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/wire.vue | 43 +++++++++---- src/pages/login/index.vue | 2 src/pages/production/twist/report/index.vue | 4 src/pages/production/wire/selfInspect/index.vue | 2 src/pages/production/twist/receive/monofil.vue | 2 src/pages/production/wire/receive/index.vue | 4 + src/pages/production/detail/wireDetail.vue | 8 +- src/pages/production/twist/report/form.vue | 2 src/pages/production/wire/report/wireForm.vue | 104 +++++++++++++++++++++++++++------- 9 files changed, 125 insertions(+), 46 deletions(-) diff --git a/src/pages/login/index.vue b/src/pages/login/index.vue index a2982bc..ffc4bf1 100644 --- a/src/pages/login/index.vue +++ b/src/pages/login/index.vue @@ -96,7 +96,7 @@ // 鐧诲綍琛ㄥ崟鏁版嵁 const loginFormData = ref<LoginFormData>({ - username: "31601016", + username: "32408083", // username: "32308027", password: "cxjt1234", }); diff --git a/src/pages/production/detail/wireDetail.vue b/src/pages/production/detail/wireDetail.vue index 19abcd5..305e6e0 100644 --- a/src/pages/production/detail/wireDetail.vue +++ b/src/pages/production/detail/wireDetail.vue @@ -15,7 +15,7 @@ <wd-grid-item icon="computer" link-type="navigateTo" - :url="`/pages/production/wire/report/wire?id=${paramsId}`" + :url="`/pages/production/wire/report/wire?id=${paramsId}&model=${cardData.model}&oneLength=${cardData.oneLength}`" text="鎶ュ伐" /> <!-- <wd-grid-item @@ -30,12 +30,12 @@ :url="`/pages/production/wire/backman/index?id=${paramsId}`" text="鏉傚伐" /> - <wd-grid-item + <!-- <wd-grid-item icon="wallet" link-type="navigateTo" url="/pages/production/wire/receive/index" text="鏉愭枡棰嗙敤" - /> + /> --> </wd-grid> </view> </view> @@ -53,6 +53,7 @@ totalAmount: undefined, amount: undefined, unAmount: undefined, + oneLength: undefined, }); const getDetailData = async (id: string) => { @@ -64,6 +65,7 @@ cardData.totalAmount = data.totalAmount; cardData.amount = data.amount; cardData.unAmount = data.unAmount; + cardData.oneLength = data.oneLength; }; onLoad((options: any) => { diff --git a/src/pages/production/twist/receive/monofil.vue b/src/pages/production/twist/receive/monofil.vue index 4abc5bc..d6bd8ce 100644 --- a/src/pages/production/twist/receive/monofil.vue +++ b/src/pages/production/twist/receive/monofil.vue @@ -47,7 +47,7 @@ const toast = useToast(); const getScanCode = async (code: any) => { - // console.log("鑷畾涔夋壂鎻忕殑缁撴灉鍥炶皟鍑芥暟:", code); + console.log("鑷畾涔夋壂鎻忕殑缁撴灉鍥炶皟鍑芥暟:", code); // let parseData = code.trim(); console.log("code:===========", JSON.parse(code.code)); console.log("id:=============", JSON.parse(code.code).id); diff --git a/src/pages/production/twist/report/form.vue b/src/pages/production/twist/report/form.vue index b03ee0b..2047d38 100644 --- a/src/pages/production/twist/report/form.vue +++ b/src/pages/production/twist/report/form.vue @@ -73,7 +73,7 @@ poleWeight: undefined, // 鏉嗛噸(kg) monofilamentNumber: undefined, // 鍗曚笣鐩樺彿 actuallyWeight: undefined, // 瀹為檯閲嶉噺(kg) - ontLength: undefined, // 鐩橀暱(m) + oneLength: undefined, // 鐩橀暱(m) theoryWeight: undefined, // 鐞嗚閲嶉噺(kg) model: undefined, // 瑙勬牸鍨嬪彿 }); diff --git a/src/pages/production/twist/report/index.vue b/src/pages/production/twist/report/index.vue index a0383eb..62df4ae 100644 --- a/src/pages/production/twist/report/index.vue +++ b/src/pages/production/twist/report/index.vue @@ -67,7 +67,7 @@ }, { label: "鐩橀暱(m)", - prop: "ontLength", + prop: "oneLength", }, { label: "鐞嗚閲嶉噺(kg)", @@ -122,7 +122,7 @@ <style lang="scss" scoped> .list { - height: calc(100vh - 120px); + height: calc(100vh - 80px); padding: 12px; background: #f3f9f8; diff --git a/src/pages/production/wire/receive/index.vue b/src/pages/production/wire/receive/index.vue index 64327e1..2148afe 100644 --- a/src/pages/production/wire/receive/index.vue +++ b/src/pages/production/wire/receive/index.vue @@ -1,7 +1,9 @@ <template> <view class="page pt-2"> - <CardTitle title="鎷変笣棰嗙敤" :hideAction="true" @action="addReport" /> <z-paging ref="paging" refresher-only class="list"> + <template #top> + <CardTitle title="鎷変笣棰嗙敤" :hideAction="true" @action="addReport" /> + </template> <wd-card type="rectangle" custom-class="round"> <template #title> <view class="flex justify-between"> diff --git a/src/pages/production/wire/report/wire.vue b/src/pages/production/wire/report/wire.vue index 3a129dc..76db8fb 100644 --- a/src/pages/production/wire/report/wire.vue +++ b/src/pages/production/wire/report/wire.vue @@ -17,7 +17,7 @@ <text class="text-[#0D867F] ml-2 font-medium">鐢熶骇浜�</text> <text class="text-[#333333] ml-2">{{ item.productUser }}</text> </view> - <view class="text-[#A8A8A8]" @click="toEdit">缂栬緫</view> + <!-- <view class="text-[#A8A8A8]" @click="toEdit">缂栬緫</view> --> </view> </template> <ProductionCard :data="cardAttr" :value="item" /> @@ -57,26 +57,40 @@ { label: "棰嗙敤鏉嗗彿", prop: "poleNumber", + span: 24, + }, + { + label: "鍗曚笣鐩樺彿", + prop: "monofilamentNumber", + span: 24, + }, + { + label: "鏉嗗瀷鍙�", + prop: "poleModel", + }, + { + label: "鏉嗗寘鍙�", + prop: "polePackageNumber", }, { label: "鏉嗛噸(kg)", prop: "poleWeight", }, { - label: "鍗曚笣鐩樺彿", - prop: "monofilamentNumber", - }, - { label: "瑙勬牸鍨嬪彿", prop: "model", + }, + { + label: "鐩樺瀷鍙�", + prop: "dishModel", }, { label: "鐩橀暱(m)", prop: "oneLength", }, { - label: "鐞嗚閲嶉噺(kg)", - prop: "theoryWeight", + label: "瀹為檯闀垮害", + prop: "actuallyLength", }, { label: "瀹為檯閲嶉噺(kg)", @@ -86,18 +100,19 @@ const wireReportList = ref<any[]>([]); -const toEdit = () => { - uni.navigateTo({ - url: "/pages/production/wire/report/wireEdit", - }); -}; +// const toEdit = () => { +// uni.navigateTo({ +// url: "/pages/production/wire/report/wireEdit", +// }); +// }; const addReport = () => { dialog.visible = true; }; const submit = () => { - dialog.visible = wireFormRef.value.submit(); + dialog.visible = !wireFormRef.value.submit(); + pagingRef.value.reload(); }; const cancel = () => { @@ -127,7 +142,7 @@ <style lang="scss" scoped> .list { - height: calc(100vh - 120px); + height: calc(100vh - 30px); padding: 12px; background: #f3f9f8; 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; diff --git a/src/pages/production/wire/selfInspect/index.vue b/src/pages/production/wire/selfInspect/index.vue index bbd9cb9..37f3733 100644 --- a/src/pages/production/wire/selfInspect/index.vue +++ b/src/pages/production/wire/selfInspect/index.vue @@ -96,7 +96,7 @@ <style lang="scss" scoped> .list { - height: calc(100vh - 120px); + height: calc(100vh - 30px); padding: 12px; background: #f3f9f8; -- Gitblit v1.9.3