fix: 内置报告bug修复

This commit is contained in:
@changcode
2022-04-14 11:59:37 +08:00
parent 0bf3534f0d
commit 7d0152c068
6 changed files with 71 additions and 20 deletions

View File

@@ -21,3 +21,10 @@ body {
font-size: 14px; font-size: 14px;
position: fixed; position: fixed;
} }
.icon {
width: 1em;
height: 1em;
vertical-align: -0.15em;
fill: currentColor;
overflow: hidden;
}

View File

@@ -178,9 +178,6 @@
.table-operation-items { .table-operation-items {
display: flex; display: flex;
justify-content: center; justify-content: center;
.table-operation-item--down {
margin-right: 16px;
}
.table-operation-item { .table-operation-item {
display: flex; display: flex;
height: 22px; height: 22px;
@@ -250,7 +247,7 @@
box-shadow: 1px 0 $--right-box-border-color; box-shadow: 1px 0 $--right-box-border-color;
} }
.el-table:not(.no-operation):not(.chart-table).el-table--border .el-table__header-wrapper th:nth-last-child(3) { .el-table:not(.no-operation):not(.chart-table).el-table--border .el-table__header-wrapper th:nth-last-child(3) {
border-right: none !important; //border-right: none !important;
box-shadow: 1px 0 $--right-box-border-color; box-shadow: 1px 0 $--right-box-border-color;
} }
.el-table__fixed-body-wrapper { .el-table__fixed-body-wrapper {

View File

@@ -52,7 +52,8 @@
bottom: 17px; bottom: 17px;
z-index: 2; z-index: 2;
left: 20px; left: 20px;
height: 22px; line-height: 24px;
height: 24px;
display: flex; display: flex;
.el-checkbox { .el-checkbox {
width: 14px; width: 14px;
@@ -65,34 +66,61 @@
} }
} }
.table-operation-all-span { .table-operation-all-span {
span:nth-of-type(1) { height: 24px;
display: flex;
span {
margin: 0 10px; margin: 0 10px;
font-size: 14px; font-size: 14px;
color: #666666; color: #666666;
letter-spacing: 0; letter-spacing: 0;
font-weight: 400; font-weight: 400;
} }
span:nth-of-type(2) { .table-operation-back-down {
font-size: 12px;
color: #FFFFFF;
font-weight: 500; font-weight: 500;
height: 24px; height: 24px;
background: #D7D7D7; background: #D7D7D7;
border-radius: 2px; border-radius: 2px;
padding: 3px 8px; line-height: 21px;
line-height: 16px;
cursor: pointer; cursor: pointer;
margin-top: 2px; position: relative;
span {
margin: 3px 8px;
font-size: 12px;
color: #FFFFFF;
}
} }
span:nth-of-type(2).table-operation-all-checkbox { .table-operation-back-down div {
color: #FFFFFF;
height: 24px;
background: #D7D7D7;
border-radius: 2px;
i {
font-size: 25px;
top: calc(50% - 12px);
}
}
.table-operation-back-down.table-operation-all-checkbox {
background: #0091ff; background: #0091ff;
} }
.table-operation-back-down.table-operation-all-loading {
background: #D7D7D7;
}
} }
} }
.table-operation-items { .table-operation-items {
.table-operation-item--down { .table-operation-item--down {
margin-right: 16px;
cursor: pointer; cursor: pointer;
} }
.table-operation-item--down,.table-operation-item--preview {
display: flex;
justify-content: center;
flex-direction: column;
.icon {
height: 25px;
width: 25px;
}
}
.table-operation-item--preview { .table-operation-item--preview {
cursor: pointer; cursor: pointer;
} }

View File

@@ -54,8 +54,16 @@
</template> </template>
<template #default="scope"> <template #default="scope">
<div class="table-operation-items"> <div class="table-operation-items">
<div class="table-operation-item--down" @click="tableOperation(['download', scope.row])"><i class="cn-icon cn-icon-download2"></i></div> <div class="table-operation-item--down" @click="tableOperation(['download', scope.row])">
<div class="table-operation-item--preview" @click="tableOperation(['preview', scope.row])"><i class="cn-icon cn-icon-preview"></i></div> <svg class="icon" aria-hidden="true">
<use xlink:href="#cn-icon-download2"></use>
</svg>
</div>
<div class="table-operation-item--preview" @click="tableOperation(['preview', scope.row])">
<svg class="icon" aria-hidden="true">
<use xlink:href="#cn-icon-preview"></use>
</svg>
</div>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
@@ -64,18 +72,22 @@
<el-checkbox v-model="checkboxAll" @change="builtinReportCheckbox(tableData)"></el-checkbox> <el-checkbox v-model="checkboxAll" @change="builtinReportCheckbox(tableData)"></el-checkbox>
<div class="table-operation-all-span"> <div class="table-operation-all-span">
<span>{{ $t('overall.all') }}</span> <span>{{ $t('overall.all') }}</span>
<span :class="{'table-operation-all-checkbox': batchDow}" :disabled="checkboxAll" @click="tableOperation(['download', this.checkboxIds, 'builtin'])">{{$t('report.batchDow')}}</span> <div class="table-operation-back-down" :class="{'table-operation-all-checkbox': batchDow, 'table-operation-all-loading': loading}" @click="tableOperation(['download', this.checkboxIds, 'builtin'])">
<loading :loading="loading"></loading>
<span>{{$t('report.batchDow')}}</span>
</div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import table from '@/mixins/table' import table from '@/mixins/table'
import Loading from '@/components/common/Loading'
export default { export default {
name: 'builtinReportTable', name: 'builtinReportTable',
mixins: [table], mixins: [table],
props: { components: {
builtinReportLeftMenu: Number Loading
}, },
data () { data () {
return { return {
@@ -104,7 +116,8 @@ export default {
checkboxIds: '', checkboxIds: '',
batchDow: false, batchDow: false,
builtinId: '', builtinId: '',
indeterminate: false indeterminate: false,
loading: false
} }
}, },
methods: { methods: {

View File

@@ -1,5 +1,6 @@
import { createApp } from 'vue' import { createApp } from 'vue'
import '@/assets/css/font/iconfont.css' import '@/assets/css/font/iconfont.css'
import '@/assets/css/font/iconfont.js'
import router from '@/router' import router from '@/router'
import store from '@/store' import store from '@/store'
import App from '@/App.vue' import App from '@/App.vue'

View File

@@ -147,6 +147,7 @@ export default {
this.rightBox.show = true this.rightBox.show = true
}, },
download (u, n) { download (u, n) {
if (this.$refs.dataTable.loading && n === 'builtin') return
let fileName = '' let fileName = ''
let url = '' let url = ''
let params = {} let params = {}
@@ -157,12 +158,14 @@ export default {
ids: u ids: u
} }
} else { } else {
fileName = 'builtinReport' + '-' + this.getTimeString() + '.pdf' // 文件名称 fileName = u.name + '.pdf' // 文件名称
url = '/report/job/downloadPdf' // 单个 pdf 下载 url = '/report/job/downloadPdf' // 单个 pdf 下载
params = { params = {
id: u.id id: u.id
} }
} }
if (n === 'builtin') this.$refs.dataTable.loading = true
if (!u) return this.$refs.dataTable.loading = false
axios.get(url, { responseType: 'blob', params: params }).then(res => { axios.get(url, { responseType: 'blob', params: params }).then(res => {
if (window.navigator.msSaveOrOpenBlob) { if (window.navigator.msSaveOrOpenBlob) {
// 兼容ie11 // 兼容ie11
@@ -178,6 +181,7 @@ export default {
a.click() a.click()
a.remove() // 将a标签移除 a.remove() // 将a标签移除
} }
if (n === 'builtin') this.$refs.dataTable.loading = false
}, error => { }, error => {
const $self = this const $self = this
const reader = new FileReader() const reader = new FileReader()
@@ -191,6 +195,7 @@ export default {
} }
} }
reader.readAsText(error.response.data) reader.readAsText(error.response.data)
if (n === 'builtin') this.$refs.dataTable.loading = false
}) })
}, },
preview (u) { preview (u) {