干燥机配套车间生产管理系统/云平台前端
baoshiwei
9 小时以前 a3e955e801044d8abc2ec575cdf74a6815b8d963
src/views/dry/dataDefine/DryHerbFormula.data.ts
@@ -2,6 +2,7 @@
import {render} from "/@/utils/common/renderUtils";
import {rules} from "/@/utils/helper/validator";
import {queryById} from "/@/views/dry/api/DryHerbInfo.api"
import { getFirstWordSpell } from "/@/utils/common/renderUtils";
//列表数据
export const columns: BasicColumn[] = [
   {
@@ -20,12 +21,36 @@
      dataIndex: 'eqpType_dictText',
   },
  {
    title: '配方分类',
    title: '缩写',
    align: 'center',
    dataIndex: 'category',
    dataIndex: 'abbr',
  },
  {
    title: '特种物料',
    align: 'center',
    dataIndex: 'special',
    customRender: ({ text }) => {
      return render.renderDict(text, 'formula_category');
      return render.renderSwitch(text, [
        { text: '是', value: 'true' },
        { text: '否', value: 'false' },
      ])
    },
  },
  {
    title: '轻质物料',
    align: 'center',
    dataIndex: 'light',
    customRender: ({ text }) => {
      return render.renderSwitch(text, [
        { text: '是', value: 'true' },
        { text: '否', value: 'false' },
      ])
    },
  },
  {
    title: '初始含水率',
    align: 'center',
    dataIndex: 'initial',
  },
   {
      title: '目标含水率',
@@ -52,41 +77,25 @@
    align: 'center',
    dataIndex: 'fanSpeed',
  },
   // {
   //    title: '环境温度',
   //    align: 'center',
   //    dataIndex: 'envTemp',
   // },
   // {
   //    title: '环境湿度',
   //    align: 'center',
   //    dataIndex: 'envHum',
   // },
   {
      title: '荡料延时ms',
      title: '启用翻料策略',
      align: 'center',
      dataIndex: 'delay',
      dataIndex: 'strategy',
    customRender: ({ text }) => {
      return render.renderSwitch(text, [
        { text: '是', value: 'true' },
        { text: '否', value: 'false' },
      ])
    },
   },
   // {
   //    title: '翻料次数',
   //    align: 'center',
   //    dataIndex: 'turn',
   // },
  {
    title: '含水率补偿',
    align: 'center',
    dataIndex: 'moisOffset',
  },
  {
    title: '冷风时长',
    align: 'center',
    dataIndex: 'coolingDuration',
  },
   // {
   //    title: '租户id',
   //    align: 'center',
   //    dataIndex: 'tenantId',
   // },
]
//查询数据
export const searchFormSchema: FormSchema[] = [
@@ -115,6 +124,12 @@
          }
          queryById(param).then(res => {
            formModel.name = res.name
            if (res.name) {
              const abbr = getFirstWordSpell(res.name);
              formModel.abbr = abbr.toUpperCase();
            } else {
              formModel.abbr = '';
            }
          })
        },
      }
@@ -123,33 +138,69 @@
         return [{ required: true, message: '请选择药材!' }]
      },
   },
   {
      label: '配方名称',
      field: 'name',
      component: 'Input',
  {
    label: '配方名称',
    field: 'name',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [{ required: true, message: '请输入配方名称!' }, { ...rules.duplicateCheckRule('dry_herb_formula', 'name', model, schema)[0] }]
    },
   },
    componentProps: ({ formModel }) => {
      return {
        onChange: (e) => {
          const value = e.target.value;
          // 生成拼音首字母并赋值给 abbr 字段
          if (value) {
            const abbr = getFirstWordSpell(value);
            formModel.abbr = abbr.toUpperCase();
          } else {
            formModel.abbr = '';
          }
        }
      };
    },
  },
   {
      label: '设备类型',
      field: 'eqpType',
      component: 'JSearchSelect',
      componentProps: {
         dict: 'dry_eqp_type,name,id',
         dict: 'dry_eqp_type,name,id'
      },
      dynamicRules: ({ model, schema }) => {
         return [{ required: true, message: '请设备设备类型!' }]
         return [{ required: true, message: '请选择设备类型!' }]
      },
    defaultValue: '1952566592372215810',
   },
  {
    label: '配方分类',
    field: 'category',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'formula_category',
      placeholder: '请选择配方分类',
      stringToNumber: true,
    label: '首字母缩写',
    field: 'abbr',
    component: 'Input'
  },
  {
    label: '特种物料',
    field: 'special',
    component: 'Switch',
    defaultValue: false
  },
  {
    label: '轻质物料',
    field: 'light',
    component: 'Switch',
    defaultValue: false
  },
  {
    label: '初始含水率',
    field: 'initial',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [{ required: false }, { pattern: /^-?\d+\.?\d*$/, message: '请输入数字!' }]
    },
    renderComponentContent: () => {
      return {
        suffix: () => '%',
      }
    },
  },
   {
@@ -217,71 +268,13 @@
      }
    },
  },
   // {
   //    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',
      component: 'Input',
      dynamicRules: ({ model, schema }) => {
         return [{ required: false }, { pattern: /^-?\d+\.?\d*$/, message: '请输入数字!' }]
      },
      renderComponentContent: () => {
         return {
            suffix: () => 'ms',
         }
      },
      label: '启用翻料策略',
      field: 'strategy',
    component: 'Switch',
    defaultValue: false,
   },
   // {
   //    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',