commit
f30f71b775
|
@ -65,6 +65,13 @@ export const getContract = async (id: number) => {
|
||||||
return await request.get({ url: `/crm/contract/get?id=` + id })
|
return await request.get({ url: `/crm/contract/get?id=` + id })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 查询 CRM 合同下拉列表
|
||||||
|
export const getCrmContractSimpleListByCustomerId = async (customerId: number) => {
|
||||||
|
return await request.get({
|
||||||
|
url: `/crm/contract/list-all-simple-by-customer?customerId=${customerId}`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 新增 CRM 合同
|
// 新增 CRM 合同
|
||||||
export const createContract = async (data: ContractVO) => {
|
export const createContract = async (data: ContractVO) => {
|
||||||
return await request.post({ url: `/crm/contract/create`, data })
|
return await request.post({ url: `/crm/contract/create`, data })
|
||||||
|
|
|
@ -90,6 +90,11 @@ export const importCustomerTemplate = () => {
|
||||||
return request.download({ url: '/crm/customer/get-import-template' })
|
return request.download({ url: '/crm/customer/get-import-template' })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 导入客户
|
||||||
|
export const handleImport = async (formData) => {
|
||||||
|
return await request.upload({ url: `/crm/customer/import`, data: formData })
|
||||||
|
}
|
||||||
|
|
||||||
// 客户列表
|
// 客户列表
|
||||||
export const getCustomerSimpleList = async () => {
|
export const getCustomerSimpleList = async () => {
|
||||||
return await request.get({ url: `/crm/customer/simple-list` })
|
return await request.get({ url: `/crm/customer/simple-list` })
|
||||||
|
|
|
@ -12,7 +12,6 @@ export interface ReceivableVO {
|
||||||
returnType: string
|
returnType: string
|
||||||
price: number
|
price: number
|
||||||
ownerUserId: number
|
ownerUserId: number
|
||||||
sort: number
|
|
||||||
remark: string
|
remark: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,3 +49,8 @@ export const deleteReceivable = async (id: number) => {
|
||||||
export const exportReceivable = async (params) => {
|
export const exportReceivable = async (params) => {
|
||||||
return await request.download({ url: `/crm/receivable/export-excel`, params })
|
return await request.download({ url: `/crm/receivable/export-excel`, params })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 提交审核
|
||||||
|
export const submitReceivable = async (id: number) => {
|
||||||
|
return await request.put({ url: `/crm/receivable/submit?id=${id}` })
|
||||||
|
}
|
||||||
|
|
|
@ -4,8 +4,7 @@ export interface ReceivablePlanVO {
|
||||||
id: number
|
id: number
|
||||||
period: number
|
period: number
|
||||||
receivableId: number
|
receivableId: number
|
||||||
status: number
|
finishStatus: number
|
||||||
checkStatus: string
|
|
||||||
processInstanceId: number
|
processInstanceId: number
|
||||||
price: number
|
price: number
|
||||||
returnTime: Date
|
returnTime: Date
|
||||||
|
@ -14,7 +13,6 @@ export interface ReceivablePlanVO {
|
||||||
customerId: number
|
customerId: number
|
||||||
contractId: number
|
contractId: number
|
||||||
ownerUserId: number
|
ownerUserId: number
|
||||||
sort: number
|
|
||||||
remark: string
|
remark: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,6 +31,13 @@ export const getReceivablePlan = async (id: number) => {
|
||||||
return await request.get({ url: `/crm/receivable-plan/get?id=` + id })
|
return await request.get({ url: `/crm/receivable-plan/get?id=` + id })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 查询回款计划下拉数据
|
||||||
|
export const getReceivablePlanListByContractId = async (customerId: number, contractId: number) => {
|
||||||
|
return await request.get({
|
||||||
|
url: `/crm/receivable-plan/list-all-simple-by-customer?customerId=${customerId}&contractId=${contractId}`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 新增回款计划
|
// 新增回款计划
|
||||||
export const createReceivablePlan = async (data: ReceivablePlanVO) => {
|
export const createReceivablePlan = async (data: ReceivablePlanVO) => {
|
||||||
return await request.post({ url: `/crm/receivable-plan/create`, data })
|
return await request.post({ url: `/crm/receivable-plan/create`, data })
|
||||||
|
|
|
@ -19,8 +19,18 @@
|
||||||
<el-tab-pane label="产品">
|
<el-tab-pane label="产品">
|
||||||
<ContractProductList :contract="contract" />
|
<ContractProductList :contract="contract" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<!-- TODO @puhui999:回款信息 -->
|
<el-tab-pane label="回款">
|
||||||
<el-tab-pane label="回款"> 123 </el-tab-pane>
|
<ReceivablePlanList
|
||||||
|
:contract-id="contract.id!"
|
||||||
|
:customer-id="contract.customerId"
|
||||||
|
@crate-receivable="crateReceivable"
|
||||||
|
/>
|
||||||
|
<ReceivableList
|
||||||
|
ref="receivableListRef"
|
||||||
|
:contract-id="contract.id!"
|
||||||
|
:customer-id="contract.customerId"
|
||||||
|
/>
|
||||||
|
</el-tab-pane>
|
||||||
<el-tab-pane label="团队成员">
|
<el-tab-pane label="团队成员">
|
||||||
<PermissionList
|
<PermissionList
|
||||||
ref="permissionListRef"
|
ref="permissionListRef"
|
||||||
|
@ -53,6 +63,8 @@ import ContractForm from '@/views/crm/contract/ContractForm.vue'
|
||||||
import CrmTransferForm from '@/views/crm/permission/components/TransferForm.vue'
|
import CrmTransferForm from '@/views/crm/permission/components/TransferForm.vue'
|
||||||
import PermissionList from '@/views/crm/permission/components/PermissionList.vue'
|
import PermissionList from '@/views/crm/permission/components/PermissionList.vue'
|
||||||
import FollowUpList from '@/views/crm/followup/index.vue'
|
import FollowUpList from '@/views/crm/followup/index.vue'
|
||||||
|
import ReceivableList from '@/views/crm/receivable/components/ReceivableList.vue'
|
||||||
|
import ReceivablePlanList from '@/views/crm/receivable/plan/components/ReceivablePlanList.vue'
|
||||||
|
|
||||||
defineOptions({ name: 'CrmContractDetail' })
|
defineOptions({ name: 'CrmContractDetail' })
|
||||||
const props = defineProps<{ id?: number }>()
|
const props = defineProps<{ id?: number }>()
|
||||||
|
@ -94,8 +106,14 @@ const getOperateLog = async (contractId: number) => {
|
||||||
logList.value = data.list
|
logList.value = data.list
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 从回款计划创建回款 */
|
||||||
|
const receivableListRef = ref<InstanceType<typeof ReceivableList>>() // 回款列表 Ref
|
||||||
|
const crateReceivable = (planData: any) => {
|
||||||
|
receivableListRef.value?.crateReceivable(planData)
|
||||||
|
}
|
||||||
|
|
||||||
/** 转移 */
|
/** 转移 */
|
||||||
// TODO @puhui999:这个组件,要不传递业务类型,然后组件里判断 title 和 api 能调用哪个;整体治理掉;
|
// 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)
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
<el-upload
|
<el-upload
|
||||||
ref="uploadRef"
|
ref="uploadRef"
|
||||||
v-model:file-list="fileList"
|
v-model:file-list="fileList"
|
||||||
:action="importUrl + '?updateSupport=' + updateSupport"
|
|
||||||
:auto-upload="false"
|
:auto-upload="false"
|
||||||
:disabled="formLoading"
|
:disabled="formLoading"
|
||||||
:headers="uploadHeaders"
|
:headers="uploadHeaders"
|
||||||
|
@ -13,6 +12,7 @@
|
||||||
:on-exceed="handleExceed"
|
:on-exceed="handleExceed"
|
||||||
:on-success="submitFormSuccess"
|
:on-success="submitFormSuccess"
|
||||||
accept=".xlsx, .xls"
|
accept=".xlsx, .xls"
|
||||||
|
action="none"
|
||||||
drag
|
drag
|
||||||
>
|
>
|
||||||
<Icon icon="ep:upload" />
|
<Icon icon="ep:upload" />
|
||||||
|
@ -45,6 +45,7 @@
|
||||||
import * as CustomerApi from '@/api/crm/customer'
|
import * as CustomerApi from '@/api/crm/customer'
|
||||||
import { getAccessToken, getTenantId } from '@/utils/auth'
|
import { getAccessToken, getTenantId } from '@/utils/auth'
|
||||||
import download from '@/utils/download'
|
import download from '@/utils/download'
|
||||||
|
import type { UploadUserFile } from 'element-plus'
|
||||||
|
|
||||||
defineOptions({ name: 'SystemUserImportForm' })
|
defineOptions({ name: 'SystemUserImportForm' })
|
||||||
|
|
||||||
|
@ -53,11 +54,9 @@ const message = useMessage() // 消息弹窗
|
||||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||||
const formLoading = ref(false) // 表单的加载中
|
const formLoading = ref(false) // 表单的加载中
|
||||||
const uploadRef = ref()
|
const uploadRef = ref()
|
||||||
const importUrl =
|
|
||||||
import.meta.env.VITE_BASE_URL + import.meta.env.VITE_API_URL + '/crm/customer/import'
|
|
||||||
const uploadHeaders = ref() // 上传 Header 头
|
const uploadHeaders = ref() // 上传 Header 头
|
||||||
const fileList = ref([]) // 文件列表
|
const fileList = ref<UploadUserFile[]>([]) // 文件列表
|
||||||
const updateSupport = ref(0) // 是否更新已经存在的客户数据
|
const updateSupport = ref(false) // 是否更新已经存在的客户数据
|
||||||
|
|
||||||
/** 打开弹窗 */
|
/** 打开弹窗 */
|
||||||
const open = () => {
|
const open = () => {
|
||||||
|
@ -79,7 +78,10 @@ const submitForm = async () => {
|
||||||
'tenant-id': getTenantId()
|
'tenant-id': getTenantId()
|
||||||
}
|
}
|
||||||
formLoading.value = true
|
formLoading.value = true
|
||||||
uploadRef.value!.submit()
|
const formData = new FormData()
|
||||||
|
formData.append('updateSupport', updateSupport.value)
|
||||||
|
formData.append('file', fileList.value[0].raw)
|
||||||
|
await CustomerApi.handleImport(formData)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 文件上传成功 */
|
/** 文件上传成功 */
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
>
|
>
|
||||||
锁定
|
锁定
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button v-if="!customer.ownerUserId" type="primary" @click="handleReceive"> 领取 </el-button>
|
<el-button v-if="!customer.ownerUserId" type="primary" @click="handleReceive"> 领取</el-button>
|
||||||
<el-button v-if="!customer.ownerUserId" type="primary" @click="handleDistributeForm">
|
<el-button v-if="!customer.ownerUserId" type="primary" @click="handleDistributeForm">
|
||||||
分配
|
分配
|
||||||
</el-button>
|
</el-button>
|
||||||
|
@ -64,8 +64,8 @@
|
||||||
<ContractList :biz-id="customer.id!" :biz-type="BizTypeEnum.CRM_CUSTOMER" />
|
<ContractList :biz-id="customer.id!" :biz-type="BizTypeEnum.CRM_CUSTOMER" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="回款" lazy>
|
<el-tab-pane label="回款" lazy>
|
||||||
<ReceivablePlanList :biz-id="customer.id!" :biz-type="BizTypeEnum.CRM_CUSTOMER" />
|
<ReceivablePlanList :customer-id="customer.id!" @crate-receivable="crateReceivable" />
|
||||||
<ReceivableList :biz-id="customer.id!" :biz-type="BizTypeEnum.CRM_CUSTOMER" />
|
<ReceivableList ref="receivableListRef" :customer-id="customer.id!" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="操作日志">
|
<el-tab-pane label="操作日志">
|
||||||
<OperateLogV2 :log-list="logList" />
|
<OperateLogV2 :log-list="logList" />
|
||||||
|
@ -197,6 +197,12 @@ const getOperateLog = async () => {
|
||||||
logList.value = data.list
|
logList.value = data.list
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 从回款计划创建回款 */
|
||||||
|
const receivableListRef = ref<InstanceType<typeof ReceivableList>>() // 回款列表 Ref
|
||||||
|
const crateReceivable = (planData: any) => {
|
||||||
|
receivableListRef.value?.crateReceivable(planData)
|
||||||
|
}
|
||||||
|
|
||||||
const close = () => {
|
const close = () => {
|
||||||
delView(unref(currentRoute))
|
delView(unref(currentRoute))
|
||||||
push({ name: 'CrmCustomer' })
|
push({ name: 'CrmCustomer' })
|
||||||
|
|
|
@ -1,98 +1,134 @@
|
||||||
<template>
|
<template>
|
||||||
<Dialog :title="dialogTitle" v-model="dialogVisible">
|
<Dialog v-model="dialogVisible" :title="dialogTitle">
|
||||||
<el-form
|
<el-form
|
||||||
ref="formRef"
|
ref="formRef"
|
||||||
|
v-loading="formLoading"
|
||||||
:model="formData"
|
:model="formData"
|
||||||
:rules="formRules"
|
:rules="formRules"
|
||||||
label-width="100px"
|
label-width="100px"
|
||||||
v-loading="formLoading"
|
|
||||||
>
|
>
|
||||||
<el-form-item label="回款编号" prop="no">
|
<el-row>
|
||||||
<el-input v-model="formData.no" placeholder="请输入回款编号" />
|
<el-col :span="12">
|
||||||
</el-form-item>
|
<el-form-item label="回款编号" prop="no">
|
||||||
<el-form-item label="回款计划" prop="planId">
|
<el-input v-model="formData.no" placeholder="请输入回款编号" />
|
||||||
<el-input v-model="formData.planId" placeholder="请输入回款计划" />
|
</el-form-item>
|
||||||
</el-form-item>
|
</el-col>
|
||||||
<el-form-item label="客户名称" prop="customerId">
|
<el-col :span="12">
|
||||||
<el-input v-model="formData.customerId" placeholder="请输入客户名称" />
|
<el-form-item label="客户名称" prop="customerId">
|
||||||
</el-form-item>
|
<el-select v-model="formData.customerId" class="w-1/1" placeholder="请选择客户">
|
||||||
<el-form-item label="合同名称" prop="contractId">
|
<el-option
|
||||||
<el-input v-model="formData.contractId" placeholder="请输入合同名称" />
|
v-for="item in customerList"
|
||||||
</el-form-item>
|
:key="item.id"
|
||||||
<!--<el-form-item label="审批状态" prop="checkStatus">
|
:label="item.name"
|
||||||
<el-select v-model="formData.checkStatus" placeholder="请选择审批状态">
|
:value="item.id"
|
||||||
<el-option
|
/>
|
||||||
v-for="dict in getIntDictOptions(DICT_TYPE.CRM_RECEIVABLE_CHECK_STATUS)"
|
</el-select>
|
||||||
:key="dict.value"
|
</el-form-item>
|
||||||
:label="dict.label"
|
</el-col>
|
||||||
:value="dict.value"
|
<el-col :span="12">
|
||||||
/>
|
<el-form-item label="合同名称" prop="contractId">
|
||||||
</el-select>
|
<el-select
|
||||||
</el-form-item>-->
|
v-model="formData.contractId"
|
||||||
<!--<el-form-item label="工作流编号" prop="processInstanceId">
|
:disabled="!formData.customerId"
|
||||||
<el-input v-model="formData.processInstanceId" placeholder="请输入工作流编号" />
|
class="!w-100%"
|
||||||
</el-form-item>-->
|
placeholder="请选择合同"
|
||||||
<el-form-item label="回款日期" prop="returnTime">
|
>
|
||||||
<el-date-picker
|
<el-option
|
||||||
v-model="formData.returnTime"
|
v-for="data in contractList"
|
||||||
type="date"
|
:key="data.id"
|
||||||
value-format="x"
|
:label="data.name"
|
||||||
placeholder="选择回款日期"
|
:value="data.id!"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-select>
|
||||||
<el-form-item label="回款方式" prop="returnType">
|
</el-form-item>
|
||||||
<el-select v-model="formData.returnType" placeholder="请选择回款方式">
|
</el-col>
|
||||||
<el-option
|
<el-col :span="12">
|
||||||
v-for="dict in getStrDictOptions(DICT_TYPE.CRM_RECEIVABLE_RETURN_TYPE)"
|
<el-form-item label="回款期数" prop="planId">
|
||||||
:key="dict.value"
|
<el-select
|
||||||
:label="dict.label"
|
v-model="formData.planId"
|
||||||
:value="dict.value"
|
:disabled="!formData.contractId"
|
||||||
/>
|
class="!w-100%"
|
||||||
</el-select>
|
placeholder="请选择回款期数"
|
||||||
</el-form-item>
|
>
|
||||||
<el-form-item label="回款金额" prop="price">
|
<el-option
|
||||||
<el-input-number v-model="formData.price" placeholder="请输入回款金额" />
|
v-for="data in receivablePlanList"
|
||||||
</el-form-item>
|
:key="data.id"
|
||||||
<el-form-item label="负责人" prop="ownerUserId">
|
:label="data.period + '期'"
|
||||||
<el-select v-model="formData.ownerUserId" clearable placeholder="请输入负责人">
|
:value="data.id!"
|
||||||
<el-option
|
/>
|
||||||
v-for="item in userList"
|
</el-select>
|
||||||
:key="item.id"
|
</el-form-item>
|
||||||
:label="item.nickname"
|
</el-col>
|
||||||
:value="item.id"
|
<el-col :span="12">
|
||||||
/>
|
<el-form-item label="负责人" prop="ownerUserId">
|
||||||
</el-select>
|
<el-select v-model="formData.ownerUserId" clearable placeholder="请输入负责人">
|
||||||
</el-form-item>
|
<el-option
|
||||||
<el-form-item label="批次" prop="batchId">
|
v-for="item in userList"
|
||||||
<el-input-number v-model="formData.batchId" placeholder="请输入批次" />
|
:key="item.id"
|
||||||
</el-form-item>
|
:label="item.nickname"
|
||||||
<el-form-item label="显示排序" prop="sort">
|
:value="item.id"
|
||||||
<el-input-number v-model="formData.sort" :min="0" controls-position="right" />
|
/>
|
||||||
</el-form-item>
|
</el-select>
|
||||||
<!--<el-form-item label="状态" prop="status">
|
</el-form-item>
|
||||||
<el-select v-model="formData.status" placeholder="请选择状态">
|
</el-col>
|
||||||
<el-option
|
<el-col :span="12">
|
||||||
v-for="dict in getIntDictOptions(DICT_TYPE.COMMON_STATUS)"
|
<el-form-item label="回款方式" prop="returnType">
|
||||||
:key="dict.value"
|
<el-select v-model="formData.returnType" placeholder="请选择回款方式">
|
||||||
:label="dict.label"
|
<el-option
|
||||||
:value="dict.value"
|
v-for="dict in getStrDictOptions(DICT_TYPE.CRM_RECEIVABLE_RETURN_TYPE)"
|
||||||
/>
|
:key="dict.value"
|
||||||
</el-select>
|
:label="dict.label"
|
||||||
</el-form-item>-->
|
:value="dict.value"
|
||||||
<el-form-item label="备注" prop="remark">
|
/>
|
||||||
<el-input type="textarea" :rows="3" v-model="formData.remark" placeholder="请输入备注" />
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="回款金额" prop="price">
|
||||||
|
<el-input-number
|
||||||
|
v-model="formData.price"
|
||||||
|
class="!w-100%"
|
||||||
|
controls-position="right"
|
||||||
|
placeholder="请输入回款金额"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="回款日期" prop="returnTime">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="formData.returnTime"
|
||||||
|
placeholder="选择回款日期"
|
||||||
|
type="date"
|
||||||
|
value-format="x"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input
|
||||||
|
v-model="formData.remark"
|
||||||
|
:rows="3"
|
||||||
|
placeholder="请输入备注"
|
||||||
|
type="textarea"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
<el-button :disabled="formLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||||
</template>
|
</template>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script lang="ts" setup>
|
||||||
import { DICT_TYPE, getIntDictOptions, getStrDictOptions } from '@/utils/dict'
|
import * as ReceivablePlanApi from '@/api/crm/receivable/plan'
|
||||||
import * as ReceivableApi from '@/api/crm/receivable'
|
import * as ReceivableApi from '@/api/crm/receivable'
|
||||||
import * as UserApi from '@/api/system/user'
|
import * as UserApi from '@/api/system/user'
|
||||||
|
import * as CustomerApi from '@/api/crm/customer'
|
||||||
|
import * as ContractApi from '@/api/crm/contract'
|
||||||
|
import { useUserStore } from '@/store/modules/user'
|
||||||
|
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
|
||||||
|
|
||||||
const { t } = useI18n() // 国际化
|
const { t } = useI18n() // 国际化
|
||||||
const message = useMessage() // 消息弹窗
|
const message = useMessage() // 消息弹窗
|
||||||
|
@ -101,32 +137,21 @@ const dialogVisible = ref(false) // 弹窗的是否展示
|
||||||
const dialogTitle = ref('') // 弹窗的标题
|
const dialogTitle = ref('') // 弹窗的标题
|
||||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||||
const formData = ref({
|
const formData = ref<ReceivableApi.ReceivableVO>({} as ReceivableApi.ReceivableVO)
|
||||||
id: undefined,
|
const formRules = reactive({
|
||||||
no: undefined,
|
no: [{ required: true, message: '回款编号不能为空', trigger: 'blur' }],
|
||||||
planId: undefined,
|
customerId: [{ required: true, message: '客户不能为空', trigger: 'blur' }],
|
||||||
customerId: undefined,
|
contractId: [{ required: true, message: '合同不能为空', trigger: 'blur' }],
|
||||||
contractId: undefined,
|
auditStatus: [{ required: true, message: '审批状态不能为空', trigger: 'blur' }],
|
||||||
checkStatus: undefined,
|
returnTime: [{ required: true, message: '回款日期不能为空', trigger: 'blur' }],
|
||||||
processInstanceId: undefined,
|
price: [{ required: true, message: '回款金额不能为空', trigger: 'blur' }]
|
||||||
returnTime: undefined,
|
|
||||||
returnType: undefined,
|
|
||||||
price: undefined,
|
|
||||||
ownerUserId: undefined,
|
|
||||||
batchId: undefined,
|
|
||||||
sort: undefined,
|
|
||||||
dataScope: undefined,
|
|
||||||
dataScopeDeptIds: undefined,
|
|
||||||
status: undefined,
|
|
||||||
remark: undefined
|
|
||||||
})
|
})
|
||||||
// const formRules = reactive({
|
|
||||||
// status: [{ required: true, message: '状态不能为空', trigger: 'change' }]
|
|
||||||
// })
|
|
||||||
const formRef = ref() // 表单 Ref
|
const formRef = ref() // 表单 Ref
|
||||||
|
const customerList = ref<CustomerApi.CustomerVO[]>([]) // 客户列表
|
||||||
|
const contractList = ref<ContractApi.ContractVO[]>([]) // 合同列表
|
||||||
|
const receivablePlanList = ref<ReceivablePlanApi.ReceivablePlanVO[]>([]) // 回款计划列表
|
||||||
/** 打开弹窗 */
|
/** 打开弹窗 */
|
||||||
const open = async (type: string, id?: number) => {
|
const open = async (type: string, id?: number, planData?: ReceivablePlanApi.ReceivablePlanVO) => {
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
dialogTitle.value = t('action.' + type)
|
dialogTitle.value = t('action.' + type)
|
||||||
formType.value = type
|
formType.value = type
|
||||||
|
@ -142,6 +167,18 @@ const open = async (type: string, id?: number) => {
|
||||||
}
|
}
|
||||||
// 获得用户列表
|
// 获得用户列表
|
||||||
userList.value = await UserApi.getSimpleUserList()
|
userList.value = await UserApi.getSimpleUserList()
|
||||||
|
// 获得客户列表
|
||||||
|
customerList.value = await CustomerApi.getCustomerSimpleList()
|
||||||
|
// 默认新建时选中自己
|
||||||
|
if (formType.value === 'create') {
|
||||||
|
formData.value.ownerUserId = useUserStore().getUser.id
|
||||||
|
}
|
||||||
|
// 从回款计划创建回款
|
||||||
|
if (planData) {
|
||||||
|
formData.value.customerId = planData.customerId
|
||||||
|
formData.value.contractId = planData.contractId
|
||||||
|
formData.value.planId = planData.id
|
||||||
|
}
|
||||||
}
|
}
|
||||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||||
|
|
||||||
|
@ -173,25 +210,57 @@ const submitForm = async () => {
|
||||||
|
|
||||||
/** 重置表单 */
|
/** 重置表单 */
|
||||||
const resetForm = () => {
|
const resetForm = () => {
|
||||||
formData.value = {
|
formData.value = {} as ReceivableApi.ReceivableVO
|
||||||
id: undefined,
|
|
||||||
no: undefined,
|
|
||||||
planId: undefined,
|
|
||||||
customerId: undefined,
|
|
||||||
contractId: undefined,
|
|
||||||
checkStatus: undefined,
|
|
||||||
processInstanceId: undefined,
|
|
||||||
returnTime: undefined,
|
|
||||||
returnType: undefined,
|
|
||||||
price: undefined,
|
|
||||||
ownerUserId: undefined,
|
|
||||||
batchId: undefined,
|
|
||||||
sort: undefined,
|
|
||||||
dataScope: undefined,
|
|
||||||
dataScopeDeptIds: undefined,
|
|
||||||
status: undefined,
|
|
||||||
remark: undefined
|
|
||||||
}
|
|
||||||
formRef.value?.resetFields()
|
formRef.value?.resetFields()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getContractList = async (customerId: number) => {
|
||||||
|
contractList.value = await ContractApi.getCrmContractSimpleListByCustomerId(customerId)
|
||||||
|
}
|
||||||
|
const getReceivablePlanList = async (contractId: number) => {
|
||||||
|
receivablePlanList.value = await ReceivablePlanApi.getReceivablePlanListByContractId(
|
||||||
|
formData.value.customerId,
|
||||||
|
contractId
|
||||||
|
)
|
||||||
|
}
|
||||||
|
watch(
|
||||||
|
() => formData.value.customerId,
|
||||||
|
(newVal) => {
|
||||||
|
if (!newVal) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
getContractList(newVal)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
immediate: true
|
||||||
|
}
|
||||||
|
)
|
||||||
|
watch(
|
||||||
|
() => formData.value.contractId,
|
||||||
|
(newVal) => {
|
||||||
|
if (!newVal) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
getReceivablePlanList(newVal)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
immediate: true
|
||||||
|
}
|
||||||
|
)
|
||||||
|
watch(
|
||||||
|
() => formData.value.planId,
|
||||||
|
(newVal) => {
|
||||||
|
if (!newVal) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const receivablePlan = receivablePlanList.value.find((item) => item.id === newVal)
|
||||||
|
if (!receivablePlan) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// 只有没有金额的时候才设置
|
||||||
|
if (!formData.value.price || formData.value.price === 0) {
|
||||||
|
formData.value.price = receivablePlan.price
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -9,40 +9,51 @@
|
||||||
|
|
||||||
<!-- 列表 -->
|
<!-- 列表 -->
|
||||||
<ContentWrap class="mt-10px">
|
<ContentWrap class="mt-10px">
|
||||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
<el-table v-loading="loading" :data="list" :show-overflow-tooltip="true" :stripe="true">
|
||||||
<el-table-column label="回款编号" fixed="left" align="center" prop="no">
|
<el-table-column align="center" label="回款编号" prop="no" />
|
||||||
<template #default="scope">
|
<el-table-column align="center" label="客户" prop="customerName" />
|
||||||
<el-link type="primary" :underline="false" @click="openDetail(scope.row.id)">
|
<el-table-column align="center" label="合同" prop="contractName" />
|
||||||
{{ scope.row.no }}
|
|
||||||
</el-link>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="合同编号" align="center" prop="contractNo" />
|
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="回款金额(元)"
|
:formatter="dateFormatter2"
|
||||||
align="center"
|
align="center"
|
||||||
prop="price"
|
|
||||||
:formatter="fenToYuanFormat"
|
|
||||||
/>
|
|
||||||
<el-table-column label="负责人" align="center" prop="ownerUserName" />
|
|
||||||
<el-table-column align="center" label="状态" prop="auditStatus">
|
|
||||||
<template #default="scope">
|
|
||||||
<dict-tag :type="DICT_TYPE.CRM_AUDIT_STATUS" :value="scope.row.auditStatus" />
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column
|
|
||||||
label="回款日期"
|
label="回款日期"
|
||||||
align="center"
|
|
||||||
prop="returnTime"
|
prop="returnTime"
|
||||||
:formatter="dateFormatter"
|
width="150px"
|
||||||
width="180px"
|
|
||||||
/>
|
/>
|
||||||
|
<el-table-column align="center" label="回款方式" prop="returnType" width="130px">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :type="DICT_TYPE.CRM_RECEIVABLE_RETURN_TYPE" :value="scope.row.returnType" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column align="center" label="回款金额(元)" prop="price" />
|
||||||
|
<el-table-column align="center" label="负责人" prop="ownerUserName" />
|
||||||
|
<el-table-column align="center" label="备注" prop="remark" />
|
||||||
|
<el-table-column align="center" fixed="right" label="操作" width="130px">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button
|
||||||
|
v-hasPermi="['crm:receivable:update']"
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
@click="openForm('update', scope.row.id)"
|
||||||
|
>
|
||||||
|
编辑
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
v-hasPermi="['crm:receivable:delete']"
|
||||||
|
link
|
||||||
|
type="danger"
|
||||||
|
@click="handleDelete(scope.row.id)"
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<!-- 分页 -->
|
<!-- 分页 -->
|
||||||
<Pagination
|
<Pagination
|
||||||
:total="total"
|
|
||||||
v-model:page="queryParams.pageNo"
|
|
||||||
v-model:limit="queryParams.pageSize"
|
v-model:limit="queryParams.pageSize"
|
||||||
|
v-model:page="queryParams.pageNo"
|
||||||
|
:total="total"
|
||||||
@pagination="getList"
|
@pagination="getList"
|
||||||
/>
|
/>
|
||||||
</ContentWrap>
|
</ContentWrap>
|
||||||
|
@ -50,45 +61,43 @@
|
||||||
<!-- 表单弹窗:添加 -->
|
<!-- 表单弹窗:添加 -->
|
||||||
<ReceivableForm ref="formRef" @success="getList" />
|
<ReceivableForm ref="formRef" @success="getList" />
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script lang="ts" setup>
|
||||||
|
import * as ReceivablePlanApi from '@/api/crm/receivable/plan'
|
||||||
import * as ReceivableApi from '@/api/crm/receivable'
|
import * as ReceivableApi from '@/api/crm/receivable'
|
||||||
import ReceivableForm from './../ReceivableForm.vue'
|
import ReceivableForm from './../ReceivableForm.vue'
|
||||||
import { BizTypeEnum } from '@/api/crm/permission'
|
import { dateFormatter2 } from '@/utils/formatTime'
|
||||||
import { dateFormatter } from '@/utils/formatTime'
|
|
||||||
import { fenToYuanFormat } from '@/utils/formatter'
|
|
||||||
import { DICT_TYPE } from '@/utils/dict'
|
import { DICT_TYPE } from '@/utils/dict'
|
||||||
|
|
||||||
defineOptions({ name: 'CrmReceivableList' })
|
defineOptions({ name: 'CrmReceivableList' })
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
bizType: number // 业务类型
|
customerId?: number // 客户编号
|
||||||
bizId: number // 业务编号
|
contractId?: number // 合同编号
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
|
const message = useMessage() // 消息弹窗
|
||||||
|
const { t } = useI18n() // 国际化
|
||||||
const loading = ref(true) // 列表的加载中
|
const loading = ref(true) // 列表的加载中
|
||||||
const total = ref(0) // 列表的总页数
|
const total = ref(0) // 列表的总页数
|
||||||
const list = ref([]) // 列表的数据
|
const list = ref([]) // 列表的数据
|
||||||
const queryParams = reactive({
|
const queryParams = reactive({
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
customerId: undefined as unknown // 允许 undefined + number
|
customerId: undefined as unknown, // 允许 undefined + number
|
||||||
|
contractId: undefined as unknown // 允许 undefined + number
|
||||||
})
|
})
|
||||||
|
|
||||||
/** 查询列表 */
|
/** 查询列表 */
|
||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
// 置空参数
|
if (props.customerId && !props.contractId) {
|
||||||
queryParams.customerId = undefined
|
queryParams.customerId = props.customerId
|
||||||
// 执行查询
|
} else if (props.customerId && props.contractId) {
|
||||||
let data = { list: [], total: 0 }
|
// 如果是合同的话客户编号也需要带上因为权限基于客户
|
||||||
switch (props.bizType) {
|
queryParams.customerId = props.customerId
|
||||||
case BizTypeEnum.CRM_CUSTOMER:
|
queryParams.contractId = props.contractId
|
||||||
queryParams.customerId = props.bizId
|
|
||||||
data = await ReceivableApi.getReceivablePageByCustomer(queryParams)
|
|
||||||
break
|
|
||||||
default:
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
const data = await ReceivableApi.getReceivablePageByCustomer(queryParams)
|
||||||
list.value = data.list
|
list.value = data.list
|
||||||
total.value = data.total
|
total.value = data.total
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -99,25 +108,45 @@ const getList = async () => {
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
const handleQuery = () => {
|
const handleQuery = () => {
|
||||||
queryParams.pageNo = 1
|
queryParams.pageNo = 1
|
||||||
|
// 置空参数
|
||||||
|
queryParams.customerId = undefined
|
||||||
|
queryParams.contractId = undefined
|
||||||
getList()
|
getList()
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 添加 */
|
/** 添加/修改操作 */
|
||||||
const formRef = ref()
|
const formRef = ref()
|
||||||
const openForm = () => {
|
const openForm = (type: string, id?: number) => {
|
||||||
formRef.value.open('create')
|
formRef.value.open(type, id)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 打开合同详情 */
|
/** 删除按钮操作 */
|
||||||
const { push } = useRouter()
|
const handleDelete = async (id: number) => {
|
||||||
const openDetail = (id: number) => {
|
try {
|
||||||
push({ name: 'CrmReceivableDetail', params: { id } })
|
// 删除的二次确认
|
||||||
|
await message.delConfirm()
|
||||||
|
// 发起删除
|
||||||
|
await ReceivableApi.deleteReceivable(id)
|
||||||
|
message.success(t('common.delSuccess'))
|
||||||
|
// 刷新列表
|
||||||
|
await getList()
|
||||||
|
} catch {}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 监听打开的 bizId + bizType,从而加载最新的列表 */
|
/** 从回款计划创建回款 */
|
||||||
|
const crateReceivable = (planData: any) => {
|
||||||
|
const data = planData as unknown as ReceivablePlanApi.ReceivablePlanVO
|
||||||
|
formRef.value.open('create', undefined, data)
|
||||||
|
}
|
||||||
|
defineExpose({ crateReceivable })
|
||||||
|
/** 监听打开的 customerId + contractId,从而加载最新的列表 */
|
||||||
watch(
|
watch(
|
||||||
() => [props.bizId, props.bizType],
|
() => [props.customerId, props.contractId],
|
||||||
() => {
|
(newVal) => {
|
||||||
|
// 保证至少客户编号有值
|
||||||
|
if (!newVal[0]) {
|
||||||
|
return
|
||||||
|
}
|
||||||
handleQuery()
|
handleQuery()
|
||||||
},
|
},
|
||||||
{ immediate: true, deep: true }
|
{ immediate: true, deep: true }
|
||||||
|
|
|
@ -2,49 +2,63 @@
|
||||||
<ContentWrap>
|
<ContentWrap>
|
||||||
<!-- 搜索工作栏 -->
|
<!-- 搜索工作栏 -->
|
||||||
<el-form
|
<el-form
|
||||||
class="-mb-15px"
|
|
||||||
:model="queryParams"
|
|
||||||
ref="queryFormRef"
|
ref="queryFormRef"
|
||||||
:inline="true"
|
:inline="true"
|
||||||
|
:model="queryParams"
|
||||||
|
class="-mb-15px"
|
||||||
label-width="68px"
|
label-width="68px"
|
||||||
>
|
>
|
||||||
<el-form-item label="回款编号" prop="no">
|
<el-form-item label="回款编号" prop="no">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="queryParams.no"
|
v-model="queryParams.no"
|
||||||
placeholder="请输入回款编号"
|
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
class="!w-240px"
|
class="!w-240px"
|
||||||
|
clearable
|
||||||
|
placeholder="请输入回款编号"
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="客户名称" prop="customerId">
|
<el-form-item label="客户名称" prop="customerId">
|
||||||
<el-input
|
<el-select
|
||||||
v-model="queryParams.customerId"
|
v-model="queryParams.customerId"
|
||||||
placeholder="请输入客户名称"
|
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
class="!w-240px"
|
class="!w-240px"
|
||||||
/>
|
placeholder="请选择客户"
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in customerList"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
<el-button @click="handleQuery">
|
||||||
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
<Icon class="mr-5px" icon="ep:search" />
|
||||||
<el-button
|
搜索
|
||||||
type="primary"
|
</el-button>
|
||||||
plain
|
<el-button @click="resetQuery">
|
||||||
@click="openForm('create')"
|
<Icon class="mr-5px" icon="ep:refresh" />
|
||||||
v-hasPermi="['crm:receivable:create']"
|
重置
|
||||||
>
|
|
||||||
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
type="success"
|
v-hasPermi="['crm:receivable:create']"
|
||||||
plain
|
plain
|
||||||
@click="handleExport"
|
type="primary"
|
||||||
:loading="exportLoading"
|
@click="openForm('create')"
|
||||||
v-hasPermi="['crm:receivable:export']"
|
|
||||||
>
|
>
|
||||||
<Icon icon="ep:download" class="mr-5px" /> 导出
|
<Icon class="mr-5px" icon="ep:plus" />
|
||||||
|
新增
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
v-hasPermi="['crm:receivable:export']"
|
||||||
|
:loading="exportLoading"
|
||||||
|
plain
|
||||||
|
type="success"
|
||||||
|
@click="handleExport"
|
||||||
|
>
|
||||||
|
<Icon class="mr-5px" icon="ep:download" />
|
||||||
|
导出
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
@ -52,66 +66,63 @@
|
||||||
|
|
||||||
<!-- 列表 -->
|
<!-- 列表 -->
|
||||||
<ContentWrap>
|
<ContentWrap>
|
||||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
<el-table v-loading="loading" :data="list" :show-overflow-tooltip="true" :stripe="true">
|
||||||
<el-table-column label="ID" align="center" prop="id" />
|
<el-table-column align="center" label="回款编号" prop="no" />
|
||||||
<el-table-column label="回款编号" align="center" prop="no" />
|
<el-table-column align="center" label="客户" prop="customerName" />
|
||||||
<!-- <el-table-column label="回款计划ID" align="center" prop="planId" />-->
|
<el-table-column align="center" label="合同" prop="contractName" />
|
||||||
<el-table-column label="客户" align="center" prop="customerId" />
|
|
||||||
<el-table-column label="合同" align="center" prop="contractId" />
|
|
||||||
<el-table-column label="审批状态" align="center" prop="checkStatus" width="130px">
|
|
||||||
<template #default="scope">
|
|
||||||
<dict-tag :type="DICT_TYPE.CRM_AUDIT_STATUS" :value="scope.row.checkStatus" />
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<!-- <el-table-column label="工作流编号" align="center" prop="processInstanceId" />-->
|
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="回款日期"
|
|
||||||
align="center"
|
|
||||||
prop="returnTime"
|
|
||||||
:formatter="dateFormatter2"
|
:formatter="dateFormatter2"
|
||||||
|
align="center"
|
||||||
|
label="回款日期"
|
||||||
|
prop="returnTime"
|
||||||
width="150px"
|
width="150px"
|
||||||
/>
|
/>
|
||||||
<el-table-column label="回款方式" align="center" prop="returnType" width="130px">
|
<el-table-column align="center" label="回款方式" prop="returnType" width="130px">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<dict-tag :type="DICT_TYPE.CRM_RECEIVABLE_RETURN_TYPE" :value="scope.row.returnType" />
|
<dict-tag :type="DICT_TYPE.CRM_RECEIVABLE_RETURN_TYPE" :value="scope.row.returnType" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="回款金额(元)" align="center" prop="price" />
|
<el-table-column align="center" label="回款金额(元)" prop="price" />
|
||||||
<el-table-column label="负责人" align="center" prop="ownerUserId" />
|
<el-table-column align="center" label="负责人" prop="ownerUserName" />
|
||||||
<el-table-column label="批次" align="center" prop="batchId" />
|
<el-table-column align="center" label="备注" prop="remark" />
|
||||||
<!--<el-table-column label="显示顺序" align="center" prop="sort" />-->
|
<el-table-column align="center" fixed="right" label="回款状态" prop="auditStatus" width="120">
|
||||||
<el-table-column label="状态" align="center" prop="status">
|
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" />
|
<dict-tag :type="DICT_TYPE.CRM_AUDIT_STATUS" :value="scope.row.auditStatus" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="备注" align="center" prop="remark" />
|
<el-table-column align="center" fixed="right" label="操作" width="180px">
|
||||||
<el-table-column
|
|
||||||
label="创建时间"
|
|
||||||
align="center"
|
|
||||||
prop="createTime"
|
|
||||||
:formatter="dateFormatter"
|
|
||||||
width="180px"
|
|
||||||
/>
|
|
||||||
<el-table-column label="操作" align="center" width="180px">
|
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<!-- todo @liuhongfeng:用路径参数哈,receivableId -->
|
|
||||||
<!--<router-link :to="'/crm/receivable-plan?receivableId=' + scope.row.receivableId">
|
|
||||||
<el-button link type="primary">详情</el-button>
|
|
||||||
</router-link>-->
|
|
||||||
<el-button
|
<el-button
|
||||||
|
v-hasPermi="['crm:receivable:update']"
|
||||||
link
|
link
|
||||||
type="primary"
|
type="primary"
|
||||||
@click="openForm('update', scope.row.id)"
|
@click="openForm('update', scope.row.id)"
|
||||||
v-hasPermi="['crm:receivable:update']"
|
|
||||||
>
|
>
|
||||||
编辑
|
编辑
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
|
v-if="scope.row.auditStatus === 0"
|
||||||
|
v-hasPermi="['crm:receivable:update']"
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
@click="handleSubmit(scope.row)"
|
||||||
|
>
|
||||||
|
提交审核
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
v-else
|
||||||
|
v-hasPermi="['crm:receivable:update']"
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
@click="handleProcessDetail(scope.row)"
|
||||||
|
>
|
||||||
|
查看审批
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
v-hasPermi="['crm:receivable:delete']"
|
||||||
link
|
link
|
||||||
type="danger"
|
type="danger"
|
||||||
@click="handleDelete(scope.row.id)"
|
@click="handleDelete(scope.row.id)"
|
||||||
v-hasPermi="['crm:receivable:delete']"
|
|
||||||
>
|
>
|
||||||
删除
|
删除
|
||||||
</el-button>
|
</el-button>
|
||||||
|
@ -120,9 +131,9 @@
|
||||||
</el-table>
|
</el-table>
|
||||||
<!-- 分页 -->
|
<!-- 分页 -->
|
||||||
<Pagination
|
<Pagination
|
||||||
:total="total"
|
|
||||||
v-model:page="queryParams.pageNo"
|
|
||||||
v-model:limit="queryParams.pageSize"
|
v-model:limit="queryParams.pageSize"
|
||||||
|
v-model:page="queryParams.pageNo"
|
||||||
|
:total="total"
|
||||||
@pagination="getList"
|
@pagination="getList"
|
||||||
/>
|
/>
|
||||||
</ContentWrap>
|
</ContentWrap>
|
||||||
|
@ -131,26 +142,27 @@
|
||||||
<ReceivableForm ref="formRef" @success="getList" />
|
<ReceivableForm ref="formRef" @success="getList" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script lang="ts" setup>
|
||||||
import { DICT_TYPE } from '@/utils/dict'
|
import { DICT_TYPE } from '@/utils/dict'
|
||||||
import { dateFormatter, dateFormatter2 } from '@/utils/formatTime'
|
import { dateFormatter2 } from '@/utils/formatTime'
|
||||||
import download from '@/utils/download'
|
import download from '@/utils/download'
|
||||||
import * as ReceivableApi from '@/api/crm/receivable'
|
import * as ReceivableApi from '@/api/crm/receivable'
|
||||||
import ReceivableForm from './ReceivableForm.vue'
|
import ReceivableForm from './ReceivableForm.vue'
|
||||||
|
import * as CustomerApi from '@/api/crm/customer'
|
||||||
|
|
||||||
defineOptions({ name: 'Receivable' })
|
defineOptions({ name: 'Receivable' })
|
||||||
|
|
||||||
const message = useMessage() // 消息弹窗
|
const message = useMessage() // 消息弹窗
|
||||||
const { t } = useI18n() // 国际化
|
const { t } = useI18n() // 国际化
|
||||||
|
const { push } = useRouter() // 路由
|
||||||
const loading = ref(true) // 列表的加载中
|
const loading = ref(true) // 列表的加载中
|
||||||
const total = ref(0) // 列表的总页数
|
const total = ref(0) // 列表的总页数
|
||||||
const list = ref([]) // 列表的数据
|
const list = ref([]) // 列表的数据
|
||||||
const queryParams = reactive({
|
const queryParams = reactive({
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
no: null,
|
no: undefined,
|
||||||
customerId: null
|
customerId: undefined
|
||||||
})
|
})
|
||||||
const queryFormRef = ref() // 搜索的表单
|
const queryFormRef = ref() // 搜索的表单
|
||||||
const exportLoading = ref(false) // 导出的加载中
|
const exportLoading = ref(false) // 导出的加载中
|
||||||
|
@ -198,6 +210,19 @@ const handleDelete = async (id: number) => {
|
||||||
} catch {}
|
} catch {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 提交审核 **/
|
||||||
|
const handleSubmit = async (row: ReceivableApi.ReceivableVO) => {
|
||||||
|
await message.confirm(`您确定提交编号为【${row.no}】的回款审核吗?`)
|
||||||
|
await ReceivableApi.submitReceivable(row.id)
|
||||||
|
message.success('提交审核成功!')
|
||||||
|
await getList()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 查看审批 */
|
||||||
|
const handleProcessDetail = (row: ReceivableApi.ReceivableVO) => {
|
||||||
|
push({ name: 'BpmProcessInstanceDetail', query: { id: row.processInstanceId } })
|
||||||
|
}
|
||||||
|
// TODO puhui999: 回款流程审批表单详情查看后面完善
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
const handleExport = async () => {
|
const handleExport = async () => {
|
||||||
try {
|
try {
|
||||||
|
@ -212,9 +237,11 @@ const handleExport = async () => {
|
||||||
exportLoading.value = false
|
exportLoading.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const customerList = ref<CustomerApi.CustomerVO[]>([]) // 客户列表
|
||||||
/** 初始化 **/
|
/** 初始化 **/
|
||||||
onMounted(() => {
|
onMounted(async () => {
|
||||||
getList()
|
await getList()
|
||||||
|
// 获得客户列表
|
||||||
|
customerList.value = await CustomerApi.getCustomerSimpleList()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,95 +1,119 @@
|
||||||
<template>
|
<template>
|
||||||
<Dialog :title="dialogTitle" v-model="dialogVisible">
|
<Dialog v-model="dialogVisible" :title="dialogTitle">
|
||||||
<el-form
|
<el-form
|
||||||
ref="formRef"
|
ref="formRef"
|
||||||
|
v-loading="formLoading"
|
||||||
:model="formData"
|
:model="formData"
|
||||||
:rules="formRules"
|
:rules="formRules"
|
||||||
label-width="100px"
|
label-width="110px"
|
||||||
v-loading="formLoading"
|
|
||||||
>
|
>
|
||||||
<el-form-item label="客户名称" prop="customerId">
|
<el-row>
|
||||||
<el-input v-model="formData.customerId" placeholder="请输入客户名称" />
|
<el-col :span="12">
|
||||||
</el-form-item>
|
<el-form-item label="客户名称" prop="customerId">
|
||||||
<el-form-item label="合同名称" prop="contractId">
|
<el-select v-model="formData.customerId" class="w-1/1" placeholder="请选择客户">
|
||||||
<el-input v-model="formData.contractId" placeholder="请输入合同名称" />
|
<el-option
|
||||||
</el-form-item>
|
v-for="item in customerList"
|
||||||
<el-form-item label="负责人" prop="ownerUserId">
|
:key="item.id"
|
||||||
<el-select v-model="formData.ownerUserId" clearable placeholder="请输入负责人">
|
:label="item.name"
|
||||||
<el-option
|
:value="item.id"
|
||||||
v-for="item in userList"
|
/>
|
||||||
:key="item.id"
|
</el-select>
|
||||||
:label="item.nickname"
|
</el-form-item>
|
||||||
:value="item.id"
|
</el-col>
|
||||||
/>
|
<el-col :span="12">
|
||||||
</el-select>
|
<el-form-item label="合同名称" prop="contractId">
|
||||||
</el-form-item>
|
<el-select
|
||||||
<el-form-item label="期数" prop="period">
|
v-model="formData.contractId"
|
||||||
<el-input-number v-model="formData.period" placeholder="请输入期数" />
|
:disabled="!formData.customerId"
|
||||||
</el-form-item>
|
class="!w-100%"
|
||||||
<!--<el-form-item label="回款ID" prop="receivableId">
|
placeholder="请选择合同"
|
||||||
<el-input v-model="formData.receivableId" placeholder="请输入回款ID" />
|
>
|
||||||
</el-form-item>
|
<el-option
|
||||||
<el-form-item label="完成状态" prop="status">
|
v-for="data in contractList"
|
||||||
<el-select v-model="formData.status" placeholder="请选择完成状态">
|
:key="data.id"
|
||||||
<el-option
|
:label="data.name"
|
||||||
v-for="dict in getIntDictOptions(DICT_TYPE.COMMON_STATUS)"
|
:value="data.id!"
|
||||||
:key="dict.value"
|
/>
|
||||||
:label="dict.label"
|
</el-select>
|
||||||
:value="dict.value"
|
</el-form-item>
|
||||||
/>
|
</el-col>
|
||||||
</el-select>
|
<el-col :span="12">
|
||||||
</el-form-item>
|
<el-form-item label="负责人" prop="ownerUserId">
|
||||||
<el-form-item label="审批状态" prop="checkStatus">
|
<el-select v-model="formData.ownerUserId" clearable placeholder="请输入负责人">
|
||||||
<el-select v-model="formData.checkStatus" placeholder="请选择审批状态">
|
<el-option
|
||||||
<el-option
|
v-for="item in userList"
|
||||||
v-for="dict in getStrDictOptions(DICT_TYPE.CRM_RECEIVABLE_CHECK_STATUS)"
|
:key="item.id"
|
||||||
:key="dict.value"
|
:label="item.nickname"
|
||||||
:label="dict.label"
|
:value="item.id"
|
||||||
:value="dict.value"
|
/>
|
||||||
/>
|
</el-select>
|
||||||
</el-select>
|
</el-form-item>
|
||||||
</el-form-item>
|
</el-col>
|
||||||
<el-form-item label="工作流编号" prop="processInstanceId">
|
<el-col :span="12">
|
||||||
<el-input v-model="formData.processInstanceId" placeholder="请输入工作流编号" />
|
<el-form-item label="计划回款金额" prop="price">
|
||||||
</el-form-item>-->
|
<el-input-number
|
||||||
<el-form-item label="计划回款金额" prop="price">
|
v-model="formData.price"
|
||||||
<el-input-number v-model="formData.price" placeholder="请输入计划回款金额" />
|
class="!w-100%"
|
||||||
</el-form-item>
|
controls-position="right"
|
||||||
<el-form-item label="计划回款日期" prop="returnTime">
|
placeholder="请输入计划回款金额"
|
||||||
<el-date-picker
|
/>
|
||||||
v-model="formData.returnTime"
|
</el-form-item>
|
||||||
type="date"
|
</el-col>
|
||||||
value-format="x"
|
<el-col :span="12">
|
||||||
placeholder="选择计划回款日期"
|
<el-form-item label="计划回款日期" prop="returnTime">
|
||||||
/>
|
<el-date-picker
|
||||||
</el-form-item>
|
v-model="formData.returnTime"
|
||||||
<el-form-item label="提前几天提醒" prop="remindDays">
|
placeholder="选择计划回款日期"
|
||||||
<el-input-number v-model="formData.remindDays" placeholder="请输入提前几天提醒" />
|
type="date"
|
||||||
</el-form-item>
|
value-format="x"
|
||||||
<el-form-item label="提醒日期" prop="remindTime">
|
/>
|
||||||
<el-date-picker
|
</el-form-item>
|
||||||
v-model="formData.remindTime"
|
</el-col>
|
||||||
type="date"
|
<el-col :span="12">
|
||||||
value-format="x"
|
<el-form-item label="提前几天提醒" prop="remindDays">
|
||||||
placeholder="选择提醒日期"
|
<el-input-number
|
||||||
/>
|
v-model="formData.remindDays"
|
||||||
</el-form-item>
|
class="!w-100%"
|
||||||
<el-form-item label="显示排序" prop="sort">
|
controls-position="right"
|
||||||
<el-input-number v-model="formData.sort" :min="0" controls-position="right" />
|
placeholder="请输入提前几天提醒"
|
||||||
</el-form-item>
|
/>
|
||||||
<el-form-item label="备注" prop="remark">
|
</el-form-item>
|
||||||
<el-input type="textarea" :rows="3" v-model="formData.remark" placeholder="请输入备注" />
|
</el-col>
|
||||||
</el-form-item>
|
<el-col :span="12">
|
||||||
|
<el-form-item label="提醒日期" prop="remindTime">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="formData.remindTime"
|
||||||
|
placeholder="选择提醒日期"
|
||||||
|
type="date"
|
||||||
|
value-format="x"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input
|
||||||
|
v-model="formData.remark"
|
||||||
|
:rows="3"
|
||||||
|
placeholder="请输入备注"
|
||||||
|
type="textarea"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
<el-button :disabled="formLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||||
</template>
|
</template>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script lang="ts" setup>
|
||||||
import * as ReceivablePlanApi from '@/api/crm/receivable/plan'
|
import * as ReceivablePlanApi from '@/api/crm/receivable/plan'
|
||||||
import * as UserApi from '@/api/system/user'
|
import * as UserApi from '@/api/system/user'
|
||||||
|
import * as CustomerApi from '@/api/crm/customer'
|
||||||
|
import * as ContractApi from '@/api/crm/contract'
|
||||||
|
import { useUserStore } from '@/store/modules/user'
|
||||||
|
|
||||||
const { t } = useI18n() // 国际化
|
const { t } = useI18n() // 国际化
|
||||||
const message = useMessage() // 消息弹窗
|
const message = useMessage() // 消息弹窗
|
||||||
const userList = ref<UserApi.UserVO[]>([]) // 用户列表
|
const userList = ref<UserApi.UserVO[]>([]) // 用户列表
|
||||||
|
@ -97,28 +121,18 @@ const dialogVisible = ref(false) // 弹窗的是否展示
|
||||||
const dialogTitle = ref('') // 弹窗的标题
|
const dialogTitle = ref('') // 弹窗的标题
|
||||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||||
const formData = ref({
|
const formData = ref<ReceivablePlanApi.ReceivablePlanVO>({} as ReceivablePlanApi.ReceivablePlanVO)
|
||||||
id: undefined,
|
|
||||||
period: undefined,
|
|
||||||
receivableId: undefined,
|
|
||||||
status: undefined,
|
|
||||||
checkStatus: undefined,
|
|
||||||
processInstanceId: undefined,
|
|
||||||
price: undefined,
|
|
||||||
returnTime: undefined,
|
|
||||||
remindDays: undefined,
|
|
||||||
remindTime: undefined,
|
|
||||||
customerId: undefined,
|
|
||||||
contractId: undefined,
|
|
||||||
ownerUserId: undefined,
|
|
||||||
sort: undefined,
|
|
||||||
remark: undefined
|
|
||||||
})
|
|
||||||
const formRules = reactive({
|
const formRules = reactive({
|
||||||
status: [{ required: true, message: '完成状态不能为空', trigger: 'change' }]
|
price: [{ required: true, message: '计划回款金额不能为空', trigger: 'blur' }],
|
||||||
|
returnTime: [{ required: true, message: '计划回款日期不能为空', trigger: 'blur' }],
|
||||||
|
remindTime: [{ required: true, message: '提醒日期不能为空', trigger: 'blur' }],
|
||||||
|
customerId: [{ required: true, message: '客户编号不能为空', trigger: 'blur' }],
|
||||||
|
contractId: [{ required: true, message: '合同编号不能为空', trigger: 'blur' }],
|
||||||
|
ownerUserId: [{ required: true, message: '负责人不能为空', trigger: 'blur' }]
|
||||||
})
|
})
|
||||||
const formRef = ref() // 表单 Ref
|
const formRef = ref() // 表单 Ref
|
||||||
|
const customerList = ref<CustomerApi.CustomerVO[]>([]) // 客户列表
|
||||||
|
const contractList = ref<ContractApi.ContractVO[]>([]) // 合同列表
|
||||||
/** 打开弹窗 */
|
/** 打开弹窗 */
|
||||||
const open = async (type: string, id?: number) => {
|
const open = async (type: string, id?: number) => {
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
|
@ -137,9 +151,31 @@ const open = async (type: string, id?: number) => {
|
||||||
|
|
||||||
// 获得用户列表
|
// 获得用户列表
|
||||||
userList.value = await UserApi.getSimpleUserList()
|
userList.value = await UserApi.getSimpleUserList()
|
||||||
|
// 获得客户列表
|
||||||
|
customerList.value = await CustomerApi.getCustomerSimpleList()
|
||||||
|
// 默认新建时选中自己
|
||||||
|
if (formType.value === 'create') {
|
||||||
|
formData.value.ownerUserId = useUserStore().getUser.id
|
||||||
|
}
|
||||||
}
|
}
|
||||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||||
|
|
||||||
|
const getContractList = async (customerId: number) => {
|
||||||
|
contractList.value = await ContractApi.getCrmContractSimpleListByCustomerId(customerId)
|
||||||
|
}
|
||||||
|
watch(
|
||||||
|
() => formData.value.customerId,
|
||||||
|
(newVal) => {
|
||||||
|
if (!newVal) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
getContractList(newVal)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
immediate: true
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
/** 提交表单 */
|
/** 提交表单 */
|
||||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||||
const submitForm = async () => {
|
const submitForm = async () => {
|
||||||
|
@ -168,23 +204,7 @@ const submitForm = async () => {
|
||||||
|
|
||||||
/** 重置表单 */
|
/** 重置表单 */
|
||||||
const resetForm = () => {
|
const resetForm = () => {
|
||||||
formData.value = {
|
formData.value = {} as ReceivablePlanApi.ReceivablePlanVO
|
||||||
id: undefined,
|
|
||||||
period: undefined,
|
|
||||||
receivableId: undefined,
|
|
||||||
status: undefined,
|
|
||||||
checkStatus: undefined,
|
|
||||||
processInstanceId: undefined,
|
|
||||||
price: undefined,
|
|
||||||
returnTime: undefined,
|
|
||||||
remindDays: undefined,
|
|
||||||
remindTime: undefined,
|
|
||||||
customerId: undefined,
|
|
||||||
contractId: undefined,
|
|
||||||
ownerUserId: undefined,
|
|
||||||
sort: undefined,
|
|
||||||
remark: undefined
|
|
||||||
}
|
|
||||||
formRef.value?.resetFields()
|
formRef.value?.resetFields()
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -9,43 +9,73 @@
|
||||||
|
|
||||||
<!-- 列表 -->
|
<!-- 列表 -->
|
||||||
<ContentWrap class="mt-10px">
|
<ContentWrap class="mt-10px">
|
||||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
<el-table v-loading="loading" :data="list" :show-overflow-tooltip="true" :stripe="true">
|
||||||
<el-table-column label="期数" fixed="left" align="center" prop="no">
|
<el-table-column align="center" label="客户名称" prop="customerName" width="150px" />
|
||||||
<template #default="scope">
|
<el-table-column align="center" label="合同编号" prop="contractNo" width="200px" />
|
||||||
<el-link type="primary" :underline="false" @click="openDetail(scope.row.id)">
|
<el-table-column align="center" label="期数" prop="period" />
|
||||||
{{ scope.row.period }}
|
<el-table-column align="center" label="计划回款(元)" prop="price" width="120" />
|
||||||
</el-link>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="客户名称" align="center" prop="customerName" />
|
|
||||||
<el-table-column label="合同编号" align="center" prop="contractNo" />
|
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="计划还款金额(元)"
|
:formatter="dateFormatter2"
|
||||||
align="center"
|
|
||||||
prop="price"
|
|
||||||
:formatter="fenToYuanFormat"
|
|
||||||
/>
|
|
||||||
<el-table-column
|
|
||||||
label="计划还款日期"
|
|
||||||
align="center"
|
align="center"
|
||||||
|
label="计划回款日期"
|
||||||
prop="returnTime"
|
prop="returnTime"
|
||||||
:formatter="dateFormatter"
|
|
||||||
width="180px"
|
width="180px"
|
||||||
/>
|
/>
|
||||||
<el-table-column align="center" label="计划还款方式" prop="auditStatus">
|
<el-table-column align="center" label="提前几天提醒" prop="remindDays" width="150" />
|
||||||
|
<el-table-column
|
||||||
|
:formatter="dateFormatter2"
|
||||||
|
align="center"
|
||||||
|
label="提醒日期"
|
||||||
|
prop="remindTime"
|
||||||
|
width="180px"
|
||||||
|
/>
|
||||||
|
<el-table-column label="负责人" prop="ownerUserName" width="120" />
|
||||||
|
<el-table-column align="center" label="备注" prop="remark" />
|
||||||
|
<el-table-column
|
||||||
|
align="center"
|
||||||
|
fixed="right"
|
||||||
|
label="完成状态"
|
||||||
|
prop="finishStatus"
|
||||||
|
width="130px"
|
||||||
|
>
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<dict-tag :type="DICT_TYPE.CRM_RECEIVABLE_RETURN_TYPE" :value="scope.row.returnType" />
|
<dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.finishStatus" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column align="center" fixed="right" label="操作" width="200px">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button
|
||||||
|
v-hasPermi="['crm:receivable:create']"
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
@click="crateReceivable(scope.row)"
|
||||||
|
>
|
||||||
|
创建回款
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
v-hasPermi="['crm:receivable-plan:update']"
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
@click="openForm('update', scope.row.id)"
|
||||||
|
>
|
||||||
|
编辑
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
v-hasPermi="['crm:receivable-plan:delete']"
|
||||||
|
link
|
||||||
|
type="danger"
|
||||||
|
@click="handleDelete(scope.row.id)"
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="提前几日提醒" align="center" prop="remindDays" />
|
|
||||||
<el-table-column label="备注" align="center" prop="remark" />
|
|
||||||
<!-- TODO 芋艿:新建回款、编辑、删除 -->
|
|
||||||
</el-table>
|
</el-table>
|
||||||
<!-- 分页 -->
|
<!-- 分页 -->
|
||||||
<Pagination
|
<Pagination
|
||||||
:total="total"
|
|
||||||
v-model:page="queryParams.pageNo"
|
|
||||||
v-model:limit="queryParams.pageSize"
|
v-model:limit="queryParams.pageSize"
|
||||||
|
v-model:page="queryParams.pageNo"
|
||||||
|
:total="total"
|
||||||
@pagination="getList"
|
@pagination="getList"
|
||||||
/>
|
/>
|
||||||
</ContentWrap>
|
</ContentWrap>
|
||||||
|
@ -53,45 +83,42 @@
|
||||||
<!-- 表单弹窗:添加 -->
|
<!-- 表单弹窗:添加 -->
|
||||||
<ReceivableForm ref="formRef" @success="getList" />
|
<ReceivableForm ref="formRef" @success="getList" />
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script lang="ts" setup>
|
||||||
import * as ReceivablePlanApi from '@/api/crm/receivable/plan'
|
import * as ReceivablePlanApi from '@/api/crm/receivable/plan'
|
||||||
import ReceivableForm from './../ReceivablePlanForm.vue'
|
import ReceivableForm from './../ReceivablePlanForm.vue'
|
||||||
import { BizTypeEnum } from '@/api/crm/permission'
|
|
||||||
import { dateFormatter } from '@/utils/formatTime'
|
|
||||||
import { fenToYuanFormat } from '@/utils/formatter'
|
|
||||||
import { DICT_TYPE } from '@/utils/dict'
|
import { DICT_TYPE } from '@/utils/dict'
|
||||||
|
import { dateFormatter2 } from '@/utils/formatTime'
|
||||||
|
|
||||||
defineOptions({ name: 'CrmReceivablePlanList' })
|
defineOptions({ name: 'CrmReceivablePlanList' })
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
bizType: number // 业务类型
|
customerId?: number // 客户编号
|
||||||
bizId: number // 业务编号
|
contractId?: number // 合同编号
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
|
const message = useMessage() // 消息弹窗
|
||||||
|
const { t } = useI18n() // 国际化
|
||||||
const loading = ref(true) // 列表的加载中
|
const loading = ref(true) // 列表的加载中
|
||||||
const total = ref(0) // 列表的总页数
|
const total = ref(0) // 列表的总页数
|
||||||
const list = ref([]) // 列表的数据
|
const list = ref([]) // 列表的数据
|
||||||
const queryParams = reactive({
|
const queryParams = reactive({
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
customerId: undefined as unknown // 允许 undefined + number
|
customerId: undefined as unknown, // 允许 undefined + number
|
||||||
|
contractId: undefined as unknown // 允许 undefined + number
|
||||||
})
|
})
|
||||||
|
|
||||||
/** 查询列表 */
|
/** 查询列表 */
|
||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
// 置空参数
|
if (props.customerId && !props.contractId) {
|
||||||
queryParams.customerId = undefined
|
queryParams.customerId = props.customerId
|
||||||
// 执行查询
|
} else if (props.customerId && props.contractId) {
|
||||||
let data = { list: [], total: 0 }
|
// 如果是合同的话客户编号也需要带上因为权限基于客户
|
||||||
switch (props.bizType) {
|
queryParams.customerId = props.customerId
|
||||||
case BizTypeEnum.CRM_CUSTOMER:
|
queryParams.contractId = props.contractId
|
||||||
queryParams.customerId = props.bizId
|
|
||||||
data = await ReceivablePlanApi.getReceivablePlanPageByCustomer(queryParams)
|
|
||||||
break
|
|
||||||
default:
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
const data = await ReceivablePlanApi.getReceivablePlanPageByCustomer(queryParams)
|
||||||
list.value = data.list
|
list.value = data.list
|
||||||
total.value = data.total
|
total.value = data.total
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -102,25 +129,46 @@ const getList = async () => {
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
const handleQuery = () => {
|
const handleQuery = () => {
|
||||||
queryParams.pageNo = 1
|
queryParams.pageNo = 1
|
||||||
|
// 置空参数
|
||||||
|
queryParams.customerId = undefined
|
||||||
|
queryParams.contractId = undefined
|
||||||
getList()
|
getList()
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 添加 */
|
/** 添加/修改操作 */
|
||||||
const formRef = ref()
|
const formRef = ref()
|
||||||
const openForm = () => {
|
const openForm = (type: string, id?: number) => {
|
||||||
formRef.value.open('create')
|
formRef.value.open(type, id)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 打开合同详情 */
|
const emits = defineEmits<{
|
||||||
const { push } = useRouter()
|
(e: 'crateReceivable', v: ReceivablePlanApi.ReceivablePlanVO)
|
||||||
const openDetail = (id: number) => {
|
}>()
|
||||||
push({ name: 'CrmReceivablePlanDetail', params: { id } })
|
/** 创建回款 */
|
||||||
|
const crateReceivable = (row: ReceivablePlanApi.ReceivablePlanVO) => {
|
||||||
|
emits('crateReceivable', row)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 监听打开的 bizId + bizType,从而加载最新的列表 */
|
/** 删除按钮操作 */
|
||||||
|
const handleDelete = async (id: number) => {
|
||||||
|
try {
|
||||||
|
// 删除的二次确认
|
||||||
|
await message.delConfirm()
|
||||||
|
// 发起删除
|
||||||
|
await ReceivablePlanApi.deleteReceivablePlan(id)
|
||||||
|
message.success(t('common.delSuccess'))
|
||||||
|
// 刷新列表
|
||||||
|
await getList()
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
|
/** 监听打开的 customerId + contractId,从而加载最新的列表 */
|
||||||
watch(
|
watch(
|
||||||
() => [props.bizId, props.bizType],
|
() => [props.customerId, props.contractId],
|
||||||
() => {
|
(newVal) => {
|
||||||
|
// 保证至少客户编号有值
|
||||||
|
if (!newVal[0]) {
|
||||||
|
return
|
||||||
|
}
|
||||||
handleQuery()
|
handleQuery()
|
||||||
},
|
},
|
||||||
{ immediate: true, deep: true }
|
{ immediate: true, deep: true }
|
||||||
|
|
|
@ -2,49 +2,63 @@
|
||||||
<ContentWrap>
|
<ContentWrap>
|
||||||
<!-- 搜索工作栏 -->
|
<!-- 搜索工作栏 -->
|
||||||
<el-form
|
<el-form
|
||||||
class="-mb-15px"
|
|
||||||
:model="queryParams"
|
|
||||||
ref="queryFormRef"
|
ref="queryFormRef"
|
||||||
:inline="true"
|
:inline="true"
|
||||||
|
:model="queryParams"
|
||||||
|
class="-mb-15px"
|
||||||
label-width="68px"
|
label-width="68px"
|
||||||
>
|
>
|
||||||
<el-form-item label="客户" prop="customerId">
|
<el-form-item label="客户名称" prop="customerId">
|
||||||
<el-input
|
<el-select
|
||||||
v-model="queryParams.customerId"
|
v-model="queryParams.customerId"
|
||||||
placeholder="请输入客户"
|
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
class="!w-240px"
|
class="!w-240px"
|
||||||
/>
|
placeholder="请选择客户"
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in customerList"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="合同" prop="contractId">
|
<el-form-item label="合同编号" prop="contractNo">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="queryParams.contractId"
|
v-model="queryParams.contractNo"
|
||||||
placeholder="请输入合同"
|
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
class="!w-240px"
|
class="!w-240px"
|
||||||
|
clearable
|
||||||
|
placeholder="请输入合同编号"
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
<el-button @click="handleQuery">
|
||||||
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
<Icon class="mr-5px" icon="ep:search" />
|
||||||
<el-button
|
搜索
|
||||||
type="primary"
|
</el-button>
|
||||||
plain
|
<el-button @click="resetQuery">
|
||||||
@click="openForm('create')"
|
<Icon class="mr-5px" icon="ep:refresh" />
|
||||||
v-hasPermi="['crm:receivable-plan:create']"
|
重置
|
||||||
>
|
|
||||||
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
type="success"
|
v-hasPermi="['crm:receivable-plan:create']"
|
||||||
plain
|
plain
|
||||||
@click="handleExport"
|
type="primary"
|
||||||
:loading="exportLoading"
|
@click="openForm('create')"
|
||||||
v-hasPermi="['crm:receivable-plan:export']"
|
|
||||||
>
|
>
|
||||||
<Icon icon="ep:download" class="mr-5px" /> 导出
|
<Icon class="mr-5px" icon="ep:plus" />
|
||||||
|
新增
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
v-hasPermi="['crm:receivable-plan:export']"
|
||||||
|
:loading="exportLoading"
|
||||||
|
plain
|
||||||
|
type="success"
|
||||||
|
@click="handleExport"
|
||||||
|
>
|
||||||
|
<Icon class="mr-5px" icon="ep:download" />
|
||||||
|
导出
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
@ -52,68 +66,54 @@
|
||||||
|
|
||||||
<!-- 列表 -->
|
<!-- 列表 -->
|
||||||
<ContentWrap>
|
<ContentWrap>
|
||||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
<el-table v-loading="loading" :data="list" :show-overflow-tooltip="true" :stripe="true">
|
||||||
<!--<el-table-column label="ID" align="center" prop="id" />-->
|
<el-table-column align="center" label="客户名称" prop="customerName" width="150px" />
|
||||||
<el-table-column label="客户名称" align="center" prop="customerId" width="150px" />
|
<el-table-column align="center" label="合同编号" prop="contractNo" width="200px" />
|
||||||
<el-table-column label="合同名称" align="center" prop="contractId" width="150px" />
|
<el-table-column align="center" label="期数" prop="period" />
|
||||||
<el-table-column label="期数" align="center" prop="period" />
|
<el-table-column align="center" label="计划回款(元)" prop="price" width="120" />
|
||||||
<el-table-column label="计划回款" align="center" prop="price" />
|
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="计划回款日期"
|
|
||||||
align="center"
|
|
||||||
prop="returnTime"
|
|
||||||
:formatter="dateFormatter2"
|
:formatter="dateFormatter2"
|
||||||
|
align="center"
|
||||||
|
label="计划回款日期"
|
||||||
|
prop="returnTime"
|
||||||
width="180px"
|
width="180px"
|
||||||
/>
|
/>
|
||||||
<el-table-column label="提前几天提醒" align="center" prop="remindDays" />
|
<el-table-column align="center" label="提前几天提醒" prop="remindDays" width="150" />
|
||||||
<!--<el-table-column
|
|
||||||
label="提醒日期"
|
|
||||||
align="center"
|
|
||||||
prop="remindTime"
|
|
||||||
:formatter="dateFormatter"
|
|
||||||
width="180px"
|
|
||||||
/>-->
|
|
||||||
<!--<el-table-column label="回款ID" align="center" prop="receivableId" />-->
|
|
||||||
<el-table-column label="完成状态" align="center" prop="status">
|
|
||||||
<template #default="scope">
|
|
||||||
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" />
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="审批状态" align="center" prop="checkStatus" width="130px">
|
|
||||||
<template #default="scope">
|
|
||||||
<dict-tag :type="DICT_TYPE.CRM_AUDIT_STATUS" :value="scope.row.checkStatus" />
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<!--<el-table-column label="工作流编号" align="center" prop="processInstanceId" />-->
|
|
||||||
<el-table-column prop="ownerUserId" label="负责人" width="120">
|
|
||||||
<template #default="scope">
|
|
||||||
{{ userList.find((user) => user.id === scope.row.ownerUserId)?.nickname }}
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="显示顺序" align="center" prop="sort" />
|
|
||||||
<el-table-column label="备注" align="center" prop="remark" />
|
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="创建时间"
|
:formatter="dateFormatter2"
|
||||||
align="center"
|
align="center"
|
||||||
prop="createTime"
|
label="提醒日期"
|
||||||
:formatter="dateFormatter"
|
prop="remindTime"
|
||||||
width="180px"
|
width="180px"
|
||||||
/>
|
/>
|
||||||
<el-table-column label="操作" align="center" width="130px">
|
<el-table-column label="负责人" prop="ownerUserName" width="120" />
|
||||||
|
<el-table-column align="center" label="备注" prop="remark" />
|
||||||
|
<el-table-column
|
||||||
|
align="center"
|
||||||
|
fixed="right"
|
||||||
|
label="完成状态"
|
||||||
|
prop="finishStatus"
|
||||||
|
width="130px"
|
||||||
|
>
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.finishStatus" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column align="center" fixed="right" label="操作" width="130px">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button
|
<el-button
|
||||||
|
v-hasPermi="['crm:receivable-plan:update']"
|
||||||
link
|
link
|
||||||
type="primary"
|
type="primary"
|
||||||
@click="openForm('update', scope.row.id)"
|
@click="openForm('update', scope.row.id)"
|
||||||
v-hasPermi="['crm:receivable-plan:update']"
|
|
||||||
>
|
>
|
||||||
编辑
|
编辑
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
|
v-hasPermi="['crm:receivable-plan:delete']"
|
||||||
link
|
link
|
||||||
type="danger"
|
type="danger"
|
||||||
@click="handleDelete(scope.row.id)"
|
@click="handleDelete(scope.row.id)"
|
||||||
v-hasPermi="['crm:receivable-plan:delete']"
|
|
||||||
>
|
>
|
||||||
删除
|
删除
|
||||||
</el-button>
|
</el-button>
|
||||||
|
@ -122,9 +122,9 @@
|
||||||
</el-table>
|
</el-table>
|
||||||
<!-- 分页 -->
|
<!-- 分页 -->
|
||||||
<Pagination
|
<Pagination
|
||||||
:total="total"
|
|
||||||
v-model:page="queryParams.pageNo"
|
|
||||||
v-model:limit="queryParams.pageSize"
|
v-model:limit="queryParams.pageSize"
|
||||||
|
v-model:page="queryParams.pageNo"
|
||||||
|
:total="total"
|
||||||
@pagination="getList"
|
@pagination="getList"
|
||||||
/>
|
/>
|
||||||
</ContentWrap>
|
</ContentWrap>
|
||||||
|
@ -133,13 +133,14 @@
|
||||||
<ReceivablePlanForm ref="formRef" @success="getList" />
|
<ReceivablePlanForm ref="formRef" @success="getList" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script lang="ts" setup>
|
||||||
import { DICT_TYPE } from '@/utils/dict'
|
import { DICT_TYPE } from '@/utils/dict'
|
||||||
import { dateFormatter, dateFormatter2 } from '@/utils/formatTime'
|
import { dateFormatter2 } from '@/utils/formatTime'
|
||||||
import download from '@/utils/download'
|
import download from '@/utils/download'
|
||||||
import * as ReceivablePlanApi from '@/api/crm/receivable/plan'
|
import * as ReceivablePlanApi from '@/api/crm/receivable/plan'
|
||||||
import ReceivablePlanForm from './ReceivablePlanForm.vue'
|
import ReceivablePlanForm from './ReceivablePlanForm.vue'
|
||||||
import * as UserApi from '@/api/system/user'
|
import * as UserApi from '@/api/system/user'
|
||||||
|
import * as CustomerApi from '@/api/crm/customer'
|
||||||
|
|
||||||
defineOptions({ name: 'ReceivablePlan' })
|
defineOptions({ name: 'ReceivablePlan' })
|
||||||
|
|
||||||
|
@ -153,8 +154,8 @@ const userList = ref<UserApi.UserVO[]>([]) // 用户列表
|
||||||
const queryParams = reactive({
|
const queryParams = reactive({
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
customerId: null,
|
customerId: undefined,
|
||||||
contractId: null
|
contractNo: undefined
|
||||||
})
|
})
|
||||||
const queryFormRef = ref() // 搜索的表单
|
const queryFormRef = ref() // 搜索的表单
|
||||||
const exportLoading = ref(false) // 导出的加载中
|
const exportLoading = ref(false) // 导出的加载中
|
||||||
|
@ -216,11 +217,13 @@ const handleExport = async () => {
|
||||||
exportLoading.value = false
|
exportLoading.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const customerList = ref<CustomerApi.CustomerVO[]>([]) // 客户列表
|
||||||
/** 初始化 **/
|
/** 初始化 **/
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await getList()
|
await getList()
|
||||||
// 获取用户列表
|
// 获取用户列表
|
||||||
userList.value = await UserApi.getSimpleUserList()
|
userList.value = await UserApi.getSimpleUserList()
|
||||||
|
// 获得客户列表
|
||||||
|
customerList.value = await CustomerApi.getCustomerSimpleList()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue