style:设备管理-工单管理操作栏添加必填校验

main
黄伟杰 2 weeks ago
parent 75329f9af9
commit e7d16254fe

@ -49,7 +49,14 @@ v-show="total > 0" v-model:current-page="queryParams.pageNo" v-model:page-size="
<template #footer>
<el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="handleSave" :loading="submitLoading"> </el-button>
<el-button
type="primary"
@click="handleSave"
:loading="submitLoading"
:disabled="submitLoading || !isAllPendingSelected()"
>
</el-button>
</template>
</Dialog>
</template>
@ -124,6 +131,16 @@ const handleCurrentChange = () => {
}
const handleSave = async () => {
const hasUnselected = list.value.some((row) => {
if (!row?.id) return false
if (String(row.inspectionResult) !== '0') return false
const decision = decisionMap[String(row.id)]
return !decision
})
if (hasUnselected) {
message.error('请先为所有待检测记录选择通过或不通过')
return
}
const payload: TicketResultVO[] = []
for (const row of list.value) {
if (!row?.id) continue
@ -150,6 +167,16 @@ const handleSave = async () => {
}
}
const isAllPendingSelected = () => {
for (const row of list.value) {
if (!row?.id) continue
if (String(row.inspectionResult) !== '0') continue
const decision = decisionMap[String(row.id)]
if (!decision) return false
}
return true
}
const getRowKey = (row: TicketResultVO) => {
return String(row.id ?? '')
}

Loading…
Cancel
Save