|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
|
<div :id="`table-form-item-${uuid}`" :class="!isTableForm ? 'no-scroll-bar' : ''" class="hc-table-form-data-item h-full w-full">
|
|
|
<el-scrollbar class="table-form-item-scrollbar">
|
|
|
- <div :id="`table-form-${uuid}`" class="hc-excel-table-form" @click.capture="excelTableFormClick" />
|
|
|
+ <div :id="`table-form-${uuid}`" class="hc-excel-table-form" />
|
|
|
</el-scrollbar>
|
|
|
<hc-empty v-if="!isTableForm" :src="notableform" title="暂无表单数据" />
|
|
|
</div>
|
|
@@ -23,7 +23,7 @@ const props = defineProps({
|
|
|
})
|
|
|
|
|
|
//事件
|
|
|
-const emit = defineEmits(['blur', 'focus', 'render', 'excelBodyTap'])
|
|
|
+const emit = defineEmits(['tap', 'render'])
|
|
|
|
|
|
const uuid = getRandom(8)
|
|
|
|
|
@@ -38,7 +38,7 @@ const isTableForm = ref(false)
|
|
|
|
|
|
//渲染完成
|
|
|
onMounted(() => {
|
|
|
- setEmitterData()
|
|
|
+ initClickEvents()
|
|
|
getExcelHtml()
|
|
|
})
|
|
|
|
|
@@ -54,21 +54,9 @@ watch(() => props.form, (val) => {
|
|
|
setFormData(val)
|
|
|
}, { deep: true })
|
|
|
|
|
|
-//注册监听事件
|
|
|
-const setEmitterData = () => {
|
|
|
- window.addEventListener('message', ({ data }) => {
|
|
|
- if (data.type !== 'table-form') return
|
|
|
- if (data.key === 'focus') {
|
|
|
- emit('focus', data.data)
|
|
|
- } else if (data.key === 'blur') {
|
|
|
- emit('blur', data.data)
|
|
|
- }
|
|
|
- })
|
|
|
-}
|
|
|
+//注册被点击事件
|
|
|
+const initClickEvents = () => {
|
|
|
|
|
|
-//表单被点击
|
|
|
-const excelTableFormClick = () => {
|
|
|
- emit('excelBodyTap', uuid)
|
|
|
}
|
|
|
|
|
|
const setExcelHtml = () => {
|