From 7cd0df6b1b7a081cbaacd006ecd8a995769262f4 Mon Sep 17 00:00:00 2001 From: joylink_zhaoerwei Date: Fri, 8 Nov 2024 10:45:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=85=E9=9A=9C=E6=9F=A5=E8=AF=A2=E8=BF=87?= =?UTF-8?q?=E6=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/FaultQueryManage.vue | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/src/pages/FaultQueryManage.vue b/src/pages/FaultQueryManage.vue index 2f39853..04d8f6e 100644 --- a/src/pages/FaultQueryManage.vue +++ b/src/pages/FaultQueryManage.vue @@ -243,7 +243,7 @@ const pagination = ref({ }); const filter = ref({ - faultType: '全部', + faultType: '', lineId: 0, }); @@ -260,7 +260,7 @@ const onRequest: QTable['onRequest'] = async (props) => { lineId: filter.value.lineId, }); } - if (filter.value.faultType !== '全部') { + if (filter.value.faultType !== '') { Object.assign(params, { faultType: filter.value.faultType, }); @@ -334,6 +334,7 @@ let optionsFaultType = ref<{ label: string; value: string }[]>([]); async function queryAllFaultType() { try { allOptionsFaultType = await faultQueryType(); + handleSelectAllFaultType(); } catch (err) { $q.notify({ type: 'negative', @@ -372,13 +373,16 @@ function handleSelectLineId() { } const searchOptionsFaultType = ref<{ label: string; value: string }[]>([ - { label: '全部', value: '全部' }, + { label: '全部', value: '' }, ]); function handleSelectSearchLineId() { - filter.value.faultType = '全部'; + filter.value.faultType = ''; searchOptionsFaultType.value = [{ label: '全部', value: '' }]; + if (filter.value.lineId == 0) { + handleSelectAllFaultType(); + } for (let i = 0; i < allOptionsFaultType.length; i++) { - if (allOptionsFaultType[i].lineId == +filter.value.lineId) { + if (allOptionsFaultType[i].lineId == filter.value.lineId) { allOptionsFaultType[i].fts.forEach((item) => { searchOptionsFaultType.value.push({ label: item.typeName, @@ -390,6 +394,17 @@ function handleSelectSearchLineId() { } } +function handleSelectAllFaultType() { + allOptionsFaultType.forEach((faultTypeOption) => { + faultTypeOption.fts.forEach((fault) => + searchOptionsFaultType.value.push({ + label: fault.typeName, + value: fault.faultType, + }) + ); + }); +} + function onCreate() { myForm.value?.validate().then(async (res) => { if (res) {