From c37f0db24bcb9c08c11da9cd96e562a84cd66e6a Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期四, 14 十二月 2023 17:39:50 +0800
Subject: [PATCH] 评估管理模块完成历史记录展示

---
 src/components/search-option/FYOptionTime.vue              |    3 
 src/views/fysp/evaluation/ResultManage.vue                 |  108 +++++++++++++++--
 src/composables/formConfirm.js                             |    2 
 src/components/form/FYForm.vue                             |    1 
 src/api/fysp/evaluateApi.js                                |   11 +
 src/components/search-option/FYOptionLocation.vue          |    5 
 src/components/table/FYTable.vue                           |   55 +++++---
 src/components/search-option/FYOptionOnlineStatus.vue      |    1 
 src/components/search-option/FYOptionUserType.vue          |    1 
 src/api/index.js                                           |    2 
 src/views/fysp/evaluation/components/CompPreCheck.vue      |   21 ++-
 src/views/fysp/evaluation/components/CompQuickSet.vue      |   94 +++++++++++++++
 src/views/fysp/evaluation/components/CompHistoryRecord.vue |   10 +
 src/components/search-option/FYOptionScene.vue             |    1 
 14 files changed, 264 insertions(+), 51 deletions(-)

diff --git a/src/api/fysp/evaluateApi.js b/src/api/fysp/evaluateApi.js
new file mode 100644
index 0000000..5a54955
--- /dev/null
+++ b/src/api/fysp/evaluateApi.js
@@ -0,0 +1,11 @@
+import { $fysp } from '../index';
+
+export default {
+
+  /**
+   * 鑾峰彇鑷姩璇勪及鍘嗗彶璁板綍
+   */
+  fetchAutoEvaluation(param){
+    return $fysp.post(`evaluation/auto/record`, param).then((res) => res.data);
+  }
+};
diff --git a/src/api/index.js b/src/api/index.js
index f21aba3..1d6e329 100644
--- a/src/api/index.js
+++ b/src/api/index.js
@@ -9,7 +9,7 @@
 let ip2_file = 'https://fyami.com.cn/';
 
 if (debug) {
-  // ip1 = 'http://192.168.0.123:8082/';
+  ip1 = 'http://192.168.0.138:8082/';
   // ip1_file = 'http://47.100.191.150:9005/';
   ip2 = 'http://192.168.0.138:8080/';
   // ip2_file = 'https://fyami.com.cn/';
diff --git a/src/components/form/FYForm.vue b/src/components/form/FYForm.vue
index 7509183..0d68089 100644
--- a/src/components/form/FYForm.vue
+++ b/src/components/form/FYForm.vue
@@ -1,4 +1,3 @@
-<!-- 鍦烘櫙鍩烘湰淇℃伅缂栬緫 -->
 <template>
   <el-form
     :inline="false"
diff --git a/src/components/search-option/FYOptionLocation.vue b/src/components/search-option/FYOptionLocation.vue
index 98db772..34c47c0 100644
--- a/src/components/search-option/FYOptionLocation.vue
+++ b/src/components/search-option/FYOptionLocation.vue
@@ -82,12 +82,13 @@
         }
         if (nVal != oVal) {
           if (nVal || nVal.length > 0) {
-            this.selectedOptions = this.optionFormatReverse(nVal);
+            this.selectedOptions = this.optionFormatReverse(nVal)
           }
         }
       },
       deep: true,
-    },
+      immediate: true
+    }
   },
   methods: {
     /**
diff --git a/src/components/search-option/FYOptionOnlineStatus.vue b/src/components/search-option/FYOptionOnlineStatus.vue
index dacbd38..3d245b1 100644
--- a/src/components/search-option/FYOptionOnlineStatus.vue
+++ b/src/components/search-option/FYOptionOnlineStatus.vue
@@ -56,6 +56,7 @@
         }
       },
       deep: true,
+      immediate: true
     },
   },
   mounted() {
diff --git a/src/components/search-option/FYOptionScene.vue b/src/components/search-option/FYOptionScene.vue
index 436ccdf..437b2b3 100644
--- a/src/components/search-option/FYOptionScene.vue
+++ b/src/components/search-option/FYOptionScene.vue
@@ -61,6 +61,7 @@
         }
       },
       deep: true,
+      immediate: true
     },
   },
   mounted() {
diff --git a/src/components/search-option/FYOptionTime.vue b/src/components/search-option/FYOptionTime.vue
index fdea90c..9a6ba6f 100644
--- a/src/components/search-option/FYOptionTime.vue
+++ b/src/components/search-option/FYOptionTime.vue
@@ -47,7 +47,8 @@
         if (nVal != oVal) {
           this.selectedOptions = nVal
         }
-      }
+      },
+      immediate: true
     }
   },
   methods: {
diff --git a/src/components/search-option/FYOptionUserType.vue b/src/components/search-option/FYOptionUserType.vue
index 164c672..bda5045 100644
--- a/src/components/search-option/FYOptionUserType.vue
+++ b/src/components/search-option/FYOptionUserType.vue
@@ -56,6 +56,7 @@
         }
       },
       deep: true,
+      immediate: true
     },
   },
   mounted() {
diff --git a/src/components/table/FYTable.vue b/src/components/table/FYTable.vue
index d87d4c8..0e6e982 100644
--- a/src/components/table/FYTable.vue
+++ b/src/components/table/FYTable.vue
@@ -6,7 +6,9 @@
       </template>
     </FYSearchBar>
   </el-row>
-
+  <el-row ref="expandRef">
+    <slot name="options-expand"></slot>
+  </el-row>
   <el-table
     :data="tableData"
     v-loading="loading"
@@ -18,6 +20,7 @@
   </el-table>
 
   <el-pagination
+    v-if="pagination"
     ref="paginationRef"
     class="el-pagination"
     v-model:current-page="currentPage"
@@ -41,6 +44,10 @@
 export default {
   props: {
     rowClassName: undefined,
+    pagination: {
+      type: Boolean,
+      default: true
+    }
   },
   data() {
     return {
@@ -49,21 +56,21 @@
       total: 0,
       currentPage: 1,
       pageSize: 20,
-      loading: false,
-    };
+      loading: false
+    }
   },
   emits: ['search'],
   watch: {
     currentPage(nValue, oValue) {
       if (nValue != oValue) {
-        this.onSearch();
+        this.onSearch()
       }
     },
     pageSize(nValue, oValue) {
       if (nValue != oValue) {
-        this.onSearch();
+        this.onSearch()
       }
-    },
+    }
   },
   methods: {
     /**
@@ -72,43 +79,45 @@
      * 鍥炶皟鍑芥暟鎺ユ敹涓�涓璞★紝鍖呮嫭琛ㄦ牸鏁版嵁鏁扮粍data鍜屾暟鎹�绘暟total
      */
     onSearch() {
-      this.loading = true;
+      this.loading = true
       this.$emit(
         'search',
         {
           currentPage: this.currentPage,
-          pageSize: this.pageSize,
+          pageSize: this.pageSize
         },
         (res) => {
-          this.tableData = res.data;
-          this.total = res.total;
-          this.loading = false;
+          this.tableData = res.data
+          this.total = res.total ? res.total : 0
+          this.loading = false
         }
-      );
+      )
     },
     calcTableHeight() {
-      const h1 = this.$refs.searchRef.$el.offsetHeight;
-      const h2 = this.$refs.paginationRef.$el.offsetHeight;
+      const h1 = this.$refs.searchRef.$el.offsetHeight
+      const h2 = this.$refs.paginationRef ? this.$refs.paginationRef.$el.offsetHeight : 0
+      const h3 = this.$refs.expandRef.$el.offsetHeight
+      const h = h1 + h2 + h3
       // return `calc(100vh - ${h1}px - ${h2}px - var(--el-main-padding) * 2 - var(--el-header-height))`;
-      return `calc(100vh - ${h1}px - ${h2}px - 60px - var(--el-main-padding) * 2)`;
+      return `calc(100vh - ${h}px - 60px - var(--el-main-padding) * 2)`
     },
     tableRowClassName({ row }) {
       if (this.rowClassName) {
         if (typeof this.rowClassName == 'string') {
-          return this.rowClassName;
+          return this.rowClassName
         } else if (typeof this.rowClassName == 'function') {
-          return this.rowClassName({ row });
+          return this.rowClassName({ row })
         }
       } else {
-        return row.extension1 != '0' ? 'online-row' : 'offline-row';
+        return row.extension1 != '0' ? 'online-row' : 'offline-row'
       }
-    },
+    }
   },
   mounted() {
-    this.tableHeight = this.calcTableHeight();
-    this.onSearch();
-  },
-};
+    this.tableHeight = this.calcTableHeight()
+    this.onSearch()
+  }
+}
 </script>
 
 <style>
diff --git a/src/composables/formConfirm.js b/src/composables/formConfirm.js
index 306b125..3b4d80c 100644
--- a/src/composables/formConfirm.js
+++ b/src/composables/formConfirm.js
@@ -1,8 +1,8 @@
-// 琛ㄥ崟鐨勭‘璁ゅ拰鍙栨秷
 import { onActivated, onDeactivated, ref, watch } from 'vue';
 import { useCloned } from '@vueuse/core';
 import { useMessageBoxTip, useMessageBox } from './messageBox';
 
+// 琛ㄥ崟鐨勭‘璁ゅ拰鍙栨秷
 export function useFormConfirm({
   defaultForm = undefined,
   submit = {
diff --git a/src/views/fysp/evaluation/ResultManage.vue b/src/views/fysp/evaluation/ResultManage.vue
index 864aab2..0a3a198 100644
--- a/src/views/fysp/evaluation/ResultManage.vue
+++ b/src/views/fysp/evaluation/ResultManage.vue
@@ -1,24 +1,102 @@
 <template>
-  <CompPreCheck @pre-check="autoEvaluate"></CompPreCheck>
+  <!-- <CompPreCheck @pre-check="autoEvaluate"></CompPreCheck> -->
+
+  <FYTable @search="onSearch" :pagination="false">
+    <template #options>
+      <!-- 鍖哄幙 -->
+      <FYOptionLocation
+        :allOption="false"
+        :level="3"
+        :checkStrictly="false"
+        v-model:value="formSearch.locations"
+      ></FYOptionLocation>
+      <!-- 鍦烘櫙绫诲瀷 -->
+      <FYOptionScene
+        :allOption="false"
+        :type="2"
+        v-model:value="formSearch.scenetype"
+      ></FYOptionScene>
+      <!-- 鏃堕棿 -->
+      <FYOptionTime :initValue="false" type="month" v-model:value="formSearch.time"></FYOptionTime>
+    </template>
+
+    <template #options-expand>
+      <CompQuickSet @quick-set="setOptions"></CompQuickSet>
+    </template>
+
+    <template #table-column>
+      <el-table-column
+        type="index"
+        fixed="left"
+        prop="sceneName"
+        label="鍚嶇О"
+        width="400"
+      >
+        <template #default="{row}">
+          <el-tooltip
+            effect="dark"
+            :content="row.sceneName"
+            placement="top-start"
+            :show-after="500"
+          >
+            {{ row.sceneName }}
+          </el-tooltip>
+        </template>
+      </el-table-column>
+      
+      <el-table-column prop="dname" label="鍖哄幙" width="90" />
+      <el-table-column prop="tname" label="琛楅亾" width="110" />
+      <el-table-column prop="evaluation.scenseaddress" label="鍦板潃" />
+      <!-- <el-table-column prop="biArea" label="闆嗕腑鍖�" width="110" />
+      <el-table-column prop="biManagementCompany" label="鐗╀笟" min-width="110"/> -->
+      <el-table-column prop="evaluation.resultscorebef" label="寰楀垎" width="110" />
+    </template>
+  </FYTable>
 </template>
 
 <script>
-import CompPreCheck from './components/CompPreCheck.vue';
+import CompPreCheck from './components/CompPreCheck.vue'
+import evaluateApi from '@/api/fysp/evaluateApi'
+import dayjs from 'dayjs'
+import CompQuickSet from './components/CompQuickSet.vue'
 
 export default {
-    name: 'ResultManage',
-    components: { CompPreCheck },
-    data() {
-        return {};
-    },
-    methods:{
-      /**
-       * 閫氳繃鑷瘎棰勬鍚庯紝鎵ц鑷姩璇勪及
-       * @param {*} options 鏌ヨ鍙傛暟
-       */
-      autoEvaluate(options){
-
+  name: 'ResultManage',
+  components: { CompPreCheck, CompQuickSet },
+  data() {
+    return {
+      formSearch: {
+        locations: {},
+        scenetype: {},
+        time: dayjs().add(-1, 'M').date(1).toDate()
       }
     }
-};
+  },
+  methods: {
+    setOptions(param) {
+      this.formSearch.locations = param.locations
+      this.formSearch.scenetype = param.scenetype
+    },
+    onSearch(page, func) {
+      const { locations, scenetype, time } = this.formSearch
+      const area = {
+        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'),
+        scensetypeid: scenetype.value
+      }
+      evaluateApi.fetchAutoEvaluation(area).then((res) => {
+        if (res) {
+          func({
+            data: res.data
+          })
+        }
+      })
+    }
+  }
+}
 </script>
diff --git a/src/views/fysp/evaluation/components/CompHistoryRecord.vue b/src/views/fysp/evaluation/components/CompHistoryRecord.vue
new file mode 100644
index 0000000..95fda22
--- /dev/null
+++ b/src/views/fysp/evaluation/components/CompHistoryRecord.vue
@@ -0,0 +1,10 @@
+<template>
+  <div></div>
+</template>
+<script>
+export default {
+  methods:{
+
+  }
+}
+</script>
\ No newline at end of file
diff --git a/src/views/fysp/evaluation/components/CompPreCheck.vue b/src/views/fysp/evaluation/components/CompPreCheck.vue
index 315b76b..0199703 100644
--- a/src/views/fysp/evaluation/components/CompPreCheck.vue
+++ b/src/views/fysp/evaluation/components/CompPreCheck.vue
@@ -6,7 +6,7 @@
         :allOption="false"
         :level="3"
         :checkStrictly="false"
-        v-model:value="formSearch._locations"
+        v-model:value="formSearch.locations"
       ></FYOptionLocation>
       <!-- 鍦烘櫙绫诲瀷 -->
       <FYOptionScene
@@ -15,7 +15,7 @@
         v-model:value="formSearch.scenetype"
       ></FYOptionScene>
       <!-- 鏃堕棿 -->
-      <FYOptionTime type="month" v-model:value="formSearch.time"></FYOptionTime>
+      <FYOptionTime :initValue="false" type="month" v-model:value="formSearch.time"></FYOptionTime>
     </template>
   </FYSearchBar>
   <el-row>
@@ -27,6 +27,8 @@
 </template>
 
 <script>
+import dayjs from 'dayjs'
+
 /**
  * 鑷姩璇勪及鏉′欢鍚堣鎬ф鏌�
  */
@@ -105,9 +107,9 @@
   data() {
     return {
       formSearch: {
-        _locations: {},
+        locations: {},
         scenetype: {},
-        time: undefined
+        time: dayjs().add(-1, 'M').date(1).toDate()
       }
     }
   },
@@ -117,17 +119,22 @@
      * 妫�鏌ユ墍閫夎寖鍥村唴鍚勯」璇勪及鏁版嵁婧愭槸鍚﹀畬鏁�
      */
     preCheck() {
-      this.$emit('preCheck', this.formSearch)
+      const param = {
+        locations: this.formSearch.locations,
+        scenetype: this.formSearch.scenetype,
+        time: dayjs(this.formSearch.time).format('YYYY-MM-DD')
+      }
+      this.$emit('preCheck', param)
     },
 
     /**
      * 蹇�熻缃潯浠�
      */
     quickSet(set) {
-      this.formSearch._locations = set.locations
+      this.formSearch.locations = set.locations
       this.formSearch.scenetype = set.scenetype
 
-      this.preCheck()
+      // this.preCheck()
     }
   }
 }
diff --git a/src/views/fysp/evaluation/components/CompQuickSet.vue b/src/views/fysp/evaluation/components/CompQuickSet.vue
new file mode 100644
index 0000000..23a99a8
--- /dev/null
+++ b/src/views/fysp/evaluation/components/CompQuickSet.vue
@@ -0,0 +1,94 @@
+<template>
+  <el-row>
+    <span>蹇嵎閫夋嫨</span>
+    <el-button v-for="(v, i) in quickSetting" :key="i" type="primary" @click="quickSet(v)">{{
+      v.name
+    }}</el-button>
+  </el-row>
+</template>
+<script>
+export default {
+  props: {
+    quickSetting: {
+      type: Array,
+      default: () => {
+        return [
+          {
+            name: '闈欏畨宸ュ湴',
+            locations: {
+              pCode: '31',
+              pName: '涓婃捣甯�',
+              cCode: '3100',
+              cName: '涓婃捣甯�',
+              dCode: '310106',
+              dName: '闈欏畨鍖�'
+            },
+            scenetype: { label: '宸ュ湴', value: '1' }
+          },
+          {
+            name: '寰愭眹椁愰ギ',
+            locations: {
+              pCode: '31',
+              pName: '涓婃捣甯�',
+              cCode: '3100',
+              cName: '涓婃捣甯�',
+              dCode: '310104',
+              dName: '寰愭眹鍖�'
+            },
+            scenetype: { label: '椁愰ギ', value: '5' }
+          },
+          {
+            name: '閲戝北宸ュ湴',
+            locations: {
+              pCode: '31',
+              pName: '涓婃捣甯�',
+              cCode: '3100',
+              cName: '涓婃捣甯�',
+              dCode: '310116',
+              dName: '閲戝北鍖�'
+            },
+            scenetype: { label: '宸ュ湴', value: '1' }
+          },
+          {
+            name: '閲戝北鐮佸ご',
+            locations: {
+              pCode: '31',
+              pName: '涓婃捣甯�',
+              cCode: '3100',
+              cName: '涓婃捣甯�',
+              dCode: '310116',
+              dName: '閲戝北鍖�'
+            },
+            scenetype: { label: '鐮佸ご', value: '2' }
+          },
+          {
+            name: '閲戝北鎼呮媽绔�',
+            locations: {
+              pCode: '31',
+              pName: '涓婃捣甯�',
+              cCode: '3100',
+              cName: '涓婃捣甯�',
+              dCode: '310116',
+              dName: '閲戝北鍖�'
+            },
+            scenetype: { label: '鎼呮媽绔�', value: '3' }
+          }
+        ]
+      }
+    }
+  },
+  emits: ['quickSet'],
+  methods: {
+    /**
+     * 蹇�熻缃潯浠�
+     * @param {locations, scenetype} set
+     */
+    quickSet(set) {
+      // this.formSearch.locations = set.locations
+      // this.formSearch.scenetype = set.scenetype
+
+      this.$emit('quickSet', set)
+    }
+  }
+}
+</script>

--
Gitblit v1.9.3