lkk
2024-11-27 e17811c1d7b1e6318af32a366d23bd586750b6d2
src/views/doctor/checkAll/index.vue
@@ -481,7 +481,7 @@
                      <textarea
                        placeholder="请输入内容"
                        :autosize="{ minRows: 2, maxRows: 2 }"
                        style="width: 100%; height: 100%;resize: none;"
                        style="width: 100%; height: 100%; resize: none"
                        v-model="changedate[index].remark"
                        v-on:input="change"
                      ></textarea>
@@ -493,34 +493,31 @@
              </div>
              <div v-else>
                <table style="width: 100%" v-if="tjproject != '1'">
                  <tr
                    style="border: 1px solid #dfe6ec; border-collapse: collapse"
                  >
                  <tr style="border: 1px solid #dfe6ec">
                    <td
                      style="
                        border: 1px solid #dfe6ec;
                        border-collapse: collapse;
                        width: 15%;
                        height: 52px;
                      "
                    >
                      检查所见:
                    </td>
                    <td style="border: 1px solid #dfe6ec;"  colspan="2">
                       <textarea
                    <td
                      style="border: 1px solid #dfe6ec; height: 52px"
                      colspan="2"
                    >
                      <textarea
                        placeholder="请输入内容"
                        :autosize="{ minRows: 3, maxRows: 4 }"
                        style="width: 100%; height: 100%;resize: none;"
                        style="width: 100%; height: 100%; resize: none"
                        v-model="item.jgbx"
                      ></textarea>
                    </td>
                  </tr>
                  <tr
                    style="
                      border: 1px solid #dfe6ec;
                      border-collapse: collapse;
                    "
                    style="border: 1px solid #dfe6ec; border-collapse: collapse"
                  >
                    <td
                      style="
@@ -535,33 +532,31 @@
                      style="
                        border: 1px solid #dfe6ec;
                        border-collapse: collapse;
                      "
                      colspan="2"
                    >
                    <el-input v-model="item.remark" ></el-input>
                      <!-- <textarea
                      <!-- <el-input v-model="item.remark"></el-input> -->
                      <textarea
                        placeholder="请输入内容"
                        :autosize="{ minRows: 2, maxRows: 2 }"
                        style="width: 100%; height: 100%"
                        v-model="changedate[index].remark"
                        v-on:input="change"
                      ></textarea> -->
                        :autosize="{ minRows: 2, maxRows: 3 }"
                        style="width: 100%; height: 100%; resize: none"
                        v-model="item.remark"
                      ></textarea>
                    </td>
                  </tr>
                  <tr  style="
                  <tr
                    style="
                      border: 1px solid #dfe6ec;
                      border-collapse: collapse;
                      width: 200px;
                      height: 36px;
                    ">
                    "
                  >
                    <td
                      style="
                        border: 1px solid #dfe6ec;
                        border-collapse: collapse;
                        width: 15%;
                      "
                    >
                      主检医师:
@@ -1157,6 +1152,9 @@
  name: "checkAll",
  data() {
    return {
      // 更新总检建议
      initialTotalCheckAdvice: "",
      initialState: "",
      preObj: {},
      baogao: [],
      flags: false,
@@ -1528,6 +1526,8 @@
    radioChange(value) {
      this.loading = true;
      this.queryParams.checkStatus = value;
      this.queryParams.page = 1;
      this.queryParams.pageSize = 10;
      getcheckList(this.queryParams).then((response) => {
        if (response.data) {
          this.checkList = response.data.customers;
@@ -1658,6 +1658,7 @@
    // 搜索
    submitForm() {
      console.log(this.tjStatus);
      this.loading = true;
      this.queryParams.compId = this.CheckBox.drugManufacturerId;
      this.queryParams.checkStatus = this.tjStatus;
@@ -1701,11 +1702,25 @@
      }
    },
    /*  changRed(row) {
      if (row.label === "↑") {
        return {
          color: "green", // 设置上箭头为绿色
        };
      } else if (row.label === "↓") {
        return {
          color: "red", // 设置下箭头为红色
        };
      }
      // 默认颜色
      return {
        color: "black",
      };
    }, */
    handleCurrentChange(val) {
      if(val != null){
      if (val != null) {
        this.handleClick(val);
      }
    },
    // 点击详情
@@ -1713,15 +1728,7 @@
      this.$refs.Pre.open = false;
      this.tableAll = row;
      this.tjproject = "0";
      // if (this.tableAll.cusSex === 0) {
      //   this.tableAll.cusSex = "男";
      // }
      // if (this.tableAll.cusSex === 1) {
      //   this.tableAll.cusSex = "女";
      // }
      // if (this.tableAll.cusSex === 2) {
      //   this.tableAll.cusSex = "未知";
      // }
      this.tjNumber = this.tableAll.tjNumber;
      getState(this.tjNumber).then((res) => {
        this.status = res.data;
@@ -1741,8 +1748,17 @@
                  this.changedate = response.data;
                  if (this.changedate) {
                    this.changedate.forEach((item) => {
                      this.textarea1 = item.checkAdvice;
                      this.textarea1 = item.checkAdvice || "";
                    });
                    // 这里设置初始值
                    this.initialTotalCheckAdvice = this.textarea1; // 保存总检建议
                    // 保存初始状态
                    this.initialState = JSON.parse(
                      JSON.stringify(this.changedate)
                    );
                    for (let i = 0; i < this.changedate.length; i++) {
                      this.remark = this.changedate[i].remark;
                    }
@@ -1795,8 +1811,12 @@
                        for (let i = 0; i < this.changedate.length; i++) {
                          this.remark = this.changedate[i].remark;
                        }
                        this.initialState = JSON.parse(
                          JSON.stringify(this.changedate)
                        );
                        this.changedate.forEach((item) => {
                          this.textarea1 = item.checkAdvice;
                          this.textarea1 = item.checkAdvice || "";
                          // this.remark = item.remark;
                          // item.sons.forEach((item3) => {
@@ -1809,6 +1829,11 @@
                          // });
                          // item.remark = "";
                        });
                        // 保存总检建议
                        this.totalCheckAdvice = this.changedate.map(
                          (item) => item.totalCheckAdvice
                        );
                      } else {
                        this.$message({
                          type: "warning ",
@@ -1859,29 +1884,44 @@
      if (this.loading) {
        return;
      }
      this.$confirm("确定要提交吗?")
        .then((_) => {
          this.loading = true;
          this.timer = setTimeout(() => {
            done();
            this.determine();
            // 动画关闭需要一定的时间
            setTimeout(() => {
              this.loading = false;
            }, 400);
          }, 2000);
        })
        .catch((_) => {
          this.drawer = false;
          let data = {
            userId: this.userId,
            tjNumber: this.tjNumber,
            state: 1,
            id: this.MsgId,
          };
          getfiedState(data).then((res) => {});
          this.submitForm()
        });
      // 检查是否有修改
      let isModified =
        JSON.stringify(this.changedate) !== JSON.stringify(this.initialState) ||
        (this.textarea1 !== this.initialTotalCheckAdvice &&
          this.textarea1 !== null);
      console.log("Initial Total Check Advice:", this.initialTotalCheckAdvice);
      console.log("Current textarea1:", this.textarea1);
      if (isModified) {
        // 如果有修改,弹出确认框
        this.$confirm("检测内容有修改,确定要提交吗?")
          .then(() => {
            this.loading = true;
            this.timer = setTimeout(() => {
              done();
              this.determine();
              setTimeout(() => {
                this.loading = false;
              }, 400);
            }, 2000);
          })
          .catch(() => {
            // 用户取消操作
            this.drawer = false;
            let data = {
              userId: this.userId,
              tjNumber: this.tjNumber,
              state: 1,
              id: this.MsgId,
            };
            getfiedState(data).then((res) => {});
            this.submitForm();
          });
      } else {
        // 如果没有修改,直接关闭
        done();
      }
    },
    handleClose1() {
      this.jianqians = false;
@@ -1907,9 +1947,8 @@
    //     });
    //   }
    // },
    change(vale) {
    },
    determine() {
    change(vale) {},
   /*  determine() {
      let tjNumber = this.tableAll.tjNumber;
      let advice = this.textarea1;
      let data = {
@@ -1917,6 +1956,7 @@
        advice,
        checkStatus: 1,
      };
      this.loading = true;
      getTjdetailList(data).then((response) => {
        if (response.code === 200) {
          this.$modal.msgSuccess("提交成功");
@@ -1927,13 +1967,22 @@
            state: 1,
            id: this.MsgId,
          };
          gettoPdf(tjNumber).then((res) => {
            this.$modal.msgSuccess("已生成报告!请前往报告核收页面确认!");
          });
          gettoPdf(tjNumber)
            .then((res) => {
              this.$modal.msgSuccess("已生成报告!请前往报告核收页面确认!");
            })
            .catch((error) => {
              this.$modal.msgError(
                "打印报告失败,请前往报告打印页面补打报告!"
              );
            })
          getfiedState(data).then((res) => {
            this.drawer = false;
          });
        }
          this.queryParams.page = 1;
          this.queryParams.pageSize = 10;
          this.submitForm();
          this.$forceUpdate();
      });
      for (let i = 0; i < this.changedate.length; i++) {
@@ -1948,12 +1997,94 @@
        ];
        getModified(updateOrderRemarkVos).then((response) => {});
      }
      this.submitForm();
      this.$forceUpdate();
      // this.changedate.forEach((item) => {
      //   this.proIds = item.parentId;
      //   // this.remark = item.remark;
      // });
    }, */
    determine() {
      let tjNumber = this.tableAll.tjNumber;
      let advice = this.textarea1;
      let data = {
        tjNumber,
        advice,
        checkStatus: 1,
      };
      // 开始加载
      this.loading = true;
      // 提交数据
      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 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, ...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);
        });
    },
  },
};