修复map.value.clearMa报错)

master
doublekou 11 months ago
parent 68458ec359
commit 5e995f71cd

@ -11,10 +11,8 @@
:width="850" :width="850"
@cancel="handleClose" @cancel="handleClose"
> >
<a-tabs <a-tabs
v-if=" v-if="title === '新建预约'"
title === '新建预约'
"
v-model:activeKey="activeKey" v-model:activeKey="activeKey"
centered centered
@change="tabsChange" @change="tabsChange"
@ -22,14 +20,8 @@
<a-tab-pane key="1" tab="A类型客户"> </a-tab-pane> <a-tab-pane key="1" tab="A类型客户"> </a-tab-pane>
<a-tab-pane key="2" tab="B类型客户" force-render> </a-tab-pane> <a-tab-pane key="2" tab="B类型客户" force-render> </a-tab-pane>
</a-tabs> </a-tabs>
<a-tabs
v-else-if=" <a-tabs v-else v-model:activeKey="activeKey" centered>
title !== '新建预约'
"
v-model:activeKey="activeKey"
centered
@change="tabsChange"
>
<a-tab-pane v-if="formModel.customType === 0" key="1" tab="A类型客户"> </a-tab-pane> <a-tab-pane v-if="formModel.customType === 0" key="1" tab="A类型客户"> </a-tab-pane>
<a-tab-pane v-if="formModel.customType === 1" key="2" tab="B类型客户" force-render> <a-tab-pane v-if="formModel.customType === 1" key="2" tab="B类型客户" force-render>
</a-tab-pane> </a-tab-pane>
@ -430,8 +422,12 @@
</p> </p>
</div> </div>
</a-modal> </a-modal>
<!-- 匹配信息确认弹窗 --> <!-- 匹配信息确认弹窗 -->
<a-modal v-model:visible="matchregisterVisible" title="确认信息" @ok="matchhandleOk"> <a-modal
v-model:visible="matchregisterVisible"
title="确认信息"
@ok="matchhandleOk(formModel.detailAddress)"
>
<p>重新匹配将清空预约门店信息,是否重新匹配?</p> <p>重新匹配将清空预约门店信息,是否重新匹配?</p>
</a-modal> </a-modal>
</a-modal> </a-modal>
@ -473,7 +469,13 @@ const userInfoCurrent = ref<string | undefined>('')
// required: true, // required: true,
// trigger: 'change' // trigger: 'change'
// } // }
// watch(
// () => activeKey.value,
// (newVal, oldVal) => {
// console.log('newVal, oldVal', newVal, oldVal)
// },
// { immediate: true, deep: true }
// )
onMounted(() => { onMounted(() => {
// //
provincesAndCitiesAndAutonomousOptions.value = window.globalProvincesAndCitiesAndAutonomousRegions provincesAndCitiesAndAutonomousOptions.value = window.globalProvincesAndCitiesAndAutonomousRegions
@ -496,7 +498,7 @@ onMounted(() => {
}) })
// tab key // tab key
const activeKey = ref('1') const activeKey = ref('')
//tabs change //tabs change
const tabsChange = (val: string) => { const tabsChange = (val: string) => {
handleMapInit() handleMapInit()
@ -530,7 +532,6 @@ const reservationTimeClass = computed(() => ({
/// ///
const isDetailAddressDisabled = ref(false) const isDetailAddressDisabled = ref(false)
const isDetailAddressReadOnly = ref(false) const isDetailAddressReadOnly = ref(false)
const detailAddressReadOnlyDynamicClass = computed(() => ({ const detailAddressReadOnlyDynamicClass = computed(() => ({
'custom-disabled-style': isDetailAddressDisabled.value, 'custom-disabled-style': isDetailAddressDisabled.value,
'custom-readonly-style': 'custom-readonly-style':
@ -555,7 +556,6 @@ const addressChange = async (value: any) => {
formModel.economize = value[0] formModel.economize = value[0]
formModel.market = value[1] formModel.market = value[1]
formModel.distinguish = value[2] formModel.distinguish = value[2]
// console.log(value.length, 'value.length')
// if (value.length === 2) { // if (value.length === 2) {
// formModel.detailAddress = value[0] + value[1] // formModel.detailAddress = value[0] + value[1]
// } else if (value.length === 3) { // } else if (value.length === 3) {
@ -733,7 +733,6 @@ const accordingAddressGetCenter = () => {
// //
const getLocation = (type: string) => { const getLocation = (type: string) => {
// console.log(address, 'address')
const addressValue = const addressValue =
// //
formModel.address?.toString().split(',').join('') + formModel.detailAddress formModel.address?.toString().split(',').join('') + formModel.detailAddress
@ -744,7 +743,6 @@ const getLocation = (type: string) => {
lng.value = result.geocodes[0].location.lng lng.value = result.geocodes[0].location.lng
lat.value = result.geocodes[0].location.lat lat.value = result.geocodes[0].location.lat
formModel.otherAddressesInfo = `${lng.value},${lat.value}` formModel.otherAddressesInfo = `${lng.value},${lat.value}`
console.log(lng.value, lat.value, 'lng.value')
// //
map.value.setCenter([lng.value, lat.value]) // map.value.setCenter([lng.value, lat.value]) //
if (type === 'match') { if (type === 'match') {
@ -779,7 +777,6 @@ const getLocation = (type: string) => {
// //
const getCenterMarker = (type: string, lng: number, lat: number) => { const getCenterMarker = (type: string, lng: number, lat: number) => {
formModel.otherAddressesInfo = `${lng},${lat}` formModel.otherAddressesInfo = `${lng},${lat}`
console.log(lng, lat, 'lng')
// //
map.value.setCenter([lng, lat]) // map.value.setCenter([lng, lat]) //
if (type === 'match' || type === 'select') { if (type === 'match' || type === 'select') {
@ -822,7 +819,6 @@ const getCenterMarkerAddress = () => {
// //
const pois = result.poiList.pois const pois = result.poiList.pois
console.log(pois, 'pois') console.log(pois, 'pois')
console.log(formModel.detailAddress, 'formModel.detailAddress匹配')
// //
if (pois[0].name.includes('小区')) { if (pois[0].name.includes('小区')) {
const result = pois[0].name.replace('小区', '') const result = pois[0].name.replace('小区', '')
@ -999,11 +995,6 @@ const pagingQuery = (lng: number | undefined, lat: number | undefined) => {
const accordingStorenameMatch = (pois: any) => { const accordingStorenameMatch = (pois: any) => {
isName.value = false isName.value = false
getCenterMarker('match', pois[0].location.lng, pois[0].location.lat) getCenterMarker('match', pois[0].location.lng, pois[0].location.lat)
console.log(
pois[0].location.lng,
pois[0].location.lat,
'pois[0].location.lng, pois[0].location.lat'
)
} }
// //
const accordingAddressMatch = () => { const accordingAddressMatch = () => {
@ -1016,7 +1007,9 @@ const idThen = (detailAddress: string) => {
listData.value = [] listData.value = []
lng.value = undefined lng.value = undefined
lat.value = undefined lat.value = undefined
// if (map.value && typeof map.value.clearMap === 'function') {
map.value.clearMap() map.value.clearMap()
// }
// city.value = formModel.market?.slice(0, -1) // city.value = formModel.market?.slice(0, -1)
// //
@ -1111,39 +1104,45 @@ const idThen = (detailAddress: string) => {
// //
const match = async (detailAddress: string) => { const match = async (detailAddress: string) => {
// console.log(listData.length,'listData.length') // console.log(listData.length,'listData.length')
console.log(title.value,'title.value') console.log(title.value, 'title.value')
if (activeKey.value === '1') { if (activeKey.value === '1') {
if(title.value==='新建预约'&&formModel.customStoreEntities.length!==0){ if (title.value === '新建预约' && formModel.customStoreEntities.length !== 0) {
matchregisterVisible.value=true matchregisterVisible.value = true
}else{ } else {
const fields = ['address', 'detailAddress', 'radius'] // const fields = ['address', 'detailAddress', 'radius'] //
formRef.value formRef.value
?.validateFields(fields) ?.validateFields(fields)
.then(() => { .then(() => {
idThen(detailAddress) idThen(detailAddress)
}) })
.catch(() => { .catch(() => {
// //
console.log('校验失败') console.log('校验失败')
}) })
} }
} else { } else {
if(title.value==='新建预约'&&formModel.customStoreEntities.length!==0){ if (title.value === '新建预约' && formModel.customStoreEntities.length !== 0) {
matchregisterVisible.value=true matchregisterVisible.value = true
}else{ } else {
if (formModel.address && formModel.address.length === 0) { if (formModel.address && formModel.address.length === 0) {
message.info('请输入您的地址信息') return message.info('请输入您的地址信息')
} if (!formModel.detailAddress) { }
message.info('请输入您的详细地址信息') if (!formModel.detailAddress) {
} if(!formModel.radius){ return message.info('请输入您的详细地址信息')
message.info('请选择区域半径') }
} if (!formModel.radius) {
if(formModel.address && formModel.address.length>0&&formModel.detailAddress&&formModel.radius){ return message.info('请选择区域半径')
idThen(detailAddress) }
if (
formModel.address &&
formModel.address.length > 0 &&
formModel.detailAddress &&
formModel.radius
) {
idThen(detailAddress)
}
} }
} }
}
} }
// //
const resetForm = () => { const resetForm = () => {
@ -1282,26 +1281,26 @@ const handleOk = async () => {
await submitOperate() await submitOperate()
} }
// //
const matchhandleOk = async () => { const matchhandleOk = async (detailAddress: string) => {
matchregisterVisible.value=false matchregisterVisible.value = false
listData.value.forEach((item:any)=>{ listData.value.forEach((item: any) => {
item.disabled=false item.disabled = false
}) })
if (infoWindows.value) { if (infoWindows.value) {
infoWindows.value.close(); // infoWindows.value.close() //
} }
formModel.customStoreEntities=[] formModel.customStoreEntities = []
// listData.value=[] // listData.value=[]
const fields = ['address', 'detailAddress', 'radius'] // const fields = ['address', 'detailAddress', 'radius'] //
formRef.value formRef.value
?.validateFields(fields) ?.validateFields(fields)
.then(() => { .then(() => {
idThen(detailAddress) idThen(detailAddress)
}) })
.catch(() => { .catch(() => {
// //
console.log('校验失败') console.log('校验失败')
}) })
// await submitOperate() // await submitOperate()
} }
// //
@ -1413,9 +1412,9 @@ const handleSubmit = () => {
// //
const handleClose = () => { const handleClose = () => {
activeKey.value = '1' // activeKey.value = '1'
/// ///
isAddressDisabled.value = isAddressDisabled.value =
isAddressReadOnly.value = isAddressReadOnly.value =
isDetailAddressDisabled.value = isDetailAddressDisabled.value =
isDetailAddressReadOnly.value = isDetailAddressReadOnly.value =
@ -1445,22 +1444,28 @@ interface openObj {
type?: string type?: string
record?: GeopoliticalCustomersRecord record?: GeopoliticalCustomersRecord
} }
const handleMapInit = () => { const handleMapInit = async () => {
nextTick(() => { await nextTick(async () => {
initMap() await initMap()
}) })
} }
defineExpose({ defineExpose({
open(opendata: openObj) { open(opendata: openObj) {
console.log(activeKey.value, 'activeKey.value')
isSubmit.value = false isSubmit.value = false
openModal() openModal()
resetFields.value() console.log('formModel.customType resssssssss', formModel.customType)
if (userInfoCurrent.value === 'ROLE_REVIEWER') { //resetFields.value(),resetFields.value()formModel.customType0
formModel.customType = 1 // resetFields.value()
} else if (userInfoCurrent.value === 'ROLE_PRELIMINARY_EXAMINER') { // formModel.customType = undefined
formModel.customType = 0 formModel.customStoreEntities = []
} console.log('formModel.customType ddddddddddd', formModel.customType)
// if (userInfoCurrent.value === 'ROLE_REVIEWER') {
// formModel.customType = 1
// } else if (userInfoCurrent.value === 'ROLE_PRELIMINARY_EXAMINER') {
// formModel.customType = 0
// }
const handleSuccess = (res: any) => { const handleSuccess = (res: any) => {
const data = res.data || {} const data = res.data || {}
@ -1494,6 +1499,7 @@ defineExpose({
formModel.distinguish = distinguish formModel.distinguish = distinguish
formModel.detailAddress = detailAddress formModel.detailAddress = detailAddress
formModel.customType = customType formModel.customType = customType
console.log(formModel.customType, '111')
formModel.otherAddressesInfo = otherAddressesInfo formModel.otherAddressesInfo = otherAddressesInfo
formModel.radius = radius formModel.radius = radius
@ -1502,77 +1508,86 @@ defineExpose({
formModel.customStoreEntities.forEach((i: any) => { formModel.customStoreEntities.forEach((i: any) => {
i.option = generateTimeSlots(i.tradeStartTime, i.tradeEndTime) i.option = generateTimeSlots(i.tradeStartTime, i.tradeEndTime)
}) })
const getActiveKey = () => {
if (formModel.customType === 0) {
activeKey.value = '1'
} else {
activeKey.value = '2'
}
}
if (opendata.type === 'audit') { if (opendata.type === 'audit') {
handleMapInit() getActiveKey()
// handleMapInit()
title.value = '编辑' title.value = '编辑'
// activeKey.value=formModel.customType // activeKey.value=formModel.customType
if (formModel.address.length !== 0) { if (formModel.address.length !== 0) {
isAddressDisabled.value = true isAddressDisabled.value = true
// isRadiusReadOnly.value = true // isRadiusReadOnly.value = true
} }
if (formModel.radius) { if (formModel.radius) {
isRadiusDisabled.value = true isRadiusDisabled.value = true
} }
if (formModel.detailAddress) { if (formModel.detailAddress) {
isDetailAddressDisabled.value = true isDetailAddressDisabled.value = true
} }
if (formModel.address.length !== 0 && formModel.detailAddress && formModel.radius) { if (formModel.address.length !== 0 && formModel.detailAddress && formModel.radius) {
match(formModel.detailAddress) handleMapInit().then(() => {
match(formModel.detailAddress)
})
} }
} else if (opendata.type === 'edit') { } else if (opendata.type === 'edit') {
handleMapInit() getActiveKey()
title.value = '编辑预约' title.value = '编辑预约'
// if(formModel.customType===0){
// activeKey.value='1'
// }else if(formModel.customType===1){
// activeKey.value='2'
// }
if (formModel.address.length !== 0) { if (formModel.address.length !== 0) {
isAddressDisabled.value = true isAddressDisabled.value = true
// isRadiusDisabled.value = true
// isRadiusReadOnly.value = true
// match(formModel.detailAddress)
} }
if (formModel.radius) { if (formModel.radius) {
isRadiusDisabled.value = true isRadiusDisabled.value = true
} }
if (formModel.detailAddress) { if (formModel.detailAddress) {
isDetailAddressDisabled.value = true isDetailAddressDisabled.value = true
} }
if (formModel.address.length !== 0 && formModel.detailAddress && formModel.radius) { if (formModel.address.length !== 0 && formModel.detailAddress && formModel.radius) {
match(formModel.detailAddress) handleMapInit().then(() => {
match(formModel.detailAddress)
})
}
} else if (opendata.type === 'view') {
if (formModel.customType === 0) {
activeKey.value = '1'
} else {
activeKey.value = '2'
} }
}
}
if (opendata.newFormAction === FormAction.CREATE) {
handleMapInit()
title.value = '新建预约'
formModel.customStoreEntities.length = 0
} else if (opendata.newFormAction === FormAction.UPDATE) {
doRequest(getDetail({ id: opendata.record?.customId }), {
onSuccess: handleSuccess
})
if (opendata.type === 'view') {
title.value = '详情' title.value = '详情'
console.log(formModel.customType, 'formModel.customTypeA')
isAddressReadOnly.value = true isAddressReadOnly.value = true
isRadiusReadOnly.value = true isRadiusReadOnly.value = true
isDetailAddressReadOnly.value = true isDetailAddressReadOnly.value = true
isReservationTimeisReadOnly.value = true isReservationTimeisReadOnly.value = true
} else if (opendata.type === 'distribute') { } else if (opendata.type === 'distribute') {
getActiveKey()
title.value = '分发' title.value = '分发'
isAddressReadOnly.value = true isAddressReadOnly.value = true
isRadiusReadOnly.value = true isRadiusReadOnly.value = true
isDetailAddressReadOnly.value = true isDetailAddressReadOnly.value = true
isReservationTimeisReadOnly.value = true isReservationTimeisReadOnly.value = true
// handleMapInit() // handleMapInit()
formModel.description = 1 formModel.description = 1
} }
} }
if (opendata.newFormAction === FormAction.CREATE) {
activeKey.value = '1'
handleMapInit()
title.value = '新建预约'
formModel.customStoreEntities.length = 0
} else if (opendata.newFormAction === FormAction.UPDATE) {
doRequest(getDetail({ id: opendata.record?.customId }), {
onSuccess: handleSuccess
})
}
formAction.value = opendata.newFormAction formAction.value = opendata.newFormAction
} }
}) })
@ -1775,7 +1790,7 @@ const initMap = async () => {
// center: [120.1551, 30.2741], // // center: [120.1551, 30.2741], //
zoom: 18 // zoom: 18 //
}) })
console.log(map.value, 'map.value') console.log(map.value, 'initMap map.value')
// await auto('') // await auto('')
if ( if (
(title.value === '编辑预约' && formModel.otherAddressesInfo) || (title.value === '编辑预约' && formModel.otherAddressesInfo) ||

@ -259,9 +259,7 @@ const uploadAvatarProcessor = (fileObj: FileObject, record: SysUserPageVO) => {
return res return res
}) })
} }
// const chargingStatus = ref()
const switchChange = (record: any) => { const switchChange = (record: any) => {
console.log(record, 'record')
if (record.chargingStatus === 1) { if (record.chargingStatus === 1) {
record.chargingStatus = 0 record.chargingStatus = 0
} else { } else {
@ -277,12 +275,7 @@ const switchChange = (record: any) => {
}) })
), ),
{ {
onSuccess: (res: any) => { onSuccess: (res: any) => {}
if (res.code === 200) {
// message.success('')
// reloadTable()
}
}
} }
) )
} }

@ -22,13 +22,13 @@ import { antdvStyleDeps } from './src/utils/resolvers'
//项目 //项目
// export const serverAddress = 'http://admin.ballcat.cn' // export const serverAddress = 'http://admin.ballcat.cn'
//xy //xy
export const serverAddress = 'http://172.18.0.225:8000' // export const serverAddress = 'http://172.18.0.225:8000'
//jt //jt
// export const serverAddress = 'http://172.18.1.8:8000' // export const serverAddress = 'http://172.18.1.8:8000'
//ts //ts
// export const serverAddress = 'http://172.18.0.228:8000' // export const serverAddress = 'http://172.18.0.228:8000'
//测试 //测试
// export const serverAddress = 'http://39.100.77.21:8000' export const serverAddress = 'http://39.100.77.21:8000'
//线上ip //线上ip
// export const serverAddress = 'http://175.27.212.74:80' // export const serverAddress = 'http://175.27.212.74:80'

Loading…
Cancel
Save