CRM 场地管理
parent
d804171fed
commit
ae637966a4
|
|
@ -34,7 +34,8 @@ export enum BizTypeEnum {
|
|||
CRM_CONTRACT = 5, // 合同
|
||||
CRM_PRODUCT = 6, // 产品
|
||||
CRM_RECEIVABLE = 7, // 回款
|
||||
CRM_RECEIVABLE_PLAN = 8 // 回款计划
|
||||
CRM_RECEIVABLE_PLAN = 8, // 回款计划
|
||||
CRM_STATION_SITE = 9 // 场地信息
|
||||
}
|
||||
/**
|
||||
* CRM 数据权限级别枚举
|
||||
|
|
|
|||
|
|
@ -9,11 +9,14 @@ export interface StationSiteVO {
|
|||
detailAddress?: string // 地址
|
||||
locationLng: number // 定位经度
|
||||
locationLat: number // 定位纬度
|
||||
locationName: string // 定位名称
|
||||
estimatedPiles: number // 可建充电桩数
|
||||
siteType: number // 场地类型
|
||||
siteStatus: number // 场地状态
|
||||
ownerId: number // 关联的业主方
|
||||
ownerName: string // 业主方名称
|
||||
managementId: number // 关联的物管方
|
||||
managementName: string // 物管方名称
|
||||
recommenderName: string // 推荐人姓名
|
||||
recommenderContact: string // 推荐人联系方式
|
||||
picUrls?: string // 图片
|
||||
|
|
|
|||
|
|
@ -588,6 +588,17 @@ const remainingRouter: AppRouteRecordRaw[] = [
|
|||
activeMenu: '/crm/product'
|
||||
},
|
||||
component: () => import('@/views/crm/product/detail/index.vue')
|
||||
},
|
||||
{
|
||||
path: 'stationsite/detail/:id',
|
||||
name: 'CrmStationSiteDetail',
|
||||
meta: {
|
||||
title: '场地信息详情',
|
||||
noCache: true,
|
||||
hidden: true,
|
||||
activeMenu: '/crm/station-site'
|
||||
},
|
||||
component: () => import('@/views/crm/stationsite/detail/index.vue')
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
|||
|
|
@ -267,15 +267,6 @@ const openDetail = (id: number) => {
|
|||
push({ name: 'CrmCustomerDetail', params: { id } })
|
||||
}
|
||||
|
||||
/** 打开主要联系人详情 */
|
||||
const openPrimaryContactDetail = (id: number) => {
|
||||
if (!id) {
|
||||
// id 为空跳转客户详情
|
||||
push({ name: 'CrmCustomerDetail', params: { id: scopeRowIdForCustomerDetail.value } })
|
||||
} else {
|
||||
push({ name: 'CrmContactDetail', params: { id } })
|
||||
}
|
||||
}
|
||||
// 用于存储当前行客户id
|
||||
const scopeRowIdForCustomerDetail = ref<number | null>(null)
|
||||
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@
|
|||
<template>
|
||||
<!-- 搜索栏 -->
|
||||
<el-form :inline="true" :model="queryParams" class="mb-10px">
|
||||
<el-form-item label="跟进人">
|
||||
<el-form-item :label="bizLabel + '人'">
|
||||
<el-select
|
||||
v-model="queryParams.creator"
|
||||
filterable
|
||||
remote
|
||||
clearable
|
||||
placeholder="请选择跟进人"
|
||||
placeholder="请选择"
|
||||
style="width: 150px"
|
||||
>
|
||||
<el-option
|
||||
|
|
@ -19,8 +19,8 @@
|
|||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="跟进方式">
|
||||
<el-select v-model="queryParams.type" placeholder="请选择跟进方式" clearable style="width: 150px">
|
||||
<el-form-item v-if="queryParams.bizType === BizTypeEnum.CRM_CUSTOMER" :label="bizLabel + '方式'">
|
||||
<el-select v-model="queryParams.type" :placeholder="'请选择' + bizLabel + '方式'" clearable style="width: 150px">
|
||||
<el-option v-for="dict in getIntDictOptions(DICT_TYPE.CRM_FOLLOW_UP_TYPE)" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
|
@ -31,8 +31,13 @@
|
|||
<el-button @click="resetQuery">
|
||||
<Icon icon="ep:refresh" class="mr-5px" />重置
|
||||
</el-button>
|
||||
<el-button v-if="queryParams.bizId !== undefined" v-hasPermi="['crm:follow-up-record:create']" @click="openForm('create')">
|
||||
<Icon icon="ep:plus" class="mr-5px" />添加{{ bizLabel }}记录
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
{{ queryParams }}
|
||||
</el-form>
|
||||
|
||||
|
||||
<!-- 跟进记录时间线 -->
|
||||
<el-timeline>
|
||||
|
|
@ -42,13 +47,13 @@
|
|||
:timestamp="formatDate(item.createTime)"
|
||||
placement="top"
|
||||
>
|
||||
<span>跟进人:</span>{{ item.creatorName }}
|
||||
<span>{{ bizLabel }}人:</span>{{ item.creatorName }}
|
||||
<span v-if="Array.isArray(item.customer) && item.customer.length > 0 && item.customer[0].name" style="margin-left: 8px;">
|
||||
客户名称:{{ item.customer[0].name }}
|
||||
</span>
|
||||
|
||||
<template #timestamp>
|
||||
<div style="color:#999;font-size:13px;margin-bottom:2px;">跟进时间</div>
|
||||
<div style="color:#999;font-size:13px;margin-bottom:2px;">{{ bizLabel }}时间</div>
|
||||
<span>{{ formatDate(item.createTime) }}</span>
|
||||
</template>
|
||||
<div class="el-timeline-right-content">
|
||||
|
|
@ -67,19 +72,19 @@
|
|||
</el-link>
|
||||
<span style="margin: 0 8px;"> </span>
|
||||
</template>
|
||||
<span class="meta-label">跟进方式:</span><dict-tag :type="DICT_TYPE.CRM_FOLLOW_UP_TYPE" :value="item.type" class="mr-10px" />
|
||||
<span class="meta-label">{{ bizLabel }}方式:</span><dict-tag :type="DICT_TYPE.CRM_FOLLOW_UP_TYPE" :value="item.type" class="mr-10px" />
|
||||
</div>
|
||||
<!-- 操作按钮统一放右上角 -->
|
||||
<div class="followup-action-btns">
|
||||
<el-button v-hasPermi="['crm:follow-up-record:update']" link class="followup-action-btn edit" @click="openForm('update', item.id)">
|
||||
<el-button v-hasPermi="['crm:follow-up-record:update']" link class="followup-action-btn edit" @click="openForm('update')">
|
||||
<Icon icon="ep:edit" class="mr-3px" /> 编辑
|
||||
</el-button>
|
||||
<el-button v-hasPermi="['crm:follow-up-record:delete']" link class="followup-action-btn delete" @click="handleDelete(item.id)">
|
||||
<Icon icon="ep:delete" class="mr-3px" /> 删除
|
||||
</el-button>
|
||||
</div>
|
||||
<span class="follow-row" v-if="!/<[a-z][\s\S]*>/i.test(item.content)">跟进内容:{{ item.content }}</span>
|
||||
<div class="follow-row" v-else v-html="'跟进内容:' + item.content"></div>
|
||||
<span class="follow-row" v-if="!/<[a-z][\s\S]*>/i.test(item.content)">{{ bizLabel }}内容:{{ item.content }}</span>
|
||||
<div class="follow-row" v-else v-html="bizLabel + '内容:' + item.content"></div>
|
||||
<!-- 图片直接展示 -->
|
||||
<div v-if="item.picUrls && item.picUrls.length" class="followup-img-list follow-row mt-10px">
|
||||
<el-image
|
||||
|
|
@ -121,7 +126,7 @@
|
|||
/>
|
||||
|
||||
<!-- 表单弹窗:添加/修改 -->
|
||||
<FollowUpRecordForm ref="formRef" @success="getList" />
|
||||
<FollowUpRecordForm ref="formRef" @success="getList" :biz-label="bizLabel" />
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
|
|
@ -137,6 +142,7 @@ const userOptions = ref<any[]>([])
|
|||
|
||||
/** 跟进记录列表 */
|
||||
defineOptions({ name: 'FollowUpRecord' })
|
||||
|
||||
const props = defineProps<{
|
||||
bizType: number
|
||||
bizId?: number // bizId 可选
|
||||
|
|
@ -172,9 +178,8 @@ const getList = async () => {
|
|||
/** 添加/修改操作 */
|
||||
const formRef = ref<InstanceType<typeof FollowUpRecordForm>>()
|
||||
// 支持编辑和新增
|
||||
const openForm = (type: 'create' | 'update', id: number) => {
|
||||
|
||||
formRef.value?.open(type, id)
|
||||
const openForm = (type: 'create' | 'update') => {
|
||||
formRef.value?.open(type, props.bizType, props.bizId)
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -192,6 +197,17 @@ const handleDelete = async (id: number) => {
|
|||
} catch {}
|
||||
}
|
||||
|
||||
const bizLabel = computed(() => {
|
||||
switch (formRef.value?.bizType) {
|
||||
case BizTypeEnum.CRM_CUSTOMER:
|
||||
return '跟进'
|
||||
case BizTypeEnum.CRM_STATION_SITE:
|
||||
return '评审'
|
||||
default:
|
||||
return '跟进'
|
||||
}
|
||||
})
|
||||
|
||||
/** 打开联系人详情 */
|
||||
const { push } = useRouter()
|
||||
const openContactDetail = (id: number) => {
|
||||
|
|
@ -235,7 +251,8 @@ watch(
|
|||
() => props.bizId,
|
||||
() => {
|
||||
queryParams.bizType = props.bizType
|
||||
queryParams.bizId = typeof props.bizId === 'number' ? props.bizId : undefined
|
||||
queryParams.bizId = props.bizId
|
||||
|
||||
getList()
|
||||
},
|
||||
{ immediate: true }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<!-- 跟进记录的添加表单 -->
|
||||
<template>
|
||||
<Dialog v-model="dialogVisible" title="添加跟进记录" width="70%">
|
||||
<Dialog v-model="dialogVisible" :title="`添加${bizLabel}记录`" width="70%">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
v-loading="formLoading"
|
||||
|
|
@ -8,10 +8,11 @@
|
|||
:rules="formRules"
|
||||
label-width="120px"
|
||||
>
|
||||
{{ formData }}
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="跟进方式" prop="type">
|
||||
<el-select v-model="formData.type" placeholder="请选择跟进">
|
||||
<el-form-item :label="`${bizLabel}方式`" prop="type" :required="bizLabel !== '9'">
|
||||
<el-select v-model="formData.type" :placeholder="`请选择${bizLabel}`" :clearable="bizLabel === '9'">
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.CRM_FOLLOW_UP_TYPE)"
|
||||
:key="dict.value"
|
||||
|
|
@ -29,7 +30,7 @@
|
|||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="跟进内容" prop="content">
|
||||
<el-form-item :label="`${bizLabel}内容`" prop="content">
|
||||
<Editor v-model="formData.content" height="300px" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
|
@ -85,14 +86,32 @@ const formData = ref<FollowUpFormData>({
|
|||
contacts: [],
|
||||
contactIds: []
|
||||
})
|
||||
const formRules = reactive({
|
||||
type: [{ required: true, message: '跟进类型不能为空', trigger: 'change' }],
|
||||
content: [{ required: true, message: '跟进内容不能为空', trigger: 'blur' }],
|
||||
contactIds: [{ required: true, message: '联系人不能为空', trigger: 'change' }]
|
||||
|
||||
})
|
||||
|
||||
const formRef = ref() // 表单 Ref
|
||||
|
||||
const bizLabel = computed(() => {
|
||||
switch (formData.value.bizType) {
|
||||
case BizTypeEnum.CRM_CUSTOMER:
|
||||
return '跟进'
|
||||
case BizTypeEnum.CRM_STATION_SITE:
|
||||
return '评审'
|
||||
default:
|
||||
return '跟进'
|
||||
}
|
||||
})
|
||||
|
||||
const formRules = reactive({
|
||||
type: [
|
||||
{
|
||||
required: bizLabel.value !== '评审',
|
||||
message: `${bizLabel.value}类型不能为空`,
|
||||
trigger: 'change'
|
||||
}
|
||||
],
|
||||
content: [{ required: true, message: `${bizLabel.value}内容不能为空`, trigger: 'blur' }],
|
||||
contactIds: [{ required: bizLabel.value !== '评审', message: '联系人不能为空', trigger: 'change' }]
|
||||
})
|
||||
|
||||
const contactOptions = ref<ContactApi.ContactVO[]>([])
|
||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||
|
||||
|
|
@ -113,15 +132,21 @@ watch(
|
|||
)
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (type: string, id: number) => {
|
||||
const open = async (type: string, bizType: number, bizId: number) => {
|
||||
console.log(formData.value)
|
||||
dialogVisible.value = true
|
||||
resetForm()
|
||||
formType.value = type
|
||||
formData.value.bizType = bizType
|
||||
formData.value.bizId = bizId
|
||||
if (formType.value === 'update') {
|
||||
|
||||
if (bizId === undefined || bizId === null) {
|
||||
message.warning(t('记录ID不能为空'))
|
||||
return
|
||||
}
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = await FollowUpRecordApi.getFollowUpRecord(id)
|
||||
const data = await FollowUpRecordApi.getFollowUpRecord(bizId)
|
||||
Object.assign(formData.value, data)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
|
|
@ -130,6 +155,7 @@ const open = async (type: string, id: number) => {
|
|||
}
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
|
||||
|
||||
/** 提交表单 */
|
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||
// 提交时contactIds直接提交
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="场地类型" prop="type">
|
||||
<el-form-item label="场地类型" prop="siteType">
|
||||
<el-select v-model="formData.siteType" placeholder="请选择场地类型" class="w-1/1">
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.CRM_STATION_SITE_TYPE)"
|
||||
|
|
@ -67,31 +67,41 @@
|
|||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="停车位数" prop="parkingSpaces">
|
||||
<el-input-number v-model="formData.parkingSpaces" :min="0" :max="255" :step="1" placeholder="0" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="租金或分成" prop="rentPrice">
|
||||
<el-input v-model="formData.rentPrice" placeholder="请输入租金或分成" />
|
||||
<el-form-item label="地图选点" prop="locationName">
|
||||
<el-input v-model="formData.locationName" placeholder="请选择地图位置" readonly>
|
||||
<template #append>
|
||||
<el-button @click="openMapDialog">地图选点</el-button>
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item label="定位经度" prop="locationLng">
|
||||
<el-input v-model="formData.locationLng" placeholder="请输入定位经度" />
|
||||
</el-form-item>
|
||||
<el-form-item label="定位纬度" prop="locationLat">
|
||||
<el-input v-model="formData.locationLat" placeholder="请输入定位纬度" />
|
||||
</el-form-item>
|
||||
<el-row>
|
||||
<el-dialog v-model="mapDialogVisible" title="获取经纬度" width="800px" append-to-body>
|
||||
<iframe
|
||||
v-if="mapDialogVisible"
|
||||
:src="tencentLbsUrl"
|
||||
width="100%"
|
||||
height="600"
|
||||
frameborder="0"
|
||||
></iframe>
|
||||
</el-dialog>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="关联的业主方" prop="ownerId">
|
||||
<el-input v-model="formData.ownerId" placeholder="请输入关联的业主方" />
|
||||
<el-form-item label="业主方" prop="ownerId">
|
||||
<el-input v-model="formData.ownerName" placeholder="请输入业主方" :disabled="ownerInputDisabled">
|
||||
<template #append>
|
||||
<el-button @click="openOwnerDialog">关联</el-button>
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="关联的物管方" prop="managementId">
|
||||
<el-input v-model="formData.managementId" placeholder="请输入关联的物管方" />
|
||||
<el-form-item label="物管方" prop="managementId">
|
||||
<el-input v-model="formData.managementName" placeholder="请输入物管方" :disabled="managementInputDisabled">
|
||||
<template #append>
|
||||
<el-button @click="openManagementDialog">关联</el-button>
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
|
@ -141,13 +151,59 @@
|
|||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
|
||||
<!-- 业主方选择弹窗 -->
|
||||
<el-dialog
|
||||
title="选择业主方"
|
||||
v-model="ownerDialogVisible"
|
||||
width="400px"
|
||||
>
|
||||
<el-table
|
||||
:data="customerList"
|
||||
style="width: 100%"
|
||||
@current-change="handleOwnerSelect"
|
||||
|
||||
highlight-current-row
|
||||
ref="ownerTable"
|
||||
>
|
||||
<el-table-column type="index" width="55" />
|
||||
<el-table-column prop="name" label="客户名称" width="300" />
|
||||
</el-table>
|
||||
<div style="text-align: right; margin-top: 10px;">
|
||||
<el-button @click="ownerDialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="confirmOwnerSelection">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 物管方选择弹窗 -->
|
||||
<el-dialog
|
||||
title="选择物管方"
|
||||
v-model="managementDialogVisible"
|
||||
width="400px"
|
||||
>
|
||||
<el-table
|
||||
:data="customerList"
|
||||
style="width: 100%"
|
||||
@current-change="handleManagementSelect"
|
||||
highlight-current-row
|
||||
ref="managementTable"
|
||||
>
|
||||
<el-table-column type="index" width="55" />
|
||||
<el-table-column prop="name" label="客户名称" width="300" />
|
||||
</el-table>
|
||||
<div style="text-align: right; margin-top: 10px;">
|
||||
<el-button @click="managementDialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="confirmManagementSelection">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||
import { StationSiteApi, StationSiteVO } from '@/api/crm/stationsite'
|
||||
import { defaultProps } from '@/utils/tree'
|
||||
import * as AreaApi from '@/api/system/area'
|
||||
import { ro } from 'element-plus/es/locale'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
import * as CustomerApi from '@/api/crm/customer'
|
||||
|
||||
/** 场地信息 表单 */
|
||||
defineOptions({ name: 'StationSiteForm' })
|
||||
|
|
@ -164,18 +220,20 @@ const formData = ref({
|
|||
name: undefined,
|
||||
areaId: undefined,
|
||||
detailAddress: undefined,
|
||||
locationLng: undefined,
|
||||
locationLat: undefined,
|
||||
locationLng: 0,
|
||||
locationLat: 0,
|
||||
estimatedPiles: 0,
|
||||
siteStatus: undefined,
|
||||
siteType: undefined,
|
||||
ownerUserId: 0,
|
||||
ownerId: undefined,
|
||||
ownerName: undefined,
|
||||
managementId: undefined,
|
||||
managementName: undefined,
|
||||
recommenderName: undefined,
|
||||
recommenderContact: undefined,
|
||||
picUrls: undefined,
|
||||
fileUrls: undefined,
|
||||
picUrls: [], // 修复:初始化为空数组
|
||||
fileUrls: [], // 修复:初始化为空数组
|
||||
parkingSpaces: 0,
|
||||
rentPrice: '',
|
||||
params: {
|
||||
|
|
@ -184,19 +242,32 @@ const formData = ref({
|
|||
barrierGate: '',
|
||||
competitor: ''
|
||||
},
|
||||
locationName: '', // locationName 字段用于显示地图选点名称
|
||||
})
|
||||
const areaList = ref([]) // 地区列表
|
||||
const customerList = ref<{ id: string | number; name: string }[]>([])
|
||||
const formRules = reactive({
|
||||
name: [{ required: true, message: '场地名称不能为空', trigger: 'blur' }],
|
||||
areaId: [{ required: true, message: '地区不能为空', trigger: 'blur' }],
|
||||
locationLng: [{ required: true, message: '定位经度不能为空', trigger: 'blur' }],
|
||||
locationLat: [{ required: true, message: '定位纬度不能为空', trigger: 'blur' }],
|
||||
siteType: [{ required: true, message: '场地类型不能为空', trigger: 'blur' }],
|
||||
locationName: [{ required: true, message: '地图选点不能为空', trigger: 'blur' }],
|
||||
estimatedPiles: [{ required: true, message: '可建充电桩数不能为空', trigger: 'blur' }],
|
||||
siteStatus: [{ required: true, message: '场地状态不能为空', trigger: 'blur' }],
|
||||
recommenderName: [{ required: true, message: '推荐人姓名不能为空', trigger: 'blur' }],
|
||||
recommenderContact: [{ required: true, message: '推荐人联系方式不能为空', trigger: 'blur' }],
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
const mapDialogVisible = ref(false)
|
||||
const tencentLbsUrl = ref('')
|
||||
const TENCENT_MAP_KEY = import.meta.env.VITE_APP_TENCENT_MAP_KEY // 你的腾讯地图key
|
||||
const ownerDialogVisible = ref(false)
|
||||
const managementDialogVisible = ref(false)
|
||||
const selectedOwner = ref()
|
||||
const selectedManagement = ref()
|
||||
const ownerFlag = ref(false)
|
||||
const managementFlag = ref(false)
|
||||
const ownerInputDisabled = computed(() => !!formData.value.ownerId)
|
||||
const managementInputDisabled = computed(() => !!formData.value.managementId)
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (type: string, id?: number) => {
|
||||
|
|
@ -209,6 +280,19 @@ const open = async (type: string, id?: number) => {
|
|||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await StationSiteApi.getStationSite(id)
|
||||
// 修复 params 多重转义问题
|
||||
if (typeof formData.value.params === 'string') {
|
||||
try {
|
||||
formData.value.params = JSON.parse(formData.value.params)
|
||||
} catch (e) {
|
||||
formData.value.params = {
|
||||
traffic: '',
|
||||
powerDistance: '',
|
||||
barrierGate: '',
|
||||
competitor: ''
|
||||
}
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
|
|
@ -254,34 +338,149 @@ const resetForm = () => {
|
|||
name: undefined,
|
||||
areaId: undefined,
|
||||
detailAddress: undefined,
|
||||
locationLng: undefined,
|
||||
locationLat: undefined,
|
||||
locationLng: 0,
|
||||
locationLat: 0,
|
||||
estimatedPiles: 0,
|
||||
siteStatus: undefined,
|
||||
type: undefined,
|
||||
siteType: undefined,
|
||||
ownerUserId: useUserStore().getUser.id,
|
||||
ownerId: undefined,
|
||||
ownerName: undefined,
|
||||
managementId: undefined,
|
||||
managementName: undefined,
|
||||
recommenderName: undefined,
|
||||
recommenderContact: undefined,
|
||||
planPicUrls: undefined,
|
||||
picUrls: undefined,
|
||||
fileUrls: undefined,
|
||||
picUrls: [], // 修复:初始化为空数组
|
||||
fileUrls: [], // 修复:初始化为空数组
|
||||
parkingSpaces: 0,
|
||||
rentPrice: 0,
|
||||
rentPrice: '',
|
||||
params: {
|
||||
traffic: '',
|
||||
powerDistance: '',
|
||||
barrierGate: '',
|
||||
competitor: ''
|
||||
}
|
||||
},
|
||||
locationName: '',
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
|
||||
/** 初始化 **/
|
||||
const openMapDialog = () => {
|
||||
// 拼接带初始点的 url
|
||||
let url = `https://apis.map.qq.com/tools/locpicker?type=1&key=${TENCENT_MAP_KEY}&referer=myapp`
|
||||
if (formData.value.locationLat && formData.value.locationLng) {
|
||||
url += `&coord=${formData.value.locationLat},${formData.value.locationLng}`
|
||||
}
|
||||
tencentLbsUrl.value = url
|
||||
mapDialogVisible.value = true
|
||||
}
|
||||
|
||||
function selectAddress(loc: any): void {
|
||||
if (loc.poiname) {
|
||||
formData.value.locationName = loc.poiname
|
||||
} else {
|
||||
formData.value.locationName = ''
|
||||
}
|
||||
if (loc.latlng && loc.latlng.lat) {
|
||||
formData.value.locationLat = Number(loc.latlng.lat)
|
||||
formData.value.locationLng = Number(loc.latlng.lng)
|
||||
}
|
||||
mapDialogVisible.value = false
|
||||
}
|
||||
|
||||
const initTencentLbsMap = () => {
|
||||
// @ts-ignore
|
||||
window.selectAddress = selectAddress
|
||||
window.addEventListener(
|
||||
'message',
|
||||
function (event) {
|
||||
let loc = event.data
|
||||
if (loc && loc.module === 'locationPicker') {
|
||||
// @ts-ignore
|
||||
window.selectAddress(loc)
|
||||
}
|
||||
},
|
||||
false
|
||||
)
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
AreaApi.getAreaTree().then(res => {
|
||||
areaList.value = res
|
||||
})
|
||||
initTencentLbsMap()
|
||||
})
|
||||
|
||||
watch(mapDialogVisible, (val) => {
|
||||
if (!val) {
|
||||
tencentLbsUrl.value = '' // 关闭时重置,避免缓存
|
||||
}
|
||||
})
|
||||
|
||||
/** 打开业主方选择弹窗 */
|
||||
const openOwnerDialog = async () => {
|
||||
ownerDialogVisible.value = true
|
||||
const list = await CustomerApi.getCustomerSimpleList()
|
||||
customerList.value = [{ id: '0', name: '无' }, ...list] // 添加空数据
|
||||
}
|
||||
|
||||
/** 打开物管方选择弹窗 */
|
||||
const openManagementDialog = async () => {
|
||||
managementDialogVisible.value = true
|
||||
const list = await CustomerApi.getCustomerSimpleList()
|
||||
customerList.value = [{ id: '0', name: '无' }, ...list] // 添加空数据
|
||||
}
|
||||
|
||||
/** 选择业主方 */
|
||||
const handleOwnerSelect = (val) => {
|
||||
if (!val) return;
|
||||
selectedOwner.value = val
|
||||
formData.value.ownerId = val.id
|
||||
formData.value.ownerName = val.name // 记录业主方名称
|
||||
}
|
||||
|
||||
/** 选择物管方 */
|
||||
const handleManagementSelect = (val) => {
|
||||
if (!val) return;
|
||||
selectedManagement.value = val
|
||||
formData.value.managementId = val.id
|
||||
formData.value.managementName = val.name // 记录物管方名称
|
||||
}
|
||||
|
||||
/** 确认业主方选择 */
|
||||
const confirmOwnerSelection = () => {
|
||||
if (!selectedOwner.value) {
|
||||
message.error('请先选择业主方')
|
||||
return
|
||||
}
|
||||
if (selectedOwner.value.id === '0') {
|
||||
formData.value.ownerId = undefined
|
||||
formData.value.ownerName = undefined
|
||||
ownerFlag.value = false
|
||||
} else {
|
||||
formData.value.ownerId = selectedOwner.value.id
|
||||
formData.value.ownerName = selectedOwner.value.name
|
||||
ownerFlag.value = true
|
||||
}
|
||||
ownerDialogVisible.value = false
|
||||
}
|
||||
|
||||
/** 确认物管方选择 */
|
||||
const confirmManagementSelection = () => {
|
||||
if (!selectedManagement.value) {
|
||||
message.error('请先选择物管方')
|
||||
return
|
||||
}
|
||||
if (selectedManagement.value.id === '0') {
|
||||
formData.value.managementId = undefined
|
||||
formData.value.managementName = undefined
|
||||
managementFlag.value = false
|
||||
} else {
|
||||
formData.value.managementId = selectedManagement.value.id
|
||||
formData.value.managementName = selectedManagement.value.name
|
||||
managementFlag.value = true
|
||||
}
|
||||
managementDialogVisible.value = false
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
<template>
|
||||
<div v-loading="loading">
|
||||
<div class="flex items-start justify-between">
|
||||
<div>
|
||||
<el-col>
|
||||
<el-row>
|
||||
<span class="text-md font-bold">{{ stationSite.name }}</span>
|
||||
</el-row>
|
||||
</el-col>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<ContentWrap class="mt-10px">
|
||||
<el-descriptions :column="3" direction="horizontal" class="mb-10px">
|
||||
<el-descriptions-item label="场地类型:">
|
||||
<dict-tag :type="DICT_TYPE.CRM_STATION_SITE_TYPE" :value="stationSite.siteType ?? ''" />
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="场地状态:">
|
||||
<dict-tag :type="DICT_TYPE.CRM_STATION_SITE_STATUS" :value="stationSite.siteStatus ?? ''" />
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="地址:">
|
||||
{{ stationSite.areaName || '-' }}{{ stationSite.detailAddress }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="可建充电桩数:">
|
||||
{{ stationSite.estimatedPiles ?? '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="业主方:">
|
||||
{{ stationSite.ownerName || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="物管方:">
|
||||
{{ stationSite.managementName || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="推荐人姓名:">
|
||||
{{ stationSite.recommenderName || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="推荐人联系方式:">
|
||||
{{ stationSite.recommenderContact || '-' }}
|
||||
</el-descriptions-item>
|
||||
|
||||
</el-descriptions>
|
||||
</ContentWrap>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { DICT_TYPE } from '@/utils/dict'
|
||||
import { StationSiteVO } from '@/api/crm/stationsite'
|
||||
import { formatDate } from '@/utils/formatTime'
|
||||
|
||||
defineOptions({ name: 'CrmStationSiteDetailsHeader' })
|
||||
defineProps<{
|
||||
stationSite: StationSiteVO // 场地信息
|
||||
loading: boolean // 加载中
|
||||
}>()
|
||||
</script>
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
<template>
|
||||
<StationSiteDetailsHeader :station-site="stationSite" :loading="loading" />
|
||||
<el-col>
|
||||
<el-tabs>
|
||||
<el-tab-pane label="评审记录"> <!-- v-if="checkPermi(['crm:follow-up-record:query'])" -->
|
||||
<FollowUpList :biz-id="stationSite.id" :biz-type="BizTypeEnum.CRM_STATION_SITE" />
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
<!-- <el-tabs>
|
||||
<el-tab-pane label="操作日志">
|
||||
<OperateLogV2 :log-list="logList" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="附件">
|
||||
<div>附件内容</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs> -->
|
||||
</el-col>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { useRoute } from 'vue-router'
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { StationSiteVO, StationSiteApi } from '@/api/crm/stationsite'
|
||||
import StationSiteDetailsHeader from './StationSiteDetailsHeader.vue'
|
||||
import type { OperateLogVO } from '@/api/system/operatelog'
|
||||
import { getOperateLogPage } from '@/api/crm/operateLog'
|
||||
import { BizTypeEnum } from '@/api/crm/permission'
|
||||
import { useTagsViewStore } from '@/store/modules/tagsView'
|
||||
import { checkPermi } from "@/utils/permission"; // 权限判断函数
|
||||
import FollowUpList from '@/views/crm/followup/components/FollowUpList.vue'
|
||||
|
||||
|
||||
const route = useRoute()
|
||||
const stationSiteId = ref<number>()
|
||||
const loading = ref(true)
|
||||
const stationSite = ref<StationSiteVO>({} as StationSiteVO)
|
||||
const message = useMessage() // 消息弹窗
|
||||
const fileUrl = ref() // 文件URL
|
||||
const { delView } = useTagsViewStore() // 视图操作
|
||||
const { push, currentRoute } = useRouter() // 路由
|
||||
|
||||
|
||||
defineOptions({ name: 'CrmStationSiteDetail' })
|
||||
|
||||
/** 获取操作日志 */
|
||||
const logList = ref<OperateLogVO[]>([]) // 操作日志列表
|
||||
const getOperateLog = async () => {
|
||||
if (!stationSiteId.value) {
|
||||
return
|
||||
}
|
||||
const data = await getOperateLogPage({
|
||||
bizType: BizTypeEnum.CRM_CUSTOMER,
|
||||
bizId: stationSiteId.value
|
||||
})
|
||||
logList.value = data.list
|
||||
}
|
||||
|
||||
const getStationSite = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
stationSiteId.value = Number(route.params.id)
|
||||
stationSite.value = await StationSiteApi.getStationSite(stationSiteId.value)
|
||||
await getOperateLog()
|
||||
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const close = () => {
|
||||
delView(unref(currentRoute))
|
||||
push({ name: 'CrmStaionSite' })
|
||||
}
|
||||
|
||||
/** 初始化 */
|
||||
const { params } = useRoute()
|
||||
onMounted(() => {
|
||||
if (!params.id) {
|
||||
message.warning('参数错误,场地信息不能为空!')
|
||||
close()
|
||||
return
|
||||
}
|
||||
stationSiteId.value = Number(params.id)
|
||||
getStationSite()
|
||||
})
|
||||
</script>
|
||||
|
|
@ -70,26 +70,32 @@
|
|||
<!-- 列表 -->
|
||||
<ContentWrap>
|
||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||
<el-table-column label="场地名称" fixed="left" align="center" prop="name" />
|
||||
<el-table-column label="场地名称" fixed="left" align="center" prop="name" width="250px">
|
||||
<template #default="scope">
|
||||
<el-link :underline="false" type="primary" @click="openDetail(scope.row.id)">
|
||||
{{ scope.row.name }}
|
||||
</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="地区" prop="areaId" width="200px" >
|
||||
<template #default="scope">
|
||||
<span>{{ scope.row.areaName || '暂无' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="推荐人" align="center" prop="recommenderName" />
|
||||
<el-table-column label="可建充电桩数" align="center" prop="estimatedPiles" />
|
||||
<el-table-column label="场地类型" align="center" prop="siteType">
|
||||
<el-table-column label="推荐人" align="center" prop="recommenderName" width="150px"/>
|
||||
<el-table-column label="可建充电桩数" align="center" prop="estimatedPiles" width="150px"/>
|
||||
<el-table-column label="场地类型" align="center" prop="siteType" width="150px">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.CRM_STATION_SITE_TYPE" :value="scope.row.siteType" />
|
||||
<dict-tag :type="DICT_TYPE.CRM_STATION_SITE_TYPE" :value="scope.row.siteType" width="150px"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="场地状态" align="center" prop="siteStatus">
|
||||
<el-table-column label="场地状态" align="center" prop="siteStatus">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.CRM_STATION_SITE_STATUS" :value="scope.row.siteStatus" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="填报人" align="center" prop="creatorName" />
|
||||
<el-table-column label="操作" fixed="right" align="center" min-width="180px">
|
||||
<el-table-column label="填报人" align="center" prop="creatorName" width="150px" />
|
||||
<el-table-column label="操作" fixed="right" align="center" min-width="150px">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
link
|
||||
|
|
@ -107,13 +113,13 @@
|
|||
>
|
||||
删除
|
||||
</el-button>
|
||||
<el-button
|
||||
<!-- <el-button
|
||||
link
|
||||
type="success"
|
||||
@click="openMapDialog(scope.row)"
|
||||
>
|
||||
获取经纬度
|
||||
</el-button>
|
||||
查看选点
|
||||
</el-button> -->
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
|
@ -142,6 +148,7 @@ import { StationSiteApi, StationSiteVO } from '@/api/crm/stationsite'
|
|||
import StationSiteForm from './StationSiteForm.vue'
|
||||
import * as AreaApi from '@/api/system/area'
|
||||
import { defaultProps } from '@/utils/tree'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
|
||||
/** 场地信息 列表 */
|
||||
defineOptions({ name: 'CrmStationSite' })
|
||||
|
|
@ -168,6 +175,12 @@ const tencentLbsUrl = ref('')
|
|||
const currentRow = ref<any>(null)
|
||||
const TENCENT_MAP_KEY = import.meta.env.VITE_APP_TENCENT_MAP_KEY // 你的腾讯地图key
|
||||
|
||||
/** 打开场地信息详情 */
|
||||
const { currentRoute, push } = useRouter()
|
||||
const openDetail = (id: number) => {
|
||||
push({ name: 'CrmStationSiteDetail', params: { id } })
|
||||
}
|
||||
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
|
|
@ -245,41 +258,19 @@ watch(mapDialogVisible, (val) => {
|
|||
}
|
||||
})
|
||||
|
||||
// 选择经纬度回填
|
||||
function selectAddress(loc: any): void {
|
||||
if (loc.latlng && loc.latlng.lat) {
|
||||
currentRow.value.locationLat = loc.latlng.lat
|
||||
}
|
||||
if (loc.latlng && loc.latlng.lng) {
|
||||
currentRow.value.locationLng = loc.latlng.lng
|
||||
}
|
||||
mapDialogVisible.value = false
|
||||
// 可选:刷新表格数据
|
||||
getList()
|
||||
}
|
||||
|
||||
// 初始化腾讯地图监听
|
||||
const initTencentLbsMap = () => {
|
||||
// @ts-ignore
|
||||
window.selectAddress = selectAddress
|
||||
window.addEventListener(
|
||||
'message',
|
||||
function (event) {
|
||||
let loc = event.data
|
||||
if (loc && loc.module === 'locationPicker') {
|
||||
// @ts-ignore
|
||||
window.selectAddress(loc)
|
||||
}
|
||||
},
|
||||
false
|
||||
)
|
||||
}
|
||||
/** 监听路由变化更新列表 */
|
||||
watch(
|
||||
() => currentRoute.value,
|
||||
() => {
|
||||
getList()
|
||||
}
|
||||
)
|
||||
|
||||
onMounted(() => {
|
||||
getList()
|
||||
AreaApi.getAreaTree().then(res => {
|
||||
areaList.value = res
|
||||
})
|
||||
initTencentLbsMap()
|
||||
})
|
||||
</script>
|
||||
Loading…
Reference in New Issue