| | |
| | | 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" |
| | |
| | | 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"; |
| | |
| | | multiple: true, |
| | | // 显示搜索条件 |
| | | showSearch: true, |
| | | // 当前机构名称 |
| | | orgname: localStorage.getItem("orgname") || "", |
| | | // 总条数 |
| | | total: 0, |
| | | // 用户表格数据 |
| | |
| | | // 部门树选项 |
| | | deptOptionsks: undefined, |
| | | deptOptionsbq: undefined, |
| | | // 科室编码 -> 名称映射 |
| | | deptNameMap: {}, |
| | | // 病区编码 -> 名称映射 |
| | | wardNameMap: {}, |
| | | // 院区编码 -> 名称映射 |
| | | campusNameMap: {}, |
| | | // 是否显示弹出层 |
| | | open: false, |
| | | // 部门名称 |
| | |
| | | { 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 }, |
| | | ], |
| | | |
| | | // 表单校验 |
| | |
| | | }, |
| | | }, |
| | | created() { |
| | | this.getList(); |
| | | this.getDeptTree(); |
| | | this.getConfigKey("sys.user.initPassword").then((response) => { |
| | | this.initPassword = response.msg; |
| | |
| | | (response) => { |
| | | this.userList = response.rows; |
| | | this.total = response.total; |
| | | this.enrichUserDept(); |
| | | this.loading = false; |
| | | } |
| | | ); |
| | |
| | | /** 查询部门下拉树结构 */ |
| | | getDeptTree() { |
| | | // 科室列表 |
| | | deptTreeSelect(1).then((response) => { |
| | | const ksPromise = deptTreeSelect(1).then((response) => { |
| | | this.deptOptionsks = response.data; |
| | | this.deptNameMap = this.flattenDeptTree(response.data); |
| | | }); |
| | | // 病区列表 |
| | | deptTreeSelect(2).then((response) => { |
| | | 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)] || "-"; |
| | | }); |
| | | }, |
| | | /** 解析编码 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) { |