import dayjs from 'dayjs';
import { doFetch } from '@/utils/doFetch';
function getcolumns(setdrawer) {
return [
{
tab: '我的待办',
key: '1',
columns: [
{
title: '点检单号',
dataIndex: 'taskNo',
key: 'taskNo',
hideInForm: true,
render: (text, row, _, action) => {
return (
{
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}
);
},
},
{
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',
},
],
fieldProps: {
dropdownMatchSelectWidth: 100,
},
},
{
title: '点检截止日期',
dataIndex: 'checkCloseDate',
key: 'checkCloseDateList',
hideInForm: true,
valueType: 'dateRange',
render: (text, row, _, action) => {
return (
{row.checkCloseDate}
);
},
},
{
title: '接单时间',
dataIndex: 'checkStartTime',
key: 'checkStartTime',
hideInForm: true,
hideInSearch: true,
},
{
title: '点检人员',
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',
},
],
fieldProps: {
dropdownMatchSelectWidth: 100,
},
},
],
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,
render: (text, row, _, action) => {
return (
{
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}
);
},
},
{
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',
},
],
fieldProps: {
dropdownMatchSelectWidth: 100,
},
},
{
title: '点检截止日期',
dataIndex: 'checkCloseDate',
key: 'checkCloseDateList',
hideInForm: true,
valueType: 'dateRange',
render: (text, row, _, action) => {
return (
{row.checkCloseDate}
);
},
},
{
title: '接单时间',
dataIndex: 'checkStartTime',
key: 'checkStartTime',
hideInForm: true,
hideInSearch: true,
},
{
title: '点检人员',
dataIndex: 'checkUserName',
key: 'checkUserId',
hideInSearch: false,
hideInForm: true,
valueType: 'select',
options: {
path: '/auth/sysUser/selection',
params: {},
},
fieldProps: {
placeholder: '请选择',
showSearch: true,
},
},
{
title: '状态',
dataIndex: 'statusName',
key: 'status',
hideInForm: true,
valueType: 'select',
options: [
{
label: '待接单',
value: '1',
},
{
label: '点检中',
value: '2',
},
],
fieldProps: {
dropdownMatchSelectWidth: 100,
},
},
],
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,
render: (text, row, _, action) => {
return (
{
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}
);
},
},
{
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',
},
],
fieldProps: {
dropdownMatchSelectWidth: 100,
},
},
{
title: '点检截止日期',
dataIndex: 'checkCloseDate',
key: 'checkCloseDateList',
hideInForm: true,
valueType: 'dateRange',
render: (text, row, _, action) => {
return {row.checkCloseDate};
},
},
{
title: '接单时间',
dataIndex: 'checkStartTime',
key: 'checkStartTime',
hideInForm: true,
hideInSearch: true,
render: (text, row, _, action) => {
return {row.checkStartTime};
},
},
{
title: '关单时间',
dataIndex: 'endTime',
key: 'endDateList',
hideInForm: true,
valueType: 'dateRange',
render: (text, row, _, action) => {
return {row.endTime};
},
},
{
title: '点检人员',
dataIndex: 'checkUserName',
key: 'checkUserId',
hideInForm: true,
valueType: 'select',
options: {
path: '/auth/sysUser/selection',
params: {},
},
fieldProps: {
placeholder: '请选择',
showSearch: true,
},
},
{
title: '状态',
dataIndex: 'statusName',
key: 'status',
hideInForm: true,
valueType: 'select',
options: [
{
label: '已关单',
value: '3',
},
{
label: '已完成',
value: '4',
},
{
label: '超时关单',
value: '5',
},
],
fieldProps: {
dropdownMatchSelectWidth: 100,
},
},
],
pathconfig: {
enableadd: false,
enableedit: false,
enabledelete: false,
enabledetail: false,
add: '',
edit: '',
list: '/check/umEquipmentCheckTaskHis/queryCheckCompleted',
delete: '',
detail: '',
},
},
];
}
export default getcolumns;