columns.js 2.5 KB
Newer Older
左玲玲's avatar
左玲玲 committed
1
import { doFetch } from '@/utils/doFetch';
TZW's avatar
TZW committed
2
import dayjs from 'dayjs';
3
function getcolumns(setdrawer) {
TZW's avatar
TZW committed
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
  return {
    columns: [
      {
        title: '点检单号',
        dataIndex: 'taskNo',
        key: 'taskNo',
        hideInForm: false,
        render: (text, row, _, action) => {
          return (
            <a
              onClick={async () => {
                let res = await doFetch({
                  url: '/check/umEquipmentCheckTask/queryDetails',
                  params: { id: row.id },
                });
                if (res.code == '0000') {
                  setdrawer((s) => ({
                    ...s,
                    open: true,
                    val: 'detail',
                    title: '详细信息',
                    item: {
                      ...res?.data?.basics,
左玲玲's avatar
左玲玲 committed
27
                    },
TZW's avatar
TZW committed
28
                  }));
左玲玲's avatar
左玲玲 committed
29
                }
TZW's avatar
TZW committed
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
              }}
            >
              {row?.taskNo}
            </a>
          );
        },
      },
      {
        title: '设备编号',
        dataIndex: 'equipmentNo',
        key: 'equipmentNo',
      },
      {
        title: '设备名称',
        dataIndex: 'equipmentName',
        key: 'equipmentName',
      },
      {
        title: '点检类型',
        dataIndex: 'checkTypeName',
        key: 'checkType',
        valueType: 'select',
        hideInForm: true,
        options: [
          {
            label: '制造点检',
            value: '1',
          },
          {
            label: '设备点检',
            value: '2',
          },
左玲玲's avatar
左玲玲 committed
62
        ],
TZW's avatar
TZW committed
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
        fieldProps: {
          dropdownMatchSelectWidth: 100,
        },
      },
      {
        title: '点检截止日期',
        dataIndex: 'checkCloseDate',
        key: 'checkCloseDateList',
        valueType: 'dateRange',
        render: (text, row, _, action) => {
          return (
            <span
              style={{
                color: `${
                  dayjs(row.checkCloseDate).valueOf() <
                  dayjs(dayjs().format('YYYY-MM-DD')).valueOf()
                    ? '#f50'
                    : 'rgba(0, 0, 0, 0.85)'
                }`,
              }}
            >
              {row.checkCloseDate}
            </span>
          );
左玲玲's avatar
左玲玲 committed
87
        },
TZW's avatar
TZW committed
88 89 90 91 92 93 94 95 96 97 98 99 100 101
      },
    ],
    pathconfig: {
      enableadd: false,
      enableedit: false,
      enabledelete: false,
      enabledetail: true,
      add: '',
      edit: '',
      list: '/check/umEquipmentCheckTask/queryCheckOrders',
      delete: '',
      detail: '',
    },
  };
102
}
左玲玲's avatar
左玲玲 committed
103
export default getcolumns;