2022-04-12 18:00:01 +08:00
|
|
|
<template>
|
|
|
|
|
<el-table
|
|
|
|
|
id="userTable"
|
|
|
|
|
ref="dataTable"
|
|
|
|
|
:data="tableData"
|
|
|
|
|
:height="height"
|
|
|
|
|
border
|
|
|
|
|
@header-dragend="dragend"
|
|
|
|
|
@sort-change="tableDataSort"
|
|
|
|
|
@selection-change="selectionChange"
|
|
|
|
|
>
|
|
|
|
|
<el-table-column
|
|
|
|
|
:resizable="false"
|
|
|
|
|
align="center"
|
|
|
|
|
type="selection"
|
|
|
|
|
width="55">
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column
|
|
|
|
|
v-for="(item, index) in customTableTitles"
|
|
|
|
|
:key="`col-${index}`"
|
|
|
|
|
:fixed="item.fixed"
|
|
|
|
|
:label="item.label"
|
|
|
|
|
:min-width="`${item.minWidth}`"
|
|
|
|
|
:prop="item.prop"
|
|
|
|
|
:resizable="true"
|
|
|
|
|
:sort-orders="['ascending', 'descending']"
|
|
|
|
|
:sortable="item.sortable"
|
|
|
|
|
:width="`${item.width}`"
|
|
|
|
|
>
|
|
|
|
|
<template #header>
|
|
|
|
|
<span class="data-column__span">{{item.label}}</span>
|
|
|
|
|
<div class="col-resize-area"></div>
|
|
|
|
|
</template>
|
|
|
|
|
<template #default="scope" :column="item">
|
|
|
|
|
<span v-if="item.prop === 'dataRange'">
|
|
|
|
|
<template v-if="scope.row.startTime && scope.row.endTime">
|
|
|
|
|
{{scope.row.startTime}}-{{scope.row.endTime}}
|
|
|
|
|
</template>
|
|
|
|
|
</span>
|
2022-04-19 13:11:26 +08:00
|
|
|
<span v-else-if="item.prop === 'type'">
|
2022-04-13 18:31:13 +08:00
|
|
|
{{scope.row.reportTemp.name}}
|
|
|
|
|
</span>
|
2022-04-19 13:11:26 +08:00
|
|
|
<span v-else-if="item.prop === 'state'">
|
|
|
|
|
{{getJobStatus(scope.row.state)}}
|
|
|
|
|
</span>
|
2022-04-12 18:00:01 +08:00
|
|
|
<span v-else>{{scope.row[item.prop]}}</span>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column
|
|
|
|
|
:resizable="false"
|
|
|
|
|
:width="operationWidth"
|
|
|
|
|
fixed="right">
|
|
|
|
|
<template #header>
|
|
|
|
|
<div class="table-operation-title">{{$t('overall.option')}}</div>
|
|
|
|
|
</template>
|
|
|
|
|
<template #default="scope">
|
2022-04-19 13:11:26 +08:00
|
|
|
<div class="table-operation-items" v-if="scope.row.state === 1">
|
2022-04-15 14:59:53 +08:00
|
|
|
<div class="table-operation-item--down" @click="tableOperation(['download', scope.row, 1])">
|
|
|
|
|
<loading :loading="loadingTableId === scope.row.id"></loading>
|
|
|
|
|
<svg class="icon" aria-hidden="true" :class="{'table-operation-all-loading': loadingTableId}">
|
2022-04-14 11:59:37 +08:00
|
|
|
<use xlink:href="#cn-icon-download2"></use>
|
|
|
|
|
</svg>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="table-operation-item--preview" @click="tableOperation(['preview', scope.row])">
|
2022-04-15 14:59:53 +08:00
|
|
|
<loading :loading="loadingPreviewId === scope.row.id"></loading>
|
|
|
|
|
<svg class="icon" aria-hidden="true" :class="{'table-operation-all-loading': loadingPreviewId}">
|
2022-04-14 11:59:37 +08:00
|
|
|
<use xlink:href="#cn-icon-preview"></use>
|
|
|
|
|
</svg>
|
|
|
|
|
</div>
|
2022-04-12 18:00:01 +08:00
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
2022-04-12 18:02:27 +08:00
|
|
|
<div class="table-operation-all">
|
2022-04-14 15:52:07 +08:00
|
|
|
<el-checkbox v-model="checkboxAll" @change="selectAll(tableData)"></el-checkbox>
|
2022-04-12 18:02:27 +08:00
|
|
|
<div class="table-operation-all-span">
|
2022-04-12 18:00:01 +08:00
|
|
|
<span>{{ $t('overall.all') }}</span>
|
2022-04-15 14:59:53 +08:00
|
|
|
<div class="table-operation-back-down" :class="{'table-operation-all-checkbox': batchDow, 'table-operation-all-loading': loading}" @click="tableOperation(['download', this.checkboxIds, 2])">
|
2022-04-14 11:59:37 +08:00
|
|
|
<loading :loading="loading"></loading>
|
|
|
|
|
<span>{{$t('report.batchDow')}}</span>
|
|
|
|
|
</div>
|
2022-04-12 18:00:01 +08:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import table from '@/mixins/table'
|
2022-04-14 11:59:37 +08:00
|
|
|
import Loading from '@/components/common/Loading'
|
2022-04-12 18:00:01 +08:00
|
|
|
export default {
|
|
|
|
|
name: 'builtinReportTable',
|
|
|
|
|
mixins: [table],
|
2022-04-14 11:59:37 +08:00
|
|
|
components: {
|
|
|
|
|
Loading
|
2022-04-12 18:00:01 +08:00
|
|
|
},
|
|
|
|
|
data () {
|
|
|
|
|
return {
|
|
|
|
|
tableTitle: [ // 原始table列
|
|
|
|
|
{
|
|
|
|
|
label: this.$t('config.user.name'),
|
|
|
|
|
prop: 'name',
|
|
|
|
|
show: true,
|
|
|
|
|
sortable: 'custom'
|
|
|
|
|
}, {
|
|
|
|
|
label: this.$t('config.chart.remark'),
|
|
|
|
|
prop: 'remark',
|
|
|
|
|
show: true
|
|
|
|
|
}, {
|
|
|
|
|
label: this.$t('overall.type'),
|
|
|
|
|
prop: 'type',
|
|
|
|
|
show: true,
|
|
|
|
|
sortable: 'custom'
|
|
|
|
|
}, {
|
|
|
|
|
label: this.$t('report.dataRange'),
|
|
|
|
|
prop: 'dataRange',
|
2022-04-14 13:52:58 +08:00
|
|
|
show: true,
|
|
|
|
|
minWidth: 110
|
2022-04-19 13:11:26 +08:00
|
|
|
}, {
|
|
|
|
|
label: this.$t('overall.status'),
|
|
|
|
|
prop: 'state',
|
|
|
|
|
show: true,
|
2022-04-28 15:15:08 +08:00
|
|
|
width: 130,
|
2022-04-19 13:11:26 +08:00
|
|
|
sortable: 'custom'
|
2022-04-12 18:00:01 +08:00
|
|
|
}
|
|
|
|
|
],
|
2022-04-13 16:40:55 +08:00
|
|
|
checkboxAll: false,
|
2022-04-12 18:00:01 +08:00
|
|
|
checkboxIds: '',
|
2022-04-13 18:31:13 +08:00
|
|
|
batchDow: false,
|
|
|
|
|
builtinId: '',
|
2022-04-14 11:59:37 +08:00
|
|
|
indeterminate: false,
|
2022-04-15 14:59:53 +08:00
|
|
|
loading: false,
|
|
|
|
|
loadingTableId: '',
|
|
|
|
|
loadingPreviewId: ''
|
|
|
|
|
|
2022-04-12 18:00:01 +08:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
2022-04-19 13:11:26 +08:00
|
|
|
getJobStatus (state) {
|
|
|
|
|
if (state === 0) {
|
|
|
|
|
return this.$t('overall.inProgress')
|
|
|
|
|
} else if (state === 1) {
|
|
|
|
|
return this.$t('overall.completed')
|
|
|
|
|
}
|
|
|
|
|
},
|
2022-04-13 18:31:13 +08:00
|
|
|
selectionChange (objs) {
|
|
|
|
|
this.$emit('selectionChange', objs)
|
2022-04-12 18:00:01 +08:00
|
|
|
this.checkboxIds = objs.map(item => { return item.id }).join(',')
|
2022-04-13 18:31:13 +08:00
|
|
|
this.checkboxAll = objs.length > 0 || objs.length === this.tableData.length
|
|
|
|
|
this.batchDow = objs.length > 0
|
2022-04-12 18:00:01 +08:00
|
|
|
},
|
2022-04-14 15:52:07 +08:00
|
|
|
selectAll (objs) {
|
2022-04-12 18:00:01 +08:00
|
|
|
if (objs) {
|
2022-04-13 18:31:13 +08:00
|
|
|
objs.forEach(item => {
|
|
|
|
|
this.$refs.dataTable.toggleAllSelection(item)
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
this.$refs.dataTable.clearSelection()
|
2022-04-13 16:40:55 +08:00
|
|
|
}
|
2022-04-12 18:00:01 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|