Browse Source

fix:增加机组、系统、子系统筛选条件

pull/31/head
肖晋飞 1 week ago
parent
commit
7b6f54edf3
  1. 4
      src/views/run/instant/index.vue
  2. 80
      src/views/run/instant/instant.data.ts

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

@ -31,7 +31,7 @@ const [registerTable, { getForm, reload, getDataSource, updateTableDataRecord }]
immediate: true,
columns,
formConfig: {
labelWidth: 120,
labelWidth: 80,
schemas: searchFormSchema,
showResetButton: false,
actionColOptions: {
@ -96,6 +96,8 @@ const countData = ref<countObj>()
onMounted(async () => {
countData.value = await getInstantCount()
console.log(countData.value)
const { setFieldsValue } = getForm()
await setFieldsValue({ system: null })
getNow()
})
async function getTableData(type) {

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

@ -1,8 +1,11 @@
import moment from 'moment'
import { left } from 'inquirer/lib/utils/readline'
import { ref } from 'vue'
import type { BasicColumn, FormSchema } from '@/components/Table'
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'
export const columns: BasicColumn[] = [
{
@ -90,14 +93,87 @@ export const columns: BasicColumn[] = [
]
const optionList = await optionListApi()
const systemOptions = ref<any>([])
systemOptions.value = optionList.systems
export const searchFormSchema: FormSchema[] = [
{
label: '机组',
field: 'unit',
component: 'Select',
defaultValue: optionList.units[0].id || null,
colProps: { span: 4 },
componentProps: ({ schema, tableAction, formActionType, formModel }) => {
return {
// xxxx props
allowClear: false,
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,
}
systemOptions.value = await subSystemListApi(param)
formModel.system = systemOptions.value[0].id
},
}
},
},
{
label: '系统',
field: 'type',
component: 'Select',
defaultValue: optionList.types[0].id || null,
colProps: { span: 4 },
componentProps: ({ formModel }) => {
return {
allowClear: false,
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,
}
systemOptions.value = await subSystemListApi(param)
},
}
},
},
{
label: '子系统',
field: 'system',
component: 'Select',
defaultValue: systemOptions.value[0].id || null,
colProps: { span: 4 },
componentProps: () => {
return {
allowClear: false,
placeholder: '请选择子系统',
options: systemOptions.value.map(system => ({ value: system.id, label: system.name })),
}
},
},
{
label: '模型实例名称',
field: 'mpName',
component: 'Input',
labelWidth: 120,
defaultValue: '',
required: true,
colProps: { span: 8 },
colProps: { span: 5 },
},
{
label: '状态1',

Loading…
Cancel
Save