Skip to content

Commit 506b836

Browse files
committed
multiExport
1 parent 632e412 commit 506b836

File tree

3 files changed

+47
-2
lines changed

3 files changed

+47
-2
lines changed

src/api/table.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,14 @@ const table = {
123123
dataSource: dataSource
124124
});
125125
},
126+
multiExport: function(dataSource, ids) {
127+
return axiosInstance.post("/api/business/export",
128+
ids,
129+
{
130+
dataSource: dataSource
131+
}
132+
);
133+
},
126134
multiImport: async function(dataSource, data, progressCallback) {
127135
console.log("table->import")
128136
console.log(data)

src/pages/metadata/table/list.vue

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,22 @@
7474
unelevated
7575
@click="onExportClickAction()"
7676
color="positive"
77-
label="批量导出"
77+
label="批量导出元数据"
78+
/>
79+
<p class="q-px-sm"/>
80+
<q-btn
81+
:disable="selected.length == 0"
82+
unelevated
83+
@click="onExportBussinessClickAction()"
84+
color="positive"
85+
label="导出业务数据"
7886
/>
7987
<p class="q-px-sm"/>
8088
<q-btn
8189
unelevated
8290
@click="onImportClickAction()"
8391
color="purple"
84-
label="批量导入"
92+
label="导入元数据"
8593
/>
8694
<p class="q-px-sm"/>
8795
<q-btn
@@ -97,6 +105,7 @@
97105
color="primary"
98106
label="添加"
99107
/>
108+
<p class="q-px-sm"/>
100109
</template>
101110

102111
</q-banner>
@@ -177,6 +186,7 @@
177186

178187
<script>
179188
import { metadataTableService } from "../../../service";
189+
import { tableService } from "../../../service";
180190
import { date } from "../../../utils";
181191
182192
export default {
@@ -414,6 +424,29 @@ export default {
414424
console.error(error);
415425
}
416426
},
427+
async onExportBussinessClickAction(id) {
428+
let ids = [];
429+
this.selected.forEach(function(val){
430+
ids.push(val.id);
431+
});
432+
console.info("list->onExportBussinessClickAction");
433+
434+
this.$q.loading.show({
435+
message: "导出中"
436+
});
437+
438+
try {
439+
const fileName = await tableService.multiExport(this.dataSource, ids);
440+
this.$q.notify("业务数据JSON生成成功,请等待下载完成后查看!");
441+
442+
window.open("/api/file/" + fileName + "?dataSource=" + this.dataSource, "_blank");
443+
444+
this.$q.loading.hide();
445+
} catch (error) {
446+
this.$q.loading.hide();
447+
console.error(error);
448+
}
449+
},
417450
418451
onImportClickAction() {
419452
this.$router.push("/dataSource/" + this.dataSource + "/metadata/tables/import");

src/service/tableService.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ const tableService = {
4545
return res.data;
4646
})
4747
},
48+
multiExport: async function(dataSource, ids) {
49+
var res = await table.multiExport(dataSource, ids);
50+
return res.data;
51+
},
4852
getImportTemplate: async function(dataSource, tableName) {
4953
var res = await table.getImportTemplate(dataSource, tableName);
5054
return res.data;

0 commit comments

Comments
 (0)