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,
  menuWidth: 300,
  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",
      },
      rules: [
        {
          required: true,
          message: '请选择所属工厂',
          trigger: 'click',
        },
      ],
    },
    {
      label: "工序号",
      prop: "code",
      type: "input",
      search: true,
      rules: [
        {
          required: true,
          message: '请填写工序号',
          trigger: 'click',
        },
      ],
    },
    {
      label: "工序名称",
      prop: "name",
      type: "input",
      search: true,
      rules: [
        {
          required: true,
          message: '请填写工序名称',
          trigger: 'click',
        },
      ],
    },
    {
      label: "过程类型",
      prop: "type",
      type: "radio",
      search: true,
      type:"select",
      dicUrl:"/blade-system/dict-biz/dictionary?code=procedural_type",
      props:{label:"dictValue",value:"dictKey"},
      rules: [
        {
          required: true,
          message: '请选择过程类型',
          trigger: 'click',
        },
      ],
    },
    {
      label: "设备/冶具",
      prop: "equipment",
      type: "input",
      rules: [
        {
          required: true,
          message: '请填写设备/冶具',
          trigger: 'click',
        },
      ],
    },
    {
      label: "使用寿命",
      prop: "lifeSpan",
      type: "input",
      rules: [
        {
          required: true,
          message: '请填写使用寿命',
          trigger: 'click',
        },
      ],
    },
    {
      label: "关键过程",
      prop: "isCrux",
      type: 'switch',
      dicData: [{
        label: '否',
        value: 0
      }, {
        label: '是',
        value: 1
      }],
      rules: [
        {
          required: true,
          message: '请选择关键过程',
          trigger: 'click',
        },
      ],
    },
    {
      label: "是否拍照",
      prop: "isPhotograph",
      type: 'switch',
      dicData: [{
        label: '否',
        value: 0
      }, {
        label: '是',
        value: 1
      }],
      rules: [
        {
          required: true,
          message: '请选择是否拍照',
          trigger: 'click',
        },
      ],
      control: (val, form) => {
        if (val == 1) {
          return {
            isDownline: {
              display: true
            },
          }
        } else {
          return {
            isDownline: {
              display: false
            },
          }
        }
      },
    },
    {
      label: "是否下线",
      prop: "isDownline",
      type: 'switch',
      dicData: [{
        label: '否',
        value: 0
      }, {
        label: '是',
        value: 1
      }],
      rules: [
        {
          required: true,
          message: '请选择是否下线',
          trigger: 'click',
        },
      ],
    },
    {
      label: "追溯要求",
      prop: "isRetrospect",
      type: 'switch',
      dicData: [{
        label: '否',
        value: 0
      }, {
        label: '是',
        value: 1
      }],
      search: true,
      rules: [
        {
          required: true,
          message: '请选择追溯要求',
          trigger: 'click',
        },
      ],
      control: (val, form) => {
        if (val == 1) {
          return {
            details: {
              display: true
            },
          }
        } else {
          return {
            details: {
              display: false
            },
          }
        }
      },
    },
    {
      label: "电子指导书",
      prop: "guidebookUrls",
      dataType: 'string',
      type: 'upload',
      propsHttp: {
        res: 'data',
        url: 'link',
      },
      action: '/blade-resource/oss/endpoint/put-file',
      hide: true,
      rules: [
        {
          required: true,
          message: '请上传电子指导书',
          trigger: 'click',
        },
      ],
    },
    {
      labelWidth: 0,
      label: '',
      prop: 'details',
      span: 24,
      hide: true
    },
    {
      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,
    },
    {
      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,
    },
  ]
}
