CRM:完善回款在合同、客户的引入

This commit is contained in:
YunaiV
2024-02-25 20:23:10 +08:00
parent c5e5228e78
commit 25665f548e
7 changed files with 59 additions and 29 deletions

View File

@@ -136,6 +136,7 @@ import * as CustomerApi from '@/api/crm/customer'
import * as ContractApi from '@/api/crm/contract'
import { useUserStore } from '@/store/modules/user'
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import { aw } from '../../../../../dist-prod/assets/index-9eac537b'
const { t } = useI18n() // 国际化
const message = useMessage() // 消息弹窗
@@ -157,7 +158,7 @@ const customerList = ref<CustomerApi.CustomerVO[]>([]) // 客户列表
const contractList = ref<ContractApi.ContractVO[]>([]) // 合同列表
/** 打开弹窗 */
const open = async (type: string, id?: number) => {
const open = async (type: string, id?: number, customerId?: number, contractId?: number) => {
dialogVisible.value = true
dialogTitle.value = t('action.' + type)
formType.value = type
@@ -179,6 +180,14 @@ const open = async (type: string, id?: number) => {
if (formType.value === 'create') {
formData.value.ownerUserId = useUserStore().getUser.id
}
// 设置 customerId 和 contractId 默认值
if (customerId) {
formData.value.customerId = customerId
await handleCustomerChange(customerId)
}
if (contractId) {
formData.value.contractId = contractId
}
}
defineExpose({ open }) // 提供 open 方法,用于打开弹窗

View File

@@ -1,7 +1,7 @@
<template>
<!-- 操作栏 -->
<el-row justify="end">
<el-button @click="openForm">
<el-button @click="openForm('create', undefined)">
<Icon class="mr-5px" icon="icon-park:income" />
创建回款计划
</el-button>
@@ -13,7 +13,13 @@
<el-table-column align="center" label="客户名称" prop="customerName" width="150px" />
<el-table-column align="center" label="合同编号" prop="contractNo" width="200px" />
<el-table-column align="center" label="期数" prop="period" />
<el-table-column align="center" label="计划回款(元)" prop="price" width="120" />
<el-table-column
align="center"
label="计划回款(元)"
prop="price"
width="120"
:formatter="erpPriceTableColumnFormatter"
/>
<el-table-column
:formatter="dateFormatter2"
align="center"
@@ -37,7 +43,8 @@
v-hasPermi="['crm:receivable:create']"
link
type="primary"
@click="crateReceivable(scope.row)"
@click="createReceivable(scope.row)"
:disabled="scope.row.receivableId"
>
创建回款
</el-button>
@@ -75,8 +82,8 @@
<script lang="ts" setup>
import * as ReceivablePlanApi from '@/api/crm/receivable/plan'
import ReceivableForm from './../ReceivablePlanForm.vue'
import { DICT_TYPE } from '@/utils/dict'
import { dateFormatter2 } from '@/utils/formatTime'
import { erpPriceTableColumnFormatter } from '@/utils'
defineOptions({ name: 'CrmReceivablePlanList' })
const props = defineProps<{
@@ -127,16 +134,15 @@ const handleQuery = () => {
/** 添加/修改操作 */
const formRef = ref()
const openForm = (type: string, id?: number) => {
formRef.value.open(type, id)
formRef.value.open(type, id, props.customerId, props.contractId)
}
// todo @puhui999拼写错误
const emits = defineEmits<{
(e: 'crateReceivable', v: ReceivablePlanApi.ReceivablePlanVO)
}>()
/** 创建回款 */
const crateReceivable = (row: ReceivablePlanApi.ReceivablePlanVO) => {
emits('crateReceivable', row)
const emits = defineEmits<{
(e: 'createReceivable', v: ReceivablePlanApi.ReceivablePlanVO)
}>()
const createReceivable = (row: ReceivablePlanApi.ReceivablePlanVO) => {
emits('createReceivable', row)
}
/** 删除按钮操作 */