CRM:合同的 code review

(cherry picked from commit 3ad68c3227)
This commit is contained in:
YunaiV 2024-02-04 09:48:44 +08:00 committed by shizhong
parent d4eb24798b
commit b0a6af4b40
4 changed files with 17 additions and 11 deletions

View File

@ -192,7 +192,7 @@ const formRules = reactive({
const formRef = ref() // Ref const formRef = ref() // Ref
const BPMLModelRef = ref<InstanceType<typeof BPMLModel>>() // TODO @puhui999 bpm model const BPMLModelRef = ref<InstanceType<typeof BPMLModel>>() // TODO @puhui999 bpm model
// //
watch( watch(
() => formData.value.productItems, () => formData.value.productItems,
(val) => { (val) => {

View File

@ -42,7 +42,7 @@
</el-table> </el-table>
<!-- table 选择表单 --> <!-- table 选择表单 -->
<TableSelectForm ref="tableSelectFormRef" v-model="multipleSelection" title="选择品"> <TableSelectForm ref="tableSelectFormRef" v-model="multipleSelection" title="选择品">
<el-table-column align="center" label="产品名称" prop="name" width="160" /> <el-table-column align="center" label="产品名称" prop="name" width="160" />
<el-table-column align="center" label="产品类型" prop="categoryName" width="160" /> <el-table-column align="center" label="产品类型" prop="categoryName" width="160" />
<el-table-column align="center" label="产品单位" prop="unit"> <el-table-column align="center" label="产品单位" prop="unit">
@ -76,7 +76,7 @@ const emits = defineEmits<{
(e: 'update:modelValue', v: any[]): void (e: 'update:modelValue', v: any[]): void
}>() }>()
const list = ref<ProductApi.ProductExpandVO[]>([]) // const list = ref<ProductApi.ProductExpandVO[]>([]) //
const multipleSelection = ref<ProductApi.ProductExpandVO[]>([]) // const multipleSelection = ref<ProductApi.ProductExpandVO[]>([]) //
/** 处理删除 */ /** 处理删除 */
@ -100,8 +100,9 @@ const getTotalPrice = computed(() => (row: ProductApi.ProductExpandVO) => {
row.totalPrice = isNaN(totalPrice) ? 0 : yuanToFen(totalPrice) row.totalPrice = isNaN(totalPrice) ? 0 : yuanToFen(totalPrice)
return isNaN(totalPrice) ? 0 : totalPrice.toFixed(2) return isNaN(totalPrice) ? 0 : totalPrice.toFixed(2)
}) })
const isSetListValue = ref(false) // list
// /** 编辑时合同产品回显 */
const isSetListValue = ref(false) // list
watch( watch(
() => props.modelValue, () => props.modelValue,
(val) => { (val) => {
@ -118,7 +119,8 @@ watch(
}, },
{ immediate: true, deep: true } { immediate: true, deep: true }
) )
//
/** 监听列表变化,动态更新合同产品列表 */
watch( watch(
list, list,
(val) => { (val) => {
@ -130,14 +132,14 @@ watch(
{ deep: true } { deep: true }
) )
// , // ,
watch( watch(
multipleSelection, multipleSelection,
(val) => { (val) => {
if (!val || val.length === 0) { if (!val || val.length === 0) {
return return
} }
// //
const ids = list.value.map((item) => item.id) const ids = list.value.map((item) => item.id)
const productList = multipleSelection.value.filter((item) => ids.indexOf(item.id) === -1) const productList = multipleSelection.value.filter((item) => ids.indexOf(item.id) === -1)
if (!productList || productList.length === 0) { if (!productList || productList.length === 0) {

View File

@ -1,3 +1,4 @@
<!-- 合同详情产品列表 -->
<template> <template>
<el-table :data="list" :show-overflow-tooltip="true" :stripe="true"> <el-table :data="list" :show-overflow-tooltip="true" :stripe="true">
<el-table-column align="center" label="产品名称" prop="name" width="160" /> <el-table-column align="center" label="产品名称" prop="name" width="160" />
@ -35,7 +36,8 @@ defineOptions({ name: 'ContractProductList' })
const props = withDefaults(defineProps<{ modelValue: ProductApi.ProductExpandVO[] }>(), { const props = withDefaults(defineProps<{ modelValue: ProductApi.ProductExpandVO[] }>(), {
modelValue: () => [] modelValue: () => []
}) })
const list = ref<ProductApi.ProductExpandVO[]>([]) // const list = ref<ProductApi.ProductExpandVO[]>([]) //
/** 计算 totalPrice */ /** 计算 totalPrice */
const getTotalPrice = computed(() => (row: ProductApi.ProductExpandVO) => { const getTotalPrice = computed(() => (row: ProductApi.ProductExpandVO) => {
const totalPrice = const totalPrice =
@ -43,8 +45,9 @@ const getTotalPrice = computed(() => (row: ProductApi.ProductExpandVO) => {
row.totalPrice = isNaN(totalPrice) ? 0 : yuanToFen(totalPrice) row.totalPrice = isNaN(totalPrice) ? 0 : yuanToFen(totalPrice)
return isNaN(totalPrice) ? 0 : totalPrice.toFixed(2) return isNaN(totalPrice) ? 0 : totalPrice.toFixed(2)
}) })
const isSetListValue = ref(false) // list
// /** 编辑时合同产品回显 */
const isSetListValue = ref(false) // list
watch( watch(
() => props.modelValue, () => props.modelValue,
(val) => { (val) => {

View File

@ -87,6 +87,7 @@ const getOperateLog = async (contractId: number) => {
} }
/** 转移 */ /** 转移 */
// TODO @puhui999 title api
const transferFormRef = ref<InstanceType<typeof CrmTransferForm>>() // ref const transferFormRef = ref<InstanceType<typeof CrmTransferForm>>() // ref
const transferContract = () => { const transferContract = () => {
transferFormRef.value?.open('合同转移', contract.value.id, ContractApi.transferContract) transferFormRef.value?.open('合同转移', contract.value.id, ContractApi.transferContract)