From 78c565e37520fad100693c4e298e30e7c916d1bb Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期二, 28 十月 2025 16:21:40 +0800
Subject: [PATCH] fix: 领用二维码异常提示,原材料自检重构
---
src/pages/production/wire/report/wire.vue | 2
src/pages/production/twist/report/index.vue | 33 +
src/pages/production/twist/receive/plate/index.vue | 75 ++
src/pages/production/twist/receive/monofil.vue | 82 ++-
src/pages/production/wire/report/rawMaterial.vue | 4
src/pages/production/twist/receive/plate/form.vue | 155 +++++++
src/manifest.json | 2
src/pages/production/twist/receive/plate/edit.vue | 40 +
src/pages/production/twist/receive/steelCore/index.vue | 111 +++--
src/pages/production/twist/report/draw.vue | 587 ++++++++++++++++++++--------
src/pages/production/twist/receive/steelCore/form.vue | 56 ++
11 files changed, 836 insertions(+), 311 deletions(-)
diff --git a/src/manifest.json b/src/manifest.json
index eafd708..280f32b 100644
--- a/src/manifest.json
+++ b/src/manifest.json
@@ -2,7 +2,7 @@
"name" : "绾跨紗涓婃姤",
"appid" : "__UNI__F64E0A4",
"description" : "",
- "versionName" : "1.0.8",
+ "versionName" : "1.0.12",
"versionCode" : "100",
"transformPx" : false,
/* 5+App鐗规湁鐩稿叧 */
diff --git a/src/pages/production/twist/receive/monofil.vue b/src/pages/production/twist/receive/monofil.vue
index ed89446..1c7a03e 100644
--- a/src/pages/production/twist/receive/monofil.vue
+++ b/src/pages/production/twist/receive/monofil.vue
@@ -109,48 +109,52 @@
// let parseData = code.trim();
console.log("code:===========", JSON.parse(code.code));
console.log("id:=============", JSON.parse(code.code).id);
- const { data } = await TwistApi.getScarn({
- outPutId: JSON.parse(code.code).id,
- });
+ try {
+ const { data } = await TwistApi.getScarn({
+ outPutId: JSON.parse(code.code).id,
+ });
- // 妫�鏌ユ槸鍚﹀凡閫夋嫨鏍囩
- if (!tab.value) {
- toast.error("璇峰厛閫夋嫨涓�涓眰");
- return;
- }
-
- // 鎵惧埌褰撳墠閫変腑鐨勫眰
- console.log("tab.value:===========2", tab.value);
- const currentLayer = nodeList.value.find((node) => node.twistedLayer === tab.value);
- if (!currentLayer) {
- toast.error("鏈壘鍒板綋鍓嶉�変腑鐨勫眰");
- return;
- }
-
- // 妫�鏌ュ綋鍓嶅眰鏄惁宸插瓨鍦ㄨ鍗曚笣
- const exists = currentLayer.strandedWireDish?.some(
- (item: any) => item.monofilamentNumber === data.monofilamentNumber
- );
- if (!exists) {
- const { id, outPutId, wireId, oneLength, ...rest } = data;
- const newItem = {
- wireId: paramsId.value,
- outputId: id,
- amount: oneLength,
- ongLength: oneLength,
- ...rest,
- };
-
- // 娣诲姞鍒板綋鍓嶅眰鐨� strandedWireDish 涓�
- if (!currentLayer.strandedWireDish) {
- currentLayer.strandedWireDish = [];
+ // 妫�鏌ユ槸鍚﹀凡閫夋嫨鏍囩
+ if (!tab.value) {
+ toast.error("璇峰厛閫夋嫨涓�涓眰");
+ return;
}
- currentLayer.strandedWireDish.push(newItem);
- // 鍒锋柊褰撳墠灞傜殑鏁版嵁鏄剧ず
- getList();
- } else {
- toast.error("璇ュ崟涓濆凡棰嗙敤锛岃鍕块噸澶嶆壂鐮�");
+ // 鎵惧埌褰撳墠閫変腑鐨勫眰
+ console.log("tab.value:===========2", tab.value);
+ const currentLayer = nodeList.value.find((node) => node.twistedLayer === tab.value);
+ if (!currentLayer) {
+ toast.error("鏈壘鍒板綋鍓嶉�変腑鐨勫眰");
+ return;
+ }
+
+ // 妫�鏌ュ綋鍓嶅眰鏄惁宸插瓨鍦ㄨ鍗曚笣
+ const exists = currentLayer.strandedWireDish?.some(
+ (item: any) => item.monofilamentNumber === data.monofilamentNumber
+ );
+ if (!exists) {
+ const { id, outPutId, wireId, oneLength, ...rest } = data;
+ const newItem = {
+ wireId: paramsId.value,
+ outputId: id,
+ amount: oneLength,
+ ongLength: oneLength,
+ ...rest,
+ };
+
+ // 娣诲姞鍒板綋鍓嶅眰鐨� strandedWireDish 涓�
+ if (!currentLayer.strandedWireDish) {
+ currentLayer.strandedWireDish = [];
+ }
+ currentLayer.strandedWireDish.push(newItem);
+
+ // 鍒锋柊褰撳墠灞傜殑鏁版嵁鏄剧ず
+ getList();
+ } else {
+ toast.error("璇ュ崟涓濆凡棰嗙敤锛岃鍕块噸澶嶆壂鐮�");
+ }
+ } catch (error) {
+ toast.error("浜岀淮鐮佸紓甯革紝璇锋洿鎹簩缁寸爜锛�");
}
};
diff --git a/src/pages/production/twist/receive/plate/edit.vue b/src/pages/production/twist/receive/plate/edit.vue
index da1ad01..f4ce69a 100644
--- a/src/pages/production/twist/receive/plate/edit.vue
+++ b/src/pages/production/twist/receive/plate/edit.vue
@@ -1,7 +1,7 @@
<template>
<view>
<CardTitle title="缁炵嚎鐩樺叿棰嗙敤" :hideAction="false" />
- <PlateForm class="mx-4" />
+ <PlateForm ref="formRef" class="mx-4" />
<view class="footer">
<wd-button
class="submit_btn"
@@ -15,12 +15,48 @@
</wd-button>
</view>
</view>
+ <wd-toast />
</template>
<script lang="ts" setup>
import CardTitle from "@/components/card-title/index.vue";
import PlateForm from "./form.vue";
+import { useToast } from "wot-design-uni";
+import { onLoad, onUnload } from "@dcloudio/uni-app";
-const handleSubmit = () => {};
+const formRef = ref();
+const toast = useToast();
+
+const handleSubmit = async () => {
+ const success = await formRef.value.submitEdit();
+ if (success) {
+ setTimeout(() => {
+ uni.navigateBack();
+ }, 500);
+ }
+};
+
+// 鎺ユ敹鍒楄〃椤典紶閫掔殑鏁版嵁
+const receiveEditData = (data: any) => {
+ console.log("receiveEditData 鎺ユ敹鍒扮殑鏁版嵁:", data);
+ if (data && formRef.value) {
+ // 纭繚 list 鍜� editId 閮藉瓨鍦�
+ if (data.list && data.editId) {
+ formRef.value.setFormData(data.list, data.editId);
+ } else {
+ console.error("鏁版嵁鏍煎紡閿欒:", data);
+ }
+ }
+};
+
+onLoad((options: any) => {
+ // 鐩戝惉鏁版嵁浼犻�掍簨浠�
+ uni.$on("plateEditData", receiveEditData);
+});
+
+onUnload(() => {
+ // 椤甸潰鍗歌浇鏃剁Щ闄ょ洃鍚�
+ uni.$off("plateEditData", receiveEditData);
+});
</script>
<style lang="scss" scoped>
.footer {
diff --git a/src/pages/production/twist/receive/plate/form.vue b/src/pages/production/twist/receive/plate/form.vue
index 8358eba..032e5b0 100644
--- a/src/pages/production/twist/receive/plate/form.vue
+++ b/src/pages/production/twist/receive/plate/form.vue
@@ -1,13 +1,15 @@
<template>
<wd-form ref="form" :model="model" class="relative form_box">
<wd-cell-group :border="true">
- <wd-input
- v-model="model.diskMaterial"
+ <wd-picker
+ v-model="diskMaterialValue"
+ :columns="diskMaterialOptions"
label="鐩樺叿绫诲瀷"
label-width="100px"
prop="diskMaterial"
+ placeholder="璇烽�夋嫨鐩樺叿绫诲瀷"
clearable
- placeholder="璇疯緭鍏ョ洏鍏风被鍨�"
+ @confirm="handleDiskMaterialChange"
/>
<wd-input
v-model="model.model"
@@ -41,7 +43,19 @@
<script setup lang="ts">
import useFormData from "@/hooks/useFormData";
import TwistApi from "@/api/product/twist";
+import ManageApi from "@/api/product/manage";
import { useToast } from "wot-design-uni";
+
+const props = defineProps({
+ mode: {
+ type: String,
+ default: "add",
+ },
+ editData: {
+ type: Object,
+ default: null,
+ },
+});
const emits = defineEmits(["refresh"]);
const paramsId = ref();
@@ -53,6 +67,43 @@
supplier: undefined,
type: "鐩樺叿",
});
+
+// 鐢ㄤ簬缂栬緫鏃跺瓨鍌ㄥ畬鏁村垪琛ㄦ暟鎹拰褰撳墠缂栬緫ID
+const allListData = ref<any[]>([]);
+const editId = ref<number>();
+
+// 鐩樺叿绫诲瀷瀛楀吀鏁版嵁
+const diskMaterialOptions = ref<Array<{ label: string; value: string }>>([]);
+const diskMaterialValue = ref("");
+
+// 鍔犺浇鐩樺叿绫诲瀷瀛楀吀鏁版嵁
+const loadDiskMaterialDict = async () => {
+ try {
+ const res = await ManageApi.dictAPI("disk_material");
+ if (res.data && Array.isArray(res.data)) {
+ diskMaterialOptions.value = res.data.map((item: any) => ({
+ label: item.dictLabel || "",
+ value: item.dictValue || "",
+ }));
+ }
+ } catch (error) {
+ console.error("鍔犺浇鐩樺叿绫诲瀷瀛楀吀澶辫触:", error);
+ }
+};
+
+// 澶勭悊鐩樺叿绫诲瀷閫夋嫨
+const handleDiskMaterialChange = (val: any) => {
+ model.diskMaterial = val.value;
+};
+
+// 鐩戝惉 model.diskMaterial 鍙樺寲锛屽悓姝ラ�夋嫨鍣ㄦ樉绀�
+watch(
+ () => model.diskMaterial,
+ (newValue) => {
+ diskMaterialValue.value = newValue || "";
+ },
+ { immediate: true }
+);
const submit = async () => {
const { code } = await TwistApi.addStrandedWireDish([
@@ -66,19 +117,113 @@
emits("refresh");
return true;
}
+ return false;
+};
+
+// 缂栬緫鎻愪氦锛堜篃璧版柊澧炴帴鍙o紝鎻愪氦鏁翠釜鍒楄〃锛�
+const submitEdit = async (list?: any[], id?: number) => {
+ const currentList = list || allListData.value;
+ const currentId = id || editId.value;
+
+ if (!currentId) {
+ toast.error("缂哄皯璁板綍ID");
+ return false;
+ }
+
+ // 鏇存柊鍒楄〃涓搴旂殑鏁版嵁椤�
+ const updatedList = currentList.map((item) => {
+ if (item.id === currentId) {
+ // 淇濈暀鍘熸湁鏁版嵁锛岀劧鍚庢洿鏂颁慨鏀圭殑瀛楁
+ const updatedItem = {
+ ...item, // 鍏堜繚鐣欏師鏈夌殑鎵�鏈夋暟鎹�
+ diskMaterial: model.diskMaterial,
+ model: model.model,
+ amount: model.amount,
+ supplier: model.supplier,
+ type: model.type,
+ };
+ return updatedItem;
+ }
+ return item;
+ });
+
+ // 鎻愪氦鏁翠釜鍒楄〃
+ const { code } = await TwistApi.addStrandedWireDish(updatedList);
+
+ if (code == 200) {
+ toast.success("鏇存柊鎴愬姛");
+ return true;
+ }
+ return false;
+};
+
+// 璁剧疆琛ㄥ崟鏁版嵁锛堢敤浜庣紪杈戞椂鍥炴樉锛�
+const setFormData = (list: any[], currentEditId: number) => {
+ // 瀹夊叏妫�鏌ワ細纭繚list鏄暟缁�
+ if (!Array.isArray(list)) {
+ console.error("setFormData: list 鍙傛暟涓嶆槸鏁扮粍", list);
+ return;
+ }
+
+ // 瀛樺偍瀹屾暣鍒楄〃鏁版嵁
+ allListData.value = list;
+ editId.value = currentEditId;
+
+ // 鎵惧埌褰撳墠缂栬緫椤瑰苟鍥炴樉鍒拌〃鍗�
+ const currentItem = list.find((item) => item.id === currentEditId);
+ if (currentItem) {
+ model.diskMaterial = currentItem.diskMaterial;
+ model.model = currentItem.model;
+ model.amount = currentItem.amount;
+ model.supplier = currentItem.supplier;
+ model.type = currentItem.type || "鐩樺叿";
+ // 璁剧疆鐩樺叿绫诲瀷鐨勫洖鏄惧��
+ diskMaterialValue.value = currentItem.diskMaterial || "";
+ }
};
onLoad((options: any) => {
paramsId.value = options.id;
});
+onMounted(async () => {
+ await loadDiskMaterialDict();
+});
+
+// 鐩戝惉缂栬緫鏁版嵁鍙樺寲锛岃嚜鍔ㄥ洖鏄�
+watch(
+ () => props.editData,
+ (newData) => {
+ if (newData && props.mode === "edit") {
+ model.diskMaterial = newData.diskMaterial || "";
+ model.model = newData.model || "";
+ model.amount = newData.amount || "";
+ model.supplier = newData.supplier || "";
+ model.type = newData.type || "鐩樺叿";
+ diskMaterialValue.value = newData.diskMaterial || "";
+ }
+ },
+ { immediate: true, deep: true }
+);
+
+// 閲嶇疆琛ㄥ崟鏁版嵁
+const resetFormData = () => {
+ model.diskMaterial = undefined;
+ model.model = undefined;
+ model.amount = undefined;
+ model.supplier = undefined;
+ model.type = "鐩樺叿";
+ diskMaterialValue.value = "";
+};
+
defineExpose({
submit,
+ submitEdit,
+ setFormData,
+ resetFormData,
});
</script>
<style lang="scss" scoped>
-.form_box {
-}
.submit_btn {
position: absolute;
bottom: 0;
diff --git a/src/pages/production/twist/receive/plate/index.vue b/src/pages/production/twist/receive/plate/index.vue
index 128db14..222205a 100644
--- a/src/pages/production/twist/receive/plate/index.vue
+++ b/src/pages/production/twist/receive/plate/index.vue
@@ -23,12 +23,24 @@
<ProductionCard :data="cardAttr" :value="item" color="#0D867F" />
</wd-card>
</z-paging>
- <wd-popup v-model="dialog.visible" position="bottom" custom-class="yl-popup">
+ <wd-popup v-model="addDialog.visible" position="bottom" custom-class="yl-popup">
<view class="action px-3">
- <wd-button type="text" @click="cancel">鍙栨秷</wd-button>
- <wd-button type="text" @click="submit">纭畾</wd-button>
+ <wd-button type="text" @click="cancelAdd">鍙栨秷</wd-button>
+ <wd-button type="text" @click="submitAdd">纭畾</wd-button>
</view>
- <PlateForm ref="plateFormRef" @refresh="reloadList" />
+ <PlateForm ref="addFormRef" mode="add" @refresh="reloadList" />
+ </wd-popup>
+ <wd-popup v-model="editDialog.visible" position="bottom" custom-class="yl-popup">
+ <view class="action px-3">
+ <wd-button type="text" @click="cancelEdit">鍙栨秷</wd-button>
+ <wd-button type="text" @click="submitEdit">纭畾</wd-button>
+ </view>
+ <PlateForm
+ ref="editFormRef"
+ mode="edit"
+ :editData="editDialog.currentItem"
+ @refresh="reloadList"
+ />
</wd-popup>
<wd-toast />
</view>
@@ -39,16 +51,22 @@
import ProductionCard from "../../../components/ProductionCard.vue";
import { useToast } from "wot-design-uni";
import PlateForm from "./form.vue";
-import { onLoad } from "@dcloudio/uni-app";
+import { onLoad, onShow } from "@dcloudio/uni-app";
import ManageApi from "@/api/product/manage";
import zPaging from "@/components/z-paging/z-paging.vue";
const paramsId = ref();
const pagingRef = ref();
-const plateFormRef = ref();
+const addFormRef = ref();
+const editFormRef = ref();
const toast = useToast();
-const dialog = reactive({
+const addDialog = reactive({
visible: false,
+});
+const editDialog = reactive({
+ visible: false,
+ currentItem: null as any,
+ editId: undefined as number | undefined,
});
const cardList = ref<any[]>([]);
@@ -66,7 +84,6 @@
label: "鏁伴噺",
prop: "amount",
},
- {},
{
label: "鍘傚",
prop: "supplier",
@@ -75,23 +92,49 @@
]);
const toEdit = (id: number) => {
- uni.navigateTo({
- url: `/pages/production/twist/receive/plate/edit?id=${id}`,
- });
+ // 鎵惧埌闇�瑕佺紪杈戠殑椤�
+ const itemToEdit = cardList.value.find((item) => item.id === id);
+ if (itemToEdit) {
+ editDialog.currentItem = itemToEdit;
+ editDialog.editId = id;
+ editDialog.visible = true;
+ }
};
const addReport = () => {
- dialog.visible = true;
+ // 閲嶇疆琛ㄥ崟鏁版嵁
+ if (addFormRef.value) {
+ addFormRef.value.resetFormData();
+ }
+ addDialog.visible = true;
};
-const submit = async () => {
+const submitAdd = async () => {
toast.show("鎻愪氦");
- dialog.visible = !(await plateFormRef.value.submit());
+ const success = await addFormRef.value.submit();
+ if (success) {
+ addDialog.visible = false;
+ }
};
-const cancel = () => {
+const cancelAdd = () => {
toast.show("鍙栨秷");
- dialog.visible = false;
+ addDialog.visible = false;
+ // 娓呯┖琛ㄥ崟鏁版嵁
+ addFormRef.value?.$refs?.form?.resetFields();
+};
+
+const submitEdit = async () => {
+ const success = await editFormRef.value.submitEdit(cardList.value, editDialog.editId);
+ if (success) {
+ editDialog.visible = false;
+ reloadList();
+ }
+};
+
+const cancelEdit = () => {
+ toast.show("鍙栨秷");
+ editDialog.visible = false;
};
const reloadList = () => {
diff --git a/src/pages/production/twist/receive/steelCore/form.vue b/src/pages/production/twist/receive/steelCore/form.vue
index c4185ec..616e48f 100644
--- a/src/pages/production/twist/receive/steelCore/form.vue
+++ b/src/pages/production/twist/receive/steelCore/form.vue
@@ -50,6 +50,17 @@
import TwistApi from "@/api/product/twist";
import { useToast } from "wot-design-uni";
+const props = defineProps({
+ mode: {
+ type: String,
+ default: "add",
+ },
+ editData: {
+ type: Object,
+ default: null,
+ },
+});
+
const emits = defineEmits(["refresh"]);
const paramsId = ref();
const editId = ref(); // 缂栬緫鏃剁殑ID
@@ -81,19 +92,18 @@
};
// 缂栬緫鎻愪氦锛堜篃璧版柊澧炴帴鍙o紝鎻愪氦鏁翠釜鍒楄〃锛�
-const submitEdit = async () => {
- if (!editId.value) {
+const submitEdit = async (list?: any[], id?: number) => {
+ const currentList = list || allListData.value;
+ const currentId = id || editId.value;
+
+ if (!currentId) {
toast.error("缂哄皯璁板綍ID");
return false;
}
- console.log("submitEdit - 缂栬緫鍓嶇殑鍒楄〃:", allListData.value);
- console.log("submitEdit - 褰撳墠琛ㄥ崟鏁版嵁:", model);
- console.log("submitEdit - 缂栬緫鐨処D:", editId.value);
-
// 鏇存柊鍒楄〃涓搴旂殑鏁版嵁椤�
- const updatedList = allListData.value.map((item) => {
- if (item.id === editId.value) {
+ const updatedList = currentList.map((item) => {
+ if (item.id === currentId) {
// 淇濈暀鍘熸湁鏁版嵁锛岀劧鍚庢洿鏂颁慨鏀圭殑瀛楁
const updatedItem = {
...item, // 鍏堜繚鐣欏師鏈夌殑鎵�鏈夋暟鎹�
@@ -104,13 +114,10 @@
supplier: model.supplier,
type: model.type,
};
- console.log("submitEdit - 鏇存柊鍚庣殑椤�:", updatedItem);
return updatedItem;
}
return item;
});
-
- console.log("submitEdit - 鎻愪氦鐨勫畬鏁村垪琛�:", updatedList);
// 鎻愪氦鏁翠釜鍒楄〃
const { code } = await TwistApi.addStrandedWireDish(updatedList);
@@ -146,6 +153,32 @@
}
};
+// 鐩戝惉缂栬緫鏁版嵁鍙樺寲锛岃嚜鍔ㄥ洖鏄�
+watch(
+ () => props.editData,
+ (newData) => {
+ if (newData && props.mode === "edit") {
+ model.model = newData.model || "";
+ model.monofilamentNumber = newData.monofilamentNumber || "";
+ model.amount = newData.amount || "";
+ model.weight = newData.weight || "";
+ model.supplier = newData.supplier || "";
+ model.type = newData.type || "閽㈣姱";
+ }
+ },
+ { immediate: true, deep: true }
+);
+
+// 閲嶇疆琛ㄥ崟鏁版嵁
+const resetFormData = () => {
+ model.model = undefined;
+ model.monofilamentNumber = undefined;
+ model.amount = undefined;
+ model.weight = undefined;
+ model.supplier = undefined;
+ model.type = "閽㈣姱";
+};
+
onLoad((options: any) => {
paramsId.value = options.id;
});
@@ -154,6 +187,7 @@
submit,
submitEdit,
setFormData,
+ resetFormData,
});
</script>
diff --git a/src/pages/production/twist/receive/steelCore/index.vue b/src/pages/production/twist/receive/steelCore/index.vue
index a0f40cd..85da5f2 100644
--- a/src/pages/production/twist/receive/steelCore/index.vue
+++ b/src/pages/production/twist/receive/steelCore/index.vue
@@ -23,15 +23,27 @@
<ProductionCard :data="cardAttr" :value="item" color="#0D867F" />
</wd-card>
</z-paging>
+ <wd-popup v-model="addDialog.visible" position="bottom" custom-class="yl-popup">
+ <view class="action px-3">
+ <wd-button type="text" @click="cancelAdd">鍙栨秷</wd-button>
+ <wd-button type="text" @click="submitAdd">纭畾</wd-button>
+ </view>
+ <SteelCore ref="addFormRef" mode="add" @refresh="reloadList" />
+ </wd-popup>
+ <wd-popup v-model="editDialog.visible" position="bottom" custom-class="yl-popup">
+ <view class="action px-3">
+ <wd-button type="text" @click="cancelEdit">鍙栨秷</wd-button>
+ <wd-button type="text" @click="submitEdit">纭畾</wd-button>
+ </view>
+ <SteelCore
+ ref="editFormRef"
+ mode="edit"
+ :editData="editDialog.currentItem"
+ @refresh="reloadList"
+ />
+ </wd-popup>
+ <wd-toast />
</view>
- <wd-popup v-model="dialog.visible" position="bottom" custom-class="yl-popup">
- <view class="action px-3">
- <wd-button type="text" @click="cancel">鍙栨秷</wd-button>
- <wd-button type="text" @click="submit">纭畾</wd-button>
- </view>
- <SteelCore ref="steelCoreRef" @refresh="reloadList" />
- </wd-popup>
- <wd-toast />
</template>
<script setup lang="ts">
@@ -39,19 +51,24 @@
import ProductionCard from "../../../components/ProductionCard.vue";
import { useToast } from "wot-design-uni";
import SteelCore from "./form.vue";
-import { onLoad, onShow } from "@dcloudio/uni-app";
+import { onLoad } from "@dcloudio/uni-app";
import ManageApi from "@/api/product/manage";
import zPaging from "@/components/z-paging/z-paging.vue";
const paramsId = ref();
const pagingRef = ref();
-const steelCoreRef = ref();
+const addFormRef = ref();
+const editFormRef = ref();
const toast = useToast();
-const dialog = reactive({
+const addDialog = reactive({
visible: false,
});
+const editDialog = reactive({
+ visible: false,
+ currentItem: null as any,
+ editId: undefined as number | undefined,
+});
const cardList = ref<any[]>([]);
-const needRefresh = ref(false); // 鏍囪鏄惁闇�瑕佸埛鏂�
const cardAttr = ref<any[]>([
{
@@ -76,38 +93,44 @@
]);
const toEdit = (id: number) => {
- needRefresh.value = true; // 鏍囪闇�瑕佸埛鏂�
-
- // 纭繚 cardList 鏄暟缁�
- const listData = Array.isArray(cardList.value) ? cardList.value : [];
- console.log("toEdit - 浼犻�掔殑鍒楄〃鏁版嵁:", listData, "缂栬緫ID:", id);
-
- uni.navigateTo({
- url: `/pages/production/twist/receive/steelCore/edit?id=${id}`,
- success: () => {
- // 椤甸潰璺宠浆鎴愬姛鍚庡彂閫佷簨浠朵紶閫掑畬鏁村垪琛ㄦ暟鎹拰褰撳墠缂栬緫ID
- uni.$emit("steelCoreEditData", {
- list: listData,
- editId: id,
- });
- },
- });
-};
-
-const addReport = () => {
- dialog.visible = true;
-};
-
-const submit = async () => {
- const success = await steelCoreRef.value.submit();
- if (success) {
- dialog.visible = false;
+ const itemToEdit = cardList.value.find((item) => item.id === id);
+ if (itemToEdit) {
+ editDialog.currentItem = itemToEdit;
+ editDialog.editId = id;
+ editDialog.visible = true;
}
};
-const cancel = () => {
+const addReport = () => {
+ if (addFormRef.value) {
+ addFormRef.value.resetFormData();
+ }
+ addDialog.visible = true;
+};
+
+const submitAdd = async () => {
+ const success = await addFormRef.value.submit();
+ if (success) {
+ addDialog.visible = false;
+ }
+};
+
+const cancelAdd = () => {
toast.show("鍙栨秷");
- dialog.visible = false;
+ addDialog.visible = false;
+};
+
+const submitEdit = async () => {
+ const success = await editFormRef.value.submitEdit(cardList.value, editDialog.editId);
+ if (success) {
+ editDialog.visible = false;
+ reloadList();
+ }
+};
+
+const cancelEdit = () => {
+ toast.show("鍙栨秷");
+ editDialog.visible = false;
};
const getList = async () => {
@@ -126,14 +149,6 @@
onLoad((options: any) => {
paramsId.value = options.id;
-});
-
-onShow(() => {
- // 浠庣紪杈戦〉杩斿洖鏃跺埛鏂板垪琛�
- if (needRefresh.value) {
- reloadList();
- needRefresh.value = false;
- }
});
</script>
diff --git a/src/pages/production/twist/report/draw.vue b/src/pages/production/twist/report/draw.vue
index 9f3a160..56eb4bc 100644
--- a/src/pages/production/twist/report/draw.vue
+++ b/src/pages/production/twist/report/draw.vue
@@ -1,12 +1,12 @@
<template>
<view class="draw-container">
<view class="header">
- <text class="title">棰嗙敤淇℃伅</text>
+ <text class="title">棰嗙敤鑷</text>
<wd-icon name="close" class="close-icon" @click="handleClose"></wd-icon>
</view>
<view class="content">
<wd-tabs v-model="activeTab" @change="handleTabChange">
- <wd-tab title="鍘熸潗鏂欓鐢�" name="material">
+ <wd-tab title="鍘熸潗鏂欓鐢ㄨ嚜妫�" name="material">
<view class="form-section">
<template v-for="(item, index) in localMaterialData" :key="index">
<view v-if="index > 0" class="mt-4 pt-4 border-t border-gray-100"></view>
@@ -15,36 +15,43 @@
<wd-input v-model="item.model" :disabled="false" placeholder="璇疯緭鍏�"></wd-input>
</wd-form-item>
<wd-form-item label="澶栬璐ㄩ噺" prop="appearanceQuality" required>
- <wd-select-picker
- v-model="item.appearanceQuality"
- :columns="appearanceQualityOptions"
- placeholder="璇烽�夋嫨"
- range-key="label"
- ></wd-select-picker>
+ <view class="checkbox-group">
+ <wd-checkbox
+ v-for="option in appearanceQualityOptions"
+ :key="option.value"
+ :modelValue="
+ Array.isArray(item.appearanceQuality)
+ ? item.appearanceQuality.includes(String(option.value))
+ : false
+ "
+ shape="square"
+ @change="
+ (val) => handleAppearanceQualityCheckbox(index, String(option.value), val)
+ "
+ >
+ {{ option.label }}
+ </wd-checkbox>
+ </view>
</wd-form-item>
- <wd-form-item label="鐩村緞" prop="diameter" required>
+ <wd-form-item label="鐩村緞(mm)" prop="diameter" required>
<wd-input v-model="item.dia" :disabled="false" placeholder="璇疯緭鍏�"></wd-input>
</wd-form-item>
- <wd-form-item label="闀垮害" prop="length" required>
+ <wd-form-item label="闀垮害(m)" prop="length" required>
<wd-input v-model="item.length" :disabled="false" placeholder="璇疯緭鍏�"></wd-input>
</wd-form-item>
<wd-form-item label="鍗风粫绱у瘑" prop="windingTightness" required>
- <wd-picker
- v-model="item.windingTightness"
- range-key="label"
- :columns="trueOrFalseOptions"
- placeholder="璇烽�夋嫨"
- ></wd-picker>
+ <wd-radio-group v-model="item.windingTightness" cell shape="dot">
+ <wd-radio value="鏄�">鏄�</wd-radio>
+ <wd-radio value="鍚�">鍚�</wd-radio>
+ </wd-radio-group>
</wd-form-item>
<wd-form-item label="鎺掑垪鏁撮綈" prop="arrangement" required>
- <wd-picker
- v-model="item.arrangement"
- range-key="label"
- :columns="trueOrFalseOptions"
- placeholder="璇烽�夋嫨"
- ></wd-picker>
+ <wd-radio-group v-model="item.arrangement" cell shape="dot">
+ <wd-radio value="鏄�">鏄�</wd-radio>
+ <wd-radio value="鍚�">鍚�</wd-radio>
+ </wd-radio-group>
</wd-form-item>
- <wd-form-item label="澶栧眰閾濈嚎绂讳晶鏉胯竟缂樿窛绂�" prop="edgeDistance" required>
+ <wd-form-item label="澶栧眰閾濈嚎绂讳晶鏉胯竟缂樿窛绂�(mm)" prop="edgeDistance" required>
<wd-input
v-model="item.edgeDistance"
:disabled="false"
@@ -55,114 +62,116 @@
</template>
</view>
</wd-tab>
- <wd-tab title="閽㈣姱棰嗙敤" name="steel">
+ <wd-tab title="閽㈣姱棰嗙敤鑷" name="steel">
<view class="form-section">
- <template v-for="(item, index) in localSteelData" :key="index">
- <view v-if="index > 0" class="mt-4 pt-4 border-t border-gray-100"></view>
- <wd-form :model="item">
- <wd-form-item label="瑙勬牸鍨嬪彿" prop="model" required>
- <wd-input v-model="item.model" :disabled="false" placeholder="璇疯緭鍏�"></wd-input>
- </wd-form-item>
- <wd-form-item label="缁炲悜" prop="twistedDirection" required>
- <wd-input
- v-model="item.twistedDirection"
- :disabled="false"
- placeholder="璇疯緭鍏�"
- ></wd-input>
- </wd-form-item>
- <wd-form-item label="澶栧緞" prop="outerDiameter" required>
- <wd-input
- v-model="item.outerDiameter"
- :disabled="false"
- placeholder="璇疯緭鍏�"
- ></wd-input>
- </wd-form-item>
- <wd-form-item label="鍒掍激" prop="scratch" required>
- <wd-picker
- v-model="item.scratch"
- range-key="label"
- :columns="trueOrFalseOptions"
- placeholder="璇烽�夋嫨"
- ></wd-picker>
- </wd-form-item>
- <wd-form-item label="娌规薄" prop="oilStain" required>
- <wd-picker
- v-model="item.oilStain"
- range-key="label"
- :columns="trueOrFalseOptions"
- placeholder="璇烽�夋嫨"
- ></wd-picker>
- </wd-form-item>
- </wd-form>
- </template>
+ <wd-form :model="localSteelData">
+ <wd-form-item label="瑙勬牸鍨嬪彿" prop="model" required>
+ <wd-input
+ v-model="localSteelData.model"
+ :disabled="false"
+ placeholder="璇疯緭鍏�"
+ ></wd-input>
+ </wd-form-item>
+ <wd-form-item label="缁炲悜" prop="twistedDirection" required>
+ <wd-input
+ v-model="localSteelData.twistedDirection"
+ :disabled="false"
+ placeholder="璇疯緭鍏�"
+ ></wd-input>
+ </wd-form-item>
+ <wd-form-item label="澶栧緞" prop="outerDiameter" required>
+ <wd-input
+ v-model="localSteelData.outerDiameter"
+ :disabled="false"
+ placeholder="璇疯緭鍏�"
+ ></wd-input>
+ </wd-form-item>
+ <wd-form-item label="鍒掍激" prop="scratch" required>
+ <wd-radio-group v-model="localSteelData.scratch" cell shape="dot">
+ <wd-radio value="鏄�">鏄�</wd-radio>
+ <wd-radio value="鍚�">鍚�</wd-radio>
+ </wd-radio-group>
+ </wd-form-item>
+ <wd-form-item label="娌规薄" prop="oilStain" required>
+ <wd-radio-group v-model="localSteelData.oilStain" cell shape="dot">
+ <wd-radio value="鏄�">鏄�</wd-radio>
+ <wd-radio value="鍚�">鍚�</wd-radio>
+ </wd-radio-group>
+ </wd-form-item>
+ </wd-form>
</view>
</wd-tab>
- <wd-tab title="鐩樺叿棰嗙敤" name="reel">
+ <wd-tab title="鐩樺叿棰嗙敤鑷" name="reel">
<view class="form-section">
<wd-form :model="localReelData">
<wd-form-item label="铻烘瘝鏄惁鍥哄畾" prop="nutFixed" required>
- <wd-picker
- v-model="localReelData.nutFixed"
- range-key="label"
- :columns="trueOrFalseOptions"
- placeholder="璇烽�夋嫨"
- ></wd-picker>
+ <wd-radio-group v-model="localReelData.nutFixed" cell shape="dot">
+ <wd-radio value="鏄�">鏄�</wd-radio>
+ <wd-radio value="鍚�">鍚�</wd-radio>
+ </wd-radio-group>
</wd-form-item>
<wd-form-item label="渚ф澘鏄惁骞崇洿" prop="sidePlateFlat" required>
- <wd-picker
- v-model="localReelData.sidePlateFlat"
- range-key="label"
- :columns="trueOrFalseOptions"
- placeholder="璇烽�夋嫨"
- ></wd-picker>
+ <wd-radio-group v-model="localReelData.sidePlateFlat" cell shape="dot">
+ <wd-radio value="鏄�">鏄�</wd-radio>
+ <wd-radio value="鍚�">鍚�</wd-radio>
+ </wd-radio-group>
</wd-form-item>
<wd-form-item label="涓績鏉挎槸鍚﹀钩鐩�" prop="centerPlateFlat" required>
- <wd-picker
- v-model="localReelData.centerPlateFlat"
- range-key="label"
- :columns="trueOrFalseOptions"
- placeholder="璇烽�夋嫨"
- ></wd-picker>
+ <wd-radio-group v-model="localReelData.centerPlateFlat" cell shape="dot">
+ <wd-radio value="鏄�">鏄�</wd-radio>
+ <wd-radio value="鍚�">鍚�</wd-radio>
+ </wd-radio-group>
</wd-form-item>
<wd-form-item label="娑傛紗璐ㄩ噺" prop="paintQuality" required>
- <wd-picker
- v-model="localReelData.paintQuality"
- range-key="label"
- :columns="paintQualityOptions"
- placeholder="璇烽�夋嫨"
- ></wd-picker>
+ <wd-radio-group v-model="localReelData.paintQuality" cell shape="dot">
+ <wd-radio
+ v-for="option in paintQualityOptions"
+ :key="option.value"
+ :value="option.value"
+ >
+ {{ option.label }}
+ </wd-radio>
+ </wd-radio-group>
</wd-form-item>
<wd-form-item label="姣涘埡瑁傜汗鎵姌" prop="burrCrack" required>
- <wd-picker
- v-model="localReelData.burrCrack"
- range-key="label"
- :columns="trueOrFalseOptions"
- placeholder="璇烽�夋嫨"
- ></wd-picker>
+ <wd-radio-group v-model="localReelData.burrCrack" cell shape="dot">
+ <wd-radio value="鏄�">鏄�</wd-radio>
+ <wd-radio value="鍚�">鍚�</wd-radio>
+ </wd-radio-group>
</wd-form-item>
<wd-form-item label="閿愯妫辫竟鍊掗挐" prop="edgeBlunt" required>
- <wd-picker
- v-model="localReelData.edgeBlunt"
- range-key="label"
- :columns="haveOrNotOptions"
- placeholder="璇烽�夋嫨"
- ></wd-picker>
+ <wd-radio-group v-model="localReelData.edgeBlunt" cell shape="dot">
+ <wd-radio
+ v-for="option in haveOrNotOptions"
+ :key="option.value"
+ :value="option.value"
+ >
+ {{ option.label }}
+ </wd-radio>
+ </wd-radio-group>
</wd-form-item>
<wd-form-item label="鏈ㄦ澘鏄惁鍙戦湁" prop="woodMold" required>
- <wd-picker
- v-model="localReelData.woodMold"
- range-key="label"
- :columns="trueOrFalseOptions"
- placeholder="璇烽�夋嫨"
- ></wd-picker>
+ <wd-radio-group v-model="localReelData.woodMold" cell shape="dot">
+ <wd-radio value="鏄�">鏄�</wd-radio>
+ <wd-radio value="鍚�">鍚�</wd-radio>
+ </wd-radio-group>
</wd-form-item>
<wd-form-item label="鐒婃帴璐ㄩ噺" prop="weldQuality">
- <wd-select-picker
- v-model="localReelData.weldQuality"
- range-key="label"
- :columns="weldQualityOptions"
- placeholder="璇烽�夋嫨"
- ></wd-select-picker>
+ <view class="checkbox-group">
+ <wd-checkbox
+ v-for="option in weldQualityOptions"
+ :key="option.value"
+ :modelValue="
+ Array.isArray(localReelData.weldQuality)
+ ? localReelData.weldQuality.includes(String(option.value))
+ : false
+ "
+ shape="square"
+ @change="(val) => handleWeldQualityCheckbox(String(option.value), val)"
+ >
+ {{ option.label }}
+ </wd-checkbox>
+ </view>
</wd-form-item>
</wd-form>
</view>
@@ -176,7 +185,7 @@
</template>
<script setup lang="ts">
-import { ref, watch } from "vue";
+import { ref, watch, nextTick } from "vue";
import { useToast } from "wot-design-uni";
import TwistApi from "@/api/product/twist";
import ManageApi from "@/api/product/manage";
@@ -184,7 +193,7 @@
// 瀹氫箟TypeScript鎺ュ彛
interface MaterialData {
model: string;
- appearanceQuality: string;
+ appearanceQuality: string | string[];
dia: string;
length: string;
windingTightness: string;
@@ -208,13 +217,13 @@
burrCrack: string;
edgeBlunt: string;
woodMold: string;
- weldQuality: string;
+ weldQuality: string | string[];
}
// 瀹氫箟缁勪欢鐨刾rops
const props = defineProps<{
singleRegulationInfoArray: MaterialData[];
- steelRegulationInfoArray: SteelData[];
+ steelRegulationInfo: SteelData;
reelToolingInfo: ReelData;
wireId: string;
}>();
@@ -254,6 +263,121 @@
console.error("鍔犺浇鏁版嵁瀛楀吀澶辫触:", error);
}
};
+
+// 瀛樺偍姣忎釜鍘熸潗鏂欓」鐨勫墠涓�涓瑙傝川閲忓�硷紝鐢ㄤ簬姣旇緝鍙樺寲
+const previousAppearanceQuality = ref<Map<number, string[]>>(new Map());
+
+// 澶勭悊澶栬璐ㄩ噺涓嬫媺妗嗙殑浜掓枼閫夋嫨閫昏緫
+const handleAppearanceQualityChange = (
+ index: number,
+ selectedValues: string[],
+ allOptions: Array<{ label: string; value: string }>
+): string[] => {
+ // 濡傛灉娌℃湁閫夐」鏁版嵁锛岀洿鎺ヨ繑鍥�
+ if (!allOptions || allOptions.length === 0) {
+ return selectedValues;
+ }
+
+ // 鑾峰彇涔嬪墠鐨勫��
+ const previousValues = previousAppearanceQuality.value.get(index) || [];
+
+ // 鏌ユ壘"鏃犲瑙傞棶棰�"閫夐」鐨勫��
+ const noIssueOption = allOptions.find(
+ (item) => item.label === "鏃犲瑙傞棶棰�" || item.value === "鏃犲瑙傞棶棰�"
+ );
+
+ if (!noIssueOption) {
+ // 濡傛灉瀛楀吀涓病鏈�"鏃犲瑙傞棶棰�"閫夐」锛岀洿鎺ヨ繑鍥�
+ return selectedValues;
+ }
+
+ const noIssueValue = noIssueOption.value as string;
+
+ // 妫�鏌ュ綋鍓嶉�変腑鍊间腑鏄惁鍖呭惈"鏃犲瑙傞棶棰�"
+ const hasNoIssue = selectedValues.includes(noIssueValue);
+
+ // 妫�鏌ヤ箣鍓嶆槸鍚﹀寘鍚�"鏃犲瑙傞棶棰�"
+ const hadNoIssue = previousValues.includes(noIssueValue);
+
+ // 鍒ゆ柇鏄惁鏂伴�夋嫨浜�"鏃犲瑙傞棶棰�"锛堜箣鍓嶆病鏈夛紝鐜板湪鏈夛級
+ const isNewlySelectedNoIssue = !hadNoIssue && hasNoIssue;
+
+ // 鍒ゆ柇鏄惁绉婚櫎浜�"鏃犲瑙傞棶棰�"锛堜箣鍓嶆湁锛岀幇鍦ㄦ病鏈夛級
+ const isRemovedNoIssue = hadNoIssue && !hasNoIssue;
+
+ // 鍒ゆ柇鏄惁鍦�"鏃犲瑙傞棶棰�"宸查�変腑鐨勬儏鍐典笅閫夋嫨浜嗗叾浠栭�夐」
+ const isSelectingOtherWithNoIssue =
+ hadNoIssue && hasNoIssue && selectedValues.length > previousValues.length;
+
+ let result: string[];
+
+ if (isNewlySelectedNoIssue) {
+ // 濡傛灉鏂伴�夋嫨浜�"鏃犲瑙傞棶棰�"锛屽垯鍙繚鐣�"鏃犲瑙傞棶棰�"
+ result = [noIssueValue];
+ } else if (isSelectingOtherWithNoIssue) {
+ // 濡傛灉"鏃犲瑙傞棶棰�"宸茬粡琚�変腑锛屼笖鏂伴�夋嫨浜嗗叾浠栭�夐」锛屽垯绉婚櫎"鏃犲瑙傞棶棰�"
+ result = selectedValues.filter((val) => val !== noIssueValue);
+ } else if (isRemovedNoIssue) {
+ // 濡傛灉绉婚櫎浜�"鏃犲瑙傞棶棰�"锛岀洿鎺ヨ繑鍥烇紙宸茬粡鏄叾浠栭�夐」浜嗭級
+ result = selectedValues;
+ } else {
+ result = selectedValues;
+ }
+
+ // 淇濆瓨褰撳墠鍊间綔涓轰笅涓�娆$殑鍓嶄竴涓��
+ previousAppearanceQuality.value.set(index, result);
+ return result;
+};
+
+// 澶勭悊澶嶉�夋鐨刢hange浜嬩欢
+const handleAppearanceQualityCheckbox = (
+ index: number,
+ optionValue: string | number,
+ checked: boolean
+) => {
+ const currentValues = Array.isArray(localMaterialData.value[index].appearanceQuality)
+ ? localMaterialData.value[index].appearanceQuality
+ : [];
+
+ let newValues: string[];
+ if (checked) {
+ // 閫変腑
+ newValues = [...(currentValues as string[]), optionValue as string];
+ } else {
+ // 鍙栨秷閫変腑
+ newValues = (currentValues as string[]).filter((v) => v !== optionValue);
+ }
+
+ // 搴旂敤浜掓枼閫昏緫
+ const result = handleAppearanceQualityChange(
+ index,
+ newValues,
+ appearanceQualityOptions.value as Array<{ label: string; value: string }>
+ );
+
+ // 鏇存柊鍊�
+ localMaterialData.value[index].appearanceQuality = result;
+};
+
+// 澶勭悊鐒婃帴璐ㄩ噺澶嶉�夋鐨刢hange浜嬩欢
+const handleWeldQualityCheckbox = (optionValue: string, checked: boolean) => {
+ const currentValues = Array.isArray(localReelData.value.weldQuality)
+ ? localReelData.value.weldQuality
+ : [];
+
+ let newValues: string[];
+ if (checked) {
+ // 閫変腑
+ newValues = [...currentValues, optionValue];
+ } else {
+ // 鍙栨秷閫変腑
+ newValues = currentValues.filter((v) => v !== optionValue);
+ }
+
+ // 鏇存柊鍊�
+ localReelData.value.weldQuality = newValues;
+};
+
const haveOrNotOptions = [
{
label: "鏈�",
@@ -281,7 +405,13 @@
// 鏈湴鍝嶅簲寮忔暟鎹紝鐢ㄤ簬瀛樺偍鐢ㄦ埛杈撳叆
const localMaterialData = ref<MaterialData[]>([]);
-const localSteelData = ref<SteelData[]>([]);
+const localSteelData = ref<SteelData>({
+ model: "",
+ twistedDirection: "",
+ outerDiameter: "",
+ scratch: "",
+ oilStain: "",
+});
const localReelData = ref<ReelData>({
nutFixed: "",
sidePlateFlat: "",
@@ -295,69 +425,160 @@
// 鍒濆鍖栨湰鍦版暟鎹�
const initializeData = () => {
+ // 鏌ユ壘"鏃犲瑙傞棶棰�"鐨勫��
+ const noIssueOption = appearanceQualityOptions.value.find(
+ (item) => item.label === "鏃犲瑙傞棶棰�" || item.value === "鏃犲瑙傞棶棰�"
+ );
+ const defaultAppearanceQuality = noIssueOption ? [noIssueOption.value as string] : [];
+
// 鍒濆鍖栧師鏉愭枡鏁版嵁
localMaterialData.value =
props.singleRegulationInfoArray.length > 0
- ? props.singleRegulationInfoArray.map((item) => ({
- model: item.model || "",
- appearanceQuality: item.appearanceQuality || "",
- dia: item.dia || "",
- length: item.length || "",
- windingTightness: item.windingTightness || "",
- arrangement: item.arrangement || "",
- edgeDistance: item.edgeDistance || "",
- }))
+ ? props.singleRegulationInfoArray.map((item, idx) => {
+ // 澶勭悊澶栬璐ㄩ噺鏁版嵁锛岀‘淇濇槸鏁扮粍鏍煎紡
+ let initialQuality: string[] = [];
+ if (item.appearanceQuality) {
+ if (Array.isArray(item.appearanceQuality)) {
+ initialQuality = item.appearanceQuality.map((v) => String(v));
+ } else if (typeof item.appearanceQuality === "string") {
+ initialQuality = [item.appearanceQuality];
+ }
+ } else {
+ initialQuality = defaultAppearanceQuality;
+ }
+
+ // 鍒濆鍖栧墠涓�涓��
+ previousAppearanceQuality.value.set(idx, initialQuality);
+
+ return {
+ model: item.model || "",
+ appearanceQuality: initialQuality,
+ dia: item.dia || "",
+ length: item.length || "",
+ windingTightness: item.windingTightness || "鏄�",
+ arrangement: item.arrangement || "鏄�",
+ edgeDistance: item.edgeDistance || "",
+ };
+ })
: [
{
model: "",
- appearanceQuality: "",
+ appearanceQuality: defaultAppearanceQuality,
dia: "",
length: "",
- windingTightness: "",
- arrangement: "",
+ windingTightness: "鏄�",
+ arrangement: "鏄�",
edgeDistance: "",
},
];
+ // 濡傛灉鏂板缓浜嗙涓�鏉℃暟鎹紝鍒濆鍖栧畠鐨勫墠涓�涓��
+ if (localMaterialData.value.length > 0 && !previousAppearanceQuality.value.has(0)) {
+ previousAppearanceQuality.value.set(0, defaultAppearanceQuality);
+ }
+
// 鍒濆鍖栭挗鑺暟鎹�
localSteelData.value =
- props.steelRegulationInfoArray.length > 0
- ? props.steelRegulationInfoArray.map((item) => ({
- model: item.model || "",
- twistedDirection: item.twistedDirection || "",
- outerDiameter: item.outerDiameter || "",
- scratch: item.scratch || "",
- oilStain: item.oilStain || "",
- }))
- : [
- {
- model: "",
- twistedDirection: "",
- outerDiameter: "",
- scratch: "",
- oilStain: "",
- },
- ];
+ props.steelRegulationInfo && Object.keys(props.steelRegulationInfo).length > 0
+ ? {
+ model: props.steelRegulationInfo.model || "",
+ twistedDirection: props.steelRegulationInfo.twistedDirection || "",
+ outerDiameter: props.steelRegulationInfo.outerDiameter || "",
+ scratch: props.steelRegulationInfo.scratch || "鍚�",
+ oilStain: props.steelRegulationInfo.oilStain || "鍚�",
+ }
+ : {
+ model: "",
+ twistedDirection: "",
+ outerDiameter: "",
+ scratch: "鍚�",
+ oilStain: "鍚�",
+ };
// 鍒濆鍖栫洏鍏锋暟鎹�
+ // 澶勭悊鐒婃帴璐ㄩ噺榛樿鍊硷細濡傛灉涓虹┖鍒欒缃负"宸茬(鍏�"鍜�"宸蹭慨骞�"
+ let weldQualityValue: string[] = [];
+ if (
+ Array.isArray(props.reelToolingInfo.weldQuality) &&
+ props.reelToolingInfo.weldQuality.length > 0
+ ) {
+ weldQualityValue = props.reelToolingInfo.weldQuality.map((v) => String(v));
+ } else if (
+ props.reelToolingInfo.weldQuality &&
+ typeof props.reelToolingInfo.weldQuality === "string"
+ ) {
+ weldQualityValue = [props.reelToolingInfo.weldQuality as string];
+ } else {
+ // 榛樿閫夋嫨"宸茬(鍏�"鍜�"宸蹭慨骞�"
+ weldQualityValue = ["宸茬(鍏�", "宸蹭慨骞�"];
+ }
+
localReelData.value = {
- nutFixed: props.reelToolingInfo.nutFixed || "",
- sidePlateFlat: props.reelToolingInfo.sidePlateFlat || "",
- centerPlateFlat: props.reelToolingInfo.centerPlateFlat || "",
- paintQuality: props.reelToolingInfo.paintQuality || "",
- burrCrack: props.reelToolingInfo.burrCrack || "",
- edgeBlunt: props.reelToolingInfo.edgeBlunt || "",
- woodMold: props.reelToolingInfo.woodMold || "",
- weldQuality: props.reelToolingInfo.weldQuality || "",
+ nutFixed: props.reelToolingInfo.nutFixed || "鏄�",
+ sidePlateFlat: props.reelToolingInfo.sidePlateFlat || "鏄�",
+ centerPlateFlat: props.reelToolingInfo.centerPlateFlat || "鏄�",
+ paintQuality: props.reelToolingInfo.paintQuality || "瀹屽ソ",
+ burrCrack: props.reelToolingInfo.burrCrack || "鍚�",
+ edgeBlunt: props.reelToolingInfo.edgeBlunt || "鏃�",
+ woodMold: props.reelToolingInfo.woodMold || "鍚�",
+ weldQuality: weldQualityValue,
};
};
+
+// 鐢ㄤ簬璺熻釜姣忎釜鍘熸潗鏂欓」鐨勫垵濮嬪瑙傝川閲忓��
+const appearanceQualityWatchers = ref<Map<number, any>>(new Map());
// 鍒濆鍖栨暟鎹�
initializeData();
+// 涓烘瘡涓師鏉愭枡椤规坊鍔犵嫭绔嬬殑澶栬璐ㄩ噺鐩戝惉鍣�
+const setupAppearanceQualityWatchers = () => {
+ // 娓呴櫎鏃х殑鐩戝惉鍣�
+ appearanceQualityWatchers.value.forEach((stop) => stop());
+ appearanceQualityWatchers.value.clear();
+
+ // 涓烘瘡涓」娣诲姞鏂扮殑鐩戝惉鍣�
+ localMaterialData.value.forEach((item, index) => {
+ const stop = watch(
+ () => item.appearanceQuality,
+ (newValue, oldValue) => {
+ const normalizedNewValue = Array.isArray(newValue) ? newValue : [];
+ const normalizedOldValue = Array.isArray(oldValue) ? oldValue : [];
+
+ // 搴旂敤浜掓枼閫昏緫
+ const result = handleAppearanceQualityChange(
+ index,
+ normalizedNewValue,
+ appearanceQualityOptions.value as Array<{ label: string; value: string }>
+ );
+
+ // 濡傛灉鍊艰淇敼浜嗭紝寮傛鏇存柊锛岄伩鍏嶅湪鐩戝惉涓悓姝ヤ慨鏀�
+ if (JSON.stringify(result) !== JSON.stringify(normalizedNewValue)) {
+ nextTick(() => {
+ item.appearanceQuality = result;
+ });
+ }
+ },
+ { deep: true }
+ );
+
+ appearanceQualityWatchers.value.set(index, stop);
+ });
+};
+
+// 鍒濆鍖栫洃鍚櫒
+setupAppearanceQualityWatchers();
+
// 鐩戝惉props鍙樺寲锛屾洿鏂版湰鍦版暟鎹�
-watch(() => props.singleRegulationInfoArray, initializeData, { deep: true });
-watch(() => props.steelRegulationInfoArray, initializeData, { deep: true });
+watch(
+ () => props.singleRegulationInfoArray,
+ () => {
+ initializeData();
+ setupAppearanceQualityWatchers();
+ },
+ { deep: true }
+);
+watch(() => props.steelRegulationInfo, initializeData, { deep: true });
watch(() => props.reelToolingInfo, initializeData, { deep: true });
const handleTabChange = (tabName: string) => {
@@ -375,7 +596,7 @@
if (
activeTab.value === "material" ||
(!localMaterialData.value.length &&
- !localSteelData.value.length &&
+ !Object.keys(localSteelData.value).length &&
!Object.keys(localReelData.value).length)
) {
for (let i = 0; i < localMaterialData.value.length; i++) {
@@ -406,26 +627,24 @@
if (
activeTab.value === "steel" ||
(!localMaterialData.value.length &&
- !localSteelData.value.length &&
+ !Object.keys(localSteelData.value).length &&
!Object.keys(localReelData.value).length)
) {
- for (let i = 0; i < localSteelData.value.length; i++) {
- const item = localSteelData.value[i];
- if (
- !item.model ||
- item.model === "" ||
- !item.twistedDirection ||
- item.twistedDirection === "" ||
- !item.outerDiameter ||
- item.outerDiameter === "" ||
- !item.scratch ||
- item.scratch === "" ||
- !item.oilStain ||
- item.oilStain === ""
- ) {
- toast.error(`閽㈣姱绗�${i + 1}琛屽瓨鍦ㄥ繀濉」鏈~鍐檂);
- return false;
- }
+ const steel = localSteelData.value;
+ if (
+ !steel.model ||
+ steel.model === "" ||
+ !steel.twistedDirection ||
+ steel.twistedDirection === "" ||
+ !steel.outerDiameter ||
+ steel.outerDiameter === "" ||
+ !steel.scratch ||
+ steel.scratch === "" ||
+ !steel.oilStain ||
+ steel.oilStain === ""
+ ) {
+ toast.error("閽㈣姱鏁版嵁瀛樺湪蹇呭~椤规湭濉啓");
+ return false;
}
}
@@ -433,7 +652,7 @@
if (
activeTab.value === "reel" ||
(!localMaterialData.value.length &&
- !localSteelData.value.length &&
+ !Object.keys(localSteelData.value).length &&
!Object.keys(localReelData.value).length)
) {
const reel = localReelData.value;
@@ -448,7 +667,7 @@
await TwistApi.addSingleDishInspection({
inspectResult: {
singleRegulationInfoArray: localMaterialData.value,
- steelRegulationInfoArray: localSteelData.value,
+ steelRegulationInfo: localSteelData.value,
reelToolingInfo: localReelData.value,
},
wireId: props.wireId,
@@ -476,12 +695,14 @@
await loadDictData();
});
watch(
- () => [props.singleRegulationInfoArray, props.steelRegulationInfoArray, props.reelToolingInfo],
+ () => [props.singleRegulationInfoArray, props.steelRegulationInfo, props.reelToolingInfo],
() => {
const hasMaterial =
Array.isArray(props.singleRegulationInfoArray) && props.singleRegulationInfoArray.length > 0;
const hasSteel =
- Array.isArray(props.steelRegulationInfoArray) && props.steelRegulationInfoArray.length > 0;
+ props.steelRegulationInfo &&
+ typeof props.steelRegulationInfo === "object" &&
+ Object.keys(props.steelRegulationInfo).length > 0;
const hasReel =
props.reelToolingInfo &&
typeof props.reelToolingInfo === "object" &&
@@ -576,4 +797,14 @@
.submit-btn {
width: 100%;
}
+
+.checkbox-group {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 12px;
+}
+
+:deep(.wd-checkbox) {
+ margin-right: 0;
+}
</style>
diff --git a/src/pages/production/twist/report/index.vue b/src/pages/production/twist/report/index.vue
index 49e4cb3..f100b78 100644
--- a/src/pages/production/twist/report/index.vue
+++ b/src/pages/production/twist/report/index.vue
@@ -35,7 +35,7 @@
<wd-popup v-model="drawFormRef.visible" position="bottom" custom-class="yl-popup">
<Draw
:single-regulation-info-array="drawData.singleRegulationInfoArray"
- :steel-regulation-info-array="drawData.steelRegulationInfoArray"
+ :steel-regulation-info="drawData.steelRegulationInfo"
:reel-tooling-info="drawData.reelToolingInfo"
:wire-id="drawData.wireId"
@close="handleDrawClose"
@@ -73,8 +73,23 @@
});
const drawData = ref({
singleRegulationInfoArray: [],
- steelRegulationInfoArray: [],
- reelToolingInfo: {},
+ steelRegulationInfo: {
+ model: "",
+ twistedDirection: "",
+ outerDiameter: "",
+ scratch: "",
+ oilStain: "",
+ },
+ reelToolingInfo: {
+ nutFixed: "",
+ sidePlateFlat: "",
+ centerPlateFlat: "",
+ paintQuality: "",
+ burrCrack: "",
+ edgeBlunt: "",
+ woodMold: "",
+ weldQuality: "",
+ },
wireId: "",
});
@@ -117,8 +132,10 @@
});
};
-const addReport = () => {
+const addReport = async () => {
dialog.visible = true;
+ // 鎵撳紑鏂板寮圭獥鏃惰嚜鍔ㄦ墽琛�
+ // await showDrawPopup();
};
const submit = async () => {
@@ -126,7 +143,7 @@
dialog.visible = !isSuccess; // 濡傛灉鎻愪氦鎴愬姛锛屽叧闂脊绐�
if (isSuccess) {
// 鎻愪氦鎴愬姛鍚庢墽琛�
- showDrawPopup();
+ // showDrawPopup();
}
};
@@ -150,14 +167,13 @@
const { data } = await TwistApi.querySingleDishInspection({
id: paramsId.value,
});
- console.log("棰嗙敤淇℃伅鏁版嵁:", data);
// 閫傞厤涓嶅悓鐨勬暟鎹粨鏋勮繑鍥炴牸寮�
const responseData = data.data || data;
if (responseData && responseData.singleWirePrePareInfoVo) {
const info = responseData.singleWirePrePareInfoVo;
drawData.value = {
singleRegulationInfoArray: info.singleRegulationInfoArray || [],
- steelRegulationInfoArray: info.steelRegulationInfoArray || [],
+ steelRegulationInfo: info.steelRegulationInfo || {},
reelToolingInfo: info.reelToolingInfo || {},
wireId: paramsId.value,
};
@@ -165,7 +181,7 @@
drawFormRef.visible = true;
toast.success("璇峰~鍐欓鐢ㄤ俊鎭�!");
} else {
- toast.error("宸插瓨鍦ㄩ鐢ㄤ俊鎭�,鏃犻渶濉姤!");
+ // toast.error("宸插瓨鍦ㄩ鐢ㄤ俊鎭�,鏃犻渶濉姤!");
}
} catch (error) {
console.error("鑾峰彇棰嗙敤淇℃伅澶辫触:", error);
@@ -197,6 +213,7 @@
onLoad((options: any) => {
paramsId.value = options.id;
+ showDrawPopup();
});
</script>
diff --git a/src/pages/production/wire/report/rawMaterial.vue b/src/pages/production/wire/report/rawMaterial.vue
index 5fc8076..e75d424 100644
--- a/src/pages/production/wire/report/rawMaterial.vue
+++ b/src/pages/production/wire/report/rawMaterial.vue
@@ -1,12 +1,12 @@
<template>
<view class="draw-container">
<view class="header">
- <text class="title">棰嗙敤淇℃伅</text>
+ <text class="title">棰嗙敤鑷</text>
<wd-icon name="close" class="close-icon" @click="handleClose"></wd-icon>
</view>
<view class="content">
<wd-tabs v-model="activeTab" @change="handleTabChange">
- <wd-tab title="鍘熸潗鏂欓鐢�" name="reel">
+ <wd-tab title="鍘熸潗鏂欓鐢ㄨ嚜妫�" name="reel">
<view class="form-section">
<wd-form :model="materialData">
<wd-form-item label="鍨嬪彿" prop="model" required>
diff --git a/src/pages/production/wire/report/wire.vue b/src/pages/production/wire/report/wire.vue
index 7552cd0..da32716 100644
--- a/src/pages/production/wire/report/wire.vue
+++ b/src/pages/production/wire/report/wire.vue
@@ -95,7 +95,7 @@
drawFormRef.visible = true;
toast.success("璇峰~鍐欓鐢ㄤ俊鎭�!");
} else {
- toast.error("宸插瓨鍦ㄩ鐢ㄤ俊鎭�,鏃犻渶濉姤!");
+ // toast.error("宸插瓨鍦ㄩ鐢ㄤ俊鎭�,鏃犻渶濉姤!");
}
} catch (error) {
console.error("鑾峰彇棰嗙敤淇℃伅澶辫触:", error);
--
Gitblit v1.9.3