import { setStore, getStore } from '@/utils/store';
export default {
  height:'auto',
  calcHeight: 30,
  tip: false,
  searchShow: true,
  searchMenuSpan: 6,
  labelWidth:120,
  border: true,
  index: true,
  viewBtn: true,
  selection: true,
  dialogClickModal: false,
  columnBtn:false,
  column: [
    {
      label: "主键",
      prop: "id",
      type: "input",
      addDisplay: false,
      editDisplay: false,
      viewDisplay: false,
      hide: true,
    },
    {
      label: "租户ID",
      prop: "tenantId",
      type: "input",
      addDisplay: false,
      editDisplay: false,
      viewDisplay: false,
      hide: true,
    },
    {
      label: "所属工厂",
      prop: "factoryId",
      search: getStore({ name: 'userInfo' }).user_category==1,
      hide: getStore({ name: 'userInfo' }).user_category!=1,
      display: getStore({ name: 'userInfo' }).user_category==1,
      type: "tree",
      cascader: [getStore({ name: 'userInfo' }).user_category==1?'clientId':''],
      dicUrl: "/api/pl-factory/factory/select",
      props: {
        label: "name",
        value: "id",
      },
    },
    // {
    //   label: "所属客户",
    //   prop: "clientId",
    //   type: "input",
    //   search: true,
    //   type: "tree",
    //   dicUrl: "/api/pl-client/client/select?factoryId={{factoryId}}",
    //   props: {
    //     label: "name",
    //     value: "id",
    //   },
    // },
    {
      label: "产品名称",
      prop: "productName",
      type: "input",
      search: true,
    },
    {
      label: "产品型号",
      prop: "productModel",
      type: "input",
      search: true,
    },
    {
      label: "规格",
      prop: "productSpec",
      type: "input",
      rules: [
        {
          required: true,
          message: '请输入规格4位数字',
          trigger: 'click',
        },
        { min: 4, max: 4, message: "请输入4位数字", trigger: "blur" }
      ],
    },
    {
      label: "是否直接入库",
      prop: "isDirectStorage",
      type: 'switch',
      dicData: [{
        label: '否',
        value: 0
      }, {
        label: '是',
        value: 1
      }]
    },
    {
      label: "是否Ai检测",
      prop: "isAi",
      type: 'switch',
      dicData: [{
        label: '否',
        value: 0
      }, {
        label: '是',
        value: 1
      }],
    },
    {
      label: "入库数量",
      prop: "inStockNum",
      type: 'select',
      dicData: [{
        label: '7个',
        value: 7
      }, {
        label: '10个',
        value: 10
      }],
      rules: [
        {
          required: true,
          message: '请选择入库数量',
          trigger: 'click',
        },
      ],
    },
    {
      label: "入库填写项",
      prop: "inStockFormItem",
      type: 'select',
      multiple: true,
      dataType:"String",
      dicUrl:"/blade-system/dict-biz/dictionary?code=in_stock_form_item",
      props: {
        label: 'dictValue',
        value: 'dictKey'
      },
      rules: [
        {
          required: true,
          message: '请选择入库数量',
          trigger: 'click',
        },
      ],
    },
    {
      label: "是否启动工序",
      prop: "isEnableProcess",
      type: 'switch',
      dicData: [{
        label: '否',
        value: 0
      }, {
        label: '是',
        value: 1
      }],
      control: (val, form) => {
        if (val == 1) {
          return {
            processConfigId: {
              display: true
            },
          }
        } else {
          return {
            processConfigId: {
              display: false
            },
          }
        }
      }
    },
    {
      label: "工序配置",
      prop: "processConfigId",
      type: 'select',
      dataType:"String",
      dicUrl: "/api/pl-processConfig/processConfig/select",
      props: {
        label: "code",
        value: "id",
      },
      rules: [
        {
          required: true,
          message: '请选择工序配置',
          trigger: 'click',
        },
      ],
    },
    {
      label: "创建人",
      prop: "createUser",
      type: "input",
      addDisplay: false,
      editDisplay: false,
      viewDisplay: false,
      hide: true,
    },
    {
      label: "创建部门",
      prop: "createDept",
      type: "input",
      addDisplay: false,
      editDisplay: false,
      viewDisplay: false,
      hide: true,
    },
    {
      label: "创建时间",
      prop: "createTime",
      type: "input",
      addDisplay: false,
      editDisplay: false,
      viewDisplay: false,
    },
    {
      label: "修改人",
      prop: "updateUser",
      type: "input",
      addDisplay: false,
      editDisplay: false,
      viewDisplay: false,
      hide: true,
    },
    {
      label: "修改时间",
      prop: "updateTime",
      type: "input",
      addDisplay: false,
      editDisplay: false,
      viewDisplay: false,
      hide: true,
    },
    {
      label: "状态",
      prop: "status",
      type: "input",
      addDisplay: false,
      editDisplay: false,
      viewDisplay: false,
      hide: true,
    },
    {
      label: "是否已删除",
      prop: "isDeleted",
      type: "input",
      addDisplay: false,
      editDisplay: false,
      viewDisplay: false,
      hide: true,
    },
  ]
}
