diff --git a/src/components/IPTV.vue b/src/components/IPTV.vue index c4d5ee5..4447d70 100644 --- a/src/components/IPTV.vue +++ b/src/components/IPTV.vue @@ -9,9 +9,10 @@
- + - 保存 + 保存分组 + 频道合并 删除
@@ -121,7 +122,7 @@ export default { searchTxt: '', searchRecordList: [], enableBatchEdit: false, - batchGroupName: '', + inputContent: '', batchIsActive: true, shiftDown: false, selectionBegin: '', @@ -237,13 +238,28 @@ export default { }, saveBatchEdit () { this.multipleSelection.forEach(ele => { - if (this.batchGroupName) { - ele.group = this.batchGroupName + if (this.inputContent) { + ele.group = this.inputContent } ele.isActive = this.batchIsActive }) this.updateDatabase() }, + mergeChannel () { + if (this.inputContent && this.multipleSelection.length) { + var channels = [] + const id = this.multipleSelection[0].id + this.multipleSelection.forEach(ele => { + channels = channels.concat(ele.channels) + channels.forEach(e => { e.channelID = id }) + channelList.remove(ele.id) + }) + const mergeChannel = { id: id, name: this.inputContent, isActive: channels.some(c => c.isActive), group: this.determineGroup(this.inputContent), hasChildren: channels.length > 1, channels: channels } + channelList.add(mergeChannel) + this.getChannelList() + this.updateDatabase() + } + }, playEvent (e) { // 下一步与Play联动prefer if (e.id <= this.iptvList.length) { this.video = { iptv: e } @@ -484,10 +500,10 @@ export default { } }, syncTableData () { - if (this.$refs.iptvTable.tableData) { + if (this.$refs.iptvTable.tableData && this.$refs.iptvTable.tableData.length === this.channelList.length) { this.channelList = this.$refs.iptvTable.tableData - this.getIptvList() } + this.getIptvList() }, updateDatabase () { this.syncTableData()