接口对接
This commit is contained in:
parent
224d58c7b1
commit
86fe781cea
@ -279,11 +279,11 @@ const columns = ref([
|
||||
dataIndex: 'zoneName'
|
||||
},
|
||||
{
|
||||
key: 'regionName',
|
||||
key: 'operationRegionName',
|
||||
title: '区域名称',
|
||||
width: 150,
|
||||
align: 'center',
|
||||
dataIndex: 'regionName'
|
||||
dataIndex: 'operationRegionName'
|
||||
},
|
||||
{
|
||||
key: 'simpleName',
|
||||
@ -414,11 +414,11 @@ const search = () => {
|
||||
*/
|
||||
const feeConfigInfo = (record) => {
|
||||
modalFreeKey.value = getGUID();
|
||||
openTitle.value = "费用信息 - " + record['regionName']
|
||||
openTitle.value = "费用信息 - " + record['operationRegionName']
|
||||
open.value = true
|
||||
nextTick(() => {
|
||||
if (formModel.value) {
|
||||
formModel.value.openForm({ regionId: record['regionId'] });
|
||||
formModel.value.openForm({ regionId: record['operationRegionId'] });
|
||||
} else {
|
||||
console.log('formModel is not ready yet');
|
||||
}
|
||||
@ -445,11 +445,11 @@ const handleOkFeeModal = () => {
|
||||
*/
|
||||
const regionConfigInfo = (record) => {
|
||||
modalOperateKey.value = getGUID();
|
||||
openTitleConfig.value = "运营配置 - " + record['regionName']
|
||||
openTitleConfig.value = "运营配置 - " + record['operationRegionName']
|
||||
openConfig.value = true
|
||||
nextTick(() => {
|
||||
if (formModelConfig) {
|
||||
formModelConfig.value.openForm({ regionId: record['regionId'] });
|
||||
formModelConfig.value.openForm({ regionId: record['operationRegionId'] });
|
||||
} else {
|
||||
console.log('formModel is not ready yet');
|
||||
}
|
||||
@ -471,9 +471,9 @@ const handleOkConfgModal = () => {
|
||||
}
|
||||
|
||||
const handleEditORMap = (record) => {
|
||||
openORMapTitle.value = '绘制地图(' + record['regionName'] + ')';
|
||||
openORMapTitle.value = '绘制地图(' + record['operationRegionName'] + ')';
|
||||
const data = {
|
||||
regionId: record['regionId']
|
||||
regionId: record['operationRegionId']
|
||||
}
|
||||
editORMapModel.value.showModal(data);
|
||||
}
|
||||
|
||||
@ -11,10 +11,19 @@
|
||||
:afterClose="handleClose"
|
||||
>
|
||||
<div class="button-panel">
|
||||
<a-button type="primary" @click="onEditorClear">{{ buttonName }}</a-button>
|
||||
<a-button type="primary" @click="onEditorComplete">完成</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
@click="onEditorClear"
|
||||
>{{ buttonName }}</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
@click="onEditorComplete"
|
||||
>完成</a-button>
|
||||
</div>
|
||||
<div class="map-container" style="width: auto; height: auto;">
|
||||
<div
|
||||
class="map-container"
|
||||
style="width: auto; height: auto;"
|
||||
>
|
||||
<tlbs-map
|
||||
ref="mapRef"
|
||||
:api-key="config.map.apiKey"
|
||||
@ -42,11 +51,11 @@
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, defineProps } from 'vue'
|
||||
import { callOperate } from '@/apis/call.js'
|
||||
import { message } from 'ant-design-vue'
|
||||
import { isNullOrEmpty } from '@/utils/tools.js'
|
||||
import config from '@/utils/config.js'
|
||||
const props = defineProps({
|
||||
import { callOperate } from '@/apis/call.js'
|
||||
import { message } from 'ant-design-vue'
|
||||
import { isNullOrEmpty } from '@/utils/tools.js'
|
||||
import config from '@/utils/config.js'
|
||||
const props = defineProps({
|
||||
onCallBack: {
|
||||
type: Function,
|
||||
required: true
|
||||
@ -55,24 +64,24 @@ import { ref, reactive, defineProps } from 'vue'
|
||||
type: String,
|
||||
default: '' // Default value in case no openTitle is provided
|
||||
}
|
||||
});
|
||||
const open = ref(false);
|
||||
const showModal = (data) => {
|
||||
});
|
||||
const open = ref(false);
|
||||
const showModal = (data) => {
|
||||
if (data) {
|
||||
loadMap(data);
|
||||
}
|
||||
open.value = true;
|
||||
};
|
||||
const handleClose = () => {
|
||||
};
|
||||
const handleClose = () => {
|
||||
open.value = false;
|
||||
ClearEditor();
|
||||
if (props.onCallBack) {
|
||||
props.onCallBack(formData.value);
|
||||
}
|
||||
};
|
||||
defineExpose({ showModal });
|
||||
};
|
||||
defineExpose({ showModal });
|
||||
|
||||
const formData = ref({
|
||||
const formData = ref({
|
||||
"regionId": "",
|
||||
"regionName": "",
|
||||
"simpleName": "",
|
||||
@ -80,15 +89,15 @@ import { ref, reactive, defineProps } from 'vue'
|
||||
"points": [],
|
||||
"shapeType": 2, // 1:圆形 2:多边形
|
||||
"radius": 0, // 圆形半径
|
||||
});
|
||||
});
|
||||
|
||||
let timer = null;
|
||||
const loadMap = (dataRegion) => {
|
||||
let timer = null;
|
||||
const loadMap = (dataRegion) => {
|
||||
if (editorRef.value) {
|
||||
clearTimeout(timer);
|
||||
if (dataRegion) {
|
||||
const { regionId } = dataRegion;
|
||||
callOperate("/ebikeRegion/getRegionInfo/" + regionId, {}, "get").then((res) => {
|
||||
callOperate("/ebikeRegion/getOperationById?regionId=" + regionId, {}, "get").then((res) => {
|
||||
if (res.code != 200) {
|
||||
message.error(res.message)
|
||||
return
|
||||
@ -107,23 +116,22 @@ import { ref, reactive, defineProps } from 'vue'
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
timer = setTimeout(() => {
|
||||
loadMap(dataRegion);
|
||||
}, 1000)
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
let shapeId = null;
|
||||
const loadGeometry = () => {
|
||||
let shapeId = null;
|
||||
const loadGeometry = () => {
|
||||
const { points, shapeType, regionId, radius } = formData.value;
|
||||
shapeId = 'polygon' + regionId;
|
||||
if (shapeType == 1) {
|
||||
shapeId = 'circle' + regionId;
|
||||
}
|
||||
if (points) {
|
||||
if(shapeType == 1){
|
||||
if (shapeType == 1) {
|
||||
const circleGeometries = [];//editorRef.value.circle.getGeometries();
|
||||
if (circleGeometries.length > 0) {
|
||||
circleGeometries.forEach((geometry) => {
|
||||
@ -144,11 +152,11 @@ import { ref, reactive, defineProps } from 'vue'
|
||||
//设置视野范围
|
||||
const mycircle = editorRef.value.circle.getGeometryById(shapeId);
|
||||
const boundary = TMap.geometry.computeBoundingRectangle(mycircle.paths);
|
||||
mapRef.value.map.fitBounds(boundary,{
|
||||
mapRef.value.map.fitBounds(boundary, {
|
||||
padding: 100, // 设置地图边界的内边距
|
||||
});
|
||||
}
|
||||
else if(shapeType == 2){
|
||||
else if (shapeType == 2) {
|
||||
const paths = [];
|
||||
points.forEach((point) => {
|
||||
paths.push(new TMap.LatLng(point.latitude, point.longitude));
|
||||
@ -169,7 +177,7 @@ import { ref, reactive, defineProps } from 'vue'
|
||||
//设置视野范围
|
||||
const mypolygon = editorRef.value.polygon.getGeometryById(shapeId);
|
||||
const boundary = TMap.geometry.computeBoundingRectangle(mypolygon.paths);
|
||||
mapRef.value.map.fitBounds(boundary,{
|
||||
mapRef.value.map.fitBounds(boundary, {
|
||||
padding: 100, // 设置地图边界的内边距
|
||||
});
|
||||
}
|
||||
@ -177,14 +185,14 @@ import { ref, reactive, defineProps } from 'vue'
|
||||
editorRef.value.editor.setActionMode(TMap.tools.constants.EDITOR_ACTION.INTERACT);
|
||||
editorRef.value.editor.select([shapeId]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const mapRef = ref(null);
|
||||
const center = ref( config.map.center );
|
||||
const control = ref({ scale: {}, zoom: { position: 'topRight',},});
|
||||
const options = ref({ renderOptions: { renderOptions: true, }});
|
||||
const editorRef = ref(null);
|
||||
const onMapInited = () => {
|
||||
const mapRef = ref(null);
|
||||
const center = ref(config.map.center);
|
||||
const control = ref({ scale: {}, zoom: { position: 'topRight', }, });
|
||||
const options = ref({ renderOptions: { renderOptions: true, } });
|
||||
const editorRef = ref(null);
|
||||
const onMapInited = () => {
|
||||
if (mapRef.value) {
|
||||
const windowWidth = window.innerWidth;
|
||||
const windowHeight = window.innerHeight;
|
||||
@ -196,53 +204,52 @@ import { ref, reactive, defineProps } from 'vue'
|
||||
map.resize(calculatedWidth, calculatedHeight);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
const buttonName = ref('清除');
|
||||
const onDrowComplet = (geomeytry) => {
|
||||
const buttonName = ref('清除');
|
||||
const onDrowComplet = (geomeytry) => {
|
||||
//console.log("onDrowComplet",geomeytry);
|
||||
if(geomeytry.id){
|
||||
if (geomeytry.id) {
|
||||
editorRef.value.editor.setActionMode(TMap.tools.constants.EDITOR_ACTION.INTERACT);
|
||||
editorRef.value.editor.select([geomeytry.id]);
|
||||
}
|
||||
};
|
||||
const onDrawError = (e) => {
|
||||
};
|
||||
const onDrawError = (e) => {
|
||||
ClearEditor();
|
||||
editorRef.value.editor.stop();
|
||||
};
|
||||
};
|
||||
|
||||
const onAdjustComplete = (geomeytry) => {
|
||||
const onAdjustComplete = (geomeytry) => {
|
||||
//console.log("onAdjustComplete",geomeytry);
|
||||
};
|
||||
const onAdjustError = (e) => {
|
||||
};
|
||||
const onAdjustError = (e) => {
|
||||
ClearEditor();
|
||||
loadGeometry();
|
||||
};
|
||||
};
|
||||
|
||||
const onEditorClear = () => {
|
||||
if(!isNullOrEmpty(shapeId)){
|
||||
const onEditorClear = () => {
|
||||
if (!isNullOrEmpty(shapeId)) {
|
||||
loadGeometry();
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
ClearEditor();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const ClearEditor = () => {
|
||||
const ClearEditor = () => {
|
||||
editorRef.value.editor.select([]);
|
||||
editorRef.value.editor.setActionMode(TMap.tools.constants.EDITOR_ACTION.DRAW);
|
||||
editorRef.value.circle.setGeometries([]);
|
||||
editorRef.value.polygon.setGeometries([]);
|
||||
}
|
||||
}
|
||||
|
||||
const onEditorComplete = () => {
|
||||
if(editorRef.value.editor.getSelectedList().length > 0){
|
||||
const onEditorComplete = () => {
|
||||
if (editorRef.value.editor.getSelectedList().length > 0) {
|
||||
const selectedList = editorRef.value.editor.getSelectedList();
|
||||
const geometry = selectedList[0];
|
||||
console.log("onEditorComplete",geometry);
|
||||
if(geometry.id){
|
||||
if(geometry.radius && geometry.center){
|
||||
console.log("onEditorComplete", geometry);
|
||||
if (geometry.id) {
|
||||
if (geometry.radius && geometry.center) {
|
||||
formData.value.radius = geometry.radius;
|
||||
formData.value.points = [
|
||||
{
|
||||
@ -252,7 +259,7 @@ import { ref, reactive, defineProps } from 'vue'
|
||||
];
|
||||
formData.value.shapeType = 1;
|
||||
}
|
||||
else if(geometry.paths){
|
||||
else if (geometry.paths) {
|
||||
formData.value.radius = 0;
|
||||
formData.value.points = geometry.paths.map((point) => {
|
||||
return {
|
||||
@ -266,7 +273,8 @@ import { ref, reactive, defineProps } from 'vue'
|
||||
});
|
||||
formData.value.shapeType = 2;
|
||||
}
|
||||
if(!isNullOrEmpty(formData.value.regionId)){
|
||||
debugger
|
||||
if (!isNullOrEmpty(formData.value.regionId)) {
|
||||
callOperate("/ebikeRegion/updateOperation", formData.value, "post").then((res) => {
|
||||
if (res.code == 200) {
|
||||
message.success(res.message, 3, handleClose);
|
||||
@ -275,36 +283,33 @@ import { ref, reactive, defineProps } from 'vue'
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
handleClose();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
message.error("请先绘制区域!")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const onDeleteComplete = (geomeytry) => {
|
||||
if(editorRef.value.polygon.getGeometries().length > 0){
|
||||
const onDeleteComplete = (geomeytry) => {
|
||||
if (editorRef.value.polygon.getGeometries().length > 0) {
|
||||
const shapeId = editorRef.value.polygon.getGeometries()[0].id;
|
||||
editorRef.value.editor.setActionMode(TMap.tools.constants.EDITOR_ACTION.INTERACT);
|
||||
editorRef.value.editor.select([shapeId]);
|
||||
}
|
||||
else if(editorRef.value.circle.getGeometries().length > 0){
|
||||
else if (editorRef.value.circle.getGeometries().length > 0) {
|
||||
const shapeId = editorRef.value.circle.getGeometries()[0].id;
|
||||
editorRef.value.editor.setActionMode(TMap.tools.constants.EDITOR_ACTION.INTERACT);
|
||||
editorRef.value.editor.select([shapeId]);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
editorRef.value.editor.setActionMode(TMap.tools.constants.EDITOR_ACTION.DRAW);
|
||||
// editorRef.value.circle.setGeometries([]);
|
||||
// editorRef.value.polygon.setGeometries([]);
|
||||
}
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
@ -318,13 +323,13 @@ import { ref, reactive, defineProps } from 'vue'
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: calc(100vh);
|
||||
border-radius:0 !important;
|
||||
border-radius: 0 !important;
|
||||
}
|
||||
.full-modal .ant-modal-body {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.button-panel{
|
||||
.button-panel {
|
||||
position: absolute;
|
||||
bottom: 55px;
|
||||
right: 35px;
|
||||
@ -334,7 +339,7 @@ import { ref, reactive, defineProps } from 'vue'
|
||||
background-color: rgb(255, 255, 255, 0.8);
|
||||
padding: 15px;
|
||||
}
|
||||
.button-panel button{
|
||||
.button-panel button {
|
||||
width: 100%;
|
||||
border-radius: 0px !important;
|
||||
margin-bottom: 10px;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user