Your Name
2022-05-10 30e36368e54581fcc0c581a004f1f68873c1e819
src/components/Tab/Plot.vue
@@ -79,6 +79,7 @@
</template>
<script>
    import { addMap } from '@/api/fourColorMap'
    import { global } from '../../global';
    // 默认样式
@@ -106,6 +107,35 @@
                },
                showCreatePanel: false,
                showPlot: true,
                form:{
                    id:'',
                    etype:1,
                    "type": "Feature",
                    "properties": {
                    "type": "polygon",
                    "style": { "text": "D号楼", "clampToGround": true },
                    "attr": {
                        "name": "D号楼",
                        "id": "8a65b4df-2450-4dab-958d-fbd182cfd92d"
                    }
                    },
                    "geometry": {
                    "type": "Polygon",
                    "coordinates": [
                        [
                            [120.728524, 31.258178, 0],
                            [120.727911, 31.257992, 0],
                            [120.728024, 31.25772, 0],
                            [120.727986, 31.2577, 0],
                            [120.728039, 31.257535, 0],
                            [120.728759, 31.257714, 0],
                            [120.728524, 31.258178, 0],
                            [120.728524, 31.258178, 0],
                            [120.728524, 31.258178, 0]
                            ]
                        ]
                    }
                },
            };
        },
        computed: {
@@ -149,7 +179,11 @@
                    name: '',
                };
            },
            createHandle() {
            async createHandle() {
                // debugger
                // this.form.geometry = JSON.stringify(this.form.geometry)
                // this.form.properties = JSON.stringify(this.form.properties)
                // let res = await addMap(this.form)
                if (!global.map) return;
                let map = global.map;
                const { id, name } = this.label;
@@ -169,9 +203,34 @@
                                name,
                            },
                        },
                        () => {
                        (entity) => {
                            this._initLabel();
                            this.$store.dispatch('map/updateTimestamp');
                            this.form = {
                                id:'',
                                etype:1,
                                "type": "Feature",
                                "properties":
                                    JSON.stringify(entity.attribute),
                                "geometry": JSON.stringify({
                                "type": "Polygon",
                                "coordinates": [
                                    wutu3d.draw.attr.getCoordinates(entity)
                                    ]
                                })
                            }
                            addMap(this.form).then(res =>{
                                if(res.data.code === '200'){
                                    this.$message({
                                        type:'success',
                                        duration:2000,
                                        title:'成功',
                                        message:'四色图新增成功',
                                    })
                                }
                            })
                        }
                    );
                }