ADD:添加导出子计划元信息和导入检修计划按钮逻辑
This commit is contained in:
@@ -123,3 +123,13 @@ export const getBoundStandardDevList = (params: Plan.ResPlan) => {
|
|||||||
export const getBoundStandardDevAllList = (params: Plan.ResPlan) => {
|
export const getBoundStandardDevAllList = (params: Plan.ResPlan) => {
|
||||||
return http.get(`/adPlan/getBoundStandardDev?planId=${params.id}&all=1`)
|
return http.get(`/adPlan/getBoundStandardDev?planId=${params.id}&all=1`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 导出子计划
|
||||||
|
export const exportSubPlan = (params: Plan.ResPlan) => {
|
||||||
|
return http.download(`/adPlan/exportSubPlan?planId=${params.id}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 导入子检测计划
|
||||||
|
export const importSubPlan = (params: Device.ReqPqDevParams) => {
|
||||||
|
return http.upload(`/adPlan/importSubPlan`, params)
|
||||||
|
}
|
||||||
3
frontend/src/components/ImportZip/index.scss
Normal file
3
frontend/src/components/ImportZip/index.scss
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
.upload {
|
||||||
|
width: 80%;
|
||||||
|
}
|
||||||
89
frontend/src/components/ImportZip/index.vue
Normal file
89
frontend/src/components/ImportZip/index.vue
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog
|
||||||
|
v-model="dialogVisible"
|
||||||
|
:title="`导入${parameter.title}`"
|
||||||
|
:destroy-on-close="true"
|
||||||
|
width="580px"
|
||||||
|
draggable
|
||||||
|
>
|
||||||
|
<el-form class="drawer-multiColumn-form" style="margin-top: 10px" label-width="100px">
|
||||||
|
<el-form-item label="文件上传:">
|
||||||
|
<el-upload
|
||||||
|
action="#"
|
||||||
|
class="upload"
|
||||||
|
drag
|
||||||
|
:http-request="uploadZip"
|
||||||
|
accept=".zip"
|
||||||
|
:show-file-list="false"
|
||||||
|
>
|
||||||
|
<slot name="empty">
|
||||||
|
<el-icon class="el-icon--upload">
|
||||||
|
<upload-filled />
|
||||||
|
</el-icon>
|
||||||
|
<div class="el-upload__text">
|
||||||
|
将文件拖到此处,或
|
||||||
|
<em>点击上传</em>
|
||||||
|
</div>
|
||||||
|
</slot>
|
||||||
|
<template #tip>
|
||||||
|
<slot name="tip">
|
||||||
|
<div class="el-upload__tip">请上传 .zip 标准格式文件</div>
|
||||||
|
</slot>
|
||||||
|
</template>
|
||||||
|
</el-upload>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts" name="ImportZip">
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import { ElMessage, UploadRequestOptions } from 'element-plus'
|
||||||
|
|
||||||
|
export interface ZipParameterProps {
|
||||||
|
title: string // 标题
|
||||||
|
patternId?: string // 模式ID
|
||||||
|
importApi?: (params: any) => Promise<any> // 批量导入的Api
|
||||||
|
}
|
||||||
|
// dialog状态
|
||||||
|
const dialogVisible = ref(false)
|
||||||
|
// 父组件传过来的参数
|
||||||
|
const parameter = ref<ZipParameterProps>({
|
||||||
|
title: ''
|
||||||
|
})
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'result', data: boolean): void
|
||||||
|
}>()
|
||||||
|
// 接收父组件参数
|
||||||
|
const acceptParams = (params: ZipParameterProps) => {
|
||||||
|
parameter.value = { ...parameter.value, ...params }
|
||||||
|
dialogVisible.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// 文件上传
|
||||||
|
const uploadZip = async (param: UploadRequestOptions) => {
|
||||||
|
let zipFormData = new FormData()
|
||||||
|
zipFormData.append('file', param.file)
|
||||||
|
if (parameter.value.patternId) {
|
||||||
|
zipFormData.append('patternId', parameter.value.patternId)
|
||||||
|
}
|
||||||
|
await parameter.value.importApi!(zipFormData).then(res => handleImportResponse(res))
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleImportResponse = (res: any) => {
|
||||||
|
if (res.code === 'A0000') {
|
||||||
|
ElMessage.success('导入成功')
|
||||||
|
} else {
|
||||||
|
ElMessage.error(res.message)
|
||||||
|
}
|
||||||
|
dialogVisible.value = false
|
||||||
|
emit('result', res.data)
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
acceptParams
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
@use './index.scss';
|
||||||
|
</style>
|
||||||
@@ -26,21 +26,20 @@
|
|||||||
<ProTable ref="proTable" :columns="columns" :request-api="getTableList" type="selection">
|
<ProTable ref="proTable" :columns="columns" :request-api="getTableList" type="selection">
|
||||||
<!-- 表格 header 按钮 -->
|
<!-- 表格 header 按钮 -->
|
||||||
<template #tableHeader="scope">
|
<template #tableHeader="scope">
|
||||||
<el-button type="primary" :icon="CirclePlus" @click="addTab('add')" v-if="!isTabPlanFather">
|
<el-button type="primary" icon="CirclePlus" @click="addTab('add')" v-if="!isTabPlanFather">
|
||||||
新增子计划
|
新增子计划
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button type="primary" :icon="CirclePlus" @click="addTab('edit')" v-if="isTabPlanFather">
|
<el-button type="primary" icon="Edit" @click="addTab('edit')" v-if="isTabPlanFather">
|
||||||
编辑子计划
|
编辑子计划
|
||||||
</el-button>
|
</el-button>
|
||||||
<!-- <el-button type="primary" :icon="Upload" >
|
<el-button type="primary" icon="Download" @click="exportPlan" v-if="isTabPlanFather">
|
||||||
导出检测方案
|
导出子计划元信息
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button type="primary" :icon="Download" >
|
<el-button type="primary" icon="Upload">导入检测结果</el-button>
|
||||||
导入检测结果
|
<el-button type="primary" icon="Box" v-if="!isTabPlanFather">数据合并</el-button>
|
||||||
</el-button> -->
|
|
||||||
<el-button
|
<el-button
|
||||||
type="danger"
|
type="danger"
|
||||||
:icon="Delete"
|
icon="Delete"
|
||||||
plain
|
plain
|
||||||
:disabled="!scope.isSelected"
|
:disabled="!scope.isSelected"
|
||||||
v-if="isTabPlanFather"
|
v-if="isTabPlanFather"
|
||||||
@@ -56,7 +55,7 @@
|
|||||||
>
|
>
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
:icon="ScaleToOriginal"
|
icon="ScaleToOriginal"
|
||||||
style="margin-left: 10px"
|
style="margin-left: 10px"
|
||||||
v-if="!isTabPlanFather"
|
v-if="!isTabPlanFather"
|
||||||
:disabled="!scope.isSelected"
|
:disabled="!scope.isSelected"
|
||||||
@@ -82,7 +81,7 @@
|
|||||||
>
|
>
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
:icon="ScaleToOriginal"
|
icon="ScaleToOriginal"
|
||||||
style="margin-left: 10px"
|
style="margin-left: 10px"
|
||||||
v-if="!isTabPlanFather"
|
v-if="!isTabPlanFather"
|
||||||
>
|
>
|
||||||
@@ -106,7 +105,7 @@
|
|||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
link
|
link
|
||||||
:icon="Delete"
|
icon="Delete"
|
||||||
v-if="!isTabPlanFather"
|
v-if="!isTabPlanFather"
|
||||||
:disabled="scope.row.checkState != 0"
|
:disabled="scope.row.checkState != 0"
|
||||||
@click="handleRemove(scope.row)"
|
@click="handleRemove(scope.row)"
|
||||||
@@ -116,7 +115,7 @@
|
|||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
link
|
link
|
||||||
:icon="Delete"
|
icon="Delete"
|
||||||
v-if="isTabPlanFather"
|
v-if="isTabPlanFather"
|
||||||
@click="subHandleRemove(scope.row)"
|
@click="subHandleRemove(scope.row)"
|
||||||
>
|
>
|
||||||
@@ -133,17 +132,17 @@
|
|||||||
<script setup lang="tsx">
|
<script setup lang="tsx">
|
||||||
import { ElMessage, ElMessageBox, TabPaneName } from 'element-plus'
|
import { ElMessage, ElMessageBox, TabPaneName } from 'element-plus'
|
||||||
import { computed, reactive, ref } from 'vue'
|
import { computed, reactive, ref } from 'vue'
|
||||||
import { CirclePlus, Delete, ScaleToOriginal } from '@element-plus/icons-vue'
|
|
||||||
import PlanPopup from '@/views/plan/planList/components/planPopup.vue' // 导入子组件
|
import PlanPopup from '@/views/plan/planList/components/planPopup.vue' // 导入子组件
|
||||||
import { Plan } from '@/api/plan/interface'
|
import { Plan } from '@/api/plan/interface'
|
||||||
import { useModeStore } from '@/stores/modules/mode' // 引入模式 store
|
import { useModeStore } from '@/stores/modules/mode' // 引入模式 store
|
||||||
import { ColumnProps, ProTableInstance, SearchRenderScope } from '@/components/ProTable/interface'
|
import { ColumnProps, ProTableInstance, SearchRenderScope } from '@/components/ProTable/interface'
|
||||||
import { deletePlan, getDevListByPlanId, subPlanBindDev } from '@/api/plan/plan'
|
import { deletePlan, exportSubPlan, getDevListByPlanId, subPlanBindDev } from '@/api/plan/plan'
|
||||||
import { Device } from '@/api/device/interface/device'
|
import { Device } from '@/api/device/interface/device'
|
||||||
import { useDictStore } from '@/stores/modules/dict'
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
import DevTransfer from '@/views/plan/planList/components/devTransfer.vue'
|
import DevTransfer from '@/views/plan/planList/components/devTransfer.vue'
|
||||||
import { useHandleData } from '@/hooks/useHandleData'
|
import { useHandleData } from '@/hooks/useHandleData'
|
||||||
import router from '@/routers'
|
import router from '@/routers'
|
||||||
|
import { useDownload } from '@/hooks/useDownload'
|
||||||
|
|
||||||
const dictStore = useDictStore()
|
const dictStore = useDictStore()
|
||||||
const planFormContent = ref<Plan.ReqPlan>()
|
const planFormContent = ref<Plan.ReqPlan>()
|
||||||
@@ -499,7 +498,7 @@ const handleRemove = async (row: any) => {
|
|||||||
|
|
||||||
//子计划下移除被检设备
|
//子计划下移除被检设备
|
||||||
const subHandleRemove = async (row: any) => {
|
const subHandleRemove = async (row: any) => {
|
||||||
ElMessageBox.confirm(`确定要移除计划【${row.name}】吗?`, '提示', {
|
ElMessageBox.confirm(`确定要移除被检设备【${row.name}】吗?`, '提示', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
@@ -554,6 +553,16 @@ const handleClose = () => {
|
|||||||
router.push('/plan/planList')
|
router.push('/plan/planList')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const exportPlan = async () => {
|
||||||
|
// 从 planFormContent.value?.children 中找到 id 与 item.name 匹配的子计划
|
||||||
|
const subPlanFormContent = planFormContent.value?.children?.find(child => child.id === planId.value)
|
||||||
|
const params = {
|
||||||
|
id: subPlanFormContent.id
|
||||||
|
}
|
||||||
|
ElMessageBox.confirm(`确认导出${subPlanFormContent.name}子计划元信息?`, '温馨提示', { type: 'warning' }).then(() =>
|
||||||
|
useDownload(exportSubPlan, `${subPlanFormContent.name}_子计划元信息`, params, false, '.zip')
|
||||||
|
)
|
||||||
|
}
|
||||||
defineExpose({ open, handleTableDataUpdate })
|
defineExpose({ open, handleTableDataUpdate })
|
||||||
|
|
||||||
interface ChildrenPlanProps {
|
interface ChildrenPlanProps {
|
||||||
@@ -566,10 +575,10 @@ const props = withDefaults(defineProps<ChildrenPlanProps>(), {
|
|||||||
width: 800,
|
width: 800,
|
||||||
height: 744
|
height: 744
|
||||||
})
|
})
|
||||||
|
|
||||||
// const props = defineProps<{
|
// const props = defineProps<{
|
||||||
// refreshTable: (() => Promise<void>) | undefined;
|
// refreshTable: (() => Promise<void>) | undefined;
|
||||||
// width: {
|
// width: {
|
||||||
// type: Number,
|
|
||||||
// default: 800,
|
// default: 800,
|
||||||
// },
|
// },
|
||||||
// height: {
|
// height: {
|
||||||
|
|||||||
@@ -1,37 +1,105 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class='table-box' ref='popupBaseView'>
|
<div class="table-box" ref="popupBaseView">
|
||||||
<ProTable
|
<ProTable
|
||||||
ref='proTable'
|
ref="proTable"
|
||||||
:columns='columns'
|
:columns="columns"
|
||||||
:data="currentPageData"
|
:data="currentPageData"
|
||||||
:request-api='getTableList'
|
:request-api="getTableList"
|
||||||
:pagination="false"
|
:pagination="false"
|
||||||
>
|
>
|
||||||
<!-- 表格 header 按钮 -->
|
<!-- 表格 header 按钮 -->
|
||||||
<template #tableHeader='scope'>
|
<template #tableHeader="scope">
|
||||||
<el-button type='primary' v-auth.plan="'import'" :icon='Download' @click='importClick' v-if="modeStore.currentMode != '比对式'">导入</el-button>
|
<el-button
|
||||||
<el-button type='primary' v-auth.plan="'export'" :icon='Upload' @click='exportClick' v-if="modeStore.currentMode != '比对式'">导出</el-button>
|
type="primary"
|
||||||
|
v-auth.plan="'import'"
|
||||||
|
:icon="Download"
|
||||||
|
@click="importClick"
|
||||||
|
v-if="modeStore.currentMode != '比对式'"
|
||||||
|
>
|
||||||
|
导入
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
v-auth.plan="'export'"
|
||||||
|
:icon="Upload"
|
||||||
|
@click="exportClick"
|
||||||
|
v-if="modeStore.currentMode != '比对式'"
|
||||||
|
>
|
||||||
|
导出
|
||||||
|
</el-button>
|
||||||
<!-- <el-button type='primary' v-auth.plan="'combine'" :icon='ScaleToOriginal' :disabled='!(scope.selectedList.length > 1)' @click='combineClick'>
|
<!-- <el-button type='primary' v-auth.plan="'combine'" :icon='ScaleToOriginal' :disabled='!(scope.selectedList.length > 1)' @click='combineClick'>
|
||||||
合并
|
合并
|
||||||
</el-button> -->
|
</el-button> -->
|
||||||
<el-button type='primary' v-auth.plan="'add'" :icon='CirclePlus' @click="openDialog('add')">新增</el-button>
|
<el-button
|
||||||
<el-button type='primary' v-auth.plan="'analysis'" :icon='List' :disabled='!scope.isSelected' @click='statisticalAnalysisMore(scope.selectedListIds,scope.selectedList)'>统计分析</el-button>
|
type="primary"
|
||||||
<el-button type='danger' v-auth.plan="'delete'" :icon='Delete' plain :disabled='!scope.isSelected' @click='batchDelete(scope.selectedListIds)'>
|
v-auth.plan="'import'"
|
||||||
|
icon="Upload"
|
||||||
|
@click="importSubClick"
|
||||||
|
v-if="modeStore.currentMode === '比对式'"
|
||||||
|
>
|
||||||
|
导入检测计划
|
||||||
|
</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"
|
||||||
|
: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>
|
</el-button>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
<!-- 表格操作 -->
|
<!-- 表格操作 -->
|
||||||
<template #operation='scope'>
|
<template #operation="scope">
|
||||||
<el-button type='primary' v-auth.plan="'edit'" link :icon='EditPen' @click="openDialog('edit',scope.row)">编辑</el-button>
|
<el-button
|
||||||
<el-button type='primary' v-auth.plan="'delete'" link :icon='Delete' @click='handleDelete(scope.row)'>删除</el-button>
|
type="primary"
|
||||||
<el-button type='primary' link :icon='List' @click="openChildrenPlan(scope.row)" v-if="modeStore.currentMode == '比对式' && scope.row.fatherPlanId == 0">子计划</el-button>
|
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="openChildrenPlan(scope.row)"
|
||||||
|
v-if="modeStore.currentMode == '比对式' && scope.row.fatherPlanId == 0"
|
||||||
|
>
|
||||||
|
子计划
|
||||||
|
</el-button>
|
||||||
<!-- <el-button type='primary' link :icon='List' @click='showDeviceOpen(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' v-if="scope.row.testState == '2'" @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>
|
</template>
|
||||||
|
|
||||||
<!-- 在此处新增 footer 插槽 -->
|
<!-- 在此处新增 footer 插槽 -->
|
||||||
<template #pagination ='scope'>
|
<template #pagination="scope">
|
||||||
<el-pagination
|
<el-pagination
|
||||||
:background="true"
|
:background="true"
|
||||||
:current-page="currentPage"
|
:current-page="currentPage"
|
||||||
@@ -47,45 +115,53 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 向计划导入/导出设备对话框 -->
|
<!-- 向计划导入/导出设备对话框 -->
|
||||||
<PlanPopup :refresh-table='refreshTable' ref='planPopup'/>
|
<PlanPopup :refresh-table="refreshTable" ref="planPopup" />
|
||||||
<!-- 查看误差体系详细信息 -->
|
<!-- 查看误差体系详细信息 -->
|
||||||
<ErrorStandardPopup :refresh-table='proTable?.getTableList' ref="errorStandardPopup"/>
|
<ErrorStandardPopup :refresh-table="proTable?.getTableList" ref="errorStandardPopup" />
|
||||||
<!-- 查看检测源 -->
|
<!-- 查看检测源 -->
|
||||||
<TestSourcePopup :refresh-table='proTable?.getTableList' ref="testSourcePopup"/>
|
<TestSourcePopup :refresh-table="proTable?.getTableList" ref="testSourcePopup" />
|
||||||
|
|
||||||
<ImportExcel ref='planImportExcel'/>
|
<ImportExcel ref="planImportExcel" />
|
||||||
|
<ImportZip ref="planImportZip" @result="importResult" />
|
||||||
|
|
||||||
<ChildrenPlan :refresh-table='refreshTable' ref='childrenPlanView' :width='viewWidth' :height='viewHeight'></ChildrenPlan>
|
<ChildrenPlan
|
||||||
|
:refresh-table="refreshTable"
|
||||||
|
ref="childrenPlanView"
|
||||||
|
:width="viewWidth"
|
||||||
|
:height="viewHeight"
|
||||||
|
></ChildrenPlan>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang='tsx' name='useProTable'>
|
<script setup lang="tsx" name="useProTable">
|
||||||
import ProTable from '@/components/ProTable/index.vue'
|
import ProTable from '@/components/ProTable/index.vue'
|
||||||
import type { ProTableInstance, ColumnProps, RenderScope } from '@/components/ProTable/interface'
|
import type { ColumnProps, ProTableInstance } from '@/components/ProTable/interface'
|
||||||
import { ScaleToOriginal, CirclePlus, Delete, EditPen, View, Upload, Download, List, Tools } from '@element-plus/icons-vue'
|
import { CirclePlus, Delete, Download, EditPen, List, Upload } from '@element-plus/icons-vue'
|
||||||
import {getPlanList,deletePlan,exportPlan,downloadTemplate,importPlan } from '@/api/plan/plan.ts'
|
import {
|
||||||
|
deletePlan,
|
||||||
|
downloadTemplate,
|
||||||
|
exportPlan,
|
||||||
|
getPlanList,
|
||||||
|
importPlan,
|
||||||
|
importSubPlan,
|
||||||
|
staticsAnalyse
|
||||||
|
} from '@/api/plan/plan.ts'
|
||||||
import { computed, onMounted, reactive, ref, watch } from 'vue'
|
import { computed, onMounted, reactive, ref, watch } from 'vue'
|
||||||
import type { Plan } from '@/api/plan/interface'
|
import type { Plan } from '@/api/plan/interface'
|
||||||
import PlanPopup from '@/views/plan/planList/components/planPopup.vue' // 导入子组件
|
import PlanPopup from '@/views/plan/planList/components/planPopup.vue' // 导入子组件
|
||||||
import DeviceOpen from '@/views/plan/planList/components/devPopup.vue'
|
|
||||||
import ChildrenPlan from '@/views/plan/planList/components/childrenPlan.vue'
|
import ChildrenPlan from '@/views/plan/planList/components/childrenPlan.vue'
|
||||||
import { useViewSize } from '@/hooks/useViewSize'
|
import { useViewSize } from '@/hooks/useViewSize'
|
||||||
import { useRouter } from 'vue-router'
|
|
||||||
import { useDictStore } from '@/stores/modules/dict'
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
import type { Action } from 'element-plus'
|
|
||||||
import type { ErrorSystem } from '@/api/error/interface'
|
|
||||||
import ErrorStandardPopup from '@/views/machine/errorSystem/components/errorStandardPopup.vue' // 导入子组件
|
import ErrorStandardPopup from '@/views/machine/errorSystem/components/errorStandardPopup.vue' // 导入子组件
|
||||||
import TestSourcePopup from '@/views/machine/testSource/components/testSourcePopup.vue' // 导入子组件
|
import TestSourcePopup from '@/views/machine/testSource/components/testSourcePopup.vue' // 导入子组件
|
||||||
import { type TestSource } from '@/api/device/interface/testSource'
|
import { type TestSource } from '@/api/device/interface/testSource'
|
||||||
import { useAppSceneStore, useModeStore } from '@/stores/modules/mode'; // 引入模式 store
|
import { useModeStore } from '@/stores/modules/mode' // 引入模式 store
|
||||||
import { useHandleData } from '@/hooks/useHandleData'
|
import { useHandleData } from '@/hooks/useHandleData'
|
||||||
import { dictTestState,dictReportState,dictResult } from '@/api/plan/planData.ts'
|
import { dictReportState, dictResult, dictTestState } from '@/api/plan/planData.ts'
|
||||||
import {getTestSourceById} from '@/api/device/testSource/index'
|
import { getTestSourceById } from '@/api/device/testSource/index'
|
||||||
import ImportExcel from '@/components/ImportExcel/index.vue'
|
import ImportExcel from '@/components/ImportExcel/index.vue'
|
||||||
import {useDownload} from "@/hooks/useDownload";
|
import ImportZip from '@/components/ImportZip/index.vue'
|
||||||
import {getTestConfig } from '@/api/system/base/index'
|
import { useDownload } from '@/hooks/useDownload'
|
||||||
import {type Base } from '@/api/system/base/interface'
|
|
||||||
import { getBoundPqDevList ,staticsAnalyse} from '@/api/plan/plan.ts'
|
|
||||||
|
|
||||||
// defineOptions({
|
// defineOptions({
|
||||||
// name: 'planList'
|
// name: 'planList'
|
||||||
@@ -98,48 +174,51 @@ const errorStandardPopup = ref()
|
|||||||
const testSourcePopup = ref()
|
const testSourcePopup = ref()
|
||||||
const planPopup = ref()
|
const planPopup = ref()
|
||||||
|
|
||||||
const modeStore = useModeStore();
|
const modeStore = useModeStore()
|
||||||
const tableData = ref<any[]>([])
|
const tableData = ref<any[]>([])
|
||||||
const planImportExcel = ref<InstanceType<typeof ImportExcel> | null>(null)
|
const planImportExcel = ref<InstanceType<typeof ImportExcel> | null>(null)
|
||||||
|
const planImportZip = ref<InstanceType<typeof ImportZip> | null>(null)
|
||||||
const { popupBaseView, viewWidth, viewHeight } = useViewSize()
|
const { popupBaseView, viewWidth, viewHeight } = useViewSize()
|
||||||
const pageTotal = ref(0)
|
const pageTotal = ref(0)
|
||||||
const currentPage = ref(1)
|
const currentPage = ref(1)
|
||||||
const pageSize = ref(10)
|
const pageSize = ref(10)
|
||||||
const currentPageData = ref<any[]>([])//当前页的数据
|
const currentPageData = ref<any[]>([]) //当前页的数据
|
||||||
const patternId = ref('')
|
const patternId = ref('')
|
||||||
|
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
refreshTable()
|
refreshTable()
|
||||||
|
|
||||||
})
|
})
|
||||||
//假分页后用data刷新
|
//假分页后用data刷新
|
||||||
const refreshTable = async () => {
|
const refreshTable = async () => {
|
||||||
try {
|
try {
|
||||||
console.log("表格刷新")
|
console.log('表格刷新')
|
||||||
patternId.value = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id;
|
patternId.value = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id
|
||||||
const result = await getPlanList({'patternId' : patternId.value} );
|
const result = await getPlanList({ patternId: patternId.value })
|
||||||
tableData.value = buildTree(result.data as any[]);
|
tableData.value = buildTree(result.data as any[])
|
||||||
pageTotal.value = tableData.value.length;
|
pageTotal.value = tableData.value.length
|
||||||
updateCurrentPageData(tableData.value)
|
updateCurrentPageData(tableData.value)
|
||||||
console.log("表格刷新成功")
|
console.log('表格刷新成功')
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
tableData.value = [];
|
tableData.value = []
|
||||||
ElMessage.error('获取计划列表失败');
|
ElMessage.error('获取计划列表失败')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 监听 tableData 变化
|
// 监听 tableData 变化
|
||||||
watch(() => tableData.value, (newVal) => {
|
watch(
|
||||||
|
() => tableData.value,
|
||||||
|
newVal => {
|
||||||
if (childrenPlanView.value && newVal) {
|
if (childrenPlanView.value && newVal) {
|
||||||
console.log('监听 tableData 变化', newVal)
|
console.log('监听 tableData 变化', newVal)
|
||||||
childrenPlanView.value.handleTableDataUpdate?.(newVal)
|
childrenPlanView.value.handleTableDataUpdate?.(newVal)
|
||||||
updateCurrentPageData(newVal)
|
updateCurrentPageData(newVal)
|
||||||
}
|
}
|
||||||
}, { deep: true, immediate: true })
|
},
|
||||||
|
{ deep: true, immediate: true }
|
||||||
|
)
|
||||||
|
|
||||||
//模糊查询计划列表
|
//模糊查询计划列表
|
||||||
const getTableList = async(params: any) => {
|
const getTableList = async (params: any) => {
|
||||||
let newParams = JSON.parse(JSON.stringify(params))
|
let newParams = JSON.parse(JSON.stringify(params))
|
||||||
// 从 newParams 中提取筛选条件
|
// 从 newParams 中提取筛选条件
|
||||||
const name = newParams.name
|
const name = newParams.name
|
||||||
@@ -156,21 +235,20 @@ const getTableList = async(params: any) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (reportState !== undefined && reportState !== null && reportState !== '') {
|
if (reportState !== undefined && reportState !== null && reportState !== '') {
|
||||||
match = item.reportState == (reportState)
|
match = item.reportState == reportState
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result !== undefined && result !== null && result !== '') {
|
if (result !== undefined && result !== null && result !== '') {
|
||||||
match = item.result == (result)
|
match = item.result == result
|
||||||
}
|
}
|
||||||
|
|
||||||
if (testState !== undefined && testState !== null && testState !== '') {
|
if (testState !== undefined && testState !== null && testState !== '') {
|
||||||
match = item.testState == (testState)
|
match = item.testState == testState
|
||||||
}
|
}
|
||||||
|
|
||||||
return match
|
return match
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
// 更新分页总数
|
// 更新分页总数
|
||||||
pageTotal.value = filteredData.length
|
pageTotal.value = filteredData.length
|
||||||
|
|
||||||
@@ -180,28 +258,27 @@ const getTableList = async(params: any) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function buildTree(flatList: any[]): any[] {
|
function buildTree(flatList: any[]): any[] {
|
||||||
const map = new Map();
|
const map = new Map()
|
||||||
const tree: any[] = [];
|
const tree: any[] = []
|
||||||
|
|
||||||
// First, create a map of all items by id for fast lookup
|
// First, create a map of all items by id for fast lookup
|
||||||
flatList.forEach(item => {
|
flatList.forEach(item => {
|
||||||
map.set(item.id, { ...item, children: [] });
|
map.set(item.id, { ...item, children: [] })
|
||||||
});
|
})
|
||||||
|
|
||||||
// Then, assign each item to its parent's children array
|
// Then, assign each item to its parent's children array
|
||||||
flatList.forEach(item => {
|
flatList.forEach(item => {
|
||||||
if (item.fatherPlanId && map.has(item.fatherPlanId)) {
|
if (item.fatherPlanId && map.has(item.fatherPlanId)) {
|
||||||
map.get(item.fatherPlanId).children.push(map.get(item.id));
|
map.get(item.fatherPlanId).children.push(map.get(item.id))
|
||||||
} else if (item.fatherPlanId === '0') {
|
} else if (item.fatherPlanId === '0') {
|
||||||
// Items with fatherPlanId '0' are root nodes
|
// Items with fatherPlanId '0' are root nodes
|
||||||
tree.push(map.get(item.id));
|
tree.push(map.get(item.id))
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
|
||||||
return tree;
|
return tree
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const handleSizeChange = (size: number) => {
|
const handleSizeChange = (size: number) => {
|
||||||
pageSize.value = size
|
pageSize.value = size
|
||||||
updateCurrentPageData()
|
updateCurrentPageData()
|
||||||
@@ -234,68 +311,72 @@ const dataSourceType = computed(() => {
|
|||||||
// 表格配置项
|
// 表格配置项
|
||||||
const columns = reactive<ColumnProps<Plan.ReqPlan>[]>([
|
const columns = reactive<ColumnProps<Plan.ReqPlan>[]>([
|
||||||
{ type: 'selection', fixed: 'left', minWidth: 70 },
|
{ type: 'selection', fixed: 'left', minWidth: 70 },
|
||||||
{ type: 'index', fixed: 'left', minWidth: 70, label: '序号'},
|
{ type: 'index', fixed: 'left', minWidth: 70, label: '序号' },
|
||||||
{
|
{
|
||||||
prop: 'name',
|
prop: 'name',
|
||||||
label: '名称',
|
label: '名称',
|
||||||
minWidth: 200,
|
minWidth: 200,
|
||||||
search: { el: 'input' },
|
search: { el: 'input' }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'testState',
|
prop: 'testState',
|
||||||
label: '检测状态',
|
label: '检测状态',
|
||||||
minWidth: 100,
|
minWidth: 100,
|
||||||
enum:dictTestState,
|
enum: dictTestState,
|
||||||
search: { el:'select',props: { filterable: true }},
|
search: { el: 'select', props: { filterable: true } },
|
||||||
fieldNames: { label: 'label', value: 'id' },
|
fieldNames: { label: 'label', value: 'id' },
|
||||||
render: scope => {
|
render: scope => {
|
||||||
return (
|
return scope.row.testState === 0 ? (
|
||||||
scope.row.testState === 0 ? <el-tag type='warning' effect="dark">未检</el-tag> :
|
<el-tag type="warning" effect="dark">
|
||||||
scope.row.testState === 1 ? <el-tag type='danger' effect="dark">检测中</el-tag> :
|
未检
|
||||||
<el-tag type='success' effect="dark">检测完成</el-tag>
|
</el-tag>
|
||||||
|
) : scope.row.testState === 1 ? (
|
||||||
|
<el-tag type="danger" effect="dark">
|
||||||
|
检测中
|
||||||
|
</el-tag>
|
||||||
|
) : (
|
||||||
|
<el-tag type="success" effect="dark">
|
||||||
|
检测完成
|
||||||
|
</el-tag>
|
||||||
)
|
)
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'progress',
|
prop: 'progress',
|
||||||
label: '检测进度',
|
label: '检测进度',
|
||||||
minWidth: 150,
|
minWidth: 150,
|
||||||
render: (scope) => {
|
render: scope => {
|
||||||
return (
|
return (
|
||||||
<el-progress
|
<el-progress
|
||||||
text-inside={true}
|
text-inside={true}
|
||||||
stroke-width={20}
|
stroke-width={20}
|
||||||
percentage={(scope.row.progress ?? 0) * 100}
|
percentage={(scope.row.progress ?? 0) * 100}
|
||||||
status='success'
|
status="success"
|
||||||
/>
|
/>
|
||||||
);
|
)
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'reportState',
|
prop: 'reportState',
|
||||||
label: '检测报告状态',
|
label: '检测报告状态',
|
||||||
minWidth: 120,
|
minWidth: 120,
|
||||||
enum:dictReportState,
|
enum: dictReportState,
|
||||||
search: { el: 'select', props: { filterable: true } },
|
search: { el: 'select', props: { filterable: true } },
|
||||||
fieldNames: { label: 'label', value: 'id' },
|
fieldNames: { label: 'label', value: 'id' },
|
||||||
render: scope => {
|
render: scope => {
|
||||||
return (
|
return scope.row.reportState === 0 ? '未生成' : scope.row.reportState === 1 ? '部分生成' : '全部生成'
|
||||||
scope.row.reportState === 0 ? '未生成' : scope.row.reportState === 1 ? '部分生成' : '全部生成'
|
}
|
||||||
)
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'result',
|
prop: 'result',
|
||||||
label: '检测结果',
|
label: '检测结果',
|
||||||
minWidth: 100,
|
minWidth: 100,
|
||||||
enum:dictResult,
|
enum: dictResult,
|
||||||
search: { el: 'select', props: { filterable: true } },
|
search: { el: 'select', props: { filterable: true } },
|
||||||
fieldNames: { label: 'label', value: 'id' },
|
fieldNames: { label: 'label', value: 'id' },
|
||||||
render: scope => {
|
render: scope => {
|
||||||
return (
|
return scope.row.result === 0 ? '不符合' : scope.row.result === 1 ? '符合' : '/'
|
||||||
scope.row.result === 0 ? '不符合' : scope.row.result === 1 ? '符合' : '/'
|
}
|
||||||
)
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'createTime',
|
prop: 'createTime',
|
||||||
@@ -303,63 +384,62 @@ const columns = reactive<ColumnProps<Plan.ReqPlan>[]>([
|
|||||||
minWidth: 180,
|
minWidth: 180,
|
||||||
render: scope => {
|
render: scope => {
|
||||||
if (scope.row.createTime) {
|
if (scope.row.createTime) {
|
||||||
const date = new Date(scope.row.createTime);
|
const date = new Date(scope.row.createTime)
|
||||||
const year = date.getFullYear();
|
const year = date.getFullYear()
|
||||||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
const month = String(date.getMonth() + 1).padStart(2, '0')
|
||||||
const day = String(date.getDate()).padStart(2, '0');
|
const day = String(date.getDate()).padStart(2, '0')
|
||||||
const hours = String(date.getHours()).padStart(2, '0');
|
const hours = String(date.getHours()).padStart(2, '0')
|
||||||
const minutes = String(date.getMinutes()).padStart(2, '0');
|
const minutes = String(date.getMinutes()).padStart(2, '0')
|
||||||
const seconds = String(date.getSeconds()).padStart(2, '0');
|
const seconds = String(date.getSeconds()).padStart(2, '0')
|
||||||
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
|
||||||
}
|
}
|
||||||
return '';
|
return ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'sourceName',
|
prop: 'sourceName',
|
||||||
label: '检测源',
|
label: '检测源',
|
||||||
minWidth: 300,
|
minWidth: 300,
|
||||||
isShow: modeStore.currentMode != "比对式",
|
isShow: modeStore.currentMode != '比对式',
|
||||||
render: scope => {
|
render: scope => {
|
||||||
const sourceNames = Array.isArray(scope.row.sourceName) ? scope.row.sourceName : [];
|
const sourceNames = Array.isArray(scope.row.sourceName) ? scope.row.sourceName : []
|
||||||
const sourceIds = Array.isArray(scope.row.sourceIds) ? scope.row.sourceIds : [];
|
const sourceIds = Array.isArray(scope.row.sourceIds) ? scope.row.sourceIds : []
|
||||||
const firstSourceName = sourceNames[0];
|
const firstSourceName = sourceNames[0]
|
||||||
const firstSourceId = sourceIds[0];
|
const firstSourceId = sourceIds[0]
|
||||||
const remainingSourceNames = sourceNames.slice(1);
|
const remainingSourceNames = sourceNames.slice(1)
|
||||||
const remainingSourceIds = sourceIds.slice(1);
|
const remainingSourceIds = sourceIds.slice(1)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div class='flx-flex-start'>
|
<div class="flx-flex-start">
|
||||||
{firstSourceName && (
|
{firstSourceName && (
|
||||||
<el-link type='primary' link onClick={() => showTestSource(firstSourceId)}>
|
<el-link type="primary" link onClick={() => showTestSource(firstSourceId)}>
|
||||||
{firstSourceName}
|
{firstSourceName}
|
||||||
</el-link>
|
</el-link>
|
||||||
)}
|
)}
|
||||||
<moreButtons isShow={isVisible(scope.row)}
|
<moreButtons
|
||||||
sourceNames={remainingSourceNames}//长度>1时,传给更多子组件从第二位开始的名字
|
isShow={isVisible(scope.row)}
|
||||||
|
sourceNames={remainingSourceNames} //长度>1时,传给更多子组件从第二位开始的名字
|
||||||
sourceIds={remainingSourceIds} //长度>1时,传给更多子组件从第二位开始的id
|
sourceIds={remainingSourceIds} //长度>1时,传给更多子组件从第二位开始的id
|
||||||
onSource-clicked={showTestSource}
|
onSource-clicked={showTestSource}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'scriptId',
|
prop: 'scriptId',
|
||||||
label: '检测脚本',
|
label: '检测脚本',
|
||||||
minWidth: 300,
|
minWidth: 300,
|
||||||
isShow: modeStore.currentMode != "比对式",
|
isShow: modeStore.currentMode != '比对式',
|
||||||
render: scope => {
|
render: scope => {
|
||||||
return (
|
return <span>{scope.row.scriptName}</span>
|
||||||
<span>{scope.row.scriptName}</span>
|
}
|
||||||
)
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'standardDevNameStr',
|
prop: 'standardDevNameStr',
|
||||||
label: '标准设备',
|
label: '标准设备',
|
||||||
minWidth: 250,
|
minWidth: 250,
|
||||||
isShow: modeStore.currentMode == "比对式",
|
isShow: modeStore.currentMode == '比对式',
|
||||||
render: scope => {
|
render: scope => {
|
||||||
const standardDevNameStr = scope.row.standardDevNameStr
|
const standardDevNameStr = scope.row.standardDevNameStr
|
||||||
if (!standardDevNameStr) {
|
if (!standardDevNameStr) {
|
||||||
@@ -372,24 +452,25 @@ const columns = reactive<ColumnProps<Plan.ReqPlan>[]>([
|
|||||||
prop: 'testItemNameStr',
|
prop: 'testItemNameStr',
|
||||||
label: '测试项',
|
label: '测试项',
|
||||||
minWidth: 300,
|
minWidth: 300,
|
||||||
isShow: modeStore.currentMode == "比对式",
|
isShow: modeStore.currentMode == '比对式'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'errorSysId',
|
prop: 'errorSysId',
|
||||||
label: '误差体系', minWidth:300,
|
label: '误差体系',
|
||||||
|
minWidth: 300,
|
||||||
render: scope => {
|
render: scope => {
|
||||||
return (
|
return (
|
||||||
<el-link type='primary' link onClick={() => showData(scope.row)}>
|
<el-link type="primary" link onClick={() => showData(scope.row)}>
|
||||||
{scope.row.errorSysName}
|
{scope.row.errorSysName}
|
||||||
</el-link>
|
</el-link>
|
||||||
)
|
)
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'origin',//null 表示主计划 1表示子计划
|
prop: 'origin', //null 表示主计划 1表示子计划
|
||||||
label: '来源',
|
label: '来源',
|
||||||
minWidth:200,
|
minWidth: 200,
|
||||||
isShow: modeStore.currentMode == "比对式",
|
isShow: modeStore.currentMode == '比对式'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'datasourceIds',
|
prop: 'datasourceIds',
|
||||||
@@ -397,7 +478,7 @@ const columns = reactive<ColumnProps<Plan.ReqPlan>[]>([
|
|||||||
enum: dictStore.getDictData(dataSourceType.value),
|
enum: dictStore.getDictData(dataSourceType.value),
|
||||||
fieldNames: { label: 'name', value: 'value' },
|
fieldNames: { label: 'name', value: 'value' },
|
||||||
minWidth: 230,
|
minWidth: 230,
|
||||||
render: (scope) => {
|
render: scope => {
|
||||||
const codes = scope.row.datasourceIds // 获取当前行的 datasourceIds 字段
|
const codes = scope.row.datasourceIds // 获取当前行的 datasourceIds 字段
|
||||||
if (!codes) {
|
if (!codes) {
|
||||||
return '/'
|
return '/'
|
||||||
@@ -407,7 +488,6 @@ const columns = reactive<ColumnProps<Plan.ReqPlan>[]>([
|
|||||||
const codeString = Array.isArray(codes) ? codes.join(',') : codes
|
const codeString = Array.isArray(codes) ? codes.join(',') : codes
|
||||||
const codeArray = codeString.split(',')
|
const codeArray = codeString.split(',')
|
||||||
if (codeArray.length > 1) {
|
if (codeArray.length > 1) {
|
||||||
|
|
||||||
// 查找与每个 code 值匹配的 name,然后拼接成逗号分割的字符串
|
// 查找与每个 code 值匹配的 name,然后拼接成逗号分割的字符串
|
||||||
const names = codeArray.map(code => {
|
const names = codeArray.map(code => {
|
||||||
const dictItem = dictStore.getDictData(dataSourceType.value).find(item => item.code === code)
|
const dictItem = dictStore.getDictData(dataSourceType.value).find(item => item.code === code)
|
||||||
@@ -419,51 +499,46 @@ const columns = reactive<ColumnProps<Plan.ReqPlan>[]>([
|
|||||||
// 查找单个 code 对应的 name
|
// 查找单个 code 对应的 name
|
||||||
const dictItem = dictStore.getDictData(dataSourceType.value).find(item => item.code === codeArray[0])
|
const dictItem = dictStore.getDictData(dataSourceType.value).find(item => item.code === codeArray[0])
|
||||||
return dictItem ? dictItem.name : '/' // 如果找到匹配的项,返回对应的 name
|
return dictItem ? dictItem.name : '/' // 如果找到匹配的项,返回对应的 name
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'dataRule',
|
prop: 'dataRule',
|
||||||
label: '数据处理原则',
|
label: '数据处理原则',
|
||||||
enum: dictStore.getDictData('Data_Rule'),
|
enum: dictStore.getDictData('Data_Rule'),
|
||||||
fieldNames: { label: 'name', value: 'id' },
|
fieldNames: { label: 'name', value: 'id' },
|
||||||
minWidth: 120,
|
minWidth: 120
|
||||||
},
|
},
|
||||||
|
|
||||||
{ prop: 'operation', label: '操作', fixed: 'right', minWidth: 250 },
|
{ prop: 'operation', label: '操作', fixed: 'right', minWidth: 250 }
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
function isVisible(row: Plan.ReqPlan) {
|
function isVisible(row: Plan.ReqPlan) {
|
||||||
if(!row.hasOwnProperty('sourceName') || !Array.isArray(row.sourceName)){
|
if (!row.hasOwnProperty('sourceName') || !Array.isArray(row.sourceName)) {
|
||||||
return false
|
return false
|
||||||
}
|
} else if (row.sourceName.length <= 1) {
|
||||||
else if(row.sourceName.length <= 1){
|
|
||||||
return false
|
return false
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function showData(row: any) {
|
function showData(row: any) {
|
||||||
let split = row.errorSysName.split('-')
|
let split = row.errorSysName.split('-')
|
||||||
errorStandardPopup.value?.open(row.errorSysName, {id:row.errorSysId,devLevel:split[split.length-1]})
|
errorStandardPopup.value?.open(row.errorSysName, { id: row.errorSysId, devLevel: split[split.length - 1] })
|
||||||
}
|
}
|
||||||
|
|
||||||
async function showTestSource(row:string) {
|
async function showTestSource(row: string) {
|
||||||
const patternId = dictStore.getDictData('Pattern').find(item=>item.name=== modeStore.currentMode)?.id ?? ''//获取数据字典中对应的id
|
const patternId = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id ?? '' //获取数据字典中对应的id
|
||||||
const params: TestSource.ResTestSource = {
|
const params: TestSource.ResTestSource = {
|
||||||
id: row, // 根据实际情况设
|
id: row, // 根据实际情况设
|
||||||
pattern: patternId,
|
pattern: patternId,
|
||||||
type: '',
|
type: '',
|
||||||
devType: '',
|
devType: '',
|
||||||
state: 0
|
state: 0
|
||||||
};
|
}
|
||||||
|
|
||||||
const result = await getTestSourceById(params);
|
|
||||||
testSourcePopup.value?.open('view', result.data, modeStore.currentMode);
|
|
||||||
|
|
||||||
|
const result = await getTestSourceById(params)
|
||||||
|
testSourcePopup.value?.open('view', result.data, modeStore.currentMode)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 点击导入按钮
|
// 点击导入按钮
|
||||||
@@ -471,87 +546,102 @@ const importClick = () => {
|
|||||||
const params = {
|
const params = {
|
||||||
title: '检测计划',
|
title: '检测计划',
|
||||||
showCover: false,
|
showCover: false,
|
||||||
patternId: dictStore.getDictData('Pattern').find(item=>item.name=== modeStore.currentMode)?.id ?? '',
|
patternId: dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id ?? '',
|
||||||
tempApi: downloadTemplate,
|
tempApi: downloadTemplate,
|
||||||
importApi: importPlan,
|
importApi: importPlan,
|
||||||
getTableList: refreshTable(),
|
getTableList: refreshTable()
|
||||||
}
|
}
|
||||||
planImportExcel.value?.acceptParams(params)
|
planImportExcel.value?.acceptParams(params)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 点击导出按钮
|
// 点击导出按钮
|
||||||
const exportClick = () => {
|
const exportClick = () => {
|
||||||
ElMessageBox.confirm('确认导出检测计划?', '温馨提示', { type: 'warning' }).then(() =>{
|
ElMessageBox.confirm('确认导出检测计划?', '温馨提示', { type: 'warning' }).then(() => {
|
||||||
useDownload(exportPlan,'检测计划导出数据', {...proTable.value?.searchParam,patternId:patternId}, false,'.xlsx')
|
useDownload(
|
||||||
|
exportPlan,
|
||||||
|
'检测计划导出数据',
|
||||||
|
{ ...proTable.value?.searchParam, patternId: patternId },
|
||||||
|
false,
|
||||||
|
'.xlsx'
|
||||||
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 打开 drawer(新增、编辑)
|
// 打开 drawer(新增、编辑)
|
||||||
const openDialog = (titleType: string, row: Partial<Plan.ReqPlan> = {}) => {
|
const openDialog = (titleType: string, row: Partial<Plan.ReqPlan> = {}) => {
|
||||||
let planType = 0; // 0主计划 1子计划 2修改子计划
|
let planType = 0 // 0主计划 1子计划 2修改子计划
|
||||||
|
|
||||||
if (modeStore.currentMode === '比对式') {
|
if (modeStore.currentMode === '比对式') {
|
||||||
if (titleType === 'add') {
|
if (titleType === 'add') {
|
||||||
// 新增只能是主计划
|
// 新增只能是主计划
|
||||||
planType = 0;
|
planType = 0
|
||||||
} else {
|
} else {
|
||||||
// 编辑情况
|
// 编辑情况
|
||||||
if (row.children?.length > 0) {
|
if (row.children?.length > 0) {
|
||||||
// 有子计划 -> 主计划
|
// 有子计划 -> 主计划
|
||||||
planType = 0;
|
planType = 0
|
||||||
} else if (row.origin == null) {
|
} else if (row.origin == null) {
|
||||||
// 没有来源 -> 主计划
|
// 没有来源 -> 主计划
|
||||||
planType = 0;
|
planType = 0
|
||||||
} else {
|
} else {
|
||||||
// 其他 -> 修改子计划
|
// 其他 -> 修改子计划
|
||||||
planType = 2;
|
planType = 2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
planPopup.value?.open(titleType, row, modeStore.currentMode, planType);
|
planPopup.value?.open(titleType, row, modeStore.currentMode, planType)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 批量删除设备
|
// 批量删除设备
|
||||||
const batchDelete = async (id: string[]) => {
|
const batchDelete = async (id: string[]) => {
|
||||||
await useHandleData(deletePlan, {'id':id, 'pattern':patternId.value},'删除所选检测计划')
|
await useHandleData(deletePlan, { id: id, pattern: patternId.value }, '删除所选检测计划')
|
||||||
proTable.value?.clearSelection()
|
proTable.value?.clearSelection()
|
||||||
await refreshTable()
|
await refreshTable()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除检测计划
|
// 删除检测计划
|
||||||
const handleDelete = async (params: Plan.ReqPlanParams) => {
|
const handleDelete = async (params: Plan.ReqPlanParams) => {
|
||||||
await useHandleData(deletePlan, {id: [params.id], 'pattern': patternId.value}, `删除【${params.name}】检测计划`)
|
await useHandleData(deletePlan, { id: [params.id], pattern: patternId.value }, `删除【${params.name}】检测计划`)
|
||||||
proTable.value?.clearSelection()
|
proTable.value?.clearSelection()
|
||||||
await refreshTable()
|
await refreshTable()
|
||||||
}
|
}
|
||||||
|
|
||||||
const openChildrenPlan = (row: Partial<Plan.ReqPlan> = {}) => {
|
const openChildrenPlan = (row: Partial<Plan.ReqPlan> = {}) => {
|
||||||
childrenPlanView.value.open("检测计划详情",row,patternId.value)
|
childrenPlanView.value.open('检测计划详情', row, patternId.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const statisticalAnalysisMore = async (ids: string[], rows: Plan.ReqPlan[]) => {
|
const statisticalAnalysisMore = async (ids: string[], rows: Plan.ReqPlan[]) => {
|
||||||
const hasInvalidState = rows.some(row => row.testState != 2);
|
const hasInvalidState = rows.some(row => row.testState != 2)
|
||||||
if (hasInvalidState) {
|
if (hasInvalidState) {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
message: '存在检测状态不为检测完成的计划,无法进行统计分析。',
|
message: '存在检测状态不为检测完成的计划,无法进行统计分析。'
|
||||||
});
|
})
|
||||||
proTable.value?.clearSelection()
|
proTable.value?.clearSelection()
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
useDownload(staticsAnalyse,'分析结果', ids, false,'.xlsx')
|
useDownload(staticsAnalyse, '分析结果', ids, false, '.xlsx')
|
||||||
}
|
}
|
||||||
|
|
||||||
const statisticalAnalysis = async (row: Partial<Plan.ReqPlan> = {}) => {
|
const statisticalAnalysis = async (row: Partial<Plan.ReqPlan> = {}) => {
|
||||||
useDownload(staticsAnalyse,'分析结果', [row.id], false,'.xlsx')
|
useDownload(staticsAnalyse, '分析结果', [row.id], false, '.xlsx')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const importSubClick = () => {
|
||||||
|
const params = {
|
||||||
|
title: '检测计划',
|
||||||
|
patternId: dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id ?? '',
|
||||||
|
importApi: importSubPlan
|
||||||
|
}
|
||||||
|
planImportZip.value?.acceptParams(params)
|
||||||
|
}
|
||||||
|
|
||||||
|
const importResult = async (success: boolean | undefined) => {
|
||||||
|
if (success) {
|
||||||
|
await refreshTable()
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped></style>
|
||||||
|
|
||||||
</style>
|
|
||||||
Reference in New Issue
Block a user