|
|
@@ -19,33 +19,137 @@
|
|
|
:schema="schema"
|
|
|
/>
|
|
|
<preview-dialog ref="previewDialog" />
|
|
|
+ <confirm-dialog
|
|
|
+ ref="schedulingOptionsDialog"
|
|
|
+ title="资源日期"
|
|
|
+ @confirm="onConfirm"
|
|
|
+ >
|
|
|
+ <div class="c-grid-form auto u-align-self--center">
|
|
|
+ <div class="c-grid-form__label">
|
|
|
+ 资源日期
|
|
|
+ </div>
|
|
|
+ <el-date-picker
|
|
|
+ v-model="dateRange"
|
|
|
+ type="daterange"
|
|
|
+ range-separator="至"
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </confirm-dialog>
|
|
|
+ <confirm-dialog
|
|
|
+ ref="moveDataDialog"
|
|
|
+ title="资源移动"
|
|
|
+ @confirm="onAsstesMove"
|
|
|
+ >
|
|
|
+ <template #default>
|
|
|
+ <el-tree
|
|
|
+ class="el-tree--highlight-current"
|
|
|
+ :data="treeData"
|
|
|
+ :props="treeProps"
|
|
|
+ default-expand-all
|
|
|
+ @node-click="handleNodeClick"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+ </confirm-dialog>
|
|
|
+ <c-dialog
|
|
|
+ ref="chartOptionsDialog"
|
|
|
+ :title="dialogTitle"
|
|
|
+ >
|
|
|
+ <template #default>
|
|
|
+ <div class="c-grid-form auto u-align-self--center">
|
|
|
+ <div class="c-grid-form__label">
|
|
|
+ 播放日期
|
|
|
+ </div>
|
|
|
+ <el-date-picker
|
|
|
+ v-model="dateRange"
|
|
|
+ type="datetimerange"
|
|
|
+ range-separator="至"
|
|
|
+ start-placeholder="开始日期"
|
|
|
+ end-placeholder="结束日期"
|
|
|
+ :default-time="['00:00:00', '23:59:59']"
|
|
|
+ @change="fetchData"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <line-chart :data="chartData" />
|
|
|
+ </template>
|
|
|
+ </c-dialog>
|
|
|
+ <table-dialog
|
|
|
+ ref="mediaDialog"
|
|
|
+ title="转码进度"
|
|
|
+ size="lg"
|
|
|
+ :schema="mediaSchema"
|
|
|
+ />
|
|
|
+ <confirm-dialog
|
|
|
+ ref="bitRateDialog"
|
|
|
+ title="码率"
|
|
|
+ @confirm="onBitrateConfirm"
|
|
|
+ >
|
|
|
+ <div class="c-grid-form u-align-self--center">
|
|
|
+ <span class="c-grid-form__label u-required">
|
|
|
+ 目标码率
|
|
|
+ </span>
|
|
|
+ <div
|
|
|
+ class="has-info"
|
|
|
+ data-info="仅可输入3000~14000的正整数"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model.trim="bitrate"
|
|
|
+ placeholder="请输入码率"
|
|
|
+ clearable
|
|
|
+ maxlength="5"
|
|
|
+ @change="checkBitrate"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </confirm-dialog>
|
|
|
</wrapper>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import {
|
|
|
- State,
|
|
|
AssetTypeInfo,
|
|
|
AssetTagInfo,
|
|
|
AssetTag,
|
|
|
- AssetType
|
|
|
+ AssetType,
|
|
|
+ CourseTypeInfo
|
|
|
} from '@/constant'
|
|
|
import {
|
|
|
EventBus,
|
|
|
parseByte,
|
|
|
- getAIState
|
|
|
+ getAIState,
|
|
|
+ parseTime
|
|
|
} from '@/utils'
|
|
|
import {
|
|
|
getAssetsByQuery,
|
|
|
updateAsset,
|
|
|
deleteAsset,
|
|
|
- deleteAssets
|
|
|
+ deleteAssets,
|
|
|
+ resourceExport,
|
|
|
+ countByDay,
|
|
|
+ treeLocation,
|
|
|
+ secondaryTransList,
|
|
|
+ mediaList
|
|
|
} from '@/api/asset'
|
|
|
+import LineChart from './components/LineChart.vue'
|
|
|
|
|
|
export default {
|
|
|
+ components: {
|
|
|
+ LineChart
|
|
|
+ },
|
|
|
data () {
|
|
|
return {
|
|
|
- treeParams: null
|
|
|
+ bitrate: '',
|
|
|
+ keyName: '',
|
|
|
+ chartData: {},
|
|
|
+ dateRange: [],
|
|
|
+ treeParams: null,
|
|
|
+ dialogTitle: '',
|
|
|
+ treeData: [/* 数据源 */],
|
|
|
+ treeProps: {
|
|
|
+ label: 'name',
|
|
|
+ children: 'childrenNode'
|
|
|
+ },
|
|
|
+ selectedData: []
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -59,13 +163,15 @@ export default {
|
|
|
'row-click': this.onToggleSelection,
|
|
|
'selection-change': this.onSelectionChange
|
|
|
},
|
|
|
- autoRefreshEachPage: true,
|
|
|
- refreshInterval: 30000,
|
|
|
list: this.getAssetsByQuery,
|
|
|
transform: this.transformAsset,
|
|
|
buttons: [
|
|
|
{ type: 'add', label: '上传', on: this.onUpload },
|
|
|
- { type: 'del', on: this.onBatchDel }
|
|
|
+ { type: 'del', on: this.onBatchDel },
|
|
|
+ { label: '移动', icon: 'el-icon-rank', on: this.onMove },
|
|
|
+ { label: '曝光率导出', on: this.onExport },
|
|
|
+ { label: '二次转码', on: this.onSecondaryTranscod },
|
|
|
+ { label: '转码进度', on: this.onProgressBar }
|
|
|
],
|
|
|
filters: [
|
|
|
{ key: 'tag', type: 'select', placeholder: '资源分类', options: [
|
|
|
@@ -86,7 +192,7 @@ export default {
|
|
|
{ type: 'refresh' }
|
|
|
],
|
|
|
cols: [
|
|
|
- { type: 'selection', selectable: this.canDel, fixed: true },
|
|
|
+ { type: 'selection', fixed: true },
|
|
|
{ prop: 'tagInfo', label: '分类', width: 72, 'align': 'center', fixed: true },
|
|
|
{ prop: 'typeInfo', label: '资源', width: 72, 'align': 'center', fixed: true },
|
|
|
{ prop: 'file', label: '', type: 'asset', on: this.onView, fixed: true },
|
|
|
@@ -97,15 +203,42 @@ export default {
|
|
|
on: { edit: val => this.onEdit(data, val) }
|
|
|
}), 'class-name': 'c-edit-column', 'min-width': 120, fixed: true },
|
|
|
{ prop: 'ai', label: 'AI审核', type: 'tag' },
|
|
|
- // { prop: 'statusTag', type: 'tag' },
|
|
|
{ prop: 'size', label: '资源大小', 'align': 'right' },
|
|
|
{ prop: 'diff', label: '其他', 'align': 'right' },
|
|
|
{ prop: 'userName', label: '上传人', 'align': 'right' },
|
|
|
{ prop: 'createTime', label: '上传时间', width: 140, 'align': 'right' },
|
|
|
{ type: 'invoke', render: [
|
|
|
- { label: '查看', allow: ({ file }) => !!file, on: this.onView },
|
|
|
- { label: '删除', allow: this.canDel, on: this.onDel }
|
|
|
- ], width: 100, fixed: 'right' }
|
|
|
+ { label: '图表', allow: this.isReady, on: this.onChart },
|
|
|
+ { label: '查看', allow: this.isReady, on: this.onView },
|
|
|
+ { label: '删除', on: this.onDel }
|
|
|
+ ], width: 140, fixed: 'right' }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mediaSchema () {
|
|
|
+ return {
|
|
|
+ autoRefreshEachPage: true,
|
|
|
+ refreshInterval: 30000,
|
|
|
+ list: mediaList,
|
|
|
+ filters: [
|
|
|
+ { key: 'originalName', type: 'search', placeholder: '资源名称' },
|
|
|
+ { type: 'refresh' }
|
|
|
+ ],
|
|
|
+ cols: [
|
|
|
+ { type: 'refresh' },
|
|
|
+ { prop: 'originalName', label: '素材名称', 'align': 'center' },
|
|
|
+ { label: '类型', 'align': 'center', render: ({ taskType }) => CourseTypeInfo[taskType] },
|
|
|
+ {
|
|
|
+ label: '执行结果', type: 'tag', render: ({ taskStatus }) => {
|
|
|
+ return {
|
|
|
+ type: ['', 'info', ' ', 'success', 'danger', 'warning'][taskStatus],
|
|
|
+ label: ['', '执行中', '等待中', '成功', '失败', '取消'][taskStatus]
|
|
|
+ }
|
|
|
+ }, width: 160
|
|
|
+ },
|
|
|
+ { prop: 'departmentName', label: '部门名', 'align': 'center' },
|
|
|
+ { prop: 'username', label: '用户名', 'align': 'center' },
|
|
|
+ { prop: 'createTime', label: '上传时间', 'align': 'center' }
|
|
|
]
|
|
|
}
|
|
|
}
|
|
|
@@ -117,13 +250,108 @@ export default {
|
|
|
EventBus.$off('directory-refresh', this.onDirectoryRefresh)
|
|
|
},
|
|
|
methods: {
|
|
|
+ isReady ({ file }) {
|
|
|
+ return !!file
|
|
|
+ },
|
|
|
+ checkBitrate () {
|
|
|
+ if (!/^\d+$/.test(this.bitrate) || this.bitrate < 3000 || this.bitrate > 14000) {
|
|
|
+ this.bitrate = ''
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onSecondaryTranscod () {
|
|
|
+ if (this.$selectionItems?.length) {
|
|
|
+ this.$refs.bitRateDialog.show()
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: '请先选择需要转码的资源'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onBitrateConfirm (done) {
|
|
|
+ if (this.bitrate === '') {
|
|
|
+ this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: '请填写码率'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.$progressObj = this.$selectionItems.map(item => {
|
|
|
+ return {
|
|
|
+ keyName: item.keyName,
|
|
|
+ originalName: item.originalName,
|
|
|
+ tenant: item.tenant,
|
|
|
+ org: item.org,
|
|
|
+ type: item.type,
|
|
|
+ taskType: item.type,
|
|
|
+ extraAttributes: this.bitrate
|
|
|
+ }
|
|
|
+ })
|
|
|
+ secondaryTransList(this.$progressObj).then(() => {
|
|
|
+ done()
|
|
|
+ this.bitrate = ''
|
|
|
+ this.$refs.mediaDialog.show()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ onProgressBar () {
|
|
|
+ this.$refs.mediaDialog.show()
|
|
|
+ },
|
|
|
onDirectoryRefresh (directoryOption) {
|
|
|
if (this.$directoryOption?.group?.path && directoryOption.group.path) {
|
|
|
this.$refs.tree?.refresh()
|
|
|
}
|
|
|
},
|
|
|
- canDel ({ status }) {
|
|
|
- return status !== State.DRAFT
|
|
|
+ onMove () {
|
|
|
+ if (this.$selectionItems?.length) {
|
|
|
+ this.treeData = this.$refs.tree.directories
|
|
|
+ this.$refs.moveDataDialog.show()
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: '请先选择需要移动的资源'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ extractNodes (data, nodes = []) {
|
|
|
+ for (const node of data) {
|
|
|
+ nodes.push(node)
|
|
|
+ if (node.childrenNode && node.childrenNode.length > 0) {
|
|
|
+ this.extractNodes(node.childrenNode, nodes)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return nodes
|
|
|
+ },
|
|
|
+ transformDataToTransferFormat (data) {
|
|
|
+ const transformedData = []
|
|
|
+ for (const node of data) {
|
|
|
+ const newNode = {
|
|
|
+ key: node.id,
|
|
|
+ label: node.name,
|
|
|
+ disabled: false
|
|
|
+ }
|
|
|
+ if (node.childrenNode && node.childrenNode.length > 0) {
|
|
|
+ newNode.children = this.transformDataToTransferFormat(node.childrenNode)
|
|
|
+ }
|
|
|
+ transformedData.push(newNode)
|
|
|
+ }
|
|
|
+ return transformedData
|
|
|
+ },
|
|
|
+ handleNodeClick (data) {
|
|
|
+ this.selectedData = data
|
|
|
+ },
|
|
|
+ onAsstesMove (done) {
|
|
|
+ const asstes = {
|
|
|
+ keyNameList: this.$selectionItems.map(item => item.keyName),
|
|
|
+ newTreeId: this.selectedData.id
|
|
|
+ }
|
|
|
+ treeLocation(asstes).then(() => {
|
|
|
+ done()
|
|
|
+ this.$refs.tree?.refresh()
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: '移动成功'
|
|
|
+ })
|
|
|
+ })
|
|
|
},
|
|
|
onDirectoryChanged (directory) {
|
|
|
this.$directoryOption = directory
|
|
|
@@ -146,41 +374,8 @@ export default {
|
|
|
asset.typeInfo = AssetTypeInfo[asset.type]
|
|
|
asset.size = parseByte(asset.size)
|
|
|
asset.ai = getAIState(asset)
|
|
|
- // asset.statusTag = this.getStatusTag(asset)
|
|
|
return asset
|
|
|
},
|
|
|
- getStatusTag ({ status, remark }) {
|
|
|
- switch (status) {
|
|
|
- case State.DRAFT:
|
|
|
- return {
|
|
|
- type: 'info',
|
|
|
- label: '解析中'
|
|
|
- }
|
|
|
- case State.READY:
|
|
|
- return {
|
|
|
- type: 'primary',
|
|
|
- label: '待使用'
|
|
|
- }
|
|
|
- case State.SUBMITTED:
|
|
|
- return {
|
|
|
- type: 'warning',
|
|
|
- label: '待审核'
|
|
|
- }
|
|
|
- case State.RESOLVED:
|
|
|
- return {
|
|
|
- type: 'success',
|
|
|
- label: '通过'
|
|
|
- }
|
|
|
- case State.REJECTED:
|
|
|
- return {
|
|
|
- type: 'danger',
|
|
|
- label: '驳回',
|
|
|
- msg: remark
|
|
|
- }
|
|
|
- default:
|
|
|
- return null
|
|
|
- }
|
|
|
- },
|
|
|
onView ({ file }) {
|
|
|
this.$refs.previewDialog.show(file)
|
|
|
},
|
|
|
@@ -222,11 +417,53 @@ export default {
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
- onToggleSelection (row) {
|
|
|
- if (row.status !== State.DRAFT) {
|
|
|
- this.$refs.table.getInst().toggleRowSelection(row)
|
|
|
+ onExport () {
|
|
|
+ if (this.$selectionItems?.length) {
|
|
|
+ const date = parseTime(new Date(), '{y}-{m}-{d}')
|
|
|
+ this.dateRange = [date, date]
|
|
|
+ this.$refs.schedulingOptionsDialog.show()
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: '请先选择导出的资源'
|
|
|
+ })
|
|
|
}
|
|
|
},
|
|
|
+ async onChart ({ keyName, originalName }) {
|
|
|
+ this.dialogTitle = `${originalName}-播放统计`
|
|
|
+ this.keyName = keyName
|
|
|
+ const currentDate = new Date()
|
|
|
+ const startDate = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate(), 0, 0, 0)
|
|
|
+ const formattedStartDate = parseTime(startDate, '{y}-{m}-{d} {h}:{i}:{s}')
|
|
|
+ const formattedEndDate = parseTime(currentDate, '{y}-{m}-{d} {h}:{i}:{s}')
|
|
|
+ this.dateRange = [formattedStartDate, formattedEndDate]
|
|
|
+ await this.updateChartData()
|
|
|
+ this.$refs.chartOptionsDialog.show()
|
|
|
+ },
|
|
|
+ fetchData () {
|
|
|
+ this.updateChartData()
|
|
|
+ },
|
|
|
+ async updateChartData () {
|
|
|
+ const startTime = parseTime(this.dateRange[0], '{y}-{m}-{d} {h}:{i}:{s}')
|
|
|
+ const endTime = parseTime(this.dateRange[1], '{y}-{m}-{d} {h}:{i}:{s}')
|
|
|
+
|
|
|
+ try {
|
|
|
+ const { data } = await countByDay({ keyName: this.keyName, startTime, endTime })
|
|
|
+ this.chartData = data
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onConfirm (done) {
|
|
|
+ resourceExport({
|
|
|
+ keyNameList: this.$selectionItems.map(({ keyName }) => keyName),
|
|
|
+ startDate: this.dateRange[0],
|
|
|
+ endDate: this.dateRange[1]
|
|
|
+ }).then(done)
|
|
|
+ },
|
|
|
+ onToggleSelection (row) {
|
|
|
+ this.$refs.table.getInst().toggleRowSelection(row)
|
|
|
+ },
|
|
|
onSelectionChange (val) {
|
|
|
this.$selectionItems = val
|
|
|
},
|
|
|
@@ -236,3 +473,4 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
+
|