WXL
2024-11-26 007d3884ad259883d7a5db6714876e46525ae717
src/views/repositoryai/templateku/configurat/index.vue
@@ -101,7 +101,7 @@
            <el-col :span="12">
              <el-form-item label="可用状态" prop="region">
                <el-select
                  v-model="ruleForm.usestate"
                  v-model="ruleForm.isenable"
                  size="medium"
                  placeholder="请选择"
                >
@@ -316,6 +316,26 @@
                  >
                  </el-option>
                </el-select> </el-form-item
            ></el-col>
          </el-row>
          <el-row>
            <el-col :span="12"
              ><el-form-item label="开场白" prop="revisitBefore">
                <el-input
                  type="textarea"
                  :rows="3"
                  v-model="ruleForm.revisitBefore"
                  placeholder="请输入开场白"
                /> </el-form-item
            ></el-col>
            <el-col :span="12"
              ><el-form-item label="结束语" prop="revisitAfter">
                <el-input
                  type="textarea"
                  :rows="3"
                  v-model="ruleForm.revisitAfter"
                  placeholder="请输入结束语"
                /> </el-form-item
            ></el-col>
          </el-row>
@@ -547,8 +567,8 @@
                  v-if="topicobj.scriptType == 1"
                >
                  <el-radio-group v-model="topicobj.branchFlag">
                    <el-radio :label="1">是</el-radio>
                    <el-radio :label="0">否</el-radio>
                    <el-radio :label="'1'">是</el-radio>
                    <el-radio :label="'0'">否</el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item label="选中提示" v-if="topicobj.scriptType != 1">
@@ -969,6 +989,20 @@
                  :show-overflow-tooltip="true"
                />
                <el-table-column
                  label="问题类型"
                  align="center"
                  key="valueType"
                  prop="valueType"
                  width="120"
                >
                  <template slot-scope="scope">
                    <dict-tag
                      :options="valuetypes"
                      :value="scope.row.valueType"
                    />
                  </template>
                </el-table-column>
                <el-table-column
                  label="选项内容"
                  align="center"
                  key="targetoptions"
@@ -1081,16 +1115,19 @@
                        </el-select> </el-form-item
                    ></el-col> -->
                  </el-row>
                  <el-form-item label="选中提示" v-if="topicobj.scriptType != 1">
                  <el-input
                    style="width: 24vw"
                    type="textarea"
                    autosize
                    placeholder="请输入内容"
                    v-model="indexform.prompt"
                  <el-form-item
                    label="选中提示"
                    v-if="topicobj.scriptType != 1"
                  >
                  </el-input
                ></el-form-item>
                    <el-input
                      style="width: 24vw"
                      type="textarea"
                      autosize
                      placeholder="请输入内容"
                      v-model="indexform.prompt"
                    >
                    </el-input
                  ></el-form-item>
                  <el-row :gutter="10">
                    <el-col :span="18"
                      ><el-form-item label="语音文本">
@@ -1271,64 +1308,7 @@
                      </el-col>
                    </el-row>
                  </div>
                  <div class="topicxq">
                    <el-row :gutter="10">
                      <el-col :span="20"
                        ><el-form-item label="听不清话术">
                          <el-input
                            style="width: 400px"
                            type="textarea"
                            placeholder="请输入"
                            v-model="indexform.noClearlyText"
                            show-word-limit
                          >
                          </el-input> </el-form-item
                      ></el-col>
                    </el-row>
                    <el-row>
                      <el-col :span="6">
                        <el-form-item label="听不清语音" prop="verbaltrickyy">
                          <el-upload
                            class="upload-demo"
                            :action="uploadImgUrl"
                            :show-file-list="false"
                            :headers="headers"
                            :on-success="
                              (response, file) =>
                                handleChange(response, file, 4)
                            "
                            accept=".wav,.mp3"
                            :limit="1"
                          >
                            <el-button size="small" type="primary"
                              >点击上传</el-button
                            >
                          </el-upload>
                        </el-form-item>
                      </el-col>
                      <el-col :span="6">
                        <span
                          style="font-size: 12px"
                          v-if="indexform.noclearlyvoice"
                          >{{
                            indexform.noclearlyvoice.substring(
                              indexform.noclearlyvoice.lastIndexOf("/") + 1
                            )
                          }}</span
                        >
                      </el-col>
                      <el-col :span="6">
                        <mini-audio
                          :audio-source="
                            indexform.noclearlyvoice
                              ? indexform.noclearlyvoice
                              : 'https://example.com/example.mp3'
                          "
                        ></mini-audio>
                      </el-col>
                    </el-row>
                  </div>
                  <div class="topicxq">
                    <el-row :gutter="10">
                      <el-col :span="20"
@@ -1381,6 +1361,64 @@
                          :audio-source="
                            indexform.sliencevoice
                              ? indexform.sliencevoice
                              : 'https://example.com/example.mp3'
                          "
                        ></mini-audio>
                      </el-col>
                    </el-row>
                  </div>
                  <div class="topicxq">
                    <el-row :gutter="10">
                      <el-col :span="20"
                        ><el-form-item label="听不清话术">
                          <el-input
                            style="width: 400px"
                            type="textarea"
                            placeholder="请输入"
                            v-model="indexform.noClearlyText"
                            show-word-limit
                          >
                          </el-input> </el-form-item
                      ></el-col>
                    </el-row>
                    <el-row>
                      <el-col :span="6">
                        <el-form-item label="听不清语音" prop="verbaltrickyy">
                          <el-upload
                            class="upload-demo"
                            :action="uploadImgUrl"
                            :show-file-list="false"
                            :headers="headers"
                            :on-success="
                              (response, file) =>
                                handleChange(response, file, 4)
                            "
                            accept=".wav,.mp3"
                            :limit="1"
                          >
                            <el-button size="small" type="primary"
                              >点击上传</el-button
                            >
                          </el-upload>
                        </el-form-item>
                      </el-col>
                      <el-col :span="6">
                        <span
                          style="font-size: 12px"
                          v-if="indexform.noclearlyvoice"
                          >{{
                            indexform.noclearlyvoice.substring(
                              indexform.noclearlyvoice.lastIndexOf("/") + 1
                            )
                          }}</span
                        >
                      </el-col>
                      <el-col :span="6">
                        <mini-audio
                          :audio-source="
                            indexform.noclearlyvoice
                              ? indexform.noclearlyvoice
                              : 'https://example.com/example.mp3'
                          "
                        ></mini-audio>
@@ -1462,14 +1500,18 @@
      inputValue: "",
      inputValueillness: "",
      topicobj: {
        noMatchText:'抱歉,我没有听懂,您能再说一遍吗?',
        noClearlyText:'抱歉,我没有听清您说的话,您可以再说一次吗?',
        slienceText:'抱歉,我没有听到您说的话,您可以再说一次吗?',
        noMatchText: "抱歉,我没有听懂,您能再说一遍吗?",
        noClearlyText: "抱歉,我没有听清您说的话,您可以再说一次吗?",
        slienceText: "抱歉,我没有听到您说的话,您可以再说一次吗?",
      },
      total: 1,
      id: "",
      ruleForm: {
        templateName: "",
        revisitBefore:
          "亲爱的患者/家属,您好!我们是浙中医大二院的医护人员,为了更好地了解您的康复情况,请您抽一点宝贵时间,完成这份随访。",
        revisitAfter:
          "请您注意休息和营养,生活上要劳逸结合,适当锻炼,戒烟限酒,保持心情舒畅,定期复诊。那本次回访就到这里,祝您身体健康!",
        ivrLibaTemplateTagList: [],
        ivrLibaTemplateScriptVOList: [],
        tempDetpRelevances: [],
@@ -1505,6 +1547,7 @@
      usable: [],
      required: [],
      valuetype: [],
      valuetypes: [],
      askvaluetype: [],
      mode: [],
      inputVisible: false,
@@ -1586,6 +1629,7 @@
    this.usable = store.getters.usable;
    this.required = store.getters.required;
    this.valuetype = store.getters.valuetype;
    this.valuetypes = store.getters.valuetypelb;
    this.askvaluetype = store.getters.askvaluetype;
    this.languagelist = store.getters.languagelist;
    this.courtyardlist = store.getters.courtyardlist;
@@ -1657,9 +1701,11 @@
          if (res.code == 200) {
            console.log(2211);
            this.ruleForm = res.data;
            this.tempDetpRelevanceslist = JSON.parse(this.ruleForm.deptNames);
            if (this.ruleForm.deptNames)
              // this.tempDetpRelevanceslist = JSON.parse(this.ruleForm.deptNames);
            this.ruleForm.suitway = this.ruleForm.suitway.split(",");
            this.ruleForm.campus = this.ruleForm.campus.split(",");
            if (this.ruleForm.campus)
              this.ruleForm.campus = this.ruleForm.campus.split(",");
            this.ruleForm.submoduleID = this.ruleForm.submoduleID.split(",");
            this.ruleForm.submoduleID = this.ruleForm.submoduleID.map((res) => {
              return Number(res);
@@ -1782,20 +1828,52 @@
      this.delScriptVOList.forEach((item) => {
        this.ruleForm.ivrLibaTemplateScriptVOList.push(item);
      });
      compileFollowup(this.ruleForm).then((res) => {
        if (res.code == 200) {
          this.$modal.msgSuccess("编辑成功");
          this.$modal.closeLoading();
          this.confirmillness(res.data);
          window.location.reload();
          // const obj = { path: "/knowledge/tpuconfigurat/?id=" + this.id };
          // this.$tab.closeOpenPage(obj);
        } else {
          this.$modal.msgError("保存失败");
          this.$modal.closeLoading();
        }
      });
      // compileFollowup(this.ruleForm).then((res) => {
      //   if (res.code == 200) {
      //     this.$modal.msgSuccess("编辑成功");
      //     this.$modal.closeLoading();
      //     this.confirmillness(res.data);
      //     // window.location.reload();
      //     // const obj = { path: "/knowledge/tpuconfigurat/?id=" + this.id };
      //     // this.$tab.closeOpenPage(obj);
      //   } else {
      //     this.$modal.msgError("保存失败");
      //     this.$modal.closeLoading();
      //   }
      // });
      if (this.id) {
        this.ruleForm.isoperation = 2;
        this.ruleForm.tempDetpRelevances = [];
        compileFollowup(this.ruleForm).then((res) => {
          if (res.code == 200) {
            this.$modal.msgSuccess("修改成功");
            this.confirmillness();
            this.putbelongDepts(this.id);
            // this.$modal.closeLoading();
            // this.$router.go(-1);
            window.location.reload();
          } else {
            this.$modal.closeLoading();
          }
        });
      } else {
        this.ruleForm.isoperation = 1;
        this.ruleForm.version = this.ruleForm.version
          ? this.ruleForm.version
          : "1.0";
        this.ruleForm.tempDetpRelevances = [];
        compileFollowup(this.ruleForm).then((res) => {
          if (res.code == 200) {
            this.$modal.msgSuccess("新增成功");
            this.confirmillness(res.data);
            this.putbelongDepts(res.data);
            this.$modal.closeLoading();
            this.$router.go(-1);
          } else {
            this.$modal.closeLoading();
          }
        });
      }
    },
    confirmillness(guid) {
      this.illnesslist.forEach((item, index) => {
@@ -1827,7 +1905,7 @@
            longTemp: this.ruleForm.longTemp,
            deptCode: item,
            tempid: this.id,
            type: 1,
            type: 2,
          });
        }
      });
@@ -1839,7 +1917,8 @@
            longTemp: this.ruleForm.longTemp,
            deptCode: item,
            tempid: this.id,
            type: 1,
            type: 2,
            // 1 : 问卷模板库id、11:问卷任务模板库id;2 :语音问卷库id、21:语音任务模板库id,3 : 宣教模板库id,33:宣教任务模板库id
          });
        }
      });
@@ -1850,6 +1929,13 @@
    },
    // 保存科室/病区
    putbelongDepts(id) {
      this.tempDetpRelevanceslistform.forEach((item) => {
        if (!item.tempid) item.tempid = id;
      });
      this.tempbelongWardsform.forEach((item) => {
        if (!item.tempid) item.tempid = id;
      });
      if (this.tempDetpRelevanceslistform.length > 0) {
        depthospgetson(this.tempDetpRelevanceslistform).then((res) => {
          if (res.code == 200) {
@@ -2094,6 +2180,8 @@
    },
    // 问题排序
    sortFn() {
      console.log(this.ruleForm.ivrLibaTemplateScriptVOList);
      this.ruleForm.ivrLibaTemplateScriptVOList.forEach((item, index) => {
        item.sort = Number(index) + 1;
        console.log(this.ruleForm.ivrLibaTemplateScriptVOList.length);
@@ -2104,7 +2192,7 @@
        } else {
          item.nextScriptno = item.sort + 1;
        }
        if (item.ivrLibaScriptTargetoptionList) {
        if (item.ivrLibaScriptTargetoptionList&&!item.branchFlag) {
          item.ivrLibaScriptTargetoptionList.forEach((items) => {
            items.nextQuestion = Number(item.sort) + 1;
          });
@@ -2115,7 +2203,22 @@
      console.log(this.ruleForm.ivrLibaTemplateScriptVOList);
    },
    // -----------------------话术选项
    deloption() {},
    deloption(item) {
      const index = this.topicobj.ivrLibaScriptTargetoptionList.indexOf(item);
      if (index != -1) {
        if (item.id) {
          console.log(item, "chunz");
          item.isoperation = 3;
          console.log(this.topicobj.ivrLibaScriptTargetoptionList);
          this.$forceUpdate();
        } else {
          this.topicobj.ivrLibaScriptTargetoptionList.splice(index, 1); // 从索引位置删除一个元素
        }
        // this.sortFn();
      } else {
        console.log("未找到该对象");
      }
    },
    // 修改题目信息
    Submittopicobj() {
      this.$modal
@@ -2135,7 +2238,7 @@
          this.drawer = false;
          this.sortFn();
          this.$modal.msgSuccess("题目新增成功,保存模板失效");
          this.$modal.msgSuccess("题目新增成功,保存模板生效");
        });
    },
@@ -2181,7 +2284,11 @@
        .then((res) => {
          this.$router.push({
            path: "/knowledge/templateku/configurat/measurement",
            query: { id: this.id, name: this.ruleForm.templateName,timeout:this.ruleForm.silencetime },
            query: {
              id: this.id,
              name: this.ruleForm.templateName,
              timeout: this.ruleForm.silencetime,
            },
          });
        })
        .catch(() => {});