| | |
| | | title="èæåºå
¥åº" |
| | | class="custom-vol-box" |
| | | > |
| | | <!-- æäº¤é®ç½©å±ï¼è¦çæ´ä¸ªå¼¹çªå
容åºå --> |
| | | <div class="submit-mask" v-show="submitLoading"> |
| | | <div class="mask-content"> |
| | | <el-loading-spinner class="loading-icon" /> |
| | | <span class="loading-text">æ£å¨æäº¤åºåºï¼è¯·ç¨å...</span> |
| | | </div> |
| | | </div> |
| | | |
| | | <div> |
| | | <!-- åæ®è¾å
¥åºåï¼æ¯ææ«ç ï¼ --> |
| | | <el-form :inline="true" :model="orderForm" style="margin-bottom: 20px; align-items: flex-end;"> |
| | | <el-form |
| | | :inline="true" |
| | | :model="orderForm" |
| | | style="margin-bottom: 20px; align-items: flex-end;" |
| | | @submit.prevent |
| | | > |
| | | <el-form-item label="åºåºåæ®:" name="outboundOrderNo"> |
| | | <el-input |
| | | v-model="orderForm.outboundOrderNo" |
| | |
| | | clearable |
| | | style="width: 220px; margin-right: 10px;" |
| | | @input="handleOutboundInput" |
| | | @keyup.enter="focusPurchaseInput" |
| | | @keyup.enter="validateOutboundOrder" |
| | | ref="outboundInputRef" |
| | | :disabled="loading || submitLoading || isOutboundVerified" |
| | | ></el-input> |
| | | <!-- æ°å¢ï¼éªè¯ç¶ææç¤º --> |
| | | <span v-if="isOutboundVerified" class="verified-tag">â å·²éªè¯</span> |
| | | <span v-else-if="loading" class="loading-tag">⦠éªè¯ä¸...</span> |
| | | </el-form-item> |
| | | <el-form-item label="éè´åæ®:" name="purchaseOrderNo"> |
| | | <el-input |
| | | v-model="orderForm.purchaseOrderNo" |
| | | placeholder="请è¾å
¥ææ«æéè´åæ®å·" |
| | | placeholder="æ«ç æ¡ç åèªå¨å¡«å
" |
| | | clearable |
| | | style="width: 220px; margin-right: 10px;" |
| | | @input="handlePurchaseInput" |
| | | @keyup.enter="focusBarcodeInput" |
| | | readonly |
| | | ref="purchaseInputRef" |
| | | :disabled="submitLoading" |
| | | ></el-input> |
| | | </el-form-item> |
| | | </el-form> |
| | | |
| | | <!-- 䏿¹è¾å
¥æ¡ --> |
| | | <el-form :inline="true" :model="formData" ref="formRef" style="margin-bottom: 20px; align-items: flex-end;"> |
| | | <el-form |
| | | :inline="true" |
| | | :model="formData" |
| | | ref="formRef" |
| | | style="margin-bottom: 20px; align-items: flex-end;" |
| | | @submit.prevent |
| | | > |
| | | <el-form-item |
| | | label="æ«ææ¡ç :" |
| | | style="width: 80%" |
| | | name="barcode" |
| | | :rules="[{ required: true, message: 'è¯·æ«ææè¾å
¥æ¡ç ', trigger: 'blur' }]" |
| | | > |
| | | <el-input |
| | | ref="barcodeInputRef" |
| | | v-model="formData.barcode" |
| | | placeholder="è¯·ä½¿ç¨æ«ç æªæ«ææ¡ç ï¼ææå¨è¾å
¥" |
| | | @keyup.enter="handleScan" |
| | | @keydown.enter="debouncedHandleScan" |
| | | autofocus |
| | | class="custom-input" |
| | | :disabled="!orderForm.outboundOrderNo || !orderForm.purchaseOrderNo" |
| | | :disabled="!isOutboundVerified || loading || submitLoading" |
| | | ></el-input> |
| | | </el-form-item> |
| | | <el-form-item> |
| | |
| | | size="small" |
| | | @click="handleScan" |
| | | class="custom-button" |
| | | :disabled="!orderForm.outboundOrderNo || !orderForm.purchaseOrderNo || loading" |
| | | :disabled="!isOutboundVerified || loading || submitLoading" |
| | | > |
| | | <Search /> ç¡®è®¤æ«æ |
| | | </el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | |
| | | <!-- 䏿¹æ¾ç¤ºæ¡ --> |
| | | <!-- 䏿¹æ¾ç¤ºæ¡ï¼ç´æ¥æ¸²æå端è¿åçæ°ç»ï¼ --> |
| | | <div class="scan-list"> |
| | | <el-card shadow="hover" style="margin-bottom: 10px; border: none;" class="custom-card"> |
| | | <div class="card-header"> |
| | |
| | | <div class="card-body"> |
| | | <el-scrollbar height="400px" class="custom-scrollbar"> |
| | | <transition-group name="barcode-item-transition"> |
| | | <div class="barcode-item" v-for="(item, index) in scannedBarcodes" :key="item.barcode" :data-index="index"> |
| | | <span class="barcode-text">{{ index + 1 }}. {{ item.barcode }}</span> |
| | | <div class="barcode-item" v-for="(item, index) in scannedBarcodes" :key="`${item.barcode}-${index}`" :data-index="index"> |
| | | <div class="barcode-detail"> |
| | | <div class="detail-row"> |
| | | <span class="label">æ¡ç ï¼</span> |
| | | <span class="value">{{ item.barcode || '-' }}</span> |
| | | </div> |
| | | <div class="detail-row"> |
| | | <span class="label">ç©æç¼ç ï¼</span> |
| | | <span class="value">{{ item.materielCode || '-' }}</span> |
| | | </div> |
| | | <div class="detail-row"> |
| | | <span class="label">ç©æåç§°ï¼</span> |
| | | <span class="value">{{ item.materielName || '-' }}</span> |
| | | </div> |
| | | <div class="detail-row"> |
| | | <span class="label">æ¹æ¬¡å·ï¼</span> |
| | | <span class="value">{{ item.batchNo || '-' }}</span> |
| | | </div> |
| | | <div class="detail-row"> |
| | | <span class="label">æ¡ç æ°éï¼</span> |
| | | <span class="value">{{ item.orderQuantity || item.quantity || 0 }}</span> |
| | | </div> |
| | | <div class="detail-row"> |
| | | <span class="label">ä¾åºåç¼ç ï¼</span> |
| | | <span class="value">{{ item.supplyCode || '-' }}</span> |
| | | </div> |
| | | <div class="detail-row"> |
| | | <span class="label">éè´åå·ï¼</span> |
| | | <span class="value">{{ item.purchaseOrderNo || '-' }}</span> |
| | | </div> |
| | | </div> |
| | | <el-button |
| | | class="delete-btn" |
| | | @click="removeItem(index, item.barcode)" |
| | | icon="Delete" |
| | | circle |
| | | :disabled="loading" |
| | | :disabled="loading || submitLoading" |
| | | ></el-button> |
| | | </div> |
| | | </transition-group> |
| | | <div class="empty-tip" v-if="scannedBarcodes.length === 0"> |
| | | <span>ææ æ«æè®°å½ï¼è¯·å
è¾å
¥åæ®åæ«ææ¡ç </span> |
| | | <span v-if="isOutboundVerified">ææ æ«æè®°å½ï¼è¯·æ«ææ¡ç </span> |
| | | <span v-else>请å
è¾å
¥å¹¶éªè¯ææçåºåºåæ®å·</span> |
| | | </div> |
| | | </el-scrollbar> |
| | | </div> |
| | |
| | | type="primary" |
| | | size="small" |
| | | @click="submit" |
| | | :disabled="scannedBarcodes.length === 0 || !orderForm.outboundOrderNo || !orderForm.purchaseOrderNo || loading" |
| | | :disabled="scannedBarcodes.length === 0 || !isOutboundVerified || loading || submitLoading" |
| | | class="submit-btn" |
| | | > |
| | | <Check /> æäº¤åºåº |
| | | </el-button> |
| | | <el-button type="text" size="small" @click="showDetailBox = false" class="cancel-btn" :disabled="loading"> |
| | | <el-button |
| | | type="text" |
| | | size="small" |
| | | @click="(e) => { |
| | | e.stopPropagation(); |
| | | e.preventDefault(); |
| | | showDetailBox = false; |
| | | }" |
| | | class="cancel-btn" |
| | | :disabled="loading || submitLoading" |
| | | > |
| | | åæ¶ |
| | | </el-button> |
| | | </div> |
| | |
| | | <script setup> |
| | | import { ref, reactive, onMounted, nextTick } from 'vue'; |
| | | import { ElMessage } from 'element-plus'; |
| | | import { Search } from '@element-plus/icons-vue'; |
| | | import { Search, Check } from '@element-plus/icons-vue'; |
| | | |
| | | import VolBox from "@/components/basic/VolBox.vue"; |
| | | import http from '@/api/http'; |
| | |
| | | }); |
| | | const scannedBarcodes = ref([]); |
| | | const loading = ref(false); |
| | | // æ°å¢ï¼æäº¤ä¸å±loadingç¶æï¼æ§å¶é®ç½©å±æ¾ç¤º |
| | | const submitLoading = ref(false); |
| | | // æ ¸å¿æ°å¢ï¼åºåºåéªè¯ç¶ææ è¯ |
| | | const isOutboundVerified = ref(false); |
| | | |
| | | // 模æ¿å¼ç¨ |
| | | const formRef = ref(null); |
| | |
| | | }); |
| | | }); |
| | | |
| | | // ç®å鲿彿° |
| | | const debounce = (fn, delay = 100) => { |
| | | let timer = null; |
| | | return (...args) => { |
| | | if (timer) clearTimeout(timer); |
| | | timer = setTimeout(() => { |
| | | fn.apply(this, args); |
| | | }, delay); |
| | | }; |
| | | }; |
| | | |
| | | // æå¼å¼¹çª |
| | | const open = () => { |
| | | showDetailBox.value = true; |
| | |
| | | formData.barcode = ""; |
| | | orderForm.outboundOrderNo = ""; |
| | | orderForm.purchaseOrderNo = ""; |
| | | submitLoading.value = false; // æå¼å¼¹çªæ¶éç½®æäº¤loading |
| | | isOutboundVerified.value = false; // æå¼å¼¹çªæ¶éç½®åºåºåéªè¯ç¶æ |
| | | nextTick(() => { |
| | | outboundInputRef.value?.focus(); |
| | | outboundInputRef.value?.focus(); // æå¼å¼¹çªä»èç¦åºåºåè¾å
¥æ¡ |
| | | }); |
| | | }; |
| | | |
| | | // åºåºåè¾å
¥å¤çï¼æ«ç ææå¨è¾å
¥ï¼ |
| | | const handleOutboundInput = (value) => { |
| | | // æ«ç æªè¾å
¥é常ä¼èªå¨è§¦åenteräºä»¶ï¼è¿é主è¦å¤çæå¨è¾å
¥çæ
åµ |
| | | if (value && value.trim()) { |
| | | // å¯ä»¥å¨è¿éæ·»å åºåºåå·çæ ¼å¼éªè¯é»è¾ |
| | | } |
| | | }; |
| | | |
| | | // éè´åè¾å
¥å¤çï¼æ«ç ææå¨è¾å
¥ï¼ |
| | | const handlePurchaseInput = (value) => { |
| | | if (value && value.trim()) { |
| | | // å¯ä»¥å¨è¿éæ·»å éè´åå·çæ ¼å¼éªè¯é»è¾ |
| | | } |
| | | }; |
| | | |
| | | // ç¦ç¹è·³è½¬å½æ° |
| | | const focusPurchaseInput = () => { |
| | | if (orderForm.outboundOrderNo.trim()) { |
| | | purchaseInputRef.value?.focus(); |
| | | } else { |
| | | ElMessage.warning("请å
è¾å
¥ææçåºåºåæ®å·"); |
| | | } |
| | | }; |
| | | |
| | | const focusBarcodeInput = () => { |
| | | if (orderForm.purchaseOrderNo.trim()) { |
| | | barcodeInputRef.value?.focus(); |
| | | } else { |
| | | ElMessage.warning("请å
è¾å
¥ææçéè´åæ®å·"); |
| | | } |
| | | }; |
| | | |
| | | // æ«ææ¡ç å¤ç |
| | | const handleScan = async () => { |
| | | if (!formRef.value) return; |
| | | await formRef.value.validateField('barcode'); |
| | | |
| | | const barcode = formData.barcode.trim(); |
| | | |
| | | if (scannedBarcodes.value.some(item => item.barcode === barcode)) { |
| | | ElMessage.warning(`æ¡ç ${barcode} å·²æ«æè¿ï¼è¯·å¿é夿«æ`); |
| | | formData.barcode = ""; |
| | | nextTick(() => barcodeInputRef.value?.focus()); |
| | | /** |
| | | * éªè¯åºåºåæ®å·çæææ§ |
| | | * æ ¸å¿ä¿®æ¹ï¼éªè¯æååæ è®°isOutboundVerified为trueï¼å¤±è´¥åé置为false |
| | | */ |
| | | const validateOutboundOrder = async () => { |
| | | const outboundOrderNo = orderForm.outboundOrderNo.trim(); |
| | | if (!outboundOrderNo) { |
| | | ElMessage.warning("请è¾å
¥åºåºåæ®å·"); |
| | | return; |
| | | } |
| | | |
| | | try { |
| | | loading.value = true; |
| | | // è¿éä¿çäºåæçæ¡ç éªè¯æ¥å£ï¼ä½ å¯ä»¥æ ¹æ®å®é
éæ±ä¿®æ¹æä¿ç |
| | | const res = await http.post("/api/OutboundPicking/BarcodeValidate", { |
| | | outOder: orderForm.outboundOrderNo, // 注æï¼è¿éç°å¨ä¼ éçæ¯åæ®å·å符串ï¼è䏿¯ID |
| | | inOder: orderForm.purchaseOrderNo, // 注æï¼è¿éç°å¨ä¼ éçæ¯åæ®å·å符串ï¼è䏿¯ID |
| | | barCode: barcode |
| | | }); |
| | | const res = await http.post( |
| | | `/api/OutboundPicking/GetAvailablePickingOrders?outOrder=`+ outboundOrderNo, |
| | | "éªè¯åºåºåæ®å·ä¸..." |
| | | ); |
| | | |
| | | if (res.status === true) { |
| | | scannedBarcodes.value.push({ barcode }); |
| | | ElMessage.success("æ«ææå"); |
| | | formData.barcode = ""; |
| | | } else { |
| | | ElMessage.error("æ«æå¤±è´¥ï¼" + (res.message || 'éªè¯å¤±è´¥')); |
| | | if (res.status !== true) { |
| | | // éªè¯å¤±è´¥ï¼æ¸
空è¾å
¥æ¡ï¼æç¤ºé误ï¼éç½®éªè¯ç¶æï¼èç¦ååºåºåè¾å
¥æ¡ |
| | | orderForm.outboundOrderNo = ""; |
| | | isOutboundVerified.value = false; |
| | | ElMessage.error(res.message || "åºåºåæ®å·éªè¯å¤±è´¥ï¼è¯·æ£æ¥åæ®å·æ¯å¦æ£ç¡®"); |
| | | nextTick(() => { |
| | | outboundInputRef.value?.focus(); // 失败èç¦åºåºåè¾å
¥æ¡ |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | // éªè¯æåï¼æ è®°éªè¯ç¶æä¸ºtrueï¼æç¤ºç¨æ·ï¼èç¦æ¡ç æ«ææ¡ |
| | | isOutboundVerified.value = true; |
| | | ElMessage.success("åºåºåæ®å·éªè¯éè¿"); |
| | | nextTick(() => { |
| | | barcodeInputRef.value?.focus(); // æåç´æ¥è·³è½¬å°æ¡ç æ«ææ¡ |
| | | }); |
| | | } catch (error) { |
| | | ElMessage.error("æ«æéªè¯å¼å¸¸ï¼" + error.message); |
| | | // æ¥å£å¼å¸¸ï¼æ¸
空è¾å
¥æ¡ï¼æç¤ºé误ï¼éç½®éªè¯ç¶æï¼èç¦ååºåºåè¾å
¥æ¡ |
| | | orderForm.outboundOrderNo = ""; |
| | | isOutboundVerified.value = false; |
| | | ElMessage.error(`åºåºåæ®å·éªè¯å¼å¸¸ï¼${error.message || "ç½ç»é误ï¼è¯·éè¯"}`); |
| | | nextTick(() => { |
| | | outboundInputRef.value?.focus(); // å¼å¸¸èç¦åºåºåè¾å
¥æ¡ |
| | | }); |
| | | } finally { |
| | | loading.value = false; |
| | | nextTick(() => barcodeInputRef.value?.focus()); |
| | | } |
| | | }; |
| | | |
| | | // ç§»é¤åæ¡æ«æè®°å½ |
| | | // åºåºåè¾å
¥å¤ç |
| | | const handleOutboundInput = (value) => { |
| | | // æ ¸å¿ä¿®æ¹ï¼è¾å
¥æ¶èªå¨éç½®éªè¯ç¶æï¼é²æ¢æå¨ä¿®æ¹å·²éªè¯çåºåºåå·ï¼ |
| | | if (value && value.trim()) { |
| | | isOutboundVerified.value = false; |
| | | } |
| | | }; |
| | | |
| | | // éè´åè¾å
¥å¤ç |
| | | const handlePurchaseInput = (value) => { |
| | | if (value && value.trim()) { |
| | | // å¯ä¿çéè´åå·æ ¼å¼éªè¯é»è¾ |
| | | } |
| | | }; |
| | | |
| | | // èç¦æ¡ç è¾å
¥æ¡ï¼å¤ç¨å½æ°ï¼ |
| | | const focusBarcodeInputDirectly = () => { |
| | | if (isOutboundVerified.value) { |
| | | barcodeInputRef.value?.focus(); |
| | | } else { |
| | | ElMessage.warning("请å
è¾å
¥å¹¶éªè¯ææçåºåºåæ®å·"); |
| | | nextTick(() => { |
| | | outboundInputRef.value?.focus(); |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * æ ¹æ®æ¡ç æ¥è¯¢éè´åå· |
| | | */ |
| | | const getPurchaseOrderByBarcode = async (barcode) => { |
| | | const res = await http.post(`/api/OutboundPicking/GetPurchaseOrderByBarcode?barCode=${encodeURIComponent(barcode)}`, "æ¥è¯¢éè´åå·ä¸..."); |
| | | |
| | | if (res.status !== true) { |
| | | throw new Error(res.message || "æ¥è¯¢éè´åå·å¤±è´¥"); |
| | | } |
| | | |
| | | let purchaseOrderNo = ''; |
| | | if (Array.isArray(res.data) && res.data.length > 0) { |
| | | purchaseOrderNo = res.data[0].purchaseOrderNo || res.data[0].orderId; |
| | | } else { |
| | | purchaseOrderNo = res.data?.purchaseOrderNo || res.data?.orderId; |
| | | } |
| | | |
| | | return purchaseOrderNo; |
| | | }; |
| | | |
| | | // æ«ææ¡ç æ ¸å¿é»è¾ |
| | | const handleScan = async () => { |
| | | // æ ¸å¿æ°å¢ï¼åç½®æ ¡éªï¼ç¡®ä¿åºåºåå·²éªè¯ |
| | | if (!isOutboundVerified.value) { |
| | | ElMessage.warning("请å
éªè¯ææçåºåºåæ®å·ååæ«ææ¡ç "); |
| | | nextTick(() => { |
| | | outboundInputRef.value?.focus(); |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | if (!formRef.value) return; |
| | | await formRef.value.validateField('barcode'); |
| | | |
| | | const barcode = formData.barcode.trim(); |
| | | const outboundOrderNo = orderForm.outboundOrderNo.trim(); |
| | | |
| | | // æ¡ç å»é |
| | | const isDuplicate = scannedBarcodes.value.some(item => item.barcode === barcode); |
| | | if (isDuplicate) { |
| | | ElMessage.warning(`æ¡ç ã${barcode}ãå·²åå¨ï¼æ éé夿«æ`); |
| | | formData.barcode = ""; |
| | | nextTick(() => barcodeInputRef.value?.focus()); // å»éåä»èç¦æ¡ç æ¡ |
| | | return; |
| | | } |
| | | |
| | | try { |
| | | loading.value = true; |
| | | |
| | | // æ¥éª¤1ï¼æ¥è¯¢éè´åå· |
| | | const purchaseOrderNo = await getPurchaseOrderByBarcode(barcode); |
| | | if (purchaseOrderNo) { |
| | | orderForm.purchaseOrderNo = purchaseOrderNo; |
| | | } else { |
| | | ElMessage.info("æªæ¥è¯¢å°è¯¥æ¡ç 对åºçéè´åå·ï¼ç»§ç»éªè¯æ¡ç æææ§"); |
| | | formData.barcode = ""; |
| | | nextTick(() => barcodeInputRef.value?.focus()); |
| | | } |
| | | |
| | | // æ¥éª¤2ï¼éªè¯æ¡ç å¹¶è·åç©æä¿¡æ¯ |
| | | const validateRes = await http.post("/api/OutboundPicking/BarcodeValidate", { |
| | | outOder: outboundOrderNo, |
| | | inOder: purchaseOrderNo || orderForm.purchaseOrderNo, |
| | | barCode: barcode |
| | | }); |
| | | |
| | | if (validateRes.status === true) { |
| | | if (!Array.isArray(validateRes.data) || validateRes.data.length === 0) { |
| | | ElMessage.warning("该æ¡ç éªè¯æåï¼ä½æªè¿åç©æä¿¡æ¯"); |
| | | formData.barcode = ""; |
| | | nextTick(() => barcodeInputRef.value?.focus()); |
| | | } else { |
| | | const newItems = validateRes.data.map(item => ({ |
| | | barcode: item.barcode || '', |
| | | materielCode: item.materielCode || '', |
| | | materielName: item.materielName || '', |
| | | batchNo: item.batchNo || '', |
| | | orderQuantity: item.orderQuantity || item.quantity || 0, |
| | | supplyCode: item.supplyCode || '', |
| | | purchaseOrderNo: purchaseOrderNo || '' |
| | | })); |
| | | scannedBarcodes.value.push(...newItems); |
| | | ElMessage.success(`æ«ææåï¼æ°å¢ ${newItems.length} æ¡ç©æä¿¡æ¯ï¼ç´¯è®¡ ${scannedBarcodes.value.length} æ¡`); |
| | | formData.barcode = ""; |
| | | } |
| | | } else { |
| | | ElMessage.error("æ«æå¤±è´¥ï¼" + (validateRes.message || 'æ¡ç éªè¯å¤±è´¥')); |
| | | formData.barcode = ""; |
| | | nextTick(() => barcodeInputRef.value?.focus()); |
| | | } |
| | | } catch (error) { |
| | | ElMessage.error(error.message); |
| | | formData.barcode = ""; |
| | | nextTick(() => barcodeInputRef.value?.focus()); |
| | | } finally { |
| | | loading.value = false; |
| | | // æ«æå®æåå§ç»èç¦æ¡ç è¾å
¥æ¡ï¼æ¹ä¾¿è¿ç»æ«æï¼ |
| | | nextTick(() => { |
| | | barcodeInputRef.value?.focus(); |
| | | if (barcodeInputRef.value?.input) { |
| | | barcodeInputRef.value.input.select = () => {}; |
| | | } |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | // å¸¦é²æçæ«æå¤ç |
| | | const debouncedHandleScan = debounce(async (e) => { |
| | | e.stopPropagation(); |
| | | e.preventDefault(); |
| | | await handleScan(); |
| | | }, 100); |
| | | |
| | | // ç§»é¤åæ¡è®°å½ |
| | | const removeItem = async (index, barcode) => { |
| | | try { |
| | | loading.value = true; |
| | | // è¿éä¿çäºåæçå 餿¡ç æ¥å£ï¼ä½ å¯ä»¥æ ¹æ®å®é
éæ±ä¿®æ¹æä¿ç |
| | | const currentItem = scannedBarcodes.value[index]; |
| | | const res = await http.post("/api/OutboundPicking/DeleteBarcode", { |
| | | outOder: orderForm.outboundOrderNo, |
| | | inOder: orderForm.purchaseOrderNo, |
| | | inOder: currentItem?.purchaseOrderNo || orderForm.purchaseOrderNo, |
| | | barCode: barcode |
| | | }); |
| | | |
| | | if (res.status === true) { |
| | | scannedBarcodes.value.splice(index, 1); |
| | | ElMessage.success("å 餿å"); |
| | | if (scannedBarcodes.value.length === 0) { |
| | | orderForm.purchaseOrderNo = ""; |
| | | } |
| | | } else { |
| | | ElMessage.error("å é¤å¤±è´¥ï¼" + (res.message || 'å é¤å¤±è´¥')); |
| | | } |
| | |
| | | ElMessage.error("å 餿¡ç å¼å¸¸ï¼" + error.message); |
| | | } finally { |
| | | loading.value = false; |
| | | // å é¤åä»èç¦æ¡ç è¾å
¥æ¡ |
| | | nextTick(() => barcodeInputRef.value?.focus()); |
| | | } |
| | | }; |
| | | |
| | | // æäº¤åºåº |
| | | const submit = async () => { |
| | | // æ ¸å¿æ°å¢ï¼åç½®æ ¡éªåºåºåéªè¯ç¶æ |
| | | if (!isOutboundVerified.value) { |
| | | ElMessage.warning("åºåºåæ®å·æªéªè¯ï¼æ æ³æäº¤"); |
| | | nextTick(() => { |
| | | outboundInputRef.value?.focus(); |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | if (scannedBarcodes.value.length === 0) { |
| | | ElMessage.warning("请å
æ«æè³å°ä¸æ¡æ¡ç "); |
| | | nextTick(() => barcodeInputRef.value?.focus()); |
| | | return; |
| | | } |
| | | |
| | | const barcodes = scannedBarcodes.value.map(item => item.barcode); |
| | | const purchaseOrderNos = [...new Set(scannedBarcodes.value.map(item => item.purchaseOrderNo).filter(Boolean))]; |
| | | |
| | | try { |
| | | loading.value = true; |
| | | // è¿éä¿çäºåæçæäº¤æ¥å£ï¼æ³¨æåæ°ç°å¨ä¼ éçæ¯åæ®å·å符串 |
| | | // å¼å¯æäº¤loadingï¼æ¾ç¤ºé®ç½©å± |
| | | submitLoading.value = true; |
| | | const res = await http.post("/api/OutboundPicking/NoStockOutSubmit", { |
| | | OutOderSubmit: orderForm.outboundOrderNo, |
| | | InOderSubmit: orderForm.purchaseOrderNo, |
| | | InOderSubmit: purchaseOrderNos.join(',') || '', |
| | | BarCodeSubmit: barcodes |
| | | }); |
| | | |
| | | if (res.status === true) { |
| | | ElMessage.success("åºåºæäº¤æå"); |
| | | showDetailBox.value = false; |
| | | scannedBarcodes.value = []; |
| | | orderForm.purchaseOrderNo = ""; |
| | | isOutboundVerified.value = false; // æäº¤æååéç½®éªè¯ç¶æ |
| | | } else { |
| | | ElMessage.error("åºåºæäº¤å¤±è´¥ï¼" + (res.message || 'æäº¤å¤±è´¥')); |
| | | nextTick(() => barcodeInputRef.value?.focus()); |
| | | } |
| | | } catch (error) { |
| | | ElMessage.error("åºåºæäº¤å¼å¸¸ï¼" + error.message); |
| | | nextTick(() => barcodeInputRef.value?.focus()); |
| | | } finally { |
| | | // å
³éæäº¤loadingï¼éèé®ç½©å± |
| | | submitLoading.value = false; |
| | | loading.value = false; |
| | | } |
| | | }; |
| | |
| | | </script> |
| | | |
| | | <style scoped> |
| | | /* å
³é®ï¼å®ä¹å表项çè¿æ¸¡å¨ç» */ |
| | | /*è¿æ¸¡å¨ç» */ |
| | | .barcode-item-transition-enter-active, |
| | | .barcode-item-transition-leave-active { |
| | | transition: all 0.3s ease; |
| | |
| | | opacity: 0; |
| | | transform: translateX(30px); |
| | | } |
| | | /* ç¡®ä¿å 餿¶å
¶ä»å
ç´ å¹³æ»ä¸ç§» */ |
| | | .barcode-item-transition-move { |
| | | transition: transform 1s ease; |
| | | } |
| | | |
| | | /* æ°å¢ï¼æäº¤é®ç½©å±æ ·å¼ */ |
| | | .submit-mask { |
| | | position: absolute; |
| | | top: 0; |
| | | left: 0; |
| | | width: 100%; |
| | | height: 100%; |
| | | background-color: rgba(255, 255, 255, 0.85); |
| | | display: flex; |
| | | justify-content: center; |
| | | align-items: center; |
| | | z-index: 100; |
| | | border-radius: inherit; |
| | | } |
| | | .mask-content { |
| | | display: flex; |
| | | flex-direction: column; |
| | | align-items: center; |
| | | gap: 12px; |
| | | color: #409eff; |
| | | font-size: 15px; |
| | | } |
| | | .loading-icon { |
| | | font-size: 24px; |
| | | animation: el-loading-circle 1.5s linear infinite; |
| | | } |
| | | |
| | | /* æ°å¢ï¼éªè¯ç¶ææ ç¾æ ·å¼ */ |
| | | .verified-tag { |
| | | color: #67c23a; |
| | | font-size: 12px; |
| | | margin-left: 8px; |
| | | font-weight: 500; |
| | | } |
| | | .loading-tag { |
| | | color: #409eff; |
| | | font-size: 12px; |
| | | margin-left: 8px; |
| | | font-weight: 500; |
| | | animation: spin 1s linear infinite; |
| | | } |
| | | @keyframes spin { |
| | | 0% { transform: rotate(0deg); } |
| | | 100% { transform: rotate(360deg); } |
| | | } |
| | | |
| | | .scan-list { |
| | |
| | | padding: 0; |
| | | } |
| | | |
| | | /* èªå®ä¹æ»å¨æ¡ */ |
| | | .custom-scrollbar :deep(.el-scrollbar__thumb) { |
| | | background: rgba(0, 0, 0, 0.2); |
| | | border-radius: 4px; |
| | |
| | | .barcode-item { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | padding: 10px 15px; |
| | | align-items: flex-start; |
| | | padding: 15px; |
| | | border-bottom: 1px solid #f7f7f7; |
| | | transition: background-color 0.2s ease; |
| | | } |
| | | .barcode-item:hover { |
| | | background-color: #fafafa; |
| | | } |
| | | /* ä¸ºå¥æ°è¡æ·»å 轻微çèæ¯è²ï¼å¢å¼ºå¯è¯»æ§ */ |
| | | .barcode-item:nth-child(odd) { |
| | | background-color: #f9f9f9; |
| | | } |
| | | .barcode-text { |
| | | .barcode-detail { |
| | | flex: 1; |
| | | display: grid; |
| | | grid-template-columns: repeat(4, 1fr); |
| | | gap: 8px 15px; |
| | | font-size: 14px; |
| | | color: #666; |
| | | transition: color 0.2s; |
| | | } |
| | | .barcode-item:hover .barcode-text { |
| | | color: #409eff; |
| | | @media (max-width: 1200px) { |
| | | .barcode-detail { |
| | | grid-template-columns: repeat(3, 1fr); |
| | | } |
| | | } |
| | | @media (max-width: 992px) { |
| | | .barcode-detail { |
| | | grid-template-columns: repeat(2, 1fr); |
| | | } |
| | | } |
| | | .detail-row { |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | .label { |
| | | color: #999; |
| | | margin-right: 5px; |
| | | white-space: nowrap; |
| | | } |
| | | .value { |
| | | color: #666; |
| | | flex: 1; |
| | | word-break: break-all; |
| | | } |
| | | |
| | | .delete-btn { |
| | |
| | | font-size: 16px; |
| | | transition: all 0.2s; |
| | | opacity: 0.7; |
| | | margin-left: 10px; |
| | | flex-shrink: 0; |
| | | } |
| | | .barcode-item:hover .delete-btn { |
| | | opacity: 1; |
| | |
| | | color: #dcdfe6; |
| | | } |
| | | |
| | | /* èªå®ä¹è¾å
¥æ¡ */ |
| | | .custom-input :deep(.el-input__inner) { |
| | | border-radius: 6px; |
| | | border-color: #e4e7ed; |
| | |
| | | box-shadow: 0 0 0 3px rgba(64, 158, 255, 0.1); |
| | | } |
| | | |
| | | /* èªå®ä¹æé® */ |
| | | .custom-button { |
| | | border-radius: 6px; |
| | | height: 36px; |
| | |
| | | </style> |
| | | |
| | | <style> |
| | | /* å
¨å±æ ·å¼é¨åä¿æä¸å */ |
| | | .text-button:hover { |
| | | background-color: #f0f9eb !important; |
| | | } |