WXL
3 天以前 dc082351978a1e9f75d7a1471a0ca7ebeac552a5
src/views/business/transfer/index.vue
@@ -8,7 +8,7 @@
        :inline="true"
        label-width="80px"
      >
        <el-form-item label="案例编号" prop="caseNo">
        <el-form-item label="上报医院" prop="caseNo">
          <el-input
            v-model="queryParams.caseNo"
            placeholder="请输入案例编号"
@@ -17,7 +17,7 @@
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="患者姓名" prop="patName">
        <el-form-item label="姓名" prop="patName">
          <el-input
            v-model="queryParams.patName"
            placeholder="请输入患者姓名"
@@ -41,7 +41,7 @@
            <el-option label="暂存" :value="5" />
          </el-select>
        </el-form-item>
        <el-form-item label="创建时间">
        <el-form-item label="转运时间">
          <el-date-picker
            v-model="dateRange"
            style="width: 240px"
@@ -149,12 +149,7 @@
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="序号" type="index" width="60" align="center" />
      <el-table-column
        label="案例编号"
        align="center"
        prop="caseNo"
        width="140"
      />
      <el-table-column label="编号" align="center" prop="caseNo" width="140" />
      <el-table-column label="患者信息" align="center" width="260">
        <template slot-scope="scope">
          <div class="donor-info">
@@ -177,24 +172,6 @@
        show-overflow-tooltip
      />
      <el-table-column
        label="治疗医院"
        align="center"
        prop="treatmentHospitalName"
        width="150"
      />
      <el-table-column
        label="计划转运时间"
        align="center"
        prop="transportStartTime"
        width="160"
      />
      <el-table-column
        label="负责协调员"
        align="center"
        prop="contactPerson"
        width="100"
      />
      <el-table-column
        label="转运状态"
        align="center"
        prop="transitStatus"
@@ -206,6 +183,25 @@
          </el-tag>
        </template>
      </el-table-column>
      <el-table-column
        label="计划转运时间"
        align="center"
        prop="transportStartTime"
        width="160"
      />
      <el-table-column
        label="协调员"
        align="center"
        prop="contactPerson"
        width="100"
      />
      <el-table-column
        label="上报医院"
        align="center"
        prop="treatmentHospitalName"
        width="150"
      />
      <el-table-column
        label="创建时间"
        align="center"
@@ -221,34 +217,49 @@
      >
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-view"
            size="small"
            type="primary"
            @click="handleDetail(scope.row)"
            >详情</el-button
          >
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            size="small"
            type="primary"
            style="margin-bottom: 10px;"
            plain
            @click="handleUpdate(scope.row)"
            >编辑</el-button
          >
          <el-button
            size="mini"
            type="text"
            icon="el-icon-video-play"
            size="small"
            type="primary"
            plain
            @click="handleStartTransport(scope.row)"
            v-if="scope.row.transitStatus === 1"
            >开始转运</el-button
          >
          <el-button
            size="mini"
            type="text"
            icon="el-icon-check"
            size="small"
            type="success"
            plain
            @click="handleCompleteTransport(scope.row)"
            v-if="scope.row.transitStatus === 2"
            >完成转运</el-button
          ><el-button
            size="small"
            type="danger"
            plain
            @click="cancelTransport(scope.row)"
            v-if="scope.row.transitStatus === 2"
            >取消转运</el-button
          >
          <el-button
            size="small"
            type="warning"
            plain
            @click="recoverTransport(scope.row)"
            v-if="scope.row.transitStatus === 4"
            >恢复转运</el-button
          >
        </template>
      </el-table-column>
@@ -430,9 +441,7 @@
    >
      <div class="action-confirm">
        <p>
          确定要{{ actionText }}转运单 "{{
             currentTransport.id
          }}" 吗?
          确定要{{ actionText }}转运单 "{{ currentTransport.patName }}" 吗?
        </p>
      </div>
      <div slot="footer" class="dialog-footer">
@@ -450,7 +459,9 @@
  transportEdit,
  transportDel,
  transportInfo,
  donateList
  donateInfo,
  donateList,
  donateEdit
} from "@/api/businessApi/index";
import TransportDetail from "./transportDetail";
import TransportEdit from "./TransportEdit";
@@ -519,15 +530,15 @@
        pageNum: 1,
        pageSize: 10,
        caseNo: undefined,
        patName: undefined,
        patName: undefined
        // 只查询已同意且需要转运的案例
        // reportStatus: "3", // 已同意
        isTransport: "2" // 需要转运
        // isTransport: "2" // 需要转运
      }
    };
  },
  created() {
    this.getList();
    // this.getList();
    this.checkAutoCreate();
  },
  methods: {
@@ -567,26 +578,31 @@
    },
    checkAutoCreate() {
      const query = this.$route.query;
      // 上报跳转过来进行处理
      if (query.autoCreate === "true") {
        // 自动打开案例选择弹框
        this.selectCaseOpen = true;
        this.resetCaseSearch();
        // 如果有特定的案例编号,可以预先搜索
        if (query.caseNo) {
          // this.selectCaseOpen = true;
          this.resetCaseSearch(1);
          this.caseQueryParams.caseNo = query.caseNo;
          this.searchCaseList();
          this.searchCaseList(1);
        } else {
          this.queryParams.patName = query.patName;
        }
      }
      this.getList();
    },
    /** 搜索可用案例 */
    async searchCaseList() {
    async searchCaseList(type) {
      this.caseLoading = true;
      try {
        const response = await donateList(this.caseQueryParams);
        if (response.code === 200) {
          this.availableCaseList = response.rows || response.data || [];
          this.caseTotal = response.total || 0;
          if (type == 1 && response.data[0]) {
            this.selectCase(response.data[0]);
          }
        } else {
          this.$modal.msgError(response.msg || "获取案例列表失败");
        }
@@ -599,7 +615,7 @@
    },
    /** 重置案例搜索 */
    resetCaseSearch() {
    resetCaseSearch(type) {
      this.caseQueryParams = {
        pageNum: 1,
        pageSize: 10,
@@ -608,7 +624,12 @@
        // reportStatus: "3",
        isTransport: "2"
      };
      this.searchCaseList();
      if (!type) {
        this.searchCaseList();
      } else {
        // 跨页面新增取消限制
        this.caseQueryParams.isTransport = null;
      }
    },
    /** 判断案例是否已有转运单 */
@@ -636,7 +657,7 @@
      // 打开转运单编辑页面,并传入选中的案例
      this.currentTransport = this.convertCaseToTransport(caseData);
      console.log(this.currentTransport,'currentTransport');
      console.log(this.currentTransport, "currentTransport");
      this.isEditing = false;
      this.editOpen = true;
@@ -644,7 +665,7 @@
    /** 将案例信息转换为转运单格式 */
    convertCaseToTransport(caseData) {
      console.log(caseData,'2');
      console.log(caseData, "2");
      return {
        caseNo: caseData.caseNo,
@@ -658,6 +679,8 @@
        // 其他字段可以根据需要从案例中获取
        transportStartPlace: caseData.treatmenthospitalname || "",
        contactPerson: caseData.coordinatorName || "",
        icuDoctor: caseData.icuDoctor,
        icuDoctorPhone: caseData.icuDoctorPhone,
        transitStatus: 1, // 默认待转运
        // 清空其他字段
        id: undefined,
@@ -712,7 +735,7 @@
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item =>  item.id);
      this.ids = selection.map(item => item.id);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
    },
@@ -740,7 +763,7 @@
    /** 详情按钮操作 */
    handleDetail(row) {
      this.currentTransport = row;
      this.detailTitle = `转运单详情 - ${ row.id}`;
      this.detailTitle = `转运单详情 - ${row.id}`;
      this.detailOpen = true;
    },
@@ -787,25 +810,52 @@
      this.actionTitle = "完成转运";
      this.actionText = "完成";
      this.actionOpen = true;
    } /** 完成转运操作 */,
    async cancelTransport(row) {
      this.currentTransport = row;
      this.actionTitle = "取消转运";
      this.actionText = "取消";
      this.actionOpen = true;
    } /** 完成转运操作 */,
    async recoverTransport(row) {
      this.currentTransport = row;
      this.actionTitle = "恢复转运";
      this.actionText = "恢复";
      this.actionOpen = true;
    },
    /** 确认操作 */
    async confirmAction() {
      try {
        let requestData = {
          id: this.currentTransport.id
          ...this.currentTransport
        };
        if (this.actionText === "开始") {
          requestData.transitStatus = 2; // 设置为转运中
        } else if (this.actionText === "完成") {
          requestData.transitStatus = 3; // 设置为转运完成
        } else if (this.actionText === "取消") {
          requestData.transitStatus = 4; // 设置为转运取消
        } else if (this.actionText === "恢复") {
          requestData.transitStatus = 2; // 设置为转运中
        }
        requestData.annexfilesList.forEach(item => {
          item.id = null;
        });
        const response = await transportEdit(requestData);
        if (response.code === 200) {
        if (response.code == 200) {
          this.$modal.msgSuccess(`${this.actionText}转运成功`);
          if (requestData.transitStatus == 3) {
            const resappear = await donateInfo(requestData.reportId);
            if (resappear.code) {
              let obj = resappear.data;
              obj.isDonate = 1;
              await donateEdit(obj);
              this.$modal.msgSuccess(`对应上报案例已进入正式案例流程`);
            }
          }
          this.getList();
        } else {
          this.$modal.msgError(response.msg || `${this.actionText}转运失败`);