From 58c0f11fe2f23a1be2dec768f9ac02107301a634 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期五, 19 九月 2025 17:30:36 +0800
Subject: [PATCH] 2025.9.19 数据产品(待完成)

---
 src/views/fysp/data-product/ProdLawEnforceList.vue |  287 +++++++++++++++++++++++++-------------------------------
 1 files changed, 128 insertions(+), 159 deletions(-)

diff --git a/src/views/fysp/data-product/ProdLawEnforceList.vue b/src/views/fysp/data-product/ProdLawEnforceList.vue
index 99d1b0f..caed506 100644
--- a/src/views/fysp/data-product/ProdLawEnforceList.vue
+++ b/src/views/fysp/data-product/ProdLawEnforceList.vue
@@ -1,12 +1,13 @@
 <template>
   <FYTable
+    id="fyTable"
     @search="onSearch"
+    :data="tableData"
     :pagination="false"
     ref="tableRef"
     @cell-click="cellClick"
     :cell-class-name="cellClassName"
     @table-paste="handlePaste"
-    @sort-change="handleSortChange"
   >
     <template #options>
       <!-- 鍖哄幙 -->
@@ -34,18 +35,33 @@
       <el-form :inline="true">
         <CompQuickSet @quick-set="setOptions"></CompQuickSet>
       </el-form>
-      <el-descriptions v-if="this.tableData.length > 0" title="" :column="1" direction="vertical" border>
+      <el-descriptions
+        v-if="this.tableData.length > 0"
+        title=""
+        :column="1"
+        direction="vertical"
+        border
+      >
         <el-descriptions-item label="鑱斿悎鎵ф硶娓呭崟">
           {{ listSummary }}
         </el-descriptions-item>
       </el-descriptions>
     </template>
-
+    <template #buttons>
+      <FYDownloadTableButton
+        label="涓嬭浇娓呭崟"
+        table-id="fyTable"
+        :file-name="fileName"
+        :disabled="downloadDisabled"
+      ></FYDownloadTableButton>
+    </template>
     <template #table-column="{ size }">
-      <el-table-column fixed="left" label="搴忓彿" width="80">
+      <el-table-column fixed="left" label="搴忓彿" width="53">
         <template #default="{ row }">
           {{ row.index + 1 }}
         </template>
+      </el-table-column>
+      <el-table-column fixed="left" label="缂栧彿" width="53" prop="sceneIndex">
       </el-table-column>
       <el-table-column
         prop="sceneName"
@@ -53,6 +69,19 @@
         label="鍚嶇О"
         width="300"
       >
+      </el-table-column>
+      <el-table-column prop="evaluation.scenseaddress" label="鍦板潃" />
+      <el-table-column prop="_problems" label="闂" width="300">
+        <template #default="{ row }">
+          <el-icon class="is-loading" v-if="row._loading">
+            <Loading color="#409eff" />
+          </el-icon>
+          <template v-else-if="row._problems.length > 0">
+            <template v-for="(p, i) in row._problems" :key="p.guid">
+              <br v-if="i > 0" />{{ i + 1 + '銆�' + p.problemname }}
+            </template>
+          </template>
+        </template>
       </el-table-column>
       <!-- <el-table-column
           prop="subTaskTime"
@@ -65,8 +94,15 @@
         prop="evaluation.resultscorebef"
         label="寰楀垎"
         width="90"
-        sortable="custom"
       /> -->
+      <el-table-column prop="" label="鐩戞祴鏁版嵁" width="81">
+        <template #default="{ row }">
+          <el-icon class="is-loading" v-if="row._loading">
+            <Loading color="#409eff" />
+          </el-icon>
+          <el-text v-else>/</el-text>
+        </template>
+      </el-table-column>
       <!-- <el-table-column
           prop="evaluation.resultscorebef"
           label="鐜俊鐮�"
@@ -80,14 +116,23 @@
         </el-table-column> -->
 
       <el-table-column prop="dname" label="鍖哄幙" width="90" />
-      <el-table-column
-        prop="tname"
-        label="琛楅亾"
-        width="110"
-        :filters="townFilters"
-        :filter-method="filterHandler"
-      />
-      <el-table-column prop="evaluation.scenseaddress" label="鍦板潃" />
+      <el-table-column prop="tname" label="琛楅亾" width="110" />
+      <el-table-column prop="_contacts" label="鑱旂郴浜�" width="70">
+        <template #default="{ row }">
+          <el-icon class="is-loading" v-if="row._loading2">
+            <Loading color="#409eff" />
+          </el-icon>
+          <el-text v-else>{{ row._contacts }}</el-text>
+        </template>
+      </el-table-column>
+      <el-table-column prop="_contactst" label="鑱旂郴鐢佃瘽" width="112">
+        <template #default="{ row }">
+          <el-icon class="is-loading" v-if="row._loading2">
+            <Loading color="#409eff" />
+          </el-icon>
+          <el-text v-else>{{ row._contactst }}</el-text>
+        </template>
+      </el-table-column>
       <!-- <el-table-column prop="biArea" label="闆嗕腑鍖�" width="110" />
         <el-table-column prop="biManagementCompany" label="鐗╀笟" min-width="110"/> -->
       <!-- <el-table-column fixed="right" align="right" label="鎿嶄綔" width="160">
@@ -107,10 +152,10 @@
  */
 import dayjs from 'dayjs';
 import evaluateApi from '@/api/fysp/evaluateApi';
+import problemApi from '@/api/fysp/problemApi';
+import sceneApi from '@/api/fysp/sceneApi';
 import { envCreditCode } from '@/constants/index';
 import { useTablePaste } from '@/composables/tablePaste';
-import { useCloned } from '@vueuse/core';
-import { useMessageBoxTip } from '@/composables/messageBox';
 
 export default {
   setup() {
@@ -144,20 +189,7 @@
       townFilters: [],
       // 鍘熷鏁版嵁锛岀敤浜庢帓搴忓彇娑堝悗
       orginData: [],
-      evaluationRule: undefined,
-      evaluationSubRule: undefined,
-      //鐩戞祴鏁版嵁瑙勫垯鍚嶇О
-      ruleName: {
-        score1: {
-          id: undefined,
-          name: '鐩戞祴鏁版嵁鍑虹幇鍗曟棩鍙婁互涓婃湁鏁堣秴鏍�'
-        },
-        score2: {
-          id: undefined,
-          name: '鐩戞祴鏁版嵁鏈堝潎鍊艰秴鍖哄煙鏈堝潎鍊�20%浠ヤ笂鎴栨暟鎹槑鏄惧紓甯�'
-        }
-      },
-      updateLoading: false
+      dlLoading: false
     };
   },
   computed: {
@@ -185,22 +217,26 @@
       } else {
         return ``;
       }
+    },
+    downloadDisabled() {
+      if (this.tableData.length == 0) {
+        return true;
+      } else {
+        let b = false;
+        this.tableData.forEach((e) => {
+          b = b || e._loading || e._loading2;
+        });
+        return b;
+      }
+    },
+    fileName() {
+      const { locations, scenetype, time } = this.formSearch;
+      return `${locations.dName}${dayjs(time).format(
+        'YYYY骞碝M鏈�'
+      )}鑱斿悎鎵ф硶娓呭崟`;
     }
   },
   methods: {
-    // _getParam() {
-    //   const { locations, scenetype, time } = this.formSearch;
-    //   return {
-    //     provincecode: locations.pCode,
-    //     provincename: locations.pName,
-    //     citycode: locations.cCode,
-    //     cityname: locations.cName,
-    //     districtcode: locations.dCode,
-    //     districtname: locations.dName,
-    //     starttime: dayjs(time).format('YYYY-MM-DD HH:mm:ss'),
-    //     scensetypeid: scenetype.value
-    //   };
-    // },
     editRow(row) {
       this.$router.push(`evalutationEdit/${row.subTaskId}`);
     },
@@ -212,78 +248,60 @@
     },
     onSearch(page, func) {
       this.$refs.tableRef.clearSort();
-      this.fetchEvaluationRule(this.area).then(() => {
-        evaluateApi.fetchAutoEvaluation(this.area).then((res) => {
-          if (res.data) {
-            this.tableData = res.data
-              .filter((d) => {
-                return d.evaluation != null;
+      // this.fetchEvaluationRule(this.area).then(() => {
+      evaluateApi.fetchAutoEvaluation(this.area).then((res) => {
+        if (res.data) {
+          res.data.sort((a, b) => {
+            const s1 = a.evaluation ? parseInt(a.evaluation.resultscorebef) : 0;
+            const s2 = b.evaluation ? parseInt(b.evaluation.resultscorebef) : 0;
+            return s1 - s2;
+          });
+          this.tableData = res.data
+            .filter((d) => {
+              return (
+                d.evaluation != null &&
+                parseInt(d.evaluation.resultscorebef) < 90
+              );
+            })
+            .slice(0, 10);
+          this.tableData.forEach((e) => {
+            e._loading = true;
+            problemApi
+              .getProBySubtask(e.subTaskId)
+              .then((res) => {
+                e._problems = res;
               })
-              .slice(0, 10);
-            this.tableData.sort((a, b) => {
-              const s1 = a.evaluation
-                ? parseInt(a.evaluation.resultscorebef)
-                : 0;
-              const s2 = b.evaluation
-                ? parseInt(b.evaluation.resultscorebef)
-                : 0;
-              return s1 - s2;
-            });
-            this.orginData = useCloned(this.tableData).cloned;
-            this.getFilters(res.data);
-            if (typeof func === 'function') {
-              func({ data: this.tableData });
-            }
-          } else {
-            this.tableData = [];
-            this.orginData = [];
-            if (typeof func === 'function') {
-              func({ data: this.tableData });
-            }
-          }
-        });
-      });
-    },
-    fetchEvaluationRule() {
-      const param = {
-        // 鑷姩璇勪及绫诲瀷
-        taskTypeId: 99,
-        ...this.area
-      };
-      // 鑾峰彇璇勪及鎬昏鍒�
-      return evaluateApi.fetchEvaluationRule(param).then((res) => {
-        if (res.data.length > 0) {
-          this.evaluationRule = res.data[0];
-          // 鑾峰彇鍏蜂綋瀛愯鍒�
-          return evaluateApi
-            .getSubRules(this.evaluationRule.guid)
-            .then((res) => {
-              this.evaluationSubRule = res.data;
-              // 鏌ユ壘鍙鍏ュ緱鍒嗙殑瑙勫垯id
-              for (const key in this.ruleName) {
-                const value = this.ruleName[key];
-                const subrule = this.evaluationSubRule.find((v) => {
-                  return v.itemname == value.name;
-                });
-                if (subrule) {
-                  value.id = subrule.guid;
-                }
-              }
-            });
-        }
-      });
-    },
+              .finally(() => {
+                e._loading = false;
+              });
 
-    getFilters(data) {
-      const townList = [];
-      data.forEach((e) => {
-        if (townList.indexOf(e.tname) == -1) {
-          townList.push(e.tname);
+            e._loading2 = true;
+            sceneApi
+              .getSceneDetail(e.sceneId)
+              .then((res) => {
+                //鍦烘櫙
+                if (res.data.scense) {
+                  e._contacts = res.data.scense.contacts;
+                  e._contactst = res.data.scense.contactst;
+                }
+              })
+              .finally(() => {
+                e._loading2 = false;
+              });
+          });
+          // this.orginData = useCloned(this.tableData).cloned;
+          if (typeof func === 'function') {
+            func();
+          }
+        } else {
+          this.tableData = [];
+          // this.orginData = [];
+          if (typeof func === 'function') {
+            func();
+          }
         }
       });
-      this.townFilters = townList.map((v) => {
-        return { text: v, value: v };
-      });
+      // });
     },
     toCode(row, column) {
       if (row.evaluation) {
@@ -303,55 +321,6 @@
     filterHandler(value, row, column) {
       const property = column['property'];
       return row[property] === value;
-    },
-    sortScore(a, b) {
-      const s1 = a.evaluation ? parseInt(a.evaluation.resultscorebef) : 0;
-      const s2 = b.evaluation ? parseInt(b.evaluation.resultscorebef) : 0;
-      return s1 - s2;
-    },
-    handleSortChange({ column, prop, order }) {
-      console.log(column, prop, order);
-      if (order == null) {
-        this.orginData.forEach((e, i) => {
-          this.tableData[i] = e;
-        });
-      } else if (prop == 'evaluation.resultscorebef') {
-        this.tableData.sort((a, b) => {
-          const s1 = a.evaluation ? parseInt(a.evaluation.resultscorebef) : 0;
-          const s2 = b.evaluation ? parseInt(b.evaluation.resultscorebef) : 0;
-          if (order == 'ascending') {
-            return s1 - s2;
-          } else if (order == 'descending') {
-            return s2 - s1;
-          }
-        });
-      } else if (prop == 'sceneIndex') {
-        this.tableData.sort((a, b) => {
-          if (order == 'ascending') {
-            if (a.sceneIndex === b.sceneIndex) {
-              return a.subTaskTime > b.subTaskTime ? 1 : -1;
-            } else {
-              return a.sceneIndex - b.sceneIndex;
-            }
-          } else if (order == 'descending') {
-            if (a.sceneIndex === b.sceneIndex) {
-              return b.subTaskTime > a.subTaskTime ? 1 : -1;
-            } else {
-              return b.sceneIndex - a.sceneIndex;
-            }
-          }
-        });
-      } else if (prop == 'subTaskTime') {
-        this.tableData.sort((a, b) => {
-          if (order == 'ascending') {
-            return a[prop] > b[prop] ? 1 : -1;
-            // return dayjs(a).isAfter(dayjs(b)) ? 1 : -1;
-          } else if (order == 'descending') {
-            return b[prop] > a[prop] ? 1 : -1;
-            // return dayjs(b).isAfter(dayjs(a)) ? 1 : -1;
-          }
-        });
-      }
     }
   },
   mounted() {

--
Gitblit v1.9.3