WXL (wul)
21 小时以前 0c7cc21d8a51e164dd2fe4ce73ab566b3a9081a9
src/views/sfstatistics/percentage/index.vue
@@ -356,6 +356,7 @@
                  prop="leavehospitaldistrictname"
                  width="150"
                  :show-overflow-tooltip="true"
                  :sort-method="sortChineseNumber"
                />
                <el-table-column
                  label="科室"
@@ -1508,13 +1509,48 @@
      delete params.leavehospitaldistrictcodes.all;
      delete params.deptcodes.all;
      getSfStatistics(params).then((response) => {
        console.log(response);
        this.loading = false;
        // this.total = response.total;
        this.userList = this.customSort(response.data);
      });
    },
    sortChineseNumber(a, b) {
      // 提取中文数字
      const chineseNumbers = [
        "一",
        "二",
        "三",
        "四",
        "五",
        "六",
        "七",
        "八",
        "九",
        "十",
        "十一",
        "十二",
      ];
      // 从字符串中提取病区数字,如"四病区" -> "四"
      const getNumberFromText = (text) => {
        if (!text) return -1;
        const match = text.match(/^([一二三四五六七八九十]+)/);
        if (match && match[1]) {
          return chineseNumbers.indexOf(match[1]);
        }
        return -1;
      };
      const numA = getNumberFromText(a);
      const numB = getNumberFromText(b);
      if (numA === -1 && numB === -1) return 0;
      if (numA === -1) return 1; // 无法解析的放到后面
      if (numB === -1) return -1; // 无法解析的放到后面
      return numA - numB;
    },
    // 搜索处理函数
    handleSearch() {
      if (!this.searchName.trim()) {