|
|
@@ -222,6 +222,7 @@ export default {
|
|
|
},
|
|
|
selectedList: {
|
|
|
handler(val) {
|
|
|
+ console.log(val)
|
|
|
this.$emit('selected', this.selectedList)
|
|
|
},
|
|
|
immediate: true
|
|
|
@@ -256,24 +257,30 @@ export default {
|
|
|
return
|
|
|
}
|
|
|
// filePicker 文件选择
|
|
|
- if (this.selectedList.length === this.max) {
|
|
|
+ if (this.showMenu === false && this.selectedList.length === this.max) {
|
|
|
this.$message.error('可选择文件数量最大为' + this.max)
|
|
|
return
|
|
|
}
|
|
|
- // 点击的内容为文件
|
|
|
- if (row.type === 1 && this.showCheckBox === false) {
|
|
|
- return
|
|
|
- }
|
|
|
- this.$emit('row-click', row)
|
|
|
- if (row.checked) {
|
|
|
- const tmps = this.data.filter(ele => ele.checked)
|
|
|
- tmps.forEach(ele => {
|
|
|
- if (this.selectedList.findIndex(sub => sub.id === ele.id) === -1) {
|
|
|
- this.selectedList.push(ele)
|
|
|
- }
|
|
|
- })
|
|
|
+ // 未显示选择按钮的情况下,点击调用row-click
|
|
|
+ if (this.showCheckBox === false) {
|
|
|
+ this.$emit('row-click', row)
|
|
|
} else {
|
|
|
- this.selectedList = this.selectedList.filter(ele => ele.id !== row.id)
|
|
|
+ if (this.showMenu === false && row.type === 2) {
|
|
|
+ this.$emit('row-click', row)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ row.checked = !row.checked
|
|
|
+ if (row.checked) {
|
|
|
+ const tmps = this.data.filter(ele => ele.checked)
|
|
|
+ tmps.forEach(ele => {
|
|
|
+ if (this.selectedList.findIndex(sub => sub.id === ele.id) === -1) {
|
|
|
+ this.selectedList.push(ele)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.selectedList = this.selectedList.filter(ele => ele.id !== row.id)
|
|
|
+ }
|
|
|
+ this.selectedList = this.selectedList.filter(ele => ele.checked)
|
|
|
}
|
|
|
},
|
|
|
/**
|