vue2-client 1.6.63-single → 1.7.1

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 (127) hide show
  1. package/.env +15 -15
  2. package/CHANGELOG.md +6 -0
  3. package/Components.md +60 -0
  4. package/index.js +39 -30
  5. package/package.json +4 -2
  6. package/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox.vue +1 -1
  7. package/src/base-client/components/common/CitySelect/CitySelect.vue +247 -247
  8. package/src/base-client/components/common/CreateQuery/CreateQuery.vue +669 -669
  9. package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +735 -735
  10. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQuery.vue +466 -460
  11. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQueryItem.vue +510 -510
  12. package/src/base-client/components/common/FormGroupEdit/FormGroupEdit.vue +144 -138
  13. package/src/base-client/components/common/FormGroupQuery/FormGroupQuery.vue +165 -165
  14. package/src/base-client/components/common/JSONToTree/jsontotree.vue +275 -275
  15. package/src/base-client/components/common/Upload/Upload.vue +3 -3
  16. package/src/base-client/components/common/XAddForm/XAddForm.vue +72 -72
  17. package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +365 -365
  18. package/src/base-client/components/common/XAddNativeForm/index.md +96 -56
  19. package/src/base-client/components/common/XCard/XCard.vue +64 -64
  20. package/src/base-client/components/common/XDataDrawer/XDataDrawer.vue +180 -0
  21. package/src/base-client/components/common/XDataDrawer/index.js +3 -0
  22. package/src/base-client/components/common/XDataDrawer/index.md +41 -0
  23. package/src/base-client/components/common/XForm/XForm.vue +178 -178
  24. package/src/base-client/components/common/XForm/XFormItem.vue +521 -521
  25. package/src/base-client/components/common/XForm/XTreeSelect.vue +184 -184
  26. package/src/base-client/components/common/XFormCol/XFormCol.vue +38 -38
  27. package/src/base-client/components/common/XFormTable/XFormTable.vue +356 -348
  28. package/src/base-client/components/common/XFormTable/index.md +97 -97
  29. package/src/base-client/components/common/XImportExcel/XImportExcel.vue +1 -1
  30. package/src/base-client/components/common/XTable/XTable.vue +519 -519
  31. package/src/base-client/components/common/XTreeOne/XTreeOne.vue +111 -111
  32. package/src/base-client/components/system/DictionaryDetailsView/DictionaryDetailsView.vue +1 -1
  33. package/src/base-client/components/system/QueryParamsDetailsView/QueryParamsDetailsView.vue +1 -1
  34. package/src/base-client/components/ticket/TicketDetailsView/TicketDetailsView.vue +1 -1
  35. package/src/base-client/components/ticket/TicketDetailsView/index.md +29 -29
  36. package/src/base-client/components/ticket/TicketDetailsView/part/TicketDetailsFlow.vue +260 -260
  37. package/src/base-client/components/ticket/TicketSubmitSuccessView/TicketSubmitSuccessView.vue +1 -1
  38. package/src/base-client/components/ticket/TicketSubmitSuccessView/index.md +29 -29
  39. package/src/base-client/plugins/AppData.js +76 -76
  40. package/src/base-client/plugins/GetLoginInfoService.js +179 -179
  41. package/src/base-client/plugins/PagedList.js +177 -177
  42. package/src/base-client/plugins/compatible/LoginServiceOA.js +20 -20
  43. package/src/base-client/plugins/i18n-extend.js +32 -32
  44. package/src/components/Ellipsis/Ellipsis.vue +65 -65
  45. package/src/components/Ellipsis/index.md +38 -38
  46. package/src/components/NumberInfo/index.md +43 -43
  47. package/src/components/STable/README.md +341 -341
  48. package/src/components/STable/index.js +318 -318
  49. package/src/components/Trend/index.md +45 -45
  50. package/src/components/checkbox/ColorCheckbox.vue +157 -157
  51. package/src/components/checkbox/ImgCheckbox.vue +163 -163
  52. package/src/components/exception/ExceptionPage.vue +70 -70
  53. package/src/components/form/FormRow.vue +52 -52
  54. package/src/components/index.js +36 -36
  55. package/src/components/menu/SideMenu.vue +62 -62
  56. package/src/components/menu/menu.js +273 -273
  57. package/src/components/page/header/index.less +40 -40
  58. package/src/components/setting/Setting.vue +235 -235
  59. package/src/components/table/StandardTable.vue +141 -141
  60. package/src/components/table/advance/ActionColumns.vue +158 -158
  61. package/src/components/table/advance/SearchArea.vue +355 -355
  62. package/src/components/tool/AStepItem.vue +60 -60
  63. package/src/components/tool/AvatarList.vue +68 -68
  64. package/src/components/tool/Drawer.vue +142 -142
  65. package/src/components/tool/TagSelect.vue +83 -83
  66. package/src/components/transition/PageToggleTransition.vue +97 -97
  67. package/src/config/CreateQueryConfig.js +307 -307
  68. package/src/config/default/admin.config.js +18 -18
  69. package/src/config/default/setting.config.js +48 -48
  70. package/src/config/replacer/resolve.config.js +67 -67
  71. package/src/layouts/CommonLayout.vue +42 -42
  72. package/src/layouts/ComponentLayoutOne.vue +47 -47
  73. package/src/layouts/PageLayout.vue +151 -151
  74. package/src/layouts/SinglePageView.vue +116 -116
  75. package/src/layouts/footer/PageFooter.vue +49 -49
  76. package/src/layouts/header/AdminHeader.vue +134 -134
  77. package/src/layouts/header/HeaderAvatar.vue +64 -64
  78. package/src/layouts/header/HeaderNotice.vue +1 -1
  79. package/src/layouts/header/HeaderSearch.vue +67 -67
  80. package/src/layouts/header/InstitutionDetail.vue +2 -2
  81. package/src/layouts/header/index.less +92 -92
  82. package/src/layouts/tabs/TabsHead.vue +190 -190
  83. package/src/layouts/tabs/TabsView.vue +379 -379
  84. package/src/mock/goods/index.js +108 -108
  85. package/src/pages/CreateQueryPage.vue +2 -2
  86. package/src/pages/login/Login.vue +369 -369
  87. package/src/pages/report/ReportTable.js +124 -124
  88. package/src/pages/report/ReportTableHome.vue +1 -1
  89. package/src/pages/resourceManage/orgListManage.vue +98 -98
  90. package/src/pages/system/dictionary/index.vue +1 -1
  91. package/src/pages/system/file/index.vue +3 -3
  92. package/src/pages/system/monitor/loginInfor/index.vue +1 -1
  93. package/src/pages/system/monitor/operLog/index.vue +1 -1
  94. package/src/pages/system/settings/index.vue +126 -126
  95. package/src/pages/system/settings/modifyPassword.vue +109 -109
  96. package/src/router/async/config.async.js +28 -28
  97. package/src/router/async/router.map.js +66 -74
  98. package/src/router/guards.js +153 -153
  99. package/src/router/index.js +27 -27
  100. package/src/services/api/DictionaryDetailsViewApi.js +1 -1
  101. package/src/services/api/LogDetailsViewApi.js +3 -3
  102. package/src/services/api/QueryParamsDetailsViewApi.js +1 -1
  103. package/src/services/api/TicketDetailsViewApi.js +15 -15
  104. package/src/services/api/cas.js +79 -79
  105. package/src/services/api/common.js +18 -13
  106. package/src/services/api/commonTempTable.js +3 -3
  107. package/src/services/api/index.js +17 -17
  108. package/src/services/api/logininfor/index.js +1 -1
  109. package/src/services/api/manage.js +2 -2
  110. package/src/services/apiService.js +14 -14
  111. package/src/services/user.js +67 -67
  112. package/src/store/modules/index.js +4 -4
  113. package/src/theme/default/nprogress.less +76 -76
  114. package/src/theme/default/style.less +58 -58
  115. package/src/utils/EncryptUtil.js +53 -53
  116. package/src/utils/colors.js +107 -107
  117. package/src/utils/excel/Blob.js +180 -180
  118. package/src/utils/excel/Export2Excel.js +141 -141
  119. package/src/utils/formatter.js +68 -68
  120. package/src/utils/i18n.js +80 -80
  121. package/src/utils/login.js +138 -138
  122. package/src/utils/map-utils.js +37 -37
  123. package/src/utils/theme-color-replacer-extend.js +91 -91
  124. package/src/utils/themeUtil.js +100 -100
  125. package/src/utils/util.js +230 -230
  126. package/vue.config.js +106 -106
  127. package/src/pages/system/queryParams/index.vue +0 -43
@@ -1,521 +1,521 @@
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-date-picker
186
- v-if="mode === '新增/修改'"
187
- v-model="form[attr.model]"
188
- :disabled="disabled"
189
- :show-time="true"
190
- valueFormat="YYYY-MM-DD HH:mm:ss"/>
191
- <a-range-picker v-else v-model="form[attr.model]" :disabled="disabled" :show-time="true" valueFormat="YYYY-MM-DD HH:mm:ss"/>
192
- </a-form-model-item>
193
- </x-form-col>
194
- <!-- 月份选择器 -->
195
- <x-form-col
196
- v-else-if="attr.type === 'monthPicker'"
197
- :flex="attr.flex">
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
- :flex="attr.flex">
206
- <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
207
- <a-date-picker
208
- v-model="form[attr.model]"
209
- :disabled="disabled"
210
- format="YYYY"
211
- mode="year"
212
- v-decorator="['year']"
213
- placeholder="请选择年份"
214
- :open="yearShowOne"
215
- @openChange="openChangeOne"
216
- @panelChange="panelChangeOne"/>
217
- </a-form-model-item>
218
- </x-form-col>
219
- <!-- 单日选择器 -->
220
- <x-form-col
221
- v-else-if="attr.type === 'datePicker'"
222
- :flex="attr.flex">
223
- <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
224
- <a-range-picker
225
- v-if="mode === '查询'"
226
- v-model="form[attr.model]"
227
- :disabled="disabled"
228
- :show-time="true"
229
- format="YYYY-MM-DD"
230
- valueFormat="YYYY-MM-DD HH:mm:ss" />
231
- <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"/>
232
- </a-form-model-item>
233
- </x-form-col>
234
- <!-- 文本域 -->
235
- <x-form-col
236
- v-else-if="attr.type === 'textarea'"
237
- :flex="{
238
- xs: 24,
239
- sm: 24,
240
- md: 24,
241
- lg: 24,
242
- xl: 24,
243
- xxl: 24
244
- }">
245
- <a-form-model-item
246
- :ref="attr.model"
247
- :label="attr.name"
248
- :prop="attr.model">
249
- <a-textarea v-model="form[attr.model]" :disabled="disabled" :placeholder="attr.placeholder ? attr.placeholder : '请输入'+attr.name.replace(/\s*/g, '')" :rows="4"/>
250
- </a-form-model-item>
251
- </x-form-col>
252
- <!-- 文件上传 -->
253
- <x-form-col
254
- v-else-if="attr.type === 'file' || attr.type === 'image'"
255
- :flex="{
256
- xs: 24,
257
- sm: 24,
258
- md: 24,
259
- lg: 24,
260
- xl: 24,
261
- xxl: 24
262
- }">
263
- <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
264
- <upload :files="files" :images="images" :model="attr" :service-name="serviceName" @setFiles="setFiles"></upload>
265
- </a-form-model-item>
266
- </x-form-col>
267
- <!-- 省市区选择框 -->
268
- <x-form-col
269
- v-else-if="attr.type === 'citySelect'"
270
- :flex="attr.flex">
271
- <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
272
- <citySelect v-model="form[attr.model]" ></citySelect>
273
- </a-form-model-item>
274
- </x-form-col>
275
- <!-- 地点搜索框 -->
276
- <x-form-col
277
- v-else-if="attr.type === 'addressSearch'"
278
- :flex="attr.flex">
279
- <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
280
- <address-search-combobox
281
- v-model="searchResult"
282
- :resultKeys="{ address: attr.model, coords: `${attr.model}_lng_lat` }"
283
- searchResultType="Object"
284
- @onSelect="form=Object.assign(form,JSON.parse(searchResult))"
285
- ></address-search-combobox>
286
- </a-form-model-item>
287
- </x-form-col>
288
- <!-- 人员选择框 -->
289
- <x-form-col
290
- v-else-if="attr.type === 'personSetting'"
291
- :flex="attr.flex">
292
- <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
293
- <PersonSetting v-model="form[attr.model]" ></PersonSetting>
294
- </a-form-model-item>
295
- </x-form-col>
296
- <!-- 树形选择框 -->
297
- <x-form-col
298
- v-else-if="attr.type === 'treeSelect'"
299
- :flex="attr.flex">
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 === '新增/修改' && !this.attr.flex) {
414
- this.attr.flex = {
415
- xs: 24,
416
- sm: 24,
417
- md: 24,
418
- lg: 12,
419
- xl: 12,
420
- xxl: 8
421
- }
422
- }
423
- if (this.attr.keyName && this.attr.keyName.indexOf('logic@') !== -1) {
424
- this.getData({}, res => {
425
- this.option = res
426
- if (this.attr.type === 'treeSelect') {
427
- this.$refs.xTreeSelect.init({
428
- option: this.option,
429
- form: this.form,
430
- queryType: this.attr.queryType,
431
- name: this.attr.name,
432
- model: this.attr.model,
433
- mode: this.mode,
434
- disabled: this.disabled
435
- })
436
- } else if (this.attr.type === 'radio') {
437
- this.initRadioValue()
438
- }
439
- })
440
- } else {
441
- this.initRadioValue()
442
- }
443
- },
444
- initRadioValue () {
445
- const model = this.attr.model
446
- if (this.mode === '新增/修改' && this.attr.type === 'radio' && !this.form[model]) {
447
- if (this.attr.keys && this.attr.keys.length > 0) {
448
- this.form[model] = this.attr.keys[0].value
449
- } else if (this.option && this.option.length > 0) {
450
- this.form[model] = this.option[0].value
451
- } else if (this.attr.keyName) {
452
- const list = this.$appdata.getDictionaryList(this.attr.keyName)
453
- if (list.length > 0) {
454
- this.form[model] = list[0].value
455
- }
456
- }
457
- }
458
- },
459
- openChangeOne (status) {
460
- if (status) {
461
- this.yearShowOne = true
462
- }
463
- },
464
- // 得到年份选择器的值
465
- panelChangeOne (value) {
466
- this.yearShowOne = false
467
- this.form[this.attr.model] = value.format('YYYY')
468
- },
469
- // 文件框时设置上传组件的值
470
- setFiles (fileIds) {
471
- if (!this.form[this.attr.model]) {
472
- this.form[this.attr.model] = []
473
- }
474
- this.form[this.attr.model] = [...fileIds]
475
- },
476
- // 懒加载检索方法
477
- fetchFunction (value) {
478
- this.lastFetchId += 1
479
- const fetchId = this.lastFetchId
480
- this.option = []
481
- this.searching = true
482
- this.getData({
483
- word: value
484
- }, res => {
485
- if (fetchId !== this.lastFetchId) {
486
- return
487
- }
488
- this.option = res
489
- this.searching = false
490
- })
491
- },
492
- // 获取数据
493
- getData (value, callback) {
494
- if (value !== '') {
495
- const logicName = this.attr.keyName
496
- const logic = logicName.substring(6)
497
- // 调用logic前设置参数
498
- if (this.getDataParams && this.getDataParams[this.attr.model]) {
499
- Object.assign(value, this.getDataParams[this.attr.model])
500
- }
501
- post('/api/' + this.serviceName + '/logic/' + logic, value).then(res => {
502
- callback(res)
503
- })
504
- }
505
- },
506
- filterOption (input, option) {
507
- const child = option.componentOptions.children[0]
508
- if (child.text) {
509
- return child.text.toLowerCase().indexOf(input.toLowerCase()) >= 0
510
- } else if (child.elm.innerText) {
511
- return child.elm.innerText.toLowerCase().indexOf(input.toLowerCase()) >= 0
512
- } else {
513
- return child.child.value.toLowerCase().indexOf(input.toLowerCase()) >= 0
514
- }
515
- }
516
- }
517
- }
518
- </script>
519
-
520
- <style lang="less" scoped>
521
- </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-date-picker
186
+ v-if="mode === '新增/修改'"
187
+ v-model="form[attr.model]"
188
+ :disabled="disabled"
189
+ :show-time="true"
190
+ valueFormat="YYYY-MM-DD HH:mm:ss"/>
191
+ <a-range-picker v-else v-model="form[attr.model]" :disabled="disabled" :show-time="true" valueFormat="YYYY-MM-DD HH:mm:ss"/>
192
+ </a-form-model-item>
193
+ </x-form-col>
194
+ <!-- 月份选择器 -->
195
+ <x-form-col
196
+ v-else-if="attr.type === 'monthPicker'"
197
+ :flex="attr.flex">
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
+ :flex="attr.flex">
206
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
207
+ <a-date-picker
208
+ v-model="form[attr.model]"
209
+ :disabled="disabled"
210
+ format="YYYY"
211
+ mode="year"
212
+ v-decorator="['year']"
213
+ placeholder="请选择年份"
214
+ :open="yearShowOne"
215
+ @openChange="openChangeOne"
216
+ @panelChange="panelChangeOne"/>
217
+ </a-form-model-item>
218
+ </x-form-col>
219
+ <!-- 单日选择器 -->
220
+ <x-form-col
221
+ v-else-if="attr.type === 'datePicker'"
222
+ :flex="attr.flex">
223
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
224
+ <a-range-picker
225
+ v-if="mode === '查询'"
226
+ v-model="form[attr.model]"
227
+ :disabled="disabled"
228
+ :show-time="true"
229
+ format="YYYY-MM-DD"
230
+ valueFormat="YYYY-MM-DD HH:mm:ss" />
231
+ <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"/>
232
+ </a-form-model-item>
233
+ </x-form-col>
234
+ <!-- 文本域 -->
235
+ <x-form-col
236
+ v-else-if="attr.type === 'textarea'"
237
+ :flex="{
238
+ xs: 24,
239
+ sm: 24,
240
+ md: 24,
241
+ lg: 24,
242
+ xl: 24,
243
+ xxl: 24
244
+ }">
245
+ <a-form-model-item
246
+ :ref="attr.model"
247
+ :label="attr.name"
248
+ :prop="attr.model">
249
+ <a-textarea v-model="form[attr.model]" :disabled="disabled" :placeholder="attr.placeholder ? attr.placeholder : '请输入'+attr.name.replace(/\s*/g, '')" :rows="4"/>
250
+ </a-form-model-item>
251
+ </x-form-col>
252
+ <!-- 文件上传 -->
253
+ <x-form-col
254
+ v-else-if="attr.type === 'file' || attr.type === 'image'"
255
+ :flex="{
256
+ xs: 24,
257
+ sm: 24,
258
+ md: 24,
259
+ lg: 24,
260
+ xl: 24,
261
+ xxl: 24
262
+ }">
263
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
264
+ <upload :files="files" :images="images" :model="attr" :service-name="serviceName" @setFiles="setFiles"></upload>
265
+ </a-form-model-item>
266
+ </x-form-col>
267
+ <!-- 省市区选择框 -->
268
+ <x-form-col
269
+ v-else-if="attr.type === 'citySelect'"
270
+ :flex="attr.flex">
271
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
272
+ <citySelect v-model="form[attr.model]" ></citySelect>
273
+ </a-form-model-item>
274
+ </x-form-col>
275
+ <!-- 地点搜索框 -->
276
+ <x-form-col
277
+ v-else-if="attr.type === 'addressSearch'"
278
+ :flex="attr.flex">
279
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
280
+ <address-search-combobox
281
+ v-model="searchResult"
282
+ :resultKeys="{ address: attr.model, coords: `${attr.model}_lng_lat` }"
283
+ searchResultType="Object"
284
+ @onSelect="form=Object.assign(form,JSON.parse(searchResult))"
285
+ ></address-search-combobox>
286
+ </a-form-model-item>
287
+ </x-form-col>
288
+ <!-- 人员选择框 -->
289
+ <x-form-col
290
+ v-else-if="attr.type === 'personSetting'"
291
+ :flex="attr.flex">
292
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
293
+ <PersonSetting v-model="form[attr.model]" ></PersonSetting>
294
+ </a-form-model-item>
295
+ </x-form-col>
296
+ <!-- 树形选择框 -->
297
+ <x-form-col
298
+ v-else-if="attr.type === 'treeSelect'"
299
+ :flex="attr.flex">
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: '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 === '新增/修改' && !this.attr.flex) {
414
+ this.attr.flex = {
415
+ xs: 24,
416
+ sm: 24,
417
+ md: 24,
418
+ lg: 12,
419
+ xl: 12,
420
+ xxl: 8
421
+ }
422
+ }
423
+ if (this.attr.keyName && this.attr.keyName.indexOf('logic@') !== -1) {
424
+ this.getData({}, res => {
425
+ this.option = res
426
+ if (this.attr.type === 'treeSelect') {
427
+ this.$refs.xTreeSelect.init({
428
+ option: this.option,
429
+ form: this.form,
430
+ queryType: this.attr.queryType,
431
+ name: this.attr.name,
432
+ model: this.attr.model,
433
+ mode: this.mode,
434
+ disabled: this.disabled
435
+ })
436
+ } else if (this.attr.type === 'radio') {
437
+ this.initRadioValue()
438
+ }
439
+ })
440
+ } else {
441
+ this.initRadioValue()
442
+ }
443
+ },
444
+ initRadioValue () {
445
+ const model = this.attr.model
446
+ if (this.mode === '新增/修改' && this.attr.type === 'radio' && !this.form[model]) {
447
+ if (this.attr.keys && this.attr.keys.length > 0) {
448
+ this.form[model] = this.attr.keys[0].value
449
+ } else if (this.option && this.option.length > 0) {
450
+ this.form[model] = this.option[0].value
451
+ } else if (this.attr.keyName) {
452
+ const list = this.$appdata.getDictionaryList(this.attr.keyName)
453
+ if (list.length > 0) {
454
+ this.form[model] = list[0].value
455
+ }
456
+ }
457
+ }
458
+ },
459
+ openChangeOne (status) {
460
+ if (status) {
461
+ this.yearShowOne = true
462
+ }
463
+ },
464
+ // 得到年份选择器的值
465
+ panelChangeOne (value) {
466
+ this.yearShowOne = false
467
+ this.form[this.attr.model] = value.format('YYYY')
468
+ },
469
+ // 文件框时设置上传组件的值
470
+ setFiles (fileIds) {
471
+ if (!this.form[this.attr.model]) {
472
+ this.form[this.attr.model] = []
473
+ }
474
+ this.form[this.attr.model] = [...fileIds]
475
+ },
476
+ // 懒加载检索方法
477
+ fetchFunction (value) {
478
+ this.lastFetchId += 1
479
+ const fetchId = this.lastFetchId
480
+ this.option = []
481
+ this.searching = true
482
+ this.getData({
483
+ word: value
484
+ }, res => {
485
+ if (fetchId !== this.lastFetchId) {
486
+ return
487
+ }
488
+ this.option = res
489
+ this.searching = false
490
+ })
491
+ },
492
+ // 获取数据
493
+ getData (value, callback) {
494
+ if (value !== '') {
495
+ const logicName = this.attr.keyName
496
+ const logic = logicName.substring(6)
497
+ // 调用logic前设置参数
498
+ if (this.getDataParams && this.getDataParams[this.attr.model]) {
499
+ Object.assign(value, this.getDataParams[this.attr.model])
500
+ }
501
+ post('/api/' + this.serviceName + '/logic/' + logic, value).then(res => {
502
+ callback(res)
503
+ })
504
+ }
505
+ },
506
+ filterOption (input, option) {
507
+ const child = option.componentOptions.children[0]
508
+ if (child.text) {
509
+ return child.text.toLowerCase().indexOf(input.toLowerCase()) >= 0
510
+ } else if (child.elm.innerText) {
511
+ return child.elm.innerText.toLowerCase().indexOf(input.toLowerCase()) >= 0
512
+ } else {
513
+ return child.child.value.toLowerCase().indexOf(input.toLowerCase()) >= 0
514
+ }
515
+ }
516
+ }
517
+ }
518
+ </script>
519
+
520
+ <style lang="less" scoped>
521
+ </style>