¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <FYTable |
| | | @search="onSearch" |
| | | :pagination="false" |
| | | ref="tableRef" |
| | | @cell-click="cellClick" |
| | | :cell-class-name="cellClassName" |
| | | @table-paste="handlePaste" |
| | | @sort-change="handleSortChange" |
| | | > |
| | | <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> |
| | | <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-item label="èåæ§æ³æ¸
å"> |
| | | {{ listSummary }} |
| | | </el-descriptions-item> |
| | | </el-descriptions> |
| | | </template> |
| | | |
| | | <template #table-column="{ size }"> |
| | | <el-table-column fixed="left" label="åºå·" width="80"> |
| | | <template #default="{ row }"> |
| | | {{ row.index + 1 }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="sceneName" |
| | | :show-overflow-tooltip="true" |
| | | label="åç§°" |
| | | width="300" |
| | | > |
| | | </el-table-column> |
| | | <!-- <el-table-column |
| | | prop="subTaskTime" |
| | | label="å·¡æ¥æ¥æ" |
| | | width="110" |
| | | sortable="custom" |
| | | :formatter="timeFormat" |
| | | /> --> |
| | | <!-- <el-table-column |
| | | prop="evaluation.resultscorebef" |
| | | label="å¾å" |
| | | width="90" |
| | | sortable="custom" |
| | | /> --> |
| | | <!-- <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 #default="{ row }"> |
| | | <el-button type="primary" size="small" @click="editRow(row)" |
| | | >æ¥ç</el-button |
| | | > |
| | | </template> |
| | | </el-table-column> --> |
| | | </template> |
| | | </FYTable> |
| | | </template> |
| | | |
| | | <script> |
| | | /** |
| | | * èåæ§æ³æ¸
å |
| | | */ |
| | | import dayjs from 'dayjs'; |
| | | import evaluateApi from '@/api/fysp/evaluateApi'; |
| | | import { envCreditCode } from '@/constants/index'; |
| | | import { useTablePaste } from '@/composables/tablePaste'; |
| | | import { useCloned } from '@vueuse/core'; |
| | | import { useMessageBoxTip } from '@/composables/messageBox'; |
| | | |
| | | export default { |
| | | setup() { |
| | | const { |
| | | cellClick, |
| | | cellClassName, |
| | | handlePaste, |
| | | setTableData, |
| | | addRefreshEvent, |
| | | tableData |
| | | } = useTablePaste({ |
| | | score1: 8, |
| | | score2: 9 |
| | | }); |
| | | return { |
| | | cellClick, |
| | | cellClassName, |
| | | handlePaste, |
| | | setTableData, |
| | | addRefreshEvent, |
| | | tableData |
| | | }; |
| | | }, |
| | | data() { |
| | | return { |
| | | formSearch: { |
| | | locations: {}, |
| | | scenetype: {}, |
| | | time: dayjs().add(-1, 'M').date(1).toDate() |
| | | }, |
| | | townFilters: [], |
| | | // åå§æ°æ®ï¼ç¨äºæåºåæ¶å |
| | | orginData: [], |
| | | evaluationRule: undefined, |
| | | evaluationSubRule: undefined, |
| | | //çæµæ°æ®è§ååç§° |
| | | ruleName: { |
| | | score1: { |
| | | id: undefined, |
| | | name: 'çæµæ°æ®åºç°åæ¥å以䏿æè¶
æ ' |
| | | }, |
| | | score2: { |
| | | id: undefined, |
| | | name: 'çæµæ°æ®æåå¼è¶
åºåæåå¼20%ä»¥ä¸ææ°æ®ææ¾å¼å¸¸' |
| | | } |
| | | }, |
| | | updateLoading: false |
| | | }; |
| | | }, |
| | | computed: { |
| | | area() { |
| | | 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 |
| | | }; |
| | | }, |
| | | listSummary() { |
| | | if (this.tableData.length > 0) { |
| | | const { locations, scenetype, time } = this.formSearch; |
| | | return `æ ¹æ®${locations.dName}${dayjs(time).format( |
| | | 'YYYYå¹´MMæ' |
| | | )}çç°åºæ´æ¹æ
åµä»¥åèªå¨è¯åç»æï¼å¹¶ç»ååå²å·¡æ¥è®°å½ï¼å¾åºä»¥ä¸ç»¼åå¾åæå·®ç10å®¶${ |
| | | scenetype.label |
| | | }ä½ä¸ºèåæ§æ³å¤éæ¸
åã`; |
| | | } else { |
| | | return ``; |
| | | } |
| | | } |
| | | }, |
| | | 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}`); |
| | | }, |
| | | setOptions(param) { |
| | | this.formSearch.locations = param.locations; |
| | | this.formSearch.scenetype = param.scenetype; |
| | | this.formSearch.sourceType = param.sourceType; |
| | | this.$refs.tableRef.onSearch(); |
| | | }, |
| | | 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; |
| | | }) |
| | | .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; |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | 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; |
| | | }, |
| | | 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() { |
| | | this.addRefreshEvent(this.$refs.tableRef.doLayout); |
| | | } |
| | | }; |
| | | </script> |
| | | <style scoped></style> |