This commit is contained in:
sjl
2025-02-21 14:57:52 +08:00
parent 1a9d8e8606
commit 7a76c2da8a

View File

@@ -13,7 +13,7 @@
合并
</el-button>
<el-button type='primary' v-auth.plan="'add'" :icon='CirclePlus' @click="openDialog('add')">新增</el-button>
<el-button type='primary' v-auth.plan="'analysis'" :icon='List' @click='statisticalAnalysisMore(scope.selectedListIds)'>统计分析</el-button>
<el-button type='primary' v-auth.plan="'analysis'" :icon='List' :disabled='!scope.isSelected' @click='statisticalAnalysisMore(scope.selectedListIds,scope.selectedList)'>统计分析</el-button>
<el-button type='danger' v-auth.plan="'delete'" :icon='Delete' plain :disabled='!scope.isSelected' @click='batchDelete(scope.selectedListIds)'>
删除
</el-button>
@@ -24,7 +24,7 @@
<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>
<el-button type='primary' v-auth.plan="'analysis'" link :icon='List' v-if="scope.row.testState != '2'" @click='statisticalAnalysis(scope.row)'>统计分析</el-button>
</template>
</ProTable>
</div>
@@ -89,13 +89,19 @@ const devTransferPopup = ref()
const modeStore = useModeStore();
const planImportExcel = ref<InstanceType<typeof ImportExcel> | null>(null)
const planList = ref<Plan.ResPlan[]>([]);
const getTableList = async(params: any) => {
let newParams = JSON.parse(JSON.stringify(params))
const patternId = dictStore.getDictData('Pattern').find(item=>item.name=== modeStore.currentMode)?.id//获取数据字典中对应的id
newParams.pattern = patternId
return getPlanList(newParams)
try {
const result = await getPlanList(newParams);
planList.value = result.data as Plan.ResPlan[];
return result;
} catch (error) {
return { data: [] }; // 返回空数据或处理错误
}
}
@@ -396,8 +402,16 @@ const showDeviceOpen = (row: Partial<Plan.ReqPlan> = {}) => {
const myDict = new Map<string, any[]>();
const statisticalAnalysisMore = async (id: string[]) =>{
useDownload(staticsAnalyse,'分析结果', id, false,'.xlsx')
const statisticalAnalysisMore = async (ids: string[], rows: Plan.ReqPlan[]) => {
const hasInvalidState = rows.some(row => row.testState != 2);
if (hasInvalidState) {
ElMessage({
type: 'error',
message: '存在检测状态不为检测完成的计划,无法进行统计分析。',
});
return;
}
useDownload(staticsAnalyse,'分析结果', ids, false,'.xlsx')
}
const statisticalAnalysis = async (row: Partial<Plan.ReqPlan> = {}) => {