UPDATE: 检测计划选择数据源逻辑改成主计划默认全选,子计划勾选校验

This commit is contained in:
贾同学
2025-09-05 08:57:39 +08:00
parent 5a7eea1052
commit 6122f53c8e
3 changed files with 35 additions and 26 deletions

View File

@@ -46,7 +46,7 @@ export namespace Plan {
export interface ReqPlan extends ResPlan {
datasourceIds:string;
datasourceIds:string | string[];
sourceIds: string | null;
planId:string;
scriptName: string ;

View File

@@ -19,6 +19,7 @@
<el-input
style="width: 82%; margin: 0 10px"
size="small"
clearable
v-model="filter.leftText"
:placeholder="props.filterPlaceholder"
/>
@@ -138,6 +139,7 @@
<el-input
style="width: 80%; margin: 0 10px"
size="small"
clearable
v-model="filter.rightText"
:placeholder="props.filterPlaceholder"
/>

View File

@@ -80,13 +80,13 @@
<el-form-item :label-width="110" label="数据源" prop="datasourceIds">
<el-select
v-model="formContent.datasourceIds"
:disabled="planType != 0 || allDisabled"
:max-collapse-tags="2"
:disabled="allDisabled"
:max-collapse-tags="1"
:multiple="selectByMode"
autocomplete="off"
clearable
:clearable="planType != 0"
collapse-tags
filterable
:filterable="planType != 0"
placeholder="请选择数据源"
@change="handleDataSourceChange"
>
@@ -95,6 +95,7 @@
:key="item.id"
:label="item.name"
:value="item.code || ''"
:disabled="planType == 0 || allDisabled"
/>
</el-select>
</el-form-item>
@@ -731,7 +732,11 @@ const open = async (sign: string, data: Plan.ReqPlan, currentMode: string, plan:
formContent.scriptId = pqScriptList.value[0]?.id ?? ''
formContent.errorSysId = pqErrSysList.value[0]?.id ?? ''
formContent.sourceIds = pqSourceList.value[0]?.id ?? ''
formContent.datasourceIds = dictStore.getDictData('Datasource')[0]?.code ?? ''
const datasourceDicts = dictStore.getDictData('Datasource')
if (plan == 0) {
formContent.datasourceIds = datasourceDicts.map(item => item.code)
}
// formContent.datasourceIds = dictStore.getDictData('Datasource')[0]?.code ?? ''
formContent.dataRule = dictStore.getDictData('Data_Rule')[0]?.id ?? ''
} else {
//编辑时先给表单赋值(这会没接收被检设备),需要手动再给被检设备复制后整体表单赋值
@@ -1018,6 +1023,7 @@ const dataSourceType = computed(() => {
const handleDataSourceChange = () => {
if (mode.value != '比对式') return
if (planType.value == 1 || planType.value == 2) {
// 获取当前选中的 datasourceIds并确保为数组
const values = Array.isArray(formContent.datasourceIds)
? formContent.datasourceIds
@@ -1043,6 +1049,7 @@ const handleDataSourceChange = () => {
formContent.datasourceIds = ''
}
}
}
//导入设备
const deviceImportExcel = ref<InstanceType<typeof ImportExcel> | null>(null)