|
@@ -101,11 +101,23 @@
|
|
|
<el-form ref="form" :model="form" label-width="90px" class="user-from">
|
|
|
<el-form-item label="用户姓名" class="mandatory" >
|
|
|
<el-input
|
|
|
- v-model.trim="editName"
|
|
|
+ v-model.trim="editData.editName"
|
|
|
placeholder="请输入"
|
|
|
maxlength="30"
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item label="所属架构:" class="mandatory" v-if="user.roleKey !== 'admin-ordinary'">
|
|
|
+ <el-cascader
|
|
|
+ style="width: 100%"
|
|
|
+ v-model="editData.deptIdList"
|
|
|
+ @change="editChange"
|
|
|
+ :options="treedata"
|
|
|
+ :props="{ checkStrictly: true, label: 'name', value: 'id' }"
|
|
|
+ ></el-cascader>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="用户角色" class="roleName mandatory">
|
|
|
+ <com-role :deptId="relationDeptId" v-model="editData.roleId" style="width: 100%" allText="请选择" hideAll :notDefault="true" />
|
|
|
+ </el-form-item>
|
|
|
</el-form>
|
|
|
</com-dialog>
|
|
|
|
|
@@ -124,17 +136,17 @@
|
|
|
placeholder="请输入"
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="所属架构:" v-if="user.roleKey !== 'admin-ordinary'">
|
|
|
+ <el-form-item label="所属架构:" class="mandatory" v-if="user.roleKey !== 'admin-ordinary'">
|
|
|
<el-cascader
|
|
|
style="width: 100%"
|
|
|
- v-model="deptIdList"
|
|
|
- @change="changeDeptId"
|
|
|
+ v-model="newData.deptIdList"
|
|
|
+ @change="editChange"
|
|
|
:options="treedata"
|
|
|
:props="{ checkStrictly: true, label: 'name', value: 'id' }"
|
|
|
></el-cascader>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="用户角色" class="roleName mandatory">
|
|
|
- <com-role v-model="newData.roleId" style="width: 100%" allText="请选择" hideAll :notDefault="true" />
|
|
|
+ <com-role :deptId="relationDeptId" v-model="newData.roleId" style="width: 100%" allText="请选择" hideAll :notDefault="true" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="用户账号" class="mandatory">
|
|
|
<el-input
|
|
@@ -204,7 +216,12 @@ export default {
|
|
|
if (!row.status) {
|
|
|
return getApp().$message.error("请先启用用户", "提示");
|
|
|
}
|
|
|
- data.editName = row.nickName
|
|
|
+ console.log('updateInfo',row)
|
|
|
+ data.editData = {
|
|
|
+ editName:row.nickName,
|
|
|
+ roleId:row.roleId,
|
|
|
+ deptIdList:row.deptIdList.split(','),
|
|
|
+ }
|
|
|
operRoleId.value = row.roleId;
|
|
|
state.oper.value.readyUpdate(row);
|
|
|
};
|
|
@@ -226,8 +243,13 @@ export default {
|
|
|
data.newShow = true
|
|
|
}
|
|
|
const data = reactive({
|
|
|
+ relationDeptId:'',
|
|
|
newShow: false,
|
|
|
- editName:'',//修改编辑用户名称
|
|
|
+ editData:{
|
|
|
+ editName:'',
|
|
|
+ roleId:'',
|
|
|
+ deptIdList:'',
|
|
|
+ },//修改编辑用户名称
|
|
|
deptIdList:[],
|
|
|
treedata:[],
|
|
|
newData:{
|
|
@@ -235,6 +257,7 @@ export default {
|
|
|
userId: "",
|
|
|
password: "",
|
|
|
userRole: "",
|
|
|
+ deptIdList:null
|
|
|
}
|
|
|
});
|
|
|
onMounted(async () => {
|
|
@@ -257,14 +280,16 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
- changeDeptId(val){
|
|
|
- this.newData.deptId = val && val[val.length - 1];
|
|
|
- },
|
|
|
async newSubmit(){
|
|
|
console.log('newSubmit',this.user,this.newData);
|
|
|
+ let deptIdList = this.newData.deptIdList
|
|
|
+ let deptId = deptIdList&& deptIdList[deptIdList.length - 1];
|
|
|
if (!this.newData.nickName) {
|
|
|
return this.$message.error("请输入用户姓名", "提示");
|
|
|
}
|
|
|
+ if(!deptId){
|
|
|
+ return this.$message.error("请选择用户所属架构", "提示");
|
|
|
+ }
|
|
|
if (!this.newData.roleId) {
|
|
|
return this.$message.error("请选择用户角色", "提示");
|
|
|
}
|
|
@@ -284,28 +309,48 @@ export default {
|
|
|
password:this.newData.psw,
|
|
|
userName:this.newData.userName,
|
|
|
roleId:this.newData.roleId,
|
|
|
- deptId:this.newData.deptId
|
|
|
- // ...this.newData
|
|
|
+ deptId:deptId,
|
|
|
+ deptIdList:deptIdList.toString()
|
|
|
});
|
|
|
this.$message({message: apiinfo.msg || '成功', type: 'success'});
|
|
|
// await this.$confirm('每个组织只能创建一个总管理员~', '新增用户')
|
|
|
- this.newData = {}
|
|
|
- this.deptIdList = []
|
|
|
+ this.newData = {
|
|
|
+ userName: "",
|
|
|
+ userId: "",
|
|
|
+ password: "",
|
|
|
+ userRole: "",
|
|
|
+ deptIdList:null
|
|
|
+ }
|
|
|
this.newShow = false
|
|
|
this.dataList.refer();
|
|
|
},
|
|
|
async operItem() {
|
|
|
- if (!this.editName) {
|
|
|
+ console.log('state.oper',this.editData);
|
|
|
+ if (!this.editData.editName) {
|
|
|
return this.$message.error("请输入用户名称", "提示");
|
|
|
}
|
|
|
+ if (!this.editData.deptIdList) {
|
|
|
+ return this.$message.error("请选择用户所属架构", "提示");
|
|
|
+ }
|
|
|
+ if (!this.editData.roleId) {
|
|
|
+ return this.$message.error("请选择用户角色", "提示");
|
|
|
+ }
|
|
|
console.log('state.oper',this.oper);
|
|
|
+ let deptId = this.editData.deptIdList[this.editData.deptIdList.length - 1];
|
|
|
await axios.post(userEdit, {
|
|
|
id:this.oper.state.id,
|
|
|
- nickName:this.editName,
|
|
|
+ nickName:this.editData.editName,
|
|
|
+ roleId:this.editData.roleId,
|
|
|
+ deptId:deptId,
|
|
|
+ deptIdList:this.editData.deptIdList.toString()
|
|
|
});
|
|
|
this.$message({message: '编辑成功', type: 'success'});
|
|
|
this.oper.reset();
|
|
|
- this.editName = ''
|
|
|
+ this.editData = {
|
|
|
+ editName:'',
|
|
|
+ roleId:'',
|
|
|
+ deptIdList:'',
|
|
|
+ }
|
|
|
this.dataList.refer();
|
|
|
},
|
|
|
async changeUserStatus(row, d) {
|
|
@@ -325,6 +370,10 @@ export default {
|
|
|
return false;
|
|
|
}
|
|
|
},
|
|
|
+ editChange(val){
|
|
|
+ console.log('relationDeptId',val);
|
|
|
+ this.relationDeptId = val&&val[val.length - 1] || '';
|
|
|
+ }
|
|
|
},
|
|
|
components: {
|
|
|
"com-dialog": comDialog,
|