vue2-client 1.8.310 → 1.8.312

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 (222) hide show
  1. package/.env +19 -19
  2. package/.eslintrc.js +90 -90
  3. package/CHANGELOG.md +824 -824
  4. package/Components.md +60 -60
  5. package/babel.config.js +21 -21
  6. package/docs/LowCode/lowcode.md +155 -155
  7. package/docs/LowCode/lowcodeForDeveloper.md +230 -230
  8. package/docs/index.md +30 -30
  9. package/index.js +31 -31
  10. package/jest-transform-stub.js +8 -8
  11. package/jest.config.js +21 -21
  12. package/jest.setup.js +7 -7
  13. package/package.json +97 -97
  14. package/public/index.html +27 -27
  15. package/src/App.vue +188 -188
  16. package/src/ReportView.js +19 -19
  17. package/src/assets/img/querySlotDemo.svg +15 -15
  18. package/src/assets/svg/badtwo.svg +1 -1
  19. package/src/assets/svg/goodtwo.svg +1 -1
  20. package/src/base-client/components/common/AMisRender/index.js +3 -3
  21. package/src/base-client/components/common/AMisRender/index.vue +263 -263
  22. package/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox.vue +438 -416
  23. package/src/base-client/components/common/AddressSearchCombobox/demo.vue +36 -36
  24. package/src/base-client/components/common/AddressSearchCombobox/ic_map.svg +6 -6
  25. package/src/base-client/components/common/AmapMarker/AmapPointRendering.vue +120 -120
  26. package/src/base-client/components/common/CitySelect/CitySelect.vue +342 -342
  27. package/src/base-client/components/common/CitySelect/index.js +3 -3
  28. package/src/base-client/components/common/CitySelect/index.md +109 -109
  29. package/src/base-client/components/common/CreateQuery/CreateQuery.vue +669 -669
  30. package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +1014 -1014
  31. package/src/base-client/components/common/CreateQuery/index.js +3 -3
  32. package/src/base-client/components/common/CreateQuery/index.md +42 -42
  33. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQuery.vue +452 -452
  34. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQueryItem.vue +511 -511
  35. package/src/base-client/components/common/CreateSimpleFormQuery/index.js +3 -3
  36. package/src/base-client/components/common/CreateSimpleFormQuery/index.md +42 -42
  37. package/src/base-client/components/common/FormGroupEdit/FormGroupEdit.vue +149 -149
  38. package/src/base-client/components/common/FormGroupEdit/index.js +3 -3
  39. package/src/base-client/components/common/FormGroupEdit/index.md +43 -43
  40. package/src/base-client/components/common/FormGroupQuery/FormGroupQuery.vue +166 -166
  41. package/src/base-client/components/common/FormGroupQuery/index.js +3 -3
  42. package/src/base-client/components/common/FormGroupQuery/index.md +43 -43
  43. package/src/base-client/components/common/JSONToTree/jsontotree.vue +271 -271
  44. package/src/base-client/components/common/LowCodeComponent/LowCodeEditorPanel.vue +413 -350
  45. package/src/base-client/components/common/LowCodeComponent/LowCodePageOrganization.vue +502 -502
  46. package/src/base-client/components/common/LowCodeComponent/LowCodeRender.vue +728 -699
  47. package/src/base-client/components/common/LowCodeComponent/LowCodeRenderEnter.vue +29 -29
  48. package/src/base-client/components/common/LowCodeComponent/LowCodeUIStore.vue +219 -162
  49. package/src/base-client/components/common/PersonSetting/PersonSetting.vue +208 -208
  50. package/src/base-client/components/common/PersonSetting/index.js +3 -3
  51. package/src/base-client/components/common/Tree/Tree.vue +149 -149
  52. package/src/base-client/components/common/Tree/index.js +2 -2
  53. package/src/base-client/components/common/Upload/Upload.vue +239 -239
  54. package/src/base-client/components/common/Upload/index.js +3 -3
  55. package/src/base-client/components/common/XAddForm/XAddForm.vue +105 -105
  56. package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +807 -807
  57. package/src/base-client/components/common/XAddNativeForm/index.md +146 -146
  58. package/src/base-client/components/common/XAddNativeForm/lowcodeEditorRegister.js +16 -16
  59. package/src/base-client/components/common/XAddNativeFormOA/XAddNativeFormOA.vue +303 -303
  60. package/src/base-client/components/common/XAddNativeFormOA/index.js +3 -3
  61. package/src/base-client/components/common/XAddNativeFormOA/index.md +146 -146
  62. package/src/base-client/components/common/XBadge/XBadge.vue +78 -78
  63. package/src/base-client/components/common/XCard/XCard.vue +64 -64
  64. package/src/base-client/components/common/XDataCard/XDataCard.vue +355 -0
  65. package/src/base-client/components/common/XDataCard/index.js +3 -0
  66. package/src/base-client/components/common/XDataCard/index.md +1 -0
  67. package/src/base-client/components/common/XDataDrawer/XDataDrawer.vue +180 -180
  68. package/src/base-client/components/common/XDataDrawer/index.js +3 -3
  69. package/src/base-client/components/common/XDataDrawer/index.md +41 -41
  70. package/src/base-client/components/common/XDescriptions/XDescriptions.vue +188 -187
  71. package/src/base-client/components/common/XDescriptions/XDescriptionsGroup.vue +306 -306
  72. package/src/base-client/components/common/XDescriptions/demo.vue +50 -50
  73. package/src/base-client/components/common/XDescriptions/index.js +3 -3
  74. package/src/base-client/components/common/XDescriptions/index.md +83 -83
  75. package/src/base-client/components/common/XDetailsView/XDetailsView.vue +214 -214
  76. package/src/base-client/components/common/XDetailsView/index.js +3 -3
  77. package/src/base-client/components/common/XForm/XForm.vue +294 -294
  78. package/src/base-client/components/common/XForm/XFormItem.vue +911 -911
  79. package/src/base-client/components/common/XForm/XTreeSelect.vue +207 -207
  80. package/src/base-client/components/common/XForm/index.md +178 -178
  81. package/src/base-client/components/common/XFormCol/XFormCol.vue +36 -36
  82. package/src/base-client/components/common/XFormGroup/XFormGroup.vue +241 -241
  83. package/src/base-client/components/common/XFormGroup/demo.vue +40 -40
  84. package/src/base-client/components/common/XFormGroup/index.js +3 -3
  85. package/src/base-client/components/common/XFormGroup/index.md +38 -38
  86. package/src/base-client/components/common/XFormGroupDetails/XFormGroupDetails.vue +72 -72
  87. package/src/base-client/components/common/XFormGroupDetails/index.js +3 -3
  88. package/src/base-client/components/common/XFormTable/XFormTable.vue +545 -539
  89. package/src/base-client/components/common/XFormTable/demo.vue +72 -72
  90. package/src/base-client/components/common/XFormTable/index.md +98 -98
  91. package/src/base-client/components/common/XFormTable/lowcodeEditorRegister.js +30 -30
  92. package/src/base-client/components/common/XImportExcel/XImportExcel.vue +147 -147
  93. package/src/base-client/components/common/XReport/XReport.vue +858 -858
  94. package/src/base-client/components/common/XReport/XReportDemo.vue +266 -266
  95. package/src/base-client/components/common/XReport/XReportDesign.vue +509 -509
  96. package/src/base-client/components/common/XReport/XReportJsonRender.vue +295 -295
  97. package/src/base-client/components/common/XReport/XReportTrGroup.vue +801 -801
  98. package/src/base-client/components/common/XReport/index.js +3 -3
  99. package/src/base-client/components/common/XReport/index.md +44 -44
  100. package/src/base-client/components/common/XReportSlot/XReportSlot.vue +110 -110
  101. package/src/base-client/components/common/XReportSlot/index.js +3 -3
  102. package/src/base-client/components/common/XSimpleDescriptions/XSimpleDescriptions.vue +137 -0
  103. package/src/base-client/components/common/XSimpleDescriptions/index.js +3 -0
  104. package/src/base-client/components/common/XSimpleDescriptions/index.md +7 -0
  105. package/src/base-client/components/common/XStepView/XStepView.vue +252 -252
  106. package/src/base-client/components/common/XStepView/index.js +3 -3
  107. package/src/base-client/components/common/XStepView/index.md +31 -31
  108. package/src/base-client/components/common/XTable/XTable.vue +715 -676
  109. package/src/base-client/components/common/XTable/index.md +255 -255
  110. package/src/base-client/components/common/XTree/XTree.vue +423 -423
  111. package/src/base-client/components/common/XTree/index.js +3 -3
  112. package/src/base-client/components/common/XTree/index.md +36 -36
  113. package/src/base-client/components/common/XTreeOne/XTreeOne.vue +114 -114
  114. package/src/base-client/components/common/XTreeOne/lowcodeEditorRegister.js +11 -11
  115. package/src/base-client/components/index.js +51 -51
  116. package/src/base-client/components/system/DictionaryDetailsView/DictionaryDetailsView.vue +232 -232
  117. package/src/base-client/components/system/QueryParamsDetailsView/QueryParamsDetailsView.vue +281 -281
  118. package/src/base-client/plugins/AppData.js +121 -121
  119. package/src/base-client/plugins/Config.js +19 -19
  120. package/src/base-client/plugins/GetLoginInfoService.js +183 -183
  121. package/src/base-client/plugins/tabs-page-plugin.js +39 -39
  122. package/src/bootstrap.js +39 -39
  123. package/src/components/CodeMirror/inedx.vue +118 -118
  124. package/src/components/CodeMirror/setting.js +40 -40
  125. package/src/components/FilePreview/FilePreview.vue +166 -166
  126. package/src/components/NumberInfo/NumberInfo.vue +54 -54
  127. package/src/components/STable/index.js +361 -361
  128. package/src/components/checkbox/ColorCheckbox.vue +157 -157
  129. package/src/components/checkbox/ImgCheckbox.vue +163 -163
  130. package/src/components/menu/SideMenu.vue +75 -75
  131. package/src/components/menu/menu.js +273 -273
  132. package/src/components/tool/AStepItem.vue +60 -60
  133. package/src/config/CreateQueryConfig.js +322 -322
  134. package/src/config/default/antd.config.js +89 -89
  135. package/src/config/default/setting.config.js +55 -55
  136. package/src/font-style/font.css +4 -4
  137. package/src/layouts/CommonLayout.vue +56 -56
  138. package/src/layouts/PageLayout.vue +151 -151
  139. package/src/layouts/SinglePageView.vue +138 -138
  140. package/src/layouts/header/AdminHeader.vue +132 -132
  141. package/src/layouts/header/HeaderNotice.vue +177 -177
  142. package/src/layouts/tabs/TabsHead.vue +189 -189
  143. package/src/layouts/tabs/TabsView.vue +387 -387
  144. package/src/lib.js +1 -1
  145. package/src/main.js +26 -26
  146. package/src/mock/extend/index.js +84 -84
  147. package/src/mock/goods/index.js +108 -108
  148. package/src/pages/AMisDemo/AMisDemo.vue +325 -325
  149. package/src/pages/AMisDemo/AMisDemo2.vue +74 -74
  150. package/src/pages/DynamicStatistics/ChartSelector.vue +331 -331
  151. package/src/pages/DynamicStatistics/DataTabs.vue +83 -83
  152. package/src/pages/DynamicStatistics/DynamicTable.vue +128 -128
  153. package/src/pages/DynamicStatistics/EvaluationArea.vue +69 -69
  154. package/src/pages/DynamicStatistics/FavoriteList.vue +51 -51
  155. package/src/pages/DynamicStatistics/QuestionHistoryAndFavorites.vue +591 -591
  156. package/src/pages/DynamicStatistics/SearchBar.vue +192 -192
  157. package/src/pages/DynamicStatistics/index.vue +282 -282
  158. package/src/pages/Example/index.vue +193 -33
  159. package/src/pages/NewDynamicStatistics/ChartSelector.vue +331 -331
  160. package/src/pages/NewDynamicStatistics/DataTabs.vue +122 -122
  161. package/src/pages/NewDynamicStatistics/DynamicTable.vue +128 -128
  162. package/src/pages/NewDynamicStatistics/EvaluationArea.vue +69 -69
  163. package/src/pages/NewDynamicStatistics/FavoriteList.vue +51 -51
  164. package/src/pages/NewDynamicStatistics/QuestionHistoryAndFavorites.vue +289 -289
  165. package/src/pages/NewDynamicStatistics/SearchBar.vue +193 -193
  166. package/src/pages/NewDynamicStatistics/index.vue +258 -258
  167. package/src/pages/ServiceReview/index.vue +284 -284
  168. package/src/pages/XReportView/index.vue +62 -62
  169. package/src/pages/login/Login.vue +378 -378
  170. package/src/pages/login/LoginV3.vue +389 -389
  171. package/src/pages/lowCode/lowCodeEditor.vue +1219 -1030
  172. package/src/pages/lowCode/lowCodeRenderPage.vue +43 -43
  173. package/src/pages/resourceManage/orgListManage.vue +98 -98
  174. package/src/pages/system/dictionary/index.vue +44 -44
  175. package/src/pages/system/monitor/loginInfor/index.vue +37 -37
  176. package/src/pages/system/monitor/operLog/index.vue +37 -37
  177. package/src/pages/system/settings/modifyPassword.vue +117 -117
  178. package/src/pages/system/ticket/index.vue +480 -480
  179. package/src/pages/system/ticket/submitTicketSuccess.vue +484 -484
  180. package/src/router/async/config.async.js +34 -34
  181. package/src/router/async/router.map.js +104 -104
  182. package/src/router/guards.js +223 -223
  183. package/src/router/index.js +27 -27
  184. package/src/router.js +19 -19
  185. package/src/services/api/TicketDetailsViewApi.js +46 -46
  186. package/src/services/api/cas.js +79 -79
  187. package/src/services/api/common.js +307 -307
  188. package/src/services/api/entity.js +18 -18
  189. package/src/services/api/index.js +17 -17
  190. package/src/services/api/restTools.js +46 -46
  191. package/src/services/apiService.js +14 -14
  192. package/src/services/user.js +71 -71
  193. package/src/services/v3Api.js +81 -81
  194. package/src/store/modules/index.js +5 -5
  195. package/src/store/modules/lowCode.js +33 -33
  196. package/src/store/modules/setting.js +119 -119
  197. package/src/theme/default/style.less +58 -58
  198. package/src/theme/global.less +139 -139
  199. package/src/utils/authority-utils.js +85 -85
  200. package/src/utils/errorCode.js +6 -6
  201. package/src/utils/formatter.js +80 -80
  202. package/src/utils/htmlToPDF.js +108 -108
  203. package/src/utils/htmlToPDFApi.js +5 -5
  204. package/src/utils/indexedDB.js +258 -258
  205. package/src/utils/login.js +188 -188
  206. package/src/utils/lowcode/lowcodeComponentMixin.js +120 -120
  207. package/src/utils/lowcode/lowcodeLog.js +29 -29
  208. package/src/utils/lowcode/lowcodeUtils.js +373 -373
  209. package/src/utils/lowcode/registerComponentForEditor.js +11 -11
  210. package/src/utils/lowcode/registerComponentForRender.js +11 -11
  211. package/src/utils/map-utils.js +47 -47
  212. package/src/utils/reg.js +95 -95
  213. package/src/utils/request.js +347 -347
  214. package/src/utils/routerUtil.js +435 -435
  215. package/src/utils/runEvalFunction.js +6 -6
  216. package/src/utils/util.js +241 -241
  217. package/src/utils/waterMark.js +31 -31
  218. package/test/Amis.spec.js +163 -163
  219. package/test/Tree.spec.js +167 -167
  220. package/test/myDialog.spec.js +46 -46
  221. package/vue.config.js +181 -181
  222. package//350/277/201/347/247/273/346/227/245/345/277/227.md +15 -15
@@ -1,416 +1,438 @@
1
- <template>
2
- <div id="addressSearchCombobox">
3
- <div style="display: flex; width: 100%;">
4
- <a-input-group style="flex: 1; display: flex;" compact>
5
- <a-input
6
- v-model="addressInput"
7
- :read-only="readOnly || !this.addressObj.address"
8
- @change="change"
9
- style="flex: 1; min-width: 0;"
10
- placeholder="请选择地址信息"/>
11
- <a-button
12
- v-if="attr?.inputOnAfterName && attr?.inputOnAfterFunc"
13
- style="min-width: 4rem; max-width: 6rem;"
14
- type="primary"
15
- @click="emitFunc(attr?.inputOnAfterFunc, addressInput)">
16
- {{ attr?.inputOnAfterName }}
17
- </a-button>
18
- </a-input-group>
19
- <a-button
20
- style="flex-shrink: 0; margin-left: 0.2rem;"
21
- :type="attr?.inputOnAfterName ? 'primary' : ''"
22
- @click="visible = true">
23
- <img src="./ic_map.svg" class="address_btn_logo" alt=" ">
24
- 定位
25
- </a-button>
26
- </div>
27
- <a-modal
28
- v-model="visible"
29
- title="地址选择"
30
- @ok="selected"
31
- :zIndex="m_index"
32
- :destroyOnClose="true">
33
- <div class="certain-category-search-wrapper">
34
- <a-auto-complete
35
- style="right: 0px;width: 90%;z-index:2;margin-top:2%;"
36
- :disabled="!mapAutocomplete"
37
- class="certain-category-search"
38
- dropdown-class-name="certain-category-search-dropdown"
39
- option-label-prop="value"
40
- placeholder="输入地址关键字搜索"
41
- @search="fetchFunction"
42
- @select="onSelect"
43
- >
44
- <a-spin v-if="searching" slot="notFoundContent" size="small"/>
45
- <template slot="dataSource">
46
- <a-select-opt-group v-for="group in option" :key="group.title">
47
- <span
48
- slot="label">
49
- <a-icon type="bank"/> {{ group.title }}
50
- </span>
51
- <a-select-option v-for="address in group.children" :key="address.label + ' <' + address.value + '>'">
52
- <p class="addressName">
53
- <a-icon type="environment"/>
54
- <span v-html="highLight(address.label, address.word)"></span></p>
55
- <p v-if="address.address !== '[]'" class="addressRemark">
56
- {{ address.address }}
57
- </p>
58
- </a-select-option>
59
- </a-select-opt-group>
60
- </template>
61
- <a-input>
62
- <a-icon slot="suffix" class="certain-category-icon" type="search"/>
63
- </a-input>
64
- </a-auto-complete>
65
- </div>
66
- <div id="addressSearchCombobox_map"/>
67
- <a-descriptions
68
- bordered
69
- class="asc_descriptions"
70
- :column="{ xxl: 2, xl: 2, lg: 2, md: 2, sm: 1, xs: 1 }"
71
- >
72
- <a-descriptions-item label="坐标" span="2"><span>{{ addressObj.lng_lat }}</span></a-descriptions-item>
73
- <a-descriptions-item label="地址" span="2"><span>{{ addressObj.address }}</span></a-descriptions-item>
74
- </a-descriptions>
75
- </a-modal>
76
- <!-- -->
77
- </div>
78
- </template>
79
- <script>
80
-
81
- import { GetGDMap } from '@vue2-client/utils/map-utils'
82
- import { debounce } from 'ant-design-vue/lib/vc-table/src/utils'
83
- import { mapState } from 'vuex'
84
- import { runLogic } from '@vue2-client/services/api/common'
85
-
86
- export default {
87
- name: 'AddressSearchCombobox',
88
- data () {
89
- // 检索去抖
90
- this.fetchFunction = debounce(this.fetchFunction, 300)
91
- return {
92
- // 地址搜索联想
93
- mapAutocomplete: undefined,
94
- // 检索结果
95
- option: [],
96
- // 最后检索版本
97
- lastFetchId: 0,
98
- // 检索中
99
- searching: false,
100
- addressObj: {
101
- lng_lat: '',
102
- address: '',
103
- },
104
- visible: false,
105
- map: null,
106
- m_index: 1002,
107
- positionPicker: null,
108
- addressInput: this.searchResult,
109
- // 选择地址返回的行政区域
110
- divisions: {},
111
- // 生成地址串中省市区街道信息禁止修改
112
- readOnlyDivisions: false
113
- }
114
- },
115
- computed: {
116
- ...mapState('setting', ['isMobile', 'gaode_key', 'gaode_secret_key'])
117
- },
118
- props: {
119
- attr: {
120
- type: Object,
121
- default: () => {
122
- }
123
- },
124
- emitFunc: {
125
- type: Function,
126
- default: () => {
127
- }
128
- },
129
- searchResult: {
130
- type: String,
131
- default: undefined
132
- },
133
- // 返回数据格式
134
- searchResultType: {
135
- type: String,
136
- default: 'Default'
137
- // default: 'Array'
138
- // default: 'Object'
139
- },
140
- // Object 返回格式时 可以自定义key
141
- resultKeys: {
142
- type: Object,
143
- default: () => {
144
- return { address: 'address', coords: 'coords' }
145
- }
146
- },
147
- readOnly: {
148
- type: Boolean,
149
- default: false
150
- },
151
- // 省市区是否可以修改
152
- divisionsChange: {
153
- type: Boolean,
154
- default: false
155
- },
156
- },
157
- created () {
158
- },
159
- mounted () {
160
- },
161
- methods: {
162
- change (value) {
163
- if (this.readOnlyDivisions && !this.divisionsChange) {
164
- // 如果省市区街道信息禁止修改
165
- if (this.divisions.str && !this.addressInput.startsWith(this.divisions.str)) {
166
- this.addressInput = this.addressObj.address
167
- this.$message.info('省市区街道信息请从选择新地址以变更')
168
- return
169
- }
170
- }
171
- debounce(() => {
172
- this.selected(null, this.addressInput)
173
- }, 200)()
174
- },
175
- initMap (aMap) {
176
- this.map = new (aMap).Map('addressSearchCombobox_map', { // 设置地图容器id
177
- resizeEnable: true, // 是否监控地图容器尺寸变化
178
- zoom: 10, // 初始化地图层级
179
- })
180
- this.geocoder = new (aMap).Geocoder({
181
- radius: 500 // 范围,默认:500
182
- })
183
- this.map.addControl(new (aMap).ToolBar()) // 初始化工具插件
184
- // 初始化窗体
185
- /* this.infoWindow = new (aMap).InfoWindow({
186
- anchor: 'bottom-center',
187
- isCustom: false, // 使用自定义窗体
188
- autoMove: true,
189
- content: '',
190
- showShadow: true,
191
- offset: new (aMap).Pixel(0, -25)
192
- }) */
193
- },
194
- onSelect (value) {
195
- console.log(' value--- ', this.searchResult)
196
- const _arr = value.replace('>', '').split('<')
197
- this.addressObj.address = _arr[0]
198
- this.addressObj.lng_lat = _arr[1]
199
- this.map.setCenter(this.addressObj.lng_lat.split(','))
200
- },
201
- selected (_value, _addstr) {
202
- let result
203
- if (this.searchResultType !== 'Default') {
204
- if (this.searchResultType === 'Array') {
205
- result = [_addstr || this.addressObj.address, this.addressObj.lng_lat]
206
- } else {
207
- result = {}
208
- result[this.resultKeys.address] = _addstr || this.addressObj.address
209
- result[this.resultKeys.coords] = this.addressObj.lng_lat
210
- }
211
- }
212
- this.visible = false
213
- this.$emit('onSelect', JSON.stringify(result))
214
- // 如果传递了地址 是为了更新上级 不做省市区检验处理
215
- if (!_addstr) {
216
- this.addressInput = this.addressObj.address
217
- this.$emit('onDivisionsChange', Object.assign({}, result, { divisions: this.divisions, vm: this }))
218
- }
219
- },
220
- // 懒加载检索方法
221
- fetchFunction (value) {
222
- if (value && this.mapAutocomplete) {
223
- this.searching = true
224
- this.lastFetchId += 1
225
- const fetchId = this.lastFetchId
226
- this.mapAutocomplete.search(value, (status, result) => {
227
- if (fetchId !== this.lastFetchId) {
228
- return
229
- }
230
- if (status === 'complete') {
231
- this.option = []
232
- const addressMap = {}
233
- result.tips.forEach((res) => {
234
- if (res.location) {
235
- if (!Object.prototype.hasOwnProperty.call(addressMap, res.district)) {
236
- addressMap[res.district] = []
237
- }
238
- addressMap[res.district].push({
239
- label: res.name,
240
- value: res.location.lng + ',' + res.location.lat,
241
- address: res.address + '',
242
- word: value
243
- })
244
- }
245
- })
246
- for (const key of Object.keys(addressMap)) {
247
- this.option.push({
248
- title: key,
249
- children: addressMap[key]
250
- })
251
- }
252
- }
253
- this.searching = false
254
- })
255
- }
256
- },
257
- // 获取数据
258
- getData (value, callback) {
259
- if (value !== '') {
260
- const logicName = this.attr.keyName
261
- const logic = logicName.substring(6)
262
- runLogic(logic, value, 'af-system').then(res => {
263
- callback(res)
264
- })
265
- }
266
- },
267
- // 关键字高亮
268
- highLight (value, word) {
269
- // 如果标题中包含,关键字就替换一下
270
- if (value.includes(word)) {
271
- value = value.replace(word,
272
- // 这里是替换成html格式的数据,最好再加一个样式权重,保险一点
273
- '<span style="color:red!important;">' + word + '</span>'
274
- )
275
- return value
276
- // eslint-disable-next-line brace-style
277
- }
278
- // 不包含的话还用这个
279
- else {
280
- return value
281
- }
282
- }
283
- },
284
- watch: {
285
- 'visible' (val) {
286
- if (val) {
287
- this.$nextTick(() => {
288
- GetGDMap(this.gaode_secret_key, this.gaode_key).then(aMap => {
289
- this.initMap(aMap)
290
- this.mapAutocomplete = new (aMap).AutoComplete({
291
- // city 限定城市,默认全国
292
- city: '全国',
293
- dragEnable: true,
294
- animateEnable: false
295
- })
296
- this.positionPicker = new window.AMapUI.PositionPicker({
297
- mode: 'dragMap',
298
- map: this.map
299
- })
300
- this.positionPicker.on('success', (positionResult) => {
301
- console.log(positionResult)
302
- console.log(positionResult.position)
303
- // 设置 行政区划信息
304
- if (positionResult?.regeocode?.addressComponent) {
305
- const { addressComponent } = positionResult?.regeocode
306
- this.divisions.province = addressComponent.province
307
- this.divisions.city = addressComponent.city
308
- this.divisions.district = addressComponent.district
309
- this.divisions.township = addressComponent.township
310
- this.divisions.towncode = addressComponent.towncode
311
- this.divisions.street = addressComponent.street
312
- // 试着获取小区
313
- if (positionResult?.regeocode?.aois && positionResult?.regeocode?.aois.length) {
314
- // 取第一个当做小区
315
- this.divisions.area = positionResult?.regeocode?.aois[0]?.name
316
- } else if (positionResult?.regeocode?.pois && positionResult?.regeocode?.pois.length) {
317
- // 取第一个当做小区
318
- this.divisions.area = positionResult?.regeocode?.pois[0]?.name
319
- }
320
- this.divisions.str =
321
- `${addressComponent.province}${addressComponent.city}${addressComponent.district}${addressComponent.township}`
322
- }
323
- if (this.divisions.str && positionResult.address.startsWith(this.divisions.str)) {
324
- // 如果 省市区信息和获取到的地址的前缀一致 那么省市区前缀禁止修改只能修改后面的 通过 onchange事件拦截
325
- this.readOnlyDivisions = true
326
- }
327
- this.addressObj.address = positionResult.address
328
- this.addressObj.lng_lat = `${positionResult.position.lng},${positionResult.position.lat}`
329
- })
330
- this.positionPicker.on('fail', function (positionResult) {
331
- })
332
- this.positionPicker.start()
333
- })
334
- })
335
- }
336
- }
337
- }
338
- }
339
- </script>
340
-
341
- <style lang="less" scoped>
342
- #addressSearchCombobox_map {
343
- margin: 1% 0;
344
- width: 100%;
345
- height: 400px;
346
- text-align: center
347
- }
348
-
349
- .address_btn_logo {
350
- width: 1rem;
351
- margin-right: 0.5rem
352
- }
353
-
354
- .asc_descriptions .ant-descriptions-item-content {
355
- width: 80%;
356
- }
357
-
358
- .certain-category-search-wrapper {
359
- margin-bottom: -4rem;
360
- text-align: center;
361
- }
362
-
363
- #addressSearchCombobox {
364
-
365
- .certain-category-search-dropdown .ant-select-dropdown-menu-item-group-title {
366
- color: #666;
367
- font-weight: bold;
368
- font-size: 14px;
369
- }
370
-
371
- .certain-category-search-dropdown .ant-select-dropdown-menu-item-group {
372
- border-bottom: 1px solid #f6f6f6;
373
- }
374
-
375
- .certain-category-search-dropdown .ant-select-dropdown-menu-item {
376
- padding-left: 16px;
377
- }
378
-
379
- .certain-category-search-dropdown .ant-select-dropdown-menu-item.show-all {
380
- text-align: center;
381
- cursor: default;
382
- }
383
-
384
- .certain-category-search-dropdown .ant-select-dropdown-menu {
385
- max-height: 300px;
386
- }
387
-
388
- .certain-category-search-wrapper .certain-search-item-count {
389
- position: absolute;
390
- color: #999;
391
- right: 16px;
392
- }
393
-
394
- .certain-category-search-wrapper .certain-category-search.ant-select-focused,
395
- .certain-category-icon {
396
- color: #108ee9;
397
- }
398
-
399
- .certain-category-search-wrapper .certain-category-icon {
400
- color: #6e6e6e;
401
- transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
402
- font-size: 16px;
403
- }
404
-
405
- .addressName {
406
- margin-bottom: 0;
407
- font-size: 14px;
408
- font-weight: bold;
409
- }
410
-
411
- .addressRemark {
412
- margin-bottom: 0;
413
- font-size: 12px;
414
- }
415
- }
416
- </style>
1
+ <template>
2
+ <div id="addressSearchCombobox">
3
+ <div style="display: flex; width: 100%;">
4
+ <a-input-group style="flex: 1; display: flex;" compact>
5
+ <a-input
6
+ v-model="addressInput"
7
+ :read-only="readOnly || !this.addressObj.address"
8
+ @change="change"
9
+ style="flex: 1; min-width: 0;"
10
+ placeholder="请选择地址信息"/>
11
+ <a-button
12
+ v-if="attr?.inputOnAfterName && attr?.inputOnAfterFunc"
13
+ style="min-width: 4rem; max-width: 6rem;"
14
+ type="primary"
15
+ @click="emitFunc(attr?.inputOnAfterFunc, addressInput)">
16
+ {{ attr?.inputOnAfterName }}
17
+ </a-button>
18
+ </a-input-group>
19
+ <a-button
20
+ style="flex-shrink: 0; margin-left: 0.2rem;"
21
+ :type="attr?.inputOnAfterName ? 'primary' : ''"
22
+ @click="visible = true">
23
+ <img src="./ic_map.svg" class="address_btn_logo" alt=" ">
24
+ 定位
25
+ </a-button>
26
+ </div>
27
+ <a-modal
28
+ v-model="visible"
29
+ title="地址选择"
30
+ @ok="selected"
31
+ :zIndex="m_index"
32
+ :destroyOnClose="true">
33
+ <div class="certain-category-search-wrapper">
34
+ <a-auto-complete
35
+ style="right: 0px;width: 90%;z-index:2;margin-top:2%;"
36
+ :disabled="!mapAutocomplete"
37
+ class="certain-category-search"
38
+ dropdown-class-name="certain-category-search-dropdown"
39
+ option-label-prop="value"
40
+ placeholder="输入地址关键字搜索"
41
+ @search="fetchFunction"
42
+ @select="onSelect"
43
+ >
44
+ <a-spin v-if="searching" slot="notFoundContent" size="small"/>
45
+ <template slot="dataSource">
46
+ <a-select-opt-group v-for="group in option" :key="group.title">
47
+ <span
48
+ slot="label">
49
+ <a-icon type="bank"/> {{ group.title }}
50
+ </span>
51
+ <a-select-option v-for="address in group.children" :key="address.label + ' <' + address.value + '>'">
52
+ <p class="addressName">
53
+ <a-icon type="environment"/>
54
+ <span v-html="highLight(address.label, address.word)"></span></p>
55
+ <p v-if="address.address !== '[]'" class="addressRemark">
56
+ {{ address.address }}
57
+ </p>
58
+ </a-select-option>
59
+ </a-select-opt-group>
60
+ </template>
61
+ <a-input>
62
+ <a-icon slot="suffix" class="certain-category-icon" type="search"/>
63
+ </a-input>
64
+ </a-auto-complete>
65
+ </div>
66
+ <div id="addressSearchCombobox_map"/>
67
+ <a-descriptions
68
+ bordered
69
+ class="asc_descriptions"
70
+ :column="{ xxl: 2, xl: 2, lg: 2, md: 2, sm: 1, xs: 1 }"
71
+ >
72
+ <a-descriptions-item label="坐标" span="2"><span>{{ addressObj.lng_lat }}</span></a-descriptions-item>
73
+ <a-descriptions-item label="地址" span="2"><span>{{ addressObj.address }}</span></a-descriptions-item>
74
+ </a-descriptions>
75
+ </a-modal>
76
+ <!-- -->
77
+ </div>
78
+ </template>
79
+ <script>
80
+
81
+ import { GetGDMap } from '@vue2-client/utils/map-utils'
82
+ import { debounce } from 'ant-design-vue/lib/vc-table/src/utils'
83
+ import { mapState } from 'vuex'
84
+ import { runLogic } from '@vue2-client/services/api/common'
85
+
86
+ export default {
87
+ name: 'AddressSearchCombobox',
88
+ data () {
89
+ // 检索去抖
90
+ this.fetchFunction = debounce(this.fetchFunction, 300)
91
+ return {
92
+ // 地址搜索联想
93
+ mapAutocomplete: undefined,
94
+ // 检索结果
95
+ option: [],
96
+ // 最后检索版本
97
+ lastFetchId: 0,
98
+ // 检索中
99
+ searching: false,
100
+ addressObj: {
101
+ lng_lat: '',
102
+ address: '',
103
+ },
104
+ visible: false,
105
+ map: null,
106
+ m_index: 1002,
107
+ positionPicker: null,
108
+ addressInput: this.searchResult,
109
+ // 选择地址返回的行政区域
110
+ divisions: {},
111
+ // 生成地址串中省市区街道信息禁止修改
112
+ readOnlyDivisions: false,
113
+ // cur 位置
114
+ curPosition: null
115
+ }
116
+ },
117
+ computed: {
118
+ ...mapState('setting', ['isMobile', 'gaode_key', 'gaode_secret_key'])
119
+ },
120
+ props: {
121
+ attr: {
122
+ type: Object,
123
+ default: () => {
124
+ }
125
+ },
126
+ emitFunc: {
127
+ type: Function,
128
+ default: () => {
129
+ }
130
+ },
131
+ searchResult: {
132
+ type: String,
133
+ default: undefined
134
+ },
135
+ // 返回数据格式
136
+ searchResultType: {
137
+ type: String,
138
+ default: 'Default'
139
+ // default: 'Array'
140
+ // default: 'Object'
141
+ },
142
+ // Object 返回格式时 可以自定义key
143
+ resultKeys: {
144
+ type: Object,
145
+ default: () => {
146
+ return { address: 'address', coords: 'coords' }
147
+ }
148
+ },
149
+ readOnly: {
150
+ type: Boolean,
151
+ default: false
152
+ },
153
+ // 省市区是否可以修改
154
+ divisionsChange: {
155
+ type: Boolean,
156
+ default: false
157
+ },
158
+ },
159
+ created () {
160
+ },
161
+ mounted () {
162
+ },
163
+ methods: {
164
+ change (value) {
165
+ if (this.readOnlyDivisions && !this.divisionsChange) {
166
+ // 如果省市区街道信息禁止修改
167
+ if (this.divisions.str && !this.addressInput.startsWith(this.divisions.str)) {
168
+ this.addressInput = this.addressObj.address
169
+ this.$message.info('省市区街道信息请从选择新地址以变更')
170
+ return
171
+ }
172
+ }
173
+ debounce(() => {
174
+ this.selected(null, this.addressInput)
175
+ }, 200)()
176
+ },
177
+ initMap (aMap) {
178
+ this.map = new (aMap).Map('addressSearchCombobox_map', { // 设置地图容器id
179
+ resizeEnable: true, // 是否监控地图容器尺寸变化
180
+ zoom: 10, // 初始化地图层级
181
+ })
182
+ this.geocoder = new (aMap).Geocoder({
183
+ radius: 500 // 范围,默认:500
184
+ })
185
+ this.map.addControl(new (aMap).ToolBar()) // 初始化工具插件
186
+ // 初始化窗体
187
+ /* this.infoWindow = new (aMap).InfoWindow({
188
+ anchor: 'bottom-center',
189
+ isCustom: false, // 使用自定义窗体
190
+ autoMove: true,
191
+ content: '',
192
+ showShadow: true,
193
+ offset: new (aMap).Pixel(0, -25)
194
+ }) */
195
+ },
196
+ onSelect (value) {
197
+ console.log(' value--- ', this.searchResult)
198
+ const _arr = value.replace('>', '').split('<')
199
+ this.addressObj.address = _arr[0]
200
+ this.addressObj.lng_lat = _arr[1]
201
+ this.map.setCenter(this.addressObj.lng_lat.split(','))
202
+ },
203
+ selected (_value, _addstr) {
204
+ let result
205
+ if (this.searchResultType !== 'Default') {
206
+ if (this.searchResultType === 'Array') {
207
+ result = [_addstr || this.addressObj.address, this.addressObj.lng_lat]
208
+ } else {
209
+ result = {}
210
+ result[this.resultKeys.address] = _addstr || this.addressObj.address
211
+ result[this.resultKeys.coords] = this.addressObj.lng_lat
212
+ }
213
+ }
214
+ this.visible = false
215
+ this.$emit('onSelect', JSON.stringify(result))
216
+ // 如果传递了地址 是为了更新上级 不做省市区检验处理
217
+ if (!_addstr) {
218
+ this.addressInput = this.addressObj.address
219
+ this.$emit('onDivisionsChange', Object.assign({}, result, { divisions: this.divisions, vm: this }))
220
+ }
221
+ },
222
+ // 懒加载检索方法
223
+ fetchFunction (value) {
224
+ if (value && this.mapAutocomplete) {
225
+ this.searching = true
226
+ this.lastFetchId += 1
227
+ const fetchId = this.lastFetchId
228
+ this.mapAutocomplete.search(value, (status, result) => {
229
+ if (fetchId !== this.lastFetchId) {
230
+ return
231
+ }
232
+ if (status === 'complete') {
233
+ this.option = []
234
+ const addressMap = {}
235
+ const addressDisMap = {}
236
+ result.tips.forEach((res) => {
237
+ if (res.location) {
238
+ if (!Object.prototype.hasOwnProperty.call(addressMap, res.district)) {
239
+ addressMap[res.district] = []
240
+ }
241
+ const msgData = {
242
+ label: res.name,
243
+ value: res.location.lng + ',' + res.location.lat,
244
+ address: res.address + '',
245
+ word: value
246
+ }
247
+ const p1 = [this.curPosition.lng, this.curPosition.lat]
248
+ const p2 = [res.location.lng, res.location.lat]
249
+ // 判断与当前位置的距离
250
+ let dis = 0
251
+ try {
252
+ // eslint-disable-next-line
253
+ dis = AMap.GeometryUtil.distance(p1, p2)
254
+ } catch (e) {
255
+ console.log(e)
256
+ }
257
+ addressDisMap[res.district] = {}
258
+ addressDisMap[res.district].dis = dis
259
+ addressMap[res.district].push(msgData)
260
+ }
261
+ })
262
+ for (const key of Object.keys(addressMap)) {
263
+ this.option.push({
264
+ title: key,
265
+ dis: addressDisMap[key].dis,
266
+ children: addressMap[key]
267
+ })
268
+ }
269
+ // 根据 dis 排序
270
+ this.option.sort((a, b) => {
271
+ return a.dis - b.dis
272
+ })
273
+ }
274
+ this.searching = false
275
+ })
276
+ }
277
+ },
278
+ // 获取数据
279
+ getData (value, callback) {
280
+ if (value !== '') {
281
+ const logicName = this.attr.keyName
282
+ const logic = logicName.substring(6)
283
+ runLogic(logic, value, 'af-system').then(res => {
284
+ callback(res)
285
+ })
286
+ }
287
+ },
288
+ // 关键字高亮
289
+ highLight (value, word) {
290
+ // 如果标题中包含,关键字就替换一下
291
+ if (value.includes(word)) {
292
+ value = value.replace(word,
293
+ // 这里是替换成html格式的数据,最好再加一个样式权重,保险一点
294
+ '<span style="color:red!important;">' + word + '</span>'
295
+ )
296
+ return value
297
+ // eslint-disable-next-line brace-style
298
+ }
299
+ // 不包含的话还用这个
300
+ else {
301
+ return value
302
+ }
303
+ }
304
+ },
305
+ watch: {
306
+ 'visible' (val) {
307
+ if (val) {
308
+ this.$nextTick(() => {
309
+ GetGDMap(this.gaode_secret_key, this.gaode_key).then(aMap => {
310
+ this.initMap(aMap)
311
+ this.mapAutocomplete = new (aMap).AutoComplete({
312
+ // city 限定城市,默认全国
313
+ city: '全国',
314
+ dragEnable: true,
315
+ animateEnable: false
316
+ })
317
+ this.positionPicker = new window.AMapUI.PositionPicker({
318
+ mode: 'dragMap',
319
+ map: this.map
320
+ })
321
+ this.positionPicker.on('success', (positionResult) => {
322
+ console.log(positionResult)
323
+ console.log(positionResult.position)
324
+ this.curPosition = positionResult.position
325
+ // 设置 行政区划信息
326
+ if (positionResult?.regeocode?.addressComponent) {
327
+ const { addressComponent } = positionResult?.regeocode
328
+ this.divisions.province = addressComponent.province
329
+ this.divisions.city = addressComponent.city
330
+ this.divisions.district = addressComponent.district
331
+ this.divisions.township = addressComponent.township
332
+ this.divisions.towncode = addressComponent.towncode
333
+ this.divisions.street = addressComponent.street
334
+ // 试着获取小区
335
+ if (positionResult?.regeocode?.aois && positionResult?.regeocode?.aois.length) {
336
+ // 取第一个当做小区
337
+ this.divisions.area = positionResult?.regeocode?.aois[0]?.name
338
+ } else if (positionResult?.regeocode?.pois && positionResult?.regeocode?.pois.length) {
339
+ // 取第一个当做小区
340
+ this.divisions.area = positionResult?.regeocode?.pois[0]?.name
341
+ }
342
+ this.divisions.str =
343
+ `${addressComponent.province}${addressComponent.city}${addressComponent.district}${addressComponent.township}`
344
+ }
345
+ if (this.divisions.str && positionResult.address.startsWith(this.divisions.str)) {
346
+ // 如果 省市区信息和获取到的地址的前缀一致 那么省市区前缀禁止修改只能修改后面的 通过 onchange事件拦截
347
+ this.readOnlyDivisions = true
348
+ }
349
+ this.addressObj.address = positionResult.address
350
+ this.addressObj.lng_lat = `${positionResult.position.lng},${positionResult.position.lat}`
351
+ })
352
+ this.positionPicker.on('fail', function (positionResult) {
353
+ })
354
+ this.positionPicker.start()
355
+ })
356
+ })
357
+ }
358
+ }
359
+ }
360
+ }
361
+ </script>
362
+
363
+ <style lang="less" scoped>
364
+ #addressSearchCombobox_map {
365
+ margin: 1% 0;
366
+ width: 100%;
367
+ height: 400px;
368
+ text-align: center
369
+ }
370
+
371
+ .address_btn_logo {
372
+ width: 1rem;
373
+ margin-right: 0.5rem
374
+ }
375
+
376
+ .asc_descriptions .ant-descriptions-item-content {
377
+ width: 80%;
378
+ }
379
+
380
+ .certain-category-search-wrapper {
381
+ margin-bottom: -4rem;
382
+ text-align: center;
383
+ }
384
+
385
+ #addressSearchCombobox {
386
+
387
+ .certain-category-search-dropdown .ant-select-dropdown-menu-item-group-title {
388
+ color: #666;
389
+ font-weight: bold;
390
+ font-size: 14px;
391
+ }
392
+
393
+ .certain-category-search-dropdown .ant-select-dropdown-menu-item-group {
394
+ border-bottom: 1px solid #f6f6f6;
395
+ }
396
+
397
+ .certain-category-search-dropdown .ant-select-dropdown-menu-item {
398
+ padding-left: 16px;
399
+ }
400
+
401
+ .certain-category-search-dropdown .ant-select-dropdown-menu-item.show-all {
402
+ text-align: center;
403
+ cursor: default;
404
+ }
405
+
406
+ .certain-category-search-dropdown .ant-select-dropdown-menu {
407
+ max-height: 300px;
408
+ }
409
+
410
+ .certain-category-search-wrapper .certain-search-item-count {
411
+ position: absolute;
412
+ color: #999;
413
+ right: 16px;
414
+ }
415
+
416
+ .certain-category-search-wrapper .certain-category-search.ant-select-focused,
417
+ .certain-category-icon {
418
+ color: #108ee9;
419
+ }
420
+
421
+ .certain-category-search-wrapper .certain-category-icon {
422
+ color: #6e6e6e;
423
+ transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
424
+ font-size: 16px;
425
+ }
426
+
427
+ .addressName {
428
+ margin-bottom: 0;
429
+ font-size: 14px;
430
+ font-weight: bold;
431
+ }
432
+
433
+ .addressRemark {
434
+ margin-bottom: 0;
435
+ font-size: 12px;
436
+ }
437
+ }
438
+ </style>