From 3ad68c3227062aa3a37f07b7b760c73eeee4bd5c Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sun, 4 Feb 2024 09:48:44 +0800 Subject: [PATCH] =?UTF-8?q?CRM=EF=BC=9A=E5=90=88=E5=90=8C=E7=9A=84=20code?= =?UTF-8?q?=20review?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/crm/contract/ContractForm.vue | 2 +- .../crm/contract/components/ProductList.vue | 16 +++++++++------- .../crm/contract/detail/ContractProductList.vue | 9 ++++++--- src/views/crm/contract/detail/index.vue | 1 + 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/views/crm/contract/ContractForm.vue b/src/views/crm/contract/ContractForm.vue index 79de3513..b955f3d4 100644 --- a/src/views/crm/contract/ContractForm.vue +++ b/src/views/crm/contract/ContractForm.vue @@ -192,7 +192,7 @@ const formRules = reactive({ const formRef = ref() // 表单 Ref const BPMLModelRef = ref>() // TODO @puhui999:这个变量不太对;另外,可以不做 bpm model 窗口,而是可以点击跳转到工作流详情里; -// 监听合同商品变化,计算合同商品总价 +// 监听合同产品变化,计算合同产品总价 watch( () => formData.value.productItems, (val) => { diff --git a/src/views/crm/contract/components/ProductList.vue b/src/views/crm/contract/components/ProductList.vue index a5672c75..d0c32bf4 100644 --- a/src/views/crm/contract/components/ProductList.vue +++ b/src/views/crm/contract/components/ProductList.vue @@ -42,7 +42,7 @@ - + @@ -76,7 +76,7 @@ const emits = defineEmits<{ (e: 'update:modelValue', v: any[]): void }>() -const list = ref([]) // 列表数量 +const list = ref([]) // 已添加的产品列表 const multipleSelection = ref([]) // 多选 /** 处理删除 */ @@ -100,8 +100,9 @@ const getTotalPrice = computed(() => (row: ProductApi.ProductExpandVO) => { row.totalPrice = isNaN(totalPrice) ? 0 : yuanToFen(totalPrice) return isNaN(totalPrice) ? 0 : totalPrice.toFixed(2) }) -const isSetListValue = ref(false) // 判断是否已经给 list 赋值过,用于编辑表单商品回显 -// 编辑时合同商品回显 + +/** 编辑时合同产品回显 */ +const isSetListValue = ref(false) // 判断是否已经给 list 赋值过,用于编辑表单产品回显 watch( () => props.modelValue, (val) => { @@ -118,7 +119,8 @@ watch( }, { immediate: true, deep: true } ) -// 监听列表变化,动态更新合同商品列表 + +/** 监听列表变化,动态更新合同产品列表 */ watch( list, (val) => { @@ -130,14 +132,14 @@ watch( { deep: true } ) -// 监听商品选择结果动态添加商品到列表中,如果商品存在则不放入列表中 +// 监听产品选择结果动态添加产品到列表中,如果产品存在则不放入列表中 watch( multipleSelection, (val) => { if (!val || val.length === 0) { return } - // 过滤出不在列表中的商品 + // 过滤出不在列表中的产品 const ids = list.value.map((item) => item.id) const productList = multipleSelection.value.filter((item) => ids.indexOf(item.id) === -1) if (!productList || productList.length === 0) { diff --git a/src/views/crm/contract/detail/ContractProductList.vue b/src/views/crm/contract/detail/ContractProductList.vue index 9a15c1fe..43c72be7 100644 --- a/src/views/crm/contract/detail/ContractProductList.vue +++ b/src/views/crm/contract/detail/ContractProductList.vue @@ -1,3 +1,4 @@ +