From af4f45eaa2703ecf991bd10f07f6df179f2677d9 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期三, 19 十一月 2025 10:04:45 +0800
Subject: [PATCH] Merge branch 'refs/heads/yyb'
---
src/pages/production/twist/receive/steelCore/form.vue | 80 +++++++++++++++++++++++++++++++++++++++-
1 files changed, 78 insertions(+), 2 deletions(-)
diff --git a/src/pages/production/twist/receive/steelCore/form.vue b/src/pages/production/twist/receive/steelCore/form.vue
index 616e48f..4561801 100644
--- a/src/pages/production/twist/receive/steelCore/form.vue
+++ b/src/pages/production/twist/receive/steelCore/form.vue
@@ -1,6 +1,16 @@
<template>
<wd-form ref="form" :model="model" class="relative form_box">
<wd-cell-group :border="true">
+ <wd-picker
+ v-model="diskMaterialValue"
+ :columns="diskMaterialOptions"
+ label="鑺嚎绫诲瀷"
+ label-width="100px"
+ prop="diskMaterial"
+ placeholder="璇烽�夋嫨鑺嚎绫诲瀷"
+ clearable
+ @confirm="handleDiskMaterialChange"
+ />
<wd-input
v-model="model.model"
label="瑙勬牸鍨嬪彿"
@@ -48,6 +58,7 @@
<script lang="ts" setup>
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({
@@ -59,6 +70,10 @@
type: Object,
default: null,
},
+ wireId: {
+ type: [String, Number],
+ default: undefined,
+ },
});
const emits = defineEmits(["refresh"]);
@@ -67,6 +82,7 @@
const allListData = ref<any[]>([]); // 瀛樺偍瀹屾暣鍒楄〃鏁版嵁
const toast = useToast();
const { form: model } = useFormData({
+ diskMaterial: undefined, // 鑺嚎绫诲瀷
model: undefined, // 瑙勬牸鍨嬪彿
monofilamentNumber: undefined, // 鏍峰搧缂栧彿
amount: undefined, // 鏁伴噺
@@ -75,11 +91,45 @@
type: "閽㈣姱",
});
+// 鑺嚎绫诲瀷瀛楀吀鏁版嵁
+const diskMaterialOptions = ref<Array<{ label: string; value: string }>>([]);
+const diskMaterialValue = ref("");
+
+// 鍔犺浇鑺嚎绫诲瀷瀛楀吀鏁版嵁
+const loadDiskMaterialDict = async () => {
+ try {
+ const res = await ManageApi.dictAPI("core_wire_type");
+ if (res.data && Array.isArray(res.data)) {
+ diskMaterialOptions.value = res.data.map((item: any) => ({
+ label: item.dictLabel || "",
+ value: item.dictValue || "",
+ }));
+ }
+ } catch (error) {
+ // 鍔犺浇瀛楀吀澶辫触锛岄潤榛樺鐞�
+ }
+};
+
+// 澶勭悊鑺嚎绫诲瀷閫夋嫨
+const handleDiskMaterialChange = (val: any) => {
+ model.diskMaterial = val.value;
+};
+
+// 鐩戝惉 model.diskMaterial 鍙樺寲锛屽悓姝ラ�夋嫨鍣ㄦ樉绀�
+watch(
+ () => model.diskMaterial,
+ (newValue) => {
+ diskMaterialValue.value = newValue || "";
+ },
+ { immediate: true }
+);
+
// 鏂板鎻愪氦
const submit = async () => {
+ const currentWireId = props.wireId || paramsId.value;
const { code } = await TwistApi.addStrandedWireDish([
{
- wireId: paramsId.value,
+ wireId: currentWireId,
...model,
},
]);
@@ -107,6 +157,7 @@
// 淇濈暀鍘熸湁鏁版嵁锛岀劧鍚庢洿鏂颁慨鏀圭殑瀛楁
const updatedItem = {
...item, // 鍏堜繚鐣欏師鏈夌殑鎵�鏈夋暟鎹�
+ diskMaterial: model.diskMaterial,
model: model.model,
monofilamentNumber: model.monofilamentNumber,
amount: model.amount,
@@ -133,7 +184,6 @@
const setFormData = (list: any[], currentEditId: number) => {
// 瀹夊叏妫�鏌ワ細纭繚list鏄暟缁�
if (!Array.isArray(list)) {
- console.error("setFormData: list 鍙傛暟涓嶆槸鏁扮粍", list);
return;
}
@@ -144,12 +194,15 @@
// 鎵惧埌褰撳墠缂栬緫椤瑰苟鍥炴樉鍒拌〃鍗�
const currentItem = list.find((item) => item.id === currentEditId);
if (currentItem) {
+ model.diskMaterial = currentItem.diskMaterial;
model.model = currentItem.model;
model.monofilamentNumber = currentItem.monofilamentNumber;
model.amount = currentItem.amount;
model.weight = currentItem.weight;
model.supplier = currentItem.supplier;
model.type = currentItem.type || "閽㈣姱";
+ // 璁剧疆鑺嚎绫诲瀷鐨勫洖鏄惧��
+ diskMaterialValue.value = currentItem.diskMaterial || "";
}
};
@@ -158,12 +211,14 @@
() => props.editData,
(newData) => {
if (newData && props.mode === "edit") {
+ model.diskMaterial = newData.diskMaterial || "";
model.model = newData.model || "";
model.monofilamentNumber = newData.monofilamentNumber || "";
model.amount = newData.amount || "";
model.weight = newData.weight || "";
model.supplier = newData.supplier || "";
model.type = newData.type || "閽㈣姱";
+ diskMaterialValue.value = newData.diskMaterial || "";
}
},
{ immediate: true, deep: true }
@@ -171,16 +226,36 @@
// 閲嶇疆琛ㄥ崟鏁版嵁
const resetFormData = () => {
+ model.diskMaterial = undefined;
model.model = undefined;
model.monofilamentNumber = undefined;
model.amount = undefined;
model.weight = undefined;
model.supplier = undefined;
model.type = "閽㈣姱";
+ diskMaterialValue.value = "";
+};
+
+// 濉厖琛ㄥ崟鏁版嵁锛堢敤浜庢壂鐮佸悗鍥炴樉锛�
+const fillFormData = (data: any) => {
+ if (data) {
+ model.diskMaterial = data.diskMaterial || "";
+ model.model = data.model || "";
+ model.monofilamentNumber = data.monofilamentNumber || "";
+ model.amount = data.oneLength || data.amount || "";
+ model.weight = data.weight || "";
+ model.supplier = data.supplier || "";
+ model.type = data.type || "閽㈣姱";
+ diskMaterialValue.value = data.diskMaterial || "";
+ }
};
onLoad((options: any) => {
paramsId.value = options.id;
+});
+
+onMounted(async () => {
+ await loadDiskMaterialDict();
});
defineExpose({
@@ -188,6 +263,7 @@
submitEdit,
setFormData,
resetFormData,
+ fillFormData,
});
</script>
--
Gitblit v1.9.3