WXL
2024-03-27 da407d5de7f1106d494cb8cb13317dded827ba39
src/views/repositoryai/templateku/configurat/index.vue
@@ -20,9 +20,7 @@
          </el-step>
          <el-step description="查看随访模版预览,可导出PDF">
            <template slot="title">
              <span style="cursor: pointer" @click="Editprogress = 3"
                >随访模版预览</span
              >
              <span style="cursor: pointer" @click="preview">随访模版预览</span>
            </template>
          </el-step>
        </el-steps>
@@ -307,7 +305,7 @@
          </el-form-item>
          <el-row :gutter="20">
            <el-col :span="8">
              <el-form-item label="随访前处理" prop="name">
              <el-form-item label="随访前处理(是否需要)" prop="name">
                <el-select
                  v-model="ruleForm.prefollowup"
                  size="medium"
@@ -325,7 +323,7 @@
                </el-select> </el-form-item
            ></el-col>
            <el-col :span="9">
              <el-form-item label="随访后处理" prop="region">
              <el-form-item label="随访后处理(是否需要)" prop="region">
                <el-select
                  v-model="ruleForm.postfollowup"
                  size="medium"
@@ -348,7 +346,7 @@
              <el-form-item label="静默时间(秒)" prop="name">
                <div style="width: 40%">
                  <el-input
                    v-model="ruleForm.name"
                    v-model="ruleForm.silencetime"
                  ></el-input></div></el-form-item
            ></el-col>
            <el-col :span="10">
@@ -359,11 +357,11 @@
            ></el-col>
          </el-row>
          <el-form-item>
            <el-button type="success" @click="nextstep('ruleForm')"
            <el-button type="success" plain @click="nextstep('ruleForm')"
              >下一步</el-button
            >
            <el-button type="info" @click="closeFm('ruleForm')">关闭</el-button>
            <el-button @click="Departmenttreatment('ruleForm')"
            <el-button type="success" @click="Departmenttreatment('ruleForm')"
              >保存随访模版基础信息</el-button
            >
          </el-form-item>
@@ -511,7 +509,7 @@
                    >
                  </div>
                </div>
                <div
                <!-- <div
                  class="topicxq"
                  v-for="item in topicobj.ivrLibaScriptTargetoptionList"
                >
@@ -570,7 +568,6 @@
                    >
                    </el-input>
                  </el-form-item>
                  <el-row :gutter="10">
                    <el-col :span="16">
                      <el-form-item label="语音文件">
@@ -591,11 +588,16 @@
                    >
                    <el-col :span="8">
                      <div style="text-align: right; padding-right: 10px">
                        <el-button type="danger" round>删除</el-button>
                        <el-button type="danger" @click="" round>删除</el-button>
                      </div>
                    </el-col>
                  </el-row>
                </div>
                </div> -->
                <Regular
                  :TargetoptionList="topicobj.ivrLibaScriptTargetoptionList"
                  @deloption="deloption"
                  :controlsc="false"
                />
                <!-- 无匹配类型 -->
                <div class="topicxq">
                  <el-row :gutter="10">
@@ -743,14 +745,14 @@
          </div>
        </div>
        <el-button type="success" @click="nextstep('ruleForm')"
          >下一步</el-button
        >
        <el-button type="primary" @click="laststep()">上一步</el-button>
        <el-button type="info" @click="closeFm('ruleForm')">关闭</el-button>
        <el-button @click="Departmenttreatment('ruleForm')"
        <el-button type="success" @click="Departmenttreatment('ruleForm')"
          >保存题目数据</el-button
        >
        <el-button type="primary" plain @click="laststep()">上一步</el-button>
        <el-button type="success" plain @click="preview('ruleForm')"
          >查看预览</el-button
        >
        <el-button type="info" @click="closeFm('ruleForm')">关闭</el-button>
      </div>
      <!-- 随访模版预览 -->
      <div v-if="Editprogress == 3">
@@ -758,39 +760,39 @@
        <el-divider></el-divider>
        <div class="preview-left">
          <!-- 单选 -->
          <div class="topic-dev" v-for="item in valssu" :key="item.aaa">
          <div class="topic-dev" v-for="(item,index) in valssu" :key="item.aaa">
            <div class="dev-text">
              {{ item.idd }}、[单选]<span>{{ item.wssd }}</span>
              {{ index+1 }}、[单选]<span>{{ item.questionText }}</span>
            </div>
            <div class="dev-xx">
              <el-radio-group v-model="radio">
                <el-radio
                  v-for="(items, index) in item.sdadd"
                  v-for="(items, index) in item.ivrLibaScriptTargetoptionList"
                  :key="index"
                  :label="index"
                  >{{ items }}</el-radio
                  >{{ items.targetvalue }}</el-radio
                >
              </el-radio-group>
            </div>
          </div>
          <!-- 多选 -->
          <div class="topic-dev" v-for="item in valssu" :key="item.aaa">
          <div class="topic-dev" v-for="(item,index) in valssu" :key="item.aaa">
            <div class="dev-text">
              {{ item.idd }}、[多选]<span>{{ item.wssd }}</span>
              {{ index+1 }}、[多选]<span>{{ item.questionText }}</span>
            </div>
            <div class="dev-xx">
              <el-checkbox-group v-model="radios">
                <el-checkbox
                  v-for="(items, index) in item.sdadd"
                  :key="index"
                  :label="index"
                  v-for="(items, indexs) in item.ivrLibaScriptTargetoptionList"
                  :key="indexs"
                  :label="indexs"
                >
                  {{ items }}
                  {{ items.targetvalue }}
                </el-checkbox>
              </el-checkbox-group>
            </div>
          </div>
          <!-- 填空 -->
          <!-- 填空
          <div class="topic-dev" v-for="item in valssu" :key="item.aaa">
            <div class="dev-text">
              {{ item.idd }}、[填空]<span>{{ item.wssd }}</span>
@@ -799,11 +801,11 @@
              <el-input placeholder="请输入答案" v-model="radioas" clearable>
              </el-input>
            </div>
          </div>
          </div> -->
        </div>
        <el-button type="info" @click="closeFm('ruleForm')">关闭</el-button>
        <el-button>导出为pdf</el-button>
        <el-button type="primary" @click="laststep()">上一步</el-button>
        <el-button type="warning">导出为pdf</el-button>
        <el-button type="primary" plain @click="laststep()">上一步</el-button>
      </div>
    </div>
    <!-- 添加题目弹窗 -->
@@ -884,6 +886,7 @@
import { listtag } from "@/api/system/label";
import store from "@/store";
import { listDept } from "@/api/system/dept";
import Regular from "@/components/Regular"; //正则组件
import {
  getFollowupclassify,
  delFollowupclassify,
@@ -896,12 +899,15 @@
  delFollowupinfo,
  Followupinfo,
  getFollowuplist,
  deltargetillness,
  getillnesslist,
  illnesslistget,
  getillness,
} from "@/api/AiCentre/index";
export default {
  name: "SpeechTemplates",
  components: { Regular },
  data() {
    return {
      Editprogress: 1, //编辑进度
@@ -958,6 +964,8 @@
        label: "indexAssortName",
      },
      tempDetpRelevanceslist: [],
      delScriptVOList: [],
      optionIndex: "",
      variablelist: [
        { variatename: "姓名", variate: "${name}", default: 1 },
        { variatename: "电话", variate: "${phone}", default: 1 },
@@ -980,6 +988,7 @@
          sdadd: ["sss", "ssccss", "ssaas", "ss"],
        },
      ],
      radio:'',
      addvalue: "添加题目",
      // 题目表格数据
      userList: [
@@ -1102,7 +1111,8 @@
    // 科室处理
    Departmenttreatment() {
      this.ruleForm.deptNames = JSON.stringify(this.tempDetpRelevanceslist);
      console.log(this.tempDetpRelevanceslist);
      this.ruleForm.ivrLibaTemplateScriptVOList =
        this.ruleForm.ivrLibaTemplateScriptVOList.concat(this.delScriptVOList);
      const result = this.tempDetpRelevanceslist.map(
        (subArr) => subArr[subArr.length - 1]
      );
@@ -1160,23 +1170,6 @@
          });
        });
    },
    /** 查询题目列表 */
    getList() {
      //   this.loading = true;
      listUser().then((response) => {
        console.log(response);
        // this.userList = response.data;
        // this.total = response.total;
        // this.loading = false;
        console.log(this.userList);
      });
      //   const { rows } = await listUser();
      //   console.log(rows);
      //   this.list = rows;
    },
    // 修改题目信息
    Submittopicobj() {},
    // 控制文件
    handleChange(file, fileList) {
@@ -1258,6 +1251,7 @@
      this.getaddtopiclist();
    },
    getaddtopiclist() {
      console.log(11);
      this.drawer = true;
      getverbaltricklist(this.queryParams).then((res) => {
        this.loading = false;
@@ -1269,31 +1263,39 @@
    addtopic(row) {
      console.log(row);
      getverbaltrick({ id: row.id }).then((res) => {
        console.log(res);
        console.log(res, "详情");
        res.data.isoperation = 1;
        res.data.pid = this.ruleForm.id;
        res.data.ivrLibaScriptTargetoptionList.forEach((item) => {
          item.isoperation = 1;
        });
        this.ruleForm.ivrLibaTemplateScriptVOList.push(res.data);
      });
      row.isoperation = 1;
      this.ruleForm.ivrLibaTemplateScriptVOList.push(row);
    },
    handleDelete(row) {
      let index = this.ruleForm.ivrLibaTemplateScriptVOList.indexOf(row);
      this.ruleForm.ivrLibaTemplateScriptVOList.splice(
        this.ruleForm.ivrLibaTemplateScriptVOList.indexOf(row),
        1
      );
      row.isoperation = 3;
      this.delScriptVOList.push(row);
    },
    handleUpdate(row) {
      console.log(row.id);
      getverbaltrick({ id: row.id }).then((res) => {
        this.topicobj = res.data;
        console.log(res.data);
      });
    },
    handleDelete(item) {
      const index = this.ruleForm.ivrLibaTemplateScriptVOList.indexOf(item);
      if (index !== -1) {
        this.ruleForm.ivrLibaTemplateScriptVOList.splice(index, 1); // 从索引位置删除一个元素
        this.sortFn();
      console.log(row);
      this.optionIndex = this.ruleForm.ivrLibaTemplateScriptVOList.indexOf(row);
      if (row.ivrLibaScriptTargetoptionList.length) {
        console.log(11);
        this.topicobj = row;
      } else {
        console.log("未找到该对象");
        getverbaltrick({ id: row.id }).then((res) => {
          if (res.code==200) {
            this.topicobj = res.data;
            console.log(res.data, "topicobj");
          }else{
            console.log('没找到');
          }
        });
      }
    },
    syioption(row) {
@@ -1323,15 +1325,19 @@
    sortFn() {
      this.ruleForm.ivrLibaTemplateScriptVOList =
        this.ruleForm.ivrLibaTemplateScriptVOList.map((item, index) => {
          return {
            guid: index + 1,
            id: item.id,
            questiontitle: item.questiontitle,
            questionText: item.questionText,
          };
          return Object.assign({}, item, { guid: (index + 1).toString() });
        });
      console.log(this.ruleForm.ivrLibaTemplateScriptVOList);
    },
    // -----------------------话术选项
    deloption() {},
    // 修改题目信息
    Submittopicobj() {
      this.ruleForm.ivrLibaTemplateScriptVOList[this.optionIndex] =
        this.topicobj;
      this.$modal.msgSuccess("暂存选项成功");
    },
    // ---------------------
    resetForm(formName) {
      this.$refs[formName].resetFields();
@@ -1378,18 +1384,11 @@
      this.inputVisibleillness = false;
      this.inputValueillness = "";
    },
    // 保存
    confirmillness() {
      this.illnesslist.forEach((item, index) => {
        if (!item.id) {
          addtargetillness(item).then((res) => {});
        }
      });
      if (this.illnesslistapi.length) {
        deltargetillness(this.illnesslistapi.join(",")).then((res) => {});
      }
      this.illnessVisible = false;
      this.$modal.msgSuccess("编辑成功");
    // 预览---------------
    preview() {
      console.log(this.ruleForm);
      this.valssu = this.ruleForm.ivrLibaTemplateScriptVOList
      this.Editprogress = 3;
    },
  },
};