Commit 8fa6e9fa by wusiyi

feat: 编辑配货分拣规则的校验优化 #1013114

parent e193f6ab
......@@ -746,6 +746,14 @@ export function editAreaApi(data: SortingRuleDetail) {
)
}
// 配货分拣 编辑保存前校验箱子是否有货
export function checkUsedBoxApi(id: number) {
return axios.get<never, BaseRespData<never>>(
'allocation-sorting-rule/check-used-box',
{ params: { id }, skipGlobalError: true },
)
}
// 配货分拣 删除
export function deleteAreaApi(id: number) {
return axios.get<never, BaseRespData<never>>(
......
......@@ -237,20 +237,23 @@
<script setup lang="ts">
import { computed, onMounted, ref } from 'vue'
import { Plus, Minus } from '@element-plus/icons-vue'
import type { FormInstance } from 'element-plus'
import { ElMessageBox, type FormInstance } from 'element-plus'
import platformJson from '@/json/platform.json'
import type {
OperatorList,
SortingRuleCondition,
SortingRuleDetail,
} from '@/types/api/order'
import type { BaseRespData } from '@/types/api'
import {
getAreaListApi,
addAreaApi,
editAreaApi,
checkUsedBoxApi,
getSortingUserListApi,
getCategoryListApi,
} from '@/api/order'
import { showError } from '@/utils/ui'
const props = defineProps<{
modelValue: boolean
......@@ -498,6 +501,28 @@ const handleSubmit = async () => {
}),
),
}
if (props.isEdit) {
submitData.id = props.editData?.id
try {
await checkUsedBoxApi(submitData.id as number)
} catch (err) {
const error = err as BaseRespData<never>
if (error?.code !== 301) {
showError(error?.message)
return
}
try {
await ElMessageBox.confirm(error.message, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
dangerouslyUseHTMLString: true,
})
} catch {
return
}
}
}
const res = props.isEdit
? await editAreaApi(submitData)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment