From 49fcdb7178dffc69769e2fb8cb6a03e204cb1e68 Mon Sep 17 00:00:00 2001
From: WXL <1785969728@qq.com>
Date: 星期五, 31 五月 2024 18:26:42 +0800
Subject: [PATCH] 测试完成

---
 src/views/knowledge/questionbank/particulars/index.vue |  244 ++++++++++++++++++++++++++++++------------------
 1 files changed, 153 insertions(+), 91 deletions(-)

diff --git a/src/views/knowledge/questionbank/particulars/index.vue b/src/views/knowledge/questionbank/particulars/index.vue
index ef1020e..cd24643 100644
--- a/src/views/knowledge/questionbank/particulars/index.vue
+++ b/src/views/knowledge/questionbank/particulars/index.vue
@@ -7,11 +7,37 @@
             棰樼洰璁剧疆璇︽儏
             <span style="margin-left: 30px"
               ><el-button type="primary" @click="compileissue"
-                >淇濆瓨</el-button
+                >淇� 瀛�</el-button
+              ></span
+            ><span style="margin-left: 30px"
+              ><el-button type="success" round @click="drawer = true"
+                >+閫夋嫨鎸囨爣</el-button
               ></span
             >
           </div>
           <div style="margin-left: 8%">
+            <el-form-item label="闂鍒嗙被">
+              <el-select
+                v-model="topicobj.categoryid"
+                size="medium"
+                filterable
+                placeholder="璇烽�夋嫨鍒嗙被"
+              >
+                <el-option-group
+                  v-for="group in classifylist"
+                  :key="group.id"
+                  :label="group.name"
+                >
+                  <el-option
+                    v-for="item in group.svyLibTopicCategoryList"
+                    :key="item.id"
+                    :label="item.name"
+                    :value="item.id"
+                  >
+                  </el-option>
+                </el-option-group>
+              </el-select>
+            </el-form-item>
             <el-row :gutter="10">
               <el-col :span="6"
                 ><el-form-item label="棰樼洰鏍囬">
@@ -79,14 +105,14 @@
               <el-col :span="6"
                 ><el-form-item label="棰樼洰绫诲瀷">
                   <el-select
-                    v-model="topicobj.topictype"
+                    v-model="topicobj.valueType"
                     size="medium"
                     filterable
                     placeholder="璇烽�夋嫨鍒嗙被"
                   >
                     <el-option
                       class="topicobjaa"
-                      v-for="item in xjxsoptions"
+                      v-for="item in valuetype"
                       :key="item.value"
                       :label="item.label"
                       :value="item.value"
@@ -116,9 +142,9 @@
               <el-input
                 style="width: 40vw"
                 type="textarea"
-                id="questiontext"
+                id="topicContent"
                 v-model="topicobj.topicContent"
-                @focus="handleInput('questiontext')"
+                @focus="handleInput('topicContent')"
                 placeholder="璇疯緭鍏ユ爣棰�"
               ></el-input>
             </el-form-item>
@@ -209,7 +235,7 @@
                 </div>
               </el-form-item>
             </el-row>
-            <el-form-item label="閫氱煡鍙橀噺" prop="name">
+            <!-- <el-form-item label="閫氱煡鍙橀噺" prop="name">
               <div style="margin-bottom: 5px" v-for="item in variablelist">
                 <el-row>
                   <el-col :span="5">
@@ -256,77 +282,74 @@
                   </div>
                 </div>
               </el-col></el-row
-            >
+            > -->
           </div>
-
-          <div class="headline">
-            閫夐」璁剧疆<span style="margin-left: 30px"
-              ><el-button type="primary" round @click="addoption"
-                >+鏂板</el-button
-              ></span
-            ><span style="margin-left: 30px"
-              ><el-button type="success" round @click="drawer = true"
-                >+閫夋嫨鎸囨爣</el-button
-              ></span
+          <div v-if="topicobj.valueType == 1">
+            <div class="headline">
+              閫夐」璁剧疆<span style="margin-left: 30px"
+                ><el-button type="primary" round @click="addoption"
+                  >+鏂板</el-button
+                ></span
+              >
+            </div>
+            <div
+              class="topicxq"
+              v-for="item in topicobj.svyLibTopicoptions"
+              v-if="item.isoperation != 3"
             >
-          </div>
-          <div
-            class="topicxq"
-            v-for="item in topicobj.svyLibTopicoptions"
-            v-if="item.isoperation != 3"
-          >
-            <el-row :gutter="10">
-              <el-col :span="11"
-                ><el-form-item label="閫夐」">
-                  <el-input
-                    type="text"
-                    placeholder="璇疯緭鍏ラ�夐」"
-                    v-model="item.optioncontent"
-                    show-word-limit
-                  >
-                  </el-input> </el-form-item
-              ></el-col>
-              <el-col :span="11"
-                ><el-form-item label="鍒嗗��">
-                  <el-input
-                    type="text"
-                    placeholder="璇疯緭鍏�"
-                    v-model="item.score"
-                    show-word-limit
-                  >
-                  </el-input> </el-form-item
-              ></el-col>
-              <el-col :span="2">
-                <el-button
-                  type="danger"
-                  icon="el-icon-delete"
-                  circle
-                  @click="deletexuanx(item)"
-                ></el-button>
-              </el-col>
-            </el-row>
+              <el-row :gutter="10">
+                <el-col :span="11"
+                  ><el-form-item label="閫夐」">
+                    <el-input
+                      type="text"
+                      placeholder="璇疯緭鍏ラ�夐」"
+                      v-model="item.optioncontent"
+                      show-word-limit
+                    >
+                    </el-input> </el-form-item
+                ></el-col>
+                <el-col :span="11"
+                  ><el-form-item label="鍒嗗��">
+                    <el-input
+                      type="text"
+                      placeholder="璇疯緭鍏�"
+                      v-model="item.score"
+                      show-word-limit
+                    >
+                    </el-input> </el-form-item
+                ></el-col>
+                <el-col :span="2">
+                  <el-button
+                    type="danger"
+                    icon="el-icon-delete"
+                    circle
+                    @click="deletexuanx(item)"
+                  ></el-button>
+                </el-col>
+              </el-row>
 
-            <el-row :gutter="10">
-              <el-form-item label="閫変腑鎻愮ず">
-                <el-input
-                  style="width: 40vw"
-                  type="textarea"
-                  autosize
-                  placeholder="璇疯緭鍏ュ唴瀹�"
-                  v-model="item.prompt"
-                >
-                </el-input
-              ></el-form-item>
-            </el-row>
+              <el-row :gutter="10">
+                <el-form-item label="閫変腑鎻愮ず">
+                  <el-input
+                    style="width: 40vw"
+                    type="textarea"
+                    autosize
+                    placeholder="璇疯緭鍏ュ唴瀹�"
+                    v-model="item.prompt"
+                  >
+                  </el-input
+                ></el-form-item>
+              </el-row>
+            </div>
           </div>
         </el-form>
       </el-card>
     </div>
     <el-drawer
-      title="娣诲姞棰樼洰"
+      title="娣诲姞閫夐」"
       :visible.sync="drawer"
       custom-class="demo-drawer"
-      width="50%"
+      width="66%"
     >
       <div class="preview-left">
         <el-form
@@ -387,7 +410,7 @@
                 type="text"
                 @click="selectlabel(scope.row)"
                 ><span class="button-textxg"
-                  ><i class="el-icon-circle-plus-outline"></i>娣诲姞</span
+                  ><i class="el-icon-circle-plus-outline"></i>閫夋嫨</span
                 ></el-button
               >
             </template>
@@ -415,6 +438,7 @@
   compileissue,
   delissueinfo,
   Followupinfo,
+  getissueclassify,
   deltargetillness,
   addtargetillness,
   getillnesslist,
@@ -467,9 +491,9 @@
       optionsillness: [],
       illnesslistapi: [],
       illnesslist: [],
-
+      classifylist: [],
       optionstag: [],
-      xjxsoptions: [],
+      valuetype: [],
       usable: [],
       mode: [], //鏂瑰紡
     };
@@ -482,18 +506,38 @@
     this.mode = store.getters.mode;
     this.languagelist = store.getters.languagelist;
     this.usable = store.getters.usable;
-    this.xjxsoptions = store.getters.xjxsoptions;
+    this.valuetype = store.getters.valuetype;
     this.required = store.getters.required;
   },
 
   methods: {
+    // 鍏叡鏂规硶---------------
     getIndexInArray(arr, obj) {
       return arr.indexOf(obj);
     },
-
+    // 閫掑綊鎵佸钩鍖�
+    flattenArray(arr) {
+      let result = [];
+      arr.forEach((item) => {
+        result.push(item);
+        if (item.svyLibTopicCategoryList) {
+          console.log(2);
+          result = result.concat(
+            this.flattenArray(item.svyLibTopicCategoryList)
+          );
+          delete item.svyLibTopicCategoryList;
+        }
+      });
+      return result;
+    },
+    // -----------------------------
     // 鑾峰彇鏁版嵁
     getissueinfo() {
       this.id = this.$route.query.id;
+      // 鍒嗙被
+      getissueclassify({}).then((res) => {
+        this.classifylist = res.rows;
+      });
       if (!this.id) {
         return;
       }
@@ -513,6 +557,7 @@
       getillness({ outid: this.id, type: 4 }).then((res) => {
         this.illnesslist = res.rows;
       });
+      
     },
     gettargetInfo() {
       gettargetInfo(this.queryParams).then((res) => {
@@ -592,13 +637,29 @@
     },
     // 閫夋嫨鎸囨爣
     selectlabel(row) {
-      const labellist = row.targetoptionList;
-      labellist.forEach((item) => {
-        this.topicobj.svyLibTopicoptions.push({
-          optioncontent: item.targetvalue,
-          isoperation: 1,
-        });
-      });
+      this.$modal
+        .confirm(
+          '鏄惁閫夋嫨鏍囬涓�"' + row.targetname + '"鐨勬寚鏍囧苟鏇挎崲濉厖闂淇℃伅锛�'
+        )
+        .then(() => {
+          console.log(row);
+          console.log(this.topicobj);
+          this.topicobj.topic = row.targetname;
+          this.topicobj.valueType = row.valueType;
+          this.topicobj.topicContent = row.targetdesc;
+          this.topicobj.isavailable = "0";
+          this.topicobj.language = "鏅�氳瘽";
+          this.topicobj.svyLibTopicoptions = [];
+          const labellist = row.targetoptionList;
+          labellist.forEach((item) => {
+            this.topicobj.svyLibTopicoptions.push({
+              optioncontent: item.targetvalue,
+              isoperation: 1,
+            });
+          });
+          this.drawer = false;
+        })
+        .catch(() => {});
     },
 
     // 鏍囩-----------------
@@ -720,16 +781,17 @@
       let inputValueArr = "";
       let el = document.querySelector("#" + this.currentInputId);
       //el.selectionStart; 杩欏氨鏄綋鍓嶅厜鏍囨墍鍦ㄧ殑浣嶇疆锛堝瓧绗︿覆涓瓧绗︾殑index锛�
-      if (this.currentInputId == "questiontext") {
-        inputValueArr = this.indexform.questiontext.split("");
+      if (this.currentInputId == "topicContent") {
+        inputValueArr = this.topicobj.topicContent.split("");
+        console.log(123);
       } else if (this.currentInputId == "nomatchtext") {
-        inputValueArr = this.indexform.nomatchtext.split("");
+        inputValueArr = this.topicobj.nomatchtext.split("");
       } else if (this.currentInputId == "sliencetext") {
-        inputValueArr = this.indexform.sliencetext.split("");
+        inputValueArr = this.topicobj.sliencetext.split("");
       } else if (this.currentInputId == "noclearlytext") {
-        inputValueArr = this.indexform.noclearlytext.split("");
+        inputValueArr = this.topicobj.noclearlytext.split("");
       } else if (this.currentInputId == "submoduletext") {
-        inputValueArr = this.indexform.submoduletext.split("");
+        inputValueArr = this.topicobj.submoduletext.split("");
       } else {
         return;
       }
@@ -742,16 +804,16 @@
       // 鎶婃暟缁勯噸鏂拌浆鎹负瀛楃涓插苟璧嬪��
       inputValueArr = inputValueArr.join("");
       console.log(inputValueArr);
-      if (this.currentInputId == "questiontext") {
-        this.indexform.questiontext = inputValueArr;
+      if (this.currentInputId == "topicContent") {
+        this.topicobj.topicContent = inputValueArr;
       } else if (this.currentInputId == "nomatchtext") {
-        this.indexform.nomatchtext = inputValueArr;
+        this.topicobj.nomatchtext = inputValueArr;
       } else if (this.currentInputId == "sliencetext") {
-        this.indexform.sliencetext = inputValueArr;
+        this.topicobj.sliencetext = inputValueArr;
       } else if (this.currentInputId == "noclearlytext") {
-        this.indexform.noclearlytext = inputValueArr;
+        this.topicobj.noclearlytext = inputValueArr;
       } else if (this.currentInputId == "submoduletext") {
-        this.indexform.submoduletext = inputValueArr;
+        this.topicobj.submoduletext = inputValueArr;
       } else {
         return;
       }

--
Gitblit v1.9.3