WXL (wul)
7 天以前 fb34ba28cb908bd328cf6690ab0b19a56428f4e2
src/views/followvisit/zysatisfaction/index.vue
@@ -15,6 +15,18 @@
        v-show="showSearch"
        label-width="98px"
      >
        <el-form-item label="满意度类型" prop="satisfactionScope">
          <el-select
            v-model="satisfactionScope"
            placeholder="默认离院"
            clearable
            style="width: 150px"
            @change="handleSatisfactionScopeChange"
          >
            <el-option label="离院满意度" value="leave" />
            <el-option label="在院满意度" value="hospital" />
          </el-select>
        </el-form-item>
        <!-- <el-form-item label="出院时间">
          <el-date-picker
            v-model="dateRange"
@@ -67,6 +79,23 @@
            @change="handleChange"
          ></el-cascader>
        </el-form-item>
        <el-form-item label="点位" prop="pointLocations" v-if="isTongdeCampus">
          <el-select
            v-model="topqueryParams.pointLocations"
            multiple
            filterable
            clearable
            placeholder="请选择点位"
            style="width: 240px"
          >
            <el-option
              v-for="item in pointOptions"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            ></el-option>
          </el-select>
        </el-form-item>
        <!-- <el-form-item label="服务状态" prop="status">
          <el-select
@@ -82,12 +111,16 @@
            </el-option>
          </el-select>
        </el-form-item> -->
        <!-- 处理状态:保留级联联动(一级大类 → 二级具体状态),
             面板挂在本组件内(popper-append-to-body=false),避免下拉跑到别处 -->
        <el-form-item label="处理状态" prop="status">
          <el-cascader
            v-model="serviceStatusValue"
            placeholder="请选择"
            :options="serviceStatusOptions"
            :props="cascaderProps"
            :popper-append-to-body="false"
            style="width: 180px"
            @change="handleServiceStatusChange"
            clearable
          ></el-cascader>
@@ -374,18 +407,33 @@
        <el-table-column
          label="科室"
          align="center"
          key="deptname"
          prop="deptname"
          key="leaveldeptname"
          width="120"
        >
          <template slot-scope="scope">
            {{ deptNameOf(scope.row) }}
          </template>
        </el-table-column>
        <el-table-column
          label="病区"
          align="center"
          key="leavehospitaldistrictname"
          prop="leavehospitaldistrictname"
          width="120"
        >
          <template slot-scope="scope">
            {{ wardNameOf(scope.row) }}
          </template>
        </el-table-column>
        <el-table-column
          v-if="isTongdeCampus"
          label="点位"
          width="120"
          align="center"
          key="pointLocation"
        >
          <template slot-scope="scope">
            {{ pointNameOf(scope.row) }}
          </template>
        </el-table-column>
        <el-table-column
@@ -393,7 +441,8 @@
          align="center"
          key="updateBy"
          prop="updateBy"
          width="120"
          min-width="120"
          :show-overflow-tooltip="true"
        />
        <el-table-column
          label="住院满意度模板名称"
@@ -897,6 +946,7 @@
  updateUser,
  resetUserPwd,
  changeUserStatus,
  deptTreeSelect,
} from "@/api/system/user";
import {
  getTaskservelist,
@@ -1089,6 +1139,8 @@
          label: "应随访日期(倒序)",
        },
      ],
      // 满意度类型:leave=离院满意度(按离院科室/病区查),hospital=在院满意度(按在院科室/病区查)
      satisfactionScope: "leave",
      // 查询参数
      topqueryParams: {
        pageNum: 1,
@@ -1103,6 +1155,7 @@
        scopetype: [],
        leaveldeptcodes: [],
        leavehospitaldistrictcodes: [],
        pointLocations: [],
      },
      propss: { multiple: true },
      options: [],
@@ -1194,6 +1247,8 @@
      leavehospitaldistrictcode: "",
      serviceState: [],
      checkboxlist: [],
      // 点位列表(同德院区,deptType=3)
      pointOptions: [],
      // 表单校验
      rules: {},
    };
@@ -1224,6 +1279,7 @@
    } else {
      this.getList(1);
    }
    this.getPointOptions();
    this.getConfigKey("sys.user.initPassword").then((response) => {
      this.initPassword = response.msg;
    });
@@ -1250,21 +1306,26 @@
        );
        console.log(this.topqueryParams.leavehospitaldistrictcodes, "11");
      }
      const queryParams = this.buildQueryParams();
      this.loading = true;
      if (
        this.topqueryParams.leavehospitaldistrictcodes[0] &&
        this.topqueryParams.leaveldeptcodes[0]
        queryParams.leavehospitaldistrictcodes &&
        queryParams.leavehospitaldistrictcodes[0] &&
        queryParams.leaveldeptcodes &&
        queryParams.leaveldeptcodes[0]
      ) {
        this.topqueryParams.deptOrDistrict = 2;
        queryParams.deptOrDistrict = 2;
      } else {
        this.topqueryParams.deptOrDistrict = 1;
        queryParams.deptOrDistrict = 1;
      }
      if (!this.followupAuthority()) {
        this.$message.warning("未配置科室/病区相关权限不可查询");
        return Promise.reject(new Error("无权限查询"));
      }
      getTaskservelist(this.topqueryParams).then((response) => {
      getTaskservelist(this.buildScopePayload(queryParams)).then((response) => {
        this.userList = response.rows[0].serviceSubtaskList;
        this.total = response.total;
        if (refresh) {
@@ -1309,6 +1370,82 @@
        this.total = response.total;
      });
    },
    // 切换满意度类型(离院/在院)后重新查询
    handleSatisfactionScopeChange() {
      this.topqueryParams.pageNum = 1;
      this.getList(1);
    },
    // 按满意度类型组装科室/病区条件:
    // 离院满意度 => leaveldeptcodes / leavehospitaldistrictcodes;
    // 在院满意度 => deptcodes / hospitaldistrictcodes(在院科室、在院病区)
    buildScopePayload(params) {
      const payload = { ...params };
      if (this.satisfactionScope === "hospital") {
        // 选点位时 leaveldeptcodes/leavehospitaldistrictcodes 为 null,需原样透传,不能 || [] 兜成空数组
        payload.deptcodes = params.leaveldeptcodes;
        payload.hospitaldistrictcodes = params.leavehospitaldistrictcodes;
        delete payload.leaveldeptcodes;
        delete payload.leavehospitaldistrictcodes;
      }
      return payload;
    },
    // 科室名称:在院满意度优先取在院科室,其余取出院科室
    deptNameOf(row) {
      if (!row) return "-";
      return (
        (this.satisfactionScope === "hospital"
          ? row.deptname || row.leaveldeptname
          : row.leaveldeptname || row.deptname) || "-"
      );
    },
    // 病区名称:在院满意度优先取在院病区,其余取出院病区
    wardNameOf(row) {
      if (!row) return "-";
      return (
        (this.satisfactionScope === "hospital"
          ? row.hospitaldistrictname || row.leavehospitaldistrictname
          : row.leavehospitaldistrictname || row.hospitaldistrictname) || "-"
      );
    },
    // 点位列表(同德院区,deptType=3)
    getPointOptions() {
      if (!this.isTongdeCampus) return;
      deptTreeSelect(3).then((response) => {
        const flat = [];
        const walk = (nodes) => {
          (Array.isArray(nodes) ? nodes : []).forEach((n) => {
            if (n.label && n.deptCode) {
              flat.push({ label: n.label, value: String(n.deptCode) });
            }
            if (n.children && n.children.length) walk(n.children);
          });
        };
        walk(response && response.data);
        this.pointOptions = flat;
      });
    },
    // 点位名称:将 pointLocation 编码映射为点位名称
    pointNameOf(row) {
      if (
        !row ||
        row.pointLocation === undefined ||
        row.pointLocation === null ||
        row.pointLocation === ""
      ) {
        return "";
      }
      const found = this.pointOptions.find(
        (p) => String(p.value) === String(row.pointLocation)
      );
      return found ? found.label : row.pointLocation;
    },
    // 服务状态变更处理
    handleServiceStatusChange(value) {
      // 清空选择
@@ -1487,6 +1624,18 @@
      this.topqueryParams.finishtimeEnd = this.dateRangefs[1];
      this.getList(refresh);
    },
    // 构造查询/导出参数:选择点位时科室/病区传 null,否则保持原值
    buildQueryParams() {
      const params = { ...this.topqueryParams };
      if (
        this.topqueryParams.pointLocations &&
        this.topqueryParams.pointLocations.length > 0
      ) {
        params.leaveldeptcodes = null;
        params.leavehospitaldistrictcodes = null;
      }
      return params;
    },
    // 患者范围处理
    handleChange(value) {
      let type = value[0];
@@ -1522,6 +1671,7 @@
        scopetype: [],
        leaveldeptcodes: [],
        leavehospitaldistrictcodes: [],
        pointLocations: [],
      };
      this.handleQuery(1);
    },
@@ -1543,6 +1693,7 @@
        scopetype: [],
        leaveldeptcodes: [],
        leavehospitaldistrictcodes: [],
        pointLocations: [],
      };
    },
    handleSelectionChange(rows) {
@@ -1836,15 +1987,22 @@
    },
    /** 导出按钮操作 */
    handleExport() {
      // 导出需要全量数据,临时去掉分页;导出后必须还原,否则分页会算成 Infinity(页码显示 infinity)
      const originalPageNum = this.topqueryParams.pageNum;
      const originalPageSize = this.topqueryParams.pageSize;
      this.topqueryParams.pageNum = null;
      this.topqueryParams.pageSize = null;
      this.download(
        "smartor/serviceSubtask/patItemExport",
        {
          ...this.topqueryParams,
          ...this.buildScopePayload(this.buildQueryParams()),
        },
        `user_${new Date().getTime()}.xlsx`
      );
      ).finally(() => {
        this.topqueryParams.pageNum = originalPageNum;
        this.topqueryParams.pageSize = originalPageSize;
        this.getList();
      });
    },
    // 异常列渲染
    tableRowClassName({ row, rowIndex }) {
@@ -2085,6 +2243,11 @@
  box-shadow: 0 2px 12px rgba(31, 45, 61, 0.05);
}
/* 级联下拉挂在本组件内时,以所在表单项为定位基准,避免面板跑到页面别处 */
::v-deep .el-form--inline .el-form-item {
  position: relative;
}
/* 隐藏分割线 */
::v-deep .el-divider {
  display: none;