From 6dabd7d10f4d680dd3033b44247c5dc821861c3a Mon Sep 17 00:00:00 2001 From: jameszow Date: Tue, 24 Oct 2023 14:08:48 +0800 Subject: [PATCH 1/4] Add handleExport method --- src/views/product/info/index.vue | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/views/product/info/index.vue b/src/views/product/info/index.vue index 379e60c..4a377ce 100644 --- a/src/views/product/info/index.vue +++ b/src/views/product/info/index.vue @@ -7,7 +7,7 @@ 批量启用 批量禁用 导入 - 导出 + 导出 批量编辑 修正库存 @@ -50,6 +50,7 @@ import ProductInfoModal from "@/views/product/info/components/ProductInfoModal.v import BatchEditModal from "@/views/product/info/components/BatchEditModal.vue"; import {getProductInfo, deleteProduct, updateProductStatus} from "@/api/product/product"; import ImportFileModal from "@/components/Tools/ImportFileModal.vue"; +import {exportXlsx} from "@/api/basic/common"; export default defineComponent({ name: 'ProductInfo', @@ -155,6 +156,29 @@ export default defineComponent({ importModalRef.value.title = "商品信息数据导入"; } + const getTimestamp = (date) => { + return ( + date.getFullYear() * 10000000000 + + (date.getMonth() + 1) * 100000000 + + date.getDate() * 1000000 + + date.getHours() * 10000 + + date.getMinutes() * 100 + + date.getSeconds() + ).toString(); + }; + + async function handleExport() { + const file = await exportXlsx("商品信息列表") + const blob = new Blob([file]); + const link = document.createElement("a"); + link.href = URL.createObjectURL(blob); + const timestamp = getTimestamp(new Date()); + link.download = "商品信息数据" + timestamp + ".xlsx"; + link.target = "_blank"; + link.click(); + } + + return { registerTable, handleCreate, @@ -169,6 +193,7 @@ export default defineComponent({ batchProductInfoModalRef, handleBatchProductInfo, handleImport, + handleExport, importModalRef } } From f2a9da2a9c7ba1d8bad7ed5abfe6fe080f4a681b Mon Sep 17 00:00:00 2001 From: jameszow Date: Tue, 24 Oct 2023 21:33:49 +0800 Subject: [PATCH 2/4] Fix business reality bugs on the page --- .../info/components/ProductInfoModal.vue | 154 ++++++++++-------- 1 file changed, 86 insertions(+), 68 deletions(-) diff --git a/src/views/product/info/components/ProductInfoModal.vue b/src/views/product/info/components/ProductInfoModal.vue index 3717761..106de6b 100644 --- a/src/views/product/info/components/ProductInfoModal.vue +++ b/src/views/product/info/components/ProductInfoModal.vue @@ -58,22 +58,17 @@ @change="manyUnitOnChange" showSearch optionFilterProp="children" - :dropdownMatchSelectWidth="false"> - - - - - - - - - - - - {{ item.computeUnit }} - + :dropdownMatchSelectWidth="false" + v-if="unitChecked" + :options="unitList.map(item => ({ value: item.id, label: item.computeUnit }))"> + @@ -156,8 +151,7 @@ 需要先录入单位才能激活 - + {{ item.attributeName }} @@ -335,11 +329,11 @@ -