vue2-client 1.4.20 → 1.4.21

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