diff --git a/src/api/crm/contract/index.ts b/src/api/crm/contract/index.ts
index a15b8790..ee06ad6d 100644
--- a/src/api/crm/contract/index.ts
+++ b/src/api/crm/contract/index.ts
@@ -66,9 +66,9 @@ export const getContract = async (id: number) => {
}
// 查询 CRM 合同下拉列表
-export const getCrmContractSimpleListByCustomerId = async (customerId: number) => {
+export const getContractSimpleList = async (customerId: number) => {
return await request.get({
- url: `/crm/contract/list-all-simple-by-customer?customerId=${customerId}`
+ url: `/crm/contract/simple-list?customerId=${customerId}`
})
}
diff --git a/src/api/crm/receivable/plan/index.ts b/src/api/crm/receivable/plan/index.ts
index d5a72871..f11ca17c 100644
--- a/src/api/crm/receivable/plan/index.ts
+++ b/src/api/crm/receivable/plan/index.ts
@@ -5,10 +5,10 @@ export interface ReceivablePlanVO {
period: number
receivableId: number
finishStatus: number
- processInstanceId: number
price: number
returnTime: Date
remindDays: number
+ returnType: number
remindTime: Date
customerId: number
customerName?: string
@@ -43,6 +43,7 @@ export const getReceivablePlan = async (id: number) => {
}
// 查询回款计划下拉数据
+// TODO @芋艿:再看看这里
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}`
diff --git a/src/views/crm/receivable/ReceivableForm.vue b/src/views/crm/receivable/ReceivableForm.vue
index 6738cd99..537173f9 100644
--- a/src/views/crm/receivable/ReceivableForm.vue
+++ b/src/views/crm/receivable/ReceivableForm.vue
@@ -75,7 +75,7 @@
{
}
const getContractList = async (customerId: number) => {
- contractList.value = await ContractApi.getCrmContractSimpleListByCustomerId(customerId)
+ contractList.value = await ContractApi.getContractSimpleList(customerId)
}
const getReceivablePlanList = async (contractId: number) => {
receivablePlanList.value = await ReceivablePlanApi.getReceivablePlanListByContractId(
diff --git a/src/views/crm/receivable/plan/ReceivablePlanForm.vue b/src/views/crm/receivable/plan/ReceivablePlanForm.vue
index b6fa9799..8401e5a2 100644
--- a/src/views/crm/receivable/plan/ReceivablePlanForm.vue
+++ b/src/views/crm/receivable/plan/ReceivablePlanForm.vue
@@ -7,10 +7,40 @@
:rules="formRules"
label-width="110px"
>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
+
+
@@ -69,6 +92,8 @@
/>
+
+
-
-
+
+
+
+
-
+
@@ -113,10 +135,11 @@ 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, getIntDictOptions } from '@/utils/dict'
const { t } = useI18n() // 国际化
const message = useMessage() // 消息弹窗
-const userList = ref([]) // 用户列表
+const userOptions = ref([]) // 用户列表
const dialogVisible = ref(false) // 弹窗的是否展示
const dialogTitle = ref('') // 弹窗的标题
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
@@ -125,7 +148,6 @@ const formData = ref({} as ReceivablePlanApi
const formRules = reactive({
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' }]
@@ -133,6 +155,7 @@ const formRules = reactive({
const formRef = ref() // 表单 Ref
const customerList = ref([]) // 客户列表
const contractList = ref([]) // 合同列表
+
/** 打开弹窗 */
const open = async (type: string, id?: number) => {
dialogVisible.value = true
@@ -148,9 +171,8 @@ const open = async (type: string, id?: number) => {
formLoading.value = false
}
}
-
// 获得用户列表
- userList.value = await UserApi.getSimpleUserList()
+ userOptions.value = await UserApi.getSimpleUserList()
// 获得客户列表
customerList.value = await CustomerApi.getCustomerSimpleList()
// 默认新建时选中自己
@@ -160,22 +182,6 @@ const open = async (type: string, id?: number) => {
}
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 submitForm = async () => {
@@ -207,4 +213,15 @@ const resetForm = () => {
formData.value = {} as ReceivablePlanApi.ReceivablePlanVO
formRef.value?.resetFields()
}
+
+/** 处理切换客户 */
+const handleCustomerChange = async (customerId: number) => {
+ // 重置合同编号
+ formData.value.contractId = undefined
+ // 获得合同列表
+ if (customerId) {
+ contractList.value = []
+ contractList.value = await ContractApi.getContractSimpleList(customerId)
+ }
+}