vue2-client 1.3.0 → 1.3.3

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 (106) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/index.js +30 -28
  3. package/package.json +1 -1
  4. package/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox.vue +225 -225
  5. package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +777 -777
  6. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQueryItem.vue +553 -553
  7. package/src/base-client/components/common/FormGroupQuery/FormGroupQuery.vue +165 -163
  8. package/src/base-client/components/common/Upload/Upload.vue +161 -158
  9. package/src/base-client/components/common/XAddForm/XAddForm.vue +349 -349
  10. package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +321 -322
  11. package/src/base-client/components/common/XForm/XForm.vue +273 -268
  12. package/src/base-client/components/common/XForm/XFormItem.vue +387 -371
  13. package/src/base-client/components/common/XFormTable/XFormTable.vue +8 -7
  14. package/src/base-client/components/common/XTable/XTable.vue +278 -274
  15. package/src/base-client/components/{iot → system}/LogDetailsView/LogDetailsView.vue +0 -0
  16. package/src/base-client/components/{iot → system}/LogDetailsView/index.js +0 -0
  17. package/src/base-client/components/{iot → system}/LogDetailsView/index.md +0 -0
  18. package/src/base-client/components/system/QueryParamsDetailsView/QueryParamsDetailsView.vue +281 -280
  19. package/src/base-client/components/ticket/TicketDetailsView/TicketDetailsView.vue +806 -804
  20. package/src/base-client/components/ticket/TicketSubmitSuccessView/TicketSubmitSuccessView.vue +24 -24
  21. package/src/base-client/plugins/PagedList.js +177 -176
  22. package/src/components/STable/index.js +318 -316
  23. package/src/components/index.js +36 -36
  24. package/src/components/table/StandardTable.vue +141 -142
  25. package/src/components/tool/TagSelect.vue +83 -83
  26. package/src/layouts/header/AdminHeader.vue +104 -109
  27. package/src/layouts/header/HeaderNotice.vue +167 -199
  28. package/src/layouts/header/InstitutionDetail.vue +181 -182
  29. package/src/pages/CreateQueryPage.vue +65 -59
  30. package/src/pages/system/dictionary/index.vue +43 -41
  31. package/src/pages/system/file/Info.vue +56 -0
  32. package/src/pages/system/file/index.vue +317 -0
  33. package/src/pages/system/queryParams/index.vue +43 -41
  34. package/src/pages/system/ticket/index.vue +458 -452
  35. package/src/pages/system/ticket/submitTicketSuccess.vue +206 -203
  36. package/src/router/async/config.async.js +2 -1
  37. package/src/router/async/router.map.js +56 -60
  38. package/src/services/api/DictionaryDetailsViewApi.js +6 -6
  39. package/src/services/api/LogDetailsViewApi.js +10 -10
  40. package/src/services/api/QueryParamsDetailsViewApi.js +6 -6
  41. package/src/services/api/TicketDetailsViewApi.js +42 -40
  42. package/src/services/api/commonTempTable.js +10 -0
  43. package/src/services/api/index.js +2 -24
  44. package/src/services/api/manage.js +8 -16
  45. package/src/utils/excel/Blob.js +181 -181
  46. package/src/utils/excel/Export2Excel.js +141 -142
  47. package/src/utils/i18n.js +80 -80
  48. package/src/utils/request.js +4 -4
  49. package/src/utils/routerUtil.js +358 -350
  50. package/src/utils/theme-color-replacer-extend.js +91 -92
  51. package/vue.config.js +109 -163
  52. package/src/base-client/all.js +0 -62
  53. package/src/base-client/components/iot/CustomerDetailsView/CustomerDetailsView.vue +0 -225
  54. package/src/base-client/components/iot/CustomerDetailsView/index.js +0 -3
  55. package/src/base-client/components/iot/CustomerDetailsView/index.md +0 -40
  56. package/src/base-client/components/iot/DataAnalysisUser/DataAnalysisUser.vue +0 -127
  57. package/src/base-client/components/iot/DataAnalysisUser/index.js +0 -3
  58. package/src/base-client/components/iot/DeviceBrandDetailsView/DeviceBrandDetailsView.vue +0 -452
  59. package/src/base-client/components/iot/DeviceBrandDetailsView/index.js +0 -3
  60. package/src/base-client/components/iot/DeviceDetailsView/DeviceDetailsView.vue +0 -232
  61. package/src/base-client/components/iot/DeviceDetailsView/index.js +0 -3
  62. package/src/base-client/components/iot/DeviceDetailsView/index.md +0 -41
  63. package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsCount.vue +0 -678
  64. package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsException.vue +0 -57
  65. package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsInstruct.vue +0 -122
  66. package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsInstructOperate.vue +0 -121
  67. package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsMain.vue +0 -269
  68. package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsRead.vue +0 -131
  69. package/src/base-client/components/iot/DeviceDetailsView/part/index.js +0 -8
  70. package/src/base-client/components/iot/DeviceTypeDetailsView/DeviceTypeDetailsView.vue +0 -300
  71. package/src/base-client/components/iot/DeviceTypeDetailsView/index.js +0 -3
  72. package/src/base-client/components/iot/InstructDetailsView/InstructDetailsView.vue +0 -464
  73. package/src/base-client/components/iot/InstructDetailsView/index.js +0 -3
  74. package/src/base-client/components/iot/InstructDetailsView/index.md +0 -43
  75. package/src/base-client/components/iot/MeterDetailsView/MeterDetailsView.vue +0 -352
  76. package/src/base-client/components/iot/MeterDetailsView/index.js +0 -3
  77. package/src/base-client/components/iot/MeterDetailsView/index.md +0 -41
  78. package/src/base-client/components/iot/MeterDetailsView/part/MeterDetailsCount.vue +0 -330
  79. package/src/base-client/components/iot/MeterDetailsView/part/MeterDetailsException.vue +0 -179
  80. package/src/base-client/components/iot/MeterDetailsView/part/MeterDetailsHandPlan.vue +0 -285
  81. package/src/base-client/components/iot/MeterDetailsView/part/MeterDetailsInstruct.vue +0 -230
  82. package/src/base-client/components/iot/MeterDetailsView/part/MeterDetailsMain.vue +0 -251
  83. package/src/base-client/components/iot/MeterDetailsView/part/MeterDetailsSellGas.vue +0 -184
  84. package/src/base-client/components/iot/MeterDetailsView/part/index.js +0 -9
  85. package/src/base-client/components/iot/WebmeterAnalysisView/WebmeterAnalysisView.vue +0 -960
  86. package/src/base-client/components/iot/WebmeterAnalysisView/index.js +0 -3
  87. package/src/base-client/components/iot/WebmeterAnalysisView/index.md +0 -42
  88. package/src/base-client/components/ticket/EmployeeDetailsView/EmployeeDetailsView.vue +0 -370
  89. package/src/base-client/components/ticket/EmployeeDetailsView/index.js +0 -3
  90. package/src/base-client/components/ticket/EmployeeDetailsView/index.md +0 -28
  91. package/src/components/Charts/DataUserOrderSituation.vue +0 -77
  92. package/src/components/Charts/DataUserReporting.vue +0 -74
  93. package/src/components/Charts/DataUserSituation.vue +0 -107
  94. package/src/services/api/CustomerDetailsViewApi.js +0 -6
  95. package/src/services/api/DeviceBrandDetailsViewApi.js +0 -14
  96. package/src/services/api/DeviceDetailsViewApi.js +0 -10
  97. package/src/services/api/DeviceTypeDetailsViewApi.js +0 -6
  98. package/src/services/api/EmployeeDetailsViewApi.js +0 -12
  99. package/src/services/api/FormGroupEditApi.js +0 -6
  100. package/src/services/api/InstructDetailsViewApi.js +0 -12
  101. package/src/services/api/MeterDetailsViewApi.js +0 -24
  102. package/src/services/api/WebmeterAnalysisViewApi.js +0 -24
  103. package/src/services/api/applyInstallApi.js +0 -14
  104. package/src/services/api/iot/DeviceDetailsView/DeviceDetailsCountApi.js +0 -18
  105. package/src/services/api/iot.js +0 -7
  106. package/src/services/api/service.js +0 -12
@@ -1,371 +1,387 @@
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="item.value">{{ item.label }}
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="item.value">
66
- {{ item.label }}
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="item.value">{{ item.label }}
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="item.value">{{ item.label }}
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
- <a-cascader
174
- :disabled="disabled"
175
- change-on-select
176
- :options="option"
177
- v-model="form[attr.model]"
178
- :placeholder="attr.placeholder ? attr.placeholder : '请选择'+attr.name.replace(/\s*/g, '')"
179
- :rows="4"/>
180
- </a-form-model-item>
181
- </x-form-col>
182
- <!-- 文本域 -->
183
- <x-form-col
184
- v-else-if="attr.type === 'textarea'"
185
- :lg="24"
186
- :md="24"
187
- :sm="24"
188
- :xl="24"
189
- :xs="24"
190
- :xxl="24">
191
- <a-form-model-item
192
- :ref="attr.model"
193
- :label="attr.name"
194
- :prop="attr.model">
195
- <a-textarea v-model="form[attr.model]" :disabled="disabled" :placeholder="attr.placeholder ? attr.placeholder : '请输入'+attr.name.replace(/\s*/g, '')" :rows="4"/>
196
- </a-form-model-item>
197
- </x-form-col>
198
- <!-- TODO 文件上传 -->
199
- <x-form-col
200
- v-else-if="attr.type === 'file' || attr.type === 'image'"
201
- :lg="24"
202
- :md="24"
203
- :sm="24"
204
- :xl="24"
205
- :xs="24"
206
- :xxl="24">
207
- <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
208
- <upload :model="attr" @setFiles="setFiles" :files="files" :images="images"></upload>
209
- </a-form-model-item>
210
- </x-form-col>
211
- <!-- TODO 地点搜索框 -->
212
- <x-form-col
213
- v-else-if="attr.type === 'addressSearch'"
214
- :xl="xl"
215
- :xxl="xxl">
216
- <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
217
- <address-search-combobox
218
- v-model="searchResult"
219
- searchResultType="Object"
220
- @onSelect="form=Object.assign(form,JSON.parse(searchResult))"
221
- :resultKeys="{ address: attr.model, coords: `${attr.model}_lng_lat` }"
222
- ></address-search-combobox>
223
- </a-form-model-item>
224
- </x-form-col>
225
- <!-- TODO 省市区选择框 -->
226
- <x-form-col
227
- v-else-if="attr.type === 'citySelect'"
228
- :xl="xl"
229
- :xxl="xxl">
230
- <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
231
- <citySelect v-model="form[attr.model]" ></citySelect>
232
- </a-form-model-item>
233
- </x-form-col>
234
- <!-- TODO 省市区选择框 -->
235
- <x-form-col
236
- v-else-if="attr.type === 'personSetting'"
237
- :xl="xl"
238
- :xxl="xxl">
239
- <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
240
- <PersonSetting v-model="form[attr.model]" ></PersonSetting>
241
- </a-form-model-item>
242
- </x-form-col>
243
- </template>
244
- <script>
245
-
246
- import { post } from '@vue2-client/services/api'
247
- import { debounce } from 'ant-design-vue/lib/vc-table/src/utils'
248
-
249
- export default {
250
- name: 'XFormItem',
251
- data () {
252
- // 检索去抖
253
- this.fetchFunction = debounce(this.fetchFunction, 800)
254
- return {
255
- option: [],
256
- // 最后检索版本
257
- lastFetchId: 0,
258
- // 检索中
259
- searching: false,
260
- searchResult: ''
261
- }
262
- },
263
- props: {
264
- attr: {
265
- type: Object,
266
- default: () => {
267
- return {}
268
- }
269
- },
270
- form: {
271
- type: Object,
272
- required: true
273
- },
274
- disabled: {
275
- type: Boolean,
276
- default: () => {
277
- return false
278
- }
279
- },
280
- mode: {
281
- type: String,
282
- default: () => {
283
- return '查询'
284
- }
285
- },
286
- xl: {
287
- type: Number,
288
- default: undefined
289
- },
290
- xxl: {
291
- type: Number,
292
- default: undefined
293
- },
294
- selectsArray: {
295
- type: Object,
296
- default: () => {
297
- return {}
298
- }
299
- },
300
- files: {
301
- type: Array,
302
- default: () => {
303
- return []
304
- }
305
- },
306
- images: {
307
- type: Array,
308
- default: () => {
309
- return []
310
- }
311
- },
312
- },
313
- created () {
314
- if (this.attr.keyName && this.attr.keyName.indexOf('logic@') !== -1) {
315
- this.getData({}, res => {
316
- this.option = res
317
- })
318
- }
319
- },
320
- methods: {
321
- // 向父组件获取级联框的数据
322
- selectsItemCheck (groupName, index, value) {
323
- this.$emit('selectsItemCheck', val => { this.selectsArray = val }, groupName, index, value)
324
- },
325
- // 文件框时设置上传组件的值
326
- setFiles (fileIds) {
327
- if (!this.form[this.attr.model]) {
328
- this.form[this.attr.model] = []
329
- }
330
- this.form[this.attr.model] = [...fileIds]
331
- },
332
- // 懒加载检索方法
333
- fetchFunction (value) {
334
- this.lastFetchId += 1
335
- const fetchId = this.lastFetchId
336
- this.option = []
337
- this.searching = true
338
- this.getData({
339
- word: value
340
- }, res => {
341
- if (fetchId !== this.lastFetchId) {
342
- return
343
- }
344
- this.option = res
345
- this.searching = false
346
- })
347
- },
348
- // 获取数据
349
- getData (value, callback) {
350
- if (value !== '') {
351
- const logicName = this.attr.keyName
352
- const logic = logicName.substring(6)
353
- post('/webmeterapi/' + logic, value).then(res => {
354
- callback(res)
355
- })
356
- }
357
- },
358
- filterOption (input, option) {
359
- if (option.componentOptions.children[0].text) {
360
- return (
361
- option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
362
- )
363
- } else {
364
- return (
365
- option.componentOptions.children[0].child.value.toLowerCase().indexOf(input.toLowerCase()) >= 0
366
- )
367
- }
368
- }
369
- }
370
- }
371
- </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
+ v-model="form['rowIdName']"
15
+ :getPopupContainer=" triggerNode => { return triggerNode.parentNode } "
16
+ style="width: 100px">
17
+ <a-select-option
18
+ v-for="(item,index) in attr.keys"
19
+ :key="index"
20
+ :value="item.value">{{ item.label }}
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
+ v-if="!attr.lazyLoad || attr.lazyLoad === 'false'"
49
+ v-model="form[attr.model]"
50
+ :disabled="disabled"
51
+ :filter-option="filterOption"
52
+ :getPopupContainer=" triggerNode => { return triggerNode.parentNode } "
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="item.value">
66
+ {{ item.label }}
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="item.value">{{ item.label }}
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
+ :getPopupContainer=" triggerNode => { return triggerNode.parentNode } "
94
+ :placeholder="attr.placeholder ? attr.placeholder : '搜索' + attr.name"
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="item.value">{{ item.label }}
108
+ </a-select-option>
109
+ </a-select>
110
+ </a-form-model-item>
111
+ </x-form-col>
112
+ <!-- 级联下拉框 -->
113
+ <x-form-col
114
+ v-else-if="attr.type === 'selects'"
115
+ :xl="xl"
116
+ :xxl="xxl">
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
+ :getPopupContainer=" triggerNode => { return triggerNode.parentNode } "
126
+ :placeholder="attr.placeholder ? attr.placeholder : '请选择'"
127
+ show-search
128
+ @change="selectsItemCheck(attr.group, attr.groupIndex, form[attr.model])"
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
+ <a-cascader
174
+ v-model="form[attr.model]"
175
+ :disabled="disabled"
176
+ :options="option"
177
+ :placeholder="attr.placeholder ? attr.placeholder : '请选择'+attr.name.replace(/\s*/g, '')"
178
+ :rows="4"
179
+ change-on-select/>
180
+ </a-form-model-item>
181
+ </x-form-col>
182
+ <!-- 文本域 -->
183
+ <x-form-col
184
+ v-else-if="attr.type === 'textarea'"
185
+ :lg="24"
186
+ :md="24"
187
+ :sm="24"
188
+ :xl="24"
189
+ :xs="24"
190
+ :xxl="24">
191
+ <a-form-model-item
192
+ :ref="attr.model"
193
+ :label="attr.name"
194
+ :prop="attr.model">
195
+ <a-textarea v-model="form[attr.model]" :disabled="disabled" :placeholder="attr.placeholder ? attr.placeholder : '请输入'+attr.name.replace(/\s*/g, '')" :rows="4"/>
196
+ </a-form-model-item>
197
+ </x-form-col>
198
+ <!-- 文件上传 -->
199
+ <x-form-col
200
+ v-else-if="attr.type === 'file' || attr.type === 'image'"
201
+ :lg="24"
202
+ :md="24"
203
+ :sm="24"
204
+ :xl="24"
205
+ :xs="24"
206
+ :xxl="24">
207
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
208
+ <upload :files="files" :images="images" :model="attr" :service-name="serviceName" @setFiles="setFiles"></upload>
209
+ </a-form-model-item>
210
+ </x-form-col>
211
+ <!-- 省市区选择框 -->
212
+ <x-form-col
213
+ v-else-if="attr.type === 'citySelect'"
214
+ :xl="xl"
215
+ :xxl="xxl">
216
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
217
+ <citySelect v-model="form[attr.model]" ></citySelect>
218
+ </a-form-model-item>
219
+ </x-form-col>
220
+ <!-- 地点搜索框 -->
221
+ <x-form-col
222
+ v-else-if="attr.type === 'addressSearch'"
223
+ :xl="xl"
224
+ :xxl="xxl">
225
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
226
+ <address-search-combobox
227
+ v-model="searchResult"
228
+ :resultKeys="{ address: attr.model, coords: `${attr.model}_lng_lat` }"
229
+ searchResultType="Object"
230
+ @onSelect="form=Object.assign(form,JSON.parse(searchResult))"
231
+ ></address-search-combobox>
232
+ </a-form-model-item>
233
+ </x-form-col>
234
+ <!-- 人员选择框 -->
235
+ <x-form-col
236
+ v-else-if="attr.type === 'personSetting'"
237
+ :xl="xl"
238
+ :xxl="xxl">
239
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
240
+ <PersonSetting v-model="form[attr.model]" ></PersonSetting>
241
+ </a-form-model-item>
242
+ </x-form-col>
243
+ </template>
244
+ <script>
245
+
246
+ import { post } from '@vue2-client/services/api'
247
+ import { debounce } from 'ant-design-vue/lib/vc-table/src/utils'
248
+ import XFormCol from '@/base-client/components/common/XFormCol'
249
+ import XBadge from '@/base-client/components/common/XBadge'
250
+ import CitySelect from '@/base-client/components/common/CitySelect'
251
+ import PersonSetting from '@/base-client/components/common/PersonSetting'
252
+ import AddressSearchCombobox from '@/base-client/components/common/AddressSearchCombobox'
253
+
254
+ export default {
255
+ name: 'XFormItem',
256
+ components: {
257
+ XFormCol,
258
+ XBadge,
259
+ CitySelect,
260
+ PersonSetting,
261
+ AddressSearchCombobox
262
+ },
263
+ data () {
264
+ // 检索去抖
265
+ this.fetchFunction = debounce(this.fetchFunction, 800)
266
+ return {
267
+ option: [],
268
+ // 最后检索版本
269
+ lastFetchId: 0,
270
+ // 检索中
271
+ searching: false,
272
+ searchResult: ''
273
+ }
274
+ },
275
+ props: {
276
+ attr: {
277
+ type: Object,
278
+ default: () => {
279
+ return {}
280
+ }
281
+ },
282
+ form: {
283
+ type: Object,
284
+ required: true
285
+ },
286
+ disabled: {
287
+ type: Boolean,
288
+ default: () => {
289
+ return false
290
+ }
291
+ },
292
+ mode: {
293
+ type: String,
294
+ default: () => {
295
+ return '查询'
296
+ }
297
+ },
298
+ xl: {
299
+ type: Number,
300
+ default: undefined
301
+ },
302
+ xxl: {
303
+ type: Number,
304
+ default: undefined
305
+ },
306
+ selectsArray: {
307
+ type: Object,
308
+ default: () => {
309
+ return {}
310
+ }
311
+ },
312
+ files: {
313
+ type: Array,
314
+ default: () => {
315
+ return []
316
+ }
317
+ },
318
+ images: {
319
+ type: Array,
320
+ default: () => {
321
+ return []
322
+ }
323
+ },
324
+ serviceName: {
325
+ type: String,
326
+ default: 'af-system'
327
+ }
328
+ },
329
+ created () {
330
+ if (this.attr.keyName && this.attr.keyName.indexOf('logic@') !== -1) {
331
+ this.getData({}, res => {
332
+ this.option = res
333
+ })
334
+ }
335
+ },
336
+ methods: {
337
+ // 向父组件获取级联框的数据
338
+ selectsItemCheck (groupName, index, value) {
339
+ this.$emit('selectsItemCheck', val => { this.selectsArray = val }, groupName, index, value)
340
+ },
341
+ // 文件框时设置上传组件的值
342
+ setFiles (fileIds) {
343
+ if (!this.form[this.attr.model]) {
344
+ this.form[this.attr.model] = []
345
+ }
346
+ this.form[this.attr.model] = [...fileIds]
347
+ },
348
+ // 懒加载检索方法
349
+ fetchFunction (value) {
350
+ this.lastFetchId += 1
351
+ const fetchId = this.lastFetchId
352
+ this.option = []
353
+ this.searching = true
354
+ this.getData({
355
+ word: value
356
+ }, res => {
357
+ if (fetchId !== this.lastFetchId) {
358
+ return
359
+ }
360
+ this.option = res
361
+ this.searching = false
362
+ })
363
+ },
364
+ // 获取数据
365
+ getData (value, callback) {
366
+ if (value !== '') {
367
+ const logicName = this.attr.keyName
368
+ const logic = logicName.substring(6)
369
+ post('/af-system/' + logic, value).then(res => {
370
+ callback(res)
371
+ })
372
+ }
373
+ },
374
+ filterOption (input, option) {
375
+ if (option.componentOptions.children[0].text) {
376
+ return (
377
+ option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
378
+ )
379
+ } else {
380
+ return (
381
+ option.componentOptions.children[0].child.value.toLowerCase().indexOf(input.toLowerCase()) >= 0
382
+ )
383
+ }
384
+ }
385
+ }
386
+ }
387
+ </script>