This commit is contained in:
2021-09-09 18:58:00 +00:00
parent 7a80ee7df4
commit b8ee6fa025
4 changed files with 100 additions and 64 deletions

View File

@@ -21,7 +21,7 @@
<v-list-item
v-for="item in reportList"
:key="item.id"
@click="renderReport(item.id)"
@click="renderReport(item.id, item.name)"
>
<v-list-item-title>{{ item.name }}</v-list-item-title>
<v-list-item-action>
@@ -72,7 +72,8 @@ export default {
},
reportList: [],
selectedReport: null,
rendering: false
rendering: false,
preSelectReportId: null
}),
methods: {
editReport(reportid) {
@@ -86,7 +87,7 @@ export default {
}
});
},
async renderReport(reportId) {
async renderReport(reportId, reportName) {
let vm = this;
if (vm.$route.params.recordid == 0) {
return;
@@ -115,9 +116,13 @@ export default {
}
}
this.isVisible = false;
this.resolve(null);
if (reportName != null) {
this.resolve({ name: reportName, id: reportId });
} else {
this.resolve(null);
}
},
async open(reportDataOptions) {
async open(reportDataOptions, preSelectReportId) {
let vm = this;
if (reportDataOptions == null) {
throw new Error("report-selector:Open missing reportDataOptions");
@@ -127,18 +132,22 @@ export default {
}
this.reportDataOptions = reportDataOptions;
//get report list from server
let res = await window.$gz.api.get(
`report/list/${reportDataOptions.AType}`
);
if (res.error) {
// throw new Error(res.error);
throw new Error(window.$gz.errorHandler.errorToString(res, vm));
this.preSelectReportId = preSelectReportId;
if (!preSelectReportId) {
//get report list from server
let res = await window.$gz.api.get(
`report/list/${reportDataOptions.AType}`
);
if (res.error) {
// throw new Error(res.error);
throw new Error(window.$gz.errorHandler.errorToString(res, vm));
} else {
this.reportList = res.data;
}
this.isVisible = true;
} else {
this.reportList = res.data;
this.renderReport(this.preSelectReportId);
}
this.isVisible = true;
return new Promise((resolve, reject) => {
this.resolve = resolve;
this.reject = reject;