() => command(cmd)(row)} />)
},
];
const columns1 = [
{ title: '序号', key: 'inx', dataIndex: 'inx', width: 60, align:"center" },
{ title: '培训日期', key: 'planDate', dataIndex: 'planDate', width: 150, ellipsis: true },
{
title: '培训时段', key: 'personCount', dataIndex: 'personCount', width: 150,
render: (value, record) => {(record?.stm && record?.etm) ? `${record?.stm}至${record?.etm}` : ''},
},
{ title: '参加人数', key: 'trainees', dataIndex: 'trainees', width: 100 },
{
title: '参训人员', key: 'numPeople', dataIndex: 'numPeople', width: 200,ellipsis: true
},
{
title: '培训签到表', key: 'teamLeader', dataIndex: 'teamLeader', width: 150,
render: (value,record) =>
},
{
title: '操作', key: 'operation', width: 100, fixed: 'right',align: 'center',
render: (value, row, index) => (
{ setPxRecordOpen(true); setQdItem(row)}}>查看
)
},
];
const width = useMemo(() => columns.reduce((total, cur) => total + (cur.width), 0), [columns]);
const width1 = useMemo(() => columns1.reduce((total, cur) => total + (cur.width), 0), [columns1]);
const [pxOpen, setPxOpen] = useState(false)
const [imgVisible, setImgVisible] = useState(false)
const [imgList, setImgList] = useState([])
const [fileList1, setFileList1] = useState([]) //上传文件列表
const [fileList2, setFileList2] = useState([]) //上传文件列表
const reviewPic = (arrPic) => {
if (arrPic.length > 0) {
setImgVisible(true)
setImgList(arrPic)
}
}
const command = (type) => (params) => {
if (type === 'save') {
refModal.current.showSave();
} else if (type === 'edit') {
refModal.current.showEdit({ ...params });
} else if (type === 'view') {
refModal.current.showView(params);
} else if (type === 'del') {
refModal.current.onDeleteGet(apiurl.pxjh.delete + `/${params.id}`);
}else if (type === 'similarAdd') {
refModal.current.showSimilarSave(params);
} else {
// 培训记录
const params1 = {
search: {
...searchVal,
planId:params.id
}
};
setPxOpen(true);
search1(params1)
// getFileInfo(params)
}
}
const { tableProps, search, refresh } = usePageTable(createCrudService(apiurl.pxjh.page).find_noCode);
const { tableProps:tableProps1, search:search1 } = usePageTable(createCrudService(apiurl.pxjl.page).find_noCode);
/**
* @description 处理成功的回调
*/
const successCallback = () => {
refresh()
}
// const getFileInfo = async (params) => {
// try {
// const res = await httpget2(apiurl.pxjl.getFile + `/${params.id}`)
// if (res.code === 200) {
// if (res.data?.files1) {
// let fileArr1 = res.data?.files1.map(item => {
// return {
// name: item.fileName,
// response: {
// data: {
// filePath: item.filePath,
// fileId: item.fileId
// }
// },
// }
// })
// setFileList1(fileArr1)
// }
// if (res.data?.files2) {
// let fileArr2 = res.data?.files2.map(item => {
// return {
// name: item.fileName,
// response: {
// data: {
// filePath: item.filePath,
// fileId: item.fileId
// }
// },
// }
// })
// setFileList2(fileArr2)
// }
// }
// } catch (error) {
// console.log(error);
// }
// }
// 导出
const exportExcel = () => {
let params = {
...searchVal,
}
httppost5(apiurl.pxjh.export, params).then(res => {
exportFile(`培训计划管理.xlsx`,res.data)
})
}
useEffect(()=>{
const params = {
search: {
...searchVal,
}
};
search(params)
}, [searchVal])
// const dataSource = useMemo(() => {
// if (tableProps1.dataSource.length > 0) {
// return tableProps1.dataSource.map(item => ({
// ...item,
// files1: fileList1,
// files2: fileList2,
// }))
// } else {
// return []
// }
// },[tableProps1.dataSource,fileList1,fileList2])
return (
<>
{/* 培训记录 */}
{
setPxOpen(false);
}}
>
{/* 培训记录查看 */}
{
setPxRecordOpen(false);
}}
>
setImgVisible(vis),
}}
>
{
imgList.length > 0 ? imgList.map(item => (
))
: null
}
>
);
}
export default Page;