From 7b38cbd5c0af64e2f11e02d4d2e0ea6cbb1c09f5 Mon Sep 17 00:00:00 2001
From: WXL (wul) <wl_5969728@163.com>
Date: 星期一, 09 十一月 2026 17:05:06 +0800
Subject: [PATCH] 测试完成
---
src/views/system/user/index.vue | 252 +++++++++++++++++++++++++++++++++++++-------------
1 files changed, 187 insertions(+), 65 deletions(-)
diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue
index eeb5432..9c5693e 100644
--- a/src/views/system/user/index.vue
+++ b/src/views/system/user/index.vue
@@ -2,7 +2,7 @@
<div class="app-container">
<el-row :gutter="20">
<!--閮ㄩ棬鏁版嵁-->
- <el-col :span="4" :xs="24">
+ <!-- <el-col :span="4" :xs="24">
<div class="head-container">
<el-input
v-model="deptName"
@@ -26,9 +26,9 @@
@node-click="handleNodeClick"
/>
</div>
- </el-col>
+ </el-col> -->
<!--鐢ㄦ埛鏁版嵁-->
- <el-col :span="20" :xs="24">
+ <el-col :span="24" :xs="24">
<el-form
:model="queryParams"
ref="queryForm"
@@ -125,7 +125,7 @@
size="mini"
:disabled="single"
@click="handleUpdate"
- v-hasPermi="['system:user:edit']"
+
>淇敼</el-button
>
</el-col>
@@ -199,14 +199,39 @@
v-if="columns[2].visible"
:show-overflow-tooltip="true"
/>
- <!-- <el-table-column
- label="閮ㄩ棬"
+ <el-table-column
+ label="绉戝"
align="center"
- key="deptName"
- prop="dept.deptName"
+ key="deptNames"
v-if="columns[3].visible"
:show-overflow-tooltip="true"
- /> -->
+ >
+ <template slot-scope="scope">
+ <span>{{ scope.row._deptNames || "-" }}</span>
+ </template>
+ </el-table-column>
+ <el-table-column
+ label="鐥呭尯"
+ align="center"
+ key="wardNames"
+ v-if="columns[7].visible"
+ :show-overflow-tooltip="true"
+ >
+ <template slot-scope="scope">
+ <span>{{ scope.row._wardNames || "-" }}</span>
+ </template>
+ </el-table-column>
+ <el-table-column
+ label="闄㈠尯"
+ align="center"
+ key="campusName"
+ v-if="columns[8].visible && (orgname === '绗竴浜烘皯鍖婚櫌婀栨花闄㈠尯' || orgname === '绗竴浜烘皯鍖婚櫌鍚村北闄㈠尯' || orgname === '绗竴浜烘皯鍖婚櫌鍩庝笢闄㈠尯')"
+ :show-overflow-tooltip="true"
+ >
+ <template slot-scope="scope">
+ <span>{{ scope.row._campusName || "-" }}</span>
+ </template>
+ </el-table-column>
<el-table-column
label="鎵嬫満鍙风爜"
align="center"
@@ -253,7 +278,7 @@
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
- v-hasPermi="['system:user:edit']"
+
>淇敼</el-button
>
<el-button
@@ -282,7 +307,7 @@
<el-dropdown-item
command="handleAuthRole"
icon="el-icon-circle-check"
- v-hasPermi="['system:user:edit']"
+
>鍒嗛厤瑙掕壊</el-dropdown-item
>
</el-dropdown-menu>
@@ -332,36 +357,36 @@
</el-col>
</el-row>
<el-form-item label="閫傜敤绉戝" prop="region">
- <el-cascader
- style="width: 478px"
- v-model="form.deptCodes"
- @remove-tag="removehpsp"
- :options="deptOptions"
- :props="props"
- :show-all-levels="false"
- clearable
- >
- <template slot-scope="{ node, data }">
- <span>{{ data.label }}</span>
- <span v-if="!node.isLeaf"> ({{ data.children.length }}) </span>
- </template>
- </el-cascader>
+ <el-cascader
+ style="width: 478px"
+ v-model="form.deptCodes"
+ @remove-tag="removehpsp"
+ :options="deptOptionsks"
+ :props="props"
+ filterable
+ clearable
+ >
+ <template slot-scope="{ node, data }">
+ <span>{{ data.label }}</span>
+ <span v-if="!node.isLeaf"> ({{ data.children.length }}) </span>
+ </template>
+ </el-cascader>
</el-form-item>
<el-form-item label="閫傜敤鐥呭尯" prop="region">
- <el-cascader
- style="width: 478px"
- @remove-tag="removehpsp"
- v-model="form.wardCodes"
- :options="deptOptions"
- :props="props"
- :show-all-levels="false"
- clearable
- >
- <template slot-scope="{ node, data }">
- <span>{{ data.label }}</span>
- <span v-if="!node.isLeaf"> ({{ data.children.length }}) </span>
- </template>
- </el-cascader>
+ <el-cascader
+ style="width: 478px"
+ @remove-tag="removehpsp"
+ v-model="form.wardCodes"
+ :options="deptOptionsbq"
+ :props="props"
+ filterable
+ clearable
+ >
+ <template slot-scope="{ node, data }">
+ <span>{{ data.label }}</span>
+ <span v-if="!node.isLeaf"> ({{ data.children.length }}) </span>
+ </template>
+ </el-cascader>
</el-form-item>
<el-row>
<el-col :span="12">
@@ -552,6 +577,7 @@
deptTreeSelect,
} from "@/api/system/user";
import { getToken } from "@/utils/auth";
+import { getorganization } from "@/api/AiCentre/index";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import { type } from "jquery";
@@ -572,6 +598,8 @@
multiple: true,
// 鏄剧ず鎼滅储鏉′欢
showSearch: true,
+ // 褰撳墠鏈烘瀯鍚嶇О
+ orgname: localStorage.getItem("orgname") || "",
// 鎬绘潯鏁�
total: 0,
// 鐢ㄦ埛琛ㄦ牸鏁版嵁
@@ -579,7 +607,14 @@
// 寮瑰嚭灞傛爣棰�
title: "",
// 閮ㄩ棬鏍戦�夐」
- deptOptions: undefined,
+ deptOptionsks: undefined,
+ deptOptionsbq: undefined,
+ // 绉戝缂栫爜 -> 鍚嶇О鏄犲皠
+ deptNameMap: {},
+ // 鐥呭尯缂栫爜 -> 鍚嶇О鏄犲皠
+ wardNameMap: {},
+ // 闄㈠尯缂栫爜 -> 鍚嶇О鏄犲皠
+ campusNameMap: {},
// 鏄惁鏄剧ず寮瑰嚭灞�
open: false,
// 閮ㄩ棬鍚嶇О
@@ -635,10 +670,12 @@
{ key: 0, label: `鐢ㄦ埛缂栧彿`, visible: true },
{ key: 1, label: `鐢ㄦ埛宸ュ彿`, visible: true },
{ key: 2, label: `鐢ㄦ埛鏄电О`, visible: true },
- { key: 3, label: `閮ㄩ棬`, visible: true },
+ { key: 3, label: `绉戝`, visible: true },
{ key: 4, label: `鎵嬫満鍙风爜`, visible: true },
{ key: 5, label: `鐘舵�乣, visible: true },
{ key: 6, label: `鍒涘缓鏃堕棿`, visible: true },
+ { key: 7, label: `鐥呭尯`, visible: true },
+ { key: 8, label: `闄㈠尯`, visible: true },
],
// 琛ㄥ崟鏍¢獙
@@ -688,10 +725,17 @@
},
},
created() {
- this.getList();
this.getDeptTree();
this.getConfigKey("sys.user.initPassword").then((response) => {
this.initPassword = response.msg;
+ });
+ },
+ mounted() {
+ this.$nextTick(() => {
+ const menuWrap = document.querySelector('.el-cascader-menu__wrap');
+ if (menuWrap) {
+ menuWrap.style.height = '404px';
+ }
});
},
methods: {
@@ -703,6 +747,7 @@
(response) => {
this.userList = response.rows;
this.total = response.total;
+ this.enrichUserDept();
this.loading = false;
}
);
@@ -710,13 +755,74 @@
/** 鏌ヨ閮ㄩ棬涓嬫媺鏍戠粨鏋� */
getDeptTree() {
// 绉戝鍒楄〃
- deptTreeSelect().then((response) => {
- this.deptOptions = response.data;
+ const ksPromise = deptTreeSelect(1).then((response) => {
+ this.deptOptionsks = response.data;
+ this.deptNameMap = this.flattenDeptTree(response.data);
+ });
+ // 鐥呭尯鍒楄〃
+ const bqPromise = deptTreeSelect(2).then((response) => {
+ this.deptOptionsbq = response.data;
+ this.wardNameMap = this.flattenDeptTree(response.data);
});
// 闄㈠尯鍒楄〃
- // deptTreeSelect().then((response) => {
- // this.deptOptions = response.data;
- // });
+ const campusPromise = getorganization({ pageSize: 100 }).then((res) => {
+ if (res.code == 200) {
+ (res.rows || []).forEach((item) => {
+ this.campusNameMap[String(item.organizationID)] =
+ item.organizationName;
+ });
+ }
+ });
+ // 绉戝/鐥呭尯/闄㈠尯鏄犲皠灏辩华鍚庡啀鍔犺浇鍒楄〃锛屼繚璇侀灞忚兘鏄剧ず鍚嶇О
+ Promise.all([ksPromise, bqPromise, campusPromise]).then(() => {
+ this.getList();
+ });
+ },
+ /** 灏嗙瀹�/鐥呭尯鏍戞媿骞充负 { deptCode: label } 鏄犲皠 */
+ flattenDeptTree(nodes) {
+ const map = {};
+ const walk = (list) => {
+ (list || []).forEach((node) => {
+ if (node.deptCode) {
+ map[node.deptCode] = node.label;
+ }
+ if (node.children && node.children.length) {
+ walk(node.children);
+ }
+ });
+ };
+ walk(nodes);
+ return map;
+ },
+ /** 鎶� hospInfo/deptInfo 涓殑缂栫爜杞垚鍚嶇О锛屽啓鍏ヨ鐨勫睍绀哄瓧娈� */
+ enrichUserDept() {
+ (this.userList || []).forEach((row) => {
+ row._deptNames = this.mapCodesToNames(row.hospInfo, this.deptNameMap);
+ row._wardNames = this.mapCodesToNames(row.deptInfo, this.wardNameMap);
+ row._campusName = this.campusNameMap[String(row.campusid)] || "-";
+ });
+ },
+ /** 瑙f瀽缂栫爜 JSON 骞舵槧灏勪负鍚嶇О锛氱骇鑱旇矾寰勫悇灞傜敤 "/" 杩炴帴锛屽鏉$敤 "銆�" 杩炴帴 */
+ mapCodesToNames(jsonStr, nameMap) {
+ if (!jsonStr || !nameMap) return "";
+ let data = [];
+ try {
+ data = JSON.parse(jsonStr);
+ } catch (e) {
+ return "";
+ }
+ if (!Array.isArray(data)) data = [data];
+ return data
+ .map((item) => {
+ // 绾ц仈澶氶�夌殑鍊兼槸鏁存潯璺緞锛堟暟缁勶級锛屾棫鏁版嵁鍙兘鏄崟涓紪鐮�
+ const path = Array.isArray(item) ? item : [item];
+ return path
+ .map((code) => nameMap[code] || code)
+ .filter(Boolean)
+ .join(" / ");
+ })
+ .filter(Boolean)
+ .join("銆�");
},
// 绛涢�夎妭鐐�
filterNode(value, data) {
@@ -763,6 +869,8 @@
remark: undefined,
postIds: [],
roleIds: [],
+ deptCodes: [],
+ wardCodes: [],
};
this.resetForm("form");
},
@@ -820,13 +928,18 @@
this.form = response.data;
this.belongDepts = response.belongDepts;
this.belongWards = response.belongWards;
- if (this.form.hospInfo)
+ if (this.form.hospInfo) {
this.form.deptCodes = JSON.parse(this.form.hospInfo);
- if (this.form.deptInfo)
+ } else {
+ this.form.deptCodes = [];
+ }
+ if (this.form.deptInfo) {
this.form.wardCodes = JSON.parse(this.form.deptInfo);
+ } else {
+ this.form.wardCodes = [];
+ }
console.log(this.form.wardCodes, "wardCodes");
console.log(this.form.deptCodes, "deptCodes");
-
this.postOptions = response.posts;
this.roleOptions = response.roles;
this.$set(this.form, "postIds", response.postIds);
@@ -838,10 +951,10 @@
},
// 鍒犻櫎绉戝
removehpsp(valueArray) {
- console.log(valueArray,'鍒犻櫎绉戝');
- console.log(this.form.userId,'鍒犻櫎');
- let code=valueArray[valueArray.length-1];
- removeusertd(this.form.userId,code).then((res) => {
+ console.log(valueArray, "鍒犻櫎绉戝");
+ console.log(this.form.userId, "鍒犻櫎");
+ let code = valueArray[valueArray.length - 1];
+ removeusertd(this.form.userId, code).then((res) => {
if (res.code) {
}
});
@@ -872,13 +985,13 @@
this.form.hospInfo = JSON.stringify(this.form.deptCodes);
this.form.deptInfo = JSON.stringify(this.form.wardCodes);
if (this.form.deptCodes.length)
- this.form.deptCodes = this.form.deptCodes.map(
- (subArr) => subArr[subArr.length - 1]
- );
+ this.form.deptCodes = this.form.deptCodes.map(
+ (subArr) => subArr[subArr.length - 1]
+ );
if (this.form.wardCodes.length)
- this.form.wardCodes = this.form.wardCodes.map(
- (subArr) => subArr[subArr.length - 1]
- );
+ this.form.wardCodes = this.form.wardCodes.map(
+ (subArr) => subArr[subArr.length - 1]
+ );
console.log(this.form.wardCodes, "wardCodes");
console.log(this.form.deptCodes, "deptCodes");
@@ -888,7 +1001,7 @@
updateUser(this.form).then((response) => {
this.$modal.msgSuccess("淇敼鎴愬姛");
this.open = false;
- this.adduserdept();
+ // this.adduserdept();
});
} else {
addUser(this.form).then((response) => {
@@ -897,7 +1010,7 @@
this.form.userId = response.data;
console.log("寮�濮嬪姞閮ㄩ棬");
- this.adduserdept();
+ // this.adduserdept();
});
}
}
@@ -907,7 +1020,7 @@
adduserdept() {
if (this.form.wardCodes[0]) {
this.form.wardCodes.forEach((dept) => {
- const containsId8 = null;
+ let containsId8 = null;
if (this.belongWards) {
containsId8 = this.belongWards.some(
(item) => item.deptCode == dept
@@ -928,7 +1041,7 @@
}
if (this.form.deptCodes[0]) {
this.form.deptCodes.forEach((dept) => {
- const containsId8 = null;
+ let containsId8 = null;
if (this.belongDepts) {
containsId8 = this.belongDepts.some(
(item) => item.deptCode == dept
@@ -979,7 +1092,7 @@
/** 涓嬭浇妯℃澘鎿嶄綔 */
importTemplate() {
this.download(
- "system/user/importTemplate",
+ "smartor/import/getImportPatTemplate",
{},
`user_template_${new Date().getTime()}.xlsx`
);
@@ -1009,3 +1122,12 @@
},
};
</script>
+<style lang="scss" >
+// ::v-deep .el-cascader-menu__wrap{
+// min-height: 404px ;
+// }
+// ::v-deep.el-cascader-panel .el-cascader-menu__wrap {
+// height: 404px !important;
+// }
+
+</style>
--
Gitblit v1.9.3