WXL (wul)
2 天以前 22bd207587899810e9afb4c1a53f0d5dae1e2ece
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}...`,
@@ -1428,16 +1442,26 @@
    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 } // 立即执行一次以获取初始值
@@ -1582,8 +1606,6 @@
    },
    // 检查随访日期是否有效
    checkFollowupDate(date) {
      console.log(date);
      if (!date) {
        this.form.date1 = "";
        this.$refs.zcform.clearValidate(["date1"]);
@@ -1710,7 +1732,10 @@
            }
          });
          this.Editsingletasksonyic(6);
          if (this.visitCount != 1) {
            this.Torouter();
            return;
          }
          this.$modal
            .confirm(
              '任务保存成功是否针对患者:"' +
@@ -1732,33 +1757,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 +1917,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 +1945,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();
            });
        }
      });