This commit is contained in:
joylink_fanyuhong 2024-11-08 13:55:25 +08:00
commit 50b80fef68

View File

@ -243,7 +243,7 @@ const pagination = ref({
}); });
const filter = ref({ const filter = ref({
faultType: '全部', faultType: '',
lineId: 0, lineId: 0,
}); });
@ -260,7 +260,7 @@ const onRequest: QTable['onRequest'] = async (props) => {
lineId: filter.value.lineId, lineId: filter.value.lineId,
}); });
} }
if (filter.value.faultType !== '全部') { if (filter.value.faultType !== '') {
Object.assign(params, { Object.assign(params, {
faultType: filter.value.faultType, faultType: filter.value.faultType,
}); });
@ -334,6 +334,7 @@ let optionsFaultType = ref<{ label: string; value: string }[]>([]);
async function queryAllFaultType() { async function queryAllFaultType() {
try { try {
allOptionsFaultType = await faultQueryType(); allOptionsFaultType = await faultQueryType();
handleSelectAllFaultType();
} catch (err) { } catch (err) {
$q.notify({ $q.notify({
type: 'negative', type: 'negative',
@ -372,13 +373,16 @@ function handleSelectLineId() {
} }
const searchOptionsFaultType = ref<{ label: string; value: string }[]>([ const searchOptionsFaultType = ref<{ label: string; value: string }[]>([
{ label: '全部', value: '全部' }, { label: '全部', value: '' },
]); ]);
function handleSelectSearchLineId() { function handleSelectSearchLineId() {
filter.value.faultType = '全部'; filter.value.faultType = '';
searchOptionsFaultType.value = [{ label: '全部', value: '' }]; searchOptionsFaultType.value = [{ label: '全部', value: '' }];
if (filter.value.lineId == 0) {
handleSelectAllFaultType();
}
for (let i = 0; i < allOptionsFaultType.length; i++) { 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) => { allOptionsFaultType[i].fts.forEach((item) => {
searchOptionsFaultType.value.push({ searchOptionsFaultType.value.push({
label: item.typeName, 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() { function onCreate() {
myForm.value?.validate().then(async (res) => { myForm.value?.validate().then(async (res) => {
if (res) { if (res) {