You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

192 lines
4.4 KiB

4 months ago
import moment from 'moment'
import { ref } from 'vue'
import type { BasicColumn, FormSchema } from '@/components/Table'
import { DICT_TYPE, getDictOptions } from '@/utils/dict'
import { optionListApi, subSystemListApi } from '@/api/alert/model/select'
import type { systemSelectParams } from '@/api/alert/model/model/optionsModel'
export const columns: BasicColumn[] = [
{
title: '编号',
1 month ago
dataIndex: 'mpId',
width: 60,
4 months ago
fixed: 'left',
},
{
title: '模型名称',
dataIndex: 'modelName',
1 month ago
width: 200,
4 months ago
className: 'instant',
slots: { customRender: 'detail' },
fixed: 'left',
},
{
title: '算法',
1 month ago
dataIndex: 'algorithmShortname',
width: 100,
4 months ago
},
{
title: '模式覆盖率',
dataIndex: 'CoveredPercent',
1 month ago
width: 100,
4 months ago
},
{
title: '报警次数',
dataIndex: 'AlarmNumber',
1 month ago
width: 100,
4 months ago
},
{
title: '总报警时间(m)',
dataIndex: 'AlarmToatlMinutes',
1 month ago
width: 100,
4 months ago
},
{
title: '系统维度',
dataIndex: 'Dimension',
1 month ago
width: 100,
4 months ago
},
{
title: '计算耗时(s)',
dataIndex: 'CalcSeconds',
1 month ago
width: 100,
4 months ago
},
{
title: '状态',
dataIndex: 'status',
width: 100,
slots: { customRender: 'status' },
fixed: 'right',
},
]
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,
1 month ago
colProps: { span: 5 },
4 months ago
componentProps: ({ 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,
1 month ago
colProps: { span: 5 },
4 months ago
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,
1 month ago
colProps: { span: 5 },
4 months ago
componentProps: () => {
return {
allowClear: false,
placeholder: '请选择子系统',
options: systemOptions.value.map(system => ({ value: system.id, label: system.name })),
}
},
},
{
label: '模型名称',
field: 'modelName',
component: 'Input',
defaultValue: '',
componentProps: {
placeholder: '请输入模型名称',
},
1 month ago
colProps: { span: 6 },
4 months ago
},
]
export const calcFormSchemas: FormSchema[] = [
{
label: '回算时间',
field: 'time',
component: 'RangePicker',
componentProps: {
placeholder: ['开始时间', '结束时间'],
defaultValue: [moment().subtract(1, 'day').format('YYYY-MM-DD HH:mm:ss'), moment().format('YYYY-MM-DD HH:mm:ss')],
valueFormat: 'YYYY-MM-DD HH:mm:ss',
showTime: {
defaultValue: [moment().subtract(1, 'day').format('YYYY-MM-DD HH:mm:ss'), moment().format('YYYY-MM-DD HH:mm:ss')],
},
onChange: (e: any) => {
console.log(e)
},
4 weeks ago
allowClear: false, // ← 必须用这个
4 months ago
},
4 weeks ago
4 months ago
required: true,
colProps: {
1 month ago
span: 10,
4 months ago
},
},
{
1 month ago
label: '采样周期',
4 months ago
field: 'interval',
component: 'Select',
defaultValue: 60,
componentProps: {
options: [{ value: 10, label: '10秒' }, { value: 60, label: '60秒' }, { value: 300, label: '300秒' }],
},
required: true,
colProps: {
1 month ago
span: 5,
4 months ago
},
},
]