11
WXL
2024-04-25 8a01cd3076ac20e1529a6768bb07e71f3c21f00d
src/views/project/unitCost/particulars/index.vue
@@ -6,7 +6,7 @@
        <el-row>
          <el-col :span="5">
            <el-form-item label="申请日期" prop="createTime">
              <el-date-picker v-model="form.createTime" value-format="yyyy-MM-dd HH:mm:ss" type="datetime"
              <el-date-picker v-model="form.createTime" value-format="yyyy-MM-dd " type="date"
                :disabled="true" placeholder="选择出生年月">
              </el-date-picker>
            </el-form-item>
@@ -66,8 +66,8 @@
          </el-col>
          <el-col :span="5">
            <el-form-item label="收款日期" prop="receivedtime">
              <el-date-picker clearable size="small" v-model="form.receivedtime" value-format="yyyy-MM-dd HH:mm:ss"
                type="datetime" placeholder="选择收款日期">
              <el-date-picker clearable size="small" v-model="form.receivedtime" value-format="yyyy-MM-dd "
                type="date" placeholder="选择收款日期">
              </el-date-picker>
            </el-form-item>
          </el-col>
@@ -165,6 +165,24 @@
      <!-- 添加患者 -->
      <el-dialog title="选择器官和组织" :visible.sync="dialogVisiblepatient" width="70%" :before-close="handleClosehz">
        <div class="examine-jic">
          <div style="margin: 0 10px 20px 10px;">
            <el-card class="box-card">
              <el-tag
                v-for="item in overallCase"
                :key="item.id"
                closable
                @close="handleClose(item)"
              >
                {{ item.donorname }}
              </el-tag>
              <div style="margin-top: 20px; text-align: right;">
                共选择<span
                  style="font-size: 18px; color: #409EFF;margin: 0 10px;"
                  >{{ overallCase.length }}</span
                >条数据
              </div>
            </el-card>
          </div>
          <div class="jic-value">
            <el-row :gutter="20">
              <!--用户数据-->
@@ -173,11 +191,14 @@
                  <el-input v-model="form.hospitalname" placeholder="请输入付款医院" :disabled="true" />
                </el-form-item>
                <el-form-item label="捐献者" prop="status">
                  <el-input v-model="patientqueryParams.donorname"  @keyup.enter.native="handleAddpatient" placeholder="请输入捐献者姓名"  />
                </el-form-item>
                <!-- <el-form-item label="捐献者" prop="status">
                  <el-select v-model="patientqueryParams.donorchargeid" filterable placeholder="请选择">
                    <el-option v-for="item in donorchargeanlList" :key="item.id" :label="item.name" :value="item.id">
                    </el-option>
                  </el-select>
                </el-form-item>
                </el-form-item> -->
                <el-form-item>
                  <el-button type="primary" icon="el-icon-search" size="medium" @click="handleAddpatient">搜索</el-button>
@@ -307,7 +328,7 @@
    Li_area_select,
    pdf
  },
  dicts: ["sys_gathering", "sys_0_1"],
  dicts: ["Collection_status", "sys_0_1"],
  name: "Donorchargemanager",
  data() {
    return {
@@ -346,6 +367,8 @@
        hospitalno: null,
        paymentid: null
      },
      // 总选中数据
      overallCase: [],
      dialogVisiblepatient: false,
      patienttotal: 0, //
      //票据文件
@@ -528,7 +551,6 @@
    handleClosehz() {
      this.dialogVisiblepatient = false;
    },
    handleQuery() { },
    resetQuery() {
      this.patientqueryParams.donorname = null;
      this.patientqueryParams.donorchargeid = null;
@@ -538,13 +560,82 @@
    // 弹框添加
    AddDispatchpatients() {
      this.donorchargeorgans = this.donorchargeorgans.concat(
        this.multipleSelection
        this.overallCase
      );
      this.dialogVisiblepatient = false;
    },
    // 多选框选中数据
    handleSelectionChange(val) {
      this.multipleSelection = val;
    handleSelectionChange(selection) {
      if (this.decision) return;
      // 判断是否有删除
      if (this.multipleSelection.length <= selection.length) {
        this.multipleSelection = selection;
      } else {
        console.log(11);
        this.multipleSelection.forEach(item => {
          if (selection.includes(item)) {
          } else {
            if (this.multipleSelection.length == 1) {
              this.multipleSelection = [];
            } else {
              this.multipleSelection.splice(
                this.multipleSelection.indexOf(item),
                1
              );
            }
            if (this.overallCase.length == 1) {
              this.overallCase = [];
            } else {
              this.overallCase.splice(this.overallCase.indexOf(item), 1);
            }
          }
        });
      }
      // 赋值给整体选中数组
      this.multipleSelection.forEach(item => {
        if (!this.overallCase.includes(item)) {
          this.overallCase.push(item);
        }
      });
      console.log(this.multipleSelection, "触发选择后multipleSelection");
    },
    // 切换页后恢复选中
    Restorecheck() {
      console.log(this.overallCase, "this.overallCase");
      const allid = this.overallCase.map(item => item.id);
      const overlap = this.donorchargeList.filter(value => {
        return allid.includes(value.id);
      });
      // 保持ids和当前页面的同步性
      this.multipleSelection = overlap;
      console.log(this.multipleSelection, "进入分页multipleSelection");
      this.toggleSelection(overlap);
    },
    // 挂载选择状态
    toggleSelection(rows) {
      if (rows) {
        this.decision = true;
        this.$nextTick(() => {
          rows.forEach(row => {
            this.$refs.multipleTable.toggleRowSelection(row, true);
          });
          this.decision = false;
        });
        console.log(123);
      } else {
        this.$refs.multipleTable.clearSelection();
      }
    },
    // 选择人员标签删除事件
    handleClose(item) {
      this.overallCase.splice(this.overallCase.indexOf(item), 1);
      if (this.multipleSelection.indexOf(item) == -1) {
      } else {
        this.multipleSelection.splice(this.multipleSelection.indexOf(item), 1);
        this.$refs.multipleTable.toggleRowSelection(item, false);
        // this.toggleSelection(this.multipleSelection);
      }
    },
    // 点击新增
    handleAddpatient(row) {
@@ -556,7 +647,7 @@
        this.donorchargeList = res.rows;
        this.patienttotal = res.total;
        this.patientqueryParams.paymentidIsNotNull = true;
        console.log(this.donorchargeList);
        this.Restorecheck();
      });
    },
    // 获取请求头
@@ -622,11 +713,7 @@
      });
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 取消按钮
    cancel() {
@@ -697,6 +784,7 @@
                saveDonorchargeorgan(this.donorchargeorgans).then(res2 => {
                  if (res2.code == 200) {
                    this.$modal.msgSuccess("保存成功!");
                    this.overallCase=[]
                  } else {
                    this.$modal.msgError(res2.msg);
                  }
@@ -718,6 +806,7 @@
                saveDonorchargeorgan(this.donorchargeorgans).then(res2 => {
                  if (res2.code == 200) {
                    this.$modal.msgSuccess("保存成功!");
                    this.overallCase=[]
                  } else {
                    this.$modal.msgError(res2.msg);
                  }
@@ -1147,6 +1236,13 @@
    }
  }
}
::v-deep .el-tag--medium {
  height: 28px;
  line-height: 26px;
  margin-right: 15px;
  margin-bottom: 15px;
  font-size: 16px;
}
::v-deep .el-input.is-disabled .el-input__inner {
  background-color: #F5F7FA;