agilebuilder-ui 1.1.13-tmp6 → 1.1.13-tmp7
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.
- package/lib/{401-b72ce8b6.js → 401-8eb9481a.js} +1 -1
- package/lib/{404-3aabf44b.js → 404-9fca116f.js} +1 -1
- package/lib/{iframe-page-2bd8a200.js → iframe-page-fadda1f8.js} +1 -1
- package/lib/{index-c03eac61.js → index-42d5d61b.js} +1719 -1719
- package/lib/super-ui.css +1 -1
- package/lib/super-ui.js +1 -1
- package/lib/super-ui.umd.cjs +42 -42
- package/lib/{tab-content-iframe-index-fc7d9146.js → tab-content-iframe-index-12527a41.js} +1 -1
- package/lib/{tab-content-index-552e53a1.js → tab-content-index-56d7113b.js} +1 -1
- package/lib/{tache-subprocess-history-3ef2a115.js → tache-subprocess-history-b289d758.js} +1 -1
- package/package.json +1 -1
- package/packages/fs-preview/src/fs-preview.vue +24 -36
- package/packages/super-grid/src/components/mobile-table-card.jsx +463 -463
- package/src/components/Card/index.jsx +155 -155
- package/src/components/Scrollbar/index.vue +196 -196
- package/src/mixins/resizeMixin.js +48 -48
- package/src/styles/display-layout.scss +13 -1
- package/src/utils/guid.js +13 -13
- package/pnpm-lock.yaml +0 -3467
|
@@ -1,463 +1,463 @@
|
|
|
1
|
-
/** @jsxImportSource vue */
|
|
2
|
-
import { defineComponent, ref, computed, watch, defineEmits } from 'vue';
|
|
3
|
-
import { ElCard, ElDrawer, ElTag,ElDescriptions, ElDescriptionsItem, ElButton, ElIcon, ElCheckbox, ElCheckboxGroup, ElBreadcrumb, ElLink, ElEmpty, ElDivider } from 'element-plus';
|
|
4
|
-
import NormalColumnContent from '../normal-column-content.vue';
|
|
5
|
-
import CardView from '../../../../src/components/Card';
|
|
6
|
-
import Scrollbar from '../../../../src/components/Scrollbar';
|
|
7
|
-
import store from '../store';
|
|
8
|
-
import { apisMixin } from '../apis'
|
|
9
|
-
|
|
10
|
-
import { ArrowLeft, Bottom, CirclePlus, Loading, Tickets } from '@element-plus/icons-vue';
|
|
11
|
-
// import { $emit, $off, $on } from '@/utils/gogocodeTransfer'
|
|
12
|
-
|
|
13
|
-
export default defineComponent({
|
|
14
|
-
name: 'MobileTableCard',
|
|
15
|
-
components: {
|
|
16
|
-
NormalColumnContent,
|
|
17
|
-
CardView,
|
|
18
|
-
Scrollbar
|
|
19
|
-
},
|
|
20
|
-
mixins: [apisMixin],
|
|
21
|
-
props: {
|
|
22
|
-
// 展示字段限制
|
|
23
|
-
showFieldCount: {
|
|
24
|
-
type: [Number, undefined],
|
|
25
|
-
default: () => 5
|
|
26
|
-
},
|
|
27
|
-
// 列字段数据
|
|
28
|
-
columns: {
|
|
29
|
-
type: Array,
|
|
30
|
-
default: () => []
|
|
31
|
-
},
|
|
32
|
-
// 表格数据
|
|
33
|
-
data: {
|
|
34
|
-
type: Array,
|
|
35
|
-
default: () => []
|
|
36
|
-
},
|
|
37
|
-
// 字段事件 v-bind 与 v-on 集成
|
|
38
|
-
getColumnComponentData: {
|
|
39
|
-
type: [Function, undefined],
|
|
40
|
-
default: undefined
|
|
41
|
-
},
|
|
42
|
-
// 选中页
|
|
43
|
-
currentPage: {
|
|
44
|
-
type: [Number],
|
|
45
|
-
default: 1
|
|
46
|
-
},
|
|
47
|
-
// 一页展示数量
|
|
48
|
-
pageSize: {
|
|
49
|
-
type: [Number],
|
|
50
|
-
default: 20
|
|
51
|
-
},
|
|
52
|
-
// 一页展示数量
|
|
53
|
-
pageTotal: {
|
|
54
|
-
type: [Number],
|
|
55
|
-
default: 0
|
|
56
|
-
},
|
|
57
|
-
// 是否开启 堆积分页数据
|
|
58
|
-
isStackingPaginatedData: {
|
|
59
|
-
type: Boolean,
|
|
60
|
-
default: () => false
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
setup(props, setupData) {
|
|
64
|
-
const $emits = defineEmits(['currentChange', 'update:current-page', 'select']);
|
|
65
|
-
|
|
66
|
-
const { attrs, emit, expose } = setupData
|
|
67
|
-
|
|
68
|
-
console.log('*mobile-table-card.JSX**********************************************=>', props, attrs, setupData, expose)
|
|
69
|
-
|
|
70
|
-
// 分页加载状态
|
|
71
|
-
const isPaginationLoading = ref(false)
|
|
72
|
-
|
|
73
|
-
const paginationList = ref([])
|
|
74
|
-
// 选中数据
|
|
75
|
-
const checkedList = ref([]);
|
|
76
|
-
// 当前勾选ID
|
|
77
|
-
const checkedClickId = ref(undefined);
|
|
78
|
-
// 当前选中数据
|
|
79
|
-
const isCheckedIndex = ref(undefined);
|
|
80
|
-
|
|
81
|
-
// 是否打开子表弹窗
|
|
82
|
-
const isChildrenDrawer = ref(false);
|
|
83
|
-
|
|
84
|
-
// 子表打开历史数据
|
|
85
|
-
const childrenBreadcrumbData = ref([]);
|
|
86
|
-
|
|
87
|
-
const setPaginationList = (data) => {
|
|
88
|
-
if (props.isStackingPaginatedData) {
|
|
89
|
-
paginationList.value[(props.currentPage ?? 1) - 1] = data
|
|
90
|
-
} else {
|
|
91
|
-
paginationList.value[0] = data
|
|
92
|
-
}
|
|
93
|
-
isPaginationLoading.value = false
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
setPaginationList(props.data)
|
|
97
|
-
|
|
98
|
-
const addColumnBtn = computed(() => {
|
|
99
|
-
const gridParams = store.get(attrs.listCode)
|
|
100
|
-
const showOperationButton = gridParams?.options?.showOperationButton ?? false
|
|
101
|
-
const isFormSubTable = gridParams?.options?.isFormSubTable ?? false
|
|
102
|
-
const subTableCanAdd = gridParams?.options?.subTableCanAdd ?? false
|
|
103
|
-
const isOperation = componentDatas.value?.some(({ prop }) => ['operation'].includes(prop))
|
|
104
|
-
return showOperationButton && isFormSubTable && subTableCanAdd && isOperation
|
|
105
|
-
})
|
|
106
|
-
|
|
107
|
-
// 列表数据
|
|
108
|
-
const dataList = computed(() => {
|
|
109
|
-
if (props.isStackingPaginatedData) {
|
|
110
|
-
return paginationList.value.flatMap((data, index) => index + 1 <= props.currentPage ? data : [] )
|
|
111
|
-
} else {
|
|
112
|
-
return paginationList.value[0] ?? []
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
// 获取包含所有子表数据 LIST 一般用于勾选
|
|
117
|
-
const dataChildrenList = computed(() => {
|
|
118
|
-
const getChildrenData = (data) => {
|
|
119
|
-
return data?.flatMap(item => {
|
|
120
|
-
if (item?.children?.length) return [item, ...getChildrenData(item.children)]
|
|
121
|
-
return [item]
|
|
122
|
-
}) ?? []
|
|
123
|
-
}
|
|
124
|
-
return getChildrenData(dataList.value)
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
const isLoadPaginationData = computed(() => {
|
|
128
|
-
if (props.isStackingPaginatedData) {
|
|
129
|
-
return (paginationList.value[props.currentPage - 1]?.length ?? 0) > 0
|
|
130
|
-
} else {
|
|
131
|
-
return dataList.value.length < props.pageSize * props.currentPage && pagesNumber.value >= props.currentPage
|
|
132
|
-
}
|
|
133
|
-
})
|
|
134
|
-
|
|
135
|
-
// 面包屑数据
|
|
136
|
-
const childrenList = computed(() => {
|
|
137
|
-
return childrenBreadcrumbData.value[childrenBreadcrumbData.value.length - 1]?.children ?? []
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
const componentDatas = computed(() => {
|
|
141
|
-
const getChildrenData = (data) => {
|
|
142
|
-
return data?.flatMap(item => {
|
|
143
|
-
if (item?.children?.length) return getChildrenData(item.children)
|
|
144
|
-
return [item]
|
|
145
|
-
}) ?? []
|
|
146
|
-
}
|
|
147
|
-
return getChildrenData(props.columns.filter((column) => !column ? false : !['$selection', '$index'].includes(column?.prop)))
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
const layoutData = computed(() => {
|
|
151
|
-
const contentData = componentDatas.value.map((data, index) => {
|
|
152
|
-
if (data.operations) {
|
|
153
|
-
data.layoutModelType = 'footer'
|
|
154
|
-
} else {
|
|
155
|
-
data.layoutModelType = 'content'
|
|
156
|
-
}
|
|
157
|
-
return data
|
|
158
|
-
});
|
|
159
|
-
const content = contentData.filter(({ layoutModelType}) => ['content'].includes(layoutModelType))
|
|
160
|
-
return {
|
|
161
|
-
header: content[0] ? [content[0]] : [],
|
|
162
|
-
content,
|
|
163
|
-
footer: contentData.filter(({ layoutModelType}) => ['footer'].includes(layoutModelType))
|
|
164
|
-
};
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
// 获取最大 label 字符长度
|
|
168
|
-
const getLongestStringLength = (strArray) => {
|
|
169
|
-
return strArray.reduce((maxLen, str) => {
|
|
170
|
-
return Math.max(maxLen, [...str].reduce((len, char) => /[\u4e00-\u9fff]/.test(char) ? len + 2 : len + 1, 0));
|
|
171
|
-
}, 0);
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
// 分页数量
|
|
175
|
-
const pagesNumber = computed(() => {
|
|
176
|
-
if (!props.pageTotal) return 0
|
|
177
|
-
return Math.ceil(props.pageTotal / props.pageSize)
|
|
178
|
-
})
|
|
179
|
-
|
|
180
|
-
// 字段更多 是否开启
|
|
181
|
-
const isShowDetailsMore = computed(() => {
|
|
182
|
-
if (props.showFieldCount && layoutData.value.content.length > props.showFieldCount) return true
|
|
183
|
-
return false
|
|
184
|
-
})
|
|
185
|
-
|
|
186
|
-
// 是否显示卡片底部控件
|
|
187
|
-
const isShowFooter = computed(() => {
|
|
188
|
-
return layoutData.value.footer.length > 0
|
|
189
|
-
})
|
|
190
|
-
|
|
191
|
-
const maxLabelWidth = computed(() => {
|
|
192
|
-
return getLongestStringLength(layoutData.value.content.map((column) => column?.label ?? 0)) * 7 + 15
|
|
193
|
-
})
|
|
194
|
-
|
|
195
|
-
const isCheck = computed(() => {
|
|
196
|
-
return props.columns.some((column) => ['$selection'].includes(column?.prop));
|
|
197
|
-
});
|
|
198
|
-
|
|
199
|
-
const isIndex = computed(() => {
|
|
200
|
-
return props.columns.some((column) => ['$index'].includes(column?.prop));
|
|
201
|
-
});
|
|
202
|
-
|
|
203
|
-
const detailsFormData = computed(() => {
|
|
204
|
-
return dataList.value[isCheckedIndex.value]
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
// 写入选中
|
|
208
|
-
const setCheckedList = (value) => {
|
|
209
|
-
debugger;
|
|
210
|
-
if (!isCheck.value) return
|
|
211
|
-
if (checkedList.value.includes(value)) {
|
|
212
|
-
checkedList.value = checkedList.value.filter(v => v !== value)
|
|
213
|
-
} else {
|
|
214
|
-
checkedList.value = [...new Set([...checkedList.value, value])]
|
|
215
|
-
}
|
|
216
|
-
checkedClickId.value = value
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* 字段渲染展示
|
|
221
|
-
* @param {当前字段数据} columnData
|
|
222
|
-
* @param {当前行的数据} columnFormData
|
|
223
|
-
* @param {所在行的$index} columnIndex
|
|
224
|
-
* @param {是否只显示文本} isViewText
|
|
225
|
-
* @returns
|
|
226
|
-
*/
|
|
227
|
-
const columnViewDom = (columnData, columnFormData, columnIndex, isViewText = false) => {
|
|
228
|
-
const {$bind = {}, $on = {}} = props.getColumnComponentData?.(columnData) ?? {}
|
|
229
|
-
const gridParams = store.get($bind['list-code'])
|
|
230
|
-
const options = gridParams?.options
|
|
231
|
-
const lineEdit = gridParams.lineEdit ?? false
|
|
232
|
-
const attrs = {
|
|
233
|
-
...$bind,
|
|
234
|
-
options,
|
|
235
|
-
row: columnFormData,
|
|
236
|
-
rowIndex: columnIndex,
|
|
237
|
-
'right-click-menu-arr': options?.rightClickMenuArr,
|
|
238
|
-
'line-edit': lineEdit
|
|
239
|
-
}
|
|
240
|
-
const onAttrs = {
|
|
241
|
-
...Object.fromEntries(Object.keys($on).map(key => [`on${key.charAt(0).toUpperCase()}${key.slice(1).replace(/-([a-z])/g, (match, letter) => letter.toUpperCase())}`, $on[key]]))
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
return <NormalColumnContent isContentViewText={isViewText} {...attrs} {...onAttrs} />
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
*
|
|
249
|
-
* @param {字段columns List} layoutDatas
|
|
250
|
-
* @param {当前行的数据} columnFormData
|
|
251
|
-
* @param {所在行的$index} columnIndex
|
|
252
|
-
* @param {限制显示字段} showFieldCount
|
|
253
|
-
* @returns .filter((_, index) => !props.showFieldCount || props.showFieldCount > index + 1)
|
|
254
|
-
*/
|
|
255
|
-
const getElDescriptions = (layoutDatas, columnFormData = detailsFormData.value, columnIndex = isCheckedIndex.value, showFieldCount = undefined) => {
|
|
256
|
-
// const propertyData = columnData?.find(({ property }) => property)
|
|
257
|
-
return <ElDescriptions column={1} label-width={maxLabelWidth.value} align="right" direction="horizontal" layout='form'>
|
|
258
|
-
{(showFieldCount ? layoutDatas?.slice?.(0, showFieldCount) : layoutDatas)?.map((columnCol, index) => (
|
|
259
|
-
<ElDescriptionsItem
|
|
260
|
-
key={columnCol.label + index}
|
|
261
|
-
v-slots={
|
|
262
|
-
{
|
|
263
|
-
label: () => <div v-html={columnCol.label ? `${columnCol.label}:` : ''} />
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
// onRowDblclick={(event) => {
|
|
267
|
-
// console.log('我双击了', columnCol?.property )
|
|
268
|
-
// // if (isViewText) return
|
|
269
|
-
// event.stopPropagation()
|
|
270
|
-
// // emit('rowDblclick', columnFormData, columnData, event)
|
|
271
|
-
// }}
|
|
272
|
-
>
|
|
273
|
-
{columnViewDom(columnCol, columnFormData, columnIndex) || '-'}
|
|
274
|
-
</ElDescriptionsItem>
|
|
275
|
-
))}
|
|
276
|
-
</ElDescriptions>
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
watch(() => attrs.selection, (newValue) => {
|
|
280
|
-
console.log('表格勾选数据监听', newValue)
|
|
281
|
-
checkedList.value = newValue.map(({ $rowDataGuId }) => $rowDataGuId)
|
|
282
|
-
}, { deep: true });
|
|
283
|
-
|
|
284
|
-
// 勾选监听
|
|
285
|
-
watch(checkedList, (newValue , oldValue) => {
|
|
286
|
-
console.log(newValue , oldValue)
|
|
287
|
-
if (attrs.selection.length === newValue.length) {
|
|
288
|
-
if (attrs.selection.every(({ $rowDataGuId }) => newValue.includes($rowDataGuId ) )) return
|
|
289
|
-
}
|
|
290
|
-
const selectData = dataChildrenList.value.filter(({ $rowDataGuId }) => newValue?.includes($rowDataGuId))
|
|
291
|
-
const findData = checkedClickId.value ? dataChildrenList.value.find(({ $rowDataGuId }) => checkedClickId.value === $rowDataGuId) : undefined
|
|
292
|
-
// 新增选中
|
|
293
|
-
if (newValue.length > oldValue?.length && findData) {
|
|
294
|
-
emit('select', selectData, findData)
|
|
295
|
-
}
|
|
296
|
-
// 移除选中
|
|
297
|
-
if (newValue.length < oldValue?.length && findData) {
|
|
298
|
-
emit('select', selectData, findData)
|
|
299
|
-
}
|
|
300
|
-
emit('selectionChange', selectData)
|
|
301
|
-
checkedClickId.value = undefined
|
|
302
|
-
}, { deep: true });
|
|
303
|
-
|
|
304
|
-
// 滚动数据加载监听
|
|
305
|
-
watch(() => props.data, (newValue) => {
|
|
306
|
-
console.log('props.data =======================> 更新', newValue)
|
|
307
|
-
setPaginationList(newValue)
|
|
308
|
-
}, { deep: true });
|
|
309
|
-
|
|
310
|
-
// 滚动到底部监听
|
|
311
|
-
const scrollLoad = () => {
|
|
312
|
-
console.log('分页', pagesNumber.value, props.currentPage)
|
|
313
|
-
if (pagesNumber.value > 1 && pagesNumber.value > props.currentPage) {
|
|
314
|
-
// paginationList.value[props.currentPage - 1]?.length ||
|
|
315
|
-
console.log(dataList.value.length, props.pageSize * props.currentPage)
|
|
316
|
-
if (dataList.value.length === props.pageSize * props.currentPage ) {
|
|
317
|
-
isPaginationLoading.value = true
|
|
318
|
-
const currentPage = props.currentPage + 1
|
|
319
|
-
console.log('开始滚动了', currentPage, pagesNumber.value)
|
|
320
|
-
emit('update:current-page', currentPage)
|
|
321
|
-
emit('currentChange', currentPage)
|
|
322
|
-
} else {
|
|
323
|
-
console.log('等待数据加载')
|
|
324
|
-
}
|
|
325
|
-
} else {
|
|
326
|
-
console.log('到底了')
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
const getAddBtn = (Fun) => addColumnBtn.value && <ElButton type="primary" plain icon={<CirclePlus />} onClick={() => Fun?.(attrs.listCode)}>Add</ElButton>
|
|
331
|
-
|
|
332
|
-
return {
|
|
333
|
-
getAddBtn,
|
|
334
|
-
renderDom: (AddBtn) => (
|
|
335
|
-
<Scrollbar onScrollToBottom={scrollLoad} set-max-height={data => {
|
|
336
|
-
if (data?.windowHeight) {
|
|
337
|
-
const height = data?.windowHeight - 160
|
|
338
|
-
return height > 400 ? height : 400
|
|
339
|
-
}
|
|
340
|
-
}}>
|
|
341
|
-
{(<ElDrawer v-model={isChildrenDrawer.value} modal-class='yx-drawer yx-scrollbar-body' with-header={true} direction="btt" append-to-body size='90vh' v-slots={{
|
|
342
|
-
header: () => (<div class="yx-flex-wrap" style={{gap: '10px'}}>
|
|
343
|
-
{layoutData.value.header[0] && `${layoutData.value.header[0].label}: `}
|
|
344
|
-
<ElBreadcrumb separator-icon={<ArrowRight></ArrowRight>}>
|
|
345
|
-
{childrenBreadcrumbData.value.map((columnFormData, i) => {
|
|
346
|
-
const label = columnViewDom(layoutData.value.header[0], columnFormData, undefined, true)
|
|
347
|
-
return (
|
|
348
|
-
<ElBreadcrumbItem>
|
|
349
|
-
{
|
|
350
|
-
childrenBreadcrumbData.value.length - 1 === i ? label : <ElLink onClick={() => childrenBreadcrumbData.value = childrenBreadcrumbData.value.slice(0, i + 1)}>{ label }</ElLink>
|
|
351
|
-
}
|
|
352
|
-
</ElBreadcrumbItem>
|
|
353
|
-
)
|
|
354
|
-
|
|
355
|
-
})}
|
|
356
|
-
</ElBreadcrumb>
|
|
357
|
-
</div>)
|
|
358
|
-
}}
|
|
359
|
-
onClosed={() => childrenBreadcrumbData.value = []}
|
|
360
|
-
>
|
|
361
|
-
|
|
362
|
-
<Scrollbar scrollable-main max-height='100%' style={{ 'flex': '1 1 auto'}}>
|
|
363
|
-
<div class="yx-flex-wrap" vertical style={{ gap: '15px'}}>
|
|
364
|
-
{ childrenList.value.map((columnFormData, columnIndex) => {
|
|
365
|
-
// 开启编辑后禁止选中
|
|
366
|
-
const onChecked = () => !columnFormData.$editing && setCheckedList(columnFormData.$rowDataGuId)
|
|
367
|
-
|
|
368
|
-
// 是否选中
|
|
369
|
-
const isChecked = checkedList.value.includes(columnFormData.$rowDataGuId)
|
|
370
|
-
|
|
371
|
-
// 是否有子表
|
|
372
|
-
const isSubTable = !!((columnFormData?.children?.length ?? 0) > 0)
|
|
373
|
-
|
|
374
|
-
const clickPropertyData = layoutData.value.content?.find(({ property }) => property) ?? layoutData.value.content[0]
|
|
375
|
-
|
|
376
|
-
return (<CardView
|
|
377
|
-
form={columnFormData}
|
|
378
|
-
no={ isIndex ? columnIndex + 1 : undefined}
|
|
379
|
-
isChecked={isChecked}
|
|
380
|
-
isSubTable={isSubTable}
|
|
381
|
-
isCheck={isCheck.value}
|
|
382
|
-
isMore={!columnFormData.$editing}
|
|
383
|
-
isShowDetailsMore={isShowDetailsMore.value}
|
|
384
|
-
onChecked={onChecked}
|
|
385
|
-
onShowSubTable={() => {
|
|
386
|
-
childrenBreadcrumbData.value =[...childrenBreadcrumbData.value, columnFormData];
|
|
387
|
-
}}
|
|
388
|
-
onRowClick={(event) => emit('rowClick', columnFormData, clickPropertyData, event)}
|
|
389
|
-
onRowDblclick={(event) => emit('rowDblclick', columnFormData, clickPropertyData, event)}
|
|
390
|
-
v-slots={{
|
|
391
|
-
titleSlot: layoutData.value.header && layoutData.value.header?.map((columnCol) => columnViewDom(columnCol, columnFormData, columnIndex, true)),
|
|
392
|
-
children: ({ isMore }) => getElDescriptions(layoutData.value.content, columnFormData, columnIndex, !isMore ? undefined : props.showFieldCount),
|
|
393
|
-
footerSlot: isShowFooter.value && (<div class="yx-flex-wrap" wrap style={{gap: '15px'}}>
|
|
394
|
-
{layoutData.value.footer?.map((columnCol) => columnViewDom(columnCol, columnFormData, columnIndex))}
|
|
395
|
-
</div>)
|
|
396
|
-
}}
|
|
397
|
-
/>)
|
|
398
|
-
}) }
|
|
399
|
-
</div>
|
|
400
|
-
</Scrollbar>
|
|
401
|
-
</ElDrawer>)}
|
|
402
|
-
<div
|
|
403
|
-
class="yx-flex-wrap"
|
|
404
|
-
vertical
|
|
405
|
-
style="overflow: auto; gap: 15px;"
|
|
406
|
-
>
|
|
407
|
-
{dataList.value.length === 0 && <ElEmpty>{AddBtn}</ElEmpty>}
|
|
408
|
-
|
|
409
|
-
{dataList.value.map((columnFormData, columnIndex) => {
|
|
410
|
-
|
|
411
|
-
// 开启编辑后禁止选中
|
|
412
|
-
const onChecked = () => !columnFormData.$editing && setCheckedList(columnFormData.$rowDataGuId)
|
|
413
|
-
|
|
414
|
-
// 是否选中
|
|
415
|
-
const isChecked = checkedList.value.includes(columnFormData.$rowDataGuId)
|
|
416
|
-
|
|
417
|
-
// 是否有子表
|
|
418
|
-
const isSubTable = !!(columnFormData?.children?.length ?? false)
|
|
419
|
-
|
|
420
|
-
const clickPropertyData = layoutData.value.content?.find(({ property }) => property) ?? layoutData.value.content[0]
|
|
421
|
-
|
|
422
|
-
return (<CardView
|
|
423
|
-
form={columnFormData}
|
|
424
|
-
no={ isIndex ? columnIndex + 1 : undefined}
|
|
425
|
-
isChecked={isChecked}
|
|
426
|
-
isSubTable={isSubTable}
|
|
427
|
-
isCheck={isCheck.value}
|
|
428
|
-
isMore={!columnFormData.$editing}
|
|
429
|
-
isShowDetailsMore={isShowDetailsMore.value}
|
|
430
|
-
onChecked={onChecked}
|
|
431
|
-
onShowSubTable={() => {
|
|
432
|
-
childrenBreadcrumbData.value =[columnFormData];
|
|
433
|
-
isChildrenDrawer.value = true
|
|
434
|
-
}}
|
|
435
|
-
onRowClick={(event) => emit('rowClick', columnFormData, clickPropertyData, event)}
|
|
436
|
-
onRowDblclick={(event) => emit('rowDblclick', columnFormData, clickPropertyData, event)}
|
|
437
|
-
v-slots={{
|
|
438
|
-
titleSlot: layoutData.value.header && layoutData.value.header?.map((columnCol) => columnViewDom(columnCol, columnFormData, columnIndex, true)),
|
|
439
|
-
children: ({ isMore }) => getElDescriptions(layoutData.value.content, columnFormData, columnIndex, !isMore ? undefined : props.showFieldCount),
|
|
440
|
-
footerSlot: isShowFooter.value && (<div class="yx-flex-wrap" wrap style={{gap: '15px'}}>
|
|
441
|
-
{layoutData.value.footer?.map((columnCol) => columnViewDom(columnCol, columnFormData, columnIndex))}
|
|
442
|
-
</div>)
|
|
443
|
-
}}
|
|
444
|
-
/>)
|
|
445
|
-
})}
|
|
446
|
-
|
|
447
|
-
{dataList.value.length > 0 && AddBtn}
|
|
448
|
-
|
|
449
|
-
{
|
|
450
|
-
dataList.value.length > 0 && pagesNumber.value > 1 && (<ElDivider>
|
|
451
|
-
{ (pagesNumber.value > props.currentPage || isPaginationLoading.value) ? (<ElIcon loading-rotate size={25} color="#409eff" style={{ margin: '15px auto' }}><Loading></Loading></ElIcon>) : (pagesNumber.value <= props.currentPage && isLoadPaginationData.value) && 'END' }
|
|
452
|
-
</ElDivider>)
|
|
453
|
-
}
|
|
454
|
-
</div>
|
|
455
|
-
</Scrollbar>
|
|
456
|
-
)
|
|
457
|
-
};
|
|
458
|
-
},
|
|
459
|
-
render() {
|
|
460
|
-
// 为了 能兼容 使用 mixins 参数
|
|
461
|
-
return this.renderDom(this.getAddBtn(this.createRow))
|
|
462
|
-
}
|
|
463
|
-
});
|
|
1
|
+
/** @jsxImportSource vue */
|
|
2
|
+
import { defineComponent, ref, computed, watch, defineEmits } from 'vue';
|
|
3
|
+
import { ElCard, ElDrawer, ElTag,ElDescriptions, ElDescriptionsItem, ElButton, ElIcon, ElCheckbox, ElCheckboxGroup, ElBreadcrumb, ElLink, ElEmpty, ElDivider } from 'element-plus';
|
|
4
|
+
import NormalColumnContent from '../normal-column-content.vue';
|
|
5
|
+
import CardView from '../../../../src/components/Card';
|
|
6
|
+
import Scrollbar from '../../../../src/components/Scrollbar';
|
|
7
|
+
import store from '../store';
|
|
8
|
+
import { apisMixin } from '../apis'
|
|
9
|
+
|
|
10
|
+
import { ArrowLeft, Bottom, CirclePlus, Loading, Tickets } from '@element-plus/icons-vue';
|
|
11
|
+
// import { $emit, $off, $on } from '@/utils/gogocodeTransfer'
|
|
12
|
+
|
|
13
|
+
export default defineComponent({
|
|
14
|
+
name: 'MobileTableCard',
|
|
15
|
+
components: {
|
|
16
|
+
NormalColumnContent,
|
|
17
|
+
CardView,
|
|
18
|
+
Scrollbar
|
|
19
|
+
},
|
|
20
|
+
mixins: [apisMixin],
|
|
21
|
+
props: {
|
|
22
|
+
// 展示字段限制
|
|
23
|
+
showFieldCount: {
|
|
24
|
+
type: [Number, undefined],
|
|
25
|
+
default: () => 5
|
|
26
|
+
},
|
|
27
|
+
// 列字段数据
|
|
28
|
+
columns: {
|
|
29
|
+
type: Array,
|
|
30
|
+
default: () => []
|
|
31
|
+
},
|
|
32
|
+
// 表格数据
|
|
33
|
+
data: {
|
|
34
|
+
type: Array,
|
|
35
|
+
default: () => []
|
|
36
|
+
},
|
|
37
|
+
// 字段事件 v-bind 与 v-on 集成
|
|
38
|
+
getColumnComponentData: {
|
|
39
|
+
type: [Function, undefined],
|
|
40
|
+
default: undefined
|
|
41
|
+
},
|
|
42
|
+
// 选中页
|
|
43
|
+
currentPage: {
|
|
44
|
+
type: [Number],
|
|
45
|
+
default: 1
|
|
46
|
+
},
|
|
47
|
+
// 一页展示数量
|
|
48
|
+
pageSize: {
|
|
49
|
+
type: [Number],
|
|
50
|
+
default: 20
|
|
51
|
+
},
|
|
52
|
+
// 一页展示数量
|
|
53
|
+
pageTotal: {
|
|
54
|
+
type: [Number],
|
|
55
|
+
default: 0
|
|
56
|
+
},
|
|
57
|
+
// 是否开启 堆积分页数据
|
|
58
|
+
isStackingPaginatedData: {
|
|
59
|
+
type: Boolean,
|
|
60
|
+
default: () => false
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
setup(props, setupData) {
|
|
64
|
+
const $emits = defineEmits(['currentChange', 'update:current-page', 'select']);
|
|
65
|
+
|
|
66
|
+
const { attrs, emit, expose } = setupData
|
|
67
|
+
|
|
68
|
+
console.log('*mobile-table-card.JSX**********************************************=>', props, attrs, setupData, expose)
|
|
69
|
+
|
|
70
|
+
// 分页加载状态
|
|
71
|
+
const isPaginationLoading = ref(false)
|
|
72
|
+
|
|
73
|
+
const paginationList = ref([])
|
|
74
|
+
// 选中数据
|
|
75
|
+
const checkedList = ref([]);
|
|
76
|
+
// 当前勾选ID
|
|
77
|
+
const checkedClickId = ref(undefined);
|
|
78
|
+
// 当前选中数据
|
|
79
|
+
const isCheckedIndex = ref(undefined);
|
|
80
|
+
|
|
81
|
+
// 是否打开子表弹窗
|
|
82
|
+
const isChildrenDrawer = ref(false);
|
|
83
|
+
|
|
84
|
+
// 子表打开历史数据
|
|
85
|
+
const childrenBreadcrumbData = ref([]);
|
|
86
|
+
|
|
87
|
+
const setPaginationList = (data) => {
|
|
88
|
+
if (props.isStackingPaginatedData) {
|
|
89
|
+
paginationList.value[(props.currentPage ?? 1) - 1] = data
|
|
90
|
+
} else {
|
|
91
|
+
paginationList.value[0] = data
|
|
92
|
+
}
|
|
93
|
+
isPaginationLoading.value = false
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
setPaginationList(props.data)
|
|
97
|
+
|
|
98
|
+
const addColumnBtn = computed(() => {
|
|
99
|
+
const gridParams = store.get(attrs.listCode)
|
|
100
|
+
const showOperationButton = gridParams?.options?.showOperationButton ?? false
|
|
101
|
+
const isFormSubTable = gridParams?.options?.isFormSubTable ?? false
|
|
102
|
+
const subTableCanAdd = gridParams?.options?.subTableCanAdd ?? false
|
|
103
|
+
const isOperation = componentDatas.value?.some(({ prop }) => ['operation'].includes(prop))
|
|
104
|
+
return showOperationButton && isFormSubTable && subTableCanAdd && isOperation
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
// 列表数据
|
|
108
|
+
const dataList = computed(() => {
|
|
109
|
+
if (props.isStackingPaginatedData) {
|
|
110
|
+
return paginationList.value.flatMap((data, index) => index + 1 <= props.currentPage ? data : [] )
|
|
111
|
+
} else {
|
|
112
|
+
return paginationList.value[0] ?? []
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
// 获取包含所有子表数据 LIST 一般用于勾选
|
|
117
|
+
const dataChildrenList = computed(() => {
|
|
118
|
+
const getChildrenData = (data) => {
|
|
119
|
+
return data?.flatMap(item => {
|
|
120
|
+
if (item?.children?.length) return [item, ...getChildrenData(item.children)]
|
|
121
|
+
return [item]
|
|
122
|
+
}) ?? []
|
|
123
|
+
}
|
|
124
|
+
return getChildrenData(dataList.value)
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
const isLoadPaginationData = computed(() => {
|
|
128
|
+
if (props.isStackingPaginatedData) {
|
|
129
|
+
return (paginationList.value[props.currentPage - 1]?.length ?? 0) > 0
|
|
130
|
+
} else {
|
|
131
|
+
return dataList.value.length < props.pageSize * props.currentPage && pagesNumber.value >= props.currentPage
|
|
132
|
+
}
|
|
133
|
+
})
|
|
134
|
+
|
|
135
|
+
// 面包屑数据
|
|
136
|
+
const childrenList = computed(() => {
|
|
137
|
+
return childrenBreadcrumbData.value[childrenBreadcrumbData.value.length - 1]?.children ?? []
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
const componentDatas = computed(() => {
|
|
141
|
+
const getChildrenData = (data) => {
|
|
142
|
+
return data?.flatMap(item => {
|
|
143
|
+
if (item?.children?.length) return getChildrenData(item.children)
|
|
144
|
+
return [item]
|
|
145
|
+
}) ?? []
|
|
146
|
+
}
|
|
147
|
+
return getChildrenData(props.columns.filter((column) => !column ? false : !['$selection', '$index'].includes(column?.prop)))
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
const layoutData = computed(() => {
|
|
151
|
+
const contentData = componentDatas.value.map((data, index) => {
|
|
152
|
+
if (data.operations) {
|
|
153
|
+
data.layoutModelType = 'footer'
|
|
154
|
+
} else {
|
|
155
|
+
data.layoutModelType = 'content'
|
|
156
|
+
}
|
|
157
|
+
return data
|
|
158
|
+
});
|
|
159
|
+
const content = contentData.filter(({ layoutModelType}) => ['content'].includes(layoutModelType))
|
|
160
|
+
return {
|
|
161
|
+
header: content[0] ? [content[0]] : [],
|
|
162
|
+
content,
|
|
163
|
+
footer: contentData.filter(({ layoutModelType}) => ['footer'].includes(layoutModelType))
|
|
164
|
+
};
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
// 获取最大 label 字符长度
|
|
168
|
+
const getLongestStringLength = (strArray) => {
|
|
169
|
+
return strArray.reduce((maxLen, str) => {
|
|
170
|
+
return Math.max(maxLen, [...str].reduce((len, char) => /[\u4e00-\u9fff]/.test(char) ? len + 2 : len + 1, 0));
|
|
171
|
+
}, 0);
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
// 分页数量
|
|
175
|
+
const pagesNumber = computed(() => {
|
|
176
|
+
if (!props.pageTotal) return 0
|
|
177
|
+
return Math.ceil(props.pageTotal / props.pageSize)
|
|
178
|
+
})
|
|
179
|
+
|
|
180
|
+
// 字段更多 是否开启
|
|
181
|
+
const isShowDetailsMore = computed(() => {
|
|
182
|
+
if (props.showFieldCount && layoutData.value.content.length > props.showFieldCount) return true
|
|
183
|
+
return false
|
|
184
|
+
})
|
|
185
|
+
|
|
186
|
+
// 是否显示卡片底部控件
|
|
187
|
+
const isShowFooter = computed(() => {
|
|
188
|
+
return layoutData.value.footer.length > 0
|
|
189
|
+
})
|
|
190
|
+
|
|
191
|
+
const maxLabelWidth = computed(() => {
|
|
192
|
+
return getLongestStringLength(layoutData.value.content.map((column) => column?.label ?? 0)) * 7 + 15
|
|
193
|
+
})
|
|
194
|
+
|
|
195
|
+
const isCheck = computed(() => {
|
|
196
|
+
return props.columns.some((column) => ['$selection'].includes(column?.prop));
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
const isIndex = computed(() => {
|
|
200
|
+
return props.columns.some((column) => ['$index'].includes(column?.prop));
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
const detailsFormData = computed(() => {
|
|
204
|
+
return dataList.value[isCheckedIndex.value]
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
// 写入选中
|
|
208
|
+
const setCheckedList = (value) => {
|
|
209
|
+
debugger;
|
|
210
|
+
if (!isCheck.value) return
|
|
211
|
+
if (checkedList.value.includes(value)) {
|
|
212
|
+
checkedList.value = checkedList.value.filter(v => v !== value)
|
|
213
|
+
} else {
|
|
214
|
+
checkedList.value = [...new Set([...checkedList.value, value])]
|
|
215
|
+
}
|
|
216
|
+
checkedClickId.value = value
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* 字段渲染展示
|
|
221
|
+
* @param {当前字段数据} columnData
|
|
222
|
+
* @param {当前行的数据} columnFormData
|
|
223
|
+
* @param {所在行的$index} columnIndex
|
|
224
|
+
* @param {是否只显示文本} isViewText
|
|
225
|
+
* @returns
|
|
226
|
+
*/
|
|
227
|
+
const columnViewDom = (columnData, columnFormData, columnIndex, isViewText = false) => {
|
|
228
|
+
const {$bind = {}, $on = {}} = props.getColumnComponentData?.(columnData) ?? {}
|
|
229
|
+
const gridParams = store.get($bind['list-code'])
|
|
230
|
+
const options = gridParams?.options
|
|
231
|
+
const lineEdit = gridParams.lineEdit ?? false
|
|
232
|
+
const attrs = {
|
|
233
|
+
...$bind,
|
|
234
|
+
options,
|
|
235
|
+
row: columnFormData,
|
|
236
|
+
rowIndex: columnIndex,
|
|
237
|
+
'right-click-menu-arr': options?.rightClickMenuArr,
|
|
238
|
+
'line-edit': lineEdit
|
|
239
|
+
}
|
|
240
|
+
const onAttrs = {
|
|
241
|
+
...Object.fromEntries(Object.keys($on).map(key => [`on${key.charAt(0).toUpperCase()}${key.slice(1).replace(/-([a-z])/g, (match, letter) => letter.toUpperCase())}`, $on[key]]))
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
return <NormalColumnContent isContentViewText={isViewText} {...attrs} {...onAttrs} />
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
*
|
|
249
|
+
* @param {字段columns List} layoutDatas
|
|
250
|
+
* @param {当前行的数据} columnFormData
|
|
251
|
+
* @param {所在行的$index} columnIndex
|
|
252
|
+
* @param {限制显示字段} showFieldCount
|
|
253
|
+
* @returns .filter((_, index) => !props.showFieldCount || props.showFieldCount > index + 1)
|
|
254
|
+
*/
|
|
255
|
+
const getElDescriptions = (layoutDatas, columnFormData = detailsFormData.value, columnIndex = isCheckedIndex.value, showFieldCount = undefined) => {
|
|
256
|
+
// const propertyData = columnData?.find(({ property }) => property)
|
|
257
|
+
return <ElDescriptions column={1} label-width={maxLabelWidth.value} align="right" direction="horizontal" layout='form'>
|
|
258
|
+
{(showFieldCount ? layoutDatas?.slice?.(0, showFieldCount) : layoutDatas)?.map((columnCol, index) => (
|
|
259
|
+
<ElDescriptionsItem
|
|
260
|
+
key={columnCol.label + index}
|
|
261
|
+
v-slots={
|
|
262
|
+
{
|
|
263
|
+
label: () => <div v-html={columnCol.label ? `${columnCol.label}:` : ''} />
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
// onRowDblclick={(event) => {
|
|
267
|
+
// console.log('我双击了', columnCol?.property )
|
|
268
|
+
// // if (isViewText) return
|
|
269
|
+
// event.stopPropagation()
|
|
270
|
+
// // emit('rowDblclick', columnFormData, columnData, event)
|
|
271
|
+
// }}
|
|
272
|
+
>
|
|
273
|
+
{columnViewDom(columnCol, columnFormData, columnIndex) || '-'}
|
|
274
|
+
</ElDescriptionsItem>
|
|
275
|
+
))}
|
|
276
|
+
</ElDescriptions>
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
watch(() => attrs.selection, (newValue) => {
|
|
280
|
+
console.log('表格勾选数据监听', newValue)
|
|
281
|
+
checkedList.value = newValue.map(({ $rowDataGuId }) => $rowDataGuId)
|
|
282
|
+
}, { deep: true });
|
|
283
|
+
|
|
284
|
+
// 勾选监听
|
|
285
|
+
watch(checkedList, (newValue , oldValue) => {
|
|
286
|
+
console.log(newValue , oldValue)
|
|
287
|
+
if (attrs.selection.length === newValue.length) {
|
|
288
|
+
if (attrs.selection.every(({ $rowDataGuId }) => newValue.includes($rowDataGuId ) )) return
|
|
289
|
+
}
|
|
290
|
+
const selectData = dataChildrenList.value.filter(({ $rowDataGuId }) => newValue?.includes($rowDataGuId))
|
|
291
|
+
const findData = checkedClickId.value ? dataChildrenList.value.find(({ $rowDataGuId }) => checkedClickId.value === $rowDataGuId) : undefined
|
|
292
|
+
// 新增选中
|
|
293
|
+
if (newValue.length > oldValue?.length && findData) {
|
|
294
|
+
emit('select', selectData, findData)
|
|
295
|
+
}
|
|
296
|
+
// 移除选中
|
|
297
|
+
if (newValue.length < oldValue?.length && findData) {
|
|
298
|
+
emit('select', selectData, findData)
|
|
299
|
+
}
|
|
300
|
+
emit('selectionChange', selectData)
|
|
301
|
+
checkedClickId.value = undefined
|
|
302
|
+
}, { deep: true });
|
|
303
|
+
|
|
304
|
+
// 滚动数据加载监听
|
|
305
|
+
watch(() => props.data, (newValue) => {
|
|
306
|
+
console.log('props.data =======================> 更新', newValue)
|
|
307
|
+
setPaginationList(newValue)
|
|
308
|
+
}, { deep: true });
|
|
309
|
+
|
|
310
|
+
// 滚动到底部监听
|
|
311
|
+
const scrollLoad = () => {
|
|
312
|
+
console.log('分页', pagesNumber.value, props.currentPage)
|
|
313
|
+
if (pagesNumber.value > 1 && pagesNumber.value > props.currentPage) {
|
|
314
|
+
// paginationList.value[props.currentPage - 1]?.length ||
|
|
315
|
+
console.log(dataList.value.length, props.pageSize * props.currentPage)
|
|
316
|
+
if (dataList.value.length === props.pageSize * props.currentPage ) {
|
|
317
|
+
isPaginationLoading.value = true
|
|
318
|
+
const currentPage = props.currentPage + 1
|
|
319
|
+
console.log('开始滚动了', currentPage, pagesNumber.value)
|
|
320
|
+
emit('update:current-page', currentPage)
|
|
321
|
+
emit('currentChange', currentPage)
|
|
322
|
+
} else {
|
|
323
|
+
console.log('等待数据加载')
|
|
324
|
+
}
|
|
325
|
+
} else {
|
|
326
|
+
console.log('到底了')
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
const getAddBtn = (Fun) => addColumnBtn.value && <ElButton type="primary" plain icon={<CirclePlus />} onClick={() => Fun?.(attrs.listCode)}>Add</ElButton>
|
|
331
|
+
|
|
332
|
+
return {
|
|
333
|
+
getAddBtn,
|
|
334
|
+
renderDom: (AddBtn) => (
|
|
335
|
+
<Scrollbar onScrollToBottom={scrollLoad} set-max-height={data => {
|
|
336
|
+
if (data?.windowHeight) {
|
|
337
|
+
const height = data?.windowHeight - 160
|
|
338
|
+
return height > 400 ? height : 400
|
|
339
|
+
}
|
|
340
|
+
}}>
|
|
341
|
+
{(<ElDrawer v-model={isChildrenDrawer.value} modal-class='yx-drawer yx-scrollbar-body' with-header={true} direction="btt" append-to-body size='90vh' v-slots={{
|
|
342
|
+
header: () => (<div class="yx-flex-wrap" style={{gap: '10px'}}>
|
|
343
|
+
{layoutData.value.header[0] && `${layoutData.value.header[0].label}: `}
|
|
344
|
+
<ElBreadcrumb separator-icon={<ArrowRight></ArrowRight>}>
|
|
345
|
+
{childrenBreadcrumbData.value.map((columnFormData, i) => {
|
|
346
|
+
const label = columnViewDom(layoutData.value.header[0], columnFormData, undefined, true)
|
|
347
|
+
return (
|
|
348
|
+
<ElBreadcrumbItem>
|
|
349
|
+
{
|
|
350
|
+
childrenBreadcrumbData.value.length - 1 === i ? label : <ElLink onClick={() => childrenBreadcrumbData.value = childrenBreadcrumbData.value.slice(0, i + 1)}>{ label }</ElLink>
|
|
351
|
+
}
|
|
352
|
+
</ElBreadcrumbItem>
|
|
353
|
+
)
|
|
354
|
+
|
|
355
|
+
})}
|
|
356
|
+
</ElBreadcrumb>
|
|
357
|
+
</div>)
|
|
358
|
+
}}
|
|
359
|
+
onClosed={() => childrenBreadcrumbData.value = []}
|
|
360
|
+
>
|
|
361
|
+
|
|
362
|
+
<Scrollbar scrollable-main max-height='100%' style={{ 'flex': '1 1 auto'}}>
|
|
363
|
+
<div class="yx-flex-wrap" vertical style={{ gap: '15px'}}>
|
|
364
|
+
{ childrenList.value.map((columnFormData, columnIndex) => {
|
|
365
|
+
// 开启编辑后禁止选中
|
|
366
|
+
const onChecked = () => !columnFormData.$editing && setCheckedList(columnFormData.$rowDataGuId)
|
|
367
|
+
|
|
368
|
+
// 是否选中
|
|
369
|
+
const isChecked = checkedList.value.includes(columnFormData.$rowDataGuId)
|
|
370
|
+
|
|
371
|
+
// 是否有子表
|
|
372
|
+
const isSubTable = !!((columnFormData?.children?.length ?? 0) > 0)
|
|
373
|
+
|
|
374
|
+
const clickPropertyData = layoutData.value.content?.find(({ property }) => property) ?? layoutData.value.content[0]
|
|
375
|
+
|
|
376
|
+
return (<CardView
|
|
377
|
+
form={columnFormData}
|
|
378
|
+
no={ isIndex ? columnIndex + 1 : undefined}
|
|
379
|
+
isChecked={isChecked}
|
|
380
|
+
isSubTable={isSubTable}
|
|
381
|
+
isCheck={isCheck.value}
|
|
382
|
+
isMore={!columnFormData.$editing}
|
|
383
|
+
isShowDetailsMore={isShowDetailsMore.value}
|
|
384
|
+
onChecked={onChecked}
|
|
385
|
+
onShowSubTable={() => {
|
|
386
|
+
childrenBreadcrumbData.value =[...childrenBreadcrumbData.value, columnFormData];
|
|
387
|
+
}}
|
|
388
|
+
onRowClick={(event) => emit('rowClick', columnFormData, clickPropertyData, event)}
|
|
389
|
+
onRowDblclick={(event) => emit('rowDblclick', columnFormData, clickPropertyData, event)}
|
|
390
|
+
v-slots={{
|
|
391
|
+
titleSlot: layoutData.value.header && layoutData.value.header?.map((columnCol) => columnViewDom(columnCol, columnFormData, columnIndex, true)),
|
|
392
|
+
children: ({ isMore }) => getElDescriptions(layoutData.value.content, columnFormData, columnIndex, !isMore ? undefined : props.showFieldCount),
|
|
393
|
+
footerSlot: isShowFooter.value && (<div class="yx-flex-wrap" wrap style={{gap: '15px'}}>
|
|
394
|
+
{layoutData.value.footer?.map((columnCol) => columnViewDom(columnCol, columnFormData, columnIndex))}
|
|
395
|
+
</div>)
|
|
396
|
+
}}
|
|
397
|
+
/>)
|
|
398
|
+
}) }
|
|
399
|
+
</div>
|
|
400
|
+
</Scrollbar>
|
|
401
|
+
</ElDrawer>)}
|
|
402
|
+
<div
|
|
403
|
+
class="yx-flex-wrap"
|
|
404
|
+
vertical
|
|
405
|
+
style="overflow: auto; gap: 15px;"
|
|
406
|
+
>
|
|
407
|
+
{dataList.value.length === 0 && <ElEmpty>{AddBtn}</ElEmpty>}
|
|
408
|
+
|
|
409
|
+
{dataList.value.map((columnFormData, columnIndex) => {
|
|
410
|
+
|
|
411
|
+
// 开启编辑后禁止选中
|
|
412
|
+
const onChecked = () => !columnFormData.$editing && setCheckedList(columnFormData.$rowDataGuId)
|
|
413
|
+
|
|
414
|
+
// 是否选中
|
|
415
|
+
const isChecked = checkedList.value.includes(columnFormData.$rowDataGuId)
|
|
416
|
+
|
|
417
|
+
// 是否有子表
|
|
418
|
+
const isSubTable = !!(columnFormData?.children?.length ?? false)
|
|
419
|
+
|
|
420
|
+
const clickPropertyData = layoutData.value.content?.find(({ property }) => property) ?? layoutData.value.content[0]
|
|
421
|
+
|
|
422
|
+
return (<CardView
|
|
423
|
+
form={columnFormData}
|
|
424
|
+
no={ isIndex ? columnIndex + 1 : undefined}
|
|
425
|
+
isChecked={isChecked}
|
|
426
|
+
isSubTable={isSubTable}
|
|
427
|
+
isCheck={isCheck.value}
|
|
428
|
+
isMore={!columnFormData.$editing}
|
|
429
|
+
isShowDetailsMore={isShowDetailsMore.value}
|
|
430
|
+
onChecked={onChecked}
|
|
431
|
+
onShowSubTable={() => {
|
|
432
|
+
childrenBreadcrumbData.value =[columnFormData];
|
|
433
|
+
isChildrenDrawer.value = true
|
|
434
|
+
}}
|
|
435
|
+
onRowClick={(event) => emit('rowClick', columnFormData, clickPropertyData, event)}
|
|
436
|
+
onRowDblclick={(event) => emit('rowDblclick', columnFormData, clickPropertyData, event)}
|
|
437
|
+
v-slots={{
|
|
438
|
+
titleSlot: layoutData.value.header && layoutData.value.header?.map((columnCol) => columnViewDom(columnCol, columnFormData, columnIndex, true)),
|
|
439
|
+
children: ({ isMore }) => getElDescriptions(layoutData.value.content, columnFormData, columnIndex, !isMore ? undefined : props.showFieldCount),
|
|
440
|
+
footerSlot: isShowFooter.value && (<div class="yx-flex-wrap" wrap style={{gap: '15px'}}>
|
|
441
|
+
{layoutData.value.footer?.map((columnCol) => columnViewDom(columnCol, columnFormData, columnIndex))}
|
|
442
|
+
</div>)
|
|
443
|
+
}}
|
|
444
|
+
/>)
|
|
445
|
+
})}
|
|
446
|
+
|
|
447
|
+
{dataList.value.length > 0 && AddBtn}
|
|
448
|
+
|
|
449
|
+
{
|
|
450
|
+
dataList.value.length > 0 && pagesNumber.value > 1 && (<ElDivider>
|
|
451
|
+
{ (pagesNumber.value > props.currentPage || isPaginationLoading.value) ? (<ElIcon loading-rotate size={25} color="#409eff" style={{ margin: '15px auto' }}><Loading></Loading></ElIcon>) : (pagesNumber.value <= props.currentPage && isLoadPaginationData.value) && 'END' }
|
|
452
|
+
</ElDivider>)
|
|
453
|
+
}
|
|
454
|
+
</div>
|
|
455
|
+
</Scrollbar>
|
|
456
|
+
)
|
|
457
|
+
};
|
|
458
|
+
},
|
|
459
|
+
render() {
|
|
460
|
+
// 为了 能兼容 使用 mixins 参数
|
|
461
|
+
return this.renderDom(this.getAddBtn(this.createRow))
|
|
462
|
+
}
|
|
463
|
+
});
|