fields.js 4.39 KB
Newer Older
krysent's avatar
krysent committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
import { doFetch } from "@/utils/doFetch";

export function getColumns(setDrawer, formRef) {
  return [
    {
      title: "物料(名称+编码)",
      key: "materieId",
      dataIndex: "materieId",
      valueType: "select",
      formItemProps: { rules: [{ required: true, message: "此项为必填项" }] },
      options: {
        path: "/ngic-workmanship/pmMaterie/query/selectbox",
      },
      fieldProps: {
        onChange: (value, options) => {
          if (value) {
            doFetch({
              url: "/ngic-workmanship/pmMaterie/queryById",
krysent's avatar
krysent committed
19
              params: { materieId: value },
krysent's avatar
krysent committed
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
            }).then((res) => {
              console.log(res);
              const data = res?.data?.data;
              formRef.current.setFieldValue(
                "specificationModel",
                data?.specificationModel ?? ""
              );
              formRef.current.setFieldValue("shopSign", data?.shopSign ?? "");
              formRef.current.setFieldValue("ironLoss", data?.ironLoss ?? "");
              formRef.current.setFieldValue(
                "sheetThickness",
                data?.sheetThickness ?? ""
              );
            });
          } else {
            formRef?.current?.resetFields();
          }
        },
      },
    },
    {
      title: "规格型号",
      key: "specificationModel",
      dataIndex: "specificationModel",
      fieldProps: {
        disabled: true,
krysent's avatar
krysent committed
46
        placeholder: "",
krysent's avatar
krysent committed
47 48 49 50 51 52 53 54
      },
    },
    {
      title: "牌号",
      key: "shopSign",
      dataIndex: "shopSign",
      fieldProps: {
        disabled: true,
krysent's avatar
krysent committed
55
        placeholder: "",
krysent's avatar
krysent committed
56 57 58 59 60 61 62 63
      },
    },
    {
      title: "铁损",
      key: "ironLoss",
      dataIndex: "ironLoss",
      fieldProps: {
        disabled: true,
krysent's avatar
krysent committed
64
        placeholder: "",
krysent's avatar
krysent committed
65 66 67 68 69 70 71 72
      },
    },
    {
      title: "片厚",
      key: "sheetThickness",
      dataIndex: "sheetThickness",
      fieldProps: {
        disabled: true,
krysent's avatar
krysent committed
73
        placeholder: "",
krysent's avatar
krysent committed
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
      },
    },
    {
      title: "手动录入",
      key: "split",
      dataIndex: "split",
      valueType: "split",
    },
    {
      title: "供应商",
      key: "supplierId",
      dataIndex: "supplierId",
      valueType: "select",
      options: {
        path: "/ngic-auth/sysSupplier/query/selection",
krysent's avatar
krysent committed
89
        params: {},
krysent's avatar
krysent committed
90 91 92 93 94 95
      },
    },
    {
      title: "单边厚度",
      key: "unilateralThickness",
      dataIndex: "unilateralThickness",
krysent's avatar
krysent committed
96
      valueType: "digit",
krysent's avatar
krysent committed
97 98 99 100 101 102 103 104
    },
    {
      title: "备注",
      key: "remark",
      dataIndex: "remark",
      valueType: "textarea",
    },
    {
krysent's avatar
krysent committed
105 106 107 108 109
      title: (
        <span>
          <b style={{ color: "red" }}>*</b> 列
        </span>
      ),
krysent's avatar
krysent committed
110 111
      valueType: "formList",
      dataIndex: "list",
krysent's avatar
krysent committed
112
      formItemProps: { rules: [{ required: true, message: "此项为必填项" }] },
krysent's avatar
krysent committed
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194
      initialValue: [
        {
          state: "all",
          title: "标题",
        },
      ],
      colProps: {
        xs: 24,
        sm: 24,
      },
      columns: [
        {
          title: "重量",
          dataIndex: "weight",
          key: "weight",
          valueType: "digit",
          colProps: {
            sm: 6,
          },
          fieldProps: {
            precision: 3,
            max: 999999,
          },
          formItemProps: {
            rules: [
              {
                required: true,
                message: "此项为必填项",
              },
            ],
          },
        },
        {
          title: "宽度",
          dataIndex: "width",
          key: "width",
          valueType: "digit",
          fieldProps: {
            mode: "multiple",
            precision: 3,
            max: 999999,
          },

          colProps: {
            sm: 6,
          },
        },
        {
          title: "米数",
          dataIndex: "length",
          key: "length",
          valueType: "digit",
          fieldProps: {
            precision: 3,
            max: 999999,
          },
          colProps: {
            sm: 6,
          },
        },
        {
          title: "批次号",
          dataIndex: "materieControlNo",
          key: "materieControlNo",
          valueType: "input",
          formItemProps: {
            rules: [
              {
                required: false,
                message: "此项为必填项",
              },
            ],
          },
          colProps: {
            sm: 6,
          },
        },
      ],
      search: false,
    },
  ];
}