import moment from 'moment' import { left } from 'inquirer/lib/utils/readline' import type { BasicColumn, FormSchema } from '@/components/Table' import { DICT_TYPE, getDictOptions } from '@/utils/dict' import { getModelVersionList } from '@/api/alert/run/model/index' export const columns: BasicColumn[] = [ { title: '编号', dataIndex: 'id', width: 80, fixed: 'left', }, { title: '实例状态', dataIndex: 'status1', width: 100, slots: { customRender: 'runStatus' }, fixed: 'left', }, { title: '实例名称', dataIndex: 'mpName', width: 250, className: 'instant', slots: { customRender: 'detail' }, fixed: 'left', }, { title: '专业', dataIndex: 'systemName', width: 200, }, { title: '算法', dataIndex: 'algorithmName', width: 200, }, { title: '模式', dataIndex: 'conditionName', width: 200, }, { title: '原模型名称', dataIndex: 'modelName', width: 200, }, { title: '版本', dataIndex: 'modelVersion', width: 200, }, { title: '运行日志', dataIndex: 'runningLog', width: 200, }, { title: '计算组', dataIndex: 'groupName', width: 200, }, { title: '统计量', dataIndex: 'pointSte', width: 120, slots: { customRender: 'history' }, fixed: 'left', }, { title: '投切', dataIndex: 'status', width: 100, slots: { customRender: 'status' }, fixed: 'right', }, // { // title: '实时值', // dataIndex: 'value', // width: 90, // className: 'value', // slots: { customRender: 'value' }, // } ] export const searchFormSchema: FormSchema[] = [ { label: '模型实例名称', field: 'mpName', component: 'Input', defaultValue: '', required: true, colProps: { span: 8 }, }, { 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[] = [ { label: '测点编码', field: 'ItemName', required: true, component: 'Input', }, { label: '测点描述', field: 'Descriptor', required: true, component: 'Input', }, { label: '单位', field: 'EngUnits', required: true, component: 'Input', }, { label: '组名', field: 'GroupName', component: 'Select', componentProps: { options: getDictOptions(DICT_TYPE.COMMON_STATUS), }, required: true, }, { label: '类型', field: 'ItemType', component: 'Select', componentProps: { options: [{ value: 1, label: 1 }, { value: 2, label: 2 }, { value: 3, label: 3 }, { value: 4, label: 4 }, { value: 5, label: 5 }], }, required: true, }, { label: '自动保存', field: 'AutoSave', component: 'Select', componentProps: { options: [{ value: 1, label: '是' }, { value: 2, label: '否' }], }, required: true, }, { label: '数据来源', field: 'Source', component: 'Input', }, ] export const instantForm: FormSchema[] = [ { label: '时间范围', field: 'time', show: true, component: 'RangePicker', defaultValue: [moment().subtract(1, 'day').format('YYYY-MM-DD HH:mm:ss'), moment().format('YYYY-MM-DD HH:mm:ss')], componentProps: { placeholder: ['开始时间', '结束时间'], 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) }, }, }, { label: '时间间隔', field: 'interval', component: 'Select', defaultValue: 300, componentProps: { options: [{ value: 1, label: '1秒' }, { value: 10, label: '10秒' }, { value: 100, label: '100秒' }, { value: 300, label: '300秒' }], }, required: true, colProps: { span: 3, }, }, { label: '', field: '0', component: 'Input', slot: 'configButton', colProps: { span: 2, }, }, { label: '复盘', field: 'fp', component: 'RadioGroup', defaultValue: 0, componentProps: { options: [ { label: '是', value: 1, }, { label: '否', value: 0, }, ], }, required: true, }, ] export const searchFormSchemaModel: FormSchema[] = [ { label: '模型实例名称', field: 'mpName', component: 'Input', defaultValue: '', required: true, colProps: { span: 8 }, }, ] export const createInstantForm: FormSchema[] = [ { label: '所用模型的id', field: 'modelId', component: 'Input', required: true, show: false, colProps: { span: 12, }, }, { label: '实例名称', field: 'mpName', component: 'Input', required: true, colProps: { span: 12, }, componentProps: { placeholder: '请选择下方模型以生成实例', }, rules: [{ required: true, message: '请选择下方模型以生成实例' }], }, { label: '运行周期', field: 'intervalTime', component: 'Input', required: true, defaultValue: 30, colProps: { span: 6, }, }, { label: '计算组', field: 'calcGroup', component: 'Select', componentProps: { options: [], }, colProps: { span: 6, }, required: true, }, { label: '版本号', field: 'modelVersionId', component: 'Select', componentProps: { // api: getModelVersionList, // labelField: 'version', // valueField: 'id', // params: {}, options: [], }, colProps: { span: 12, }, required: true, }, { label: '是否存储', field: 'hisSto', component: 'RadioGroup', defaultValue: '1', componentProps: { options: [ { label: '是', value: '1', }, { label: '否', value: '0', }, ], }, colProps: { span: 6, }, required: true, }, ] export const InstantBasicInfo: any[] = [ { label: '实例名称', field: 'mpName', }, { label: '创建人', field: 'creator', }, { label: '创建时间', field: 'createTime', }, { label: '最近修改人', field: 'updater', }, { label: '最近修改时间', field: 'updateTime', }, { label: '算法', field: 'algorithm_shortname', }, // modelInfo中的字段 { label: '训练采样间隔', field: 'sampling', }, { label: '参数个数', field: 'pointInfo', }, { label: '最小主元贡献率', field: 'rate', }, { label: '主元个数', field: 'principal', }, { label: '模型精度', field: 'rate', }, ] export const detailColumns: BasicColumn[] = [ { title: '编号', dataIndex: 'id', width: 80, fixed: 'left', }, { title: '测点编码', dataIndex: 'inputInfo', width: 150, fixed: 'left', }, { title: '测点名称', dataIndex: 'inputName', width: 200, fixed: 'left', }, { title: '单位', dataIndex: 'unit', width: 50, fixed: 'left', }, { title: '重构值测点', dataIndex: 'outPointInfo', width: 200, }, { title: '偏差值测点', dataIndex: 'biasPointInfo', width: 200, }, { title: '错误状态测点', dataIndex: 'faultVariablePointInfo', width: 200, }, ]