From 665c18b68a5dedba63e00f89f763539967fb7f08 Mon Sep 17 00:00:00 2001
From: 曹睿 <360930172@qq.com>
Date: 星期二, 03 六月 2025 16:20:36 +0800
Subject: [PATCH] feat: 拉丝添加报工,铝杆支持扫码输入

---
 src/pages/production/wire/report/wireForm.vue |  104 +++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 82 insertions(+), 22 deletions(-)

diff --git a/src/pages/production/wire/report/wireForm.vue b/src/pages/production/wire/report/wireForm.vue
index b248788..b2c4b74 100644
--- a/src/pages/production/wire/report/wireForm.vue
+++ b/src/pages/production/wire/report/wireForm.vue
@@ -6,9 +6,12 @@
         label="棰嗙敤鏉嗗彿"
         label-width="100px"
         prop="poleNumber"
-        clearable
         placeholder="璇疯緭鍏ラ鐢ㄦ潌鍙�"
-      />
+      >
+        <template #suffix>
+          <wd-icon name="scan" @click="openScan" />
+        </template>
+      </wd-input>
       <wd-input
         v-model="model.poleWeight"
         label="鏉嗛噸"
@@ -18,12 +21,12 @@
         placeholder="璇疯緭鍏ユ潌閲�"
       />
       <wd-input
-        v-model="model.monofilamentNumber"
-        label="鍗曚笣鐩樺彿"
+        v-model="model.poleModel"
+        label="鏉嗗瀷鍙�"
         label-width="100px"
-        prop="monofilamentNumber"
+        prop="poleModel"
         clearable
-        placeholder="璇疯緭鍏ユ満鍙�"
+        placeholder="璇疯緭鍏ユ潌鍨嬪彿"
       />
       <wd-input
         v-model="model.model"
@@ -34,31 +37,60 @@
         placeholder="璇疯緭鍏ヨ鏍煎瀷鍙�"
       />
       <wd-input
-        v-model="model.ontLength"
-        label="鐩橀暱"
+        v-model="model.oneLength"
+        label="鐩橀暱(m)"
         label-width="100px"
-        prop="ontLength"
+        prop="oneLength"
         clearable
         placeholder="璇疯緭鍏ョ洏闀�"
       />
       <wd-input
-        v-model="model.theoryWeight"
-        label="鐞嗚閲嶉噺"
+        v-model="model.polePackageNumber"
         label-width="100px"
-        prop="theoryWeight"
+        prop="polePackageNumber"
         clearable
-        placeholder="璇疯緭鍏ョ悊璁洪噸閲�"
-      />
+        placeholder="璇疯緭鍏ユ潌鍖呭彿"
+      >
+          <template #label>
+            <span style="color: #F56C6C">鏉嗗寘鍙�</span>
+          </template>
+      </wd-input>
+      <wd-input
+        v-model="model.dishModel"
+        label-width="100px"
+        prop="dishModel"
+        clearable
+        placeholder="璇疯緭鍏ョ洏鍨嬪彿"
+      >
+          <template #label>
+            <span style="color: #F56C6C">鐩樺瀷鍙�</span>
+          </template>
+      </wd-input>
+      <wd-input
+        v-model="model.actuallyLength"
+        label-width="100px"
+        prop="actuallyLength"
+        clearable
+        placeholder="璇疯緭鍏ュ疄闄呴暱搴�"
+      >
+          <template #label>
+            <span style="color: #F56C6C">瀹為檯闀垮害(m)</span>
+          </template>
+      </wd-input>
       <wd-input
         v-model="model.actuallyWeight"
-        label="瀹為檯閲嶉噺"
         label-width="100px"
         prop="actuallyWeight"
         clearable
         placeholder="璇疯緭鍏ュ疄闄呴噸閲�"
-      />
+      >
+          <template #label>
+            <span style="color: #F56C6C">瀹為檯閲嶉噺(kg)</span>
+          </template>
+      </wd-input>
     </wd-cell-group>
     <wd-toast />
+    <Scan ref="scanRef" />
   </wd-form>
 </template>
 
@@ -66,16 +98,21 @@
 import useFormData from "@/hooks/useFormData";
 import { useToast } from "wot-design-uni";
 import WireApi from "@/api/product/wire";
+import Scan from "@/components/scan/index.vue";
 
 const paramsId = ref();
+const scanRef = ref();
 const toast = useToast();
-const { form: model } = useFormData({
+const { form: model, resetForm } = useFormData({
   poleNumber: undefined, // 棰嗙敤鏉嗗彿
-  poleWeight: undefined, // 瀹㈡埛鍚嶇О
-  monofilamentNumber: undefined, // 鍗曚笣鐩樺彿
+  poleWeight: undefined, // 鏉嗛噸
+  poleModel: undefined, // 鏉嗗瀷鍙�
   model: undefined, // 瑙勬牸鍨嬪彿
+  polePackageNumber: undefined, // 鏉嗗寘鍙�
+  dishModel: undefined, // 鐩樺瀷鍙�
   oneLength: undefined, // 鐩橀暱
-  singleDisc: undefined, // 鍗曚笣鐩橀暱
+  actuallyLength: undefined, // 瀹為檯闀垮害
+  actuallyWeight: undefined, // 瀹為檯閲嶉噺
 });
 
 const submit = async () => {
@@ -86,6 +123,7 @@
   });
   if (code == 200) {
     toast.success("鎻愪氦鎴愬姛");
+    resetForm()
     return true;
   } else {
     toast.error("鎻愪氦澶辫触");
@@ -93,8 +131,32 @@
   }
 };
 
+const openScan = () => {
+  scanRef.value.triggerScan();
+};
+
+//  鐩戝惉鎵爜
+const getScanCode = (code: any) => {
+  console.log("鑷畾涔夋壂鎻忕殑缁撴灉鍥炶皟鍑芥暟:", code.code);
+  // console.log("鑷畾涔夋壂鎻忕殑缁撴灉鍥炶皟鍑芥暟", JSON.parse(code));
+  const arr = code.code.split(",");
+  model.poleNumber = arr[3]; //  棰嗙敤鏉嗗彿
+  model.poleWeight = arr[4]; //  鏉嗛噸
+  model.poleModel = '桅' + arr[1].slice(2); //  鏉嗗瀷鍙�
+};
+
 onLoad((options: any) => {
   paramsId.value = options.id;
+  model.model = options.model;
+  console.log("options", options);
+  model.oneLength = options.oneLength;
+  // 寮�鍚箍鎾洃鍚簨浠�
+  uni.$on("scan", getScanCode);
+});
+
+onUnload(() => {
+  // 寮�鍚箍鎾洃鍚簨浠�
+  uni.$off("scan", getScanCode);
 });
 
 defineExpose({
@@ -103,8 +165,6 @@
 </script>
 
 <style lang="scss" scoped>
-.form_box {
-}
 .submit_btn {
   position: absolute;
   bottom: 0;

--
Gitblit v1.9.3