From 26c2a9602ab3f6c63b22031c1c13c06d7b07d87a Mon Sep 17 00:00:00 2001 From: shidongli Date: Fri, 29 Nov 2024 16:53:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=89=80=E5=B1=9E=E6=9C=BA=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/system/department/index.vue | 527 ++++++++++++++++++++------ 1 file changed, 416 insertions(+), 111 deletions(-) diff --git a/src/views/system/department/index.vue b/src/views/system/department/index.vue index d17938c..08b02ff 100644 --- a/src/views/system/department/index.vue +++ b/src/views/system/department/index.vue @@ -13,103 +13,284 @@ /> -->
- +
- + - + - + - 搜索 - 重置 + 搜索 + 重置
- 新增 + 新增 - 修改 + 修改 - 删除 + 删除 - 导入 + 导入 - 导出 + 导出 - +
- + - - - + + + - - + +
- +
- - + +
将文件拖到此处,或 @@ -117,8 +298,13 @@
仅允许导入xls、xlsx格式文件。 - 下载模板 + 下载模板
- - + + - + - - + + - + - - + + - - + + - + - + - + - + - + @@ -425,8 +727,8 @@ export default { id: "", // 表单校验 rules: { - nodeType:[ - { required: true, message: "节点类型不能为空", trigger: "blur" }, + nodeType: [ + { required: true, message: "节点类型不能为空", trigger: "blur" }, ], hospitalAgencyName: [ { required: true, message: "所属机构不能为空", trigger: "blur" }, @@ -541,7 +843,6 @@ export default { }, // 所属机构 change(e) { - console.log(this.form.hospitalAgencyIdtwo) if (e) { this.form.hospitalAgencyId = e[e.length - 1]; if (this.form.hospitalAgencyId) { @@ -674,6 +975,7 @@ export default { createTime: null, updateBy: null, updateTime: null, + parentDepartmentName:null, }; this.resetForm("form"); }, @@ -694,25 +996,25 @@ export default { this.multiple = !selection.length; }, getLeafIds(nodes) { - console.log(nodes,';node') + console.log(nodes, ';node') - this.form.hospitalAgencyIdtwo=JSON.parse(localStorage.getItem('user')).hospitalAgencyId; + this.form.hospitalAgencyIdtwo = JSON.parse(localStorage.getItem('user')).hospitalAgencyId; let leafIds = []; nodes.forEach(node => { - if(node.id==this.form.hospitalAgencyIdtwo){ - this.form.hospitalAgencyName=node.label; + if (node.id == this.form.hospitalAgencyIdtwo) { + this.form.hospitalAgencyName = node.label; - }else{ - if (node.children) { - // 如果有子节点,递归调用getLeafIds - leafIds = leafIds.concat(this.getLeafIds(node.children)); } else { - // 如果没有子节点,取当前节点的id - leafIds.push(node.id); - } + if (node.children) { + // 如果有子节点,递归调用getLeafIds + leafIds = leafIds.concat(this.getLeafIds(node.children)); + } else { + // 如果没有子节点,取当前节点的id + leafIds.push(node.id); + } } @@ -728,8 +1030,8 @@ export default { this.reset(); this.open = true; this.title = "添加科室信息"; - if(localStorage.getItem('roleKey') !='admin'){ - this.getLeafIds(this.treeOptions) + if (localStorage.getItem('roleKey') != 'admin') { + this.getLeafIds(this.treeOptions) } @@ -764,7 +1066,10 @@ export default { this.getList(); }); } else { - this.form.hospitalAgencyId=this.form.hospitalAgencyIdtwo + if (!this.form.hospitalAgencyId) { + this.form.hospitalAgencyId = this.form.hospitalAgencyIdtwo + } + addDepartment(this.form).then((response) => { this.$modal.msgSuccess("新增成功"); this.open = false;