columns.js 2.67 KB
Newer Older
TZW's avatar
TZW committed
1 2 3
import dayjs from 'dayjs';
import { doFetch } from '@/utils/doFetch';

TZW's avatar
TZW committed
4 5
function getcolumns(setdrawer) {
  return {
TZW's avatar
TZW committed
6 7 8 9 10 11 12 13 14 15 16 17 18 19 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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 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
    columns: [
      {
        title: '保养单号',
        dataIndex: 'taskNo',
        key: 'taskNo',
        render: (text, row, _, action) => {
          return (
            <a
              onClick={() => {
                setdrawer((s) => ({
                  ...s,
                  open: true,
                  val: 'only',
                  title: '详细信息',
                  item: row,
                }));
              }}
            >
              {row?.maintainNo}
            </a>
          );
        },
      },
      {
        title: '设备编号',
        dataIndex: 'equipmentNo',
        key: 'equipmentNo',
      },
      {
        title: '设备名称',
        dataIndex: 'equipmentName',
        key: 'equipmentName',
      },
      {
        title: '保养类型',
        dataIndex: 'maintainTypeName',
        key: 'maintainType',
        valueType: 'select',
        mode: 'radio',
        options: [
          {
            label: '自主保养',
            value: '1',
          },
          {
            label: '专业保养',
            value: '2',
          },
        ],
      },
      {
        title: '保养频次',
        dataIndex: 'maintainFrequencyName',
        key: 'maintainFrequency',
        valueType: 'select',
        mode: 'radio',
        options: [
          {
            label: '周',
            value: '0',
          },
          {
            label: '月度',
            value: '1',
          },
          {
            label: '季度',
            value: '2',
          },
          {
            label: '半年',
            value: '3',
          },
          {
            label: '一年',
            value: '4',
          },
        ],
      },
      {
        title: '保养截至日期',
        dataIndex: 'planMaintainDate',
        key: 'planMaintainDateList',
        valueType: 'dateRange',
        render: (text, row, _, action) => {
          return (
            <span
              style={{
                color: `${
                  dayjs(row.planMaintainDate).valueOf() < dayjs().format('YYYY-MM-DD').valueOf()
                    ? '#f50'
                    : 'rgba(0, 0, 0, 0.85)'
                }`,
              }}
            >
              {row.planMaintainDate}
            </span>
          );
        },
      },
    ],
    pathconfig: {
      enableadd: false,
      enableedit: false,
      enabledelete: false,
      enabledetail: false,
      add: '',
      edit: '',
      list: '/maintain/umMaintainTask/queryReceivingList',
      delete: '',
      detail: '',
    },
  };
TZW's avatar
TZW committed
119
}
TZW's avatar
TZW committed
120
export default getcolumns;