diff --git a/src/views/user-list/UserList.vue b/src/views/user-list/UserList.vue index d8ea1db..be6e933 100644 --- a/src/views/user-list/UserList.vue +++ b/src/views/user-list/UserList.vue @@ -293,22 +293,24 @@ /> - + - + @@ -426,11 +433,24 @@ :data="newdepartment" show-checkbox :default-expand-all="true" - @check="ischesc" + @check="iscrentddepartments" node-key="id" ref="tree" - :default-expanded-keys="nodekes" - :default-checked-keys="[5]" + :props="{ label: 'displayName', children: 'treeChildren' }" + size="small" + > + + + + +
+ @@ -767,6 +787,9 @@ export default { passwordid: "", newdepartment: [], //新增科室 curRow: {}, + itemtype: [], + haveitemtype: [], + newitemtype: [], }; }, computed: { @@ -786,6 +809,7 @@ export default { this.roleNames = this.$options.data().roleNames; this.department = this.$options.data().department; this.orgId = this.$options.data().orgId; + this.haveitemtype = this.$options.data().haveitemtype; }, cascaderchang(v) { if (v.length > 1) { @@ -821,6 +845,15 @@ export default { iscrentddepartment() { this.department = this.$refs.department.getCheckedKeys(true); }, + iscrentddepartments() { + this.department = this.$refs.tree.getCheckedKeys(true); + }, + iscrentditemtype() { + this.haveitemtype = this.$refs.haveitemtype.getCheckedKeys(true); + }, + iscrentditemtypes() { + this.haveitemtype = this.$refs.newitemtype.getCheckedKeys(true); + }, //修改密码确定按钮 Changepassword() { if (this.newPassWord == "") { @@ -1036,6 +1069,11 @@ export default { tcdate(this.organizationalstructure); } }); + getapi("/api/app/item-type/by-code-all").then((res) => { + if (res.code != -1) { + this.newitemtype = [...res.data]; + } + }); }, //确定添加或修改 addlsit() { @@ -1054,23 +1092,48 @@ export default { usesurnamerName: this.form.usesurnamerName, phoneNumber: this.form.phoneNumber, password: this.form.password, - roleNames: this.roleNames, + roleNames: this.form.roleNames, isActive: this.form.isActive, }; - if (this.roleNames.length == 0) { + if (this.form.roleNames.length == 0) { this.$message.warning("请选择角色"); + } else if (this.orgId == "" || this.orgId == null) { + this.$message.warning("请选择科室"); } else { newlists(obj).then((res) => { if (res.code != -1) { - this.dialogVisible = false; - this.$message.success("新增成功"); - this.form = this.$options.data().form; - this.roleNames = this.$options.data().roleNames; - this.department = this.$options.data().department; - this.curRow = this.$options.data().curRow; - this.orgId = this.$options.data().orgId; - this.$refs["tableData"].setCurrentRow(""); - this.btnQuery(); + this.form = res.data; + postapi( + `/api/app/abpuserdepartment/createmany?UserId=${this.form.id}`, + this.department + ).then((res) => { + if (res.code != -1) { + postapi( + "/api/app/organization-units/user-organization-unit", + { userId: this.form.id, orgId: this.orgId } + ).then((res) => { + if (res.code != -1) { + postapi( + `/api/app/UserItemType/CreateMany?UserId=${this.form.id}`, + this.haveitemtype + ).then((res) => { + if (res.code != -1) { + this.dialogVisible = false; + this.$message.success("新增成功"); + this.form = this.$options.data().form; + this.roleNames = this.$options.data().roleNames; + this.department = this.$options.data().department; + this.curRow = this.$options.data().curRow; + this.orgId = this.$options.data().orgId; + this.haveitemtype =this.$options.data().haveitemtype; + this.$refs["tableData"].setCurrentRow(""); + this.btnQuery(); + } + }); + } + }); + } + }); } }); } @@ -1088,7 +1151,7 @@ export default { isActive: this.form.isActive, // roleNames: this.form.roleNames, }; - if(this.orgId=="" || this.orgId==null){ + if (this.orgId == "" || this.orgId == null) { return this.$message.warning("请选择科室"); } if (this.form.roleNames.length == 0) { @@ -1099,31 +1162,46 @@ export default { let msg = ""; //更新用户与所属角色 - postapi(`/api/identity/users/update?id=${this.form.id}`, obj) - .then((res) => { + postapi(`/api/identity/users/update?id=${this.form.id}`, obj).then( + (res) => { if (res.code != -1) { //更新科室权限 - postapi(`/api/app/abpuserdepartment/createmany?UserId=${this.form.id}`,this.department).then((res)=>{ - if(res.code!=-1){ - postapi("/api/app/organization-units/user-organization-unit",{ userId: this.form.id, orgId: this.orgId }).then((res)=>{ - if(res.code!=-1){ + postapi( + `/api/app/abpuserdepartment/createmany?UserId=${this.form.id}`, + this.department + ).then((res) => { + if (res.code != -1) { + postapi( + "/api/app/organization-units/user-organization-unit", + { userId: this.form.id, orgId: this.orgId } + ).then((res) => { + if (res.code != -1) { + postapi( + `/api/app/UserItemType/CreateMany?UserId=${this.form.id}`, + this.haveitemtype + ).then((res) => { + if (res.code != -1) { this.dialogVisible = false; this.form = this.$options.data().form; this.roleNames = this.$options.data().roleNames; this.department = this.$options.data().department; this.curRow = this.$options.data().curRow; this.orgId = this.$options.data().orgId; + this.haveitemtype =this.$options.data().haveitemtype; this.$refs["tableData"].setCurrentRow(""); this.$message.success("操作成功!"); this.btnQuery(); + } + }); } - }) + }); } - }) + }); } - }) - } + } + ); } + } }); }, //删除方法 @@ -1216,7 +1294,6 @@ export default { // default-checked-keys if (res.code != -1) { this.department = res.data; - console.log(this.department); } }); } @@ -1247,16 +1324,18 @@ export default { // }); } }); - // console.log(row); - // usersinits(row.id).then((res) => { - // this.orgId = res.data[res.data.length - 1].displayName; - // this.orgIds = res.data[0].displayName; - // let list = res.data; - // this.defaultKeys = list.map((item) => { - // return item.id; - // }); - // console.log("defaultKeys", this.defaultKeys); - // }); + getapi("/api/app/item-type/by-code-all").then((res) => { + if (res.code != -1) { + this.itemtype = [...res.data]; + } + }); + postapi( + `/api/app/UserItemType/GetUserItemType?UserId=${this.curRow.id}` + ).then((res) => { + if (res.code != -1) { + this.haveitemtype = [...res.data]; + } + }); } }, //分页