From e358d69fc18870584dd2d9f531910b7838ea27d9 Mon Sep 17 00:00:00 2001 From: wangting <wangting@vci-tech.com> Date: 星期四, 02 一月 2025 09:58:53 +0800 Subject: [PATCH] 调整行点击后的回调 --- Source/plt-web/plt-web-ui/src/views/system/fileCab/index.vue | 79 +++++++++++++++++++++++++++++++++------ 1 files changed, 66 insertions(+), 13 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 b0427c1..3f47257 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,7 +2,7 @@ <!--鏂囦粨绠$悊椤甸潰--> <basic-container> <avue-crud - ref="logCrud" + ref="crud" v-model="form" :data="tableData" :option="option" @@ -11,9 +11,11 @@ @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.exportBtn" icon="el-icon-download" plain size="small" type="primary" @click="exportClickHandler">瀵煎嚭</el-button> </template> <!--<template #menu="{row,index,size}"> <el-button icon="el-icon-user" type="text" size="small" @click="userHandler(row,index)">鍒嗛厤鎴愬憳</el-button> @@ -32,6 +34,7 @@ import func from "@/util/func"; import basicOption from "@/util/basic-option"; import {listUserByRoleOid, listUserUnInRoleOid, saveRight} from "@/api/system/role/api"; +import {mapGetters} from "vuex"; export default { name: "index", @@ -40,8 +43,36 @@ 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:this.permissionList.addBtn, + editBtn:this.permissionList.editBtn, + delBtn:this.permissionList.delBtn, calcHeight: -60, align:'left', headerAlign:'center', @@ -104,11 +135,7 @@ }); }, }] - }, - currentRow:null, - leftRoleData: [], // 鍒嗛厤鎴愬憳绌挎妗嗗乏渚у垵濮嬫暟鎹� - rightRoleData: [], // 鍒嗛厤鎴愬憳绌挎妗嗗彸渚у垵濮嬫暟鎹� - transferTitle: ['鏂囦欢鏌滃鎴愬憳', '鏂囦欢鏌滃唴鎴愬憳'], + } } }, methods: { @@ -122,7 +149,7 @@ }, // 鏂板 - rowSaveHandler(row, done,loading) { + rowSaveHandler(row, done, loading) { savePvolume(row).then(res => { if (res.data.code === 200) { this.$message.success(res.data.obj); @@ -135,7 +162,7 @@ }, // 缂栬緫 - rowUpdateHandler(row, index, done,loading) { + rowUpdateHandler(row, index, done, loading) { updatePvolume(row).then(res => { if (res.data.code === 200) { this.$message.success(res.data.obj); @@ -173,8 +200,15 @@ }, // 瀵煎嚭 exportClickHandler() { + if (this.ids == null || this.ids == "") { + this.$message({ + type: 'warning', + message: '璇峰嬀閫夎瀵煎嚭鐨勬暟鎹�!' + }); + return; + } const loading = this.$loading({}); - exportPvolumes().then(res => { + exportPvolumes({"pvolumeIds": this.ids}).then(res => { func.downloadFileByBlobHandler(res); this.createdLoading = false this.$message.success('瀵煎嚭鎴愬姛'); @@ -183,8 +217,8 @@ }, //鍒嗛厤鎴愬憳 - userHandler(row,index){ - this.currentRow=row; + userHandler(row, index) { + this.currentRow = row; Promise.all([ listUserUnInRoleOid({pkRole: row.id}), listUserByRoleOid({pkRole: row.id}) @@ -214,6 +248,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