|
@@ -1,5 +1,5 @@
|
|
|
<script setup lang="ts">
|
|
|
-import { ref, shallowRef ,onMounted, nextTick } from "vue";
|
|
|
+import { ref, shallowRef ,onMounted, nextTick} from "vue";
|
|
|
import { ElMessage } from "element-plus";
|
|
|
import contentConfig from "./config/content.config";
|
|
|
import searchConfig from "./config/search.config";
|
|
@@ -21,7 +21,7 @@ const loading = shallowRef(false);
|
|
|
const selectlist = ref<any[]>([]);
|
|
|
const purchaseModalRef = ref<InstanceType<typeof PurchaseModal> | null>(null);
|
|
|
const contentRef = ref<any>(null);
|
|
|
-const { hasPermissionWithCode } = usePermission(PageName);
|
|
|
+const { hasPermissionWithCode } = usePermission("supplyPorder");
|
|
|
const hooks: PageHooks = {
|
|
|
pageSearchHook: () => usePageSearch(undefined, undefined, searchConfig)
|
|
|
};
|
|
@@ -34,6 +34,8 @@ const events: PageEvents = {
|
|
|
reset: () => contentRef.value.onSearchPro({ size:15, page:1, total: "2" })
|
|
|
}
|
|
|
};
|
|
|
+
|
|
|
+
|
|
|
async function handleExport() {
|
|
|
if (selectlist.value.length === 0) {
|
|
|
ElMessage.warning("请选择一条采购单");
|
|
@@ -49,23 +51,33 @@ async function handleExport() {
|
|
|
_template["采购主单编码"] = item.cxCode;
|
|
|
_template["销售订单编码"] = item.qrdCode;
|
|
|
_template["供应商端"] = item.has_account
|
|
|
- ? (hasAccountOptions.find(s => s.value == item.has_account + "") || {}).label || ""
|
|
|
+ ? (hasAccountOptions.find(s => s.value == item.has_account + "") || {})
|
|
|
+ .label || ""
|
|
|
: "";
|
|
|
_template["状态"] = item.status
|
|
|
- ? (cgdStatusOptions.find(s => s.value == item.status + "") || {}).label || ""
|
|
|
+ ? (cgdStatusOptions.find(s => s.value == item.status + "") || {}).label ||
|
|
|
+ ""
|
|
|
: "";
|
|
|
_template["销售单发货状态"] = item.qrdSend
|
|
|
- ? (send_status_list.find(s => s.value == item.qrdSend + "") || {}).label || ""
|
|
|
+ ? (send_status_list.find(s => s.value == item.qrdSend + "") || {})
|
|
|
+ .label || ""
|
|
|
: "";
|
|
|
_template["采购单状态"] = item.cgd_status
|
|
|
- ? (sendStatusOptions.find(s => s.value == item.cgd_status + "") || {}).label || ""
|
|
|
+ ? (sendStatusOptions.find(s => s.value == item.cgd_status + "") || {})
|
|
|
+ .label || ""
|
|
|
: "";
|
|
|
_template["订单来源"] = item.cgdSource
|
|
|
- ? (cg_order_source_options.find(s => s.value == item.cgdSource + "") || {}).label || ""
|
|
|
+ ? (
|
|
|
+ cg_order_source_options.find(s => s.value == item.cgdSource + "") ||
|
|
|
+ {}
|
|
|
+ ).label || ""
|
|
|
: "";
|
|
|
_template["商品来源"] = item.cgdType
|
|
|
- ? (cg_order_type_options.find(s => s.value == item.cgdType + "") || {}).label || ""
|
|
|
+ ? (cg_order_type_options.find(s => s.value == item.cgdType + "") || {})
|
|
|
+ .label || ""
|
|
|
: "";
|
|
|
+
|
|
|
+
|
|
|
_template["商品编码"] = item.goodNo;
|
|
|
_template["商品名称"] = item.goodName;
|
|
|
_template["商品名称"] = item.goodName;
|
|
@@ -87,11 +99,11 @@ async function handleExport() {
|
|
|
_template["创建时间"] = item.addtime;
|
|
|
data.push(_template);
|
|
|
});
|
|
|
-
|
|
|
//创建数据表
|
|
|
const workBook = utils.book_new();
|
|
|
const workSheet = utils.json_to_sheet(data);
|
|
|
utils.book_append_sheet(workBook, workSheet, "sheet");
|
|
|
+
|
|
|
//导出模板
|
|
|
writeFile(workBook, `${judieFilename}.xlsx`, { bookType: "xlsx" });
|
|
|
}
|
|
@@ -106,16 +118,15 @@ onMounted(() => {nextTick(() => contentRef.value.onSearchPro({ size:15, page:1
|
|
|
:events="events"
|
|
|
:contentConfig="contentConfig"
|
|
|
:search-config="searchConfig"
|
|
|
- :get-content-ref="ref => contentRef = ref"
|
|
|
+ :get-content-ref="ref => contentRef = ref"
|
|
|
@content-select-change="items => (selectlist = items)"
|
|
|
>
|
|
|
<template #content_header>
|
|
|
- <ElButton
|
|
|
- type="primary"
|
|
|
- v-if="hasPermissionWithCode('048')"
|
|
|
+ <ElButton
|
|
|
@click="handleExport"
|
|
|
:loading="loading"
|
|
|
- >导出</ElButton
|
|
|
+ size="small"
|
|
|
+ >采购单导出</ElButton
|
|
|
>
|
|
|
</template>
|
|
|
</PageContainer>
|