vue2-client 1.4.59 → 1.4.60

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 (102) hide show
  1. package/CHANGELOG.md +480 -477
  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/CreateQueryItem.vue +778 -778
  6. package/src/base-client/components/common/FormGroupEdit/FormGroupEdit.vue +151 -151
  7. package/src/base-client/components/common/FormGroupQuery/FormGroupQuery.vue +165 -165
  8. package/src/base-client/components/common/JSONToTree/jsontotree.vue +275 -275
  9. package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +327 -327
  10. package/src/base-client/components/common/XCard/XCard.vue +64 -64
  11. package/src/base-client/components/common/XForm/XForm.vue +274 -274
  12. package/src/base-client/components/common/XForm/XFormItem.vue +519 -471
  13. package/src/base-client/components/common/XFormTable/XFormTable.vue +570 -570
  14. package/src/base-client/components/common/XFormTable/index.md +96 -96
  15. package/src/base-client/components/common/XTreeOne/XTreeOne.vue +109 -109
  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/exception/ExceptionPage.vue +70 -70
  35. package/src/components/form/FormRow.vue +52 -52
  36. package/src/components/index.js +36 -36
  37. package/src/components/menu/SideMenu.vue +62 -62
  38. package/src/components/menu/menu.js +273 -273
  39. package/src/components/page/header/index.less +40 -40
  40. package/src/components/setting/Setting.vue +235 -235
  41. package/src/components/table/StandardTable.vue +141 -141
  42. package/src/components/table/advance/ActionColumns.vue +158 -158
  43. package/src/components/table/advance/SearchArea.vue +355 -355
  44. package/src/components/tool/AStepItem.vue +60 -60
  45. package/src/components/tool/AvatarList.vue +68 -68
  46. package/src/components/tool/Drawer.vue +142 -142
  47. package/src/components/tool/TagSelect.vue +83 -83
  48. package/src/components/transition/PageToggleTransition.vue +97 -97
  49. package/src/config/CreateQueryConfig.js +7 -4
  50. package/src/config/default/admin.config.js +18 -18
  51. package/src/config/default/setting.config.js +44 -44
  52. package/src/config/replacer/resolve.config.js +67 -67
  53. package/src/layouts/AdminLayout.vue +174 -174
  54. package/src/layouts/CommonLayout.vue +42 -42
  55. package/src/layouts/ComponentLayoutOne.vue +47 -47
  56. package/src/layouts/PageLayout.vue +151 -151
  57. package/src/layouts/SinglePageView.vue +111 -111
  58. package/src/layouts/footer/PageFooter.vue +49 -49
  59. package/src/layouts/header/AdminHeader.vue +104 -104
  60. package/src/layouts/header/HeaderNotice.vue +167 -167
  61. package/src/layouts/header/HeaderSearch.vue +67 -67
  62. package/src/layouts/header/InstitutionDetail.vue +181 -181
  63. package/src/layouts/header/index.less +92 -92
  64. package/src/layouts/tabs/TabsHead.vue +190 -190
  65. package/src/layouts/tabs/TabsView.vue +379 -379
  66. package/src/mock/goods/index.js +108 -108
  67. package/src/pages/exception/404.vue +25 -25
  68. package/src/pages/login/Login.vue +348 -348
  69. package/src/pages/report/ReportTable.js +124 -124
  70. package/src/pages/report/ReportTableHome.vue +28 -28
  71. package/src/pages/resourceManage/orgListManage.vue +98 -98
  72. package/src/pages/system/dictionary/index.vue +43 -43
  73. package/src/pages/system/file/index.vue +317 -317
  74. package/src/pages/system/monitor/loginInfor/index.vue +36 -36
  75. package/src/pages/system/monitor/operLog/index.vue +36 -36
  76. package/src/pages/system/queryParams/index.vue +43 -43
  77. package/src/router/async/config.async.js +27 -27
  78. package/src/router/async/router.map.js +68 -68
  79. package/src/router/guards.js +104 -104
  80. package/src/router/index.js +27 -27
  81. package/src/services/api/DictionaryDetailsViewApi.js +6 -6
  82. package/src/services/api/LogDetailsViewApi.js +10 -10
  83. package/src/services/api/QueryParamsDetailsViewApi.js +6 -6
  84. package/src/services/api/TicketDetailsViewApi.js +34 -34
  85. package/src/services/api/cas.js +79 -79
  86. package/src/services/api/commonTempTable.js +10 -10
  87. package/src/services/api/index.js +17 -17
  88. package/src/services/api/logininfor/index.js +6 -6
  89. package/src/services/api/manage.js +8 -8
  90. package/src/services/apiService.js +13 -13
  91. package/src/services/user.js +53 -53
  92. package/src/store/modules/index.js +4 -4
  93. package/src/theme/default/nprogress.less +76 -76
  94. package/src/theme/default/style.less +47 -47
  95. package/src/utils/colors.js +107 -107
  96. package/src/utils/excel/Blob.js +180 -180
  97. package/src/utils/excel/Export2Excel.js +141 -141
  98. package/src/utils/formatter.js +68 -68
  99. package/src/utils/i18n.js +80 -80
  100. package/src/utils/theme-color-replacer-extend.js +91 -91
  101. package/src/utils/themeUtil.js +100 -100
  102. package/src/utils/util.js +230 -230
@@ -1,471 +1,519 @@
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 === 'yearPicker'"
202
- :xl="xl"
203
- :xxl="xxl">
204
- <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
205
- <a-date-picker
206
- v-model="form[attr.model]"
207
- :disabled="disabled"
208
- format="YYYY"
209
- mode="year"
210
- v-decorator="['year']"
211
- placeholder="请输入年份"
212
- :open="yearShowOne"
213
- @openChange="openChangeOne"
214
- @panelChange="panelChangeOne"/>
215
- </a-form-model-item>
216
- </x-form-col>
217
- <!-- 日期选择器 -->
218
- <x-form-col
219
- v-else-if="attr.type === 'datePicker'"
220
- :xl="xl"
221
- :xxl="xxl">
222
- <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
223
- <a-range-picker
224
- v-if="mode === '查询'"
225
- v-model="form[attr.model]"
226
- :disabled="disabled"
227
- :show-time="{ defaultValue: [moment('00:00:00', 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')] }"
228
- format="YYYY-MM-DD"
229
- valueFormat="YYYY-MM-DD HH:mm:ss" />
230
- <a-date-picker v-else v-model="form[attr.model]" :disabled="disabled" :show-time="{ defaultValue: moment('00:00:00', 'HH:mm:ss') }" valueFormat="YYYY-MM-DD HH:mm:ss"/>
231
- </a-form-model-item>
232
- </x-form-col>
233
- <!-- 级联选择器 -->
234
- <x-form-col
235
- v-else-if="attr.type === 'cascader'"
236
- :xl="xl"
237
- :xxl="xxl">
238
- <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
239
- <a-cascader
240
- v-model="form[attr.model]"
241
- :disabled="disabled"
242
- :options="option"
243
- :placeholder="attr.placeholder ? attr.placeholder : '请选择'+attr.name.replace(/\s*/g, '')"
244
- :rows="4"
245
- change-on-select/>
246
- </a-form-model-item>
247
- </x-form-col>
248
- <!-- 文本域 -->
249
- <x-form-col
250
- v-else-if="attr.type === 'textarea'"
251
- :lg="24"
252
- :md="24"
253
- :sm="24"
254
- :xl="24"
255
- :xs="24"
256
- :xxl="24">
257
- <a-form-model-item
258
- :ref="attr.model"
259
- :label="attr.name"
260
- :prop="attr.model">
261
- <a-textarea v-model="form[attr.model]" :disabled="disabled" :placeholder="attr.placeholder ? attr.placeholder : '请输入'+attr.name.replace(/\s*/g, '')" :rows="4"/>
262
- </a-form-model-item>
263
- </x-form-col>
264
- <!-- 文件上传 -->
265
- <x-form-col
266
- v-else-if="attr.type === 'file' || attr.type === 'image'"
267
- :lg="24"
268
- :md="24"
269
- :sm="24"
270
- :xl="24"
271
- :xs="24"
272
- :xxl="24">
273
- <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
274
- <upload :files="files" :images="images" :model="attr" :service-name="serviceName" @setFiles="setFiles"></upload>
275
- </a-form-model-item>
276
- </x-form-col>
277
- <!-- 省市区选择框 -->
278
- <x-form-col
279
- v-else-if="attr.type === 'citySelect'"
280
- :xl="xl"
281
- :xxl="xxl">
282
- <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
283
- <citySelect v-model="form[attr.model]" ></citySelect>
284
- </a-form-model-item>
285
- </x-form-col>
286
- <!-- 地点搜索框 -->
287
- <x-form-col
288
- v-else-if="attr.type === 'addressSearch'"
289
- :xl="xl"
290
- :xxl="xxl">
291
- <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
292
- <address-search-combobox
293
- v-model="searchResult"
294
- :resultKeys="{ address: attr.model, coords: `${attr.model}_lng_lat` }"
295
- searchResultType="Object"
296
- @onSelect="form=Object.assign(form,JSON.parse(searchResult))"
297
- ></address-search-combobox>
298
- </a-form-model-item>
299
- </x-form-col>
300
- <!-- 人员选择框 -->
301
- <x-form-col
302
- v-else-if="attr.type === 'personSetting'"
303
- :xl="xl"
304
- :xxl="xxl">
305
- <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
306
- <PersonSetting v-model="form[attr.model]" ></PersonSetting>
307
- </a-form-model-item>
308
- </x-form-col>
309
- </template>
310
- <script>
311
-
312
- import { post } from '@vue2-client/services/api'
313
- import { debounce } from 'ant-design-vue/lib/vc-table/src/utils'
314
- import XFormCol from '@vue2-client/base-client/components/common/XFormCol'
315
- import XBadge from '@vue2-client/base-client/components/common/XBadge'
316
- import CitySelect from '@vue2-client/base-client/components/common/CitySelect'
317
- import PersonSetting from '@vue2-client/base-client/components/common/PersonSetting'
318
- import AddressSearchCombobox from '@vue2-client/base-client/components/common/AddressSearchCombobox'
319
- import Upload from '@vue2-client/base-client/components/common/Upload'
320
- import moment from 'moment'
321
-
322
- export default {
323
- name: 'XFormItem',
324
- components: {
325
- XFormCol,
326
- XBadge,
327
- CitySelect,
328
- PersonSetting,
329
- AddressSearchCombobox,
330
- Upload
331
- },
332
- data () {
333
- // 检索去抖
334
- this.fetchFunction = debounce(this.fetchFunction, 800)
335
- return {
336
- option: [],
337
- // 最后检索版本
338
- lastFetchId: 0,
339
- // 检索中
340
- searching: false,
341
- searchResult: '',
342
- yearShowOne: false,
343
- // moment
344
- moment
345
- }
346
- },
347
- props: {
348
- attr: {
349
- type: Object,
350
- default: () => {
351
- return {}
352
- }
353
- },
354
- form: {
355
- type: Object,
356
- required: true
357
- },
358
- disabled: {
359
- type: Boolean,
360
- default: () => {
361
- return false
362
- }
363
- },
364
- mode: {
365
- type: String,
366
- default: () => {
367
- return '查询'
368
- }
369
- },
370
- xl: {
371
- type: Number,
372
- default: undefined
373
- },
374
- xxl: {
375
- type: Number,
376
- default: undefined
377
- },
378
- selectsArray: {
379
- type: Object,
380
- default: () => {
381
- return {}
382
- }
383
- },
384
- files: {
385
- type: Array,
386
- default: () => {
387
- return []
388
- }
389
- },
390
- images: {
391
- type: Array,
392
- default: () => {
393
- return []
394
- }
395
- },
396
- serviceName: {
397
- type: String,
398
- default: 'af-system'
399
- }
400
- },
401
- created () {
402
- if (this.attr.type !== 'selects' &&
403
- this.attr.keyName &&
404
- this.attr.keyName.indexOf('logic@') !== -1) {
405
- this.getData({}, res => {
406
- this.option = res
407
- })
408
- }
409
- },
410
- methods: {
411
- openChangeOne (status) {
412
- if (status) {
413
- this.yearShowOne = true
414
- }
415
- },
416
- // 得到年份选择器的值
417
- panelChangeOne (value) {
418
- this.yearShowOne = false
419
- this.form[this.attr.model] = value.format('YYYY')
420
- },
421
- // 向父组件获取级联框的数据
422
- selectsItemCheck (groupName, index, value) {
423
- this.$emit('selectsItemCheck', val => { this.selectsArray = val }, groupName, index, value)
424
- },
425
- // 文件框时设置上传组件的值
426
- setFiles (fileIds) {
427
- if (!this.form[this.attr.model]) {
428
- this.form[this.attr.model] = []
429
- }
430
- this.form[this.attr.model] = [...fileIds]
431
- },
432
- // 懒加载检索方法
433
- fetchFunction (value) {
434
- this.lastFetchId += 1
435
- const fetchId = this.lastFetchId
436
- this.option = []
437
- this.searching = true
438
- this.getData({
439
- word: value
440
- }, res => {
441
- if (fetchId !== this.lastFetchId) {
442
- return
443
- }
444
- this.option = res
445
- this.searching = false
446
- })
447
- },
448
- // 获取数据
449
- getData (value, callback) {
450
- if (value !== '') {
451
- const logicName = this.attr.keyName
452
- const logic = logicName.substring(6)
453
- post('/api/' + this.serviceName + '/logic/' + logic, value).then(res => {
454
- callback(res)
455
- })
456
- }
457
- },
458
- filterOption (input, option) {
459
- if (option.componentOptions.children[0].text) {
460
- return (
461
- option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
462
- )
463
- } else {
464
- return (
465
- option.componentOptions.children[0].child.value.toLowerCase().indexOf(input.toLowerCase()) >= 0
466
- )
467
- }
468
- }
469
- }
470
- }
471
- </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 === 'yearPicker'"
202
+ :xl="xl"
203
+ :xxl="xxl">
204
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
205
+ <a-date-picker
206
+ v-model="form[attr.model]"
207
+ :disabled="disabled"
208
+ format="YYYY"
209
+ mode="year"
210
+ v-decorator="['year']"
211
+ placeholder="请输入年份"
212
+ :open="yearShowOne"
213
+ @openChange="openChangeOne"
214
+ @panelChange="panelChangeOne"/>
215
+ </a-form-model-item>
216
+ </x-form-col>
217
+ <!-- 日期选择器 -->
218
+ <x-form-col
219
+ v-else-if="attr.type === 'datePicker'"
220
+ :xl="xl"
221
+ :xxl="xxl">
222
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
223
+ <a-range-picker
224
+ v-if="mode === '查询'"
225
+ v-model="form[attr.model]"
226
+ :disabled="disabled"
227
+ :show-time="{ defaultValue: [moment('00:00:00', 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')] }"
228
+ format="YYYY-MM-DD"
229
+ valueFormat="YYYY-MM-DD HH:mm:ss" />
230
+ <a-date-picker v-else v-model="form[attr.model]" :disabled="disabled" :show-time="{ defaultValue: moment('00:00:00', 'HH:mm:ss') }" valueFormat="YYYY-MM-DD HH:mm:ss"/>
231
+ </a-form-model-item>
232
+ </x-form-col>
233
+ <!-- 级联选择器 -->
234
+ <x-form-col
235
+ v-else-if="attr.type === 'cascader'"
236
+ :xl="xl"
237
+ :xxl="xxl">
238
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
239
+ <a-cascader
240
+ v-model="form[attr.model]"
241
+ :disabled="disabled"
242
+ :options="option"
243
+ :placeholder="attr.placeholder ? attr.placeholder : '请选择'+attr.name.replace(/\s*/g, '')"
244
+ :rows="4"
245
+ change-on-select/>
246
+ </a-form-model-item>
247
+ </x-form-col>
248
+ <!-- 文本域 -->
249
+ <x-form-col
250
+ v-else-if="attr.type === 'textarea'"
251
+ :lg="24"
252
+ :md="24"
253
+ :sm="24"
254
+ :xl="24"
255
+ :xs="24"
256
+ :xxl="24">
257
+ <a-form-model-item
258
+ :ref="attr.model"
259
+ :label="attr.name"
260
+ :prop="attr.model">
261
+ <a-textarea v-model="form[attr.model]" :disabled="disabled" :placeholder="attr.placeholder ? attr.placeholder : '请输入'+attr.name.replace(/\s*/g, '')" :rows="4"/>
262
+ </a-form-model-item>
263
+ </x-form-col>
264
+ <!-- 文件上传 -->
265
+ <x-form-col
266
+ v-else-if="attr.type === 'file' || attr.type === 'image'"
267
+ :lg="24"
268
+ :md="24"
269
+ :sm="24"
270
+ :xl="24"
271
+ :xs="24"
272
+ :xxl="24">
273
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
274
+ <upload :files="files" :images="images" :model="attr" :service-name="serviceName" @setFiles="setFiles"></upload>
275
+ </a-form-model-item>
276
+ </x-form-col>
277
+ <!-- 省市区选择框 -->
278
+ <x-form-col
279
+ v-else-if="attr.type === 'citySelect'"
280
+ :xl="xl"
281
+ :xxl="xxl">
282
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
283
+ <citySelect v-model="form[attr.model]" ></citySelect>
284
+ </a-form-model-item>
285
+ </x-form-col>
286
+ <!-- 地点搜索框 -->
287
+ <x-form-col
288
+ v-else-if="attr.type === 'addressSearch'"
289
+ :xl="xl"
290
+ :xxl="xxl">
291
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
292
+ <address-search-combobox
293
+ v-model="searchResult"
294
+ :resultKeys="{ address: attr.model, coords: `${attr.model}_lng_lat` }"
295
+ searchResultType="Object"
296
+ @onSelect="form=Object.assign(form,JSON.parse(searchResult))"
297
+ ></address-search-combobox>
298
+ </a-form-model-item>
299
+ </x-form-col>
300
+ <!-- 人员选择框 -->
301
+ <x-form-col
302
+ v-else-if="attr.type === 'personSetting'"
303
+ :xl="xl"
304
+ :xxl="xxl">
305
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
306
+ <PersonSetting v-model="form[attr.model]" ></PersonSetting>
307
+ </a-form-model-item>
308
+ </x-form-col>
309
+ <!-- 树形选择框 -->
310
+ <x-form-col
311
+ v-else-if="attr.type === 'treeSelect'"
312
+ :xl="xl"
313
+ :xxl="xxl">
314
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
315
+ <a-tree-select
316
+ v-model="form[attr.model]"
317
+ :disabled="disabled"
318
+ :tree-data="getTreeData()"
319
+ :tree-checkable="mode === '查询'"
320
+ :placeholder="'请选择' + attr.name"
321
+ :dropdown-style="{ maxHeight: '400px' }"
322
+ tree-node-filter-prop="label"
323
+ allow-clear
324
+ class="tree-select">
325
+ </a-tree-select>
326
+ </a-form-model-item>
327
+ </x-form-col>
328
+ </template>
329
+ <script>
330
+
331
+ import { post } from '@vue2-client/services/api'
332
+ import { debounce } from 'ant-design-vue/lib/vc-table/src/utils'
333
+ import XFormCol from '@vue2-client/base-client/components/common/XFormCol'
334
+ import XBadge from '@vue2-client/base-client/components/common/XBadge'
335
+ import CitySelect from '@vue2-client/base-client/components/common/CitySelect'
336
+ import PersonSetting from '@vue2-client/base-client/components/common/PersonSetting'
337
+ import AddressSearchCombobox from '@vue2-client/base-client/components/common/AddressSearchCombobox'
338
+ import Upload from '@vue2-client/base-client/components/common/Upload'
339
+ import moment from 'moment'
340
+
341
+ export default {
342
+ name: 'XFormItem',
343
+ components: {
344
+ XFormCol,
345
+ XBadge,
346
+ CitySelect,
347
+ PersonSetting,
348
+ AddressSearchCombobox,
349
+ Upload
350
+ },
351
+ data () {
352
+ // 检索去抖
353
+ this.fetchFunction = debounce(this.fetchFunction, 800)
354
+ return {
355
+ option: [],
356
+ // 最后检索版本
357
+ lastFetchId: 0,
358
+ // 检索中
359
+ searching: false,
360
+ searchResult: '',
361
+ yearShowOne: false,
362
+ // moment
363
+ moment
364
+ }
365
+ },
366
+ props: {
367
+ attr: {
368
+ type: Object,
369
+ default: () => {
370
+ return {}
371
+ }
372
+ },
373
+ form: {
374
+ type: Object,
375
+ required: true
376
+ },
377
+ disabled: {
378
+ type: Boolean,
379
+ default: () => {
380
+ return false
381
+ }
382
+ },
383
+ mode: {
384
+ type: String,
385
+ default: () => {
386
+ return '查询'
387
+ }
388
+ },
389
+ xl: {
390
+ type: Number,
391
+ default: undefined
392
+ },
393
+ xxl: {
394
+ type: Number,
395
+ default: undefined
396
+ },
397
+ selectsArray: {
398
+ type: Object,
399
+ default: () => {
400
+ return {}
401
+ }
402
+ },
403
+ files: {
404
+ type: Array,
405
+ default: () => {
406
+ return []
407
+ }
408
+ },
409
+ images: {
410
+ type: Array,
411
+ default: () => {
412
+ return []
413
+ }
414
+ },
415
+ serviceName: {
416
+ type: String,
417
+ default: 'af-system'
418
+ }
419
+ },
420
+ created () {
421
+ if (this.attr.type !== 'selects' &&
422
+ this.attr.keyName &&
423
+ this.attr.keyName.indexOf('logic@') !== -1) {
424
+ this.getData({}, res => {
425
+ this.option = res
426
+ })
427
+ }
428
+ },
429
+ methods: {
430
+ openChangeOne (status) {
431
+ if (status) {
432
+ this.yearShowOne = true
433
+ }
434
+ },
435
+ // 得到年份选择器的值
436
+ panelChangeOne (value) {
437
+ this.yearShowOne = false
438
+ this.form[this.attr.model] = value.format('YYYY')
439
+ },
440
+ // 向父组件获取级联框的数据
441
+ selectsItemCheck (groupName, index, value) {
442
+ this.$emit('selectsItemCheck', val => { this.selectsArray = val }, groupName, index, value)
443
+ },
444
+ // 文件框时设置上传组件的值
445
+ setFiles (fileIds) {
446
+ if (!this.form[this.attr.model]) {
447
+ this.form[this.attr.model] = []
448
+ }
449
+ this.form[this.attr.model] = [...fileIds]
450
+ },
451
+ // 懒加载检索方法
452
+ fetchFunction (value) {
453
+ this.lastFetchId += 1
454
+ const fetchId = this.lastFetchId
455
+ this.option = []
456
+ this.searching = true
457
+ this.getData({
458
+ word: value
459
+ }, res => {
460
+ if (fetchId !== this.lastFetchId) {
461
+ return
462
+ }
463
+ this.option = res
464
+ this.searching = false
465
+ })
466
+ },
467
+ // 获取数据
468
+ getData (value, callback) {
469
+ if (value !== '') {
470
+ const logicName = this.attr.keyName
471
+ const logic = logicName.substring(6)
472
+ post('/api/' + this.serviceName + '/logic/' + logic, value).then(res => {
473
+ callback(res)
474
+ })
475
+ }
476
+ },
477
+ filterOption (input, option) {
478
+ if (option.componentOptions.children[0].text) {
479
+ return (
480
+ option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
481
+ )
482
+ } else {
483
+ return (
484
+ option.componentOptions.children[0].child.value.toLowerCase().indexOf(input.toLowerCase()) >= 0
485
+ )
486
+ }
487
+ },
488
+ // 获取树形选择框数据
489
+ getTreeData () {
490
+ let treeData = this.attr.keys
491
+ if (!treeData) {
492
+ treeData = this.option
493
+ }
494
+ if (this.mode === '新增/修改') {
495
+ this.setParentSelectable(treeData)
496
+ }
497
+ return treeData
498
+ },
499
+ // 设置树形选择框不能选择父节点
500
+ setParentSelectable (treeData) {
501
+ treeData.forEach(item => {
502
+ if (item.children && item.children.length) {
503
+ item.selectable = false
504
+ this.setParentSelectable(item.children)
505
+ }
506
+ })
507
+ }
508
+ }
509
+ }
510
+ </script>
511
+
512
+ <style lang="less" scoped>
513
+ .tree-select {
514
+ /deep/ .ant-select-selection.ant-select-selection--multiple {
515
+ max-height: 48px;
516
+ overflow-y: auto;
517
+ }
518
+ }
519
+ </style>