From 404966637eda6881a0f17683c5aacc7c1c34aed8 Mon Sep 17 00:00:00 2001
From: 田源 <tianyuan@vci-tech.com>
Date: 星期四, 16 一月 2025 16:18:34 +0800
Subject: [PATCH] 增加操作类型

---
 Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/versioning/index.vue |  348 ++++++++++++++++++++++++++++-----------------------------
 1 files changed, 170 insertions(+), 178 deletions(-)

diff --git a/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/versioning/index.vue b/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/versioning/index.vue
index 276a7f3..431e01c 100644
--- a/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/versioning/index.vue
+++ b/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/versioning/index.vue
@@ -1,122 +1,60 @@
 <template>
-  <el-container>
-    <el-aside>
-      <basic-container>
-        <div ref="TreeBox" style="height: calc(100vh - 144px);!important;">
-          <div class="headerCon">
-            <el-button icon="el-icon-plus" plain size="small" type="primary" @click="addClickHandler">鍒涘缓
-            </el-button>
-            <el-button icon="el-icon-edit" plain size="small" type="primary" @click="editClickHandler">淇敼
-            </el-button>
-            <el-button icon="el-icon-delete" plain size="small" type="danger" @click="delClickHandler">鍒犻櫎
-            </el-button>
-            <el-button icon="el-icon-download" plain size="small" type="primary" @click="exportClickHandler">瀵煎嚭
-            </el-button>
-            <el-button icon="el-icon-upload2" plain size="small" type="primary" @click="uploadClickHandler">瀵煎叆
-            </el-button>
-            <el-button class="smallBtn" plain size="small" type="primary"
-                       @click="checkViewClickHandler">鏌ョ湅浣跨敤鑼冨洿
-            </el-button>
-          </div>
-          <!-- 宸︿晶鏍�         -->
-          <div style="height:  calc(100vh - 260px);">
-            <avue-tree :data="treeData" :option="treeOption" @node-click="nodeClick">
-          <span slot-scope="{ node, data }" class="el-tree-node__label">
-           <span style="font-size: 15px">
-              <i class="el-icon-s-promotion"></i>
-                {{ (node || {}).label }}
-            </span>
-          </span>
-            </avue-tree>
-          </div>
-        </div>
-      </basic-container>
-    </el-aside>
-
-    <el-main>
-      <basic-container>
-        <el-descriptions :column="1" border class="margin-top" size="medium" title="灞炴�т俊鎭�">
-          <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
-                                :labelStyle="descriptionOption.labelStyle">
-            <template slot="label">
-              <i :class="icons.id"></i>
-              鍚嶇О
-            </template>
-            <el-tag v-if="nodeRow.id">{{ nodeRow.id }}</el-tag>
-          </el-descriptions-item>
-          <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
-                                :labelStyle="descriptionOption.labelStyle">
-            <template slot="label">
-              <i :class="icons.name"></i>
-              鏍囩
-            </template>
-            <el-tag v-if="nodeRow.name">{{ nodeRow.name }}</el-tag>
-          </el-descriptions-item>
-          <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
-                                :labelStyle="descriptionOption.labelStyle">
-            <template slot="label">
-              <i :class="icons.jump"></i>
-              璺宠穬瀛楃
-            </template>
-            <el-tag v-if="nodeRow.jumpCharacter">{{ nodeRow.jumpCharacter }}</el-tag>
-          </el-descriptions-item>
-          <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
-                                :labelStyle="descriptionOption.labelStyle">
-            <template slot="label">
-              <i :class="icons.init"></i>
-              鍒濆鍊�
-            </template>
-            <el-tag v-if="nodeRow.initialValue">{{ nodeRow.initialValue }}</el-tag>
-          </el-descriptions-item>
-          <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
-                                :labelStyle="descriptionOption.labelStyle">
-            <template slot="label">
-              <i :class="icons.length"></i>
-              姝ラ暱
-            </template>
-            <el-tag v-if="nodeRow.stepLength">{{ nodeRow.stepLength }}</el-tag>
-          </el-descriptions-item>
-          <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
-                                :labelStyle="descriptionOption.labelStyle">
-            <template slot="label">
-              <i :class="icons.left"></i>
-              鍓嶇紑
-            </template>
-            <el-tag v-if="nodeRow.prefixion">{{ nodeRow.prefixion }}</el-tag>
-          </el-descriptions-item>
-          <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
-                                :labelStyle="descriptionOption.labelStyle">
-            <template slot="label">
-              <i :class="icons.right"></i>
-              鍚庣紑
-            </template>
-            <el-tag v-if="nodeRow.suffix">{{ nodeRow.suffix }}</el-tag>
-          </el-descriptions-item>
-          <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
-                                :labelStyle="descriptionOption.labelStyle">
-            <template slot="label">
-              <i :class="icons.desc"></i>
-              鎻忚堪
-            </template>
-            <el-tag v-if="nodeRow.description">{{ nodeRow.description }}</el-tag>
-          </el-descriptions-item>
-        </el-descriptions>
-      </basic-container>
-    </el-main>
-
-    <!-- 鏂板 淇敼   -->
+  <basic-container>
+    <avue-crud
+      ref="crud"
+      :data="data"
+      :option="option"
+      :table-loading="loading"
+      @refresh-change="getTableList"
+      @selection-change="selectChange"
+      @row-click="rowClickHandler">
+      <template slot="menuLeft" slot-scope="scope">
+        <el-button v-if="permissionList.addBtn" class="button-custom-icon" plain size="small" type="primary"
+                   @click="addClickHandler">
+          <icon-show :name="permissionList.addBtn.source"></icon-show>
+          鍒涘缓
+        </el-button>
+        <el-button v-if="permissionList.viewTheScopeBtn" class="button-custom-icon" plain size="small" type="primary"
+                   @click="checkViewClickHandler">
+          <icon-show :name="permissionList.viewTheScopeBtn.source"></icon-show>
+          鏌ョ湅浣跨敤鑼冨洿
+        </el-button>
+        <el-button v-if="permissionList.importBtn" class="button-custom-icon" plain size="small" type="primary"
+                   @click="uploadClickHandler">
+          <icon-show :name="permissionList.importBtn.source"></icon-show>
+          瀵煎叆
+        </el-button>
+        <el-button v-if="permissionList.exportBtn" class="button-custom-icon" plain size="small" type="primary"
+                   @click="exportClickHandler">
+          <icon-show :name="permissionList.exportBtn.source"></icon-show>
+          瀵煎嚭
+        </el-button>
+      </template>
+      <template slot="menu" slot-scope="{row,index}">
+        <el-button v-if="permissionList.editBtn" size="small" type="text"
+                   @click="editClickHandler(row)">
+          <icon-show :name="permissionList.editBtn.source"></icon-show>
+          缂栬緫
+        </el-button>
+        <el-button v-if="permissionList.delBtn" size="small" type="text" @click="delClickHandler(row)">
+          <icon-show :name="permissionList.delBtn.source"></icon-show>
+          鍒犻櫎
+        </el-button>
+      </template>
+    </avue-crud>
+    <!-- 鏂板 淇敼 -->
     <el-dialog
       v-dialogDrag
       :title="dialogTitle === 'add' ? '鍒涘缓' : '淇敼'"
       :visible.sync="visible"
       append-to-body="true"
       class="avue-dialog"
-      width="40%"
+      width="800px"
       @close="visibleCloseHandler"
     >
-      <el-form ref="form" :model="form" :rules="rules" label-width="95px">
+      <el-form ref="form" :model="form" :rules="rules" label-width="95px" size="small">
         <el-row>
-          <el-col :span="12">
+          <el-col :span="24">
             <el-form-item label="鍚嶇О锛�" prop="id">
               <el-input v-model="form.id"></el-input>
             </el-form-item>
@@ -159,16 +97,16 @@
         </el-row>
       </el-form>
       <span slot="footer" class="dialog-footer">
-         <el-button @click="visibleCloseHandler">鍙� 娑�</el-button>
-         <el-button type="primary" @click="addSaveHandler">纭� 瀹�</el-button>
+         <el-button size="small" type="primary" @click="addSaveHandler">纭� 瀹�</el-button>
+         <el-button size="small" @click="visibleCloseHandler">鍙� 娑�</el-button>
         </span>
     </el-dialog>
 
-    <!-- 瀵煎叆    -->
+    <!-- 瀵煎叆 -->
     <upload-file ref="upload" :fileType="upFileType" :fileUrl="fileUrl" :tipList="tipList" title="瀵煎叆"
-                 @updata="getTreeList"></upload-file>
+                 @updata="getTableList"></upload-file>
 
-    <!-- 鏌ョ湅浣跨敤鑼冨洿    -->
+    <!-- 鏌ョ湅浣跨敤鑼冨洿 -->
     <el-dialog
       v-dialogDrag
       :visible.sync="checkViewVisible"
@@ -187,7 +125,7 @@
       >
       </avue-crud>
     </el-dialog>
-  </el-container>
+  </basic-container>
 </template>
 
 <script>
@@ -201,11 +139,63 @@
 } from "@/api/modeling/version/api";
 import func from "@/util/func";
 import basicOption from "@/util/basic-option";
+import {mapGetters} from "vuex";
 
 export default {
   name: "index",
   data() {
     return {
+      loading: false,
+      data: [],
+      option: {
+        ...basicOption,
+        addBtn: false,
+        editBtn: false,
+        delBtn: false,
+        calcHeight: -30,
+        column: [
+          {
+            label: '鍚嶇О',
+            prop: 'id',
+            sortable: true,
+          },
+          {
+            label: '鏍囩',
+            prop: 'name',
+            sortable: true,
+          },
+          {
+            label: '璺宠穬瀛楃',
+            prop: 'jumpCharacter',
+            sortable: true,
+          },
+          {
+            label: '鍒濆鍊�',
+            prop: 'initialValue',
+            sortable: true,
+          },
+          {
+            label: '姝ラ暱',
+            prop: 'stepLength',
+            sortable: true,
+          },
+          {
+            label: '鍓嶇紑',
+            prop: 'prefixion',
+            sortable: true,
+          },
+          {
+            label: '鍚庣紑',
+            prop: 'suffix',
+            sortable: true,
+          },
+          {
+            label: '鎻忚堪',
+            prop: 'description',
+            sortable: true,
+          },
+        ]
+      },
       checkViewVisible: false,
       checkViewData: [],
       checkViewDataSearch: [],
@@ -217,6 +207,7 @@
         searchMenuSpan: 8,
         refreshBtn: false,
         selection: false,
+        header: false,
         column: [
           {
             label: '鍚嶇О',
@@ -296,25 +287,37 @@
         right: 'el-icon-caret-right',
         desc: 'el-icon-chat-line-square'
       },
+      selectList: [],
+      lastIndex: null,
     }
   },
+  computed: {
+    ...mapGetters(["permission"]),
+    permissionList() {
+      return {
+        addBtn: this.vaildData(this.permission[this.$route.query.id].ADD, false),
+        delBtn: this.vaildData(this.permission[this.$route.query.id].DELETE, false),
+        editBtn: this.vaildData(this.permission[this.$route.query.id].EDIT, false),
+        exportBtn: this.vaildData(this.permission[this.$route.query.id].EXPORT, false),
+        importBtn: this.vaildData(this.permission[this.$route.query.id].IMPORT, false),
+        viewTheScopeBtn: this.vaildData(this.permission[this.$route.query.id].SEARCH, false),
+      };
+    },
+  },
   created() {
-    this.getTreeList();
+    this.getTableList();
   },
   methods: {
-    //宸︿晶鏍戞煡璇�
-    getTreeList() {
+    // 宸︿晶鏍戞煡璇�
+    getTableList() {
+      this.loading = true;
       getVersionRuleAllList().then(res => {
         const data = res.data.data;
-        this.treeData = data;
+        this.data = data;
+        this.loading = false;
       }).catch(err => {
         this.$message.error(err)
       });
-    },
-
-    // 宸︿晶鏍戣鐐瑰嚮
-    nodeClick(row) {
-      this.nodeRow = row;
     },
 
     // 鍒涘缓鎸夐挳
@@ -324,14 +327,10 @@
     },
 
     // 淇敼鎸夐挳
-    editClickHandler() {
-      if (func.isEmptyObject(this.nodeRow)) {
-        this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒');
-        return;
-      }
+    editClickHandler(row) {
+      this.form = {...row};
       this.visible = true;
       this.dialogTitle = 'edit';
-      this.form = this.nodeRow;
     },
 
     // 鏂板淇敼瀵硅瘽妗嗗叧闂�
@@ -359,7 +358,7 @@
           saveFunction(this.form).then(res => {
             if (res.data.code === 200) {
               this.$message.success(res.data.obj);
-              this.getTreeList();
+              this.getTableList();
               this.visible = false;
             } else {
               this.$message.error(res.data.obj);
@@ -374,22 +373,17 @@
     },
 
     // 鍒犻櫎鎸夐挳
-    delClickHandler() {
-      if (func.isEmptyObject(this.nodeRow)) {
-        this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒');
-        return;
-      }
+    delClickHandler(row) {
       this.$confirm('鎮ㄧ‘瀹氳鍒犻櫎鎵�閫夋嫨鐨勬暟鎹悧锛�', '鎻愮ず', {
         confirmButtonText: '纭畾',
         cancelButtonText: '鍙栨秷',
         type: 'warning'
       }).then(() => {
-        const list = [this.nodeRow];
+        const list = [row];
         deleteVersionRule(list).then(res => {
           if (res.data.code === 200) {
             this.$message.success(res.data.obj);
-            this.getTreeList();
-            this.nodeRow = {};
+            this.getTableList();
           }
         })
       }).catch(() => {
@@ -402,12 +396,17 @@
 
     // 瀵煎嚭
     exportClickHandler() {
-      if (func.isEmptyObject(this.nodeRow)) {
+      if (this.selectList.length <= 0) {
         this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒');
         return;
       }
 
-      exportVersionRule({vrNames: this.nodeRow.id}).then(res => {
+      if (this.selectList.length > 1) {
+        this.$message.error('鍙兘閫夋嫨涓�鏉℃暟鎹紒');
+        return;
+      }
+
+      exportVersionRule({vrNames: this.selectList[0].id}).then(res => {
         func.downloadFileByBlobHandler(res);
         this.$message.success('瀵煎嚭鎴愬姛');
       }).catch(err => {
@@ -422,11 +421,16 @@
 
     // 鏌ョ湅浣跨敤鑼冨洿
     checkViewClickHandler() {
-      if (func.isEmptyObject(this.nodeRow)) {
+      if (this.selectList.length <= 0) {
         this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒');
         return;
       }
-      getUsedVersionRuleList({vrName: this.nodeRow.id}).then(res => {
+
+      if (this.selectList.length > 1) {
+        this.$message.error('鍙兘閫夋嫨涓�鏉℃暟鎹紒');
+        return;
+      }
+      getUsedVersionRuleList({vrName: this.selectList[0].id}).then(res => {
         if (res.data.code === 200) {
           this.checkViewVisible = true;
           const data = res.data.data;
@@ -444,7 +448,6 @@
         this.checkViewData = this.checkViewDataSearch;
         return done();
       }
-      ;
 
       this.checkViewData = this.checkViewDataSearch.filter(item => {
         return item.source && item.source.includes(source);
@@ -458,6 +461,27 @@
     checkHandleReset() {
       this.checkViewData = this.checkViewDataSearch;
     },
+
+    // 閫夋嫨妗�
+    selectChange(row) {
+      this.selectList = row;
+    },
+
+    // 鐐瑰嚮琛�
+    rowClickHandler(row) {
+      func.rowClickHandler(
+        row,
+        this.$refs.crud,
+        this.lastIndex,
+        (newIndex) => {
+          this.lastIndex = newIndex;
+        },
+        () => {
+          this.selectList = [row];
+        }
+      );
+    },
+
   }
 }
 </script>
@@ -468,40 +492,8 @@
     overflow: auto !important;
   }
 
-  .headerCon {
-    .el-button {
-      width: 82px;
-    }
-  }
-
-}
-
-.headerCon {
-  display: flex;
-  flex-wrap: wrap;
-  margin-bottom: 5px;
-
-  .el-button + .el-button {
-    margin-left: 5px;
-  }
-
-  .el-button {
-    margin-top: 5px;
+  .el-input-number--small {
+    width: 100%;
   }
 }
-
-.headerCon > .el-button:nth-child(4) {
-  margin-left: 0;
-}
-
-.headerCon > .el-button:nth-child(7) {
-  margin-left: 0;
-}
-
-.smallBtn {
-  width: 82px;
-  text-align: center;
-  padding-left: 4.5px;
-}
-
 </style>

--
Gitblit v1.9.3