diff --git a/.env b/.env index cdbb61806..21ce00ac1 100644 --- a/.env +++ b/.env @@ -25,4 +25,7 @@ VITE_APP_DEFAULT_LOGIN_USERNAME = admin VITE_APP_DEFAULT_LOGIN_PASSWORD = admin123 # 租户开关 -VUE_APP_TENANT_ENABLE=false \ No newline at end of file +VUE_APP_TENANT_ENABLE=false + +# 腾讯地图key +VITE_APP_TENCENT_MAP_KEY= EE5BZ-SMO63-I6G3P-OL4UN-BE34O-QCBOS \ No newline at end of file diff --git a/.env.local b/.env.local index 1a84e6942..aa7982fa5 100644 --- a/.env.local +++ b/.env.local @@ -4,7 +4,7 @@ NODE_ENV=development VITE_DEV=true # 请求路径 -VITE_BASE_URL='http://localhost:48080' +VITE_BASE_URL='http://www.woyaoshouchong.asia:48080' # 文件上传类型:server - 后端上传, client - 前端直连上传,仅支持 S3 服务 VITE_UPLOAD_TYPE=client diff --git a/.env.test b/.env.test index b4bef42a8..3436f5776 100644 --- a/.env.test +++ b/.env.test @@ -1,10 +1,10 @@ # 测试环境:只在打包时使用 NODE_ENV=production -VITE_DEV=false +VITE_DEV=true # 请求路径 -VITE_BASE_URL='http://www.woyaoshouchong.asia:48080' +VITE_BASE_URL='http://www.woyaoshouchong.asia:88' # 文件上传类型:server - 后端上传, client - 前端直连上传,仅支持S3服务 VITE_UPLOAD_TYPE=client @@ -13,16 +13,16 @@ VITE_UPLOAD_TYPE=client VITE_API_URL=/admin-api # 是否删除debugger -VITE_DROP_DEBUGGER=true +VITE_DROP_DEBUGGER=false # 是否删除console.log -VITE_DROP_CONSOLE=true +VITE_DROP_CONSOLE=false # 是否sourcemap -VITE_SOURCEMAP=false +VITE_SOURCEMAP=true # 打包路径 -VITE_BASE_PATH=/admin-ui-vue3/ +VITE_BASE_PATH=/ # 输出路径 VITE_OUT_DIR=dist-test diff --git a/src/api/crm/followup/index.ts b/src/api/crm/followup/index.ts index 8071f7284..a3bc03c25 100644 --- a/src/api/crm/followup/index.ts +++ b/src/api/crm/followup/index.ts @@ -35,6 +35,16 @@ export const FollowUpRecordApi = { return await request.get({ url: `/crm/follow-up-record/page`, params }) }, + // 查询单条跟进记录 + getFollowUpRecord: async (id: number) => { + return await request.get({ url: `/crm/follow-up-record/get?id=${id}` }) + }, + + // 更新跟进记录 + updateFollowUpRecord: async (data: FollowUpRecordVO) => { + return await request.put({ url: `/crm/follow-up-record/update`, data }) + }, + // 新增跟进记录 createFollowUpRecord: async (data: FollowUpRecordVO) => { return await request.post({ url: `/crm/follow-up-record/create`, data }) diff --git a/src/views/crm/backlog/components/ContractRemindList.vue b/src/views/crm/backlog/components/ContractRemindList.vue index 0cacf3597..4957949d0 100644 --- a/src/views/crm/backlog/components/ContractRemindList.vue +++ b/src/views/crm/backlog/components/ContractRemindList.vue @@ -49,17 +49,6 @@ - - - 编辑 - + diff --git a/src/views/crm/customer/components/FileForm.vue b/src/views/crm/customer/components/FileForm.vue index d5aa4cca2..b2f7bd4e3 100644 --- a/src/views/crm/customer/components/FileForm.vue +++ b/src/views/crm/customer/components/FileForm.vue @@ -47,11 +47,19 @@ const uploadRef = ref() const props = defineProps<{ customerId: number }>() -const { uploadUrl, httpRequest } = useUpload(undefined, 'crm_consumer', props.customerId ) +const { uploadUrl, httpRequest } = useUpload(undefined, 'crm_consumer', Number(props.customerId)) +// 保证 data.value.categoryId 始终为最新 customerId +watch(() => props.customerId, (val) => { + if (val && Number(val) >= 0) { + data.value.categoryId = Number(val) + } else { + data.value.categoryId = undefined + } +}) /** 打开弹窗 */ -const open = (customerId: number) => { - data.value.categoryId = customerId +const open = (customerId: number | string) => { + data.value.categoryId = customerId && Number(customerId) > 0 ? Number(customerId) : undefined dialogVisible.value = true resetForm() } @@ -66,7 +74,7 @@ const resetForm = () => { const handleFileChange = (file) => { data.value.path = file.name data.value.category = 'crm_consumer' - data.value.categoryId = props.customerId + data.value.categoryId = Number(props.customerId) } /** 提交上传 */ diff --git a/src/views/crm/customer/components/FileList.vue b/src/views/crm/customer/components/FileList.vue index b04d1dc77..a8190a50b 100644 --- a/src/views/crm/customer/components/FileList.vue +++ b/src/views/crm/customer/components/FileList.vue @@ -101,7 +101,7 @@ link type="danger" @click="handleDelete(scope.row.id)" - v-hasPermi="['infra:file:delete']" + v-hasPermi="['crm:customer:file:delete']" > 删除 diff --git a/src/views/crm/customer/detail/index.vue b/src/views/crm/customer/detail/index.vue index f64d1fa0d..93e65fb9b 100644 --- a/src/views/crm/customer/detail/index.vue +++ b/src/views/crm/customer/detail/index.vue @@ -8,7 +8,7 @@ > 编辑 - + 转移 @@ -108,13 +93,13 @@ const formData = ref({ const formRules = reactive({ type: [{ required: true, message: '跟进类型不能为空', trigger: 'change' }], content: [{ required: true, message: '跟进内容不能为空', trigger: 'blur' }], - nextTime: [{ required: true, message: '下次联系时间不能为空', trigger: 'blur' }], contactIds: [{ required: true, message: '联系人不能为空', trigger: 'change' }] }) const formRef = ref() // 表单 Ref const contactOptions = ref([]) +const formType = ref('') // 表单的类型:create - 新增;update - 修改 watch( () => formData.value.bizId, @@ -123,19 +108,38 @@ watch( // 获取客户下联系人 const res = await ContactApi.getContactPageByCustomer({ customerId: val, pageSize: 100 }) contactOptions.value = res.list || [] + // 自动选中第一个联系人 + if (contactOptions.value.length > 0) { + formData.value.contactIds = [contactOptions.value[0].id] + } else { + formData.value.contactIds = [] + } } else { contactOptions.value = [] + formData.value.contactIds = [] } }, { immediate: true } ) /** 打开弹窗 */ -const open = async (bizType: number, bizId: number) => { +const open = async (bizType: number, bizId: number, id?: number) => { dialogVisible.value = true resetForm() formData.value.bizType = bizType formData.value.bizId = bizId + if (id) { + formType.value = 'update' + formLoading.value = true + try { + const data = await FollowUpRecordApi.getFollowUpRecord(id) + Object.assign(formData.value, data) + } finally { + formLoading.value = false + } + } else { + formType.value = 'create' + } } defineExpose({ open }) // 提供 open 方法,用于打开弹窗 @@ -156,7 +160,15 @@ const submitForm = async () => { contactIds, businessIds: (formData.value.businesses || []).map((item: any) => item.id) } as unknown as FollowUpRecordVO - await FollowUpRecordApi.createFollowUpRecord(data) + + if (formType.value === 'create') { + await FollowUpRecordApi.createFollowUpRecord(data) + message.success(t('common.createSuccess')) + } else { + await FollowUpRecordApi.updateFollowUpRecord(data) + message.success(t('common.updateSuccess')) + } + message.success(t('common.createSuccess')) dialogVisible.value = false emit('success') diff --git a/src/views/crm/followup/index.vue b/src/views/crm/followup/index.vue index fbd0990fc..e50dbc508 100644 --- a/src/views/crm/followup/index.vue +++ b/src/views/crm/followup/index.vue @@ -15,6 +15,7 @@ :timestamp="formatDate(item.createTime)" placement="top" > + 跟进人:{{ item.creatorName }}