289 lines
5.6 KiB
TypeScript
289 lines
5.6 KiB
TypeScript
import {BasicColumn} from '/@/components/Table';
|
||
import {FormSchema} from '/@/components/Table';
|
||
import { rules} from '/@/utils/helper/validator';
|
||
import { render } from '/@/utils/common/renderUtils';
|
||
import { relayItemCheck,relayTypeList} from './SetupRun.api';
|
||
|
||
|
||
//列表数据
|
||
export const columns: BasicColumn[] = [
|
||
{
|
||
title: '创建者',
|
||
align: "center",
|
||
dataIndex: 'createId'
|
||
},
|
||
{
|
||
title: '更新者',
|
||
align: "center",
|
||
dataIndex: 'updateId'
|
||
},
|
||
{
|
||
title: '设备主键',
|
||
align: "center",
|
||
dataIndex: 'equId'
|
||
},
|
||
{
|
||
title: '指标code',
|
||
align: "center",
|
||
dataIndex: 'code'
|
||
},
|
||
{
|
||
title: '指标名称',
|
||
align: "center",
|
||
dataIndex: 'name'
|
||
},
|
||
{
|
||
title: '低阈值',
|
||
align: "center",
|
||
dataIndex: 'valLow'
|
||
},
|
||
{
|
||
title: '高阈值',
|
||
align: "center",
|
||
dataIndex: 'valHeight'
|
||
},
|
||
{
|
||
title: '计量单位',
|
||
align: "center",
|
||
dataIndex: 'nuit'
|
||
},
|
||
];
|
||
|
||
//查询数据
|
||
export const searchFormSchema: FormSchema[] = [
|
||
];
|
||
|
||
//表单数据
|
||
export const formSchema: FormSchema[] = [
|
||
{
|
||
label: '创建者',
|
||
field: 'createId',
|
||
component: 'Input',
|
||
},
|
||
{
|
||
label: '更新者',
|
||
field: 'updateId',
|
||
component: 'Input',
|
||
},
|
||
{
|
||
label: '设备主键',
|
||
field: 'equId',
|
||
component: 'Input',
|
||
},
|
||
{
|
||
label: '指标code',
|
||
field: 'code',
|
||
component: 'Input',
|
||
},
|
||
{
|
||
label: '指标名称',
|
||
field: 'name',
|
||
component: 'Input',
|
||
},
|
||
{
|
||
label: '低阈值',
|
||
field: 'valLow',
|
||
component: 'InputNumber',
|
||
},
|
||
{
|
||
label: '高阈值',
|
||
field: 'valHeight',
|
||
component: 'InputNumber',
|
||
},
|
||
{
|
||
label: '计量单位',
|
||
field: 'nuit',
|
||
component: 'Input',
|
||
},
|
||
{
|
||
label: '排序',
|
||
field: 'sortNo',
|
||
component: 'InputNumber',
|
||
},
|
||
// TODO 主键隐藏字段,目前写死为ID
|
||
{
|
||
label: '',
|
||
field: 'id',
|
||
component: 'Input',
|
||
show: false,
|
||
},
|
||
];
|
||
|
||
|
||
|
||
export const itemFormSchema: FormSchema[] = [
|
||
{
|
||
label: '',
|
||
field: 'id',
|
||
component: 'Input',
|
||
show: false,
|
||
},
|
||
{
|
||
label: '',
|
||
field: 'deployId',
|
||
component: 'Input',
|
||
show: false,
|
||
},
|
||
{
|
||
label: '状态名称',
|
||
field: 'runName',
|
||
required: true,
|
||
component: 'Input',
|
||
},
|
||
{
|
||
label: '状态编码',
|
||
field: 'runKey',
|
||
component: 'Input',
|
||
dynamicRules: ({ values, model }) => {
|
||
return [
|
||
{
|
||
required: true,
|
||
validator: (_, value) => {
|
||
if (!value) {
|
||
return Promise.reject('请输入属性编码');
|
||
}
|
||
if (new RegExp("[`~!@#$^&*()=|{}'.<>《》/?!¥()—【】‘;:”“。,、?]").test(value)) {
|
||
return Promise.reject('数据值不能包含特殊字符!');
|
||
}
|
||
return new Promise<void>((resolve, reject) => {
|
||
let params = {
|
||
deployId: model.deployId,
|
||
relayKey: value,
|
||
id: model.id,
|
||
};
|
||
relayItemCheck(params)
|
||
.then((res) => {
|
||
res.success ? resolve() : reject(res.message || '校验失败');
|
||
})
|
||
.catch((err) => {
|
||
reject(err.message || '验证失败');
|
||
});
|
||
});
|
||
},
|
||
},
|
||
];
|
||
},
|
||
},
|
||
{
|
||
label: '状态种类',
|
||
field: 'runType',
|
||
required: true,
|
||
component: 'JDictSelectTag',
|
||
componentProps: {
|
||
dictCode: 'iot_run_type',
|
||
placeholder: '请选择状态种类',
|
||
stringToNumber: true,
|
||
},
|
||
},
|
||
{
|
||
label: '状态类别',
|
||
field: 'runCate',
|
||
required: true,
|
||
component: 'JDictSelectTag',
|
||
componentProps: {
|
||
dictCode: 'iot_run_cate',
|
||
placeholder: '请选择状态类别',
|
||
stringToNumber: true,
|
||
},
|
||
},
|
||
{
|
||
label: '所属分组',
|
||
field: 'groupId',
|
||
defaultValue: '',
|
||
component: 'JDictSelectTag',
|
||
componentProps: ({ schema, formModel }) => {
|
||
return {
|
||
dictCode: 'surv_device_deploy_rungroup,GROUP_NAME,ID,IS_ENABLE = 1 and DEPLOY_ID=' + formModel.deployId,
|
||
dict: 'surv_device_deploy_rungroup,GROUP_NAME,ID,IS_ENABLE = 1 and DEPLOY_ID=' + formModel.deployId,
|
||
};
|
||
},
|
||
},
|
||
// {
|
||
// label: '分组编码',
|
||
// field: 'groupCode',
|
||
// required: false,
|
||
// component: 'Input',
|
||
// },
|
||
|
||
{
|
||
label: '开状态值',
|
||
field: 'registerOn',
|
||
required: false,
|
||
component: 'Input',
|
||
},
|
||
{
|
||
label: '关状态值',
|
||
field: 'registerOff',
|
||
required: false,
|
||
component: 'Input',
|
||
},
|
||
{
|
||
label: '停状态值',
|
||
field: 'registerStop',
|
||
required: false,
|
||
component: 'Input',
|
||
},
|
||
|
||
{
|
||
field: 'isEnable',
|
||
label: '是否启用',
|
||
defaultValue: 1,
|
||
component: 'JDictSelectTag',
|
||
componentProps: {
|
||
type: 'radioButton',
|
||
dictCode: 'yn',
|
||
stringToNumber: true,
|
||
},
|
||
},
|
||
|
||
{
|
||
label: '排序',
|
||
field: 'sortNo',
|
||
required: false,
|
||
component: 'InputNumber',
|
||
defaultValue: 1,
|
||
},
|
||
];
|
||
|
||
|
||
export const dictItemColumns: BasicColumn[] = [
|
||
{
|
||
title: '状态编号',
|
||
dataIndex: 'runKey',
|
||
width: 80,
|
||
},
|
||
{
|
||
title: '状态名称',
|
||
dataIndex: 'runName',
|
||
width: 80,
|
||
},
|
||
{
|
||
title: '分组名称',
|
||
dataIndex: 'groupNameStr',
|
||
width: 80,
|
||
},
|
||
{
|
||
title: '状态类别',
|
||
dataIndex: 'runCateName',
|
||
width: 80,
|
||
},
|
||
{
|
||
title: '状态种类',
|
||
dataIndex: 'runTypeName',
|
||
width: 80,
|
||
},
|
||
{
|
||
title: '排序',
|
||
dataIndex: 'sortNo',
|
||
width: 80,
|
||
},
|
||
];
|
||
|
||
export const dictItemSearchFormSchema: FormSchema[] = [
|
||
{
|
||
label: '名称',
|
||
field: 'runName',
|
||
component: 'Input',
|
||
},
|
||
];
|