| | |
| | | </li> |
| | | |
| | | <!-- ===== 所属病区 ===== --> |
| | | <li class="list-group-item" v-if="user.belongWards && user.belongWards.length"> |
| | | <li class="list-group-item" v-if="uniqueWards && uniqueWards.length"> |
| | | <svg-icon icon-class="tree" />所属病区 |
| | | <div class="pull-right"> |
| | | <!-- 南华附一:可编辑模式 --> |
| | |
| | | <!-- 南华附一:只读模式 --> |
| | | <template v-else-if="isNanhua"> |
| | | <el-tag |
| | | v-for="ward in user.belongWards" |
| | | v-for="ward in uniqueWards" |
| | | :key="ward.districtId" |
| | | size="small" |
| | | class="ward-tag" |
| | |
| | | popper-class="ward-popover" |
| | | > |
| | | <div class="popover-content"> |
| | | <p v-for="ward in user.belongWards" :key="ward.districtId" class="popover-item"> |
| | | <p v-for="ward in uniqueWards" :key="ward.districtId" class="popover-item"> |
| | | {{ ward.districtName }} |
| | | </p> |
| | | </div> |
| | |
| | | class="ward-tag" |
| | | >{{ ward.districtName }}</el-tag> |
| | | <el-tag |
| | | v-if="user.belongWards.length > maxTagCount" |
| | | v-if="uniqueWards.length > maxTagCount" |
| | | size="small" |
| | | class="more-tag" |
| | | @click="showAllWardsPopover = !showAllWardsPopover" |
| | | >+{{ user.belongWards.length - maxTagCount }}</el-tag> |
| | | >+{{ uniqueWards.length - maxTagCount }}</el-tag> |
| | | </div> |
| | | </el-popover> |
| | | </template> |
| | |
| | | </li> |
| | | |
| | | <!-- ===== 所属科室 ===== --> |
| | | <li class="list-group-item" v-if="user.belongDepts && user.belongDepts.length"> |
| | | <li class="list-group-item" v-if="uniqueDepts && uniqueDepts.length"> |
| | | <svg-icon icon-class="tree" />所属科室 |
| | | <div class="pull-right"> |
| | | <!-- 南华附一:可编辑模式 --> |
| | |
| | | <!-- 南华附一:只读模式 --> |
| | | <template v-else-if="isNanhua"> |
| | | <el-tag |
| | | v-for="dept in user.belongDepts" |
| | | v-for="dept in uniqueDepts" |
| | | :key="dept.deptId" |
| | | size="small" |
| | | class="dept-tag" |
| | |
| | | popper-class="dept-popover" |
| | | > |
| | | <div class="popover-content"> |
| | | <p v-for="dept in user.belongDepts" :key="dept.deptId" class="popover-item"> |
| | | <p v-for="dept in uniqueDepts" :key="dept.deptId" class="popover-item"> |
| | | {{ dept.deptName }} |
| | | </p> |
| | | </div> |
| | |
| | | class="dept-tag" |
| | | >{{ dept.deptName }}</el-tag> |
| | | <el-tag |
| | | v-if="user.belongDepts.length > maxTagCount" |
| | | v-if="uniqueDepts.length > maxTagCount" |
| | | size="small" |
| | | class="more-tag" |
| | | @click="showAllDeptsPopover = !showAllDeptsPopover" |
| | | >+{{ user.belongDepts.length - maxTagCount }}</el-tag> |
| | | >+{{ uniqueDepts.length - maxTagCount }}</el-tag> |
| | | </div> |
| | | </el-popover> |
| | | </template> |
| | |
| | | }; |
| | | }, |
| | | computed: { |
| | | // sys_user_dept 里同一病区可能有几十条重复行,接口原样返回,这里按编码去重 |
| | | uniqueWards() { |
| | | return this.uniqueByCode(this.user.belongWards); |
| | | }, |
| | | uniqueDepts() { |
| | | return this.uniqueByCode(this.user.belongDepts); |
| | | }, |
| | | // 计算要显示的病区标签(前maxTagCount个) |
| | | displayWards() { |
| | | if (!this.user.belongWards) return []; |
| | | return this.user.belongWards.slice(0, this.maxTagCount); |
| | | if (!this.uniqueWards) return []; |
| | | return this.uniqueWards.slice(0, this.maxTagCount); |
| | | }, |
| | | // 计算要显示的科室标签(前maxTagCount个) |
| | | displayDepts() { |
| | | if (!this.user.belongDepts) return []; |
| | | return this.user.belongDepts.slice(0, this.maxTagCount); |
| | | if (!this.uniqueDepts) return []; |
| | | return this.uniqueDepts.slice(0, this.maxTagCount); |
| | | }, |
| | | // 南华大学附属第一医院 允许编辑科室/病区 |
| | | isNanhua() { |
| | |
| | | } |
| | | }, |
| | | methods: { |
| | | // 按科室/病区编码去重(sys_user_dept 存在重复行) |
| | | uniqueByCode(list) { |
| | | const seen = {}; |
| | | return (list || []).filter((item) => { |
| | | if (!item) return false; |
| | | const code = |
| | | item.districtCode || item.deptCode || item.districtId || item.deptId; |
| | | const key = String(code === undefined || code === null ? "" : code); |
| | | if (!key || seen[key]) return false; |
| | | seen[key] = true; |
| | | return true; |
| | | }); |
| | | }, |
| | | getUser() { |
| | | getUserProfile().then((response) => { |
| | | this.user = response.data; |