Browse Source

恢复下载差异数据按钮

intex_online_narushoulingshu
张立 2 weeks ago
parent
commit
0bed5ad69c
  1. 65
      src/components/ImportForm/src/ImportFormStep.vue
  2. 3
      src/locales/en-US.ts
  3. 3
      src/locales/zh-CN.ts

65
src/components/ImportForm/src/ImportFormStep.vue

@ -83,9 +83,11 @@
<Icon icon="ep:download" />
{{ t('ts.下载模板') }}
</el-button>
<el-button type="primary" plain @click="downloadDifferenceData" v-if="active == 1 && error">
<Icon icon="ep:download" />
{{ t('ts.差异数据') }}
<el-button type="primary" plain @click="downloadDifferenceData" v-if="active == 1 && error">
{{ t('ts.下载差异数据') }}
</el-button>
<el-button type="primary" plain @click="differentialAdjustment" v-if="active == 1 && error">
{{ t('ts.差异调整') }}
</el-button>
</div>
<el-button :disabled="formLoading || isShowLoading" type="primary" @click="submitForm" v-if="active == 0 || (active == 1 && !error)">{{ t('ts.下一步') }}</el-button>
@ -690,36 +692,43 @@ const importTemplate = () => {
const searchTableSuccess = (formField, searchField, val, type, row) => {
emits('searchTableSuccess', formField, searchField, val, formRef.value, type, row)
}
const downloadDifferenceData = () => {
//
const downloadDifferenceData = () => {
if (props.tableObject.tableList.length === 0) {
message.warning('没有可下载的差异数据');
return;
}
// // 使
// const columns = currentColumns.value;
// // 簿使
// const wb = XLSX.utils.book_new();
// const ws = XLSX.utils.json_to_sheet(props.tableObject.tableList);
// // ;
// columns.forEach((col, index) => {
// const cellAddress = XLSX.utils.encode_cell({ r: 0, c: index });
// if (ws[cellAddress]) {
// ws[cellAddress].v = col.label;
// }
// });
// //
// const colWidth = columns.map(() => ({ wch: 20 }));
// ws['!cols'] = colWidth;
// // 簿
// XLSX.utils.book_append_sheet(wb, ws, "");
// const timestamp = new Date().getTime();
// XLSX.writeFile(wb, `_${timestamp}.xlsx`);
// 使
const columns = currentColumns.value;
// 簿使
const wb = XLSX.utils.book_new();
const ws = XLSX.utils.json_to_sheet(props.tableObject.tableList);
// ;
columns.forEach((col, index) => {
const cellAddress = XLSX.utils.encode_cell({ r: 0, c: index });
if (ws[cellAddress]) {
ws[cellAddress].v = col.label;
}
});
//
const colWidth = columns.map(() => ({ wch: 20 }));
ws['!cols'] = colWidth;
// 簿
XLSX.utils.book_append_sheet(wb, ws, "差异数据");
const timestamp = new Date().getTime();
XLSX.writeFile(wb, `差异数据_${timestamp}.xlsx`);
}
//
const differentialAdjustment = () => {
if (props.tableObject.tableList.length === 0) {
message.warning('没有差异数据');
return;
}
const list = props.tableObject.tableList.map(item => {
return {
materialCode: item.materialCode,

3
src/locales/en-US.ts

@ -904,7 +904,8 @@ export default {
'追加:只新增,不修改':'Add:Add,no modify',
'覆盖:只修改不新增':'Cover:Modify,not add',
: 'Download Template',
: 'Differential data',
: 'Download differential data',
: 'Differential adjustment',
:'Update',
:'Add',
:'Cover',

3
src/locales/zh-CN.ts

@ -909,7 +909,8 @@ export default {
'追加:只新增,不修改':'追加:只新增,不修改',
'覆盖:只修改不新增':'覆盖:只修改不新增',
: '下载模板',
: '差异数据',
: '下载差异数据',
: '差异调整',
:'更新',
:'追加',
:'覆盖',

Loading…
Cancel
Save