columns.js 13.5 KB
Newer Older
左玲玲's avatar
左玲玲 committed
1 2 3 4 5 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
import dayjs from 'dayjs';
function getcolumns(setdrawer) {
    const disabledDate = (current) => {
        // Can not select days before today and today
        return current && current < dayjs().endOf('day');
    };
    const columns = [
        {
            title: '设备编号',
            dataIndex: 'equipmentNo',
            key: 'equipmentNo',
            editable: false,
        },
        {
            title: '设备名称',
            dataIndex: 'equipmentName',
            key: 'equipmentName',
            editable: false,
        },
        {
            title: '工厂名称',
            dataIndex: 'factoryName',
            key: 'factoryId',
            hideInForm: true,
            valueType: 'select',
            fieldProps: {
                placeholder: '请选择',
                showSearch: true,
            },
            options: {
                path: '/auth/sysFactory/getAllFactorySelection',
                params: {},
            },
            editable: false,
        },
        {
            title: '车间名称',
            dataIndex: 'shopName',
            key: 'shopId',
            hideInForm: true,
            valueType: 'select',
            fieldProps: {
                placeholder: '请选择',
                showSearch: true,
            },
            options: {
                path: '/auth/sysShop/getAllShopSelection',
                params: {},
            },
            editable: false,
        },
        {
            title: '下次点检日期',
            dataIndex: 'checkPlanDate',
            formItemProps: {
                rules: [
                    {
                        required: true,
                        message: '此项为必填项',
                    },
                ],
            },
            fieldProps: {
                disabledDate,
            },
            valueType: 'date',
            hideInSearch: true,
        },
    ];
左玲玲's avatar
左玲玲 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
    return [
        {
            tab: '未完成',
            key: 1,
            columns: [
                {
                    title: '点检计划单号',
                    dataIndex: 'checkNo',
                    key: 'checkNo',
                    hideInForm: true,
                    render: (text, row, _, action) => {
                        return (
                            <a
                                onClick={() => {
                                    setdrawer((s) => ({
                                        ...s,
                                        open: true,
                                        val: 'detail',
                                        title: '详细信息',
                                        item: row,
                                    }));
                                }}
                            >
                                {row?.checkNo}
                            </a>
                        );
                    },
                },
                {
                    title: '设备编号',
                    dataIndex: 'equipmentNo',
                    key: 'equipmentNo',
                    hideInForm: true,
                },
                {
                    title: '设备名称',
                    dataIndex: 'equipmentName',
                    key: 'equipmentName',
                    hideInForm: true,
                },
                {
                    title: '工厂名称',
                    dataIndex: 'factoryName',
                    key: 'factoryId',
                    hideInForm: true,
                    valueType: 'select',
左玲玲's avatar
左玲玲 committed
116 117 118 119
                    fieldProps: {
                        placeholder: '请选择',
                        showSearch: true,
                    },
左玲玲's avatar
左玲玲 committed
120 121 122 123 124 125 126 127 128 129 130
                    options: {
                        path: '/auth/sysFactory/getAllFactorySelection',
                        params: {},
                    },
                },
                {
                    title: '车间名称',
                    dataIndex: 'shopName',
                    key: 'shopId',
                    hideInForm: true,
                    valueType: 'select',
左玲玲's avatar
左玲玲 committed
131 132 133 134
                    fieldProps: {
                        placeholder: '请选择',
                        showSearch: true,
                    },
左玲玲's avatar
左玲玲 committed
135
                    options: {
左玲玲's avatar
左玲玲 committed
136
                        path: '/auth/sysShop/getAllShopSelection',
左玲玲's avatar
左玲玲 committed
137
                        params: {},
左玲玲's avatar
左玲玲 committed
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
                    },
                },
                {
                    title: '点检类型',
                    dataIndex: 'checkTypeName',
                    key: 'checkType',
                    valueType: 'select',
                    options: [
                        {
                            label: '制造点检',
                            value: 1,
                        },
                        {
                            label: '设备点检',
                            value: 2,
                        },
                    ],
                    formItemProps: {
                        rules: [
                            {
                                required: true,
                                message: '此项为必填项',
                            },
                        ],
                    },
                },
                {
                    title: '计划类型',
                    dataIndex: 'checkLoopName',
                    key: 'checkLoop',
                    formItemProps: {
                        rules: [
                            {
                                required: true,
                                message: '此项为必填项',
                            },
                        ],
                    },
                    valueType: 'radio',
                    searchValueType: 'select',
                    options: [
                        {
                            label: '单次',
                            value: 1,
                        },
                        {
                            label: '周期',
                            value: 2,
                        },
                    ],
                },
                {
                    title: '周期(天)',
                    dataIndex: 'checkCycle',
                    key: 'checkCycle',
                    hideInSearch: true,
                    valueType: 'digit',
                    hideInForm: {
左玲玲's avatar
左玲玲 committed
196
                        checkLoop: [1, undefined],
左玲玲's avatar
左玲玲 committed
197
                    },
左玲玲's avatar
左玲玲 committed
198
                    precision: 0,
左玲玲's avatar
左玲玲 committed
199 200 201 202 203 204 205
                },
                {
                    title: '下次点检日期',
                    dataIndex: 'planCheckDate',
                    key: 'planCheckDateList',
                    hideInForm: true,
                    valueType: 'dateRange',
左玲玲's avatar
左玲玲 committed
206 207 208
                    render: (text, row, _, action) => {
                        return <span>{row.planCheckDate}</span>;
                    },
左玲玲's avatar
左玲玲 committed
209 210 211 212 213 214 215 216
                },
                {
                    title: '状态',
                    dataIndex: 'statusName',
                    key: 'status',
                    hideInForm: true,
                    valueType: 'select',
                    fieldProps: {
左玲玲's avatar
左玲玲 committed
217
                        dropdownMatchSelectWidth: 100
左玲玲's avatar
左玲玲 committed
218 219 220 221 222 223 224 225 226 227 228 229 230 231
                    },
                    options: [
                        {
                            label: '未开始',
                            value: 1,
                        },
                        {
                            label: '执行中',
                            value: 2,
                        },
                    ],
                },
                {
                    title: '选择设备',
左玲玲's avatar
左玲玲 committed
232 233
                    dataIndex: 'paramList',
                    key: 'paramList',
左玲玲's avatar
左玲玲 committed
234 235 236 237 238 239 240 241 242 243 244 245 246 247
                    formItemProps: {
                        rules: [
                            {
                                required: true,
                                message: '此项为必填项',
                            },
                        ],
                    },
                    hideInSearch: true,
                    hideInTable: true,
                    valueType: 'formSelectList',
                    colProps: {
                        span: 24,
                    },
左玲玲's avatar
左玲玲 committed
248 249 250
                    path: '/asset/equipment/list/user/shop',
                    columns,
                    hideInDescriptions: true,
左玲玲's avatar
左玲玲 committed
251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272
                },
            ],
            pathconfig: {
                enableadd: true,
                enableedit: false,
                enabledelete: true,
                enabledetail: true,
                add: '/check/umEquipmentCheckPlan/save',
                edit: '',
                list: '/check/umEquipmentCheckPlan/queryNoComplete',
                delete: '/check/umEquipmentCheckPlan/deleteById',
                detail: '/check/umEquipmentCheckPlan/queryDetails',
            },
        },
        {
            tab: '已完成',
            key: 2,
            columns: [
                {
                    title: '点检计划单号',
                    dataIndex: 'checkNo',
                    key: 'checkNo',
左玲玲's avatar
左玲玲 committed
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291
                    render: (text, row, _, action) => {
                        return (
                            <a
                                onClick={() => {
                                    setdrawer((s) => ({
                                        ...s,
                                        open: true,
                                        title: '详情',
                                        val: 'detail',
                                        type: 'detail',
                                        title: '详细信息',
                                        item: row,
                                    }));
                                }}
                            >
                                {row?.checkNo}
                            </a>
                        );
                    },
左玲玲's avatar
左玲玲 committed
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306
                },
                {
                    title: '设备编号',
                    dataIndex: 'equipmentNo',
                    key: 'equipmentNo',
                },
                {
                    title: '设备名称',
                    dataIndex: 'equipmentName',
                    key: 'equipmentName',
                },
                {
                    title: '工厂名称',
                    dataIndex: 'factoryName',
                    key: 'factoryId',
左玲玲's avatar
左玲玲 committed
307
                    hideInForm: true,
左玲玲's avatar
左玲玲 committed
308
                    valueType: 'select',
左玲玲's avatar
左玲玲 committed
309 310 311 312
                    fieldProps: {
                        placeholder: '请选择',
                        showSearch: true,
                    },
左玲玲's avatar
左玲玲 committed
313 314 315 316 317 318 319 320 321
                    options: {
                        path: '/auth/sysFactory/getAllFactorySelection',
                        params: {},
                    },
                },
                {
                    title: '车间名称',
                    dataIndex: 'shopName',
                    key: 'shopId',
左玲玲's avatar
左玲玲 committed
322
                    hideInForm: true,
左玲玲's avatar
左玲玲 committed
323
                    valueType: 'select',
左玲玲's avatar
左玲玲 committed
324 325 326 327
                    fieldProps: {
                        placeholder: '请选择',
                        showSearch: true,
                    },
左玲玲's avatar
左玲玲 committed
328
                    options: {
左玲玲's avatar
左玲玲 committed
329
                        path: '/auth/sysShop/getAllShopSelection',
左玲玲's avatar
左玲玲 committed
330
                        params: {},
左玲玲's avatar
左玲玲 committed
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 368 369 370 371 372 373 374 375
                    },
                },
                {
                    title: '点检类型',
                    dataIndex: 'checkTypeName',
                    key: 'checkType',
                    valueType: 'select',
                    options: [
                        {
                            label: '制造点检',
                            value: 1,
                        },
                        {
                            label: '设备点检',
                            value: 2,
                        },
                    ],
                },
                {
                    title: '计划类型',
                    dataIndex: 'checkLoopName',
                    key: 'checkLoop',
                    valueType: 'select',
                    options: [
                        {
                            label: '单次',
                            value: 1,
                        },
                        {
                            label: '周期',
                            value: 2,
                        },
                    ],
                },
                {
                    title: '周期(天)',
                    dataIndex: 'checkCycle',
                    key: 'checkCycle',
                    hideInSearch: true,
                },
                {
                    title: '关单日期',
                    dataIndex: 'endDate',
                    key: 'endDateList',
                    valueType: 'dateRange',
左玲玲's avatar
左玲玲 committed
376 377 378
                    render: (text, row, _, action) => {
                        return <span>{row.endDate}</span>;
                    },
左玲玲's avatar
左玲玲 committed
379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394
                },
                {
                    title: '状态',
                    dataIndex: 'statusName',
                    key: 'statusName',
                    hideInSearch: true,
                },
            ],
            pathconfig: {
                enableadd: false,
                enableedit: false,
                enabledelete: false,
                enabledetail: true,
                add: '',
                edit: '',
                list: '/check/umEquipmentCheckPlan/queryYesComplete',
左玲玲's avatar
左玲玲 committed
395
                delete: '/check/umEquipmentCheckPlan/deleteByI',
左玲玲's avatar
左玲玲 committed
396 397 398 399 400 401
                detail: '/check/umEquipmentCheckPlan/queryDetails',
            },
        },
    ];
}
export default getcolumns;