From 0cd1631ceaa93e6483908fd692d2cb693b85324b Mon Sep 17 00:00:00 2001
From: 石广澎 <shiguangpeng@163.com>
Date: 星期二, 02 一月 2024 14:26:01 +0800
Subject: [PATCH] 增加图片验证码和登录日志 权限管理优化
---
admin-web/src/views/systemManger/server/user/index.vue | 76 +++-
admin-web/src/views/systemSetting/role/index.vue | 229 ++++---------
admin-web/src/views/systemManger/server/user/editRole.vue | 180 +++++-----
admin-web/src/components/myTree/index.vue | 4
admin-web/src/views/login/index.vue | 31 +
admin-web/src/views/systemManger/server/user/edit.vue | 476 ++++++++++++++-------------
6 files changed, 477 insertions(+), 519 deletions(-)
diff --git a/admin-web/src/components/myTree/index.vue b/admin-web/src/components/myTree/index.vue
index bdd1b93..f6b602c 100644
--- a/admin-web/src/components/myTree/index.vue
+++ b/admin-web/src/components/myTree/index.vue
@@ -127,8 +127,8 @@
}
}
},
- onSelect(selectedNodes) {
- const param = { id: selectedNodes.id, name: selectedNodes.label };
+ onSelect(selectedNodes,a,b) {
+ const param = { id: selectedNodes.id, name: selectedNodes.label,lv: a.level};
if (selectedNodes.code) {
param.code = selectedNodes.code;
}
diff --git a/admin-web/src/views/login/index.vue b/admin-web/src/views/login/index.vue
index bbec4a5..7782d34 100644
--- a/admin-web/src/views/login/index.vue
+++ b/admin-web/src/views/login/index.vue
@@ -52,20 +52,23 @@
:icon-class="passwordType === 'password' ? 'eye' : 'eye-open'"
/></span>
</el-form-item>
- <el-form-item prop="code" class="captcha" v-if="loginForm.verifyType==='code' && captchaEnabled">
- <el-input
- v-model.trim="loginForm.code"
- style="width: 218px"
- placeholder="楠岃瘉鐮�"
- type="text"
- tabindex="3"
- autocomplete="off"
- />
- <div class="imgs" @click="getCode()">
- <img :src="codeUrl"/>
- <span v-show="showCaptchatImg">宸插け鏁�</span>
- </div>
- </el-form-item>
+ <template v-if="loginForm.verifyType==='code' && captchaEnabled">
+ <div class="f-lable">楠岃瘉鐮�</div>
+ <el-form-item prop="code" class="captcha">
+ <el-input
+ v-model.trim="loginForm.code"
+ style="width: 218px"
+ placeholder="楠岃瘉鐮�"
+ type="text"
+ tabindex="3"
+ autocomplete="off"
+ />
+ <div class="imgs" @click="getCode()">
+ <img :src="codeUrl"/>
+ <span v-show="showCaptchatImg">宸插け鏁�</span>
+ </div>
+ </el-form-item>
+ </template>
<el-button
id="loginBtn"
:loading="loading"
diff --git a/admin-web/src/views/systemManger/server/user/edit.vue b/admin-web/src/views/systemManger/server/user/edit.vue
index 9e4d187..6d62fa2 100644
--- a/admin-web/src/views/systemManger/server/user/edit.vue
+++ b/admin-web/src/views/systemManger/server/user/edit.vue
@@ -1,5 +1,5 @@
<template>
- <win-sm :title="setting.title" @close="close" :width="'800px'">
+ <win-sm :title="setting.title" @close="close" :width="'800px'" :loading="loading">
<el-alert
style="margin-bottom: 10px"
title="娓╅Θ鎻愮ず锛氱敤鎴峰垵濮嬪瘑鐮佷负123456"
@@ -13,17 +13,18 @@
</el-form-item>
<el-form-item label="閮ㄩ棬" prop="sysDeptId">
<el-select v-model="formData.sysDeptId">
- <el-option v-for="(item,index) in deptmentOptions" :key="index" :label="item.name" :value="item.id"></el-option>
+ <el-option v-for="(item,index) in deptmentOptions" :key="index" :label="item.name"
+ :value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item label="浜哄憳濮撳悕" prop="userName">
<el-input v-model="formData.userName" clearable maxlength="20" show-word-limit style="width: 250px"/>
</el-form-item>
- <el-form-item label="鍛樺伐缂栧彿" prop="userCode">
+ <el-form-item label="鐧诲綍鍚�" prop="userCode">
<el-input v-model="formData.userCode" clearable maxlength="20" show-word-limit style="width: 250px"/>
</el-form-item>
<el-form-item label="鎵嬫満鍙�" prop="userPhone">
- <el-input v-model="formData.userPhone" clearable maxlength="20" show-word-limit
+ <el-input v-model="formData.userPhone" clearable maxlength="20" show-word-limit
style="width: 250px"/>
</el-form-item>
<el-form-item label="鎬у埆" prop="sex">
@@ -54,7 +55,7 @@
<el-checkbox v-model="checkAll" @change="handleCheckAllChange">鍏ㄩ��</el-checkbox>
<div style="margin: 15px 0;"></div>
<el-checkbox-group v-model="checkedList" @change="handleCheckedCitiesChange">
- <el-checkbox v-for="(r,i) in roleOptions" :label="r.role_id" :key="r.role_id">{{r.role_name}}</el-checkbox>
+ <el-checkbox v-for="(r,i) in roleOptions" :label="r.role_id" :key="r.role_id">{{ r.role_name }}</el-checkbox>
</el-checkbox-group>
</el-form-item>
</el-form>
@@ -74,231 +75,244 @@
import {departmentListAll} from "@/api/system/deptment";
export default {
- components: {winSm, myButton},
- props: {
- // setting 涓』鑷冲皯鍖呭惈鎺у埗dialog鏄剧ず鎴栭殣钘忕殑灞炴��,鍏朵綑灞炴�у彲鎷撳睍
- // 灏嗘坊鍔�/淇敼鐨勫ぇ閲忔暟鎹強閫昏緫浠庡垪琛ㄩ〉闈腑鍒嗙鍑烘潵,閬垮厤鍒楄〃椤甸潰浠g爜杩囧,瀹℃煡鍥伴毦
- // 鑻ユ椤甸潰椤诲洖浼犳暟鎹嚦鐖堕〉闈�,鍙湪寮曠敤缁勪欢鏃舵坊鍔犱簨浠�,鏈〉闈娇鐢╰his.$emit('浜嬩欢鍚�',鍙傛暟1,鍙傛暟2...)鍥炰紶鏁版嵁
- setting: {
- type: Object,
- default: () => {
- }
- }
- },
- data() {
- return {
- deptmentOptions:[],
- checkAll: false,
- checkedList: [],
- roleList: [
- {'id': 1, label: '鐜嬫兜1'},
- {'id': 2, label: '鐜嬫兜2'}
- ],
- // 鏌ヨ鍙傛暟
- queryParams: {
- pageNum: 1,
- pageSize: 10,
- roleName: undefined,
- roleKey: undefined,
- status: undefined,
- orgId: 1
- },
- roleOptions: [],// 閫夋嫨椤�
- roleCheckStrictly: true,
- defaultProps: {
- children: 'childList',
- label: 'name',
- },
- formData: {
- sysDeptId:'',
- userName: '',
- userCode: '',
- userPhone: '',
- sex: 1,
- status: 1,
- remark: '',
- seq: null,
- },
- rules: {
- sysDeptId: [
- {required: true, message: '璇烽�夋嫨閮ㄩ棬', trigger: 'change'}
- ],
- userName: [
- {required: true, message: '璇疯緭鍏ヤ汉鍛樺鍚�', trigger: 'blur'}
- ],
- userCode: [
- {required: true, message: '璇疯緭鍏ュ憳宸ョ紪鍙�', trigger: 'blur'}
- ],
- userPhone: [
- {required: true, message: '璇疯緭鍏ユ墜鏈哄彿', trigger: 'blur'}
- ],
- sex: [
- {required: true, message: '璇烽�夋嫨鎬у埆', trigger: 'change'}
- ],
- seq: [
- {required: true, message: '璇疯緭鍏ラ『搴忓彿', trigger: 'blur'}
- ],
- }
- }
- },
- created() {
- this.getInfo()
- this.getAllRole()
- this.getDeptmentOptions()
- },
- methods: {
- // 鑾峰彇鎵�鏈夎鑹�
- getAllRole() {
- // const user = this.$store.getters.userInfo
- // this.data_scope = 1
- // if (user.lv == 1) {
- // this.data_scope = 1
- // }
- // if (user.lv == 2) {
- // this.data_scope = 2
- // }
- // if (user.lv == 3) {
- // this.data_scope = 3
- // }
- this.data_scope = 1
- role.listRoleByDataScope({dataScope: this.data_scope}).then(response => {
- if (response) {
- this.roleOptions = response;
- } else {
- this.roleOptions = [];
- }
- this.loading = false;
- }
- );
- },
- getDeptmentOptions(){
- departmentListAll({tenantId:this.setting.tenantId}).then(res=>{
- this.deptmentOptions = res
- })
- },
- handleCheckAllChange(val) {
- if (val) {
- this.checkedList = this.roleOptions.map(x => {
- return x.role_id
- })
- } else {
- this.checkedList = []
- }
- },
- handleCheckedCitiesChange(value) {
- let checkedCount = value.length;
- this.checkAll = checkedCount === this.roleOptions.length;
- },
- getInfo() {
- this.title = this.setting.title
- if (this.setting.id != null) {
- // 鏌ヨ鏁版嵁
- user.getUser({id: this.setting.id}).then(res => {
- const data = res.data
- this.formData = Object.assign(this.formData, data)
- if (this.formData.projectStart != null && this.formData.projectStart > 0) {
- this.formData.projectStart = DateFormatter.LongToDateTime(this.formData.projectStart)
- }
- if (this.formData.projectEnd != null && this.formData.projectEnd > 0) {
- this.formData.projectEnd = DateFormatter.LongToDateTime(this.formData.projectEnd)
- }
- this.checkedList = res.list.map(x => {
- return x.role_id
- })
- if (res.list.length == this.roleOptions.length) {
- this.handleCheckedCitiesChange(res.list)
- }
- })
- }
- },
- close() {
- this.formData = {
- projectName: '',
- projectSubName: '',
- projectCode: '',
- projectContact: '',
- projectTel: '',
- projectEmail: '',
- projectStart: null,
- projectEnd: null,
- projectDesc: '',
- status: 1
- },
- this.$emit('close')
- },
- save() {
-
- this.$refs.ruleForm.validate((valid) => {
- if (valid) {
- const params = Object.assign({}, this.formData)
- params.roleList = this.checkedList
- // 鍖哄煙id
- params.tenantId = this.setting.tenantId
- params.tenantCode = this.setting.tenantCode
- if (params.ctiStatus == 0) {
- params.agentJid = ''
- params.workgroupJid = ''
- params.clientNumber = ''
- params.clientPwd = ''
- }
- if (params.projectStart != null && params.projectEnd != null) {
- params.projectStart = DateFormatter.DateToLong(params.projectStart)
- params.projectEnd = DateFormatter.DateToLong(params.projectEnd)
- if (params.projectStart >= params.projectEnd) {
- this.$message.error('鏈嶅姟缁撴潫鏃堕棿涓嶈兘灏忎簬鎴栬�呯瓑浜庢湇鍔″紑濮嬫椂闂�')
- return
- }
- }
- if ((params.projectStart == null && params.projectEnd != null) || (params.projectStart != null && params.projectEnd == null)) {
- this.$message.error('鏈嶅姟寮�濮嬫椂闂村拰鏈嶅姟缁撴潫鏃堕棿蹇呴』鎴愬鍑虹幇')
- return
- }
- if (params.id) {
- user.upd(params).then(res => {
- if (res) {
- this.$message.success('淇濆瓨鎴愬姛锛�')
- this.close()
- this.$emit('search')
- } else {
- this.$message.error('淇濆瓨澶辫触')
- }
- })
- } else {
- user.add(params).then(res => {
- if (res) {
- this.$message.success('淇濆瓨鎴愬姛锛�')
- this.close()
- this.$emit('search')
- } else {
- this.$message.error('淇濆瓨澶辫触')
- }
- })
- }
- } else {
- this.$message.error('鏍¢獙鏈�氳繃锛岃妫�鏌ャ��')
- }
- })
- },
- getWorkgroupsAll(){
- callCenter.getWorkgroupsAll().then(res => {
- this.workgroups = res.workgroups
- })
- },
- getWorkgroupAgents(workgroupName){
- this.formData.agentJid = ''
- this.formData.clientNumber = ''
- this.formData.clientPwd = ''
- this.agentExtendEntiry.agentId = ''
- this.formData.workgroupJid = this.workgroup.workgroupJID
- callCenter.getWorkgroupAgents(workgroupName).then(res => {
- this.agents = res.agents
- })
- },
- onClickAgent(agent){
- this.formData.agentJid = agent.agentExtendEntiry.agentId
- this.formData.clientNumber = agent.agentExtendEntiry.ccClientNumber
- this.formData.clientPwd = agent.agentExtendEntiry.ccClientPWD
- }
- }
+ components: {winSm, myButton},
+ props: {
+ // setting 涓』鑷冲皯鍖呭惈鎺у埗dialog鏄剧ず鎴栭殣钘忕殑灞炴��,鍏朵綑灞炴�у彲鎷撳睍
+ // 灏嗘坊鍔�/淇敼鐨勫ぇ閲忔暟鎹強閫昏緫浠庡垪琛ㄩ〉闈腑鍒嗙鍑烘潵,閬垮厤鍒楄〃椤甸潰浠g爜杩囧,瀹℃煡鍥伴毦
+ // 鑻ユ椤甸潰椤诲洖浼犳暟鎹嚦鐖堕〉闈�,鍙湪寮曠敤缁勪欢鏃舵坊鍔犱簨浠�,鏈〉闈娇鐢╰his.$emit('浜嬩欢鍚�',鍙傛暟1,鍙傛暟2...)鍥炰紶鏁版嵁
+ setting: {
+ type: Object,
+ default: () => {
+ }
}
+ },
+ data() {
+ // 鍙傛暟1: rule 瀵硅薄, 鏄牎楠岃鍒�, 涓�鑸笉鐢�
+ // 鍙傛暟2: value 鏍¢獙椤圭殑鏁版嵁
+ // 鍙傛暟3: callback 鍥炶皟鍑芥暟, 鍐冲畾鏄惁鏍¢獙閫氳繃
+ const checkedListCheck = (rule, value, callback) => {
+ if (this.checkedList.length < 1) {
+ callback(new Error('鑷冲皯閫夋嫨涓�涓�'))
+ } else {
+ callback()
+ }
+ }
+ return {
+ deptmentOptions: [],
+ loading: true,
+ checkAll: false,
+ checkedList: [],
+ roleList: [
+ {'id': 1, label: '鐜嬫兜1'},
+ {'id': 2, label: '鐜嬫兜2'}
+ ],
+ // 鏌ヨ鍙傛暟
+ queryParams: {
+ pageNum: 1,
+ pageSize: 10,
+ roleName: undefined,
+ roleKey: undefined,
+ status: undefined,
+ orgId: 1
+ },
+ roleOptions: [],// 閫夋嫨椤�
+ roleCheckStrictly: true,
+ defaultProps: {
+ children: 'childList',
+ label: 'name',
+ },
+ formData: {
+ sysDeptId: '',
+ userName: '',
+ userCode: '',
+ userPhone: '',
+ sex: 1,
+ status: 1,
+ remark: '',
+ seq: null,
+ },
+ rules: {
+ sysDeptId: [
+ {required: true, message: '璇烽�夋嫨閮ㄩ棬', trigger: 'change'}
+ ],
+ userName: [
+ {required: true, message: '璇疯緭鍏ヤ汉鍛樺鍚�', trigger: 'blur'}
+ ],
+ userCode: [
+ {required: true, message: '璇疯緭鍏ョ櫥褰曞悕', trigger: 'blur'}
+ ],
+ userPhone: [
+ {required: true, message: '璇疯緭鍏ユ墜鏈哄彿', trigger: 'blur'}
+ ],
+ sex: [
+ {required: true, message: '璇烽�夋嫨鎬у埆', trigger: 'change'}
+ ],
+ seq: [
+ {required: true, message: '璇疯緭鍏ラ『搴忓彿', trigger: 'blur'}
+ ],
+ // 瑙掕壊閰嶇疆鐨勯獙璇�
+ roleSetting: [
+ {validator: checkedListCheck, required: true, trigger: 'blur'},
+ ],
+ }
+ }
+ },
+ async created() {
+ this.title = this.setting.title
+ if (this.setting.id != null) {
+ await this.getInfo()
+ }
+
+ await this.getAllRole()
+ await this.getDeptmentOptions()
+ this.loading = false
+ },
+ methods: {
+ // 鑾峰彇鎵�鏈夎鑹�
+ async getAllRole() {
+ this.data_scope = this.$store.getters.userInfo ? this.$store.getters.userInfo.lv : ''
+ await role.listRoleByDataScope({dataScope: this.setting.data_scope}).then(response => {
+ if (response) {
+ this.roleOptions = response;
+ } else {
+ this.roleOptions = [];
+ }
+ this.loading = false;
+ }
+ );
+ },
+ async getDeptmentOptions() {
+ await departmentListAll({tenantId: this.setting.tenantId}).then(res => {
+ this.deptmentOptions = res
+ })
+ },
+ handleCheckAllChange(val) {
+ if (val) {
+ this.checkedList = this.roleOptions.map(x => {
+ return x.role_id
+ })
+ } else {
+ this.checkedList = []
+ }
+ },
+ handleCheckedCitiesChange(value) {
+ let checkedCount = value.length;
+ this.checkAll = checkedCount === this.roleOptions.length;
+ },
+ async getInfo() {
+ this.title = this.setting.title
+ // 鏌ヨ鏁版嵁
+ await user.getUser({id: this.setting.id}).then(res => {
+ const data = res.data
+ this.formData = Object.assign(this.formData, data)
+ if (this.formData.projectStart != null && this.formData.projectStart > 0) {
+ this.formData.projectStart = DateFormatter.LongToDateTime(this.formData.projectStart)
+ }
+ if (this.formData.projectEnd != null && this.formData.projectEnd > 0) {
+ this.formData.projectEnd = DateFormatter.LongToDateTime(this.formData.projectEnd)
+ }
+ this.checkedList = res.list.map(x => {
+ return x.role_id
+ })
+ if (res.list.length == this.roleOptions.length) {
+ this.handleCheckedCitiesChange(res.list)
+ }
+ })
+ },
+ close() {
+ this.formData = {
+ sysDeptId: '',
+ userName: '',
+ userCode: '',
+ userPhone: '',
+ sex: 1,
+ status: 1,
+ remark: '',
+ seq: null,
+ }
+ this.$emit('close')
+ },
+ save() {
+
+ this.$refs.ruleForm.validate((valid) => {
+ if (valid) {
+ const params = Object.assign({}, this.formData)
+ params.roleList = this.checkedList
+ // 鍖哄煙id
+ params.tenantId = this.setting.tenantId
+ params.tenantCode = this.setting.tenantCode
+ if (params.ctiStatus == 0) {
+ params.agentJid = ''
+ params.workgroupJid = ''
+ params.clientNumber = ''
+ params.clientPwd = ''
+ }
+ if (params.projectStart != null && params.projectEnd != null) {
+ params.projectStart = DateFormatter.DateToLong(params.projectStart)
+ params.projectEnd = DateFormatter.DateToLong(params.projectEnd)
+ if (params.projectStart >= params.projectEnd) {
+ this.$message.error('鏈嶅姟缁撴潫鏃堕棿涓嶈兘灏忎簬鎴栬�呯瓑浜庢湇鍔″紑濮嬫椂闂�')
+ return
+ }
+ }
+ if ((params.projectStart == null && params.projectEnd != null) || (params.projectStart != null && params.projectEnd == null)) {
+ this.$message.error('鏈嶅姟寮�濮嬫椂闂村拰鏈嶅姟缁撴潫鏃堕棿蹇呴』鎴愬鍑虹幇')
+ return
+ }
+ if (this.loading) return;
+ this.loading = true
+ if (params.id) {
+ user.upd(params).then(res => {
+ this.loading = false
+ if (res) {
+ this.$message.success('淇濆瓨鎴愬姛锛�')
+ this.close()
+ this.$emit('search')
+ } else {
+ this.$message.error('淇濆瓨澶辫触')
+ }
+ }).catch(() => {
+ this.loading = false
+ })
+ } else {
+ user.add(params).then(res => {
+ this.loading = false
+ if (res) {
+ this.$message.success('淇濆瓨鎴愬姛锛�')
+ this.close()
+ this.$emit('search')
+ } else {
+ this.$message.error('淇濆瓨澶辫触')
+ }
+ }).catch(() => {
+ this.loading = false
+ })
+ }
+ } else {
+ this.$message.error('鏍¢獙鏈�氳繃锛岃妫�鏌ャ��')
+ }
+ })
+ },
+ getWorkgroupsAll() {
+ callCenter.getWorkgroupsAll().then(res => {
+ this.workgroups = res.workgroups
+ })
+ },
+ getWorkgroupAgents(workgroupName) {
+ this.formData.agentJid = ''
+ this.formData.clientNumber = ''
+ this.formData.clientPwd = ''
+ this.agentExtendEntiry.agentId = ''
+ this.formData.workgroupJid = this.workgroup.workgroupJID
+ callCenter.getWorkgroupAgents(workgroupName).then(res => {
+ this.agents = res.agents
+ })
+ },
+ onClickAgent(agent) {
+ this.formData.agentJid = agent.agentExtendEntiry.agentId
+ this.formData.clientNumber = agent.agentExtendEntiry.ccClientNumber
+ this.formData.clientPwd = agent.agentExtendEntiry.ccClientPWD
+ }
+ }
+}
</script>
diff --git a/admin-web/src/views/systemManger/server/user/editRole.vue b/admin-web/src/views/systemManger/server/user/editRole.vue
index c20acc0..197aac9 100644
--- a/admin-web/src/views/systemManger/server/user/editRole.vue
+++ b/admin-web/src/views/systemManger/server/user/editRole.vue
@@ -1,17 +1,17 @@
<template>
- <win :title="setting.title" @close="close" :width="'800px'">
- <el-form :model="formData" class="demo-ruleForm" label-width="100px">
- <el-form-item label="瑙掕壊閰嶇疆" prop="roleSetting">
+ <win :title="setting.title" @close="close" :width="'800px'" :loading="loading">
+ <el-form :model="formData" class="demo-ruleForm" label-width="100px">
+ <el-form-item label="瑙掕壊閰嶇疆" prop="roleSetting">
<el-checkbox v-model="checkAll" @change="handleCheckAllChange">鍏ㄩ��</el-checkbox>
<div style="margin: 15px 0;"></div>
- <el-checkbox-group v-model="checkedList" @change="handleCheckedCitiesChange" >
- <el-checkbox v-for="(r,i) in roleOptions" :label="r.role_id" :key="r.role_id">{{r.role_name}}</el-checkbox>
+ <el-checkbox-group v-model="checkedList" @change="handleCheckedCitiesChange">
+ <el-checkbox v-for="(r,i) in roleOptions" :label="r.role_id" :key="r.role_id">{{ r.role_name }}</el-checkbox>
</el-checkbox-group>
</el-form-item>
</el-form>
<div slot="footer" align="center" class="dialog-footer">
- <my-button name="鍙栨秷" site="form" @click="close" />
- <my-button name="淇濆瓨" site="form" @click="save" />
+ <my-button name="鍙栨秷" site="form" @click="close"/>
+ <my-button name="淇濆瓨" site="form" @click="save"/>
</div>
</win>
</template>
@@ -23,7 +23,7 @@
import * as user from "@/api/user";
export default {
- components: { win, myButton },
+ components: {win, myButton},
props: {
// setting 涓』鑷冲皯鍖呭惈鎺у埗dialog鏄剧ず鎴栭殣钘忕殑灞炴��,鍏朵綑灞炴�у彲鎷撳睍
// 灏嗘坊鍔�/淇敼鐨勫ぇ閲忔暟鎹強閫昏緫浠庡垪琛ㄩ〉闈腑鍒嗙鍑烘潵,閬垮厤鍒楄〃椤甸潰浠g爜杩囧,瀹℃煡鍥伴毦
@@ -36,22 +36,23 @@
},
data() {
return {
+ loading: true,
data_scope: null,
- checkAll:false,
- checkedList:[],
- roleList:[
- {'id':1,label:'鐜嬫兜1'},
- {'id':2,label:'鐜嬫兜2'}
+ checkAll: false,
+ checkedList: [],
+ roleList: [
+ {'id': 1, label: '鐜嬫兜1'},
+ {'id': 2, label: '鐜嬫兜2'}
],
- // 鏌ヨ鍙傛暟
- queryParams: {
- pageNum: 1,
- pageSize: 10,
- roleName: undefined,
- roleKey: undefined,
- status: 0,
- orgId: 1
- },
+ // 鏌ヨ鍙傛暟
+ queryParams: {
+ pageNum: 1,
+ pageSize: 10,
+ roleName: undefined,
+ roleKey: undefined,
+ status: 0,
+ orgId: 1
+ },
roleOptions: [],// 閫夋嫨椤�
roleCheckStrictly: true,
defaultProps: {
@@ -69,45 +70,36 @@
}
}
},
- created() {
- this.getInfo()
- this.getAllRole()
+ async created() {
+ this.title = this.setting.title
+ if (this.setting.id != null) {
+ await this.getInfo()
+ }
+ await this.getAllRole()
+ this.loading = false
},
methods: {
// 鑾峰彇鎵�鏈夎鑹�
- getAllRole() {
- const user = this.$store.getters.userInfo
- // debugger
- // if (user == undefined){
- // this.data_scope = 1
- // } else {
- // if (user.lv==null|| user.lv== 1) {
- // this.data_scope = 1
- // }
- // if (user.lv && user.lv== 2) {
- // this.data_scope = 2
- // }
- // if (user.lv && user.lv== 3) {
- // this.data_scope = 3
- // }
- // }
- this.data_scope = 1
- role.listRoleByDataScope({dataScope: this.data_scope}).then(response => {
- if (response) {
- this.roleOptions = response;
- } else {
- this.roleOptions = [];
- }
- this.loading = false;
- }
- );
+ async getAllRole() {
+ // const user = this.$store.getters.userInfo
+ // this.data_scope = 1
+ this.data_scope = this.$store.getters.userInfo ? this.$store.getters.userInfo.lv : ''
+ await role.listRoleByDataScope({dataScope: this.setting.data_scope}).then(response => {
+ if (response) {
+ this.roleOptions = response;
+ } else {
+ this.roleOptions = [];
+ }
+ this.loading = false;
+ }
+ );
},
- handleCheckAllChange(val){
- if(val){
- this.checkedList = this.roleOptions.map(x=>{
+ handleCheckAllChange(val) {
+ if (val) {
+ this.checkedList = this.roleOptions.map(x => {
return x.role_id
})
- }else{
+ } else {
this.checkedList = []
}
},
@@ -115,52 +107,50 @@
let checkedCount = value.length;
this.checkAll = checkedCount === this.roleOptions.length;
},
- getInfo() {
- this.title = this.setting.title
- if ( this.setting.id != null ) {
- // 鏌ヨ鏁版嵁
- user.getUser({ id: this.setting.id }).then(res => {
- const data = res.data
- this.formData = Object.assign(this.formData, data)
- this.checkedList = res.list.map(x=>{
- return x.role_id
- })
- if (res.list.length===this.roleOptions.length){
- this.handleCheckedCitiesChange(res.list)
- }
+ async getInfo() {
+ // 鏌ヨ鏁版嵁
+ await user.getUser({id: this.setting.id}).then(res => {
+ const data = res.data
+ this.formData = Object.assign(this.formData, data)
+ this.checkedList = res.list.map(x => {
+ return x.role_id
})
- }
+ if (res.list.length === this.roleOptions.length) {
+ this.handleCheckedCitiesChange(res.list)
+ }
+ })
},
close() {
- this.formData = {
- projectName: '',
- projectSubName: '',
- projectCode: '',
- projectContact: '',
- projectTel: '',
- projectEmail: '',
- projectStart: null,
- projectEnd: null,
- projectDesc: '',
- status: 1
- },
+ this.formData = {
+ userName: '',
+ userCode: '',
+ userPhone: '',
+ sex: 1,
+ status: 1,
+ remark: '',
+ seq: null
+ }
this.$emit('close')
},
save() {
- const params = Object.assign({}, this.formData)
- params.roleList=this.checkedList
- if (params.id) {
- console.log(params+'params')
- user.updRole(params).then(res => {
- if (res) {
- this.$message.success('淇濆瓨鎴愬姛锛�')
- this.close()
- this.$emit('search')
- } else {
- this.$message.error('淇濆瓨澶辫触')
- }
- })
- }
+ const params = Object.assign({}, this.formData)
+ params.roleList = this.checkedList
+ if (params.id) {
+ if (this.loading) return;
+ this.loading = true
+ user.updRole(params).then(res => {
+ this.loading = false
+ if (res) {
+ this.$message.success('淇濆瓨鎴愬姛锛�')
+ this.close()
+ this.$emit('search')
+ } else {
+ this.$message.error('淇濆瓨澶辫触')
+ }
+ }).catch(() => {
+ this.loading = false
+ })
+ }
}
}
}
diff --git a/admin-web/src/views/systemManger/server/user/index.vue b/admin-web/src/views/systemManger/server/user/index.vue
index 2d13d56..ff44999 100644
--- a/admin-web/src/views/systemManger/server/user/index.vue
+++ b/admin-web/src/views/systemManger/server/user/index.vue
@@ -18,14 +18,14 @@
<el-row style="margin-top: 15px">
<el-col>
<!--鍒楄〃-->
- <my-table-v2 ref="myTable" :filter="filterFrom" :table="table" />
+ <my-table-v2 ref="myTable" :filter="filterFrom" :table="table"/>
</el-col>
</el-row>
</el-card>
</el-col>
</el-row>
<!--娣诲姞/缂栬緫寮圭獥-->
- <edit v-if="editSetting.show" :setting="editSetting" @close="editSetting.show = false" @search="search" />
+ <edit v-if="editSetting.show" :setting="editSetting" @close="editSetting.show = false" @search="search"/>
<editRole
v-if="editRoleSetting.show"
:setting="editRoleSetting"
@@ -45,6 +45,7 @@
import editRole from './editRole';
import * as finsystenant from '@/api/baseSetting/finsystenant';
import * as user from '@/api/user';
+import {LongToDateTime} from "@/utils/DateFormatter";
export default {
name: 'index',
@@ -57,7 +58,7 @@
treeDataList: [],
// 鎼滅储鏉′欢
filterFrom: {
- tenantCode: 0,
+ tenantCode: null,
userName: null,
userCode: null,
},
@@ -66,6 +67,7 @@
tenantId: null, //鍖哄垝id
tenantCode: null, //鍖哄垝code
tenantName: null, //鍖哄垝鍚嶇О
+ data_scope: 0, //瑙掕壊鑼冨洿
editSetting: {
title: '',
id: '',
@@ -75,6 +77,7 @@
// 缂栬緫瑙掕壊閰嶇疆
editRoleSetting: {
title: '',
+ data_scope: 0,
id: '',
show: false,
},
@@ -105,10 +108,10 @@
},
// 鍒椾俊鎭�
columns: [
- { title: '缂栧彿', field: 'userCode', align: 'left' },
- { title: '鐢ㄦ埛濮撳悕', field: 'userName', align: 'left' },
- { title: '鐧诲綍鍚�', field: 'userPhone', align: 'center' },
- { title: '鎵�灞炴満鏋�', field: 'tenantName', align: 'center', width: 150 },
+ {title: '浜哄憳濮撳悕', field: 'userName', align: 'left', minWidth: 140},
+ {title: '鐧诲綍鍚�', field: 'userCode', align: 'left', minWidth: 140},
+ {title: '鎵嬫満鍙�', field: 'userPhone', align: 'center', width: 110},
+ { title: '鎵�灞炴満鏋�', field: 'tenantName', align: 'center', minWidth: 150 },
{ title: '閮ㄩ棬', field: 'sysDeptName', align: 'center' },
{
field: 'status',
@@ -145,15 +148,15 @@
width: '250', // 鍒楀
attr: [
{
- title: '缂栬緫',
- events: (row) => {
- this.showAdd(row.id);
- },
- },
- {
title: '瑙掕壊',
events: (row) => {
this.showEditRole(row.id);
+ },
+ },
+ {
+ title: '缂栬緫',
+ events: (row) => {
+ this.showAdd(row.id);
},
},
{
@@ -180,8 +183,27 @@
created() {
// 鑾峰彇鏈烘瀯鏍�
this.initTreeData();
+ this.data_scope = this.$store.getters.userInfo ? this.$store.getters.userInfo.lv : ''
+ if(this.data_scope===0){
+ this.data_scope=1
+ }
+ this.editSetting.data_scope = this.data_scope;
+ this.editRoleSetting.data_scope = this.data_scope;
},
methods: {
+ //瀵煎叆
+ importUser() {
+ this.importSetting.dialogShow = true
+ this.importSetting.onSuccess = (response, callBack) => {
+ if (response.code === 1) {
+ this.$message.success(response.msg)
+ this.search(1)
+ } else {
+ this.$message.warning(response.msg)
+ }
+ callBack()
+ }
+ },
// 宸︿晶鏍戝垵濮嬪寲
initTreeData() {
finsystenant.getTree().then((res) => {
@@ -198,11 +220,11 @@
updState(row) {
let vm = this
let text = row.status === 0 ? "鍚敤" : "绂佺敤";
- vm.$modal.confirm('纭瑕�' + text + '"' + row.userName + '"鍚楋紵').then(function() {
- let params = Object.assign({},row)
+ vm.$modal.confirm('纭瑕�' + text + '"' + row.userName + '"鍚楋紵').then(function () {
+ let params = Object.assign({}, row)
params.status = row.status === 1 ? 0 : 1
- user.updateStatus(params).then(res=>{
- if(res){
+ user.updateStatus(params).then(res => {
+ if (res) {
row.status = row.status === 1 ? 0 : 1
vm.$modal.msgSuccess(text + "鎴愬姛");
}
@@ -217,13 +239,17 @@
id: param.id,
name: param.name,
code: param.code,
+ lv: param.lv,
},
);
+ let data_scope = Number(this.data_scope) + (param.lv-1)
if (this.p.code != undefined && this.p.code != null) {
this.filterFrom.tenantCode = this.p.code;
this.tenantId = this.p.id;
this.tenantName = this.p.name;
this.editSetting.tenantCode = this.p.code;
+ this.editSetting.data_scope = data_scope;
+ this.editRoleSetting.data_scope = data_scope;
} else {
this.filterFrom.tenantCode = 0;
}
@@ -278,6 +304,22 @@
this.editSetting.title = title;
this.editSetting.show = true;
},
+ // 鍒犻櫎鐢ㄦ埛璐﹀彿
+ del(row) {
+ row.isDelete = 0;
+ this.$modal
+ .confirm('鏄惁瑕佸垹闄�"' + row.userName + '"鐨勮处鍙凤紵')
+ .then(function () {
+ user.updateStatus(row).then((res) => {
+ });
+ })
+ .then((res) => {
+ this.$message.success('鍒犻櫎鎴愬姛锛�');
+ this.search();
+ })
+ .catch(() => {
+ });
+ },
showEditRole(id) {
let title = '娣诲姞';
if (id != null) {
diff --git a/admin-web/src/views/systemSetting/role/index.vue b/admin-web/src/views/systemSetting/role/index.vue
index 73b530d..25bb0db 100644
--- a/admin-web/src/views/systemSetting/role/index.vue
+++ b/admin-web/src/views/systemSetting/role/index.vue
@@ -2,104 +2,6 @@
<div class="app-container">
<el-container>
<el-card class="box-card" style="width: 100%" shadow="never">
- <!-- <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">-->
- <!-- <el-form-item label="瑙掕壊鍚嶇О" prop="roleName">-->
- <!-- <el-input-->
- <!-- v-model="queryParams.roleName"-->
- <!-- placeholder="璇疯緭鍏�"-->
- <!-- clearable-->
- <!-- @keyup.enter.native="handleQuery"-->
- <!-- style="width: 150px"-->
- <!-- />-->
- <!-- </el-form-item>-->
- <!-- <el-form-item label="鐘舵��" prop="status">-->
- <!-- <el-select-->
- <!-- style="width: 150px"-->
- <!-- v-model="queryParams.status"-->
- <!-- placeholder="璇烽�夋嫨"-->
- <!-- clearable>-->
- <!-- <el-option-->
- <!-- v-for="dict in constants.normalOrDisabled"-->
- <!-- :key="dict.value"-->
- <!-- :label="dict.label"-->
- <!-- :value="dict.value"-->
- <!-- />-->
- <!-- </el-select>-->
- <!-- </el-form-item>-->
- <!-- <el-form-item>-->
- <!-- <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鏌ヨ</el-button>-->
- <!-- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button>-->
- <!-- </el-form-item>-->
- <!-- </el-form>-->
- <!-- <el-row :gutter="10" class="mb8">-->
- <!-- <el-col :span="1.5">-->
- <!-- <el-button-->
- <!-- type="primary"-->
- <!-- plain-->
- <!-- icon="el-icon-plus"-->
- <!-- size="mini"-->
- <!-- @click="handleAdd"-->
- <!-- v-hasPermi="['system:role:add']"-->
- <!-- >鏂板</el-button>-->
- <!-- </el-col>-->
- <!-- </el-row>-->
- <!-- <el-table v-loading="loading" :data="roleList" @selection-change="handleSelectionChange">-->
- <!-- <el-table-column type="selection" width="55" align="center" />-->
- <!-- <el-table-column label="瑙掕壊缂栧彿" prop="role_id" width="160" />-->
- <!-- <el-table-column label="瑙掕壊鍚嶇О" prop="role_name" :show-overflow-tooltip="true" width="150" />-->
- <!-- <el-table-column label="鏉冮檺瀛楃" prop="role_key" :show-overflow-tooltip="true" width="150" />-->
- <!-- <el-table-column label="鏄剧ず椤哄簭" prop="role_sort" width="100" />-->
- <!-- <el-table-column label="鐘舵��" align="center" width="100">-->
- <!-- <template slot-scope="scope">-->
- <!-- <el-switch-->
- <!-- v-model="scope.row.status"-->
- <!-- :active-value=0-->
- <!-- :inactive-value=1-->
- <!-- @change="handleStatusChange(scope.row)"-->
- <!-- ></el-switch>-->
- <!-- </template>-->
- <!-- </el-table-column>-->
- <!-- <el-table-column label="澶囨敞" align="center" prop="remark" width="180">-->
- <!-- </el-table-column>-->
- <!-- <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width" width="180">-->
- <!-- <template slot-scope="scope">-->
- <!-- <el-button-->
- <!-- size="mini"-->
- <!-- type="text"-->
- <!-- icon="el-icon-edit"-->
- <!-- @click="handleUpdate(scope.row)"-->
- <!-- v-hasPermi="['system:role:edit']"-->
- <!-- >淇敼</el-button>-->
- <!-- <el-button-->
- <!-- size="mini"-->
- <!-- type="text"-->
- <!-- icon="el-icon-delete"-->
- <!-- @click="handleDelete(scope.row)"-->
- <!-- v-hasPermi="['system:role:remove']"-->
- <!-- >鍒犻櫎</el-button>-->
- <!--<!– <el-dropdown size="mini" @command="(command) => handleCommand(command, scope.row)" v-hasPermi="['system:role:edit']">-->
- <!-- <span class="el-dropdown-link">-->
- <!-- <i class="el-icon-d-arrow-right el-icon--right"></i>鏇村-->
- <!-- </span>-->
- <!-- <el-dropdown-menu slot="dropdown">-->
- <!-- <el-dropdown-item command="handleDataScope" icon="el-icon-circle-check"-->
- <!-- v-hasPermi="['system:role:edit']">鏁版嵁鏉冮檺</el-dropdown-item>-->
- <!-- <el-dropdown-item command="handleAuthUser" icon="el-icon-user"-->
- <!-- v-hasPermi="['system:role:edit']">鍒嗛厤鐢ㄦ埛</el-dropdown-item>-->
- <!-- </el-dropdown-menu>-->
- <!-- </el-dropdown>–>-->
- <!-- </template>-->
- <!-- </el-table-column>-->
- <!-- </el-table>-->
- <!-- <el-pagination-->
- <!-- :current-page="queryParams.pageNum"-->
- <!-- :page-sizes="constants.page.limit"-->
- <!-- :layout="constants.page.layout"-->
- <!-- :total="this.total"-->
- <!-- @size-change="changeSize"-->
- <!-- @current-change="changePage"-->
- <!-- />-->
- <!--鎼滅储鏉′欢-->
<div class="filter-container">
<my-search ref="searchBar" :items="items" @search="fifterForm"></my-search>
</div>
@@ -113,19 +15,19 @@
</el-container>
<!-- 娣诲姞鎴栦慨鏀硅鑹查厤缃璇濇 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
- <el-form ref="form" :model="form" :rules="rules" label-width="100px">
+ <el-form v-loading="loading" ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="瑙掕壊鍚嶇О" prop="role_name">
<el-input v-model="form.role_name" placeholder="璇疯緭鍏ヨ鑹插悕绉�"/>
</el-form-item>
- <el-form-item prop="role_key">
- <span slot="label">
- <el-tooltip content="瑙掕壊鏍囪瘑锛岀洰鍓嶆殏鏈娇鐢�" placement="top">
- <i class="el-icon-question"></i>
- </el-tooltip>
- 瑙掕壊鏍囪瘑
- </span>
- <el-input v-model="form.role_key" placeholder="璇疯緭鍏ヨ鑹叉爣璇�"/>
- </el-form-item>
+ <!-- <el-form-item prop="role_key">
+ <span slot="label">
+ <el-tooltip content="瑙掕壊鏍囪瘑锛岀洰鍓嶆殏鏈娇鐢�" placement="top">
+ <i class="el-icon-question"></i>
+ </el-tooltip>
+ 瑙掕壊鏍囪瘑
+ </span>
+ <el-input v-model="form.role_key" placeholder="璇疯緭鍏ヨ鑹叉爣璇�"/>
+ </el-form-item>-->
<el-form-item label="瑙掕壊椤哄簭" prop="role_sort">
<el-input-number v-model="form.role_sort" controls-position="right" :min="0"/>
</el-form-item>
@@ -133,23 +35,19 @@
<el-radio-group v-model="form.status">
<el-radio :label="0">姝e父</el-radio>
<el-radio :label="1">绂佺敤</el-radio>
- <!-- <el-radio-->
- <!-- v-for="dict in constants.normalOrDisabled"-->
- <!-- :key="dict.value"-->
- <!-- :label="dict.value"-->
- <!-- >{{dict.label}}</el-radio>-->
</el-radio-group>
</el-form-item>
-<!-- <el-form-item label="瑙掕壊鑼冨洿">
+ <el-form-item label="瑙掕壊鑼冨洿">
<el-radio-group v-model="form.data_scope">
- <el-radio :label="1" checked>鐪�</el-radio>
- <el-radio :label="2">甯�</el-radio>
- <el-radio :label="3">鍘�</el-radio>
+ <el-radio v-if="$store.getters.userInfo.lv<2" :label="1">鐪�</el-radio>
+ <el-radio v-if="$store.getters.userInfo.lv<3" :label="2">甯�</el-radio>
+ <el-radio v-if="$store.getters.userInfo.lv<4" :label="3">鍘�</el-radio>
</el-radio-group>
- </el-form-item>-->
+ </el-form-item>
<el-form-item label="鑿滃崟鏉冮檺">
<el-checkbox v-model="menuExpand" @change="handleCheckedTreeExpand($event, 'menu')">灞曞紑/鎶樺彔</el-checkbox>
- <el-checkbox v-model="menuNodeAll" @change="handleCheckedTreeNodeAll($event, 'menu')">鍏ㄩ��/鍏ㄤ笉閫�</el-checkbox>
+ <el-checkbox v-model="menuNodeAll" @change="handleCheckedTreeNodeAll($event, 'menu')">鍏ㄩ��/鍏ㄤ笉閫�
+ </el-checkbox>
<el-checkbox v-model="form.menu_check_strictly" @change="handleCheckedTreeConnect($event, 'menu')">鐖跺瓙鑱斿姩
</el-checkbox>
<el-tree
@@ -176,9 +74,9 @@
</template>
<script>
-import {addRole, changeRoleStatus, dataScope, delRole, getRole, listRole, updateRole} from "@/api/system/role";
-import {roleMenuTreeselect, treeselect as menuTreeselect} from "@/api/system/menu";
-import {listOrgRoot, roleDeptTreeselect, treeselect as deptTreeselect} from "@/api/system/dept";
+import {listRole, getRole, delRole, addRole, updateRole, dataScope, changeRoleStatus} from "@/api/system/role";
+import {treeselect as menuTreeselect, roleMenuTreeselect} from "@/api/system/menu";
+import {treeselect as deptTreeselect, roleDeptTreeselect, listOrgRoot} from "@/api/system/dept";
import MyTableV2 from "@/components/myTable/myTableV2";
import SettingIplatform from '@/utils/settingIplatform';
import items from './items'
@@ -262,9 +160,10 @@
tableShow: false,
// 琛ㄦ牸鏁版嵁
table: {
+ autoLoad: false,
showIndex: true, // 鏄惁鏄剧ず搴忓彿
expand: false, // 鏄惁鏄剧ず璇︽儏鏁版嵁
- url: SettingIplatform.apiBaseURL + '/system/role/list', // 璇锋眰鍦板潃
+ url: SettingIplatform.apiBaseURL + '/pc/fin/sys/tenant/user/query/role', // 璇锋眰鍦板潃
// 宸ュ叿鏉�
tools: {
columnsCtrl: {// 鍒楁帶鍒舵寜閽�
@@ -286,12 +185,12 @@
},
// 鍒椾俊鎭�
columns: [
- {title: '瑙掕壊缂栧彿', field: 'role_id', align: 'center',},
- {title: '瑙掕壊鍚嶇О', field: 'role_name', align: 'center',},
- {title: '鏉冮檺瀛楃', field: 'role_key', align: 'center',},
- {title: '椤哄簭鍙�', field: 'role_sort', align: 'center',},
+ {title: '瑙掕壊缂栧彿', field: 'role_id', align: 'center', width: 135},
+ {title: '瑙掕壊鍚嶇О', field: 'role_name', align: 'left', minWidth: 200},
+ // {title: '鏉冮檺瀛楃', field: 'role_key', align: 'center', width: 100},
+ {title: '鏄剧ず椤哄簭', field: 'role_sort', align: 'center', width: 100},
{
- title: '鐘舵��', field: 'status', align: 'center',
+ title: '鐘舵��', field: 'status', align: 'center', width: 100,
switch: row => {
const result = {}
if (row.status == 0) {
@@ -314,7 +213,7 @@
return result
}
},
- // {title: '澶囨敞', field: 'remark', align: 'left', width: '250px'},
+ {title: '澶囨敞', field: 'remark', align: 'left', minWidth: 200},
],
// 鎿嶄綔淇℃伅
operation: {
@@ -368,6 +267,9 @@
},
// 琛ㄥ崟鍙傛暟
form: {
+ role_name: '',
+ role_key: '',
+ role_sort: '',
data_scope: 1,
status: 1
},
@@ -395,6 +297,7 @@
methods: {
fifterForm(params) {
this.queryParams = Object.assign(this.queryParams, params)
+ this.queryParams.status = 0
this.search(1)
},
// 鏌ヨtable鍒楄〃
@@ -407,33 +310,30 @@
},
/** 鑾峰彇椤剁骇鏈烘瀯鍒楄〃閫夋嫨妗� 2022-12-15 */
getRootOrgList() {
- this.loading = true;
listOrgRoot().then(response => {
this.rootOrgList = response;
this.selectedRootOrgId = this.rootOrgList[0].id;
this.queryParams.orgId = this.selectedRootOrgId;
- this.loading = false;
}).then(() => {
this.tableShow = true
- this.search(1);
- }).catch(function () {
- // this.loading = false;
+ this.$nextTick(() => {
+ this.search(1);
+ })
+
});
},
/** 鏌ヨ瑙掕壊鍒楄〃 */
getList() {
- this.loading = true;
this.selectedRootOrgId = this.queryParams.orgId;
listRole(this.queryParams).then(response => {
this.roleList = response.datas;
this.total = response.totalRows;
- this.loading = false;
}
);
},
/** 鏌ヨ鑿滃崟鏍戠粨鏋� */
- getMenuTreeselect() {
- menuTreeselect().then(response => {
+ async getMenuTreeselect() {
+ await menuTreeselect().then(response => {
this.menuOptions = response;
});
},
@@ -503,23 +403,24 @@
if (this.$refs.menu != undefined) {
this.$refs.menu.setCheckedKeys([]);
}
- this.menuExpand = false,
- this.menuNodeAll = false,
- this.deptExpand = true,
- this.deptNodeAll = false,
- this.form = {
- org_id: undefined, // 椤剁骇鏈烘瀯ID
- role_id: undefined,
- role_name: undefined,
- role_key: "None",
- role_sort: 0,
- status: 0,
- menuIds: [],
- deptIds: [],
- menu_check_strictly: true,
- dept_check_strictly: true,
- remark: undefined
- };
+ this.menuExpand = false
+ this.menuNodeAll = false
+ this.deptExpand = true
+ this.deptNodeAll = false
+ this.form = {
+ org_id: undefined, // 椤剁骇鏈烘瀯ID
+ role_id: undefined,
+ role_name: undefined,
+ data_scope: this.$store.getters.userInfo ? this.$store.getters.userInfo.lv : 1,
+ role_key: "None",
+ role_sort: 0,
+ status: 0,
+ menuIds: [],
+ deptIds: [],
+ menu_check_strictly: true,
+ dept_check_strictly: true,
+ remark: undefined
+ };
this.resetForm("form");
},
changeSize(e) {
@@ -593,13 +494,15 @@
}
},
/** 鏂板鎸夐挳鎿嶄綔 */
- handleAdd() {
+ async handleAdd() {
+ this.loading = true
this.reset();
- this.getMenuTreeselect();
+ await this.getMenuTreeselect();
// 2022-12-18 娣诲姞涓婇《绾ф満鏋処D
this.form.org_id = this.selectedRootOrgId;
this.open = true;
this.title = "娣诲姞瑙掕壊";
+ this.loading = false
},
/** 淇敼鎸夐挳鎿嶄綔 */
handleUpdate(row) {
@@ -607,6 +510,7 @@
// const roleId = row.role_id || this.ids
const roleId = row.role_id;
const roleMenu = this.getRoleMenuTreeselect(roleId);
+ this.loading = true
getRole(roleId).then(response => {
this.form = response;
this.open = true;
@@ -623,6 +527,9 @@
});
});
this.title = "淇敼瑙掕壊";
+ this.loading = false
+ }).catch(() => {
+ this.loading = false
});
},
/** 閫夋嫨瑙掕壊鏉冮檺鑼冨洿瑙﹀彂 */
@@ -658,20 +565,22 @@
// 2022-12-19,鎶婅繖涓や釜瀛楁璁剧疆涓烘暟鍊硷紝鐩墠鏆備笉浣跨敤锛岃涓嶅悗鍙扮被鍨嬭浆鎹㈤敊璇�(boolean)
this.form.menu_check_strictly = 1;
this.form.dept_check_strictly = 1;
+ // 2023-11-30 澧炲姞榛樿data_scope涓�1
+ // this.form.data_scope = 1;
if (this.form.role_id != undefined) {
this.form.menuIds = this.getMenuAllCheckedKeys();
updateRole(this.form).then(response => {
this.$modal.msgSuccess("淇敼鎴愬姛");
this.open = false;
- this.getList();
+ this.search()
});
} else {
this.form.menuIds = this.getMenuAllCheckedKeys();
addRole(this.form).then(response => {
this.$modal.msgSuccess("鏂板鎴愬姛");
this.open = false;
- this.getList();
+ this.search()
});
}
}
@@ -694,7 +603,7 @@
this.$modal.confirm('鏄惁纭鍒犻櫎瑙掕壊涓�"' + row.role_name + '"鐨勬暟鎹」锛�').then(function () {
return delRole(roleIds);
}).then(() => {
- this.this.search();
+ this.search();
this.$modal.msgSuccess("鍒犻櫎鎴愬姛");
}).catch(() => {
});
--
Gitblit v1.9.1