用户管理修改

This commit is contained in:
zyx.net
2022-11-16 11:21:09 +08:00
parent ea4d8bc82f
commit afb50c3fa9
7 changed files with 144 additions and 8 deletions
@@ -1,6 +1,6 @@
<template>
<a-drawer
:title="$t('See')"
:title="$t('edit')"
:maskClosable="true"
:width="drawerWidth"
placement="right"
@@ -66,6 +66,7 @@
:placeholder="$t('selectUserRole')"
optionFilterProp="children"
v-model="selectedRole"
@change='selectChange'
:disabled='false'
:getPopupContainer="(target) => target.parentNode">
<a-select-option v-for="(role,roleindex) in roleList" :key="roleindex.toString()" :value="role.id">
@@ -73,6 +74,19 @@
</a-select-option>
</a-select>
</a-form-item>
<a-form-item v-if='viewshow' :label="$t('NareaOfResponsibility')" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-multi-select-tag class="box-input" v-model="dutyTerritories"
:placeholder="$t('PleaseSelect')+$t('NareaOfResponsibility')"
:type="'select'"
:triggerChange="false" :dictCode="'duty_territory'"/>
</a-form-item>
<a-form-item v-if='viewshow' :label="$t('brand')" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-multi-select-tag class="box-input" v-model="brands"
:placeholder="$t('PleaseSelect')+$t('brand')"
:type="'select'"
:triggerChange="false" :dictCode="'brand'"/>
</a-form-item>
<!--部门分配-->
<!-- v-show="!departDisabled && !disabled"-->
@@ -194,7 +208,7 @@
import departWindow from './DepartWindow'
import { ACCESS_TOKEN } from '@/store/mutation-types'
import { getAction, postAction } from '@/api/manage'
import { addUser, editUser, queryUserRole, queryall } from '@/api/api'
import { addUser, editUser, queryUserRole, queryall,ajaxGetDictItems,getDictItemsFromCache } from '@/api/api'
import { disabledAuthFilter } from '@/utils/authFilter'
import { duplicateCheck } from '@/api/api'
import JImageUpload from '../../../components/jero/JImageUpload'
@@ -215,11 +229,13 @@
disabled: false,
modaltoggleFlag: true,
confirmDirty: false,
viewshow: false,
selectedDepartKeys: [], //保存用户选择部门id
checkedDepartKeys: [],
checkedDepartNames: [], // 保存部门的名称 =>title
checkedDepartNameString: '', // 保存部门的名称 =>title
resultDepartOptions: [],
dictOptions: [],
userId: '', //保存用户id
disableSubmit: false,
userDepartModel: { userId: '', departIdList: [] }, // 保存SysUserDepart的用户部门中间表数据需要的对象
@@ -276,6 +292,8 @@
model: {},
roleList: [],
selectedRole: [],
dutyTerritories: '',
brands: '',
labelCol: {
xs: { span: 24 },
sm: { span: 5 }
@@ -346,17 +364,63 @@
queryUserRole({ userid: userid }).then((res) => {
if (res.success) {
this.selectedRole = res.result
this.selectedRole.map((item,index) => {
this.roleList.map((val,index) => {
if(val.roleCode == 'Viewer' && item == val.id){
this.$nextTick(() => {
this.viewshow = true
})
return
}else{
this.viewshow = false
}
})
})
this.initDictData()
} else {
console.log(res.message)
}
})
},
selectChange(value){
value.map((item,index) => {
this.roleList.map((val,index) => {
if(val.roleCode == 'Viewer' && item == val.id){
this.$nextTick(() => {
this.viewshow = true
})
return
}else{
this.viewshow = false
}
})
})
},
initDictData() {
//优先从缓存中读取字典配置
if (getDictItemsFromCache(this.dictCode)) {
this.dictOptions = getDictItemsFromCache(this.dictCode)
return
}
//根据字典Code, 初始化字典数组
ajaxGetDictItems(this.dictCode, null).then((res) => {
if (res.success) {
// console.log(res.result);
this.dictOptions = res.result
}
})
},
handleSubmitOk() {
this.confirmLoading = true
let selectedRole = JSON.parse(JSON.stringify(this.selectedRole))
let dutyTerritorie = JSON.parse(JSON.stringify(this.dutyTerritories))
let brand = JSON.parse(JSON.stringify(this.brands))
let param = {
ids: this.userId,
selectedroles: selectedRole.join(',')
selectedroles: selectedRole.join(','),
dutyTerritories: dutyTerritorie,
brands: brand
}
postAction('/sys/user/setRole', param).then((res) => {
if (res.success) {