From 48265831b23a469c375bb97099deaf584444a0a2 Mon Sep 17 00:00:00 2001 From: liweilong <515897141@qq.com> Date: 星期三, 23 十二月 2020 17:27:45 +0800 Subject: [PATCH] 修改权限编辑颜色 --- src/pages/system/admin.vue | 68 ++++++++++++++++++++++++++-------- 1 files changed, 52 insertions(+), 16 deletions(-) diff --git a/src/pages/system/admin.vue b/src/pages/system/admin.vue index 5f8fbc0..bdf6a28 100644 --- a/src/pages/system/admin.vue +++ b/src/pages/system/admin.vue @@ -38,6 +38,11 @@ <el-table-column type="index" label="搴忓彿" align="center" width="60" /> <el-table-column label="鍚嶇О" prop="name" align="center" min-width="120" /> <el-table-column label="璐﹀彿" prop="account" align="center" min-width="120" /> + <el-table-column label="璐﹀彿绫诲瀷" prop="account" align="center" min-width="120"> + <template slot-scope="scope"> + <span v-if="scope.row.type">{{ accountTypeOptions[scope.row.type].name }}</span> + </template> + </el-table-column> <el-table-column label="瑙掕壊" prop="roleName" align="center" min-width="120" /> <!-- <el-table-column label="鏈�杩戠櫥褰曟椂闂�" prop="loginTime" align="center" min-width="180" /> --> <el-table-column label="鐘舵��" align="center" min-width="100"> @@ -80,7 +85,7 @@ /> <!-- 鏂板&缂栬緫 --> - <el-dialog :title="adminDialogData.type=='add'?'鏂板绠$悊鍛�':'缂栬緫绠$悊鍛�'" width="500px" :visible.sync="isShowadminDialog" append-to-body> + <el-dialog :title="adminDialogData.type=='add'?'鏂板绠$悊鍛�':'缂栬緫绠$悊鍛�'" width="500px" :visible.sync="adminDialogVisible" append-to-body> <el-form ref="adminDialog" :model="adminDialogData" label-width="80px" :rules="rules" size="small"> <el-form-item label="鍚嶇О" prop="name"> <el-input v-model="adminDialogData.name" placeholder="璇疯緭鍏ュ悕绉�" /> @@ -88,14 +93,24 @@ <el-form-item label="璐﹀彿" prop="account"> <el-input v-model="adminDialogData.account" placeholder="璇疯緭鍏ュ笎鍙�" :disabled="adminDialogData.type!='add'" /> </el-form-item> - <el-form-item label="瀵嗙爜" prop="password"> + <el-form-item label="瀵嗙爜" :prop="adminDialogData.type=='add'?'password':''"> <el-input v-model="adminDialogData.password" type="password" placeholder="璇疯緭鍏ュ瘑鐮�" /> </el-form-item> - <el-form-item label="纭瀵嗙爜" prop="passwordSure"> + <el-form-item label="纭瀵嗙爜" :prop="adminDialogData.type=='add'?'passwordSure':''"> <el-input v-model="adminDialogData.passwordSure" type="password" placeholder="璇疯緭鍏ョ‘璁ゅ瘑鐮�" /> </el-form-item> + <!-- 璐﹀彿绫诲瀷 --> + <el-form-item label="璐﹀彿绫诲瀷" prop="accountType"> + <el-select + v-model="adminDialogData.accountType" + clearable + placeholder="璐﹀彿绫诲瀷" + style="width: 100%" + > + <el-option v-for="item in accountTypeOptions" :key="item.id" :label="item.name" :value="item.id" /> + </el-select> + </el-form-item> <!-- 瑙掕壊 --> - <!-- 閫夋嫨妗� --> <el-form-item label="瑙掕壊" prop="sysRoleId"> <el-select v-model="adminDialogData.sysRoleId" @@ -144,8 +159,13 @@ // 瑙掕壊鍒楄〃 roleArr: [], + // 璐﹀彿绫诲瀷 + accountTypeOptions: [ + { name: '鏅�氱鐞嗗憳', id: 1 }, + { name: '瓒呯骇绠$悊鍛�', id: 0 } + ], - isShowadminDialog: false, + adminDialogVisible: false, adminDialogData: {}, // 鍒嗛〉 鈫撯啌鈫撯啌鈫撯啌鈫撯啌鈫撯啌 @@ -171,6 +191,9 @@ ], sysRoleId: [ { required: true, message: '瑙掕壊涓嶈兘涓虹┖', trigger: 'change' } + ], + accountType: [ + { required: true, message: '璐﹀彿绫诲瀷涓嶈兘涓虹┖', trigger: 'change' } ] } } @@ -188,7 +211,11 @@ // 鑾峰彇瑙掕壊鍒楄〃 getRoleList() { this.postFN({ - url: 'admin/roleList', + url: 'admin/role/list', + params: { + pageNum: 1, + pageSize: 9999 + }, mockData: { code: 100, msg: '', @@ -198,7 +225,7 @@ }] } }, (inf) => { - this.roleArr = inf || [] + this.roleArr = inf.list || [] }) }, @@ -209,7 +236,7 @@ url: 'admin/list', params: { pageNum: pageNum, - rowCount: pageSize, + pageSize: pageSize, keyWord: keyWord }, mockData: { @@ -303,10 +330,14 @@ password: '', passwordSure: '', sysRoleId: '', - isUse: 1 + isUse: 1, + accountType: 1 } - this.adminDialogData = adminDialogData - this.isShowadminDialog = true + this.adminDialogVisible = true + this.$nextTick(() => { + this.adminDialogData = adminDialogData + this.$refs['adminDialog'].resetFields() + }) }, // 鎵撳紑缂栬緫鍒嗙被寮规 showEditAdminDialog(item) { @@ -320,13 +351,17 @@ id: item.id, isUse: item.isUse } - this.adminDialogData = adminDialogData - this.isShowadminDialog = true + if (!item.type + '') adminDialogData.accountType = item.type + this.adminDialogVisible = true + this.$nextTick(() => { + this.adminDialogData = adminDialogData + this.$refs['adminDialog'].resetFields() + }) }, // 鍏抽棴缂栬緫寮圭獥 hideAdminDialog() { this.adminDialogData = {} - this.isShowadminDialog = false + this.adminDialogVisible = false }, // 鎻愪氦鏂板&缂栬緫 submitAdmin(type) { @@ -336,10 +371,11 @@ var params = { name: adminDialogData.name, account: adminDialogData.account, - password: adminDialogData.password, sysAdRoleId: adminDialogData.sysRoleId, - isUse: adminDialogData.isUse + isUse: adminDialogData.isUse, + type: adminDialogData.accountType } + if (adminDialogData.password) params.password = adminDialogData.password var isAdd = adminDialogData.type === 'add' var url = isAdd ? 'admin/add' : 'admin/update' -- Gitblit v1.8.0