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

344 lines
11 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
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. <!-- 移动 -->
  3. <el-dialog class="move-form" append-to-body :modal-append-to-body="false" :close-on-click-modal="false" :before-close="handleClose" :visible="moveVisible" title="移动" @opened="opened">
  4. <span class="dialog-right-top" />
  5. <span class="dialog-left-bottom" />
  6. <div class="setting-dialog">
  7. <div class="move-main">
  8. <div class="move-left">
  9. <el-tree
  10. ref="treeMove"
  11. v-loading="crud.loading"
  12. :data="crud.data"
  13. node-key="id"
  14. default-expand-all
  15. :props="defaultProps"
  16. :expand-on-click-node="false"
  17. @node-click="handleMoveNodeClick"
  18. />
  19. </div>
  20. <div class="move-right">
  21. <div style="padding: 10px;">
  22. <el-input v-model="query.search" placeholder="输入题名或档号搜索" style="width: 200px;" />
  23. <el-button class="filter-item filter-search" size="mini" type="success" icon="el-icon-search" @click="getViewTableList">搜索</el-button>
  24. </div>
  25. <div class="raido-main">
  26. <!-- @select="handleSelect"
  27. @selection-change="selectionChangeHandler"
  28. @row-click="clickRowHandler" -->
  29. <el-table
  30. ref="table"
  31. v-loading="loading"
  32. lazy
  33. :data="tableData"
  34. style="width: 100%;"
  35. height="calc(100vh)"
  36. :row-key="getRowKey"
  37. :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
  38. highlight-current-row
  39. @selection-change="selectionChangeHandler"
  40. @row-click="clickRowHandler"
  41. >
  42. <el-table-column type="selection" align="center" width="55" />
  43. <el-table-column v-for="field in tableDisplayFields" :key="field.id" :label="field.fieldCnName" :align="field.displayformatType" :width="field.displayLength" show-overflow-tooltip>
  44. <template slot="header">
  45. <el-tooltip
  46. class="item"
  47. effect="dark"
  48. :content="field.fieldCnName"
  49. placement="top-start"
  50. >
  51. <span>{{ field.fieldCnName }}</span>
  52. </el-tooltip>
  53. </template>
  54. <template slot-scope="scope">
  55. {{ scope.row[field.fieldName] }}
  56. </template>
  57. </el-table-column>
  58. </el-table>
  59. </div>
  60. <el-pagination
  61. v-if="tableData.length !== 0"
  62. :current-page="page.page"
  63. :total="page.total"
  64. :page-size="page.size"
  65. :pager-count="5"
  66. layout="total, prev, pager, next, sizes"
  67. @size-change="handleSizeChange"
  68. @current-change="handleCurrentPage"
  69. />
  70. </div>
  71. </div>
  72. <div slot="footer" class="dialog-footer">
  73. <el-button type="text" @click="closedDialog">取消</el-button>
  74. <el-button type="primary" @click="handleComfirmed">确定</el-button>
  75. </div>
  76. </div>
  77. </el-dialog>
  78. </template>
  79. <script>
  80. import { preLibraryCrud } from '../mixins/index'
  81. import CRUD, { presenter, header, crud } from '@crud/crud'
  82. import { FetchMove } from '@/api/prearchiveLibrary/prearchiveLibrary'
  83. import { FetchInitCategoryViewTable, FetchInitCategoryView } from '@/api/collect/collect'
  84. import Vue from 'vue'
  85. export default {
  86. name: 'MoveFile',
  87. components: { },
  88. cruds() {
  89. return [
  90. CRUD({
  91. title: '移动', url: 'api/category/menu',
  92. crudMethod: {}, sort: []
  93. })
  94. ]
  95. },
  96. mixins: [presenter(), header(), crud(), preLibraryCrud],
  97. props: {
  98. selectedDocument: {
  99. type: Object,
  100. default: function() {
  101. return {}
  102. }
  103. }
  104. },
  105. data() {
  106. return {
  107. selectedCategoryMove: {},
  108. query: {
  109. search: ''
  110. },
  111. moveVisible: false,
  112. loading: false,
  113. arrySort: [],
  114. tableData: [],
  115. tableDisplayFields: [],
  116. selections: [],
  117. moveArc: [],
  118. defaultProps: { children: 'children', label: 'cnName' },
  119. page: {
  120. page: 1,
  121. size: 10,
  122. total: 0
  123. }
  124. }
  125. },
  126. watch: {
  127. selectedDocument: function(newValue, oldValue) {
  128. }
  129. },
  130. created() {
  131. },
  132. methods: {
  133. getRowKey(row) {
  134. return row.id
  135. },
  136. [CRUD.HOOK.afterRefresh]() {
  137. this.crud.data = this.filterData(this.crud.data)
  138. },
  139. opened() {
  140. this.refresh()
  141. },
  142. refresh() {
  143. if (this.$refs.treeMove) {
  144. let currentKey
  145. if (this.crud.data[0].isType === 1) {
  146. console.log(currentKey)
  147. currentKey = this.findNode(this.crud.data[0].children, (node) => {
  148. return node.isType !== 1
  149. })
  150. } else {
  151. currentKey = this.crud.data[0]
  152. }
  153. // 设置某个节点的当前选中状态
  154. this.$refs.treeMove.setCurrentKey(currentKey.id)
  155. this.$nextTick(() => {
  156. // 设置某个节点的父级展开
  157. const selectedKey = this.$refs.treeMove.getCurrentNode()
  158. if (this.$refs.treeMove.getNode(selectedKey) && this.$refs.treeMove.getNode(selectedKey).parent) {
  159. this.expandParents(this.$refs.treeMove.getNode(selectedKey).parent)
  160. }
  161. // 选中节点的门类详情
  162. this.handleMoveNodeClick(selectedKey)
  163. })
  164. }
  165. },
  166. // 选中门类后,设置门类详情数据
  167. handleMoveNodeClick(val) {
  168. if (val) {
  169. this.selectedCategoryMove = val
  170. if (val.pid !== '0') {
  171. Vue.set(this.selectedCategoryMove, 'parentName', this.$refs.treeMove.getNode(val.pid).data.cnName)
  172. }
  173. this.getViewTable()
  174. }
  175. },
  176. getViewTable() {
  177. this.loading = true
  178. this.tableDisplayFields = []
  179. FetchInitCategoryViewTable({ categoryId: this.selectedCategoryMove.id, categoryLevel: 3 }).then((res) => {
  180. if (res) {
  181. this.arrySort = []
  182. this.tableDisplayFields = res
  183. const orderSortArry = this.tableDisplayFields.filter(item => item.displayOrder).sort((a, b) => a.displayOrder - b.displayOrder)
  184. orderSortArry.forEach(item => {
  185. if (item.displayOrderBy) {
  186. this.arrySort.push(item.fieldName + ',' + item.displayOrderBy)
  187. }
  188. })
  189. this.$nextTick(() => {
  190. this.getViewTableList()
  191. })
  192. this.loading = false
  193. }
  194. })
  195. },
  196. getViewTableList() {
  197. this.tableData = []
  198. this.loading = true
  199. const params = {
  200. 'categoryId': this.selectedCategoryMove.id,
  201. 'categoryLevel': 3,
  202. 'search': this.query.search,
  203. 'page': this.page.page - 1,
  204. 'size': this.page.size
  205. }
  206. FetchInitCategoryView(params).then((res) => {
  207. console.log(res)
  208. if (res.code !== 500) {
  209. this.tableData = res.list.content
  210. this.page.total = res.list.totalElements
  211. }
  212. this.loading = false
  213. })
  214. },
  215. handleClose(done) {
  216. this.moveVisible = false
  217. this.query.search = null
  218. done()
  219. },
  220. closedDialog() {
  221. this.moveVisible = false
  222. this.query.search = null
  223. },
  224. clickRowHandler(row) {
  225. this.selections = []
  226. this.$refs.table.clearSelection()
  227. this.$refs.table.toggleRowSelection(row)
  228. this.selections.push(row)
  229. },
  230. selectionChangeHandler(selection, row) {
  231. this.selections = selection
  232. },
  233. handleComfirmed() {
  234. if (this.selections.length === 0) {
  235. this.crud.notify('请选择要移动到收集库的档案', CRUD.NOTIFICATION_TYPE.WARNING)
  236. return false
  237. }
  238. const archivesIds = this.moveArc.map(item => {
  239. return item.id
  240. })
  241. const params = {
  242. 'archivesId': this.selections[0].id, // 移动到的收集库档案id
  243. 'archivesIds': archivesIds, // 移动的预归档档案信息
  244. 'categoryId': this.selectedCategoryMove.id, // 门类id
  245. 'documentId': this.selectedDocument.id // 预归档门类id
  246. }
  247. console.log(params)
  248. FetchMove(params).then((res) => {
  249. this.$message.success(res)
  250. this.moveVisible = false
  251. this.query.search = null
  252. this.selections = []
  253. this.$emit('refresh')
  254. })
  255. },
  256. handleSizeChange(size) {
  257. this.page.size = size
  258. this.page.page = 1
  259. this.getViewTableList()
  260. },
  261. handleCurrentPage(val) {
  262. this.page.page = val
  263. this.getViewTableList()
  264. }
  265. }
  266. }
  267. </script>
  268. <style lang="scss" scoped>
  269. @import "~@/assets/styles/prearchive-library.scss";
  270. .el-pagination{
  271. padding-right: 5px;
  272. margin: 25px 0 !important;
  273. }
  274. ::v-deep .el-dialog{
  275. .el-button.filter-search{
  276. background-color: #0348f3;
  277. border-color: #0348f3;
  278. color: #fff !important;
  279. }
  280. .el-tree{
  281. .el-tree-node__content{
  282. color: #0C0E1E;
  283. &:hover{
  284. background-color: #E8F2FF !important;
  285. background-image: none !important;
  286. }
  287. }
  288. .el-tree-node__children{
  289. .el-tree-node__content{
  290. color: #545B65;
  291. }
  292. }
  293. .el-tree-node__expand-icon{
  294. color: #0C0E1E;
  295. }
  296. .is-current>.el-tree-node__content{
  297. background-color: #E8F2FF !important;
  298. background-image: none !important;
  299. }
  300. .el-tree-node.is-current>.el-tree-node__content .el-tree-node__label{
  301. background-image: none !important;
  302. color: #0348F3;
  303. }
  304. }
  305. .el-table{
  306. .el-table__header-wrapper,
  307. .el-table__header{
  308. background-color: #F5F9FC !important;
  309. th.el-table__cell{
  310. background-color: #F5F9FC !important;
  311. border-bottom: none;
  312. &>.cell{
  313. font-size: 14px;
  314. color: #0C0E1E !important;
  315. }
  316. }
  317. }
  318. }
  319. .el-table .el-table__body-wrapper td.el-table__cell,
  320. .el-table .el-table__fixed-right td.el-table__cell {
  321. border-bottom: none;
  322. }
  323. .el-table__body tr.el-table__row:hover>td.el-table__cell,
  324. .el-table__body tr.el-table__row:focus>td.el-table__cell,
  325. .el-table__body tr.current-row>td.el-table__cell,
  326. .el-table__body tr.current-row:hover>td.el-table__cell,
  327. .el-table__body tr.current-row:focus>td.el-table__cell{
  328. background-color: #eaf3fb;
  329. color: #545b65;
  330. border-bottom: 1px solid #f5f9fc;
  331. }
  332. .el-button--text:hover,
  333. .el-button--text:focus{
  334. border-color: #e6e8ed;
  335. color: #545b65;
  336. background-color: #E8F2FF;
  337. }
  338. }
  339. </style>