vue2-client 1.7.0 → 1.7.2

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 (128) hide show
  1. package/.env +15 -15
  2. package/CHANGELOG.md +661 -628
  3. package/Components.md +60 -0
  4. package/index.js +31 -30
  5. package/package.json +83 -81
  6. package/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox.vue +316 -316
  7. package/src/base-client/components/common/CitySelect/CitySelect.vue +247 -247
  8. package/src/base-client/components/common/CreateQuery/CreateQuery.vue +669 -667
  9. package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +735 -733
  10. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQuery.vue +466 -468
  11. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQueryItem.vue +510 -508
  12. package/src/base-client/components/common/FormGroupEdit/FormGroupEdit.vue +144 -146
  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 +168 -168
  16. package/src/base-client/components/common/XAddForm/XAddForm.vue +72 -325
  17. package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +369 -279
  18. package/src/base-client/components/common/XAddNativeForm/index.md +107 -17
  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 -180
  24. package/src/base-client/components/common/XForm/XFormItem.vue +521 -513
  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 -344
  28. package/src/base-client/components/common/XFormTable/index.md +97 -97
  29. package/src/base-client/components/common/XImportExcel/XImportExcel.vue +132 -132
  30. package/src/base-client/components/common/XTable/XTable.vue +519 -506
  31. package/src/base-client/components/common/XTreeOne/XTreeOne.vue +111 -111
  32. package/src/base-client/components/index.js +41 -0
  33. package/src/base-client/components/system/DictionaryDetailsView/DictionaryDetailsView.vue +231 -231
  34. package/src/base-client/components/system/QueryParamsDetailsView/QueryParamsDetailsView.vue +281 -281
  35. package/src/base-client/components/ticket/TicketDetailsView/TicketDetailsView.vue +807 -807
  36. package/src/base-client/components/ticket/TicketDetailsView/index.md +29 -29
  37. package/src/base-client/components/ticket/TicketDetailsView/part/TicketDetailsFlow.vue +260 -260
  38. package/src/base-client/components/ticket/TicketSubmitSuccessView/TicketSubmitSuccessView.vue +532 -532
  39. package/src/base-client/components/ticket/TicketSubmitSuccessView/index.md +29 -29
  40. package/src/base-client/plugins/AppData.js +76 -76
  41. package/src/base-client/plugins/GetLoginInfoService.js +179 -179
  42. package/src/base-client/plugins/PagedList.js +177 -177
  43. package/src/base-client/plugins/compatible/LoginServiceOA.js +20 -20
  44. package/src/base-client/plugins/i18n-extend.js +32 -32
  45. package/src/components/Ellipsis/Ellipsis.vue +65 -65
  46. package/src/components/Ellipsis/index.md +38 -38
  47. package/src/components/NumberInfo/index.md +43 -43
  48. package/src/components/STable/README.md +341 -341
  49. package/src/components/STable/index.js +318 -318
  50. package/src/components/Trend/index.md +45 -45
  51. package/src/components/checkbox/ColorCheckbox.vue +157 -157
  52. package/src/components/checkbox/ImgCheckbox.vue +163 -163
  53. package/src/components/exception/ExceptionPage.vue +70 -70
  54. package/src/components/form/FormRow.vue +52 -52
  55. package/src/components/index.js +36 -36
  56. package/src/components/menu/SideMenu.vue +75 -62
  57. package/src/components/menu/menu.js +273 -273
  58. package/src/components/page/header/index.less +40 -40
  59. package/src/components/setting/Setting.vue +235 -235
  60. package/src/components/table/StandardTable.vue +141 -141
  61. package/src/components/table/advance/ActionColumns.vue +158 -158
  62. package/src/components/table/advance/SearchArea.vue +355 -355
  63. package/src/components/tool/AStepItem.vue +60 -60
  64. package/src/components/tool/AvatarList.vue +68 -68
  65. package/src/components/tool/Drawer.vue +142 -142
  66. package/src/components/tool/TagSelect.vue +83 -83
  67. package/src/components/transition/PageToggleTransition.vue +97 -97
  68. package/src/config/CreateQueryConfig.js +307 -307
  69. package/src/config/default/admin.config.js +18 -18
  70. package/src/config/default/setting.config.js +4 -2
  71. package/src/config/replacer/resolve.config.js +67 -67
  72. package/src/layouts/CommonLayout.vue +42 -42
  73. package/src/layouts/ComponentLayoutOne.vue +47 -47
  74. package/src/layouts/PageLayout.vue +151 -151
  75. package/src/layouts/SinglePageView.vue +116 -116
  76. package/src/layouts/footer/PageFooter.vue +49 -49
  77. package/src/layouts/header/AdminHeader.vue +134 -134
  78. package/src/layouts/header/HeaderAvatar.vue +64 -64
  79. package/src/layouts/header/HeaderNotice.vue +176 -176
  80. package/src/layouts/header/HeaderSearch.vue +67 -67
  81. package/src/layouts/header/InstitutionDetail.vue +181 -181
  82. package/src/layouts/header/index.less +92 -92
  83. package/src/layouts/tabs/TabsHead.vue +190 -190
  84. package/src/layouts/tabs/TabsView.vue +379 -379
  85. package/src/lib.js +1 -0
  86. package/src/mock/goods/index.js +108 -108
  87. package/src/pages/CreateQueryPage.vue +84 -84
  88. package/src/pages/login/Login.vue +369 -369
  89. package/src/pages/report/ReportTable.js +124 -124
  90. package/src/pages/report/ReportTableHome.vue +28 -28
  91. package/src/pages/resourceManage/orgListManage.vue +98 -98
  92. package/src/pages/system/dictionary/index.vue +43 -43
  93. package/src/pages/system/file/index.vue +317 -317
  94. package/src/pages/system/monitor/loginInfor/index.vue +36 -36
  95. package/src/pages/system/monitor/operLog/index.vue +36 -36
  96. package/src/pages/system/settings/index.vue +126 -126
  97. package/src/pages/system/settings/modifyPassword.vue +109 -109
  98. package/src/router/async/config.async.js +28 -28
  99. package/src/router/async/router.map.js +66 -66
  100. package/src/router/guards.js +52 -12
  101. package/src/router/index.js +27 -27
  102. package/src/services/api/DictionaryDetailsViewApi.js +6 -6
  103. package/src/services/api/LogDetailsViewApi.js +10 -10
  104. package/src/services/api/QueryParamsDetailsViewApi.js +6 -6
  105. package/src/services/api/TicketDetailsViewApi.js +34 -34
  106. package/src/services/api/cas.js +79 -79
  107. package/src/services/api/common.js +137 -137
  108. package/src/services/api/commonTempTable.js +10 -10
  109. package/src/services/api/index.js +17 -17
  110. package/src/services/api/logininfor/index.js +6 -6
  111. package/src/services/api/manage.js +8 -8
  112. package/src/services/apiService.js +14 -14
  113. package/src/services/user.js +67 -67
  114. package/src/store/modules/index.js +4 -4
  115. package/src/theme/default/nprogress.less +76 -76
  116. package/src/theme/default/style.less +58 -58
  117. package/src/utils/EncryptUtil.js +53 -53
  118. package/src/utils/colors.js +107 -107
  119. package/src/utils/excel/Blob.js +180 -180
  120. package/src/utils/excel/Export2Excel.js +141 -141
  121. package/src/utils/formatter.js +68 -68
  122. package/src/utils/i18n.js +80 -80
  123. package/src/utils/login.js +138 -0
  124. package/src/utils/map-utils.js +37 -37
  125. package/src/utils/theme-color-replacer-extend.js +91 -91
  126. package/src/utils/themeUtil.js +100 -100
  127. package/src/utils/util.js +230 -230
  128. package/vue.config.js +106 -106
@@ -1,513 +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-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: '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>
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>