From 1378fc4cd7abc24ed3a982e09437c2c8a74e9f2f Mon Sep 17 00:00:00 2001
From: 647556386 <647556386@qq.com>
Date: 星期二, 27 一月 2026 19:06:32 +0800
Subject: [PATCH] 代码优化
---
项目代码/WIDESEA_WMSClient/src/extension/outbound/extend/EmptyTrayOutbound.vue | 53 ++++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 46 insertions(+), 7 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/extend/EmptyTrayOutbound.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/extend/EmptyTrayOutbound.vue"
index 3460293..e368a58 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/extend/EmptyTrayOutbound.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/extend/EmptyTrayOutbound.vue"
@@ -4,7 +4,10 @@
<el-form ref="form" :model="form" label-width="90px">
<el-form-item label="鍑哄簱鍖哄煙:">
<el-select v-model="locationType" placeholder="璇烽�夋嫨鍑哄簱鍖哄煙">
- <el-option v-for="item in locationTypes" :key="item.locationType" :label="item.locationTypeDesc.toString()"
+ <el-option
+ v-for="item in locationTypes"
+ :key="item.locationType"
+ :label="item.locationTypeDesc.toString()"
:value="item.locationType">
</el-option>
</el-select>
@@ -12,17 +15,34 @@
</el-form>
<el-form ref="form" :model="form" label-width="90px">
<el-form-item label="鍑哄簱鏁伴噺:">
- <el-input-number v-model="num" :min="1" :max="999" :controls="true" placeholder="璇烽�夋嫨鍑哄簱鏁伴噺"
- style="width: 100%;"></el-input-number>
+ <el-input-number
+ v-model="num"
+ :min="1"
+ :max="999"
+ :controls="true"
+ placeholder="璇烽�夋嫨鍑哄簱鏁伴噺"
+ style="width: 100%;">
+ </el-input-number>
</el-form-item>
</el-form>
</template>
<template #footer>
<div>
- <el-button type="danger" size="small" plain @click="submit">
+ <!-- 娣诲姞loading鐘舵�佸拰disabled灞炴�� -->
+ <el-button
+ type="danger"
+ size="small"
+ plain
+ @click="submit"
+ :loading="isSubmitting"
+ :disabled="isSubmitting">
<i class="el-icon-check">纭</i>
</el-button>
- <el-button size="small" type="primary" plain @click="() => { this.show = false }">
+ <el-button
+ size="small"
+ type="primary"
+ plain
+ @click="() => { this.show = false }">
<i class="el-icon-close">鍏抽棴</i>
</el-button>
</div>
@@ -42,6 +62,8 @@
show: false,
locationTypes: [],
locationType: "",
+ // 鏂板鎻愪氦鐘舵�佹爣璇�
+ isSubmitting: false
}
},
methods: {
@@ -50,6 +72,15 @@
this.getData();
},
submit() {
+ // 1. 楠岃瘉蹇呭~椤�
+ if (!this.locationType) {
+ this.$message.warning('璇烽�夋嫨鍑哄簱鍖哄煙');
+ return;
+ }
+
+ // 2. 璁剧疆鎻愪氦鐘舵�佷负true锛岀鐢ㄦ寜閽�
+ this.isSubmitting = true;
+
this.$emit('parentCall', ($vue) => {
this.http.post(`/api/Task/PalletOutboundTask?num=${this.num}&locationType=${this.locationType}`, {}, '鏁版嵁澶勭悊涓�...')
.then((x) => {
@@ -61,9 +92,17 @@
$vue.refresh();
}
})
+ .catch((error) => {
+ // 鎹曡幏璇锋眰寮傚父锛屾彁绀虹敤鎴�
+ this.$message.error('璇锋眰澶辫触锛岃绋嶅悗閲嶈瘯');
+ console.error('鎻愪氦澶辫触:', error);
+ })
+ .finally(() => {
+ // 3. 璇锋眰瀹屾垚锛堟垚鍔�/澶辫触锛夊悗閲嶇疆鎻愪氦鐘舵��
+ this.isSubmitting = false;
+ });
})
},
-
getData() {
this.http.post("api/LocationInfo/GetLocationTypes", null, "鏌ヨ涓�")
.then((x) => {
@@ -72,4 +111,4 @@
},
}
}
-</script>
+</script>
\ No newline at end of file
--
Gitblit v1.9.3