From 370b26066c560f15f6a84caca2be149e48e86556 Mon Sep 17 00:00:00 2001
From: 田源 <tianyuan@vci-tech.com>
Date: 星期二, 07 一月 2025 15:52:05 +0800
Subject: [PATCH] 系统菜单 默认显示&&系统配置、对象建模按钮权限以及按钮图标

---
 Source/plt-web/plt-web-ui/src/views/system/fileCab/index.vue |  161 ++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 127 insertions(+), 34 deletions(-)

diff --git a/Source/plt-web/plt-web-ui/src/views/system/fileCab/index.vue b/Source/plt-web/plt-web-ui/src/views/system/fileCab/index.vue
index adbd870..b30aeee 100644
--- a/Source/plt-web/plt-web-ui/src/views/system/fileCab/index.vue
+++ b/Source/plt-web/plt-web-ui/src/views/system/fileCab/index.vue
@@ -2,20 +2,47 @@
   <!--鏂囦粨绠$悊椤甸潰-->
   <basic-container>
     <avue-crud
-      ref="logCrud"
+      ref="crud"
+      v-model="form"
       :data="tableData"
       :option="option"
       :table-loading="tableLoading"
       @on-load="getTableList"
       @row-save="rowSaveHandler"
       @row-update="rowUpdateHandler"
-      @row-del="rowDeleteHandler"
+      @row-click="rowClickHandler"
+      @selection-change="selectionChange"
     >
       <template slot="menuLeft" slot-scope="scope">
-        <el-button icon="el-icon-download" plain size="small" type="primary" @click="exportClickHandler">瀵煎嚭</el-button>
+        <el-button v-if="permissionList.addBtn" class="button-custom-icon" size="small" type="primary"
+                   @click="$refs.crud.rowAdd()">
+          <icon-show :name="permissionList.addBtn.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 #menu="{row,index,size}">
-        <el-button icon="el-icon-user" type="text" size="small" @click="userHandler(row,index)">鍒嗛厤鎴愬憳</el-button>
+      <template slot="menu" slot-scope="{ row, index }">
+        <el-button
+          v-if="permissionList.editBtn"
+          size="small"
+          type="text"
+          @click="handleEdit(row, index)"
+        >
+          <icon-show :name="permissionList.editBtn.source"></icon-show>
+          缂栬緫
+        </el-button>
+        <el-button
+          v-if="permissionList.delBtn"
+          size="small"
+          type="text"
+          @click="handleDel(row, index)"
+        >
+          <icon-show :name="permissionList.delBtn.source"></icon-show>
+          鍒犻櫎
+        </el-button>
       </template>
     </avue-crud>
     <!-- 鍒嗛厤鎴愬憳绌挎妗�   -->
@@ -27,91 +54,127 @@
 </template>
 
 <script>
-import {exportLog, getLogListByContion} from "@/api/system/log/logBasic";
+import {exportPvolumes, getPvolumesPage,savePvolume,updatePvolume,deletePvolume} from "@/api/system/fileCab/api";
 import func from "@/util/func";
 import basicOption from "@/util/basic-option";
-import {addUser, deleteUser, updateUser} from "@/api/system/user/api";
 import {listUserByRoleOid, listUserUnInRoleOid, saveRight} from "@/api/system/role/api";
+import {mapGetters} from "vuex";
 
 export default {
   name: "index",
   data: function () {
     return {
+      form:{},
       tableLoading: false,
       tableData: [],
-      option: {
+      currentRow:null,
+      leftRoleData: [],  // 鍒嗛厤鎴愬憳绌挎妗嗗乏渚у垵濮嬫暟鎹�
+      rightRoleData: [], // 鍒嗛厤鎴愬憳绌挎妗嗗彸渚у垵濮嬫暟鎹�
+      transferTitle: ['鏂囦欢鏌滃鎴愬憳', '鏂囦欢鏌滃唴鎴愬憳'],
+      selectionList: [],
+    }
+  },
+  computed: {
+    ids() {
+      let ids = [];
+      this.selectionList.forEach(ele => {
+        ids.push(ele.id);
+      });
+      return ids.join(",");
+    },
+    ...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),
+      };
+    },
+    option(){
+      return  {
         ...basicOption,
+        addBtn:false,
+        editBtn:false,
+        delBtn:false,
         calcHeight: -60,
         align:'left',
         headerAlign:'center',
-        menuWidth:260,
+        menuWidth:160,
         dialogMenuPosition: 'right',
         dialogWidth:600,
         column: [
           {
             label: '鍗峰悕',
-            prop: 'truename',
+            prop: 'name',
             width: 200,
             span: 24,
             rules: [{ required: true, message: '璇疯緭鍏ュ嵎鍚�', trigger: 'blur' }]
           },{
             label: '鏈嶅姟鍣�',
-            prop: 'type',
+            prop: 'host',
             span: 24,
             rules: [{ required: true, message: '璇疯緭鍏ユ湇鍔″櫒', trigger: 'blur' }]
           },{
             label: '鍗锋湇鍔�',
-            prop: 'date',
+            prop: 'service',
             span: 24,
             rules: [{ required: true, message: '璇疯緭鍏ュ嵎鏈嶅姟', trigger: 'blur' }]
           }, {
             label: '鏈哄櫒绫诲瀷',
-            prop: 'username',
+            prop: 'type',
             width: 120,
             span: 24,
             type:'radio',
             dicData:[{
               label:'Unix',
-              value:'Unix'
+              value:0
             },{
               label:'Win NT',
-              value:'Win NT'
+              value:1
             }],
-            value:'Win NT'
+            value:1
           },{
             label: '璺緞鍚嶇О',
-            prop: 'userIp',
+            prop: 'path',
             span: 24,
             overHidden: true,
             rules: [{ required: true, message: '璇疯緭鍏ヨ矾寰勫悕绉�', trigger: 'blur' }]
           },{
             label: '棣栭�夎矾寰�',
-            prop: 'loc',
+            prop: 'isvalid',
             width: 120,
             span: 24,
             type: 'switch',
-            value:false
+            value:false,
+            beforeChange: (done) => {debugger;
+              this.$confirm('鎮ㄧ‘瀹炶淇敼鍗风殑棣栭�夎矾寰勫悧锛�', '鎻愮ず', {
+                confirmButtonText: '纭畾',
+                cancelButtonText: '鍙栨秷',
+                type: 'warning'
+              }).then(() => {
+                done(true);
+              }).catch(() => {
+                done(false);
+              });
+            },
           }]
-      },
-      currentRow:null,
-      leftRoleData: [],  // 鍒嗛厤鎴愬憳绌挎妗嗗乏渚у垵濮嬫暟鎹�
-      rightRoleData: [], // 鍒嗛厤鎴愬憳绌挎妗嗗彸渚у垵濮嬫暟鎹�
-      transferTitle: ['鏂囦欢鏌滃鎴愬憳', '鏂囦欢鏌滃唴鎴愬憳'],
+      }
     }
   },
   methods: {
     // 琛ㄦ牸璇锋眰
     getTableList() {
       this.tableLoading = true;
-      getLogListByContion(1, 50, {}).then(res => {
+      getPvolumesPage().then(res => {
         this.tableData = res.data.data;
         this.tableLoading = false;
       })
     },
 
     // 鏂板
-    rowSaveHandler(row, done,loading) {
-      addUser(row).then(res => {
+    rowSaveHandler(row, done, loading) {
+      savePvolume(row).then(res => {
         if (res.data.code === 200) {
           this.$message.success(res.data.obj);
           this.getTableList();
@@ -122,9 +185,13 @@
       });
     },
 
+    handleEdit(row,index){
+      this.$refs.crud.rowEdit(row, index);
+    },
+
     // 缂栬緫
-    rowUpdateHandler(row, index, done,loading) {
-      updateUser(row).then(res => {
+    rowUpdateHandler(row, index, done, loading) {
+      updatePvolume(row).then(res => {
         if (res.data.code === 200) {
           this.$message.success(res.data.obj);
           this.getTableList();
@@ -136,7 +203,7 @@
     },
 
     // 鍒犻櫎
-    rowDeleteHandler(row) {
+    handleDel(row,index) {
       let params = {
         ids: row.id
       }
@@ -146,7 +213,7 @@
         cancelButtonText: '鍙栨秷',
         type: 'warning'
       }).then(() => {
-        deleteUser(params).then(res => {
+        deletePvolume(params).then(res => {
           if (res.data.code === 200) {
             this.$message.success(res.data.obj);
             this.getTableList();
@@ -161,8 +228,15 @@
     },
     // 瀵煎嚭
     exportClickHandler() {
+      if (this.ids == null || this.ids == "") {
+        this.$message({
+          type: 'warning',
+          message: '璇峰嬀閫夎瀵煎嚭鐨勬暟鎹�!'
+        });
+        return;
+      }
       const loading = this.$loading({});
-      exportLog().then(res => {
+      exportPvolumes({"pvolumeIds": this.ids}).then(res => {
         func.downloadFileByBlobHandler(res);
         this.createdLoading = false
         this.$message.success('瀵煎嚭鎴愬姛');
@@ -171,8 +245,8 @@
     },
 
     //鍒嗛厤鎴愬憳
-    userHandler(row,index){
-      this.currentRow=row;
+    userHandler(row, index) {
+      this.currentRow = row;
       Promise.all([
         listUserUnInRoleOid({pkRole: row.id}),
         listUserByRoleOid({pkRole: row.id})
@@ -202,6 +276,25 @@
         this.getTableList();
       })
     },
+    //閫夋嫨鐨勮
+    selectionChange(list) {
+      this.selectionList = list;
+    },
+
+    // 琛屽崟閫�
+    rowClickHandler(row) {
+      func.rowClickHandler(
+        row,
+        this.$refs.crud,
+        this.lastIndex,
+        (newIndex) => {
+          this.lastIndex = newIndex;
+        },
+        () => {
+          this.selectionList = [row];
+        }
+      );
+    },
   }
 }
 </script>

--
Gitblit v1.9.3