WXL (wul)
9 小时以前 1feb410410781eb56159c8fdd856e68d2c23e0a4
src/views/followvisit/record/detailpage/index.vue
@@ -695,7 +695,10 @@
                </div>
                <!-- SIP注册状态提示 -->
                <div v-if="isSipRegistering&&orgname == '丽水市中医院'" class="sip-registering">
                <div
                  v-if="isSipRegistering && orgname == '丽水市中医院'"
                  class="sip-registering"
                >
                  <el-alert
                    title="呼叫座机初始化中,请稍候..."
                    type="info"
@@ -1157,6 +1160,7 @@
      callType: "", // 用于区分是哪个电话
      isSipRegistering: true, // SIP注册状态
      // 已有数据...
      customCallStatus: "", // 用于存储自定义状态文本
      callStatus: "idle", // idle, calling, connected, ended, failed
      isEndingCall: false,
      CaldialogVisible: false,
@@ -1376,6 +1380,7 @@
          label: "一年后",
        },
      ],
      statusTimer: null,
      userform: {},
      smsDialogVisible: false, // 控制短信对话框显示
      smsContent: "", // 存储短信内容
@@ -1392,9 +1397,18 @@
      patid: null,
    };
  },
  // 在组件中添加销毁前的清理
  beforeUnmount() {
    if (this.statusTimer) {
      clearTimeout(this.statusTimer);
      this.statusTimer = null;
    }
  },
  computed: {
    callStatusText() {
      if (this.customCallStatus) {
        return this.customCallStatus;
      }
      const statusMap = {
        idle: "准备呼叫",
        calling: `正在呼叫 ${this.currentPhoneNumber}...`,
@@ -1425,19 +1439,55 @@
    this.visitCount = this.$route.query.visitCount;
    this.serviceType = this.$route.query.serviceType;
    this.orgname = localStorage.getItem("orgname");
    if (this.orgname == "缙云县中医医院") {
      this.options = [
        {
          value: "半个月后",
          label: "半个月后",
        },
        {
          value: "一个月后",
          label: "一个月后",
        },   {
          value: "两个月后",
          label: "两个月后",
        },
        {
          value: "三个月后",
          label: "三个月后",
        },
        {
          value: "六个月后",
          label: "六个月后",
        },
        {
          value: "12个月后",
          label: "12个月后",
        },
      ];
    }
    this.getTaskservelist();
  },
mounted() {
  mounted() {
    // 监听子组件的sipStatus属性变化
    if (this.$refs.callButton) {
      this.$watch(
        () => this.$refs.callButton.sipStatus,
        (newStatus) => {
          if (newStatus === '已注册') {
          if (this.statusTimer) {
            clearTimeout(this.statusTimer);
            this.statusTimer = null;
          }
          if (newStatus === "已注册") {
            this.statusTimer = setTimeout(() => {
              this.isSipRegistering = false;
              this.customCallStatus = ""; // 注册成功后清空自定义提示
              console.log("SIP注册成功,状态已更新");
            }, 2000);
            this.isSipRegistering = false;
          } else if (newStatus === '注册失败' || newStatus === '未连接') {
          } else if (newStatus === "注册失败" || newStatus === "未连接") {
            this.isSipRegistering = true;
            this.customCallStatus = "呼叫中断,资源重新加载中请稍等3s重新。";
          }
        },
        { immediate: true } // 立即执行一次以获取初始值
@@ -1555,15 +1605,17 @@
      // 根据选择的随访方式计算随访日期
      if (value.includes("七天后")) {
        followupDate.setDate(dischargeDate.getDate() + 7);
      } else if (value.includes("15天后")) {
      } else if (value.includes("15天后")||value.includes("半个月后")) {
        followupDate.setDate(dischargeDate.getDate() + 15);
      } else if (value.includes("一个月后")) {
        followupDate.setMonth(dischargeDate.getMonth() + 1);
      }else if (value.includes("两个月后")) {
        followupDate.setMonth(dischargeDate.getMonth() + 2);
      } else if (value.includes("三个月后")) {
        followupDate.setMonth(dischargeDate.getMonth() + 3);
      } else if (value.includes("六个月后")) {
        followupDate.setMonth(dischargeDate.getMonth() + 6);
      } else if (value.includes("一年后")) {
      } else if (value.includes("一年后")||value.includes("12个月后")) {
        followupDate.setFullYear(dischargeDate.getFullYear() + 1);
      }
@@ -1582,8 +1634,6 @@
    },
    // 检查随访日期是否有效
    checkFollowupDate(date) {
      console.log(date);
      if (!date) {
        this.form.date1 = "";
        this.$refs.zcform.clearValidate(["date1"]);
@@ -1710,7 +1760,10 @@
            }
          });
          this.Editsingletasksonyic(6);
          if (this.visitCount != 1) {
            this.Torouter();
            return;
          }
          this.$modal
            .confirm(
              '任务保存成功是否针对患者:"' +
@@ -1732,33 +1785,36 @@
              this.dialogFormVisible = true;
            })
            .catch(() => {
              if (this.form.serviceType == 13) {
                if (this.visitCount != 1) {
                  this.$router.push({
                    path: "/logisticsservice/zbAgain",
                  });
                } else {
                  this.$router.push({
                    path: "/logisticsservice/record",
                  });
                }
              } else if (this.form.serviceType == 2) {
                if (this.visitCount != 1) {
                  this.$router.push({
                    path: "/logisticsservice/again",
                  });
                } else {
                  this.$router.push({
                    path: "/followvisit/discharge",
                  });
                }
              }
              this.Torouter();
            });
        })
        .catch((error) => {
          // 如果有任何一个异步操作失败,会进入这里
          console.error("发生错误:", error);
        });
    },
    Torouter() {
      if (this.form.serviceType == 13) {
        if (this.visitCount != 1) {
          this.$router.push({
            path: "/logisticsservice/zbAgain",
          });
        } else {
          this.$router.push({
            path: "/logisticsservice/record",
          });
        }
      } else if (this.form.serviceType == 2) {
        if (this.visitCount != 1) {
          this.$router.push({
            path: "/logisticsservice/again",
          });
        } else {
          this.$router.push({
            path: "/followvisit/discharge",
          });
        }
      }
    },
    // 电话============================
    // 验证电话号码格式并返回错误信息
@@ -1889,7 +1945,10 @@
        param2: this.patid,
        subId: this.id,
      };
      if (this.visitCount != 1) {
        this.Torouter();
        return;
      }
      addPersonVoices(obj).then((res) => {
        if (res.code == 200) {
          this.$modal.msgSuccess("服务保存成功");
@@ -1914,27 +1973,7 @@
              this.dialogFormVisible = true;
            })
            .catch(() => {
              if (this.form.serviceType == 13) {
                if (this.visitCount != 1) {
                  this.$router.push({
                    path: "/logisticsservice/zbAgain",
                  });
                } else {
                  this.$router.push({
                    path: "/logisticsservice/record",
                  });
                }
              } else if (form.serviceType == 2) {
                if (this.visitCount != 1) {
                  this.$router.push({
                    path: "/followvisit/again",
                  });
                } else {
                  this.$router.push({
                    path: "/followvisit/discharge",
                  });
                }
              }
              this.Torouter();
            });
        }
      });