From 202adad6c3d5fe1d95e745d47434dc29cc60d957 Mon Sep 17 00:00:00 2001
From: Riku <risaku@163.com>
Date: 星期六, 28 九月 2024 20:41:11 +0800
Subject: [PATCH] Merge branch 'hc-evalution' into riku-evaluation
---
src/views/fysp/evaluation/EvalutationRecord.vue | 109 ++++++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 92 insertions(+), 17 deletions(-)
diff --git a/src/views/fysp/evaluation/EvalutationRecord.vue b/src/views/fysp/evaluation/EvalutationRecord.vue
index 37d2b7e..41338ec 100644
--- a/src/views/fysp/evaluation/EvalutationRecord.vue
+++ b/src/views/fysp/evaluation/EvalutationRecord.vue
@@ -1,5 +1,13 @@
<template>
- <FYTable @search="onSearch" :pagination="false" ref="tableRef">
+ <FYTable
+ @search="onSearch"
+ :pagination="false"
+ ref="tableRef"
+ @cell-click="cellClick"
+ :cell-class-name="cellClassName"
+ @table-paste="handlePaste"
+ @sort-change="handleSortChange"
+ >
<template #options>
<!-- 鍖哄幙 -->
<FYOptionLocation
@@ -35,22 +43,18 @@
</template>
<template #table-column>
- <el-table-column fixed="left" prop="sceneName" :show-overflow-tooltip="true" label="鍚嶇О" width="300">
+ <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>
<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>
@@ -68,6 +72,16 @@
<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-input v-model="row.score1" />
+ </template>
+ </el-table-column>
+ <el-table-column fixed="right" align="right" label="鐩戞祴鏁版嵁瓒呭尯鏈堝潎鍊�" width="160">
+ <template #default="{ row }">
+ <el-input v-model="row.score2" />
+ </template>
+ </el-table-column>
<el-table-column fixed="right" align="right" label="鎿嶄綔" width="160">
<!-- <template #header>
<el-button icon="Download" size="default" type="success" @click="exportExcel"
@@ -86,12 +100,20 @@
import dayjs from 'dayjs';
import evaluateApi from '@/api/fysp/evaluateApi';
import { envCreditCode } from '@/constants/index';
-import CompQuickSet from './components/CompQuickSet.vue';
import CompReport from './components/CompReport.vue';
+import { useTablePaste } from '@/composables/tablePaste';
+import { useCloned } from '@vueuse/core';
export default {
- name: 'ResultManage',
- components: { CompQuickSet, CompReport },
+ setup() {
+ const { cellClick, cellClassName, handlePaste, setTableData, addRefreshEvent, tableData } =
+ useTablePaste({
+ score1: 8,
+ score2: 9
+ });
+ return { cellClick, cellClassName, handlePaste, setTableData, addRefreshEvent, tableData };
+ },
+ components: { CompReport },
data() {
return {
formSearch: {
@@ -99,7 +121,9 @@
scenetype: {},
time: dayjs().add(-1, 'M').date(1).toDate()
},
- townFilters: []
+ townFilters: [],
+ // 鍘熷鏁版嵁锛岀敤浜庢帓搴忓彇娑堝悗
+ orginData: []
};
},
methods: {
@@ -126,13 +150,17 @@
this.$refs.tableRef.onSearch();
},
onSearch(page, func) {
+ this.$refs.tableRef.clearSort();
const area = this._getParam();
evaluateApi.fetchAutoEvaluation(area).then((res) => {
- if (typeof func === 'function') {
- func({ data: res.data });
- }
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 });
+ }
}
});
},
@@ -182,7 +210,54 @@
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>
--
Gitblit v1.9.3