vue2-client 1.6.47 → 1.6.49

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