diff --git a/src/views/run/calc/index.vue b/src/views/run/calc/index.vue index d75a7cb..9f06050 100644 --- a/src/views/run/calc/index.vue +++ b/src/views/run/calc/index.vue @@ -4,7 +4,7 @@ import {onMounted, ref, reactive} from 'vue' import moment from 'moment' import HistoryModal from '../../exa/config/HistoryModal.vue' import {calcFormSchemas, columns} from './calc.data' -import {searchFormSchema} from '../instant/instant.data' +import {getSearchFormSchema} from '../instant/instant.data' import {BasicTable, TableAction, useTable} from '@/components/Table' import {BasicForm, useForm} from '@/components/Form' @@ -30,6 +30,8 @@ const statusMap = { // 添加多选框相关状态 const selectedRowss = ref([]) +const searchSchema = ref(getSearchFormSchema(true)) // 不显示算法 + const [registerTable, {getForm, reload, getDataSource, updateTableDataRecord}] = useTable({ title: '实例列表', api: getInstantPage, @@ -38,7 +40,7 @@ const [registerTable, {getForm, reload, getDataSource, updateTableDataRecord}] = columns, formConfig: { labelWidth: 70, - schemas: searchFormSchema, + schemas: searchSchema.value, showResetButton: false, actionColOptions: { span: 2, diff --git a/src/views/run/instant/index.vue b/src/views/run/instant/index.vue index 6c71067..39e2f9e 100644 --- a/src/views/run/instant/index.vue +++ b/src/views/run/instant/index.vue @@ -3,7 +3,7 @@ import { Tag,Badge, Switch } from 'ant-design-vue' import { onMounted, ref } from 'vue' import HistoryModal from '../../exa/config/HistoryModal.vue' -import { columns, searchFormSchema } from './instant.data' +import {columns, getSearchFormSchema} from './instant.data' import CreateModal from './CreateModal.vue' import UpdateModal from './UpdateModal.vue' @@ -23,6 +23,7 @@ const { t } = useI18n() const [registerHistoryModal, { openModal: openHistoryModal }] = useModal() const [registerCreateModal, { openModal: openCreateModal }] = useModal() const [registerUpdateModal, { openModal: openUpdateModal }] = useModal() +const searchSchema = ref(getSearchFormSchema(true)) // 不显示算法 const [registerTable, { getForm, reload, getDataSource, updateTableDataRecord }] = useTable({ title: '实例列表', @@ -32,7 +33,7 @@ const [registerTable, { getForm, reload, getDataSource, updateTableDataRecord }] columns, formConfig: { labelWidth: 80, - schemas: searchFormSchema, + schemas: searchSchema.value, showResetButton: false, actionColOptions: { span: 3, diff --git a/src/views/run/instant/instant.data.ts b/src/views/run/instant/instant.data.ts index 82e104d..1d38423 100644 --- a/src/views/run/instant/instant.data.ts +++ b/src/views/run/instant/instant.data.ts @@ -98,127 +98,226 @@ const optionList = await optionListApi() const systemOptions = ref([]) // systemOptions.value = optionList.systems -export const searchFormSchema: FormSchema[] = [ - { - label: '机组', - field: 'unit', - component: 'Select', - // defaultValue: optionList.units[0].id || null, - defaultValue: null, - - colProps: { span: 4 }, - - componentProps: ({ schema, tableAction, formActionType, formModel }) => { - return { - // xxxx props +// export const searchFormSchema: FormSchema[] = [ +// { +// label: '机组', +// field: 'unit', +// component: 'Select', +// // defaultValue: optionList.units[0].id || null, +// defaultValue: null, +// +// colProps: { span: 4 }, +// +// componentProps: ({ schema, tableAction, formActionType, formModel }) => { +// return { +// // xxxx props +// placeholder: '全部机组', +// options: optionList.units.map(unit => ({ value: unit.id, label: unit.name })), +// onChange: async (e: any) => { +// // const { reload } = tableAction +// // reload() +// // or +// console.log(e) +// const param: systemSelectParams = { +// unitId: e, +// typeId: formModel.type, +// } +// //如果typeId是空,则不设置system'Options +// if (!param.typeId || !param.unitId) { +// systemOptions.value = [] +// return +// } +// systemOptions.value = await subSystemListApi(param) +// // formModel.system = systemOptions.value[0].id +// }, +// } +// }, +// }, +// { +// label: '系统', +// field: 'type', +// component: 'Select', +// // defaultValue: optionList.types[0].id || null, +// defaultValue: null, +// +// colProps: { span: 4 }, +// componentProps: ({ formModel }) => { +// return { +// placeholder: '全部系统', +// options: optionList.types.map(type => ({ value: type.id, label: type.name })), +// onChange: async (e: any) => { +// // const { reload } = tableAction +// // reload() +// // or +// console.log(e) +// const param: systemSelectParams = { +// unitId: formModel.unit, +// typeId: e, +// } +// //如果typeId是空,则不设置system'Options +// if (!param.typeId || !param.unitId) { +// systemOptions.value = [] +// return +// } +// systemOptions.value = await subSystemListApi(param) +// }, +// } +// }, +// }, +// { +// label: '子系统', +// field: 'system', +// component: 'Select', +// // defaultValue: systemOptions.value[0].id || null, +// defaultValue: null, +// colProps: { span: 4 }, +// componentProps: () => { +// return { +// placeholder: '全部子系统', +// options: systemOptions.value.map(system => ({ value: system.id, label: system.name })), +// } +// }, +// }, +// +// { +// label: '模型实例名称', +// field: 'mpName', +// component: 'Input', +// labelWidth: 100, +// +// defaultValue: '', +// colProps: { span: 5 }, +// }, { +// label: '算法', +// field: 'algorithmId', +// component: 'Select', +// labelWidth: 40, +// componentProps: { +// placeholder: '全部算法', +// options: [{ value: 1, label: "主成分分析(PCA)" }, { value: 2, label: "神经网络(ANN)" }], +// }, +// defaultValue: null, +// colProps: { span: 3 }, +// show:true +// }, +// { +// label: '状态1', +// field: 'running', +// component: 'Input', +// show: false, +// }, +// { +// label: '状态2', +// field: 'runningLog', +// component: 'Input', +// show: false, +// }, +// { +// label: '状态3', +// field: 'isUpdate', +// component: 'Input', +// show: false, +// }, +// ] +/** + * 获取搜索表单 schema + * @param showAlgorithm 是否显示算法字段 + */ +export function getSearchFormSchema(showAlgorithm = true): FormSchema[] { + return [ + { + label: '机组', + field: 'unit', + component: 'Select', + defaultValue: null, + colProps: { span: 4 }, + componentProps: ({ formModel }) => ({ placeholder: '全部机组', options: optionList.units.map(unit => ({ value: unit.id, label: unit.name })), onChange: async (e: any) => { - // const { reload } = tableAction - // reload() - // or - console.log(e) - const param: systemSelectParams = { - unitId: e, - typeId: formModel.type, - } - //如果typeId是空,则不设置system'Options + const param: systemSelectParams = { unitId: e, typeId: formModel.type } if (!param.typeId || !param.unitId) { systemOptions.value = [] return } systemOptions.value = await subSystemListApi(param) - // formModel.system = systemOptions.value[0].id }, - } + }), }, - }, - { - label: '系统', - field: 'type', - component: 'Select', - // defaultValue: optionList.types[0].id || null, - defaultValue: null, - - colProps: { span: 4 }, - componentProps: ({ formModel }) => { - return { + { + label: '系统', + field: 'type', + component: 'Select', + defaultValue: null, + colProps: { span: 4 }, + componentProps: ({ formModel }) => ({ placeholder: '全部系统', options: optionList.types.map(type => ({ value: type.id, label: type.name })), onChange: async (e: any) => { - // const { reload } = tableAction - // reload() - // or - console.log(e) - const param: systemSelectParams = { - unitId: formModel.unit, - typeId: e, - } - //如果typeId是空,则不设置system'Options + const param: systemSelectParams = { unitId: formModel.unit, typeId: e } if (!param.typeId || !param.unitId) { systemOptions.value = [] return } systemOptions.value = await subSystemListApi(param) }, - } + }), }, - }, - { - label: '子系统', - field: 'system', - component: 'Select', - // defaultValue: systemOptions.value[0].id || null, - defaultValue: null, - colProps: { span: 4 }, - componentProps: () => { - return { + { + label: '子系统', + field: 'system', + component: 'Select', + defaultValue: null, + colProps: { span: 4 }, + componentProps: () => ({ placeholder: '全部子系统', options: systemOptions.value.map(system => ({ value: system.id, label: system.name })), - } + }), }, - }, - - { - label: '模型实例名称', - field: 'mpName', - component: 'Input', - labelWidth: 100, - - defaultValue: '', - colProps: { span: 5 }, - }, { - label: '算法', - field: 'algorithmId', - component: 'Select', - labelWidth: 40, - componentProps: { - placeholder: '全部算法', - options: [{ value: 1, label: "主成分分析(PCA)" }, { value: 2, label: "神经网络(ANN)" }], + { + label: '模型实例名称', + field: 'mpName', + component: 'Input', + labelWidth: 100, + defaultValue: '', + colProps: { span: 5 }, }, - defaultValue: null, - colProps: { span: 3 }, - }, - { - label: '状态1', - field: 'running', - component: 'Input', - show: false, - }, - { - label: '状态2', - field: 'runningLog', - component: 'Input', - show: false, - }, - { - label: '状态3', - field: 'isUpdate', - component: 'Input', - show: false, - }, -] - + { + label: '算法', + field: 'algorithmId', + component: 'Select', + labelWidth: 40, + componentProps: { + placeholder: '全部算法', + options: [ + { value: 1, label: '主成分分析(PCA)' }, + { value: 2, label: '神经网络(ANN)' }, + ], + }, + defaultValue: null, + colProps: { span: 3 }, + show: showAlgorithm, // 根据参数决定是否显示 + }, + { + label: '状态1', + field: 'running', + component: 'Input', + show: false, + }, + { + label: '状态2', + field: 'runningLog', + component: 'Input', + show: false, + }, + { + label: '状态3', + field: 'isUpdate', + component: 'Input', + show: false, + }, + ] +} export const formSchema: FormSchema[] = [ { diff --git a/src/views/warn/alarm/index.vue b/src/views/warn/alarm/index.vue index 13791e8..e9b2138 100644 --- a/src/views/warn/alarm/index.vue +++ b/src/views/warn/alarm/index.vue @@ -1,9 +1,11 @@