WXL
2024-02-04 cf9259c2ebee0e82c32864a1ee91d96c403b9099
src/views/repositoryai/templateku/configurat/index.vue
@@ -2,14 +2,29 @@
  <div class="Questionnairemanagement">
    <!-- 左侧栏 -->
    <div class="sidecolumn">
      <div style="height: 400px">
        <el-steps direction="vertical" :active="Editprogress">
          <el-step title="基础信息"></el-step>
          <el-step title="随访模版题目"></el-step>
          <el-step
            title="随访模版预览"
            description="查看随访模版预览,可导出PDF"
          ></el-step>
      <div>
        <el-steps finish-status="success" :active="Editprogress" simple>
          <el-step>
            <template slot="title">
              <span style="cursor: pointer" @click="Editprogress = 1"
                >基础信息</span
              >
            </template>
          </el-step>
          <el-step>
            <template slot="title">
              <span style="cursor: pointer" @click="Editprogress = 2"
                >随访模版题目</span
              >
            </template>
          </el-step>
          <el-step description="查看随访模版预览,可导出PDF">
            <template slot="title">
              <span style="cursor: pointer" @click="Editprogress = 3"
                >随访模版预览</span
              >
            </template>
          </el-step>
        </el-steps>
      </div>
    </div>
@@ -45,14 +60,19 @@
                  filterable
                  placeholder="请选择分类"
                >
                  <el-option
                    class="ruleFormaa"
                    v-for="item in indexAssortlist"
                    :key="item.id"
                    :label="item.indexAssortName"
                    :value="item.id"
                  <el-option-group
                    v-for="group in indexAssortlist"
                    :key="group.id"
                    :label="group.indexAssortName"
                  >
                  </el-option>
                    <el-option
                      v-for="item in group.ivrLibaTemplateAssortList"
                      :key="item.id"
                      :label="item.indexAssortName"
                      :value="item.id"
                    >
                    </el-option>
                  </el-option-group>
                </el-select>
              </el-form-item>
            </el-col>
@@ -287,7 +307,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"
@@ -305,7 +325,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"
@@ -328,7 +348,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">
@@ -372,8 +392,8 @@
                <el-table-column
                  label="编号"
                  align="center"
                  key="id"
                  prop="id"
                  key="guid"
                  prop="guid"
                />
                <el-table-column
                  label="标题"
@@ -444,7 +464,8 @@
                <el-form-item label="题目标题">
                  <el-input
                    v-model="topicobj.questiontitle"
                    placeholder="请输入标题"
                    placeholder="请从左侧列表选择"
                    :disabled="true"
                  ></el-input>
                </el-form-item>
                <el-row :gutter="10">
@@ -490,7 +511,7 @@
                    >
                  </div>
                </div>
                <div
                <!-- <div
                  class="topicxq"
                  v-for="item in topicobj.ivrLibaScriptTargetoptionList"
                >
@@ -549,7 +570,6 @@
                    >
                    </el-input>
                  </el-form-item>
                  <el-row :gutter="10">
                    <el-col :span="16">
                      <el-form-item label="语音文件">
@@ -570,9 +590,156 @@
                    >
                    <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> -->
                <Regular
                  :TargetoptionList="topicobj.ivrLibaScriptTargetoptionList"
                  @deloption="deloption"
                  :controlsc="false"
                />
                <!-- 无匹配类型 -->
                <div class="topicxq">
                  <el-row :gutter="10">
                    <el-col :span="12"
                      ><el-form-item label="无匹配话术">
                        <el-input
                          type="text"
                          placeholder="请输入"
                          v-model="topicobj.nomatchtext"
                          show-word-limit
                        >
                        </el-input> </el-form-item
                    ></el-col>
                  </el-row>
                  <el-row :gutter="10">
                    <el-col :span="12"
                      ><el-form-item label="处理">
                        <el-input
                          type="text"
                          placeholder="(默认)无声"
                          v-model="topicobj.text"
                          maxlength="10"
                          show-word-limit
                        >
                        </el-input> </el-form-item
                    ></el-col>
                  </el-row>
                  <el-row :gutter="10">
                    <el-col :span="16">
                      <el-form-item label="语音文件">
                        <el-upload
                          class="upload-demo"
                          style="display: flex"
                          action="https://jsonplaceholder.typicode.com/posts/"
                          :on-change="handleChange"
                          :file-list="fileList"
                          :limit="1"
                          :on-exceed="handleExceed"
                        >
                          <el-button size="small" type="primary"
                            >点击上传</el-button
                          >
                        </el-upload>
                      </el-form-item></el-col
                    >
                  </el-row>
                </div>
                <div class="topicxq">
                  <el-row :gutter="10">
                    <el-col :span="12"
                      ><el-form-item label="听不清话术">
                        <el-input
                          type="text"
                          placeholder="请输入"
                          v-model="topicobj.noclearlytext"
                          show-word-limit
                        >
                        </el-input> </el-form-item
                    ></el-col>
                  </el-row>
                  <el-row :gutter="10">
                    <el-col :span="12"
                      ><el-form-item label="处理">
                        <el-input
                          type="text"
                          placeholder="(默认)无声"
                          v-model="topicobj.text"
                          maxlength="10"
                          show-word-limit
                        >
                        </el-input> </el-form-item
                    ></el-col>
                  </el-row>
                  <el-row :gutter="10">
                    <el-col :span="16">
                      <el-form-item label="语音文件">
                        <el-upload
                          class="upload-demo"
                          style="display: flex"
                          action="https://jsonplaceholder.typicode.com/posts/"
                          :on-change="handleChange"
                          :file-list="fileList"
                          :limit="1"
                          :on-exceed="handleExceed"
                        >
                          <el-button size="small" type="primary"
                            >点击上传</el-button
                          >
                        </el-upload>
                      </el-form-item></el-col
                    >
                  </el-row>
                </div>
                <div class="topicxq">
                  <el-row :gutter="10">
                    <el-col :span="12"
                      ><el-form-item label="静默话术">
                        <el-input
                          type="text"
                          placeholder="请输入"
                          v-model="topicobj.sliencetext"
                          show-word-limit
                        >
                        </el-input> </el-form-item
                    ></el-col>
                  </el-row>
                  <el-row :gutter="10">
                    <el-col :span="12"
                      ><el-form-item label="处理">
                        <el-input
                          type="text"
                          placeholder="(默认)无声"
                          v-model="topicobj.text"
                          maxlength="10"
                          show-word-limit
                        >
                        </el-input> </el-form-item
                    ></el-col>
                  </el-row>
                  <el-row :gutter="10">
                    <el-col :span="16">
                      <el-form-item label="语音文件">
                        <el-upload
                          class="upload-demo"
                          style="display: flex"
                          action="https://jsonplaceholder.typicode.com/posts/"
                          :on-change="handleChange"
                          :file-list="fileList"
                          :limit="1"
                          :on-exceed="handleExceed"
                        >
                          <el-button size="small" type="primary"
                            >点击上传</el-button
                          >
                        </el-upload>
                      </el-form-item></el-col
                    >
                  </el-row>
                </div>
              </el-form>
@@ -721,6 +888,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,
@@ -733,12 +901,15 @@
  delFollowupinfo,
  Followupinfo,
  getFollowuplist,
  deltargetillness,
  getillnesslist,
  illnesslistget,
  getillness,
} from "@/api/AiCentre/index";
export default {
  name: "SpeechTemplates",
  components: { Regular },
  data() {
    return {
      Editprogress: 1, //编辑进度
@@ -775,6 +946,7 @@
        { value: "1", label: "心外科" },
        { value: "2", label: "心内科" },
      ],
      standbylist: [],
      themelist: [],
      languagelist: [],
      courtyardlist: [],
@@ -794,6 +966,8 @@
        label: "indexAssortName",
      },
      tempDetpRelevanceslist: [],
      delScriptVOList: [],
      optionIndex:'',
      variablelist: [
        { variatename: "姓名", variate: "${name}", default: 1 },
        { variatename: "电话", variate: "${phone}", default: 1 },
@@ -922,9 +1096,6 @@
      //   提交
      compileFollowup(this.ruleForm).then((res) => {
        this.$modal.msgSuccess("编辑成功");
      });
      this.illnesslist.forEach((item, index) => {
        if (!item.id) {
          addtargetillness(item).then((res) => {});
@@ -933,11 +1104,16 @@
      if (this.illnesslistapi.length) {
        deltargetillness(this.illnesslistapi.join(",")).then((res) => {});
      }
      compileFollowup(this.ruleForm).then((res) => {
        this.$modal.msgSuccess("编辑成功");
        this.$router.go(-1);
      });
    },
    // 科室处理
    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]
      );
@@ -995,23 +1171,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) {
@@ -1102,53 +1261,77 @@
      });
    },
    addtopic(row) {
      row.isoperation = 1;
      this.ruleForm.ivrLibaTemplateScriptVOList.push(row);
      console.log(row);
      getverbaltrick({ id: row.id }).then((res) => {
        console.log(res, "详情");
        res.data.isoperation = 1;
        res.data.id = null;
        res.data.ivrLibaScriptTargetoptionList.forEach((item) => {
          item.isoperation = 1;
        });
        this.ruleForm.ivrLibaTemplateScriptVOList.push(res.data);
      });
    },
    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.userList.indexOf(item);
      if (index !== -1) {
        this.userList.splice(index, 1); // 从索引位置删除一个元素
        this.sortFn();
      console.log(row);
      this.optionIndex = this.ruleForm.ivrLibaTemplateScriptVOList.indexOf(row);
      if (row.ivrLibaScriptTargetoptionList.length) {
        this.topicobj = row;
      } else {
        console.log("未找到该对象");
        getverbaltrick({ id: row.id }).then((res) => {
          this.topicobj = res.data;
          console.log(res.data, "topicobj");
        });
      }
    },
    syioption(row) {
      const index = this.getIndexInArray(this.userList, row);
      const item = this.userList.splice(index, 1)[0]; // 移除指定索引处的元素,并保存到item变量中
      this.userList.splice(index - 1, 0, item); // 将item插入到索引位置的前一位
      const index = this.getIndexInArray(
        this.ruleForm.ivrLibaTemplateScriptVOList,
        row
      );
      const item = this.ruleForm.ivrLibaTemplateScriptVOList.splice(
        index,
        1
      )[0]; // 移除指定索引处的元素,并保存到item变量中
      this.ruleForm.ivrLibaTemplateScriptVOList.splice(index - 1, 0, item); // 将item插入到索引位置的前一位
      this.sortFn();
    },
    xiayioption(row) {
      const index = this.getIndexInArray(this.userList, row);
      const item = this.userList.splice(index, 1)[0]; // 移除指定索引处的元素,并保存到item变量中
      this.userList.splice(index + 1, 0, item); // 将item插入到索引位置的前一位
      const index = this.getIndexInArray(
        this.ruleForm.ivrLibaTemplateScriptVOList,
        row
      );
      const item = this.ruleForm.ivrLibaTemplateScriptVOList.splice(
        index,
        1
      )[0]; // 移除指定索引处的元素,并保存到item变量中
      this.ruleForm.ivrLibaTemplateScriptVOList.splice(index + 1, 0, item); // 将item插入到索引位置的前一位
      this.sortFn();
    },
    sortFn() {
      this.userList = this.userList.map((item, index) => {
        return {
          userid: index + 1,
          userName: item.userName,
          verbaltrick: item.verbaltrick,
        };
      });
      console.log(this.userList);
      this.ruleForm.ivrLibaTemplateScriptVOList =
        this.ruleForm.ivrLibaTemplateScriptVOList.map((item, index) => {
          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();
@@ -1195,33 +1378,15 @@
      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("编辑成功");
    },
  },
};
</script>
<style lang="scss" scoped>
.Questionnairemanagement {
  display: flex;
  // display: flex;
}
.sidecolumn {
  width: 250px;
  min-height: 100vh;
  text-align: center;
  //   display: flex;
  //   margin-top: 20px;
  margin: 20px;
  margin-bottom: 0;
  padding: 30px;
@@ -1233,9 +1398,8 @@
.leftvlue {
  //   display: flex;
  //   flex: 1;
  width: 80%;
  margin-top: 20px;
  //   margin: 20px;
  // width: 80%;
  margin: 20px;
  padding: 30px;
  background: #ffff;
  border: 1px solid #dcdfe6;
@@ -1319,8 +1483,10 @@
  .presentation-right {
    width: 55%;
    max-height: 688px;
    padding: 0 20px;
    margin: 0 20px;
    font-size: 18px;
    -webkit-box-shadow: 0 2px 4px 0 rgba(32, 32, 32, 0.12),
      0 0 6px 0 rgba(58, 57, 57, 0.04);
    overflow: auto;
    .headline {
      display: flex;