WXL
2024-07-31 3d50e2c6d8cd86ee10b4353ad6365c59f588dbc4
src/views/repositoryai/verbaltrick/particulars/index.vue
@@ -1,182 +1,1282 @@
<template>
  <div>
    <div class="basic">基本信息</div>
    <div class="top-text">
      <div class="substance">
        <p>话术主旨:<span>有无复查</span></p>
        <p>问题文本:<span>有无复查</span></p>
        <p>指标种类:<span>有无复查</span></p>
        <p>
          指标选项:<span>{{ optionvalue }}</span>
        </p>
  <div class="Questionnairemanagement">
    <!-- 左侧栏 -->
    <div class="sidecolumn">
      <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="nextstep"
                >问题指标编辑</span
              >
            </template>
          </el-step>
        </el-steps>
      </div>
    </div>
    <div class="headline">
      <div class="basics">问题配置</div>
      <div class="headbottom">
        <el-button
          type="primary"
          icon="el-icon-circle-plus-outline"
          @click="addzbiao"
          >添加指标</el-button
    <!-- 右侧数据 -->
    <div class="leftvlue">
      <!-- 基本信息 -->
      <div v-if="Editprogress == 1">
        <div class="leftvlue-jbxx">
          基本信息
          <span style="margin-left: 30px"
            ><el-button type="success" round @click="gettargetInfo"
              >+选择指标</el-button
            ></span
          >
        </div>
        <el-divider></el-divider>
        <el-form
          ref="form"
          :model="indexform"
          :rules="rules"
          label-width="100px"
        >
        <el-button type="primary" icon="el-icon-s-claim">保存</el-button>
        <el-button type="primary" icon="el-icon-document"
          >更新指标规则至模版</el-button
          <el-row>
            <el-col :span="12">
              <el-form-item label="语言" prop="deptId">
                <el-select
                  v-model="indexform.language"
                  placeholder="请选择语言"
                >
                  <el-option
                    v-for="index in languagelist"
                    :key="index.value"
                    :label="index.label"
                    :value="index.value"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="可用状态" prop="status">
                <el-select
                  v-model="indexform.isAvailable"
                  placeholder="请选择状态"
                >
                  <el-option
                    v-for="item in usable"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col :span="12">
              <el-form-item label="问题分类" prop="status">
                <el-select
                  v-model="indexform.assortid"
                  filterable
                  placeholder="请选择分类"
                >
                  <el-option-group
                    v-for="group in questionclass"
                    :key="group.id"
                    :label="group.indexAssortName"
                  >
                    <el-option
                      v-for="item in group.ivrLibaScriptAssortList"
                      :key="item.id"
                      :label="item.indexAssortName"
                      :value="item.id"
                    >
                    </el-option>
                  </el-option-group>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="5">
              <el-form-item label="版本号" prop="version">
                <el-input
                  v-model="indexform.version"
                  placeholder="请输入"
                  maxlength="80"
                />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col :span="20">
              <el-form-item label="问题主旨" prop="scriptTopic">
                <el-input
                  v-model="indexform.scriptTopic"
                  placeholder="请输入问题主旨"
                  maxlength="80"
                />
              </el-form-item>
            </el-col>
          </el-row>
          <el-form-item label="标签" prop="desc">
            <div class="xinz-inf">
              <el-tag
                :key="tag.tagname"
                type="success"
                v-for="tag in dynamicTags"
                closable
                :disable-transitions="false"
                @close="handleClosetag(tag)"
              >
                {{ tag.tagname }}
              </el-tag>
              <el-select
                v-model="inputValue"
                v-if="inputVisible"
                @change="handleInputConfirm"
                filterable
                remote
                allow-create
                reserve-keyword
                default-first-option
                :remote-method="remoteMethodtag"
                :loading="loading"
                placeholder="请选择"
              >
                <el-option
                  v-for="item in optionstag"
                  :key="item.tagid"
                  :label="item.tagname"
                  :value="item.tagname"
                >
                </el-option>
              </el-select>
              <el-button
                v-else
                class="button-new-tag"
                size="small"
                @click="showInput"
                >+ 新增标签</el-button
              >
            </div>
          </el-form-item>
          <el-drawer
            title="变量编辑"
            :visible.sync="variabledeawer"
            direction="ttb"
            size="35%"
          >
            <el-form-item label="通知变量" prop="name">
              <div style="margin-bottom: 5px" v-for="item in variablelist">
                <el-row>
                  <el-col :span="5">
                    <el-input
                      v-model="item.variatename"
                      placeholder="请输入变量名"
                    ></el-input>
                  </el-col>
                  <el-col :span="8" :offset="1">
                    <el-input
                      v-model="item.variate"
                      placeholder="请输入变量内容"
                    ></el-input>
                  </el-col>
                  <el-col :span="8" :offset="1">
                    <el-button
                      type="success"
                      icon="el-icon-plus"
                      circle
                      @click="addvariable(item)"
                    ></el-button>
                    <el-button
                      v-if="!item.default"
                      type="danger"
                      icon="el-icon-delete"
                      circle
                      @click="delvariable(item)"
                    ></el-button>
                  </el-col>
                </el-row>
              </div>
            </el-form-item>
          </el-drawer>
          <el-row>
            <el-col :span="6">
              <el-form-item label="仅限院区" prop="region">
                <el-select
                  v-model="indexform.campus"
                  size="medium"
                  filterable
                  placeholder="请选择"
                >
                  <el-option
                    class="indexformaa"
                    v-for="item in courtyardlist"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="适用方式" prop="status">
                <el-select
                  disabled
                  v-model="indexform.suitway"
                  placeholder="请选择"
                >
                  <el-option
                    v-for="item in mode"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="24">
              <el-form-item label="问题变量" prop="scriptContent">
                <div style="display: flex; margin-bottom: 10px">
                  <div
                    v-for="item in variablelist"
                    :class="item.default ? 'tsgname' : 'tsgnames'"
                    @click="tsgnameto(item)"
                  >
                    {{ item.variatename }}
                  </div>
                  <div class="tsgnamebj" @click="variabledeawer = true">
                    变量编辑
                  </div>
                </div>
              </el-form-item>
            </el-col></el-row
          >
          <el-row>
            <el-col :span="24">
              <el-form-item label="问题文本" prop="scriptContent">
                <el-input
                  :rows="2"
                  type="textarea"
                  id="scriptContent"
                  show-word-limit
                  placeholder="请输入内容"
                  v-model.sync="indexform.scriptContent"
                  @focus="handleInput('scriptContent')"
                />
              </el-form-item> </el-col
          ></el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item label="问题语音" prop="verbaltrickyy">
                <el-upload
                  class="upload-demo"
                  :action="uploadImgUrl"
                  :headers="headers"
                  :on-success="
                    (response, file) => handleChange(response, file, 1)
                  "
                  accept=".wav,.mp3"
                  :limit="1"
                >
                  <el-button size="small" type="primary">点击上传</el-button>
                </el-upload>
              </el-form-item>
            </el-col>
            <el-col :span="6"> </el-col>
            <mini-audio
              :audio-source="
                indexform.scriptVoice
                  ? indexform.scriptVoice
                  : 'https://example.com/example.mp3'
              "
            ></mini-audio>
          </el-row>
          <el-row>
            <el-col :span="24">
              <el-form-item label="无匹配文本" prop="noMatchText">
                <el-input
                  type="textarea"
                  :rows="2"
                  id="noMatchText"
                  placeholder="请输入内容"
                  v-model.sync="indexform.noMatchText"
                  @focus="handleInput('noMatchText')"
                  show-word-limit
                />
              </el-form-item> </el-col
          ></el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item label="无匹配语音" prop="verbaltrickyy">
                <el-upload
                  class="upload-demo"
                  :action="uploadImgUrl"
                  :headers="headers"
                  :on-success="
                    (response, file) => handleChange(response, file, 2)
                  "
                  accept=".wav,.mp3"
                  :limit="1"
                >
                  <el-button size="small" type="primary">点击上传</el-button>
                </el-upload>
              </el-form-item>
            </el-col>
            <el-col :span="6"> </el-col>
            <mini-audio
              :audio-source="
                indexform.nomatchvoice
                  ? indexform.nomatchvoice
                  : 'https://example.com/example.mp3'
              "
            ></mini-audio>
          </el-row>
          <el-row>
            <el-col :span="24">
              <el-form-item label="无声文本" prop="slienceText">
                <el-input
                  type="textarea"
                  :rows="2"
                  id="slienceText"
                  placeholder="请输入内容"
                  v-model.sync="indexform.slienceText"
                  @focus="handleInput('slienceText')"
                  show-word-limit
                />
              </el-form-item> </el-col
          ></el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item label="无声语音" prop="verbaltrickyy">
                <el-upload
                  class="upload-demo"
                  :action="uploadImgUrl"
                  :headers="headers"
                  :on-success="
                    (response, file) => handleChange(response, file, 3)
                  "
                  accept=".wav,.mp3"
                  :limit="1"
                >
                  <el-button size="small" type="primary">点击上传</el-button>
                </el-upload>
              </el-form-item>
            </el-col>
            <el-col :span="6"> </el-col>
            <mini-audio
              :audio-source="
                indexform.sliencevoice
                  ? indexform.sliencevoice
                  : 'https://example.com/example.mp3'
              "
            ></mini-audio>
          </el-row>
          <el-row>
            <el-col :span="24">
              <el-form-item label="听不清文本" prop="noClearlyText">
                <el-input
                  type="textarea"
                  id="noClearlyText"
                  :rows="2"
                  placeholder="请输入内容"
                  @focus="handleInput('noClearlyText')"
                  v-model.sync="indexform.noClearlyText"
                  show-word-limit
                />
              </el-form-item> </el-col
          ></el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item label="听不清语音" prop="verbaltrickyy">
                <el-upload
                  class="upload-demo"
                  :action="uploadImgUrl"
                  :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"> </el-col>
            <mini-audio
              :audio-source="
                indexform.noclearlyvoice
                  ? indexform.noclearlyvoice
                  : 'https://example.com/example.mp3'
              "
            ></mini-audio>
          </el-row>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button type="primary" @click="nextstep">下一步</el-button>
          <el-button @click="closeFm">关 闭</el-button>
          <el-button @click="Saveproblem()">保存数据</el-button>
        </div>
      </div>
      <!-- 指标设置 -->
      <div v-if="Editprogress == 2">
        <div class="leftvlue-jbxx">
          指标题目设置
          <span style="margin-left: 30px"
            ><el-button type="success" round @click="gettargetInfo"
              >+选择指标</el-button
            ></span
          >
        </div>
        <el-divider></el-divider>
        <el-form
          ref="form"
          :model="indexform"
          :rules="rules"
          label-width="100px"
        >
          <el-row>
            <el-col :span="8">
              <el-form-item label="指标名称" prop="deptId">
                <el-input
                  v-model="indexform.targetname"
                  placeholder="请输入指标名称"
                  maxlength="20"
                />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="指标描述" prop="deptId">
                <el-input
                  v-model="indexform.targetdesc"
                  placeholder="请输入指标描述"
                  maxlength="60"
                />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="24">
              <el-form-item label="值类型">
                <el-radio-group disabled v-model="indexform.valueType">
                  <el-radio :label="1">选项</el-radio>
                  <el-radio :label="2">文本</el-radio>
                  <el-radio :label="3">数值</el-radio>
                </el-radio-group>
              </el-form-item>
              <el-form-item label="题目类型">
                <el-radio-group disabled v-model="indexform.scriptType">
                  <el-radio :label="1">单选</el-radio>
                  <el-radio :label="2">多选</el-radio>
                  <el-radio :label="3">填空</el-radio>
                  <el-radio :label="4">问答</el-radio>
                </el-radio-group>
              </el-form-item>
            </el-col></el-row
          >
          <div v-if="indexform.valueType == 1">
            <el-card class="box-card" style="margin-bottom: 20px">
              <Regular
                :TargetoptionList="indexform.ivrLibaScriptTargetoptionList"
                @addoption="addoption"
                @deloption="deloption"
                @syioption="syioption"
                @xiayioption="xiayioption"
                :intent="false"
                :Verbalproblem="false"
              />
            </el-card>
            <el-row :gutter="20">
              <el-col :span="12">
                <el-form-item label="测试输入" prop="targetvalue">
                  <el-input
                    v-model="testvalue"
                    placeholder="请输入测试内容"
                    maxlength="40"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-button type="success">开始测试</el-button>
              </el-col>
            </el-row>
            <div style="margin-bottom: 20px">
              <el-input
                type="textarea"
                :rows="4"
                placeholder="此处展示识别结果"
                v-model="testgovalue"
              >
              </el-input>
            </div>
          </div>
          <div style="margin-bottom: 20px" v-else>
            <el-input
              type="textarea"
              :rows="4"
              placeholder="此处展示收集信息"
              v-model="testgovalue"
            >
            </el-input>
          </div>
        </el-form>
        <el-button type="primary" @click="laststep()">上一步</el-button>
        <el-button type="info" @click="closeFm()">关闭</el-button>
        <el-button @click="Saveproblem()">保存数据</el-button>
      </div>
    </div>
    <div class="valuetop" v-for="(item, index) in deployList" :key="item.id">
      <div class="val-text">
        <div>
          有无复查 <span>{{ item.name }}</span>
        </div>
        <div class="text-icon" @click="deletei(index)">
          <i class="el-icon-delete" />
        </div>
      </div>
      <div class="val-bon">
        <el-form ref="form" :model="form" label-width="80px">
          <el-form-item label="指标类型">
            <el-radio-group v-model="form.resource">
              <el-radio label="选项"></el-radio>
              <el-radio label="文本"></el-radio>
              <el-radio label="数组"></el-radio>
            </el-radio-group>
    <el-drawer
      title="选择指标"
      :visible.sync="drawer"
      custom-class="demo-drawer"
      size="50%"
    >
      <div class="preview-left">
        <el-form
          :model="queryParams"
          ref="queryForm"
          size="small"
          :inline="true"
          label-width="98px"
        >
          <el-form-item label="标题" prop="userName">
            <el-input
              v-model="queryParams.targetname"
              placeholder="请输入"
              clearable
              style="width: 200px"
              @keyup.enter.native="gettargetInfo"
            />
          </el-form-item>
          <el-form-item label="指标名称">
            <el-input v-model="form.name"></el-input>
          </el-form-item>
          <el-form-item label="指标值">
            <el-input v-model="item.name"></el-input>
          </el-form-item>
          <el-form-item label="特殊资源">
            <el-radio-group v-model="form.resource">
              <el-radio label="基础"></el-radio>
              <el-radio label="自定义"></el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="基础规则">
            <el-input type="textarea" v-model="item.valuetop"></el-input>
          <el-form-item>
            <el-button
              type="primary"
              icon="el-icon-search"
              size="medium"
              @click="gettargetInfo"
              >搜索</el-button
            >
            <el-button icon="el-icon-refresh" size="medium" @click="resetQuery"
              >重置</el-button
            >
          </el-form-item>
        </el-form>
        <el-table v-loading="loading" :data="targetList">
          <el-table-column
            label="标题"
            align="center"
            key="targetname"
            prop="targetname"
            width="100"
          />
          <el-table-column
            label="问题内容"
            align="center"
            key="targetdesc"
            prop="targetdesc"
            width="200"
            :show-overflow-tooltip="true"
          />
          <el-table-column
            label="操作"
            align="center"
            class-name="small-padding fixed-width"
          >
            <template slot-scope="scope">
              <el-button
                size="medium"
                type="text"
                @click="selectlabel(scope.row)"
                ><span class="button-textxg"
                  ><i class="el-icon-circle-plus-outline"></i>选择</span
                ></el-button
              >
            </template>
          </el-table-column>
        </el-table>
        <pagination
          v-show="total > 0"
          :total="total"
          :page.sync="queryParams.pageNum"
          :limit.sync="queryParams.pageSize"
          @pagination="gettargetInfo"
        />
      </div>
    </div>
    </el-drawer>
  </div>
</template>
<script>
import { listtag } from "@/api/system/label";
import {
  gettagerlist,
  testtagerlist,
  delverbaltrickinfo,
  compileverbaltrick,
  getverbaltrick,
  getbaltrickclassify,
  gettargetInfolist,
  gettargetInfo,
} from "@/api/AiCentre/index";
import Regular from "@/components/Regular"; //正则组件
import store from "@/store";
import { getToken } from "@/utils/auth";
export default {
  name: "Verbalproblem",
  components: { Regular },
  data() {
    return {
      optionvalue: "不需要、没有、不知道",
      form: {
        name: "",
        region: "",
        date1: "",
        date2: "",
        delivery: false,
        type: [],
        resource: "",
        desc: "",
      headers: {
        Authorization: "Bearer " + getToken(),
      },
      deployList: [
      uploadImgUrl: process.env.VUE_APP_BASE_API + "/common/uploadSort",
      Editprogress: 1, //编辑进度
      loading: false, // 遮罩层
      radio: "false", //单选题选中
      radios: [], //多选题选中
      radioas: "", //填空题答案
      dynamicTags: [],
      dellist: [],
      targetList: [],
      inputVisible: false,
      drawer: false,
      inputValue: "",
      testvalue: "",
      testgovalue: "",
      topicobj: {},
      indexform: {
        ivrLibaScriptTargetoptionList: [],
        ivrLibaScriptTagList: [],
        suitway: "2",
      },
      mode: [],
      questionclass: [],
      currentInputId: "",
      courtyardlist: [],
      // 总条数
      total: 1,
      rules: {},
      rulesa: {},
      optionstag: [],
      fileList: [
        {
          id: 1,
          name: "有",
          valuetop:
            "(?!.*忘|.*不|.*没)^.*(是|有|对|做|作|检|查|复诊|好|参加|复诊|去(过|好|了|完|医院)|来(过|了|医院))|没错|对呀|可能|(已经|早)去了|开了药|腰带|吊带|要的|(?<!没)有的|表带,10;要,5",
        },
        {
          id: 2,
          name: "不知道",
          valuetop:
            "(不|没|谁|鬼|怎么).*(病|可能|知道|了解|清楚|懂|明白|确认|确定|晓得|知晓|认得|识得|印象|熟悉|记|会|关心|关注|注意|告诉|通知|听)",
          name: "food.jpeg",
          url: "https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100",
        },
      ],
      usable: [],
      options: [],
      variablelist: [
        { variatename: "姓名", variate: "${name}", default: 1 },
        { variatename: "电话", variate: "${phone}", default: 1 },
        { variatename: "病情", variate: "${illness}", default: 1 },
      ],
      addvalue: "添加题目",
      languagelist: [], //语言列表
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
      },
      variabledeawer: false,
    };
  },
  created() {},
  created() {
    this.gettabList();
    this.getverbaltrick();
    this.mode = store.getters.mode;
    this.valuetype = store.getters.valuetype;
    this.languagelist = store.getters.languagelist;
    this.usable = store.getters.usable;
    this.courtyardlist = store.getters.courtyardlist;
  },
  methods: {
    onSubmit() {
      console.log("submit!");
    },
    deletei(index) {
      console.log(index);
      this.deployList.splice(index, 1);
    },
    addzbiao() {
      const ids = this.deployList.length + 1;
      console.log(ids);
      this.deployList.push({
        id: ids,
        name: "",
        valuetop: "",
    // 获取详情数据
    getverbaltrick() {
      let id = this.$route.query.id;
      if (id) {
        getverbaltrick({ id: id }).then((res) => {
          this.indexform = res.data;
          this.indexform.assortid = parseInt(this.indexform.assortid);
          this.variablelist = JSON.parse(this.indexform.otherdata).length
            ? JSON.parse(this.indexform.otherdata)
            : this.variablelist;
          this.dynamicTags = this.indexform.ivrLibaScriptTagList.map(
            this.processElement
          );
        });
      }
      // 树
      getbaltrickclassify({}).then((res) => {
        this.questionclass = res.rows;
        console.log(res);
      });
    },
    // 保存详细信息
    Saveproblem() {
      this.indexform.otherdata = JSON.stringify(this.variablelist);
      if (this.indexform.id) {
        this.indexform.ivrLibaScriptTargetoptionList =
          this.indexform.ivrLibaScriptTargetoptionList.map((res) => {
            if (res.isoperation != 1) {
              res.isoperation = 2;
            }
            return res;
          });
        this.indexform.isoperation = 2;
        console.log(this.dellist);
        this.indexform.ivrLibaScriptTargetoptionList =
          this.indexform.ivrLibaScriptTargetoptionList.concat(this.dellist);
        this.indexform.targetoptions =
          this.indexform.ivrLibaScriptTargetoptionList
            .filter((item) => item.isope != 3) // 过滤掉 isope 为 3 的项
            .map((item) => item.targetvalue)
            .join(", ");
        compileverbaltrick(this.indexform).then((res) => {
          if (res.code == 200) {
            this.$modal.msgSuccess("修改成功");
            this.$router.go(-1);
          } else {
            this.$message({
              message: "修改失败",
              type: "error",
            });
          }
        });
      } else {
        this.indexform.isoperation = 1;
        compileverbaltrick(this.indexform).then((res) => {
          if (res.code == 200) {
            this.$modal.msgSuccess("新增成功");
            this.$router.go(-1);
          } else {
            this.$message({
              message: "新增失败",
              type: "error",
            });
          }
        });
      }
    },
    // targetchange(res) {
    //   console.log(res);
    //   gettargetInfo({ id: res }).then((res) => {
    //     console.log(res.rows[0]);
    //     this.$modal
    //       .confirm('是否添加"' + res.rows[0].targetname + '"指标的选项?')
    //       .then(() => {
    //         this.indexform.valueType = res.rows[0].valueType;
    //         this.indexform.scriptType = res.rows[0].scriptType;
    //         this.indexform.scriptTopic = res.rows[0].targetname;
    //         this.indexform.targetname = res.rows[0].targetname;
    //         this.indexform.targetid = res.rows[0].id;
    //         this.indexform.targetdesc = res.rows[0].targetdesc;
    //         this.indexform.isAvailable = "0";
    //         this.indexform.language = "普通话";
    //         this.indexform.isenable = res.rows[0].isenable;
    //         this.$forceUpdate();
    //         res.rows[0].targetoptionList.forEach((item) => {
    //           item.isoperation = 1;
    //           this.indexform.ivrLibaScriptTargetoptionList.push(item);
    //         });
    //       })
    //       .catch(() => {
    //         this.$modal.msgSuccess("已取消");
    //       });
    //   });
    // },
    // 选择指标
    selectlabel(row) {
      this.$modal
        .confirm(
          '是否选择标题为"' + row.targetname + '"的指标并替换填充问题信息?'
        )
        .then(() => {
          console.log(row);
          this.indexform.valueType = row.valueType;
          this.indexform.scriptType = row.scriptType;
          this.indexform.scriptTopic = row.targetname;
          this.indexform.targetname = row.targetname;
          this.indexform.targetid = row.id;
          this.indexform.targetdesc = row.targetdesc;
          this.indexform.isAvailable = "0";
          this.indexform.language = "普通话";
          this.indexform.isenable = row.isenable;
          const labellist = row.targetoptionList;
          labellist.forEach((item) => {
            item.isoperation = 1;
            this.indexform.ivrLibaScriptTargetoptionList.push(item);
          });
          this.drawer = false;
        })
        .catch(() => {});
    },
    gettargetInfo() {
      gettargetInfo(this.queryParams).then((res) => {
        console.log(res);
        this.targetList = res.rows;
        this.total = res.total;
        this.drawer = true;
      });
    },
    resetQuery() {
      this.queryParams = {
        pageNum: 1,
        pageSize: 10,
      };
      this.gettargetInfo();
    },
    // 下一步
    nextstep() {
      if (this.Editprogress <= 1) {
        // if (this.indexform.targetid) {
        return this.Editprogress++;
        // } else {
        //   this.$message.warning("请先选择关联指标");
        // }
      } else {
      }
    },
    // 上一步
    laststep() {
      this.Editprogress = this.Editprogress - 1;
    },
    // 关闭
    closeFm() {
      this.$confirm("退出不会保留页面内容更改, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          this.$router.go(-1);
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消",
          });
        });
    },
    // 文件----------------------
    // 控制文件
    handleChange(response, file, additionalParam) {
      console.log(response);
      if (additionalParam == 1) {
        this.indexform.scriptVoice = response.url;
      } else if (additionalParam == 2) {
        this.indexform.nomatchvoice = response.url;
      } else if (additionalParam == 3) {
        this.indexform.sliencevoice = response.url;
      } else if (additionalParam == 4) {
        this.indexform.noclearlyvoice = response.url;
      }
    },
    // 标签-----------------
    gettabList() {
      const tagqueryParams = {
        pageNum: 1,
        pageSize: 1000,
        tagcategoryid: "0",
      };
      listtag(tagqueryParams).then((response) => {
        console.log(response);
        this.optionstag = response.rows;
      });
    },
    handleClosetag(tag) {
      console.log(tag);
      console.log(this.dynamicTags.indexOf(tag));
      const lindex = this.dynamicTags.indexOf(tag);
      this.dynamicTags.splice(this.dynamicTags.indexOf(tag), 1);
      this.indexform.ivrLibaScriptTagList[lindex].isoperation = 3;
    },
    handleInputConfirm() {
      let tagvalue = {};
      let tagname = this.inputValue;
      if (tagname) {
        listtag({
          pageNum: 1,
          pageSize: 1000,
          tagcategoryid: "0",
          tagname: tagname,
        }).then((res) => {
          if (res.rows[0]) {
            tagvalue = res.rows[0];
            tagvalue.isoperation = 1;
          } else {
            tagvalue = {
              tagname: tagname,
              isoperation: 1,
            };
          }
          this.indexform.ivrLibaScriptTagList.push(tagvalue);
          this.dynamicTags.push(tagvalue);
        });
      }
      this.inputVisible = false;
      this.inputValue = "";
    },
    remoteMethodtag(query) {
      if (query !== "") {
        this.loading = true;
        setTimeout(() => {
          this.loading = false;
          listtag({ tagname: query, tagcategoryid: "0" }).then((res) => {
            this.optionstag = res.rows;
          });
        }, 200);
      } else {
        this.optionstag = [];
      }
    },
    showInput() {
      this.inputVisible = true;
    },
    //测试表单 --------------------------
    gettagerlist() {
      gettagerlist({ targetname: this.targetname }).then((response) => {
        console.log(response);
        this.optionstag = response.rows;
      });
    },
    addoption() {
      this.indexform.ivrLibaScriptTargetoptionList.push({
        guid: 1,
        isoperation: 1,
        targetvalue: "",
        targetregex: "",
        targetregex2: "",
        dynamiccruxs: [],
        nodynamiccruxs: [],
        dynamiccruxsJson: "",
        nodynamiccruxsJson: "",
      });
      this.sortFn();
    },
    deloption(item) {
      const index = this.indexform.ivrLibaScriptTargetoptionList.indexOf(item);
      if (index !== -1) {
        if (item.id) {
          console.log(item, "chunz");
          item.isoperation = 3;
          this.dellist.push(item);
        }
        console.log(this.dellist, "dellist");
        this.indexform.ivrLibaScriptTargetoptionList.splice(index, 1); // 从索引位置删除一个元素
        this.sortFn();
      } else {
        console.log("未找到该对象");
      }
    },
    getIndexInArray(arr, obj) {
      return arr.indexOf(obj);
    },
    processElement(element) {
      return { ...element, isoperation: 1 };
    },
    syioption(row) {
      const index = this.getIndexInArray(
        this.indexform.ivrLibaScriptTargetoptionList,
        row
      );
      const item = this.indexform.ivrLibaScriptTargetoptionList.splice(
        index,
        1
      )[0]; // 移除指定索引处的元素,并保存到item变量中
      this.indexform.ivrLibaScriptTargetoptionList.splice(index - 1, 0, item); // 将item插入到索引位置的前一位
      this.sortFn();
    },
    xiayioption(row) {
      const index = this.getIndexInArray(
        this.indexform.ivrLibaScriptTargetoptionList,
        row
      );
      const item = this.indexform.ivrLibaScriptTargetoptionList.splice(
        index,
        1
      )[0]; // 移除指定索引处的元素,并保存到item变量中
      this.indexform.ivrLibaScriptTargetoptionList.splice(index + 1, 0, item); // 将item插入到索引位置的前一位
      this.sortFn();
    },
    sortFn() {
      this.indexform.ivrLibaScriptTargetoptionList =
        this.indexform.ivrLibaScriptTargetoptionList.map((item, index) => {
          return {
            guid: index + 1,
            targetvalue: item.targetvalue,
            targetregex2: item.targetregex2,
            targetregex: item.targetregex,
            id: item.id,
            targettype: this.indexform.targettype,
            isoperation: item.id ? 2 : 1,
            categoryName: item.categoryName,
            language: item.language,
            dynamiccruxs: item.dynamiccruxs,
            nodynamiccruxs: item.nodynamiccruxs,
            dynamiccruxsJson: item.dynamiccruxsJson,
            nodynamiccruxsJson: item.nodynamiccruxsJson,
          };
        });
      console.log(this.indexform.ivrLibaScriptTargetoptionList);
    },
    // ---------------------
    // 便捷标签
    tsgnameto(row) {
      let inputValueArr = "";
      let el = document.querySelector("#" + this.currentInputId);
      //el.selectionStart; 这就是当前光标所在的位置(字符串中字符的index)
      if (this.currentInputId == "scriptContent") {
        inputValueArr = this.indexform.scriptContent.split("");
      } else if (this.currentInputId == "noMatchText") {
        inputValueArr = this.indexform.noMatchText.split("");
      } else if (this.currentInputId == "slienceText") {
        inputValueArr = this.indexform.slienceText.split("");
      } else if (this.currentInputId == "noClearlyText") {
        inputValueArr = this.indexform.noClearlyText.split("");
      } else if (this.currentInputId == "submoduletext") {
        inputValueArr = this.indexform.submoduletext.split("");
      } else {
        return;
      }
      //将输入框内容切成数组,方便后续操作
      // inputValueArr = this.inputValue.split("");
      // 拿到选中文字的长度(后续可以用来替换选中的文字)
      let selectLength = el.selectionEnd - el.selectionStart;
      // 将要插入/替换的文字插入/替换(value.name是要插入/替换的字符串)
      inputValueArr.splice(el.selectionStart, selectLength, `${row.variate}`);
      // 把数组重新转换为字符串并赋值
      inputValueArr = inputValueArr.join("");
      console.log(inputValueArr);
      if (this.currentInputId == "scriptContent") {
        this.indexform.scriptContent = inputValueArr;
      } else if (this.currentInputId == "noMatchText") {
        this.indexform.noMatchText = inputValueArr;
      } else if (this.currentInputId == "slienceText") {
        this.indexform.slienceText = inputValueArr;
      } else if (this.currentInputId == "noClearlyText") {
        this.indexform.noClearlyText = inputValueArr;
      } else if (this.currentInputId == "submoduletext") {
        this.indexform.submoduletext = inputValueArr;
      } else {
        return;
      }
    },
    // 新增变量
    addvariable() {
      this.variablelist.push({
        variatename: "",
        variate: "",
      });
    },
    // 删除变量
    delvariable(item) {
      const index = this.variablelist.indexOf(item);
      if (index !== -1) {
        this.variablelist.splice(index, 1); // 从索引位置删除一个元素
      } else {
        console.log("未找到该对象");
      }
    },
    // 输入获取id
    handleInput(id) {
      this.currentInputId = id;
      console.log("输入框的值已更新:", this.currentInputId);
      // 在这里执行更新数据的逻辑
    },
  },
};
</script>
<style lang="scss" scoped>
.top-text {
  margin: 15px;
  margin-top: 0;
  padding: 0 30px 30px 30px;
  background: #f2f5fc;
.Questionnairemanagement {
  // display: flex;
}
.sidecolumn {
  margin: 20px;
  margin-bottom: 0;
  padding: 20px;
  background: #edf1f7;
  border: 1px solid #dcdfe6;
  -webkit-box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.12),
    0 0 6px 0 rgba(0, 0, 0, 0.04);
}
.basic {
  height: 50px;
  margin: 15px;
  margin-bottom: 0;
  padding: 0 20px 20px 20px;
  line-height: 50px;
  background: #cdcdce;
.leftvlue {
  margin: 20px;
  padding: 30px;
  background: #ffff;
  border: 1px solid #dcdfe6;
  -webkit-box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.12),
    0 0 6px 0 rgba(0, 0, 0, 0.04);
  .leftvlue-jbxx {
    font-size: 24px;
    border-left: 5px solid #41a1be;
    padding-left: 5px;
    margin: 15px 0;
  }
}
.headline {
  display: flex;
  height: 50px;
  margin: 15px;
  margin-bottom: 0;
  padding: 0 20px 20px 20px;
  line-height: 50px;
  background: #cdcdce;
  justify-content: space-between;
.xinz-inf {
  font-size: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 48px;
  .el-tag + .el-tag {
    margin-left: 10px;
  }
  .button-new-tag {
    margin-left: 10px;
    height: 32px;
    line-height: 30px;
    padding-top: 0;
    padding-bottom: 0;
  }
  .input-new-tag {
    width: 90px;
    margin-left: 10px;
    vertical-align: bottom;
  }
}
.valuetop {
  .val-text {
    display: flex;
    height: 50px;
    margin: 15px;
    margin-bottom: 0;
    // padding: 0 20px 20px 20px;
    padding: 0 20px;
    align-items: center;
    background: #cdcdce;
    justify-content: space-between;
    .text-icon {
      width: 35px;
      height: 35px;
      line-height: 35px;
      text-align: center;
      background: #fafafa;
      cursor: pointer;
      border-radius: 5px;
.button-new-tag {
  margin-left: 10px;
  height: 32px;
  line-height: 30px;
  padding-top: 0;
  padding-bottom: 0;
}
.tsgnames {
  width: 90px;
  margin-right: 10px;
  text-align: center;
  cursor: pointer;
  height: 40px;
  line-height: 40px;
  background: #7799fa;
  color: #ffff;
  font-size: 18px;
  border-radius: 5px;
}
.tsgnames:hover {
  background: #3366f5;
}
.tsgname {
  width: 90px;
  margin-right: 10px;
  text-align: center;
  cursor: pointer;
  height: 40px;
  line-height: 40px;
  background: #66c18c;
  color: #ffff;
  font-size: 18px;
  border-radius: 5px;
}
.tsgname:hover {
  background: #20894d;
}
.tsgnamebj {
  width: 90px;
  margin-left: 15px;
  text-align: center;
  cursor: pointer;
  height: 40px;
  line-height: 40px;
  background: #49dbb7;
  color: #ffff;
  font-size: 18px;
  border-radius: 5px;
}
.tsgnamebj:hover {
  background: #27c449;
}
.preview-left {
  margin: 20px;
  //   margin: 20px;
  padding: 30px;
  background: #ffff;
  border: 1px solid #dcdfe6;
  -webkit-box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.12),
    0 0 6px 0 rgba(0, 0, 0, 0.04);
  .scriptTopic-dev {
    margin-bottom: 25px;
    font-size: 20px !important;
    .dev-text {
      margin-bottom: 10px;
    }
  }
  .val-bon {
    margin: 15px;
    margin-top: 0;
    padding: 30px;
    background: #f2f5fc;
    border: 1px solid #dcdfe6;
    -webkit-box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.12),
      0 0 6px 0 rgba(0, 0, 0, 0.04);
}
::v-deep .addtopic-input {
  input {
    background: #02a7f0;
    color: #edf1f7;
    width: 150px;
  }
}
::v-deep.el-step.is-vertical .el-step__title {
  font-size: 25px;
}
::v-deep.el-input--medium {
  font-size: 18px !important;
}
.el-select__tags {
  font-size: 20px;
  max-width: 888px !important;
}
::v-deep.el-radio__inner {
  width: 22px;
  height: 22px;
}
// ::v-deep.topic-dev.el-radio__label {
//   font-size: 24px;
// }
::v-deep.el-radio-group {
  span {
    font-size: 24px;
  }
}
::v-deep.upload-demo {
  display: flex;
}
::v-deep.el-checkbox-group {
  span {
    font-size: 24px;
  }
}
// ::v-deep.el-form-item--medium .el-form-item__content {
//   line-height: 36px;
//   display: flex;
// }
</style>