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) {