This commit is contained in:
sjl
2025-02-13 15:40:13 +08:00
parent ddeb84fcfe
commit 475d236b7e
10 changed files with 149 additions and 88 deletions

View File

@@ -7,21 +7,22 @@
>
<!-- 表格 header 按钮 -->
<template #tableHeader='scope'>
<el-button type='primary' :icon='Download' @click='importClick'>导入</el-button>
<el-button type='primary' :icon='Upload' @click='exportClick'>导出</el-button>
<el-button type='primary' :icon='ScaleToOriginal' :disabled='!(scope.selectedList.length > 1)' @click='combineClick'>
<el-button type='primary' v-auth.plan="'import'" :icon='Download' @click='importClick'>导入</el-button>
<el-button type='primary' v-auth.plan="'export'" :icon='Upload' @click='exportClick'>导出</el-button>
<el-button type='primary' v-auth.plan="'combine'" :icon='ScaleToOriginal' :disabled='!(scope.selectedList.length > 1)' @click='combineClick'>
合并
</el-button>
<el-button type='primary' :icon='CirclePlus' @click="openDialog('add')">新增</el-button>
<el-button type='danger' :icon='Delete' plain :disabled='!scope.isSelected' @click='batchDelete(scope.selectedListIds)'>
<el-button type='primary' v-auth.plan="'add'" :icon='CirclePlus' @click="openDialog('add')">新增</el-button>
<el-button type='danger' v-auth.plan="'delete'" :icon='Delete' plain :disabled='!scope.isSelected' @click='batchDelete(scope.selectedListIds)'>
删除
</el-button>
</template>
<!-- 表格操作 -->
<template #operation='scope'>
<el-button type='primary' link :icon='EditPen' @click="openDialog('edit',scope.row)">编辑</el-button>
<el-button type='primary' link :icon='Delete' @click='handleDelete(scope.row)'>删除</el-button>
<el-button type='primary' v-auth.plan="'edit'" link :icon='EditPen' @click="openDialog('edit',scope.row)">编辑</el-button>
<el-button type='primary' v-auth.plan="'delete'" link :icon='Delete' @click='handleDelete(scope.row)'>删除</el-button>
<!-- <el-button type='primary' link :icon='List' @click='showDeviceOpen(scope.row)'>设备绑定</el-button> -->
<el-button type='primary' v-auth.plan="'analysis'" link :icon='List' @click='statisticalAnalysis(scope.row)'>统计分析</el-button>
</template>
</ProTable>
</div>
@@ -35,6 +36,8 @@
<!-- 查看设备绑定
<DevTransfer :refresh-table='proTable?.getTableList' ref='devTransferPopup'/> -->
<ImportExcel ref='deviceImportExcel' />
</template>
<script setup lang='tsx' name='useProTable'>
@@ -63,7 +66,9 @@ import { dictTestState,dictReportState,dictResult } from '@/api/plan/planData.ts
import {getTestSourceById} from '@/api/device/testSource/index'
import ImportExcel from "@/components/ImportExcel/index.vue";
import {useDownload} from "@/hooks/useDownload";
import {exportPqDev} from "@/api/device/device";
import {getTestConfig } from '@/api/system/base/index'
import {type Base } from '@/api/system/base/interface'
import { getBoundPqDevList } from '@/api/plan/plan.ts'
// defineOptions({
// name: 'planList'
@@ -103,7 +108,6 @@ const dataSourceType = computed(() => {
}
})
// 表格配置项
const columns = reactive<ColumnProps<Plan.ReqPlan>[]>([
@@ -253,14 +257,9 @@ const columns = reactive<ColumnProps<Plan.ReqPlan>[]>([
},
},
{ prop: 'operation', label: '操作', fixed: 'right', width: 200 },
{ prop: 'operation', label: '操作', fixed: 'right', width: 300 },
])
const handleSourceClicked = (id: string) => {
};
function isVisible(row: Plan.ReqPlan) {
if(!row.hasOwnProperty('sourceName') || !Array.isArray(row.sourceName)){
@@ -298,7 +297,6 @@ function showTestScript(row: string) {
}
function handleFiles(event: Event) {
const target = event.target as HTMLInputElement
const files = target.files
@@ -371,9 +369,6 @@ const combineClick = () => {
})
}
// 打开 drawer(新增、编辑)
const openDialog = (titleType: string, row: Partial<Plan.ReqPlan> = {}) => {
planPopup.value?.open(titleType, row,modeStore.currentMode)
@@ -397,6 +392,44 @@ const showDeviceOpen = (row: Partial<Plan.ReqPlan> = {}) => {
devTransferPopup.value.open(row)
}
const myDict = new Map<string, any[]>();
// 引用图表容器
const chartContainer = ref<HTMLElement | null>(null);
let myChart: echarts.ECharts | null = null;
const statisticalAnalysis = async (row: Partial<Plan.ReqPlan> = {}) => {
// const response = await getTestConfig() as unknown as Base.ResTestConfig
// const maxTime= response.data.maxTime//检测最大次数
// const dev = await getBoundPqDevList({ 'planId': row.id })
// for (let i = 0; i <= maxTime; i++) {
// dev.data.forEach((item: any) => {
// if(item.reCheckNum === i){
// // 向已有的数组中添加元素
// if (myDict.has(i.toString())) {
// myDict.get(i.toString())?.push(item.name);
// }else{
// myDict.set(i.toString(), [item.name]);
// }
// }
// })
// }
// for (let i = 0; i <= maxTime; i++) {
// if (myDict.has(i.toString())) {
// const array = myDict.get(i.toString());
// if (array) {
// for (const value of array) {
// console.log(i + '---'+value);
// }
// }
// }
// }
}
</script>
<style scoped>