From 1022826db3084755348fa4169fe0d703ad3bb443 Mon Sep 17 00:00:00 2001
From: yuan <123@>
Date: 星期一, 30 三月 2026 15:20:57 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_长治_健齿齿科器材' into dev_长治_健齿齿科器材
---
src/views/qualityManagement/processInspection/components/formDia.vue | 19
src/views/productionManagement/processRoute/index.vue | 3
src/views/productionManagement/productionOrder/MaterialRequisitionDialog.vue | 245 ++++++++++++----
src/views/basicData/product/ProductSelectDialog.vue | 1
src/views/productionManagement/workOrder/components/ProductionRecordForm.vue | 148 +++++++++-
src/views/productionManagement/workOrder/index.vue | 256 ++++++++++++++----
src/views/qualityManagement/finalInspection/components/formDia.vue | 9
src/views/productionManagement/processRoute/processRouteItem/index.vue | 22 +
src/views/productionManagement/productionCosting/index.vue | 5
src/api/productionManagement/productionOrder.js | 9
src/views/qualityManagement/rawMaterialInspection/index.vue | 2
src/views/salesManagement/salesLedger/index.vue | 11
src/views/productionManagement/productionReporting/Input.vue | 8
src/api/inventoryManagement/stockInventory.js | 6
src/views/productionManagement/productStructure/Detail/index.vue | 12
src/views/procurementManagement/procurementLedger/index.vue | 14 +
src/views/productionManagement/productionOrder/ClearanceRecordDialog.vue | 12
src/views/qualityManagement/nonconformingManagement/components/formDia.vue | 30 +
src/views/qualityManagement/rawMaterialInspection/components/formDia.vue | 13
src/views/productionManagement/productionOrder/index.vue | 2
src/views/inventoryManagement/stockReport/index.vue | 2
src/views/inventoryManagement/receiptManagement/Record.vue | 2
22 files changed, 653 insertions(+), 178 deletions(-)
diff --git a/src/api/inventoryManagement/stockInventory.js b/src/api/inventoryManagement/stockInventory.js
index aed71e2..92b3892c 100644
--- a/src/api/inventoryManagement/stockInventory.js
+++ b/src/api/inventoryManagement/stockInventory.js
@@ -60,3 +60,9 @@
});
};
+export function getMaterials() {
+ return request({
+ url: "/stockInventory/getMaterials",
+ method: "get",
+ });
+}
\ No newline at end of file
diff --git a/src/api/productionManagement/productionOrder.js b/src/api/productionManagement/productionOrder.js
index 5d3db7b..b706084 100644
--- a/src/api/productionManagement/productionOrder.js
+++ b/src/api/productionManagement/productionOrder.js
@@ -147,15 +147,6 @@
});
}
-//鏍规嵁璁㈠崟鐨刡omId鏌ヨ搴撳瓨鍘熸潗鏂�
-export function getByBomId(query) {
- return request({
- url: "/productOrder/getByBomId",
- method: "get",
- params: query,
- });
-}
-
//淇濆瓨鐢熶骇璁㈠崟棰嗘枡
export function drawMaterials(data) {
return request({
diff --git a/src/views/basicData/product/ProductSelectDialog.vue b/src/views/basicData/product/ProductSelectDialog.vue
index ded23cc..760991c 100644
--- a/src/views/basicData/product/ProductSelectDialog.vue
+++ b/src/views/basicData/product/ProductSelectDialog.vue
@@ -22,6 +22,7 @@
<el-table-column type="index" label="搴忓彿" width="60" />
<el-table-column prop="productName" label="浜у搧澶х被" min-width="160" />
<el-table-column prop="model" label="鍨嬪彿鍚嶇О" min-width="200" />
+ <el-table-column prop="uidNo" label="UID鐮�" min-width="200" />
<el-table-column prop="unit" label="鍗曚綅" min-width="160" />
</el-table>
diff --git a/src/views/inventoryManagement/receiptManagement/Record.vue b/src/views/inventoryManagement/receiptManagement/Record.vue
index fc35691..6e904ec 100644
--- a/src/views/inventoryManagement/receiptManagement/Record.vue
+++ b/src/views/inventoryManagement/receiptManagement/Record.vue
@@ -68,7 +68,7 @@
prop="model"
show-overflow-tooltip/>
<el-table-column label="UID鐮�"
- prop="uidNO"
+ prop="uidNo"
show-overflow-tooltip/>
<el-table-column label="鍗曚綅"
prop="unit"
diff --git a/src/views/inventoryManagement/stockReport/index.vue b/src/views/inventoryManagement/stockReport/index.vue
index 02689e9..90198ef 100644
--- a/src/views/inventoryManagement/stockReport/index.vue
+++ b/src/views/inventoryManagement/stockReport/index.vue
@@ -187,7 +187,7 @@
/>
<el-table-column
label="UID鐮�"
- prop="uid鐮�"
+ prop="uidNo"
show-overflow-tooltip
/>
<el-table-column
diff --git a/src/views/procurementManagement/procurementLedger/index.vue b/src/views/procurementManagement/procurementLedger/index.vue
index 20c6b1c..d69c73e 100644
--- a/src/views/procurementManagement/procurementLedger/index.vue
+++ b/src/views/procurementManagement/procurementLedger/index.vue
@@ -408,6 +408,7 @@
<el-table-column label="鍗曚綅"
prop="unit"
width="70" />
+ <el-table-column label="UID鐮�" prop="uidNo" />
<el-table-column label="鏁伴噺"
prop="quantity"
width="70" />
@@ -565,6 +566,16 @@
:label="item.model"
:value="item.id" />
</el-select>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="30">
+ <el-col :span="24">
+ <el-form-item label="UID鐮侊細"
+ prop="uidNo">
+ <el-input v-model="productForm.uidNo"
+ placeholder="璇疯緭鍏�"
+ disabled />
</el-form-item>
</el-col>
</el-row>
@@ -951,6 +962,7 @@
productId: "",
productCategory: "",
productModelId: "",
+ uidNo: "",
specificationModel: "",
unit: "",
quantity: "",
@@ -1555,9 +1567,11 @@
if (index !== -1) {
productForm.value.specificationModel = modelOptions.value[index].model;
productForm.value.unit = modelOptions.value[index].unit;
+ productForm.value.uidNo = modelOptions.value[index].uidNo || "";
} else {
productForm.value.specificationModel = null;
productForm.value.unit = null;
+ productForm.value.uidNo = "";
}
};
const findNodeById = (nodes, productId) => {
diff --git a/src/views/productionManagement/processRoute/index.vue b/src/views/productionManagement/processRoute/index.vue
index 6672ca0..9e9f2b1 100644
--- a/src/views/productionManagement/processRoute/index.vue
+++ b/src/views/productionManagement/processRoute/index.vue
@@ -81,7 +81,7 @@
},
{
label: "UID鐮�",
- prop: "uid鐮�",
+ prop: "uidNo",
},
{
label: "BOM缂栧彿",
@@ -178,6 +178,7 @@
processRouteCode: row.processRouteCode || '',
productName: row.productName || '',
model: row.model || '',
+ uidNo: row.uidNo || '',
bomNo: row.bomNo || '',
description: row.description || '',
type: 'route',
diff --git a/src/views/productionManagement/processRoute/processRouteItem/index.vue b/src/views/productionManagement/processRoute/processRouteItem/index.vue
index c1c490c..76ac092 100644
--- a/src/views/productionManagement/processRoute/processRouteItem/index.vue
+++ b/src/views/productionManagement/processRoute/processRouteItem/index.vue
@@ -31,6 +31,14 @@
</div>
<div class="info-item">
<div class="info-label-wrapper">
+ <span class="info-label">UID鐮�</span>
+ </div>
+ <div class="info-value-wrapper">
+ <span class="info-value">{{ routeInfo.uidNo || '-' }}</span>
+ </div>
+ </div>
+ <div class="info-item">
+ <div class="info-label-wrapper">
<span class="info-label">BOM缂栧彿</span>
</div>
<div class="info-value-wrapper">
@@ -81,6 +89,7 @@
</el-table-column>
<el-table-column label="浜у搧鍚嶇О" prop="productName" min-width="160" />
<el-table-column label="瑙勬牸鍚嶇О" prop="model" min-width="140" />
+ <el-table-column label="UID鐮�" prop="uidNo"/>
<el-table-column label="鍗曚綅" prop="unit" width="100" />
<el-table-column label="鏄惁璐ㄦ" prop="isQuality" width="100">
<template #default="scope">
@@ -186,6 +195,14 @@
: '閫夋嫨浜у搧' }}
</el-button>
</el-form-item>
+ <el-form-item label="UID鐮�" prop="uidNo">
+ <el-input
+ v-model="form.uidNo"
+ :placeholder="form.productModelId ? '鏍规嵁閫夋嫨鐨勪骇鍝佽嚜鍔ㄥ甫鍑�' : '璇峰厛閫夋嫨浜у搧'"
+ clearable
+ :disabled="true"
+ />
+ </el-form-item>
<el-form-item label="鍗曚綅" prop="unit">
<el-input
@@ -271,6 +288,7 @@
productModelId: undefined,
productName: "",
model: "",
+ uidNo: "",
unit: "",
isQuality: false,
});
@@ -328,6 +346,7 @@
processRouteCode: route.query.processRouteCode || '',
productName: route.query.productName || '',
model: route.query.model || '',
+ uidNo: route.query.uidNo || '',
bomNo: route.query.bomNo || '',
description: route.query.description || ''
};
@@ -348,6 +367,7 @@
routeId: routeId.value,
processId: row.processId,
productModelId: row.productModelId,
+ uidNo: row.uidNo || "",
productName: row.productName || "",
model: row.model || "",
unit: row.unit || "",
@@ -389,6 +409,7 @@
form.value.productModelId = product.id;
form.value.productName = product.productName;
form.value.model = product.model;
+ form.value.uidNo = product.uidNo;
form.value.unit = product.unit || "";
showProductSelectDialog.value = false;
// 瑙﹀彂琛ㄥ崟楠岃瘉
@@ -480,6 +501,7 @@
routeId: routeId.value,
processId: undefined,
productModelId: undefined,
+ uidNo: "",
productName: "",
model: "",
unit: "",
diff --git a/src/views/productionManagement/productStructure/Detail/index.vue b/src/views/productionManagement/productStructure/Detail/index.vue
index cf1e3a7..eb8d664 100644
--- a/src/views/productionManagement/productStructure/Detail/index.vue
+++ b/src/views/productionManagement/productStructure/Detail/index.vue
@@ -53,6 +53,8 @@
</el-form-item>
</template>
</el-table-column>
+ <el-table-column prop="uidNo"
+ label="UID鐮�" />
<el-table-column prop="processName"
label="娑堣�楀伐搴�">
<template #default="{ row, $index }">
@@ -145,6 +147,8 @@
prop="productName" />
<el-table-column label="瑙勬牸鍨嬪彿"
prop="model" />
+ <el-table-column label="UID鐮�"
+ prop="uidNo" />
</el-table>
<product-select-dialog v-if="dataValue.showProductDialog"
v-model:model-value="dataValue.showProductDialog"
@@ -195,6 +199,7 @@
const routeProductModelName = computed(
() => route.query.productModelName || ""
);
+ const routeUidNo = computed(() => route.query.uidNo || "");
const routeOrderId = computed(() => route.query.orderId);
const pageType = computed(() => route.query.type);
const isOrderPage = computed(
@@ -216,6 +221,7 @@
{
productName: "",
model: "",
+ uidNo: "",
bomNo: "",
},
]);
@@ -277,7 +283,8 @@
item =>
(item as any).tempId !== dataValue.currentRowName &&
(item as any).productName === tableData[0].productName &&
- (item as any).model === tableData[0].model
+ (item as any).model === tableData[0].model &&
+ (item as any).uidNo === tableData[0].uidNo
);
if (hasOther) {
ElMessage.warning("鏈�澶栧眰鍜屽綋鍓嶄骇鍝佷竴鏍风殑涓�绾у彧鑳芥湁涓�涓�");
@@ -294,6 +301,7 @@
if (item.tempId === dataValue.currentRowName) {
item.productName = productData.productName;
item.model = productData.model;
+ item.uidNo = productData.uidNo;
item.productModelId = productData.id;
item.unit = productData.unit || "";
return;
@@ -306,6 +314,7 @@
if (item.tempId === tempId) {
item.productName = productData.productName;
item.model = productData.model;
+ item.uidNo = productData.uidNo;
item.productModelId = productData.id;
item.unit = productData.unit || "";
return true;
@@ -507,6 +516,7 @@
// 浠庤矾鐢卞弬鏁板洖鏄炬暟鎹�
tableData[0].productName = routeProductName.value as string;
tableData[0].model = routeProductModelName.value as string;
+ tableData[0].uidNo = routeUidNo.value as string;
tableData[0].bomNo = routeBomNo.value as string;
// 璁㈠崟鎯呭喌涓嬬鐢ㄧ紪杈�
diff --git a/src/views/productionManagement/productionCosting/index.vue b/src/views/productionManagement/productionCosting/index.vue
index 8e1d40b..fc9dc39 100644
--- a/src/views/productionManagement/productionCosting/index.vue
+++ b/src/views/productionManagement/productionCosting/index.vue
@@ -102,6 +102,11 @@
prop: "productModelName",
minWidth: 100,
},
+ {
+ label: "UID鐮�",
+ prop: "uidNo",
+ minWidth: 100,
+ },
{
label: "鍗曚綅",
prop: "unit",
diff --git a/src/views/productionManagement/productionOrder/ClearanceRecordDialog.vue b/src/views/productionManagement/productionOrder/ClearanceRecordDialog.vue
index 0b8d3af..80a9211 100644
--- a/src/views/productionManagement/productionOrder/ClearanceRecordDialog.vue
+++ b/src/views/productionManagement/productionOrder/ClearanceRecordDialog.vue
@@ -12,13 +12,15 @@
<table class="info-table">
<tr>
<td class="label">浜у搧鍚嶇О</td>
- <td class="value" colspan="3">{{ formData.productName }}</td>
+ <td class="value" colspan="5">{{ formData.productName }}</td>
<td class="label">鐢熶骇鏃ユ湡</td>
<td class="value">{{ formData.productionDate }}</td>
</tr>
<tr>
<td class="label">瑙勬牸</td>
<td class="value">{{ formData.spec }}</td>
+ <td class="label">UID鐮�</td>
+ <td class="value">{{ formData.uidNo }}</td>
<td class="label">鎵瑰彿</td>
<td class="value">{{ formData.batchNo }}</td>
<td class="label">鐢熶骇杞﹂棿</td>
@@ -145,6 +147,7 @@
productName: '',
productionDate: '',
spec: '',
+ uidNo: '',
batchNo: '',
workshop: '',
checkItems: JSON.parse(JSON.stringify(defaultCheckItems)),
@@ -176,7 +179,8 @@
formData.productName = record.productName || order.productCategory || '';
formData.productionDate = record.productionDate || (order.startTime ? dayjs(order.startTime).format('YYYY-MM-DD') : dayjs().format('YYYY-MM-DD'));
formData.spec = record.spec || order.specificationModel || '';
- formData.batchNo = record.batchNo || order.batchNo || order.uidNo || '';
+ formData.uidNo = record.uidNo || order.uidNo || '';
+ formData.batchNo = record.batchNo || order.batchNo || '';
formData.workshop = record.workshop || order.workshop || order.manufacturingTeam || '';
// 鍔犺浇妫�鏌ラ」鐩紝淇濇寔榛樿缁撴瀯浣嗘洿鏂扮粨鏋�
@@ -216,7 +220,8 @@
formData.productName = order.productCategory || '';
formData.productionDate = order.startTime ? dayjs(order.startTime).format('YYYY-MM-DD') : dayjs().format('YYYY-MM-DD');
formData.spec = order.specificationModel || '';
- formData.batchNo = order.batchNo || order.uidNo || '';
+ formData.uidNo = order.uidNo || '';
+ formData.batchNo = order.batchNo || '';
formData.workshop = order.workshop || order.manufacturingTeam || '';
// 娓呭満浜哄拰妫�鏌ヤ汉榛樿涓虹┖锛屾棩鏈熼粯璁や负褰撳墠鏃堕棿
@@ -253,6 +258,7 @@
const saveData = {
orderId: formData.orderId,
productName: formData.productName,
+ uidNo: formData.uidNo,
productionDate: formData.productionDate,
spec: formData.spec,
batchNo: formData.batchNo,
diff --git a/src/views/productionManagement/productionOrder/MaterialRequisitionDialog.vue b/src/views/productionManagement/productionOrder/MaterialRequisitionDialog.vue
index ab3bd63..4aa002b 100644
--- a/src/views/productionManagement/productionOrder/MaterialRequisitionDialog.vue
+++ b/src/views/productionManagement/productionOrder/MaterialRequisitionDialog.vue
@@ -9,49 +9,45 @@
class="material-requisition-dialog"
>
<div class="material-requisition-form">
- <!-- 鍘熸潗鏂欏垪琛� -->
- <el-table :data="materialList" border style="width: 100%" height="65vh">
- <el-table-column type="index" label="搴忓彿" width="60" align="center" />
- <el-table-column prop="productName" label="浜у搧鍚嶇О" min-width="150" />
- <el-table-column prop="model" label="鍨嬪彿" min-width="150" />
- <!-- <el-table-column prop="batchNo" label="鎵瑰彿" min-width="150">
- <template #default="{ row }">
- <el-select
- v-model="row.batchNo"
- placeholder="璇烽�夋嫨鎵瑰彿"
- clearable
- style="width: 100%"
- >
- <el-option
- v-for="item in row.batchOptions || []"
- :key="item.batchNo"
- :label="item.batchNo"
- :value="item.batchNo"
- />
- </el-select>
- </template>
- </el-table-column> -->
- <el-table-column prop="unit" label="鍗曚綅" width="80" align="center" />
- <el-table-column prop="qualitity" label="鏁伴噺" width="100" align="center">
- <template #default="{ row }">
- {{ row.qualitity || 0 }}
- </template>
- </el-table-column>
- <el-table-column prop="requisitionQty" label="棰嗙敤鏁伴噺" width="120" align="center">
- <template #default="{ row }">
- <el-input-number
- v-model="row.requisitionQty"
- :min="0"
- :precision="2"
- :controls="false"
- :disabled="!row.qualitity || hasDrawMaterials"
- style="width: 100%"
- />
- </template>
- </el-table-column>
- <el-table-column prop="remark" label="澶囨敞" min-width="150">
- </el-table-column>
- </el-table>
+ <!-- 鍘熸潗鏂� Tab -->
+
+ <div class="operation-bar">
+ <el-button type="primary" @click="handleAdd">鏂板</el-button>
+ </div>
+ <el-table :data="materialList" border style="width: 100%" height="50vh">
+ <el-table-column type="index" label="搴忓彿" width="60" align="center" />
+ <el-table-column prop="productName" label="浜у搧鍚嶇О" min-width="150" />
+ <el-table-column prop="model" label="鍨嬪彿" min-width="150" />
+ <el-table-column prop="unit" label="鍗曚綅" width="80" align="center" />
+ <!-- <el-table-column prop="qualitity" label="鍙鐢ㄦ暟閲�" width="100" align="center">
+ <template #default="{ row }">
+ {{ row.qualitity || 0 }}
+ </template>
+ </el-table-column> -->
+ <el-table-column prop="requisitionQty" label="棰嗙敤鏁伴噺" width="120" align="center">
+ <template #default="{ row }">
+ <el-input-number
+ v-model="row.requisitionQty"
+ :min="0"
+ :max="row.qualitity || 0"
+ :precision="2"
+ :controls="false"
+ :disabled="!row.qualitity"
+ style="width: 100%"
+ />
+ </template>
+ </el-table-column>
+ <el-table-column prop="remark" label="澶囨敞" min-width="150">
+ <template #default="{ row }">
+ <el-input v-model="row.remark" placeholder="璇疯緭鍏ュ娉�" clearable />
+ </template>
+ </el-table-column>
+ <el-table-column label="鎿嶄綔" width="80" align="center">
+ <template #default="{ $index }">
+ <el-button type="danger" link @click="handleDelete($index)">鍒犻櫎</el-button>
+ </template>
+ </el-table-column>
+ </el-table>
</div>
<template #footer>
@@ -60,13 +56,50 @@
<el-button @click="handleCancel">鍙� 娑�</el-button>
</span>
</template>
+
+ <!-- 鏂板鍘熸潗鏂欏脊绐� -->
+ <el-dialog
+ v-model="addDialogVisible"
+ title="閫夋嫨鍘熸潗鏂�"
+ width="800px"
+ top="5vh"
+ :close-on-click-modal="false"
+ append-to-body
+ >
+ <el-table
+ :data="availableMaterials"
+ border
+ style="width: 100%"
+ height="50vh"
+ @selection-change="handleSelectionChange"
+ >
+ <el-table-column type="selection" width="55" align="center" />
+ <el-table-column type="index" label="搴忓彿" width="60" align="center" />
+ <el-table-column prop="productName" label="浜у搧鍚嶇О" min-width="150" />
+ <el-table-column prop="model" label="鍨嬪彿" min-width="150" />
+ <el-table-column prop="unit" label="鍗曚綅" width="80" align="center" />
+ <!-- <el-table-column prop="qualitity" label="鍙鐢ㄦ暟閲�" width="100" align="center">
+ <template #default="{ row }">
+ {{ row.qualitity || 0 }}
+ </template>
+ </el-table-column> -->
+ </el-table>
+
+ <template #footer>
+ <span class="dialog-footer">
+ <el-button type="primary" @click="handleAddConfirm">纭� 瀹�</el-button>
+ <el-button @click="addDialogVisible = false">鍙� 娑�</el-button>
+ </span>
+ </template>
+ </el-dialog>
</el-dialog>
</template>
<script setup>
-import { ref, reactive, computed, watch } from 'vue';
+import { ref, computed, watch } from 'vue';
import { ElMessage } from 'element-plus';
-import { getByBomId, drawMaterials } from '@/api/productionManagement/productionOrder.js';
+import { drawMaterials } from '@/api/productionManagement/productionOrder.js';
+import { getMaterials } from '@/api/inventoryManagement/stockInventory.js';
const props = defineProps({
modelValue: {
@@ -88,8 +121,13 @@
const loading = ref(false);
const saving = ref(false);
+const activeTab = ref('material');
const materialList = ref([]);
-const hasDrawMaterials = ref(false);
+
+// 鏂板寮圭獥鐩稿叧
+const addDialogVisible = ref(false);
+const availableMaterials = ref([]);
+const selectedMaterials = ref([]);
// 鐩戝惉寮规鎵撳紑锛屽姞杞芥暟鎹�
watch(() => props.modelValue, (val) => {
@@ -101,26 +139,46 @@
const loadMaterialList = async () => {
const order = props.orderData;
const drawMaterialsData = order.drawMaterials;
+ const bomId = order?.bomId;
- // 濡傛灉宸叉湁棰嗘枡鏁版嵁锛岀洿鎺ヤ娇鐢�
+ // 鍏堣幏鍙杇etMaterials鐨勬渶鏂版暟鎹�
+ let materialsFromApi = [];
+ if (bomId) {
+ try {
+ const res = await getMaterials({ bomId });
+ materialsFromApi = res.data || [];
+ } catch (error) {
+ console.error('鏌ヨ鍘熸潗鏂欏垪琛ㄥけ璐�:', error);
+ }
+ }
+
+ // 鍔犺浇宸蹭繚瀛樼殑棰嗘枡鏁版嵁
if (drawMaterialsData) {
- hasDrawMaterials.value = true;
try {
const list = typeof drawMaterialsData === 'string'
? JSON.parse(drawMaterialsData)
: drawMaterialsData;
- materialList.value = list.map(item => ({
- ...item,
- requisitionQty: item.requisitionQty || 0
- }));
- return;
+ // 鍚堝苟鏁版嵁锛氫娇鐢ˋPI鐨剄ualitity锛屼娇鐢ㄤ繚瀛樼殑requisitionQty鍜宺emark
+ materialList.value = list.map(savedItem => {
+ const apiItem = materialsFromApi.find(m => m.id === savedItem.id || m.productModelId === savedItem.productModelId);
+ return {
+ ...savedItem,
+ qualitity: apiItem?.qualitity ?? savedItem.qualitity ?? 0,
+ requisitionQty: savedItem.requisitionQty || 0
+ };
+ });
} catch (e) {
console.error('瑙f瀽棰嗘枡鏁版嵁澶辫触:', e);
+ materialList.value = [];
}
+ } else {
+ materialList.value = [];
}
+};
- // 娌℃湁棰嗘枡鏁版嵁锛岃皟鐢ㄦ帴鍙f煡璇�
- hasDrawMaterials.value = false;
+// 鎵撳紑鏂板寮圭獥
+const handleAdd = async () => {
+ const order = props.orderData;
const bomId = order?.bomId;
if (!bomId) {
ElMessage.warning('褰撳墠璁㈠崟缂哄皯BOM淇℃伅');
@@ -129,30 +187,63 @@
loading.value = true;
try {
- const res = await getByBomId({ bomId });
- const data = res.data || [];
- // 澶勭悊鏁版嵁锛屾坊鍔犻鐢ㄦ暟閲忓瓧娈靛拰鎵瑰彿閫夐」
- materialList.value = data.map(item => ({
- ...item,
- requisitionQty: item.qualitity ? 0 : 0,
- batchNo: item.batchNo || '',
- remark: item.remark || '',
- // 鎵瑰彿閫夐」锛屼粠搴撳瓨鍘熸潗鏂欎俊鎭腑鑾峰彇
- batchOptions: item.inventoryList || []
- }));
+ const res = await getMaterials({ bomId });
+ console.log('getMaterials杩斿洖鏁版嵁:', res.data);
+ // 鐩存帴灞曠ず鎵�鏈夋暟鎹紝涓嶈繃婊�
+ availableMaterials.value = res.data || [];
+ selectedMaterials.value = [];
+ addDialogVisible.value = true;
} catch (error) {
console.error('鏌ヨ鍘熸潗鏂欏垪琛ㄥけ璐�:', error);
ElMessage.error('鏌ヨ鍘熸潗鏂欏垪琛ㄥけ璐�');
- materialList.value = [];
} finally {
loading.value = false;
}
};
+// 閫夋嫨鍙樺寲
+const handleSelectionChange = (selection) => {
+ selectedMaterials.value = selection;
+};
+
+// 纭娣诲姞
+const handleAddConfirm = () => {
+ if (selectedMaterials.value.length === 0) {
+ ElMessage.warning('璇烽�夋嫨鑷冲皯涓�鏉¤褰�');
+ return;
+ }
+
+ // 杩囨护鎺夊凡瀛樺湪鐨勶紙閫氳繃id鍜宲roductModelId鍒ゆ柇锛�
+ const existingIds = materialList.value.map(item => item.id);
+ const existingProductModelIds = materialList.value.map(item => item.productModelId);
+
+ const newItems = selectedMaterials.value
+ .filter(item => !existingIds.includes(item.id) && !existingProductModelIds.includes(item.productModelId))
+ .map(item => ({
+ ...item,
+ requisitionQty: 0,
+ remark: ''
+ }));
+
+ if (newItems.length === 0) {
+ ElMessage.warning('鎵�閫夋暟鎹凡瀛樺湪锛屾棤闇�閲嶅娣诲姞');
+ return;
+ }
+
+ materialList.value = [...materialList.value, ...newItems];
+ addDialogVisible.value = false;
+ ElMessage.success(`鎴愬姛娣诲姞 ${newItems.length} 鏉¤褰昤);
+};
+
+// 鍒犻櫎
+const handleDelete = (index) => {
+ materialList.value.splice(index, 1);
+};
+
const handleCancel = () => {
visible.value = false;
materialList.value = [];
- hasDrawMaterials.value = false;
+ activeTab.value = 'material';
};
const handleConfirm = async () => {
@@ -178,7 +269,7 @@
ElMessage.success('棰嗘枡淇濆瓨鎴愬姛');
visible.value = false;
materialList.value = [];
- hasDrawMaterials.value = false;
+ activeTab.value = 'material';
} catch (error) {
console.error('淇濆瓨棰嗘枡澶辫触:', error);
ElMessage.error('淇濆瓨棰嗘枡澶辫触');
@@ -190,6 +281,14 @@
<style scoped lang="scss">
.material-requisition-form {
+ .operation-bar {
+ margin-bottom: 15px;
+ }
+
+ .el-tabs {
+ height: 100%;
+ }
+
.el-table {
margin-top: 10px;
}
@@ -223,4 +322,12 @@
padding: 15px 20px;
border-top: 1px solid #e4e7ed;
}
+
+:deep(.el-tabs__content) {
+ height: calc(100% - 55px);
+}
+
+:deep(.el-tab-pane) {
+ height: 100%;
+}
</style>
diff --git a/src/views/productionManagement/productionOrder/index.vue b/src/views/productionManagement/productionOrder/index.vue
index 49624b6..3b4adc7 100644
--- a/src/views/productionManagement/productionOrder/index.vue
+++ b/src/views/productionManagement/productionOrder/index.vue
@@ -430,6 +430,7 @@
processRouteCode: data.processRouteCode || "",
productName: data.productName || "",
model: data.model || "",
+ uidNo: data.uidNo || "",
bomNo: data.bomNo || "",
description: data.description || "",
orderId,
@@ -450,6 +451,7 @@
bomNo: row.bomNo || "",
productName: row.productCategory || "",
productModelName: row.specificationModel || "",
+ uidNo: row.uidNo || "",
orderId: row.id,
type: "order",
},
diff --git a/src/views/productionManagement/productionReporting/Input.vue b/src/views/productionManagement/productionReporting/Input.vue
index eed9624..06c2d9d 100644
--- a/src/views/productionManagement/productionReporting/Input.vue
+++ b/src/views/productionManagement/productionReporting/Input.vue
@@ -67,8 +67,8 @@
prop: 'model',
},
{
- label: 'UID鍚�',
- prop: 'uid_no',
+ label: 'UID鐮�',
+ prop: 'uidNo',
},
{
label: '鎶曞叆鏁伴噺',
@@ -78,6 +78,10 @@
label: '鍗曚綅',
prop: 'unit',
},
+ {
+ label: '澶囨敞',
+ prop: 'remark',
+ },
]
const isShow = computed({
diff --git a/src/views/productionManagement/workOrder/components/ProductionRecordForm.vue b/src/views/productionManagement/workOrder/components/ProductionRecordForm.vue
index a7c1cc9..2af0633 100644
--- a/src/views/productionManagement/workOrder/components/ProductionRecordForm.vue
+++ b/src/views/productionManagement/workOrder/components/ProductionRecordForm.vue
@@ -1,22 +1,31 @@
<script setup lang="ts">
-import {computed, reactive, ref, watch} from "vue";
+import {computed, reactive, ref, watch, withDefaults} from "vue";
defineOptions({
name: "ProductionRecordForm"
});
-const props = defineProps({
- list: {
- type: Array,
- default() {
- return [];
- }
- },
- labelWidth: {
- type: Number,
- default: 120
+type DeviceOption = {
+ id: string | number;
+ deviceName: string;
+ deviceCode?: string | number | null;
+ rpm?: string | number | null;
+};
+
+const props = withDefaults(
+ defineProps<{
+ list: any[];
+ labelWidth: number;
+ deviceOptions: DeviceOption[];
+ selectedDeviceId: string | number | null;
+ }>(),
+ {
+ list: () => [],
+ labelWidth: 120,
+ deviceOptions: () => [],
+ selectedDeviceId: null,
}
-});
+);
const formRef = ref();
const formData = reactive({
@@ -32,6 +41,76 @@
const getType = (item: any) => item.type || "鏂囨湰鏍煎紡";
+const machineSelectItem = computed(() => {
+ return formData.list.find(item => getType(item) === '鏈哄彴閫夋嫨') || null;
+});
+
+const selectedDevice = computed(() => {
+ const machineValue = machineSelectItem.value?.value;
+ if (machineValue === null || machineValue === undefined || machineValue === '') return null;
+ return props.deviceOptions.find(device => String(device.id) === String(machineValue)) || null;
+});
+
+const AUTO_DEVICE_CODE_ID = "__auto_deviceCode__";
+const AUTO_RPM_ID = "__auto_rpm__";
+
+let isSyncingAutoFields = false;
+
+const syncAutoDeviceFields = () => {
+ if (isSyncingAutoFields) return;
+ isSyncingAutoFields = true;
+
+ try {
+ const machineIndex = formData.list.findIndex(item => getType(item) === "鏈哄彴閫夋嫨");
+ if (machineIndex === -1) return;
+
+ const removeById = (id: string) => {
+ const idx = formData.list.findIndex(x => x?.id === id);
+ if (idx !== -1) formData.list.splice(idx, 1);
+ };
+
+ removeById(AUTO_DEVICE_CODE_ID);
+ removeById(AUTO_RPM_ID);
+
+ const dev = selectedDevice.value as any;
+ let insertPos = machineIndex + 1;
+
+ const hasCode =
+ dev &&
+ dev.deviceCode !== null &&
+ dev.deviceCode !== undefined &&
+ String(dev.deviceCode) !== "";
+
+ const hasRpm = dev && dev.rpm !== null && dev.rpm !== undefined;
+
+ if (hasCode) {
+ formData.list.splice(insertPos, 0, {
+ id: AUTO_DEVICE_CODE_ID,
+ parameterItem: "璁惧缂栧彿",
+ value: dev.deviceCode,
+ // 鍙灞曠ず锛氶伩鍏嶅奖鍝嶅悗绔弬鏁扮粨鏋勶紙submitData 浼氳繃婊わ級
+ readonly: true,
+ isRequired: "0",
+ __autoExtra: true,
+ });
+ insertPos++;
+ }
+
+ if (hasRpm) {
+ formData.list.splice(insertPos, 0, {
+ id: AUTO_RPM_ID,
+ parameterItem: "杞暟",
+ value: dev.rpm,
+ readonly: true,
+ isRequired: "0",
+ __autoExtra: true,
+ });
+ }
+ } finally {
+ isSyncingAutoFields = false;
+ }
+};
+
const rules = computed(() => {
const result: Record<string, any[]> = {};
formData.list.forEach((item, index) => {
@@ -43,10 +122,15 @@
});
const initData = () => {
- formData.list = props.list || [];
+ // 閲嶈锛氫笉瑕佺洿鎺ュ鐢� props.list 鐨勫紩鐢紝鍚﹀垯鍚庣画 splice formData.list 浼氳Е鍙� props watch锛屽鑷撮�掑綊鏇存柊
+ formData.list = (props.list || []).map(item => ({ ...item }));
formData.list.forEach(item => {
if (item.value === undefined) {
item.value = null;
+ }
+ // 濡傛灉鍙傛暟涓瓨鍦ㄢ�滄満鍙伴�夋嫨鈥濓紝鍒欎娇鐢ㄧ埗缁勪欢浼犲叆鐨勯粯璁ゆ満鍙板洖濉�
+ if (getType(item) === '鏈哄彴閫夋嫨' && (item.value === null || item.value === undefined || item.value === '')) {
+ item.value = props.selectedDeviceId ?? item.value;
}
});
};
@@ -55,7 +139,8 @@
const valid = await formRef.value.validate().catch(() => false)
if (valid) {
- return formData.list
+ // 鑷姩鎻掑叆鐨勫彧璇诲瓧娈典笉鍙備笌鎻愪氦锛岄伩鍏嶅悗绔弬鏁扮粨鏋勫彉鍖�
+ return formData.list.filter(item => !item.__autoExtra)
} else {
return null
}
@@ -65,8 +150,18 @@
() => props.list,
() => {
initData();
+ // 鍒濆鍖栧悗鍐嶅悓姝ヨ嚜鍔ㄦ彃鍏ュ瓧娈�
+ syncAutoDeviceFields();
},
{immediate: true, deep: true}
+);
+
+watch(
+ () => selectedDevice.value,
+ () => {
+ syncAutoDeviceFields();
+ },
+ { immediate: true }
);
defineExpose({
@@ -76,9 +171,11 @@
<template>
<el-form ref="formRef" :model="formData" :rules="rules" :label-width="`${labelWidth}px`">
+ <el-row :gutter="30">
+ <el-col :span="12" v-for="(item, index) in formData.list"
+ :key="item.id">
<el-form-item
- v-for="(item, index) in formData.list"
- :key="item.id"
+
:label="fieldLabel(item)"
:prop="`list.${index}.value`"
>
@@ -117,12 +214,29 @@
<el-option label="鏄�" value="鏄�"/>
<el-option label="鍚�" value="鍚�"/>
</el-select>
+ <el-select
+ v-else-if="getType(item) === '鏈哄彴閫夋嫨'"
+ v-model="item.value"
+ placeholder="璇烽�夋嫨"
+ clearable
+ style="width: 100%"
+ >
+ <el-option
+ v-for="device in props.deviceOptions"
+ :key="device.id"
+ :label="device.deviceName"
+ :value="device.id"
+ />
+ </el-select>
<el-input
v-else
v-model="item.value"
placeholder="璇疯緭鍏�"
- clearable
+ :disabled="item.readonly"
+ :clearable="!item.readonly"
/>
</el-form-item>
+ </el-col>
+ </el-row>
</el-form>
</template>
\ No newline at end of file
diff --git a/src/views/productionManagement/workOrder/index.vue b/src/views/productionManagement/workOrder/index.vue
index b9df112..1d3c8a5 100644
--- a/src/views/productionManagement/workOrder/index.vue
+++ b/src/views/productionManagement/workOrder/index.vue
@@ -166,17 +166,21 @@
</el-dialog>
<el-dialog v-model="reportDialogVisible"
title="鎶ュ伐"
- width="500px">
+ width="1400px">
<el-form ref="reportFormRef"
:model="reportForm"
:rules="reportFormRules"
label-width="120px">
- <el-form-item label="寰呯敓浜ф暟閲�">
- <el-input v-model="reportForm.planQuantity"
- readonly
- style="width: 300px" />
- </el-form-item>
- <el-form-item label="鎶曞叆鎬婚噺(kg)"
+ <el-row :gutter="30">
+ <el-col :span="12">
+ <el-form-item label="寰呯敓浜ф暟閲�">
+ <el-input v-model="reportForm.planQuantity"
+ readonly
+ style="width: 300px" />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="鎶曞叆鎬婚噺(kg)"
prop="totalInvestment">
<el-input v-model.number="reportForm.totalInvestment"
type="number"
@@ -186,7 +190,8 @@
placeholder="璇疯緭鍏ユ姇鍏ユ�婚噺"
@input="handleTotalInvestmentInput" />
</el-form-item>
- <el-form-item label="鏈鐢熶骇鏁伴噺"
+ </el-col>
+ <el-col :span="12"><el-form-item label="鏈鐢熶骇鏁伴噺"
prop="quantity">
<el-input v-model.number="reportForm.quantity"
type="number"
@@ -195,8 +200,8 @@
style="width: 300px"
placeholder="璇疯緭鍏ユ湰娆$敓浜ф暟閲�"
@input="handleQuantityInput" />
- </el-form-item>
- <el-form-item label="鎶ュ簾鏁伴噺"
+ </el-form-item></el-col>
+ <el-col :span="12"><el-form-item label="鎶ュ簾鏁伴噺"
prop="scrapQty">
<el-input v-model.number="reportForm.scrapQty"
type="number"
@@ -205,8 +210,9 @@
style="width: 300px"
placeholder="璇疯緭鍏ユ姤搴熸暟閲�"
@input="handleScrapQtyInput" />
- </el-form-item>
- <el-form-item label="妫�鍝佹暟閲�"
+ </el-form-item></el-col>
+ <el-col :span="12">
+ <el-form-item label="妫�鍝佹暟閲�"
prop="inspectedQuantity">
<el-input v-model.number="reportForm.inspectedQuantity"
type="number"
@@ -216,7 +222,9 @@
placeholder="璇疯緭鍏ユ鍝佹暟閲�"
@input="handleInspectedQuantity"/>
</el-form-item>
- <el-form-item label="鐝粍淇℃伅">
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="鐝粍淇℃伅">
<el-select v-model="reportForm.userId"
style="width: 300px"
placeholder="璇烽�夋嫨鐝粍淇℃伅"
@@ -229,30 +237,56 @@
:value="user.userId" />
</el-select>
</el-form-item>
- <el-form-item label="璁惧閫夋嫨">
- <el-select v-model="reportForm.deviceId"
- style="width: 300px"
- placeholder="璇烽�夋嫨璁惧"
- clearable
- filterable
- @change="handleDeviceChange">
- <el-option v-for="device in deviceOptions"
- :key="device.id"
- :label="device.deviceName"
- :value="device.id" />
- </el-select>
- </el-form-item>
- <el-form-item v-if="currentDevice" label="璁惧缂栧彿">
- <el-input v-model="currentDevice.deviceCode"
- disabled
- style="width: 300px" />
- </el-form-item>
- <el-form-item v-if="currentDevice" label="杞暟">
- <el-input v-model="currentDevice.rpm"
- disabled
- style="width: 300px" />
- </el-form-item>
- <ProductionRecordForm ref="productionRecordFormRef" :list="processParamList"/>
+ </el-col>
+ </el-row>
+ <ProductionRecordForm
+ ref="productionRecordFormRef"
+ :list="processParamList"
+ :device-options="deviceOptions"
+ :selected-device-id="reportForm.deviceId"
+ />
+
+ <div style="margin-top: 20px">
+ <div style="display: flex; justify-content: flex-end; margin-bottom: 10px">
+ <el-button type="primary" @click="openAddMaterialDialog">鏂板鍘熸潗鏂�</el-button>
+ </div>
+
+ <el-table
+ :data="reportForm.drawMaterialList"
+ border
+ style="width: 100%"
+ height="220px"
+ empty-text="鏆傛棤鍘熸潗鏂欓鐢ㄦ槑缁�"
+ >
+ <el-table-column type="index" label="搴忓彿" width="60" align="center" />
+ <el-table-column prop="productName" label="浜у搧鍚嶇О" min-width="160" />
+ <el-table-column prop="model" label="鍨嬪彿" min-width="150" />
+ <el-table-column prop="unit" label="鍗曚綅" width="90" align="center" />
+ <el-table-column prop="reportQty" label="棰嗙敤鏁伴噺" width="160" align="center">
+ <template #default="{ row }">
+ <el-input-number
+ v-model.number="row.reportQty"
+ :min="0"
+ :precision="2"
+ :controls="false"
+ :max="row.qualitity || 0"
+ :disabled="!row.qualitity"
+ style="width: 100%"
+ />
+ </template>
+ </el-table-column>
+ <el-table-column prop="remark" label="澶囨敞" min-width="160">
+ <template #default="{ row }">
+ <el-input v-model="row.remark" placeholder="璇疯緭鍏ュ娉�" clearable />
+ </template>
+ </el-table-column>
+ <el-table-column label="鎿嶄綔" width="80" align="center">
+ <template #default="{ $index }">
+ <el-button type="danger" link @click="removeDrawMaterialRow($index)">鍒犻櫎</el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ </div>
</el-form>
<template #footer>
<span class="dialog-footer">
@@ -262,12 +296,49 @@
</span>
</template>
</el-dialog>
+
+ <el-dialog
+ v-model="addMaterialDialogVisible"
+ title="閫夋嫨鍘熸潗鏂�"
+ width="1000px"
+ top="5vh"
+ :close-on-click-modal="false"
+ append-to-body
+ destroy-on-close
+ >
+ <div>
+ <el-table
+ :data="availableMaterials"
+ border
+ style="width: 100%"
+ height="45vh"
+ row-key="id"
+ @selection-change="handleAddMaterialSelectionChange"
+ >
+ <el-table-column type="selection" width="55" align="center" />
+ <el-table-column type="index" label="搴忓彿" width="60" align="center" />
+ <el-table-column prop="productName" label="浜у搧鍚嶇О" min-width="160" />
+ <el-table-column prop="model" label="鍨嬪彿" min-width="150" />
+ <el-table-column prop="unit" label="鍗曚綅" width="90" align="center" />
+ <el-table-column prop="qualitity" label="鍙鐢ㄦ暟閲�" width="140" align="center" />
+ </el-table>
+
+ <!-- 宸查�夋嫨鏄庣粏灞曠ず鏀惧湪鎶ュ伐寮规涓嬫柟鐨� reportForm.drawMaterialList 琛ㄦ牸閲� -->
+ </div>
+
+ <template #footer>
+ <span class="dialog-footer">
+ <el-button @click="addMaterialDialogVisible = false">鍙栨秷</el-button>
+ <el-button type="primary" @click="handleConfirmAddMaterial">纭畾</el-button>
+ </span>
+ </template>
+ </el-dialog>
<FilesDia ref="workOrderFilesRef" />
</div>
</template>
<script setup>
- import { onMounted, ref, nextTick, computed } from "vue";
+ import { onMounted, ref, nextTick } from "vue";
import { ElMessageBox } from "element-plus";
import dayjs from "dayjs";
import {
@@ -429,16 +500,18 @@
userId: "",
productMainId: null,
deviceId: null,
+ // 鎶ュ伐鏃堕�夋嫨鐨勫師鏉愭枡棰嗙敤鏄庣粏
+ drawMaterialList: [],
otherData: {
rows: []
},
});
const productionRecordFormRef = ref();
- const currentDevice = computed(() => {
- if (!reportForm.deviceId) return null;
- return deviceOptions.value.find(device => device.id === reportForm.deviceId) || null;
- });
+ // 鍘熸潗鏂欓鐢紙鏂板/閫夋嫨寮规锛�
+ const availableMaterials = ref([]); // 鏉ヨ嚜褰撳墠琛岀殑 drawMaterials锛坖son瑙f瀽鎴恖ist锛�
+ const addMaterialDialogVisible = ref(false);
+ const selectedAddMaterials = ref([]); // 寮规閲岀敤鎴烽�変腑鐨勬潯鐩紙鍙紪杈� reportQty锛�
// 鎶曞叆鎬婚噺楠岃瘉瑙勫垯
const validateTotalInvestment = (rule, value, callback) => {
@@ -545,7 +618,6 @@
const handleQuantityInput = value => {
if (value === "" || value === null || value === undefined) {
reportForm.quantity = null;
- reportForm.scrapQty = null;
return;
}
const num = Number(value);
@@ -554,29 +626,17 @@
}
if (num < 1) {
reportForm.quantity = null;
- reportForm.scrapQty = null;
return;
}
if (!Number.isInteger(num)) {
const intValue = Math.floor(num);
if (intValue < 1) {
reportForm.quantity = null;
- reportForm.scrapQty = null;
return;
}
reportForm.quantity = intValue;
} else {
reportForm.quantity = num;
- }
- // 濡傛灉 totalInvestment 鏈夊�硷紝鑷姩璁$畻 scrapQty = totalInvestment - quantity
- if (reportForm.totalInvestment !== null && reportForm.totalInvestment !== undefined && reportForm.totalInvestment !== "") {
- const total = Number(reportForm.totalInvestment);
- const qty = Number(reportForm.quantity);
- if (total > qty) {
- reportForm.scrapQty = total - qty;
- } else {
- reportForm.scrapQty = null;
- }
}
};
@@ -771,6 +831,72 @@
return res.data.records
};
+ // 鍘熸潗鏂欓鐢細drawMaterials锛坖son -> list锛変笌 drawMaterialList锛堟渶缁堟彁浜わ級
+ const parseMaybeJsonList = (val) => {
+ if (!val) return [];
+ if (Array.isArray(val)) return val;
+ if (typeof val === 'string') {
+ try {
+ const parsed = JSON.parse(val);
+ return Array.isArray(parsed) ? parsed : [];
+ } catch (e) {
+ return [];
+ }
+ }
+ return [];
+ };
+
+ const normalizeDrawMaterialItem = (item) => {
+ if (!item) return null;
+ return {
+ ...item,
+ reportQty: item.reportQty ?? item.requisitionQty ?? 0,
+ remark: item.remark ?? '',
+ };
+ };
+
+ const materialKey = (item) => String(item?.id ?? item?.productModelId ?? '');
+
+ const openAddMaterialDialog = () => {
+ if (!availableMaterials.value || availableMaterials.value.length === 0) {
+ proxy.$modal.msgWarning("褰撳墠宸ュ崟娌℃湁鍙鐢ㄧ殑鍘熸潗鏂�");
+ return;
+ }
+ selectedAddMaterials.value = [];
+ addMaterialDialogVisible.value = true;
+ };
+
+ const handleAddMaterialSelectionChange = (selection) => {
+ selectedAddMaterials.value = (selection || []).map((x) => normalizeDrawMaterialItem({ ...x }));
+ };
+
+ const handleConfirmAddMaterial = () => {
+ if (!selectedAddMaterials.value || selectedAddMaterials.value.length === 0) {
+ proxy.$modal.msgWarning("璇峰厛閫夋嫨鍘熸潗鏂�");
+ return;
+ }
+
+ const existingKeys = new Set((reportForm.drawMaterialList || []).map(materialKey));
+ const newItems = selectedAddMaterials.value
+ .filter((it) => !existingKeys.has(materialKey(it)))
+ .map(normalizeDrawMaterialItem)
+ .filter(Boolean);
+
+ if (newItems.length === 0) {
+ proxy.$modal.msgWarning("鎵�閫夊師鏉愭枡宸插瓨鍦紝鏃犻渶閲嶅娣诲姞");
+ addMaterialDialogVisible.value = false;
+ return;
+ }
+
+ reportForm.drawMaterialList = [...(reportForm.drawMaterialList || []), ...newItems];
+ addMaterialDialogVisible.value = false;
+ };
+
+ const removeDrawMaterialRow = (index) => {
+ if (!Array.isArray(reportForm.drawMaterialList)) return;
+ reportForm.drawMaterialList.splice(index, 1);
+ };
+
const processParamList = ref([])
const showReportDialog = async row => {
currentReportRowData.value = row;
@@ -790,6 +916,15 @@
// 鑾峰彇宸ュ簭缁戝畾璁惧鍒楄〃
getDeviceList(row.processId);
+
+ // 鍘熸潗鏂欙細鍙�夐」鏉ヨ嚜褰撳墠琛� drawMaterials锛坖son -> list锛�
+ availableMaterials.value = parseMaybeJsonList(row.drawMaterials);
+
+ // 鏈�缁堥鐢ㄦ竻鍗曪細浼樺厛鍥炴樉 drawMaterialList锛堣嫢鍚庣宸茶繑鍥烇級锛涘惁鍒欎负绌�
+ const existingDrawList = parseMaybeJsonList(row.drawMaterialList);
+ reportForm.drawMaterialList = (existingDrawList || []).map(normalizeDrawMaterialItem).filter(Boolean);
+ selectedAddMaterials.value = [];
+ addMaterialDialogVisible.value = false;
nextTick(() => {
reportFormRef.value?.clearValidate();
@@ -818,6 +953,8 @@
const data = await productionRecordFormRef.value.submitData();
console.log("鐢熶骇璁板綍琛ㄥ崟鏁版嵁:", data);
reportForm.otherData.rows = data || [];
+ // 鏈哄彴閫夋嫨鐢� ProductionRecordForm 鐨勨�滄満鍙伴�夋嫨鈥濆弬鏁板喅瀹�
+ reportForm.deviceId = getDeviceFromRecordParams(data) ?? reportForm.deviceId;
} catch (error) {
console.error("鑾峰彇鐢熶骇璁板綍琛ㄥ崟鏁版嵁澶辫触", error);
return;
@@ -882,6 +1019,8 @@
...reportForm,
quantity: quantity,
scrapQty: scrapQty,
+ // drawMaterialList 鐩存帴浼犳暟缁勶紙涓嶅仛 JSON.stringify锛�
+ drawMaterialList: reportForm.drawMaterialList || [],
otherData: JSON.stringify(reportForm.otherData)
};
@@ -947,9 +1086,10 @@
}
};
- // 璁惧閫夋嫨鍙樺寲鏃舵洿鏂� deviceId
- const handleDeviceChange = deviceId => {
- reportForm.deviceId = deviceId;
+ const getDeviceFromRecordParams = (rows) => {
+ if (!Array.isArray(rows)) return null;
+ const machineRow = rows.find(r => r?.type === '鏈哄彴閫夋嫨');
+ return machineRow?.value ?? null;
};
onMounted(() => {
diff --git a/src/views/qualityManagement/finalInspection/components/formDia.vue b/src/views/qualityManagement/finalInspection/components/formDia.vue
index 93abe9a..332b3fd 100644
--- a/src/views/qualityManagement/finalInspection/components/formDia.vue
+++ b/src/views/qualityManagement/finalInspection/components/formDia.vue
@@ -49,6 +49,11 @@
</el-select>
</el-form-item>
</el-col>
+ <el-col :span="12">
+ <el-form-item label="UID鐮侊細" prop="uidNo">
+ <el-input v-model="form.uidNo" placeholder="璇疯緭鍏�" disabled/>
+ </el-form-item>
+ </el-col>
</el-row>
<el-row :gutter="30">
<el-col :span="12">
@@ -180,6 +185,7 @@
model: "",
testStandardId: "",
unit: "",
+ uidNo: "",
quantity: "",
checkCompany: "",
checkResult: "",
@@ -316,6 +322,7 @@
if (selectedModel) {
form.value.model = selectedModel.model || '';
form.value.unit = selectedModel.unit || '';
+ form.value.uidNo = selectedModel.uidNo || '';
}
}
@@ -355,6 +362,7 @@
const getModels = (value) => {
form.value.productModelId = undefined;
form.value.unit = undefined;
+ form.value.uidNo = undefined;
modelOptions.value = [];
currentProductId.value = value
form.value.productName = findNodeById(productOptions.value, value);
@@ -369,6 +377,7 @@
const handleChangeModel = (value) => {
form.value.model = modelOptions.value.find(item => item.id == value)?.model || '';
form.value.unit = modelOptions.value.find(item => item.id == value)?.unit || '';
+ form.value.uidNo = modelOptions.value.find(item => item.id == value)?.uidNo || '';
}
const findNodeById = (nodes, productId) => {
diff --git a/src/views/qualityManagement/nonconformingManagement/components/formDia.vue b/src/views/qualityManagement/nonconformingManagement/components/formDia.vue
index 0c6562c..2301cee 100644
--- a/src/views/qualityManagement/nonconformingManagement/components/formDia.vue
+++ b/src/views/qualityManagement/nonconformingManagement/components/formDia.vue
@@ -44,8 +44,13 @@
</el-row>
<el-row :gutter="30">
<el-col :span="12">
+ <el-form-item label="UID鐮侊細" prop="uidNo">
+ <el-input v-model="form.uidNo" placeholder="璇疯緭鍏�" disabled/>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
<el-form-item label="鍗曚綅锛�" prop="unit">
- <el-input v-model="form.unit" placeholder="璇疯緭鍏�" clearable/>
+ <el-input v-model="form.unit" placeholder="璇疯緭鍏�" disabled/>
</el-form-item>
</el-col>
<el-col :span="12">
@@ -53,8 +58,6 @@
<el-input-number :step="0.01" :min="0" style="width: 100%" v-model="form.quantity" placeholder="璇疯緭鍏�" clearable :precision="2"/>
</el-form-item>
</el-col>
- </el-row>
- <el-row :gutter="30">
<el-col :span="12">
<el-form-item label="妫�楠屽憳锛�" prop="checkName">
<el-select v-model="form.checkName" placeholder="璇烽�夋嫨" clearable style="width: 100%">
@@ -75,8 +78,7 @@
/>
</el-form-item>
</el-col>
- </el-row>
- <el-row :gutter="30">
+
<el-col :span="12">
<el-form-item label="涓嶅悎鏍肩幇璞★細" prop="defectivePhenomena">
<el-input v-model="form.defectivePhenomena" placeholder="璇疯緭鍏�" clearable/>
@@ -89,8 +91,7 @@
</el-select>
</el-form-item>
</el-col>
- </el-row>
- <el-row :gutter="30">
+
<el-col :span="12">
<el-form-item label="澶勭悊浜猴細" prop="dealName">
<el-select v-model="form.dealName" placeholder="璇烽�夋嫨" clearable style="width: 100%">
@@ -148,6 +149,7 @@
productName: "",
productId: "",
model: "",
+ uidNo: "",
unit: "",
quantity: "",
checkCompany: "",
@@ -198,6 +200,7 @@
checkTime: '',
productId: '',
model: '',
+ uidNo: '',
unit: '',
quantity: '',
productName: '',
@@ -213,17 +216,30 @@
})
}
}
+
+const handleChangeModel = (value) => {
+ form.value.model = modelOptions.value.find(item => item.id == value)?.model || '';
+ form.value.unit = modelOptions.value.find(item => item.id == value)?.unit || '';
+ form.value.uidNo = modelOptions.value.find(item => item.id == value)?.uidNo || '';
+}
+
const getProductOptions = () => {
productTreeList().then((res) => {
productOptions.value = convertIdToValue(res);
});
};
+
const getModels = (value) => {
+ form.value.model = undefined;
+ form.value.unit = undefined;
+ form.value.uidNo = undefined;
+ modelOptions.value = [];
form.value.productName = findNodeById(productOptions.value, value);
modelList({ id: value }).then((res) => {
modelOptions.value = res;
})
};
+
const findNodeById = (nodes, productId) => {
for (let i = 0; i < nodes.length; i++) {
if (nodes[i].value === productId) {
diff --git a/src/views/qualityManagement/processInspection/components/formDia.vue b/src/views/qualityManagement/processInspection/components/formDia.vue
index e580aef..1a40a9c 100644
--- a/src/views/qualityManagement/processInspection/components/formDia.vue
+++ b/src/views/qualityManagement/processInspection/components/formDia.vue
@@ -73,6 +73,11 @@
</el-row>
<el-row :gutter="30">
<el-col :span="12">
+ <el-form-item label="UID鐮侊細" prop="uidNo">
+ <el-input v-model="form.uidNo" placeholder="璇疯緭鍏�" disabled/>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
<el-form-item label="妫�娴嬪崟浣嶏細" prop="checkCompany">
<el-input v-model="form.checkCompany" placeholder="璇疯緭鍏�" clearable/>
</el-form-item>
@@ -85,14 +90,12 @@
</el-select>
</el-form-item>
</el-col>
- </el-row>
- <el-row :gutter="30">
<el-col :span="12">
<el-form-item label="妫�楠屽憳锛�" prop="checkName">
- <el-select v-model="form.checkName" placeholder="璇烽�夋嫨" clearable>
- <el-option v-for="item in userList" :key="item.nickName" :label="item.nickName"
- :value="item.nickName"/>
- </el-select>
+ <el-select v-model="form.checkName" placeholder="璇烽�夋嫨" clearable>
+ <el-option v-for="item in userList" :key="item.nickName" :label="item.nickName"
+ :value="item.nickName"/>
+ </el-select>
</el-form-item>
</el-col>
<el-col :span="12">
@@ -190,6 +193,7 @@
productId: "",
productModelId: "",
model: "",
+ uidNo: "",
testStandardId: "",
unit: "",
quantity: "",
@@ -300,6 +304,7 @@
model: "",
testStandardId: "",
unit: "",
+ uidNo: "",
quantity: "",
checkCompany: "",
checkResult: "",
@@ -384,6 +389,7 @@
const getModels = (value) => {
form.value.productModelId = undefined;
form.value.unit = undefined;
+ form.value.uidNo = undefined;
modelOptions.value = [];
currentProductId.value = value
form.value.productName = findNodeById(productOptions.value, value);
@@ -398,6 +404,7 @@
const handleChangeModel = (value) => {
form.value.model = modelOptions.value.find(item => item.id == value)?.model || '';
form.value.unit = modelOptions.value.find(item => item.id == value)?.unit || '';
+ form.value.uidNo = modelOptions.value.find(item => item.id == value)?.uidNo || '';
}
const findNodeById = (nodes, productId) => {
diff --git a/src/views/qualityManagement/rawMaterialInspection/components/formDia.vue b/src/views/qualityManagement/rawMaterialInspection/components/formDia.vue
index 7362235..daa4712 100644
--- a/src/views/qualityManagement/rawMaterialInspection/components/formDia.vue
+++ b/src/views/qualityManagement/rawMaterialInspection/components/formDia.vue
@@ -84,10 +84,17 @@
</el-row>
<el-row :gutter="30">
<el-col :span="12">
+ <el-form-item label="UID鐮侊細" prop="uidNo">
+ <el-input v-model="form.uidNo" disabled/>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
<el-form-item label="妫�娴嬪崟浣嶏細" prop="checkCompany">
<el-input v-model="form.checkCompany" placeholder="璇疯緭鍏�" clearable/>
</el-form-item>
</el-col>
+ </el-row>
+ <el-row :gutter="30">
<el-col :span="12">
<el-form-item label="妫�娴嬬粨鏋滐細" prop="checkResult">
<el-select v-model="form.checkResult">
@@ -96,8 +103,6 @@
</el-select>
</el-form-item>
</el-col>
- </el-row>
- <el-row :gutter="30">
<el-col :span="12">
<el-form-item label="妫�楠屽憳锛�" prop="checkName">
<el-select v-model="form.checkName" placeholder="璇烽�夋嫨" clearable style="width: 100%">
@@ -201,6 +206,7 @@
productId: "",
productModelId: "",
model: "",
+ uidNo: "",
testStandardId: "",
unit: "",
quantity: "",
@@ -309,6 +315,7 @@
productId: "",
productModelId: "",
model: "",
+ uidNo: "",
testStandardId: "",
unit: "",
quantity: "",
@@ -393,6 +400,7 @@
const getModels = (value) => {
form.value.productModelId = undefined;
form.value.unit = undefined;
+ form.value.uidNo = undefined;
modelOptions.value = [];
currentProductId.value = value
form.value.productName = findNodeById(productOptions.value, value);
@@ -407,6 +415,7 @@
const handleChangeModel = (value) => {
form.value.model = modelOptions.value.find(item => item.id == value)?.model || '';
form.value.unit = modelOptions.value.find(item => item.id == value)?.unit || '';
+ form.value.uidNo = modelOptions.value.find(item => item.id == value)?.uidNo || '';
}
const findNodeById = (nodes, productId) => {
diff --git a/src/views/qualityManagement/rawMaterialInspection/index.vue b/src/views/qualityManagement/rawMaterialInspection/index.vue
index 9751a86..c03608a 100644
--- a/src/views/qualityManagement/rawMaterialInspection/index.vue
+++ b/src/views/qualityManagement/rawMaterialInspection/index.vue
@@ -121,7 +121,7 @@
},
{
label: "UID鐮�",
- prop: "uidNO",
+ prop: "uidNo",
},
{
label: "鍗曚綅",
diff --git a/src/views/salesManagement/salesLedger/index.vue b/src/views/salesManagement/salesLedger/index.vue
index 884582d..ca1530f 100644
--- a/src/views/salesManagement/salesLedger/index.vue
+++ b/src/views/salesManagement/salesLedger/index.vue
@@ -367,6 +367,13 @@
</el-row>
<el-row :gutter="30">
<el-col :span="24">
+ <el-form-item label="UID鐮侊細" prop="uidNo">
+ <el-input v-model="productForm.uidNo" placeholder="璇疯緭鍏�" disabled />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="30">
+ <el-col :span="24">
<el-form-item label="鎵瑰彿锛�" prop="batchNo">
<el-select v-model="productForm.batchNo" placeholder="璇烽�夋嫨" clearable filterable>
<el-option v-for="item in batchNoOptions" :key="item.value" :label="item.label" :value="item.value" />
@@ -755,6 +762,7 @@
productForm: {
productCategory: "",
specificationModel: "",
+ uidNo: "",
unit: "",
quantity: "",
taxInclusiveUnitPrice: "",
@@ -959,9 +967,11 @@
if (index !== -1) {
productForm.value.specificationModel = modelOptions.value[index].model;
productForm.value.unit = modelOptions.value[index].unit;
+ productForm.value.uidNo = modelOptions.value[index].uidNo || "";
} else {
productForm.value.specificationModel = null;
productForm.value.unit = null;
+ productForm.value.uidNo = null;
}
};
const findNodeById = (nodes, productId) => {
@@ -1186,6 +1196,7 @@
// 鍙拌处瀛楁
productCategory: p.product || p.productName || "",
specificationModel: p.specification || "",
+ uidNo: p.uidNo || "",
unit: p.unit || "",
quantity: quantity,
taxRate: taxRate,
--
Gitblit v1.9.3