Commit b6bcaa07 by 高源

表格优化

parent 8e83c9b7
<template> <template>
<div class="collectionTable"> <div class="collectionTable">
<div style="display: flex;height: 25px;padding-left: 15px;text-align: left;align-items: center;justify-content: space-between;"> <div
style="display: flex;height: 25px;padding-left: 15px;text-align: left;align-items: center;justify-content: space-between;">
<template v-if="isSelectTable"> <template v-if="isSelectTable">
<!-- <el-tooltip class="item" effect="dark" content="点击新增,右击页面元素添加数据" placement="top"> <!-- <el-tooltip class="item" effect="dark" content="点击新增,右击页面元素添加数据" placement="top">
<el-button type="primary" size="mini" style="width: 40px;height: 20px;" @click="selectElement" <el-button type="primary" size="mini" style="width: 40px;height: 20px;" @click="selectElement"
...@@ -12,17 +13,22 @@ ...@@ -12,17 +13,22 @@
<!-- <el-button style="width: 50px;height: 20px;" size="small" class="button-new-tag" @click="cancelSelect" <!-- <el-button style="width: 50px;height: 20px;" size="small" class="button-new-tag" @click="cancelSelect"
v-if="selectTable">取消选择</el-button> --> v-if="selectTable">取消选择</el-button> -->
</template> </template>
<el-button style="width: 50px;height: 20px;" size="mini" class="button-new-tag" @click="columnBack" v-else>返回</el-button> <el-button style="width: 50px;height: 20px;" size="mini" class="button-new-tag" @click="columnBack"
v-else>返回</el-button>
<div style="display: flex;align-items: center;"> <div style="display: flex;align-items: center;">
<span style="font-size: 13px;" v-if="isSelectTable">表名:</span> <span style="font-size: 13px;" v-if="isSelectTable">表名:</span>
<vxe-input style="margin-left: 10px;" v-if="isSelectTable" v-model="tableName" placeholder="请填写表名" size="mini"></vxe-input> <vxe-input style="margin-left: 10px;" v-if="isSelectTable" v-model="tableName" placeholder="请填写表名"
size="mini"></vxe-input>
</div> </div>
<!-- <el-button style="padding-right: 15px;" size="small" class="button-new-tag" @click="getTable" v-if="isSelectTable">获取表格信息</el-button> --> <!-- <el-button style="padding-right: 15px;" size="small" class="button-new-tag" @click="getTable" v-if="isSelectTable">获取表格信息</el-button> -->
<el-button size="mini" style="width: 74px;height: 20px;margin-right: 7px;" @click="getTable" v-if="isSelectTable">获取表格信息</el-button> <el-button size="mini" style="width: 74px;height: 20px;margin-right: 7px;" @click="getTable"
v-if="isSelectTable">获取表格信息</el-button>
</div> </div>
<!-- 全部表格信息 --> <!-- 全部表格信息 -->
<div style="overflow: auto;height: 230px;" :style="{ width: widthResize + 'px' }"> <div style="overflow: auto;height: 230px;" :style="{ width: widthResize + 'px' }">
<vxe-table :data="SelectTableData" ref="xTableColumn" border class="mytable-scrollbar" height="220" v-if="isSelectTable" auto-resize style="margin-bottom: 5px;" @current-change="currentChangeEvent" highlight-hover-row highlight-current-row> <vxe-table :data="SelectTableData" ref="xTableColumn" border class="mytable-scrollbar" height="220"
v-if="isSelectTable" auto-resize style="margin-bottom: 5px;" @current-change="currentChangeEvent"
highlight-hover-row highlight-current-row>
<vxe-column field="" min-width="170"> <vxe-column field="" min-width="170">
<template #header> <template #header>
<span style="font-size: 13px;">列名</span> <span style="font-size: 13px;">列名</span>
...@@ -49,10 +55,13 @@ ...@@ -49,10 +55,13 @@
</template> </template>
<template v-slot="{ row }"> <template v-slot="{ row }">
<div style="display: flex;flex-direction: column;" v-if="row.xpath !== ''"> <div style="display: flex;flex-direction: column;" v-if="row.xpath !== ''">
<el-select style="height: 28px;" v-model="row.type" placeholder="选择值类型" v-if="row.typeOptions.length > 1" :popper-append-to-body="false" filterable remote> <el-select style="height: 28px;" v-model="row.type" placeholder="选择值类型"
<el-option v-for="num in row.typeOptions" :key="num.xpath" :value="num.label" :label="num.value"></el-option> v-if="row.typeOptions.length > 1" :popper-append-to-body="false" filterable remote>
<el-option v-for="num in row.typeOptions" :key="num.xpath" :value="num.label"
:label="num.value"></el-option>
</el-select> </el-select>
<vxe-input style="width: 100% !important;" v-model="row.type" :placeholder="row.typeOptions[0].value" size="mini" v-else disabled></vxe-input> <vxe-input style="width: 100% !important;" v-model="row.type"
:placeholder="row.typeOptions[0].value" size="mini" v-else disabled></vxe-input>
</div> </div>
</template> </template>
</vxe-column> </vxe-column>
...@@ -61,15 +70,23 @@ ...@@ -61,15 +70,23 @@
<span style="font-size: 13px;">操作</span> <span style="font-size: 13px;">操作</span>
</template> </template>
<template #default="{ row }"> <template #default="{ row }">
<!-- <el-tooltip class="item" effect="dark" content="删除" placement="top"> -->
<img style="width: 38px;height: 28px;vertical-align: bottom;cursor: pointer;" src="../assets/close.svg" @click.stop="columnDelete(row)" v-if="row.xpath !== ''"> <img style="width: 38px;height: 28px;vertical-align: bottom;cursor: pointer;"
<img style="width: 37px;height: 24px;vertical-align: bottom;cursor: pointer;" src="../assets/addTable.svg" @click.stop="selectElement" v-else> src="../assets/close.svg" @click.stop="columnDelete(row)" v-if="row.xpath !== ''">
<!-- </el-tooltip> --> <template v-else>
<el-tooltip class="item" effect="dark" content="点击按钮,右击页面元素添加数据" placement="top">
<img style="width: 24px;height: 24px;vertical-align: bottom;cursor: pointer;background-color: transparent;"
src="../assets/addTable.svg" @click.stop="selectElement">
</el-tooltip>
</template>
</template> </template>
</vxe-column> </vxe-column>
</vxe-table> </vxe-table>
<vxe-table :data="tableData" ref="xTable" border class="mytable-scrollbar" height="220" v-else> <vxe-table :data="tableData" ref="xTable" border class="mytable-scrollbar" height="220" v-else>
<vxe-table-column show-overflow="ellipsis" v-for="(config, index) in tableColumn" :key="index" v-bind="config"></vxe-table-column> <vxe-table-column show-overflow="ellipsis" v-for="(config, index) in tableColumn" :key="index"
v-bind="config"></vxe-table-column>
</vxe-table> </vxe-table>
</div> </div>
...@@ -287,8 +304,8 @@ export default { ...@@ -287,8 +304,8 @@ export default {
window.currentlyHighlighted = event.target; window.currentlyHighlighted = event.target;
_this.selectTable = false; _this.selectTable = false;
// 移除事件监听器 // 移除事件监听器
// document.removeEventListener('contextmenu', contextMenuHandler); document.removeEventListener('contextmenu', this.contextMenuHandler);
// _this.contextMenuListenerAdded = false; _this.contextMenuListenerAdded = false;
}, },
// 选择元素按钮调用 // 选择元素按钮调用
selectElement () { selectElement () {
...@@ -426,5 +443,4 @@ export default { ...@@ -426,5 +443,4 @@ export default {
.vxe-table--filter-wrapper .vxe-input>.vxe-input--inner, .vxe-table--filter-wrapper .vxe-input>.vxe-input--inner,
.vxe-table--filter-wrapper .vxe-textarea>.vxe-textarea--inner { .vxe-table--filter-wrapper .vxe-textarea>.vxe-textarea--inner {
width: 145px !important; width: 145px !important;
} }</style>
</style> \ No newline at end of file
\ No newline at end of file
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