vue2-client 1.4.47 → 1.4.49

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 (104) hide show
  1. package/.env +15 -15
  2. package/.eslintrc.js +82 -82
  3. package/CHANGELOG.md +4 -1
  4. package/index.js +30 -30
  5. package/package.json +1 -1
  6. package/src/assets/img/querySlotDemo.svg +15 -15
  7. package/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox.vue +225 -225
  8. package/src/base-client/components/common/AmapMarker/AmapPointRendering.vue +113 -113
  9. package/src/base-client/components/common/CitySelect/CitySelect.vue +244 -244
  10. package/src/base-client/components/common/CitySelect/index.js +3 -3
  11. package/src/base-client/components/common/CitySelect/index.md +109 -109
  12. package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +777 -777
  13. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQuery.vue +310 -310
  14. package/src/base-client/components/common/FormGroupQuery/FormGroupQuery.vue +165 -165
  15. package/src/base-client/components/common/JSONToTree/jsontotree.vue +275 -275
  16. package/src/base-client/components/common/PersonSetting/PersonSetting.vue +210 -210
  17. package/src/base-client/components/common/PersonSetting/index.js +3 -3
  18. package/src/base-client/components/common/Upload/index.js +3 -3
  19. package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +327 -327
  20. package/src/base-client/components/common/XCard/XCard.vue +64 -64
  21. package/src/base-client/components/common/XForm/XForm.vue +274 -274
  22. package/src/base-client/components/common/XForm/XFormItem.vue +469 -469
  23. package/src/base-client/components/common/XFormTable/index.md +96 -96
  24. package/src/base-client/components/system/QueryParamsDetailsView/QueryParamsDetailsView.vue +281 -281
  25. package/src/base-client/components/ticket/TicketDetailsView/TicketDetailsView.vue +807 -807
  26. package/src/base-client/components/ticket/TicketDetailsView/index.md +29 -29
  27. package/src/base-client/components/ticket/TicketDetailsView/part/TicketDetailsFlow.vue +260 -260
  28. package/src/base-client/components/ticket/TicketSubmitSuccessView/TicketSubmitSuccessView.vue +532 -532
  29. package/src/base-client/components/ticket/TicketSubmitSuccessView/index.md +29 -29
  30. package/src/base-client/plugins/AppData.js +73 -73
  31. package/src/base-client/plugins/GetLoginInfoService.js +179 -179
  32. package/src/base-client/plugins/PagedList.js +177 -177
  33. package/src/base-client/plugins/compatible/LoginServiceOA.js +20 -20
  34. package/src/base-client/plugins/i18n-extend.js +32 -32
  35. package/src/components/Ellipsis/index.md +38 -38
  36. package/src/components/NumberInfo/index.md +43 -43
  37. package/src/components/STable/README.md +341 -341
  38. package/src/components/STable/index.js +318 -318
  39. package/src/components/Trend/index.md +45 -45
  40. package/src/components/checkbox/ColorCheckbox.vue +157 -157
  41. package/src/components/checkbox/ImgCheckbox.vue +163 -163
  42. package/src/components/form/FormRow.vue +52 -52
  43. package/src/components/index.js +36 -36
  44. package/src/components/menu/SideMenu.vue +62 -62
  45. package/src/components/menu/menu.js +273 -273
  46. package/src/components/page/header/index.less +40 -40
  47. package/src/components/setting/Setting.vue +235 -235
  48. package/src/components/table/StandardTable.vue +141 -141
  49. package/src/components/table/advance/ActionColumns.vue +158 -158
  50. package/src/components/table/advance/SearchArea.vue +355 -355
  51. package/src/components/tool/AStepItem.vue +60 -60
  52. package/src/components/tool/AvatarList.vue +68 -68
  53. package/src/components/tool/Drawer.vue +142 -142
  54. package/src/components/tool/TagSelect.vue +83 -83
  55. package/src/components/transition/PageToggleTransition.vue +97 -97
  56. package/src/config/CreateQueryConfig.js +310 -310
  57. package/src/config/default/admin.config.js +18 -18
  58. package/src/config/replacer/resolve.config.js +67 -67
  59. package/src/layouts/AdminLayout.vue +174 -174
  60. package/src/layouts/PageLayout.vue +151 -151
  61. package/src/layouts/SinglePageView.vue +105 -105
  62. package/src/layouts/header/AdminHeader.vue +104 -104
  63. package/src/layouts/header/HeaderNotice.vue +167 -167
  64. package/src/layouts/header/HeaderSearch.vue +67 -67
  65. package/src/layouts/header/InstitutionDetail.vue +181 -181
  66. package/src/layouts/header/index.less +92 -92
  67. package/src/layouts/tabs/TabsHead.vue +190 -190
  68. package/src/layouts/tabs/TabsView.vue +379 -379
  69. package/src/mock/goods/index.js +108 -108
  70. package/src/pages/CreateQueryPage.vue +65 -65
  71. package/src/pages/login/Login.vue +345 -345
  72. package/src/pages/report/ReportTable.js +124 -124
  73. package/src/pages/report/ReportTableHome.vue +28 -28
  74. package/src/pages/resourceManage/orgListManage.vue +98 -98
  75. package/src/pages/system/dictionary/index.vue +43 -43
  76. package/src/pages/system/file/index.vue +317 -317
  77. package/src/pages/system/monitor/loginInfor/index.vue +36 -36
  78. package/src/pages/system/monitor/operLog/index.vue +36 -36
  79. package/src/pages/system/queryParams/index.vue +43 -43
  80. package/src/router/async/config.async.js +27 -27
  81. package/src/router/async/router.map.js +65 -65
  82. package/src/router/index.js +27 -27
  83. package/src/services/api/DictionaryDetailsViewApi.js +6 -6
  84. package/src/services/api/LogDetailsViewApi.js +10 -10
  85. package/src/services/api/QueryParamsDetailsViewApi.js +6 -6
  86. package/src/services/api/TicketDetailsViewApi.js +34 -34
  87. package/src/services/api/cas.js +79 -79
  88. package/src/services/api/commonTempTable.js +10 -10
  89. package/src/services/api/index.js +17 -17
  90. package/src/services/api/manage.js +8 -8
  91. package/src/services/api/restTools.js +24 -24
  92. package/src/services/apiService.js +13 -13
  93. package/src/services/user.js +53 -53
  94. package/src/store/modules/index.js +4 -4
  95. package/src/theme/default/nprogress.less +76 -76
  96. package/src/theme/default/style.less +47 -47
  97. package/src/utils/colors.js +107 -103
  98. package/src/utils/excel/Blob.js +180 -180
  99. package/src/utils/excel/Export2Excel.js +141 -141
  100. package/src/utils/formatter.js +68 -68
  101. package/src/utils/i18n.js +80 -80
  102. package/src/utils/theme-color-replacer-extend.js +91 -91
  103. package/src/utils/themeUtil.js +100 -100
  104. package/src/utils/util.js +230 -230
@@ -1,469 +1,469 @@
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.keyName && this.attr.keyName.indexOf('logic@') !== -1) {
403
- this.getData({}, res => {
404
- this.option = res
405
- })
406
- }
407
- },
408
- methods: {
409
- openChangeOne (status) {
410
- if (status) {
411
- this.yearShowOne = true
412
- }
413
- },
414
- // 得到年份选择器的值
415
- panelChangeOne (value) {
416
- this.yearShowOne = false
417
- this.form[this.attr.model] = value
418
- },
419
- // 向父组件获取级联框的数据
420
- selectsItemCheck (groupName, index, value) {
421
- this.$emit('selectsItemCheck', val => { this.selectsArray = val }, groupName, index, value)
422
- },
423
- // 文件框时设置上传组件的值
424
- setFiles (fileIds) {
425
- if (!this.form[this.attr.model]) {
426
- this.form[this.attr.model] = []
427
- }
428
- this.form[this.attr.model] = [...fileIds]
429
- },
430
- // 懒加载检索方法
431
- fetchFunction (value) {
432
- this.lastFetchId += 1
433
- const fetchId = this.lastFetchId
434
- this.option = []
435
- this.searching = true
436
- this.getData({
437
- word: value
438
- }, res => {
439
- if (fetchId !== this.lastFetchId) {
440
- return
441
- }
442
- this.option = res
443
- this.searching = false
444
- })
445
- },
446
- // 获取数据
447
- getData (value, callback) {
448
- if (value !== '') {
449
- const logicName = this.attr.keyName
450
- const logic = logicName.substring(6)
451
- post('/api/' + this.serviceName + '/logic/' + logic, value).then(res => {
452
- callback(res)
453
- })
454
- }
455
- },
456
- filterOption (input, option) {
457
- if (option.componentOptions.children[0].text) {
458
- return (
459
- option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
460
- )
461
- } else {
462
- return (
463
- option.componentOptions.children[0].child.value.toLowerCase().indexOf(input.toLowerCase()) >= 0
464
- )
465
- }
466
- }
467
- }
468
- }
469
- </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
+ </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.keyName && this.attr.keyName.indexOf('logic@') !== -1) {
403
+ this.getData({}, res => {
404
+ this.option = res
405
+ })
406
+ }
407
+ },
408
+ methods: {
409
+ openChangeOne (status) {
410
+ if (status) {
411
+ this.yearShowOne = true
412
+ }
413
+ },
414
+ // 得到年份选择器的值
415
+ panelChangeOne (value) {
416
+ this.yearShowOne = false
417
+ this.form[this.attr.model] = value.format('YYYY')
418
+ },
419
+ // 向父组件获取级联框的数据
420
+ selectsItemCheck (groupName, index, value) {
421
+ this.$emit('selectsItemCheck', val => { this.selectsArray = val }, groupName, index, value)
422
+ },
423
+ // 文件框时设置上传组件的值
424
+ setFiles (fileIds) {
425
+ if (!this.form[this.attr.model]) {
426
+ this.form[this.attr.model] = []
427
+ }
428
+ this.form[this.attr.model] = [...fileIds]
429
+ },
430
+ // 懒加载检索方法
431
+ fetchFunction (value) {
432
+ this.lastFetchId += 1
433
+ const fetchId = this.lastFetchId
434
+ this.option = []
435
+ this.searching = true
436
+ this.getData({
437
+ word: value
438
+ }, res => {
439
+ if (fetchId !== this.lastFetchId) {
440
+ return
441
+ }
442
+ this.option = res
443
+ this.searching = false
444
+ })
445
+ },
446
+ // 获取数据
447
+ getData (value, callback) {
448
+ if (value !== '') {
449
+ const logicName = this.attr.keyName
450
+ const logic = logicName.substring(6)
451
+ post('/api/' + this.serviceName + '/logic/' + logic, value).then(res => {
452
+ callback(res)
453
+ })
454
+ }
455
+ },
456
+ filterOption (input, option) {
457
+ if (option.componentOptions.children[0].text) {
458
+ return (
459
+ option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
460
+ )
461
+ } else {
462
+ return (
463
+ option.componentOptions.children[0].child.value.toLowerCase().indexOf(input.toLowerCase()) >= 0
464
+ )
465
+ }
466
+ }
467
+ }
468
+ }
469
+ </script>