vue2-client 1.5.13 → 1.5.15

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 (112) hide show
  1. package/CHANGELOG.md +513 -504
  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 +667 -667
  6. package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +713 -713
  7. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQuery.vue +457 -457
  8. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQueryItem.vue +508 -508
  9. package/src/base-client/components/common/FormGroupEdit/FormGroupEdit.vue +140 -140
  10. package/src/base-client/components/common/FormGroupQuery/FormGroupQuery.vue +165 -165
  11. package/src/base-client/components/common/JSONToTree/jsontotree.vue +275 -275
  12. package/src/base-client/components/common/XAddForm/XAddForm.vue +316 -316
  13. package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +278 -277
  14. package/src/base-client/components/common/XCard/XCard.vue +64 -64
  15. package/src/base-client/components/common/XForm/XForm.vue +185 -185
  16. package/src/base-client/components/common/XForm/XFormItem.vue +502 -485
  17. package/src/base-client/components/common/XForm/index.md +177 -177
  18. package/src/base-client/components/common/XFormTable/XFormTable.vue +325 -324
  19. package/src/base-client/components/common/XFormTable/index.md +96 -96
  20. package/src/base-client/components/common/XTable/XTable.vue +505 -505
  21. package/src/base-client/components/common/XTreeOne/XTreeOne.vue +109 -109
  22. package/src/base-client/components/system/QueryParamsDetailsView/QueryParamsDetailsView.vue +281 -281
  23. package/src/base-client/components/ticket/TicketDetailsView/TicketDetailsView.vue +807 -807
  24. package/src/base-client/components/ticket/TicketDetailsView/index.md +29 -29
  25. package/src/base-client/components/ticket/TicketDetailsView/part/TicketDetailsFlow.vue +260 -260
  26. package/src/base-client/components/ticket/TicketSubmitSuccessView/TicketSubmitSuccessView.vue +532 -532
  27. package/src/base-client/components/ticket/TicketSubmitSuccessView/index.md +29 -29
  28. package/src/base-client/plugins/AppData.js +70 -70
  29. package/src/base-client/plugins/GetLoginInfoService.js +179 -179
  30. package/src/base-client/plugins/PagedList.js +177 -177
  31. package/src/base-client/plugins/compatible/LoginServiceOA.js +20 -20
  32. package/src/base-client/plugins/i18n-extend.js +32 -32
  33. package/src/components/Ellipsis/Ellipsis.vue +65 -65
  34. package/src/components/Ellipsis/index.md +38 -38
  35. package/src/components/NumberInfo/index.md +43 -43
  36. package/src/components/STable/README.md +341 -341
  37. package/src/components/STable/index.js +318 -318
  38. package/src/components/Trend/index.md +45 -45
  39. package/src/components/checkbox/ColorCheckbox.vue +157 -157
  40. package/src/components/checkbox/ImgCheckbox.vue +163 -163
  41. package/src/components/exception/ExceptionPage.vue +70 -70
  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 +307 -307
  57. package/src/config/default/admin.config.js +18 -18
  58. package/src/config/default/setting.config.js +44 -44
  59. package/src/config/replacer/resolve.config.js +67 -67
  60. package/src/layouts/AdminLayout.vue +174 -174
  61. package/src/layouts/CommonLayout.vue +42 -42
  62. package/src/layouts/ComponentLayoutOne.vue +47 -47
  63. package/src/layouts/PageLayout.vue +151 -151
  64. package/src/layouts/SinglePageView.vue +111 -111
  65. package/src/layouts/footer/PageFooter.vue +49 -49
  66. package/src/layouts/header/AdminHeader.vue +104 -104
  67. package/src/layouts/header/HeaderAvatar.vue +61 -61
  68. package/src/layouts/header/HeaderNotice.vue +176 -176
  69. package/src/layouts/header/HeaderSearch.vue +67 -67
  70. package/src/layouts/header/InstitutionDetail.vue +181 -181
  71. package/src/layouts/header/index.less +92 -92
  72. package/src/layouts/tabs/TabsHead.vue +190 -190
  73. package/src/layouts/tabs/TabsView.vue +379 -379
  74. package/src/mock/goods/index.js +108 -108
  75. package/src/pages/exception/404.vue +25 -25
  76. package/src/pages/login/Login.vue +363 -363
  77. package/src/pages/report/ReportTable.js +124 -124
  78. package/src/pages/report/ReportTableHome.vue +28 -28
  79. package/src/pages/resourceManage/orgListManage.vue +98 -98
  80. package/src/pages/system/dictionary/index.vue +43 -43
  81. package/src/pages/system/file/index.vue +317 -317
  82. package/src/pages/system/monitor/loginInfor/index.vue +36 -36
  83. package/src/pages/system/monitor/operLog/index.vue +36 -36
  84. package/src/pages/system/queryParams/index.vue +43 -43
  85. package/src/router/async/config.async.js +27 -27
  86. package/src/router/async/router.map.js +68 -68
  87. package/src/router/guards.js +113 -113
  88. package/src/router/index.js +27 -27
  89. package/src/services/api/DictionaryDetailsViewApi.js +6 -6
  90. package/src/services/api/LogDetailsViewApi.js +10 -10
  91. package/src/services/api/QueryParamsDetailsViewApi.js +6 -6
  92. package/src/services/api/TicketDetailsViewApi.js +34 -34
  93. package/src/services/api/cas.js +79 -79
  94. package/src/services/api/commonTempTable.js +10 -10
  95. package/src/services/api/index.js +17 -17
  96. package/src/services/api/logininfor/index.js +6 -6
  97. package/src/services/api/manage.js +8 -8
  98. package/src/services/apiService.js +13 -13
  99. package/src/services/user.js +53 -53
  100. package/src/store/modules/index.js +4 -4
  101. package/src/theme/default/nprogress.less +76 -76
  102. package/src/theme/default/style.less +47 -47
  103. package/src/utils/colors.js +107 -107
  104. package/src/utils/excel/Blob.js +180 -180
  105. package/src/utils/excel/Export2Excel.js +141 -141
  106. package/src/utils/formatter.js +68 -68
  107. package/src/utils/i18n.js +80 -80
  108. package/src/utils/indexedDB.js +145 -145
  109. package/src/utils/theme-color-replacer-extend.js +91 -91
  110. package/src/utils/themeUtil.js +100 -100
  111. package/src/utils/util.js +230 -230
  112. package/vue.config.js +106 -106
@@ -1,485 +1,502 @@
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 === 'checkbox'"
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="disabled"
101
- :filter-option="filterOption"
102
- :getPopupContainer=" triggerNode => { return triggerNode.parentNode } "
103
- :placeholder="attr.placeholder ? attr.placeholder : '请选择'"
104
- mode="multiple"
105
- show-search
106
- allowClear
107
- >
108
- <template v-if="attr.keys">
109
- <a-select-option
110
- v-for="(item,index) in attr.keys"
111
- :key="index"
112
- :value="item.value">
113
- {{ item.label }}
114
- </a-select-option>
115
- </template>
116
- <template v-else>
117
- <template v-if="attr.keyName.indexOf('logic@') !== -1">
118
- <a-select-option
119
- v-for="(item,index) in option"
120
- :key="index"
121
- :value="item.value">{{ item.label }}
122
- </a-select-option>
123
- </template>
124
- <template v-else>
125
- <a-select-option
126
- v-for="item in $appdata.getDictionaryList(attr.keyName)"
127
- :key="item.value"
128
- :value="item.value">{{ item.text }}
129
- </a-select-option>
130
- </template>
131
- </template>
132
- </a-select>
133
- <a-select
134
- v-else
135
- v-model="form[attr.model]"
136
- :disabled="disabled"
137
- :filter-option="filterOption"
138
- :getPopupContainer=" triggerNode => { return triggerNode.parentNode } "
139
- :placeholder="attr.placeholder ? attr.placeholder : '搜索' + attr.name"
140
- mode="multiple"
141
- show-search
142
- allowClear
143
- @search="fetchFunction"
144
- >
145
- <a-spin v-if="searching" slot="notFoundContent" size="small" />
146
- <a-select-option
147
- v-for="(item,index) in option"
148
- :key="index"
149
- :value="item.value">{{ item.label }}
150
- </a-select-option>
151
- </a-select>
152
- </a-form-model-item>
153
- </x-form-col>
154
- <!-- TODO 单选框 -->
155
- <!-- 日期范围选择器 -->
156
- <x-form-col
157
- v-else-if="attr.type === 'rangePicker'"
158
- :xl="xl"
159
- :xxl="xxl">
160
- <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
161
- <a-range-picker v-model="form[attr.model]" :disabled="disabled" :show-time="true" valueFormat="YYYY-MM-DD HH:mm:ss"/>
162
- </a-form-model-item>
163
- </x-form-col>
164
- <!-- 月份选择器 -->
165
- <x-form-col
166
- v-else-if="attr.type === 'monthPicker'"
167
- :xl="xl"
168
- :xxl="xxl">
169
- <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
170
- <a-month-picker v-model="form[attr.model]" :disabled="disabled" :show-time="true" valueFormat="YYYY-MM"/>
171
- </a-form-model-item>
172
- </x-form-col>
173
- <!-- 年份选择器 -->
174
- <x-form-col
175
- v-else-if="attr.type === 'yearPicker'"
176
- :xl="xl"
177
- :xxl="xxl">
178
- <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
179
- <a-date-picker
180
- v-model="form[attr.model]"
181
- :disabled="disabled"
182
- format="YYYY"
183
- mode="year"
184
- v-decorator="['year']"
185
- placeholder="请输入年份"
186
- :open="yearShowOne"
187
- @openChange="openChangeOne"
188
- @panelChange="panelChangeOne"/>
189
- </a-form-model-item>
190
- </x-form-col>
191
- <!-- 日期选择器 -->
192
- <x-form-col
193
- v-else-if="attr.type === 'datePicker'"
194
- :xl="xl"
195
- :xxl="xxl">
196
- <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
197
- <a-range-picker
198
- v-if="mode === '查询'"
199
- v-model="form[attr.model]"
200
- :disabled="disabled"
201
- :show-time="{ defaultValue: [moment('00:00:00', 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')] }"
202
- format="YYYY-MM-DD"
203
- valueFormat="YYYY-MM-DD HH:mm:ss" />
204
- <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"/>
205
- </a-form-model-item>
206
- </x-form-col>
207
- <!-- 文本域 -->
208
- <x-form-col
209
- v-else-if="attr.type === 'textarea'"
210
- :lg="24"
211
- :md="24"
212
- :sm="24"
213
- :xl="24"
214
- :xs="24"
215
- :xxl="24">
216
- <a-form-model-item
217
- :ref="attr.model"
218
- :label="attr.name"
219
- :prop="attr.model">
220
- <a-textarea v-model="form[attr.model]" :disabled="disabled" :placeholder="attr.placeholder ? attr.placeholder : '请输入'+attr.name.replace(/\s*/g, '')" :rows="4"/>
221
- </a-form-model-item>
222
- </x-form-col>
223
- <!-- 文件上传 -->
224
- <x-form-col
225
- v-else-if="attr.type === 'file' || attr.type === 'image'"
226
- :lg="24"
227
- :md="24"
228
- :sm="24"
229
- :xl="24"
230
- :xs="24"
231
- :xxl="24">
232
- <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
233
- <upload :files="files" :images="images" :model="attr" :service-name="serviceName" @setFiles="setFiles"></upload>
234
- </a-form-model-item>
235
- </x-form-col>
236
- <!-- 省市区选择框 -->
237
- <x-form-col
238
- v-else-if="attr.type === 'citySelect'"
239
- :xl="xl"
240
- :xxl="xxl">
241
- <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
242
- <citySelect v-model="form[attr.model]" ></citySelect>
243
- </a-form-model-item>
244
- </x-form-col>
245
- <!-- 地点搜索框 -->
246
- <x-form-col
247
- v-else-if="attr.type === 'addressSearch'"
248
- :xl="xl"
249
- :xxl="xxl">
250
- <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
251
- <address-search-combobox
252
- v-model="searchResult"
253
- :resultKeys="{ address: attr.model, coords: `${attr.model}_lng_lat` }"
254
- searchResultType="Object"
255
- @onSelect="form=Object.assign(form,JSON.parse(searchResult))"
256
- ></address-search-combobox>
257
- </a-form-model-item>
258
- </x-form-col>
259
- <!-- 人员选择框 -->
260
- <x-form-col
261
- v-else-if="attr.type === 'personSetting'"
262
- :xl="xl"
263
- :xxl="xxl">
264
- <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
265
- <PersonSetting v-model="form[attr.model]" ></PersonSetting>
266
- </a-form-model-item>
267
- </x-form-col>
268
- <!-- 树形选择框 -->
269
- <x-form-col
270
- v-else-if="attr.type === 'treeSelect'"
271
- :xl="xl"
272
- :xxl="xxl">
273
- <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
274
- <a-tree-select
275
- v-model="treeSelectValue"
276
- :disabled="disabled"
277
- :tree-data="getTreeData()"
278
- :tree-checkable="mode === '查询' && attr.queryType !== 'RIGHT_LIKE'"
279
- :placeholder="'请选择' + attr.name"
280
- :dropdown-style="{ maxHeight: '400px' }"
281
- tree-node-filter-prop="label"
282
- :show-checked-strategy="attr.queryType === 'RIGHT_LIKE' ? 'SHOW_ALL' : undefined"
283
- allow-clear
284
- class="tree-select"
285
- @change="onTreeSelectChange">
286
- </a-tree-select>
287
- </a-form-model-item>
288
- </x-form-col>
289
- </template>
290
- <script>
291
-
292
- import { post } from '@vue2-client/services/api'
293
- import { debounce } from 'ant-design-vue/lib/vc-table/src/utils'
294
- import XFormCol from '@vue2-client/base-client/components/common/XFormCol'
295
- import XBadge from '@vue2-client/base-client/components/common/XBadge'
296
- import CitySelect from '@vue2-client/base-client/components/common/CitySelect'
297
- import PersonSetting from '@vue2-client/base-client/components/common/PersonSetting'
298
- import AddressSearchCombobox from '@vue2-client/base-client/components/common/AddressSearchCombobox'
299
- import Upload from '@vue2-client/base-client/components/common/Upload'
300
- import moment from 'moment'
301
-
302
- export default {
303
- name: 'XFormItem',
304
- components: {
305
- XFormCol,
306
- XBadge,
307
- CitySelect,
308
- PersonSetting,
309
- AddressSearchCombobox,
310
- Upload
311
- },
312
- data () {
313
- // 检索去抖
314
- this.fetchFunction = debounce(this.fetchFunction, 800)
315
- return {
316
- option: [],
317
- // 最后检索版本
318
- lastFetchId: 0,
319
- // 检索中
320
- searching: false,
321
- searchResult: '',
322
- yearShowOne: false,
323
- // moment
324
- moment,
325
- // 树形选择框选中值
326
- treeSelectValue: undefined
327
- }
328
- },
329
- props: {
330
- attr: {
331
- type: Object,
332
- default: () => {
333
- return {}
334
- }
335
- },
336
- form: {
337
- type: Object,
338
- required: true
339
- },
340
- disabled: {
341
- type: Boolean,
342
- default: () => {
343
- return false
344
- }
345
- },
346
- mode: {
347
- type: String,
348
- default: () => {
349
- return '查询'
350
- }
351
- },
352
- xl: {
353
- type: Number,
354
- default: undefined
355
- },
356
- xxl: {
357
- type: Number,
358
- default: undefined
359
- },
360
- files: {
361
- type: Array,
362
- default: () => {
363
- return []
364
- }
365
- },
366
- images: {
367
- type: Array,
368
- default: () => {
369
- return []
370
- }
371
- },
372
- serviceName: {
373
- type: String,
374
- default: 'af-system'
375
- }
376
- },
377
- created () {
378
- if (this.attr.keyName && this.attr.keyName.indexOf('logic@') !== -1) {
379
- this.getData({}, res => {
380
- this.option = res
381
- })
382
- }
383
- },
384
- methods: {
385
- openChangeOne (status) {
386
- if (status) {
387
- this.yearShowOne = true
388
- }
389
- },
390
- // 得到年份选择器的值
391
- panelChangeOne (value) {
392
- this.yearShowOne = false
393
- this.form[this.attr.model] = value.format('YYYY')
394
- },
395
- // 文件框时设置上传组件的值
396
- setFiles (fileIds) {
397
- if (!this.form[this.attr.model]) {
398
- this.form[this.attr.model] = []
399
- }
400
- this.form[this.attr.model] = [...fileIds]
401
- },
402
- // 懒加载检索方法
403
- fetchFunction (value) {
404
- this.lastFetchId += 1
405
- const fetchId = this.lastFetchId
406
- this.option = []
407
- this.searching = true
408
- this.getData({
409
- word: value
410
- }, res => {
411
- if (fetchId !== this.lastFetchId) {
412
- return
413
- }
414
- this.option = res
415
- this.searching = false
416
- })
417
- },
418
- // 获取数据
419
- getData (value, callback) {
420
- if (value !== '') {
421
- const logicName = this.attr.keyName
422
- const logic = logicName.substring(6)
423
- post('/api/' + this.serviceName + '/logic/' + logic, value).then(res => {
424
- callback(res)
425
- })
426
- }
427
- },
428
- filterOption (input, option) {
429
- if (option.componentOptions.children[0].text) {
430
- return (
431
- option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
432
- )
433
- } else {
434
- return (
435
- option.componentOptions.children[0].child.value.toLowerCase().indexOf(input.toLowerCase()) >= 0
436
- )
437
- }
438
- },
439
- // 获取树形选择框数据
440
- getTreeData () {
441
- let treeData = this.attr.keys
442
- if (!treeData) {
443
- treeData = this.option
444
- }
445
- if (this.mode === '新增/修改') {
446
- this.setParentSelectable(treeData)
447
- }
448
- return treeData
449
- },
450
- // 设置树形选择框不能选择父节点
451
- setParentSelectable (treeData) {
452
- treeData.forEach(item => {
453
- if (item.children && item.children.length) {
454
- item.selectable = false
455
- this.setParentSelectable(item.children)
456
- }
457
- })
458
- },
459
- // 选中树节点
460
- onTreeSelectChange (value, label, extra) {
461
- if (this.attr.queryType === 'RIGHT_LIKE') {
462
- // 获取可用于模糊查询的组织机构字符串
463
- let node = extra.triggerNode.$parent
464
- label = label[0]
465
- while (node && node.label) {
466
- label = node.label + '.' + label
467
- node = node.$parent
468
- }
469
- this.form[this.attr.model] = label
470
- } else {
471
- this.form[this.attr.model] = value
472
- }
473
- }
474
- }
475
- }
476
- </script>
477
-
478
- <style lang="less" scoped>
479
- .tree-select {
480
- /deep/ .ant-select-selection.ant-select-selection--multiple {
481
- max-height: 48px;
482
- overflow-y: auto;
483
- }
484
- }
485
- </style>
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 === 'checkbox'"
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="disabled"
101
+ :filter-option="filterOption"
102
+ :getPopupContainer=" triggerNode => { return triggerNode.parentNode } "
103
+ :placeholder="attr.placeholder ? attr.placeholder : '请选择'"
104
+ mode="multiple"
105
+ show-search
106
+ allowClear
107
+ >
108
+ <template v-if="attr.keys">
109
+ <a-select-option
110
+ v-for="(item,index) in attr.keys"
111
+ :key="index"
112
+ :value="item.value">
113
+ {{ item.label }}
114
+ </a-select-option>
115
+ </template>
116
+ <template v-else>
117
+ <template v-if="attr.keyName.indexOf('logic@') !== -1">
118
+ <a-select-option
119
+ v-for="(item,index) in option"
120
+ :key="index"
121
+ :value="item.value">{{ item.label }}
122
+ </a-select-option>
123
+ </template>
124
+ <template v-else>
125
+ <a-select-option
126
+ v-for="item in $appdata.getDictionaryList(attr.keyName)"
127
+ :key="item.value"
128
+ :value="item.value">{{ item.text }}
129
+ </a-select-option>
130
+ </template>
131
+ </template>
132
+ </a-select>
133
+ <a-select
134
+ v-else
135
+ v-model="form[attr.model]"
136
+ :disabled="disabled"
137
+ :filter-option="filterOption"
138
+ :getPopupContainer=" triggerNode => { return triggerNode.parentNode } "
139
+ :placeholder="attr.placeholder ? attr.placeholder : '搜索' + attr.name"
140
+ mode="multiple"
141
+ show-search
142
+ allowClear
143
+ @search="fetchFunction"
144
+ >
145
+ <a-spin v-if="searching" slot="notFoundContent" size="small" />
146
+ <a-select-option
147
+ v-for="(item,index) in option"
148
+ :key="index"
149
+ :value="item.value">{{ item.label }}
150
+ </a-select-option>
151
+ </a-select>
152
+ </a-form-model-item>
153
+ </x-form-col>
154
+ <!-- TODO 单选框 -->
155
+ <!-- 日期范围选择器 -->
156
+ <x-form-col
157
+ v-else-if="attr.type === 'rangePicker'"
158
+ :xl="xl"
159
+ :xxl="xxl">
160
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
161
+ <a-range-picker v-model="form[attr.model]" :disabled="disabled" :show-time="true" valueFormat="YYYY-MM-DD HH:mm:ss"/>
162
+ </a-form-model-item>
163
+ </x-form-col>
164
+ <!-- 月份选择器 -->
165
+ <x-form-col
166
+ v-else-if="attr.type === 'monthPicker'"
167
+ :xl="xl"
168
+ :xxl="xxl">
169
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
170
+ <a-month-picker v-model="form[attr.model]" :disabled="disabled" :show-time="true" valueFormat="YYYY-MM"/>
171
+ </a-form-model-item>
172
+ </x-form-col>
173
+ <!-- 年份选择器 -->
174
+ <x-form-col
175
+ v-else-if="attr.type === 'yearPicker'"
176
+ :xl="xl"
177
+ :xxl="xxl">
178
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
179
+ <a-date-picker
180
+ v-model="form[attr.model]"
181
+ :disabled="disabled"
182
+ format="YYYY"
183
+ mode="year"
184
+ v-decorator="['year']"
185
+ placeholder="请输入年份"
186
+ :open="yearShowOne"
187
+ @openChange="openChangeOne"
188
+ @panelChange="panelChangeOne"/>
189
+ </a-form-model-item>
190
+ </x-form-col>
191
+ <!-- 日期选择器 -->
192
+ <x-form-col
193
+ v-else-if="attr.type === 'datePicker'"
194
+ :xl="xl"
195
+ :xxl="xxl">
196
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
197
+ <a-range-picker
198
+ v-if="mode === '查询'"
199
+ v-model="form[attr.model]"
200
+ :disabled="disabled"
201
+ :show-time="{ defaultValue: [moment('00:00:00', 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')] }"
202
+ format="YYYY-MM-DD"
203
+ valueFormat="YYYY-MM-DD HH:mm:ss" />
204
+ <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"/>
205
+ </a-form-model-item>
206
+ </x-form-col>
207
+ <!-- 文本域 -->
208
+ <x-form-col
209
+ v-else-if="attr.type === 'textarea'"
210
+ :lg="24"
211
+ :md="24"
212
+ :sm="24"
213
+ :xl="24"
214
+ :xs="24"
215
+ :xxl="24">
216
+ <a-form-model-item
217
+ :ref="attr.model"
218
+ :label="attr.name"
219
+ :prop="attr.model">
220
+ <a-textarea v-model="form[attr.model]" :disabled="disabled" :placeholder="attr.placeholder ? attr.placeholder : '请输入'+attr.name.replace(/\s*/g, '')" :rows="4"/>
221
+ </a-form-model-item>
222
+ </x-form-col>
223
+ <!-- 文件上传 -->
224
+ <x-form-col
225
+ v-else-if="attr.type === 'file' || attr.type === 'image'"
226
+ :lg="24"
227
+ :md="24"
228
+ :sm="24"
229
+ :xl="24"
230
+ :xs="24"
231
+ :xxl="24">
232
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
233
+ <upload :files="files" :images="images" :model="attr" :service-name="serviceName" @setFiles="setFiles"></upload>
234
+ </a-form-model-item>
235
+ </x-form-col>
236
+ <!-- 省市区选择框 -->
237
+ <x-form-col
238
+ v-else-if="attr.type === 'citySelect'"
239
+ :xl="xl"
240
+ :xxl="xxl">
241
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
242
+ <citySelect v-model="form[attr.model]" ></citySelect>
243
+ </a-form-model-item>
244
+ </x-form-col>
245
+ <!-- 地点搜索框 -->
246
+ <x-form-col
247
+ v-else-if="attr.type === 'addressSearch'"
248
+ :xl="xl"
249
+ :xxl="xxl">
250
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
251
+ <address-search-combobox
252
+ v-model="searchResult"
253
+ :resultKeys="{ address: attr.model, coords: `${attr.model}_lng_lat` }"
254
+ searchResultType="Object"
255
+ @onSelect="form=Object.assign(form,JSON.parse(searchResult))"
256
+ ></address-search-combobox>
257
+ </a-form-model-item>
258
+ </x-form-col>
259
+ <!-- 人员选择框 -->
260
+ <x-form-col
261
+ v-else-if="attr.type === 'personSetting'"
262
+ :xl="xl"
263
+ :xxl="xxl">
264
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
265
+ <PersonSetting v-model="form[attr.model]" ></PersonSetting>
266
+ </a-form-model-item>
267
+ </x-form-col>
268
+ <!-- 树形选择框 -->
269
+ <x-form-col
270
+ v-else-if="attr.type === 'treeSelect'"
271
+ :xl="xl"
272
+ :xxl="xxl">
273
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
274
+ <a-tree-select
275
+ v-model="treeSelectValue"
276
+ :disabled="disabled"
277
+ :tree-data="getTreeData()"
278
+ :tree-checkable="mode === '查询' && attr.queryType !== 'RIGHT_LIKE'"
279
+ :placeholder="'请选择' + attr.name"
280
+ :dropdown-style="{ maxHeight: '400px' }"
281
+ tree-node-filter-prop="label"
282
+ :show-checked-strategy="attr.queryType === 'RIGHT_LIKE' ? 'SHOW_ALL' : undefined"
283
+ allow-clear
284
+ class="tree-select"
285
+ @change="onTreeSelectChange">
286
+ </a-tree-select>
287
+ </a-form-model-item>
288
+ </x-form-col>
289
+ </template>
290
+ <script>
291
+
292
+ import { post } from '@vue2-client/services/api'
293
+ import { debounce } from 'ant-design-vue/lib/vc-table/src/utils'
294
+ import XFormCol from '@vue2-client/base-client/components/common/XFormCol'
295
+ import XBadge from '@vue2-client/base-client/components/common/XBadge'
296
+ import CitySelect from '@vue2-client/base-client/components/common/CitySelect'
297
+ import PersonSetting from '@vue2-client/base-client/components/common/PersonSetting'
298
+ import AddressSearchCombobox from '@vue2-client/base-client/components/common/AddressSearchCombobox'
299
+ import Upload from '@vue2-client/base-client/components/common/Upload'
300
+ import moment from 'moment'
301
+
302
+ export default {
303
+ name: 'XFormItem',
304
+ components: {
305
+ XFormCol,
306
+ XBadge,
307
+ CitySelect,
308
+ PersonSetting,
309
+ AddressSearchCombobox,
310
+ Upload
311
+ },
312
+ data () {
313
+ // 检索去抖
314
+ this.fetchFunction = debounce(this.fetchFunction, 800)
315
+ return {
316
+ option: [],
317
+ // 最后检索版本
318
+ lastFetchId: 0,
319
+ // 检索中
320
+ searching: false,
321
+ searchResult: '',
322
+ yearShowOne: false,
323
+ // moment
324
+ moment,
325
+ // 树形选择框选中值
326
+ treeSelectValue: undefined
327
+ }
328
+ },
329
+ props: {
330
+ attr: {
331
+ type: Object,
332
+ default: () => {
333
+ return {}
334
+ }
335
+ },
336
+ form: {
337
+ type: Object,
338
+ required: true
339
+ },
340
+ disabled: {
341
+ type: Boolean,
342
+ default: () => {
343
+ return false
344
+ }
345
+ },
346
+ mode: {
347
+ type: String,
348
+ default: () => {
349
+ return '查询'
350
+ }
351
+ },
352
+ xl: {
353
+ type: Number,
354
+ default: undefined
355
+ },
356
+ xxl: {
357
+ type: Number,
358
+ default: undefined
359
+ },
360
+ files: {
361
+ type: Array,
362
+ default: () => {
363
+ return []
364
+ }
365
+ },
366
+ images: {
367
+ type: Array,
368
+ default: () => {
369
+ return []
370
+ }
371
+ },
372
+ serviceName: {
373
+ type: String,
374
+ default: 'af-system'
375
+ }
376
+ },
377
+ created () {
378
+ if (this.attr.keyName && this.attr.keyName.indexOf('logic@') !== -1) {
379
+ this.getData({}, res => {
380
+ this.option = res
381
+ })
382
+ }
383
+ // 修改时恢复树形选择框选中状态
384
+ if (this.attr.type === 'treeSelect' && this.attr.queryType !== 'RIGHT_LIKE') {
385
+ this.treeSelectValue = this.form[this.attr.model]
386
+ }
387
+ },
388
+ watch: {
389
+ form: {
390
+ handler (newVal) {
391
+ const value = newVal[this.attr.model]
392
+ const isEmpty = !value || !value.toString()
393
+ // 查询表单点击重置按钮时清空树形选择框选中状态
394
+ if (this.attr.type === 'treeSelect' && isEmpty) {
395
+ this.treeSelectValue = undefined
396
+ }
397
+ },
398
+ deep: true
399
+ }
400
+ },
401
+ methods: {
402
+ openChangeOne (status) {
403
+ if (status) {
404
+ this.yearShowOne = true
405
+ }
406
+ },
407
+ // 得到年份选择器的值
408
+ panelChangeOne (value) {
409
+ this.yearShowOne = false
410
+ this.form[this.attr.model] = value.format('YYYY')
411
+ },
412
+ // 文件框时设置上传组件的值
413
+ setFiles (fileIds) {
414
+ if (!this.form[this.attr.model]) {
415
+ this.form[this.attr.model] = []
416
+ }
417
+ this.form[this.attr.model] = [...fileIds]
418
+ },
419
+ // 懒加载检索方法
420
+ fetchFunction (value) {
421
+ this.lastFetchId += 1
422
+ const fetchId = this.lastFetchId
423
+ this.option = []
424
+ this.searching = true
425
+ this.getData({
426
+ word: value
427
+ }, res => {
428
+ if (fetchId !== this.lastFetchId) {
429
+ return
430
+ }
431
+ this.option = res
432
+ this.searching = false
433
+ })
434
+ },
435
+ // 获取数据
436
+ getData (value, callback) {
437
+ if (value !== '') {
438
+ const logicName = this.attr.keyName
439
+ const logic = logicName.substring(6)
440
+ post('/api/' + this.serviceName + '/logic/' + logic, value).then(res => {
441
+ callback(res)
442
+ })
443
+ }
444
+ },
445
+ filterOption (input, option) {
446
+ if (option.componentOptions.children[0].text) {
447
+ return (
448
+ option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
449
+ )
450
+ } else {
451
+ return (
452
+ option.componentOptions.children[0].child.value.toLowerCase().indexOf(input.toLowerCase()) >= 0
453
+ )
454
+ }
455
+ },
456
+ // 获取树形选择框数据
457
+ getTreeData () {
458
+ let treeData = this.attr.keys
459
+ if (!treeData) {
460
+ treeData = this.option
461
+ }
462
+ if (this.mode === '新增/修改') {
463
+ this.setParentSelectable(treeData)
464
+ }
465
+ return treeData
466
+ },
467
+ // 设置树形选择框不能选择父节点
468
+ setParentSelectable (treeData) {
469
+ treeData.forEach(item => {
470
+ if (item.children && item.children.length) {
471
+ item.selectable = false
472
+ this.setParentSelectable(item.children)
473
+ }
474
+ })
475
+ },
476
+ // 选中树节点
477
+ onTreeSelectChange (value, label, extra) {
478
+ if (this.attr.queryType === 'RIGHT_LIKE') {
479
+ // 获取可用于模糊查询的组织机构字符串
480
+ let node = extra.triggerNode.$parent
481
+ label = label[0]
482
+ while (node && node.label) {
483
+ label = node.label + '.' + label
484
+ node = node.$parent
485
+ }
486
+ this.form[this.attr.model] = label
487
+ } else {
488
+ this.form[this.attr.model] = value
489
+ }
490
+ }
491
+ }
492
+ }
493
+ </script>
494
+
495
+ <style lang="less" scoped>
496
+ .tree-select {
497
+ /deep/ .ant-select-selection.ant-select-selection--multiple {
498
+ max-height: 48px;
499
+ overflow-y: auto;
500
+ }
501
+ }
502
+ </style>