用户管理修改

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',
Importfailure:'Import failure',
CuiBan:'CuiBan',
brand:'Brand',
}
+1
View File
@@ -1462,4 +1462,5 @@ module.exports = {
relatedProjectVersion:'相关项目版本',
Importfailure:'导入失败',
CuiBan:'催办',
brand:'品牌',
}
@@ -163,7 +163,7 @@ export default {
}
.itemModel {
width: calc(100% - 130px);
width: calc(80% - 130px);
display: inline-block;
margin-top: 2px;
}
@@ -172,7 +172,7 @@ export default {
}
.itemModel {
width: calc(100% - 130px);
width: calc(80% - 130px);
display: inline-block;
margin-top: 2px;
}
+1 -1
View File
@@ -132,7 +132,7 @@
</div>
</template>
<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>-->
</span>
@@ -12,7 +12,7 @@
<a-row :gutter='24'>
<a-col :span='24'>
<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">
<span style="display: inline-block;width: 100%">
{{ role.roleName }}
@@ -22,6 +22,33 @@
</a-form-item>
</a-col>
</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-spin>
<div class='drawer-bootom-button'>
@@ -33,6 +60,7 @@
<script>
import { putAction, postAction, getAction, deleteAction } from '@/api/manage'
import { ajaxGetDictItems, getDictItemsFromCache } from '@/api/api'
import axios from 'axios'
import Vue from 'vue'
import { ACCESS_TOKEN } from '@/store/mutation-types'
@@ -51,6 +79,8 @@ export default {
editId: '',
newVisible: false,
selectedRole: undefined,
dutyTerritories: undefined,
brands: undefined,
labelCol: {
xs: { span: 24 },
sm: { span: 7 }
@@ -65,8 +95,10 @@ export default {
flag: false, //表单提交标识
spinLoading: false,
confirmLoading: false,
viewshow: false,
selectedRowKeys: [],
roleList: [],
dictOptions: [],
defaultValue: undefined
}
},
@@ -79,8 +111,24 @@ export default {
},
mounted() {
this.loadData()
this.initDictData()
},
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() {
this.loading = true
getAction(`sys/role/queryall`, {}).then(res => {
@@ -94,9 +142,31 @@ export default {
handleCancel() {
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() {
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) => {
if (res.success) {
this.$emit('rolevisible', false)
@@ -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) {