columns.js 3 KB
Newer Older
左玲玲's avatar
左玲玲 committed
1 2
import { doFetch } from '@/utils/doFetch';
import dayjs from "dayjs";
3
function getcolumns(setdrawer) {
左玲玲's avatar
左玲玲 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
                                        }
                                    }));
                                }
27

左玲玲's avatar
左玲玲 committed
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
                            }}
                        >
                            {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',
                    },
                ],
                fieldProps: {
左玲玲's avatar
左玲玲 committed
62 63
                    dropdownMatchSelectWidth: 100
                }
左玲玲's avatar
左玲玲 committed
64 65 66 67 68 69 70
            },
            {
                title: '点检截止日期',
                dataIndex: 'checkCloseDate',
                key: 'checkCloseDateList',
                valueType: 'dateRange',
                render: (text, row, _, action) => {
左玲玲's avatar
左玲玲 committed
71
                    return <span style={{ color: `${dayjs(row.checkCloseDate).valueOf() < dayjs().format("YYYY-MM-DD").valueOf() ? "#f50" : "rgba(0, 0, 0, 0.85)"}` }}>{row.checkCloseDate}</span>
左玲玲's avatar
左玲玲 committed
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
                }
            },
        ],
        pathconfig: {
            enableadd: false,
            enableedit: false,
            enabledelete: false,
            enabledetail: true,
            add: '',
            edit: '',
            list: '/check/umEquipmentCheckTask/queryCheckOrders',
            delete: '',
            detail: '',
        },
    };
87
}
左玲玲's avatar
左玲玲 committed
88
export default getcolumns;