//搜索输入框
<el-input @input="searchFeildtable"
v-model="searchFeild"
placeholder="搜索字段"></el-input>
//表格
<el-table ref="multipleTable"
:data="tableFeildCopy"
:select-on-indeterminate="true"
row-key="key"
@selection-change="handleSelectionChange"
@select="handleSelect"
@row-click="handleRowClick">
<el-table-column type="selection"
align="center" />
<el-table-column prop="fieldName"
label="字段名称">
</el-table-column>
<el-table-column prop="sourceColumnCname"
label="字段注释">
</el-table-column>
<el-table-column prop="tableName"
label="表名">
</el-table-column>
<el-table-column prop="sourceTableCname"
label="表注释">
</el-table-column>
</el-table>
handleSelectionChange函数是 校验勾选中有字段重复的函数
handleSelect 赋值给勾选数组
handleRowClick 点击行勾选当前行
handleSelectionChange(value) {
// this.checkList ={}
this.repetitionList = arrayFn.repetitionArray(this.checkTableList, 'fieldName')
// console.log(this.checkList, 'value')
// this.checkList = value
},
handleSelect(value) {
this.checkTableList = value
},
// 选中字段表格
handleRowClick(row, column, event) {
console.log(row)
if (this.checkTableList.findIndex((ele) => ele.key == row.key) != -1) {
this.$refs.multipleTable.toggleRowSelection(row, false)
arrayFn.deleteArray(
this.checkTableList,
this.checkTableList.findIndex((ele) => ele.key == row.key)
)
} else {
this.checkTableList.push(row)
this.$refs.multipleTable.toggleRowSelection(row, true)
}
console.log(this.checkTableList)
},