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

252 lines
8.6 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
  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 label="序号" width="55" align="center" show-overflow-tooltip>
  33. <template slot-scope="scope">
  34. <span>{{ (page.page === 1 ? 0 : (page.page === 0 ? 0 : page.page - 1)) * page.size + scope.$index + 1 }}</span>
  35. </template>
  36. </el-table-column>
  37. <!-- <el-table-column type="index" label="序号" width="55" align="center" /> -->
  38. <el-table-column prop="file_name" label="原文名称" show-overflow-tooltip min-width="140" />
  39. <el-table-column prop="file_type" label="格式" min-width="60" align="center" />
  40. <el-table-column prop="file_size" label="大小" min-width="85" align="center">
  41. <template slot-scope="scope">
  42. {{ getFileSize(scope.row.file_size) }}
  43. </template>
  44. </el-table-column>
  45. <el-table-column prop="file_dpi" label="尺寸" min-width="85" align="center">
  46. <template slot-scope="scope">
  47. <div v-if="!scope.row.file_dpi || scope.row.file_dpi === 'null'"> - </div>
  48. <div v-else> {{ scope.row.file_dpi }} </div>
  49. </template>
  50. </el-table-column>
  51. <!-- @click="showCoverPreview(scope.row)" -->
  52. <el-table-column prop="file_thumbnail" label="缩略图" min-width="60" align="center">
  53. <template slot-scope="scope">
  54. <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'">
  55. <i class="fileIcon icon-image" />
  56. </div>
  57. <div v-else-if="scope.row.file_type === 'xlsx' || scope.row.file_type === 'xls'">
  58. <i class="fileIcon icon-excel" />
  59. </div>
  60. <div v-else-if="scope.row.file_type === 'docx' || scope.row.file_type === 'doc'">
  61. <i class="fileIcon icon-word" />
  62. </div>
  63. <div v-else-if="scope.row.file_type === 'pdf'">
  64. <i class="fileIcon icon-pdf" />
  65. </div>
  66. <div v-else-if="scope.row.file_type === 'ppt' || scope.row.file_type === 'pptx'">
  67. <i class="fileIcon icon-ppt" />
  68. </div>
  69. <div v-else-if="scope.row.file_type === 'zip' || scope.row.file_type === 'rar'">
  70. <i class="fileIcon icon-zip" />
  71. </div>
  72. <div v-else-if="scope.row.file_type === 'txt'">
  73. <i class="fileIcon icon-txt" />
  74. </div>
  75. <div v-else>
  76. <i class="fileIcon icon-other" />
  77. </div>
  78. </template>
  79. </el-table-column>
  80. <el-table-column prop="create_time" label="创建时间" min-width="110" align="center" />
  81. </el-table>
  82. <!--分页组件-->
  83. <el-pagination
  84. v-if="fileData.length !== 0"
  85. :current-page="page.page"
  86. :total="page.total"
  87. :page-size="page.size"
  88. :pager-count="5"
  89. layout="total, prev, pager, next, sizes"
  90. @size-change="handleSizeChange"
  91. @current-change="handleCurrentPage"
  92. />
  93. </div>
  94. </el-drawer>
  95. <!-- 点击缩略图看大图 -->
  96. <el-dialog class="preview-dialog" :append-to-body="true" :close-on-click-modal="false" :before-close="handleClose" :visible="showCoverVisible" title="查看大图">
  97. <span class="dialog-right-top" />
  98. <span class="dialog-left-bottom" />
  99. <div class="setting-dialog" style="max-height:calc(100vh - 230px); overflow:auto;">
  100. <img style="max-width:100%; object-fit: contain;" :src="previewSrc" :onerror="defaultImg">
  101. </div>
  102. </el-dialog>
  103. </div>
  104. </template>
  105. <script>
  106. import { collectionLibraryCrud } from '../mixins/index'
  107. import { header, form } from '@crud/crud'
  108. import CollectHeader from '../module/collectHeader'
  109. import { mapGetters } from 'vuex'
  110. export default {
  111. name: 'File',
  112. components: { CollectHeader },
  113. mixins: [
  114. header(),
  115. form({}),
  116. collectionLibraryCrud
  117. ],
  118. props: {
  119. selectedCategory: {
  120. type: Object,
  121. default: function() {
  122. return {}
  123. }
  124. },
  125. isRecycle: {
  126. type: Boolean,
  127. default: false
  128. },
  129. smartQuery: {
  130. type: Object,
  131. default: function() {
  132. return {}
  133. }
  134. }
  135. },
  136. inject: ['parentsData'],
  137. data() {
  138. return {
  139. defaultImg: 'this.src="' + require('@/assets/images/cover-bg.png') + '"',
  140. isTitleType: 6,
  141. fileDrawer: false,
  142. test: '',
  143. isAjNo: 0,
  144. selections: [],
  145. showCoverVisible: false,
  146. previewSrc: null
  147. }
  148. },
  149. computed: {
  150. ...mapGetters([
  151. 'baseApi'
  152. ])
  153. },
  154. watch: {
  155. selectedCategory: function(newValue, oldValue) {
  156. }
  157. },
  158. created() {
  159. },
  160. mounted() {
  161. },
  162. methods: {
  163. getFileSize(fileSize) {
  164. const fileSizeInKB = (fileSize / 1024).toFixed(2) + 'kB'
  165. const fileSizeInB = fileSize + 'B'
  166. return (fileSize / 1024) <= 0.01 ? fileSizeInB : fileSizeInKB
  167. },
  168. getCommonData(categoryLevel, parentId, type) {
  169. this.getViewTable(categoryLevel, parentId, type)
  170. },
  171. closeDrawer() {
  172. this.fileDrawer = false
  173. if (this.selectedCategory.arrangeType === 1) {
  174. this.$parent.parentsAnjuanId = null
  175. } else {
  176. this.$parent.parentsJuanneiId = null
  177. }
  178. },
  179. rowKey(row) {
  180. return row.id
  181. },
  182. // table选中加上选中状态
  183. tableRowClassName({ row, rowIndex }) {
  184. let color = ''
  185. this.selections.forEach(item => {
  186. if (item.id === row.id) {
  187. color = 'rowStyle'
  188. }
  189. })
  190. return color
  191. },
  192. // table - 全选
  193. selectAll(val) {
  194. this.selections = val
  195. },
  196. // table - 双击查看详情
  197. tableDoubleClick(row) {
  198. },
  199. // table - 当前选中得row
  200. clickRowHandler(row) {
  201. this.parentsData.smartQuery = {
  202. 'retention': null,
  203. 'security_class': null,
  204. 'doc_type': null,
  205. 'medium_type': null,
  206. 'archive_year': null,
  207. 'fonds_no': null
  208. }
  209. this.selections = this.crud.selections
  210. },
  211. // 触发单选
  212. handleCurrentChange(selection, row) {
  213. this.selections = selection
  214. },
  215. handleSizeChange(size) {
  216. this.page.size = size
  217. this.page.page = 1
  218. if (this.selectedCategory.arrangeType === 1) {
  219. this.getViewTable(4, this.parentsData.parentsAnjuanId)
  220. } else {
  221. this.getViewTable(4, this.parentsData.parentsJuanneiId)
  222. }
  223. },
  224. handleCurrentPage(val) {
  225. this.page.page = val
  226. if (this.selectedCategory.arrangeType === 1) {
  227. this.getViewTable(4, this.parentsData.parentsAnjuanId)
  228. } else {
  229. this.getViewTable(4, this.parentsData.parentsJuanneiId)
  230. }
  231. },
  232. // dialog - close
  233. handleClose(done) {
  234. this.showCoverVisible = false
  235. done()
  236. },
  237. showCoverPreview(row) {
  238. this.showCoverVisible = true
  239. this.previewSrc = this.baseApi + '/downloadFile' + row.file_path
  240. }
  241. }
  242. }
  243. </script>
  244. <style lang='scss' scoped>
  245. @import "~@/assets/styles/collect-reorganizi.scss";
  246. .svg-style{
  247. width: 60px;
  248. height: 32px;
  249. }
  250. </style>