From 3959e507bfa99cc4ced2a6f48f9b4358334d34c4 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期二, 19 十二月 2023 17:34:45 +0800
Subject: [PATCH] 1. 调试表单选项组件的双向绑定逻辑
---
src/views/fysp/evaluation/ResultManage.vue | 175 ++++++++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 162 insertions(+), 13 deletions(-)
diff --git a/src/views/fysp/evaluation/ResultManage.vue b/src/views/fysp/evaluation/ResultManage.vue
index 864aab2..da2c668 100644
--- a/src/views/fysp/evaluation/ResultManage.vue
+++ b/src/views/fysp/evaluation/ResultManage.vue
@@ -1,24 +1,173 @@
<template>
- <CompPreCheck @pre-check="autoEvaluate"></CompPreCheck>
+ <!-- <CompPreCheck @pre-check="autoEvaluate"></CompPreCheck> -->
+
+ <FYTable @search="onSearch" :pagination="false" ref="tableRef">
+ <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="300">
+ <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="subTaskTime"
+ label="宸℃煡鏃ユ湡"
+ width="110"
+ sortable
+ :formatter="timeFormat"
+ />
+ <el-table-column
+ prop="evaluation.resultscorebef"
+ label="寰楀垎"
+ width="90"
+ sortable
+ :sort-method="sortScore"
+ />
+ <el-table-column prop="evaluation.resultscorebef" label="鐜俊鐮�" width="100">
+ <template #default="{ row }">
+ <span :style="`color: ${toCode(row).color};`">{{ toCode(row).name }}</span>
+ </template>
+ </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="biArea" label="闆嗕腑鍖�" width="110" />
+ <el-table-column prop="biManagementCompany" label="鐗╀笟" min-width="110"/> -->
+ <el-table-column fixed="right" align="right" label="鎿嶄綔" width="160">
+ <template #header>
+ <el-button icon="DocumentAdd" size="default" type="success" @click="drawer = true"
+ >鑷姩璇勪及</el-button
+ >
+ </template>
+ <template #default="{ row }">
+ <el-button type="primary" size="small" @click="editRow(row)">鏌ョ湅</el-button>
+ </template>
+ </el-table-column>
+ </template>
+ </FYTable>
</template>
<script>
-import CompPreCheck from './components/CompPreCheck.vue';
+import dayjs from 'dayjs';
+import evaluateApi from '@/api/fysp/evaluateApi';
+import { envCreditCode } from '@/constants/index';
+import CompQuickSet from './components/CompQuickSet.vue';
export default {
- name: 'ResultManage',
- components: { CompPreCheck },
- data() {
- return {};
+ name: 'ResultManage',
+ components: { CompQuickSet },
+ data() {
+ return {
+ formSearch: {
+ locations: {},
+ scenetype: {},
+ time: dayjs().add(-1, 'M').date(1).toDate()
+ },
+ townFilters: []
+ };
+ },
+ methods: {
+ setOptions(param) {
+ this.formSearch.locations = param.locations;
+ this.formSearch.scenetype = param.scenetype;
+ this.$refs.tableRef.onSearch()
},
- methods:{
- /**
- * 閫氳繃鑷瘎棰勬鍚庯紝鎵ц鑷姩璇勪及
- * @param {*} options 鏌ヨ鍙傛暟
- */
- autoEvaluate(options){
-
+ 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 (typeof func === 'function') {
+ func({ data: res.data });
+ }
+ if (res.data) {
+ this.getFilters(res.data);
+ }
+ });
+ },
+ getFilters(data) {
+ const townList = [];
+ data.forEach((e) => {
+ if (townList.indexOf(e.tname) == -1) {
+ townList.push(e.tname);
+ }
+ });
+ this.townFilters = townList.map((v) => {
+ return { text: v, value: v };
+ });
+ },
+ toCode(row, column) {
+ if (row.evaluation) {
+ return envCreditCode(row.evaluation.resultscorebef);
+ } else {
+ return '';
}
+ },
+ timeFormat(row, column) {
+ const time = row.subTaskTime;
+ if (time) {
+ return dayjs(time).format('MM-DD');
+ } else {
+ return '';
+ }
+ },
+ 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;
}
+ }
};
</script>
+<style scoped>
+.a {
+ color: #f7a62c;
+}
+</style>
--
Gitblit v1.9.3