From 156e532b14066dec4a8dec7797a15a8b7cb67c4b Mon Sep 17 00:00:00 2001 From: hwj Date: Mon, 8 Jun 2026 17:26:23 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E6=A8=A1=E5=85=B7=E7=BB=84-?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=AC=AC=E4=B8=80=E6=AC=A1=E8=BF=9B=E5=85=A5?= =?UTF-8?q?=E4=B8=8A=E6=A8=A1/=E4=B8=8B=E6=A8=A1=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E6=B2=A1=E8=B0=83=E7=94=A8=E6=8E=A5=E5=8F=A3bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/erp/mold/index.vue | 51 ++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 17 deletions(-) diff --git a/src/views/erp/mold/index.vue b/src/views/erp/mold/index.vue index bae14aeb..346271a1 100644 --- a/src/views/erp/mold/index.vue +++ b/src/views/erp/mold/index.vue @@ -12,8 +12,8 @@ - + { + const v = val?.trim() || undefined + queryParams.code = v + queryParams.name = v + queryParams.productName = v +}) + +const onKeywordClear = () => { + inputKeyword.value = '' +} + const statusCards = computed(() => [ { key: 'all', label: t('MoldManagement.MoldBrandPage.all'), value: counters.allCount, status: undefined }, { key: 'onMachine', label: t('MoldManagement.MoldBrandPage.onMachine'), value: counters.onMachineCount, status: 1 }, @@ -215,12 +226,6 @@ const statusCards = computed(() => [ { key: 'scrapped', label: t('MoldManagement.MoldBrandPage.scrapped'), value: counters.scrappedCount, status: 3 } ]) -const parseKeyword = () => { - const keyword = queryParams.keyword?.trim() - queryParams.code = keyword || undefined - queryParams.name = keyword || undefined -} - const getImageList = (images?: string) => { if (!images) return [] return String(images) @@ -243,9 +248,10 @@ const normalizePageResult = (data: any) => { const getList = async () => { loading.value = true try { - parseKeyword() const selected = productOptions.value.filter((item) => (queryParams.productIds || []).includes(item.id)) - queryParams.productName = selected.map((p) => p.name).join(',') + if (selected.length > 0) { + queryParams.productName = selected.map((p) => p.name).join(',') + } const data = await MoldBrandApi.getMoldBrandPage({ ...queryParams, currentDevice: queryParams.currentDevice @@ -263,6 +269,7 @@ const handleQuery = () => { const resetQuery = () => { queryFormRef.value?.resetFields() + inputKeyword.value = '' currentStatusKey.value = 'all' queryParams.status = undefined queryParams.productIds = [] @@ -331,14 +338,19 @@ const openDetail = (id: number) => { } // 上下模操作函数 -const openOperateForm = async (type: number, row: MoldBrandVO) => { +const openOperateForm = (type: number, row: MoldBrandVO) => { operateType.value = type currentMold.value = row operateFormVisible.value = true - await nextTick() - moldOperateViewRef.value?.open() } +// 监听 operateFormVisible + moldOperateViewRef,等异步组件就绪后调用 open +watch([operateFormVisible, moldOperateViewRef], ([visible, ref]) => { + if (visible && ref) { + ref.open() + } +}) + const closeOperateForm = () => { operateFormVisible.value = false currentMold.value = null @@ -349,13 +361,18 @@ const onOperateSuccess = () => { } // 维护操作函数 -const openMaintainForm = async (row: MoldBrandVO) => { +const openMaintainForm = (row: MoldBrandVO) => { currentMold.value = row maintainFormVisible.value = true - await nextTick() - moldMaintainViewRef.value?.open() } +// 监听 maintainFormVisible + moldMaintainViewRef,等异步组件就绪后调用 open +watch([maintainFormVisible, moldMaintainViewRef], ([visible, ref]) => { + if (visible && ref) { + ref.open() + } +}) + const closeMaintainForm = () => { maintainFormVisible.value = false currentMold.value = null