vue2-client 1.2.51 → 1.2.54-1
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.
- package/.env +15 -14
- package/.eslintrc.js +82 -82
- package/CHANGELOG.md +5 -0
- package/package.json +1 -1
- package/src/base-client/all.js +64 -61
- package/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox.vue +225 -0
- package/src/base-client/components/common/AddressSearchCombobox/index.js +3 -0
- package/src/base-client/components/common/AmapMarker/AmapPointRendering.vue +111 -107
- package/src/base-client/components/common/CitySelect/CitySelect.vue +244 -0
- package/src/base-client/components/common/CitySelect/index.js +3 -0
- package/src/base-client/components/common/CitySelect/index.md +109 -0
- package/src/base-client/components/common/CreateQuery/CreateQuery.vue +483 -1342
- package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +770 -555
- package/src/base-client/components/common/Upload/Upload.vue +124 -124
- package/src/base-client/components/common/Upload/index.js +3 -3
- package/src/base-client/components/common/XAddForm/XAddForm.vue +38 -46
- package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +316 -316
- package/src/base-client/components/common/XForm/XForm.vue +268 -275
- package/src/base-client/components/common/XForm/XFormItem.vue +346 -285
- package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsException.vue +57 -57
- package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsRead.vue +131 -131
- package/src/base-client/components/iot/WebmeterAnalysisView/WebmeterAnalysisView.vue +205 -205
- package/src/base-client/components/ticket/TicketSubmitSuccessView/TicketSubmitSuccessView.vue +532 -532
- package/src/base-client/plugins/AppData.js +72 -57
- package/src/config/CreateQueryConfig.js +298 -80
- package/src/pages/resourceManage/orgListManage.vue +40 -40
- package/src/router/async/config.async.js +26 -26
- package/src/router/index.js +27 -27
- package/src/services/api/manage.js +16 -14
- package/src/services/api/restTools.js +24 -24
- package/src/theme/default/style.less +47 -47
- package/src/utils/map-utils.js +28 -29
- package/src/utils/request.js +198 -198
- package/src/utils/util.js +222 -176
- package/vue.config.js +2 -2
package/.env
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
VUE_APP_PUBLIC_PATH=/
|
|
2
|
-
VUE_APP_NAME=Admin
|
|
3
|
-
VUE_APP_ROUTES_KEY=admin.routes
|
|
4
|
-
VUE_APP_PERMISSIONS_KEY=admin.permissions
|
|
5
|
-
VUE_APP_ROLES_KEY=admin.roles
|
|
6
|
-
VUE_APP_USER_KEY=admin.user
|
|
7
|
-
VUE_APP_LOGIN_KEY=admin.login
|
|
8
|
-
VUE_APP_SETTING_KEY=admin.setting
|
|
9
|
-
VUE_APP_TBAS_KEY=admin.tabs
|
|
10
|
-
VUE_APP_TBAS_TITLES_KEY=admin.tabs.titles
|
|
11
|
-
VUE_APP_DICTIONARY_KEY=admin.dictionary
|
|
12
|
-
VUE_APP_BADGE_KEY=admin.badge
|
|
13
|
-
VUE_APP_SINGLEVALUE_KEY=admin.singlevalue
|
|
14
|
-
|
|
1
|
+
VUE_APP_PUBLIC_PATH=/
|
|
2
|
+
VUE_APP_NAME=Admin
|
|
3
|
+
VUE_APP_ROUTES_KEY=admin.routes
|
|
4
|
+
VUE_APP_PERMISSIONS_KEY=admin.permissions
|
|
5
|
+
VUE_APP_ROLES_KEY=admin.roles
|
|
6
|
+
VUE_APP_USER_KEY=admin.user
|
|
7
|
+
VUE_APP_LOGIN_KEY=admin.login
|
|
8
|
+
VUE_APP_SETTING_KEY=admin.setting
|
|
9
|
+
VUE_APP_TBAS_KEY=admin.tabs
|
|
10
|
+
VUE_APP_TBAS_TITLES_KEY=admin.tabs.titles
|
|
11
|
+
VUE_APP_DICTIONARY_KEY=admin.dictionary
|
|
12
|
+
VUE_APP_BADGE_KEY=admin.badge
|
|
13
|
+
VUE_APP_SINGLEVALUE_KEY=admin.singlevalue
|
|
14
|
+
VUE_APP_DIVISIONSOHCHINA=admin.divisionsohchina
|
|
15
|
+
VUE_APP_API_BASE_URL=http://123.60.214.109:8405
|
package/.eslintrc.js
CHANGED
|
@@ -1,82 +1,82 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
root: true,
|
|
3
|
-
env: {
|
|
4
|
-
node: true
|
|
5
|
-
},
|
|
6
|
-
'extends': [
|
|
7
|
-
'plugin:vue/essential',
|
|
8
|
-
'plugin:vue/strongly-recommended',
|
|
9
|
-
'@vue/standard'
|
|
10
|
-
],
|
|
11
|
-
rules: {
|
|
12
|
-
'comma-dangle': 'off',
|
|
13
|
-
'no-console': 'off',
|
|
14
|
-
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
|
|
15
|
-
'generator-star-spacing': 'off',
|
|
16
|
-
'no-mixed-operators': 0,
|
|
17
|
-
'vue/max-attributes-per-line': [
|
|
18
|
-
2,
|
|
19
|
-
{
|
|
20
|
-
'singleline': 5,
|
|
21
|
-
'multiline': {
|
|
22
|
-
'max': 1,
|
|
23
|
-
'allowFirstLine': false
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
],
|
|
27
|
-
'vue/attribute-hyphenation': 0,
|
|
28
|
-
'vue/html-self-closing': 0,
|
|
29
|
-
'vue/component-name-in-template-casing': 0,
|
|
30
|
-
'vue/html-closing-bracket-spacing': 0,
|
|
31
|
-
'vue/singleline-html-element-content-newline': 0,
|
|
32
|
-
'vue/no-unused-components': 0,
|
|
33
|
-
'vue/multiline-html-element-content-newline': 0,
|
|
34
|
-
'vue/no-use-v-if-with-v-for': 0,
|
|
35
|
-
'vue/html-closing-bracket-newline': 0,
|
|
36
|
-
'vue/no-parsing-error': 0,
|
|
37
|
-
'vue/name-property-casing': 0,
|
|
38
|
-
'no-tabs': 0,
|
|
39
|
-
'quotes': [
|
|
40
|
-
2,
|
|
41
|
-
'single',
|
|
42
|
-
{
|
|
43
|
-
'avoidEscape': true,
|
|
44
|
-
'allowTemplateLiterals': true
|
|
45
|
-
}
|
|
46
|
-
],
|
|
47
|
-
'semi': [
|
|
48
|
-
2,
|
|
49
|
-
'never',
|
|
50
|
-
{
|
|
51
|
-
'beforeStatementContinuationChars': 'never'
|
|
52
|
-
}
|
|
53
|
-
],
|
|
54
|
-
'no-delete-var': 2,
|
|
55
|
-
'prefer-const': [
|
|
56
|
-
2,
|
|
57
|
-
{
|
|
58
|
-
'ignoreReadBeforeAssign': false
|
|
59
|
-
}
|
|
60
|
-
],
|
|
61
|
-
'template-curly-spacing': 'off',
|
|
62
|
-
'indent': 'off',
|
|
63
|
-
// 必须使用全等: false
|
|
64
|
-
'eqeqeq': 0,
|
|
65
|
-
// 可以使用!! 双重否定
|
|
66
|
-
'no-extra-boolean-cast': 'off'
|
|
67
|
-
},
|
|
68
|
-
parserOptions: {
|
|
69
|
-
parser: 'babel-eslint'
|
|
70
|
-
},
|
|
71
|
-
overrides: [
|
|
72
|
-
{
|
|
73
|
-
files: [
|
|
74
|
-
'**/__tests__/*.{j,t}s?(x)',
|
|
75
|
-
'**/tests/unit/**/*.spec.{j,t}s?(x)'
|
|
76
|
-
],
|
|
77
|
-
env: {
|
|
78
|
-
jest: true
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
]
|
|
82
|
-
}
|
|
1
|
+
module.exports = {
|
|
2
|
+
root: true,
|
|
3
|
+
env: {
|
|
4
|
+
node: true
|
|
5
|
+
},
|
|
6
|
+
'extends': [
|
|
7
|
+
'plugin:vue/essential',
|
|
8
|
+
'plugin:vue/strongly-recommended',
|
|
9
|
+
'@vue/standard'
|
|
10
|
+
],
|
|
11
|
+
rules: {
|
|
12
|
+
'comma-dangle': 'off',
|
|
13
|
+
'no-console': 'off',
|
|
14
|
+
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
|
|
15
|
+
'generator-star-spacing': 'off',
|
|
16
|
+
'no-mixed-operators': 0,
|
|
17
|
+
'vue/max-attributes-per-line': [
|
|
18
|
+
2,
|
|
19
|
+
{
|
|
20
|
+
'singleline': 5,
|
|
21
|
+
'multiline': {
|
|
22
|
+
'max': 1,
|
|
23
|
+
'allowFirstLine': false
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
'vue/attribute-hyphenation': 0,
|
|
28
|
+
'vue/html-self-closing': 0,
|
|
29
|
+
'vue/component-name-in-template-casing': 0,
|
|
30
|
+
'vue/html-closing-bracket-spacing': 0,
|
|
31
|
+
'vue/singleline-html-element-content-newline': 0,
|
|
32
|
+
'vue/no-unused-components': 0,
|
|
33
|
+
'vue/multiline-html-element-content-newline': 0,
|
|
34
|
+
'vue/no-use-v-if-with-v-for': 0,
|
|
35
|
+
'vue/html-closing-bracket-newline': 0,
|
|
36
|
+
'vue/no-parsing-error': 0,
|
|
37
|
+
'vue/name-property-casing': 0,
|
|
38
|
+
'no-tabs': 0,
|
|
39
|
+
'quotes': [
|
|
40
|
+
2,
|
|
41
|
+
'single',
|
|
42
|
+
{
|
|
43
|
+
'avoidEscape': true,
|
|
44
|
+
'allowTemplateLiterals': true
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
'semi': [
|
|
48
|
+
2,
|
|
49
|
+
'never',
|
|
50
|
+
{
|
|
51
|
+
'beforeStatementContinuationChars': 'never'
|
|
52
|
+
}
|
|
53
|
+
],
|
|
54
|
+
'no-delete-var': 2,
|
|
55
|
+
'prefer-const': [
|
|
56
|
+
2,
|
|
57
|
+
{
|
|
58
|
+
'ignoreReadBeforeAssign': false
|
|
59
|
+
}
|
|
60
|
+
],
|
|
61
|
+
'template-curly-spacing': 'off',
|
|
62
|
+
'indent': 'off',
|
|
63
|
+
// 必须使用全等: false
|
|
64
|
+
'eqeqeq': 0,
|
|
65
|
+
// 可以使用!! 双重否定
|
|
66
|
+
'no-extra-boolean-cast': 'off'
|
|
67
|
+
},
|
|
68
|
+
parserOptions: {
|
|
69
|
+
parser: 'babel-eslint'
|
|
70
|
+
},
|
|
71
|
+
overrides: [
|
|
72
|
+
{
|
|
73
|
+
files: [
|
|
74
|
+
'**/__tests__/*.{j,t}s?(x)',
|
|
75
|
+
'**/tests/unit/**/*.spec.{j,t}s?(x)'
|
|
76
|
+
],
|
|
77
|
+
env: {
|
|
78
|
+
jest: true
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
}
|
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
package/src/base-client/all.js
CHANGED
|
@@ -1,61 +1,64 @@
|
|
|
1
|
-
import Vue from 'vue'
|
|
2
|
-
|
|
3
|
-
import CustomColumnsDrawer from '@vue2-client/base-client/components/common/CustomColumnsDrawer'
|
|
4
|
-
import InstructDetailsView from '@vue2-client/base-client/components/iot/InstructDetailsView'
|
|
5
|
-
import MeterDetailsView from '@vue2-client/base-client/components/iot/MeterDetailsView'
|
|
6
|
-
import CustomerDetailsView from '@vue2-client/base-client/components/iot/CustomerDetailsView'
|
|
7
|
-
import LogDetailsView from '@vue2-client/base-client/components/iot/LogDetailsView'
|
|
8
|
-
import WebmeterAnalysisView from '@vue2-client/base-client/components/iot/WebmeterAnalysisView'
|
|
9
|
-
import XCard from '@vue2-client/base-client/components/common/XCard/XCard'
|
|
10
|
-
import XFormCol from '@vue2-client/base-client/components/common/XFormCol'
|
|
11
|
-
import XBadge from '@vue2-client/base-client/components/common/XBadge'
|
|
12
|
-
import DataAnalysisView from '@vue2-client/base-client/components/iot/DataAnalysisView'
|
|
13
|
-
import DataAnalysisUser from '@vue2-client/base-client/components/iot/DataAnalysisUser'
|
|
14
|
-
import SrcollList from '@vue2-client/base-client/components/common/ScrollList'
|
|
15
|
-
import AmapPointRendering from '@vue2-client/base-client/components/common/AmapMarker'
|
|
16
|
-
import DeviceTypeDetailsView from '@vue2-client/base-client/components/iot/DeviceTypeDetailsView'
|
|
17
|
-
import DeviceBrandDetailsView from '@vue2-client/base-client/components/iot/DeviceBrandDetailsView'
|
|
18
|
-
import DictionaryDetailsView from '@vue2-client/base-client/components/system/DictionaryDetailsView'
|
|
19
|
-
import QueryParamsDetailsView from '@vue2-client/base-client/components/system/QueryParamsDetailsView'
|
|
20
|
-
import DeviceDetailsView from '@vue2-client/base-client/components/iot/DeviceDetailsView'
|
|
21
|
-
import TicketDetailsView from '@vue2-client/base-client/components/ticket/TicketDetailsView'
|
|
22
|
-
import EmployeeDetailsView from '@vue2-client/base-client/components/ticket/EmployeeDetailsView'
|
|
23
|
-
import submitTicketSuccess from '@vue2-client/base-client/components/ticket/TicketSubmitSuccessView'
|
|
24
|
-
import CreateQuery from '@vue2-client/base-client/components/common/CreateQuery'
|
|
25
|
-
import CreateSimpleFormQuery from '@vue2-client/base-client/components/common/CreateSimpleFormQuery'
|
|
26
|
-
import FormGroupQuery from '@vue2-client/base-client/components/common/FormGroupQuery'
|
|
27
|
-
import FormGroupEdit from '@vue2-client/base-client/components/common/FormGroupEdit'
|
|
28
|
-
import JSONToTree from '@vue2-client/base-client/components/common/JSONToTree'
|
|
29
|
-
import Upload from '@vue2-client/base-client/components/common/Upload'
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
Vue.component('
|
|
37
|
-
Vue.component('
|
|
38
|
-
Vue.component('
|
|
39
|
-
Vue.component('
|
|
40
|
-
Vue.component('
|
|
41
|
-
Vue.component('
|
|
42
|
-
Vue.component('
|
|
43
|
-
Vue.component('
|
|
44
|
-
Vue.component('
|
|
45
|
-
Vue.component('
|
|
46
|
-
Vue.component('
|
|
47
|
-
Vue.component('
|
|
48
|
-
Vue.component('
|
|
49
|
-
Vue.component('
|
|
50
|
-
Vue.component('
|
|
51
|
-
Vue.component('
|
|
52
|
-
Vue.component('
|
|
53
|
-
Vue.component('
|
|
54
|
-
Vue.component('
|
|
55
|
-
Vue.component('
|
|
56
|
-
Vue.component('
|
|
57
|
-
Vue.component('
|
|
58
|
-
Vue.component('
|
|
59
|
-
Vue.component('
|
|
60
|
-
Vue.component('
|
|
61
|
-
Vue.component('
|
|
1
|
+
import Vue from 'vue'
|
|
2
|
+
|
|
3
|
+
import CustomColumnsDrawer from '@vue2-client/base-client/components/common/CustomColumnsDrawer'
|
|
4
|
+
import InstructDetailsView from '@vue2-client/base-client/components/iot/InstructDetailsView'
|
|
5
|
+
import MeterDetailsView from '@vue2-client/base-client/components/iot/MeterDetailsView'
|
|
6
|
+
import CustomerDetailsView from '@vue2-client/base-client/components/iot/CustomerDetailsView'
|
|
7
|
+
import LogDetailsView from '@vue2-client/base-client/components/iot/LogDetailsView'
|
|
8
|
+
import WebmeterAnalysisView from '@vue2-client/base-client/components/iot/WebmeterAnalysisView'
|
|
9
|
+
import XCard from '@vue2-client/base-client/components/common/XCard/XCard'
|
|
10
|
+
import XFormCol from '@vue2-client/base-client/components/common/XFormCol'
|
|
11
|
+
import XBadge from '@vue2-client/base-client/components/common/XBadge'
|
|
12
|
+
import DataAnalysisView from '@vue2-client/base-client/components/iot/DataAnalysisView'
|
|
13
|
+
import DataAnalysisUser from '@vue2-client/base-client/components/iot/DataAnalysisUser'
|
|
14
|
+
import SrcollList from '@vue2-client/base-client/components/common/ScrollList'
|
|
15
|
+
import AmapPointRendering from '@vue2-client/base-client/components/common/AmapMarker'
|
|
16
|
+
import DeviceTypeDetailsView from '@vue2-client/base-client/components/iot/DeviceTypeDetailsView'
|
|
17
|
+
import DeviceBrandDetailsView from '@vue2-client/base-client/components/iot/DeviceBrandDetailsView'
|
|
18
|
+
import DictionaryDetailsView from '@vue2-client/base-client/components/system/DictionaryDetailsView'
|
|
19
|
+
import QueryParamsDetailsView from '@vue2-client/base-client/components/system/QueryParamsDetailsView'
|
|
20
|
+
import DeviceDetailsView from '@vue2-client/base-client/components/iot/DeviceDetailsView'
|
|
21
|
+
import TicketDetailsView from '@vue2-client/base-client/components/ticket/TicketDetailsView'
|
|
22
|
+
import EmployeeDetailsView from '@vue2-client/base-client/components/ticket/EmployeeDetailsView'
|
|
23
|
+
import submitTicketSuccess from '@vue2-client/base-client/components/ticket/TicketSubmitSuccessView'
|
|
24
|
+
import CreateQuery from '@vue2-client/base-client/components/common/CreateQuery'
|
|
25
|
+
import CreateSimpleFormQuery from '@vue2-client/base-client/components/common/CreateSimpleFormQuery'
|
|
26
|
+
import FormGroupQuery from '@vue2-client/base-client/components/common/FormGroupQuery'
|
|
27
|
+
import FormGroupEdit from '@vue2-client/base-client/components/common/FormGroupEdit'
|
|
28
|
+
import JSONToTree from '@vue2-client/base-client/components/common/JSONToTree'
|
|
29
|
+
import Upload from '@vue2-client/base-client/components/common/Upload'
|
|
30
|
+
import AddressSearchCombobox from '@/base-client/components/common/AddressSearchCombobox'
|
|
31
|
+
import CitySelect from '@/base-client/components/common/CitySelect'
|
|
32
|
+
// 插件
|
|
33
|
+
import Plugins from '@vue2-client/base-client/plugins'
|
|
34
|
+
Vue.use(Plugins)
|
|
35
|
+
|
|
36
|
+
Vue.component('custom-columns-drawer', CustomColumnsDrawer)
|
|
37
|
+
Vue.component('InstructDetailsView', InstructDetailsView)
|
|
38
|
+
Vue.component('MeterDetailsView', MeterDetailsView)
|
|
39
|
+
Vue.component('CustomerDetailsView', CustomerDetailsView)
|
|
40
|
+
Vue.component('LogDetailsView', LogDetailsView)
|
|
41
|
+
Vue.component('WebmeterAnalysisView', WebmeterAnalysisView)
|
|
42
|
+
Vue.component('XCard', XCard)
|
|
43
|
+
Vue.component('XBadge', XBadge)
|
|
44
|
+
Vue.component('XFormCol', XFormCol)
|
|
45
|
+
Vue.component('DataAnalysisView', DataAnalysisView)
|
|
46
|
+
Vue.component('DataAnalysisUser', DataAnalysisUser)
|
|
47
|
+
Vue.component('SrcollList', SrcollList)
|
|
48
|
+
Vue.component('DeviceTypeDetailsView', DeviceTypeDetailsView)
|
|
49
|
+
Vue.component('DeviceBrandDetailsView', DeviceBrandDetailsView)
|
|
50
|
+
Vue.component('DeviceDetailsView', DeviceDetailsView)
|
|
51
|
+
Vue.component('DictionaryDetailsView', DictionaryDetailsView)
|
|
52
|
+
Vue.component('QueryParamsDetailsView', QueryParamsDetailsView)
|
|
53
|
+
Vue.component('TicketDetailsView', TicketDetailsView)
|
|
54
|
+
Vue.component('EmployeeDetailsView', EmployeeDetailsView)
|
|
55
|
+
Vue.component('submitTicketSuccess', submitTicketSuccess)
|
|
56
|
+
Vue.component('CreateQuery', CreateQuery)
|
|
57
|
+
Vue.component('CreateSimpleFormQuery', CreateSimpleFormQuery)
|
|
58
|
+
Vue.component('FormGroupQuery', FormGroupQuery)
|
|
59
|
+
Vue.component('FormGroupEdit', FormGroupEdit)
|
|
60
|
+
Vue.component('JSONToTree', JSONToTree)
|
|
61
|
+
Vue.component('Upload', Upload)
|
|
62
|
+
Vue.component('AmapPointRendering', AmapPointRendering)
|
|
63
|
+
Vue.component('AddressSearchCombobox', AddressSearchCombobox)
|
|
64
|
+
Vue.component('CitySelect', CitySelect)
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="certain-category-search-wrapper">
|
|
3
|
+
<a-auto-complete
|
|
4
|
+
:disabled="!mapAutocomplete"
|
|
5
|
+
:dropdown-match-select-width="false"
|
|
6
|
+
:dropdown-style="{ width: '400px' }"
|
|
7
|
+
class="certain-category-search"
|
|
8
|
+
dropdown-class-name="certain-category-search-dropdown"
|
|
9
|
+
option-label-prop="value"
|
|
10
|
+
placeholder="输入地址关键字搜索"
|
|
11
|
+
@search="fetchFunction"
|
|
12
|
+
@select="onSelect"
|
|
13
|
+
>
|
|
14
|
+
<a-spin v-if="searching" slot="notFoundContent" size="small" />
|
|
15
|
+
<template slot="dataSource">
|
|
16
|
+
<a-select-opt-group v-for="group in option" :key="group.title">
|
|
17
|
+
<span
|
|
18
|
+
slot="label">
|
|
19
|
+
<a-icon type="bank" /> {{ group.title }}
|
|
20
|
+
</span>
|
|
21
|
+
<a-select-option v-for="address in group.children" :key="address.label + ' (' + address.value + ')'">
|
|
22
|
+
<p class="addressName"><a-icon type="environment" /> <span v-html="highLight(address.label, address.word)">{{ address.label }}</span></p>
|
|
23
|
+
<p v-if="address.address !== '[]'" class="addressRemark">
|
|
24
|
+
{{ address.address }}
|
|
25
|
+
</p>
|
|
26
|
+
</a-select-option>
|
|
27
|
+
</a-select-opt-group>
|
|
28
|
+
</template>
|
|
29
|
+
<a-input>
|
|
30
|
+
<a-icon slot="suffix" class="certain-category-icon" type="search"/>
|
|
31
|
+
</a-input>
|
|
32
|
+
</a-auto-complete>
|
|
33
|
+
</div>
|
|
34
|
+
</template>
|
|
35
|
+
<script>
|
|
36
|
+
|
|
37
|
+
import { post } from '@vue2-client/services/api'
|
|
38
|
+
import { GetGDMap } from '@/utils/map-utils'
|
|
39
|
+
import { debounce } from 'ant-design-vue/lib/vc-table/src/utils'
|
|
40
|
+
|
|
41
|
+
export default {
|
|
42
|
+
name: 'AddressSearchCombobox',
|
|
43
|
+
data () {
|
|
44
|
+
// 检索去抖
|
|
45
|
+
this.fetchFunction = debounce(this.fetchFunction, 300)
|
|
46
|
+
return {
|
|
47
|
+
// 地址搜索联想
|
|
48
|
+
mapAutocomplete: undefined,
|
|
49
|
+
// 检索结果
|
|
50
|
+
option: [],
|
|
51
|
+
// 最后检索版本
|
|
52
|
+
lastFetchId: 0,
|
|
53
|
+
// 检索中
|
|
54
|
+
searching: false
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
model: {
|
|
58
|
+
prop: 'searchResult',
|
|
59
|
+
event: 'onSelect'
|
|
60
|
+
},
|
|
61
|
+
props: {
|
|
62
|
+
searchResult: {
|
|
63
|
+
type: String,
|
|
64
|
+
default: undefined
|
|
65
|
+
},
|
|
66
|
+
// 返回数据格式
|
|
67
|
+
searchResultType: {
|
|
68
|
+
type: String,
|
|
69
|
+
default: 'Default'
|
|
70
|
+
// default: 'Array'
|
|
71
|
+
// default: 'Object'
|
|
72
|
+
},
|
|
73
|
+
// Object 返回格式时 可以自定义key
|
|
74
|
+
resultKeys: {
|
|
75
|
+
type: Object,
|
|
76
|
+
default: () => { return { address: 'address', coords: 'coords' } }
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
created () {
|
|
80
|
+
},
|
|
81
|
+
mounted () {
|
|
82
|
+
GetGDMap().then(aMap => {
|
|
83
|
+
this.mapAutocomplete = new (aMap).Autocomplete({})
|
|
84
|
+
})
|
|
85
|
+
},
|
|
86
|
+
methods: {
|
|
87
|
+
onSelect (value) {
|
|
88
|
+
let result
|
|
89
|
+
if (this.searchResultType !== 'Default') {
|
|
90
|
+
const _arr = value.replace(')', '').split('(')
|
|
91
|
+
if (this.searchResultType === 'Array') {
|
|
92
|
+
result = _arr
|
|
93
|
+
} else {
|
|
94
|
+
result = {}
|
|
95
|
+
result[this.resultKeys.address] = _arr[0]
|
|
96
|
+
result[this.resultKeys.coords] = _arr[1]
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
this.$emit('onSelect', JSON.stringify(result) || value)
|
|
100
|
+
// this.$emit('onClick', result || value)
|
|
101
|
+
},
|
|
102
|
+
// 懒加载检索方法
|
|
103
|
+
fetchFunction (value) {
|
|
104
|
+
if (value && this.mapAutocomplete) {
|
|
105
|
+
this.searching = true
|
|
106
|
+
this.lastFetchId += 1
|
|
107
|
+
const fetchId = this.lastFetchId
|
|
108
|
+
this.mapAutocomplete.search(value, (status, result) => {
|
|
109
|
+
if (fetchId !== this.lastFetchId) {
|
|
110
|
+
return
|
|
111
|
+
}
|
|
112
|
+
if (status === 'complete') {
|
|
113
|
+
this.option = []
|
|
114
|
+
const addressMap = {}
|
|
115
|
+
result.tips.forEach((res) => {
|
|
116
|
+
if (res.location) {
|
|
117
|
+
if (!addressMap.hasOwnProperty(res.district)) {
|
|
118
|
+
addressMap[res.district] = []
|
|
119
|
+
}
|
|
120
|
+
addressMap[res.district].push({
|
|
121
|
+
label: res.name,
|
|
122
|
+
value: res.location.lat + ',' + res.location.lng,
|
|
123
|
+
address: res.address + '',
|
|
124
|
+
word: value
|
|
125
|
+
})
|
|
126
|
+
}
|
|
127
|
+
})
|
|
128
|
+
for (const key of Object.keys(addressMap)) {
|
|
129
|
+
this.option.push({
|
|
130
|
+
title: key,
|
|
131
|
+
children: addressMap[key]
|
|
132
|
+
})
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
this.searching = false
|
|
136
|
+
})
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
// 获取数据
|
|
140
|
+
getData (value, callback) {
|
|
141
|
+
if (value !== '') {
|
|
142
|
+
const logicName = this.attr.keyName
|
|
143
|
+
const logic = logicName.substring(6)
|
|
144
|
+
post('/webmeterapi/' + logic, value).then(res => {
|
|
145
|
+
callback(res)
|
|
146
|
+
})
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
// 关键字高亮
|
|
150
|
+
highLight (value, word) {
|
|
151
|
+
// 如果标题中包含,关键字就替换一下
|
|
152
|
+
if (value.includes(word)) {
|
|
153
|
+
value = value.replace(word,
|
|
154
|
+
// 这里是替换成html格式的数据,最好再加一个样式权重,保险一点
|
|
155
|
+
'<span style="color:red!important;">' + word + '</span>'
|
|
156
|
+
)
|
|
157
|
+
return value
|
|
158
|
+
// eslint-disable-next-line brace-style
|
|
159
|
+
}
|
|
160
|
+
// 不包含的话还用这个
|
|
161
|
+
else {
|
|
162
|
+
return value
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
</script>
|
|
168
|
+
|
|
169
|
+
<style>
|
|
170
|
+
.certain-category-search-dropdown .ant-select-dropdown-menu-item-group-title {
|
|
171
|
+
color: #666;
|
|
172
|
+
font-weight: bold;
|
|
173
|
+
font-size: 14px;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.certain-category-search-dropdown .ant-select-dropdown-menu-item-group {
|
|
177
|
+
border-bottom: 1px solid #f6f6f6;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.certain-category-search-dropdown .ant-select-dropdown-menu-item {
|
|
181
|
+
padding-left: 16px;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.certain-category-search-dropdown .ant-select-dropdown-menu-item.show-all {
|
|
185
|
+
text-align: center;
|
|
186
|
+
cursor: default;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.certain-category-search-dropdown .ant-select-dropdown-menu {
|
|
190
|
+
max-height: 300px;
|
|
191
|
+
}
|
|
192
|
+
</style>
|
|
193
|
+
<style scoped>
|
|
194
|
+
.certain-category-search-wrapper
|
|
195
|
+
>>> .certain-category-search.ant-select-auto-complete
|
|
196
|
+
.ant-input-affix-wrapper
|
|
197
|
+
.ant-input-suffix {
|
|
198
|
+
right: 12px;
|
|
199
|
+
}
|
|
200
|
+
.certain-category-search-wrapper >>> .certain-search-item-count {
|
|
201
|
+
position: absolute;
|
|
202
|
+
color: #999;
|
|
203
|
+
right: 16px;
|
|
204
|
+
}
|
|
205
|
+
.certain-category-search-wrapper >>> .certain-category-search.ant-select-focused,
|
|
206
|
+
.certain-category-icon {
|
|
207
|
+
color: #108ee9;
|
|
208
|
+
}
|
|
209
|
+
.certain-category-search-wrapper >>> .certain-category-icon {
|
|
210
|
+
color: #6e6e6e;
|
|
211
|
+
transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
|
|
212
|
+
font-size: 16px;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.addressName {
|
|
216
|
+
margin-bottom: 0;
|
|
217
|
+
font-size: 14px;
|
|
218
|
+
font-weight: bold;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.addressRemark {
|
|
222
|
+
margin-bottom: 0;
|
|
223
|
+
font-size: 12px;
|
|
224
|
+
}
|
|
225
|
+
</style>
|