|
@@ -1,27 +1,31 @@
|
|
|
<script setup lang="ts">
|
|
|
-import { shallowRef, ref } from "vue";
|
|
|
+import { ref } from "vue";
|
|
|
+import apis from "./config/apis";
|
|
|
import { ElMessage } from "element-plus";
|
|
|
+import { usePermission } from "/@/hooks/core";
|
|
|
+import { frontEndExport } from "/@/utils/export";
|
|
|
+import { isBeyondTime } from "/@/views/time/_utils";
|
|
|
import sourceSearchConfig from "./config/search.config";
|
|
|
import sourceContentConfig from "./config/content.config";
|
|
|
-import { httpRequsetExport } from "/@/utils/export";
|
|
|
import { usePageSearch, type PageHooks } from "/@/hooks/page";
|
|
|
import { useRenderIcon } from "/@/components/ReIcon/src/hooks";
|
|
|
import { PageContentInstance } from "/@/components/PageContent";
|
|
|
import { useBusinessSearch, useBusinessContent } from "./../../_hooks";
|
|
|
-import { httpCompanyList } from "/@/api/dataDashboardNew/daily";
|
|
|
|
|
|
-const loading = shallowRef(false);
|
|
|
const pageContentRef = ref<PageContentInstance | null>(null);
|
|
|
-const lockKey = "relaComNo";
|
|
|
+const lockKey = "companyNo";
|
|
|
+
|
|
|
+const pageName = "reportDaily";
|
|
|
+const { hasPermissionWithCode } = usePermission(pageName);
|
|
|
|
|
|
const { searchConfig } = useBusinessSearch({
|
|
|
- sourceConfig: sourceSearchConfig
|
|
|
+ sourceConfig: sourceSearchConfig,
|
|
|
+ queryField: "companyNo"
|
|
|
});
|
|
|
+
|
|
|
const { contentConfig } = useBusinessContent({
|
|
|
sourceConfig: sourceContentConfig,
|
|
|
- apis: {
|
|
|
- httpList: httpCompanyList
|
|
|
- }
|
|
|
+ apis: { httpList: apis.list }
|
|
|
});
|
|
|
|
|
|
const hooks: PageHooks = {
|
|
@@ -32,27 +36,25 @@ const hooks: PageHooks = {
|
|
|
async function handleExportAllReport() {
|
|
|
const params = pageContentRef.value.getBasicParams() || {};
|
|
|
|
|
|
- console.log(params);
|
|
|
-
|
|
|
- if (!params.date) {
|
|
|
- ElMessage.warning("请选择导出文件的日期!");
|
|
|
- return;
|
|
|
- }
|
|
|
+ const { start, end } = params;
|
|
|
|
|
|
if (!params[lockKey]) {
|
|
|
ElMessage.warning("请选择业务公司");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- await httpRequsetExport({
|
|
|
- url: "r_saleexportconsultdayexport",
|
|
|
- fileType: "aplication/zip",
|
|
|
- isPurchase: true,
|
|
|
- name: "日报.zip",
|
|
|
- onSuccess: () => (loading.value = false),
|
|
|
- onStart: () => (loading.value = true),
|
|
|
- onFail: () => (loading.value = false),
|
|
|
- params
|
|
|
+ const beyondTime = isBeyondTime({
|
|
|
+ start,
|
|
|
+ end,
|
|
|
+ len: 30
|
|
|
+ });
|
|
|
+
|
|
|
+ if (beyondTime) return;
|
|
|
+ const data = pageContentRef.value.getData();
|
|
|
+ frontEndExport({
|
|
|
+ columns: contentConfig.columns,
|
|
|
+ name: "日报.xlsx",
|
|
|
+ data
|
|
|
});
|
|
|
}
|
|
|
</script>
|
|
@@ -67,9 +69,10 @@ async function handleExportAllReport() {
|
|
|
>
|
|
|
<template #content_header>
|
|
|
<el-button
|
|
|
+ v-if="hasPermissionWithCode('18')"
|
|
|
+ :icon="useRenderIcon('arrow-up-line')"
|
|
|
@click="handleExportAllReport"
|
|
|
size="small"
|
|
|
- :icon="useRenderIcon('arrow-up-line')"
|
|
|
type="primary"
|
|
|
>导出</el-button
|
|
|
>
|