columns.js 17 KB
Newer Older
左玲玲's avatar
左玲玲 committed
1 2
import dayjs from "dayjs";
import { doFetch } from '@/utils/doFetch';
3
function getcolumns(setdrawer) {
左玲玲's avatar
左玲玲 committed
4 5 6 7 8 9 10 11 12 13
    return [
        {
            tab: '我的待办',
            key: '1',
            columns: [
                {
                    title: '点检单号',
                    dataIndex: 'taskNo',
                    key: 'taskNo',
                    hideInForm: true,
左玲玲's avatar
左玲玲 committed
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
                    render: (text, row, _, action) => {
                        return (
                            <a
                                onClick={async () => {
                                    let res = await doFetch({ url: "/check/umEquipmentCheckTask/queryDetails", params: { id: row.id } });
                                    if (res.code == "0000") {
                                        const { taskNo, createTime, statusName, planNo, status } = res?.data?.basics;
                                        setdrawer((s) => ({
                                            ...s,
                                            open: true,
                                            val: 'detail',
                                            title: '详细信息',
                                            item: {
                                                task: {
                                                    taskNo,
                                                    createTime,
                                                    statusName,
                                                    planNo,
                                                    status
                                                },
                                                ...res?.data
                                            }
                                        }));
                                    }
                                }}
                            >
                                {row?.taskNo}
                            </a>
                        );
                    }
左玲玲's avatar
左玲玲 committed
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
                },
                {
                    title: '设备编号',
                    dataIndex: 'equipmentNo',
                    key: 'equipmentNo',
                    hideInForm: true,
                },
                {
                    title: '设备名称',
                    dataIndex: 'equipmentName',
                    key: 'equipmentName',
                    hideInForm: true,
                },
                {
                    title: '点检类型',
                    dataIndex: 'checkTypeName',
                    key: 'checkType',
                    hideInForm: true,
                    valueType: 'select',
                    options: [
                        {
                            label: '制造点检',
                            value: '1',
                        },
                        {
                            label: '设备点检',
                            value: '2',
                        },
                    ],
左玲玲's avatar
左玲玲 committed
73 74 75
                    fieldProps: {
                        dropdownMatchSelectWidth: 100
                    }
左玲玲's avatar
左玲玲 committed
76 77 78 79 80 81 82
                },
                {
                    title: '点检截止日期',
                    dataIndex: 'checkCloseDate',
                    key: 'checkCloseDateList',
                    hideInForm: true,
                    valueType: 'dateRange',
左玲玲's avatar
左玲玲 committed
83 84 85
                    render: (text, row, _, action) => {
                        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
86 87 88 89 90 91 92 93 94
                },
                {
                    title: '接单时间',
                    dataIndex: 'checkStartTime',
                    key: 'checkStartTime',
                    hideInForm: true,
                    hideInSearch: true,
                },
                {
左玲玲's avatar
左玲玲 committed
95
                    title: '点检人员',
左玲玲's avatar
左玲玲 committed
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
                    dataIndex: 'checkUserName',
                    key: 'checkUserName',
                    hideInForm: true,
                    valueType: 'input',
                    hideInSearch: true,
                },
                {
                    title: '状态',
                    dataIndex: 'statusName',
                    key: 'status',
                    hideInForm: true,
                    valueType: 'select',
                    options: [
                        {
                            label: '待接单',
                            value: '1',
                        },
                        {
                            label: '点检中',
                            value: '2',
                        },
                    ],
左玲玲's avatar
左玲玲 committed
118 119 120
                    fieldProps: {
                        dropdownMatchSelectWidth: 100
                    }
左玲玲's avatar
左玲玲 committed
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
                },
            ],
            pathconfig: {
                enableadd: false,
                enableedit: false,
                enabledelete: false,
                enabledetail: false,
                add: '',
                edit: '',
                list: '/check/umEquipmentCheckTask/queryCheckUndone',
                delete: '',
                detail: '',
            },
        },
        {
            tab: '未完成',
            key: '2',
            columns: [
                {
                    title: '点检单号',
                    dataIndex: 'taskNo',
                    key: 'taskNo',
                    hideInForm: true,
左玲玲's avatar
左玲玲 committed
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
                    render: (text, row, _, action) => {
                        return (
                            <a
                                onClick={async () => {
                                    let res = await doFetch({ url: "/check/umEquipmentCheckTask/queryDetails", params: { id: row.id } });
                                    if (res.code == "0000") {
                                        const { taskNo, createTime, statusName, planNo, status } = res?.data?.basics;
                                        setdrawer((s) => ({
                                            ...s,
                                            open: true,
                                            val: 'detail',
                                            title: '详细信息',
                                            item: {
                                                task: {
                                                    taskNo,
                                                    createTime,
                                                    statusName,
                                                    planNo,
                                                    status
                                                },
                                                ...res?.data
                                            }
                                        }));
                                    }
                                }}
                            >
                                {row?.taskNo}
                            </a>
                        );
                    }
左玲玲's avatar
左玲玲 committed
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202
                },
                {
                    title: '设备编号',
                    dataIndex: 'equipmentNo',
                    key: 'equipmentNo',
                    hideInForm: true,
                },
                {
                    title: '设备名称',
                    dataIndex: 'equipmentName',
                    key: 'equipmentName',
                    hideInForm: true,
                },
                {
                    title: '点检类型',
                    dataIndex: 'checkTypeName',
                    key: 'checkType',
                    hideInForm: true,
                    valueType: 'select',
                    options: [
                        {
                            label: '制造点检',
                            value: '1',
                        },
                        {
                            label: '设备点检',
                            value: '2',
                        },
                    ],
左玲玲's avatar
左玲玲 committed
203 204 205
                    fieldProps: {
                        dropdownMatchSelectWidth: 100
                    }
左玲玲's avatar
左玲玲 committed
206 207 208 209 210 211 212
                },
                {
                    title: '点检截止日期',
                    dataIndex: 'checkCloseDate',
                    key: 'checkCloseDateList',
                    hideInForm: true,
                    valueType: 'dateRange',
左玲玲's avatar
左玲玲 committed
213 214 215
                    render: (text, row, _, action) => {
                        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
216 217 218 219 220 221 222 223
                },
                {
                    title: '接单时间',
                    dataIndex: 'checkStartTime',
                    key: 'checkStartTime',
                    hideInForm: true,
                },
                {
左玲玲's avatar
左玲玲 committed
224
                    title: '点检人员',
左玲玲's avatar
左玲玲 committed
225 226 227 228 229 230 231 232 233
                    dataIndex: 'checkUserName',
                    key: 'checkUserId',
                    hideInSearch: false,
                    hideInForm: true,
                    valueType: 'select',
                    options: {
                        path: '/auth/sysUser/selection',
                        params: {},
                    },
左玲玲's avatar
左玲玲 committed
234 235 236
                    fieldProps: {
                        dropdownMatchSelectWidth: 100
                    }
左玲玲's avatar
左玲玲 committed
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253
                },
                {
                    title: '状态',
                    dataIndex: 'statusName',
                    key: 'status',
                    hideInForm: true,
                    valueType: 'select',
                    options: [
                        {
                            label: '待接单',
                            value: '1',
                        },
                        {
                            label: '点检中',
                            value: '2',
                        },
                    ],
左玲玲's avatar
左玲玲 committed
254 255 256
                    fieldProps: {
                        dropdownMatchSelectWidth: 100
                    }
左玲玲's avatar
左玲玲 committed
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279
                },
            ],
            pathconfig: {
                enableadd: false,
                enableedit: false,
                enabledelete: false,
                enabledetail: false,
                add: '',
                edit: '',
                list: '/check/umEquipmentCheckTask/queryCheckUndoneAll',
                delete: '',
                detail: '',
            },
        },
        {
            tab: '已完成',
            key: '3',
            columns: [
                {
                    title: '点检单号',
                    dataIndex: 'taskNo',
                    key: 'taskNo',
                    hideInForm: true,
左玲玲's avatar
左玲玲 committed
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
                    render: (text, row, _, action) => {
                        return (
                            <a
                                onClick={async () => {
                                    let res = await doFetch({ url: "/check/umEquipmentCheckTaskHis/queryDetails", params: { id: row.id } });
                                    if (res.code == "0000") {
                                        const { taskNo, createTime, statusName, planNo, endTime, status } = res?.data?.basics;
                                        let newArr = [];
                                        if (row.status == 4) {
                                            newArr = res?.data?.delay?.item?.map(it => {
                                                return {
                                                    ...it,
                                                    result: it.judgeType == 1 ? it.judgeResultQualitative : it.judgeResultRation
                                                }
                                            });
                                        }
                                        setdrawer((s) => ({
                                            ...s,
                                            open: true,
                                            val: 'detail',
                                            title: '详细信息',
                                            item: {
                                                task: {
                                                    taskNo,
                                                    createTime,
                                                    statusName,
                                                    planNo,
                                                    endTime,
                                                    status: row.status
                                                },
                                                ...res?.data,
                                                delay: res?.data?.delay && {
                                                    ...res?.data?.delay,
                                                    itemlist: newArr
                                                }
                                            }
                                        }));
                                    }

                                }}
                            >
                                {row?.taskNo}
                            </a>
                        );
                    }
左玲玲's avatar
左玲玲 committed
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
                },
                {
                    title: '设备编号',
                    dataIndex: 'equipmentNo',
                    key: 'equipmentNo',
                    hideInForm: true,
                },
                {
                    title: '设备名称',
                    dataIndex: 'equipmentName',
                    key: 'equipmentName',
                    hideInForm: true,
                },
                {
                    title: '点检类型',
                    dataIndex: 'checkTypeName',
                    key: 'checkType',
                    hideInForm: true,
                    valueType: 'select',
                    options: [
                        {
                            label: '制造点检',
                            value: '1',
                        },
                        {
                            label: '设备点检',
                            value: '2',
                        },
                    ],
左玲玲's avatar
左玲玲 committed
354 355 356
                    fieldProps: {
                        dropdownMatchSelectWidth: 100
                    }
左玲玲's avatar
左玲玲 committed
357 358 359 360 361 362 363
                },
                {
                    title: '点检截止日期',
                    dataIndex: 'checkCloseDate',
                    key: 'checkCloseDateList',
                    hideInForm: true,
                    valueType: 'dateRange',
左玲玲's avatar
左玲玲 committed
364 365 366
                    render: (text, row, _, action) => {
                        return <span>{row.checkCloseDate}</span>
                    }
左玲玲's avatar
左玲玲 committed
367 368 369 370 371 372 373 374 375 376 377 378 379
                },
                {
                    title: '接单时间',
                    dataIndex: 'checkStartTime',
                    key: 'checkStartTime',
                    hideInForm: true,
                },
                {
                    title: '关单时间',
                    dataIndex: 'endTime',
                    key: 'endDateList',
                    hideInForm: true,
                    valueType: 'dateRange',
左玲玲's avatar
左玲玲 committed
380 381 382
                    render: (text, row, _, action) => {
                        return <span>{row.endTime}</span>
                    }
左玲玲's avatar
左玲玲 committed
383 384
                },
                {
左玲玲's avatar
左玲玲 committed
385
                    title: '点检人员',
左玲玲's avatar
左玲玲 committed
386 387 388 389 390 391 392 393
                    dataIndex: 'checkUserName',
                    key: 'checkUserId',
                    hideInForm: true,
                    valueType: 'select',
                    options: {
                        path: '/auth/sysUser/selection',
                        params: {},
                    },
左玲玲's avatar
左玲玲 committed
394 395 396
                    fieldProps: {
                        dropdownMatchSelectWidth: 100
                    }
左玲玲's avatar
左玲玲 committed
397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417
                },
                {
                    title: '状态',
                    dataIndex: 'statusName',
                    key: 'status',
                    hideInForm: true,
                    valueType: 'select',
                    options: [
                        {
                            label: '已关单',
                            value: '3',
                        },
                        {
                            label: '已完成',
                            value: '4',
                        },
                        {
                            label: '超时关单',
                            value: '5',
                        },
                    ],
左玲玲's avatar
左玲玲 committed
418 419 420
                    fieldProps: {
                        dropdownMatchSelectWidth: 100
                    }
左玲玲's avatar
左玲玲 committed
421 422 423 424 425 426 427 428 429 430 431 432 433 434 435
                },
            ],
            pathconfig: {
                enableadd: false,
                enableedit: false,
                enabledelete: false,
                enabledetail: false,
                add: '',
                edit: '',
                list: '/check/umEquipmentCheckTaskHis/queryCheckCompleted',
                delete: '',
                detail: '',
            },
        },
    ];
436
}
左玲玲's avatar
左玲玲 committed
437
export default getcolumns;