@mapgis/mapgis-pan-spatial-map-widgets-config-ui 16.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/.browserslistrc +3 -0
  2. package/.env.production +5 -0
  3. package/.eslintignore +5 -0
  4. package/.eslintrc.js +18 -0
  5. package/README.md +24 -0
  6. package/babel.config.js +5 -0
  7. package/dist-libs/demo.html +10 -0
  8. package/dist-libs/fonts/ionicons.99ac3308.woff +0 -0
  9. package/dist-libs/fonts/ionicons.d535a25a.ttf +0 -0
  10. package/dist-libs/img/iconfont.573255ce.svg +36 -0
  11. package/dist-libs/img/image-icon.dd06d30b.dd06d30b.png +0 -0
  12. package/dist-libs/img/ionicons.17bf2ac0.svg +870 -0
  13. package/dist-libs/img/jsoneditor-icons.2b9b4872.2b9b4872.svg +749 -0
  14. package/dist-libs/img/plus.bdc6b5b1.bdc6b5b1.svg +1 -0
  15. package/dist-libs/img/text-icon.dd1b3d87.dd1b3d87.png +0 -0
  16. package/dist-libs/img/video-icon.499ddeb4.499ddeb4.png +0 -0
  17. package/dist-libs/mapgis-pan-spatial-map-widgets-config-ui.common.js +33467 -0
  18. package/dist-libs/mapgis-pan-spatial-map-widgets-config-ui.css +6 -0
  19. package/dist-libs/mapgis-pan-spatial-map-widgets-config-ui.umd.js +33477 -0
  20. package/dist-libs/mapgis-pan-spatial-map-widgets-config-ui.umd.min.js +1183 -0
  21. package/docs/.vuepress/config.js +81 -0
  22. package/docs/.vuepress/public/favicon.ico +0 -0
  23. package/docs/.vuepress/public/logo.svg +7 -0
  24. package/docs/.vuepress/styles/palette.styl +1 -0
  25. package/docs/README.md +35 -0
  26. package/docs/api/common/MultiImgWithForm.md +87 -0
  27. package/docs/api/common/MultiTypeForm.md +113 -0
  28. package/docs/api/images/basemapConfigUI.png +0 -0
  29. package/docs/api/images/comprehensiveQueryConfigUI.png +0 -0
  30. package/docs/guide/README.md +42 -0
  31. package/docs/guide/publish.md +84 -0
  32. package/docs/guide/yarn/mapgis.png +0 -0
  33. package/docs/guide/yarn/use_mapgis.png +0 -0
  34. package/package.json +58 -0
  35. package/postcss.config.js +5 -0
  36. package/public/favicon.ico +0 -0
  37. package/public/index.html +17 -0
  38. package/src/api/app/config.js +10 -0
  39. package/src/assets/iviewIcon/fonts/ionicons.svg +870 -0
  40. package/src/assets/iviewIcon/fonts/ionicons.ttf +0 -0
  41. package/src/assets/iviewIcon/fonts/ionicons.woff +0 -0
  42. package/src/assets/iviewIcon/iview.css +3461 -0
  43. package/src/assets/logo.png +0 -0
  44. package/src/components/BasemapManagerSetting/BasemapManagerSetting.vue +461 -0
  45. package/src/components/CityGrowSetting/CityGrowSetting.vue +145 -0
  46. package/src/components/CityGrowSetting/EditableCell.vue +103 -0
  47. package/src/components/CommonComponents/MultiImgWithForm/MultiImgWithForm.scss +106 -0
  48. package/src/components/CommonComponents/MultiImgWithForm/MultiImgWithForm.vue +128 -0
  49. package/src/components/CommonComponents/MultiTypeForm/MultiTypeForm.vue +78 -0
  50. package/src/components/CommonComponents/ServiceSelect/index.vue +325 -0
  51. package/src/components/ComprehensiveQuerySetting/ComprehensiveQuerySetting.vue +745 -0
  52. package/src/components/ComprehensiveQuerySetting/EditAttrs.vue +254 -0
  53. package/src/components/DataCatalogSetting/DataCatalogSetting.vue +71 -0
  54. package/src/components/DataCatalogSetting/components/DataSetting.vue +126 -0
  55. package/src/components/DataCatalogSetting/components/IconSetting.vue +160 -0
  56. package/src/components/DataCatalogSetting/components/NoSpatialSetting.vue +37 -0
  57. package/src/components/DataCatalogSetting/components/OtherSetting.vue +54 -0
  58. package/src/components/DataCatalogSetting/components/ParamSetting.vue +95 -0
  59. package/src/components/DataCatalogSetting/components/component/DataSourceSetting.vue +929 -0
  60. package/src/components/DataCatalogSetting/components/component/NodeDataSetting.vue +644 -0
  61. package/src/components/DataCatalogSetting/components/component/ServiceSelectWithData.vue +413 -0
  62. package/src/components/DataCatalogSetting/index.js +29 -0
  63. package/src/components/FeatureQuerySetting/FeatureQuerySetting.vue +121 -0
  64. package/src/components/KibanaVSetting/KibanaVSetting.vue +152 -0
  65. package/src/components/LegendSetting/LegendSetting.vue +85 -0
  66. package/src/components/MapDataVSetting/MapDataVSetting.vue +41 -0
  67. package/src/components/OverlayManagerSetting/OverlayManagerSetting.vue +248 -0
  68. package/src/components/ParticleEffectsSetting/ParticleEffectsSetting.vue +166 -0
  69. package/src/components/PlotManagerSetting/EditableCell.vue +103 -0
  70. package/src/components/PlotManagerSetting/PlotManagerSetting.vue +229 -0
  71. package/src/components/ThematicMapSetting/BaseConfigSetting.vue +76 -0
  72. package/src/components/ThematicMapSetting/SubjectConfigSetting.vue +346 -0
  73. package/src/components/ThematicMapSetting/ThematicMapSetting.vue +44 -0
  74. package/src/components/ThematicMapSetting/ThematicMapSubjectAdd/common/AnimationItems.vue +141 -0
  75. package/src/components/ThematicMapSetting/ThematicMapSubjectAdd/common/ColorPickerSetting.vue +260 -0
  76. package/src/components/ThematicMapSetting/ThematicMapSubjectAdd/common/EditableFieldTable.vue +187 -0
  77. package/src/components/ThematicMapSetting/ThematicMapSubjectAdd/components/BaseItems/index.vue +161 -0
  78. package/src/components/ThematicMapSetting/ThematicMapSubjectAdd/components/SubjectItems/components/AttributeTable.vue +122 -0
  79. package/src/components/ThematicMapSetting/ThematicMapSubjectAdd/components/SubjectItems/components/Common.vue +376 -0
  80. package/src/components/ThematicMapSetting/ThematicMapSubjectAdd/components/SubjectItems/components/Popup.vue +138 -0
  81. package/src/components/ThematicMapSetting/ThematicMapSubjectAdd/components/SubjectItems/components/StatisticGragh.vue +189 -0
  82. package/src/components/ThematicMapSetting/ThematicMapSubjectAdd/components/SubjectItems/components/SubjectStyles/BaseMapWithGraph.vue +73 -0
  83. package/src/components/ThematicMapSetting/ThematicMapSubjectAdd/components/SubjectItems/components/SubjectStyles/HeatMap.vue +124 -0
  84. package/src/components/ThematicMapSetting/ThematicMapSubjectAdd/components/SubjectItems/components/SubjectStyles/HexBin.vue +100 -0
  85. package/src/components/ThematicMapSetting/ThematicMapSubjectAdd/components/SubjectItems/components/SubjectStyles/Label.vue +139 -0
  86. package/src/components/ThematicMapSetting/ThematicMapSubjectAdd/components/SubjectItems/components/SubjectStyles/StatisticLabel.vue +43 -0
  87. package/src/components/ThematicMapSetting/ThematicMapSubjectAdd/components/SubjectItems/components/SubjectStyles/SubSectionMap.vue +42 -0
  88. package/src/components/ThematicMapSetting/ThematicMapSubjectAdd/components/SubjectItems/components/SubjectStyles/index.vue +56 -0
  89. package/src/components/ThematicMapSetting/ThematicMapSubjectAdd/components/SubjectItems/index.less +101 -0
  90. package/src/components/ThematicMapSetting/ThematicMapSubjectAdd/components/SubjectItems/index.vue +236 -0
  91. package/src/components/ThematicMapSetting/ThematicMapSubjectAdd/index.less +22 -0
  92. package/src/components/ThematicMapSetting/ThematicMapSubjectAdd/index.vue +226 -0
  93. package/src/components/ThematicMapSetting/ThematicMapSubjectAdd/mixins/subject-styles-mixin.js +138 -0
  94. package/src/components/ThematicMapSetting/ThematicMapSubjectAdd/store/dep.js +21 -0
  95. package/src/components/ThematicMapSetting/ThematicMapSubjectAdd/store/fields.ts +111 -0
  96. package/src/components/ThematicMapSetting/ThematicMapSubjectList/index.vue +76 -0
  97. package/src/components/ThematicMapSetting/store/index.js +19 -0
  98. package/src/components/ThematicMapSetting/store/module/getters.js +28 -0
  99. package/src/components/ThematicMapSetting/store/module/index.js +53 -0
  100. package/src/components/ThematicMapSetting/store/module/mutations.js +272 -0
  101. package/src/components/ThematicMapSetting/store/module/state.js +36 -0
  102. package/src/components/ThematicMapSetting/store/types.js +0 -0
  103. package/src/components/WidgetSetting/WidgetJsonConfig.vue +28 -0
  104. package/src/components/WidgetSetting/components/JsonEditor/index.vue +77 -0
  105. package/src/components/WidgetSetting/widget-setting-mixin.js +22 -0
  106. package/src/components/index.js +17 -0
  107. package/src/index.js +63 -0
  108. package/src/shims-tsx.d.ts +13 -0
  109. package/src/shims-vue.d.ts +4 -0
  110. package/src/store/index.ts +15 -0
  111. package/src/utils/auth.js +18 -0
  112. package/src/utils/normal-request.js +63 -0
  113. package/src/utils/request.js +92 -0
  114. package/src/utils/settings.js +50 -0
  115. package/src/utils/uuid.js +17 -0
  116. package/src/utils/validate.js +175 -0
  117. package/tsconfig.json +40 -0
  118. package/vue.config.js +13 -0
Binary file
@@ -0,0 +1,461 @@
1
+ <template>
2
+ <div class="dialog">
3
+ <multi-img-with-form
4
+ ref="multiImgWithForm"
5
+ :config="widgetConfig.baseMapList"
6
+ :baseApi="baseApi"
7
+ TitleLabel="name"
8
+ :imgWidth="200"
9
+ :imgHeight="133"
10
+ @editItem="editItem"
11
+ @deleteItem="deleteItem"
12
+ @addItem="addItem"
13
+ />
14
+ <mapgis-ui-modal
15
+ v-model="showModal"
16
+ :title="modalTitle"
17
+ :width="1000"
18
+ :dialog-style="{ top: '60px' }"
19
+ :bodyStyle="{height:'75vh',overflowY:'auto'}"
20
+ okText="确定"
21
+ cancelText="取消"
22
+ @ok="handleOk"
23
+ @cancel="handleCancel"
24
+ >
25
+ <mapgis-ui-form layout="horizontal" :labelCol="{span:2}" :wrapperCol="{span:22}">
26
+ <mapgis-ui-form-item label="名称">
27
+ <mapgis-ui-input
28
+ v-model="basemapItem.name"
29
+ />
30
+ <mapgis-ui-checkbox :checked="JSON.parse(basemapItem.visible||'true')" @change="handleCheckVisible">可见</mapgis-ui-checkbox>
31
+ <mapgis-ui-checkbox v-model="basemapItem.select">默认选择</mapgis-ui-checkbox>
32
+ <mapgis-ui-checkbox
33
+ :checked="isIndexBaseMap"
34
+ @change="event=>{onCheckIndexBaseMap(event, basemapItem.guid)}"
35
+ >设为索引底图</mapgis-ui-checkbox>
36
+ </mapgis-ui-form-item>
37
+ <mapgis-ui-form-item label="描述">
38
+ <mapgis-ui-input
39
+ v-model="basemapItem.description"
40
+ />
41
+ </mapgis-ui-form-item>
42
+ <mapgis-ui-form-item label="缩略图">
43
+ <mapgis-ui-input
44
+ v-model="basemapItem.image"
45
+ placeholder="请上传缩略图"
46
+ disabled
47
+ >
48
+ <mapgis-ui-upload
49
+ slot="suffix"
50
+ :action="imagesUploadApi"
51
+ :showUploadList="false"
52
+ :withCredentials="true"
53
+ accept=".bmp, .dib, .pcp, .dif, .wmf, .gif, .jpg, .tif, .eps, .psd, .cdr, .iff, .tga, .pcd, .mpt, .png, .jpeg"
54
+ @change="imgUploadChange"
55
+ >
56
+ <mapgis-ui-button type="link" icon="cloud-upload">
57
+ <!-- <mapgis-ui-iconfont type="mapgis-tujiatupian"/> -->
58
+ 上传图片
59
+ </mapgis-ui-button>
60
+ </mapgis-ui-upload>
61
+ </mapgis-ui-input>
62
+ <img
63
+ v-show="basemapItem.image!==''"
64
+ class="image"
65
+ :src="baseApi + basemapItem.image"
66
+ />
67
+ </mapgis-ui-form-item>
68
+ <mapgis-ui-collapse :bordered="true" defaultActiveKey="1">
69
+ <mapgis-ui-collapse-panel key="1" header="数据列表">
70
+ <mapgis-ui-button class="editable-add-btn" @click="handleAddData" size="small">
71
+ 添加
72
+ </mapgis-ui-button>
73
+ <mapgis-ui-table
74
+ bordered
75
+ :data-source="basemapItem.children"
76
+ :columns="columns"
77
+ size="small"
78
+ :pagination="{ pageSize: 5 }"
79
+ >
80
+ <template
81
+ v-for="col in ['name', 'description', 'url', 'tokenKey', 'token']"
82
+ :slot="col"
83
+ slot-scope="text, record"
84
+ >
85
+ <div :key="col">
86
+ <mapgis-ui-input
87
+ v-if="record.editable"
88
+ size="small"
89
+ style="margin: -5px 0"
90
+ :value="text"
91
+ @change="e => handleChangeData(e.target.value, record.editableKey, col)"
92
+ />
93
+ <template v-else>
94
+ <div class="editable-text" :title="text">
95
+ {{ text }}
96
+ </div>
97
+ </template>
98
+ </div>
99
+ </template>
100
+ <template
101
+ slot="type"
102
+ slot-scope="text, record"
103
+ >
104
+ <mapgis-ui-select v-if="record.editable" :value="text" size="small" @change="e => handleChangeData(e, record.editableKey, 'type')">
105
+ <mapgis-ui-select-option v-for="dataType in typeList" :value="dataType.type" :key="dataType.type">
106
+ {{dataType.type}}
107
+ </mapgis-ui-select-option>
108
+ </mapgis-ui-select>
109
+ <template v-else>
110
+ <div class="editable-text" :title="text">
111
+ {{ text }}
112
+ </div>
113
+ </template>
114
+ </template>
115
+ <template slot="operation" slot-scope="text, record">
116
+ <div class="editable-row-operations">
117
+ <span v-if="record.editable">
118
+ <a @click="() => handleSaveData(record.editableKey)">保存</a>
119
+ <a @click="() => handleCancelEdit(record.editableKey)">取消</a>
120
+ </span>
121
+ <span v-else>
122
+ <a :disabled="editingKey !== ''" @click="() => handleEditData(record.editableKey)">编辑</a>
123
+ </span>
124
+ <span >
125
+ <mapgis-ui-popconfirm
126
+ v-if="basemapItem.children.length"
127
+ title="确认删除?"
128
+ okText="确定"
129
+ cancelText="取消"
130
+ @confirm="() => handleDeleteData(record.editableKey)"
131
+ :getPopupContainer="triggerNode => triggerNode.parentNode"
132
+ >
133
+ <a href="javascript:;">删除</a>
134
+ </mapgis-ui-popconfirm>
135
+ </span>
136
+ </div>
137
+ </template>
138
+ </mapgis-ui-table>
139
+ </mapgis-ui-collapse-panel>
140
+ </mapgis-ui-collapse>
141
+ </mapgis-ui-form>
142
+ </mapgis-ui-modal>
143
+ </div>
144
+ </template>
145
+
146
+ <script>
147
+ import { uuid } from '../../utils/uuid'
148
+ const baseUrl =
149
+ process.env.VUE_APP_BASE_API === '/' ? '' : process.env.VUE_APP_BASE_API
150
+ const initItem = {
151
+ name: '',
152
+ description: '',
153
+ image: '/upload/basemap.png',
154
+ visible: 'true',
155
+ select: false,
156
+ children: []
157
+ }
158
+ const typeList = [
159
+ { type: 'OGCWMS' },
160
+ { type: 'OGCWMTS' },
161
+ { type: 'ArcGISTile' },
162
+ { type: 'ArcGISMapImage' },
163
+ { type: 'IGSTile' },
164
+ { type: 'IGSMapImage' },
165
+ { type: 'IGSVector' },
166
+ { type: 'VectorTile' },
167
+ ]
168
+
169
+ import WidgetSettingMixin from '../WidgetSetting/widget-setting-mixin'
170
+ import MultiImgWithForm from '../CommonComponents/MultiImgWithForm/MultiImgWithForm'
171
+
172
+ export default {
173
+ name: 'BasemapManagerSetting',
174
+ mixins: [WidgetSettingMixin],
175
+ components: {
176
+ MultiImgWithForm
177
+ },
178
+ data() {
179
+ return {
180
+ baseApi: baseUrl,
181
+ imagesUploadApi: baseUrl + '/api/local-storage/pictures',
182
+ mode: 'add', // add、edit
183
+ editIndex: -1,
184
+ showModal: false,
185
+ modalTitle: '编辑',
186
+ basemapItem: JSON.parse(JSON.stringify(initItem)), // 一个底图的数据列表
187
+ columns: [
188
+ {
189
+ title: '名称',
190
+ dataIndex: 'name',
191
+ width: '18%',
192
+ scopedSlots: { customRender: 'name' },
193
+ },
194
+ {
195
+ title: '描述',
196
+ dataIndex: 'description',
197
+ width: '8%',
198
+ scopedSlots: { customRender: 'description' },
199
+ ellipsis: true,
200
+ },
201
+ {
202
+ title: '数据类型',
203
+ dataIndex: 'type',
204
+ width: '15%',
205
+ scopedSlots: { customRender: 'type' },
206
+ },
207
+ {
208
+ title: 'url',
209
+ dataIndex: 'url',
210
+ width: '20%',
211
+ scopedSlots: { customRender: 'url' },
212
+ ellipsis: true,
213
+ },
214
+ {
215
+ title: '令牌key',
216
+ dataIndex: 'tokenKey',
217
+ width: '8%',
218
+ scopedSlots: { customRender: 'tokenKey' },
219
+ },
220
+ {
221
+ title: '令牌value',
222
+ dataIndex: 'token',
223
+ width: '13%',
224
+ scopedSlots: { customRender: 'token' },
225
+ ellipsis: true,
226
+ },
227
+ {
228
+ title: '操作',
229
+ dataIndex: 'operation',
230
+ scopedSlots: { customRender: 'operation' },
231
+ },
232
+ ],
233
+ editingKey: '',
234
+ count: 0,
235
+ cacheData: {},
236
+ typeList,
237
+ }
238
+ },
239
+ watch: {
240
+ widgetConfig: {
241
+ handler(next) {
242
+ next.baseMapList.forEach(item => {
243
+ if (!item.guid || item.guid == null) {
244
+ item.guid = uuid()
245
+ }
246
+ })
247
+ },
248
+ immediate: true,
249
+ },
250
+ basemapItem: {
251
+ handler(next) {
252
+ this.count = 0
253
+ next.children.forEach(item => {
254
+ item.editableKey = this.count++
255
+ })
256
+ this.cacheData = JSON.parse(JSON.stringify(next))
257
+ },
258
+ immediate: true,
259
+ }
260
+ },
261
+ computed: {
262
+ isIndexBaseMap() {
263
+ return this.basemapItem.guid === this.widgetConfig.indexBaseMapGUID || false
264
+ },
265
+ },
266
+ methods: {
267
+ imgUploadChange(result) {
268
+ if (result.file.status === 'done') {
269
+ this.basemapItem.image = result.file.response.url
270
+ }
271
+ },
272
+ editItem(index) {
273
+ this.showModal = true
274
+ this.modalTitle = '编辑节点'
275
+ this.mode = 'edit'
276
+ this.editIndex = index
277
+ this.basemapItem = JSON.parse(JSON.stringify(this.widgetConfig.baseMapList[index]))
278
+ },
279
+ deleteItem(guid) {
280
+ if (guid === this.widgetConfig.indexBaseMapGUID) {
281
+ this.widgetConfig.indexBaseMapGUID = ''
282
+ }
283
+ },
284
+ addItem() {
285
+ this.showModal = true
286
+ this.modalTitle = '添加节点'
287
+ this.mode = 'add'
288
+ this.basemapItem = JSON.parse(JSON.stringify(initItem))
289
+ this.basemapItem.guid = uuid()
290
+ },
291
+ handleCheckVisible(event) {
292
+ this.basemapItem.visible = JSON.stringify(event.target.checked)
293
+ },
294
+ onCheckIndexBaseMap(event, guid) {
295
+ if (event.target.checked) {
296
+ this.widgetConfig.indexBaseMapGUID = guid
297
+ } else if (this.basemapItem.guid === this.widgetConfig.indexBaseMapGUID) {
298
+ this.widgetConfig.indexBaseMapGUID = ''
299
+ }
300
+ },
301
+ handleOk() {
302
+ const flag = this.checkBasemapItem()
303
+ if (!flag) return
304
+
305
+ if (this.mode === 'edit') {
306
+ this.widgetConfig.baseMapList[this.editIndex] = this.basemapItem
307
+ } else {
308
+ this.widgetConfig.baseMapList.push(this.basemapItem)
309
+ }
310
+ this.showModal = false
311
+ this.$refs.multiImgWithForm.forceUpdate()
312
+ },
313
+ handleCancel() {
314
+ this.editingKey = ''
315
+ },
316
+ handleDeleteData(key) {
317
+ let keyIndex = -1
318
+ this.basemapItem.children.forEach((item, index) => {
319
+ if (item.editableKey === key) {
320
+ keyIndex = index
321
+ }
322
+ })
323
+ this.basemapItem.children.splice(keyIndex, 1)
324
+ this.cacheData = JSON.parse(JSON.stringify(this.basemapItem))
325
+ },
326
+ handleAddData() {
327
+ const flag = this.checkBasemapDatalistSave()
328
+ if (!flag) return
329
+
330
+ const {count} = this
331
+ const newData = {
332
+ editable: true,
333
+ editableKey: count,
334
+ description: '',
335
+ name: '',
336
+ token: '',
337
+ tokenKey: '',
338
+ type: '',
339
+ url: '',
340
+ }
341
+ this.basemapItem.children.push(newData)
342
+ this.count = count + 1
343
+ this.editingKey = count
344
+ },
345
+ handleEditData(key) {
346
+ this.basemapItem.children.forEach(item => {
347
+ if (item.editableKey === key) {
348
+ this.$set(item, 'editable', true)
349
+ }
350
+ })
351
+ this.editingKey = key
352
+ },
353
+ handleChangeData(value, key, column) {
354
+ this.basemapItem.children.forEach(item => {
355
+ if (item.editableKey === key) {
356
+ item[column] = value
357
+ }
358
+ })
359
+ },
360
+ handleSaveData(key) {
361
+ const flag = this.checkBasemapDatalist()
362
+ if (!flag) return
363
+
364
+ this.editingKey = ''
365
+ this.basemapItem.children.forEach(item => {
366
+ if (item.editableKey === key) {
367
+ delete item.editable
368
+ }
369
+ })
370
+ this.cacheData = JSON.parse(JSON.stringify(this.basemapItem))
371
+ this.$forceUpdate()
372
+ },
373
+ handleCancelEdit(key) {
374
+ this.editingKey = ''
375
+ this.basemapItem.children.forEach(item => {
376
+ if (item.editableKey === key) {
377
+ delete item.editable
378
+ }
379
+ })
380
+ this.basemapItem = this.cacheData
381
+ },
382
+ /* 验证当前底图项下的数据列表是否合法,返回false则不合法,不可保存 */
383
+ checkBasemapDatalist() {
384
+ let result = true
385
+ this.basemapItem.children.forEach(item => {
386
+ if (item.editable && item.editable === true) {
387
+ if (item.name === '' || item.type === '' || item.url === '') {
388
+ result = false
389
+ this.$message.error('名称、数据类型、url不能为空!')
390
+ }
391
+ }
392
+ })
393
+ return result
394
+ },
395
+ /* 验证当前底图项下的数据列表是否全部保存 */
396
+ checkBasemapDatalistSave() {
397
+ let result = true
398
+ this.basemapItem.children.forEach(item => {
399
+ if (item.editable && item.editable === true) {
400
+ result = false
401
+ this.$message.error('请保存编辑状态的数据!')
402
+ }
403
+ })
404
+ return result
405
+ },
406
+ /* 验证当前底图项是否合法,返回false则不合法,不可保存 */
407
+ checkBasemapItem() {
408
+ const flag = this.checkBasemapDatalistSave()
409
+ if (!flag) return
410
+
411
+ let result = true
412
+ if (this.basemapItem.name === '') {
413
+ result = false
414
+ this.$message.error('名称不能为空!')
415
+ }
416
+ return result
417
+ },
418
+ /* 配置UI点击确定按钮的回调,该方法主要进行必填项的验证及多余项的删除 */
419
+ checkConfig() {
420
+ if (this.widgetConfig.indexBaseMapGUID === undefined) {
421
+ this.widgetConfig.indexBaseMapGUID = ''
422
+ }
423
+ this.widgetConfig.baseMapList.forEach(basemap => {
424
+ if (basemap.children && basemap.children.length > 0) {
425
+ basemap.children.forEach(item => {
426
+ delete item.editableKey
427
+ })
428
+ }
429
+ })
430
+ return true
431
+ }
432
+ }
433
+ }
434
+ </script>
435
+
436
+ <style scoped>
437
+ .dialog {
438
+ margin: 16px 0;
439
+ }
440
+ .image {
441
+ height: 78px;
442
+ object-fit: scale-down;
443
+ }
444
+ .editable-add-btn {
445
+ margin-bottom: 8px;
446
+ }
447
+ .editable-row-operations a {
448
+ margin-right: 8px;
449
+ }
450
+ .mapgis-ui-btn:focus, .mapgis-ui-btn:hover {
451
+ background-color: #fff0;
452
+ }
453
+ ::v-deep .mapgis-ui-collapse .mapgis-ui-collapse-item .mapgis-ui-collapse-header {
454
+ border-left: 0px solid var(--primary-5)!important;
455
+ }
456
+ .editable-text {
457
+ overflow: hidden;
458
+ white-space: nowrap;
459
+ text-overflow: ellipsis;
460
+ }
461
+ </style>
@@ -0,0 +1,145 @@
1
+ <template>
2
+ <div class="dialog">
3
+ <mapgis-ui-button class="editable-add-btn" @click="handleAdd" size="small">
4
+ 添加
5
+ </mapgis-ui-button>
6
+ <mapgis-ui-table
7
+ bordered
8
+ :data-source="widgetConfig"
9
+ rowKey="editableKey"
10
+ :columns="columns"
11
+ size="small"
12
+ >
13
+ <template slot="baseUrl" slot-scope="text, record">
14
+ <editable-cell :text="text" ref="EditableCell" @changeEdit="edit=>{changeEdit(record.editableKey, edit)}" @change="onCellChange(record.editableKey, 'baseUrl', $event)" />
15
+ </template>
16
+ <template slot="operation" slot-scope="text, record">
17
+ <mapgis-ui-popconfirm
18
+ v-if="widgetConfig.length"
19
+ title="确认删除?"
20
+ okText="确定"
21
+ cancelText="取消"
22
+ @confirm="() => onDelete(record.editableKey)"
23
+ :getPopupContainer="triggerNode => triggerNode.parentNode"
24
+ >
25
+ <a href="javascript:;">删除</a>
26
+ </mapgis-ui-popconfirm>
27
+ </template>
28
+ </mapgis-ui-table>
29
+ </div>
30
+ </template>
31
+
32
+ <script>
33
+ import WidgetSettingMixin from '../WidgetSetting/widget-setting-mixin'
34
+ import EditableCell from './EditableCell'
35
+ export default {
36
+ name: 'CityGrowSetting',
37
+ mixins: [WidgetSettingMixin],
38
+ components: {
39
+ EditableCell,
40
+ },
41
+ data() {
42
+ return {
43
+ count: 0,
44
+ columns: [
45
+ {
46
+ title: '数据源',
47
+ dataIndex: 'baseUrl',
48
+ width: '80%',
49
+ scopedSlots: { customRender: 'baseUrl' },
50
+ },
51
+ {
52
+ title: '操作',
53
+ dataIndex: 'operation',
54
+ scopedSlots: { customRender: 'operation' },
55
+ },
56
+ ],
57
+ }
58
+ },
59
+ watch: {},
60
+ mounted() {
61
+ this.count = 0
62
+ this.widgetConfig.forEach(item => {
63
+ item.editableKey = this.count++
64
+ })
65
+ },
66
+ methods: {
67
+ onCellChange(key, dataIndex, value) {
68
+ this.widgetConfig.forEach(item => {
69
+ if (item.editableKey === key) {
70
+ item[dataIndex] = value
71
+ }
72
+ })
73
+ },
74
+ onDelete(key) {
75
+ let keyIndex = -1
76
+ this.widgetConfig.forEach((item, index) => {
77
+ if (item.editableKey === key) {
78
+ keyIndex = index
79
+ }
80
+ })
81
+ this.widgetConfig.splice(keyIndex, 1)
82
+ },
83
+ handleAdd() {
84
+ const saveFlag = this.checkListSave()
85
+ if (!saveFlag) return
86
+
87
+ const {count} = this
88
+ let newData = {
89
+ editableKey: count,
90
+ baseUrl: '',
91
+ }
92
+ // if (this.widgetConfig.length) { // 前台已优化,这里不再需要加此逻辑
93
+ // newData = {...this.widgetConfig[0], ...newData}
94
+ // }
95
+
96
+ this.widgetConfig.push(newData)
97
+ this.count = count + 1
98
+ },
99
+ /**
100
+ * 验证当前widgetConfig是否合法,返回false则不合法,不可保存
101
+ */
102
+ checkConfig() {
103
+ const saveFlag = this.checkListSave()
104
+ if (!saveFlag) return
105
+
106
+ this.widgetConfig.forEach(item => {
107
+ delete item.editableKey
108
+ })
109
+ return true
110
+ },
111
+ /* 验证当前数据源列表是否全部保存 */
112
+ checkListSave() {
113
+ let result = true
114
+ this.widgetConfig.forEach(item => {
115
+ if (item.editable && item.editable === true) {
116
+ result = false
117
+ this.$message.error('请保存编辑状态的数据!')
118
+ }
119
+ })
120
+ return result
121
+ },
122
+ changeEdit(key, editable) {
123
+ this.widgetConfig.forEach(item => {
124
+ if (item.editableKey === key) {
125
+ if (editable === true) {
126
+ item['editable'] = editable
127
+ } else {
128
+ delete item.editable
129
+ }
130
+ }
131
+ })
132
+ }
133
+ },
134
+ }
135
+ </script>
136
+
137
+ <style scoped>
138
+ .dialog {
139
+ margin: 16px 0;
140
+ }
141
+
142
+ .editable-add-btn {
143
+ margin-bottom: 8px;
144
+ }
145
+ </style>
@@ -0,0 +1,103 @@
1
+ <template>
2
+ <div class="editable-cell">
3
+ <div v-if="editable" class="editable-cell-input-wrapper">
4
+ <mapgis-ui-input size="small" placeholder="请输入数据源url" :value="value" @change="handleChange" @pressEnter="check" />
5
+ <mapgis-ui-iconfont
6
+ type="mapgis-check"
7
+ class="editable-cell-icon-check"
8
+ @click="check"
9
+ />
10
+ </div>
11
+ <div v-else class="editable-cell-text-wrapper">
12
+ {{ value || ' ' }}
13
+ <mapgis-ui-iconfont type="mapgis-bianji" class="editable-cell-icon" @click="edit" />
14
+ </div>
15
+ </div>
16
+ </template>
17
+
18
+ <script>
19
+ export default {
20
+ name: 'EditableCell',
21
+ props: {
22
+ text: String,
23
+ },
24
+ data() {
25
+ return {
26
+ value: this.text,
27
+ editable: false,
28
+ };
29
+ },
30
+ watch: {
31
+ text: {
32
+ handler(next) {
33
+ if (next === '') {
34
+ this.editable = true
35
+ this.$emit('changeEdit', this.editable)
36
+ }
37
+ },
38
+ immediate: true
39
+ }
40
+ },
41
+ methods: {
42
+ handleChange(e) {
43
+ const value = e.target.value
44
+ this.value = value
45
+ },
46
+ check() {
47
+ if (this.value !== '') {
48
+ this.editable = false
49
+ this.$emit('change', this.value)
50
+ this.$emit('changeEdit', this.editable)
51
+ } else {
52
+ this.$message.error('数据源url不能为空!')
53
+ }
54
+ },
55
+ edit() {
56
+ this.editable = true
57
+ this.$emit('changeEdit', this.editable)
58
+ },
59
+ },
60
+ }
61
+ </script>
62
+
63
+ <style scoped>
64
+ .editable-cell {
65
+ position: relative;
66
+ }
67
+
68
+ .editable-cell-input-wrapper,
69
+ .editable-cell-text-wrapper {
70
+ padding-right: 24px;
71
+ }
72
+
73
+ .editable-cell-text-wrapper {
74
+ padding: 1px 24px 2px 5px;
75
+ }
76
+
77
+ .editable-cell-icon,
78
+ .editable-cell-icon-check {
79
+ position: absolute;
80
+ right: 0;
81
+ width: 20px;
82
+ cursor: pointer;
83
+ }
84
+
85
+ .editable-cell-icon {
86
+ top: 4px;
87
+ line-height: 18px;
88
+ display: none;
89
+ }
90
+
91
+ .editable-cell-icon-check {
92
+ line-height: 28px;
93
+ }
94
+
95
+ .editable-cell:hover .editable-cell-icon {
96
+ display: inline-block;
97
+ }
98
+
99
+ .editable-cell-icon:hover,
100
+ .editable-cell-icon-check:hover {
101
+ color: #108ee9;
102
+ }
103
+ </style>