From aca7aa9ce32acc4c8795342f945b027d3bc9f62a Mon Sep 17 00:00:00 2001
From: 曹睿 <360930172@qq.com>
Date: 星期二, 10 六月 2025 17:37:34 +0800
Subject: [PATCH] feat: 添加时效报工,修复扫码内存泄漏
---
src/pages/production/wire/report/wireForm.vue | 166 +++++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 131 insertions(+), 35 deletions(-)
diff --git a/src/pages/production/wire/report/wireForm.vue b/src/pages/production/wire/report/wireForm.vue
index 52d7823..f4e71f6 100644
--- a/src/pages/production/wire/report/wireForm.vue
+++ b/src/pages/production/wire/report/wireForm.vue
@@ -2,73 +2,169 @@
<wd-form ref="form" :model="model" class="relative form_box">
<wd-cell-group :border="true">
<wd-input
- v-model="model.contractNo"
- label="鍚堝悓鍙�"
+ v-model="model.poleNumber"
+ label="棰嗙敤鏉嗗彿"
label-width="100px"
- prop="contractNo"
+ prop="poleNumber"
+ placeholder="璇疯緭鍏ラ鐢ㄦ潌鍙�"
+ >
+ <template #suffix>
+ <wd-icon name="scan" @click="openScan" />
+ </template>
+ </wd-input>
+ <wd-input
+ v-model="model.poleWeight"
+ label="鏉嗛噸"
+ label-width="100px"
+ prop="poleWeight"
clearable
- placeholder="璇疯緭鍏ュ悎鍚屽彿"
+ placeholder="璇疯緭鍏ユ潌閲�"
/>
<wd-input
- v-model="model.clientName"
- label="瀹㈡埛鍚嶇О"
+ v-model="model.poleModel"
+ label="鏉嗗瀷鍙�"
label-width="100px"
- prop="clientName"
+ prop="poleModel"
clearable
- placeholder="璇疯緭鍏ュ鎴峰悕绉�"
+ placeholder="璇疯緭鍏ユ潌鍨嬪彿"
/>
<wd-input
- v-model="model.workbench"
- label="鏈哄彴"
+ v-model="model.model"
+ label="瑙勬牸鍨嬪彿"
label-width="100px"
- prop="workbench"
+ prop="model"
clearable
- placeholder="璇疯緭鍏ユ満鍙�"
+ placeholder="璇疯緭鍏ヨ鏍煎瀷鍙�"
/>
<wd-input
- v-model="model.monofilNo"
- label="鍗曚綋缂栧彿"
+ v-model="model.oneLength"
+ label="鐩橀暱(m)"
label-width="100px"
- prop="monofilNo"
+ prop="oneLength"
clearable
- placeholder="璇疯緭鍏ュ崟浣撶紪鍙�"
+ placeholder="璇疯緭鍏ョ洏闀�"
/>
<wd-input
- v-model="model.specification"
- label="瑙勬牸"
+ v-model="model.polePackageNumber"
label-width="100px"
- prop="specification"
+ prop="polePackageNumber"
clearable
- placeholder="璇疯緭鍏ヨ鏍�"
- />
+ placeholder="璇疯緭鍏ユ潌鍖呭彿"
+ >
+ <template #label>
+ <span style="color: #f56c6c">鏉嗗寘鍙�</span>
+ </template>
+ </wd-input>
<wd-input
- v-model="model.singleDisc"
- label="鍗曚笣鐩橀暱"
+ v-model="model.dishModel"
label-width="100px"
- prop="singleDisc"
+ prop="dishModel"
clearable
- placeholder="璇疯緭鍏ュ崟涓濈洏闀�"
- />
+ 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-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>
<script lang="ts" setup>
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 { form: model } = useFormData({
- contractNo: undefined, // 鍚堝悓鍙�
- clientName: undefined, // 瀹㈡埛鍚嶇О
- workbench: undefined, // 鏈哄彴
- monofilNo: undefined, // 鍗曚綋缂栧彿
- specification: undefined, // 瑙勬牸
- singleDisc: undefined, // 鍗曚笣鐩橀暱
+const paramsId = ref();
+const scanRef = ref();
+const toast = useToast();
+const { form: model, resetForm } = useFormData({
+ poleNumber: undefined, // 棰嗙敤鏉嗗彿
+ poleWeight: undefined, // 鏉嗛噸
+ poleModel: undefined, // 鏉嗗瀷鍙�
+ model: undefined, // 瑙勬牸鍨嬪彿
+ polePackageNumber: undefined, // 鏉嗗寘鍙�
+ dishModel: undefined, // 鐩樺瀷鍙�
+ oneLength: undefined, // 鐩橀暱
+ actuallyLength: undefined, // 瀹為檯闀垮害
+ actuallyWeight: undefined, // 瀹為檯閲嶉噺
+});
+
+const submit = async () => {
+ const { code } = await WireApi.addWireOutput({
+ wireId: paramsId.value,
+ type: "鎷変笣",
+ ...model,
+ });
+ if (code == 200) {
+ toast.success("鎻愪氦鎴愬姛");
+ resetForm();
+ return true;
+ } else {
+ toast.error("鎻愪氦澶辫触");
+ return false;
+ }
+};
+
+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[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({
+ submit,
});
</script>
<style lang="scss" scoped>
-.form_box {
-}
.submit_btn {
position: absolute;
bottom: 0;
--
Gitblit v1.9.3