Commit 7c00d75a by linjinhong

feat:【工厂端】POD订单(CN)增加称重环节,以解决分拣物流及erp无出库重量问题#1001252

parent 6855c54a
......@@ -147,19 +147,13 @@ export function getCardOrderList(
)
}
export function batchCheckPrintPodCn(
ids:string
) {
export function batchCheckPrintPodCn(ids: string) {
return axios.get<never, BaseRespData<PrintData[]>>(
`/factory/podJomallOrderCn/batchCheckPrintPodCn?ids=${ids}`,
)
}
export function batchCheckPrintPodUs(
ids:string
) {
export function batchCheckPrintPodUs(ids: string) {
return axios.get<never, BaseRespData<PrintData[]>>(
`/factory/podJomallOrderUs/batchCheckPrintPodUs?ids=${ids}`,
)
......@@ -723,3 +717,23 @@ export function getCustomTagListCnApi() {
`factory/podJomallOrderCn/getCustomTagList`,
)
}
// 根据店铺单号或跟踪号查询订单
export function listByNoApi(params: {
type: string
no: string
logisticsCompanyCode?: string
}) {
return axios.get<never, BaseRespData<never>>(
`factory/podJomallOrderCn/listByNo`,
{ params },
)
}
//保存称重分拣
export function orderWeighingApi(params: {
podCnWeighingParams: { id?: string; outWarehouseWeight?: string }[]
}) {
return axios.post<never, BaseRespData<never>>(
'factory/podJomallOrderCn/orderWeighing',
params,
)
}
......@@ -46,7 +46,9 @@ export interface SearchForm {
tagsId?: string
source?: string
size?: string
logisticsCompanyCode?: string
tagsIdArr?: (number | null)[]
blocking?: boolean
}
export interface PodCnOrderListData {
id: number
......
......@@ -44,6 +44,7 @@ export interface SearchForm {
size?: string
tagsIdArr?: (number | null)[]
replaceShipment?: number | null
blocking?: boolean
}
export interface PodUsOrderListData {
id: number
......
<template>
<div>
<el-dialog
:close-on-click-modal="false"
:close-on-press-escape="false"
title="称重分拣"
:before-close="handleClose"
v-model="isweight"
width="850px"
>
<div
style="
display: flex;
justify-content: space-between;
margin-bottom: 10px;
gap: 10px;
"
>
<el-select
style="width: 100px; height: 100%; margin-right: 5px"
v-model="selectType"
placeholder=""
>
<el-option label="跟踪号" value="trackingNumber"></el-option>
<el-option label="店铺单号" value="shopNumber"></el-option>
</el-select>
<input
class="inputWeight"
@keyup.enter="weightChange"
style="flex: 1"
ref="weighInput"
:placeholder="
weight.weightInput
? selectType === 'trackingNumber'
? '请输入跟踪号'
: '请输入店铺单号'
: '请输入重量'
"
v-model.lazy="weightText"
/>
<el-select
style="flex: 1"
v-model="logisticsCompanyCode"
placeholder="物流公司"
filterable
clearable
>
<el-option
v-for="(item, index) in allCodelist"
:key="index"
:label="item.basicsName"
:value="item.code"
></el-option>
</el-select>
<el-button type="primary" @click="weightChange"> 查询 </el-button>
</div>
<div>
<CustomizeTable
ref="tableRef"
v-loading="tableLoading"
border
:isShowCheckBox="false"
v-model="tableData"
height="400px"
:config="tableConfig"
align="center"
:row-config="{ isCurrent: true }"
></CustomizeTable>
</div>
<div class="statistics" style="display: flex; margin-top: 10px">
<div class="number">
<span>数量</span>
<span style="color: red">{{ tableData.length }}</span>
</div>
<div class="warehouse-weight" style="margin-left: 10px">
<span> 出库总重量:</span>
<span style="color: red">{{ warehouseWeightTotal() || 0 }}(g)</span>
</div>
</div>
<template #footer>
<div style="display: flex; justify-content: center">
<el-button @click="handleClose()"> 取消 </el-button>
<el-button type="primary" @click="weightGet"> 确定 </el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup lang="tsx">
interface IpodCnWeighingParams {
id?: string
outWarehouseWeight?: string
weight?: string
trackingNumber?: string
shopNumber?: string
platform?: string
logisticsCompanyName?: string
logisticsCompanyId?: string
wgap?: number | string
}
interface ILogisticsList {
code: string
basicsName: string
apiData: unknown
}
import weight from '../components/weigh.js'
import { listByNoApi, orderWeighingApi } from '@/api/podCnOrder'
import { logisticsCompanyAllCodelist } from '@/api/logistics.ts'
import CustomizeTable from '@/components/VxeTable.tsx'
import { TableColumn } from '@/components/VxeTable'
const tableData = ref<IpodCnWeighingParams[]>([])
const isweight = ref(false)
const selectType = ref('trackingNumber')
const logisticsCompanyCode = ref('')
const weighInput = ref()
const weightText = ref('')
const allCodelist = ref<ILogisticsList[]>([])
const tableLoading = ref(false)
const tableRef = ref()
const tableConfig = ref<TableColumn[]>([
{
prop: 'trackingNumber',
label: '跟踪号',
attrs: {
minWidth: 180,
},
},
{
prop: 'shopNumber',
label: '店铺单号',
attrs: {
minWidth: 180,
},
},
{
prop: 'platform',
label: '销售平台',
attrs: {
width: 120,
},
},
{
prop: 'logisticsCompanyName',
label: '物流公司',
attrs: {
width: 120,
},
},
{
prop: 'weight',
label: '系统重量(g)',
attrs: {
width: 100,
},
},
{
prop: 'outWarehouseWeight',
label: '出库重量(g)',
attrs: {
width: 100,
},
},
{
prop: 'wgap',
label: '重量差(g)',
attrs: {
width: 100,
},
},
{
prop: 'opeare',
label: '操作',
attrs: {
align: 'center',
width: 80,
},
render: {
default: ({ row }: { row: IpodCnWeighingParams }) => (
<div>
<el-button type="danger" onclick={() => deleteFn(row)}>
删除
</el-button>
</div>
),
},
},
])
const emits = defineEmits<{
(e: 'updateList'): void
}>()
const getlogisticsCompanyAllCodelist = async () => {
try {
const res = await logisticsCompanyAllCodelist()
if (res.code !== 200) return
allCodelist.value = res.data
} catch (e) {
console.error(e)
}
}
const warehouseWeightTotal = () => {
return tableData.value?.reduce((prev, cur: IpodCnWeighingParams) => {
prev += +(cur.outWarehouseWeight || 0)
return prev
}, 0)
}
const handleClose = () => {
isweight.value = false
}
const weightChange = async () => {
const noValue = weightText.value
if (!noValue) return weight.playAudio('weight_search_error')
weightText.value = ''
console.log(343, weight.weightInput)
tableLoading.value = true
try {
const params: {
type: string
no: string
logisticsCompanyCode?: string
} = {
type: selectType.value,
no: noValue,
}
weight.check(noValue, listByNoApi, params, (arr) => {
tableData.value = [...arr]
if (!(noValue.length < 7)) {
tableData.value.forEach((el) => {
if (el.trackingNumber === noValue) {
console.log(1111, el)
tableRef.value?.selectRowEvent(el)
}
})
}
console.log(284, arr)
})
weighInput.value?.focus()
} catch (error) {
console.log(error)
} finally {
tableLoading.value = false
}
console.log('weightChange')
}
const weightGet = async () => {
if (tableData.value.length < 1) {
ElMessage.warning('请先导出数据')
return
}
for (const iterator of tableData.value) {
if (!iterator.outWarehouseWeight) {
ElMessage.warning('跟踪号:' + iterator.trackingNumber + '的出库重量为空')
return
}
}
try {
await orderWeighingApi({ podCnWeighingParams: tableData.value })
ElMessage.success('保存称重分拣成功')
handleClose()
emits('updateList')
} catch (error) {
console.log(error)
}
}
const open = () => {
isweight.value = true
weight.clear()
tableData.value = []
selectType.value = 'trackingNumber'
logisticsCompanyCode.value = ''
weightText.value = ''
getlogisticsCompanyAllCodelist()
}
const deleteFn = (row: IpodCnWeighingParams) => {
tableData.value = tableData.value.filter((el) => el.id !== row.id)
weight.updatedList(tableData.value)
}
defineExpose({
open,
})
</script>
<style scoped></style>
// Lock 基类
class Lock {
public isLock: boolean
constructor() {
this.isLock = false
}
lock(): void {
this.isLock = true
}
unlock(): void {
this.isLock = false
}
}
import { ElMessage } from 'element-plus'
// 定义数据类型
interface WeighItem {
id?: string
outWarehouseWeight?: string
trackingNumber?: string
shopNumber?: string
platform?: string
logisticsCompanyName?: string
logisticsCompanyId?: string
wgap?: number | string
weight?: string
}
interface SearchItem {
type: string
no: string
logisticsCompanyCode?: string
}
interface Data {
data: WeighItem[]
}
type AudioKey =
| 'weight_warning'
| 'weight_success'
| 'weight_repeat'
| 'weight_search_error'
| 'weight_search_success'
type AudioFiles = Record<AudioKey, string>
// API 响应类型
class Weigh extends Lock {
public weightInput: boolean
public list: WeighItem[]
private audios: AudioFiles
private audioElements: Map<AudioKey, HTMLAudioElement>
constructor() {
super()
this.weightInput = true
this.list = []
this.audios = {
weight_warning: new URL(
'@/assets/audio/weight_warning.mp3',
import.meta.url,
).href,
weight_success: new URL(
'@/assets/audio/weight_success.mp3',
import.meta.url,
).href,
weight_repeat: new URL(
'@/assets/audio/weight_repeat.mp3',
import.meta.url,
).href,
weight_search_error: new URL(
'@/assets/audio/weight_search_error.mp3',
import.meta.url,
).href,
weight_search_success: new URL(
'@/assets/audio/weight_search_success.mp3',
import.meta.url,
).href,
}
this.audioElements = new Map()
this.preloadAudios()
}
// 预加载音频文件
private preloadAudios(): void {
Object.entries(this.audios).forEach(([key, src]) => {
const audio = new Audio()
audio.src = src
audio.preload = 'auto'
this.audioElements.set(key as AudioKey, audio)
})
}
clear(): void {
this.list = []
this.weightInput = true
}
updatedList(data: WeighItem[]) {
this.weightInput = true
this.list = [...data]
}
// 去重逻辑优化
private deduplicate(
value: string,
callback?: (list: WeighItem[]) => void,
): boolean {
const existingIndex = this.list.findIndex(
(item) => item.trackingNumber === value,
)
if (existingIndex !== -1) {
const [existingItem] = this.list.splice(existingIndex, 1)
this.list.unshift(existingItem)
callback?.(this.list)
this.playAudio('weight_repeat')
return true
}
return false
}
check(
value: string,
apiCall: (params: SearchItem) => Promise<Data>,
params: SearchItem,
callback?: (list: WeighItem[]) => void,
): void {
// 空值检查
if (!value?.trim()) {
this.playAudio('weight_warning')
return
}
// 防止重复提交
if (this.isLock) return
this.lock()
try {
// 判断输入类型并处理
if (this.isWeightInput(value)) {
this.processWeightInput(value, callback)
} else {
this.processTrackingNumberInput(value, apiCall, params, callback)
}
} catch (error) {
console.error('称重处理错误:', error)
this.playAudio('weight_search_error')
} finally {
this.unlock()
}
}
private isWeightInput(value: string): boolean {
return value.length < 7
}
private processWeightInput(
value: string,
callback?: (list: WeighItem[]) => void,
): void {
// 验证数字格式
if (isNaN(Number(value)) || Number(value) <= 0) {
this.playAudio('weight_warning', '请录入正确的重量')
return
}
console.log('currentItem', this.list)
if (!this.list.length) {
this.playAudio('weight_warning', '请先录入跟踪号')
return
}
// 检查是否已录入重量
if (!this.hasPendingWeights()) {
this.playAudio('weight_warning', '请录入跟踪号')
return
}
this.list = this.list.map((el) => {
if (!el.outWarehouseWeight) {
return {
...el,
outWarehouseWeight: value,
wgap: Math.abs(Number(value) - Number(el.weight || 0)),
}
}
return el
})
// 更新重量信息
callback?.(this.list)
this.weightInput = true
this.playAudio('weight_success')
}
private async processTrackingNumberInput(
value: string,
apiCall: (params: SearchItem) => Promise<Data>,
params: SearchItem,
callback?: (list: WeighItem[]) => void,
): Promise<void> {
// 检查重量录入状态
if (!this.weightInput) {
this.playAudio('weight_warning', '请录入重量')
return
}
// 去重检查
if (this.deduplicate(value, callback)) {
return
}
try {
const response = await apiCall(params)
const { data } = response
console.log(211, data)
if (!data.length) {
this.playAudio('weight_search_error', '查询失败')
return
}
// 最终去重检查
if (
this.deduplicate(
(data[0] as WeighItem).trackingNumber as string,
callback,
)
) {
return
}
// 添加新项目
this.addNewItem(data, callback)
} catch (error) {
console.error('跟踪号查询错误:', error)
this.playAudio('weight_search_error')
}
}
private addNewItem(
data: WeighItem[],
callback?: (list: WeighItem[]) => void,
): void {
const newArr = data.map((el) => {
return {
...el,
outWarehouseWeight: '',
wgap: '',
}
})
this.list = [...newArr, ...this.list]
this.weightInput = false
callback?.(this.list)
this.playAudio('weight_search_success')
}
playAudio(key: AudioKey, message?: string): void {
const messageMap: Record<AudioKey, string> = {
weight_warning: '请录入跟踪号或重量',
weight_success: '',
weight_repeat: '重复录入',
weight_search_error: '请录入跟踪号或重量',
weight_search_success: '',
}
const displayMessage = message || messageMap[key]
if (displayMessage) {
console.log(displayMessage)
ElMessage.warning(displayMessage)
}
// 使用预加载的音频元素
const audio = this.audioElements.get(key)
if (audio) {
audio.currentTime = 0 // 重置播放位置
audio.play().catch((error) => {
console.warn(`音频播放失败: ${key}`, error)
})
}
}
hasPendingWeights(): boolean {
return this.list.some((item) => !item.outWarehouseWeight)
}
getTotalWeight(): number {
return this.list.reduce((total, item) => {
return (
total + (item.outWarehouseWeight ? Number(item.outWarehouseWeight) : 0)
)
}, 0)
}
}
export default new Weigh()
......@@ -381,6 +381,40 @@
></ElOption>
</ElSelect>
</ElFormItem>
<ElFormItem label="自有物流公司">
<ElSelect
v-model="searchForm.logisticsCompanyCode"
placeholder="请选择"
clearable
filterable
:teleported="false"
style="width: 150px"
>
<ElOption
v-for="(item, index) in allCodelist"
:key="index"
:value="item.code"
:label="item.basicsName"
></ElOption>
</ElSelect>
</ElFormItem>
<ElFormItem label="拦截订单">
<ElSelect
v-model="searchForm.blocking"
placeholder="请选择"
clearable
filterable
:teleported="false"
style="width: 150px"
>
<ElOption
v-for="(item, index) in ['否', '是']"
:key="index"
:value="!!index"
:label="index === 0 ? '否' : '是'"
></ElOption>
</ElSelect>
</ElFormItem>
</ElForm>
<template #reference>
<el-button type="warning" @click="searchVisible = !searchVisible">
......@@ -804,9 +838,14 @@
>批量删除</ElButton
>
</span>
<span v-if="status === 'WAIT_WEIGHING'" class="item">
<ElButton type="danger" @click="weightDialogRef.open()"
>称重分拣</ElButton
>
</span>
<span v-if="status === 'WAIT_SHIPMENT'" class="item">
<ElButton type="warning" @click="showPrintSku"
>打印库存sku标签</ElButton
>打印库存sku标签</ElButton
>
</span>
</ElFormItem>
......@@ -2548,8 +2587,10 @@
"
></ChangeWayDialog>
<print-warehouse-sku-tag ref="printWarehouseSkuDialogRef" />
<weight-dialog ref="weightDialogRef" @update-list="() => {}" />
</template>
<script setup lang="ts">
import WeightDialog from './components/WeightDialog.vue'
import { getUserMarkList } from '@/api/common'
import LogisticsWaySelect from '../../logistics/components/LogisticsWaySelect.tsx'
import PrintWarehouseSkuTag from '../components/printWarehouseSkuTag.vue'
......@@ -2617,6 +2658,7 @@ import {
changeLogisticsApi,
} from '@/api/podCnOrder'
import { logisticsCompanyAllCodelist } from '@/api/logistics.ts'
import { BaseRespData } from '@/types/api'
import ChangeWayDialog from './components/ChangeWayDialog.vue'
import UpdateAddress from './components/updateAddress.vue'
......@@ -2688,7 +2730,7 @@ const isSuperFactory: boolean = userStore.user?.factory.dropShipping || false
const tabsNav = ref<Tab[]>()
const isAuto = ref(true)
const printWarehouseSkuDialogRef = ref()
const weightDialogRef = ref()
const calculatedPrice = (item: ProductList) => {
const templatePrice = new BigNumber(item.templatePrice || 0)
const craftPrice = new BigNumber(item.craftPrice || 0)
......@@ -2981,13 +3023,15 @@ const changeExceptionOrder = async () => {
}
const showPrintSku = async () => {
if(!selection.value.length) {
if (!selection.value.length) {
return ElMessage.warning('请选择数据')
}
await printWarehouseSkuDialogRef.value?.open(1,selection.value.map((item) => item.id).join(','))
await printWarehouseSkuDialogRef.value?.open(
1,
selection.value.map((item) => item.id).join(','),
)
}
const handleExceptionConfirm = async () => {
try {
await exceptionFormRef.value.validate()
......@@ -5148,6 +5192,22 @@ const getCustomTagList = async () => {
}
}
interface ILogisticsList {
code: string
basicsName: string
apiData: unknown
}
const allCodelist = ref<ILogisticsList[]>([])
const getlogisticsCompanyAllCodelist = async () => {
try {
const res = await logisticsCompanyAllCodelist()
if (res.code !== 200) return
allCodelist.value = res.data
} catch (e) {
console.error(e)
}
}
function tooltipContent(arr: { name: string }[]) {
return arr.map((tag) => tag.name).join('、')
}
......@@ -5244,6 +5304,7 @@ onMounted(() => {
loadWarehouseList()
getCustomTagList()
loadCraftList()
getlogisticsCompanyAllCodelist()
})
const handleShipmentAreaCommand = (command: number) => {
......
......@@ -362,6 +362,23 @@
></ElOption>
</ElSelect>
</ElFormItem>
<ElFormItem label="拦截订单">
<ElSelect
v-model="searchForm.blocking"
placeholder="请选择"
clearable
filterable
:teleported="false"
style="width: 150px"
>
<ElOption
v-for="(item, index) in ['否', '是']"
:key="index"
:value="!!index"
:label="index === 0 ? '否' : '是'"
></ElOption>
</ElSelect>
</ElFormItem>
</ElForm>
<template #reference>
<el-button type="warning" @click="searchVisible = !searchVisible">
......
......@@ -49,7 +49,9 @@
<div style="text-align: center">
<ElButton @click="cancelFn">取消</ElButton>
<ElButton type="primary" @click="saveSupplierFn">保存</ElButton>
<ElButton type="primary" :loading="saveLoading" @click="saveSupplierFn"
>保存</ElButton
>
</div>
</template>
</Dialog>
......@@ -58,17 +60,17 @@
title="管理供应价格"
v-model="priceDialogVisible"
width="65%"
v-loading="priceLoading"
@close="cancelPiceFn"
teleported
>
<div style="display: flex; margin-bottom: 10px">
<div style="display: flex; align-items: center; gap: 20px">
<div><span style="color: red">*</span> 结算币种</div>
<el-select
style="width: 300px; flex: 1"
v-model="currentGoods.currencyCode"
@change="
<div v-loading="priceLoading">
<div style="display: flex; margin-bottom: 10px">
<div style="display: flex; align-items: center; gap: 20px">
<div><span style="color: red">*</span> 结算币种</div>
<el-select
style="width: 300px; flex: 1"
v-model="currentGoods.currencyCode"
@change="
(v:string) => {
currentGoods.currencyName =
......@@ -78,95 +80,96 @@
}
"
>
<el-option
v-for="(item, index) in currencyOptions"
:key="index"
:label="`${item.currencyName}(${item.currencyCode})`"
:value="item.currencyCode"
>
</el-option>
</el-select>
</div>
</div>
<div
style="border-top: 1px solid #eee; margin-bottom: 10px"
v-if="showColorList.length"
>
<div style="font-size: 20px; font-weight: bold; margin: 10px 0">
颜色(Color)
</div>
<div class="flex" style="flex-wrap: wrap; gap: 5px">
<el-tag
:title="`${item.cnname}(${item.enname})`"
:color="item.bgColor"
v-for="(item, index) in showColorList"
:key="index"
:style="{ color: item.fontColor }"
class="tabBox"
:class="{ active: colorIndex === item.code }"
@click="optionSelection(item, 'color')"
>{{ item.cnname }}({{ item.enname }})</el-tag
>
<el-option
v-for="(item, index) in currencyOptions"
:key="index"
:label="`${item.currencyName}(${item.currencyCode})`"
:value="item.currencyCode"
>
</el-option>
</el-select>
</div>
</div>
</div>
<div
style="border-top: 1px solid #eee; margin-bottom: 10px"
v-if="showSizeList.length"
>
<div style="font-size: 20px; font-weight: bold; margin: 10px 0">
尺码(Size)
<div
style="border-top: 1px solid #eee; margin-bottom: 10px"
v-if="showColorList.length"
>
<div style="font-size: 20px; font-weight: bold; margin: 10px 0">
颜色(Color)
</div>
<div class="flex" style="flex-wrap: wrap; gap: 5px">
<el-tag
:title="`${item.cnname}(${item.enname})`"
:color="item.bgColor"
v-for="(item, index) in showColorList"
:key="index"
:style="{ color: item.fontColor }"
class="tabBox"
:class="{ active: colorIndex === item.code }"
@click="optionSelection(item, 'color')"
>{{ item.cnname }}({{ item.enname }})</el-tag
>
</div>
</div>
<div class="flex" style="flex-wrap: wrap; gap: 5px">
<el-tag
class="tabBox"
color="#ffff87"
style="color: #333"
effect="dark"
type="info"
v-for="(item, index) in showSizeList"
:key="index"
:class="{ active: sizeIndex === item.code }"
@click="optionSelection(item, 'size')"
>
{{ item.cnname }}</el-tag
>
<div
style="border-top: 1px solid #eee; margin-bottom: 10px"
v-if="showSizeList.length"
>
<div style="font-size: 20px; font-weight: bold; margin: 10px 0">
尺码(Size)
</div>
<div class="flex" style="flex-wrap: wrap; gap: 5px">
<el-tag
class="tabBox"
color="#ffff87"
style="color: #333"
effect="dark"
type="info"
v-for="(item, index) in showSizeList"
:key="index"
:class="{ active: sizeIndex === item.code }"
@click="optionSelection(item, 'size')"
>
{{ item.cnname }}</el-tag
>
</div>
</div>
</div>
<div
style="
display: flex;
justify-content: end;
border-top: 1px solid #eee;
"
>
<div style="margin: 10px 0">
<el-input
placeholder="请输入供应价格"
style="width: 200px; margin-right: 10px"
size="small"
v-model="supplierPirce"
clearable
></el-input
><ElButton type="primary" @click="updatePrices" size="small"
>批量更新供应价格</ElButton
>
<span style="color: #f56c6c; vertical-align: middle"
>(请注意!该操作会覆盖已有供应价格)</span
>
<div
style="
display: flex;
justify-content: end;
border-top: 1px solid #eee;
"
>
<div style="margin: 10px 0">
<el-input
placeholder="请输入供应价格"
style="width: 200px; margin-right: 10px"
size="small"
v-model="supplierPirce"
clearable
></el-input
><ElButton type="primary" @click="updatePrices" size="small"
>批量更新供应价格</ElButton
>
<span style="color: #f56c6c; vertical-align: middle"
>(请注意!该操作会覆盖已有供应价格)</span
>
</div>
</div>
<CustomizeTable
ref="tableRef"
border
style="margin-bottom: 20px"
v-model="pricetableData"
:config="priceTableConfig"
align="center"
height="500px"
@getCheckboxRecords="selectPirce"
></CustomizeTable>
</div>
<CustomizeTable
ref="tableRef"
border
style="margin-bottom: 20px"
v-model="pricetableData"
:config="priceTableConfig"
align="center"
height="500px"
@getCheckboxRecords="selectPirce"
></CustomizeTable>
<template #footer>
<div style="text-align: center">
<ElButton @click="cancelPiceFn">取消</ElButton>
......@@ -658,6 +661,7 @@ function savePiceFn() {
/**
* @description: 检查数据
*/
const saveLoading = ref(false)
async function checkData(): Promise<{
isValid: boolean
postData: IsupplierType
......@@ -722,9 +726,10 @@ async function checkData(): Promise<{
* @description: 保存按钮
*/
const saveSupplierFn = debounce(async () => {
const { isValid, postData } = await checkData()
if (isValid) {
try {
saveLoading.value = true
try {
const { isValid, postData } = await checkData()
if (isValid) {
if (!postData.id) {
await addSupplierApi({
...postData,
......@@ -741,9 +746,11 @@ const saveSupplierFn = debounce(async () => {
cancelFn()
search()
} catch (e) {
return
}
} catch (e) {
return
} finally {
saveLoading.value = false
}
}, 400)
......
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