统一接口实现

This commit is contained in:
磷叶 2025-02-24 15:55:46 +08:00
parent 6e2471ccb3
commit 67ceada31d
4 changed files with 14 additions and 14 deletions

View File

@ -1,13 +1,5 @@
import request from '@/utils/request'
// 获取项目比率
export function getDashboardProjectRate() {
return request({
url: '/dashboard/project/rate',
method: 'get'
})
}
// 获取每月项目进度概览
export function getMonthProject(params) {
return request({

View File

@ -115,6 +115,7 @@ export const BriefKeys = {
// 项目
PROJECT_STATUS: "projectStatus", // 项目状态
PROJECT_DEV_COMPLETED: "projectDevCompleted", // 项目开发完成
PROJECT_DEV_ON_TIME_COMPLETED: "projectDevOnTimeCompleted", // 项目正常开发完成
PROJECT_OVERDUE_DEV_UNCOMPLETED: "projectOverdueDevUncompleted", // 项目逾期开发未完成
PROJECT_OVERDUE_DEV_COMPLETED: "projectOverdueDevCompleted", // 项目逾期开发完成
PROJECT_DEV_OVERDUE: "projectDevOverdue", // 项目开发逾期

View File

@ -5,8 +5,9 @@
</template>
<script>
import { getDashboardProjectRate } from '@/api/dashboard/project';
import * as echarts from 'echarts';
import { getBrief } from '@/api/dashboard/dashboard';
import { BriefKeys } from '@/utils/enums';
export default {
name: 'ProjectRateChart',
@ -34,8 +35,14 @@ export default {
methods: {
getProjectRate() {
this.loading = true;
getDashboardProjectRate().then(res => {
this.data = res.data;
getBrief({
keys: [
BriefKeys.PROJECT_STATUS,
BriefKeys.PROJECT_DEV_COMPLETED,
BriefKeys.PROJECT_DEV_OVERDUE
]
}).then(res => {
this.data = res.data.project;
this.updateChart();
}).finally(() => {
this.loading = false;
@ -53,7 +60,7 @@ export default {
let completionRate = 0;
let overdueRate = 0;
if (this.data != null && this.data.total != null && this.data.total != 0) {
completionRate = (this.data.completed / this.data.total * 100).toFixed(1);
completionRate = (this.data.devCompleted / this.data.total * 100).toFixed(1);
overdueRate = (this.data.devOverdue / this.data.total * 100).toFixed(1);
}

View File

@ -57,7 +57,7 @@
/>
<statistics-card
style="flex: 1"
:value="project.devCompleted"
:value="project.devOnTimeCompleted"
label="正常开发完成"
icon="el-icon-circle-check"
start-color="#67C23A"
@ -115,7 +115,7 @@ export default {
this.loading = true
getBrief({ joinUserId: this.userId, keys: [
BriefKeys.PROJECT_STATUS,
BriefKeys.PROJECT_DEV_COMPLETED,
BriefKeys.PROJECT_DEV_ON_TIME_COMPLETED,
BriefKeys.PROJECT_OVERDUE_DEV_UNCOMPLETED,
BriefKeys.PROJECT_OVERDUE_DEV_COMPLETED,
BriefKeys.TASK_STATUS,