WXL
2024-02-04 cf9259c2ebee0e82c32864a1ee91d96c403b9099
src/views/repositoryai/verbaltrick/particulars/index.vue
@@ -2,10 +2,22 @@
  <div class="Questionnairemanagement">
    <!-- 左侧栏 -->
    <div class="sidecolumn">
      <div style="height: 300px">
        <el-steps direction="vertical" :active="Editprogress">
          <el-step title="问题库编辑"></el-step>
          <el-step title="问题指标编辑"></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="nextstep"
                >问题指标编辑</span
              >
            </template>
          </el-step>
        </el-steps>
      </div>
    </div>
@@ -39,9 +51,12 @@
            </el-col>
            <el-col :span="12">
              <el-form-item label="可用状态" prop="status">
                <el-select v-model="indexform.status" placeholder="请选择状态">
                <el-select
                  v-model="indexform.isAvailable"
                  placeholder="请选择状态"
                >
                  <el-option
                    v-for="item in qyoptions"
                    v-for="item in usable"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
@@ -51,23 +66,185 @@
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col :span="12">
              <el-form-item label="问题主旨" prop="nickName">
              <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.nickName"
                  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="questiontitle">
                <el-input
                  v-model="indexform.questiontitle"
                  placeholder="请输入问题主旨"
                  maxlength="80"
                />
              </el-form-item>
            </el-col>
            <el-col :span="5">
              <el-form-item label="版本号" prop="nickName">
                <el-input
                  v-model="indexform.nickName"
                  placeholder="请输入"
                  maxlength="80"
                />
          </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
                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-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-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
                  v-model="indexform.suitway"
                  multiple
                  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-col :span="8">
              <el-form-item label="关联指标" prop="region">
                <el-select
                  v-model="indexform.targetid"
                  filterable
                  remote
                  reserve-keyword
                  placeholder="请输入关键词"
                  :remote-method="remoteMethod"
                  @change="targetchange"
                  :loading="loading"
                >
                  <el-option
                    v-for="item in targetlist"
                    :key="item.id"
                    :label="item.targetname"
                    :value="item.id"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
@@ -76,25 +253,26 @@
              <div
                style="display: flex; margin-left: 100px; margin-bottom: 10px"
              >
                <div class="tsgname" @click="tsgnameto()">医院名称</div>
                <div class="tsgname" @click="tsgnameto()">医院电话</div>
                <div class="tsgname" @click="tsgnameto()">医院姓名</div>
                <div class="tsgname" @click="tsgnameto()">随访姓名</div>
                <div class="tsgname" @click="tsgnameto()">随访电话</div>
                <div class="tsgname" @click="tsgnameto()">性别</div>
                <div class="tsgname" @click="tsgnameto()">年龄</div>
                <div class="tsgname" @click="tsgnameto()">地址</div>
                <div
                  v-for="item in variablelist"
                  class="tsgname"
                  @click="tsgnameto(item)"
                >
                  {{ item.variatename }}
                </div>
              </div>
            </el-col></el-row
          >
          <el-row>
            <el-col :span="24">
              <el-form-item label="问题文本" prop="verbaltricktext">
              <el-form-item label="问题文本" prop="questiontext">
                <el-input
                  type="textarea"
                  :rows="2"
                  placeholder="请输入内容"
                  v-model="indexform.userName"
                  id="questiontext"
                  v-model.sync="indexform.questiontext"
                  @focus="handleInput('questiontext')"
                  maxlength="30"
                />
              </el-form-item> </el-col
@@ -118,12 +296,14 @@
          >
          <el-row>
            <el-col :span="24">
              <el-form-item label="无匹配文本" prop="matchtext">
              <el-form-item label="无匹配文本" prop="nomatchtext">
                <el-input
                  type="textarea"
                  :rows="2"
                  id="nomatchtext"
                  placeholder="请输入内容"
                  v-model="indexform.userName"
                  v-model.sync="indexform.nomatchtext"
                  @focus="handleInput('nomatchtext')"
                  maxlength="30"
                />
              </el-form-item> </el-col
@@ -146,12 +326,14 @@
          >
          <el-row>
            <el-col :span="24">
              <el-form-item label="无声文本" prop="silenttext">
              <el-form-item label="无声文本" prop="sliencetext">
                <el-input
                  type="textarea"
                  :rows="2"
                  id="sliencetext"
                  placeholder="请输入内容"
                  v-model="indexform.userName"
                  v-model.sync="indexform.sliencetext"
                  @focus="handleInput('sliencetext')"
                  maxlength="30"
                />
              </el-form-item> </el-col
@@ -174,12 +356,14 @@
          >
          <el-row>
            <el-col :span="24">
              <el-form-item label="通用库文本" prop="librarytext">
              <el-form-item label="通用库文本" prop="submoduletext">
                <el-input
                  type="textarea"
                  :rows="2"
                  id="submoduletext"
                  placeholder="请输入内容"
                  v-model="indexform.userName"
                  v-model.sync="indexform.submoduletext"
                  @focus="handleInput('submoduletext')"
                  maxlength="30"
                />
              </el-form-item> </el-col
@@ -202,12 +386,14 @@
          >
          <el-row>
            <el-col :span="24">
              <el-form-item label="听不清文本" prop="vaguetext">
              <el-form-item label="听不清文本" prop="noclearlytext">
                <el-input
                  type="textarea"
                  id="noclearlytext"
                  :rows="2"
                  placeholder="请输入内容"
                  v-model="indexform.userName"
                  @focus="handleInput('noclearlytext')"
                  v-model.sync="indexform.noclearlytext"
                  maxlength="30"
                />
              </el-form-item> </el-col
@@ -228,86 +414,11 @@
              </el-form-item>
            </el-col></el-row
          >
          <el-form-item label="通知变量" prop="name">
            <el-row v-for="item in variablelist">
              <el-col :span="4">
                <el-input v-model="item.variable"></el-input>
              </el-col>
              <el-col :span="8" :offset="1">
                <el-input v-model="item.value"></el-input>
              </el-col>
              <el-col :span="4" :offset="1">
                <el-button
                  type="success"
                  icon="el-icon-plus"
                  circle
                  @click="addvariable(item)"
                ></el-button>
                <el-button
                  type="danger"
                  icon="el-icon-delete"
                  circle
                  @click="delvariable(item)"
                ></el-button>
              </el-col>
            </el-row>
          </el-form-item>
          <el-row>
            <el-col :span="24">
              <el-form-item label="指标说明">
                <el-input
                  v-model="indexform.remark"
                  type="textarea"
                  placeholder="请输入内容"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item label="仅限院区" prop="region">
                <el-select
                  v-model="indexform.courtyard"
                  size="medium"
                  filterable
                  placeholder="请选择"
                >
                  <el-option
                    class="indexformaa"
                    v-for="item in options"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="关联指标" prop="region">
                <el-select
                  v-model="indexform.relevance"
                  size="medium"
                  filterable
                  placeholder="请选择分类"
                >
                  <el-option
                    class="indexformaa"
                    v-for="item in options"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button type="primary" @click="nextstep">确 定</el-button>
          <el-button type="primary" @click="nextstep">下一步</el-button>
          <el-button @click="closeFm">关 闭</el-button>
          <el-button @click="Saveproblem()">保存数据</el-button>
        </div>
      </div>
      <!-- 指标设置 -->
@@ -324,154 +435,48 @@
            <el-col :span="12">
              <el-form-item label="指标名称" prop="deptId">
                <el-input
                  v-model="indexform.name"
                  placeholder="请输入指标种类"
                  maxlength="40"
                />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="版本号" prop="deptId">
                <el-input
                  v-model="indexform.versions"
                  placeholder="请输入指标种类"
                  v-model="indexform.targetname"
                  placeholder="请输入指标名称"
                  maxlength="40"
                />
              </el-form-item>
            </el-col>
          </el-row>
          <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="deptId">
                <el-select v-model="indexform.useofstate" placeholder="请选择">
                  <el-option
                    v-for="index in qyoptions"
                    :key="index.value"
                    :label="index.label"
                    :value="index.value"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="24">
              <el-form-item label="指标描述" prop="nickName">
                <el-input
                  v-model="indexform.nickName"
                  placeholder="请输入指标描述"
                  maxlength="40"
                />
              </el-form-item> </el-col
          ></el-row>
          <el-form-item label="标签" prop="desc">
            <div class="xinz-inf">
              <el-tag
                :key="tag"
                type="success"
                v-for="tag in dynamicTags"
                closable
                :disable-transitions="false"
                @close="handleClose(tag)"
              >
                {{ tag }}
              </el-tag>
              <el-select
                v-model="inputValue"
                v-if="inputVisible"
                @change="handleInputConfirm"
                filterable
                placeholder="请选择"
              >
                <el-option
                  v-for="item in optionss"
                  :key="item.label"
                  :label="item.label"
                  :value="item.label"
                >
                </el-option>
              </el-select>
              <el-button
                v-else
                class="button-new-tag"
                size="small"
                @click="showInput"
                >+ 新增标签</el-button
              >
            </div>
          </el-form-item>
          <el-row>
            <el-col :span="24">
              <el-form-item label="值类型">
                <el-radio-group v-model="indexform.resource">
                  <el-radio label="选项"></el-radio>
                  <el-radio label="文本"></el-radio>
                  <el-radio label="数值"></el-radio>
                </el-radio-group>
              </el-form-item> </el-col
          ></el-row>
          <el-row>
            <el-col :span="24">
              <el-form-item label="适用疾病" prop="userName">
                <el-select v-model="indexform.useofstate" placeholder="请选择">
                  <el-option
                    v-for="index in qyoptions"
                    :key="index.value"
                    :label="index.label"
                    :value="index.value"
                  ></el-option>
                </el-select>
              </el-form-item> </el-col
          ></el-row>
          <el-row>
            <el-col :span="24">
              <el-form-item label="适用方式" prop="email">
                <el-select v-model="indexform.useofstate" placeholder="请选择">
                  <el-option
                    v-for="index in qyoptions"
                    :key="index.value"
                    :label="index.label"
                    :value="index.value"
                  ></el-option>
                </el-select>
              <el-form-item label="值类型">
                <el-radio-group v-model="indexform.isenable">
                  <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-col>
          </el-row>
          <el-card class="box-card" style="margin-bottom: 20px">
            <el-table v-loading="loading" :data="testuserList">
            </el-col></el-row
          >
          <!-- <el-card class="box-card" style="margin-bottom: 20px">
            <el-table
              v-loading="loading"
              :data="indexform.ivrLibaScriptTargetoptionList"
            >
              <el-table-column
                label="序号"
                align="center"
                key="userid"
                prop="userid"
                key="guid"
                prop="guid"
                width="50"
              />
              <el-table-column
                label="指标选项"
                align="center"
                key="nickName"
                prop="nickName"
                key="targetvalue"
                prop="targetvalue"
                :show-overflow-tooltip="true"
              >
                <template slot-scope="scope">
                  <el-input
                    v-model="scope.row.nickName"
                    v-model="scope.row.targetvalue"
                    placeholder="请输入内容"
                  ></el-input>
                </template>
@@ -479,14 +484,14 @@
              <el-table-column
                label="解析规则"
                align="center"
                key="aphonenumber"
                prop="aphonenumber"
                key="targetregex"
                prop="targetregex"
                width="460"
                :show-overflow-tooltip="true"
              >
                <template slot-scope="scope">
                  <el-input
                    v-model="scope.row.aphonenumber"
                    v-model="scope.row.targetregex"
                    placeholder="请输入内容"
                  ></el-input>
                </template>
@@ -526,10 +531,19 @@
                </template>
              </el-table-column>
            </el-table>
          </el-card>
          </el-card> -->
          <el-card class="box-card" style="margin-bottom: 20px">
              <Regular
                :TargetoptionList="indexform.ivrLibaScriptTargetoptionList"
                @addoption="addoption"
                @deloption="deloption"
                @syioption="syioption"
                @xiayioption="xiayioption"
              />
            </el-card>
          <el-row :gutter="20">
            <el-col :span="12">
              <el-form-item label="测试输入" prop="nickName">
              <el-form-item label="测试输入" prop="targetvalue">
                <el-input
                  v-model="testvalue"
                  placeholder="请输入测试内容"
@@ -552,15 +566,31 @@
          </el-input>
        </div>
        <el-button type="primary" @click="laststep()">上一步</el-button>
        <el-button type="info" @click="closeFm('ruleForm')">关闭</el-button>
        <el-button @click="Saveproblem('ruleForm')">保存指标数据</el-button>
        <el-button type="info" @click="closeFm()">关闭</el-button>
        <el-button @click="Saveproblem()">保存数据</el-button>
      </div>
    </div>
  </div>
</template>
<script>
import { listtag } from "@/api/system/label";
import {
  getverbaltricklist,
  verbaltrickinfo,
  delverbaltrickinfo,
  compileverbaltrick,
  getverbaltrick,
  getbaltrickclassify,
  gettargetInfolist,
  gettargetInfo,
} from "@/api/AiCentre/index";
import Regular from "@/components/Regular"; //正则组件
import store from "@/store";
export default {
  name:'Verbalproblem',
  components: {  Regular },
  data() {
    return {
      Editprogress: 1, //编辑进度
@@ -568,141 +598,46 @@
      radio: "false", //单选题选中
      radios: [], //多选题选中
      radioas: "", //填空题答案
      dynamicTags: ["标签一", "标签二", "标签三"],
      dynamicTags: [],
      inputVisible: false,
      inputValue: "",
      testvalue: "",
      testgovalue: "",
      topicobj: {},
      indexform: {},
      mode: [],
      questionclass: [],
      currentInputId: "",
      courtyardlist: [],
      // 总条数
      total: 1,
      ruleForm: {
        name: "",
        region: "",
        date1: "",
        date2: "",
        delivery: false,
        type: [],
        resource: "",
        desc: "",
        templatevalue: "",
        data2: "",
      },
      rules: {},
      rulesa: {},
      xjxsoptions: [
      targetlist: [
        {
          value: "选项1",
          label: "图文",
        },
        {
          value: "选项2",
          label: "视频",
        },
        {
          value: "选项3",
          label: "音频",
        },
      ],
      rules: {},
      rulesa: {},
      optionstag: [],
      fileList: [
        {
          name: "food.jpeg",
          url: "https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100",
        },
      ],
      qyoptions: [
        {
          value: 1,
          label: "可用",
        },
        {
          value: 2,
          label: "禁用",
        },
      ],
      options: [
        {
          value: "选项1",
          label: "疾病指标",
        },
        {
          value: "选项2",
          label: "入院指标",
        },
        {
          value: "选项3",
          label: "手术指标",
        },
        {
          value: "选项4",
          label: "护理指标",
        },
      ],
      usable: [],
      options: [],
      variablelist: [
        {
          variable: "paitent",
          value: "表示患者的标识",
        },
      ],
      testuserList: [
        {
          userid: 1,
          nickName: "贫血",
          aphonenumber: "(?!不.*|没.*|未.*)^.*([贫平凭血]|贫血|评学|评学),10",
        },
        {
          userid: 2,
          nickName: "正常",
          aphonenumber: "(?!不.*|没.*|未.*)^.*([贫平凭血]|贫血|评学|评学),10",
        },
        {
          userid: 55,
          nickName: "非正常",
          aphonenumber: "(?!不.*|没.*|未.*)^.*([贫平凭血]|贫血|评学|评学),10",
        },
        {
          userid: 4,
          nickName: "a正常",
          aphonenumber: "(?!不.*|没.*|未.*)^.*([贫平凭血]|贫血|评学|评学),10",
          status: "0",
        },
        { variatename: "姓名", variate: "${name}", default: 1 },
        { variatename: "电话", variate: "${phone}", default: 1 },
        { variatename: "病情", variate: "${illness}", default: 1 },
      ],
      addvalue: "添加题目",
      // 题目表格数据
      userList: [
        {
          userid: "1",
          userName: "一号指标",
        },
        {
          userid: "2",
          userName: "二号指标",
        },
        {
          userid: "3",
          userName: "三号指标",
        },
        {
          userid: "4",
          userName: "四号指标",
        },
      ],
      languagelist: [
        {
          value: 1,
          label: "普通话",
        },
        {
          value: 2,
          label: "粤语",
        },
        {
          value: 3,
          label: "英语",
        },
      ], //语言列表
      languagelist: [], //语言列表
      // 查询参数
      queryParams: {
        pageNum: 1,
@@ -716,27 +651,118 @@
    };
  },
  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: {
    submitForm(formName) {
      this.rules = this.rulesa;
      //   提交
      this.$refs[formName].validate((valid) => {
        if (valid) {
          alert("submit!");
        } else {
          console.log("error submit!!");
          return false;
        }
    // 获取详情数据
    getverbaltrick() {
      let id = this.$route.query.id;
      getverbaltrick({ id: id }).then((res) => {
        this.indexform = res.data;
        this.indexform.suitway = this.indexform.suitway.split(",");
        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
        );
        this.targetlist = [
          {
            id: this.indexform.targetid,
            targetname: this.indexform.targetname,
          },
        ];
      });
      // 树
      getbaltrickclassify({}).then((res) => {
        this.questionclass = res.rows;
        console.log(res);
      });
    },
    // 保存详细信息
    Saveproblem() {
      console.log(this.variablelist);
      this.indexform.otherdata = JSON.stringify(this.variablelist);
      this.indexform.suitway = this.indexform.suitway.join(",");
      if (this.indexform.id) {
        this.indexform.isoperation = 2;
        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",
            });
          }
        });
      }
    },
    remoteMethod(query) {
      if (query !== "") {
        this.loading = true;
        setTimeout(() => {
          this.loading = false;
          gettargetInfolist({ targetname: query }).then((res) => {
            this.targetlist = res.rows;
          });
        }, 200);
      } else {
        this.targetlist = [];
      }
    },
    targetchange(res) {
      console.log(res);
      gettargetInfo({ id: res }).then((res) => {
        this.indexform.targetname = res.rows[0].targetname;
        this.$modal
          .confirm('是否添加"' + this.indexform.targetname + '"指标的选项?')
          .then(() => {
            this.indexform.isenable = res.rows[0].isenable;
            res.rows[0].targetoptionList.forEach((item) => {
              item.isoperation = 1;
              this.indexform.ivrLibaScriptTargetoptionList.push(item);
            });
          })
          .catch(() => {
            this.$modal.msgSuccess("已取消");
          });
      });
    },
    // 下一步
    nextstep() {
      if (this.Editprogress <= 1 && this.indexform.relevance) {
        return this.Editprogress++;
      if (this.Editprogress <= 1) {
        if (this.indexform.targetid) {
          return this.Editprogress++;
        } else {
          this.$message.warning("请先选择关联指标");
        }
      } else {
        this.$message.warning("请先选择关联指标");
      }
    },
    // 上一步
@@ -760,40 +786,7 @@
          });
        });
    },
    // 保存题目信息
    Saveproblem() {},
    /** 查询题目列表 */
    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() {},
    // 新增变量
    addvariable() {
      this.variablelist.push({
        variable: "",
        value: "",
      });
    },
    // 删除变量
    delvariable(item) {
      const index = this.variablelist.indexOf(item);
      if (index !== -1) {
        this.variablelist.splice(index, 1); // 从索引位置删除一个元素
      } else {
        console.log("未找到该对象");
      }
    },
    // 文件----------------------
    // 控制文件
    handleChange(file, fileList) {
      this.fileList = fileList.slice(-3);
@@ -807,102 +800,216 @@
      );
    },
    // 标签-----------------
    handleClose(tag) {
    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 inputValue = this.inputValue;
      if (inputValue) {
        this.dynamicTags.push(inputValue);
      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;
      // 自动获取焦点
      // this.$nextTick((_) => {
      //   this.$refs.saveTagInput.$refs.input.focus();
      // });
    },
    // --------------------------
    //测试表单 --------------------------
    gettagerlist() {
      gettagerlist({ targetname: this.targetname }).then((response) => {
        console.log(response);
        this.optionstag = response.rows;
      });
    },
    addoption() {
      this.testuserList.push({
        userid: 1,
        nickName: "贫血",
        aphonenumber: "(?!不.*|没.*|未.*)^.*([贫平凭血]|贫血|评学|评学),10",
      this.indexform.ivrLibaScriptTargetoptionList.push({
        guid: 1,
        isoperation: 1,
        targetvalue: "",
        targetregex: "",
      });
      this.sortFn();
    },
    deloption() {
      const index = this.testuserList.indexOf(item);
    deloption(item) {
      const index = this.indexform.ivrLibaScriptTargetoptionList.indexOf(item);
      if (index !== -1) {
        this.testuserList.splice(index, 1); // 从索引位置删除一个元素
        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.testuserList, row);
      const item = this.testuserList.splice(index, 1)[0]; // 移除指定索引处的元素,并保存到item变量中
      this.testuserList.splice(index - 1, 0, item); // 将item插入到索引位置的前一位
      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.testuserList, row);
      const item = this.testuserList.splice(index, 1)[0]; // 移除指定索引处的元素,并保存到item变量中
      this.testuserList.splice(index + 1, 0, item); // 将item插入到索引位置的前一位
      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.testuserList = this.testuserList.map((item, index) => {
        return {
          userid: index + 1,
          nickName: item.nickName,
          aphonenumber: item.aphonenumber,
        };
      });
      console.log(this.testuserList);
      this.indexform.ivrLibaScriptTargetoptionList =
        this.indexform.ivrLibaScriptTargetoptionList.map((item, index) => {
          return {
            guid: index + 1,
            targetvalue: item.targetvalue,
            targetregex: item.targetregex,
          };
        });
      console.log(this.indexform.ivrLibaScriptTargetoptionList);
    },
    // ---------------------
    // 查询题库
    handleQuery() {},
    resetQuery() {},
    resetForm(formName) {
      this.$refs[formName].resetFields();
    },
    // 便捷标签
    tsgnameto() {},
    tsgnameto(row) {
      let inputValueArr = "";
      let el = document.querySelector("#" + this.currentInputId);
      //el.selectionStart; 这就是当前光标所在的位置(字符串中字符的index)
      if (this.currentInputId == "questiontext") {
        inputValueArr = this.indexform.questiontext.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 == "questiontext") {
        this.indexform.questiontext = 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>
.Questionnairemanagement {
  display: flex;
  // display: flex;
}
.sidecolumn {
  width: 300px;
  min-height: 100vh;
  text-align: center;
  //   display: flex;
  //   margin-top: 20px;
  margin: 20px;
  margin-bottom: 0;
  padding: 30px;
  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);
}
.leftvlue {
  //   display: flex;
  //   flex: 1;
  width: 80%;
  margin-top: 20px;
  //   margin: 20px;
  margin: 20px;
  padding: 30px;
  background: #ffff;
  border: 1px solid #dcdfe6;