WXL (wul)
2026-06-15 741805d8daa2d2baa0b6b75bc1724488baf9c6bc
src/views/followvisit/record/detailpage/index.vue
@@ -145,6 +145,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 +167,7 @@
              <span>{{ formatTime(scope.row.endtime) }}</span>
            </template></el-table-column
          >
          <el-table-column
            label="责任护士"
            width="120"
@@ -264,8 +277,11 @@
      <!-- 随访内容 -->
      <div class="call-action">
        <div class="call-container">
          <template-selector
          <div
            style="display: flex"
            v-if="orgname == '南华大学附属第一医院' && !Voicetype"
          >
            <template-selector
            v-model="form.templateid"
            :templateName="form.templatename"
            :service-type="form.serviceType"
@@ -273,6 +289,22 @@
            @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>
@@ -1187,6 +1219,7 @@
  updateTemplate,
  query360PatInfonh,
  sendMsg,
  getconfigKey,
} from "@/api/AiCentre/index";
import {
  messagelistpatient,
@@ -1290,6 +1323,7 @@
    return {
      visitAgain: 1,
      userid: "",
      defaultKey: false, //是否可默认填报
      currentPhoneNumber: "",
      callType: "", // 用于区分是哪个电话
      isSipRegistering: true, // SIP注册状态
@@ -1472,56 +1506,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 +1628,7 @@
      ];
    }
    this.getTaskservelist();
    this.getconfigKey();
  },
  mounted() {
    // 监听子组件的sipStatus属性变化
@@ -1683,7 +1668,30 @@
        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) {
@@ -2102,6 +2110,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) {
      return this.validatePhoneNumber(phone).isValid;