|
@@ -41,6 +41,7 @@ import AttachmentTable from '@/components/AttachmentTable';
|
|
|
import { getToken } from '@/utils/utils';
|
|
|
import LuckyExcel from 'luckyexcel';
|
|
|
import DDComponents from '@/components/DDComponents';
|
|
|
+import uploadExcelByUrl from '@/utils/uploadExcelByUrl';
|
|
|
|
|
|
const { TextArea } = Input;
|
|
|
const { Option } = Select;
|
|
@@ -926,49 +927,6 @@ function CommitAuditModal(props) {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
-const uploadExcelByUrl = (nodeType, versionId) => {
|
|
|
- const TEMPLATE_URL =
|
|
|
- 'https://water-service-test.oss-cn-hangzhou.aliyuncs.com/doc/contract/2023-06-29/ed0d5dcd-6ce0-40df-9d17-a1f69245dbb9.xlsx';
|
|
|
- const TEMPLATE_URL2 =
|
|
|
- 'https://water-service-test.oss-cn-hangzhou.aliyuncs.com/doc/contract/2023-06-29/431733cd-0abc-4a68-a439-d24c466e9845.xlsx';
|
|
|
-
|
|
|
- return new Promise((reslove, reject) => {
|
|
|
- LuckyExcel.transformExcelToLuckyByUrl(
|
|
|
- nodeType == 3 ? TEMPLATE_URL : TEMPLATE_URL2,
|
|
|
- '模板.xlsx',
|
|
|
- async (exportJson, luckysheetfile) => {
|
|
|
- let [record] = await getExcel(versionId);
|
|
|
-
|
|
|
- let len = exportJson.sheets.length;
|
|
|
- const excelData = exportJson.sheets?.map(item => {
|
|
|
- return { ...item, order: Number(item.order) };
|
|
|
- });
|
|
|
- delete record.id;
|
|
|
- record.order = len;
|
|
|
- record.index = String(len);
|
|
|
- record.status = '0';
|
|
|
- record.name = '投标成本';
|
|
|
- var res = [...excelData, record];
|
|
|
- // console.log(res);
|
|
|
- reslove(JSON.stringify(res));
|
|
|
- }
|
|
|
- );
|
|
|
- });
|
|
|
-};
|
|
|
-
|
|
|
-async function getExcel(gridKey) {
|
|
|
- var formData = new FormData();
|
|
|
- formData.append('gridKey', gridKey);
|
|
|
- let res = await fetch(
|
|
|
- `/api/v1/purchase/record/sheet?gridKey=${gridKey}&JWT-TOKEN=${getToken()}`,
|
|
|
- {
|
|
|
- method: 'POST',
|
|
|
- body: formData,
|
|
|
- }
|
|
|
- ).then(response => response.text());
|
|
|
- return JSON.parse(JSON.parse(res));
|
|
|
-}
|
|
|
-
|
|
|
export default connect(({ xflow, detail, user }) => ({
|
|
|
flowDetail: xflow.flowDetail,
|
|
|
versionList: detail.versionList,
|