You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
227 lines
7.4 KiB
227 lines
7.4 KiB
<template>
|
|
<div>
|
|
<el-drawer
|
|
:with-header="false"
|
|
:visible.sync="fileDrawer"
|
|
:modal="false"
|
|
:wrapper-closable="false"
|
|
:show-close="false"
|
|
direction="rtl"
|
|
:size="((selectedCategory.arrangeType === 2 && isAjNo === 0) || (selectedCategory.arrangeType === 3 && isAjNo === 1)) ? '80%' : (isAjNo === 1) ? '90%' : (selectedCategory.arrangeType === 1) ? '90%' : '70%'"
|
|
>
|
|
<CollectHeader ref="collectHeaderRef" :is-title-type="isTitleType" :selected-category="selectedCategory" :selections="selections" :test="test" :is-recycle="isRecycle" />
|
|
<span class="closed-btn" @click="closeDrawer" />
|
|
<div class="collect-table">
|
|
<el-table
|
|
ref="table"
|
|
v-loading="crud.loading || getTableDisplayFieldsLoading"
|
|
class="archives-table"
|
|
:data="fileData"
|
|
highlight-current-row
|
|
style="width: 100%;"
|
|
height="calc(100vh - 418px)"
|
|
:row-class-name="tableRowClassName"
|
|
:row-key="rowKey"
|
|
@select-all="selectAll"
|
|
@selection-change="crud.selectionChangeHandler"
|
|
@row-click="clickRowHandler"
|
|
@cell-dblclick="tableDoubleClick"
|
|
@select="handleCurrentChange"
|
|
>
|
|
<el-table-column type="selection" width="55" :reserve-selection="true" align="center" />
|
|
<el-table-column type="index" label="序号" width="55" align="center" />
|
|
<el-table-column prop="file_name" label="原文名称" show-overflow-tooltip min-width="140" align="center" />
|
|
<el-table-column prop="file_type" label="格式" min-width="60" align="center" />
|
|
<el-table-column prop="file_size" label="大小" min-width="85" align="center">
|
|
<template slot-scope="scope">
|
|
{{ (scope.row.file_size / 1024).toFixed(2) + 'kB' }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="file_dpi" label="尺寸" min-width="85" align="center">
|
|
<template slot-scope="scope">
|
|
<div v-if="!scope.row.file_dpi"> - </div>
|
|
<div v-else> {{ scope.row.file_dpi }} </div>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="file_thumbnail" label="缩览图" min-width="60" align="center">
|
|
<template slot-scope="scope">
|
|
<div v-if="scope.row.file_type === 'jpg' || scope.row.file_type === 'jpeg' || scope.row.file_type === 'png' || scope.row.file_type === 'bmp'|| scope.row.file_type === 'gif'">
|
|
<img width="60px" height="32px" class="screenshot" :src="baseApi+ '/downloadFile' +scope.row.file_path" :onerror="defaultImg" @click="showCoverPreview(scope.row)">
|
|
</div>
|
|
<div v-else>
|
|
<svg-icon icon-class="fujian" class-name="svg-style" />
|
|
</div>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="create_time" label="创建时间" min-width="110" align="center" />
|
|
</el-table>
|
|
<!--分页组件-->
|
|
<el-pagination
|
|
v-if="fileData.length !== 0"
|
|
:current-page="page.page"
|
|
:total="page.total"
|
|
:page-size="page.size"
|
|
:pager-count="5"
|
|
layout="total, prev, pager, next, sizes"
|
|
@size-change="handleSizeChange"
|
|
@current-change="handleCurrentPage"
|
|
/>
|
|
</div>
|
|
</el-drawer>
|
|
|
|
<!-- 点击缩略图看大图 -->
|
|
<el-dialog class="preview-dialog" :append-to-body="true" :close-on-click-modal="false" :before-close="handleClose" :visible="showCoverVisible" title="查看大图">
|
|
<span class="dialog-right-top" />
|
|
<span class="dialog-left-bottom" />
|
|
<div class="setting-dialog" style="max-height:calc(100vh - 230px); overflow:auto;">
|
|
<img style="max-width:100%; object-fit: contain;" :src="previewSrc" :onerror="defaultImg">
|
|
</div>
|
|
</el-dialog>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { collectionLibraryCrud } from '../mixins/index'
|
|
import { header, form } from '@crud/crud'
|
|
import CollectHeader from '../module/collectHeader.vue'
|
|
import { mapGetters } from 'vuex'
|
|
export default {
|
|
name: 'File',
|
|
components: { CollectHeader },
|
|
mixins: [
|
|
header(),
|
|
form({}),
|
|
collectionLibraryCrud
|
|
],
|
|
props: {
|
|
selectedCategory: {
|
|
type: Object,
|
|
default: function() {
|
|
return {}
|
|
}
|
|
},
|
|
isRecycle: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
smartQuery: {
|
|
type: Object,
|
|
default: function() {
|
|
return {}
|
|
}
|
|
}
|
|
},
|
|
inject: ['parentsData'],
|
|
data() {
|
|
return {
|
|
defaultImg: 'this.src="' + require('@/assets/images/cover-bg.png') + '"',
|
|
isTitleType: 6,
|
|
fileDrawer: false,
|
|
test: '',
|
|
isAjNo: 0,
|
|
selections: [],
|
|
showCoverVisible: false,
|
|
previewSrc: null
|
|
}
|
|
},
|
|
computed: {
|
|
...mapGetters([
|
|
'baseApi'
|
|
])
|
|
},
|
|
watch: {
|
|
selectedCategory: function(newValue, oldValue) {
|
|
}
|
|
},
|
|
created() {
|
|
},
|
|
mounted() {
|
|
},
|
|
methods: {
|
|
getCommonData(categoryLevel, parentId, type) {
|
|
this.getViewTable(categoryLevel, parentId, type)
|
|
},
|
|
closeDrawer() {
|
|
this.fileDrawer = false
|
|
if (this.selectedCategory.arrangeType === 1) {
|
|
this.$parent.parentsAnjuanId = null
|
|
} else {
|
|
this.$parent.parentsJuanneiId = null
|
|
}
|
|
},
|
|
rowKey(row) {
|
|
return row.id
|
|
},
|
|
// table选中加上选中状态
|
|
tableRowClassName({ row, rowIndex }) {
|
|
let color = ''
|
|
this.selections.forEach(item => {
|
|
if (item.id === row.id) {
|
|
color = 'rowStyle'
|
|
}
|
|
})
|
|
return color
|
|
},
|
|
// table - 全选
|
|
selectAll(val) {
|
|
this.selections = val
|
|
},
|
|
// table - 双击查看详情
|
|
tableDoubleClick(row) {
|
|
// console.log('tableDoubleClick', row)
|
|
// this.arcId = row.id
|
|
// console.log(this.selectedCategory.isType)
|
|
},
|
|
// table - 当前选中得row
|
|
clickRowHandler(row) {
|
|
this.parentsData.smartQuery = {
|
|
'retention': null,
|
|
'security_class': null,
|
|
'doc_type': null,
|
|
'medium_type': null,
|
|
'archive_year': null,
|
|
'fonds_no': null
|
|
}
|
|
this.selections = this.crud.selections
|
|
},
|
|
// 触发单选
|
|
handleCurrentChange(selection, row) {
|
|
this.selections = selection
|
|
},
|
|
handleSizeChange(size) {
|
|
this.page.size = size
|
|
this.page.page = 1
|
|
if (this.selectedCategory.arrangeType === 1) {
|
|
this.getViewTable(4, this.parentsData.parentsAnjuanId)
|
|
} else {
|
|
this.getViewTable(4, this.parentsData.parentsJuanneiId)
|
|
}
|
|
},
|
|
handleCurrentPage(val) {
|
|
this.page.page = val
|
|
if (this.selectedCategory.arrangeType === 1) {
|
|
this.getViewTable(4, this.parentsData.parentsAnjuanId)
|
|
} else {
|
|
this.getViewTable(4, this.parentsData.parentsJuanneiId)
|
|
}
|
|
},
|
|
// dialog - close
|
|
handleClose(done) {
|
|
this.showCoverVisible = false
|
|
done()
|
|
},
|
|
showCoverPreview(row) {
|
|
this.showCoverVisible = true
|
|
this.previewSrc = this.baseApi + '/downloadFile' + row.file_path
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang='scss' scoped>
|
|
@import "~@/assets/styles/collect-reorganizi.scss";
|
|
.svg-style{
|
|
width: 60px;
|
|
height: 32px;
|
|
}
|
|
</style>
|