pengjun 2 years ago
parent
commit
1d4298961e
  1. 167
      src/views/user-list/UserList.vue

167
src/views/user-list/UserList.vue

@ -293,22 +293,24 @@
/>
</div>
</el-tab-pane>
<!-- <el-tab-pane label="项目类别权限">
<div style="overflow-y: scroll;height:350px;">
<el-tab-pane label="项目类别权限">
<div style="overflow-y: scroll; height: 350px">
<el-tree
:props="{
label: 'displayName',
children: 'treeChildren',
}"
:default-checked-keys="department"
:default-checked-keys="haveitemtype"
:default-expand-all="true"
show-checkbox
:data="setupdepartments"
:data="itemtype"
node-key="id"
@check="iscrentddepartment"
ref="department" size="small" />
@check="iscrentditemtype"
ref="haveitemtype"
size="small"
/>
</div>
</el-tab-pane> -->
</el-tab-pane>
</el-tabs>
<!-- // -->
<el-form
@ -384,7 +386,7 @@
</el-tab-pane>
<!-- 角色111 -->
<el-tab-pane label="角色">
<el-checkbox-group v-model="roleNames">
<el-checkbox-group v-model="form.roleNames">
<el-checkbox
v-model="item.id"
:label="item.name"
@ -397,13 +399,18 @@
<!-- 组织11 -->
<el-tab-pane label="所属科室">
<el-cascader
v-model="orgId"
:options="organizationalstructure"
:show-all-levels="false"
ref="example"
popper-class="example"
@change="cascaderchang"
:props="{
label: 'displayName',
children: 'treeChildren',
checkStrictly: true,
value: 'id',
expandTrigger: 'hover',
}"
size="small"
></el-cascader>
@ -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"
>
</el-tree>
</div>
</el-tab-pane>
<el-tab-pane label="项目类别权限">
<div style="overflow-y: scroll; height: 350px">
<el-tree
:data="newitemtype"
show-checkbox
:default-expand-all="true"
@check="iscrentditemtypes"
node-key="id"
ref="newitemtype"
: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];
}
});
}
},
//

Loading…
Cancel
Save