2025-10-30 19:30:06 +08:00
|
|
|
<template>
|
|
|
|
|
<div class="task-performance-page">
|
2025-11-28 17:32:29 +08:00
|
|
|
<BaseTable
|
2025-12-25 15:38:24 +08:00
|
|
|
tableName="TASK_RUN_PERFORMANCE"
|
2025-11-28 17:32:29 +08:00
|
|
|
ref="baseTableRef"
|
|
|
|
|
:export-file-name="'指标列表'"
|
|
|
|
|
:export-api="exportPerformanceApi"
|
|
|
|
|
showCheckbox
|
|
|
|
|
hidePagination
|
|
|
|
|
:actionList="actionList"
|
|
|
|
|
:export-params="excelParams"
|
2025-12-16 11:19:40 +08:00
|
|
|
:full-height="fullHeight"
|
2025-11-28 17:32:29 +08:00
|
|
|
>
|
2025-10-30 19:30:06 +08:00
|
|
|
<template #leftOptions>
|
|
|
|
|
<div class="operate-box">
|
2025-12-02 19:47:45 +08:00
|
|
|
<!-- <el-upload
|
2025-10-30 19:30:06 +08:00
|
|
|
class="mr12"
|
|
|
|
|
:limit="1"
|
|
|
|
|
accept=".xls,.xlsx"
|
|
|
|
|
:auto-upload="true"
|
|
|
|
|
:show-file-list="false"
|
2025-11-26 18:49:29 +08:00
|
|
|
:on-change="handleLocalChangeExcelFun"
|
|
|
|
|
:before-upload="(File: any) => uploadLocalFileFun(File)"
|
2025-10-30 19:30:06 +08:00
|
|
|
>
|
|
|
|
|
<el-button icon="">导入Excel</el-button>
|
2025-12-02 19:47:45 +08:00
|
|
|
</el-upload> -->
|
2025-11-28 17:32:29 +08:00
|
|
|
<!-- <el-button icon="" @click="exportFileFun">导出Excel</el-button> -->
|
2025-11-26 18:49:29 +08:00
|
|
|
<el-button type="primary" @click="openAddPerformanceWindFun">新增</el-button>
|
|
|
|
|
<el-button v-if="showSaveButton" type="primary" @click="saveFun">保存</el-button>
|
2025-10-30 19:30:06 +08:00
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
2025-12-25 16:17:26 +08:00
|
|
|
<template #completeStatus="{ row }">
|
|
|
|
|
<StatusDot
|
|
|
|
|
:status="getTaskAchieveStyleClass(row.completeStatus || '0')"
|
|
|
|
|
:title="RESULT_ACHIEVE_STATUS.O[row.completeStatus || '0']"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
2025-12-25 15:38:24 +08:00
|
|
|
|
2025-10-30 19:30:06 +08:00
|
|
|
<template #operate="{ row }">
|
|
|
|
|
<el-button type="danger" link @click="delPerformance(row)">删除</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</BaseTable>
|
|
|
|
|
|
|
|
|
|
<addTaskPerformance
|
|
|
|
|
v-if="performanceVisible"
|
2025-12-25 15:38:24 +08:00
|
|
|
:tableName="'TASK_RUN_PERFORMANCE'"
|
2025-10-30 19:30:06 +08:00
|
|
|
@cancel="performanceVisible = false"
|
2025-11-26 18:49:29 +08:00
|
|
|
@submit="addPerformanceFun"
|
2025-10-30 19:30:06 +08:00
|
|
|
>
|
|
|
|
|
</addTaskPerformance>
|
2025-12-08 14:54:38 +08:00
|
|
|
<editPerformancePage
|
|
|
|
|
v-if="editPerformanceVisible"
|
|
|
|
|
@cancel="editPerformanceVisible = false"
|
|
|
|
|
:performance-info="currentPerformance"
|
|
|
|
|
@submit="updatePerformanceFun"
|
|
|
|
|
></editPerformancePage>
|
2025-10-30 19:30:06 +08:00
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2025-12-25 16:17:26 +08:00
|
|
|
import { ref, onMounted } from 'vue';
|
2025-10-30 19:30:06 +08:00
|
|
|
import BaseTable from '@/components/common/table/baseTable.vue';
|
|
|
|
|
import { ElMessage } from 'element-plus';
|
2025-12-16 11:19:40 +08:00
|
|
|
import {
|
|
|
|
|
getTaskPerformanceApi,
|
|
|
|
|
batchAddTaskPerformanceApi,
|
|
|
|
|
batchDeleteTaskPerformanceApi,
|
|
|
|
|
getRunPerformanceApi,
|
|
|
|
|
} from '@/api/task/taskpool';
|
2025-11-25 17:37:02 +08:00
|
|
|
import addTaskPerformance from './addTaskPerformance.vue';
|
2025-12-08 14:54:38 +08:00
|
|
|
import { editPerformanceApi, exportPerformanceApi } from '@/api/task/taskPerformance';
|
2025-11-28 17:32:29 +08:00
|
|
|
import { getFormConfigureApi } from '@/api/system/systemData';
|
2025-12-08 14:54:38 +08:00
|
|
|
import editPerformancePage from './editPerformancePage.vue';
|
2025-12-25 16:17:26 +08:00
|
|
|
import { getTaskAchieveStyleClass } from '../common/statusDot/statusMap';
|
|
|
|
|
import { useDict } from '@/utils/useDict';
|
|
|
|
|
import StatusDot from '@/components/common/statusDot/index.vue';
|
2025-10-30 19:30:06 +08:00
|
|
|
|
|
|
|
|
const props = defineProps({
|
|
|
|
|
taskId: {
|
2025-11-28 11:25:35 +08:00
|
|
|
type: String,
|
|
|
|
|
default: '',
|
2025-10-30 19:30:06 +08:00
|
|
|
},
|
2025-11-25 17:37:02 +08:00
|
|
|
runInfo: {
|
|
|
|
|
type: Object,
|
2025-12-16 11:19:40 +08:00
|
|
|
default: () => {},
|
2025-11-25 17:37:02 +08:00
|
|
|
},
|
2025-11-25 19:56:52 +08:00
|
|
|
taskInfo: {
|
|
|
|
|
type: Object,
|
2025-12-16 11:19:40 +08:00
|
|
|
default: () => {},
|
2025-11-25 19:56:52 +08:00
|
|
|
},
|
2025-11-25 17:37:02 +08:00
|
|
|
showSaveButton: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: false,
|
|
|
|
|
},
|
|
|
|
|
paramType: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: 'task',
|
|
|
|
|
},
|
2025-12-16 11:19:40 +08:00
|
|
|
fullHeight: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: false,
|
|
|
|
|
},
|
2025-10-30 19:30:06 +08:00
|
|
|
});
|
|
|
|
|
const baseTableRef = ref();
|
|
|
|
|
const performanceVisible = ref(false);
|
2025-12-08 14:54:38 +08:00
|
|
|
const editPerformanceVisible = ref(false);
|
2025-10-30 19:30:06 +08:00
|
|
|
const performanceData = ref<any>([]);
|
2025-11-26 18:49:29 +08:00
|
|
|
const getTaskPerformanceDataFun = async () => {
|
2025-10-30 19:30:06 +08:00
|
|
|
console.log(props.taskId);
|
2025-11-25 17:37:02 +08:00
|
|
|
console.log(props.runInfo);
|
2025-12-16 11:19:40 +08:00
|
|
|
const res: any =
|
|
|
|
|
props.paramType === 'task'
|
|
|
|
|
? await getTaskPerformanceApi({ taskId: props.taskInfo?.id })
|
|
|
|
|
: await getRunPerformanceApi({ runId: props.runInfo?.uuid });
|
2025-10-30 19:30:06 +08:00
|
|
|
if (res && res.code === 200) {
|
2025-12-25 16:17:26 +08:00
|
|
|
performanceData.value = res.data.map((item: any) => {
|
|
|
|
|
const completeStatus = getPerformanceSTatus(item) || 0;
|
|
|
|
|
return {
|
|
|
|
|
...item,
|
|
|
|
|
completeStatus,
|
|
|
|
|
};
|
|
|
|
|
});
|
2025-10-30 19:30:06 +08:00
|
|
|
|
|
|
|
|
console.log(performanceData.value);
|
|
|
|
|
if (baseTableRef.value) {
|
|
|
|
|
baseTableRef.value.setDataFun(performanceData.value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// ElMessage.success('获取任务性能指标数据' + props.taskId);
|
|
|
|
|
};
|
|
|
|
|
|
2025-12-25 16:17:26 +08:00
|
|
|
const { RESULT_ACHIEVE_STATUS } = useDict('RESULT_ACHIEVE_STATUS');
|
|
|
|
|
|
2025-11-26 18:49:29 +08:00
|
|
|
const openAddPerformanceWindFun = () => {
|
2025-10-30 19:30:06 +08:00
|
|
|
performanceVisible.value = true;
|
|
|
|
|
};
|
|
|
|
|
|
2025-11-26 18:49:29 +08:00
|
|
|
const addPerformanceFun = async (data: any) => {
|
2025-10-30 19:30:06 +08:00
|
|
|
console.log(data, 'data');
|
|
|
|
|
data.flag = 'add';
|
2025-12-16 11:19:40 +08:00
|
|
|
const { fullData, visibleData, tableData, footerData } =
|
|
|
|
|
baseTableRef.value.tableRef.getTableData();
|
2025-10-30 19:30:06 +08:00
|
|
|
|
2025-12-16 11:19:40 +08:00
|
|
|
const existPerformance =
|
|
|
|
|
fullData.find((item: any) => {
|
|
|
|
|
return item.nodeName === data.nodeName;
|
|
|
|
|
}) || null;
|
2025-10-30 19:30:06 +08:00
|
|
|
|
|
|
|
|
if (existPerformance) {
|
|
|
|
|
ElMessage.warning('已存在该指标,无法新增!');
|
|
|
|
|
} else {
|
|
|
|
|
baseTableRef.value.tableRef.insertAt(data, -1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.log(fullData, 'fullData');
|
|
|
|
|
console.log(visibleData, 'visibleData');
|
|
|
|
|
console.log(tableData, 'tableData');
|
|
|
|
|
console.log(footerData, 'footerData');
|
|
|
|
|
|
|
|
|
|
performanceVisible.value = false;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const deletePerformanceList = ref<any>([]);
|
|
|
|
|
const delPerformance = (row: any) => {
|
|
|
|
|
baseTableRef.value.tableRef.remove(row);
|
|
|
|
|
if (row.flag != 'add') {
|
|
|
|
|
deletePerformanceList.value.push(row);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2025-11-26 18:49:29 +08:00
|
|
|
const batchAddTaskPerformanceFun = async () => {
|
2025-10-30 19:30:06 +08:00
|
|
|
const list = baseTableRef.value.tableRef.getInsertRecords();
|
|
|
|
|
|
|
|
|
|
console.log(list, 'list');
|
2025-11-25 19:56:52 +08:00
|
|
|
console.log(props.paramType, 'paramType');
|
2025-10-30 19:30:06 +08:00
|
|
|
|
|
|
|
|
const performanceList: any = [];
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < list.length; i++) {
|
2025-11-28 17:32:29 +08:00
|
|
|
const obj: any = {
|
2025-10-30 19:30:06 +08:00
|
|
|
uuid: '',
|
|
|
|
|
nodeId: '',
|
|
|
|
|
performanceName: list[i].performanceName,
|
|
|
|
|
nodeName: list[i].nodeName,
|
|
|
|
|
englishName: list[i].englishName,
|
|
|
|
|
nodeCode: list[i].nodeCode,
|
|
|
|
|
poolName: list[i].poolName,
|
|
|
|
|
performanceType: list[i].performanceType,
|
|
|
|
|
unit: list[i].unit,
|
|
|
|
|
targetValue: list[i].targetValue,
|
|
|
|
|
lowValue: list[i].lowValue,
|
|
|
|
|
highValue: list[i].highValue,
|
|
|
|
|
method: list[i].method,
|
|
|
|
|
description: list[i].description,
|
|
|
|
|
taskName: list[i].taskName,
|
|
|
|
|
standard: list[i].standard,
|
|
|
|
|
tenantId: list[i].tenantId,
|
|
|
|
|
createTime: list[i].createTime,
|
|
|
|
|
pid: 0,
|
|
|
|
|
};
|
|
|
|
|
|
2025-11-25 17:37:02 +08:00
|
|
|
if (props.paramType === 'task') {
|
2025-11-25 19:56:52 +08:00
|
|
|
obj.taskId = props.taskInfo?.uuid;
|
2025-11-25 17:37:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (props.paramType === 'run') {
|
2025-11-25 19:56:52 +08:00
|
|
|
obj.runId = props.runInfo.uuid;
|
|
|
|
|
obj.taskId = props.runInfo.taskId;
|
2025-11-25 17:37:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.log(obj, 'objobjobj');
|
|
|
|
|
|
2025-10-30 19:30:06 +08:00
|
|
|
performanceList.push(obj);
|
|
|
|
|
}
|
2025-11-25 17:37:02 +08:00
|
|
|
|
2025-10-30 19:30:06 +08:00
|
|
|
if (!list.length) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2025-11-25 17:37:02 +08:00
|
|
|
|
2025-11-28 17:32:29 +08:00
|
|
|
const param: any = {
|
2025-10-30 19:30:06 +08:00
|
|
|
performanceList: performanceList,
|
2025-11-25 17:37:02 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (props.paramType === 'task') {
|
2025-11-25 19:56:52 +08:00
|
|
|
param.taskId = props.taskInfo?.uuid;
|
2025-11-25 17:37:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (props.paramType === 'run') {
|
2025-11-25 19:56:52 +08:00
|
|
|
param.taskId = props.runInfo.taskId;
|
|
|
|
|
param.runId = props.runInfo.uuid;
|
2025-11-25 17:37:02 +08:00
|
|
|
}
|
|
|
|
|
const res: any = await batchAddTaskPerformanceApi(param);
|
2025-10-30 19:30:06 +08:00
|
|
|
if (res && res.code === 200) {
|
|
|
|
|
// ElMessage.success('新增成功!');
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2025-11-26 18:49:29 +08:00
|
|
|
const batchDeleteTaskPerformanceFun = async () => {
|
2025-10-30 19:30:06 +08:00
|
|
|
const ids = deletePerformanceList.value.map((item: any) => {
|
|
|
|
|
return item.id;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (!ids.length) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
const res: any = await batchDeleteTaskPerformanceApi(ids);
|
|
|
|
|
if (res && res.code === 200) {
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2025-11-26 18:49:29 +08:00
|
|
|
const saveFun = async () => {
|
|
|
|
|
await batchAddTaskPerformanceFun();
|
|
|
|
|
await batchDeleteTaskPerformanceFun();
|
2025-10-30 19:30:06 +08:00
|
|
|
};
|
|
|
|
|
|
2025-11-28 17:32:29 +08:00
|
|
|
const excelHeaders = ref<any>({});
|
|
|
|
|
const excelParams = ref<any>({});
|
|
|
|
|
const getFormConfigureFun = async () => {
|
2025-12-08 14:54:38 +08:00
|
|
|
const res: any = await getFormConfigureApi({
|
2025-11-28 17:32:29 +08:00
|
|
|
formName: 'PERFORMANCE_POOL',
|
2025-10-30 19:30:06 +08:00
|
|
|
});
|
|
|
|
|
|
2025-11-28 17:32:29 +08:00
|
|
|
if (res && res.code === 200) {
|
2025-12-08 14:54:38 +08:00
|
|
|
const cloumn: any = JSON.parse(res.data.formConfig) || [];
|
|
|
|
|
excelHeaders.value = cloumn.map((item: any) => {
|
2025-11-28 17:32:29 +08:00
|
|
|
return {
|
|
|
|
|
key: item.key,
|
|
|
|
|
title: item.title,
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (props.paramType === 'run') {
|
|
|
|
|
excelParams.value = {
|
|
|
|
|
runId: props.runInfo.uuid,
|
|
|
|
|
};
|
|
|
|
|
} else {
|
|
|
|
|
excelParams.value = {
|
|
|
|
|
taskId: props.taskInfo.id,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-10-30 19:30:06 +08:00
|
|
|
};
|
|
|
|
|
|
2025-12-25 16:17:26 +08:00
|
|
|
const getPerformanceSTatus = (row: any) => {
|
|
|
|
|
let status: any = 0;
|
|
|
|
|
// 当指标值,达标方式,目标值有一个不存在时,返回状态未分析
|
|
|
|
|
if (!row?.method || !row?.highValue || !row?.targetValue) {
|
|
|
|
|
return status;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (row?.method && row?.highValue && row?.targetValue) {
|
|
|
|
|
// 小于等于
|
|
|
|
|
if (row.method === '≤') {
|
|
|
|
|
if (row?.targetValue < row?.highValue || row?.targetValue === row?.highValue) {
|
|
|
|
|
status = 2;
|
|
|
|
|
} else {
|
|
|
|
|
status = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 小于
|
|
|
|
|
if (row.method === '<') {
|
|
|
|
|
if (row?.targetValue < row?.highValue) {
|
|
|
|
|
status = 2;
|
|
|
|
|
} else {
|
|
|
|
|
status = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 大于
|
|
|
|
|
if (row.method === '>') {
|
|
|
|
|
if (row?.targetValue > row?.highValue) {
|
|
|
|
|
status = 2;
|
|
|
|
|
} else {
|
|
|
|
|
status = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 大于等于
|
|
|
|
|
if (row.method === '≥') {
|
|
|
|
|
if (row?.targetValue > row?.highValue || row?.targetValue === row?.highValue) {
|
|
|
|
|
status = 2;
|
|
|
|
|
} else {
|
|
|
|
|
status = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 包含
|
|
|
|
|
if (row.method === '[]') {
|
|
|
|
|
if (
|
|
|
|
|
(row?.targetValue < row?.highValue || row?.targetValue === row?.highValue) &&
|
|
|
|
|
(row?.targetValue > row?.lowValue || row?.targetValue === row?.lowValue)
|
|
|
|
|
) {
|
|
|
|
|
status = 2;
|
|
|
|
|
} else {
|
|
|
|
|
status = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return status;
|
|
|
|
|
};
|
|
|
|
|
|
2025-10-30 19:30:06 +08:00
|
|
|
defineExpose({
|
2025-11-26 18:49:29 +08:00
|
|
|
saveFun,
|
2025-11-26 17:18:25 +08:00
|
|
|
baseTableRef,
|
2025-10-30 19:30:06 +08:00
|
|
|
});
|
|
|
|
|
|
2025-11-25 17:37:02 +08:00
|
|
|
const actionList = ref([
|
2025-12-08 14:54:38 +08:00
|
|
|
{
|
|
|
|
|
title: '编辑',
|
|
|
|
|
type: 'primary',
|
|
|
|
|
click: (row: any) => {
|
|
|
|
|
editPerformanceFun(row);
|
|
|
|
|
},
|
|
|
|
|
},
|
2025-11-25 17:37:02 +08:00
|
|
|
{
|
|
|
|
|
title: '删除',
|
|
|
|
|
type: 'danger',
|
|
|
|
|
needConfirm: true,
|
|
|
|
|
confirmTip: '确认删除吗?',
|
2025-11-28 17:32:29 +08:00
|
|
|
click: (row: any) => {
|
2025-11-25 17:37:02 +08:00
|
|
|
delPerformance(row);
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
]);
|
|
|
|
|
|
2025-12-08 14:54:38 +08:00
|
|
|
const currentPerformance = ref<any>({});
|
|
|
|
|
const editPerformanceFun = (row: any) => {
|
|
|
|
|
currentPerformance.value = row;
|
|
|
|
|
editPerformanceVisible.value = true;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const updatePerformanceFun = async (data: any) => {
|
|
|
|
|
editPerformanceVisible.value = false;
|
|
|
|
|
const res: any = await editPerformanceApi(data);
|
|
|
|
|
if (res && res.code === 200) {
|
|
|
|
|
ElMessage.success('操作成功');
|
2025-12-25 16:17:26 +08:00
|
|
|
await getTaskPerformanceDataFun();
|
2025-12-08 14:54:38 +08:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2025-10-30 19:30:06 +08:00
|
|
|
onMounted(async () => {
|
2025-11-26 18:49:29 +08:00
|
|
|
await getTaskPerformanceDataFun();
|
2025-11-28 17:32:29 +08:00
|
|
|
|
|
|
|
|
await getFormConfigureFun();
|
2025-10-30 19:30:06 +08:00
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
.task-performance-page {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
|
|
|
|
.operate-box {
|
|
|
|
|
width: 100%;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.mr12 {
|
|
|
|
|
margin-right: 12px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|