From ff48b38e2b51733be4461af91a2916820cb46337 Mon Sep 17 00:00:00 2001 From: hwj Date: Mon, 22 Jun 2026 10:01:21 +0800 Subject: [PATCH] =?UTF-8?q?style=EF=BC=9A=E5=85=A5=E5=BA=93=E5=8D=95?= =?UTF-8?q?=E6=8D=AE/=E5=87=BA=E5=BA=93=E5=8D=95=E6=8D=AE-=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=B7=BB=E5=8A=A0=E9=BB=98=E8=AE=A4=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/erp/stock/in/index.vue | 22 ++++++++++++++++++---- src/views/erp/stock/out/index.vue | 21 +++++++++++++++++---- 2 files changed, 35 insertions(+), 8 deletions(-) diff --git a/src/views/erp/stock/in/index.vue b/src/views/erp/stock/in/index.vue index e8ff9bef..9963ca4f 100644 --- a/src/views/erp/stock/in/index.vue +++ b/src/views/erp/stock/in/index.vue @@ -360,7 +360,7 @@ const queryParams = reactive({ productId: undefined, supplierId: undefined, inTime: [], - statusList: [0, 1, 10], + statusList: [], remark: undefined, inType: undefined, creator: undefined @@ -378,6 +378,8 @@ const activeName = ref('') const queryFormRef = ref() // 搜索的表单 const exportLoading = ref(false) // 导出的加载中 const showAllFilters = ref(false) +const DEFAULT_STATUS_LIST = [0, 1, 10] +const useInitialStatusFilter = ref(true) const filterCount = 7 const toggleFilters = () => { showAllFilters.value = !showAllFilters.value @@ -426,7 +428,7 @@ const getList = async () => { loading.value = true try { await loadAuditConfig() - const data = await StockInApi.getStockInPage(queryParams) + const data = await StockInApi.getStockInPage(buildQueryParams()) list.value = data.list total.value = data.total } finally { @@ -434,14 +436,25 @@ const getList = async () => { } } +const buildQueryParams = () => ({ + ...queryParams, + statusList: queryParams.statusList?.length + ? queryParams.statusList + : useInitialStatusFilter.value + ? DEFAULT_STATUS_LIST + : [] +}) + /** 搜索按钮操作 */ const handleQuery = () => { + useInitialStatusFilter.value = false queryParams.pageNo = 1 getList() } /** 重置按钮操作 */ const resetQuery = () => { + useInitialStatusFilter.value = false queryFormRef.value.resetFields() queryParams.statusList = [] queryParams.inType = activeName.value || stockInTypeOptions.value[0]?.value @@ -533,7 +546,7 @@ const handleExport = async () => { exportLoading.value = true const ids = selectionList.value.map((item) => item.id).filter((v) => v != null) const params = { - ...queryParams, + ...buildQueryParams(), ids: ids.length ? ids.join(',') : undefined } const data = await StockInApi.exportStockIn(params) @@ -565,7 +578,8 @@ const syncDefaultInType = () => { watch(stockInTypeOptions, (options) => { if (!queryParams.inType && options.length) { syncDefaultInType() - handleQuery() + queryParams.pageNo = 1 + getList() } }) diff --git a/src/views/erp/stock/out/index.vue b/src/views/erp/stock/out/index.vue index 5c8e5d24..b62e8687 100644 --- a/src/views/erp/stock/out/index.vue +++ b/src/views/erp/stock/out/index.vue @@ -358,7 +358,7 @@ const queryParams = reactive({ no: undefined, productId: undefined, outTime: [], - statusList: [0, 1, 10], + statusList: [], remark: undefined, outType: undefined, creator: undefined @@ -378,6 +378,8 @@ const activeName = ref('') const queryFormRef = ref() // 鎼滅储鐨勮〃鍗? const exportLoading = ref(false) // 瀵煎嚭鐨勫姞杞戒腑 const showAllFilters = ref(false) +const DEFAULT_STATUS_LIST = [0, 1, 10] +const useInitialStatusFilter = ref(true) const filterCount = 7 const toggleFilters = () => { showAllFilters.value = !showAllFilters.value @@ -425,7 +427,7 @@ const getList = async () => { loading.value = true try { await loadAuditConfig() - const data = await StockOutApi.getStockOutPage(queryParams) + const data = await StockOutApi.getStockOutPage(buildQueryParams()) list.value = data.list total.value = data.total } finally { @@ -433,14 +435,24 @@ const getList = async () => { } } +const buildQueryParams = () => ({ + ...queryParams, + statusList: queryParams.statusList?.length + ? queryParams.statusList + : useInitialStatusFilter.value + ? DEFAULT_STATUS_LIST + : [] +}) /** 鎼滅储鎸夐挳鎿嶄綔 */ const handleQuery = () => { + useInitialStatusFilter.value = false queryParams.pageNo = 1 getList() } /** 閲嶇疆鎸夐挳鎿嶄綔 */ const resetQuery = () => { + useInitialStatusFilter.value = false queryFormRef.value.resetFields() queryParams.statusList = [] queryParams.outType = activeName.value || stockOutTypeOptions.value[0]?.value @@ -532,7 +544,7 @@ const handleExport = async () => { exportLoading.value = true const ids = selectionList.value.map((item) => item.id).filter((v) => v != null) const params = { - ...queryParams, + ...buildQueryParams(), ids: ids.length ? ids.join(',') : undefined } const data = await StockOutApi.exportStockOut(params) @@ -564,7 +576,8 @@ const syncDefaultOutType = () => { watch(stockOutTypeOptions, (options) => { if (!queryParams.outType && options.length) { syncDefaultOutType() - handleQuery() + queryParams.pageNo = 1 + getList() } })