import React, { Fragment, useRef, useMemo,useEffect,useState } from 'react';
import BasicCrudModal from '../../../../components/crud/BasicCrudModal';
import { Table, Card, Modal, Form, Input, Button, Row,Col, Timeline, message, Tabs,Image } from 'antd';
import {FileWordOutlined,FilePdfOutlined,FileZipOutlined,FileExcelOutlined } from '@ant-design/icons';
import { useSelector } from 'react-redux';
import ToolBar from './toolbar';
import ModalForm from './form';
import apiurl from '../../../../service/apiurl';
import usePageTable from '../../../../components/crud/usePageTable2';
import { createCrudService } from '../../../../components/crud/_';
import {CrudOpRender_text} from '../../../../components/crud/CrudOpRender';
const url = "http://223.75.53.141:9102/test.by-lyf.tmp"
const Page = () => {
const role = useSelector(state => state.auth.role);
const editBtn = role?.rule?.find(item => item.menuName == "编辑")||true;
const viewBtn = role?.rule?.find(item => item.menuName == "查看")||true;
const delBtn = role?.rule?.find(item => item.menuName == "删除")||true;
const checkType = {
1: "地方自行组织",
2: "中央规划",
}
const identifyType = {
1: "施工中",
2: "已完工",
}
const refModal = useRef();
const columns = [
{ title: '序号', key: 'inx', dataIndex: 'inx', width: 60, align: "center" },
{title: '最近一次加固开工日期', key: 'startDate', dataIndex: 'startDate', width: 240,},
{title: '竣工日期', key: 'finishDate', dataIndex: 'finishDate', width: 200,},
{
title: '组织方式', key: 'organizationWay', dataIndex: 'organizationWay', width: 200,
render: (value) => {value ? checkType[value] : ''}
},
{
title: '工程状态', key: 'projectStatus', dataIndex: 'projectStatus', width: 200,
render: (value) => {value ? identifyType[value] : ''}
},
{title: '投运日期', key: 'operationDate', dataIndex: 'operationDate', width: 200},
{title: '总投资(万元)', key: 'totalInvestment', dataIndex: 'totalInvestment', width: 200},
{
title: '操作', key: 'operation', width: 200, fixed: 'right',align: 'center',
render: (value, row, index) => (
() => command(cmd)(row)} />)
},
];
const width = useMemo(() => columns.reduce((total, cur) => total + (cur.width), 0), [columns]);
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.rcgl.aqgl.cxjgtz.delete + `/${params.id}`);
}
}
const { tableProps, search, refresh } = usePageTable(createCrudService(apiurl.rcgl.aqgl.cxjgtz.page).find_noCode);
/**
* @description 处理成功的回调
*/
const successCallback = () => {
refresh()
}
useEffect(() => {
search()
}, [])
return (
<>
{refresh({addvcd:localStorage.getItem('ADCD6')})}}
/>
>
);
}
export default Page;