Files
2026-09-08 19:49:21 +08:00

122 lines
4.6 KiB
HTML

<!--#
layout("/layouts/platform.html"){
#-->
<div id="app" v-cloak>
<guava ref="guava">
<el-card shadow="never" class="mt10">
<table-tool label="统计" :app="this"></table-tool>
<el-table :data="tableData" :size="tableSize" style="width: 100%">
<el-table-column type="index" label="序号" width="80px"></el-table-column>
<el-table-column
align="center"
header-align="center"
v-for="column in tableColumns"
show-overflow-tooltip
:label="column.label"
:prop="column.prop"
:sortable="column.sortable"
>
<template v-if="column.prop==='sumDuration'" scope="{row}">
{{(row.sumDuration / 60 / 60).toFixed(2) + 'h'}}
</template>
</el-table-column>
<el-table-column align="center" header-align="center" label="操作" width="200">
<template scope="{row}">
<el-button size="small" type="primary" @click="openView(row)">查看具体学习情况</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
<template #view>
<el-table :data="viewTableData" stripe border style="width: 100%">
<el-table-column type="index" label="序号" width="80px">
<template scope="scope">
<span>{{ scope.$index + (viewPageForm.pageNumber - 1) * viewPageForm.pageSize + 1 }} </span>
</template>
</el-table-column>
<el-table-column
align="center"
header-align="center"
v-for="column in viewTableColumns"
show-overflow-tooltip
:label="column.label"
:prop="column.prop"
:sortable="column.sortable"
>
<template v-if="column.prop==='studyDuration'" scope="{row}">
{{(row.studyDuration / 60 / 60).toFixed(2) + 'h'}}
</template>
</el-table-column>
</el-table>
<el-row class="el-pagination-container" style="margin-bottom: 0px">
<el-pagination
@current-change="(val)=>{viewPageForm.pageNumber=val;viewPageData()}"
:current-page="viewPageForm.pageNumber"
:page-size="viewPageForm.pageSize"
layout="total, sizes, prev, pager, next"
:total="viewPageForm.totalCount">
</el-pagination>
</el-row>
</template>
</guava>
</div>
<script>
var vue = new Vue({
el: '#app',
mixins: [initTableMixins],
data() {
return {
tableColumns: [
{prop: 'title', label: '专辑名称'},
{prop: 'typeName', label: '类型'},
{prop: 'studyNum', label: '已看人数', sortable: true},
{prop: 'sumDuration', label: '课程总时长', sortable: true},
],
viewTableColumns: [
{prop: 'username', label: '姓名'},
{prop: 'loginname', label: '工号'},
{prop: 'unitname', label: '单位'},
{prop: 'unionname', label: '分工会'},
{prop: 'studyDuration', label: '观看总时长'},
],
viewPageForm: {
pageNumber: 1,
pageSize: 10,
totalCount: 0,
albumId: null
},
viewTableData: []
}
},
methods: {
async openView(row) {
this.viewPageForm.albumId = row.id
this.$refs['guava'].view()
await this.viewPageData()
},
async viewPageData() {
const resp = await $.post(loc() + '/getWatchDuration', this.viewPageForm)
if (resp.code === 0) {
this.viewTableData = resp.data.list
this.viewPageForm.totalCount = resp.data.totalCount
}
},
viewPageNumberChange(val) {
}
},
created() {
this.pageData()
}
})
</script>
<!--#
}
#-->