Commit 106dbe29 by qinjianhui

fix: 请求前加loading

parent 5c68d5c2
......@@ -51,6 +51,7 @@ declare module 'vue' {
ElTag: typeof import('element-plus/es')['ElTag']
ElTooltip: typeof import('element-plus/es')['ElTooltip']
ElTree: typeof import('element-plus/es')['ElTree']
ElUpload: typeof import('element-plus/es')['ElUpload']
Icon: typeof import('./src/components/Icon.vue')['default']
ImageView: typeof import('./src/components/ImageView.vue')['default']
LogList: typeof import('./src/components/LogList.vue')['default']
......
......@@ -1258,6 +1258,10 @@ const handleUpdateRemark = async (item: ProductList) => {
inputPattern: /^.{1,2000}$/,
inputErrorMessage: '请输入备注',
}).then(async ({ value }) => {
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
})
try {
const res = await updateRemarkApi(item.id, value)
if (res.code !== 200) return
......@@ -1265,6 +1269,8 @@ const handleUpdateRemark = async (item: ProductList) => {
search()
} catch (e) {
console.error(e)
} finally {
loading.close()
}
})
}
......@@ -1289,6 +1295,10 @@ const loadProductionClient = async () => {
}
const submitConfirm = async () => {
const ids = selection.value.map((item) => item.id)
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
})
try {
const res = await confirmOrderApi(
ids,
......@@ -1302,6 +1312,8 @@ const submitConfirm = async () => {
loadTabData()
} catch (e) {
console.error(e)
} finally {
loading.close()
}
}
const updateOrder = async () => {
......@@ -1318,6 +1330,10 @@ const updateOrder = async () => {
return
}
const ids = selection.value.map((item) => item.id)
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
})
try {
const res = await updateExceptionOrderApi(ids)
if (res.code !== 200) return
......@@ -1326,6 +1342,8 @@ const updateOrder = async () => {
loadTabData()
} catch (e) {
console.error(e)
} finally {
loading.close()
}
}
const printProductionOrder = async () => {
......@@ -1333,6 +1351,10 @@ const printProductionOrder = async () => {
return ElMessage.warning('请选择数据')
}
const orderIds = selection.value.map((item) => item.id)
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
})
try {
const res = await printProductionOrderApi(orderIds)
if (res.code !== 200) return
......@@ -1340,6 +1362,8 @@ const printProductionOrder = async () => {
window.open(filePath + res.message)
} catch (e) {
console.error(e)
} finally {
loading.close()
}
}
const printPickingOrder = async () => {
......@@ -1347,6 +1371,10 @@ const printPickingOrder = async () => {
return ElMessage.warning('请选择数据')
}
const orderIds = selection.value.map((item) => item.id)
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
})
try {
const res = await printPrintOrderApi(orderIds)
if (res.code !== 200) return
......@@ -1354,6 +1382,8 @@ const printPickingOrder = async () => {
window.open(filePath + res.message)
} catch (e) {
console.error(e)
} finally {
loading.close()
}
}
const pickingComplete = async () => {
......@@ -1370,6 +1400,10 @@ const pickingComplete = async () => {
return
}
const orderIds = selection.value.map((item) => item.id)
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
})
try {
const res = await printPickingOrderApi(orderIds)
if (res.code !== 200) return
......@@ -1378,6 +1412,8 @@ const pickingComplete = async () => {
loadTabData()
} catch (e) {
console.error(e)
} finally {
loading.close()
}
}
......@@ -1392,6 +1428,10 @@ const changeExceptionOrder = async () => {
inputPattern: /^.{1,2000}$/,
inputErrorMessage: '请输入异常原因',
}).then(async ({ value }) => {
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
})
try {
const res = await changeExceptionOrderApi(orderIds, value)
if (res.code !== 200) return
......@@ -1400,6 +1440,8 @@ const changeExceptionOrder = async () => {
loadTabData()
} catch (e) {
console.error(e)
} finally {
loading.close()
}
})
}
......@@ -1414,6 +1456,10 @@ const cancelOrder = async () => {
inputPattern: /^.{1,2000}$/,
inputErrorMessage: '请输入取消原因',
}).then(async ({ value }) => {
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
})
try {
const res = await cancelOrderApi(orderIds, value)
if (res.code !== 200) return
......@@ -1422,6 +1468,8 @@ const cancelOrder = async () => {
loadTabData()
} catch (e) {
console.error(e)
} finally {
loading.close()
}
})
}
......@@ -1490,6 +1538,10 @@ const downloadMaterial = async () => {
offset: window.innerHeight / 2,
})
}
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
})
try {
const res = await downloadMaterialApi(selectedIds)
if (res.code !== 200) return
......@@ -1497,6 +1549,8 @@ const downloadMaterial = async () => {
} catch (e) {
// showError(e)
console.error(e)
} finally {
loading.close()
}
}
const logList = ref<LogListData[]>([])
......@@ -1561,6 +1615,10 @@ const getOrderByIdApi = async (type: string) => {
// console.log(Fn)
if (Fn) {
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
})
const res = await Fn(ids)
if (res.code === 200) {
......@@ -1573,6 +1631,7 @@ const getOrderByIdApi = async (type: string) => {
} else {
ElMessage.error(res.message)
}
loading.close()
}
} catch {
return
......@@ -1589,7 +1648,10 @@ const stockOutCheck = async () => {
if (selection.value.length === 0) {
return ElMessage.warning('请选择数据')
}
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
})
try {
const selectedIds = selection.value.map((item) => item.id)
const res = await stockOutCheckApi(selectedIds)
......@@ -1632,6 +1694,8 @@ const stockOutCheck = async () => {
})
} catch (error) {
console.error('补货校验失败:', error)
} finally {
loading.close()
}
}
const toBePicking = async () => {
......@@ -1647,6 +1711,10 @@ const toBePicking = async () => {
} catch (e) {
return
}
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
})
try {
const res = await toBePickingApi(selection.value.map((item) => item.id))
if (res.code !== 200) return
......@@ -1655,6 +1723,8 @@ const toBePicking = async () => {
loadTabData()
} catch (e) {
console.error(e)
} finally {
loading.close()
}
}
const sheetPrinter = ref('')
......@@ -1823,6 +1893,10 @@ const downloadPDF = (url: string) => {
return strData
}
const openDetail = async (id: number) => {
const loading = ElLoading.service({
fullscreen: true,
text: '加载中...',
})
try {
const res = await getOrderDetailById(id)
if (res.code == 200) {
......@@ -1835,6 +1909,8 @@ const openDetail = async (id: number) => {
}
} catch (e) {
//showError(e)
} finally {
loading.close()
}
}
const onFastRefresh = () => {
......@@ -1867,6 +1943,10 @@ const refreshMaterial = async () => {
if (selection.value.length === 0) {
return ElMessage.warning('请选择数据')
}
const loading = ElLoading.service({
fullscreen: true,
text: '刷新中...',
})
try {
const res = await refreshMaterialApi(
selection.value.map((item) => item.id).join(','),
......@@ -1876,6 +1956,8 @@ const refreshMaterial = async () => {
search()
} catch (e) {
console.error(e)
} finally {
loading.close()
}
}
onMounted(() => {
......
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