eoss-ui 0.7.26 → 0.7.28

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 (280) hide show
  1. package/lib/button-group.js +0 -6
  2. package/lib/button.js +0 -6
  3. package/lib/calogin.js +233 -239
  4. package/lib/checkbox-group.js +0 -6
  5. package/lib/data-table-form.js +0 -6
  6. package/lib/data-table.js +12 -14
  7. package/lib/date-picker.js +0 -6
  8. package/lib/dialog.js +0 -6
  9. package/lib/eoss-ui.common.js +1244 -1149
  10. package/lib/flow-group.js +3 -9
  11. package/lib/flow-list.js +81 -87
  12. package/lib/flow.js +301 -304
  13. package/lib/form.js +0 -6
  14. package/lib/handle-user.js +0 -6
  15. package/lib/handler.js +0 -6
  16. package/lib/icon.js +0 -6
  17. package/lib/index.js +1 -1
  18. package/lib/input-number.js +0 -6
  19. package/lib/input.js +0 -6
  20. package/lib/login.js +219 -114
  21. package/lib/main.js +370 -393
  22. package/lib/nav.js +0 -6
  23. package/lib/page.js +0 -6
  24. package/lib/pagination.js +0 -6
  25. package/lib/player.js +0 -6
  26. package/lib/qr-code.js +13 -19
  27. package/lib/radio-group.js +0 -6
  28. package/lib/retrial-auth.js +0 -6
  29. package/lib/select-ganged.js +0 -6
  30. package/lib/select.js +0 -6
  31. package/lib/selector-panel.js +0 -6
  32. package/lib/selector.js +0 -6
  33. package/lib/sizer.js +0 -6
  34. package/lib/steps.js +0 -6
  35. package/lib/switch.js +0 -6
  36. package/lib/table-form.js +0 -6
  37. package/lib/tabs.js +0 -6
  38. package/lib/tips.js +0 -6
  39. package/lib/tree-group.js +0 -6
  40. package/lib/tree.js +0 -6
  41. package/lib/upload.js +0 -6
  42. package/lib/utils/util.js +0 -6
  43. package/lib/wujie.js +0 -6
  44. package/lib/wxlogin.js +0 -6
  45. package/package.json +160 -160
  46. package/packages/.DS_Store +0 -0
  47. package/packages/button/index.js +5 -5
  48. package/packages/button/src/main.vue +418 -418
  49. package/packages/button-group/index.js +5 -5
  50. package/packages/button-group/src/main.vue +346 -346
  51. package/packages/calendar/index.js +5 -5
  52. package/packages/calogin/.DS_Store +0 -0
  53. package/packages/calogin/index.js +5 -5
  54. package/packages/calogin/src/main.vue +412 -412
  55. package/packages/calogin/src/plugin.js +915 -915
  56. package/packages/card/index.js +5 -5
  57. package/packages/card/src/main.vue +156 -156
  58. package/packages/cascader/index.js +5 -5
  59. package/packages/cascader/src/main.vue +168 -168
  60. package/packages/checkbox-group/index.js +5 -5
  61. package/packages/checkbox-group/src/main.vue +333 -333
  62. package/packages/clients/index.js +5 -5
  63. package/packages/clients/src/main.vue +151 -151
  64. package/packages/data-table/index.js +5 -5
  65. package/packages/data-table/src/children.vue +39 -39
  66. package/packages/data-table/src/column.vue +992 -988
  67. package/packages/data-table/src/main.vue +1831 -1831
  68. package/packages/data-table/src/sizer.vue +195 -195
  69. package/packages/data-table-form/index.js +5 -5
  70. package/packages/data-table-form/src/checkbox.vue +101 -101
  71. package/packages/data-table-form/src/colgroup.vue +17 -17
  72. package/packages/data-table-form/src/main.vue +181 -181
  73. package/packages/data-table-form/src/radio.vue +65 -65
  74. package/packages/data-table-form/src/table.vue +233 -233
  75. package/packages/data-table-form/src/tbody.vue +336 -336
  76. package/packages/data-table-form/src/thead.vue +68 -68
  77. package/packages/date-picker/.DS_Store +0 -0
  78. package/packages/date-picker/index.js +5 -5
  79. package/packages/date-picker/src/.DS_Store +0 -0
  80. package/packages/date-picker/src/main.vue +236 -236
  81. package/packages/dialog/index.js +5 -5
  82. package/packages/enable-drag/index.js +5 -5
  83. package/packages/enterprise/index.js +5 -5
  84. package/packages/enterprise/src/main.vue +66 -66
  85. package/packages/error-page/index.js +5 -5
  86. package/packages/error-page/src/main.vue +44 -44
  87. package/packages/flow/.DS_Store +0 -0
  88. package/packages/flow/index.js +5 -5
  89. package/packages/flow/src/.DS_Store +0 -0
  90. package/packages/flow/src/component/Circulate.vue +413 -413
  91. package/packages/flow/src/component/CommonOpinions.vue +373 -373
  92. package/packages/flow/src/component/CustomPreset.vue +322 -322
  93. package/packages/flow/src/component/FileList.vue +97 -97
  94. package/packages/flow/src/component/FreeCirculation.vue +240 -240
  95. package/packages/flow/src/component/Preset.vue +255 -255
  96. package/packages/flow/src/component/SendMsg.vue +242 -242
  97. package/packages/flow/src/component/TimeLimit.vue +190 -190
  98. package/packages/flow/src/component/taskUnionExamine.vue +755 -755
  99. package/packages/flow/src/form.vue +121 -121
  100. package/packages/flow/src/freeStartFlow.vue +2847 -2847
  101. package/packages/flow/src/main.vue +3853 -3854
  102. package/packages/flow/src/processForm.vue +1363 -1363
  103. package/packages/flow/src/processReject.vue +309 -308
  104. package/packages/flow/src/reset.vue +941 -941
  105. package/packages/flow/src/startTaskRead.vue +691 -691
  106. package/packages/flow/src/supervise.vue +159 -159
  107. package/packages/flow/src/table.vue +58 -58
  108. package/packages/flow-group/index.js +5 -5
  109. package/packages/flow-group/src/main.vue +717 -717
  110. package/packages/flow-list/.DS_Store +0 -0
  111. package/packages/flow-list/index.js +5 -5
  112. package/packages/flow-list/src/main.vue +1787 -1787
  113. package/packages/form/.DS_Store +0 -0
  114. package/packages/form/index.js +5 -5
  115. package/packages/form/src/main.vue +3901 -3901
  116. package/packages/form/src/table.vue +1512 -1512
  117. package/packages/handle-user/index.js +5 -5
  118. package/packages/handle-user/src/main.vue +137 -137
  119. package/packages/handler/index.js +5 -5
  120. package/packages/handler/src/main.vue +496 -496
  121. package/packages/icon/index.js +5 -5
  122. package/packages/icon/src/main.vue +104 -104
  123. package/packages/icons/index.js +5 -5
  124. package/packages/icons/src/main.vue +81 -81
  125. package/packages/input/index.js +5 -5
  126. package/packages/input/src/main.vue +356 -356
  127. package/packages/input-number/index.js +5 -5
  128. package/packages/input-number/src/main.vue +106 -106
  129. package/packages/label/index.js +5 -5
  130. package/packages/label/src/main.vue +457 -457
  131. package/packages/layout/index.js +5 -5
  132. package/packages/layout/src/item.vue +152 -152
  133. package/packages/layout/src/main.vue +31 -31
  134. package/packages/login/.DS_Store +0 -0
  135. package/packages/login/index.js +5 -5
  136. package/packages/login/src/main.vue +2068 -2020
  137. package/packages/login/src/resetPassword.vue +557 -557
  138. package/packages/main/.DS_Store +0 -0
  139. package/packages/main/index.js +5 -5
  140. package/packages/main/src/.DS_Store +0 -0
  141. package/packages/main/src/default/message.vue +249 -249
  142. package/packages/main/src/default/notice.vue +157 -157
  143. package/packages/main/src/default/userinfo.vue +502 -502
  144. package/packages/main/src/public/online.vue +89 -89
  145. package/packages/main/src/public/search.vue +464 -464
  146. package/packages/main/src/public/settings.vue +221 -221
  147. package/packages/main/src/simplicity/apps.vue +388 -388
  148. package/packages/main/src/simplicity/avatar.vue +82 -82
  149. package/packages/main/src/simplicity/handler.vue +144 -263
  150. package/packages/main/src/simplicity/index.vue +2211 -2135
  151. package/packages/main/src/simplicity/lists.vue +84 -84
  152. package/packages/main/src/simplicity/menu-list.vue +135 -135
  153. package/packages/main/src/simplicity/message.vue +259 -259
  154. package/packages/main/src/simplicity/notice.vue +190 -190
  155. package/packages/main/src/simplicity/router-page.vue +45 -45
  156. package/packages/main/src/simplicity/sub-menu.vue +264 -264
  157. package/packages/main/src/simplicity/user.vue +259 -259
  158. package/packages/main/src/simplicity/userinfo.vue +398 -398
  159. package/packages/menu/.DS_Store +0 -0
  160. package/packages/menu/index.js +5 -5
  161. package/packages/menu/src/main.vue +596 -596
  162. package/packages/nav/index.js +5 -5
  163. package/packages/nav/src/main.vue +351 -351
  164. package/packages/notify/index.js +5 -5
  165. package/packages/notify/src/main.vue +538 -538
  166. package/packages/page/index.js +5 -5
  167. package/packages/page/src/main.vue +167 -167
  168. package/packages/pagination/index.js +5 -5
  169. package/packages/pagination/src/main.vue +96 -96
  170. package/packages/player/index.js +5 -5
  171. package/packages/player/src/main.vue +194 -194
  172. package/packages/qr-code/index.js +5 -5
  173. package/packages/qr-code/src/main.vue +170 -170
  174. package/packages/radio-group/index.js +6 -6
  175. package/packages/radio-group/src/main.vue +319 -319
  176. package/packages/retrial-auth/index.js +5 -5
  177. package/packages/retrial-auth/src/main.vue +280 -280
  178. package/packages/select/.DS_Store +0 -0
  179. package/packages/select/index.js +5 -5
  180. package/packages/select/src/main.vue +782 -782
  181. package/packages/select-ganged/index.js +5 -5
  182. package/packages/select-ganged/src/main.vue +724 -724
  183. package/packages/selector/.DS_Store +0 -0
  184. package/packages/selector/index.js +5 -5
  185. package/packages/selector/src/main.vue +761 -761
  186. package/packages/selector-panel/.DS_Store +0 -0
  187. package/packages/selector-panel/index.js +5 -5
  188. package/packages/selector-panel/src/main.vue +1027 -1027
  189. package/packages/selector-panel/src/selection.vue +170 -170
  190. package/packages/selector-panel/src/tree.vue +129 -129
  191. package/packages/sizer/index.js +5 -5
  192. package/packages/sizer/src/main.vue +254 -254
  193. package/packages/steps/index.js +5 -5
  194. package/packages/steps/src/main.vue +181 -181
  195. package/packages/switch/index.js +5 -5
  196. package/packages/switch/src/main.vue +170 -170
  197. package/packages/table-form/index.js +5 -5
  198. package/packages/tabs/index.js +5 -5
  199. package/packages/tabs/src/main.vue +788 -788
  200. package/packages/tabs-panel/index.js +5 -5
  201. package/packages/tabs-panel/src/main.vue +29 -29
  202. package/packages/theme-chalk/src/.DS_Store +0 -0
  203. package/packages/theme-chalk/src/base.scss +261 -261
  204. package/packages/theme-chalk/src/button-group.scss +176 -176
  205. package/packages/theme-chalk/src/button.scss +24 -24
  206. package/packages/theme-chalk/src/calendar.scss +113 -113
  207. package/packages/theme-chalk/src/card.scss +99 -99
  208. package/packages/theme-chalk/src/checkbox-group.scss +8 -8
  209. package/packages/theme-chalk/src/clients.scss +87 -87
  210. package/packages/theme-chalk/src/data-table-form.scss +67 -67
  211. package/packages/theme-chalk/src/data-table.scss +293 -293
  212. package/packages/theme-chalk/src/date-picker.scss +7 -7
  213. package/packages/theme-chalk/src/dialog.scss +77 -77
  214. package/packages/theme-chalk/src/enable-drag.scss +181 -181
  215. package/packages/theme-chalk/src/enterprise.scss +5 -5
  216. package/packages/theme-chalk/src/error-page.scss +18 -18
  217. package/packages/theme-chalk/src/flow-group.scss +110 -110
  218. package/packages/theme-chalk/src/flow-list.scss +39 -39
  219. package/packages/theme-chalk/src/flow.scss +351 -351
  220. package/packages/theme-chalk/src/form.scss +501 -501
  221. package/packages/theme-chalk/src/handle-user.scss +40 -40
  222. package/packages/theme-chalk/src/handler.scss +148 -148
  223. package/packages/theme-chalk/src/icon.scss +1817 -1817
  224. package/packages/theme-chalk/src/icons.scss +99 -99
  225. package/packages/theme-chalk/src/input.scss +9 -9
  226. package/packages/theme-chalk/src/label.scss +24 -24
  227. package/packages/theme-chalk/src/layout.scss +46 -46
  228. package/packages/theme-chalk/src/login.scss +987 -987
  229. package/packages/theme-chalk/src/main.scss +663 -663
  230. package/packages/theme-chalk/src/menu.scss +224 -224
  231. package/packages/theme-chalk/src/mixins/color.scss +117 -117
  232. package/packages/theme-chalk/src/nav.scss +111 -111
  233. package/packages/theme-chalk/src/page.scss +3 -3
  234. package/packages/theme-chalk/src/pagination.scss +29 -29
  235. package/packages/theme-chalk/src/player.scss +9 -9
  236. package/packages/theme-chalk/src/qr-code.scss +17 -17
  237. package/packages/theme-chalk/src/radio-group.scss +9 -9
  238. package/packages/theme-chalk/src/retrial-auth.scss +38 -38
  239. package/packages/theme-chalk/src/select-ganged.scss +8 -8
  240. package/packages/theme-chalk/src/select.scss +8 -8
  241. package/packages/theme-chalk/src/selector-panel.scss +204 -204
  242. package/packages/theme-chalk/src/selector.scss +92 -92
  243. package/packages/theme-chalk/src/simplicity.scss +1370 -1370
  244. package/packages/theme-chalk/src/sizer.scss +36 -36
  245. package/packages/theme-chalk/src/steps.scss +88 -88
  246. package/packages/theme-chalk/src/switch.scss +3 -3
  247. package/packages/theme-chalk/src/table-form.scss +1 -1
  248. package/packages/theme-chalk/src/tabs.scss +87 -87
  249. package/packages/theme-chalk/src/tips.scss +7 -7
  250. package/packages/theme-chalk/src/toolbar.scss +179 -179
  251. package/packages/theme-chalk/src/tree-group.scss +72 -72
  252. package/packages/theme-chalk/src/tree.scss +165 -165
  253. package/packages/theme-chalk/src/upload.scss +172 -172
  254. package/packages/theme-chalk/src/wxlogin.scss +3 -3
  255. package/packages/tips/index.js +5 -5
  256. package/packages/tips/src/main.vue +141 -141
  257. package/packages/toolbar/index.js +5 -5
  258. package/packages/toolbar/src/main.vue +430 -430
  259. package/packages/tree/index.js +5 -5
  260. package/packages/tree-group/index.js +5 -5
  261. package/packages/upload/.DS_Store +0 -0
  262. package/packages/upload/index.js +5 -5
  263. package/packages/upload/src/main.vue +1343 -1343
  264. package/packages/upload/src/picture.js +15 -15
  265. package/packages/wujie/index.js +5 -5
  266. package/packages/wujie/src/main.vue +145 -145
  267. package/packages/wxlogin/index.js +5 -5
  268. package/packages/wxlogin/src/main.vue +128 -128
  269. package/src/.DS_Store +0 -0
  270. package/src/config/api.js +315 -315
  271. package/src/config/image.js +2 -2
  272. package/src/index.js +163 -163
  273. package/src/utils/.DS_Store +0 -0
  274. package/src/utils/bus.js +3 -3
  275. package/src/utils/date-util.js +312 -312
  276. package/src/utils/http.js +50 -50
  277. package/src/utils/rules.js +18 -18
  278. package/src/utils/store.js +21 -21
  279. package/src/utils/util.js +0 -6
  280. package/src/utils/webSocket.js +107 -107
@@ -1,988 +1,992 @@
1
- <template>
2
- <el-table-column v-bind="config" :key="field">
3
- <slot> </slot>
4
- <template slot-scope="scope">
5
- <template v-if="isForm && !isReadOnly(scope)">
6
- <el-form-item
7
- v-if="!(type === 'handle' && !scope.row.hideHandle)"
8
- :name="name"
9
- :prop="field || prop"
10
- :rules="isNotRule(scope) ? [] : rules"
11
- :index="scope.$index"
12
- >
13
- <component
14
- v-if="getType(scope.row.formConfigs, 'component')"
15
- :is="tag"
16
- v-bind="getOptions(scope.row.formConfigs)"
17
- v-model="scope.row[field || prop]"
18
- :data="getData(scope.row.formOptions)"
19
- @blur="
20
- (event) => {
21
- handleBlur({
22
- item: config,
23
- event: event,
24
- data: scope.row,
25
- scope: scope
26
- });
27
- }
28
- "
29
- @focus="
30
- (event) => {
31
- handleFocus({
32
- item: config,
33
- event: event,
34
- data: scope.row,
35
- scope: scope
36
- });
37
- }
38
- "
39
- @change="
40
- (value) => {
41
- handleChange({
42
- item: config,
43
- name: field || prop,
44
- value: value,
45
- data: scope.row,
46
- scope: scope
47
- });
48
- }
49
- "
50
- ></component>
51
- <es-select
52
- v-else-if="getType(scope.row.formConfigs, 'select')"
53
- v-bind="getOptions(scope.row.formConfigs)"
54
- v-model="scope.row[field || prop]"
55
- :data="getData(scope.row.formOptions)"
56
- @blur="
57
- (event) => {
58
- handleBlur({
59
- item: config,
60
- event: event,
61
- data: scope.row,
62
- scope: scope
63
- });
64
- }
65
- "
66
- @focus="
67
- (event) => {
68
- handleFocus({
69
- item: config,
70
- event: event,
71
- data: scope.row,
72
- scope: scope
73
- });
74
- }
75
- "
76
- @change="
77
- (value) => {
78
- handleChange({
79
- item: config,
80
- name: field || prop,
81
- value: value,
82
- data: scope.row,
83
- scope: scope
84
- });
85
- }
86
- "
87
- >
88
- </es-select>
89
- <es-cascader
90
- v-else-if="getType(scope.row.formConfigs, 'cascader')"
91
- v-bind="getOptions(scope.row.formConfigs)"
92
- v-model="scope.row[field || prop]"
93
- :data="getData(scope.row.formOptions)"
94
- @blur="
95
- (event) => {
96
- handleBlur({
97
- item: config,
98
- event: event,
99
- data: scope.row,
100
- scope: scope
101
- });
102
- }
103
- "
104
- @focus="
105
- (event) => {
106
- handleFocus({
107
- item: config,
108
- event: event,
109
- data: scope.row,
110
- scope: scope
111
- });
112
- }
113
- "
114
- @change="
115
- (value) => {
116
- handleChange({
117
- item: config,
118
- name: field || prop,
119
- value: value,
120
- data: scope.row,
121
- scope: scope
122
- });
123
- }
124
- "
125
- >
126
- </es-cascader>
127
- <es-select-ganged
128
- v-else-if="getType(scope.row.formConfigs, 'ganged')"
129
- v-bind="getOptions(scope.row.formConfigs)"
130
- v-model="scope.row[field || prop]"
131
- :data="init(getData(scope.row.formOptions), config)"
132
- @change="
133
- (value) => {
134
- handleChange({
135
- name: field || prop,
136
- value: value,
137
- data: scope.row,
138
- item: item
139
- });
140
- }
141
- "
142
- >
143
- </es-select-ganged>
144
- <es-radio-group
145
- v-else-if="getType(scope.row.formConfigs, 'radio')"
146
- v-bind="getOptions(scope.row.formConfigs)"
147
- v-model="scope.row[field || prop]"
148
- :data="getData(scope.row.formOptions)"
149
- @change="
150
- (value) => {
151
- handleChange({
152
- item: config,
153
- name: field || prop,
154
- value: value,
155
- data: scope.row
156
- });
157
- }
158
- "
159
- >
160
- </es-radio-group>
161
- <es-checkbox-group
162
- v-else-if="getType(scope.row.formConfigs, 'checkbox')"
163
- v-bind="getOptions(scope.row.formConfigs)"
164
- v-model="scope.row[field || prop]"
165
- :data="getData(scope.row.formOptions)"
166
- @change="
167
- (value) => {
168
- handleChange({
169
- item: config,
170
- name: field || prop,
171
- value: value,
172
- data: scope.row
173
- });
174
- }
175
- "
176
- >
177
- </es-checkbox-group>
178
- <es-switch
179
- v-else-if="getType(scope.row.formConfigs, 'switch')"
180
- v-bind="getOptions(scope.row.formConfigs)"
181
- v-model="scope.row[field || prop]"
182
- :data="getData(scope.row.formOptions)"
183
- @change="
184
- (value) => {
185
- handleChange({
186
- item: config,
187
- name: field || prop,
188
- value: value,
189
- data: scope.row
190
- });
191
- }
192
- "
193
- >
194
- </es-switch>
195
- <es-date-picker
196
- v-else-if="
197
- config.date ||
198
- getType(scope.row.formConfigs, [
199
- 'date',
200
- 'year',
201
- 'month',
202
- 'date',
203
- 'dates',
204
- 'week',
205
- 'datetime',
206
- 'datetimerange',
207
- 'daterange',
208
- 'monthrange',
209
- 'quarter',
210
- 'halfyear'
211
- ])
212
- "
213
- v-bind="getOptions(scope.row.formConfigs)"
214
- v-model="scope.row[field || prop]"
215
- :type="type"
216
- @blur="
217
- (event) => {
218
- handleBlur({
219
- item: config,
220
- event: event,
221
- data: scope.row,
222
- scope: scope
223
- });
224
- }
225
- "
226
- @focus="
227
- (event) => {
228
- handleFocus({
229
- item: config,
230
- event: event,
231
- data: scope.row,
232
- scope: scope
233
- });
234
- }
235
- "
236
- @change="
237
- (value) => {
238
- handleChange({
239
- item: config,
240
- name: field || prop,
241
- value: value,
242
- data: scope.row,
243
- scope: scope
244
- });
245
- }
246
- "
247
- >
248
- </es-date-picker>
249
- <es-input-number
250
- v-else-if="getType(scope.row.formConfigs, 'number')"
251
- v-bind="getOptions(scope.row.formConfigs)"
252
- v-model="scope.row[field || prop]"
253
- @blur="
254
- (event) => {
255
- handleBlur({
256
- item: config,
257
- event: event,
258
- data: scope.row,
259
- scope: scope
260
- });
261
- }
262
- "
263
- @focus="
264
- (event) => {
265
- handleFocus({
266
- item: config,
267
- event: event,
268
- data: scope.row,
269
- scope: scope
270
- });
271
- }
272
- "
273
- @change="
274
- (value) => {
275
- handleChange({
276
- item: config,
277
- name: field || prop,
278
- value: value,
279
- data: scope.row,
280
- scope: scope
281
- });
282
- }
283
- "
284
- >
285
- </es-input-number>
286
- <es-selector
287
- v-else-if="getType(scope.row.formConfigs, 'selector')"
288
- v-bind="getOptions(scope.row.formConfigs)"
289
- v-model="scope.row[field || prop]"
290
- v-on="
291
- exclAttribute({
292
- data: events,
293
- attrs: 'change'
294
- })
295
- "
296
- @change="
297
- (value) => {
298
- handleChange({
299
- item: config,
300
- name: field || prop,
301
- value: value,
302
- data: scope.row
303
- });
304
- }
305
- "
306
- >
307
- </es-selector>
308
- <template
309
- v-else-if="
310
- getType(scope.row.formConfigs, ['text', 'input', 'textarea'])
311
- "
312
- >
313
- <template v-if="config.lazy">
314
- <input
315
- v-if="getType(scope.row.formConfigs, ['text', 'input'])"
316
- class="el-input__inner"
317
- v-bind="getOptions(scope.row.formConfigs)"
318
- v-model.lazy="scope.row[field]"
319
- @blur="
320
- (event) => {
321
- handleBlur({
322
- item: config,
323
- event: event,
324
- data: scope.row,
325
- scope: scope
326
- });
327
- }
328
- "
329
- @focus="
330
- (event) => {
331
- handleFocus({
332
- item: config,
333
- event: event,
334
- data: scope.row,
335
- scope: scope
336
- });
337
- }
338
- "
339
- @change="
340
- (value) => {
341
- handleChange({
342
- item: config,
343
- name: field || prop,
344
- value: value,
345
- data: scope.row,
346
- scope: scope
347
- });
348
- }
349
- "
350
- />
351
- <textarea
352
- v-else
353
- class="el-textarea__inner"
354
- v-bind="getOptions(scope.row.formConfigs)"
355
- v-model.lazy="scope.row[field]"
356
- @blur="
357
- (event) => {
358
- handleBlur({
359
- item: config,
360
- event: event,
361
- data: scope.row,
362
- scope: scope
363
- });
364
- }
365
- "
366
- @focus="
367
- (event) => {
368
- handleFocus({
369
- item: config,
370
- event: event,
371
- data: scope.row,
372
- scope: scope
373
- });
374
- }
375
- "
376
- @change="
377
- (value) => {
378
- handleChange({
379
- item: config,
380
- name: field || prop,
381
- value: value,
382
- data: scope.row,
383
- scope: scope
384
- });
385
- }
386
- "
387
- ></textarea>
388
- </template>
389
- <es-input
390
- v-else
391
- v-bind="getOptions(scope.row.formConfigs)"
392
- :type="type"
393
- :scope="scope"
394
- v-model="scope.row[field || prop]"
395
- @blur="
396
- (event) => {
397
- handleBlur({
398
- item: config,
399
- event: event,
400
- data: scope.row,
401
- scope: scope
402
- });
403
- }
404
- "
405
- @focus="
406
- (event) => {
407
- handleFocus({
408
- item: config,
409
- event: event,
410
- data: scope.row,
411
- scope: scope
412
- });
413
- }
414
- "
415
- @change="
416
- (value) => {
417
- handleChange({
418
- item: config,
419
- name: field || prop,
420
- value: value,
421
- data: scope.row,
422
- scope: scope
423
- });
424
- }
425
- "
426
- >
427
- </es-input>
428
- </template>
429
- </el-form-item>
430
- </template>
431
- <expand-dom
432
- v-else-if="render"
433
- :column="config"
434
- :row="scope.row"
435
- :render="render"
436
- :index="indexs"
437
- :options="optionDatas"
438
- >
439
- </expand-dom>
440
- <template v-else-if="dateFormat">
441
- {{ formatDate(scope.row[field || prop], dateFormat) }}
442
- </template>
443
- <span
444
- v-else-if="type === 'textarea'"
445
- v-html="format(scope.row, true)"
446
- :style="styles ? styles[scope.row[prop]] : {}"
447
- ></span>
448
- <span v-else :style="styles ? styles[scope.row[prop]] : {}" v-html="format(scope.row)"></span>
449
- <!-- {{ format(scope.row) }} -->
450
- <es-button-group
451
- v-if="type === 'handle' && !scope.row.hideHandle"
452
- v-bind="
453
- exclAttribute({
454
- data: config,
455
- attrs: ['contents', 'events', 'type', 'width', 'template', 'title']
456
- })
457
- "
458
- stop
459
- :mode="mode"
460
- :contents="contents || events"
461
- :data="scope"
462
- @handleClick="handleClick"
463
- v-model="btnWidth"
464
- ></es-button-group>
465
- </template>
466
- </el-table-column>
467
- </template>
468
-
469
- <script type="text/babel">
470
- import { findSysCode, getDictList } from 'eoss-ui/src/config/api.js';
471
- import util from 'eoss-ui/src/utils/util';
472
- export default {
473
- name: 'Column',
474
- components: {
475
- expandDom: {
476
- functional: true,
477
- props: {
478
- row: Object,
479
- render: [Function, String],
480
- index: Number,
481
- column: {
482
- type: Object,
483
- default: null
484
- },
485
- options: Object
486
- },
487
- render: (h, ctx) => {
488
- const params = {
489
- row: ctx.props.row,
490
- index: ctx.props.index
491
- };
492
- if (ctx.props.column) {
493
- params.column = ctx.props.column;
494
- }
495
- if (typeof ctx.props.render == 'string') {
496
- try {
497
- return util.toFunction(ctx.props.render)(
498
- h,
499
- params,
500
- ctx.props.options
501
- );
502
- } catch (error) {
503
- throw error;
504
- }
505
- }
506
- return ctx.props.render(h, params, ctx.props.options);
507
- }
508
- }
509
- },
510
- inject: {
511
- elForm: {
512
- default: ''
513
- },
514
- tableReload: {
515
- default: ''
516
- },
517
- table: {
518
- default: ''
519
- }
520
- },
521
- props: {
522
- tag: String,
523
- mode: String,
524
- service: String,
525
- form: Boolean,
526
- readonly: Boolean,
527
- name: String,
528
- filterIcon: [Boolean, String],
529
- title: String,
530
- label: String,
531
- labelKey: String,
532
- valueKey: String,
533
- field: String,
534
- prop: String,
535
- sortable: [Boolean, String],
536
- sort: [Boolean, String],
537
- className: String,
538
- labelClassName: String,
539
- type: String,
540
- required: Boolean,
541
- width: [Number, String],
542
- minWidth: [Number, String],
543
- hide: Boolean,
544
- showOverflowTooltip: [Boolean, Number],
545
- render: [Function, String],
546
- contents: Array,
547
- events: [Array, Object],
548
- dateFormat: String,
549
- dateValue: {
550
- type: String,
551
- default: ''
552
- },
553
- styles: [Array, Object],
554
- sysCode: String,
555
- valueToString: Boolean,
556
- symbol: String,
557
- rules: [Array, Object],
558
- method: String,
559
- indexs: {
560
- type: Number,
561
- default: null
562
- },
563
- data: [Object, Array],
564
- optionData: {
565
- type: Object,
566
- default() {
567
- return {};
568
- }
569
- }
570
- },
571
- watch: {
572
- optionData: {
573
- deep: true,
574
- handler(val) {
575
- this.optionDatas = val;
576
- }
577
- },
578
- width: {
579
- immediate: true,
580
- handler(val) {
581
- if (val) {
582
- this.btnWidth = parseInt(val, 10) + 'px';
583
- }
584
- }
585
- }
586
- },
587
- computed: {
588
- config() {
589
- let config = {
590
- label: this.label || this.title,
591
- width: this.btnWidth || this.width
592
- };
593
- if (this.type === 'expand') {
594
- config = { type: this.type, ...config, ...this.$attrs };
595
- return config;
596
- }
597
- let required = this.required;
598
- if (this.rules && !required) {
599
- if (Array.isArray(this.rules)) {
600
- this.rules.map((item) => {
601
- if (item.required) {
602
- required = item.required;
603
- }
604
- });
605
- } else if (this.rules.required) {
606
- required = this.rules.required;
607
- }
608
- }
609
- if (this.type === 'handle') {
610
- config.sort = true;
611
- config.outside = false;
612
- }
613
- return {
614
- ...config,
615
- filterIcon: this.icon,
616
- sortable: this.sortable || this.sort,
617
- minWidth: this.minWidth || this.table.minWidth,
618
- className: [
619
- this.className ? this.className : '',
620
- this.type ? ' es-table-' + this.type + '-box' : '',
621
- this.showOverflowTooltip ? ' es-text-ellipsis' : ''
622
- ].join(' '),
623
- labelClassName: [
624
- this.labelClassName ? this.labelClassName : '',
625
- required ? 'es-required' : ''
626
- ].join(' '),
627
- showOverflowTooltip: this.showOverflowTooltip,
628
- prop: this.field || this.prop,
629
- field: this.field,
630
- ...this.$attrs
631
- };
632
- },
633
- formOption() {
634
- let config = {
635
- labelKey: this.sysCode
636
- ? this.service
637
- ? 'label'
638
- : 'shortName'
639
- : this.labelKey,
640
- valueKey: this.sysCode
641
- ? this.service
642
- ? 'value'
643
- : 'cciValue'
644
- : this.valueKey,
645
- rules: this.rules,
646
- events: this.events,
647
- ...this.$attrs
648
- };
649
- return config;
650
- },
651
- icon() {
652
- if (this.filterIcon === true) {
653
- return 'es-icon-biao';
654
- }
655
- return false;
656
- },
657
- isForm() {
658
- let type = this.type ? this.type.toLowerCase() : '';
659
- let flag =
660
- (this.form &&
661
- [
662
- 'input',
663
- 'text',
664
- 'textarea',
665
- 'checkbox',
666
- 'radio',
667
- 'select',
668
- 'handle',
669
- 'date',
670
- 'year',
671
- 'month',
672
- 'date',
673
- 'dates',
674
- 'week',
675
- 'datetime',
676
- 'datetimerange',
677
- 'daterange',
678
- 'monthrange',
679
- 'quarter',
680
- 'halfyear',
681
- 'switch',
682
- 'selector',
683
- 'ganged',
684
- 'number'
685
- ].indexOf(type) > -1) ||
686
- ['space', 'slot'].indexOf(type) > -1;
687
- return flag;
688
- },
689
- option() {
690
- const field = this.field || this.prop;
691
- return this.data ? this.data : this.optionDatas[this.sysCode || field];
692
- },
693
- findCode() {
694
- if (this.service) {
695
- return `/${this.service}${getDictList}`;
696
- }
697
- return findSysCode;
698
- }
699
- },
700
- data() {
701
- return {
702
- btnWidth: '',
703
- searchs: [],
704
- optionDatas: this.optionData
705
- };
706
- },
707
- mounted() {},
708
- methods: {
709
- init(data, value, item) {
710
- if (data && value) {
711
- if (Array.isArray(value) && value.length) {
712
- if (item.url || this.sysCode) {
713
- value.forEach(async (val, index) => {
714
- if (
715
- val.hasSub == false ||
716
- this.searchs.indexOf(val[this.valueKey] || val.value) > -1
717
- ) {
718
- return;
719
- }
720
- this.searchs.push(val[this.valueKey] || val.value);
721
- if ((item.ganged && index < item.ganged - 1) || val.hasSub) {
722
- let option = data[index + 1];
723
- let lists = [];
724
- if (option) {
725
- let v = val[this.valueKey] || val.value;
726
- lists = option.filter((list) => {
727
- return list[item.filtrateKey] == v;
728
- });
729
- }
730
- if (lists.length == 0) {
731
- let queryKey = item.queryKey;
732
- let param = {};
733
- if (queryKey) {
734
- for (let i in queryKey) {
735
- param[i] = val[queryKey[i]];
736
- }
737
- }
738
- let params = util.extend(
739
- true,
740
- this.sysCode
741
- ? { sysAppCode: this.sysCode, code: sysCode }
742
- : {},
743
- item.param ? item.param : {},
744
- param
745
- );
746
- await util
747
- .ajax({
748
- url: this.sysCode ? this.findCode : item.url,
749
- method: this.method,
750
- params: params,
751
- data: params
752
- })
753
- .then((res) => {
754
- if (res.rCode === 0) {
755
- let options = JSON.parse(JSON.stringify(data));
756
- if (options[index + 1]) {
757
- this.$set(
758
- data,
759
- index + 1,
760
- options[index + 1].concat(
761
- JSON.parse(JSON.stringify(res.results))
762
- )
763
- );
764
- } else {
765
- this.$set(
766
- data,
767
- index + 1,
768
- JSON.parse(JSON.stringify(res.results))
769
- );
770
- }
771
- } else {
772
- let msg = res.msg || '系统错误,请联系管理员!';
773
- this.$message.error(msg);
774
- }
775
- })
776
- .catch((err) => {
777
- if (err.message && err.message !== 'canceled') {
778
- this.$message.error(err.message);
779
- }
780
- });
781
- }
782
- }
783
- });
784
- }
785
- }
786
- }
787
- return data;
788
- },
789
- getType(config, types) {
790
- let type =
791
- config && config[this.field || this.prop]
792
- ? config[this.field || this.prop]['type'] ||
793
- config[this.field || this.prop]
794
- : this.type;
795
- return Array.isArray(types) ? types.includes(type) : type == types;
796
- },
797
- getOptions(config) {
798
- let option = config && config[this.field || this.prop];
799
- return option && typeof option == 'object'
800
- ? { ...this.formOption, ...option }
801
- : this.formOption;
802
- },
803
- getData(res) {
804
- return res && res[this.field || this.prop]
805
- ? res[this.field || this.prop]
806
- : this.option;
807
- },
808
- exclAttribute({ data, attrs }) {
809
- return util.exclAttribute({ data, attrs });
810
- },
811
- format(rows, flag) {
812
- const field = this.field || this.prop;
813
- let data = this.option;
814
- let str = '';
815
- if (util.isObject(rows[field])) {
816
- str =
817
- rows[field][this.labelKey] ||
818
- rows[field]['name'] ||
819
- rows[field]['label'] ||
820
- rows[field]['shortName'];
821
- } else if (Array.isArray(rows[field])) {
822
- const vals = rows[field].map((item) => {
823
- if (util.isObject(item)) {
824
- return (
825
- item[this.labelKey] ||
826
- item['name'] ||
827
- item['label'] ||
828
- item['shortName']
829
- );
830
- } else {
831
- if (data && data.length && util.isObject(data[0])) {
832
- return this.getLabel(data, item);
833
- }
834
- return item;
835
- }
836
- });
837
- str = vals.join(this.symbol ? this.symbol : '-');
838
- } else {
839
- if (this.valueToString) {
840
- const vals = rows[field].split(',').map((item) => {
841
- if (data && data.length && util.isObject(data[0])) {
842
- return this.getLabel(data, item);
843
- }
844
- return item;
845
- });
846
- str = vals.join(this.symbol ? this.symbol : '-');
847
- } else {
848
- if (data && data.length && util.isObject(data[0])) {
849
- str = this.getLabel(data, rows[field]);
850
- } else {
851
- str = rows[field];
852
- }
853
- }
854
- }
855
- if (str && flag) {
856
- str = str.replace(RegExp('\\n', 'g'), '<br/>');
857
- str = str.replace(RegExp(' ', 'g'), '&nbsp;');
858
- }
859
- return str;
860
- },
861
- getLabel(obj, val) {
862
- for (let i = 0; i < obj.length; i++) {
863
- let item = obj[i];
864
- let value = item[this.valueKey || 'cciValue'] || item['value'];
865
- if (value == val) {
866
- return (
867
- item[this.labelKey] ||
868
- item['name'] ||
869
- item['label'] ||
870
- item['shortName']
871
- );
872
- } else if (item.children && item.children.length) {
873
- return this.getLabel(item.children, val);
874
- }
875
- }
876
- },
877
- isReadOnly(scope) {
878
- return (
879
- scope.row.canEdit === false ||
880
- this.readonly ||
881
- this.$attrs.editable === false ||
882
- (scope.row.cantEditKey &&
883
- scope.row.cantEditKey.indexOf(this.field || this.prop) > -1)
884
- );
885
- },
886
- isNotRule(scope) {
887
- if (
888
- scope.row.canRule === false ||
889
- (scope.row.notRules &&
890
- scope.row.notRules.indexOf(this.field || this.prop) > -1)
891
- ) {
892
- this.elForm && this.elForm.clearValidate(this.field || this.prop);
893
- return true;
894
- }
895
- return false;
896
- },
897
- handleBlur(data) {
898
- this.events && this.events.blur && this.events.blur(data);
899
- this.$emit('formBlur', data);
900
- this.$emit('form-blur', data);
901
- },
902
- handleFocus(data) {
903
- this.events && this.events.focus && this.events.focus(data);
904
- this.$emit('formFocus', data);
905
- this.$emit('form-focus', data);
906
- },
907
- handleChange(datas) {
908
- let { item, name, data } = datas;
909
- if (
910
- item &&
911
- ((data.formConfigs && data.formConfigs[name] == 'ganged') ||
912
- this.type == 'ganged')
913
- ) {
914
- let { index, value } = datas.value;
915
- if (
916
- (item.url || this.sysCode) &&
917
- ((item.ganged && index > item.ganged - 1) || value.hasSub)
918
- ) {
919
- let filte = value[this.valueKey] || value.value;
920
- let datas = [];
921
- if (this.optionDatas[this.field || this.prop][index + 1]) {
922
- datas = this.optionDatas[this.field || this.prop][index + 1].filter(
923
- (items) => {
924
- return filte == items[item.filtrateKey];
925
- }
926
- );
927
- }
928
- if (datas.length == 0) {
929
- let queryKey = item.queryKey;
930
- let param = {};
931
- if (queryKey) {
932
- for (let i in queryKey) {
933
- param[i] = value[queryKey[i]];
934
- }
935
- }
936
- let params = util.extend(
937
- true,
938
- this.sysCode ? { sysAppCode: this.sysCode, code: sysCode } : {},
939
- item.param ? item.param : {},
940
- param
941
- );
942
- util
943
- .ajax({
944
- url: this.sysCode ? this.findCode : item.url,
945
- method: this.method,
946
- params: params,
947
- data: params
948
- })
949
- .then((res) => {
950
- if (res.rCode === 0) {
951
- let options = JSON.parse(
952
- JSON.stringify(this.optionDatas[this.sysCode])
953
- );
954
- if (options[index + 1]) {
955
- options[index + 1] = options[index + 1].concat(
956
- JSON.parse(JSON.stringify(res.results))
957
- );
958
- } else {
959
- options.push(JSON.parse(JSON.stringify(res.results)));
960
- }
961
- this.$set(this.optionDatas, this.sysCode, options);
962
- } else {
963
- let msg = res.msg || '系统错误,请联系管理员!';
964
- this.$message.error(msg);
965
- }
966
- })
967
- .catch((err) => {
968
- if (err.message && err.message !== 'canceled') {
969
- this.$message.error(err.message);
970
- }
971
- });
972
- }
973
- }
974
- }
975
- this.events && this.events.change && this.events.change(datas);
976
- this.$emit('formChange', datas);
977
- this.$emit('form-change', datas);
978
- },
979
- handleClick(data) {
980
- this.$emit('handleClick', data);
981
- this.$emit('handle-click', data);
982
- },
983
- formatDate(date, fmt) {
984
- return date ? util.formatDate(date, fmt) : this.dateValue;
985
- }
986
- }
987
- };
988
- </script>
1
+ <template>
2
+ <el-table-column v-bind="config" :key="field">
3
+ <slot> </slot>
4
+ <template slot-scope="scope">
5
+ <template v-if="isForm && !isReadOnly(scope)">
6
+ <el-form-item
7
+ v-if="!(type === 'handle' && !scope.row.hideHandle)"
8
+ :name="name"
9
+ :prop="field || prop"
10
+ :rules="isNotRule(scope) ? [] : rules"
11
+ :index="scope.$index"
12
+ >
13
+ <component
14
+ v-if="getType(scope.row.formConfigs, 'component')"
15
+ :is="tag"
16
+ v-bind="getOptions(scope.row.formConfigs)"
17
+ v-model="scope.row[field || prop]"
18
+ :data="getData(scope.row.formOptions)"
19
+ @blur="
20
+ (event) => {
21
+ handleBlur({
22
+ item: config,
23
+ event: event,
24
+ data: scope.row,
25
+ scope: scope
26
+ });
27
+ }
28
+ "
29
+ @focus="
30
+ (event) => {
31
+ handleFocus({
32
+ item: config,
33
+ event: event,
34
+ data: scope.row,
35
+ scope: scope
36
+ });
37
+ }
38
+ "
39
+ @change="
40
+ (value) => {
41
+ handleChange({
42
+ item: config,
43
+ name: field || prop,
44
+ value: value,
45
+ data: scope.row,
46
+ scope: scope
47
+ });
48
+ }
49
+ "
50
+ ></component>
51
+ <es-select
52
+ v-else-if="getType(scope.row.formConfigs, 'select')"
53
+ v-bind="getOptions(scope.row.formConfigs)"
54
+ v-model="scope.row[field || prop]"
55
+ :data="getData(scope.row.formOptions)"
56
+ @blur="
57
+ (event) => {
58
+ handleBlur({
59
+ item: config,
60
+ event: event,
61
+ data: scope.row,
62
+ scope: scope
63
+ });
64
+ }
65
+ "
66
+ @focus="
67
+ (event) => {
68
+ handleFocus({
69
+ item: config,
70
+ event: event,
71
+ data: scope.row,
72
+ scope: scope
73
+ });
74
+ }
75
+ "
76
+ @change="
77
+ (value) => {
78
+ handleChange({
79
+ item: config,
80
+ name: field || prop,
81
+ value: value,
82
+ data: scope.row,
83
+ scope: scope
84
+ });
85
+ }
86
+ "
87
+ >
88
+ </es-select>
89
+ <es-cascader
90
+ v-else-if="getType(scope.row.formConfigs, 'cascader')"
91
+ v-bind="getOptions(scope.row.formConfigs)"
92
+ v-model="scope.row[field || prop]"
93
+ :data="getData(scope.row.formOptions)"
94
+ @blur="
95
+ (event) => {
96
+ handleBlur({
97
+ item: config,
98
+ event: event,
99
+ data: scope.row,
100
+ scope: scope
101
+ });
102
+ }
103
+ "
104
+ @focus="
105
+ (event) => {
106
+ handleFocus({
107
+ item: config,
108
+ event: event,
109
+ data: scope.row,
110
+ scope: scope
111
+ });
112
+ }
113
+ "
114
+ @change="
115
+ (value) => {
116
+ handleChange({
117
+ item: config,
118
+ name: field || prop,
119
+ value: value,
120
+ data: scope.row,
121
+ scope: scope
122
+ });
123
+ }
124
+ "
125
+ >
126
+ </es-cascader>
127
+ <es-select-ganged
128
+ v-else-if="getType(scope.row.formConfigs, 'ganged')"
129
+ v-bind="getOptions(scope.row.formConfigs)"
130
+ v-model="scope.row[field || prop]"
131
+ :data="init(getData(scope.row.formOptions), config)"
132
+ @change="
133
+ (value) => {
134
+ handleChange({
135
+ name: field || prop,
136
+ value: value,
137
+ data: scope.row,
138
+ item: item
139
+ });
140
+ }
141
+ "
142
+ >
143
+ </es-select-ganged>
144
+ <es-radio-group
145
+ v-else-if="getType(scope.row.formConfigs, 'radio')"
146
+ v-bind="getOptions(scope.row.formConfigs)"
147
+ v-model="scope.row[field || prop]"
148
+ :data="getData(scope.row.formOptions)"
149
+ @change="
150
+ (value) => {
151
+ handleChange({
152
+ item: config,
153
+ name: field || prop,
154
+ value: value,
155
+ data: scope.row
156
+ });
157
+ }
158
+ "
159
+ >
160
+ </es-radio-group>
161
+ <es-checkbox-group
162
+ v-else-if="getType(scope.row.formConfigs, 'checkbox')"
163
+ v-bind="getOptions(scope.row.formConfigs)"
164
+ v-model="scope.row[field || prop]"
165
+ :data="getData(scope.row.formOptions)"
166
+ @change="
167
+ (value) => {
168
+ handleChange({
169
+ item: config,
170
+ name: field || prop,
171
+ value: value,
172
+ data: scope.row
173
+ });
174
+ }
175
+ "
176
+ >
177
+ </es-checkbox-group>
178
+ <es-switch
179
+ v-else-if="getType(scope.row.formConfigs, 'switch')"
180
+ v-bind="getOptions(scope.row.formConfigs)"
181
+ v-model="scope.row[field || prop]"
182
+ :data="getData(scope.row.formOptions)"
183
+ @change="
184
+ (value) => {
185
+ handleChange({
186
+ item: config,
187
+ name: field || prop,
188
+ value: value,
189
+ data: scope.row
190
+ });
191
+ }
192
+ "
193
+ >
194
+ </es-switch>
195
+ <es-date-picker
196
+ v-else-if="
197
+ config.date ||
198
+ getType(scope.row.formConfigs, [
199
+ 'date',
200
+ 'year',
201
+ 'month',
202
+ 'date',
203
+ 'dates',
204
+ 'week',
205
+ 'datetime',
206
+ 'datetimerange',
207
+ 'daterange',
208
+ 'monthrange',
209
+ 'quarter',
210
+ 'halfyear'
211
+ ])
212
+ "
213
+ v-bind="getOptions(scope.row.formConfigs)"
214
+ v-model="scope.row[field || prop]"
215
+ :type="type"
216
+ @blur="
217
+ (event) => {
218
+ handleBlur({
219
+ item: config,
220
+ event: event,
221
+ data: scope.row,
222
+ scope: scope
223
+ });
224
+ }
225
+ "
226
+ @focus="
227
+ (event) => {
228
+ handleFocus({
229
+ item: config,
230
+ event: event,
231
+ data: scope.row,
232
+ scope: scope
233
+ });
234
+ }
235
+ "
236
+ @change="
237
+ (value) => {
238
+ handleChange({
239
+ item: config,
240
+ name: field || prop,
241
+ value: value,
242
+ data: scope.row,
243
+ scope: scope
244
+ });
245
+ }
246
+ "
247
+ >
248
+ </es-date-picker>
249
+ <es-input-number
250
+ v-else-if="getType(scope.row.formConfigs, 'number')"
251
+ v-bind="getOptions(scope.row.formConfigs)"
252
+ v-model="scope.row[field || prop]"
253
+ @blur="
254
+ (event) => {
255
+ handleBlur({
256
+ item: config,
257
+ event: event,
258
+ data: scope.row,
259
+ scope: scope
260
+ });
261
+ }
262
+ "
263
+ @focus="
264
+ (event) => {
265
+ handleFocus({
266
+ item: config,
267
+ event: event,
268
+ data: scope.row,
269
+ scope: scope
270
+ });
271
+ }
272
+ "
273
+ @change="
274
+ (value) => {
275
+ handleChange({
276
+ item: config,
277
+ name: field || prop,
278
+ value: value,
279
+ data: scope.row,
280
+ scope: scope
281
+ });
282
+ }
283
+ "
284
+ >
285
+ </es-input-number>
286
+ <es-selector
287
+ v-else-if="getType(scope.row.formConfigs, 'selector')"
288
+ v-bind="getOptions(scope.row.formConfigs)"
289
+ v-model="scope.row[field || prop]"
290
+ v-on="
291
+ exclAttribute({
292
+ data: events,
293
+ attrs: 'change'
294
+ })
295
+ "
296
+ @change="
297
+ (value) => {
298
+ handleChange({
299
+ item: config,
300
+ name: field || prop,
301
+ value: value,
302
+ data: scope.row
303
+ });
304
+ }
305
+ "
306
+ >
307
+ </es-selector>
308
+ <template
309
+ v-else-if="
310
+ getType(scope.row.formConfigs, ['text', 'input', 'textarea'])
311
+ "
312
+ >
313
+ <template v-if="config.lazy">
314
+ <input
315
+ v-if="getType(scope.row.formConfigs, ['text', 'input'])"
316
+ class="el-input__inner"
317
+ v-bind="getOptions(scope.row.formConfigs)"
318
+ v-model.lazy="scope.row[field]"
319
+ @blur="
320
+ (event) => {
321
+ handleBlur({
322
+ item: config,
323
+ event: event,
324
+ data: scope.row,
325
+ scope: scope
326
+ });
327
+ }
328
+ "
329
+ @focus="
330
+ (event) => {
331
+ handleFocus({
332
+ item: config,
333
+ event: event,
334
+ data: scope.row,
335
+ scope: scope
336
+ });
337
+ }
338
+ "
339
+ @change="
340
+ (value) => {
341
+ handleChange({
342
+ item: config,
343
+ name: field || prop,
344
+ value: value,
345
+ data: scope.row,
346
+ scope: scope
347
+ });
348
+ }
349
+ "
350
+ />
351
+ <textarea
352
+ v-else
353
+ class="el-textarea__inner"
354
+ v-bind="getOptions(scope.row.formConfigs)"
355
+ v-model.lazy="scope.row[field]"
356
+ @blur="
357
+ (event) => {
358
+ handleBlur({
359
+ item: config,
360
+ event: event,
361
+ data: scope.row,
362
+ scope: scope
363
+ });
364
+ }
365
+ "
366
+ @focus="
367
+ (event) => {
368
+ handleFocus({
369
+ item: config,
370
+ event: event,
371
+ data: scope.row,
372
+ scope: scope
373
+ });
374
+ }
375
+ "
376
+ @change="
377
+ (value) => {
378
+ handleChange({
379
+ item: config,
380
+ name: field || prop,
381
+ value: value,
382
+ data: scope.row,
383
+ scope: scope
384
+ });
385
+ }
386
+ "
387
+ ></textarea>
388
+ </template>
389
+ <es-input
390
+ v-else
391
+ v-bind="getOptions(scope.row.formConfigs)"
392
+ :type="type"
393
+ :scope="scope"
394
+ v-model="scope.row[field || prop]"
395
+ @blur="
396
+ (event) => {
397
+ handleBlur({
398
+ item: config,
399
+ event: event,
400
+ data: scope.row,
401
+ scope: scope
402
+ });
403
+ }
404
+ "
405
+ @focus="
406
+ (event) => {
407
+ handleFocus({
408
+ item: config,
409
+ event: event,
410
+ data: scope.row,
411
+ scope: scope
412
+ });
413
+ }
414
+ "
415
+ @change="
416
+ (value) => {
417
+ handleChange({
418
+ item: config,
419
+ name: field || prop,
420
+ value: value,
421
+ data: scope.row,
422
+ scope: scope
423
+ });
424
+ }
425
+ "
426
+ >
427
+ </es-input>
428
+ </template>
429
+ </el-form-item>
430
+ </template>
431
+ <expand-dom
432
+ v-else-if="render"
433
+ :column="config"
434
+ :row="scope.row"
435
+ :render="render"
436
+ :index="indexs"
437
+ :options="optionDatas"
438
+ >
439
+ </expand-dom>
440
+ <template v-else-if="dateFormat">
441
+ {{ formatDate(scope.row[field || prop], dateFormat) }}
442
+ </template>
443
+ <span
444
+ v-else-if="type === 'textarea'"
445
+ v-html="format(scope.row, true)"
446
+ :style="styles ? styles[scope.row[prop]] : {}"
447
+ ></span>
448
+ <span
449
+ v-else
450
+ :style="styles ? styles[scope.row[prop]] : {}"
451
+ v-html="format(scope.row)"
452
+ ></span>
453
+ <!-- {{ format(scope.row) }} -->
454
+ <es-button-group
455
+ v-if="type === 'handle' && !scope.row.hideHandle"
456
+ v-bind="
457
+ exclAttribute({
458
+ data: config,
459
+ attrs: ['contents', 'events', 'type', 'width', 'template', 'title']
460
+ })
461
+ "
462
+ stop
463
+ :mode="mode"
464
+ :contents="contents || events"
465
+ :data="scope"
466
+ @handleClick="handleClick"
467
+ v-model="btnWidth"
468
+ ></es-button-group>
469
+ </template>
470
+ </el-table-column>
471
+ </template>
472
+
473
+ <script type="text/babel">
474
+ import { findSysCode, getDictList } from 'eoss-ui/src/config/api.js';
475
+ import util from 'eoss-ui/src/utils/util';
476
+ export default {
477
+ name: 'Column',
478
+ components: {
479
+ expandDom: {
480
+ functional: true,
481
+ props: {
482
+ row: Object,
483
+ render: [Function, String],
484
+ index: Number,
485
+ column: {
486
+ type: Object,
487
+ default: null
488
+ },
489
+ options: Object
490
+ },
491
+ render: (h, ctx) => {
492
+ const params = {
493
+ row: ctx.props.row,
494
+ index: ctx.props.index
495
+ };
496
+ if (ctx.props.column) {
497
+ params.column = ctx.props.column;
498
+ }
499
+ if (typeof ctx.props.render == 'string') {
500
+ try {
501
+ return util.toFunction(ctx.props.render)(
502
+ h,
503
+ params,
504
+ ctx.props.options
505
+ );
506
+ } catch (error) {
507
+ throw error;
508
+ }
509
+ }
510
+ return ctx.props.render(h, params, ctx.props.options);
511
+ }
512
+ }
513
+ },
514
+ inject: {
515
+ elForm: {
516
+ default: ''
517
+ },
518
+ tableReload: {
519
+ default: ''
520
+ },
521
+ table: {
522
+ default: ''
523
+ }
524
+ },
525
+ props: {
526
+ tag: String,
527
+ mode: String,
528
+ service: String,
529
+ form: Boolean,
530
+ readonly: Boolean,
531
+ name: String,
532
+ filterIcon: [Boolean, String],
533
+ title: String,
534
+ label: String,
535
+ labelKey: String,
536
+ valueKey: String,
537
+ field: String,
538
+ prop: String,
539
+ sortable: [Boolean, String],
540
+ sort: [Boolean, String],
541
+ className: String,
542
+ labelClassName: String,
543
+ type: String,
544
+ required: Boolean,
545
+ width: [Number, String],
546
+ minWidth: [Number, String],
547
+ hide: Boolean,
548
+ showOverflowTooltip: [Boolean, Number],
549
+ render: [Function, String],
550
+ contents: Array,
551
+ events: [Array, Object],
552
+ dateFormat: String,
553
+ dateValue: {
554
+ type: String,
555
+ default: ''
556
+ },
557
+ styles: [Array, Object],
558
+ sysCode: String,
559
+ valueToString: Boolean,
560
+ symbol: String,
561
+ rules: [Array, Object],
562
+ method: String,
563
+ indexs: {
564
+ type: Number,
565
+ default: null
566
+ },
567
+ data: [Object, Array],
568
+ optionData: {
569
+ type: Object,
570
+ default() {
571
+ return {};
572
+ }
573
+ }
574
+ },
575
+ watch: {
576
+ optionData: {
577
+ deep: true,
578
+ handler(val) {
579
+ this.optionDatas = val;
580
+ }
581
+ },
582
+ width: {
583
+ immediate: true,
584
+ handler(val) {
585
+ if (val) {
586
+ this.btnWidth = parseInt(val, 10) + 'px';
587
+ }
588
+ }
589
+ }
590
+ },
591
+ computed: {
592
+ config() {
593
+ let config = {
594
+ label: this.label || this.title,
595
+ width: this.btnWidth || this.width
596
+ };
597
+ if (this.type === 'expand') {
598
+ config = { type: this.type, ...config, ...this.$attrs };
599
+ return config;
600
+ }
601
+ let required = this.required;
602
+ if (this.rules && !required) {
603
+ if (Array.isArray(this.rules)) {
604
+ this.rules.map((item) => {
605
+ if (item.required) {
606
+ required = item.required;
607
+ }
608
+ });
609
+ } else if (this.rules.required) {
610
+ required = this.rules.required;
611
+ }
612
+ }
613
+ if (this.type === 'handle') {
614
+ config.sort = true;
615
+ config.outside = false;
616
+ }
617
+ return {
618
+ ...config,
619
+ filterIcon: this.icon,
620
+ sortable: this.sortable || this.sort,
621
+ minWidth: this.minWidth || this.table.minWidth,
622
+ className: [
623
+ this.className ? this.className : '',
624
+ this.type ? ' es-table-' + this.type + '-box' : '',
625
+ this.showOverflowTooltip ? ' es-text-ellipsis' : ''
626
+ ].join(' '),
627
+ labelClassName: [
628
+ this.labelClassName ? this.labelClassName : '',
629
+ required ? 'es-required' : ''
630
+ ].join(' '),
631
+ showOverflowTooltip: this.showOverflowTooltip,
632
+ prop: this.field || this.prop,
633
+ field: this.field,
634
+ ...this.$attrs
635
+ };
636
+ },
637
+ formOption() {
638
+ let config = {
639
+ labelKey: this.sysCode
640
+ ? this.service
641
+ ? 'label'
642
+ : 'shortName'
643
+ : this.labelKey,
644
+ valueKey: this.sysCode
645
+ ? this.service
646
+ ? 'value'
647
+ : 'cciValue'
648
+ : this.valueKey,
649
+ rules: this.rules,
650
+ events: this.events,
651
+ ...this.$attrs
652
+ };
653
+ return config;
654
+ },
655
+ icon() {
656
+ if (this.filterIcon === true) {
657
+ return 'es-icon-biao';
658
+ }
659
+ return false;
660
+ },
661
+ isForm() {
662
+ let type = this.type ? this.type.toLowerCase() : '';
663
+ let flag =
664
+ (this.form &&
665
+ [
666
+ 'input',
667
+ 'text',
668
+ 'textarea',
669
+ 'checkbox',
670
+ 'radio',
671
+ 'select',
672
+ 'handle',
673
+ 'date',
674
+ 'year',
675
+ 'month',
676
+ 'date',
677
+ 'dates',
678
+ 'week',
679
+ 'datetime',
680
+ 'datetimerange',
681
+ 'daterange',
682
+ 'monthrange',
683
+ 'quarter',
684
+ 'halfyear',
685
+ 'switch',
686
+ 'selector',
687
+ 'ganged',
688
+ 'number'
689
+ ].indexOf(type) > -1) ||
690
+ ['space', 'slot', 'component'].indexOf(type) > -1;
691
+ return flag;
692
+ },
693
+ option() {
694
+ const field = this.field || this.prop;
695
+ return this.data ? this.data : this.optionDatas[this.sysCode || field];
696
+ },
697
+ findCode() {
698
+ if (this.service) {
699
+ return `/${this.service}${getDictList}`;
700
+ }
701
+ return findSysCode;
702
+ }
703
+ },
704
+ data() {
705
+ return {
706
+ btnWidth: '',
707
+ searchs: [],
708
+ optionDatas: this.optionData
709
+ };
710
+ },
711
+ mounted() {},
712
+ methods: {
713
+ init(data, value, item) {
714
+ if (data && value) {
715
+ if (Array.isArray(value) && value.length) {
716
+ if (item.url || this.sysCode) {
717
+ value.forEach(async (val, index) => {
718
+ if (
719
+ val.hasSub == false ||
720
+ this.searchs.indexOf(val[this.valueKey] || val.value) > -1
721
+ ) {
722
+ return;
723
+ }
724
+ this.searchs.push(val[this.valueKey] || val.value);
725
+ if ((item.ganged && index < item.ganged - 1) || val.hasSub) {
726
+ let option = data[index + 1];
727
+ let lists = [];
728
+ if (option) {
729
+ let v = val[this.valueKey] || val.value;
730
+ lists = option.filter((list) => {
731
+ return list[item.filtrateKey] == v;
732
+ });
733
+ }
734
+ if (lists.length == 0) {
735
+ let queryKey = item.queryKey;
736
+ let param = {};
737
+ if (queryKey) {
738
+ for (let i in queryKey) {
739
+ param[i] = val[queryKey[i]];
740
+ }
741
+ }
742
+ let params = util.extend(
743
+ true,
744
+ this.sysCode
745
+ ? { sysAppCode: this.sysCode, code: sysCode }
746
+ : {},
747
+ item.param ? item.param : {},
748
+ param
749
+ );
750
+ await util
751
+ .ajax({
752
+ url: this.sysCode ? this.findCode : item.url,
753
+ method: this.method,
754
+ params: params,
755
+ data: params
756
+ })
757
+ .then((res) => {
758
+ if (res.rCode === 0) {
759
+ let options = JSON.parse(JSON.stringify(data));
760
+ if (options[index + 1]) {
761
+ this.$set(
762
+ data,
763
+ index + 1,
764
+ options[index + 1].concat(
765
+ JSON.parse(JSON.stringify(res.results))
766
+ )
767
+ );
768
+ } else {
769
+ this.$set(
770
+ data,
771
+ index + 1,
772
+ JSON.parse(JSON.stringify(res.results))
773
+ );
774
+ }
775
+ } else {
776
+ let msg = res.msg || '系统错误,请联系管理员!';
777
+ this.$message.error(msg);
778
+ }
779
+ })
780
+ .catch((err) => {
781
+ if (err.message && err.message !== 'canceled') {
782
+ this.$message.error(err.message);
783
+ }
784
+ });
785
+ }
786
+ }
787
+ });
788
+ }
789
+ }
790
+ }
791
+ return data;
792
+ },
793
+ getType(config, types) {
794
+ let type =
795
+ config && config[this.field || this.prop]
796
+ ? config[this.field || this.prop]['type'] ||
797
+ config[this.field || this.prop]
798
+ : this.type;
799
+ return Array.isArray(types) ? types.includes(type) : type == types;
800
+ },
801
+ getOptions(config) {
802
+ let option = config && config[this.field || this.prop];
803
+ return option && typeof option == 'object'
804
+ ? { ...this.formOption, ...option }
805
+ : this.formOption;
806
+ },
807
+ getData(res) {
808
+ return res && res[this.field || this.prop]
809
+ ? res[this.field || this.prop]
810
+ : this.option;
811
+ },
812
+ exclAttribute({ data, attrs }) {
813
+ return util.exclAttribute({ data, attrs });
814
+ },
815
+ format(rows, flag) {
816
+ const field = this.field || this.prop;
817
+ let data = this.option;
818
+ let str = '';
819
+ if (util.isObject(rows[field])) {
820
+ str =
821
+ rows[field][this.labelKey] ||
822
+ rows[field]['name'] ||
823
+ rows[field]['label'] ||
824
+ rows[field]['shortName'];
825
+ } else if (Array.isArray(rows[field])) {
826
+ const vals = rows[field].map((item) => {
827
+ if (util.isObject(item)) {
828
+ return (
829
+ item[this.labelKey] ||
830
+ item['name'] ||
831
+ item['label'] ||
832
+ item['shortName']
833
+ );
834
+ } else {
835
+ if (data && data.length && util.isObject(data[0])) {
836
+ return this.getLabel(data, item);
837
+ }
838
+ return item;
839
+ }
840
+ });
841
+ str = vals.join(this.symbol ? this.symbol : '-');
842
+ } else {
843
+ if (this.valueToString) {
844
+ const vals = rows[field].split(',').map((item) => {
845
+ if (data && data.length && util.isObject(data[0])) {
846
+ return this.getLabel(data, item);
847
+ }
848
+ return item;
849
+ });
850
+ str = vals.join(this.symbol ? this.symbol : '-');
851
+ } else {
852
+ if (data && data.length && util.isObject(data[0])) {
853
+ str = this.getLabel(data, rows[field]);
854
+ } else {
855
+ str = rows[field];
856
+ }
857
+ }
858
+ }
859
+ if (str && flag) {
860
+ str = str.replace(RegExp('\\n', 'g'), '<br/>');
861
+ str = str.replace(RegExp(' ', 'g'), '&nbsp;');
862
+ }
863
+ return str;
864
+ },
865
+ getLabel(obj, val) {
866
+ for (let i = 0; i < obj.length; i++) {
867
+ let item = obj[i];
868
+ let value = item[this.valueKey || 'cciValue'] || item['value'];
869
+ if (value == val) {
870
+ return (
871
+ item[this.labelKey] ||
872
+ item['name'] ||
873
+ item['label'] ||
874
+ item['shortName']
875
+ );
876
+ } else if (item.children && item.children.length) {
877
+ return this.getLabel(item.children, val);
878
+ }
879
+ }
880
+ },
881
+ isReadOnly(scope) {
882
+ return (
883
+ scope.row.canEdit === false ||
884
+ this.readonly ||
885
+ this.$attrs.editable === false ||
886
+ (scope.row.cantEditKey &&
887
+ scope.row.cantEditKey.indexOf(this.field || this.prop) > -1)
888
+ );
889
+ },
890
+ isNotRule(scope) {
891
+ if (
892
+ scope.row.canRule === false ||
893
+ (scope.row.notRules &&
894
+ scope.row.notRules.indexOf(this.field || this.prop) > -1)
895
+ ) {
896
+ this.elForm && this.elForm.clearValidate(this.field || this.prop);
897
+ return true;
898
+ }
899
+ return false;
900
+ },
901
+ handleBlur(data) {
902
+ this.events && this.events.blur && this.events.blur(data);
903
+ this.$emit('formBlur', data);
904
+ this.$emit('form-blur', data);
905
+ },
906
+ handleFocus(data) {
907
+ this.events && this.events.focus && this.events.focus(data);
908
+ this.$emit('formFocus', data);
909
+ this.$emit('form-focus', data);
910
+ },
911
+ handleChange(datas) {
912
+ let { item, name, data } = datas;
913
+ if (
914
+ item &&
915
+ ((data.formConfigs && data.formConfigs[name] == 'ganged') ||
916
+ this.type == 'ganged')
917
+ ) {
918
+ let { index, value } = datas.value;
919
+ if (
920
+ (item.url || this.sysCode) &&
921
+ ((item.ganged && index > item.ganged - 1) || value.hasSub)
922
+ ) {
923
+ let filte = value[this.valueKey] || value.value;
924
+ let datas = [];
925
+ if (this.optionDatas[this.field || this.prop][index + 1]) {
926
+ datas = this.optionDatas[this.field || this.prop][index + 1].filter(
927
+ (items) => {
928
+ return filte == items[item.filtrateKey];
929
+ }
930
+ );
931
+ }
932
+ if (datas.length == 0) {
933
+ let queryKey = item.queryKey;
934
+ let param = {};
935
+ if (queryKey) {
936
+ for (let i in queryKey) {
937
+ param[i] = value[queryKey[i]];
938
+ }
939
+ }
940
+ let params = util.extend(
941
+ true,
942
+ this.sysCode ? { sysAppCode: this.sysCode, code: sysCode } : {},
943
+ item.param ? item.param : {},
944
+ param
945
+ );
946
+ util
947
+ .ajax({
948
+ url: this.sysCode ? this.findCode : item.url,
949
+ method: this.method,
950
+ params: params,
951
+ data: params
952
+ })
953
+ .then((res) => {
954
+ if (res.rCode === 0) {
955
+ let options = JSON.parse(
956
+ JSON.stringify(this.optionDatas[this.sysCode])
957
+ );
958
+ if (options[index + 1]) {
959
+ options[index + 1] = options[index + 1].concat(
960
+ JSON.parse(JSON.stringify(res.results))
961
+ );
962
+ } else {
963
+ options.push(JSON.parse(JSON.stringify(res.results)));
964
+ }
965
+ this.$set(this.optionDatas, this.sysCode, options);
966
+ } else {
967
+ let msg = res.msg || '系统错误,请联系管理员!';
968
+ this.$message.error(msg);
969
+ }
970
+ })
971
+ .catch((err) => {
972
+ if (err.message && err.message !== 'canceled') {
973
+ this.$message.error(err.message);
974
+ }
975
+ });
976
+ }
977
+ }
978
+ }
979
+ this.events && this.events.change && this.events.change(datas);
980
+ this.$emit('formChange', datas);
981
+ this.$emit('form-change', datas);
982
+ },
983
+ handleClick(data) {
984
+ this.$emit('handleClick', data);
985
+ this.$emit('handle-click', data);
986
+ },
987
+ formatDate(date, fmt) {
988
+ return date ? util.formatDate(date, fmt) : this.dateValue;
989
+ }
990
+ }
991
+ };
992
+ </script>