|
@@ -275,10 +275,38 @@
|
|
|
v-model="rankingSearchQuery"
|
|
v-model="rankingSearchQuery"
|
|
|
placeholder="搜索..."
|
|
placeholder="搜索..."
|
|
|
@keyup.enter="handleRankingSearch"
|
|
@keyup.enter="handleRankingSearch"
|
|
|
- style="width: 300px;"
|
|
|
|
|
|
|
+ style="width: 150px;"
|
|
|
prefix-icon="search"
|
|
prefix-icon="search"
|
|
|
clearable
|
|
clearable
|
|
|
/>
|
|
/>
|
|
|
|
|
+ <!-- 月份选择器(日期选择器样式) -->
|
|
|
|
|
+ <el-date-picker
|
|
|
|
|
+ v-if="!isCustomDate"
|
|
|
|
|
+ v-model="selectedMonth"
|
|
|
|
|
+ type="month"
|
|
|
|
|
+ placeholder="选择月份"
|
|
|
|
|
+ value-format="YYYY-MM"
|
|
|
|
|
+ style="width:150px;margin: 0 10px;"
|
|
|
|
|
+ @change="onMonthChange"
|
|
|
|
|
+ />
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 自定义日期范围 -->
|
|
|
|
|
+ <el-date-picker
|
|
|
|
|
+ v-else
|
|
|
|
|
+ v-model="dateRange"
|
|
|
|
|
+ type="daterange"
|
|
|
|
|
+ range-separator="至"
|
|
|
|
|
+ start-placeholder="开始日期"
|
|
|
|
|
+ end-placeholder="结束日期"
|
|
|
|
|
+ value-format="YYYY-MM-DD"
|
|
|
|
|
+ style="margin: 0 10px;"
|
|
|
|
|
+ @change="onDateRangeChange"
|
|
|
|
|
+ />
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 切换按钮 -->
|
|
|
|
|
+ <el-button @click="toggleCustomDate">
|
|
|
|
|
+ {{ isCustomDate ? '返回' : '自定义' }}
|
|
|
|
|
+ </el-button>
|
|
|
<el-button type="primary" @click="handleExportRank">
|
|
<el-button type="primary" @click="handleExportRank">
|
|
|
<i class="fa fa-download" style="margin-right: 8px;"></i>导出
|
|
<i class="fa fa-download" style="margin-right: 8px;"></i>导出
|
|
|
</el-button>
|
|
</el-button>
|
|
@@ -288,7 +316,7 @@
|
|
|
<el-table-column prop="rank" label="排名" width="80" align="center"></el-table-column>
|
|
<el-table-column prop="rank" label="排名" width="80" align="center"></el-table-column>
|
|
|
<el-table-column prop="name" label="名字" width="120" align="center">
|
|
<el-table-column prop="name" label="名字" width="120" align="center">
|
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
|
- <span :style="{ color: scope.row.name === homePageData.nickName && scope.row.rank === currentSort ? 'red' : '' }">{{ scope.row.name }}</span>
|
|
|
|
|
|
|
+ <span :style="{ color: scope.row.userId === homePageData.userId ? 'red' : '' }">{{ scope.row.name }}</span>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
<el-table-column prop="station" label="场站" align="center"></el-table-column>
|
|
<el-table-column prop="station" label="场站" align="center"></el-table-column>
|
|
@@ -302,8 +330,7 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
-import { ref, reactive } from 'vue';
|
|
|
|
|
-import { selectHomePageData } from '@/api/gxt/repairOrder';
|
|
|
|
|
|
|
+import { selectHomePageData, selectCompanyRank } from '@/api/gxt/repairOrder';
|
|
|
import { listMyTodo } from '@/api/gxt/orderMine';
|
|
import { listMyTodo } from '@/api/gxt/orderMine';
|
|
|
import { listGxtOrderPerson } from '@/api/gxt/gxtOrderPerson';
|
|
import { listGxtOrderPerson } from '@/api/gxt/gxtOrderPerson';
|
|
|
import { encryptParams } from '@/utils/encrypt';
|
|
import { encryptParams } from '@/utils/encrypt';
|
|
@@ -325,9 +352,21 @@ export default {
|
|
|
orderCode: null,
|
|
orderCode: null,
|
|
|
status: 0
|
|
status: 0
|
|
|
},
|
|
},
|
|
|
|
|
+ // 个人公司排名相关参数
|
|
|
|
|
+ queryRank: {
|
|
|
|
|
+ dateFrom: null,
|
|
|
|
|
+ dateTo: null,
|
|
|
|
|
+ monthPeriod: null,
|
|
|
|
|
+ status: 0
|
|
|
|
|
+ },
|
|
|
|
|
+ isCustomDate: false,
|
|
|
|
|
+ monthList: [],
|
|
|
|
|
+ selectedMonth: null,
|
|
|
|
|
+ dateRange: [],
|
|
|
companyExport: false,
|
|
companyExport: false,
|
|
|
rankingSearchQuery: '',
|
|
rankingSearchQuery: '',
|
|
|
companyRankList: [],
|
|
companyRankList: [],
|
|
|
|
|
+ // 个人公司排名相关参数结束
|
|
|
orderPersonList: [],
|
|
orderPersonList: [],
|
|
|
// 添加首页统计数据
|
|
// 添加首页统计数据
|
|
|
homePageData: {
|
|
homePageData: {
|
|
@@ -375,6 +414,48 @@ export default {
|
|
|
}, 3000);
|
|
}, 3000);
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
+ // 月份选择变化
|
|
|
|
|
+ onMonthChange() {
|
|
|
|
|
+ if (!this.selectedMonth) return;
|
|
|
|
|
+ this.queryRank.monthPeriod = this.selectedMonth;
|
|
|
|
|
+ this.queryRank.dateFrom = null;
|
|
|
|
|
+ this.queryRank.dateTo = null;
|
|
|
|
|
+ selectCompanyRank(this.queryRank).then(response => {
|
|
|
|
|
+ if (response.code === 200) {
|
|
|
|
|
+ this.homePageData.scoreCompany = response.data || [];
|
|
|
|
|
+ let rankingData = [...this.homePageData.scoreCompany];
|
|
|
|
|
+ this.getCurrentRankingData(rankingData);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ // 日期范围变化
|
|
|
|
|
+ onDateRangeChange() {
|
|
|
|
|
+ if (!this.dateRange || this.dateRange.length < 2) return;
|
|
|
|
|
+ const start = this.dateRange[0] + ' 00:00:00';
|
|
|
|
|
+ const end = this.dateRange[1] + ' 23:59:59';
|
|
|
|
|
+ this.queryRank.dateFrom = start;
|
|
|
|
|
+ this.queryRank.dateTo = end;
|
|
|
|
|
+ this.queryRank.monthPeriod = null;
|
|
|
|
|
+ selectCompanyRank(this.queryRank).then(response => {
|
|
|
|
|
+ if (response.code === 200) {
|
|
|
|
|
+ this.homePageData.scoreCompany = response.data || [];
|
|
|
|
|
+ let rankingData = [...this.homePageData.scoreCompany];
|
|
|
|
|
+ this.getCurrentRankingData(rankingData);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ // 切换 月份选择 / 自定义日期
|
|
|
|
|
+ toggleCustomDate() {
|
|
|
|
|
+ this.isCustomDate = !this.isCustomDate;
|
|
|
|
|
+ if (this.isCustomDate) {
|
|
|
|
|
+ this.selectedMonth = null;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.dateRange = [];
|
|
|
|
|
+ this.onMonthChange();
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
// 在组件销毁前清除定时器
|
|
// 在组件销毁前清除定时器
|
|
|
beforeDestroy() {
|
|
beforeDestroy() {
|
|
|
if (this.timer) {
|
|
if (this.timer) {
|
|
@@ -424,36 +505,39 @@ export default {
|
|
|
rankingData = [...this.homePageData.scoreCompany];
|
|
rankingData = [...this.homePageData.scoreCompany];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 按finalScore降序排序
|
|
|
|
|
- rankingData.sort((a, b) => (b.finalScore || 0) - (a.finalScore || 0));
|
|
|
|
|
-
|
|
|
|
|
- // 实现RANK模式排名
|
|
|
|
|
- const rankedData = [];
|
|
|
|
|
- rankingData.forEach((item, index) => {
|
|
|
|
|
- // 计算RANK排名
|
|
|
|
|
- let rank = index + 1;
|
|
|
|
|
- // 如果当前项的finalScore与前一项相同,则排名也相同
|
|
|
|
|
- if (index > 0 && item.finalScore === rankingData[index - 1].finalScore) {
|
|
|
|
|
- rank = rankedData[index - 1].rank;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ this.getCurrentRankingData(rankingData);
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ getCurrentRankingData(rankingData) {
|
|
|
|
|
+ // 按finalScore降序排序
|
|
|
|
|
+ rankingData.sort((a, b) => (b.finalScore || 0) - (a.finalScore || 0));
|
|
|
|
|
+
|
|
|
|
|
+ // 实现RANK模式排名
|
|
|
|
|
+ const rankedData = [];
|
|
|
|
|
+ rankingData.forEach((item, index) => {
|
|
|
|
|
+ // 计算RANK排名
|
|
|
|
|
+ let rank = index + 1;
|
|
|
|
|
+ // 如果当前项的finalScore与前一项相同,则排名也相同
|
|
|
|
|
+ if (index > 0 && item.finalScore === rankingData[index - 1].finalScore) {
|
|
|
|
|
+ rank = rankedData[index - 1].rank;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- rankedData.push({
|
|
|
|
|
- rank: rank,
|
|
|
|
|
- name: item.nickName,
|
|
|
|
|
- station: item.deptName,
|
|
|
|
|
- finalScore: item.finalScore || 0
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ rankedData.push({
|
|
|
|
|
+ userId: item.userId,
|
|
|
|
|
+ rank: rank,
|
|
|
|
|
+ name: item.nickName,
|
|
|
|
|
+ station: item.deptName,
|
|
|
|
|
+ finalScore: item.finalScore || 0
|
|
|
});
|
|
});
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- this.companyRankList = rankedData;
|
|
|
|
|
- this.currentRankingData = rankedData;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ this.companyRankList = rankedData;
|
|
|
|
|
+ this.currentRankingData = rankedData;
|
|
|
},
|
|
},
|
|
|
applyFilter() {
|
|
applyFilter() {
|
|
|
// 获取工单人员列表数据
|
|
// 获取工单人员列表数据
|
|
|
listGxtOrderPerson(this.queryParams).then(response => {
|
|
listGxtOrderPerson(this.queryParams).then(response => {
|
|
|
if (response.code === 200) {
|
|
if (response.code === 200) {
|
|
|
- console.log(response.rows);
|
|
|
|
|
this.total = response.total;
|
|
this.total = response.total;
|
|
|
this.orderPersonList = response.rows;
|
|
this.orderPersonList = response.rows;
|
|
|
}
|
|
}
|
|
@@ -477,6 +561,7 @@ export default {
|
|
|
selectHomePageData().then(response => {
|
|
selectHomePageData().then(response => {
|
|
|
if (response.code === 200) {
|
|
if (response.code === 200) {
|
|
|
this.homePageData.nickName = response.data.nickName;
|
|
this.homePageData.nickName = response.data.nickName;
|
|
|
|
|
+ this.homePageData.userId = response.data.userId;
|
|
|
this.homePageData.workOrderNum = response.data.workOrderNum || 0;
|
|
this.homePageData.workOrderNum = response.data.workOrderNum || 0;
|
|
|
this.homePageData.workOrderJsy = response.data.workOrderJsy || 0;
|
|
this.homePageData.workOrderJsy = response.data.workOrderJsy || 0;
|
|
|
this.homePageData.repairOrderNum = response.data.repairOrderNum || 0;
|
|
this.homePageData.repairOrderNum = response.data.repairOrderNum || 0;
|
|
@@ -491,7 +576,9 @@ export default {
|
|
|
this.homePageData.pendingNum = this.homePageData.repairPending + this.homePageData.workPending;
|
|
this.homePageData.pendingNum = this.homePageData.repairPending + this.homePageData.workPending;
|
|
|
this.homePageData.hasCenter = response.data.hasCenter;
|
|
this.homePageData.hasCenter = response.data.hasCenter;
|
|
|
this.homePageData.timeOutNum = response.data.timeOutNum;
|
|
this.homePageData.timeOutNum = response.data.timeOutNum;
|
|
|
- this.homePageData.scoreCompany = response.data.scoreCompany || [];
|
|
|
|
|
|
|
+ if (this.queryRank.dateFrom == null && this.queryRank.dateTo == null && this.queryRank.monthPeriod == null) {
|
|
|
|
|
+ this.homePageData.scoreCompany = response.data.scoreCompany || [];
|
|
|
|
|
+ }
|
|
|
this.homePageData.companySort = response.data.companySort || 0;
|
|
this.homePageData.companySort = response.data.companySort || 0;
|
|
|
this.homePageData.scoreCenter = response.data.scoreCenter || [];
|
|
this.homePageData.scoreCenter = response.data.scoreCenter || [];
|
|
|
this.homePageData.centerSort = response.data.centerSort || 0;
|
|
this.homePageData.centerSort = response.data.centerSort || 0;
|