| | |
| | | @cell-click="cellClick" |
| | | :cell-class-name="cellClassName" |
| | | @table-paste="handlePaste" |
| | | @sort-change="handleSortChange" |
| | | > |
| | | <template #options> |
| | | <!-- 区县 --> |
| | |
| | | </template> |
| | | |
| | | <template #table-column> |
| | | <el-table-column fixed="left" sortable prop="sceneIndex" label="编号" width="80"> |
| | | <el-table-column fixed="left" sortable="custom" prop="sceneIndex" label="编号" width="80"> |
| | | </el-table-column> |
| | | <el-table-column prop="sceneName" :show-overflow-tooltip="true" label="名称" width="300"> |
| | | </el-table-column> |
| | |
| | | prop="subTaskTime" |
| | | label="巡查日期" |
| | | width="110" |
| | | sortable |
| | | sortable="custom" |
| | | :formatter="timeFormat" |
| | | /> |
| | | <el-table-column |
| | | prop="evaluation.resultscorebef" |
| | | label="得分" |
| | | width="90" |
| | | sortable |
| | | :sort-method="sortScore" |
| | | /> |
| | | <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> |
| | |
| | | import { envCreditCode } from '@/constants/index'; |
| | | import CompReport from './components/CompReport.vue'; |
| | | import { useTablePaste } from '@/composables/tablePaste'; |
| | | import { useCloned } from '@vueuse/core'; |
| | | |
| | | export default { |
| | | setup() { |
| | |
| | | scenetype: {}, |
| | | time: dayjs().add(-1, 'M').date(1).toDate() |
| | | }, |
| | | townFilters: [] |
| | | townFilters: [], |
| | | // 原始数据,用于排序取消后 |
| | | orginData: [] |
| | | }; |
| | | }, |
| | | methods: { |
| | |
| | | this.$refs.tableRef.onSearch(); |
| | | }, |
| | | onSearch(page, func) { |
| | | this.$refs.tableRef.clearSort(); |
| | | const area = this._getParam(); |
| | | evaluateApi.fetchAutoEvaluation(area).then((res) => { |
| | | if (res.data) { |
| | | this.tableData = res.data; |
| | | this.orginData = useCloned(this.tableData).cloned; |
| | | console.log(this.orginData); |
| | | this.getFilters(res.data); |
| | | if (typeof func === 'function') { |
| | | func({ data: this.tableData }); |
| | |
| | | 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); |