From d186b4d37394e4816e0f271fcced4d06b3069454 Mon Sep 17 00:00:00 2001 From: 田源 <lastanimals@163.com> Date: 星期一, 16 十二月 2024 15:31:28 +0800 Subject: [PATCH] 路由query添加当前页面id&&人员组织管理模块下所有页面按钮权限控制 --- Source/plt-web/plt-web-ui/src/views/system/role/index.vue | 66 ++++++++-- Source/plt-web/plt-web-ui/src/views/system/user/index.vue | 70 ++++++++--- Source/plt-web/plt-web-ui/src/page/index/sidebar/sidebarItem.vue | 6 Source/plt-web/plt-web-ui/src/views/system/department/index.vue | 52 ++++++-- Source/plt-web/plt-web-ui/src/views/system/password/index.vue | 59 ++++++--- Source/plt-web/plt-web-ui/src/store/modules/user.js | 7 Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/enumType/index.vue | 33 +++- Source/plt-web/plt-web-ui/src/api/user.js | 9 + 8 files changed, 217 insertions(+), 85 deletions(-) diff --git a/Source/plt-web/plt-web-ui/src/api/user.js b/Source/plt-web/plt-web-ui/src/api/user.js index 7fb72ed..f66c597 100644 --- a/Source/plt-web/plt-web-ui/src/api/user.js +++ b/Source/plt-web/plt-web-ui/src/api/user.js @@ -45,4 +45,11 @@ params }); } - +// 鎸夐挳鏉冮檺鎺ュ彛 +export function getButtons(params) { + return request({ + url: "/api/smFunctionController/getAllButtons", + method: "get", + params + }); +} diff --git a/Source/plt-web/plt-web-ui/src/page/index/sidebar/sidebarItem.vue b/Source/plt-web/plt-web-ui/src/page/index/sidebar/sidebarItem.vue index 170ffa4..1d0f1ee 100644 --- a/Source/plt-web/plt-web-ui/src/page/index/sidebar/sidebarItem.vue +++ b/Source/plt-web/plt-web-ui/src/page/index/sidebar/sidebarItem.vue @@ -125,6 +125,10 @@ } }, open(item) { + const query = { + ...item.query, + id:item.id + } if (this.screen <= 1) this.$store.commit("SET_COLLAPSE"); if (this.validIsOpen(item)) { window.open(item[this.pathKey]); @@ -136,7 +140,7 @@ name: item[this.labelKey], src: item[this.pathKey] }, item.meta), - query: item.query + query: query }); } } diff --git a/Source/plt-web/plt-web-ui/src/store/modules/user.js b/Source/plt-web/plt-web-ui/src/store/modules/user.js index da2ef54..8e1fbc3 100644 --- a/Source/plt-web/plt-web-ui/src/store/modules/user.js +++ b/Source/plt-web/plt-web-ui/src/store/modules/user.js @@ -17,7 +17,7 @@ label: propsConfig.label || 'name', path: propsConfig.path || 'path', icon: propsConfig.icon || 'icon', - children: propsConfig.children || 'children' + children: propsConfig.children || 'children', } const icon = ele[propsDefault.icon]; ele[propsDefault.icon] = validatenull(icon) ? menu.iconDefault : icon; @@ -232,7 +232,7 @@ commit('SET_MENU_ALL', menu) commit('SET_MENU', menu) - //dispatch('GetButtons');s + dispatch('GetButtons'); resolve(menu) }) }) @@ -244,6 +244,7 @@ return new Promise((resolve) => { getButtons().then(res => { const data = res.data.data; + console.log('getButton',data) commit('SET_PERMISSION', data); resolve(); }) @@ -305,7 +306,7 @@ Vue.set(children, child.code, true); }); } - Vue.set(permission_new, item.code, children); + Vue.set(permission_new, item.id, children); }); state.permission = permission_new; setStore({name: "permission", content: permission_new}); diff --git a/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/enumType/index.vue b/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/enumType/index.vue index 35b0974..ad24449 100644 --- a/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/enumType/index.vue +++ b/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/enumType/index.vue @@ -44,7 +44,7 @@ width="1000px" @close="dialogClose" > - <el-form ref="form" :model="form" :rules="rules" size="small" label-width="100px"> + <el-form ref="form" :model="form" :rules="rules" label-width="100px" size="small"> <el-row> <el-col :span="12"> <el-form-item label="鏋氫妇鍚嶇О锛�" prop="id"> @@ -66,7 +66,8 @@ </el-col> <el-col :span="12"> <el-form-item label="闀垮害锛�"> - <el-input-number v-model="form.length" :max="999" :min="1" label="鎻忚堪鏂囧瓧" style="width: 376px;"></el-input-number> + <el-input-number v-model="form.length" :max="999" :min="1" label="鎻忚堪鏂囧瓧" + style="width: 376px;"></el-input-number> </el-form-item> </el-col> <el-col :span="24"> @@ -105,7 +106,6 @@ @search-change="checkHandleSearch" @search-reset="checkHandleReset" > - </avue-crud> </el-dialog> @@ -117,7 +117,8 @@ <el-aside width="35%"> <basic-container> - <el-descriptions :column="1" border size="medium" style="margin-bottom: 20px" title="鏋氫妇淇℃伅" :labelStyle="{width:'150px'}"> + <el-descriptions :column="1" :labelStyle="{width:'150px'}" border size="medium" style="margin-bottom: 20px" + title="鏋氫妇淇℃伅"> <el-descriptions-item> <template slot="label"> 鍚嶇О @@ -168,6 +169,7 @@ downloadEnumTemplate } from "@/api/modeling/enumType/api"; import func from "@/util/func"; +import {mapGetters} from "vuex"; import {deleteUser} from "@/api/system/user/api"; export default { @@ -182,7 +184,7 @@ refreshBtn: false, selection: false, index: false, - header:false, + header: false, calcHeight: -40, column: [ { @@ -247,13 +249,13 @@ calcHeight: 50, refreshBtn: false, selection: false, - dialogWidth:500, + dialogWidth: 500, column: [ { label: '鏋氫妇椤瑰悕', prop: 'name', sortable: true, - span:24, + span: 24, rules: [ { required: true, @@ -266,7 +268,7 @@ label: '鏋氫妇鍊�', prop: 'value', sortable: true, - span:24, + span: 24, rules: [ { required: true, @@ -278,7 +280,7 @@ { label: '鎻忚堪', prop: 'description', - span:24 + span: 24 }, ] }, @@ -304,7 +306,7 @@ addBtn: false, editBtn: false, delBtn: false, - menuWidth:160, + menuWidth: 160, column: [ { label: '鏋氫妇鍚嶇О', @@ -321,7 +323,7 @@ label: '杩斿洖绫诲瀷', prop: 'enumValueDataTypeText', sortable: true, - width:130 + width: 130 } ] }, @@ -331,7 +333,16 @@ lastIndex: null } }, + created() { + console.log(this.$route); + }, computed: { + ...mapGetters(["permission"]), + permissionList() { + return { + viewBtn: this.vaildData(this.permission[this.$route.query.id].VIEW, false), + }; + }, lastItem() { return this.selectList.length > 0 ? this.selectList[this.selectList.length - 1] : {}; }, diff --git a/Source/plt-web/plt-web-ui/src/views/system/department/index.vue b/Source/plt-web/plt-web-ui/src/views/system/department/index.vue index 5059528..6f712df 100644 --- a/Source/plt-web/plt-web-ui/src/views/system/department/index.vue +++ b/Source/plt-web/plt-web-ui/src/views/system/department/index.vue @@ -15,21 +15,32 @@ @current-row-change="handleCurrentRowChange" > <template slot="menu" slot-scope="{row,size,type}"> - <el-button icon="el-icon-circle-plus-outline" size="small" type="text" @click="handleAdd()">鏂板瀛愮骇</el-button> - <el-button v-if="row.ALLDept !== 'ALLDept'" icon="el-icon-edit" size="small" type="text" + <el-button v-if="permissionList.departmentAddChildrenBtn" icon="el-icon-circle-plus-outline" size="small" + type="text" @click="handleAdd()">鏂板瀛愮骇 + </el-button> + <el-button v-if="row.ALLDept !== 'ALLDept' && permissionList.editBtn" icon="el-icon-edit" size="small" + type="text" @click="editBtnClick(row)">缂栬緫 </el-button> - <el-button v-if="row.ALLDept !== 'ALLDept'" icon="el-icon-delete" size="small" type="text" + <el-button v-if="row.ALLDept !== 'ALLDept' && permissionList.delBtn" icon="el-icon-delete" size="small" + type="text" @click="rowDeleteHandler(row)">鍒犻櫎 </el-button> </template> <template slot="menuLeft" slot-scope="scope"> - <el-button icon="el-icon-school" plain size="small" type="primary" @click="assignMembersHandler">鍒嗛厤鎴愬憳 + <el-button v-if="permissionList.assignMembersBtn" icon="el-icon-school" plain size="small" type="primary" + @click="assignMembersHandler">鍒嗛厤鎴愬憳 </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="upLoadHandler">瀵煎叆閮ㄩ棬</el-button> - <el-button icon="el-icon-download" plain size="small" type="primary" @click="downLoadHandler">涓嬭浇瀵煎叆妯℃澘</el-button> + <el-button v-if="permissionList.statisticsBtn" icon="el-icon-user" plain size="small" type="primary" + @click="statisticsHandler">缁熻 + </el-button> + <el-button v-if="permissionList.importDepartmentBtn" icon="el-icon-upload2" plain size="small" type="primary" + @click="upLoadHandler">瀵煎叆閮ㄩ棬 + </el-button> + <el-button v-if="permissionList.downloadImportTemplateBtn" icon="el-icon-download" plain size="small" + type="primary" @click="downLoadHandler">涓嬭浇瀵煎叆妯℃澘 + </el-button> </template> </avue-crud> @@ -85,6 +96,7 @@ import basicOption from '@/util/basic-option'; import {column} from './option' import func from "@/util/func"; +import {mapGetters} from "vuex"; export default { name: "departmentManage", @@ -95,13 +107,13 @@ ...basicOption, rowKey: 'oid', rowParentKey: 'parentId', - expandRowKeys:[], + expandRowKeys: [], selection: false, addBtn: false, editBtn: false, delBtn: false, gridBtn: false, - menuWidth:280, + menuWidth: 280, highlightCurrentRow: true, calcHeight: -50, column: column @@ -117,9 +129,9 @@ selection: false, refreshBtn: false, addBtn: false, - header :false, + header: false, menu: false, - calcHeight:80, + calcHeight: 80, column: [ { label: '閮ㄩ棬', @@ -152,12 +164,26 @@ fileUrl: 'api/departmentQueryController/importDept', } }, + computed: { + ...mapGetters(["permission"]), + permissionList() { + return { + delBtn: this.vaildData(this.permission[this.$route.query.id].DELETE, false), + editBtn: this.vaildData(this.permission[this.$route.query.id].EDIT, false), + assignMembersBtn: this.vaildData(this.permission[this.$route.query.id].assignMembers, false), + departmentAddChildrenBtn: this.vaildData(this.permission[this.$route.query.id].departmentAddChildren, false), + downloadImportTemplateBtn: this.vaildData(this.permission[this.$route.query.id].downloadImportTemplate, false), + importDepartmentBtn: this.vaildData(this.permission[this.$route.query.id].importDepartment, false), + statisticsBtn: this.vaildData(this.permission[this.$route.query.id].statistics, false), + }; + }, + }, methods: { // 琛ㄦ牸鍒濆鍖栬姹� getTableList() { refTree({queryAllLevel: true, 'extandParamsMap[showAllDepartmentNode]': true}).then(res => { this.tableData = this.departDtaFormAtter(res.data.treeData); - this.option.expandRowKeys=[res.data.treeData[0].oid]; + this.option.expandRowKeys = [res.data.treeData[0].oid]; }) }, @@ -166,7 +192,7 @@ return items.map(item => { // 杞崲褰撳墠鑺傜偣鐨勫睘鎬� const formList = { - expanded:item.expanded, + expanded: item.expanded, oid: item.oid, id: item.attributes.id, name: item.attributes.name, diff --git a/Source/plt-web/plt-web-ui/src/views/system/password/index.vue b/Source/plt-web/plt-web-ui/src/views/system/password/index.vue index 99b37e2..a621b37 100644 --- a/Source/plt-web/plt-web-ui/src/views/system/password/index.vue +++ b/Source/plt-web/plt-web-ui/src/views/system/password/index.vue @@ -16,6 +16,7 @@ > <template slot="menu" slot-scope="{ row, index }"> <el-button + v-if="permissionList.editBtn" icon="el-icon-edit" size="small" type="text" @@ -24,6 +25,7 @@ 缂栬緫 </el-button> <el-button + v-if="permissionList.delBtn" icon="el-icon-delete" size="small" type="text" @@ -49,6 +51,7 @@ <script> import {refDataGrid, deleteDep, addDept, updatePasswordStrateg} from "@/api/system/password/api" import basicOption from "@/util/basic-option"; +import {mapGetters} from "vuex"; export default { name: "index", @@ -56,8 +59,37 @@ return { form: {}, tableData: [], - option: { + page: { + currentPage: 1, + pageSize: 10, + total: 0, + pageSizes: [10, 30, 50, 100], + }, + tableLoading: false, + checkboxlength: "", // 娣诲姞瀛樻斁澶氶�夌殑鍙橀噺,鐢ㄤ簬涓嬫媺鑿滃崟鐨勭鐢ㄦ晥鏋滃拰蹇呭~绉嶇被鏄惁澶т簬缁勫悎鏂瑰紡鐒跺悗鎻愮ず鐢ㄦ埛閲嶆柊閫夋嫨 + selectlength: 0, // 涓嬫媺鑿滃崟鐨勬暟鎹彉閲� + checkboxlist: "", // 鐢ㄤ簬闃叉change鏃堕棿鍐掓场,鍑虹幇涓ゆ寮圭獥瀹氫箟鐨勫彉閲� + checkboxNumber: "", // 鐢ㄤ簬棣栨鐐瑰嚮缂栬緫锛屽垽鏂粍鍚堟柟寮忔槸鍚﹀皬浜庡繀濉绫荤殑鍙橀噺 + selectNumber: "", // 瀛樻斁澶氶�夌殑鍙橀噺,鏁堟灉涓�鏍�,鍙槸鐢ㄤ綔鍦ㄧ紪杈戞ā鍧� + checkboxedit: "", // 鐢ㄤ簬鍒ゆ柇鏄惁鏄紪杈� + editFlag: false, + minValue: "", // 鏈�灏忛暱搴alue + maxValue: "" // 鏈�澶ч暱搴alue + } + }, + computed: { + ...mapGetters(["permission"]), + permissionList() { + return { + addBtn: this.vaildData(this.permission[this.$route.query.id].ADD, false), + editBtn: this.vaildData(this.permission[this.$route.query.id].EDIT, false), + delBtn: this.vaildData(this.permission[this.$route.query.id].DELETE, false), + }; + }, + option() { + return { ...basicOption, + addBtn: this.permissionList.addBtn, selection: false, menuWidth: 150, editBtn: false, @@ -298,28 +330,13 @@ }] }, ] - }, - page: { - currentPage: 1, - pageSize: 10, - total: 0, - pageSizes: [10, 30, 50, 100], - }, - tableLoading: false, - checkboxlength: "", // 娣诲姞瀛樻斁澶氶�夌殑鍙橀噺,鐢ㄤ簬涓嬫媺鑿滃崟鐨勭鐢ㄦ晥鏋滃拰蹇呭~绉嶇被鏄惁澶т簬缁勫悎鏂瑰紡鐒跺悗鎻愮ず鐢ㄦ埛閲嶆柊閫夋嫨 - selectlength: 0, // 涓嬫媺鑿滃崟鐨勬暟鎹彉閲� - checkboxlist: "", // 鐢ㄤ簬闃叉change鏃堕棿鍐掓场,鍑虹幇涓ゆ寮圭獥瀹氫箟鐨勫彉閲� - checkboxNumber: "", // 鐢ㄤ簬棣栨鐐瑰嚮缂栬緫锛屽垽鏂粍鍚堟柟寮忔槸鍚﹀皬浜庡繀濉绫荤殑鍙橀噺 - selectNumber: "", // 瀛樻斁澶氶�夌殑鍙橀噺,鏁堟灉涓�鏍�,鍙槸鐢ㄤ綔鍦ㄧ紪杈戞ā鍧� - checkboxedit: "", // 鐢ㄤ簬鍒ゆ柇鏄惁鏄紪杈� - editFlag: false, - minValue: "", // 鏈�灏忛暱搴alue - maxValue: "" // 鏈�澶ч暱搴alue + } } }, methods: { // 琛ㄦ牸鍒濆鍖栬姹� getTableList() { + console.log(this.$route) this.tableLoading = true; refDataGrid(this.page.currentPage, this.page.pageSize).then(res => { this.tableData = res.data.data; @@ -368,7 +385,7 @@ }, // 淇敼 - rowUpdateHandler(row, index, done,loading) { + rowUpdateHandler(row, index, done, loading) { row.combinations = row.requireCharType; delete row.requireCharType; updatePasswordStrateg(row).then(res => { @@ -433,8 +450,8 @@ this.form.requireCharCount = ""; } } - }else { - this.form.requireCharCount = ""; + } else { + this.form.requireCharCount = ""; } // 澶勭悊 蹇呭~绉嶇被閫夐」绂佺敤 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 9858341..55308b2 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 @@ -17,12 +17,20 @@ @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.delBtn" icon="el-icon-delete" plain size="small" type="danger" + @click="allDelHandler">鍒犻櫎 </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.assignMembersBtn" icon="el-icon-school" plain size="small" type="primary" + @click="assignMembersHandler">鍒嗛厤鎴愬憳 + </el-button> + <el-button v-if="permissionList.statisticsBtn" icon="el-icon-user" plain size="small" type="primary" + @click="statisticsHandler">缁熻 + </el-button> + <el-button v-if="permissionList.importRoleBtn" icon="el-icon-upload2" plain size="small" type="primary" + @click="upLoadRole">瀵煎叆瑙掕壊 + </el-button> + <el-button v-if="permissionList.exportBtn" icon="el-icon-download" plain size="small" type="primary">瀵煎嚭 + </el-button> </template> <template slot="roleClassifyText" slot-scope="{row}"> @@ -79,19 +87,13 @@ 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%', - column: column, - calcHeight: -60, - }, page: { currentPage: 1, pageSize: 10, @@ -113,7 +115,7 @@ refreshBtn: false, addBtn: false, menu: false, - header:false, + header: false, column: [ { label: '閮ㄩ棬', @@ -141,6 +143,32 @@ upFileType: ['xls', 'xlsx'], fileUrl: 'api/roleQueryController/importRole', 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].assignMembers, false), + importRoleBtn: this.vaildData(this.permission[this.$route.query.id].importRole, false), + statisticsBtn: this.vaildData(this.permission[this.$route.query.id].statistics, false), + }; + }, + option() { + return { + ...basicOption, + addBtn: this.permissionList.addBtn, + delBtn: this.permissionList.delBtn, + editBtn: this.permissionList.editBtn, + dialogTop: 0, + dialogWidth: '30%', + column: column, + calcHeight: -60, + } } }, methods: { @@ -181,8 +209,12 @@ row, this.$refs.roleCrud, this.lastIndex, - (newIndex) => { this.lastIndex = newIndex; }, - () => { this.selectList = [row]; } + (newIndex) => { + this.lastIndex = newIndex; + }, + () => { + this.selectList = [row]; + } ); }, @@ -283,8 +315,8 @@ listUserUnInRoleOid({pkRole: this.selectList[0].oid}), listUserByRoleOid({pkRole: this.selectList[0].oid}) ]).then(([unInRoleRes, byRoleRes]) => { - this.leftRoleData=[]; - this.rightRoleData=[]; + this.leftRoleData = []; + this.rightRoleData = []; if (unInRoleRes.data.code === 200 && byRoleRes.data.code === 200) { const leftData = [...unInRoleRes.data.data, ...byRoleRes.data.data]; // 缁勮濂界┛姊鍙敤鏁版嵁 diff --git a/Source/plt-web/plt-web-ui/src/views/system/user/index.vue b/Source/plt-web/plt-web-ui/src/views/system/user/index.vue index 971b60b..b856de2 100644 --- a/Source/plt-web/plt-web-ui/src/views/system/user/index.vue +++ b/Source/plt-web/plt-web-ui/src/views/system/user/index.vue @@ -28,21 +28,37 @@ </template> <template #menu="{row,index,size}"> - <el-button icon="el-icon-edit" size="small" type="text" @click.stop="rowEditHandler(row,index)">缂栬緫</el-button> - <el-button icon="el-icon-delete" size="small" type="text" @click.stop="rowDeleteHandler(row)">鍒犻櫎</el-button> - <el-button size="small" type="text" @click.stop="stopUserHandler(row)"> + <el-button v-if="permissionList.editBtn" icon="el-icon-edit" size="small" type="text" + @click.stop="rowEditHandler(row,index)">缂栬緫 + </el-button> + <el-button v-if="permissionList.delBtn" icon="el-icon-delete" size="small" type="text" + @click.stop="rowDeleteHandler(row)">鍒犻櫎 + </el-button> + <el-button v-if="permissionList.stopActionBtn" size="small" type="text" @click.stop="stopUserHandler(row)"> <span v-if="row.status === 0" style="color: #fa3434"><i class="el-icon-video-pause"></i> 鍋滅敤</span> <span v-if="row.status === 1" style="color: #55b61d"><i class="el-icon-video-play"></i> 鍚敤</span> </el-button> </template> <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-user" plain size="small" type="primary" @click="roleHandler">鍒嗛厤瑙掕壊</el-button> - <el-button icon="el-icon-school" plain size="small" type="primary" @click="departmentHandler">鍒嗛厤閮ㄩ棬</el-button> - <el-button icon="el-icon-key" plain size="small" type="success" @click="setPwsHandler">璁剧疆瀵嗙爜绛栫暐</el-button> - <el-button icon="el-icon-upload2" plain size="small" type="primary" @click="uploadUser">瀵煎叆浜哄憳</el-button> - <el-button icon="el-icon-download" plain size="small" type="primary" @click="downloadHandler">涓嬭浇瀵煎叆妯℃澘</el-button> + <el-button v-if="permissionList.editBtn" icon="el-icon-delete" plain size="small" type="danger" + @click="allDelHandler">鍒犻櫎 + </el-button> + <el-button v-if="permissionList.assigningRolesBtn" icon="el-icon-user" plain size="small" type="primary" + @click="roleHandler">鍒嗛厤瑙掕壊 + </el-button> + <el-button v-if="permissionList.distributionDepartmentBtn" icon="el-icon-school" plain size="small" + type="primary" @click="departmentHandler">鍒嗛厤閮ㄩ棬 + </el-button> + <el-button v-if="permissionList.setPasswordPolicyBtn" icon="el-icon-key" plain size="small" type="success" + @click="setPwsHandler">璁剧疆瀵嗙爜绛栫暐 + </el-button> + <el-button v-if="permissionList.importPersonnelBtn" icon="el-icon-upload2" plain size="small" type="primary" + @click="uploadUser">瀵煎叆浜哄憳 + </el-button> + <el-button v-if="permissionList.downloadImportTemplateBtn" icon="el-icon-download" plain size="small" + type="primary" @click="downloadHandler">涓嬭浇瀵煎叆妯℃澘 + </el-button> </template> </avue-crud> @@ -124,6 +140,7 @@ } from '@/api/system/user/api' import {column} from "./option" import func from '@/util/func' +import {mapGetters} from "vuex"; export default { name: "userManage", @@ -173,14 +190,6 @@ pwdList: [], tableLoading: false, tableData: [], - option: { - ...basicOption, - editBtn: false, - delBtn: false, - dialogWidth: '50%', - calcHeight: -60, - column: column - }, page: { currentPage: 1, pageSize: 10, @@ -196,7 +205,32 @@ lastIndex: null, } }, - created() { + 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), + assigningRolesBtn: this.vaildData(this.permission[this.$route.query.id].assigningRoles, false), + distributionDepartmentBtn: this.vaildData(this.permission[this.$route.query.id].distributionDepartment, false), + downloadImportTemplateBtn: this.vaildData(this.permission[this.$route.query.id].downloadImportTemplate, false), + importPersonnelBtn: this.vaildData(this.permission[this.$route.query.id].importPersonnel, false), + setPasswordPolicyBtn: this.vaildData(this.permission[this.$route.query.id].setPasswordPolicy, false), + stopActionBtn: this.vaildData(this.permission[this.$route.query.id].stopAction, false), + }; + }, + option() { + return { + ...basicOption, + addBtn: this.permissionList.addBtn, + editBtn: false, + delBtn: false, + dialogWidth: '50%', + calcHeight: -60, + column: column + } + } }, methods: { // 琛ㄦ牸璇锋眰 -- Gitblit v1.9.3