| | |
| | | @selection-change="handleSafeHazardSelectionChange" |
| | | style="width: 100%"> |
| | | <el-table-column type="selection" |
| | | width="55" /> |
| | | width="55" |
| | | :selectable="isSelectable" /> |
| | | <el-table-column prop="code" |
| | | label="危险源编码" |
| | | width="180" |
| | |
| | | } |
| | | }; |
| | | const handleApplyQtyChange = () => { |
| | | if (Number(form.value.applyQty) < 0) { |
| | | ElMessage.error("领用数量不能小于0"); |
| | | form.value.applyQty = 0; |
| | | return; |
| | | } |
| | | if (form.value.applyQty > valueItem.value.stockQty) { |
| | | ElMessage.error("领用数量不能大于库存数量"); |
| | | form.value.applyQty = ""; |
| | |
| | | const fetchSafeHazardList = () => { |
| | | safeHazardLoading.value = true; |
| | | return safeHazardListPage({ |
| | | page: safeHazardPage.value.current, |
| | | current: safeHazardPage.value.current, |
| | | size: safeHazardPage.value.size, |
| | | }) |
| | | .then(res => { |
| | |
| | | .finally(() => { |
| | | safeHazardLoading.value = false; |
| | | }); |
| | | }; |
| | | |
| | | const isSelectable = row => { |
| | | // 只有库存数量大于0的行才能被选择 |
| | | return Number(row.stockQty) > 0; |
| | | }; |
| | | |
| | | const handleSafeHazardSelectionChange = selection => { |
| | |
| | | .catch(err => { |
| | | ElMessage.error(err.msg); |
| | | }); |
| | | } else { |
| | | } else if (dialogType.value === "edit") { |
| | | await formRef1.value.validate(); |
| | | safeHazardRecordUpdate({ ...form.value }) |
| | | .then(res => { |
| | |
| | | .catch(err => { |
| | | ElMessage.error(err.msg); |
| | | }); |
| | | } else if (dialogType.value === "view") { |
| | | // 查看模式下不提交表单 |
| | | dialogVisible.value = false; |
| | | } |
| | | } catch (error) { |
| | | console.error("表单验证失败:", error); |