|
|
@ -1,13 +1,16 @@
|
|
|
|
<!-- eslint-disable @typescript-eslint/no-explicit-any -->
|
|
|
|
<!-- eslint-disable @typescript-eslint/no-explicit-any -->
|
|
|
|
<script setup lang="ts">
|
|
|
|
<script setup lang="ts">
|
|
|
|
import { inject } from 'vue'
|
|
|
|
import { inject } from 'vue'
|
|
|
|
import { addTableRow, addTableCol } from "@/utils/table";
|
|
|
|
import { addTableRow, addTableCol, mergeRightCol, mergeRow, cancelMergeCol, } from "@/utils/table";
|
|
|
|
import { handleFindDomById } from "@/utils/index";
|
|
|
|
import { handleFindDomById } from "@/utils/index";
|
|
|
|
import type { IWidget, IWidgetJson } from '@/types/widgetsConfigInterface'
|
|
|
|
import type { IWidget, IWidgetJson } from '@/types/widgetsConfigInterface'
|
|
|
|
import RendererDom from '@/components/RendererDom.vue'
|
|
|
|
import RendererDom from '@/components/RendererDom.vue'
|
|
|
|
|
|
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
const props = defineProps<{
|
|
|
|
itemData: IWidget
|
|
|
|
itemData: IWidget,
|
|
|
|
|
|
|
|
rowIndex: number,
|
|
|
|
|
|
|
|
colIndex: number,
|
|
|
|
|
|
|
|
colLength: number
|
|
|
|
}>()
|
|
|
|
}>()
|
|
|
|
|
|
|
|
|
|
|
|
// 文书表单
|
|
|
|
// 文书表单
|
|
|
@ -83,7 +86,8 @@ const handleDelDom = (node: any = widgetJson) => {
|
|
|
|
<table border="1" cellpadding="10" cellspacing="0" class="w-full">
|
|
|
|
<table border="1" cellpadding="10" cellspacing="0" class="w-full">
|
|
|
|
<template v-for="(row, rowIndex) in itemData['subDomList']" :key="rowIndex">
|
|
|
|
<template v-for="(row, rowIndex) in itemData['subDomList']" :key="rowIndex">
|
|
|
|
<tr>
|
|
|
|
<tr>
|
|
|
|
<RendererDom v-for="subData in row" :key="subData['id']" :itemData="subData" />
|
|
|
|
<RendererDom v-for="(subData, index) in row" :key="subData['id']" :itemData="subData" :rowIndex="rowIndex"
|
|
|
|
|
|
|
|
:colIndex="index" :colLength="Array.isArray(row) ? row['length'] : 1" />
|
|
|
|
</tr>
|
|
|
|
</tr>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
</table>
|
|
|
|
</table>
|
|
|
@ -93,10 +97,10 @@ const handleDelDom = (node: any = widgetJson) => {
|
|
|
|
<div @click.stop="handleFindLastDom" title="选中父组件">
|
|
|
|
<div @click.stop="handleFindLastDom" title="选中父组件">
|
|
|
|
<Icon icon="ion:return-up-back" />
|
|
|
|
<Icon icon="ion:return-up-back" />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div @click.stop="addTableRow(widgetJson, 'table-cell')" title="插入新行">
|
|
|
|
<div @click.stop="addTableRow(widgetJson, rowIndex, true, false, 'table-cell')" title="插入新行">
|
|
|
|
<Icon icon="iconoir:arrow-separate-vertical" />
|
|
|
|
<Icon icon="iconoir:arrow-separate-vertical" />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div @click.stop="addTableCol(widgetJson, 'table-cell')" title="插入新列">
|
|
|
|
<div @click.stop="addTableCol(widgetJson, colIndex, true, false, 'table-cell')" title="插入新列">
|
|
|
|
<Icon icon="iconoir:arrow-separate" />
|
|
|
|
<Icon icon="iconoir:arrow-separate" />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div @click.stop="() => { debugger; handleDelDom() }" title="移除组件">
|
|
|
|
<div @click.stop="() => { debugger; handleDelDom() }" title="移除组件">
|
|
|
@ -109,10 +113,12 @@ const handleDelDom = (node: any = widgetJson) => {
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 针对表格列 -->
|
|
|
|
<!-- 针对表格列 -->
|
|
|
|
<template v-if="itemData['type'] == 'table-cell'">
|
|
|
|
<template v-if="itemData['type'] == 'table-cell'">
|
|
|
|
<td v-if="!itemData['merged']" :colspan="itemData['options']['colspan']" :rowspan="itemData['options']['rowspan']"
|
|
|
|
<td v-if="!itemData['options']['merged']" :colspan="itemData['options']['colspan']"
|
|
|
|
:data-id="itemData['id']" :class="{ activeDom: widgetJson['activeConfig']['activeId'] == itemData['id'] }"
|
|
|
|
:rowspan="itemData['options']['rowspan']" :data-id="itemData['id']"
|
|
|
|
|
|
|
|
:class="{ activeDom: widgetJson['activeConfig']['activeId'] == itemData['id'] }"
|
|
|
|
@click.stop="handleSelectDom(itemData['id'])">
|
|
|
|
@click.stop="handleSelectDom(itemData['id'])">
|
|
|
|
<RendererDom v-for="subData in itemData['subDomList'] as IWidget[]" :key="subData['id']" :itemData="subData" />
|
|
|
|
<RendererDom v-for="(subData, index) in itemData['subDomList'] as IWidget[]" :key="subData['id']"
|
|
|
|
|
|
|
|
:itemData="subData" :rowIndex="rowIndex" :colIndex="index" :colLength="1" />
|
|
|
|
<template v-if="itemData['id'] == widgetJson['activeConfig']['activeId']">
|
|
|
|
<template v-if="itemData['id'] == widgetJson['activeConfig']['activeId']">
|
|
|
|
<div class="activeDomWrapper">{{ widgetJson['activeConfig']['activeDisplayName'] }}</div>
|
|
|
|
<div class="activeDomWrapper">{{ widgetJson['activeConfig']['activeDisplayName'] }}</div>
|
|
|
|
<div class="fnArea">
|
|
|
|
<div class="fnArea">
|
|
|
@ -123,20 +129,23 @@ const handleDelDom = (node: any = widgetJson) => {
|
|
|
|
<Icon icon="hugeicons:menu-square" />
|
|
|
|
<Icon icon="hugeicons:menu-square" />
|
|
|
|
<div class="actionBox">
|
|
|
|
<div class="actionBox">
|
|
|
|
<ul>
|
|
|
|
<ul>
|
|
|
|
<li>插入左侧列</li>
|
|
|
|
<li @click.stop="addTableCol(widgetJson, colIndex, false, true, 'table-cell')">插入左侧列</li>
|
|
|
|
<li>插入右侧列</li>
|
|
|
|
<li @click.stop="addTableCol(widgetJson, colIndex, true, true, 'table-cell')">插入右侧列</li>
|
|
|
|
<li>插入上方行</li>
|
|
|
|
<li @click.stop="addTableRow(widgetJson, rowIndex, false, true, 'table-cell')">插入上方行</li>
|
|
|
|
<li>插入下方行</li>
|
|
|
|
<li @click.stop="addTableRow(widgetJson, rowIndex, true, true, 'table-cell')">插入下方行</li>
|
|
|
|
<el-divider />
|
|
|
|
<el-divider />
|
|
|
|
<li>合并左侧单元格</li>
|
|
|
|
<li :class="{ readOnly: colIndex == colLength - 1 || itemData['options']['colspan'] == colLength }"
|
|
|
|
<li>合并右侧单元格</li>
|
|
|
|
@click="mergeRightCol(widgetJson, rowIndex, colIndex)">合并右侧单元格</li>
|
|
|
|
<li>合并整行</li>
|
|
|
|
<li :class="{ readOnly: colLength == 1 || colIndex > 0 || itemData['options']['colspan'] == colLength }"
|
|
|
|
|
|
|
|
@click="mergeRow(widgetJson, rowIndex)">合并整行
|
|
|
|
|
|
|
|
</li>
|
|
|
|
<el-divider />
|
|
|
|
<el-divider />
|
|
|
|
<li>合并上方单元格</li>
|
|
|
|
|
|
|
|
<li>合并下方单元格</li>
|
|
|
|
<li>合并下方单元格</li>
|
|
|
|
<li>合并整列</li>
|
|
|
|
<li>合并整列</li>
|
|
|
|
<el-divider />
|
|
|
|
<el-divider />
|
|
|
|
<li>撤销行合并</li>
|
|
|
|
<li :class="{ readOnly: itemData['options']['colspan'] && itemData['options']['colspan'] == 1 }"
|
|
|
|
|
|
|
|
@click="cancelMergeCol(widgetJson, rowIndex, colIndex)">撤销行合并
|
|
|
|
|
|
|
|
</li>
|
|
|
|
<li>撤销列合并</li>
|
|
|
|
<li>撤销列合并</li>
|
|
|
|
<el-divider />
|
|
|
|
<el-divider />
|
|
|
|
<li>删除整列</li>
|
|
|
|
<li>删除整列</li>
|
|
|
|