vue2-client 1.4.20 → 1.4.22

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