From 66779370f23cd8f8498cdd3809e7e9c62e79de76 Mon Sep 17 00:00:00 2001
From: chenshuichuan <1154693969@qq.com>
Date: Sat, 25 May 2024 15:58:29 +0800
Subject: [PATCH] fix product
---
src/views/erp/mold/MoldBrandForm.vue | 44 ++++++++++++------
src/views/erp/mold/components/MoldList.vue | 1 -
src/views/erp/mold/index.vue | 28 +++++++----
src/views/erp/product/product/ProductForm.vue | 4 +-
src/views/mes/bom/BomForm.vue | 25 ++++++++--
.../mes/bom/components/BomDetailForm.vue | 46 ++++++++++++++++---
.../mes/bom/components/BomDetailList.vue | 6 +--
src/views/mes/bom/index.vue | 31 +++++++++----
8 files changed, 137 insertions(+), 48 deletions(-)
diff --git a/src/views/erp/mold/MoldBrandForm.vue b/src/views/erp/mold/MoldBrandForm.vue
index 71893f5a..203422f8 100644
--- a/src/views/erp/mold/MoldBrandForm.vue
+++ b/src/views/erp/mold/MoldBrandForm.vue
@@ -16,15 +16,29 @@
-
-
+
+
+
+
-
@@ -38,11 +52,12 @@
-
@@ -72,13 +87,13 @@
\ No newline at end of file
+
+
diff --git a/src/views/erp/mold/components/MoldList.vue b/src/views/erp/mold/components/MoldList.vue
index d40017b1..b68c3766 100644
--- a/src/views/erp/mold/components/MoldList.vue
+++ b/src/views/erp/mold/components/MoldList.vue
@@ -13,7 +13,6 @@
-
diff --git a/src/views/erp/mold/index.vue b/src/views/erp/mold/index.vue
index 2ad1245e..98210c01 100644
--- a/src/views/erp/mold/index.vue
+++ b/src/views/erp/mold/index.vue
@@ -35,14 +35,21 @@
class="!w-240px"
/>
-
-
+
+ >
+
+
@@ -190,13 +197,14 @@ import download from '@/utils/download'
import { MoldBrandApi, MoldBrandVO } from '@/api/erp/mold'
import MoldBrandForm from './MoldBrandForm.vue'
import MoldList from './components/MoldList.vue'
+import { ProductApi, ProductVO } from '@/api/erp/product/product'
/** 模具型号 列表 */
defineOptions({ name: 'MoldBrand' })
const message = useMessage() // 消息弹窗
const { t } = useI18n() // 国际化
-
+const productList = ref([]) // 产品列表
const loading = ref(true) // 列表的加载中
const list = ref([]) // 列表的数据
const total = ref(0) // 列表的总页数
@@ -283,7 +291,9 @@ const handleCurrentChange = (row) => {
}
/** 初始化 **/
-onMounted(() => {
- getList()
+onMounted(async () => {
+ await getList()
+ // 加载产品、
+ productList.value = await ProductApi.getProductSimpleList()
})
-
\ No newline at end of file
+
diff --git a/src/views/erp/product/product/ProductForm.vue b/src/views/erp/product/product/ProductForm.vue
index 3f9de0ad..e013f828 100644
--- a/src/views/erp/product/product/ProductForm.vue
+++ b/src/views/erp/product/product/ProductForm.vue
@@ -74,10 +74,10 @@
-
+
diff --git a/src/views/mes/bom/BomForm.vue b/src/views/mes/bom/BomForm.vue
index 4e49ed74..ee883cbc 100644
--- a/src/views/mes/bom/BomForm.vue
+++ b/src/views/mes/bom/BomForm.vue
@@ -13,8 +13,21 @@
-
-
+
+
+
+
@@ -61,6 +74,9 @@ import { getBoolDictOptions, DICT_TYPE } from '@/utils/dict'
import { BomApi, BomVO } from '@/api/mes/bom'
import BomDetailForm from './components/BomDetailForm.vue'
import { ProductUnitApi, ProductUnitVO } from '@/api/erp/product/unit'
+import { ProductApi, ProductVO } from '@/api/erp/product/product'
+
+const productList = ref([]) // 产品列表
const unitList = ref([]) // 产品单位列表
/** 产品BOM 表单 */
@@ -113,7 +129,8 @@ const open = async (type: string, id?: number) => {
}
// 产品单位
unitList.value = await ProductUnitApi.getProductUnitSimpleList()
-
+ // 加载产品、
+ productList.value = await ProductApi.getProductSimpleList()
}
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
@@ -164,4 +181,4 @@ const resetForm = () => {
}
formRef.value?.resetFields()
}
-
\ No newline at end of file
+
diff --git a/src/views/mes/bom/components/BomDetailForm.vue b/src/views/mes/bom/components/BomDetailForm.vue
index 197aafd7..93e1f363 100644
--- a/src/views/mes/bom/components/BomDetailForm.vue
+++ b/src/views/mes/bom/components/BomDetailForm.vue
@@ -12,14 +12,27 @@
-
+
+
+
-
+
([]) // 产品单位列表
+import {ProductApi, ProductVO} from "@/api/erp/product/product";
+const unitList = ref([]) // 产品单位列表
+const productList = ref([]) // 产品列表
const props = defineProps<{
bomId: undefined // BOM ID(主表的关联字段)
}>()
@@ -81,6 +96,17 @@ const formRules = reactive({
})
const formRef = ref() // 表单 Ref
+/** 初始化 */
+onMounted(async () => {
+ // 产品单位
+ unitList.value = await ProductUnitApi.getProductUnitSimpleList()
+ productList.value = await ProductApi.getProductSimpleList()
+ // 默认添加一个
+ if (formData.value.length === 0) {
+ handleAdd()
+ }
+})
+
/** 监听主表的关联字段的变化,加载对应的子表数据 */
watch(
() => props.bomId,
@@ -97,8 +123,6 @@ watch(
} finally {
formLoading.value = false
}
- // 产品单位
- unitList.value = await ProductUnitApi.getProductUnitSimpleList()
},
{ immediate: true }
@@ -136,4 +160,14 @@ const getData = () => {
}
defineExpose({ validate, getData })
-
\ No newline at end of file
+
+/** 处理产品变更 */
+const onChangeProduct = (productId, row) => {
+ const product = productList.value.find((item) => item.id === productId)
+ if (product) {
+ // row.productUnitName = product.unitName
+ }
+ // // 加载库存
+ // setStockCount(row)
+}
+
diff --git a/src/views/mes/bom/components/BomDetailList.vue b/src/views/mes/bom/components/BomDetailList.vue
index 939bc073..aa828597 100644
--- a/src/views/mes/bom/components/BomDetailList.vue
+++ b/src/views/mes/bom/components/BomDetailList.vue
@@ -3,8 +3,8 @@
-
-
+
+
@@ -57,4 +57,4 @@ const handleQuery = () => {
onMounted(() => {
getList()
})
-
\ No newline at end of file
+
diff --git a/src/views/mes/bom/index.vue b/src/views/mes/bom/index.vue
index 418fca46..bb8ecd36 100644
--- a/src/views/mes/bom/index.vue
+++ b/src/views/mes/bom/index.vue
@@ -26,14 +26,21 @@
class="!w-240px"
/>
-
-
+
+ >
+
+
@@ -101,8 +108,8 @@
-
-
+
+
@@ -158,7 +165,9 @@ import download from '@/utils/download'
import { BomApi, BomVO } from '@/api/mes/bom'
import BomForm from './BomForm.vue'
import BomDetailList from './components/BomDetailList.vue'
+import { ProductApi, ProductVO } from '@/api/erp/product/product'
+const productList = ref([]) // 产品列表
/** 产品BOM 列表 */
defineOptions({ name: 'Bom' })
@@ -242,7 +251,9 @@ const handleExport = async () => {
}
/** 初始化 **/
-onMounted(() => {
- getList()
+onMounted(async () => {
+ await getList()
+ // 加载产品、
+ productList.value = await ProductApi.getProductSimpleList()
})
-
\ No newline at end of file
+