From 027b75833ae1bc3bd1bb597b18c65c9177fa62d4 Mon Sep 17 00:00:00 2001
From: yangpeixing <yangpeixing@hnkhzn.com>
Date: 星期三, 17 十二月 2025 12:10:18 +0800
Subject: [PATCH] 1.WMS中添加自动打印开关

---
 项目代码/WMS/WIDESEA_WMSClient/src/views/widesea_wms/Order/InboundOrder.vue |   74 +++++++++++++++++++++++++++++++-----
 1 files changed, 63 insertions(+), 11 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSClient/src/views/widesea_wms/Order/InboundOrder.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSClient/src/views/widesea_wms/Order/InboundOrder.vue"
index 0d5f22b..1ee9241 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSClient/src/views/widesea_wms/Order/InboundOrder.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSClient/src/views/widesea_wms/Order/InboundOrder.vue"
@@ -5,13 +5,19 @@
  *涓氬姟璇峰湪@/extension/widesea_wms/taskinfo/Dt_Task.js姝ゅ缂栧啓
  -->
 <template>
+    <div class="switch">
+        <span class="switchTitle">鑷姩鎵撳嵃</span>
+        <el-switch v-model="value1" @change="handleSwitchChange" />
+    </div>
     <view-grid ref="grid" :columns="columns" :detail="detail" :editFormFields="editFormFields"
         :editFormOptions="editFormOptions" :searchFormFields="searchFormFields" :searchFormOptions="searchFormOptions"
         :table="table" :extend="extend" />
 </template>
 <script>
+import http from "@/api/http";
 import extend from "@/extension/widesea_wms/Order/InboundOrder.js";
-import { ref, defineComponent } from "vue";
+import { ref, defineComponent, onMounted } from "vue"; // 鏂板 onMounted
+
 export default defineComponent({
     setup() {
         const table = ref({
@@ -20,10 +26,9 @@
             cnName: '鍏ュ簱鍗曟嵁',
             name: '',
             url: "/InboundOrder/",
-            sortName: ""
+            sortName: "upperOrderNo"
         });
         const editFormFields = ref({
-            // id: "",
             orderNo: "",
             upperOrderNo: "",
             materialNo: "",
@@ -44,16 +49,13 @@
                 { "title": "鏁伴噺", "field": "quantity", "type": "text" },
             ],
         ]);
-        const searchFormFields = ref({
-
-        });
+        const searchFormFields = ref({});
         const searchFormOptions = ref([
             [
                 { "title": "璁㈠崟缂栧彿", "field": "orderNo", "type": "text" },
                 { "title": "涓婃父鍗曞彿", "field": "upperOrderNo", "type": "text" },
                 { "title": "闇�姹傚垎绫�", "field": "demandClassification", "type": "text" },
-                { "title": "鍗曟嵁绫诲瀷", "field": "orderType", "type": "text" },
-
+                { "title": "鍗曟嵁绫诲瀷", "field": "orderType", "type": "select", dataKey: "orderTypeEmun", data: [] },
             ],
             [
                 { "title": "鐗╂枡缂栫爜", "field": "materialNo", type: "text" },
@@ -75,9 +77,8 @@
             { field: 'materialName', title: '鐗╂枡鍚嶇О', type: 'string', width: 180, align: 'left' },
             { field: 'quantity', title: '鏁伴噺', type: 'string', width: 90, align: 'left' },
             { field: 'demandClassification', title: '闇�姹傚垎绫�', type: 'string', width: 180, align: 'left' },
-            { field: 'orderType', title: '鍗曟嵁绫诲瀷', type: 'string', width: 110, align: 'left' },
+            { field: 'orderType', title: '鍗曟嵁绫诲瀷', type: 'string', width: 110, align: 'left', bind: { key: "orderTypeEmun", data: [] } },
             { field: 'wareHouseId', title: '浠撳簱', type: 'string', width: 120, align: 'left', bind: { key: "WareAreaTypeEnable", data: [] } },
-            // { field: 'warehouseName', title: '浠撳簱鍚嶇О', type: 'string', width: 120, align: 'left' },
             { field: 'datetime', title: '鏃堕棿', type: 'string', width: 180, align: 'left' },
             { field: 'lineNumber', title: '琛屽彿', type: 'string', width: 90, align: 'left' },
             { field: 'productDrawingNumber', title: '鍥惧彿', type: 'string', width: 180, align: 'left' },
@@ -98,6 +99,41 @@
             sortName: "",
             key: ""
         });
+
+        // 瀹氫箟寮�鍏崇姸鎬�
+        const value1 = ref(false);
+
+        const getAutomaticPrintStatus = async () => {
+            try {
+                // 璇锋眰鍚庣鎺ュ彛鑾峰彇褰撳墠鐘舵��
+                const res = await http.get(`/api/InboundOrder/GetAutomaticPrint`);
+                // 鍒濆鍖栧紑鍏冲��
+                if (res !== undefined) {
+                    value1.value = res;
+                }
+                console.log("鑷姩鎵撳嵃鐘舵�佸垵濮嬪寲瀹屾垚锛�", value1.value);
+            } catch (error) {
+                console.error("鑾峰彇鑷姩鎵撳嵃鐘舵�佸け璐ワ細", error);
+                // 寮傚父鏃堕粯璁ゅ叧闂�
+                value1.value = false;
+            }
+        };
+
+        onMounted(() => {
+            getAutomaticPrintStatus(); 
+        });
+
+        const handleSwitchChange = async (val) => {
+            try {
+                await http.get(`/api/InboundOrder/AutomaticPrint?AutomaticPrintStatus=${val}`);
+                console.log("鑷姩鎵撳嵃鐘舵�佸凡淇敼涓猴細", val);
+            } catch (error) {
+                console.error("淇敼鑷姩鎵撳嵃鐘舵�佸け璐ワ細", error);
+                // 澶辫触鏃跺洖婊氬紑鍏崇姸鎬�
+                value1.value = !val;
+            }
+        };
+
         return {
             table,
             extend,
@@ -107,7 +143,23 @@
             searchFormOptions,
             columns,
             detail,
+            value1, // 鏆撮湶寮�鍏崇姸鎬�
+            handleSwitchChange // 鏆撮湶鏂规硶
         };
-    },
+    }
 });
 </script>
+<style>
+.switch {
+    text-align: center;
+    position: fixed;
+    top: 7.1rem;
+    left: 54rem;
+    z-index: 9999;
+}
+
+.switchTitle {
+    font-size: 15px;
+    margin-left: 20px;
+}
+</style>

--
Gitblit v1.9.3