Commit 8fa6e9fa by wusiyi

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

parent e193f6ab
...@@ -746,6 +746,14 @@ export function editAreaApi(data: SortingRuleDetail) { ...@@ -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) { export function deleteAreaApi(id: number) {
return axios.get<never, BaseRespData<never>>( return axios.get<never, BaseRespData<never>>(
......
...@@ -237,20 +237,23 @@ ...@@ -237,20 +237,23 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, onMounted, ref } from 'vue' import { computed, onMounted, ref } from 'vue'
import { Plus, Minus } from '@element-plus/icons-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 platformJson from '@/json/platform.json'
import type { import type {
OperatorList, OperatorList,
SortingRuleCondition, SortingRuleCondition,
SortingRuleDetail, SortingRuleDetail,
} from '@/types/api/order' } from '@/types/api/order'
import type { BaseRespData } from '@/types/api'
import { import {
getAreaListApi, getAreaListApi,
addAreaApi, addAreaApi,
editAreaApi, editAreaApi,
checkUsedBoxApi,
getSortingUserListApi, getSortingUserListApi,
getCategoryListApi, getCategoryListApi,
} from '@/api/order' } from '@/api/order'
import { showError } from '@/utils/ui'
const props = defineProps<{ const props = defineProps<{
modelValue: boolean modelValue: boolean
...@@ -498,6 +501,28 @@ const handleSubmit = async () => { ...@@ -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 const res = props.isEdit
? await editAreaApi(submitData) ? 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