diff --git a/src/pages/system-management/user-management/components/addOrEditUserDialog.vue b/src/pages/system-management/user-management/components/addOrEditUserDialog.vue
index d6cd69e..ab47c5d 100644
--- a/src/pages/system-management/user-management/components/addOrEditUserDialog.vue
+++ b/src/pages/system-management/user-management/components/addOrEditUserDialog.vue
@@ -39,6 +39,13 @@
+
+
+
+
+
+
+
@@ -65,7 +72,8 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
+
@@ -137,6 +170,8 @@ export default {
email:'',
realName:'',
roleIds:[],
+ regionId:'',
+ teamId:'',
deptId:'',
deptIds:[],
type: 2,
@@ -154,9 +189,12 @@ export default {
roleIds: [
{ required: true, message: '请选择员工角色', trigger: ['blur','change'] }
],
- deptId: [
- { required: true, message: '请选择团队', trigger: ['blur','change'] }
+ regionId: [
+ { required: true, message: '请选择区域', trigger: ['blur','change'] }
],
+ // deptId: [
+ // { required: true, message: '请选择团队', trigger: ['blur','change'] }
+ // ],
phone: [
{ required: true, message: '请输入手机号码', trigger: 'blur' },
{ pattern: /^(13[0-9]{9})|(18[0-9]{9})|(14[0-9]{9})|(17[0-9]{9})|(15[0-9]{9})|(19[0-9]{9})$/, message: '请输入正确手机号码', trigger: ['blur', 'change']}
@@ -168,7 +206,9 @@ export default {
},
userRoleOptions: [],
- deptOptions: []
+ deptOptions: [],
+ regionOptions:[],//区域
+ teamOptions:[]//团队
};
},
@@ -176,6 +216,7 @@ export default {
handleSubmit(){
if(!this.$clickThrottle()) { return }
let _this=this;
+ console.log(_this.userInfo,'_this.userInfo')
this.$refs.ruleForm.validate(async(valid) => {
if (valid) {
_this.userInfo.username = _this.userInfo.phone;
@@ -240,7 +281,51 @@ export default {
},
handleCascaderChange(e){
this.userInfo.deptId = e[1]
+ },
+ getRegion(){
+ api.getDeptList({current: 1,size: 100,companyId:this.$store.state.userinfo.companyId}).then(res => {
+ res.records.forEach(item =>{
+ if(item.pid == 0)
+ {
+ this.regionOptions.push({id:item.id.toString(),name:item.name})
+ if(this.userInfo.deptId == item.id){
+ this.userInfo.regionId = item.id.toString()
+ }
+ }
+
+ if(this.userInfo.deptId == item.id)
+ {
+ if(item.pid == 0)
+ {
+ this.userInfo.regionId = item.id.toString()
+ }
+ else
+ {
+ this.userInfo.regionId = item.pid.toString()
+ this.userInfo.teamId = item.id.toString()
+ }
+ }
+ })
+
+ if(this.userInfo.regionId != '')
+ {
+ this.regionChange(0)
+ }
+ })
+ },
+ regionChange(type){
+ this.teamOptions = []
+ if(type != 0){ this.userInfo.teamId = '' }
+ if(this.userInfo.regionId != '')
+ {
+ api.getDeptList({current: 1,size: 100,companyId:this.$store.state.userinfo.companyId,pid:this.userInfo.regionId}).then(res => {
+ res.records.forEach(item =>{
+ this.teamOptions.push({id:item.id.toString(),name:item.name})
+ })
+ })
+ }
}
+
},
async created()
{
@@ -248,22 +333,27 @@ export default {
this.userId = JSON.parse(sessionStorage.getItem('userInfo')).id
}
+ if(Object.keys(this.addOrEditUserConfig.data).length>0)
+ {
+ this.userInfo = JSON.parse(JSON.stringify(this.addOrEditUserConfig.data));
+ this.userInfo.regionId = '0'
+ this.userInfo.teamId = ''
+ }
+
+
api.getRoleListByUserId({userId:this.userId}).then(res => {
res.forEach(element => {
this.userRoleOptions.push({name:element.name,id:element.id})
});
})
- api.getDeptTree({current: 1,size: 100,companyId:this.$store.state.userinfo.companyId}).then(res => {
- this.deptOptions = res
- this.ShowRecursive(this.deptOptions)
-
- })
+ this.getRegion()
+ // api.getDeptTree({current: 1,size: 100,companyId:this.$store.state.userinfo.companyId}).then(res => {
+ // this.deptOptions = res
+ // this.ShowRecursive(this.deptOptions)
+ // })
+
- if(Object.keys(this.addOrEditUserConfig.data).length>0)
- {
- this.userInfo = JSON.parse(JSON.stringify(this.addOrEditUserConfig.data));
- }
}
};