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

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