From 925905688e73095517b339c89465212b1a04c259 Mon Sep 17 00:00:00 2001
From: WXL <1785969728@qq.com>
Date: 星期五, 21 三月 2025 15:24:12 +0800
Subject: [PATCH] 测试完成

---
 src/views/sfstatistics/analyse/index.vue |   60 +++++++++++++++++++++---------
 vue.config.js                            |    4 +-
 2 files changed, 44 insertions(+), 20 deletions(-)

diff --git a/src/views/sfstatistics/analyse/index.vue b/src/views/sfstatistics/analyse/index.vue
index 7356406..601d735 100644
--- a/src/views/sfstatistics/analyse/index.vue
+++ b/src/views/sfstatistics/analyse/index.vue
@@ -3,21 +3,22 @@
     <div class="analysis-top">
       <div class="title-top">鏌ヨ鏉′欢</div>
       <div class="value">
-        <el-form ref="form" :model="form" label-width="120px">
+        <el-form ref="form" :model="queryParams" label-width="120px">
           <el-form-item label="閫夋嫨鎸囨爣鍚嶇О">
             <el-select
               remote
               :remote-method="remoteMethod"
               default-first-option
-              v-model="value"
+              v-model="targetvalue"
+              @change="Labelstatistics"
               filterable
               placeholder="璇烽�夋嫨"
             >
               <el-option
-                v-for="item in options"
-                :key="item.value"
-                :label="item.label"
-                :value="item.value"
+                v-for="item in targetList"
+                :key="item.id"
+                :label="item.targetname"
+                :value="item.id"
               >
               </el-option>
             </el-select>
@@ -27,7 +28,7 @@
     </div>
     <div class="formindex">
       <el-table
-      v-loading="loading"
+        v-loading="loading"
         :data="tableData"
         :span-method="objectSpanMethod"
         border
@@ -36,12 +37,14 @@
         style="width: 100%"
       >
         <el-table-column prop="targetname" label="鎸囨爣鍚嶇О"> </el-table-column>
-        <el-table-column prop="targetShowCount" label="鎸囨爣鍑虹幇娆℃暟"> </el-table-column>
+        <el-table-column prop="targetShowCount" label="鎸囨爣鍑虹幇娆℃暟">
+        </el-table-column>
         <el-table-column prop="matchedtext" label="鍗曢」鍚嶇О"> </el-table-column>
         <el-table-column prop="count" label="鍗曢」閫変腑娆℃暟"> </el-table-column>
         <el-table-column prop="percentage" label="鍗犳瘮">
           <template slot-scope="scope">
-            <span>{{ (Number(scope.row.percentage)*100).toFixed(2) }}%</span>            </template>
+            <span>{{ (Number(scope.row.percentage) * 100).toFixed(2) }}%</span>
+          </template>
         </el-table-column>
       </el-table>
     </div>
@@ -54,7 +57,7 @@
   name: "indexanalysis",
   data() {
     return {
-      options: [
+      targetList: [
         {
           value: "閫夐」1",
           label: "鍙戠儹鏈夋棤",
@@ -91,9 +94,11 @@
           proportion: "0",
         },
       ],
+      targetvalue: "",
       queryParams: {
         pageNum: 1,
         pageSize: 66,
+        scriptType: "1",
       },
     };
   },
@@ -107,12 +112,30 @@
       this.loading = true;
       gettargetInfo(this.queryParams).then((res) => {
         this.targetList = res.rows;
-        this.Labelstatistics(res.rows[0].id)
+        this.Labelstatistics(res.rows[0].id);
       });
     },
-    Labelstatistics(id){
+    Labelstatistics(id) {
+      console.log(id, "id");
+
       Labelstatistics(id).then((res) => {
-        this.tableData = res.data;
+        if (res.data.length > 0) {
+          this.tableData = res.data;
+        } else {
+          gettargetInfo({ id: id }).then((res) => {
+            console.log(res, "鏇挎崲灞曠ず鍊�");
+            this.tableData = [];
+            res.rows[0].targetoptionList.forEach((item) => {
+              this.tableData.push({
+                targetname: res.rows[0].targetname,
+                targetShowCount:0,
+                count:0,
+                percentage:0,
+                matchedtext:item.targetvalue,
+              });
+            });
+          });
+        }
         this.loading = false;
       });
     },
@@ -120,12 +143,13 @@
       const illnessqueryParams = {
         pageNum: 1,
         pageSize: 66,
-        tagname: value,
+        targetname: value,
+        scriptType: "1",
       };
       setTimeout(() => {
-        gettargetInfo(this.illnessqueryParams).then((res) => {
-        this.targetList = res.rows;
-      });
+        gettargetInfo(illnessqueryParams).then((res) => {
+          this.targetList = res.rows;
+        });
       }, 200);
     },
     objectSpanMethod({ row, column, rowIndex, columnIndex }) {
@@ -160,7 +184,7 @@
               return prev;
             }
           }, 0);
-          sums[index] = `${total*100}%`; // 鐩存帴娣诲姞鐧惧垎鍙�
+          sums[index] = `${total * 100}%`; // 鐩存帴娣诲姞鐧惧垎鍙�
         } else if (column.property === "targetShowCount") {
           sums[index] = data[0].targetShowCount + " 娆�"; // 涓烘鏁扮浉鍏冲垪娣诲姞鍗曚綅
         } else {
diff --git a/vue.config.js b/vue.config.js
index 61507eb..a9d70d9 100644
--- a/vue.config.js
+++ b/vue.config.js
@@ -36,9 +36,9 @@
       // detail: https://cli.vuejs.org/config/#devserver-proxy
       [process.env.VUE_APP_BASE_API]: {
         // target: `http://192.168.168.60:8095`,
-        // target: `http://192.168.144.34:8095`,
+        target: `http://192.168.144.34:8095`,
         // target: `http://192.168.100.121:8095`,
-        target:`http://localhost:8095`,
+        // target:`http://localhost:8095`,
         // target: `http://192.168.101.135:8095`,
         // target: `http://192.168.101.166:8093`,
         // target: `http://192.168.191.181:8095`,

--
Gitblit v1.9.3