From 21a2d6f813f3d58b494fde010f66bd84ce2f1d41 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期三, 12 八月 2026 13:06:04 +0800
Subject: [PATCH] fix: MOM 1.修改物料弹框的SIP与SOP改为中文
---
src/views/erp/sale/order/modules/item-form.vue | 49 +++++++++++++++++++++++++++++--------------------
1 files changed, 29 insertions(+), 20 deletions(-)
diff --git a/src/views/erp/sale/order/modules/item-form.vue b/src/views/erp/sale/order/modules/item-form.vue
index f84d5ac..ffd3207 100644
--- a/src/views/erp/sale/order/modules/item-form.vue
+++ b/src/views/erp/sale/order/modules/item-form.vue
@@ -1,5 +1,4 @@
<script lang="ts" setup>
-import type { MdmItemApi } from '#/api/mdm/item';
import type { ErpSaleOrderApi } from '#/api/erp/sale/order';
import { computed, nextTick, onMounted, ref, watch } from 'vue';
@@ -10,11 +9,10 @@
erpPriceMultiply,
} from '@vben/utils';
-import { Input, InputNumber, Select } from 'ant-design-vue';
+import { Input, InputNumber, Select, Tag } from 'ant-design-vue';
import { TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
-import { getItemPage } from '#/api/mdm/item';
-import { getStockCount } from '#/api/erp/stock/stock';
+import { MdmItemSelect } from '#/views/basicData/mdm/components';
import { useFormItemColumns } from '../data';
@@ -36,8 +34,7 @@
'update:totalPrice',
]);
-const tableData = ref<ErpSaleOrderApi.SaleOrderItem[]>([]); // 琛ㄦ牸鏁版嵁
-const productOptions = ref<MdmItemApi.Item[]>([]); // 鐗╂枡涓嬫媺閫夐」
+const tableData = ref<ErpSaleOrderApi.SaleOrderItem[]>([]);
/** 鑾峰彇琛ㄦ牸鍚堣鏁版嵁 */
const summaries = computed(() => {
@@ -124,8 +121,7 @@
const newRow = {
id: undefined,
productId: undefined,
- productUnitName: undefined, // 浜у搧鍗曚綅
- productBarCode: undefined, // 浜у搧鏉$爜
+ productUnitName: undefined,
productPrice: undefined,
stockCount: undefined,
count: 1,
@@ -134,6 +130,7 @@
taxPrice: undefined,
totalPrice: undefined,
remark: undefined,
+ needProduction: 1,
};
tableData.value.push(newRow);
// 閫氱煡鐖剁粍浠舵洿鏂�
@@ -152,12 +149,11 @@
}
/** 澶勭悊浜у搧鍙樻洿 */
-async function handleProductChange(productId: any, row: any) {
- const product = productOptions.value.find((p) => p.id === productId);
+function handleProductChange(product: any, row: any) {
if (!product) {
return;
}
- row.productId = productId;
+ row.productId = product.id;
row.productUnitId = product.unitMeasureId;
row.productBarCode = product.barCode;
row.productUnitName = product.unitMeasureName;
@@ -165,7 +161,6 @@
row.productUnitName3 = product.unitMeasureName3;
row.productSpecification = product.specification;
row.productName = product.name;
- row.stockCount = (await getStockCount(productId)) || 0;
row.productPrice = product.salesPrice || 0;
row.count = row.count || 1;
handleRowChange(row);
@@ -189,6 +184,10 @@
row.taxPrice =
erpPriceMultiply(row.totalProductPrice, (row.taxPercent || 0) / 100) ?? 0;
row.totalPrice = row.totalProductPrice + row.taxPrice;
+ }
+ // 榛樿闇�瑕佺敓浜�
+ if (row.needProduction === undefined) {
+ row.needProduction = 1;
}
}
@@ -216,8 +215,6 @@
/** 鍒濆鍖� */
onMounted(async () => {
- const res = await getItemPage({ pageNo: 1, pageSize: 100, status: 0 });
- productOptions.value = res.list || [];
// 鐩殑锛氭柊澧炴椂锛岄粯璁ゆ坊鍔犱竴琛�
if (tableData.value.length === 0) {
handleAdd();
@@ -228,18 +225,30 @@
<template>
<Grid class="w-full">
<template #productId="{ row }">
- <Select
+ <MdmItemSelect
v-if="!disabled"
- v-model:value="row.productId"
- :options="productOptions"
- :field-names="{ label: 'name', value: 'id' }"
- class="w-full"
+ :model-value="row.productId"
placeholder="璇烽�夋嫨浜у搧"
- show-search
+ @update:model-value="row.productId = $event"
@change="handleProductChange($event, row)"
/>
<span v-else>{{ row.productName || '-' }}</span>
</template>
+ <template #needProduction="{ row }">
+ <Select
+ v-if="!disabled"
+ v-model:value="row.needProduction"
+ :options="[
+ { label: '鏄�', value: 1 },
+ { label: '鍚�', value: 0 },
+ ]"
+ class="w-full"
+ placeholder="璇烽�夋嫨"
+ @change="handleRowChange(row)"
+ />
+ <Tag v-else-if="row.needProduction === 1" color="success">鏄�</Tag>
+ <Tag v-else color="default">鍚�</Tag>
+ </template>
<template #count="{ row }">
<InputNumber
v-if="!disabled"
--
Gitblit v1.9.3