1
lkk
2025-01-23 35cebfa072de707605d52842672c50beca04f398
src/views/doctor/checkAll/index.vue
@@ -715,6 +715,7 @@
                    <el-table-column
                      align="center"
                      label="检测项目"
                      :show-overflow-tooltip="true"
                      width="353"
                    >
                      <template slot-scope="scope">
@@ -821,6 +822,7 @@
                      align="center"
                      label="检测项目"
                      width="232"
                      :show-overflow-tooltip="true"
                    >
                      <template slot-scope="scope">
                        <div>{{ scope.row.proName }}</div>
@@ -1385,6 +1387,7 @@
import { getNewDateList } from "@/api/hosp/order";
import { getconfigKey } from "@/api/login";
import moment from "moment";
import { get } from "sortablejs";
export default {
  components: {
@@ -1604,7 +1607,27 @@
        tjNum: this.tjNumber,
      }).then((res) => {
        this.yichangList = res.data;
        console.log(this.yichangList, 3232);
        this.getExpends();
        this.yichangList.forEach((item) => {
          item.sone.forEach((soneItem) => {
            if (
              !Array.isArray(soneItem.advices) ||
              soneItem.advices.length === 0
            ) {
              // 如果 advices 是空,设置默认值
              soneItem.advices = [
                {
                  bt: "",
                  nr: "",
                },
              ];
            }
          });
        });
        if (!this.yichangList) {
          _this.$message({
            type: "warning ",
@@ -2348,10 +2371,120 @@
    // },
    change(vale) {},
    // determine() {
    //   let tjNumber = this.tableAll.tjNumber;
    //   let tjh = this.tableAll.tjNumber;
    //   // let jyjc = this.yichangList.map(item => item.jyjc || null);
    //   let advice = this.textarea1;
    //   let data = {
    //     tjNumber,
    //     advice,
    //     checkStatus: 1,
    //   };
    //   console.log(this.yichangList, 66);
    //   let dataList = this.yichangList
    //     .map((item) => {
    //       return item.sone.map((soneItem) => ({
    //         tjh,
    //         parentName: item.proName,
    //         jcxm: soneItem.proName,
    //         map: soneItem.advices,
    //         jyjc: item.jyjc, // assuming jyjc belongs to the outer item, not soneItem
    //         jcjg: soneItem.proResult,
    //         ckfw: soneItem.stanId,
    //         dw: soneItem.proAdvice,
    //       }));
    //     })
    //     .flat(); // 使用 flat() 方法将嵌套数组展平
    //   console.log(dataList, 777);
    //   /*  addOrder(dataList).then((res) => {
    //     console.log(res, 999);
    //   }); */
    //   getTjdetailList(data)
    //     .then((response) => {
    //       if (response.code === 200) {
    //         this.$modal.msgSuccess("提交成功");
    //         // 准备生成报告的请求数据
    //         let reportData = {
    //           userId: this.userId,
    //           tjNumber: tjNumber,
    //           state: 1,
    //           id: this.MsgId,
    //         };
    //         // 生成报告并保持 loading 打开
    //         const reportPromise = gettoPdf(tjNumber)
    //           .then((res) => {
    //             this.$modal.msgSuccess("已生成报告!请前往报告核收页面确认!");
    //           })
    //           .catch((error) => {
    //             this.$modal.msgError(
    //               "打印报告失败,请前往报告打印页面补打报告!"
    //             );
    //           });
    //         // 更新状态并提交修改请求
    //         const statePromise = getfiedState(reportData).then((res) => {
    //           this.drawer = false;
    //         });
    //         // const addOrderPromise = addOrder(dataList).then((res) => {
    //         //   console.log(res, 999);
    //         // });
    //         // 处理其他修改操作
    //         const updatePromises = this.changedate.map((item) => {
    //           this.proIds = item.parentId;
    //           let remarks = item.remark;
    //           let updateOrderRemarkVos = [
    //             {
    //               tjNumber,
    //               proId: this.proIds.toString(),
    //               remarks,
    //             },
    //           ];
    //           return getModified(updateOrderRemarkVos); // 返回 Promise
    //         });
    //         // 等待所有请求完成
    //         Promise.all([
    //           reportPromise,
    //           statePromise,
    //           // addOrderPromise,
    //           ...updatePromises,
    //         ])
    //           .then(() => {
    //             // 所有请求完成,关闭 loading
    //             this.loading = false;
    //             // 更新分页信息
    //             this.queryParams.page = 1;
    //             this.queryParams.pageSize = 10;
    //             this.submitForm();
    //             this.$forceUpdate();
    //           })
    //           .catch((error) => {
    //             // 处理错误情况
    //             this.loading = false;
    //             console.error("发生错误:", error);
    //           });
    //       } else {
    //         // 提交失败,关闭 loading
    //         this.loading = false;
    //       }
    //     })
    //     .catch((error) => {
    //       // 提交请求失败,关闭 loading
    //       this.loading = false;
    //       console.error("提交请求失败:", error);
    //     });
    // },
    determine() {
      let tjNumber = this.tableAll.tjNumber;
      let tjh = this.tableAll.tjNumber;
      // let jyjc = this.yichangList.map(item => item.jyjc || null);
      let advice = this.textarea1;
      let data = {
        tjNumber,
@@ -2359,7 +2492,7 @@
        checkStatus: 1,
      };
      console.log(this.yichangList, 66);
      console.log(this.yichangList, 6644);
      let dataList = this.yichangList
        .map((item) => {
@@ -2368,18 +2501,14 @@
            parentName: item.proName,
            jcxm: soneItem.proName,
            map: soneItem.advices,
            jyjc: item.jyjc, // assuming jyjc belongs to the outer item, not soneItem
            jyjc: item.jyjc,
            jcjg: soneItem.proResult,
            ckfw: soneItem.stanId,
            dw: soneItem.proAdvice,
          }));
        })
        .flat(); // 使用 flat() 方法将嵌套数组展平
      console.log(dataList, 777);
      /*  addOrder(dataList).then((res) => {
        console.log(res, 999);
      }); */
      getTjdetailList(data)
        .then((response) => {
          if (response.code === 200) {
@@ -2393,60 +2522,62 @@
              id: this.MsgId,
            };
            // 生成报告并保持 loading 打开
            const reportPromise = gettoPdf(tjNumber)
            // 调用 addOrderPromise
            console.log(dataList, 5555);
            addOrder(dataList)
              .then((res) => {
                this.$modal.msgSuccess("已生成报告!请前往报告核收页面确认!");
                console.log(res, 999);
                if (res.code == 200) {
                  gettoPdf(tjNumber)
                    .then((res) => {
                      this.$modal.msgSuccess(
                        "已生成报告!请前往报告核收页面确认!"
                      );
                    })
                    .catch(() => {
                      this.$modal.msgError(
                        "打印报告失败,请前往报告打印页面补打报告!"
                      );
                    });
                  const statePromise = getfiedState(reportData).then(() => {
                    this.drawer = false;
                  });
                  const updatePromises = this.changedate.map((item) => {
                    this.proIds = item.parentId;
                    let remarks = item.remark;
                    let updateOrderRemarkVos = [
                      {
                        tjNumber,
                        proId: this.proIds.toString(),
                        remarks,
                      },
                    ];
                    return getModified(updateOrderRemarkVos); // 返回 Promise
                  });
                  // 等待所有请求完成
                  Promise.all([statePromise, ...updatePromises])
                    .then(() => {
                      // 所有请求完成,关闭 loading
                      this.loading = false;
                      // 更新分页信息
                      this.queryParams.page = 1;
                      this.queryParams.pageSize = 10;
                      this.submitForm();
                      this.$forceUpdate();
                    })
                    .catch((error) => {
                      // 处理错误情况
                      this.loading = false;
                      console.error("发生错误:", error);
                    });
                }
              })
              .catch((error) => {
                this.$modal.msgError(
                  "打印报告失败,请前往报告打印页面补打报告!"
                );
              });
            // 更新状态并提交修改请求
            const statePromise = getfiedState(reportData).then((res) => {
              this.drawer = false;
            });
            const addOrderPromise = addOrder(dataList).then((res) => {
              console.log(res, 999);
            });
            // 处理其他修改操作
            const updatePromises = this.changedate.map((item) => {
              this.proIds = item.parentId;
              let remarks = item.remark;
              let updateOrderRemarkVos = [
                {
                  tjNumber,
                  proId: this.proIds.toString(),
                  remarks,
                },
              ];
              return getModified(updateOrderRemarkVos); // 返回 Promise
            });
            // 等待所有请求完成
            Promise.all([
              reportPromise,
              statePromise,
              addOrderPromise,
              ...updatePromises,
            ])
              .then(() => {
                // 所有请求完成,关闭 loading
                // 如果 addOrderPromise 失败,处理错误
                this.loading = false;
                // 更新分页信息
                this.queryParams.page = 1;
                this.queryParams.pageSize = 10;
                this.submitForm();
                this.$forceUpdate();
              })
              .catch((error) => {
                // 处理错误情况
                this.loading = false;
                console.error("发生错误:", error);
                console.error("addOrderPromise 失败:", error);
              });
          } else {
            // 提交失败,关闭 loading
@@ -2636,7 +2767,6 @@
  width: 684px;
  position: fixed; /* 固定定位 */
  right: 60px;
  .right {
    background-color: #fff;