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> </div>
</el-tab-pane> </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 <el-tree
:props="{ :props="{
label: 'displayName', label: 'displayName',
children: 'treeChildren', children: 'treeChildren',
}" }"
:default-checked-keys="department"
:default-checked-keys="haveitemtype"
:default-expand-all="true" :default-expand-all="true"
show-checkbox show-checkbox
:data="setupdepartments"
:data="itemtype"
node-key="id" node-key="id"
@check="iscrentddepartment"
ref="department" size="small" />
@check="iscrentditemtype"
ref="haveitemtype"
size="small"
/>
</div> </div>
</el-tab-pane> -->
</el-tab-pane>
</el-tabs> </el-tabs>
<!-- // --> <!-- // -->
<el-form <el-form
@ -384,7 +386,7 @@
</el-tab-pane> </el-tab-pane>
<!-- 角色111 --> <!-- 角色111 -->
<el-tab-pane label="角色"> <el-tab-pane label="角色">
<el-checkbox-group v-model="roleNames">
<el-checkbox-group v-model="form.roleNames">
<el-checkbox <el-checkbox
v-model="item.id" v-model="item.id"
:label="item.name" :label="item.name"
@ -397,13 +399,18 @@
<!-- 组织11 --> <!-- 组织11 -->
<el-tab-pane label="所属科室"> <el-tab-pane label="所属科室">
<el-cascader <el-cascader
v-model="orgId"
:options="organizationalstructure" :options="organizationalstructure"
:show-all-levels="false" :show-all-levels="false"
ref="example"
popper-class="example"
@change="cascaderchang"
:props="{ :props="{
label: 'displayName', label: 'displayName',
children: 'treeChildren', children: 'treeChildren',
checkStrictly: true, checkStrictly: true,
value: 'id', value: 'id',
expandTrigger: 'hover',
}" }"
size="small" size="small"
></el-cascader> ></el-cascader>
@ -426,11 +433,24 @@
:data="newdepartment" :data="newdepartment"
show-checkbox show-checkbox
:default-expand-all="true" :default-expand-all="true"
@check="ischesc"
@check="iscrentddepartments"
node-key="id" node-key="id"
ref="tree" 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' }" :props="{ label: 'displayName', children: 'treeChildren' }"
size="small" size="small"
> >
@ -767,6 +787,9 @@ export default {
passwordid: "", passwordid: "",
newdepartment: [], // newdepartment: [], //
curRow: {}, curRow: {},
itemtype: [],
haveitemtype: [],
newitemtype: [],
}; };
}, },
computed: { computed: {
@ -786,6 +809,7 @@ export default {
this.roleNames = this.$options.data().roleNames; this.roleNames = this.$options.data().roleNames;
this.department = this.$options.data().department; this.department = this.$options.data().department;
this.orgId = this.$options.data().orgId; this.orgId = this.$options.data().orgId;
this.haveitemtype = this.$options.data().haveitemtype;
}, },
cascaderchang(v) { cascaderchang(v) {
if (v.length > 1) { if (v.length > 1) {
@ -821,6 +845,15 @@ export default {
iscrentddepartment() { iscrentddepartment() {
this.department = this.$refs.department.getCheckedKeys(true); 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() { Changepassword() {
if (this.newPassWord == "") { if (this.newPassWord == "") {
@ -1036,6 +1069,11 @@ export default {
tcdate(this.organizationalstructure); tcdate(this.organizationalstructure);
} }
}); });
getapi("/api/app/item-type/by-code-all").then((res) => {
if (res.code != -1) {
this.newitemtype = [...res.data];
}
});
}, },
// //
addlsit() { addlsit() {
@ -1054,23 +1092,48 @@ export default {
usesurnamerName: this.form.usesurnamerName, usesurnamerName: this.form.usesurnamerName,
phoneNumber: this.form.phoneNumber, phoneNumber: this.form.phoneNumber,
password: this.form.password, password: this.form.password,
roleNames: this.roleNames,
roleNames: this.form.roleNames,
isActive: this.form.isActive, isActive: this.form.isActive,
}; };
if (this.roleNames.length == 0) {
if (this.form.roleNames.length == 0) {
this.$message.warning("请选择角色"); this.$message.warning("请选择角色");
} else if (this.orgId == "" || this.orgId == null) {
this.$message.warning("请选择科室");
} else { } else {
newlists(obj).then((res) => { newlists(obj).then((res) => {
if (res.code != -1) { 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, isActive: this.form.isActive,
// roleNames: this.form.roleNames, // roleNames: this.form.roleNames,
}; };
if(this.orgId=="" || this.orgId==null){
if (this.orgId == "" || this.orgId == null) {
return this.$message.warning("请选择科室"); return this.$message.warning("请选择科室");
} }
if (this.form.roleNames.length == 0) { if (this.form.roleNames.length == 0) {
@ -1099,31 +1162,46 @@ export default {
let msg = ""; 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) { 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.dialogVisible = false;
this.form = this.$options.data().form; this.form = this.$options.data().form;
this.roleNames = this.$options.data().roleNames; this.roleNames = this.$options.data().roleNames;
this.department = this.$options.data().department; this.department = this.$options.data().department;
this.curRow = this.$options.data().curRow; this.curRow = this.$options.data().curRow;
this.orgId = this.$options.data().orgId; this.orgId = this.$options.data().orgId;
this.haveitemtype =this.$options.data().haveitemtype;
this.$refs["tableData"].setCurrentRow(""); this.$refs["tableData"].setCurrentRow("");
this.$message.success("操作成功!"); this.$message.success("操作成功!");
this.btnQuery(); this.btnQuery();
}
});
} }
})
});
} }
})
});
} }
})
}
}
);
} }
}
}); });
}, },
// //
@ -1216,7 +1294,6 @@ export default {
// default-checked-keys // default-checked-keys
if (res.code != -1) { if (res.code != -1) {
this.department = res.data; 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