|
@@ -17,11 +17,15 @@ import { CompLog } from "@/libs/log.lib";
|
|
|
import { message } from "ant-design-vue";
|
|
import { message } from "ant-design-vue";
|
|
|
import TemplateSaveModal from "./components/TemplateSaveModal.vue";
|
|
import TemplateSaveModal from "./components/TemplateSaveModal.vue";
|
|
|
import type { ReportTemplateModal } from "./reportComponent.types";
|
|
import type { ReportTemplateModal } from "./reportComponent.types";
|
|
|
|
|
+import { useReportExport } from "@/libs/reportExport.lib";
|
|
|
|
|
|
|
|
const _componentName = 'ReportEditorView'
|
|
const _componentName = 'ReportEditorView'
|
|
|
const logError = CompLog.logErr(_componentName)
|
|
const logError = CompLog.logErr(_componentName)
|
|
|
|
|
|
|
|
|
|
+// 当前路由
|
|
|
const route = useRoute();
|
|
const route = useRoute();
|
|
|
|
|
+// 报告下载函数库
|
|
|
|
|
+const reportExport = useReportExport()
|
|
|
|
|
|
|
|
const report: Ref<ReportSaveRequest | null> = ref(null);
|
|
const report: Ref<ReportSaveRequest | null> = ref(null);
|
|
|
const reportCategoryEl = ref<HTMLInputElement | null>(null);
|
|
const reportCategoryEl = ref<HTMLInputElement | null>(null);
|
|
@@ -87,6 +91,14 @@ function onSave() {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+function onExport() {
|
|
|
|
|
+ if (report.value) {
|
|
|
|
|
+ reportExport.download(report.value.name, report.value.id)
|
|
|
|
|
+ } else {
|
|
|
|
|
+ message.warning("暂无数据可以导出")
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
const templateSaveModal = ref<InstanceType<typeof TemplateSaveModal> | null>(null);
|
|
const templateSaveModal = ref<InstanceType<typeof TemplateSaveModal> | null>(null);
|
|
|
|
|
|
|
|
function showTemplateSaveModal() {
|
|
function showTemplateSaveModal() {
|
|
@@ -163,7 +175,8 @@ onMounted(() => {
|
|
|
<a-space>
|
|
<a-space>
|
|
|
<a-button type="primary" @click="onSave" :loading="saveLoading">保存</a-button>
|
|
<a-button type="primary" @click="onSave" :loading="saveLoading">保存</a-button>
|
|
|
<a-button>预览</a-button>
|
|
<a-button>预览</a-button>
|
|
|
- <a-button>导出</a-button>
|
|
|
|
|
|
|
+ <a-button @click="onExport">导出</a-button>
|
|
|
|
|
+ <!-- <a-button v-if="report" type="link" :href="reportExport.link(report.id, authStore.token)" target="_blank">导出</a-button> -->
|
|
|
<a-button @click="showTemplateSaveModal">另保存为模板</a-button>
|
|
<a-button @click="showTemplateSaveModal">另保存为模板</a-button>
|
|
|
</a-space>
|
|
</a-space>
|
|
|
</div>
|
|
</div>
|