import { Modal, Form, DatePicker, message } from "antd";
import { taskDeleteTask, extentTask, endTask } from "../../../services/api";
import $nModal from "../../../utils/modal/nModal";
import locale from "antd/es/date-picker/locale/zh_CN";
import moment from "moment";
export default function () {
return [
{
title: "序号",
dataIndex: "number",
key: "number",
width: 60,
fixed: "left",
},
{
title: '驻勤点ID',
dataIndex: 'comTaskId',
key: 'comTaskId',
},
{
title: '驻勤名称',
dataIndex: 'taskName',
key: 'taskName',
},
{
title: "驻勤状态",
dataIndex: "taskEffect",
key: "taskEffect",
render: (text, record) => {
return (
{text}
);
},
},
{
title: "驻勤点类型",
dataIndex: "taskStationType",
key: "taskStationType",
},
{
title: "驻勤时间",
dataIndex: "startDate",
key: "startDate",
render: (text, record) => `${record.startDate}~${record.endDate}`,
},
{
title: "驻勤地址",
dataIndex: "taskAddress",
key: "taskAddress",
render: (text) =>
{text}
,
},
{
title: "驻勤精确地址",
dataIndex: "taskExactAddress",
key: "taskExactAddress",
render: (text) => {text||'-'}
,
},
{
title: "驻勤人数",
dataIndex: "zqrs",
key: "zqrs",
width: 100,
fixed: "right",
render: (text, record) => {
if (record.taskStatusValue != 6) {
return (
{
this._showModal(
record.comTaskId,
"0",
record.taskName,
record.taskStatusValue
);
}}
>
{text}人
);
} else {
if (text == "0") {
return -;
} else {
return {text}人;
}
}
},
},
{
title: "关联合同",
dataIndex: "glhts",
key: "glhts",
width: 100,
fixed: "right",
dataIndex: "glhts",
key: "glhts",
render: (text) => (
{text > 0 ? (
是
) : (
否 || "-"
)}
),
},
// {
// title: '关联合同',
// dataIndex: 'glhts',
// key: 'glhts',
// width: 100,
// fixed: 'right',
// render: (text, record) => {
// if (record.taskStatusValue != 6) {
// return (
// {
// this._showModal(record.comTaskId, '1', record.taskName);
// }}
// >
// {text}份
//
// );
// } else {
// if (text == '0') {
// return -
// } else {
// return {text}份
// }
// }
// }
// },
{
title: "考勤点",
dataIndex: "kqds",
key: "kqds",
width: 100,
fixed: "right",
render: (text, record) => {
if (record.taskStatusValue != 6) {
return (
{
// 0:暂存任务,1:正式任
if (record.isFormal == "0") {
Modal.warning({
title: "这是一个暂存任务",
});
} else {
this._showModal(
record.comTaskId,
"2",
record.taskName,
record.taskStatusValue
);
}
}}
>
{text}个
);
} else {
if (text == "0") {
return -;
} else {
return {text}个;
}
}
},
},
{
title: "操作",
dataIndex: "operation",
key: "operation",
width: 200,
fixed: "right",
render: (text, record) => {
return (
{
// 未发布
record.taskStatusValue == 6 && (
{
this.props.history.push(
`/taskmanager/tasklist/newtask?id=${record.comTaskId.toString()}&model=detail`
);
// this.props.history.push(`/taskmanager/tasklist/taskDetail?id=${record.comTaskId}`);
}}
>
继续完善
)
}
{/* {// 未发布
record.taskStatusValue == 6 && (
{
Modal.confirm({
title: "确定删除本次驻勤?",
okText: "确认",
cancelText: "取消",
onOk: () => {
taskCancelTask({ comTaskId: record.comTaskId }).then(
res => {
this._updateTable();
}
);
}
});
}}
>
删除
)} */}
{record.taskStatusValue != 6 && (
{
this._showModal(
record.comTaskId,
"3",
record.taskName,
record.taskStatusValue,
{
startDate: record.startDate,
endDate: record.endDate,
}
);
}}
>
人员排班
)}
{record.taskStatusValue != 6 && (
{
// this.props.history.push(`/taskmanager/tasklist/taskDetail?id=${record.comTaskId}`);
this._showModal(record.comTaskId, "4", record.taskName);
}}
>
编辑
)}
{
//只有未生效的任务才有删除按钮
record.taskEffect == "未生效" && (
{
Modal.confirm({
title: "即将删除驻勤点信息,是否继续?",
content: (
驻勤点删除后,将无法恢复,请重新创建。
),
okText: "确认",
cancelText: "取消",
onOk: () => {
taskDeleteTask({ comTaskId: record.comTaskId }).then(
(res) => {
if (res.retType === "0") {
Modal.success({
title: "删除成功!",
okText: "确定",
onOk: () => {
this._updateTable();
},
});
}
}
);
},
});
}}
>
删除
)
}
{
//只有生效与终止的任务才有延期按钮
(record.taskStatusValue === "1" ||
record.taskStatusValue === "7") && (
{
let date = record.endDate; //新结束日期选择
const lateEndDate =
new Date(Date.parse(record.endDate)) > new Date()
? record.endDate
: moment(new Date()).format("YYYY-MM-DD");
$nModal({
width: 650,
title: "驻勤点延期",
content: (
若为已终止的驻勤点延期,则请重新安排人员及排班;若只是对生效的驻勤点进行延期,则只更新结束时间。
),
onOk: (close) => {
if (!date) {
return message.warning("请先选择时间");
} else if(new Date(Date.parse(moment(date).format("YYYY-MM-DD"))) {
if (res.retType === "0") {
Modal.success({
title: "延期成功!",
okText: "确定",
onOk: () => {
this._updateTable();
close();
date = "";
},
});
}
});
}
},
});
}}
>
延期
)
}
{/* {(record.taskStatusValue == 0 || record.taskStatusValue == 1) && (
{
let title = "确定取消并结束本次驻勤?";
switch (true) {
case record.taskStatusValue == 1:
title = "驻勤正在执行,是否确定提前结束驻勤?";
}
Modal.confirm({
title,
okText: "确认",
cancelText: "取消",
onOk: () => {
taskCancelTask({ comTaskId: record.comTaskId }).then(
res => {
this._updateTable();
}
);
}
});
}}
>
结束
)} */}
{
//只有生效状态才有终止按钮
record.taskStatusValue == "1" && (
{
Modal.confirm({
title: "即将终止驻勤点,是否继续?",
content: (
驻勤点操作终止后,将更新驻勤点结束日期为今日(即今日为该驻勤点的最后一天,今日仍需进行排班执勤)。次日时系统将更新驻勤点状态为终止,驻勤人员将被清空。
),
okText: "确认",
cancelText: "取消",
onOk: () => {
endTask({ comTaskId: record.comTaskId }).then((res) => {
if (res.retType === "0") {
Modal.success({
title: "终止成功!",
okText: "确定",
onOk: () => {
this._updateTable();
},
});
}
});
},
});
}}
>
终止
)
}
);
},
},
];
}