WXL (wul)
8 天以前 ffa22cc18c75c0a73a3fd987e2b62fbf55316db2
src/views/followvisit/record/detailpage/index.vue
@@ -107,6 +107,7 @@
                effect="dark"
                :content="scope.row.remark"
                placement="top-start"
                popper-class="statistics-tooltip"
              >
                <div v-if="scope.row.sendstateView == 1">
                  <el-tag type="primary" :disable-transitions="false"
@@ -114,22 +115,12 @@
                  >
                </div>
                <div v-if="scope.row.sendstateView == 2">
                  <el-tag type="primary" :disable-transitions="false"
                    >随访中</el-tag
                  >
                </div>
                <div v-if="scope.row.sendstateView == 3">
                  <el-tag type="warning" :disable-transitions="false"
                    >未完成</el-tag
                  >
                </div>
                <div v-if="scope.row.sendstateView == 4">
                  <el-tag type="success" :disable-transitions="false"
                    >已完成</el-tag
                  >
                </div>
                <div v-if="scope.row.sendstateView == 5">
                  <el-tag type="danger" :disable-transitions="false"
                <div v-if="scope.row.sendstateView == 3">
                  <el-tag type="warning" :disable-transitions="false"
                    >无需随访</el-tag
                  >
                </div>
@@ -145,6 +136,18 @@
          >
          </el-table-column>
          <el-table-column
            v-if="orgname == '南华大学附属第一医院'"
            label="入院日期"
            width="200"
            align="center"
            key="starttime"
            prop="starttime"
          >
            <template slot-scope="scope">
              <span>{{ formatTime(scope.row.starttime) }}</span>
            </template></el-table-column
          >
          <el-table-column
            label="出院日期"
            width="200"
            align="center"
@@ -155,6 +158,7 @@
              <span>{{ formatTime(scope.row.endtime) }}</span>
            </template></el-table-column
          >
          <el-table-column
            label="责任护士"
            width="120"
@@ -169,7 +173,58 @@
            key="drname"
            prop="drname"
          />
          <el-table-column
            label="任务状态"
            align="center"
            key="sendstate"
            prop="sendstate"
            width="120"
          >
            <template slot-scope="scope">
              <el-tooltip
                class="item"
                effect="dark"
                :content="scope.row.remark"
                placement="top-start"
              >
                <div v-if="scope.row.sendstate == 1">
                  <el-tag type="primary" :disable-transitions="false"
                    >表单已领取</el-tag
                  >
                </div>
                <div v-if="scope.row.sendstate == 2">
                  <el-tag type="primary" :disable-transitions="false"
                    >待随访</el-tag
                  >
                </div>
                <div v-if="scope.row.sendstate == 3">
                  <el-tag type="success" :disable-transitions="false"
                    >表单已发送</el-tag
                  >
                </div>
                <div v-if="scope.row.sendstate == 4">
                  <el-tag type="info" :disable-transitions="false"
                    >不执行</el-tag
                  >
                </div>
                <div v-if="scope.row.sendstate == 5">
                  <el-tag type="danger" :disable-transitions="false"
                    >发送失败</el-tag
                  >
                </div>
                <div v-if="scope.row.sendstate == 6">
                  <el-tag type="success" :disable-transitions="false"
                    >已完成</el-tag
                  >
                </div>
                <div v-if="scope.row.sendstate == 7">
                  <el-tag type="danger" :disable-transitions="false"
                    >超时</el-tag
                  >
                </div>
              </el-tooltip>
            </template>
          </el-table-column>
          <el-table-column
            label="结果状态"
            align="center"
@@ -264,15 +319,39 @@
      <!-- 随访内容 -->
      <div class="call-action">
        <div class="call-container">
          <template-selector
            v-if="orgname == '南华大学附属第一医院' && !Voicetype"
            v-model="form.templateid"
            :templateName="form.templatename"
            :service-type="form.serviceType"
            :is-editable="form.sendState !== 2"
            @select="handleTemplateSelect"
            @clear="handleTemplateClear"
          />
          <div
            style="display: flex"
            v-if="
              (orgname == '南华大学附属第一医院' ||
                orgname == '丽水市第二人民医院' ||
                orgname == '缙云县人民医院') &&
              !Voicetype
            "
          >
            <template-selector
              v-model="form.templateid"
              :templateName="form.templatename"
              :service-type="form.serviceType"
              :is-editable="form.sendState !== 2"
              @select="handleTemplateSelect"
              @clear="handleTemplateClear"
            />
            <div
              v-if="defaultKey"
              style="
                display: flex;
                align-items: center;
                justify-content: center;
                height: 100%;
                padding: 33px 0 0 50px;
              "
            >
              <el-button type="success" round @click="handleConfirmReplace">
                默认填充
              </el-button>
            </div>
          </div>
          <div class="headline">
            <div>随访内容</div>
          </div>
@@ -966,34 +1045,21 @@
      <!-- 注意这里使用了 smsDialogVisible 以区分已有的 dialogFormVisible -->
      <el-form ref="smsForm" :model="form" label-width="80px">
        <el-form-item label="患者名称">
          <el-input
            style="width: 400px"
            disabled
            v-model="form.sendname"
          ></el-input>
          <el-input style="width: 400px" v-model="form.sendname"></el-input>
        </el-form-item>
        <el-form-item label="年龄">
          <el-input style="width: 400px" disabled v-model="form.age"></el-input>
          <el-input style="width: 400px" v-model="form.age"></el-input>
        </el-form-item>
        <el-form-item label="电话">
          <el-input
            style="width: 400px"
            disabled
            v-model="userform.telcode"
          ></el-input>
          <el-input style="width: 400px" v-model="userform.telcode"></el-input>
          <!-- 注意这里可能使用 userform.telcode -->
        </el-form-item>
        <el-form-item label="科室">
          <el-input
            style="width: 400px"
            disabled
            v-model="form.deptname"
          ></el-input>
          <el-input style="width: 400px" v-model="form.deptname"></el-input>
        </el-form-item>
        <el-form-item label="病区">
          <el-input
            style="width: 400px"
            disabled
            v-model="form.leavehospitaldistrictname"
          ></el-input>
        </el-form-item>
@@ -1187,6 +1253,7 @@
  updateTemplate,
  query360PatInfonh,
  sendMsg,
  getconfigKey,
} from "@/api/AiCentre/index";
import {
  messagelistpatient,
@@ -1290,6 +1357,7 @@
    return {
      visitAgain: 1,
      userid: "",
      defaultKey: false, //是否可默认填报
      currentPhoneNumber: "",
      callType: "", // 用于区分是哪个电话
      isSipRegistering: true, // SIP注册状态
@@ -1472,56 +1540,6 @@
          // 禁用今天及之前的日期
          return time.getTime() < Date.now() - 24 * 60 * 60 * 1000;
        },
        // shortcuts: [
        //   {
        //     text: "七天后",
        //     onClick(picker) {
        //       const date = new Date();
        //       date.setTime(date.getTime() + 3600 * 1000 * 24 * 7);
        //       picker.$emit("pick", date);
        //     },
        //   },
        //   {
        //     text: "15天后",
        //     onClick(picker) {
        //       const date = new Date();
        //       date.setTime(date.getTime() + 3600 * 1000 * 24 * 15);
        //       picker.$emit("pick", date);
        //     },
        //   },
        //   {
        //     text: "一个月后",
        //     onClick(picker) {
        //       const date = new Date();
        //       date.setTime(date.getTime() + 3600 * 1000 * 24 * 30);
        //       picker.$emit("pick", date);
        //     },
        //   },
        //   {
        //     text: "三个月后",
        //     onClick(picker) {
        //       const date = new Date();
        //       date.setTime(date.getTime() + 3600 * 1000 * 24 * 90);
        //       picker.$emit("pick", date);
        //     },
        //   },
        //   {
        //     text: "六个月后",
        //     onClick(picker) {
        //       const date = new Date();
        //       date.setTime(date.getTime() + 3600 * 1000 * 24 * 180);
        //       picker.$emit("pick", date);
        //     },
        //   },
        //   {
        //     text: "一年后",
        //     onClick(picker) {
        //       const date = new Date();
        //       date.setTime(date.getTime() + 3600 * 1000 * 24 * 365);
        //       picker.$emit("pick", date);
        //     },
        //   },
        // ],
      },
      options: [
        {
@@ -1644,6 +1662,7 @@
      ];
    }
    this.getTaskservelist();
    this.getconfigKey();
  },
  mounted() {
    // 监听子组件的sipStatus属性变化
@@ -1683,7 +1702,29 @@
        return "scriptTopic-dev"; // 正常 - 默认样式
      }
    },
    getconfigKey() {
      getconfigKey("default.value.icon").then((res) => {
        if (res.msg) {
          if (
            this.getAssignArr(res.msg).includes(this.$store.state.user.name) ||
            this.$store.state.user.name == "admin"
          ) {
            this.defaultKey = true;
          } else {
            this.defaultKey = false;
          }
        }
      });
    },
    getAssignArr(rule) {
      let arr = [];
      let assiginArr = rule.split(",");
      for (let i = 0; i < assiginArr.length; i++) {
        arr[i] = assiginArr[i];
      }
      arr.sort(this.compare);
      return arr;
    },
    // 获取选项样式类
    getOptionClass(items) {
      if (items.isabnormal == 1) {
@@ -1992,29 +2033,29 @@
            this.Torouter();
            return;
          }
          this.$modal
            .confirm(
              '任务保存成功是否针对患者:"' +
                this.userform.name +
                '"再次随访?',
              "确认",
              {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                showCancelButton: true,
                dangerouslyUseHTMLString: true,
                confirmButtonClass: "custom-confirm-button", // 自定义确认按钮的类名
                cancelButtonClass: "custom-cancel-button", // 自定义取消按钮的类名
              }
            )
            .then(() => {
              document.querySelector("#app").scrollTo(0, 0);
              this.formtidy();
              this.dialogFormVisible = true;
            })
            .catch(() => {
              this.Torouter();
            });
          // this.$modal
          //   .confirm(
          //     '任务保存成功是否针对患者:"' +
          //       this.userform.name +
          //       '"再次随访?',
          //     "确认",
          //     {
          //       confirmButtonText: "确定",
          //       cancelButtonText: "取消",
          //       showCancelButton: true,
          //       dangerouslyUseHTMLString: true,
          //       confirmButtonClass: "custom-confirm-button", // 自定义确认按钮的类名
          //       cancelButtonClass: "custom-cancel-button", // 自定义取消按钮的类名
          //     }
          //   )
          //   .then(() => {
          //     document.querySelector("#app").scrollTo(0, 0);
          //     this.formtidy();
          //     this.dialogFormVisible = true;
          //   })
          //   .catch(() => {
          //     this.Torouter();
          //   });
        }
      });
    },
@@ -2101,6 +2142,39 @@
    handleTemplateClear() {
      console.log("清除了模板选择");
    },
    handleConfirmReplace() {
      // 遍历所有题目(tableDatatop)
      this.tableDatatop.forEach((item) => {
        // 只处理未填报的题目(scriptResult 为空或空数组)
        if (
          !item.scriptResult ||
          (Array.isArray(item.scriptResult) && item.scriptResult.length === 0)
        ) {
          // 查找选项中 defaultValue 为 2 的选项
          const defaultOption = item.svyTaskTemplateTargetoptions?.find(
            (opt) => opt.defaultValue == 2
          );
          console.log(item);
          if (defaultOption) {
            // 根据题目类型赋值
            if (item.scriptType === "1") {
              // 单选题:直接赋值为 optioncontent 字符串
              item.scriptResult = defaultOption.optioncontent;
            } else if (item.scriptType === "2") {
              // 多选题:赋值为包含 optioncontent 的数组
              item.scriptResult = [defaultOption.optioncontent];
            } else if (item.scriptType === "4") {
              // 填空题:一般没有选项,但如果有则赋值
              item.scriptResult = defaultOption.optioncontent;
            }
            // 触发视图更新(因为 Vue 可能无法检测到深层嵌套对象的变化)
            this.$forceUpdate();
          }
        }
      });
    },
    // 使用示例
    isValidPhone(phone) {
@@ -2225,29 +2299,31 @@
      savequestiondetail(obj).then((res) => {
        if (res.code == 200) {
          this.$modal.msgSuccess("服务保存成功");
          this.$modal
            .confirm(
              '任务保存成功是否针对患者:"' +
                this.userform.name +
                '"再次随访?',
              "确认",
              {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                showCancelButton: true,
                dangerouslyUseHTMLString: true,
                confirmButtonClass: "custom-confirm-button", // 自定义确认按钮的类名
                cancelButtonClass: "custom-cancel-button", // 自定义取消按钮的类名
              }
            )
            .then(() => {
              document.querySelector("#app").scrollTo(0, 0);
              this.formtidy();
              this.dialogFormVisible = true;
            })
            .catch(() => {
              this.Torouter();
            });
          this.Torouter();
          //   this.$modal
          //     .confirm(
          //       '任务保存成功是否针对患者:"' +
          //         this.userform.name +
          //         '"再次随访?',
          //       "确认",
          //       {
          //         confirmButtonText: "确定",
          //         cancelButtonText: "取消",
          //         showCancelButton: true,
          //         dangerouslyUseHTMLString: true,
          //         confirmButtonClass: "custom-confirm-button", // 自定义确认按钮的类名
          //         cancelButtonClass: "custom-cancel-button", // 自定义取消按钮的类名
          //       }
          //     )
          //     .then(() => {
          //       document.querySelector("#app").scrollTo(0, 0);
          //       this.formtidy();
          //       this.dialogFormVisible = true;
          //     })
          //     .catch(() => {
          //       this.Torouter();
          //     });
        }
      });
    },
@@ -2295,7 +2371,7 @@
          console.log(targetDate, "目标日期");
          if (now < targetDate && this.form.sendstate == 2) {
            this.$confirm("当前服务未到发送时间请谨慎修改", "提示", {
            this.$confirm("当前服务未到随访时间请谨慎修改", "提示", {
              confirmButtonText: "确定",
              cancelButtonText: "取消",
              type: "warning",
@@ -2350,6 +2426,7 @@
          objson = res.rows[0].serviceSubtaskList[0];
          objson.suggest = son;
          objson.remark = this.form.remark;
          objson.sendstate = this.serviceStates;
          objson.taskSituation = this.form.taskSituation;
          Editsingletaskson(objson).then((res) => {
            if (res.code) {
@@ -2391,13 +2468,14 @@
      });
    },
    alterpatient(sendstate) {
      alterpatient(this.userform).then((res) => {
        if (res.code == 200) {
          this.$modal.msgSuccess("基础信息保存成功");
        } else {
          this.$modal.msgError("基础信息修改失败");
        }
      });
      this.Editsingletasksonyic(this.serviceStates)
      // alterpatient(this.userform).then((res) => {
      //   if (res.code == 200) {
      //     this.$modal.msgSuccess("基础信息保存成功");
      //   } else {
      //     this.$modal.msgError("基础信息修改失败");
      //   }
      // });
    },
    // 异常列渲染
    tableRowClassName({ row, rowIndex }) {
@@ -2789,14 +2867,38 @@
  //   console.log(11);
  // },
  beforeRouteLeave(to, from, next) {
    this.$refs.callButton.cleanupResources();
    if (this.$refs.CallCenterLs) {
      console.log(1);
  const callButton = this.$refs.callButton;
  // 如果存在呼叫组件且正在通话中
  if (callButton && callButton.isCalling) {
    this.$confirm('当前正在通话中,确定要离开此页面吗?', '提示', {
      confirmButtonText: '挂断并离开',
      cancelButtonText: '继续通话',
      type: 'warning'
    })
      .then(() => {
        // 用户确认离开,主动挂断并清理
        callButton.cleanupResources();
        if (this.$refs.CallCenterLs) {
          this.$refs.CallCenterLs.handleSeatLogout();
        }
        next();
      })
      .catch(() => {
        // 用户取消,阻止路由跳转
        next(false);
      });
  } else {
    // 未通话或呼叫组件不存在,正常清理
    if (callButton) {
      callButton.cleanupResources();
    }
    if (this.$refs.CallCenterLs) {
      this.$refs.CallCenterLs.handleSeatLogout();
    }
    next(); // 确保调用 nex
  },
    next();
  }
}
  // beforeRouteUpdate() {
  //   console.log(33);
  // },