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/system/user/index.vue | 267 +++++++++++++++++++++++++--------------------------- 1 files changed, 128 insertions(+), 139 deletions(-) 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 ee786da..c1cf595 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 @@ -2,7 +2,6 @@ <basic-container> <avue-crud ref="userCrud" - :before-open="beforeOpen" :data="tableData" :option="option" :page.sync="page" @@ -18,26 +17,6 @@ @row-save="rowSaveHandler" @row-update="rowUpdateHandler" > - <!-- 閮ㄩ棬澶撮儴鎼滅储鎻掓Ы --> - <template slot-scope="{disabled,size}" slot="pkDepartmentNameSearch"> - <div style="display: flex;gap: 5px"> - <el-select v-model="departSearchValue" clearable placeholder="璇烽�夋嫨閮ㄩ棬"> - <el-option :label="departSearchObj.name" :value="departSearchObj.oid"></el-option> - </el-select> - <el-button size="small" type="success" @click="dialogDepartSearchHandler">閫夋嫨閮ㄩ棬</el-button> - </div> - </template> - - <!-- 瀵硅瘽妗嗛儴闂ㄦ彃妲� --> - <template slot="pkDepartmentNameForm" slot-scope="scope"> - <div style="display: flex;gap: 5px"> - <el-select v-model="departValue" clearable placeholder="璇烽�夋嫨閮ㄩ棬"> - <el-option :label="departObj.name" :value="departObj.oid"></el-option> - </el-select> - <el-button size="small" type="success" @click="dialogDepartHandler">閫夋嫨閮ㄩ棬</el-button> - </div> - </template> - <template slot="status" slot-scope="{row}"> <el-tag v-if="row.status === 0" type="success">鍚敤</el-tag> <el-tag v-if="row.status === 1" type="danger">鍋滅敤</el-tag> @@ -49,21 +28,65 @@ </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 v-if="permissionList.editBtn" size="small" type="text" + @click.stop="rowEditHandler(row,index)"> + <icon-show :name="permissionList.editBtn.source"></icon-show> + 缂栬緫 + </el-button> + <el-button v-if="permissionList.delBtn" size="small" type="text" + @click.stop="rowDeleteHandler(row)"> + <icon-show :name="permissionList.delBtn.source"></icon-show> + 鍒犻櫎 + </el-button> <el-button 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> + <span v-if="row.status === 0 && permissionList.stopBtn" style="color: #fa3434;display: flex"> + <icon-show :name="permissionList.stopBtn.source"></icon-show> + 鍋滅敤 + </span> + <span v-if="row.status === 1 && permissionList.actionBtn" style="color: #55b61d;display: flex"> + <icon-show :name="permissionList.actionBtn.source"></icon-show> + 鍚敤 + </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.addBtn" class="button-custom-icon" size="small" type="primary" + @click="$refs.userCrud.rowAdd()"> + <icon-show :name="permissionList.addBtn.source"></icon-show> + 鏂� 澧� + </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.assigningRolesBtn" class="button-custom-icon" plain size="small" type="primary" + @click="roleHandler"> + <icon-show :name="permissionList.assigningRolesBtn.source"></icon-show> + 鍒嗛厤瑙掕壊 + </el-button> + <el-button v-if="permissionList.distributionDepartmentBtn" class="button-custom-icon" plain size="small" + type="primary" @click="departmentHandler"> + <icon-show :name="permissionList.distributionDepartmentBtn.source"></icon-show> + 鍒嗛厤閮ㄩ棬 + </el-button> + <el-button v-if="permissionList.setPasswordPolicyBtn" class="button-custom-icon" plain size="small" + type="success" + @click="setPwsHandler"> + <icon-show :name="permissionList.setPasswordPolicyBtn.source"></icon-show> + 璁剧疆瀵嗙爜绛栫暐 + </el-button> + <el-button v-if="permissionList.importPersonnelBtn" class="button-custom-icon" plain size="small" type="primary" + @click="uploadUser"> + <icon-show :name="permissionList.importPersonnelBtn.source"></icon-show> + 瀵煎叆浜哄憳 + </el-button> + <el-button v-if="permissionList.downloadImportTemplateBtn" class="button-custom-icon" plain size="small" + type="primary" @click="downloadHandler"> + <icon-show :name="permissionList.downloadImportTemplateBtn.source"></icon-show> + 涓嬭浇瀵煎叆妯℃澘 + </el-button> </template> </avue-crud> @@ -82,24 +105,24 @@ class="avue-dialog" style="margin-top: -15vh !important;" title="璁剧疆瀵嗙爜绛栫暐" - width="30%" + width="500px" > - <div class="password-strategy-container"> - <div><i class="el-icon-setting"/>璁剧疆瀵嗙爜绛栫暐锛�</div> - <el-select v-model="pwdValue" placeholder="璇烽�夋嫨瀵嗙爜绛栫暐"> + <div style="width:115px;"><i class="el-icon-setting"/>璁剧疆瀵嗙爜绛栫暐锛�</div> + <el-select v-model="pwdValue" placeholder="璇烽�夋嫨瀵嗙爜绛栫暐" style="width: 330px;"> <el-option v-for="(item,index) in pwdList" :key="index" :label="item.name" :value="item.id"></el-option> </el-select> </div> <div slot="footer" class="dialog-footer"> - <el-button size="small" @click="pwdVisible = false">鍙� 娑�</el-button> <el-button size="small" type="primary" @click="savePwdHandler">纭� 瀹�</el-button> + <el-button size="small" @click="pwdVisible = false">鍙� 娑�</el-button> </div> </el-dialog> <!-- 瀵煎叆浜哄憳 --> - <upload-file ref="upload" :tipList="tipList" :fileType="upFileType" :fileUrl="fileUrl" title="瀵煎叆浜哄憳" @updata="getTableList"></upload-file> + <upload-file ref="upload" :fileType="upFileType" :fileUrl="fileUrl" :tipList="tipList" title="瀵煎叆浜哄憳" + @updata="getTableList"></upload-file> <!-- 鍒嗛厤閮ㄩ棬瀵硅瘽妗� --> <el-dialog @@ -119,8 +142,8 @@ > </avue-crud> <div slot="footer" class="dialog-footer"> - <el-button size="small" @click="departVisible = false">鍙� 娑�</el-button> <el-button size="small" type="primary" @click="saveDepartHandler">纭� 瀹�</el-button> + <el-button size="small" @click="departVisible = false">鍙� 娑�</el-button> </div> </el-dialog> </basic-container> @@ -145,21 +168,20 @@ } from '@/api/system/user/api' import {column} from "./option" import func from '@/util/func' +import {mapGetters} from "vuex"; export default { name: "userManage", data: function () { return { - departSearchObj:{}, - departSearchValue:'', + departSearchObj: {}, + departSearchValue: '', loadKey: 0, departStatus: '', // 鍖哄垎涓嶅悓鏂瑰紡鎵撳紑閮ㄩ棬瀵硅瘽妗� - departValue: '', // 閮ㄩ棬瀵硅瘽妗嗕笅鎷夋缁戝畾鍊� - departObj: {}, // 閮ㄩ棬瀵硅瘽妗嗕笅鎷夋閫夐」缁戝畾鍊� departCurrenRow: {}, departOption: { ...basicOption, - addBtn:false, + addBtn: false, rowKey: 'oid', rowParentKey: 'parentId', selection: false, @@ -168,11 +190,12 @@ menu: false, refreshBtn: false, gridBtn: false, + header: false, column: [ { label: '鍚嶇О', prop: 'name', - align:'left' + align: 'left' }, { label: '缂栧彿', @@ -195,14 +218,6 @@ pwdList: [], tableLoading: false, tableData: [], - option: { - ...basicOption, - editBtn: false, - delBtn: false, - dialogWidth: '50%', - calcHeight: -60, - column: column - }, page: { currentPage: 1, pageSize: 10, @@ -214,33 +229,53 @@ leftRoleData: [], // 鍒嗛厤瑙掕壊绌挎妗嗗乏渚у垵濮嬫暟鎹� rightRoleData: [], // 鍒嗛厤瑙掕壊绌挎妗嗗彸渚у垵濮嬫暟鎹� transferTitle: ['鐜版湁瑙掕壊', '鎷ユ湁瑙掕壊'], - tipList:["瀵煎叆妯℃澘涓爣鏄庣孩鑹插瓧浣撶殑涓哄繀杈撻」","閮ㄩ棬鍒椾笂涓嬬骇鍏崇郴蹇呴』鎸夌収鍙嶆枩鏉犻殧寮�(/)"], - lastIndex:null, + tipList: ["瀵煎叆妯℃澘涓爣鏄庣孩鑹插瓧浣撶殑涓哄繀杈撻」", "閮ㄩ棬鍒椾笂涓嬬骇鍏崇郴蹇呴』鎸夌収鍙嶆枩鏉犻殧寮�(/)"], + 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), + distributionDepartmentBtn: this.vaildData(this.permission[this.$route.query.id].ASSIGN, false), + assigningRolesBtn: this.vaildData(this.permission[this.$route.query.id].ASSIGN1, false), + downloadImportTemplateBtn: this.vaildData(this.permission[this.$route.query.id].DOWNLOADFILE, false), + importPersonnelBtn: this.vaildData(this.permission[this.$route.query.id].IMPORT, false), + setPasswordPolicyBtn: this.vaildData(this.permission[this.$route.query.id].RIGHT, false), + stopBtn: this.vaildData(this.permission[this.$route.query.id].FREEZE, false), + actionBtn: this.vaildData(this.permission[this.$route.query.id].UNFREZE, false), + }; + }, + option() { + return { + ...basicOption, + addBtn: false, + editBtn: false, + delBtn: false, + dialogWidth: '50%', + calcHeight: -60, + column: column + } + } }, methods: { - // 鏂板鎴栦慨鏀瑰璇濇鎵撳紑鍓� - beforeOpen(done, type) { - if(type == 'add'){ - this.departObj = {}; - this.departValue = ""; - } - done(); - }, - // 琛ㄦ牸璇锋眰 getTableList() { this.tableLoading = true; getDataUsers(this.page.currentPage, this.page.pageSize, this.searchParams).then(res => { const data = res.data.data; + data.map(item => { + item.secretGrade = item.secretGrade.toString() + }) this.tableData = data; this.page.total = res.data.total; this.tableLoading = false; - }).catch(err => { - this.$message.error(err) - }); + s + }) + this.departmentQueryOnLoad() }, // 琛ㄦ牸鍙充晶鍒锋柊鍥炬爣 @@ -251,10 +286,6 @@ // 鎼滅储鏌ヨ handleSearch(params, done) { this.searchParams = {}; - if(this.departSearchObj && this.departSearchValue){ - this.searchParams['conditionMap["pkDepartment"]'] = this.departSearchValue; - } - if (!func.isEmptyObject(params)) { for (let key in params) { if (params.hasOwnProperty(key)) { @@ -265,7 +296,7 @@ } } - if (func.isEmptyObject(params) && !this.departSearchValue) { + if (func.isEmptyObject(params)) { this.searchParams = {}; } @@ -275,8 +306,6 @@ // 閲嶇疆鎼滅储鏉′欢 handleReset() { - this.departSearchObj = {}; - this.departSearchValue = ""; this.searchParams = {}; this.getTableList(); }, @@ -301,9 +330,7 @@ stopUser(params).then(res => { this.$message.success(res.data.obj); this.getTableList(); - }).catch(err => { - this.$message.error(err) - }) + }); }, // 閫夋嫨妗� @@ -317,8 +344,12 @@ row, this.$refs.userCrud, this.lastIndex, - (newIndex) => { this.lastIndex = newIndex; }, - () => { this.selectList = []; } + (newIndex) => { + this.lastIndex = newIndex; + }, + () => { + this.selectList = [row]; + } ); }, @@ -341,9 +372,7 @@ listRoleByUserOid(userOid).then(res => { this.rightRoleData = res.data.data.map(item => item.oid); }) - }).catch(err => { - this.$message.error(err) - }) + }); this.$refs.transfer.visible = true; }, @@ -356,9 +385,7 @@ saveRights(params).then(res => { this.$message.success(res.data.obj); this.getTableList(); - }).catch(err => { - this.$message.error(err) - }) + }); }, // 璁剧疆瀵嗙爜绛栫暐 @@ -390,18 +417,15 @@ saveUserPasswordStrateg(params).then(res => { this.pwdVisible = false; this.$message.success(res.data.obj) - }).catch(err => { - this.$message.error(err) - }) + }); }, // 鏂板 - rowSaveHandler(row, done,loading) { + rowSaveHandler(row, done, loading) { if (row.password != row.confirmPassword) { this.$message.error('璇锋鏌ヤ袱娆″瘑鐮佹槸鍚﹁緭鍏ヤ竴鑷达紒') return this.$refs.userCrud.$refs.dialogForm.$refs.tableForm.allDisabled = false; } - row.pkDepartment = this.departValue; // 灏嗗綋鍓嶈鐨勯儴闂ㄥ弬鏁皃kDepartment 璧嬪�间负涓嬫媺妗嗙粦瀹氱殑鍊� addUser(row).then(res => { if (res.data.code === 200) { this.$message.success(res.data.obj); @@ -410,29 +434,20 @@ } }).catch(err => { loading() - console.log(err); }) }, // 鎿嶄綔鏍忕紪杈� rowEditHandler(row, index) { - let obj = { name: row.pkDepartmentName, oid: row.pkDepartment, rowOid: row.oid }; - this.departValue = row.pkDepartment; - this.departObj = obj; - - if (this.departObj.rowOid) { - this.$refs.userCrud.rowEdit(row, index); - } - + this.$refs.userCrud.rowEdit(row, index); }, // 缂栬緫 - rowUpdateHandler(row, index, done,loading) { + rowUpdateHandler(row, index, done, loading) { if (row.password != row.confirmPassword) { this.$message.error('璇锋鏌ヤ袱娆″瘑鐮佹槸鍚﹁緭鍏ヤ竴鑷达紒') return this.$refs.userCrud.$refs.dialogForm.$refs.tableForm.allDisabled = false; } - row.pkDepartment = this.departValue; // 灏嗗綋鍓嶈鐨勯儴闂ㄥ弬鏁皃kDepartment 璧嬪�间负涓嬫媺妗嗙粦瀹氱殑鍊� updateUser(row).then(res => { if (res.data.code === 200) { this.$message.success(res.data.obj); @@ -441,7 +456,6 @@ } }).catch(err => { loading() - console.log(err); }); }, @@ -501,11 +515,8 @@ // 涓嬭浇瀵煎叆妯℃澘 downloadHandler() { download().then(res => { - console.log(res); func.downloadFileByBlobHandler(res); this.$message.success('涓嬭浇鎴愬姛'); - }).catch(err => { - this.$message.error(err); }) }, @@ -521,7 +532,7 @@ return; } this.departStatus = 'default'; // 鍖哄垎涓嶅悓鏂瑰紡鎵撳紑閮ㄩ棬瀵硅瘽妗� - this.departmentQueryOnLoad(); + this.departVisible = true; }, // 鍒嗛厤閮ㄩ棬琛ㄦ牸鍒濆鍖栬姹� @@ -529,10 +540,15 @@ departmentQueryController({queryAllLevel: true}).then(res => { const data = res.data.treeData; this.departData = this.departDtaFormAtter(data); - this.departVisible = true; - }).catch(err => { - this.$message.error(err); - }) + this.option.column[7].dicData = [{ + oid: 'ALLDept', + name: '鎵�鏈夐儴闂�', + expand: true, + disabled: true, + children: this.departData + }] + this.option.column[7].defaultExpandedKeys = ['ALLDept']; + }); }, // 鍒嗛厤閮ㄩ棬鏁版嵁杞崲 @@ -566,6 +582,7 @@ return; } + //鍒嗛厤閮ㄩ棬 if (this.departStatus == 'default') { let params = { userOIds: this.selectList.map(item => item.oid).join(','), @@ -577,37 +594,9 @@ this.getTableList(); this.$message.success('鍒嗛厤鎴愬姛锛�') } - }).catch(err => { - console.log(err); }) return; } - - if (this.departStatus == 'handle') { - this.departObj = this.departCurrenRow; - this.departValue = this.departCurrenRow.oid; - this.departVisible = false; - return;; - } - - if(this.departStatus == 'search'){ - this.departSearchObj = this.departCurrenRow; - this.departSearchValue = this.departCurrenRow.oid; - this.departVisible = false; - return; - } - }, - - // 瀵硅瘽妗嗗垎閰嶉儴闂ㄦ寜閽� - dialogDepartHandler() { - this.departmentQueryOnLoad(); - this.departStatus = 'handle'; // 鍖哄垎涓嶅悓鏂瑰紡鎵撳紑閮ㄩ棬瀵硅瘽妗� - }, - - // 鎼滅储瀵硅瘽妗嗗垎閰嶉儴闂ㄦ寜閽� - dialogDepartSearchHandler(){ - this.departmentQueryOnLoad(); - this.departStatus = 'search'; // 鍖哄垎涓嶅悓鏂瑰紡鎵撳紑閮ㄩ棬瀵硅瘽妗� }, } @@ -616,7 +605,7 @@ <style lang="scss" scoped> .password-strategy-container { - padding-left: 20px; + margin-bottom: 20px; display: flex; //justify-content: center; align-items: center; -- Gitblit v1.9.3