|
@@ -25,6 +25,7 @@ import dayjs from 'dayjs';
|
|
|
import { getToken } from '@/utils/utils';
|
|
|
import { exportExcel, getUUID } from '../../utils/exportExcl';
|
|
|
import { stringify } from 'qs';
|
|
|
+import LuckyExcel from 'luckyexcel';
|
|
|
const PSRDetail = () => {
|
|
|
const navigate = useNavigate();
|
|
|
const params = useParams();
|
|
@@ -137,6 +138,14 @@ const PSRDetail = () => {
|
|
|
},
|
|
|
});
|
|
|
|
|
|
+ useEffect(() => {
|
|
|
+ axios.get('/excelData.json').then((res) => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ renderSheet(res.data);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }, []);
|
|
|
+
|
|
|
const data_type = useMemo(() => {
|
|
|
if (key == '3') return 1;
|
|
|
if (key == '4') return 2;
|
|
@@ -144,12 +153,12 @@ const PSRDetail = () => {
|
|
|
}, [key]);
|
|
|
|
|
|
useEffect(() => {
|
|
|
- setCompareValues([]);
|
|
|
- if (key) {
|
|
|
- onChange(key);
|
|
|
- } else {
|
|
|
- queryPsrExcel({ gridKey: node_id });
|
|
|
- }
|
|
|
+ // setCompareValues([]);
|
|
|
+ // if (key) {
|
|
|
+ // onChange(key);
|
|
|
+ // } else {
|
|
|
+ // queryPsrExcel({ gridKey: node_id });
|
|
|
+ // }
|
|
|
}, [key]);
|
|
|
//请求投标版、签字版psr excel
|
|
|
const queryPsrExcel = (data) => {
|
|
@@ -232,7 +241,7 @@ const PSRDetail = () => {
|
|
|
luckysheetRef.current = contentWindow.luckysheet;
|
|
|
};
|
|
|
const renderSheet = (currentData, is_edit = false) => {
|
|
|
- console.log('==================', luckysheetRef.current);
|
|
|
+ console.log('==================', JSON.stringify(currentData));
|
|
|
if (!luckysheetRef.current) {
|
|
|
setTimeout(() => {
|
|
|
renderSheet(currentData, is_edit);
|
|
@@ -404,12 +413,59 @@ const PSRDetail = () => {
|
|
|
children: renderTitle(2, '现金流'),
|
|
|
},
|
|
|
];
|
|
|
+
|
|
|
+ console.log('----------------', luckysheetRef.current);
|
|
|
+
|
|
|
+ // const handlerOnChange = (event) => {
|
|
|
+ // console.log(event);
|
|
|
+ // console.log('----------------', luckysheetRef.current);
|
|
|
+ // var file = event.target.files[0];
|
|
|
+ // var fileName = file.name;
|
|
|
+ // fileName = fileName + '';
|
|
|
+ // //將文件加載到頁面上
|
|
|
+ // LuckyExcel.transformExcelToLucky(
|
|
|
+ // file,
|
|
|
+ // function (exportJson, luckysheetfile) {
|
|
|
+ // if (exportJson.sheets == null || exportJson.sheets.length == 0) {
|
|
|
+ // alert(
|
|
|
+ // 'Failed to read the content of the excel file, currently does not support xls files!',
|
|
|
+ // );
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ // console.log(exportJson, luckysheetfile);
|
|
|
+ // renderSheet(exportJson?.sheets);
|
|
|
+ // // window.luckysheet.destroy();
|
|
|
+
|
|
|
+ // // window.luckysheet.create({
|
|
|
+ // // container: 'luckysheet', //luckysheet is the container id
|
|
|
+ // // showinfobar:false,
|
|
|
+ // // lang: 'zh', // 设定表格语言
|
|
|
+ // // allowEdit: true,//作用:是否允许前台编辑
|
|
|
+ // // // allowUpdate: true,
|
|
|
+ // // allowCopy: true, //是否允许拷贝
|
|
|
+ // // showtoolbar: true, //是否第二列显示工具栏
|
|
|
+ // // showinfobar: true, //是否显示顶部名称栏
|
|
|
+ // // showsheetbar: true, //是否显示底部表格名称区域
|
|
|
+ // // showstatisticBar: true, //是否显示底部计数栏
|
|
|
+ // // pointEdit: false, //是否是编辑器插入表格模式
|
|
|
+ // // pointEditUpdate: null, //编辑器表格更新函数
|
|
|
+ // // data:exportJson.sheets,
|
|
|
+ // // title:exportJson.info.name,
|
|
|
+ // // userInfo:exportJson.info.name.creator,
|
|
|
+ // // functionButton: '<button id="" class="btn btn-primary" style=" padding:3px 6px; font-size: 16px;width: 100px;height: 27px; margin-right: 85px;" οnclick="downExcelData()">導出</button>',
|
|
|
+
|
|
|
+ // // });
|
|
|
+ // },
|
|
|
+ // );
|
|
|
+ // };
|
|
|
+
|
|
|
return (
|
|
|
<PageContent>
|
|
|
<div className={styles.titleDev}>
|
|
|
<Button type="primary" onClick={() => navigate(-1)}>
|
|
|
返回
|
|
|
</Button>
|
|
|
+ {/* <input type="file" onChange={handlerOnChange} /> */}
|
|
|
<span className={styles.title}>{project_name}</span>
|
|
|
</div>
|
|
|
<Tabs defaultActiveKey="1" type="card" items={items} onChange={setKey} />
|