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

236 lines
7.1 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. <template>
  2. <div class="collect-no-tab">
  3. <CollectHeader ref="collectHeaderRef" :is-title-type="isTitleType" :selected-category="selectedCategory" :arc-id="arcId" :selections="selections" :is-recycle="isRecycle" />
  4. <!-- <el-button type="text" @click="openAnjuan">打开案卷的Drawer</el-button> -->
  5. <div class="collect-table">
  6. <el-table
  7. ref="table"
  8. v-loading="getTableDisplayFieldsLoading"
  9. class="archives-table"
  10. :data="projectData"
  11. highlight-current-row
  12. style="width: 100%;"
  13. height="calc(100vh - 364px)"
  14. :row-key="rowKey"
  15. :row-class-name="tableRowClassName"
  16. border
  17. @select-all="selectAll"
  18. @selection-change="crud.selectionChangeHandler"
  19. @row-click="clickRowHandler"
  20. @row-dblclick="tableDoubleClick"
  21. @select="handleCurrentChange"
  22. @mousedown.native="onMouseDown"
  23. @mouseup.native="onMouseUp"
  24. >
  25. <el-table-column type="selection" :reserve-selection="true" width="55" align="center" />
  26. <el-table-column label="序号" width="55" align="center" show-overflow-tooltip>
  27. <template slot-scope="scope">
  28. <span>{{ page.page * page.size + scope.$index + 1 }}</span>
  29. </template>
  30. </el-table-column>
  31. <!-- <el-table-column type="index" label="序号" width="55" align="center" /> -->
  32. <el-table-column label="案卷" prop="child" width="55" align="center">
  33. <template slot-scope="scope">
  34. {{ scope.row.child === '' ? 0 : scope.row.child }}
  35. </template>
  36. </el-table-column>
  37. <el-table-column v-for="field in tableDisplayFields" :key="field.id" :label="field.fieldCnName" :align="field.displayformatType" :width="field.displayLength" show-overflow-tooltip>
  38. <template slot="header">
  39. <el-tooltip
  40. class="item"
  41. effect="dark"
  42. :content="field.fieldCnName"
  43. placement="top-start"
  44. >
  45. <span>{{ field.fieldCnName }}</span>
  46. </el-tooltip>
  47. </template>
  48. <template slot-scope="scope">
  49. {{ scope.row[field.fieldName] }}
  50. </template>
  51. </el-table-column>
  52. </el-table>
  53. <!--分页组件-->
  54. <el-pagination
  55. v-if="projectData.length !== 0"
  56. :current-page="currentPage"
  57. :total="page.total"
  58. :page-size="page.size"
  59. :pager-count="5"
  60. layout="total, prev, pager, next, sizes"
  61. @size-change="handleSizeChange"
  62. @current-change="handleCurrentPage"
  63. />
  64. </div>
  65. <!-- 档案详情 -->
  66. <ArchivesInfo ref="archivesInfo" :selected-category="selectedCategory" :arc-id="arcId" :is-title-type="isTitleType" :is-collect="false" />
  67. </div>
  68. </template>
  69. <script>
  70. import { manageLibraryCrud } from '../mixins/index'
  71. import { header, form } from '@crud/crud'
  72. import CollectHeader from '../module/collectHeader.vue'
  73. import ArchivesInfo from '../module/archivesInfo/index'
  74. export default {
  75. name: 'Project',
  76. components: { CollectHeader, ArchivesInfo },
  77. mixins: [
  78. header(),
  79. form({}),
  80. manageLibraryCrud
  81. ],
  82. props: {
  83. data: {
  84. type: String,
  85. default: ''
  86. },
  87. selectedCategory: {
  88. type: Object,
  89. default: function() {
  90. return {}
  91. }
  92. },
  93. isRecycle: {
  94. type: Boolean,
  95. default: false
  96. },
  97. smartQuery: {
  98. type: Object,
  99. default: function() {
  100. return {}
  101. }
  102. }
  103. },
  104. inject: ['parentsData'],
  105. data() {
  106. return {
  107. isTitleType: 2,
  108. categoryId: '',
  109. arcId: '',
  110. activeIndex: '1',
  111. selections: [],
  112. yearData: [],
  113. parentId: null,
  114. currentPage: 1,
  115. mousedownTime: 0,
  116. mousedownX: 0,
  117. mousedownY: 0
  118. }
  119. },
  120. watch: {
  121. selectedCategory: function(newValue, oldValue) {
  122. },
  123. tableDisplayFields(val) {
  124. this.doLayout()
  125. }
  126. },
  127. created() {
  128. },
  129. mounted() {
  130. },
  131. methods: {
  132. getCommonData(categoryLevel, parentId, type) {
  133. this.getViewTable(categoryLevel, parentId, type)
  134. },
  135. sendYearDataToParent() {
  136. this.$emit('myYearEvent', this.yearData)
  137. },
  138. openAnjuan(data, parentId, parentRow) {
  139. // this.$emit('openAnjuan', '传值')
  140. this.$emit('openAnjuan', data, parentId, parentRow)
  141. },
  142. rowKey(row) {
  143. return row.id
  144. },
  145. // table选中加上选中状态
  146. tableRowClassName({ row, rowIndex }) {
  147. // console.log('添加类名', row, rowIndex)
  148. let color = ''
  149. this.selections.forEach(item => {
  150. if (item.id === row.id) {
  151. color = 'rowStyle'
  152. }
  153. })
  154. return color
  155. },
  156. // table - 全选
  157. selectAll(val) {
  158. this.selections = val
  159. },
  160. onMouseDown(event) {
  161. this.mousedownTime = Date.now()
  162. this.mousedownX = event.clientX
  163. this.mousedownY = event.clientY
  164. },
  165. onMouseUp() {
  166. // 可以在这里添加更多逻辑,比如清除临时数据等
  167. },
  168. // table - 双击查看详情
  169. tableDoubleClick(row) {
  170. if (this.timer) {
  171. clearTimeout(this.timer)
  172. }
  173. this.arcId = row.id
  174. this.$nextTick(() => {
  175. this.$refs.archivesInfo.detailTitle = '项目详情'
  176. this.$refs.archivesInfo.archivesInfoVisible = true
  177. this.$refs.archivesInfo.archivesTabIndex = 0
  178. this.$refs.archivesInfo.getDetial(1, row.id)
  179. })
  180. },
  181. // table - 当前选中得row
  182. clickRowHandler(row) {
  183. // this.parentsData.smartQuery = {
  184. // 'retention': null,
  185. // 'security_class': null,
  186. // 'doc_type': null,
  187. // 'medium_type': null,
  188. // 'archive_year': null,
  189. // 'fonds_no': null
  190. // }
  191. if (this.timer) {
  192. clearTimeout(this.timer)
  193. }
  194. const clickTime = Date.now()
  195. const clickX = event.clientX
  196. const clickY = event.clientY
  197. const timeDiff = clickTime - this.mousedownTime
  198. const distance = Math.sqrt(
  199. Math.pow(clickX - this.mousedownX, 2) + Math.pow(clickY - this.mousedownY, 2)
  200. )
  201. // 时间差较短且鼠标移动距离较小,判定为点击操作
  202. if (timeDiff < 300 && distance < 10) {
  203. this.timer = setTimeout(() => {
  204. this.parentId = row.id
  205. this.openAnjuan('所属项目:' + row.project_no, this.parentId, row)
  206. this.getDictsList(1)
  207. }, 300)
  208. this.selections = this.crud.selections
  209. }
  210. },
  211. // 触发单选
  212. handleCurrentChange(selection, row) {
  213. this.selections = selection
  214. },
  215. handleSizeChange(size) {
  216. this.currentPage = 1
  217. this.page.size = size
  218. this.page.page = 0
  219. localStorage.setItem('currentPageSize', size)
  220. this.getViewTable(1)
  221. },
  222. handleCurrentPage(pageVal) {
  223. this.currentPage = pageVal
  224. this.page.page = pageVal - 1
  225. localStorage.setItem('currentPage', JSON.stringify(this.page.page))
  226. this.getViewTable(1)
  227. }
  228. }
  229. }
  230. </script>
  231. <style lang='scss' scoped>
  232. </style>