From 03e602bbaee807c42a22df05f1f00c558ffe9fa0 Mon Sep 17 00:00:00 2001
From: 田源 <tianyuan@vci-tech.com>
Date: 星期一, 13 一月 2025 17:27:19 +0800
Subject: [PATCH] 首页跳转日志bug
---
Source/plt-web/plt-web-ui/src/views/system/role/index.vue | 181 ++++++++++++++++++++++++++++++++-------------
1 files changed, 129 insertions(+), 52 deletions(-)
diff --git a/Source/plt-web/plt-web-ui/src/views/system/role/index.vue b/Source/plt-web/plt-web-ui/src/views/system/role/index.vue
index f757b48..a32d588 100644
--- a/Source/plt-web/plt-web-ui/src/views/system/role/index.vue
+++ b/Source/plt-web/plt-web-ui/src/views/system/role/index.vue
@@ -14,15 +14,62 @@
@row-click="rowClickHandler"
@row-save="rowSaveHandler"
@row-update="rowUpdateHandler"
- @row-del="rowDeleteHandler"
>
<template slot="menuLeft" slot-scope="scope">
- <el-button icon="el-icon-delete" plain size="small" type="danger" @click="allDelHandler">鍒犻櫎</el-button>
- <el-button icon="el-icon-school" plain size="small" type="primary" @click="assignMembersHandler">鍒嗛厤鎴愬憳
+ <el-button v-if="permissionList.addBtn" class="button-custom-icon" size="small" type="primary"
+ @click="$refs.roleCrud.rowAdd()">
+ <icon-show :name="permissionList.addBtn.source"></icon-show>
+ 鏂� 澧�
</el-button>
- <el-button icon="el-icon-user" plain size="small" type="primary" @click="statisticsHandler">缁熻</el-button>
- <el-button icon="el-icon-upload2" plain size="small" type="primary" @click="upLoadRole">瀵煎叆瑙掕壊</el-button>
- <el-button icon="el-icon-download" plain size="small" type="primary">瀵煎嚭</el-button>
+ <el-button v-if="permissionList.delBtn" class="button-custom-icon" plain size="small" type="danger"
+ @click="allDelHandler">
+ <icon-show :name="permissionList.delBtn.source"></icon-show>
+ 鍒犻櫎
+ </el-button>
+ <el-button v-if="permissionList.statisticsBtn" class="button-custom-icon" plain size="small" type="primary"
+ @click="statisticsHandler">
+ <icon-show :name="permissionList.statisticsBtn.source"></icon-show>
+ 缁熻
+ </el-button>
+ <el-button v-if="permissionList.importRoleBtn" class="button-custom-icon" plain size="small" type="primary"
+ @click="upLoadRole">
+ <icon-show :name="permissionList.importRoleBtn.source"></icon-show>
+ 瀵煎叆瑙掕壊
+ </el-button>
+ <el-button v-if="permissionList.exportBtn" class="button-custom-icon" plain size="small" type="primary">
+ <icon-show :name="permissionList.exportBtn.source"></icon-show>
+ 瀵煎嚭
+ </el-button>
+ </template>
+
+ <template slot="menu" slot-scope="{ row, index }">
+ <el-button
+ v-if="permissionList.assignMembersBtn"
+ size="small"
+ type="text"
+ @click="assignMembersHandler(row, index)"
+ >
+ <icon-show :name="permissionList.assignMembersBtn.source"></icon-show>
+ 鍒嗛厤鎴愬憳
+ </el-button>
+ <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>
<template slot="roleClassifyText" slot-scope="{row}">
@@ -30,7 +77,7 @@
</template>
</avue-crud>
- <!-- 鍒嗛厤瑙掕壊绌挎妗� -->
+ <!-- 鍒嗛厤鎴愬憳绌挎妗� -->
<transfer ref="transfer" :left-role-data="leftRoleData" :right-role-data="rightRoleData"
:transferTitle="transferTitle" title="瑙掕壊娣诲姞鎴愬憳"
@transferSend="roleSendHandler">
@@ -40,7 +87,6 @@
<el-dialog
v-dialogDrag
v-loading="statisticsLoading"
- :destroy-on-close="true"
:visible.sync="statisticsVisible"
append-to-body="true"
class="avue-dialog"
@@ -54,14 +100,15 @@
</avue-crud>
<div slot="footer" class="dialog-footer" style="display: flex;gap: 20px;justify-content: center">
<div>
- <el-tag>褰撳墠瑙掕壊鎬讳汉鏁�: {{this.countData.length}}</el-tag>
+ <el-tag>褰撳墠瑙掕壊鎬讳汉鏁�: {{ this.countData.length }}</el-tag>
</div>
- <el-button size="small" @click="statisticsVisible = false" icon="el-icon-close" type="danger">鍏� 闂�</el-button>
+ <el-button icon="el-icon-close" size="small" type="danger" @click="statisticsVisible = false">鍏� 闂�</el-button>
</div>
</el-dialog>
<!-- 瀵煎叆瑙掕壊 -->
- <upload-file ref="upload" :tipList="tipList" :fileType="upFileType" :fileUrl="fileUrl" @updata="getTableList" title="瀵煎叆瑙掕壊"></upload-file>
+ <upload-file ref="upload" :fileType="upFileType" :fileUrl="fileUrl" :tipList="tipList" title="瀵煎叆瑙掕壊"
+ @updata="getTableList"></upload-file>
</basic-container>
</template>
@@ -78,19 +125,14 @@
} from '@/api/system/role/api'
import basicOption from "@/util/basic-option";
import {column} from "@/views/system/role/option";
+import func from "@/util/func";
+import {mapGetters} from "vuex";
export default {
name: "index",
data() {
return {
tableData: [],
- option: {
- ...basicOption,
- dialogTop: 0,
- dialogWidth: '30%',
- calcHeight: -60,
- column: column
- },
page: {
currentPage: 1,
pageSize: 10,
@@ -108,10 +150,11 @@
countData: [],
countOption: {
...basicOption,
- selection:false,
+ selection: false,
refreshBtn: false,
- addBtn:false,
- menu:false,
+ addBtn: false,
+ menu: false,
+ header: false,
column: [
{
label: '閮ㄩ棬',
@@ -138,7 +181,33 @@
},
upFileType: ['xls', 'xlsx'],
fileUrl: 'api/roleQueryController/importRole',
- tipList:["瑙掕壊瀵煎叆鍙湁 鍚嶇О 鍜� 鎻忚堪 涓ゅ垪锛屼笖鍚嶇О涓哄繀杈撻」涓嶈兘涓虹┖"]
+ tipList: ["瑙掕壊瀵煎叆鍙湁 鍚嶇О 鍜� 鎻忚堪 涓ゅ垪锛屼笖鍚嶇О涓哄繀杈撻」涓嶈兘涓虹┖"]
+ }
+ },
+ 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),
+ assignMembersBtn: this.vaildData(this.permission[this.$route.query.id].FREEZE, false),
+ importRoleBtn: this.vaildData(this.permission[this.$route.query.id].IMPORT, false),
+ statisticsBtn: this.vaildData(this.permission[this.$route.query.id].DISCARD, false),
+ };
+ },
+ option() {
+ return {
+ ...basicOption,
+ addBtn: false,
+ delBtn: false,
+ editBtn: false,
+ dialogTop: 0,
+ dialogWidth: '30%',
+ column: column,
+ calcHeight: -60,
+ }
}
},
methods: {
@@ -151,6 +220,11 @@
this.page.total = res.data.total;
this.tableLoading = false;
})
+ },
+
+ // 缂栬緫鎸夐挳
+ handleEdit(row, index) {
+ this.$refs.roleCrud.rowEdit(row, index);
},
// 鍒楀ご鍒锋柊
@@ -175,27 +249,36 @@
// 琛屽崟閫�
rowClickHandler(row) {
- this.$refs.roleCrud.toggleRowSelection(row);
+ func.rowClickHandler(
+ row,
+ this.$refs.roleCrud,
+ this.lastIndex,
+ (newIndex) => {
+ this.lastIndex = newIndex;
+ },
+ () => {
+ this.selectList = [row];
+ }
+ );
},
// 娣诲姞
- rowSaveHandler(row, done,loading) {
+ rowSaveHandler(row, done, loading) {
delete row.roleClassifyText;
addRole(row).then(res => {
- console.log(res)
if (res.data.code === 200) {
this.$message.success(res.data.obj);
this.getTableList();
done();
}
- }).catch(err =>{
+ }).catch(err => {
console.log(err);
loading();
})
},
// 缂栬緫
- rowUpdateHandler(row, index, done,loading) {
+ rowUpdateHandler(row, index, done, loading) {
delete row.roleClassifyText;
updateRole(row).then(res => {
if (res.data.code === 200) {
@@ -205,12 +288,11 @@
}
}).catch(err => {
loading();
- console.log(err);
});
},
// 鍒犻櫎
- rowDeleteHandler(row) {
+ handleDel(row, index) {
let params = {
ids: row.oid
}
@@ -263,20 +345,22 @@
},
// 鍒嗛厤鎴愬憳
- assignMembersHandler() {
- if (this.selectList.length <= 0) {
- this.$message.warning('璇烽�夋嫨瑙掕壊杩涜鎴愬憳鍒嗛厤锛�');
- return;
- }
-
- if (this.selectList.length > 1) {
- this.$message.warning('涓�娆″彧鑳藉涓�涓鑹茶繘琛屽垎閰嶆垚鍛樻搷浣滐紒');
- return;
- }
+ assignMembersHandler(row,index) {
+ // if (this.selectList.length <= 0) {
+ // this.$message.warning('璇烽�夋嫨瑙掕壊杩涜鎴愬憳鍒嗛厤锛�');
+ // return;
+ // }
+ //
+ // if (this.selectList.length > 1) {
+ // this.$message.warning('涓�娆″彧鑳藉涓�涓鑹茶繘琛屽垎閰嶆垚鍛樻搷浣滐紒');
+ // return;
+ // }
Promise.all([
- listUserUnInRoleOid({pkRole: this.selectList[0].oid}),
- listUserByRoleOid({pkRole: this.selectList[0].oid})
+ listUserUnInRoleOid({pkRole: row.oid}),
+ listUserByRoleOid({pkRole: row.oid})
]).then(([unInRoleRes, byRoleRes]) => {
+ this.leftRoleData = [];
+ this.rightRoleData = [];
if (unInRoleRes.data.code === 200 && byRoleRes.data.code === 200) {
const leftData = [...unInRoleRes.data.data, ...byRoleRes.data.data];
// 缁勮濂界┛姊鍙敤鏁版嵁
@@ -289,8 +373,6 @@
this.rightRoleData = byRoleRes.data.data.map(item => item.oid);
this.$refs.transfer.visible = true;
}
- }).catch(err => {
- console.error(err);
});
},
@@ -304,8 +386,6 @@
saveRight(params).then(res => {
this.$message.success(res.data.obj);
this.getTableList();
- }).catch(err => {
- this.$message.error(err)
})
},
@@ -321,26 +401,23 @@
return;
}
listUserByRoleOid({pkRole: this.selectList[0].oid}).then(res => {
- console.log(res)
if (res.data.code === 200) {
const data = res.data.data;
this.countData = data.map(item => {
return {
pkDepartmentName: item.pkDepartmentName,
- name:item.name,
- id:item.id,
- pkPersonName:this.selectList[0].name
+ name: item.name,
+ id: item.id,
+ pkPersonName: this.selectList[0].name
}
});
this.statisticsVisible = true;
}
- }).catch(err => {
- console.log(err)
})
},
// 瀵煎叆瑙掕壊
- upLoadRole(){
+ upLoadRole() {
this.$refs.upload.visible = true;
}
}
--
Gitblit v1.9.3