用户管理修改

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
View File
@@ -1361,4 +1361,5 @@ module.exports = {
relatedProjectVersion:'Related project version', relatedProjectVersion:'Related project version',
Importfailure:'Import failure', Importfailure:'Import failure',
CuiBan:'CuiBan', CuiBan:'CuiBan',
brand:'Brand',
} }
+1
View File
@@ -1462,4 +1462,5 @@ module.exports = {
relatedProjectVersion:'相关项目版本', relatedProjectVersion:'相关项目版本',
Importfailure:'导入失败', Importfailure:'导入失败',
CuiBan:'催办', CuiBan:'催办',
brand:'品牌',
} }
@@ -163,7 +163,7 @@ export default {
} }
.itemModel { .itemModel {
width: calc(100% - 130px); width: calc(80% - 130px);
display: inline-block; display: inline-block;
margin-top: 2px; margin-top: 2px;
} }
@@ -172,7 +172,7 @@ export default {
} }
.itemModel { .itemModel {
width: calc(100% - 130px); width: calc(80% - 130px);
display: inline-block; display: inline-block;
margin-top: 2px; margin-top: 2px;
} }
+1 -1
View File
@@ -132,7 +132,7 @@
</div> </div>
</template> </template>
<span slot="action" slot-scope="text, record"> <span slot="action" slot-scope="text, record">
<a @click="handleEdit(record)" style='margin-right: 10px' v-has="'sys:user:detail'">{{$t('See')}}</a> <a @click="handleEdit(record)" style='margin-right: 10px' v-has="'sys:user:detail'">{{$t('edit')}}</a>
<!-- <a @click="resetPassword(record)" v-has="'sys:user:resetpass'">{{$t('resetPassword')}}</a>--> <!-- <a @click="resetPassword(record)" v-has="'sys:user:resetpass'">{{$t('resetPassword')}}</a>-->
</span> </span>
@@ -12,7 +12,7 @@
<a-row :gutter='24'> <a-row :gutter='24'>
<a-col :span='24'> <a-col :span='24'>
<a-form-item :label="$t('RoleAssignment')" :labelCol="labelCol" :wrapperCol="wrapperCol"> <a-form-item :label="$t('RoleAssignment')" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-select mode="multiple" :placeholder="$t('PleaseSelect')+$t('controlVerification')" v-model:value="selectedRole"> <a-select mode="multiple" :placeholder="$t('PleaseSelect')+$t('controlVerification')" v-model:value="selectedRole" @change='selectChange'>
<a-select-option v-for="(role,roleindex) in roleList" :key="role.id" :value="role.id"> <a-select-option v-for="(role,roleindex) in roleList" :key="role.id" :value="role.id">
<span style="display: inline-block;width: 100%"> <span style="display: inline-block;width: 100%">
{{ role.roleName }} {{ role.roleName }}
@@ -22,6 +22,33 @@
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row>
<a-row :gutter='24' v-if='viewshow'>
<a-col :span='24'>
<a-form-item :label="$t('NareaOfResponsibility')" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-multi-select-tag class="box-input" v-model:value="dutyTerritories"
:placeholder="$t('PleaseSelect')+$t('NareaOfResponsibility')"
:type="'select'"
:triggerChange="false" :dictCode="'duty_territory'"/>
<!-- <a-select mode="multiple" :placeholder="$t('PleaseSelect')+$t('NareaOfResponsibility')" v-model:value="dutyTerritories">-->
<!-- <a-select-option v-for="(role,roleindex) in dictOptions" :key="role.id" :value="role.id">-->
<!-- <span style="display: inline-block;width: 100%">-->
<!-- {{ role.roleName }}-->
<!-- </span>-->
<!-- </a-select-option>-->
<!-- </a-select>-->
</a-form-item>
</a-col>
</a-row>
<a-row :gutter='24' v-if='viewshow'>
<a-col :span='24'>
<a-form-item :label="$t('brand')" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-multi-select-tag class="box-input" v-model:value="brands"
:placeholder="$t('PleaseSelect')+$t('brand')"
:type="'select'"
:triggerChange="false" :dictCode="'brand'"/>
</a-form-item>
</a-col>
</a-row>
</a-form-model> </a-form-model>
</a-spin> </a-spin>
<div class='drawer-bootom-button'> <div class='drawer-bootom-button'>
@@ -33,6 +60,7 @@
<script> <script>
import { putAction, postAction, getAction, deleteAction } from '@/api/manage' import { putAction, postAction, getAction, deleteAction } from '@/api/manage'
import { ajaxGetDictItems, getDictItemsFromCache } from '@/api/api'
import axios from 'axios' import axios from 'axios'
import Vue from 'vue' import Vue from 'vue'
import { ACCESS_TOKEN } from '@/store/mutation-types' import { ACCESS_TOKEN } from '@/store/mutation-types'
@@ -51,6 +79,8 @@ export default {
editId: '', editId: '',
newVisible: false, newVisible: false,
selectedRole: undefined, selectedRole: undefined,
dutyTerritories: undefined,
brands: undefined,
labelCol: { labelCol: {
xs: { span: 24 }, xs: { span: 24 },
sm: { span: 7 } sm: { span: 7 }
@@ -65,8 +95,10 @@ export default {
flag: false, //表单提交标识 flag: false, //表单提交标识
spinLoading: false, spinLoading: false,
confirmLoading: false, confirmLoading: false,
viewshow: false,
selectedRowKeys: [], selectedRowKeys: [],
roleList: [], roleList: [],
dictOptions: [],
defaultValue: undefined defaultValue: undefined
} }
}, },
@@ -79,8 +111,24 @@ export default {
}, },
mounted() { mounted() {
this.loadData() this.loadData()
this.initDictData()
}, },
methods: { methods: {
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
}
})
},
loadData() { loadData() {
this.loading = true this.loading = true
getAction(`sys/role/queryall`, {}).then(res => { getAction(`sys/role/queryall`, {}).then(res => {
@@ -94,9 +142,31 @@ export default {
handleCancel() { handleCancel() {
this.$emit('rolevisible', false) this.$emit('rolevisible', false)
}, },
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
}
})
})
// value.forEach((item,index) => {
// console.log(item)
// if(item == '1590600516943253506'){
// this.viewshow = true
// }else{
// this.viewshow = false
// }
// })
},
//保存 //保存
handleSubmit() { handleSubmit() {
let param = {ids: this.selectedRowKeysArray.join(','), selectedroles: `${this.selectedRole.join(',')}` } let param = {ids: this.selectedRowKeysArray.join(','), selectedroles: `${this.selectedRole.join(',')}`, dutyTerritories: `${this.dutyTerritories}`, brands: `${this.brands}` }
postAction('/sys/user/setRole', param).then((res) => { postAction('/sys/user/setRole', param).then((res) => {
if (res.success) { if (res.success) {
this.$emit('rolevisible', false) this.$emit('rolevisible', false)
@@ -1,6 +1,6 @@
<template> <template>
<a-drawer <a-drawer
:title="$t('See')" :title="$t('edit')"
:maskClosable="true" :maskClosable="true"
:width="drawerWidth" :width="drawerWidth"
placement="right" placement="right"
@@ -66,6 +66,7 @@
:placeholder="$t('selectUserRole')" :placeholder="$t('selectUserRole')"
optionFilterProp="children" optionFilterProp="children"
v-model="selectedRole" v-model="selectedRole"
@change='selectChange'
:disabled='false' :disabled='false'
:getPopupContainer="(target) => target.parentNode"> :getPopupContainer="(target) => target.parentNode">
<a-select-option v-for="(role,roleindex) in roleList" :key="roleindex.toString()" :value="role.id"> <a-select-option v-for="(role,roleindex) in roleList" :key="roleindex.toString()" :value="role.id">
@@ -73,6 +74,19 @@
</a-select-option> </a-select-option>
</a-select> </a-select>
</a-form-item> </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"--> <!-- v-show="!departDisabled && !disabled"-->
@@ -194,7 +208,7 @@
import departWindow from './DepartWindow' import departWindow from './DepartWindow'
import { ACCESS_TOKEN } from '@/store/mutation-types' import { ACCESS_TOKEN } from '@/store/mutation-types'
import { getAction, postAction } from '@/api/manage' 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 { disabledAuthFilter } from '@/utils/authFilter'
import { duplicateCheck } from '@/api/api' import { duplicateCheck } from '@/api/api'
import JImageUpload from '../../../components/jero/JImageUpload' import JImageUpload from '../../../components/jero/JImageUpload'
@@ -215,11 +229,13 @@
disabled: false, disabled: false,
modaltoggleFlag: true, modaltoggleFlag: true,
confirmDirty: false, confirmDirty: false,
viewshow: false,
selectedDepartKeys: [], //保存用户选择部门id selectedDepartKeys: [], //保存用户选择部门id
checkedDepartKeys: [], checkedDepartKeys: [],
checkedDepartNames: [], // 保存部门的名称 =>title checkedDepartNames: [], // 保存部门的名称 =>title
checkedDepartNameString: '', // 保存部门的名称 =>title checkedDepartNameString: '', // 保存部门的名称 =>title
resultDepartOptions: [], resultDepartOptions: [],
dictOptions: [],
userId: '', //保存用户id userId: '', //保存用户id
disableSubmit: false, disableSubmit: false,
userDepartModel: { userId: '', departIdList: [] }, // 保存SysUserDepart的用户部门中间表数据需要的对象 userDepartModel: { userId: '', departIdList: [] }, // 保存SysUserDepart的用户部门中间表数据需要的对象
@@ -276,6 +292,8 @@
model: {}, model: {},
roleList: [], roleList: [],
selectedRole: [], selectedRole: [],
dutyTerritories: '',
brands: '',
labelCol: { labelCol: {
xs: { span: 24 }, xs: { span: 24 },
sm: { span: 5 } sm: { span: 5 }
@@ -346,17 +364,63 @@
queryUserRole({ userid: userid }).then((res) => { queryUserRole({ userid: userid }).then((res) => {
if (res.success) { if (res.success) {
this.selectedRole = res.result 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 { } else {
console.log(res.message) 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() { handleSubmitOk() {
this.confirmLoading = true this.confirmLoading = true
let selectedRole = JSON.parse(JSON.stringify(this.selectedRole)) 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 = { let param = {
ids: this.userId, ids: this.userId,
selectedroles: selectedRole.join(',') selectedroles: selectedRole.join(','),
dutyTerritories: dutyTerritorie,
brands: brand
} }
postAction('/sys/user/setRole', param).then((res) => { postAction('/sys/user/setRole', param).then((res) => {
if (res.success) { if (res.success) {