WXL
3 天以前 c96768b88d575454ee06d7f4720cfbd52e7c19e0
src/views/project/donationdetails/index.vue
@@ -432,7 +432,10 @@
          </el-row> -->
          <el-row>
            <el-col :span="6">
              <el-form-item label="所在医疗机构" prop="occupation">
              <el-form-item
                label="所在医疗机构"
                prop="currentMedicalInstitution"
              >
                <el-input
                  v-model="form.currentMedicalInstitution"
                  placeholder="请输入"
@@ -443,7 +446,7 @@
              <el-form-item
                label-width="130px"
                label="所在医疗机构科室"
                prop="education"
                prop="currentDept"
              >
                <el-input v-model="form.currentDept" placeholder="请输入" />
              </el-form-item>
@@ -451,7 +454,7 @@
          </el-row>
          <el-row>
            <el-col :span="6">
              <el-form-item label="首次医疗机构" prop="occupation">
              <el-form-item label="首次医疗机构" prop="firstMedicalInstitution">
                <el-input
                  v-model="form.firstMedicalInstitution"
                  placeholder="请输入"
@@ -462,7 +465,7 @@
              <el-form-item
                label-width="130px"
                label="首次医疗机构科室"
                prop="education"
                prop="firstDept"
              >
                <el-input v-model="form.firstDept" placeholder="请输入" />
              </el-form-item>
@@ -534,7 +537,7 @@
            </el-col>
          </el-row>
          <el-row>
            <el-form-item label="疾病类型" align="left">
            <el-form-item label="疾病类型" align="left" prop="diseasetype">
              <el-checkbox-group v-model="form.diseasetype">
                <el-checkbox
                  v-for="dict in dict.type.sys_DiseaseType || []"
@@ -554,7 +557,7 @@
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item align="left" label="传染病">
              <el-form-item align="left" label="传染病" prop="infectious">
                <el-checkbox-group v-model="form.infectious">
                  <el-checkbox
                    v-for="dict in dict.type.sys_Infectious || []"
@@ -577,7 +580,7 @@
          </el-row>
          <el-row>
            <el-col :span="9">
              <el-form-item align="left" label="病人状况">
              <el-form-item align="left" label="病人状况" prop="patientstate">
                <el-checkbox-group v-model="form.patientstate">
                  <el-checkbox
                    v-for="dict in dict.type.sys_patientstate || []"
@@ -590,7 +593,7 @@
              </el-form-item>
            </el-col>
            <el-col :span="15" align="left">
              <el-form-item label="其他情况">
              <el-form-item label="其他情况" prop="othercases">
                <el-checkbox-group v-model="form.othercases">
                  <el-checkbox
                    v-for="dict in dict.type.sys_OtherCases || []"
@@ -677,7 +680,7 @@
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item align="left" label="信息来源">
              <el-form-item align="left" label="信息来源" prop="infosources">
                <el-checkbox-group v-model="form.infosources">
                  <el-checkbox
                    v-for="dict in dict.type.sys_InfoSources || []"
@@ -1016,7 +1019,7 @@
          label-width="100px"
          label-position="right"
        >
               <el-row>
          <el-row>
            <el-col :span="6">
              <el-form-item label="捐赠者民族" prop="nation">
                <el-select v-model="affirmform.nation" placeholder="请选择民族">
@@ -1170,6 +1173,12 @@
                  >{{ item }}
                </el-checkbox>
              </el-checkbox-group>
              <el-input
                v-if="organdecision.includes('其他')"
                v-model="affirmform.organdecisionOther"
                placeholder="请输入其他捐献决定的具体内容"
                style="margin-top: 10px; width: 300px;"
              ></el-input>
            </el-form-item>
          </el-row>
          <el-row>
@@ -1403,12 +1412,12 @@
                      />
                    </template>
                  </el-table-column>
                  <el-table-column
                  <!-- <el-table-column
                    label="器官编号"
                    align="center"
                    width="90"
                    prop="organno"
                  />
                  /> -->
                  <el-table-column
                    label="分配系统编号"
                    align="center"
@@ -1457,7 +1466,7 @@
                  <el-table-column
                    label="移植医院"
                    align="center"
                    width="230"
                    width="280"
                    prop="transplanthospitalno"
                  >
                    <template slot-scope="scope">
@@ -1690,7 +1699,7 @@
            <el-col :span="6">
              <el-form-item
                align="left"
                label="签字时间"
                label="签字日期"
                label-width="120px"
                prop="coordinatorSignTime"
              >
@@ -1698,7 +1707,7 @@
                  clearable
                  v-model="witnessform.coordinatorSignTime"
                  type="datetime"
                  value-format="yyyy-MM-dd HH:mm:ss"
                  value-format="yyyy-MM-dd"
                  placeholder="选择手术结束时间"
                >
                </el-date-picker>
@@ -1864,7 +1873,12 @@
          <el-row>
            <el-col>
              <el-form-item>
                <el-table v-loading="loading" border :data="procureddata">
                <el-table
                  v-loading="loading"
                  border
                  :key="tableKey"
                  :data="procureddata"
                >
                  <el-table-column
                    label="器官名称"
                    align="center"
@@ -1879,12 +1893,12 @@
                      />
                    </template>
                  </el-table-column>
                  <el-table-column
                  <!-- <el-table-column
                    label="器官编号"
                    align="center"
                    width="90"
                    prop="organno"
                  />
                  /> -->
                  <!-- <el-table-column
                    label="系统编号"
                    align="center"
@@ -1920,7 +1934,7 @@
                  <el-table-column
                    label="获取医院"
                    align="center"
                    width="230"
                    width="280"
                    prop="gainhospitalno"
                  >
                    <template slot-scope="scope">
@@ -2139,12 +2153,12 @@
                      />
                    </template>
                  </el-table-column>
                  <el-table-column
                  <!-- <el-table-column
                    label="器官编号"
                    align="center"
                    width="90"
                    prop="organno"
                  />
                  /> -->
                  <el-table-column
                    label="系统编号"
                    align="center"
@@ -2161,7 +2175,7 @@
                  <el-table-column
                    label="移植医院"
                    align="center"
                    width="220"
                    width="280"
                    prop="hospitalno"
                  >
                    <template slot-scope="scope">
@@ -2695,6 +2709,20 @@
        contacttime: "",
        reporttime: ""
      },
      organOrder: [
        "肝脏",
        "左肾",
        "右肾",
        "心脏",
        "左肺",
        "右肺",
        "胰腺",
        "小肠",
        "左眼角膜",
        "右眼角膜"
      ], // 指定的器官顺序
      isSorting: false, // 标志位,表示是否正在排序
      tableKey: 0,
      istb: false,
      activeName: "",
      tableDatafile: [
@@ -2715,6 +2743,7 @@
        kinship: []
      },
      organdecision: [],
      organdecisionOther: "", // 其他选项的具体描述
      kinship: [],
      ethicform: {
        infoid: null
@@ -2722,7 +2751,8 @@
      kinshiplist: ["配偶", "父亲", "母亲", "子女", "受托人"],
      organselection: [
        "肝脏",
        "双肾脏",
        "左肾",
        "右肾",
        "心脏",
        "肺脏",
        "胰腺",
@@ -2826,6 +2856,21 @@
        name: [
          { required: true, message: "请输入捐献者姓名", trigger: "blur" }
        ],
        nationality: [
          { required: true, message: "请输入国籍", trigger: "blur" }
        ],
        currentMedicalInstitution: [
          { required: true, message: "请输入所在医疗机构", trigger: "blur" }
        ],
        currentDept: [
          { required: true, message: "所在医疗机构科室", trigger: "blur" }
        ],
        firstMedicalInstitution: [
          { required: true, message: "请输入首次医疗机构", trigger: "blur" }
        ],
        firstDept: [
          { required: true, message: "请输入首次医疗机构科室", trigger: "blur" }
        ],
        birthday: [
          { required: true, message: "请选择出生日期", trigger: "blur" }
        ],
@@ -2835,7 +2880,30 @@
        residenceaddress: [
          { required: true, message: "请输入住址", trigger: "blur" }
        ],
        registerAddresss: [
          { required: true, message: "请输入现居住地址", trigger: "blur" }
        ],
        diseasetype: [
          { required: true, message: "请选择疾病类型", trigger: "blur" }
        ],
        infectious: [
          { required: true, message: "请选择传染病类型", trigger: "blur" }
        ],
        patientstate: [
          { required: true, message: "请选择病人状况", trigger: "blur" }
        ],
        kinship: [
          { required: true, message: "请选择亲属情况", trigger: "blur" }
        ],
        majorrelatives: [
          { required: true, message: "请输入主要亲属", trigger: "blur" }
        ],
        familyrelations: [
          { required: true, message: "请选择亲属与捐献者关系", trigger: "blur" }
        ],
        infosources: [
          { required: true, message: "请选择信息来源", trigger: "blur" }
        ],
        idcardno: [
          { required: true, message: "请正确输入证件号码", trigger: "blur" }
        ],
@@ -2892,7 +2960,7 @@
        education: [
          { required: true, message: "家属联系电话不为空", trigger: "blur" }
        ],
         occupation: [
        occupation: [
          { required: true, message: "家属联系电话不为空", trigger: "blur" }
        ],
        signfamilyrelations: [
@@ -2975,6 +3043,28 @@
    listReportname("fzr").then(res => {
      this.leaderlist = res.data;
    });
    // this.customOrganSort();
  },
  watch: {
    // 监听 procureddata 的变化,数据更新后重新排序
    procureddata: {
      handler(newVal) {
        if (this.isSorting) {
          return;
        }
        this.customOrganSort();
      },
      deep: true // 深度监听,因为数组内容可能变化
    },
    allocateddata: {
      handler(newVal) {
        if (this.isSorting) {
          return;
        }
        this.allocateddataSort();
      },
      deep: true // 深度监听,因为数组内容可能变化
    }
  },
  methods: {
@@ -3358,6 +3448,9 @@
      } else if (this.actives == 2) {
        this.affirmform.infoid = this.infoid;
        this.affirmform.organdecision = this.organdecision.join(",");
        if (!this.organdecision.includes("其他")) {
          this.affirmform.organdecisionOther = "";
        }
        this.affirmform.kinship = this.kinship.join(",");
        this.$refs["affirmform"].validate(valid => {
          if (valid) {
@@ -3567,6 +3660,73 @@
        });
      }
    },
    customOrganSort() {
      console.log("调用");
      // 1. 加锁,阻止监听器执行
      this.isSorting = true;
      // 自定义排序函数
      this.procureddata.sort((a, b) => {
        const indexA = this.organOrder.indexOf(a.organname);
        const indexB = this.organOrder.indexOf(b.organname);
        // 如果两个都在列表中,按列表中的顺序排序
        if (indexA !== -1 && indexB !== -1) {
          return indexA - indexB;
        }
        // 如果 a 在列表中,b 不在,a 排前面
        if (indexA !== -1) {
          return -1;
        }
        // 如果 b 在列表中,a 不在,b 排前面
        if (indexB !== -1) {
          return 1;
        }
        // 两个都不在列表中,保持原顺序(或按其他规则,比如按字母排序,这里按原始顺序)
        return 0;
      });
      console.log(this.procureddata, "顺序");
      this.tableKey += 1; // 改变 key 迫使表格重新渲染
      // 你可以使用 this.$forceUpdate() 或者重新赋值数组来触发更新
      this.procureddata = [...this.procureddata];
      this.$nextTick(() => {
        this.isSorting = false;
      });
    },
    allocateddataSort() {
      console.log("调用");
      // 1. 加锁,阻止监听器执行
      this.isSorting = true;
      // 自定义排序函数
      this.allocateddata.sort((a, b) => {
        const indexA = this.organOrder.indexOf(a.organname);
        const indexB = this.organOrder.indexOf(b.organname);
        // 如果两个都在列表中,按列表中的顺序排序
        if (indexA !== -1 && indexB !== -1) {
          return indexA - indexB;
        }
        // 如果 a 在列表中,b 不在,a 排前面
        if (indexA !== -1) {
          return -1;
        }
        // 如果 b 在列表中,a 不在,b 排前面
        if (indexB !== -1) {
          return 1;
        }
        // 两个都不在列表中,保持原顺序(或按其他规则,比如按字母排序,这里按原始顺序)
        return 0;
      });
      console.log(this.allocateddata, "顺序");
      this.tableKey += 1; // 改变 key 迫使表格重新渲染
      // 你可以使用 this.$forceUpdate() 或者重新赋值数组来触发更新
      this.allocateddata = [...this.allocateddata];
      this.$nextTick(() => {
        this.isSorting = false;
      });
    },
    // 切换tab
    on_click(e) {
      // if (e != "" || e != null) {