1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
| <template>
| <el-dialog class="airspace-dialog" :title="props.title" v-model="dialogShow" width="60%" align-center
| @close="handleClose" :close-on-click-modal="false" :close-on-press-escape="false">
| <div class="custom-container">
| <div class="form-container">
| <avue-form ref="formEle" :option="option" v-model="form"></avue-form>
| </div>
| <div class="map-container">
| <div id="AirspaceMap" class="ztzf-cesium"></div>
| </div>
| </div>
| </el-dialog>
| </template>
|
| <script setup>
| import * as Cesium from 'cesium'
| import { PublicCesium } from '@/utils/cesium/publicCesium'
|
| const props = defineProps({
| title: {
| type: String,
| default: '新增空域',
| },
| })
|
| const dialogShow = defineModel('show')
|
| const formEle = ref(null)
| const form = ref({})
| const option = ref({
| submitBtn: false,
| emptyBtn: false,
| column: [
| {
| label: '名称',
| prop: 'input',
| type: 'input',
| rules: [
| {
| required: true,
| message: '请输入名称',
| trigger: 'blur'
| }
| ]
| },
|
| {
| label: '高度',
| prop: 'input',
| type: 'input',
| rules: [
| {
| required: true,
| message: '请输入高度',
| trigger: 'blur'
| }
| ]
| },
|
| {
| label: '类型',
| prop: 'select',
| type: 'select',
| dicData: [
| {
| label: '字典1',
| value: 0,
| },
| {
| label: '字典2',
| value: 1,
| },
| ],
| rules: [
| {
| required: true,
| message: '请选择类型',
| trigger: 'blur'
| }
| ]
| },
| {
| label: '管控时段',
| prop: 'daterange',
| type: 'daterange',
| format: 'YYYY-MM-DD',
| valueFormat: 'YYYY-MM-DD',
| startPlaceholder: '开始日期',
| endPlaceholder: '结束日期',
| rules: [
| {
| required: true,
| message: '请选择管控时段',
| trigger: 'blur'
| }
| ]
| },
|
| {
| label: '备注',
| prop: 'input',
| type: 'textarea',
| span: 24,
| rows: 1,
| minRows: 1,
| maxRows: 1,
| placeholder: '请输入备注',
| },
| ],
| })
|
| let publicCesiumInstance = null
| let viewer = null
| // 地图
| const initMap = () => {
| if (!document.getElementById('AirspaceMap')) {
| return
| }
| publicCesiumInstance = new PublicCesium({
| dom: 'AirspaceMap',
| flatMode: false,
| terrain: true,
| layerMode: 4,
| contour: false,
| })
| viewer = publicCesiumInstance.getViewer()
| }
|
| watch(dialogShow, async (show) => {
| if (show) {
| await nextTick()
| initMap()
| }
| })
|
| const handleClose = () => {
| publicCesiumInstance?.viewerDestroy()
| publicCesiumInstance = null
| viewer = null
| form.value = {}
| formEle.value.resetForm()
| dialogShow.value = false
| }
| </script>
|
| <style scoped lang="scss">
| .custom-container {
| .map-container {
| height: 440px;
|
| #AirspaceMap {
| width: 100%;
| height: 100%;
| }
| }
| }
| </style>
|
|