Browse Source

fix:机组系统子系统下拉框空则全部适配

pull/86/head
肖晋飞 3 weeks ago
parent
commit
f236164a6d
  1. 2
      src/api/alert/run/instant/index.ts
  2. 5
      src/views/run/instant/index.vue
  3. 40
      src/views/run/instant/instant.data.ts

2
src/api/alert/run/instant/index.ts

@ -3,7 +3,7 @@ import { defHttp } from '@/utils/http/axios'
export interface InstantPageReqVO extends PageParam {
mpName?: string
algorithmId?: number
}
export interface InstantVO {

5
src/views/run/instant/index.vue

@ -35,7 +35,10 @@ const [registerTable, { getForm, reload, getDataSource, updateTableDataRecord }]
schemas: searchFormSchema,
showResetButton: false,
actionColOptions: {
span: 5
span: 3,
style: {
marginLeft: '5px',
},
},
},

40
src/views/run/instant/instant.data.ts

@ -6,6 +6,7 @@ import { DICT_TYPE, getDictOptions } from '@/utils/dict'
import { getModelVersionList } from '@/api/alert/run/model/index'
import { optionListApi, subSystemListApi } from '@/api/alert/model/select'
import type { systemSelectParams } from '@/api/alert/model/model/optionsModel'
import {setObjToUrlParams} from "@/utils";
export const columns: BasicColumn[] = [
{
@ -96,13 +97,15 @@ export const columns: BasicColumn[] = [
const optionList = await optionListApi()
const systemOptions = ref<any>([])
systemOptions.value = optionList.systems
// systemOptions.value = optionList.systems
export const searchFormSchema: FormSchema[] = [
{
label: '机组',
field: 'unit',
component: 'Select',
defaultValue: optionList.units[0].id || null,
// defaultValue: optionList.units[0].id || null,
defaultValue: null,
colProps: { span: 4 },
componentProps: ({ schema, tableAction, formActionType, formModel }) => {
@ -120,8 +123,13 @@ export const searchFormSchema: FormSchema[] = [
unitId: e,
typeId: formModel.type,
}
//如果typeId是空,则不设置system'Options
if (!param.typeId) {
systemOptions.value = []
return
}
systemOptions.value = await subSystemListApi(param)
formModel.system = systemOptions.value[0].id
// formModel.system = systemOptions.value[0].id
},
}
},
@ -130,7 +138,9 @@ export const searchFormSchema: FormSchema[] = [
label: '系统',
field: 'type',
component: 'Select',
defaultValue: optionList.types[0].id || null,
// defaultValue: optionList.types[0].id || null,
defaultValue: null,
colProps: { span: 4 },
componentProps: ({ formModel }) => {
return {
@ -146,6 +156,11 @@ export const searchFormSchema: FormSchema[] = [
unitId: formModel.unit,
typeId: e,
}
//如果typeId是空,则不设置system'Options
if (!param.typeId) {
systemOptions.value = []
return
}
systemOptions.value = await subSystemListApi(param)
},
}
@ -155,7 +170,8 @@ export const searchFormSchema: FormSchema[] = [
label: '子系统',
field: 'system',
component: 'Select',
defaultValue: systemOptions.value[0].id || null,
// defaultValue: systemOptions.value[0].id || null,
defaultValue: null,
colProps: { span: 4 },
componentProps: () => {
return {
@ -170,10 +186,20 @@ export const searchFormSchema: FormSchema[] = [
label: '模型实例名称',
field: 'mpName',
component: 'Input',
labelWidth: 120,
labelWidth: 100,
defaultValue: '',
colProps: { span: 7 },
colProps: { span: 5 },
}, {
label: '算法',
field: 'algorithmId',
component: 'Select',
labelWidth: 40,
componentProps: {
options: [{ value: 1, label: "主成分分析(PCA)" }, { value: 2, label: "神经网络(ANN)" }],
},
defaultValue: null,
colProps: { span: 3 },
},
{
label: '状态1',

Loading…
Cancel
Save