vue2-client 1.4.7 → 1.4.9

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