iov-pro-components 0.0.3

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 (133) hide show
  1. package/.eslintignore +5 -0
  2. package/.eslintrc.js +192 -0
  3. package/.gitignore +3 -0
  4. package/README.md +4 -0
  5. package/babel.config.js +5 -0
  6. package/docs/.vuepress/config.js +169 -0
  7. package/docs/.vuepress/styles/index.styl +62 -0
  8. package/docs/.vuepress/styles/palette.styl +20 -0
  9. package/docs/.vuepress/theme/enhanceApp.js +100 -0
  10. package/docs/.vuepress/theme/index.js +3 -0
  11. package/docs/README.md +13 -0
  12. package/docs/components/description.md +519 -0
  13. package/docs/components/dialog-select.md +91 -0
  14. package/docs/components/display.md +36 -0
  15. package/docs/components/enums.md +33 -0
  16. package/docs/components/icon.md +406 -0
  17. package/docs/components/link-group.md +39 -0
  18. package/docs/components/page-detail.md +48 -0
  19. package/docs/components/page-module.md +51 -0
  20. package/docs/components/pro-form.md +958 -0
  21. package/docs/components/pro-table.md +683 -0
  22. package/docs/components/request.md +44 -0
  23. package/docs/components/search-table.md +963 -0
  24. package/docs/components/space.md +35 -0
  25. package/docs/components/sub-title.md +24 -0
  26. package/docs/components/submit-module.md +24 -0
  27. package/docs/template/add.md +124 -0
  28. package/docs/template/confirm.md +28 -0
  29. package/docs/template/detail.md +240 -0
  30. package/docs/template/dialog.md +339 -0
  31. package/docs/template/list.md +464 -0
  32. package/docs/template/tabs-mini.md +32 -0
  33. package/docs/template/tabs.md +32 -0
  34. package/jsconfig.json +19 -0
  35. package/lib/iov-pro-components.css +1 -0
  36. package/lib/iov-pro-components.min.js +7 -0
  37. package/lib/postcss.config.js +8 -0
  38. package/package.json +75 -0
  39. package/patches/vue-server-renderer+2.7.16.patch +13 -0
  40. package/rollup.config.mjs +79 -0
  41. package/src/App.vue +103 -0
  42. package/src/main.js +33 -0
  43. package/src/packages/column-tooltip/index.js +7 -0
  44. package/src/packages/column-tooltip/src/main.vue +127 -0
  45. package/src/packages/description/index.js +7 -0
  46. package/src/packages/description/src/main.vue +375 -0
  47. package/src/packages/description/src/text.vue +103 -0
  48. package/src/packages/dialog-select/index.js +7 -0
  49. package/src/packages/dialog-select/src/main.vue +308 -0
  50. package/src/packages/display/index.js +7 -0
  51. package/src/packages/display/src/main.vue +44 -0
  52. package/src/packages/enums/index.js +7 -0
  53. package/src/packages/enums/src/main.vue +23 -0
  54. package/src/packages/export/index.js +7 -0
  55. package/src/packages/export/src/main.vue +316 -0
  56. package/src/packages/fixed-button-group/index.js +7 -0
  57. package/src/packages/fixed-button-group/src/main.vue +104 -0
  58. package/src/packages/form/index.js +7 -0
  59. package/src/packages/form/src/collapse.vue +149 -0
  60. package/src/packages/form/src/main.vue +1190 -0
  61. package/src/packages/form-collapse/index.js +7 -0
  62. package/src/packages/index.js +86 -0
  63. package/src/packages/link-group/index.js +7 -0
  64. package/src/packages/link-group/src/main.vue +52 -0
  65. package/src/packages/page-detail/index.js +7 -0
  66. package/src/packages/page-detail/src/main.vue +123 -0
  67. package/src/packages/page-module/index.js +7 -0
  68. package/src/packages/page-module/src/main.vue +56 -0
  69. package/src/packages/preview/index.js +7 -0
  70. package/src/packages/preview/src/eval-image-viewer.js +50 -0
  71. package/src/packages/preview/src/image-viewer.vue +366 -0
  72. package/src/packages/preview/src/main.vue +97 -0
  73. package/src/packages/request/index.js +7 -0
  74. package/src/packages/request/src/main.vue +125 -0
  75. package/src/packages/search-table/index.js +7 -0
  76. package/src/packages/search-table/src/inner-tabs.vue +237 -0
  77. package/src/packages/search-table/src/main.vue +472 -0
  78. package/src/packages/search-table/src/outer-tabs.vue +45 -0
  79. package/src/packages/search-table-inner-tabs/index.js +7 -0
  80. package/src/packages/search-table-outer-tabs/index.js +7 -0
  81. package/src/packages/space/index.js +7 -0
  82. package/src/packages/space/src/main.vue +74 -0
  83. package/src/packages/sub-title/index.js +7 -0
  84. package/src/packages/sub-title/src/main.vue +70 -0
  85. package/src/packages/submit-module/index.js +7 -0
  86. package/src/packages/submit-module/src/main.vue +67 -0
  87. package/src/packages/table/index.js +7 -0
  88. package/src/packages/table/src/filter.vue +89 -0
  89. package/src/packages/table/src/main.vue +668 -0
  90. package/src/packages/table/src/search.vue +90 -0
  91. package/src/packages/table/src/sort.vue +118 -0
  92. package/src/packages/theme/index.scss +15 -0
  93. package/src/packages/theme/src/column-tooltip.scss +23 -0
  94. package/src/packages/theme/src/common/color.scss +134 -0
  95. package/src/packages/theme/src/description.scss +56 -0
  96. package/src/packages/theme/src/dialog-select.scss +32 -0
  97. package/src/packages/theme/src/fixed-button-group.scss +25 -0
  98. package/src/packages/theme/src/form.scss +11 -0
  99. package/src/packages/theme/src/link-group.scss +43 -0
  100. package/src/packages/theme/src/page-detail.scss +61 -0
  101. package/src/packages/theme/src/page-module.scss +46 -0
  102. package/src/packages/theme/src/preview.scss +67 -0
  103. package/src/packages/theme/src/search-table.scss +185 -0
  104. package/src/packages/theme/src/space.scss +12 -0
  105. package/src/packages/theme/src/sub-title.scss +47 -0
  106. package/src/packages/theme/src/submit-module.scss +13 -0
  107. package/src/packages/theme/src/table.scss +129 -0
  108. package/src/packages/theme/src/toolbar.scss +109 -0
  109. package/src/packages/toolbar/index.js +7 -0
  110. package/src/packages/toolbar/src/main.vue +126 -0
  111. package/src/packages/toolbar/src/setting.vue +217 -0
  112. package/src/packages/toolbar/src/style.vue +68 -0
  113. package/src/packages/toolbar/src/zoom.vue +65 -0
  114. package/src/router.js +83 -0
  115. package/src/utils/config-center.js +218 -0
  116. package/src/utils/function-eval.js +84 -0
  117. package/src/utils/index.js +104 -0
  118. package/src/views/column-tooltip.vue +37 -0
  119. package/src/views/components/OtherSelect.vue +18 -0
  120. package/src/views/description.vue +60 -0
  121. package/src/views/detail.vue +146 -0
  122. package/src/views/directive/number.js +82 -0
  123. package/src/views/enums.vue +22 -0
  124. package/src/views/export.vue +9 -0
  125. package/src/views/form-collapse.vue +185 -0
  126. package/src/views/form.vue +402 -0
  127. package/src/views/link-group.vue +16 -0
  128. package/src/views/preview.vue +33 -0
  129. package/src/views/request.vue +56 -0
  130. package/src/views/search-table.vue +297 -0
  131. package/src/views/table.vue +145 -0
  132. package/src/views/toolbar.vue +30 -0
  133. package/vue.config.js +22 -0
@@ -0,0 +1,316 @@
1
+ <script>
2
+ import { toUpperCamelCase } from '@/utils'
3
+ import { isElementUI, isAntDesign, getComponentName } from '@/utils/config-center'
4
+
5
+ export default {
6
+ name: 'IovProExport',
7
+ props: {
8
+ // 当前类型 button: 按钮 link:链接
9
+ type: {
10
+ type: String,
11
+ default: 'button'
12
+ },
13
+ // 按钮的类型 primary | info | danger | warning
14
+ buttonType: {
15
+ type: String,
16
+ default: 'primary'
17
+ },
18
+ // 任务key
19
+ taskKey: {
20
+ type: String,
21
+ default: ''
22
+ },
23
+ // 导出按钮的icon
24
+ icon: {
25
+ type: String,
26
+ default: 'iov-icon-export'
27
+ },
28
+ // 当前表单对象
29
+ formRef: {
30
+ type: Object,
31
+ default: null
32
+ },
33
+ // 当前表格对象
34
+ tableRef: {
35
+ type: Object,
36
+ default: null
37
+ },
38
+ // 导出的api
39
+ exportApi: {
40
+ type: Function,
41
+ default: null
42
+ },
43
+ // 是否使用自定义的导出前确认框
44
+ customConfirm: {
45
+ type: Function,
46
+ default: null
47
+ },
48
+ // 消息内容标题
49
+ messageTitle: {
50
+ type: String,
51
+ default: '确认将当前列表数据导出至本地吗?'
52
+ },
53
+ // 消息内容
54
+ messageContent: {
55
+ type: String,
56
+ default: '导出的任务记录请稍后在“下载中心”中查看'
57
+ },
58
+ // 请求接口前的拦截方法
59
+ beforeRequest: {
60
+ type: Function,
61
+ default: null
62
+ },
63
+ // 是否禁用
64
+ disabled: {
65
+ type: Boolean,
66
+ default: false
67
+ },
68
+ // 是否是只读状态
69
+ readonly: {
70
+ type: Boolean,
71
+ default: false
72
+ }
73
+ },
74
+ data() {
75
+ return {
76
+ loading: false
77
+ }
78
+ },
79
+ methods: {
80
+ /**
81
+ * 确认是否导出
82
+ * @time 2024-09-05 11:21:33
83
+ */
84
+ async onConfirmExport() {
85
+ // 如果不需要默认弹框
86
+ if (this.customConfirm) {
87
+ // 调用自定义弹框
88
+ await this.customConfirm()
89
+ return
90
+ }
91
+
92
+ // 创建确认弹框
93
+ const h = this.$createElement
94
+ // 消息弹框内容
95
+ const messageBoxContent = [
96
+ h('p', { style: 'color: #333; padding-bottom: 3px;' }, this.messageTitle),
97
+ h('p', { style: 'color: #999; font-size: 12px;' }, this.messageContent)
98
+ ]
99
+ // 如果是elementui
100
+ if (isElementUI()) {
101
+ await this.$msgbox({
102
+ title: this.title,
103
+ message: h('div', null, messageBoxContent),
104
+ showCancelButton: true,
105
+ confirmButtonText: '确定',
106
+ cancelButtonText: '取消',
107
+ customClass: this.msgboxCustomClass
108
+ })
109
+ }
110
+ // 如果是AntDesign
111
+ if (isAntDesign()) {
112
+ const callbackPromised = new Promise((resolve, reject) => {
113
+ this.$confirm({
114
+ content: messageBoxContent,
115
+ okText: '确定',
116
+ cancelText: '取消',
117
+ onOk() {
118
+ self.destroyAll()
119
+ resolve()
120
+ },
121
+ onCancel() {
122
+ self.destroyAll()
123
+ reject()
124
+ }
125
+ })
126
+ })
127
+ // 等待promise执行完毕
128
+ await callbackPromised
129
+ }
130
+ },
131
+
132
+ /**
133
+ * 获取组件选中值的展示文案
134
+ * @param {Object} field 当前字段对象
135
+ * @time 2024-10-30 15:40:19
136
+ */
137
+ getComponentDisplayField(field) {
138
+ // 条件的展示文案
139
+ const consitionValueLabel = []
140
+ // 如果当前是ElementUI
141
+ if (isElementUI()) {
142
+ // 当前字段ref
143
+ const fieldRef = this.formRef.getFieldRef(field.name)
144
+ // 根据类型判断
145
+ switch (toUpperCamelCase(field.type)) {
146
+ case 'Select': // 如果是下拉选择器
147
+ // 如果是多选
148
+ if (fieldRef.multiple) {
149
+ consitionValueLabel.push(
150
+ fieldRef.selected
151
+ .filter(option => fieldRef.value.includes(option.value))
152
+ .map(option => option.label)
153
+ .join(',')
154
+ )
155
+ } else {
156
+ consitionValueLabel.push(
157
+ fieldRef.selected?.label
158
+ )
159
+ }
160
+ break
161
+ case 'Cascader': // 级联选择器
162
+ consitionValueLabel.push(fieldRef.presentText)
163
+ break
164
+ case 'RadioButton': // 单选按钮
165
+ case 'Radio': // 单选
166
+ consitionValueLabel.push(
167
+ fieldRef.$children.find(child => child.label === fieldRef.value)?.$el?.innerText
168
+ )
169
+ break
170
+ case 'CheckboxButton': // 多选按钮
171
+ case 'Checkbox': // 多选
172
+ consitionValueLabel.push(
173
+ fieldRef.$children
174
+ .filter(child => fieldRef.value.includes(child.label))
175
+ .map(child => child.$el?.innerText)
176
+ )
177
+ break
178
+ case 'DatePicker': // 日期选择器
179
+ // 如果选择你时间区间
180
+ if (fieldRef.displayValue) {
181
+ // 如果当前是日期连续选择
182
+ if (['datetimerange', 'daterange', 'monthrange'].includes(fieldRef.type)) {
183
+ consitionValueLabel.push(
184
+ fieldRef.displayValue.join(' 至 ')
185
+ )
186
+ } else {
187
+ consitionValueLabel.push(fieldRef.displayValue)
188
+ }
189
+ }
190
+ break
191
+ case 'TimePicker': // 时间选择器
192
+ // 如果选择你时间区间
193
+ if (fieldRef.displayValue) {
194
+ // 如果当前是时间连续选择
195
+ if (fieldRef.isRange) {
196
+ consitionValueLabel.push(
197
+ fieldRef.displayValue.join(' 至 ')
198
+ )
199
+ } else {
200
+ consitionValueLabel.push(fieldRef.displayValue)
201
+ }
202
+ }
203
+ break
204
+ default: // 默认
205
+ consitionValueLabel.push(fieldRef.value)
206
+ break
207
+ }
208
+ }
209
+ // 如果当前是AntDesign
210
+ if (isAntDesign) {
211
+ // TODO: 等待适配
212
+ }
213
+ },
214
+
215
+ /**
216
+ * 导出方法
217
+ * @param {Object} event 当前点击事件
218
+ * @time 2024-10-30 15:05:42
219
+ */
220
+ async onExport(event) {
221
+ // 如果是只读状态,则禁止点击
222
+ if (event && this.readonly) {
223
+ // 触发click点击事件
224
+ return this.$emit('click')
225
+ }
226
+ // 先弹框确认
227
+ await this.onConfirmExport()
228
+ // 导出接口请求入参
229
+ const params = {
230
+ // 导出列的数据
231
+ columnList: [],
232
+ // 导出条件
233
+ condition: [],
234
+ // 导出参数
235
+ params: {}
236
+ }
237
+ // 如果当前未传入表单ref
238
+ if (!this.formRef) {
239
+ console.warn('当前未传入formRef')
240
+ } else {
241
+ // 取出表单双向绑定的数据和配置条件
242
+ const { value, items } = this.formRef
243
+ // 设置导出参数
244
+ params.params = value
245
+ // 设置导出条件
246
+ params.condition = items.map(item => ({
247
+ key: item.name,
248
+ label: item.label,
249
+ // 获取字段中文名
250
+ value: this.getComponentDisplayField(item)
251
+ }))
252
+ }
253
+ // 当前未传入表单ref
254
+ if (!this.tableRef) {
255
+ console.warn('当前未传入tableRef')
256
+ } else {
257
+ params.columnList = this.tableRef.columns
258
+ .filter(column => column.prop)
259
+ .map(column => ({ name: column.label, column: column.prop }))
260
+ }
261
+ // 如果有请求拦截
262
+ this.beforeRequest && this.beforeRequest(params)
263
+ // 如果当前有导出api,则直接导出
264
+ if (this.exportApi) {
265
+ // 展示全局loading
266
+ this.fullscreenLoading = true
267
+ // 开始执行导出方法
268
+ await this.exportApi({
269
+ taskKey: this.taskKey,
270
+ paramCondition: params.condition,
271
+ paramJson: {
272
+ columnList: params.columnList,
273
+ ...params.params
274
+ }
275
+ })
276
+ // 给出导出成功提示
277
+ this.$message.success('数据导出任务已创建成功,您可以进入「下载中心」查看任务进度并下载文件')
278
+ }
279
+ }
280
+ },
281
+ render() {
282
+ // 获取链接的组件名
283
+ const Link = getComponentName('link')
284
+ // 获取按钮的组件名
285
+ const Button = getComponentName('button')
286
+ // 如果当前是链接
287
+ if (this.type === 'link') {
288
+ return (
289
+ <Link
290
+ v-loading_fullscreen_lock={this.loading}
291
+ element-loading-spinner='page-loading'
292
+ disabled={this.disabled}
293
+ type={this.buttonType}
294
+ onClick={this.onExport}
295
+ >
296
+ {this.$scopedSlots.default ? this.$scopedSlots.default() : '导出'}
297
+ </Link>
298
+ )
299
+ }
300
+ return (
301
+ <Button
302
+ v-loading_fullscreen_lock={this.loading}
303
+ element-loading-spinner='page-loading'
304
+ disabled={this.disabled}
305
+ type={this.buttonType}
306
+ icon={this.icon}
307
+ size='small'
308
+ round
309
+ onClick={this.onExport}
310
+ >
311
+ {this.$scopedSlots.default ? this.$scopedSlots.default() : '导出'}
312
+ </Button>
313
+ )
314
+ }
315
+ }
316
+ </script>
@@ -0,0 +1,7 @@
1
+ import FixedWrapper from './src/main.vue'
2
+
3
+ FixedWrapper.install = function(Vue) {
4
+ Vue.component(FixedWrapper.name, FixedWrapper)
5
+ }
6
+
7
+ export default FixedWrapper
@@ -0,0 +1,104 @@
1
+ <template>
2
+ <div
3
+ :style="fixedWrapperStyle"
4
+ class="iov-pro-fixed-button-group"
5
+ >
6
+ <div
7
+ :class="fixedButtonGroupClass"
8
+ :style="fixedButtonGroupStyle"
9
+ class="iov-pro-fixed-button-group__content"
10
+ >
11
+ <slot />
12
+ </div>
13
+ </div>
14
+ </template>
15
+
16
+ <script>
17
+ import isNil from 'lodash/isNil'
18
+
19
+ export default {
20
+ name: 'IovProFixedButtonGroup',
21
+ props: {
22
+ // 对其方式 align:居中对齐 left: 左对齐 right: 右对齐
23
+ align: {
24
+ type: String,
25
+ default: 'center'
26
+ },
27
+ // 当前高度
28
+ height: {
29
+ type: [String, Number],
30
+ default: null
31
+ },
32
+ // 距离左侧的偏移
33
+ left: {
34
+ type: [String, Number],
35
+ default: null
36
+ },
37
+ // 距离右侧的偏移
38
+ right: {
39
+ type: [String, Number],
40
+ default: null
41
+ }
42
+ },
43
+ computed: {
44
+ /**
45
+ * 当前浮动框的样式
46
+ * @time 2024-07-15 09:37:10
47
+ */
48
+ fixedButtonGroupClass() {
49
+ // 样式集合
50
+ const className = []
51
+ // 如果有对齐方式
52
+ if (this.align) {
53
+ className.push(this.align)
54
+ }
55
+ // 将样式合并
56
+ return className.join(' ')
57
+ },
58
+
59
+ /**
60
+ * 当前浮动框的css样式
61
+ * @time 2024-11-21 15:04:39
62
+ */
63
+ fixedButtonGroupStyle() {
64
+ // 当前样式
65
+ const style = {}
66
+ // 当前高度
67
+ const height = `${this.height}`
68
+ // 当前距离左侧距离
69
+ const left = `${this.left}`
70
+ // 当前距离右侧距离
71
+ const right = `${this.right}`
72
+ // 如果当前设置了高度
73
+ if (!isNil(this.height)) {
74
+ style.height = `${height.replace('px', '')}px`
75
+ }
76
+ // 如果当前设置了左侧距离
77
+ if (!isNil(this.left)) {
78
+ style.left = `${left.replace('px', '')}px`
79
+ }
80
+ // 如果当前设置了右侧距离
81
+ if (!isNil(this.right)) {
82
+ style.right = `${right.replace('px', '')}px`
83
+ }
84
+ return style
85
+ },
86
+
87
+ /**
88
+ * 浮动容器的样式
89
+ * @time 2024-11-21 15:20:58
90
+ */
91
+ fixedWrapperStyle() {
92
+ // 当前样式
93
+ const style = {}
94
+ // 当前高度
95
+ const height = `${this.height}`
96
+ // 如果当前设置了高度
97
+ if (!isNil(this.height)) {
98
+ style.height = `${height.replace('px', '')}px`
99
+ }
100
+ return style
101
+ }
102
+ }
103
+ }
104
+ </script>
@@ -0,0 +1,7 @@
1
+ import ProForm from './src/main.vue'
2
+
3
+ ProForm.install = function(Vue) {
4
+ Vue.component(ProForm.name, ProForm)
5
+ }
6
+
7
+ export default ProForm
@@ -0,0 +1,149 @@
1
+ <script>
2
+ import { getComponentFromChildren } from '@/utils'
3
+ import { getComponentName } from '@/utils/config-center'
4
+
5
+ const STATUS = {
6
+ EXPAND: 'expand',
7
+ COLLAPSE: 'collapse'
8
+ }
9
+
10
+ export default {
11
+ name: 'IovProFormCollapse',
12
+ props: {
13
+ maxLine: {
14
+ type: [Number, String],
15
+ default: 2
16
+ }
17
+ },
18
+ data() {
19
+ return {
20
+ status: STATUS.EXPAND,
21
+ needCollapse: false
22
+ }
23
+ },
24
+ computed: {
25
+ /**
26
+ * 透传给子组件的状态
27
+ * @time 2024-11-14 10:04:30
28
+ */
29
+ propData() {
30
+ return {
31
+ status: this.status,
32
+ needCollapse: this.needCollapse,
33
+ toggleStatus: this.onToggleStatus.bind(this)
34
+ }
35
+ }
36
+ },
37
+ mounted() {
38
+ // 取出子组件中的proForm
39
+ const formThis = getComponentFromChildren(this.$children, 'IovProForm')
40
+ // 如果没有子应用
41
+ if (!formThis) {
42
+ return console.warn('默认插槽仅支持IovProForm组件')
43
+ }
44
+ // 如果当前配置了grid
45
+ if (!formThis.config.grid) {
46
+ return console.warn('默认插槽仅支持栅格系统')
47
+ }
48
+ // 取出栅格系统的行
49
+ this.spaceVm = getComponentFromChildren(formThis.$children, getComponentName('IovProSpace'))
50
+ // 开始收起菜单
51
+ this.$nextTick(() => {
52
+ // 是否需要折叠
53
+ this.needCollapse = this.spaceVm.$children.length > this.maxLine
54
+ // 如果不需要折叠,则不操作
55
+ if (!this.needCollapse) {
56
+ return
57
+ }
58
+ this.onToggleStatus()
59
+ })
60
+ },
61
+ methods: {
62
+ /**
63
+ * 重置展开收起状态
64
+ * @time 2024-11-14 10:02:43
65
+ */
66
+ onToggleStatus() {
67
+ // 取出栅格系统的行
68
+ const formVm = getComponentFromChildren(this.$children, getComponentName('IovProForm'))
69
+ // 当前所有的孩子节点实例
70
+ const spaceChildrenVm = this.spaceVm.$children
71
+ // 切换状态
72
+ this.status = this.status === STATUS.EXPAND ? STATUS.COLLAPSE : STATUS.EXPAND
73
+ // 遍历行节点
74
+ spaceChildrenVm.forEach((rowVm, rowIndex) => {
75
+ // 如果行索引大于等于最大行数,则隐藏该行
76
+ if (rowIndex >= this.maxLine) {
77
+ // 设置el-row的隐藏状态
78
+ rowVm.$el.parentNode.style.display = this.status === STATUS.EXPAND ? '' : 'none'
79
+ }
80
+ // 如果表单有 append 插槽的内容
81
+ if (formVm.$scopedSlots.append) {
82
+ // 隐藏超过一行的span内容
83
+ this.hideOverSpanCol(formVm, rowVm, rowIndex)
84
+ // 是否需要移动append的节点内容
85
+ this.moveFormAppend(rowVm, rowIndex)
86
+ }
87
+ })
88
+ },
89
+
90
+ /**
91
+ * 隐藏收起状态下,最大展示行放不下append插槽内容的col数据
92
+ * @param {参数类型} data 参数说明
93
+ * @param {参数类型} data 参数说明
94
+ * @return {返回类型} data 返回说明
95
+ * @time 2024-11-21 14:11:37
96
+ */
97
+ hideOverSpanCol(formVm, rowVm, rowIndex) {
98
+ // 如果当前不是收起状态下最后一行,则不处理
99
+ if (rowIndex !== this.maxLine - 1) {
100
+ return
101
+ }
102
+ // 当前分割空间组件实例
103
+ const spaceChildrenVm = this.spaceVm.$children
104
+ // 如果有追加的插槽
105
+ let spanCount = spaceChildrenVm[spaceChildrenVm.length - 1].$children.slice(-1)[0].span || formVm.config.span || 6
106
+ // 开始处理数据
107
+ rowVm.$children.forEach(colVm => {
108
+ // 累加每个col的span
109
+ spanCount += colVm.span
110
+ // 如果当前超过展示的最大限制
111
+ if (spanCount > 24) {
112
+ colVm.$el.style.display = this.status === STATUS.EXPAND ? '' : 'none'
113
+ }
114
+ })
115
+ },
116
+
117
+ /**
118
+ * 移动表单中append插槽的内容
119
+ * @param {Object} formVm 当前表单实例
120
+ * @param {Number} rowIndex 当前行索引
121
+ * @time 2024-11-21 14:06:09
122
+ */
123
+ moveFormAppend(rowVm, rowIndex) {
124
+ // 当前分割空间组件实例
125
+ const spaceChildrenVm = this.spaceVm.$children
126
+ // 当前子节点的长度
127
+ const spaceLength = spaceChildrenVm.length
128
+ // 如果有追加的插槽
129
+ const formAppendEl = spaceChildrenVm[spaceLength - 1].$children.slice(-1)[0].$el
130
+ // 是否需要移动append的节点内容
131
+ // 收起状态,最大展示的行 或 展开状态,最后一行 都需要操作append的节点
132
+ const isMoveAppendEl = ((rowIndex === this.maxLine - 1 && this.status === STATUS.COLLAPSE) || (rowIndex === spaceLength - 1 && this.status === STATUS.EXPAND))
133
+ // 如果需要移动append的节点内容
134
+ if (isMoveAppendEl) {
135
+ // 将当前表单节点元素追加到容器节点中
136
+ rowVm.$el.appendChild(formAppendEl)
137
+ }
138
+ }
139
+ },
140
+ render() {
141
+ // 生成子组件
142
+ return (
143
+ <div class='iov-pro-form-collpase'>
144
+ {this.$scopedSlots.default(this.propData)}
145
+ </div>
146
+ )
147
+ }
148
+ }
149
+ </script>