190a1bbf by lihua

导入文件数据显示格式化后的值

1 parent b6f64175
...@@ -424,7 +424,7 @@ const formatterPreviewDate = (row, info) => { ...@@ -424,7 +424,7 @@ const formatterPreviewDate = (row, info) => {
424 424
425 /** 解析的总的表格数据,方便后面修改抽样比例时使用 */ 425 /** 解析的总的表格数据,方便后面修改抽样比例时使用 */
426 const parseFileDataSum: any = ref([]); 426 const parseFileDataSum: any = ref([]);
427 427 const currentSheet: any = ref();
428 const parseFileData = (fileRaw) => { 428 const parseFileData = (fileRaw) => {
429 sampleTableDataLoading.value = true; 429 sampleTableDataLoading.value = true;
430 fileRaw.arrayBuffer().then(async (f) => { 430 fileRaw.arrayBuffer().then(async (f) => {
...@@ -432,6 +432,7 @@ const parseFileData = (fileRaw) => { ...@@ -432,6 +432,7 @@ const parseFileData = (fileRaw) => {
432 raw: false, cellDates: true 432 raw: false, cellDates: true
433 }); 433 });
434 const sheet = wb.Sheets[wb.SheetNames[0]]; 434 const sheet = wb.Sheets[wb.SheetNames[0]];
435 currentSheet.value = sheet;
435 const json: any[] = XLSX.utils.sheet_to_json(sheet, { header: 1 }); 436 const json: any[] = XLSX.utils.sheet_to_json(sheet, { header: 1 });
436 if (json.length == 0) { 437 if (json.length == 0) {
437 sampleTableFields.value = []; 438 sampleTableFields.value = [];
...@@ -493,7 +494,10 @@ const transferSampleData = () => { ...@@ -493,7 +494,10 @@ const transferSampleData = () => {
493 let object = {}; 494 let object = {};
494 parseFileDataSum.value[0].forEach((chName, col) => { 495 parseFileDataSum.value[0].forEach((chName, col) => {
495 let name = sampleTableFields.value[col].enName; 496 let name = sampleTableFields.value[col].enName;
496 object[name] = info[col]; 497 var cellRef = XLSX.utils.encode_cell({ r: row + 1, c: col });
498 var cell = currentSheet.value[cellRef];
499 let v = cell.w || info[col];
500 object[name] = v;
497 }); 501 });
498 return object; 502 return object;
499 }); 503 });
...@@ -1289,7 +1293,7 @@ onUnmounted(() => { ...@@ -1289,7 +1293,7 @@ onUnmounted(() => {
1289 .table-v2-main { 1293 .table-v2-main {
1290 width: 100%; 1294 width: 100%;
1291 height: 240px; 1295 height: 240px;
1292 1296 margin-top: 2px;
1293 1297
1294 .main-placeholder { 1298 .main-placeholder {
1295 height: 100%; 1299 height: 100%;
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!