vue2-client 1.2.72 → 1.2.73

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 (41) hide show
  1. package/.env +15 -15
  2. package/.eslintrc.js +82 -82
  3. package/CHANGELOG.md +4 -0
  4. package/package.json +1 -1
  5. package/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox.vue +225 -225
  6. package/src/base-client/components/common/AmapMarker/AmapPointRendering.vue +113 -113
  7. package/src/base-client/components/common/CitySelect/CitySelect.vue +244 -244
  8. package/src/base-client/components/common/CitySelect/index.js +3 -3
  9. package/src/base-client/components/common/CitySelect/index.md +109 -109
  10. package/src/base-client/components/common/CreateQuery/CreateQuery.vue +523 -523
  11. package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +773 -773
  12. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQuery.vue +310 -310
  13. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQueryItem.vue +553 -553
  14. package/src/base-client/components/common/Upload/Upload.vue +151 -151
  15. package/src/base-client/components/common/Upload/index.js +3 -3
  16. package/src/base-client/components/common/XAddForm/XAddForm.vue +345 -345
  17. package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +322 -322
  18. package/src/base-client/components/common/XForm/XForm.vue +268 -268
  19. package/src/base-client/components/common/XForm/XFormItem.vue +358 -358
  20. package/src/base-client/components/common/XFormTable/XFormTable.vue +491 -491
  21. package/src/base-client/components/common/XTable/XTable.vue +269 -271
  22. package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsException.vue +57 -57
  23. package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsRead.vue +131 -131
  24. package/src/base-client/components/iot/DeviceTypeDetailsView/DeviceTypeDetailsView.vue +300 -300
  25. package/src/base-client/components/iot/WebmeterAnalysisView/WebmeterAnalysisView.vue +647 -647
  26. package/src/base-client/components/ticket/TicketSubmitSuccessView/TicketSubmitSuccessView.vue +532 -532
  27. package/src/base-client/plugins/AppData.js +70 -70
  28. package/src/base-client/plugins/compatible/LoginServiceOA.js +20 -20
  29. package/src/config/CreateQueryConfig.js +301 -301
  30. package/src/pages/resourceManage/orgListManage.vue +98 -98
  31. package/src/router/async/config.async.js +26 -26
  32. package/src/router/async/router.map.js +60 -60
  33. package/src/router/index.js +27 -27
  34. package/src/services/api/common.js +56 -56
  35. package/src/services/api/manage.js +16 -16
  36. package/src/services/api/restTools.js +24 -24
  37. package/src/theme/default/style.less +47 -47
  38. package/src/utils/map-utils.js +28 -28
  39. package/src/utils/request.js +198 -198
  40. package/src/utils/util.js +222 -222
  41. package/vue.config.js +153 -153
@@ -1,358 +1,358 @@
1
- <template>
2
- <!-- 综合筛选 -->
3
- <x-form-col
4
- v-if="attr.type === 'select' && attr.model === 'rowIdValue'"
5
- :xl="xl"
6
- :xxl="xxl">
7
- <a-form-model-item
8
- :ref="attr.model"
9
- :label="attr.name"
10
- :prop="attr.model">
11
- <a-input v-model="form[attr.model]" :disabled="disabled">
12
- <a-select
13
- slot="addonBefore"
14
- :getPopupContainer=" triggerNode => { return triggerNode.parentNode } "
15
- v-model="form['rowIdName']"
16
- style="width: 100px">
17
- <a-select-option
18
- v-for="(item,index) in attr.keys"
19
- :key="index"
20
- :value="Object.keys(item)[0]">{{ item[Object.keys(item)[0]] }}
21
- </a-select-option>
22
- </a-select>
23
- </a-input>
24
- </a-form-model-item>
25
- </x-form-col>
26
- <!-- 输入框 -->
27
- <x-form-col
28
- v-else-if="attr.type === 'input'"
29
- :xl="xl"
30
- :xxl="xxl">
31
- <a-form-model-item
32
- :ref="attr.model"
33
- :label="attr.name"
34
- :prop="attr.model">
35
- <a-input v-model="form[attr.model]" :disabled="disabled" :placeholder="attr.placeholder ? attr.placeholder : '请输入'+attr.name.replace(/\s*/g, '')"/>
36
- </a-form-model-item>
37
- </x-form-col>
38
- <!-- 下拉框 -->
39
- <x-form-col
40
- v-else-if="attr.type === 'select'"
41
- :xl="xl"
42
- :xxl="xxl">
43
- <a-form-model-item
44
- :ref="attr.model"
45
- :label="attr.name"
46
- :prop="attr.model">
47
- <a-select
48
- :getPopupContainer=" triggerNode => { return triggerNode.parentNode } "
49
- v-if="!attr.lazyLoad || attr.lazyLoad === 'false'"
50
- v-model="form[attr.model]"
51
- :disabled="disabled"
52
- :filter-option="filterOption"
53
- :placeholder="attr.placeholder ? attr.placeholder : '请选择'"
54
- show-search
55
- >
56
- <a-select-option
57
- v-if="mode === '查询'"
58
- key="999999"
59
- value="全部">全部
60
- </a-select-option>
61
- <template v-if="attr.keys">
62
- <a-select-option
63
- v-for="(item,index) in attr.keys"
64
- :key="index"
65
- :value="Object.keys(item)[0]">
66
- {{ item[Object.keys(item)[0]] }}
67
- </a-select-option>
68
- </template>
69
- <template v-else>
70
- <template v-if="attr.keyName.indexOf('logic@') !== -1">
71
- <a-select-option
72
- v-for="(item,index) in option"
73
- :key="index"
74
- :value="Object.keys(item)[0]">{{ item[Object.keys(item)[0]] }}
75
- </a-select-option>
76
- </template>
77
- <template v-else>
78
- <a-select-option
79
- v-for="item in $appdata.getDictionaryList(attr.keyName)"
80
- :key="item.value"
81
- :value="item.value">
82
- <!-- 徽标(badge) -->
83
- <x-badge :badge-key="attr.keyName" :replaceText="item.text" :value="item.value"/>
84
- </a-select-option>
85
- </template>
86
- </template>
87
- </a-select>
88
- <a-select
89
- v-else
90
- v-model="form[attr.model]"
91
- :disabled="disabled"
92
- :filter-option="filterOption"
93
- :placeholder="attr.placeholder ? attr.placeholder : '搜索' + attr.name"
94
- :getPopupContainer=" triggerNode => { return triggerNode.parentNode } "
95
- show-search
96
- @search="fetchFunction"
97
- >
98
- <a-spin v-if="searching" slot="notFoundContent" size="small" />
99
- <a-select-option
100
- v-if="mode === '查询'"
101
- key="999999"
102
- value="全部">全部
103
- </a-select-option>
104
- <a-select-option
105
- v-for="(item,index) in option"
106
- :key="index"
107
- :value="Object.keys(item)[0]">{{ item[Object.keys(item)[0]] }}
108
- </a-select-option>
109
- </a-select>
110
- </a-form-model-item>
111
- </x-form-col>
112
- <!-- 级联下拉框 -->
113
- <x-form-col
114
- :xl="xl"
115
- :xxl="xxl"
116
- v-else-if="attr.type === 'selects'">
117
- <a-form-model-item
118
- :ref="attr.model"
119
- :label="attr.name"
120
- :prop="attr.model">
121
- <a-select
122
- v-if="!attr.lazyLoad || attr.lazyLoad === 'false'"
123
- v-model="form[attr.model]"
124
- :disabled=" attr.groupIndex>1 && (disabled || !selectsArray[attr.group] || !selectsArray[attr.group][attr.groupIndex] || (selectsArray[attr.group][attr.groupIndex] && selectsArray[attr.group][attr.groupIndex].length === 0))"
125
- @change="selectsItemCheck(attr.group, attr.groupIndex, form[attr.model])"
126
- show-search
127
- :getPopupContainer=" triggerNode => { return triggerNode.parentNode } "
128
- :placeholder="attr.placeholder ? attr.placeholder : '请选择'"
129
- >
130
- <template v-for="optionItem in selectsArray[attr.group][attr.groupIndex]" v-if="selectsArray[attr.group].length > 0 || selectsArray[attr.group][attr.groupIndex]">
131
- <a-select-option :key="optionItem.label" :value="optionItem.value">
132
- {{ optionItem.label }}
133
- </a-select-option>
134
- </template>
135
- </a-select>
136
- </a-form-model-item>
137
- </x-form-col>
138
- <!-- TODO 多选框 -->
139
- <!-- TODO 单选框 -->
140
- <!-- 日期范围选择器 -->
141
- <x-form-col
142
- v-else-if="attr.type === 'rangePicker'"
143
- :xl="xl"
144
- :xxl="xxl">
145
- <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
146
- <a-range-picker v-model="form[attr.model]" :disabled="disabled" :show-time="true" valueFormat="YYYY-MM-DD HH:mm:ss"/>
147
- </a-form-model-item>
148
- </x-form-col>
149
- <!-- 月份选择器 -->
150
- <x-form-col
151
- v-else-if="attr.type === 'monthPicker'"
152
- :xl="xl"
153
- :xxl="xxl">
154
- <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
155
- <a-month-picker v-model="form[attr.model]" :disabled="disabled" :show-time="true" valueFormat="YYYY-MM"/>
156
- </a-form-model-item>
157
- </x-form-col>
158
- <!-- 日期选择器 -->
159
- <x-form-col
160
- v-else-if="attr.type === 'datePicker'"
161
- :xl="xl"
162
- :xxl="xxl">
163
- <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
164
- <a-date-picker v-model="form[attr.model]" :disabled="disabled" :show-time="true" valueFormat="YYYY-MM-DD"/>
165
- </a-form-model-item>
166
- </x-form-col>
167
- <!-- 级联选择器 -->
168
- <x-form-col
169
- v-else-if="attr.type === 'cascader'"
170
- :xl="xl"
171
- :xxl="xxl">
172
- <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
173
- <template v-if="attr.keys">
174
- <a-dcascader :disabled="disabled" :option="attr.keys" :value="form[attr.model]"/>
175
- </template>
176
- <template v-else>
177
- <a-dcascader :disabled="disabled" :option="option" :value="form[attr.model]"/>
178
- </template>
179
- </a-form-model-item>
180
- </x-form-col>
181
- <!-- 文本域 -->
182
- <x-form-col
183
- v-else-if="attr.type === 'textarea'"
184
- :lg="24"
185
- :md="24"
186
- :sm="24"
187
- :xl="24"
188
- :xs="24"
189
- :xxl="24">
190
- <a-form-model-item
191
- :ref="attr.model"
192
- :label="attr.name"
193
- :prop="attr.model">
194
- <a-textarea v-model="form[attr.model]" :disabled="disabled" :placeholder="attr.placeholder ? attr.placeholder : '请输入'+attr.name.replace(/\s*/g, '')" :rows="4"/>
195
- </a-form-model-item>
196
- </x-form-col>
197
- <!-- TODO 文件上传 -->
198
- <x-form-col
199
- v-else-if="attr.type === 'file' || attr.type === 'image'"
200
- :lg="24"
201
- :md="24"
202
- :sm="24"
203
- :xl="24"
204
- :xs="24"
205
- :xxl="24">
206
- <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
207
- <upload :model="attr" @setFiles="setFiles" :files="files" :images="images"></upload>
208
- </a-form-model-item>
209
- </x-form-col>
210
- <!-- TODO 地点搜索框 -->
211
- <x-form-col
212
- v-else-if="attr.type === 'addressSearch'"
213
- :xl="xl"
214
- :xxl="xxl">
215
- <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
216
- <address-search-combobox
217
- v-model="searchResult"
218
- searchResultType="Object"
219
- @onSelect="form=Object.assign(form,JSON.parse(searchResult))"
220
- :resultKeys="{ address: attr.model, coords: `${attr.model}_coords` }"
221
- ></address-search-combobox>
222
- </a-form-model-item>
223
- </x-form-col>
224
- <!-- TODO 省市区选择框 -->
225
- <x-form-col
226
- v-else-if="attr.type === 'citySelect'"
227
- :xl="xl"
228
- :xxl="xxl">
229
- <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
230
- <citySelect v-model="form[attr.model]" ></citySelect>
231
- </a-form-model-item>
232
- </x-form-col>
233
- </template>
234
- <script>
235
-
236
- import { post } from '@vue2-client/services/api'
237
- import { debounce } from 'ant-design-vue/lib/vc-table/src/utils'
238
-
239
- export default {
240
- name: 'XFormItem',
241
- data () {
242
- // 检索去抖
243
- this.fetchFunction = debounce(this.fetchFunction, 800)
244
- return {
245
- option: [],
246
- // 最后检索版本
247
- lastFetchId: 0,
248
- // 检索中
249
- searching: false,
250
- searchResult: ''
251
- }
252
- },
253
- props: {
254
- attr: {
255
- type: Object,
256
- default: () => {
257
- return {}
258
- }
259
- },
260
- form: {
261
- type: Object,
262
- required: true
263
- },
264
- disabled: {
265
- type: Boolean,
266
- default: () => {
267
- return false
268
- }
269
- },
270
- mode: {
271
- type: String,
272
- default: () => {
273
- return '查询'
274
- }
275
- },
276
- xl: {
277
- type: Number,
278
- default: undefined
279
- },
280
- xxl: {
281
- type: Number,
282
- default: undefined
283
- },
284
- selectsArray: {
285
- type: Object,
286
- default: () => {
287
- return {}
288
- }
289
- },
290
- files: {
291
- type: Array,
292
- default: () => {
293
- return []
294
- }
295
- },
296
- images: {
297
- type: Array,
298
- default: () => {
299
- return []
300
- }
301
- },
302
- },
303
- created () {
304
- if (this.attr.keyName && this.attr.keyName.indexOf('logic@') !== -1) {
305
- this.getData({}, res => {
306
- this.option = res
307
- })
308
- }
309
- },
310
- methods: {
311
- // 向父组件获取级联框的数据
312
- selectsItemCheck (groupName, index, value) {
313
- this.$emit('selectsItemCheck', val => { this.selectsArray = val }, groupName, index, value)
314
- },
315
- // 文件框时设置上传组件的值
316
- setFiles (fileIds) {
317
- this.form[this.attr.model] = fileIds
318
- },
319
- // 懒加载检索方法
320
- fetchFunction (value) {
321
- this.lastFetchId += 1
322
- const fetchId = this.lastFetchId
323
- this.option = []
324
- this.searching = true
325
- this.getData({
326
- word: value
327
- }, res => {
328
- if (fetchId !== this.lastFetchId) {
329
- return
330
- }
331
- this.option = res
332
- this.searching = false
333
- })
334
- },
335
- // 获取数据
336
- getData (value, callback) {
337
- if (value !== '') {
338
- const logicName = this.attr.keyName
339
- const logic = logicName.substring(6)
340
- post('/webmeterapi/' + logic, value).then(res => {
341
- callback(res)
342
- })
343
- }
344
- },
345
- filterOption (input, option) {
346
- if (option.componentOptions.children[0].text) {
347
- return (
348
- option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
349
- )
350
- } else {
351
- return (
352
- option.componentOptions.children[0].child.value.toLowerCase().indexOf(input.toLowerCase()) >= 0
353
- )
354
- }
355
- }
356
- }
357
- }
358
- </script>
1
+ <template>
2
+ <!-- 综合筛选 -->
3
+ <x-form-col
4
+ v-if="attr.type === 'select' && attr.model === 'rowIdValue'"
5
+ :xl="xl"
6
+ :xxl="xxl">
7
+ <a-form-model-item
8
+ :ref="attr.model"
9
+ :label="attr.name"
10
+ :prop="attr.model">
11
+ <a-input v-model="form[attr.model]" :disabled="disabled">
12
+ <a-select
13
+ slot="addonBefore"
14
+ :getPopupContainer=" triggerNode => { return triggerNode.parentNode } "
15
+ v-model="form['rowIdName']"
16
+ style="width: 100px">
17
+ <a-select-option
18
+ v-for="(item,index) in attr.keys"
19
+ :key="index"
20
+ :value="Object.keys(item)[0]">{{ item[Object.keys(item)[0]] }}
21
+ </a-select-option>
22
+ </a-select>
23
+ </a-input>
24
+ </a-form-model-item>
25
+ </x-form-col>
26
+ <!-- 输入框 -->
27
+ <x-form-col
28
+ v-else-if="attr.type === 'input'"
29
+ :xl="xl"
30
+ :xxl="xxl">
31
+ <a-form-model-item
32
+ :ref="attr.model"
33
+ :label="attr.name"
34
+ :prop="attr.model">
35
+ <a-input v-model="form[attr.model]" :disabled="disabled" :placeholder="attr.placeholder ? attr.placeholder : '请输入'+attr.name.replace(/\s*/g, '')"/>
36
+ </a-form-model-item>
37
+ </x-form-col>
38
+ <!-- 下拉框 -->
39
+ <x-form-col
40
+ v-else-if="attr.type === 'select'"
41
+ :xl="xl"
42
+ :xxl="xxl">
43
+ <a-form-model-item
44
+ :ref="attr.model"
45
+ :label="attr.name"
46
+ :prop="attr.model">
47
+ <a-select
48
+ :getPopupContainer=" triggerNode => { return triggerNode.parentNode } "
49
+ v-if="!attr.lazyLoad || attr.lazyLoad === 'false'"
50
+ v-model="form[attr.model]"
51
+ :disabled="disabled"
52
+ :filter-option="filterOption"
53
+ :placeholder="attr.placeholder ? attr.placeholder : '请选择'"
54
+ show-search
55
+ >
56
+ <a-select-option
57
+ v-if="mode === '查询'"
58
+ key="999999"
59
+ value="全部">全部
60
+ </a-select-option>
61
+ <template v-if="attr.keys">
62
+ <a-select-option
63
+ v-for="(item,index) in attr.keys"
64
+ :key="index"
65
+ :value="Object.keys(item)[0]">
66
+ {{ item[Object.keys(item)[0]] }}
67
+ </a-select-option>
68
+ </template>
69
+ <template v-else>
70
+ <template v-if="attr.keyName.indexOf('logic@') !== -1">
71
+ <a-select-option
72
+ v-for="(item,index) in option"
73
+ :key="index"
74
+ :value="Object.keys(item)[0]">{{ item[Object.keys(item)[0]] }}
75
+ </a-select-option>
76
+ </template>
77
+ <template v-else>
78
+ <a-select-option
79
+ v-for="item in $appdata.getDictionaryList(attr.keyName)"
80
+ :key="item.value"
81
+ :value="item.value">
82
+ <!-- 徽标(badge) -->
83
+ <x-badge :badge-key="attr.keyName" :replaceText="item.text" :value="item.value"/>
84
+ </a-select-option>
85
+ </template>
86
+ </template>
87
+ </a-select>
88
+ <a-select
89
+ v-else
90
+ v-model="form[attr.model]"
91
+ :disabled="disabled"
92
+ :filter-option="filterOption"
93
+ :placeholder="attr.placeholder ? attr.placeholder : '搜索' + attr.name"
94
+ :getPopupContainer=" triggerNode => { return triggerNode.parentNode } "
95
+ show-search
96
+ @search="fetchFunction"
97
+ >
98
+ <a-spin v-if="searching" slot="notFoundContent" size="small" />
99
+ <a-select-option
100
+ v-if="mode === '查询'"
101
+ key="999999"
102
+ value="全部">全部
103
+ </a-select-option>
104
+ <a-select-option
105
+ v-for="(item,index) in option"
106
+ :key="index"
107
+ :value="Object.keys(item)[0]">{{ item[Object.keys(item)[0]] }}
108
+ </a-select-option>
109
+ </a-select>
110
+ </a-form-model-item>
111
+ </x-form-col>
112
+ <!-- 级联下拉框 -->
113
+ <x-form-col
114
+ :xl="xl"
115
+ :xxl="xxl"
116
+ v-else-if="attr.type === 'selects'">
117
+ <a-form-model-item
118
+ :ref="attr.model"
119
+ :label="attr.name"
120
+ :prop="attr.model">
121
+ <a-select
122
+ v-if="!attr.lazyLoad || attr.lazyLoad === 'false'"
123
+ v-model="form[attr.model]"
124
+ :disabled=" attr.groupIndex>1 && (disabled || !selectsArray[attr.group] || !selectsArray[attr.group][attr.groupIndex] || (selectsArray[attr.group][attr.groupIndex] && selectsArray[attr.group][attr.groupIndex].length === 0))"
125
+ @change="selectsItemCheck(attr.group, attr.groupIndex, form[attr.model])"
126
+ show-search
127
+ :getPopupContainer=" triggerNode => { return triggerNode.parentNode } "
128
+ :placeholder="attr.placeholder ? attr.placeholder : '请选择'"
129
+ >
130
+ <template v-for="optionItem in selectsArray[attr.group][attr.groupIndex]" v-if="selectsArray[attr.group].length > 0 || selectsArray[attr.group][attr.groupIndex]">
131
+ <a-select-option :key="optionItem.label" :value="optionItem.value">
132
+ {{ optionItem.label }}
133
+ </a-select-option>
134
+ </template>
135
+ </a-select>
136
+ </a-form-model-item>
137
+ </x-form-col>
138
+ <!-- TODO 多选框 -->
139
+ <!-- TODO 单选框 -->
140
+ <!-- 日期范围选择器 -->
141
+ <x-form-col
142
+ v-else-if="attr.type === 'rangePicker'"
143
+ :xl="xl"
144
+ :xxl="xxl">
145
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
146
+ <a-range-picker v-model="form[attr.model]" :disabled="disabled" :show-time="true" valueFormat="YYYY-MM-DD HH:mm:ss"/>
147
+ </a-form-model-item>
148
+ </x-form-col>
149
+ <!-- 月份选择器 -->
150
+ <x-form-col
151
+ v-else-if="attr.type === 'monthPicker'"
152
+ :xl="xl"
153
+ :xxl="xxl">
154
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
155
+ <a-month-picker v-model="form[attr.model]" :disabled="disabled" :show-time="true" valueFormat="YYYY-MM"/>
156
+ </a-form-model-item>
157
+ </x-form-col>
158
+ <!-- 日期选择器 -->
159
+ <x-form-col
160
+ v-else-if="attr.type === 'datePicker'"
161
+ :xl="xl"
162
+ :xxl="xxl">
163
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
164
+ <a-date-picker v-model="form[attr.model]" :disabled="disabled" :show-time="true" valueFormat="YYYY-MM-DD"/>
165
+ </a-form-model-item>
166
+ </x-form-col>
167
+ <!-- 级联选择器 -->
168
+ <x-form-col
169
+ v-else-if="attr.type === 'cascader'"
170
+ :xl="xl"
171
+ :xxl="xxl">
172
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
173
+ <template v-if="attr.keys">
174
+ <a-dcascader :disabled="disabled" :option="attr.keys" :value="form[attr.model]"/>
175
+ </template>
176
+ <template v-else>
177
+ <a-dcascader :disabled="disabled" :option="option" :value="form[attr.model]"/>
178
+ </template>
179
+ </a-form-model-item>
180
+ </x-form-col>
181
+ <!-- 文本域 -->
182
+ <x-form-col
183
+ v-else-if="attr.type === 'textarea'"
184
+ :lg="24"
185
+ :md="24"
186
+ :sm="24"
187
+ :xl="24"
188
+ :xs="24"
189
+ :xxl="24">
190
+ <a-form-model-item
191
+ :ref="attr.model"
192
+ :label="attr.name"
193
+ :prop="attr.model">
194
+ <a-textarea v-model="form[attr.model]" :disabled="disabled" :placeholder="attr.placeholder ? attr.placeholder : '请输入'+attr.name.replace(/\s*/g, '')" :rows="4"/>
195
+ </a-form-model-item>
196
+ </x-form-col>
197
+ <!-- TODO 文件上传 -->
198
+ <x-form-col
199
+ v-else-if="attr.type === 'file' || attr.type === 'image'"
200
+ :lg="24"
201
+ :md="24"
202
+ :sm="24"
203
+ :xl="24"
204
+ :xs="24"
205
+ :xxl="24">
206
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
207
+ <upload :model="attr" @setFiles="setFiles" :files="files" :images="images"></upload>
208
+ </a-form-model-item>
209
+ </x-form-col>
210
+ <!-- TODO 地点搜索框 -->
211
+ <x-form-col
212
+ v-else-if="attr.type === 'addressSearch'"
213
+ :xl="xl"
214
+ :xxl="xxl">
215
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
216
+ <address-search-combobox
217
+ v-model="searchResult"
218
+ searchResultType="Object"
219
+ @onSelect="form=Object.assign(form,JSON.parse(searchResult))"
220
+ :resultKeys="{ address: attr.model, coords: `${attr.model}_coords` }"
221
+ ></address-search-combobox>
222
+ </a-form-model-item>
223
+ </x-form-col>
224
+ <!-- TODO 省市区选择框 -->
225
+ <x-form-col
226
+ v-else-if="attr.type === 'citySelect'"
227
+ :xl="xl"
228
+ :xxl="xxl">
229
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
230
+ <citySelect v-model="form[attr.model]" ></citySelect>
231
+ </a-form-model-item>
232
+ </x-form-col>
233
+ </template>
234
+ <script>
235
+
236
+ import { post } from '@vue2-client/services/api'
237
+ import { debounce } from 'ant-design-vue/lib/vc-table/src/utils'
238
+
239
+ export default {
240
+ name: 'XFormItem',
241
+ data () {
242
+ // 检索去抖
243
+ this.fetchFunction = debounce(this.fetchFunction, 800)
244
+ return {
245
+ option: [],
246
+ // 最后检索版本
247
+ lastFetchId: 0,
248
+ // 检索中
249
+ searching: false,
250
+ searchResult: ''
251
+ }
252
+ },
253
+ props: {
254
+ attr: {
255
+ type: Object,
256
+ default: () => {
257
+ return {}
258
+ }
259
+ },
260
+ form: {
261
+ type: Object,
262
+ required: true
263
+ },
264
+ disabled: {
265
+ type: Boolean,
266
+ default: () => {
267
+ return false
268
+ }
269
+ },
270
+ mode: {
271
+ type: String,
272
+ default: () => {
273
+ return '查询'
274
+ }
275
+ },
276
+ xl: {
277
+ type: Number,
278
+ default: undefined
279
+ },
280
+ xxl: {
281
+ type: Number,
282
+ default: undefined
283
+ },
284
+ selectsArray: {
285
+ type: Object,
286
+ default: () => {
287
+ return {}
288
+ }
289
+ },
290
+ files: {
291
+ type: Array,
292
+ default: () => {
293
+ return []
294
+ }
295
+ },
296
+ images: {
297
+ type: Array,
298
+ default: () => {
299
+ return []
300
+ }
301
+ },
302
+ },
303
+ created () {
304
+ if (this.attr.keyName && this.attr.keyName.indexOf('logic@') !== -1) {
305
+ this.getData({}, res => {
306
+ this.option = res
307
+ })
308
+ }
309
+ },
310
+ methods: {
311
+ // 向父组件获取级联框的数据
312
+ selectsItemCheck (groupName, index, value) {
313
+ this.$emit('selectsItemCheck', val => { this.selectsArray = val }, groupName, index, value)
314
+ },
315
+ // 文件框时设置上传组件的值
316
+ setFiles (fileIds) {
317
+ this.form[this.attr.model] = fileIds
318
+ },
319
+ // 懒加载检索方法
320
+ fetchFunction (value) {
321
+ this.lastFetchId += 1
322
+ const fetchId = this.lastFetchId
323
+ this.option = []
324
+ this.searching = true
325
+ this.getData({
326
+ word: value
327
+ }, res => {
328
+ if (fetchId !== this.lastFetchId) {
329
+ return
330
+ }
331
+ this.option = res
332
+ this.searching = false
333
+ })
334
+ },
335
+ // 获取数据
336
+ getData (value, callback) {
337
+ if (value !== '') {
338
+ const logicName = this.attr.keyName
339
+ const logic = logicName.substring(6)
340
+ post('/webmeterapi/' + logic, value).then(res => {
341
+ callback(res)
342
+ })
343
+ }
344
+ },
345
+ filterOption (input, option) {
346
+ if (option.componentOptions.children[0].text) {
347
+ return (
348
+ option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
349
+ )
350
+ } else {
351
+ return (
352
+ option.componentOptions.children[0].child.value.toLowerCase().indexOf(input.toLowerCase()) >= 0
353
+ )
354
+ }
355
+ }
356
+ }
357
+ }
358
+ </script>