From 3b774a197bd7087ee42999937ccc1e7e048eb1aa Mon Sep 17 00:00:00 2001
From: WXL <1785969728@qq.com>
Date: 星期四, 11 一月 2024 18:03:17 +0800
Subject: [PATCH] 指标完成

---
 src/views/repositoryai/verbaltrick/particulars/index.vue |  174 +++++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 112 insertions(+), 62 deletions(-)

diff --git a/src/views/repositoryai/verbaltrick/particulars/index.vue b/src/views/repositoryai/verbaltrick/particulars/index.vue
index 0d3bd1b..b0a4102 100644
--- a/src/views/repositoryai/verbaltrick/particulars/index.vue
+++ b/src/views/repositoryai/verbaltrick/particulars/index.vue
@@ -44,7 +44,7 @@
                   placeholder="璇烽�夋嫨鐘舵��"
                 >
                   <el-option
-                    v-for="item in qyoptions"
+                    v-for="item in usable"
                     :key="item.value"
                     :label="item.label"
                     :value="item.value"
@@ -136,49 +136,51 @@
             </div>
           </el-form-item>
           <el-form-item label="閫氱煡鍙橀噺" prop="name">
-            <el-row v-for="item in variablelist">
-              <el-col :span="4">
-                <el-input
-                  v-model="item.name"
-                  placeholder="璇疯緭鍏ュ彉閲忓悕"
-                ></el-input>
-              </el-col>
-              <el-col :span="8" :offset="1">
-                <el-input
-                  v-model="item.value"
-                  placeholder="璇疯緭鍏ュ彉閲忓唴瀹�"
-                ></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
-                  v-if="item"
-                  type="danger"
-                  icon="el-icon-delete"
-                  circle
-                  @click="delvariable(item)"
-                ></el-button>
-              </el-col>
-            </el-row>
+            <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="12">
+            <el-col :span="6">
               <el-form-item label="浠呴檺闄㈠尯" prop="region">
                 <el-select
-                  v-model="indexform.courtyard"
+                  v-model="indexform.campus"
                   size="medium"
                   filterable
                   placeholder="璇烽�夋嫨"
                 >
                   <el-option
                     class="indexformaa"
-                    v-for="item in options"
+                    v-for="item in courtyardlist"
                     :key="item.value"
                     :label="item.label"
                     :value="item.value"
@@ -187,7 +189,24 @@
                 </el-select>
               </el-form-item>
             </el-col>
-            <el-col :span="12">
+            <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"
@@ -196,13 +215,14 @@
                   reserve-keyword
                   placeholder="璇疯緭鍏ュ叧閿瘝"
                   :remote-method="remoteMethod"
+                  @change="targetchange"
                   :loading="loading"
                 >
                   <el-option
                     v-for="item in targetlist"
-                    :key="item.targetid"
+                    :key="item.id"
                     :label="item.targetname"
-                    :value="item.targetid"
+                    :value="item.id"
                   >
                   </el-option>
                 </el-select>
@@ -219,7 +239,7 @@
                   class="tsgname"
                   @click="tsgnameto(item)"
                 >
-                  {{ item.name }}
+                  {{ item.variatename }}
                 </div>
               </div>
             </el-col></el-row
@@ -377,8 +397,9 @@
           >
         </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>
       <!-- 鎸囨爣璁剧疆 -->
@@ -518,7 +539,7 @@
         </div>
         <el-button type="primary" @click="laststep()">涓婁竴姝�</el-button>
         <el-button type="info" @click="closeFm()">鍏抽棴</el-button>
-        <el-button @click="Saveproblem()">淇濆瓨鎸囨爣鏁版嵁</el-button>
+        <el-button @click="Saveproblem()">淇濆瓨鏁版嵁</el-button>
       </div>
     </div>
   </div>
@@ -556,7 +577,7 @@
       mode: [],
       questionclass: [],
       currentInputId: "",
-
+      courtyardlist: [],
       // 鎬绘潯鏁�
       total: 1,
 
@@ -576,9 +597,13 @@
           url: "https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100",
         },
       ],
-      qyoptions: [],
+      usable: [],
       options: [],
-      variablelist: [],
+      variablelist: [
+        { variatename: "濮撳悕", variate: "${name}", default: 1 },
+        { variatename: "鐢佃瘽", variate: "${phone}", default: 1 },
+        { variatename: "鐥呮儏", variate: "${illness}", default: 1 },
+      ],
 
       addvalue: "娣诲姞棰樼洰",
       languagelist: [], //璇█鍒楄〃
@@ -601,7 +626,8 @@
     this.mode = store.getters.mode;
     this.valuetype = store.getters.valuetype;
     this.languagelist = store.getters.languagelist;
-    this.qyoptions = store.getters.usable;
+    this.usable = store.getters.usable;
+    this.courtyardlist = store.getters.courtyardlist;
   },
 
   methods: {
@@ -610,20 +636,20 @@
       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.parameter)
-          ? JSON.parse(this.indexform.parameter)
-          : [{ name: "", value: "" }];
+        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 = [
           {
-            targetid: this.indexform.targetid,
+            id: this.indexform.targetid,
             targetname: this.indexform.targetname,
           },
         ];
-        console.log(this.targetlist);
       });
       // 鏍�
       getbaltrickclassify({}).then((res) => {
@@ -634,12 +660,20 @@
 
     // 淇濆瓨璇︾粏淇℃伅
     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;
-        this.indexform.parameter = JSON.stringify(this.variablelist);
         compileverbaltrick(this.indexform).then((res) => {
           if (res.code == 200) {
             this.$modal.msgSuccess("淇敼鎴愬姛");
+            this.$router.go(-1);
+          } else {
+            this.$message({
+              message: "淇敼澶辫触",
+              type: "error",
+            });
           }
         });
       } else {
@@ -647,6 +681,12 @@
         compileverbaltrick(this.indexform).then((res) => {
           if (res.code == 200) {
             this.$modal.msgSuccess("鏂板鎴愬姛");
+            this.$router.go(-1);
+          } else {
+            this.$message({
+              message: "鏂板澶辫触",
+              type: "error",
+            });
           }
         });
       }
@@ -664,6 +704,24 @@
         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() {
@@ -671,14 +729,7 @@
         if (this.indexform.ivrLibaScriptTargetoptionList.length) {
           return this.Editprogress++;
         }
-        gettargetInfo({ targetid: this.indexform.targetid }).then((res) => {
-          this.indexform.isenable = res.rows[0].isenable;
-          this.indexform.targetname = res.rows[0].targetname;
-          res.rows[0].targetoptionList.forEach((item) => {
-            item.isoperation = 1;
-            this.indexform.ivrLibaScriptTargetoptionList.push(item);
-          });
-        });
+
         return this.Editprogress++;
       } else {
         this.$message.warning("璇峰厛閫夋嫨鍏宠仈鎸囨爣");
@@ -779,7 +830,6 @@
     showInput() {
       this.inputVisible = true;
     },
-    // --------------------------
     //娴嬭瘯琛ㄥ崟 --------------------------
     gettagerlist() {
       gettagerlist({ targetname: this.targetname }).then((response) => {
@@ -796,7 +846,7 @@
       });
       this.sortFn();
     },
-    deloption() {
+    deloption(item) {
       const index = this.indexform.ivrLibaScriptTargetoptionList.indexOf(item);
       if (index !== -1) {
         this.indexform.ivrLibaScriptTargetoptionList.splice(index, 1); // 浠庣储寮曚綅缃垹闄や竴涓厓绱�
@@ -870,7 +920,7 @@
       // 鎷垮埌閫変腑鏂囧瓧鐨勯暱搴︼紙鍚庣画鍙互鐢ㄦ潵鏇挎崲閫変腑鐨勬枃瀛楋級
       let selectLength = el.selectionEnd - el.selectionStart;
       // 灏嗚鎻掑叆/鏇挎崲鐨勬枃瀛楁彃鍏�/鏇挎崲锛坴alue.name鏄鎻掑叆/鏇挎崲鐨勫瓧绗︿覆锛�
-      inputValueArr.splice(el.selectionStart, selectLength, `${row.value}`);
+      inputValueArr.splice(el.selectionStart, selectLength, `${row.variate}`);
       // 鎶婃暟缁勯噸鏂拌浆鎹负瀛楃涓插苟璧嬪��
       inputValueArr = inputValueArr.join("");
       console.log(inputValueArr);
@@ -892,8 +942,8 @@
     // 鏂板鍙橀噺
     addvariable() {
       this.variablelist.push({
-        variable: "",
-        value: "",
+        variatename: "",
+        variate: "",
       });
     },
     // 鍒犻櫎鍙橀噺

--
Gitblit v1.9.3