vue2-client 1.4.63 → 1.5.0

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