处理取消行选择仍可以删除信息的问题
This commit is contained in:
parent
2a6ff43f0b
commit
ab4961b3a4
|
@ -72,19 +72,20 @@ export default {
|
|||
class: this.innerSelectedRowKeys.includes(key) ? 'ant-table-row-selected' : '',
|
||||
on: {
|
||||
click: () => {
|
||||
this.$emit("rowClick",record)
|
||||
if(!this.canSelect) {
|
||||
return
|
||||
}
|
||||
if (this.innerSelectedRowKeys.includes(key)) {
|
||||
const findIndex = this.innerSelectedRowKeys.findIndex(k => k == key)
|
||||
this.innerSelectedRowKeys.splice(findIndex, 1)
|
||||
this.innerSelectedRowKeys.splice(findIndex, 1)
|
||||
this.$emit("cancleRowClick")
|
||||
} else {
|
||||
if(this.multiple) {
|
||||
this.innerSelectedRowKeys.push(key)
|
||||
}
|
||||
else {
|
||||
this.innerSelectedRowKeys = [key]
|
||||
this.$emit("selectRowClick",record)
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -38,7 +38,8 @@
|
|||
:list="dataSource"
|
||||
:loading="loading"
|
||||
:pagination="false"
|
||||
@rowClick="onRowClick"
|
||||
@selectRowClick="selectRow"
|
||||
@cancleRowClick="cancelRow"
|
||||
@rowDbclick="onRowDbclick"
|
||||
>
|
||||
<template slot="status" slot-scope="{record}">
|
||||
|
@ -346,9 +347,12 @@ export default {
|
|||
this.$message.info("Please select a piece of data")
|
||||
}
|
||||
},
|
||||
onRowClick(record) {
|
||||
selectRow(record) {
|
||||
this.currentId = record.id
|
||||
},
|
||||
cancelRow() {
|
||||
this.currentId = ""
|
||||
},
|
||||
onSave() {
|
||||
this.form.validateFields((err, values) => {
|
||||
if (!err) {
|
||||
|
|
|
@ -38,7 +38,8 @@
|
|||
:list="dataSource"
|
||||
:loading="loading"
|
||||
:pagination="false"
|
||||
@rowClick="onRowClick"
|
||||
@selectRowClick="selectRow"
|
||||
@cancleRowClick="cancelRow"
|
||||
@rowDbclick="onRowDbclick"
|
||||
>
|
||||
<template slot="status" slot-scope="{record}">
|
||||
|
@ -368,10 +369,12 @@ export default {
|
|||
this.$message.info("Please select a piece of data")
|
||||
}
|
||||
},
|
||||
onRowClick(record) {
|
||||
console.log(record);
|
||||
selectRow(record) {
|
||||
this.currentId = record.id
|
||||
},
|
||||
cancelRow() {
|
||||
this.currentId = ""
|
||||
},
|
||||
onSave() {
|
||||
this.form.validateFields((err, values) => {
|
||||
if (!err) {
|
||||
|
|
|
@ -38,7 +38,8 @@
|
|||
:list="dataSource"
|
||||
:pagination="false"
|
||||
:loading="loading"
|
||||
@rowClick="onRowClick"
|
||||
@selectRowClick="selectRow"
|
||||
@cancleRowClick="cancelRow"
|
||||
@rowDbclick="onRowDbclick"
|
||||
>
|
||||
<template slot="status" slot-scope="{text,record}">
|
||||
|
@ -280,9 +281,12 @@ export default {
|
|||
this.$message.info("Please select a piece of data")
|
||||
}
|
||||
},
|
||||
onRowClick(record) {
|
||||
selectRow(record) {
|
||||
this.currentId = record.id
|
||||
},
|
||||
cancelRow() {
|
||||
this.currentId = ""
|
||||
},
|
||||
onSave() {
|
||||
this.form.validateFields((err, values) => {
|
||||
if (!err) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user