WXL (wul)
20 小时以前 f5943df47c998de86d74ca3b49bf8be747bbe7a3
src/views/followvisit/record/detailpage/index.vue
@@ -27,6 +27,23 @@
                前往CDSS查询
              </el-link>
            </div>
            <div class="merge-controls" v-if="Whetherall">
              <el-button
                type="primary"
                @click="toggleMergeMode"
                :disabled="selectedServices.length < 2"
              >
                {{ isMergeMode ? "取消合并" : "合并编辑问卷" }}
              </el-button>
              <el-button
                v-if="isMergeMode"
                type="success"
                @click="openMergeDialog"
                :disabled="selectedServices.length < 2"
              >
                开始合并 (已选 {{ selectedServices.length }} 个服务)
              </el-button>
            </div>
          </div>
          <!-- <el-button type="success">随访后短信</el-button> -->
        </div>
@@ -36,7 +53,14 @@
          :data="logsheetlist"
          :row-class-name="tableRowClassName"
          style="width: 100%"
          @selection-change="handleSelectionChange"
        >
          <el-table-column
            type="selection"
            width="55"
            :selectable="checkSelectable"
            v-if="Whetherall"
          ></el-table-column>
          <el-table-column
            prop="sendname"
            align="center"
@@ -213,7 +237,22 @@
        </el-table>
      </div>
    </div>
    <!-- 添加合并编辑对话框 -->
    <el-dialog
      title="合并编辑问卷"
      :visible.sync="mergeDialogVisible"
      width="80%"
      top="5vh"
      v-dialogDrag
    >
      <MergeAndModify
        v-if="mergeDialogVisible"
        :selected-services="selectedServices"
        :patid="patid"
        @save="handleMergeSave"
        @cancel="mergeDialogVisible = false"
      />
    </el-dialog>
    <div class="action-container">
      <div class="call-action">
        <div class="call-container">
@@ -278,7 +317,7 @@
                          </el-radio-group>
                        </div>
                        <div
                          v-if="item.showAppendInput"
                          v-if="item.showAppendInput || item.answerps"
                          class="append-input-container"
                        >
                          <el-input
@@ -509,7 +548,7 @@
                    >保存基础信息</el-button
                  >
                </div>
                <div>
                <!-- <div>
                  <el-button
                    type="primary"
                    round
@@ -517,7 +556,7 @@
                    @click="sendAgain()"
                    >再次随访</el-button
                  >
                </div>
                </div> -->
              </div>
              <el-row>
                <el-col :span="14"
@@ -843,9 +882,11 @@
  listcontactinformation,
} from "@/api/patient/homepage";
import CallButton from "@/components/CallButton";
import MergeAndModify from "./MergeAndModify.vue";
export default {
  components: {
    CallButton,
    MergeAndModify,
  },
  dicts: ["sys_normal_disable", "sys_user_sex", "sys_yujing", "sys_suggest"],
@@ -882,6 +923,9 @@
      tableDatatop: [], //题目表
      voiceDatatop: [], //题目表
      dynamicTags: [],
      isMergeMode: false,
      mergeDialogVisible: false,
      selectedServices: [], // 选中的服务列表
      zcrules: {
        resource: [
          { required: true, message: "请选择随访方式", trigger: "change" },
@@ -1263,55 +1307,56 @@
          });
          this.Editsingletasksonyic(6);
          this.$modal
            .confirm(
              '任务保存成功是否针对患者:"' +
                this.logsheetlist[0].sendname +
                '"再次随访?',
              "确认",
              {
                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(() => {
              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.$modal
          //   .confirm(
          //     '任务保存成功是否针对患者:"' +
          //       this.logsheetlist[0].sendname +
          //       '"再次随访?',
          //     "确认",
          //     {
          //       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(() => {
          //     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",
          //         });
          //       }
          //     }
          //   });
        })
        .catch((error) => {
          // 如果有任何一个异步操作失败,会进入这里
          console.error("发生错误:", error);
        });
    },
    // 电话============================
    // 验证电话号码格式并返回错误信息
    validatePhoneNumber(phone) {
      if (!phone) {
@@ -1343,7 +1388,6 @@
        };
      }
    },
    // 使用示例
    isValidPhone(phone) {
      return this.validatePhoneNumber(phone).isValid;
@@ -1367,7 +1411,6 @@
        });
      });
    },
    // 处理通话状态变化
    handleCallStatusChange(status) {
      console.log(status, "status");
@@ -1389,7 +1432,6 @@
        this.$message.error(`呼叫失败: ${status.text}`);
      }
    },
    // 结束当前通话
    endCurrentCall() {
      if (!this.currentCall) return;
@@ -1490,9 +1532,13 @@
        subId: id,
      }).then((res) => {
        if (res.code == 200) {
          console.log(11);
          this.form = res.rows[0].serviceSubtaskList.find(
            (item) => item.id == this.id
          );
          console.log(this.form);
          console.log(this.form.serviceType, "serviceType");
          this.logsheetlist = res.rows[0].serviceSubtaskList;
@@ -1597,17 +1643,17 @@
    },
    aahandleOptionChange(a, b, c) {
      const result = c.find((item) => item.optioncontent == a);
      if (result.nextQuestion == 0) {
        this.tableDatatop = this.tableDatatop.reduce((acc, item, i) => {
          acc.push(i > b ? { ...item, astrict: 1 } : item);
          return acc;
        }, []);
      } else {
        this.tableDatatop = this.tableDatatop.reduce((acc, item, i) => {
          acc.push(i > b ? { ...item, astrict: 0 } : item);
          return acc;
        }, []);
      }
      // if (result.nextQuestion == 0) {
      //   this.tableDatatop = this.tableDatatop.reduce((acc, item, i) => {
      //     acc.push(i > b ? { ...item, astrict: 1 } : item);
      //     return acc;
      //   }, []);
      // } else {
      //   this.tableDatatop = this.tableDatatop.reduce((acc, item, i) => {
      //     acc.push(i > b ? { ...item, astrict: 0 } : item);
      //     return acc;
      //   }, []);
      // }
      if (this.Voicetype) {
        var obj = this.tableDatatop[b].ivrTaskScriptTargetoptionList.find(
          (item) => item.optioncontent == a
@@ -1626,6 +1672,11 @@
    },
    // 在methods部分,修改handleOptionChange方法:
    handleOptionChange(selectedOption, questionIndex, options, a) {
      // 判断是否语音
      if (this.Voicetype) {
        this.aahandleOptionChange(selectedOption, questionIndex, options);
        return;
      }
      if (document.activeElement) {
        document.activeElement.blur();
      }
@@ -1642,7 +1693,7 @@
      this.tableDatatop[questionIndex].showAppendInput =
        selectedOptionObj.appendflag == 1;
        console.log(this.tableDatatop);
      console.log(this.tableDatatop);
      // if (!this.tableDatatop[questionIndex].showAppendInput) {
      //   this.tableDatatop[questionIndex].answerps = ""; // 清除附加信息
@@ -1793,6 +1844,60 @@
      return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
    },
    updateScore(a, b, c) {},
    // 合并修改相关=============================
    toggleMergeMode() {
      this.isMergeMode = !this.isMergeMode;
      if (!this.isMergeMode) {
        this.selectedServices = [];
      }
    },
    handleSelectionChange(selection) {
      this.selectedServices = selection
        .filter(
          (item) => !item.preachformson || !item.preachformson.includes("3")
        )
        .map((item) => ({
          id: item.id,
          taskid: item.taskid,
          taskName: item.taskName,
          sendname: item.sendname,
        }));
    },
    checkSelectable(row, index) {
      // 当 sendstate 为 6 时不可选
      return row.sendstate !== 6;
    },
    openMergeDialog() {
      if (this.selectedServices.length < 2) {
        this.$message.warning("请至少选择2个问卷服务进行合并");
        return;
      }
      this.mergeDialogVisible = true;
    },
    handleMergeSave(mergedData) {
      // 处理合并保存逻辑
      this.mergeDialogVisible = false;
      this.isMergeMode = false;
      this.selectedServices = [];
      // 显示保存结果
      if (mergedData.successCount == mergedData.totalCount) {
        this.$message.success(`成功保存 ${mergedData.successCount} 个问卷`);
      } else if (mergedData.successCount > 0) {
        this.$message.warning(
          `成功保存 ${mergedData.successCount} 个问卷,失败 ${
            mergedData.totalCount - mergedData.successCount
          } 个`
        );
      } else {
        this.$message.error("所有问卷保存失败");
      }
      // 刷新数据
      this.getTaskservelist();
    },
  },
};
</script>
@@ -1852,7 +1957,11 @@
    margin-top: 20px;
  }
}
.merge-controls {
  background: #f5f7fa;
  border-radius: 4px;
  margin-left: 20px;
}
.Followuserinfo {
  margin: 10px 10px 0 10px;
  align-items: center;