columns.js 10.8 KB
Newer Older
wuhao's avatar
wuhao committed
1 2
import AutoTable from '@/components/AutoTable/mtable';

wuhao's avatar
wuhao committed
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
function ExtraTable({ dataSource }) {
  return (
    <div style={{ padding: '4px 4px 4px 36px' }}>
      <AutoTable
        dataSource={dataSource}
        pagination={false}
        resizeable={false}
        columns={[
          { title: '供应商编号', dataIndex: 'supplierNo', key: 'supplierNo', width: 200 },
          { title: '供应商名称', dataIndex: 'supplierName', key: 'supplierName', width: 200 },
          {
            title: '库存数量',
            dataIndex: 'actualStock',
            key: 'actualStock',
            hideInSearch: true,
            width: 200,
          },
          { title: '下架数量', dataIndex: 'operateNum', key: 'operateNum', hideInSearch: true },
        ]}
      />
    </div>
  );
}

wuhao's avatar
wuhao committed
27
function getcolumns(setdrawer) {
wuhao's avatar
wuhao committed
28 29 30 31 32 33
  const columns = [
    {
      title: '备件料号',
      dataIndex: 'sparePartNo',
      key: 'sparePartNo',
      editable: false,
wuhao's avatar
wuhao committed
34
      width: 235,
wuhao's avatar
wuhao committed
35 36 37 38 39 40
    },
    {
      title: '备件名称',
      dataIndex: 'sparePartName',
      key: 'sparePartName',
      editable: false,
wuhao's avatar
wuhao committed
41
      width: 200,
wuhao's avatar
wuhao committed
42 43 44 45 46 47 48
    },
    {
      title: '可用库存',
      dataIndex: 'usedStock',
      key: 'usedStock',
      editable: false,
      hideInSearch: true,
wuhao's avatar
wuhao committed
49
      width: 200,
wuhao's avatar
wuhao committed
50 51 52 53 54 55 56 57 58 59
    },
    {
      title: '出库数量',
      dataIndex: 'operateNum',
      key: 'operateNum',
      hideInSearch: true,
      valueType: 'digit',
      fieldProps: {
        precision: 3,
      },
wuhao's avatar
wuhao committed
60
      width: 200,
wuhao's avatar
wuhao committed
61 62 63 64 65 66 67 68
    },
    {
      title: '库存单位',
      dataIndex: 'unit',
      editable: false,
      hideInSearch: true,
    },
  ];
wuhao's avatar
wuhao committed
69

wuhao's avatar
wuhao committed
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 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 195 196 197
  return [
    {
      tab: '未完成',
      key: '1',
      columns: [
        {
          title: '出库单号',
          dataIndex: 'taskNo',
          key: 'taskNo',
        },
        {
          title: '出库类型',
          dataIndex: 'outTypeName',
          key: 'outType',
          formItemProps: {
            rules: [
              {
                required: true,
                message: '此项为必填项',
              },
            ],
          },
          valueType: 'select',
          options: [
            {
              label: '销售出库',
              value: '1',
            },
            {
              label: '报废出库',
              value: '2',
            },
            {
              label: '其它出库',
              value: '3',
            },
            {
              label: '备件申领出库',
              value: '4',
            },
          ],
        },
        {
          title: '入库仓库',
          dataIndex: 'inWarehouseName',
          key: 'inWarehouseName',
          formItemProps: {
            rules: [
              {
                required: true,
                message: '此项为必填项',
              },
            ],
          },
        },
        {
          title: '出库仓库',
          dataIndex: 'outWarehouseName',
          key: 'outWarehouseName',
          hideInForm: true,
        },
        {
          title: '备件种类',
          dataIndex: 'spareTypeNum',
          key: 'spareTypeNum',
          hideInSearch: true,
          hideInForm: true,
        },
        {
          title: '相关单号',
          dataIndex: 'relationNo',
          key: 'relationNo',
        },
        {
          title: '备注',
          dataIndex: 'remark',
          key: 'remark',
          colProps: {
            span: 24,
          },
          hideInSearch: true,
          valueType: 'textarea',
        },
        {
          title: '创建人',
          dataIndex: 'createUserName',
          key: 'createUserId',
          hideInForm: true,
          valueType: 'select',
          fieldProps: {
            showSearch: true,
          },
          options: {
            path: '/auth/sysUser/selection',
            params: {},
          },
          hideInForm: true,
        },
        {
          title: '创建时间',
          dataIndex: 'createTime',
          key: 'createTimeList',
          hideInForm: true,
          valueType: 'dateRange',
          render: (text, row) => {
            return <span>{row?.createTime}</span>;
          },
          hideInForm: true,
        },
        {
          title: '备件信息',
          dataIndex: 'details',
          key: 'details',
          valueType: 'split',
        },
        {
          title: '备件',
          dataIndex: 'taskSpareList',
          key: 'taskSpareList',
          valueType: 'formSelectList',
          colProps: {
            span: 24,
          },
          columns,
          span: 12,
          path: '/sparepart/spareStock/queryByOperate',
          hideInSearch: true,
          hideInTable: true,
wuhao's avatar
wuhao committed
198
          rowName: 'sparePartName',
wuhao's avatar
wuhao committed
199 200 201 202 203 204 205 206
          render: (text, row) => {
            return (
              <AutoTable
                columns={columns?.map((it) => ({
                  ...it,
                  hideInSearch: true,
                }))}
                dataSource={row?.taskSpareList}
wuhao's avatar
wuhao committed
207 208 209 210 211 212
                resizeable={false}
                expandable={{
                  expandedRowRender: (record) => (
                    <ExtraTable dataSource={record?.taskSpareSupplierList ?? []} />
                  ),
                }}
wuhao's avatar
wuhao committed
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367
              />
            );
          },
        },
      ],
      pathconfig: {
        enableadd: true,
        enableedit: true,
        enabledelete: true,
        enabledetail: true,
        add: '/sparepart/outWarehouseTask/save',
        edit: '',
        list: '/sparepart/outWarehouseTask/queryNoComplete',
        delete: '',
        detail: '/sparepart/outWarehouseTask/queryDetails',
      },
    },
    {
      tab: '已完成',
      key: '2',
      columns: [
        {
          title: '出库单号',
          dataIndex: 'taskNo',
          key: 'taskNo',
        },
        {
          title: '出库类型',
          dataIndex: 'outTypeName',
          key: 'outType',
          formItemProps: {
            rules: [
              {
                required: true,
                message: '此项为必填项',
              },
            ],
          },
          valueType: 'select',
          options: [
            {
              label: '销售出库',
              value: '1',
            },
            {
              label: '报废出库',
              value: '2',
            },
            {
              label: '其它出库',
              value: '3',
            },
            {
              label: '备件申领出库',
              value: '4',
            },
          ],
        },
        {
          title: '入库仓库',
          dataIndex: 'inWarehouseName',
          key: 'inWarehouseName',
          formItemProps: {
            rules: [
              {
                required: true,
                message: '此项为必填项',
              },
            ],
          },
        },
        {
          title: '出库仓库',
          dataIndex: 'outWarehouseName',
          key: 'outWarehouseName',
          hideInForm: true,
        },
        {
          title: '备件种类',
          dataIndex: 'spareTypeNum',
          key: 'spareTypeNum',
          hideInSearch: true,
          hideInForm: true,
        },
        {
          title: '相关单号',
          dataIndex: 'relationNo',
          key: 'relationNo',
        },
        {
          title: '备注',
          dataIndex: 'remark',
          key: 'remark',
          colProps: {
            span: 24,
          },
          hideInSearch: true,
          valueType: 'textarea',
        },
        {
          title: '创建人',
          dataIndex: 'createUserName',
          key: 'createUserId',
          hideInForm: true,
          valueType: 'select',
          fieldProps: {
            showSearch: true,
          },
          options: {
            path: '/auth/sysUser/selection',
            params: {},
          },
          hideInForm: true,
        },
        {
          title: '创建时间',
          dataIndex: 'createTime',
          key: 'createTimeList',
          hideInForm: true,
          valueType: 'dateRange',
          render: (text, row) => {
            return <span>{row?.createTime}</span>;
          },
          hideInForm: true,
        },
        {
          title: '完成时间',
          dataIndex: 'completeTime',
          key: 'completeTimeList',
          hideInForm: true,
          valueType: 'dateRange',
          render: (text, row) => {
            return <span>{row?.completeTime}</span>;
          },
          hideInForm: true,
        },
        {
          title: '备件信息',
          dataIndex: 'details',
          key: 'details',
          valueType: 'split',
        },
        {
          title: '备件',
          dataIndex: 'taskSpareList',
          key: 'taskSpareList',
          valueType: 'formSelectList',
          colProps: {
            span: 24,
          },
          columns,
          span: 12,
          path: '/sparepart/spareStock/queryByOperate',
          hideInSearch: true,
          hideInTable: true,
wuhao's avatar
wuhao committed
368
          rowName: 'sparePartName',
wuhao's avatar
wuhao committed
369 370 371 372 373 374 375
          render: (text, row) => {
            return (
              <AutoTable
                columns={columns?.map((it) => ({
                  ...it,
                  hideInSearch: true,
                }))}
wuhao's avatar
wuhao committed
376
                resizeable={false}
wuhao's avatar
wuhao committed
377
                dataSource={row?.taskSpareList}
wuhao's avatar
wuhao committed
378 379 380 381 382
                expandable={{
                  expandedRowRender: (record) => (
                    <ExtraTable dataSource={record?.taskSpareSupplierList ?? []} />
                  ),
                }}
wuhao's avatar
wuhao committed
383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439
              />
            );
          },
        },
        {
          dataIndex: 'splias',
          valueType: 'split',
          title: '出库/关单信息',
          key: 'splisa',
        },
        {
          dataIndex: 'statusName',
          valueType: 'select',
          title: '状态',
          key: 'status',
          options: [
            {
              label: '已出库',
              value: 2,
            },
            {
              label: '已关单',
              value: 3,
            },
          ],
          hideInForm: true,
        },
        {
          title: '操作人',
          dataIndex: 'operateUserName',
          key: 'operateUserName',
          hideInSearch: true,
          hideInTable: true,
          hideInForm: true,
        },
        {
          title: '操作时间',
          dataIndex: 'operateTime',
          key: 'operateTime',
          hideInSearch: true,
          hideInTable: true,
          hideInForm: true,
        },
      ],
      pathconfig: {
        enableadd: true,
        enableedit: false,
        enabledelete: false,
        enabledetail: true,
        add: '/sparepart/outWarehouseTask/save',
        edit: '',
        list: '/sparepart/outWarehouseTask/queryYesComplete',
        delete: '',
        detail: '/sparepart/outWarehouseTask/queryDetails',
      },
    },
  ];
wuhao's avatar
wuhao committed
440
}
wuhao's avatar
wuhao committed
441
export default getcolumns;