|
|
@@ -21,6 +21,8 @@
|
|
|
ref="table"
|
|
|
:key="active"
|
|
|
:schema="schema"
|
|
|
+ @row-click="onToggleSelection"
|
|
|
+ @selection-change="onSelectionChange"
|
|
|
/>
|
|
|
<streaming-media-dialog
|
|
|
ref="addDialog"
|
|
|
@@ -45,7 +47,8 @@ import {
|
|
|
import {
|
|
|
getAssetsWithDel,
|
|
|
updateAsset,
|
|
|
- deleteAsset
|
|
|
+ deleteAsset,
|
|
|
+ deleteAssets
|
|
|
} from '@/api/asset'
|
|
|
import StreamingMediaDialog from './components/StreamingMediaDialog.vue'
|
|
|
|
|
|
@@ -71,7 +74,8 @@ export default {
|
|
|
|
|
|
return {
|
|
|
buttons: [
|
|
|
- { type: 'add', label: `新增${AssetTypeInfo[AssetType.STREAMING_MEDIA]}`, on: this.addStreamingMedia }
|
|
|
+ { type: 'add', label: `新增${AssetTypeInfo[AssetType.STREAMING_MEDIA]}`, on: this.addStreamingMedia },
|
|
|
+ { type: 'del', on: this.onBatchDel }
|
|
|
],
|
|
|
condition: { status: active, ...this.$condition },
|
|
|
list: getAssetsWithDel,
|
|
|
@@ -95,6 +99,7 @@ export default {
|
|
|
{ key: 'originalName', type: 'search', placeholder: '资源名称' }
|
|
|
],
|
|
|
cols: [
|
|
|
+ { type: 'selection', selectable: row => row.del },
|
|
|
{ prop: 'tagInfo', type: 'refresh', width: 80 },
|
|
|
{ prop: 'typeName', label: '资源', align: 'center', width: 80 },
|
|
|
{ prop: 'file', label: '', type: 'asset', on: this.onView },
|
|
|
@@ -133,6 +138,7 @@ export default {
|
|
|
const { tag, type, originalName } = this.$refs.table.getCondition()
|
|
|
this.$condition = { tag, type, originalName }
|
|
|
this.active = active
|
|
|
+ this.$selectionItems = null
|
|
|
}
|
|
|
},
|
|
|
transform (asset) {
|
|
|
@@ -187,6 +193,25 @@ export default {
|
|
|
if (Number(this.active) === State.AVAILABLE_ASSET) {
|
|
|
this.$refs.table.resetCondition(streamingMedia)
|
|
|
}
|
|
|
+ },
|
|
|
+ onBatchDel () {
|
|
|
+ if (this.$selectionItems?.length) {
|
|
|
+ deleteAssets(this.$selectionItems.map(({ keyName }) => keyName)).then(() => {
|
|
|
+ this.$refs.table.decrease(this.$selectionItems.length)
|
|
|
+ this.$selectionItems = null
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: '请先选择需要删除的资源'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onToggleSelection (row) {
|
|
|
+ this.$refs.table.getInst().toggleRowSelection(row)
|
|
|
+ },
|
|
|
+ onSelectionChange (val) {
|
|
|
+ this.$selectionItems = val
|
|
|
}
|
|
|
}
|
|
|
}
|