import { useDictionaryStore } from "@/store";
const { dicts } = useDictionaryStore();

const switchOp = [
  {
    label: "否",
    value: 0,
  },
  {
    label: "是",
    value: 1,
  },
];

export const formOption = {
  submitBtn: false,
  emptyBtn: false,
  labelWidth: 120,
  column: [
    {
      label: "工序类型",
      prop: "operationType",
      type: "select",
      search: true,
      dicData: dicts.process_type,
      props: {
        label: "dictLabel",
        value: "dictValue",
      },
      span: 24,
      rules: [
        {
          required: true,
          message: "请选择工序类型",
          trigger: "change",
        },
      ],
    },
    {
      label: "技能要求",
      prop: "skillAsk",
      span: 24,
      type: "select",
      search: true,
      filterable: true,
      dicData: dicts.skill_requirements,
      props: {
        label: "dictLabel",
        value: "dictValue",
      },
      rules: [
        {
          required: true,
          message: "请选择技能要求",
          trigger: "change",
        },
      ],
    },
    {
      label: "工位类型",
      prop: "stanType",
      search: true,
      type: "select",
      dicData: dicts.station_type,
      props: {
        label: "dictLabel",
        value: "dictValue",
      },
      span: 24,
      row: true,
      rules: [
        {
          required: true,
          message: "请选择工位类型",
          trigger: "blur",
        },
      ],
    },
    {
      label: "工序分组",
      prop: "groupStr",
      span: 24,
      rules: [
        {
          required: true,
          message: "请输入工序分组",
          trigger: "blur",
        },
      ],
    },
    {
      label: "标准工时",
      prop: "standardWorktime",
      span: 24,
      value: 0,
      append: "分钟",
      rules: [
        {
          required: true,
          message: "标准工时不能为空",
          trigger: "blur",
        },
      ],
    },
    /* {
      label: "标准机时",
      prop: "timeingNum",
      span: 24,
      value: 0,
      append: "分钟",
      // rules: [
      //   {
      //     required: true,
      //     message: "标准机时不能为空",
      //     trigger: "blur",
      //   },
      // ],
    },*/
    {
      label: "后置时间",
      prop: "forceTime",
      span: 24,
      value: 0,
      append: "分钟",
      rules: [
        {
          required: true,
          message: "后置时间不能为空",
          trigger: "blur",
        },
      ],
      // slot:true, // 自定义列
    },
    /*{
      label: "是否外协",
      prop: "outsourcing",
      span: 24,
      type: "switch",
      dicData: switchOp,
      value: 0,
    },*/
    /*{
      label: "是否首检",
      prop: "firstCheck",
      span: 24,
      type: "switch",
      dicData: switchOp,
      value: 0,
    },*/
    /*{
      label: "是否巡检",
      prop: "inspection",
      span: 24,
      type: "switch",
      dicData: switchOp,
      value: 0,
    },
    {
      label: "是否自检",
      prop: "selfCheck",
      span: 24,
      type: "switch",
      dicData: switchOp,
      value: 0,
    },*/
    {
      label: "批量报工",
      prop: "batchReport",
      span: 24,
      type: "switch",
      dicData: switchOp,
      value: 0,
    },
    {
      label: "是否可跳过",
      prop: "skipped",
      span: 24,
      type: "switch",
      dicData: switchOp,
      value: 0,
    },
    {
      label: "是否特殊工序",
      prop: "isSpecial",
      span: 24,
      type: "switch",
      dicData: switchOp,
      value: 0,
    },
    {
      label: "是否关键工序",
      prop: "keyProcesses",
      span: 24,
      type: "switch",
      dicData: switchOp,
      value: 0,
    },
    {
      label: "工艺条件",
      prop: "processAsk",
      span: 24,
    },
    {
      label: "工序描述",
      prop: "operationDesc",
      span: 24,
      type: "textarea",
    },
    {
      label: "是否自定义名称",
      prop: "customEnable",
      span: 8,
      hide: true,
      type: "switch",
      dicData: switchOp,
      value: 0,
      //联动隐藏
      control: (val: number) => {
        return {
          customFieldName: {
            display: val == 1,
          },
        };
      },
    },
    {
      label: "自定义工序项目字段名称",
      prop: "customFieldName",
      hide: true,
      span: 24,
    },
    {
      label: "工段",
      prop: "workSection",
      type: "select",
      search: true,
      dicData: dicts.workshop_section,
      props: {
        label: "dictLabel",
        value: "dictValue",
      },
      span: 24,
      rules: [
        {
          required: true,
          message: "请选择工段",
          trigger: "change",
        },
      ],
    },
    /*{
      label: "tbom文件",
      prop: "tbomUrl",
      span: 24,
    },*/
  ],
};
