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

421 lines
13 KiB

2 years ago
  1. <template>
  2. <!-- 移动 -->
  3. <el-dialog class="collectMoveFile-dialog" title="移动" :close-on-click-modal="false" :modal-append-to-body="false" append-to-body :visible.sync="collectMoveFileVisible" :before-close="handleCloseDialog" @open="open">
  4. <div class="collectMove-main">
  5. <div class="collectMove-left">
  6. <CategoryTree ref="categoryTree" @nodeClick="handleNodeClick" />
  7. </div>
  8. <div class="collectMove-right">
  9. <div class="collectMove-header">
  10. <div v-if="currentCategory && currentCategory.arrangeType===3" class="detail-tab tab-content">
  11. <ul class="tab-nav">
  12. <li :class="{'active-tab-nav': tabIndex == 0}" @click="changeActiveTab(0)">项目列表</li>
  13. <li :class="{'active-tab-nav': tabIndex == 1}" @click="changeActiveTab(1)">案卷列表</li>
  14. </ul>
  15. </div>
  16. <div class="head-search">
  17. <el-input v-model="query.search" clearable size="small" placeholder="输入题名或档号搜索" prefix-icon="el-icon-search" style="width: 200px;" class="filter-item" @keyup.enter.native="getViewTableList" @clear="getViewTableList" />
  18. <el-button class="filter-item filter-search" style="margin: 0 10px;" size="mini" type="success" icon="el-icon-search" @click="getViewTableList">搜索</el-button>
  19. <el-button class="filter-item filter-refresh" size="mini" type="warning" icon="el-icon-refresh-left" @click="resetQuery">重置</el-button>
  20. </div>
  21. </div>
  22. <div class="table-list">
  23. <el-table
  24. ref="table"
  25. v-loading="loading"
  26. lazy
  27. :data="tableData"
  28. style="width: 100%;"
  29. height="calc(100%)"
  30. :row-key="getRowKey"
  31. :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
  32. highlight-current-row
  33. @selection-change="selectionChangeHandler"
  34. @row-click="clickRowHandler"
  35. >
  36. <el-table-column type="selection" align="center" width="55" />
  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="tableData.length !== 0"
  56. :current-page="page.page"
  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. <div class="move-checked">
  66. <div class="checkbox-style">
  67. <span>移动电子文件</span>
  68. <el-checkbox v-model="moveFile" label="移动电子文件" disabled />
  69. </div>
  70. <div class="checkbox-style">
  71. <span>保留原条目</span>
  72. <el-checkbox v-model="isReserve" label="保留原条目" />
  73. </div>
  74. </div>
  75. </div>
  76. </div>
  77. <div slot="footer" class="dialog-footer">
  78. <el-button type="text" @click="handleCloseDialog">取消</el-button>
  79. <el-button type="primary" :disabled="currentCategory&&currentCategory.arrangeType===3&&moveSelections.length===0&&collectLevel===2 " @click.native="handleComfireCollectMoveFile">确定</el-button>
  80. </div>
  81. </el-dialog>
  82. </template>
  83. <script>
  84. import CategoryTree from '@/views/components/categoryTree'
  85. import { FetchInitCategoryViewTable, FetchInitCategoryView, FetchMove } from '@/api/collect/collect'
  86. export default {
  87. name: 'CollectMoveFile',
  88. components: { CategoryTree },
  89. props: {
  90. selectedCategory: {
  91. type: Object,
  92. default: function() {
  93. return {}
  94. }
  95. },
  96. collectLevel: {
  97. type: Number,
  98. default: function() {
  99. return null
  100. }
  101. },
  102. selections: {
  103. type: Array,
  104. default: () => []
  105. }
  106. },
  107. data() {
  108. return {
  109. query: {
  110. search: null
  111. },
  112. currentCategory: null,
  113. currentLevel: null,
  114. collectMoveFileVisible: false,
  115. toCategoryLevel: null,
  116. loading: false,
  117. arrySort: [],
  118. tableData: [],
  119. tableDisplayFields: [],
  120. moveSelections: [],
  121. page: {
  122. page: 1,
  123. size: 10,
  124. total: 0
  125. },
  126. moveFile: true,
  127. isReserve: false,
  128. tabIndex: 0
  129. }
  130. },
  131. mounted() {
  132. },
  133. methods: {
  134. resetQuery() {
  135. this.query.search = null
  136. this.getViewTableList()
  137. },
  138. getRowKey(row) {
  139. return row.id
  140. },
  141. handleNodeClick(data) {
  142. if (data) {
  143. this.currentCategory = data
  144. if (this.currentCategory.isType !== 1) {
  145. this.getViewTable()
  146. } else {
  147. this.tableDisplayFields = []
  148. this.tableData = []
  149. }
  150. }
  151. },
  152. open() {
  153. if (this.currentCategory) {
  154. this.getViewTable()
  155. }
  156. },
  157. getViewTable() {
  158. this.loading = true
  159. this.tableDisplayFields = []
  160. if (this.currentCategory.arrangeType === 1) {
  161. this.currentLevel = 3
  162. } else if (this.currentCategory.arrangeType === 2) {
  163. this.currentLevel = 2
  164. } else {
  165. if (this.tabIndex === 1) {
  166. this.currentLevel = 2
  167. } else {
  168. this.currentLevel = 1
  169. }
  170. }
  171. FetchInitCategoryViewTable({ categoryId: this.currentCategory.id, categoryLevel: this.currentLevel }).then((res) => {
  172. if (res) {
  173. this.arrySort = []
  174. this.tableDisplayFields = res
  175. const orderSortArry = this.tableDisplayFields.filter(item => item.displayOrder).sort((a, b) => a.displayOrder - b.displayOrder)
  176. orderSortArry.forEach(item => {
  177. if (item.displayOrderBy) {
  178. this.arrySort.push(item.fieldName + ',' + item.displayOrderBy)
  179. }
  180. })
  181. this.$nextTick(() => {
  182. this.getViewTableList()
  183. })
  184. this.loading = false
  185. }
  186. })
  187. },
  188. getViewTableList() {
  189. this.tableData = []
  190. this.loading = true
  191. const params = {
  192. 'categoryId': this.currentCategory.id,
  193. 'categoryLevel': this.currentLevel,
  194. 'search': this.query.search,
  195. 'page': this.page.page - 1,
  196. 'size': this.page.size
  197. }
  198. FetchInitCategoryView(params).then((res) => {
  199. console.log(res)
  200. if (res.code !== 500) {
  201. this.tableData = res.list.content
  202. this.page.total = res.list.totalElements
  203. }
  204. this.loading = false
  205. })
  206. },
  207. changeActiveTab(data) {
  208. this.tabIndex = data
  209. this.getViewTable()
  210. this.moveSelections = []
  211. },
  212. clickRowHandler(row) {
  213. this.moveSelections = []
  214. this.$refs.table.clearSelection()
  215. this.$refs.table.toggleRowSelection(row)
  216. // this.moveSelections.push(row)
  217. },
  218. selectionChangeHandler(selection, row) {
  219. this.moveSelections = selection
  220. },
  221. handleComfireCollectMoveFile() {
  222. if (this.moveSelections.length > 1) {
  223. this.$message('该操作只可勾选唯一目标条目,请先确认!')
  224. return false
  225. }
  226. if (this.currentCategory.arrangeType === 1) {
  227. this.toCategoryLevel = 3
  228. } else if (this.currentCategory.arrangeType === 2) {
  229. this.toCategoryLevel = 2
  230. } else {
  231. console.log(this.collectLevel)
  232. if (this.collectLevel === 3) {
  233. if (this.moveSelections.length === 0) {
  234. this.toCategoryLevel = 3
  235. } else {
  236. if (this.tabIndex === 1) {
  237. this.toCategoryLevel = 2
  238. } else {
  239. this.toCategoryLevel = 3
  240. }
  241. }
  242. } else {
  243. if (this.tabIndex === 1) {
  244. this.toCategoryLevel = 2
  245. } else {
  246. this.toCategoryLevel = 1
  247. }
  248. }
  249. }
  250. if (this.collectLevel === 2) {
  251. if (this.toCategoryLevel === 3) {
  252. this.$message('案卷级的案卷不可移动到文件级,请先确认!')
  253. return false
  254. }
  255. }
  256. if (this.selectedCategory.id === this.currentCategory.id) {
  257. this.$message('正在移动的档案只可移动到其他位置,不可选择本身!')
  258. return false
  259. }
  260. const archivesIds = this.selections.map(item => item.id)
  261. // const toArchivesIds = this.moveSelections.map(item => item.id)
  262. let toArchivesId
  263. if (this.moveSelections.length === 0) {
  264. toArchivesId = null
  265. } else {
  266. if (this.collectLevel === 3) {
  267. console.log('this.tabIndex66', this.tabIndex)
  268. if (this.tabIndex === 1) {
  269. toArchivesId = this.moveSelections[0].id
  270. } else {
  271. if (this.selectedCategory.arrangeType === 1) {
  272. toArchivesId = this.moveSelections[0].id
  273. } else {
  274. toArchivesId = null
  275. }
  276. }
  277. } else {
  278. toArchivesId = this.moveSelections[0].id
  279. }
  280. }
  281. const params = {
  282. 'reserve': this.isReserve, // 是否保留原条目 true 保留 false 删除
  283. 'categoryId': this.selectedCategory.id, // 需要移动的门类总id
  284. 'categoryLevel': this.collectLevel, // 需要移动的门类级别
  285. 'archivesIds': archivesIds, // 需要移动的档案id集合
  286. 'toCategoryId': this.currentCategory.id, // 移动到的门类id
  287. 'toCategoryLevel': this.toCategoryLevel, // 移动到的门类级别
  288. 'toArchivesId': toArchivesId // 移动到的档案id (选填)
  289. }
  290. console.log(params)
  291. FetchMove(params).then((res) => {
  292. console.log(res)
  293. if (res.code !== 500) {
  294. this.$message.success('移动成功')
  295. this.$emit('close-dialog')
  296. } else {
  297. this.$message.error('移动失败')
  298. }
  299. this.handleCloseDialog()
  300. })
  301. },
  302. handleSizeChange(size) {
  303. this.page.size = size
  304. this.page.page = 1
  305. this.getViewTableList()
  306. },
  307. handleCurrentPage(val) {
  308. this.page.page = val
  309. this.getViewTableList()
  310. },
  311. handleCloseDialog(done) {
  312. // 重置表单数据
  313. this.query.search = null
  314. this.tableDisplayFields = []
  315. this.tableData = []
  316. this.$refs.table.clearSelection()
  317. this.moveSelections = []
  318. this.collectMoveFileVisible = false
  319. this.isReserve = false
  320. // 关闭弹框
  321. // done()
  322. }
  323. }
  324. }
  325. </script>
  326. <style lang='scss' scoped>
  327. .collectMoveFile-dialog{
  328. ::v-deep .el-dialog{
  329. width: 1000px;
  330. .search-btn-box{
  331. .el-button{
  332. margin-left: 10px;
  333. }
  334. }
  335. }
  336. }
  337. .collectMove-main{
  338. display: flex;
  339. justify-content: space-between;
  340. width: 100%;
  341. height: 557px;
  342. border: 1px solid #E6E8ED;
  343. .collectMove-left{
  344. width: 260px;
  345. overflow: hidden;
  346. overflow-y: scroll;
  347. .elect-cont-left{
  348. width: auto !important;
  349. margin-right: 0 !important;
  350. }
  351. ::v-deep .container-left{
  352. min-height: calc(100%) !important;
  353. }
  354. }
  355. .collectMove-right{
  356. width: calc(100% - 260px);
  357. flex: 1;
  358. border-left: 1px solid #E6E8ED;
  359. .head-search{
  360. // padding: 0 20px 0 0;
  361. flex: 1;
  362. justify-content: flex-end;
  363. margin-bottom: 0;
  364. }
  365. .table-list{
  366. height: 440px;
  367. border-bottom: 1px solid #E6E8ED;
  368. .el-pagination{
  369. margin: 15px 0 !important;
  370. }
  371. }
  372. .move-checked{
  373. display: flex;
  374. justify-content: flex-start;
  375. padding: 0 30px;
  376. height: 42px;
  377. line-height: 42px;
  378. .checkbox-style{
  379. font-size: 14px;
  380. color: #0C0E1E;
  381. margin-right: 30px;
  382. }
  383. .el-checkbox{
  384. margin-right: 20px;
  385. ::v-deep .el-checkbox__input.is-disabled .el-checkbox__inner{
  386. border-color: #0348f3;
  387. background-color: #0348f3;
  388. }
  389. ::v-deep .el-checkbox__label{
  390. opacity: 0;
  391. margin-left: -100px;
  392. padding-left: 0;
  393. }
  394. }
  395. }
  396. }
  397. }
  398. .collectMove-header{
  399. display: flex;
  400. justify-content: space-between;
  401. align-items: center;
  402. padding: 20px 20px 20px 0;
  403. .detail-tab .tab-nav{
  404. margin: 0;
  405. border-bottom: none;
  406. }
  407. .detail-tab .tab-nav li{
  408. margin-right: 20px;
  409. }
  410. .detail-tab .tab-nav li.active-tab-nav{
  411. padding-bottom: 0;
  412. }
  413. }
  414. .dialog-footer{
  415. margin-top: 20px;
  416. }
  417. </style>