| | |
| | | } |
| | | } |
| | | }, |
| | | 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; |
| | | } |
| | |
| | | :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" |
| | |
| | | <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" |
| | |
| | | </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"> |
| | |
| | | <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> |
| | |
| | | import {departmentListAll} from "@/api/system/deptment"; |
| | | |
| | | export default { |
| | | components: {winSm, myButton}, |
| | | props: { |
| | | // setting 中须至少包含控制dialog显示或隐藏的属性,其余属性可拓展 |
| | | // 将添加/修改的大量数据及逻辑从列表页面中分离出来,避免列表页面代码过多,审查困难 |
| | | // 若此页面须回传数据至父页面,可在引用组件时添加事件,本页面使用this.$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显示或隐藏的属性,其余属性可拓展 |
| | | // 将添加/修改的大量数据及逻辑从列表页面中分离出来,避免列表页面代码过多,审查困难 |
| | | // 若此页面须回传数据至父页面,可在引用组件时添加事件,本页面使用this.$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> |
| | |
| | | <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> |
| | |
| | | import * as user from "@/api/user"; |
| | | |
| | | export default { |
| | | components: { win, myButton }, |
| | | components: {win, myButton}, |
| | | props: { |
| | | // setting 中须至少包含控制dialog显示或隐藏的属性,其余属性可拓展 |
| | | // 将添加/修改的大量数据及逻辑从列表页面中分离出来,避免列表页面代码过多,审查困难 |
| | |
| | | }, |
| | | 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: { |
| | |
| | | } |
| | | } |
| | | }, |
| | | 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 = [] |
| | | } |
| | | }, |
| | |
| | | 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 |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | <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" |
| | |
| | | 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', |
| | |
| | | treeDataList: [], |
| | | // 搜索条件 |
| | | filterFrom: { |
| | | tenantCode: 0, |
| | | tenantCode: null, |
| | | userName: null, |
| | | userCode: null, |
| | | }, |
| | |
| | | tenantId: null, //区划id |
| | | tenantCode: null, //区划code |
| | | tenantName: null, //区划名称 |
| | | data_scope: 0, //角色范围 |
| | | editSetting: { |
| | | title: '', |
| | | id: '', |
| | |
| | | // 编辑角色配置 |
| | | editRoleSetting: { |
| | | title: '', |
| | | data_scope: 0, |
| | | id: '', |
| | | show: false, |
| | | }, |
| | |
| | | }, |
| | | // 列信息 |
| | | 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', |
| | |
| | | width: '250', // 列宽 |
| | | attr: [ |
| | | { |
| | | title: '编辑', |
| | | events: (row) => { |
| | | this.showAdd(row.id); |
| | | }, |
| | | }, |
| | | { |
| | | title: '角色', |
| | | events: (row) => { |
| | | this.showEditRole(row.id); |
| | | }, |
| | | }, |
| | | { |
| | | title: '编辑', |
| | | events: (row) => { |
| | | this.showAdd(row.id); |
| | | }, |
| | | }, |
| | | { |
| | |
| | | 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) => { |
| | |
| | | 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 + "成功"); |
| | | } |
| | |
| | | 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; |
| | | } |
| | |
| | | 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) { |
| | |
| | | <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> |
| | |
| | | </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> |
| | |
| | | <el-radio-group v-model="form.status"> |
| | | <el-radio :label="0">正常</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 |
| | |
| | | </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' |
| | |
| | | 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: {// 列控制按钮 |
| | |
| | | }, |
| | | // 列信息 |
| | | 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) { |
| | |
| | | return result |
| | | } |
| | | }, |
| | | // {title: '备注', field: 'remark', align: 'left', width: '250px'}, |
| | | {title: '备注', field: 'remark', align: 'left', minWidth: 200}, |
| | | ], |
| | | // 操作信息 |
| | | operation: { |
| | |
| | | }, |
| | | // 表单参数 |
| | | form: { |
| | | role_name: '', |
| | | role_key: '', |
| | | role_sort: '', |
| | | data_scope: 1, |
| | | status: 1 |
| | | }, |
| | |
| | | methods: { |
| | | fifterForm(params) { |
| | | this.queryParams = Object.assign(this.queryParams, params) |
| | | this.queryParams.status = 0 |
| | | this.search(1) |
| | | }, |
| | | // 查询table列表 |
| | |
| | | }, |
| | | /** 获取顶级机构列表选择框 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; |
| | | }); |
| | | }, |
| | |
| | | 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) { |
| | |
| | | } |
| | | }, |
| | | /** 新增按钮操作 */ |
| | | handleAdd() { |
| | | async handleAdd() { |
| | | this.loading = true |
| | | this.reset(); |
| | | this.getMenuTreeselect(); |
| | | await this.getMenuTreeselect(); |
| | | // 2022-12-18 添加上顶级机构ID |
| | | this.form.org_id = this.selectedRootOrgId; |
| | | this.open = true; |
| | | this.title = "添加角色"; |
| | | this.loading = false |
| | | }, |
| | | /** 修改按钮操作 */ |
| | | handleUpdate(row) { |
| | |
| | | // 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; |
| | |
| | | }); |
| | | }); |
| | | this.title = "修改角色"; |
| | | this.loading = false |
| | | }).catch(() => { |
| | | this.loading = false |
| | | }); |
| | | }, |
| | | /** 选择角色权限范围触发 */ |
| | |
| | | // 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() |
| | | }); |
| | | } |
| | | } |
| | |
| | | this.$modal.confirm('是否确认删除角色为"' + row.role_name + '"的数据项?').then(function () { |
| | | return delRole(roleIds); |
| | | }).then(() => { |
| | | this.this.search(); |
| | | this.search(); |
| | | this.$modal.msgSuccess("删除成功"); |
| | | }).catch(() => { |
| | | }); |