Commit 4eed1e4d authored by 何远江's avatar 何远江

添加结束标识

parent e24fd8ee
......@@ -84,5 +84,6 @@ export const areaMarksColor = {
attch_title: '#e58e26', // 附加区标题
attch_head: '#b08968', // 附加区别称
caption: '#bc5090', // 说明
exclude: '#ff6361' // 排除
exclude: '#ff6361', // 排除
end: '#666' // 结束
}
......@@ -115,6 +115,38 @@
</template>
</vxe-column>
</vxe-table>
<p class="table-title mt-2">结束标识</p>
<vxe-table
border
size="mini"
max-height="200"
:data="endArea"
:edit-config="{ trigger: 'click', mode: 'cell' }"
:row-config="{ isCurrent: true }"
>
<vxe-column title="单元格值" field="title" :edit-render="{}">
<template #default="{ row }">{{ row.title }}</template>
<template #edit="{ row }">
<el-input size="small" v-model="row.title"></el-input>
</template>
</vxe-column>
<vxe-column title="单元格" width="90">
<template #default="{ row }">{{
getRangetxt(row.row, row.row, row.colum, row.colum)
}}</template>
</vxe-column>
<vxe-column title="操作" width="50">
<template #default="{ row, $rowIndex }">
<el-link
type="danger"
style="font-size: 12px"
@click="delCaptionAndExclude(row, $rowIndex, 3)"
>删除</el-link
>
</template>
</vxe-column>
</vxe-table>
</el-col>
<el-col style="margin-top: 10px">
<el-form-item label-width="0">
......@@ -122,6 +154,7 @@
<el-button type="primary" @click="setAreaMark('data')">标记数据区</el-button>
<el-button type="primary" @click="setCaptionArea">标记说明区</el-button>
<el-button type="primary" @click="setExcludeArea">标记排除区</el-button>
<el-button type="primary" @click="setEndArea">标记结束区</el-button>
<el-button type="success" @click="nextStep">下一步</el-button>
</el-button-group>
</el-form-item>
......@@ -199,6 +232,7 @@ const resetFormState = () => {
excludeArea.value = []
captionArea.value = []
endArea.value = []
}
const setAreaMark = (type: 'data') => {
......@@ -225,6 +259,7 @@ const setAreaMark = (type: 'data') => {
const captionArea = ref<Recordable[]>([])
const excludeArea = ref<Recordable[]>([])
const endArea = ref<Recordable[]>([])
// 设置说明区
const setCaptionArea = () => {
const cells = getRangeCellValue('caption')
......@@ -248,12 +283,23 @@ const setExcludeArea = () => {
)
}
const setEndArea = () => {
const cells = getRangeCellValue('end')
// 去除重复单元格
endArea.value.push(
...cells.filter(
(cell) => endArea.value.findIndex((v) => v.row == cell.row && v.colum == cell.colum) == -1
)
)
}
const delCaptionAndExclude = (row: any, index: number, type = 1) => {
;(type == 1 ? captionArea : excludeArea).value.splice(index, 1)
;(type == 1 ? captionArea : type == 2 ? excludeArea : endArea).value.splice(index, 1)
setRangeBackground(row, areaMarksColor[type == 1 ? 'default' : 'data'])
}
// 获取有值的单元格
const getRangeCellValue = (type: 'caption' | 'exclude') => {
const getRangeCellValue = (type: 'caption' | 'exclude' | 'end') => {
return handleRangeCell(luckysheet.getRangeValue(), (c: any) => {
luckysheet.menuButton.customUpdateFormat(
null,
......@@ -287,7 +333,8 @@ const nextStep = async () => {
emits('next', 1, {
...formState,
excludeTitles: unref(excludeArea),
dataTitles: unref(captionArea)
dataTitles: unref(captionArea),
endTitles: unref(endArea)
})
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment