UPDATE: 1、子计划管理,筛选条件改成搜索、设备厂家、是否分配;
2、重复导入子计划时,增量被检设备并删除未检设备;
3、优化删除子计划后,刷新主计划信息;
This commit is contained in:
@@ -7,11 +7,12 @@
|
||||
:title="title"
|
||||
:width="width"
|
||||
class="table-box"
|
||||
top="114px"
|
||||
top="111px"
|
||||
@close="handleClose"
|
||||
>
|
||||
<div
|
||||
:style="{ height: height - 64 + 'px', maxHeight: height - 64 + 'px', overflow: 'hidden' }"
|
||||
v-if="dialogVisible"
|
||||
:style="{ height: height - 70 + 'px', maxHeight: height - 70 + 'px', overflow: 'hidden' }"
|
||||
class="table-box"
|
||||
>
|
||||
<el-tabs v-model="editableTabsValue" type="card" @tab-remove="removeTab" @tab-click="handleTabClick">
|
||||
@@ -23,19 +24,22 @@
|
||||
:name="item.name"
|
||||
></el-tab-pane>
|
||||
</el-tabs>
|
||||
<ProTable :key="planId" ref="proTable" :columns="columns" :request-api="getTableList" type="selection">
|
||||
<ProTable
|
||||
class="children-plan-table"
|
||||
:key="planId"
|
||||
ref="proTable"
|
||||
:columns="columns"
|
||||
:request-api="getTableList"
|
||||
type="selection"
|
||||
>
|
||||
<!-- 表格 header 按钮 -->
|
||||
<template #tableHeader="scope">
|
||||
<el-button
|
||||
v-if="!isTabPlanFather"
|
||||
icon="CirclePlus"
|
||||
type="primary"
|
||||
@click="addTab('add')"
|
||||
>
|
||||
<el-button v-if="!isTabPlanFather" icon="CirclePlus" type="primary" @click="addTab('add')">
|
||||
新增子计划
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="isTabPlanFather && planFormContent?.testState === 0"
|
||||
v-auth.plan="'add_subplan'"
|
||||
icon="Edit"
|
||||
type="primary"
|
||||
@click="addTab('edit')"
|
||||
@@ -172,6 +176,7 @@
|
||||
draggable
|
||||
:show-close="false"
|
||||
:close-on-click-modal="false"
|
||||
destroy-on-close
|
||||
>
|
||||
<el-row style="margin-top: 10px">
|
||||
<el-text v-if="progressData.status === ''" type="info">
|
||||
@@ -262,12 +267,30 @@ const getTableList = async (params: any) => {
|
||||
}
|
||||
|
||||
const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
||||
{ type: 'selection', fixed: 'left', width: 70, selectable: row => row.checkState == 0 },
|
||||
{ type: 'selection', fixed: 'left', width: 70, selectable: row => row.checkState == 0 || row.importFlag == 1 },
|
||||
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
||||
{
|
||||
prop: 'keywords',
|
||||
label: '关键词',
|
||||
search: {
|
||||
el: 'input',
|
||||
label: '搜索',
|
||||
order: 1,
|
||||
render: (scope: SearchRenderScope) => {
|
||||
return (
|
||||
<el-input
|
||||
v-model={scope.searchParam.keywords}
|
||||
placeholder="设备名称、地市、供电公司、变电站"
|
||||
clearable
|
||||
/>
|
||||
)
|
||||
}
|
||||
},
|
||||
isShow: false
|
||||
},
|
||||
{
|
||||
prop: 'name',
|
||||
label: '名称',
|
||||
search: { el: 'input' },
|
||||
minWidth: 180
|
||||
},
|
||||
{
|
||||
@@ -299,28 +322,26 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
||||
prop: 'manufacturer',
|
||||
label: '设备厂家',
|
||||
enum: dictStore.getDictData('Dev_Manufacturers'),
|
||||
search: { el: 'select', props: { filterable: true }, order: 1 },
|
||||
search: { el: 'select', props: { filterable: true, style: { width: 150 } }, order: 2 },
|
||||
fieldNames: { label: 'name', value: 'id' },
|
||||
minWidth: 200
|
||||
},
|
||||
{
|
||||
prop: 'assignSub',
|
||||
label: '是否分配',
|
||||
enum: [
|
||||
{ id: 0, name: '未分配' },
|
||||
{ id: 1, name: '已分配' }
|
||||
],
|
||||
search: { el: 'select', props: { filterable: true }, order: 3 },
|
||||
fieldNames: { label: 'name', value: 'id' },
|
||||
isShow: false
|
||||
},
|
||||
{
|
||||
prop: 'cityName',
|
||||
label: '地市',
|
||||
minWidth: 150
|
||||
},
|
||||
{
|
||||
prop: 'region',
|
||||
label: '地市',
|
||||
minWidth: 150,
|
||||
isShow: false,
|
||||
search: {
|
||||
el: 'input',
|
||||
label: '关键词',
|
||||
render: (scope: SearchRenderScope) => {
|
||||
return <el-input v-model={scope.searchParam.region} placeholder="请输入关键词" clearable />
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'gdName',
|
||||
label: '供电公司',
|
||||
@@ -335,9 +356,7 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
||||
prop: 'boundPlanName',
|
||||
label: '子计划',
|
||||
minWidth: 150,
|
||||
isShow: planFormContent.value?.importFlag === 0,
|
||||
render: scope => {
|
||||
console.log('boundPlanName', isTabPlanFather.value)
|
||||
const value = scope.row.boundPlanName
|
||||
if (!value) {
|
||||
return '/' // 空值直接返回空字符串
|
||||
@@ -352,7 +371,8 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
||||
{
|
||||
prop: 'checkState',
|
||||
label: '检测状态',
|
||||
minWidth: 150,
|
||||
minWidth: 120,
|
||||
fixed: 'right',
|
||||
render: (scope: { row: { checkState: number } }) => {
|
||||
return scope.row.checkState === 0 ? (
|
||||
<el-tag type="warning" effect="dark">
|
||||
@@ -509,10 +529,9 @@ const removeTab = async (targetName: TabPaneName) => {
|
||||
editableTabsValue.value = mainTab.name
|
||||
editableTabs.value = tabs.filter(tab => tab.name !== targetName)
|
||||
await props.refreshTable!() //刷新检测计划列表
|
||||
|
||||
planFormContent.value = props.currentPlan
|
||||
handleTabClick({ props: mainTab })
|
||||
}
|
||||
|
||||
// 弹窗打开方法
|
||||
const open = async (textTitle: string, data: Plan.ReqPlan, pattern: string) => {
|
||||
console.log('open', data)
|
||||
@@ -793,6 +812,7 @@ defineExpose({ open, handleTableDataUpdate })
|
||||
|
||||
interface ChildrenPlanProps {
|
||||
refreshTable?: () => Promise<void>
|
||||
currentPlan?: any
|
||||
width?: number
|
||||
height?: number
|
||||
}
|
||||
@@ -812,4 +832,4 @@ const props = withDefaults(defineProps<ChildrenPlanProps>(), {
|
||||
// default: 744,
|
||||
// },
|
||||
// }>()
|
||||
</script>
|
||||
</script>
|
||||
@@ -154,7 +154,7 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label-width="110" label="守时检测" prop="timeCheck">
|
||||
<!-- <el-form-item :label-width="110" label="守时检测" prop="timeCheck">
|
||||
<el-radio-group
|
||||
v-model="formContent.timeCheck"
|
||||
:disabled="planType != 0 || allDisabled || !canEdited"
|
||||
@@ -162,7 +162,7 @@
|
||||
<el-radio :value="1">是</el-radio>
|
||||
<el-radio :value="0">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-form-item>-->
|
||||
<!-- <el-form-item label="关联报告模版" :label-width="100" prop='associateReport'>
|
||||
<el-radio-group v-model="formContent.associateReport">
|
||||
<el-radio :value="1">是</el-radio>
|
||||
@@ -235,7 +235,7 @@
|
||||
:titles="['被检设备列表', '已选被检设备列表']"
|
||||
filter-placeholder="请输入内容搜索"
|
||||
:data="devData"
|
||||
:height="selectByMode ? 325 : 220"
|
||||
:height="selectByMode ? 272 : 220"
|
||||
:disabled="allDisabled"
|
||||
:expand-all="planType != 0"
|
||||
>
|
||||
@@ -504,7 +504,7 @@ function useMetaInfo() {
|
||||
sourceName: '',
|
||||
devIds: [],
|
||||
sourceIds: '',
|
||||
datasourceIds: '',
|
||||
datasourceIds: [],
|
||||
associateReport: 0,
|
||||
reportTemplateName: '',
|
||||
reportTemplateVersion: '',
|
||||
@@ -823,7 +823,7 @@ const open = async (sign: string, data: Plan.ReqPlan, currentMode: string, plan:
|
||||
formContent.errorSysId = pqErrSysList.value[0]?.id ?? ''
|
||||
formContent.sourceIds = pqSourceList.value[0]?.id ?? ''
|
||||
const datasourceDicts = dictStore.getDictData('Datasource')
|
||||
formContent.datasourceIds = datasourceDicts[0]?.code ?? ''
|
||||
formContent.datasourceIds = [datasourceDicts[0]?.code] ?? []
|
||||
} else {
|
||||
//编辑时先给表单赋值(这会没接收被检设备),需要手动再给被检设备复制后整体表单赋值
|
||||
|
||||
@@ -934,7 +934,6 @@ const open = async (sign: string, data: Plan.ReqPlan, currentMode: string, plan:
|
||||
const boundData = Array.isArray(boundPqDevList_Result.data) ? boundPqDevList_Result.data : []
|
||||
const unboundData = Array.isArray(unboundPqDevList_Result.data) ? unboundPqDevList_Result.data : []
|
||||
pqDevList.value = [...boundData, ...unboundData] as Device.ResPqDev[]
|
||||
formContent.devIds = boundData.map((i: any) => i.id) // 已绑定设备id集合
|
||||
|
||||
Object.assign(formContent, { ...data })
|
||||
//设备绑定显示
|
||||
@@ -967,6 +966,7 @@ const open = async (sign: string, data: Plan.ReqPlan, currentMode: string, plan:
|
||||
const fatherMemberData = Array.isArray(fatherMemberData_Result.data) ? fatherMemberData_Result.data : []
|
||||
memberData.value = fatherMemberData.map((user: any) => ({ ...user, disabled: false }))
|
||||
}
|
||||
formContent.devIds = boundData.map((i: any) => i.id) // 已绑定设备id集合
|
||||
}
|
||||
}
|
||||
|
||||
@@ -990,9 +990,9 @@ const open = async (sign: string, data: Plan.ReqPlan, currentMode: string, plan:
|
||||
formContent.sourceIds = formContent.sourceIds.join(',')
|
||||
}
|
||||
// 将 formContent.sourceIds 从数组转换为字符串
|
||||
if (Array.isArray(formContent.datasourceIds)) {
|
||||
/*if (Array.isArray(formContent.datasourceIds)) {
|
||||
formContent.datasourceIds = formContent.datasourceIds.join(',')
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
if (AppSceneStore.currentScene == '1') {
|
||||
@@ -1170,13 +1170,13 @@ const handleDataSourceChange = () => {
|
||||
|
||||
if (hasThreeSeconds && hasMinuteStats) {
|
||||
ElMessage.warning('3s实时数据与分钟统计数据不能同时选择')
|
||||
formContent.datasourceIds = ''
|
||||
formContent.datasourceIds = []
|
||||
}
|
||||
// 判断是否选择了多个“分钟统计数据”项
|
||||
const minuteStatLabels = selectedLabels.filter(label => label.includes('分钟'))
|
||||
if (minuteStatLabels.length > 1) {
|
||||
ElMessage.warning('分钟统计数据不能多选')
|
||||
formContent.datasourceIds = ''
|
||||
formContent.datasourceIds = []
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
v-auth.plan="'import_subplan'"
|
||||
icon="Upload"
|
||||
@click="importSubClick"
|
||||
v-if="modeStore.currentMode === '比对式'"
|
||||
@@ -140,6 +139,7 @@
|
||||
|
||||
<ChildrenPlan
|
||||
:refresh-table="refreshTable"
|
||||
:current-plan="selectedPlan"
|
||||
ref="childrenPlanView"
|
||||
:width="viewWidth"
|
||||
:height="viewHeight"
|
||||
@@ -158,7 +158,7 @@ import {
|
||||
importPlan,
|
||||
importSubPlan,
|
||||
staticsAnalyse
|
||||
} from '@/api/plan/plan.ts'
|
||||
} from '@/api/plan/plan'
|
||||
import { computed, onMounted, reactive, ref, watch } from 'vue'
|
||||
import type { Plan } from '@/api/plan/interface'
|
||||
import PlanPopup from '@/views/plan/planList/components/planPopup.vue' // 导入子组件
|
||||
@@ -171,8 +171,8 @@ import TestSourcePopup from '@/views/machine/testSource/components/testSourcePop
|
||||
import { type TestSource } from '@/api/device/interface/testSource'
|
||||
import { useModeStore } from '@/stores/modules/mode' // 引入模式 store
|
||||
import { useHandleData } from '@/hooks/useHandleData'
|
||||
import { dictReportState, dictResult, dictTestState } from '@/api/plan/planData.ts'
|
||||
import { getTestSourceById } from '@/api/device/testSource/index'
|
||||
import { dictReportState, dictResult, dictTestState } from '@/api/plan/planData'
|
||||
import { getTestSourceById } from '@/api/device/testSource'
|
||||
import ImportExcel from '@/components/ImportExcel/index.vue'
|
||||
import ImportZip from '@/components/ImportZip/index.vue'
|
||||
import { useDownload } from '@/hooks/useDownload'
|
||||
@@ -198,6 +198,7 @@ const currentPage = ref(1)
|
||||
const pageSize = ref(10)
|
||||
const currentPageData = ref<any[]>([]) //当前页的数据
|
||||
const patternId = ref('')
|
||||
const selectedPlan = ref()
|
||||
|
||||
onMounted(async () => {
|
||||
refreshTable()
|
||||
@@ -634,7 +635,8 @@ const handleDelete = async (params: Plan.ReqPlanParams) => {
|
||||
}
|
||||
|
||||
const openChildrenPlan = (row: Partial<Plan.ReqPlan> = {}) => {
|
||||
childrenPlanView.value.open('检测计划详情', row, patternId.value)
|
||||
selectedPlan.value = row
|
||||
childrenPlanView.value.open('子计划管理', row, patternId.value)
|
||||
}
|
||||
|
||||
const statisticalAnalysisMore = async (ids: string[], rows: Plan.ReqPlan[]) => {
|
||||
@@ -659,7 +661,7 @@ const importSubClick = () => {
|
||||
title: '导入检测计划',
|
||||
patternId: dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id ?? '',
|
||||
importApi: importSubPlan,
|
||||
confirmMessage: '本次导入会覆盖已有数据信息,是否确认继续?'
|
||||
confirmMessage: '本次导入会覆盖已有系统配置数据,是否确认继续?'
|
||||
}
|
||||
planImportZip.value?.acceptParams(params)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user