diff --git a/src/views/warn/alarm/alarm.data.ts b/src/views/warn/alarm/alarm.data.ts index c422f8b..cc6c8f6 100644 --- a/src/views/warn/alarm/alarm.data.ts +++ b/src/views/warn/alarm/alarm.data.ts @@ -14,14 +14,16 @@ export const searchFormSchema: FormSchema[] = [ label: '机组', field: 'unit', component: 'Select', - defaultValue: optionList.units[0].id || null, - colProps: { span: 5 }, + // defaultValue: optionList.units[0].id || null, + defaultValue: null, + + colProps: { span: 4 }, componentProps: ({ schema, tableAction, formActionType, formModel }) => { return { // xxxx props allowClear: false, - placeholder: '请选择机组', + placeholder: '全部机组', options: optionList.units.map(unit => ({ value: unit.id, label: unit.name })), onChange: async (e: any) => { // const { reload } = tableAction @@ -32,8 +34,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 }, } }, @@ -42,12 +49,14 @@ export const searchFormSchema: FormSchema[] = [ label: '系统', field: 'type', component: 'Select', - defaultValue: optionList.types[0].id || null, - colProps: { span: 5 }, + // defaultValue: optionList.types[0].id || null, + defaultValue: null, + + colProps: { span: 4 }, componentProps: ({ formModel }) => { return { allowClear: false, - placeholder: '请选择系统', + placeholder: '全部系统', options: optionList.types.map(type => ({ value: type.id, label: type.name })), onChange: async (e: any) => { // const { reload } = tableAction @@ -58,6 +67,11 @@ export const searchFormSchema: FormSchema[] = [ unitId: formModel.unit, typeId: e, } + //如果typeId是空,则不设置system'Options + if (!param.typeId) { + systemOptions.value = [] + return + } systemOptions.value = await subSystemListApi(param) }, } @@ -67,12 +81,13 @@ export const searchFormSchema: FormSchema[] = [ label: '子系统', field: 'system', component: 'Select', - defaultValue: systemOptions.value[0].id || null, - colProps: { span: 5 }, + // defaultValue: systemOptions.value[0].id || null, + defaultValue: null, + colProps: { span: 4 }, componentProps: () => { return { allowClear: false, - placeholder: '请选择子系统', + placeholder: '全部子系统', options: systemOptions.value.map(system => ({ value: system.id, label: system.name })), } }, @@ -82,10 +97,11 @@ export const searchFormSchema: FormSchema[] = [ label: '模型实例名称', field: 'mpName', component: 'Input', - labelWidth: 120, + labelWidth: 100, + defaultValue: '', - colProps: { span: 6 }, - } + colProps: { span: 5 }, + }, ] export const columns: BasicColumn[] = [ diff --git a/src/views/warn/alarm/index.vue b/src/views/warn/alarm/index.vue index 2015c22..13791e8 100644 --- a/src/views/warn/alarm/index.vue +++ b/src/views/warn/alarm/index.vue @@ -79,8 +79,8 @@ async function handleTrend(record: Recordable) { } onMounted(async () => { - const { setFieldsValue } = getForm() - await setFieldsValue({ system: null }) + // const { setFieldsValue } = getForm() + // await setFieldsValue({ system: null }) })