vue2-client 1.6.14 → 1.6.16

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 (102) hide show
  1. package/CHANGELOG.md +562 -555
  2. package/index.js +30 -30
  3. package/package.json +78 -78
  4. package/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox.vue +226 -226
  5. package/src/base-client/components/common/CitySelect/CitySelect.vue +247 -247
  6. package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +733 -733
  7. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQueryItem.vue +508 -508
  8. package/src/base-client/components/common/FormGroupEdit/FormGroupEdit.vue +140 -140
  9. package/src/base-client/components/common/FormGroupQuery/FormGroupQuery.vue +165 -165
  10. package/src/base-client/components/common/JSONToTree/jsontotree.vue +275 -275
  11. package/src/base-client/components/common/XAddForm/XAddForm.vue +326 -326
  12. package/src/base-client/components/common/XCard/XCard.vue +64 -64
  13. package/src/base-client/components/common/XForm/XForm.vue +180 -180
  14. package/src/base-client/components/common/XFormTable/XFormTable.vue +336 -334
  15. package/src/base-client/components/common/XFormTable/index.md +97 -97
  16. package/src/base-client/components/common/XTreeOne/XTreeOne.vue +109 -109
  17. package/src/base-client/components/system/QueryParamsDetailsView/QueryParamsDetailsView.vue +281 -281
  18. package/src/base-client/components/ticket/TicketDetailsView/TicketDetailsView.vue +807 -807
  19. package/src/base-client/components/ticket/TicketDetailsView/index.md +29 -29
  20. package/src/base-client/components/ticket/TicketDetailsView/part/TicketDetailsFlow.vue +260 -260
  21. package/src/base-client/components/ticket/TicketSubmitSuccessView/TicketSubmitSuccessView.vue +532 -532
  22. package/src/base-client/components/ticket/TicketSubmitSuccessView/index.md +29 -29
  23. package/src/base-client/plugins/AppData.js +76 -76
  24. package/src/base-client/plugins/GetLoginInfoService.js +179 -179
  25. package/src/base-client/plugins/PagedList.js +177 -177
  26. package/src/base-client/plugins/compatible/LoginServiceOA.js +20 -20
  27. package/src/base-client/plugins/i18n-extend.js +32 -32
  28. package/src/components/Ellipsis/Ellipsis.vue +65 -65
  29. package/src/components/Ellipsis/index.md +38 -38
  30. package/src/components/NumberInfo/index.md +43 -43
  31. package/src/components/STable/README.md +341 -341
  32. package/src/components/STable/index.js +318 -318
  33. package/src/components/Trend/index.md +45 -45
  34. package/src/components/checkbox/ColorCheckbox.vue +157 -157
  35. package/src/components/checkbox/ImgCheckbox.vue +163 -163
  36. package/src/components/exception/ExceptionPage.vue +70 -70
  37. package/src/components/form/FormRow.vue +52 -52
  38. package/src/components/index.js +36 -36
  39. package/src/components/menu/SideMenu.vue +62 -62
  40. package/src/components/menu/menu.js +273 -273
  41. package/src/components/page/header/index.less +40 -40
  42. package/src/components/setting/Setting.vue +235 -235
  43. package/src/components/table/StandardTable.vue +141 -141
  44. package/src/components/table/advance/ActionColumns.vue +158 -158
  45. package/src/components/table/advance/SearchArea.vue +355 -355
  46. package/src/components/tool/AStepItem.vue +60 -60
  47. package/src/components/tool/AvatarList.vue +68 -68
  48. package/src/components/tool/Drawer.vue +142 -142
  49. package/src/components/tool/TagSelect.vue +83 -83
  50. package/src/components/transition/PageToggleTransition.vue +97 -97
  51. package/src/config/default/admin.config.js +18 -18
  52. package/src/config/default/setting.config.js +44 -44
  53. package/src/config/replacer/resolve.config.js +67 -67
  54. package/src/layouts/CommonLayout.vue +42 -42
  55. package/src/layouts/ComponentLayoutOne.vue +47 -47
  56. package/src/layouts/PageLayout.vue +151 -151
  57. package/src/layouts/SinglePageView.vue +111 -111
  58. package/src/layouts/footer/PageFooter.vue +49 -49
  59. package/src/layouts/header/AdminHeader.vue +104 -104
  60. package/src/layouts/header/HeaderAvatar.vue +64 -64
  61. package/src/layouts/header/HeaderNotice.vue +176 -176
  62. package/src/layouts/header/HeaderSearch.vue +67 -67
  63. package/src/layouts/header/InstitutionDetail.vue +181 -181
  64. package/src/layouts/header/index.less +92 -92
  65. package/src/layouts/tabs/TabsHead.vue +190 -190
  66. package/src/layouts/tabs/TabsView.vue +379 -379
  67. package/src/mock/goods/index.js +108 -108
  68. package/src/pages/exception/404.vue +25 -25
  69. package/src/pages/login/Login.vue +363 -363
  70. package/src/pages/report/ReportTable.js +124 -124
  71. package/src/pages/report/ReportTableHome.vue +28 -28
  72. package/src/pages/resourceManage/orgListManage.vue +98 -98
  73. package/src/pages/system/file/index.vue +317 -317
  74. package/src/pages/system/settings/index.vue +126 -126
  75. package/src/pages/system/settings/modifyPassword.vue +109 -109
  76. package/src/router/async/config.async.js +28 -28
  77. package/src/router/async/router.map.js +68 -68
  78. package/src/router/index.js +27 -27
  79. package/src/services/api/DictionaryDetailsViewApi.js +6 -6
  80. package/src/services/api/LogDetailsViewApi.js +10 -10
  81. package/src/services/api/QueryParamsDetailsViewApi.js +6 -6
  82. package/src/services/api/TicketDetailsViewApi.js +34 -34
  83. package/src/services/api/cas.js +79 -79
  84. package/src/services/api/commonTempTable.js +10 -10
  85. package/src/services/api/index.js +17 -17
  86. package/src/services/api/logininfor/index.js +6 -6
  87. package/src/services/api/manage.js +8 -8
  88. package/src/services/apiService.js +14 -14
  89. package/src/services/user.js +64 -64
  90. package/src/store/modules/index.js +4 -4
  91. package/src/theme/default/nprogress.less +76 -76
  92. package/src/theme/default/style.less +47 -47
  93. package/src/utils/colors.js +107 -107
  94. package/src/utils/excel/Blob.js +180 -180
  95. package/src/utils/excel/Export2Excel.js +141 -141
  96. package/src/utils/formatter.js +68 -68
  97. package/src/utils/i18n.js +80 -80
  98. package/src/utils/request.js +311 -311
  99. package/src/utils/theme-color-replacer-extend.js +91 -91
  100. package/src/utils/themeUtil.js +100 -100
  101. package/src/utils/util.js +230 -230
  102. package/vue.config.js +106 -106
package/index.js CHANGED
@@ -1,30 +1,30 @@
1
- import Vue from 'vue'
2
- import { initRouter } from '@vue2-client/router'
3
- import { initI18n } from '@vue2-client/utils/i18n'
4
- import bootstrap from '@vue2-client/bootstrap'
5
- import { modules } from '@vue2-client/store'
6
- import '@vue2-client/theme/index.less'
7
- import '@vue2-client/utils/filter'
8
- import 'animate.css/source/animate.css'
9
- import 'moment/locale/zh-cn'
10
- import Antd from 'ant-design-vue'
11
- import Viser from 'viser-vue'
12
- // 插件
13
- import Plugins from '@vue2-client/base-client/plugins'
14
-
15
- const routerOptions = initRouter()
16
- const i18n = initI18n('CN', 'US')
17
-
18
- Vue.use(Antd)
19
- Vue.use(Viser)
20
- Vue.use(Plugins)
21
- Vue.config.productionTip = false
22
- const message = Vue.prototype.$message
23
-
24
- export {
25
- routerOptions,
26
- modules,
27
- i18n,
28
- message,
29
- bootstrap
30
- }
1
+ import Vue from 'vue'
2
+ import { initRouter } from '@vue2-client/router'
3
+ import { initI18n } from '@vue2-client/utils/i18n'
4
+ import bootstrap from '@vue2-client/bootstrap'
5
+ import { modules } from '@vue2-client/store'
6
+ import '@vue2-client/theme/index.less'
7
+ import '@vue2-client/utils/filter'
8
+ import 'animate.css/source/animate.css'
9
+ import 'moment/locale/zh-cn'
10
+ import Antd from 'ant-design-vue'
11
+ import Viser from 'viser-vue'
12
+ // 插件
13
+ import Plugins from '@vue2-client/base-client/plugins'
14
+
15
+ const routerOptions = initRouter()
16
+ const i18n = initI18n('CN', 'US')
17
+
18
+ Vue.use(Antd)
19
+ Vue.use(Viser)
20
+ Vue.use(Plugins)
21
+ Vue.config.productionTip = false
22
+ const message = Vue.prototype.$message
23
+
24
+ export {
25
+ routerOptions,
26
+ modules,
27
+ i18n,
28
+ message,
29
+ bootstrap
30
+ }
package/package.json CHANGED
@@ -1,78 +1,78 @@
1
- {
2
- "name": "vue2-client",
3
- "version": "1.6.14",
4
- "private": false,
5
- "scripts": {
6
- "serve": "vue-cli-service serve",
7
- "build": "vue-cli-service build",
8
- "test:unit": "vue-cli-service test:unit",
9
- "lint": "vue-cli-service lint",
10
- "build:preview": "vue-cli-service build --mode preview",
11
- "lint:nofix": "vue-cli-service lint --no-fix"
12
- },
13
- "dependencies": {
14
- "@amap/amap-jsapi-loader": "^1.0.1",
15
- "@antv/g2plot": "^2.4.20",
16
- "lodash.get": "^4.4.2",
17
- "js-base64": "^3.7.2",
18
- "jsencrypt": "^3.2.1",
19
- "vue-json-viewer": "^2.2.22",
20
- "xlsx": "0.18.5",
21
- "file-saver": "^2.0.5",
22
- "@vue/babel-preset-jsx": "^1.4.0",
23
- "@antv/data-set": "^0.11.8",
24
- "animate.css": "^4.1.1",
25
- "ant-design-vue": "^1.7.8",
26
- "axios": "^0.27.2",
27
- "clipboard": "^2.0.11",
28
- "core-js": "^3.23.5",
29
- "date-fns": "^2.28.0",
30
- "default-passive-events": "^2.0.0",
31
- "enquire.js": "^2.1.6",
32
- "highlight.js": "^10.7.3",
33
- "js-cookie": "^2.2.1",
34
- "mockjs": "^1.1.0",
35
- "nprogress": "^0.2.0",
36
- "viser-vue": "^2.4.8",
37
- "vue": "2.6.14",
38
- "vue-i18n": "^8.27.2",
39
- "vue-router": "^3.5.4",
40
- "vuedraggable": "^2.24.3",
41
- "vuex": "^3.6.2"
42
- },
43
- "devDependencies": {
44
- "script-loader": "^0.7.2",
45
- "@ant-design/colors": "^6.0.0",
46
- "@babel/core": "^7.18.10",
47
- "@vue/cli-plugin-babel": "^4.5.19",
48
- "@vue/cli-plugin-eslint": "^4.5.19",
49
- "@vue/cli-service": "^4.5.19",
50
- "@vue/eslint-config-standard": "^4.0.0",
51
- "@vuepress/plugin-back-to-top": "^1.9.7",
52
- "babel-eslint": "^10.1.0",
53
- "babel-plugin-transform-remove-console": "^6.9.4",
54
- "babel-polyfill": "^6.26.0",
55
- "compression-webpack-plugin": "^4.0.1",
56
- "deepmerge": "^4.2.2",
57
- "eslint": "^6.8.0",
58
- "eslint-plugin-import": "^2.26.0",
59
- "eslint-plugin-node": "^11.1.0",
60
- "eslint-plugin-vue": "^6.2.2",
61
- "eslint-plugin-promise": "^4.3.1",
62
- "eslint-plugin-standard": "^4.1.0",
63
- "fast-deep-equal": "^3.1.3",
64
- "less-loader": "^6.2.0",
65
- "style-resources-loader": "^1.5.0",
66
- "vue-cli-plugin-style-resources-loader": "^0.1.5",
67
- "vue-template-compiler": "2.6.14",
68
- "vuepress": "^1.9.7",
69
- "webpack": "^4.46.0",
70
- "webpack-theme-color-replacer": "1.4.1",
71
- "whatwg-fetch": "^3.6.2"
72
- },
73
- "browserslist": [
74
- "> 1%",
75
- "last 2 versions",
76
- "not ie <= 10"
77
- ]
78
- }
1
+ {
2
+ "name": "vue2-client",
3
+ "version": "1.6.16",
4
+ "private": false,
5
+ "scripts": {
6
+ "serve": "vue-cli-service serve",
7
+ "build": "vue-cli-service build",
8
+ "test:unit": "vue-cli-service test:unit",
9
+ "lint": "vue-cli-service lint",
10
+ "build:preview": "vue-cli-service build --mode preview",
11
+ "lint:nofix": "vue-cli-service lint --no-fix"
12
+ },
13
+ "dependencies": {
14
+ "@amap/amap-jsapi-loader": "^1.0.1",
15
+ "@antv/g2plot": "^2.4.25",
16
+ "lodash.get": "^4.4.2",
17
+ "js-base64": "^3.7.2",
18
+ "jsencrypt": "^3.2.1",
19
+ "vue-json-viewer": "^2.2.22",
20
+ "xlsx": "0.18.5",
21
+ "file-saver": "^2.0.5",
22
+ "@vue/babel-preset-jsx": "^1.4.0",
23
+ "@antv/data-set": "^0.11.8",
24
+ "animate.css": "^4.1.1",
25
+ "ant-design-vue": "^1.7.8",
26
+ "axios": "^0.27.2",
27
+ "clipboard": "^2.0.11",
28
+ "core-js": "^3.23.5",
29
+ "date-fns": "^2.28.0",
30
+ "default-passive-events": "^2.0.0",
31
+ "enquire.js": "^2.1.6",
32
+ "highlight.js": "^10.7.3",
33
+ "js-cookie": "^2.2.1",
34
+ "mockjs": "^1.1.0",
35
+ "nprogress": "^0.2.0",
36
+ "viser-vue": "^2.4.8",
37
+ "vue": "2.6.14",
38
+ "vue-i18n": "^8.27.2",
39
+ "vue-router": "^3.5.4",
40
+ "vuedraggable": "^2.24.3",
41
+ "vuex": "^3.6.2"
42
+ },
43
+ "devDependencies": {
44
+ "script-loader": "^0.7.2",
45
+ "@ant-design/colors": "^6.0.0",
46
+ "@babel/core": "^7.18.10",
47
+ "@vue/cli-plugin-babel": "^4.5.19",
48
+ "@vue/cli-plugin-eslint": "^4.5.19",
49
+ "@vue/cli-service": "^4.5.19",
50
+ "@vue/eslint-config-standard": "^4.0.0",
51
+ "@vuepress/plugin-back-to-top": "^1.9.7",
52
+ "babel-eslint": "^10.1.0",
53
+ "babel-plugin-transform-remove-console": "^6.9.4",
54
+ "babel-polyfill": "^6.26.0",
55
+ "compression-webpack-plugin": "^4.0.1",
56
+ "deepmerge": "^4.2.2",
57
+ "eslint": "^6.8.0",
58
+ "eslint-plugin-import": "^2.26.0",
59
+ "eslint-plugin-node": "^11.1.0",
60
+ "eslint-plugin-vue": "^6.2.2",
61
+ "eslint-plugin-promise": "^4.3.1",
62
+ "eslint-plugin-standard": "^4.1.0",
63
+ "fast-deep-equal": "^3.1.3",
64
+ "less-loader": "^6.2.0",
65
+ "style-resources-loader": "^1.5.0",
66
+ "vue-cli-plugin-style-resources-loader": "^0.1.5",
67
+ "vue-template-compiler": "2.6.14",
68
+ "vuepress": "^1.9.7",
69
+ "webpack": "^4.46.0",
70
+ "webpack-theme-color-replacer": "1.4.1",
71
+ "whatwg-fetch": "^3.6.2"
72
+ },
73
+ "browserslist": [
74
+ "> 1%",
75
+ "last 2 versions",
76
+ "not ie <= 10"
77
+ ]
78
+ }
@@ -1,226 +1,226 @@
1
- <template>
2
- <div class="certain-category-search-wrapper">
3
- <a-auto-complete
4
- style="right: -12px"
5
- :disabled="!mapAutocomplete"
6
- :dropdown-match-select-width="false"
7
- :dropdown-style="{ width: '400px' }"
8
- class="certain-category-search"
9
- dropdown-class-name="certain-category-search-dropdown"
10
- option-label-prop="value"
11
- placeholder="输入地址关键字搜索"
12
- @search="fetchFunction"
13
- @select="onSelect"
14
- >
15
- <a-spin v-if="searching" slot="notFoundContent" size="small" />
16
- <template slot="dataSource">
17
- <a-select-opt-group v-for="group in option" :key="group.title">
18
- <span
19
- slot="label">
20
- <a-icon type="bank" /> {{ group.title }}
21
- </span>
22
- <a-select-option v-for="address in group.children" :key="address.label + ' <' + address.value + '>'">
23
- <p class="addressName"><a-icon type="environment" /> <span v-html="highLight(address.label, address.word)">{{ address.label }}</span></p>
24
- <p v-if="address.address !== '[]'" class="addressRemark">
25
- {{ address.address }}
26
- </p>
27
- </a-select-option>
28
- </a-select-opt-group>
29
- </template>
30
- <a-input>
31
- <a-icon slot="suffix" class="certain-category-icon" type="search"/>
32
- </a-input>
33
- </a-auto-complete>
34
- </div>
35
- </template>
36
- <script>
37
-
38
- import { post } from '@vue2-client/services/api'
39
- import { GetGDMap } from '@vue2-client/utils/map-utils'
40
- import { debounce } from 'ant-design-vue/lib/vc-table/src/utils'
41
-
42
- export default {
43
- name: 'AddressSearchCombobox',
44
- data () {
45
- // 检索去抖
46
- this.fetchFunction = debounce(this.fetchFunction, 300)
47
- return {
48
- // 地址搜索联想
49
- mapAutocomplete: undefined,
50
- // 检索结果
51
- option: [],
52
- // 最后检索版本
53
- lastFetchId: 0,
54
- // 检索中
55
- searching: false
56
- }
57
- },
58
- model: {
59
- prop: 'searchResult',
60
- event: 'onSelect'
61
- },
62
- props: {
63
- searchResult: {
64
- type: String,
65
- default: undefined
66
- },
67
- // 返回数据格式
68
- searchResultType: {
69
- type: String,
70
- default: 'Default'
71
- // default: 'Array'
72
- // default: 'Object'
73
- },
74
- // Object 返回格式时 可以自定义key
75
- resultKeys: {
76
- type: Object,
77
- default: () => { return { address: 'address', coords: 'coords' } }
78
- }
79
- },
80
- created () {
81
- },
82
- mounted () {
83
- GetGDMap().then(aMap => {
84
- this.mapAutocomplete = new (aMap).Autocomplete({})
85
- })
86
- },
87
- methods: {
88
- onSelect (value) {
89
- let result
90
- if (this.searchResultType !== 'Default') {
91
- const _arr = value.replace('>', '').split('<')
92
- if (this.searchResultType === 'Array') {
93
- result = _arr
94
- } else {
95
- result = {}
96
- result[this.resultKeys.address] = _arr[0]
97
- result[this.resultKeys.coords] = _arr[1]
98
- }
99
- }
100
- this.$emit('onSelect', JSON.stringify(result) || value)
101
- // this.$emit('onClick', result || value)
102
- },
103
- // 懒加载检索方法
104
- fetchFunction (value) {
105
- if (value && this.mapAutocomplete) {
106
- this.searching = true
107
- this.lastFetchId += 1
108
- const fetchId = this.lastFetchId
109
- this.mapAutocomplete.search(value, (status, result) => {
110
- if (fetchId !== this.lastFetchId) {
111
- return
112
- }
113
- if (status === 'complete') {
114
- this.option = []
115
- const addressMap = {}
116
- result.tips.forEach((res) => {
117
- if (res.location) {
118
- if (!addressMap.hasOwnProperty(res.district)) {
119
- addressMap[res.district] = []
120
- }
121
- addressMap[res.district].push({
122
- label: res.name,
123
- value: res.location.lng + ',' + res.location.lat,
124
- address: res.address + '',
125
- word: value
126
- })
127
- }
128
- })
129
- for (const key of Object.keys(addressMap)) {
130
- this.option.push({
131
- title: key,
132
- children: addressMap[key]
133
- })
134
- }
135
- }
136
- this.searching = false
137
- })
138
- }
139
- },
140
- // 获取数据
141
- getData (value, callback) {
142
- if (value !== '') {
143
- const logicName = this.attr.keyName
144
- const logic = logicName.substring(6)
145
- post('/api/af-system/logic/' + logic, value).then(res => {
146
- callback(res)
147
- })
148
- }
149
- },
150
- // 关键字高亮
151
- highLight (value, word) {
152
- // 如果标题中包含,关键字就替换一下
153
- if (value.includes(word)) {
154
- value = value.replace(word,
155
- // 这里是替换成html格式的数据,最好再加一个样式权重,保险一点
156
- '<span style="color:red!important;">' + word + '</span>'
157
- )
158
- return value
159
- // eslint-disable-next-line brace-style
160
- }
161
- // 不包含的话还用这个
162
- else {
163
- return value
164
- }
165
- }
166
- }
167
- }
168
- </script>
169
-
170
- <style>
171
- .certain-category-search-dropdown .ant-select-dropdown-menu-item-group-title {
172
- color: #666;
173
- font-weight: bold;
174
- font-size: 14px;
175
- }
176
-
177
- .certain-category-search-dropdown .ant-select-dropdown-menu-item-group {
178
- border-bottom: 1px solid #f6f6f6;
179
- }
180
-
181
- .certain-category-search-dropdown .ant-select-dropdown-menu-item {
182
- padding-left: 16px;
183
- }
184
-
185
- .certain-category-search-dropdown .ant-select-dropdown-menu-item.show-all {
186
- text-align: center;
187
- cursor: default;
188
- }
189
-
190
- .certain-category-search-dropdown .ant-select-dropdown-menu {
191
- max-height: 300px;
192
- }
193
- </style>
194
- <style scoped>
195
- .certain-category-search-wrapper,
196
- >>> .certain-category-search.ant-select-auto-complete,
197
- .ant-input-affix-wrapper,
198
- .ant-input-suffix {
199
- right: 12px;
200
- }
201
- .certain-category-search-wrapper >>> .certain-search-item-count {
202
- position: absolute;
203
- color: #999;
204
- right: 16px;
205
- }
206
- .certain-category-search-wrapper >>> .certain-category-search.ant-select-focused,
207
- .certain-category-icon {
208
- color: #108ee9;
209
- }
210
- .certain-category-search-wrapper >>> .certain-category-icon {
211
- color: #6e6e6e;
212
- transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
213
- font-size: 16px;
214
- }
215
-
216
- .addressName {
217
- margin-bottom: 0;
218
- font-size: 14px;
219
- font-weight: bold;
220
- }
221
-
222
- .addressRemark {
223
- margin-bottom: 0;
224
- font-size: 12px;
225
- }
226
- </style>
1
+ <template>
2
+ <div class="certain-category-search-wrapper">
3
+ <a-auto-complete
4
+ style="right: -12px"
5
+ :disabled="!mapAutocomplete"
6
+ :dropdown-match-select-width="false"
7
+ :dropdown-style="{ width: '400px' }"
8
+ class="certain-category-search"
9
+ dropdown-class-name="certain-category-search-dropdown"
10
+ option-label-prop="value"
11
+ placeholder="输入地址关键字搜索"
12
+ @search="fetchFunction"
13
+ @select="onSelect"
14
+ >
15
+ <a-spin v-if="searching" slot="notFoundContent" size="small" />
16
+ <template slot="dataSource">
17
+ <a-select-opt-group v-for="group in option" :key="group.title">
18
+ <span
19
+ slot="label">
20
+ <a-icon type="bank" /> {{ group.title }}
21
+ </span>
22
+ <a-select-option v-for="address in group.children" :key="address.label + ' <' + address.value + '>'">
23
+ <p class="addressName"><a-icon type="environment" /> <span v-html="highLight(address.label, address.word)">{{ address.label }}</span></p>
24
+ <p v-if="address.address !== '[]'" class="addressRemark">
25
+ {{ address.address }}
26
+ </p>
27
+ </a-select-option>
28
+ </a-select-opt-group>
29
+ </template>
30
+ <a-input>
31
+ <a-icon slot="suffix" class="certain-category-icon" type="search"/>
32
+ </a-input>
33
+ </a-auto-complete>
34
+ </div>
35
+ </template>
36
+ <script>
37
+
38
+ import { post } from '@vue2-client/services/api'
39
+ import { GetGDMap } from '@vue2-client/utils/map-utils'
40
+ import { debounce } from 'ant-design-vue/lib/vc-table/src/utils'
41
+
42
+ export default {
43
+ name: 'AddressSearchCombobox',
44
+ data () {
45
+ // 检索去抖
46
+ this.fetchFunction = debounce(this.fetchFunction, 300)
47
+ return {
48
+ // 地址搜索联想
49
+ mapAutocomplete: undefined,
50
+ // 检索结果
51
+ option: [],
52
+ // 最后检索版本
53
+ lastFetchId: 0,
54
+ // 检索中
55
+ searching: false
56
+ }
57
+ },
58
+ model: {
59
+ prop: 'searchResult',
60
+ event: 'onSelect'
61
+ },
62
+ props: {
63
+ searchResult: {
64
+ type: String,
65
+ default: undefined
66
+ },
67
+ // 返回数据格式
68
+ searchResultType: {
69
+ type: String,
70
+ default: 'Default'
71
+ // default: 'Array'
72
+ // default: 'Object'
73
+ },
74
+ // Object 返回格式时 可以自定义key
75
+ resultKeys: {
76
+ type: Object,
77
+ default: () => { return { address: 'address', coords: 'coords' } }
78
+ }
79
+ },
80
+ created () {
81
+ },
82
+ mounted () {
83
+ GetGDMap().then(aMap => {
84
+ this.mapAutocomplete = new (aMap).Autocomplete({})
85
+ })
86
+ },
87
+ methods: {
88
+ onSelect (value) {
89
+ let result
90
+ if (this.searchResultType !== 'Default') {
91
+ const _arr = value.replace('>', '').split('<')
92
+ if (this.searchResultType === 'Array') {
93
+ result = _arr
94
+ } else {
95
+ result = {}
96
+ result[this.resultKeys.address] = _arr[0]
97
+ result[this.resultKeys.coords] = _arr[1]
98
+ }
99
+ }
100
+ this.$emit('onSelect', JSON.stringify(result) || value)
101
+ // this.$emit('onClick', result || value)
102
+ },
103
+ // 懒加载检索方法
104
+ fetchFunction (value) {
105
+ if (value && this.mapAutocomplete) {
106
+ this.searching = true
107
+ this.lastFetchId += 1
108
+ const fetchId = this.lastFetchId
109
+ this.mapAutocomplete.search(value, (status, result) => {
110
+ if (fetchId !== this.lastFetchId) {
111
+ return
112
+ }
113
+ if (status === 'complete') {
114
+ this.option = []
115
+ const addressMap = {}
116
+ result.tips.forEach((res) => {
117
+ if (res.location) {
118
+ if (!addressMap.hasOwnProperty(res.district)) {
119
+ addressMap[res.district] = []
120
+ }
121
+ addressMap[res.district].push({
122
+ label: res.name,
123
+ value: res.location.lng + ',' + res.location.lat,
124
+ address: res.address + '',
125
+ word: value
126
+ })
127
+ }
128
+ })
129
+ for (const key of Object.keys(addressMap)) {
130
+ this.option.push({
131
+ title: key,
132
+ children: addressMap[key]
133
+ })
134
+ }
135
+ }
136
+ this.searching = false
137
+ })
138
+ }
139
+ },
140
+ // 获取数据
141
+ getData (value, callback) {
142
+ if (value !== '') {
143
+ const logicName = this.attr.keyName
144
+ const logic = logicName.substring(6)
145
+ post('/api/af-system/logic/' + logic, value).then(res => {
146
+ callback(res)
147
+ })
148
+ }
149
+ },
150
+ // 关键字高亮
151
+ highLight (value, word) {
152
+ // 如果标题中包含,关键字就替换一下
153
+ if (value.includes(word)) {
154
+ value = value.replace(word,
155
+ // 这里是替换成html格式的数据,最好再加一个样式权重,保险一点
156
+ '<span style="color:red!important;">' + word + '</span>'
157
+ )
158
+ return value
159
+ // eslint-disable-next-line brace-style
160
+ }
161
+ // 不包含的话还用这个
162
+ else {
163
+ return value
164
+ }
165
+ }
166
+ }
167
+ }
168
+ </script>
169
+
170
+ <style>
171
+ .certain-category-search-dropdown .ant-select-dropdown-menu-item-group-title {
172
+ color: #666;
173
+ font-weight: bold;
174
+ font-size: 14px;
175
+ }
176
+
177
+ .certain-category-search-dropdown .ant-select-dropdown-menu-item-group {
178
+ border-bottom: 1px solid #f6f6f6;
179
+ }
180
+
181
+ .certain-category-search-dropdown .ant-select-dropdown-menu-item {
182
+ padding-left: 16px;
183
+ }
184
+
185
+ .certain-category-search-dropdown .ant-select-dropdown-menu-item.show-all {
186
+ text-align: center;
187
+ cursor: default;
188
+ }
189
+
190
+ .certain-category-search-dropdown .ant-select-dropdown-menu {
191
+ max-height: 300px;
192
+ }
193
+ </style>
194
+ <style scoped>
195
+ .certain-category-search-wrapper,
196
+ >>> .certain-category-search.ant-select-auto-complete,
197
+ .ant-input-affix-wrapper,
198
+ .ant-input-suffix {
199
+ right: 12px;
200
+ }
201
+ .certain-category-search-wrapper >>> .certain-search-item-count {
202
+ position: absolute;
203
+ color: #999;
204
+ right: 16px;
205
+ }
206
+ .certain-category-search-wrapper >>> .certain-category-search.ant-select-focused,
207
+ .certain-category-icon {
208
+ color: #108ee9;
209
+ }
210
+ .certain-category-search-wrapper >>> .certain-category-icon {
211
+ color: #6e6e6e;
212
+ transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
213
+ font-size: 16px;
214
+ }
215
+
216
+ .addressName {
217
+ margin-bottom: 0;
218
+ font-size: 14px;
219
+ font-weight: bold;
220
+ }
221
+
222
+ .addressRemark {
223
+ margin-bottom: 0;
224
+ font-size: 12px;
225
+ }
226
+ </style>