干燥机配套车间生产管理系统/云平台前端
baoshiwei
2024-10-25 6fcb00f27e80b38cea4ccb059112ad7cf99d8745
src/views/dry/dataDefine/DryHerbFormula.data.ts
@@ -1,4 +1,7 @@
import { BasicColumn, FormSchema } from '/@/components/Table'
import {render} from "/@/utils/common/renderUtils";
import {rules} from "/@/utils/helper/validator";
import {queryById} from "/@/views/dry/api/DryHerbInfo.api"
//列表数据
export const columns: BasicColumn[] = [
   {
@@ -6,16 +9,24 @@
      align: 'center',
      dataIndex: 'herbId_dictText',
   },
   // {
   //    title: '药材名称',
   //    align: 'center',
   //    dataIndex: 'herbName',
   // },
   {
      title: '配方名称',
      align: 'center',
      dataIndex: 'name',
   },
   {
      title: '适用设备',
      align: 'center',
      dataIndex: 'eqpType_dictText',
   },
  {
    title: '配方分类',
    align: 'center',
    dataIndex: 'category',
    customRender: ({ text }) => {
      return render.renderDict(text, 'formula_category');
    },
  },
   {
      title: '目标含水率',
      align: 'center',
@@ -36,26 +47,41 @@
      align: 'center',
      dataIndex: 'windTemp',
   },
   {
      title: '环境温度',
      align: 'center',
      dataIndex: 'envTemp',
   },
   {
      title: '环境湿度',
      align: 'center',
      dataIndex: 'envHum',
   },
  {
    title: '风机初始频率',
    align: 'center',
    dataIndex: 'fanSpeed',
  },
   // {
   //    title: '环境温度',
   //    align: 'center',
   //    dataIndex: 'envTemp',
   // },
   // {
   //    title: '环境湿度',
   //    align: 'center',
   //    dataIndex: 'envHum',
   // },
   {
      title: '荡料延时ms',
      align: 'center',
      dataIndex: 'delay',
   },
   {
      title: '翻料次数',
      align: 'center',
      dataIndex: 'turn',
   },
   // {
   //    title: '翻料次数',
   //    align: 'center',
   //    dataIndex: 'turn',
   // },
  {
    title: '含水率补偿',
    align: 'center',
    dataIndex: 'moisOffset',
  },
  {
    title: '冷风时长',
    align: 'center',
    dataIndex: 'coolingDuration',
  },
   // {
   //    title: '租户id',
   //    align: 'center',
@@ -69,7 +95,7 @@
      field: 'herbId',
      component: 'JSearchSelect',
      componentProps: {
         dict: 'dry_herb,name,id',
         dict: 'dry_herb_info,name,id',
      },
      colProps: { span: 6 },
   },
@@ -80,18 +106,31 @@
      label: '药材',
      field: 'herbId',
      component: 'JSearchSelect',
      componentProps: {
         dict: 'dry_herb,name,id',
      componentProps: ({formModel})=>{
      return {
        dict: 'dry_herb_info,name,id',
        onChange: e => {
          let param = {
            id: e,
          }
          queryById(param).then(res => {
            formModel.name = res.name
          })
        },
      }
      },
      dynamicRules: ({ model, schema }) => {
         return [{ required: true, message: '请选择药材!' }]
      },
   },
   // {
   //    label: '药材名称',
   //    field: 'herbName',
   //    component: 'Input',
   // },
   {
      label: '配方名称',
      field: 'name',
      component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [{ required: true, message: '请输入配方名称!' }, { ...rules.duplicateCheckRule('dry_herb_formula', 'name', model, schema)[0] }]
    },
   },
   {
      label: '设备类型',
      field: 'eqpType',
@@ -103,6 +142,16 @@
         return [{ required: true, message: '请设备设备类型!' }]
      },
   },
  {
    label: '配方分类',
    field: 'category',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'formula_category',
      placeholder: '请选择配方分类',
      stringToNumber: true,
    },
  },
   {
      label: '目标含水率',
      field: 'target',
@@ -155,32 +204,45 @@
         }
      },
   },
   {
      label: '环境温度',
      field: 'envTemp',
      component: 'Input',
      dynamicRules: ({ model, schema }) => {
         return [{ required: false }, { pattern: /^-?\d+\.?\d*$/, message: '请输入数字!' }]
      },
      renderComponentContent: () => {
         return {
            suffix: () => '℃',
         }
      },
   },
   {
      label: '环境湿度',
      field: 'envHum',
      component: 'Input',
      dynamicRules: ({ model, schema }) => {
         return [{ required: false }, { pattern: /^-?\d+\.?\d*$/, message: '请输入数字!' }]
      },
      renderComponentContent: () => {
         return {
            suffix: () => 'rh',
         }
      },
   },
  {
    label: '风机初始频率',
    field: 'fanSpeed',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [{ required: false }, { pattern: /^-?\d+\.?\d*$/, message: '请输入数字!' }]
    },
    renderComponentContent: () => {
      return {
        suffix: () => 'Hz',
      }
    },
  },
   // {
   //    label: '环境温度',
   //    field: 'envTemp',
   //    component: 'Input',
   //    dynamicRules: ({ model, schema }) => {
   //       return [{ required: false }, { pattern: /^-?\d+\.?\d*$/, message: '请输入数字!' }]
   //    },
   //    renderComponentContent: () => {
   //       return {
   //          suffix: () => '℃',
   //       }
   //    },
   // },
   // {
   //    label: '环境湿度',
   //    field: 'envHum',
   //    component: 'Input',
   //    dynamicRules: ({ model, schema }) => {
   //       return [{ required: false }, { pattern: /^-?\d+\.?\d*$/, message: '请输入数字!' }]
   //    },
   //    renderComponentContent: () => {
   //       return {
   //          suffix: () => 'rh',
   //       }
   //    },
   // },
   {
      label: '荡料延时',
      field: 'delay',
@@ -194,19 +256,45 @@
         }
      },
   },
   {
      label: '翻料次数',
      field: 'turn',
      component: 'Input',
      dynamicRules: ({ model, schema }) => {
         return [{ required: false }, { pattern: /^-?\d+\.?\d*$/, message: '请输入数字!' }]
      },
      renderComponentContent: () => {
         return {
            suffix: () => '次',
         }
      },
   },
   // {
   //    label: '翻料次数',
   //    field: 'turn',
   //    component: 'Input',
   //    dynamicRules: ({ model, schema }) => {
   //       return [{ required: false }, { pattern: /^-?\d+\.?\d*$/, message: '请输入数字!' }]
   //    },
   //    renderComponentContent: () => {
   //       return {
   //          suffix: () => '次',
   //       }
   //    },
   // },
  {
    label: '含水率补偿',
    field: 'moisOffset',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [{ required: false }, { pattern: /^-?\d+\.?\d*$/, message: '请输入数字!' }]
    },
    renderComponentContent: () => {
      return {
        suffix: () => '%',
      }
    },
  },
  {
    label: '冷风时长',
    field: 'coolingDuration',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [{ required: false }, { pattern: /^-?\d+\.?\d*$/, message: '请输入数字!' }]
    },
    renderComponentContent: () => {
      return {
        suffix: () => 'min',
      }
    },
  },
   // TODO 主键隐藏字段,目前写死为ID
   {
      label: '',