阅行客电子档案
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

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <template>
  2. <div>
  3. <el-drawer
  4. :with-header="false"
  5. :visible.sync="fileDrawer"
  6. :modal="false"
  7. :wrapper-closable="false"
  8. :show-close="false"
  9. direction="rtl"
  10. :size="((selectedCategory.arrangeType === 2 && isAjNo === 0) || (selectedCategory.arrangeType === 3 && isAjNo === 1)) ? '80%' : (isAjNo === 1) ? '90%' : (selectedCategory.arrangeType === 1) ? '90%' : '70%'"
  11. >
  12. <CollectHeader ref="collectHeaderRef" :is-title-type="isTitleType" :selected-category="selectedCategory" :selections="selections" :test="test" :is-recycle="isRecycle" />
  13. <span class="closed-btn" @click="closeDrawer" />
  14. <div class="collect-table">
  15. <el-table
  16. ref="table"
  17. v-loading="crud.loading || getTableDisplayFieldsLoading"
  18. class="archives-table"
  19. :data="fileData"
  20. highlight-current-row
  21. style="width: 100%;"
  22. height="calc(100vh - 418px)"
  23. :row-class-name="tableRowClassName"
  24. :row-key="rowKey"
  25. @select-all="selectAll"
  26. @selection-change="crud.selectionChangeHandler"
  27. @row-click="clickRowHandler"
  28. @cell-dblclick="tableDoubleClick"
  29. @select="handleCurrentChange"
  30. >
  31. <el-table-column type="selection" width="55" :reserve-selection="true" align="center" />
  32. <el-table-column type="index" label="序号" width="55" align="center" />
  33. <el-table-column prop="file_name" label="原文名称" show-overflow-tooltip min-width="140" align="center" />
  34. <el-table-column prop="file_type" label="格式" min-width="60" align="center" />
  35. <el-table-column prop="file_size" label="大小" min-width="85" align="center">
  36. <template slot-scope="scope">
  37. {{ (scope.row.file_size / 1024).toFixed(2) + 'kB' }}
  38. </template>
  39. </el-table-column>
  40. <el-table-column prop="file_dpi" label="尺寸" min-width="85" align="center">
  41. <template slot-scope="scope">
  42. <div v-if="!scope.row.file_dpi"> - </div>
  43. <div v-else> {{ scope.row.file_dpi }} </div>
  44. </template>
  45. </el-table-column>
  46. <el-table-column prop="file_thumbnail" label="缩览图" min-width="60" align="center">
  47. <template slot-scope="scope">
  48. <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'">
  49. <img width="60px" height="32px" class="screenshot" :src="baseApi+ '/downloadFile' +scope.row.file_path" :onerror="defaultImg" @click="showCoverPreview(scope.row)">
  50. </div>
  51. <div v-else>
  52. <svg-icon icon-class="fujian" class-name="svg-style" />
  53. </div>
  54. </template>
  55. </el-table-column>
  56. <el-table-column prop="create_time" label="创建时间" min-width="110" align="center" />
  57. </el-table>
  58. <!--分页组件-->
  59. <el-pagination
  60. v-if="fileData.length !== 0"
  61. :current-page="page.page"
  62. :total="page.total"
  63. :page-size="page.size"
  64. :pager-count="5"
  65. layout="total, prev, pager, next, sizes"
  66. @size-change="handleSizeChange"
  67. @current-change="handleCurrentPage"
  68. />
  69. </div>
  70. </el-drawer>
  71. <!-- 点击缩略图看大图 -->
  72. <el-dialog class="preview-dialog" :append-to-body="true" :close-on-click-modal="false" :before-close="handleClose" :visible="showCoverVisible" title="查看大图">
  73. <span class="dialog-right-top" />
  74. <span class="dialog-left-bottom" />
  75. <div class="setting-dialog" style="max-height:calc(100vh - 230px); overflow:auto;">
  76. <img style="max-width:100%; object-fit: contain;" :src="previewSrc" :onerror="defaultImg">
  77. </div>
  78. </el-dialog>
  79. </div>
  80. </template>
  81. <script>
  82. import { collectionLibraryCrud } from '../mixins/index'
  83. import { header, form } from '@crud/crud'
  84. import CollectHeader from '../module/collectHeader.vue'
  85. import { mapGetters } from 'vuex'
  86. export default {
  87. name: 'File',
  88. components: { CollectHeader },
  89. mixins: [
  90. header(),
  91. form({}),
  92. collectionLibraryCrud
  93. ],
  94. props: {
  95. selectedCategory: {
  96. type: Object,
  97. default: function() {
  98. return {}
  99. }
  100. },
  101. isRecycle: {
  102. type: Boolean,
  103. default: false
  104. },
  105. smartQuery: {
  106. type: Object,
  107. default: function() {
  108. return {}
  109. }
  110. }
  111. },
  112. inject: ['parentsData'],
  113. data() {
  114. return {
  115. defaultImg: 'this.src="' + require('@/assets/images/cover-bg.png') + '"',
  116. isTitleType: 6,
  117. fileDrawer: false,
  118. test: '',
  119. isAjNo: 0,
  120. selections: [],
  121. showCoverVisible: false,
  122. previewSrc: null
  123. }
  124. },
  125. computed: {
  126. ...mapGetters([
  127. 'baseApi'
  128. ])
  129. },
  130. watch: {
  131. selectedCategory: function(newValue, oldValue) {
  132. }
  133. },
  134. created() {
  135. },
  136. mounted() {
  137. },
  138. methods: {
  139. getCommonData(categoryLevel, parentId, type) {
  140. this.getViewTable(categoryLevel, parentId, type)
  141. },
  142. closeDrawer() {
  143. this.fileDrawer = false
  144. if (this.selectedCategory.arrangeType === 1) {
  145. this.$parent.parentsAnjuanId = null
  146. } else {
  147. this.$parent.parentsJuanneiId = null
  148. }
  149. },
  150. rowKey(row) {
  151. return row.id
  152. },
  153. // table选中加上选中状态
  154. tableRowClassName({ row, rowIndex }) {
  155. let color = ''
  156. this.selections.forEach(item => {
  157. if (item.id === row.id) {
  158. color = 'rowStyle'
  159. }
  160. })
  161. return color
  162. },
  163. // table - 全选
  164. selectAll(val) {
  165. this.selections = val
  166. },
  167. // table - 双击查看详情
  168. tableDoubleClick(row) {
  169. // console.log('tableDoubleClick', row)
  170. // this.arcId = row.id
  171. // console.log(this.selectedCategory.isType)
  172. },
  173. // table - 当前选中得row
  174. clickRowHandler(row) {
  175. this.parentsData.smartQuery = {
  176. 'retention': null,
  177. 'security_class': null,
  178. 'doc_type': null,
  179. 'medium_type': null,
  180. 'archive_year': null,
  181. 'fonds_no': null
  182. }
  183. this.selections = this.crud.selections
  184. },
  185. // 触发单选
  186. handleCurrentChange(selection, row) {
  187. this.selections = selection
  188. },
  189. handleSizeChange(size) {
  190. this.page.size = size
  191. this.page.page = 1
  192. if (this.selectedCategory.arrangeType === 1) {
  193. this.getViewTable(4, this.parentsData.parentsAnjuanId)
  194. } else {
  195. this.getViewTable(4, this.parentsData.parentsJuanneiId)
  196. }
  197. },
  198. handleCurrentPage(val) {
  199. this.page.page = val
  200. if (this.selectedCategory.arrangeType === 1) {
  201. this.getViewTable(4, this.parentsData.parentsAnjuanId)
  202. } else {
  203. this.getViewTable(4, this.parentsData.parentsJuanneiId)
  204. }
  205. },
  206. // dialog - close
  207. handleClose(done) {
  208. this.showCoverVisible = false
  209. done()
  210. },
  211. showCoverPreview(row) {
  212. this.showCoverVisible = true
  213. this.previewSrc = this.baseApi + '/downloadFile' + row.file_path
  214. }
  215. }
  216. }
  217. </script>
  218. <style lang='scss' scoped>
  219. @import "~@/assets/styles/collect-reorganizi.scss";
  220. .svg-style{
  221. width: 60px;
  222. height: 32px;
  223. }
  224. </style>