vue2-client 1.4.19 → 1.4.21

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 (91) hide show
  1. package/CHANGELOG.md +388 -382
  2. package/index.js +30 -30
  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/CreateQuery.vue +595 -595
  6. package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +777 -777
  7. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQueryItem.vue +553 -553
  8. package/src/base-client/components/common/FormGroupQuery/FormGroupQuery.vue +165 -165
  9. package/src/base-client/components/common/JSONToTree/jsontotree.vue +275 -275
  10. package/src/base-client/components/common/XAddForm/XAddForm.vue +354 -354
  11. package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +327 -327
  12. package/src/base-client/components/common/XCard/XCard.vue +64 -64
  13. package/src/base-client/components/common/XForm/XForm.vue +274 -274
  14. package/src/base-client/components/common/XForm/XFormItem.vue +365 -389
  15. package/src/base-client/components/common/XFormTable/index.md +96 -96
  16. package/src/base-client/components/system/QueryParamsDetailsView/QueryParamsDetailsView.vue +281 -281
  17. package/src/base-client/components/ticket/TicketDetailsView/TicketDetailsView.vue +807 -807
  18. package/src/base-client/components/ticket/TicketDetailsView/index.md +29 -29
  19. package/src/base-client/components/ticket/TicketDetailsView/part/TicketDetailsFlow.vue +260 -260
  20. package/src/base-client/components/ticket/TicketSubmitSuccessView/TicketSubmitSuccessView.vue +532 -532
  21. package/src/base-client/components/ticket/TicketSubmitSuccessView/index.md +29 -29
  22. package/src/base-client/plugins/AppData.js +73 -69
  23. package/src/base-client/plugins/GetLoginInfoService.js +179 -179
  24. package/src/base-client/plugins/PagedList.js +177 -177
  25. package/src/base-client/plugins/compatible/LoginServiceOA.js +20 -20
  26. package/src/base-client/plugins/i18n-extend.js +32 -32
  27. package/src/components/Ellipsis/index.md +38 -38
  28. package/src/components/NumberInfo/index.md +43 -43
  29. package/src/components/STable/README.md +341 -341
  30. package/src/components/STable/index.js +318 -318
  31. package/src/components/Trend/index.md +45 -45
  32. package/src/components/checkbox/ColorCheckbox.vue +157 -157
  33. package/src/components/checkbox/ImgCheckbox.vue +163 -163
  34. package/src/components/form/FormRow.vue +52 -52
  35. package/src/components/index.js +36 -36
  36. package/src/components/menu/SideMenu.vue +62 -62
  37. package/src/components/menu/menu.js +273 -273
  38. package/src/components/setting/Setting.vue +235 -235
  39. package/src/components/table/StandardTable.vue +141 -141
  40. package/src/components/table/advance/ActionColumns.vue +158 -158
  41. package/src/components/table/advance/SearchArea.vue +355 -355
  42. package/src/components/tool/AStepItem.vue +60 -60
  43. package/src/components/tool/AvatarList.vue +68 -68
  44. package/src/components/tool/Drawer.vue +142 -142
  45. package/src/components/tool/TagSelect.vue +83 -83
  46. package/src/components/transition/PageToggleTransition.vue +97 -97
  47. package/src/config/replacer/resolve.config.js +67 -67
  48. package/src/layouts/AdminLayout.vue +174 -174
  49. package/src/layouts/SinglePageView.vue +88 -88
  50. package/src/layouts/header/AdminHeader.vue +104 -104
  51. package/src/layouts/header/HeaderNotice.vue +167 -167
  52. package/src/layouts/header/HeaderSearch.vue +67 -67
  53. package/src/layouts/header/InstitutionDetail.vue +181 -181
  54. package/src/layouts/tabs/TabsHead.vue +190 -190
  55. package/src/layouts/tabs/TabsView.vue +379 -379
  56. package/src/mock/goods/index.js +108 -108
  57. package/src/pages/CreateQueryPage.vue +65 -65
  58. package/src/pages/login/Login.vue +351 -342
  59. package/src/pages/report/ReportTable.js +124 -124
  60. package/src/pages/report/ReportTableHome.vue +28 -28
  61. package/src/pages/resourceManage/orgListManage.vue +98 -98
  62. package/src/pages/system/dictionary/index.vue +43 -43
  63. package/src/pages/system/file/index.vue +317 -317
  64. package/src/pages/system/monitor/loginInfor/index.vue +36 -36
  65. package/src/pages/system/monitor/operLog/index.vue +36 -36
  66. package/src/pages/system/queryParams/index.vue +43 -43
  67. package/src/pages/system/ticket/index.vue +475 -474
  68. package/src/router/async/config.async.js +27 -27
  69. package/src/router/async/router.map.js +65 -65
  70. package/src/router/index.js +27 -27
  71. package/src/services/api/DictionaryDetailsViewApi.js +6 -6
  72. package/src/services/api/LogDetailsViewApi.js +10 -10
  73. package/src/services/api/QueryParamsDetailsViewApi.js +6 -6
  74. package/src/services/api/TicketDetailsViewApi.js +34 -34
  75. package/src/services/api/commonTempTable.js +10 -10
  76. package/src/services/api/index.js +17 -17
  77. package/src/services/api/manage.js +8 -8
  78. package/src/services/apiService.js +14 -14
  79. package/src/services/user.js +53 -53
  80. package/src/store/modules/index.js +4 -4
  81. package/src/theme/default/nprogress.less +76 -76
  82. package/src/theme/default/style.less +47 -47
  83. package/src/utils/colors.js +103 -103
  84. package/src/utils/excel/Blob.js +180 -180
  85. package/src/utils/excel/Export2Excel.js +141 -141
  86. package/src/utils/formatter.js +68 -68
  87. package/src/utils/i18n.js +80 -80
  88. package/src/utils/routerUtil.js +364 -364
  89. package/src/utils/theme-color-replacer-extend.js +91 -91
  90. package/src/utils/themeUtil.js +100 -100
  91. package/src/utils/util.js +230 -230
@@ -1,389 +1,365 @@
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 '@vue2-client/base-client/components/common/XFormCol'
249
- import XBadge from '@vue2-client/base-client/components/common/XBadge'
250
- import CitySelect from '@vue2-client/base-client/components/common/CitySelect'
251
- import PersonSetting from '@vue2-client/base-client/components/common/PersonSetting'
252
- import AddressSearchCombobox from '@vue2-client/base-client/components/common/AddressSearchCombobox'
253
- import Upload from '@vue2-client/base-client/components/common/Upload'
254
-
255
- export default {
256
- name: 'XFormItem',
257
- components: {
258
- XFormCol,
259
- XBadge,
260
- CitySelect,
261
- PersonSetting,
262
- AddressSearchCombobox,
263
- Upload
264
- },
265
- data () {
266
- // 检索去抖
267
- this.fetchFunction = debounce(this.fetchFunction, 800)
268
- return {
269
- option: [],
270
- // 最后检索版本
271
- lastFetchId: 0,
272
- // 检索中
273
- searching: false,
274
- searchResult: ''
275
- }
276
- },
277
- props: {
278
- attr: {
279
- type: Object,
280
- default: () => {
281
- return {}
282
- }
283
- },
284
- form: {
285
- type: Object,
286
- required: true
287
- },
288
- disabled: {
289
- type: Boolean,
290
- default: () => {
291
- return false
292
- }
293
- },
294
- mode: {
295
- type: String,
296
- default: () => {
297
- return '查询'
298
- }
299
- },
300
- xl: {
301
- type: Number,
302
- default: undefined
303
- },
304
- xxl: {
305
- type: Number,
306
- default: undefined
307
- },
308
- selectsArray: {
309
- type: Object,
310
- default: () => {
311
- return {}
312
- }
313
- },
314
- files: {
315
- type: Array,
316
- default: () => {
317
- return []
318
- }
319
- },
320
- images: {
321
- type: Array,
322
- default: () => {
323
- return []
324
- }
325
- },
326
- serviceName: {
327
- type: String,
328
- default: 'af-system'
329
- }
330
- },
331
- created () {
332
- if (this.attr.keyName && this.attr.keyName.indexOf('logic@') !== -1) {
333
- this.getData({}, res => {
334
- this.option = res
335
- })
336
- }
337
- },
338
- methods: {
339
- // 向父组件获取级联框的数据
340
- selectsItemCheck (groupName, index, value) {
341
- this.$emit('selectsItemCheck', val => { this.selectsArray = val }, groupName, index, value)
342
- },
343
- // 文件框时设置上传组件的值
344
- setFiles (fileIds) {
345
- if (!this.form[this.attr.model]) {
346
- this.form[this.attr.model] = []
347
- }
348
- this.form[this.attr.model] = [...fileIds]
349
- },
350
- // 懒加载检索方法
351
- fetchFunction (value) {
352
- this.lastFetchId += 1
353
- const fetchId = this.lastFetchId
354
- this.option = []
355
- this.searching = true
356
- this.getData({
357
- word: value
358
- }, res => {
359
- if (fetchId !== this.lastFetchId) {
360
- return
361
- }
362
- this.option = res
363
- this.searching = false
364
- })
365
- },
366
- // 获取数据
367
- getData (value, callback) {
368
- if (value !== '') {
369
- const logicName = this.attr.keyName
370
- const logic = logicName.substring(6)
371
- post('/api/' + this.serviceName + '/logic/' + logic, value).then(res => {
372
- callback(res)
373
- })
374
- }
375
- },
376
- filterOption (input, option) {
377
- if (option.componentOptions.children[0].text) {
378
- return (
379
- option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
380
- )
381
- } else {
382
- return (
383
- option.componentOptions.children[0].child.value.toLowerCase().indexOf(input.toLowerCase()) >= 0
384
- )
385
- }
386
- }
387
- }
388
- }
389
- </script>
1
+ <template>
2
+ <!-- 输入框 -->
3
+ <x-form-col
4
+ v-if="attr.type === 'input'"
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" :placeholder="attr.placeholder ? attr.placeholder : '请输入'+attr.name.replace(/\s*/g, '')"/>
12
+ </a-form-model-item>
13
+ </x-form-col>
14
+ <!-- 下拉框 -->
15
+ <x-form-col
16
+ v-else-if="attr.type === 'select'"
17
+ :xl="xl"
18
+ :xxl="xxl">
19
+ <a-form-model-item
20
+ :ref="attr.model"
21
+ :label="attr.name"
22
+ :prop="attr.model">
23
+ <a-select
24
+ v-if="!attr.lazyLoad || attr.lazyLoad === 'false'"
25
+ v-model="form[attr.model]"
26
+ :disabled="disabled"
27
+ :filter-option="filterOption"
28
+ :getPopupContainer=" triggerNode => { return triggerNode.parentNode } "
29
+ :placeholder="attr.placeholder ? attr.placeholder : '请选择'"
30
+ show-search
31
+ >
32
+ <a-select-option
33
+ v-if="mode === '查询'"
34
+ key="999999"
35
+ value="全部">全部
36
+ </a-select-option>
37
+ <template v-if="attr.keys">
38
+ <a-select-option
39
+ v-for="(item,index) in attr.keys"
40
+ :key="index"
41
+ :value="item.value">
42
+ {{ item.label }}
43
+ </a-select-option>
44
+ </template>
45
+ <template v-else>
46
+ <template v-if="attr.keyName.indexOf('logic@') !== -1">
47
+ <a-select-option
48
+ v-for="(item,index) in option"
49
+ :key="index"
50
+ :value="item.value">{{ item.label }}
51
+ </a-select-option>
52
+ </template>
53
+ <template v-else>
54
+ <a-select-option
55
+ v-for="item in $appdata.getDictionaryList(attr.keyName)"
56
+ :key="item.value"
57
+ :value="item.value">
58
+ <!-- 徽标(badge) -->
59
+ <x-badge :badge-key="attr.keyName" :replaceText="item.text" :value="item.value"/>
60
+ </a-select-option>
61
+ </template>
62
+ </template>
63
+ </a-select>
64
+ <a-select
65
+ v-else
66
+ v-model="form[attr.model]"
67
+ :disabled="disabled"
68
+ :filter-option="filterOption"
69
+ :getPopupContainer=" triggerNode => { return triggerNode.parentNode } "
70
+ :placeholder="attr.placeholder ? attr.placeholder : '搜索' + attr.name"
71
+ show-search
72
+ @search="fetchFunction"
73
+ >
74
+ <a-spin v-if="searching" slot="notFoundContent" size="small" />
75
+ <a-select-option
76
+ v-if="mode === '查询'"
77
+ key="999999"
78
+ value="全部">全部
79
+ </a-select-option>
80
+ <a-select-option
81
+ v-for="(item,index) in option"
82
+ :key="index"
83
+ :value="item.value">{{ item.label }}
84
+ </a-select-option>
85
+ </a-select>
86
+ </a-form-model-item>
87
+ </x-form-col>
88
+ <!-- 级联下拉框 -->
89
+ <x-form-col
90
+ v-else-if="attr.type === 'selects'"
91
+ :xl="xl"
92
+ :xxl="xxl">
93
+ <a-form-model-item
94
+ :ref="attr.model"
95
+ :label="attr.name"
96
+ :prop="attr.model">
97
+ <a-select
98
+ v-if="!attr.lazyLoad || attr.lazyLoad === 'false'"
99
+ v-model="form[attr.model]"
100
+ :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))"
101
+ :getPopupContainer=" triggerNode => { return triggerNode.parentNode } "
102
+ :placeholder="attr.placeholder ? attr.placeholder : '请选择'"
103
+ show-search
104
+ @change="selectsItemCheck(attr.group, attr.groupIndex, form[attr.model])"
105
+ >
106
+ <template v-for="optionItem in selectsArray[attr.group][attr.groupIndex]" v-if="selectsArray[attr.group].length > 0 || selectsArray[attr.group][attr.groupIndex]">
107
+ <a-select-option :key="optionItem.label" :value="optionItem.value">
108
+ {{ optionItem.label }}
109
+ </a-select-option>
110
+ </template>
111
+ </a-select>
112
+ </a-form-model-item>
113
+ </x-form-col>
114
+ <!-- TODO 多选框 -->
115
+ <!-- TODO 单选框 -->
116
+ <!-- 日期范围选择器 -->
117
+ <x-form-col
118
+ v-else-if="attr.type === 'rangePicker'"
119
+ :xl="xl"
120
+ :xxl="xxl">
121
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
122
+ <a-range-picker v-model="form[attr.model]" :disabled="disabled" :show-time="true" valueFormat="YYYY-MM-DD HH:mm:ss"/>
123
+ </a-form-model-item>
124
+ </x-form-col>
125
+ <!-- 月份选择器 -->
126
+ <x-form-col
127
+ v-else-if="attr.type === 'monthPicker'"
128
+ :xl="xl"
129
+ :xxl="xxl">
130
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
131
+ <a-month-picker v-model="form[attr.model]" :disabled="disabled" :show-time="true" valueFormat="YYYY-MM"/>
132
+ </a-form-model-item>
133
+ </x-form-col>
134
+ <!-- 日期选择器 -->
135
+ <x-form-col
136
+ v-else-if="attr.type === 'datePicker'"
137
+ :xl="xl"
138
+ :xxl="xxl">
139
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
140
+ <a-date-picker v-model="form[attr.model]" :disabled="disabled" :show-time="true" valueFormat="YYYY-MM-DD"/>
141
+ </a-form-model-item>
142
+ </x-form-col>
143
+ <!-- 级联选择器 -->
144
+ <x-form-col
145
+ v-else-if="attr.type === 'cascader'"
146
+ :xl="xl"
147
+ :xxl="xxl">
148
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
149
+ <a-cascader
150
+ v-model="form[attr.model]"
151
+ :disabled="disabled"
152
+ :options="option"
153
+ :placeholder="attr.placeholder ? attr.placeholder : '请选择'+attr.name.replace(/\s*/g, '')"
154
+ :rows="4"
155
+ change-on-select/>
156
+ </a-form-model-item>
157
+ </x-form-col>
158
+ <!-- 文本域 -->
159
+ <x-form-col
160
+ v-else-if="attr.type === 'textarea'"
161
+ :lg="24"
162
+ :md="24"
163
+ :sm="24"
164
+ :xl="24"
165
+ :xs="24"
166
+ :xxl="24">
167
+ <a-form-model-item
168
+ :ref="attr.model"
169
+ :label="attr.name"
170
+ :prop="attr.model">
171
+ <a-textarea v-model="form[attr.model]" :disabled="disabled" :placeholder="attr.placeholder ? attr.placeholder : '请输入'+attr.name.replace(/\s*/g, '')" :rows="4"/>
172
+ </a-form-model-item>
173
+ </x-form-col>
174
+ <!-- 文件上传 -->
175
+ <x-form-col
176
+ v-else-if="attr.type === 'file' || attr.type === 'image'"
177
+ :lg="24"
178
+ :md="24"
179
+ :sm="24"
180
+ :xl="24"
181
+ :xs="24"
182
+ :xxl="24">
183
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
184
+ <upload :files="files" :images="images" :model="attr" :service-name="serviceName" @setFiles="setFiles"></upload>
185
+ </a-form-model-item>
186
+ </x-form-col>
187
+ <!-- 省市区选择框 -->
188
+ <x-form-col
189
+ v-else-if="attr.type === 'citySelect'"
190
+ :xl="xl"
191
+ :xxl="xxl">
192
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
193
+ <citySelect v-model="form[attr.model]" ></citySelect>
194
+ </a-form-model-item>
195
+ </x-form-col>
196
+ <!-- 地点搜索框 -->
197
+ <x-form-col
198
+ v-else-if="attr.type === 'addressSearch'"
199
+ :xl="xl"
200
+ :xxl="xxl">
201
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
202
+ <address-search-combobox
203
+ v-model="searchResult"
204
+ :resultKeys="{ address: attr.model, coords: `${attr.model}_lng_lat` }"
205
+ searchResultType="Object"
206
+ @onSelect="form=Object.assign(form,JSON.parse(searchResult))"
207
+ ></address-search-combobox>
208
+ </a-form-model-item>
209
+ </x-form-col>
210
+ <!-- 人员选择框 -->
211
+ <x-form-col
212
+ v-else-if="attr.type === 'personSetting'"
213
+ :xl="xl"
214
+ :xxl="xxl">
215
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
216
+ <PersonSetting v-model="form[attr.model]" ></PersonSetting>
217
+ </a-form-model-item>
218
+ </x-form-col>
219
+ </template>
220
+ <script>
221
+
222
+ import { post } from '@vue2-client/services/api'
223
+ import { debounce } from 'ant-design-vue/lib/vc-table/src/utils'
224
+ import XFormCol from '@vue2-client/base-client/components/common/XFormCol'
225
+ import XBadge from '@vue2-client/base-client/components/common/XBadge'
226
+ import CitySelect from '@vue2-client/base-client/components/common/CitySelect'
227
+ import PersonSetting from '@vue2-client/base-client/components/common/PersonSetting'
228
+ import AddressSearchCombobox from '@vue2-client/base-client/components/common/AddressSearchCombobox'
229
+ import Upload from '@vue2-client/base-client/components/common/Upload'
230
+
231
+ export default {
232
+ name: 'XFormItem',
233
+ components: {
234
+ XFormCol,
235
+ XBadge,
236
+ CitySelect,
237
+ PersonSetting,
238
+ AddressSearchCombobox,
239
+ Upload
240
+ },
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
+ serviceName: {
303
+ type: String,
304
+ default: 'af-system'
305
+ }
306
+ },
307
+ created () {
308
+ if (this.attr.keyName && this.attr.keyName.indexOf('logic@') !== -1) {
309
+ this.getData({}, res => {
310
+ this.option = res
311
+ })
312
+ }
313
+ },
314
+ methods: {
315
+ // 向父组件获取级联框的数据
316
+ selectsItemCheck (groupName, index, value) {
317
+ this.$emit('selectsItemCheck', val => { this.selectsArray = val }, groupName, index, value)
318
+ },
319
+ // 文件框时设置上传组件的值
320
+ setFiles (fileIds) {
321
+ if (!this.form[this.attr.model]) {
322
+ this.form[this.attr.model] = []
323
+ }
324
+ this.form[this.attr.model] = [...fileIds]
325
+ },
326
+ // 懒加载检索方法
327
+ fetchFunction (value) {
328
+ this.lastFetchId += 1
329
+ const fetchId = this.lastFetchId
330
+ this.option = []
331
+ this.searching = true
332
+ this.getData({
333
+ word: value
334
+ }, res => {
335
+ if (fetchId !== this.lastFetchId) {
336
+ return
337
+ }
338
+ this.option = res
339
+ this.searching = false
340
+ })
341
+ },
342
+ // 获取数据
343
+ getData (value, callback) {
344
+ if (value !== '') {
345
+ const logicName = this.attr.keyName
346
+ const logic = logicName.substring(6)
347
+ post('/api/' + this.serviceName + '/logic/' + logic, value).then(res => {
348
+ callback(res)
349
+ })
350
+ }
351
+ },
352
+ filterOption (input, option) {
353
+ if (option.componentOptions.children[0].text) {
354
+ return (
355
+ option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
356
+ )
357
+ } else {
358
+ return (
359
+ option.componentOptions.children[0].child.value.toLowerCase().indexOf(input.toLowerCase()) >= 0
360
+ )
361
+ }
362
+ }
363
+ }
364
+ }
365
+ </script>