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

489 lines
16 KiB

4 months ago
2 years ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months 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" is-move-file="true" @nodeClick="handleNodeClick" />
  7. </div>
  8. <div v-if="currentCategory && currentCategory.isType===2" 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. <!-- :disabled="currentCategory&&currentCategory.arrangeType===3&&moveSelections.length===0&&collectLevel===2 " -->
  80. <el-button :loading="btnLoading" type="primary" @click.native="handleComfireCollectMoveFile">确定</el-button>
  81. </div>
  82. </el-dialog>
  83. </template>
  84. <script>
  85. import CategoryTree from '@/views/components/categoryTree'
  86. import { FetchInitCategoryViewTable, FetchInitCategoryView, FetchMove } from '@/api/collect/collect'
  87. export default {
  88. name: 'CollectMoveFile',
  89. components: { CategoryTree },
  90. props: {
  91. selectedCategory: {
  92. type: Object,
  93. default: function() {
  94. return {}
  95. }
  96. },
  97. collectLevel: {
  98. type: Number,
  99. default: function() {
  100. return null
  101. }
  102. },
  103. selections: {
  104. type: Array,
  105. default: () => []
  106. }
  107. },
  108. data() {
  109. return {
  110. btnLoading: false,
  111. query: {
  112. search: null
  113. },
  114. currentCategory: null,
  115. currentLevel: null,
  116. collectMoveFileVisible: false,
  117. toCategoryLevel: null,
  118. loading: false,
  119. arrySort: [],
  120. tableData: [],
  121. tableDisplayFields: [],
  122. moveSelections: [],
  123. page: {
  124. page: 1,
  125. size: 10,
  126. total: 0
  127. },
  128. moveFile: true,
  129. isReserve: false,
  130. tabIndex: 0,
  131. parentsId: null
  132. }
  133. },
  134. mounted() {
  135. },
  136. methods: {
  137. resetQuery() {
  138. this.query.search = null
  139. this.getViewTableList()
  140. },
  141. getRowKey(row) {
  142. return row.id
  143. },
  144. handleNodeClick(data) {
  145. if (data) {
  146. this.currentCategory = data
  147. if (this.currentCategory.isType !== 1) {
  148. this.getViewTable()
  149. } else {
  150. this.tableDisplayFields = []
  151. this.tableData = []
  152. }
  153. }
  154. },
  155. open() {
  156. if (this.currentCategory) {
  157. this.getViewTable()
  158. }
  159. },
  160. getViewTable() {
  161. this.loading = true
  162. this.tableDisplayFields = []
  163. if (this.currentCategory.arrangeType === 1) {
  164. this.currentLevel = 3
  165. } else if (this.currentCategory.arrangeType === 2) {
  166. this.currentLevel = 2
  167. } else {
  168. this.currentLevel = 2
  169. // if (this.tabIndex === 1) {
  170. // this.currentLevel = 2
  171. // } else {
  172. // this.currentLevel = 1
  173. // }
  174. }
  175. FetchInitCategoryViewTable({ categoryId: this.currentCategory.id, categoryLevel: this.currentLevel }).then((res) => {
  176. if (res) {
  177. this.arrySort = []
  178. this.tableDisplayFields = res
  179. const orderSortArry = this.tableDisplayFields.filter(item => item.displayOrder).sort((a, b) => a.displayOrder - b.displayOrder)
  180. orderSortArry.forEach(item => {
  181. if (item.displayOrderBy) {
  182. this.arrySort.push(item.fieldName + ',' + item.displayOrderBy)
  183. }
  184. })
  185. this.$nextTick(() => {
  186. this.getViewTableList()
  187. })
  188. this.loading = false
  189. }
  190. })
  191. },
  192. getViewTableList() {
  193. this.tableData = []
  194. this.loading = true
  195. const params = {
  196. 'categoryId': this.currentCategory.id,
  197. 'categoryLevel': this.currentLevel,
  198. 'ignore': false,
  199. 'isdel': false,
  200. 'fonds_no': this.currentCategory.fondsId,
  201. 'search': this.query.search,
  202. 'page': this.page.page - 1,
  203. 'size': this.page.size
  204. }
  205. FetchInitCategoryView(params).then((res) => {
  206. if (res.code !== 500) {
  207. this.tableData = res.list.content
  208. this.page.total = res.list.totalElements
  209. }
  210. this.loading = false
  211. })
  212. },
  213. changeActiveTab(data) {
  214. this.tabIndex = data
  215. this.getViewTable()
  216. this.moveSelections = []
  217. },
  218. clickRowHandler(row) {
  219. this.moveSelections = []
  220. this.$refs.table.clearSelection()
  221. this.$refs.table.toggleRowSelection(row)
  222. // this.moveSelections.push(row)
  223. },
  224. selectionChangeHandler(selection, row) {
  225. this.moveSelections = selection
  226. },
  227. handleComfireCollectMoveFile() {
  228. const archivesIds = this.selections.map(item => item.id)
  229. if (this.moveSelections.length > 1) {
  230. this.$message({ message: '该操作只可勾选唯一目标条目,请先确认!', offset: 8 })
  231. return false
  232. }
  233. if (this.currentCategory.arrangeType === 1) {
  234. // 文件级
  235. this.toCategoryLevel = 3
  236. } else if (this.currentCategory.arrangeType === 2) {
  237. // 案卷级
  238. this.toCategoryLevel = 2
  239. } else {
  240. // 项目内
  241. this.toCategoryLevel = 2
  242. // // 需要移动的门类级别
  243. // if (this.collectLevel === 3) {
  244. // console.log('444')
  245. // // 卷内级
  246. // // 选择了项目门类,但是没选文件,则进入未整理的,即文件级
  247. // if (this.moveSelections.length === 0) {
  248. // this.toCategoryLevel = 3
  249. // console.log('555')
  250. // } else {
  251. // console.log('666')
  252. // // 有指定的目标,案卷列表tab
  253. // if (this.tabIndex === 1) {
  254. // this.toCategoryLevel = 2
  255. // console.log('777')
  256. // } else {
  257. // this.toCategoryLevel = 3
  258. // console.log('888')
  259. // }
  260. // }
  261. // } else {
  262. // console.log('999')
  263. // // 案卷级
  264. // if (this.tabIndex === 1) {
  265. // console.log('10')
  266. // this.toCategoryLevel = 2
  267. // } else {
  268. // console.log('11')
  269. // this.toCategoryLevel = 1
  270. // }
  271. // }
  272. }
  273. console.log('parentsId', this.parentsId)
  274. console.log('this.currentCategory', this.currentCategory)
  275. console.log('this.collectLevel', this.collectLevel)
  276. console.log('this.toCategoryLevel', this.toCategoryLevel)
  277. console.log('this.selections', this.selections)
  278. console.log('this.moveSelections', this.moveSelections)
  279. // if (this.collectLevel === 2) {
  280. // if (this.toCategoryLevel === 3) {
  281. // this.$message({ message: '案卷不可移动到文件级,请先确认!', offset: 8 })
  282. // return false
  283. // }
  284. // }
  285. if (this.collectLevel === this.toCategoryLevel) {
  286. if (this.moveSelections.length === 0) {
  287. if (this.currentCategory.arrangeType !== 1) {
  288. this.$message({ message: '1请选择一个案卷条目进行移动操作!', offset: 8 })
  289. return false
  290. } else {
  291. if (this.selectedCategory.id === this.currentCategory.id) {
  292. this.$message({ message: '正在移动的档案不操作移动到自身同门类下!', offset: 8 })
  293. return false
  294. }
  295. }
  296. } else {
  297. if (this.currentCategory.arrangeType === 1) {
  298. this.$message({ message: '不可选择文件条目进行移动!', offset: 8 })
  299. return false
  300. }
  301. if (this.parentsId === this.moveSelections[0].id) {
  302. this.$message({ message: '正在移动的档案不操作移动到自身档案下!', offset: 8 })
  303. return false
  304. }
  305. }
  306. } else {
  307. if (this.moveSelections.length === 0) {
  308. this.$message({ message: '请选择一个案卷条目进行移动操作!', offset: 8 })
  309. return false
  310. } else {
  311. if (this.currentCategory.arrangeType === 1) {
  312. this.$message({ message: '不可选择文件条目进行移动!', offset: 8 })
  313. return false
  314. } else {
  315. if (this.parentsId === this.moveSelections[0].id) {
  316. this.$message({ message: '正在移动的档案不操作移动到自身档案下!', offset: 8 })
  317. return false
  318. }
  319. }
  320. }
  321. }
  322. // const toArchivesIds = this.moveSelections.map(item => item.id)
  323. let toArchivesId
  324. if (this.moveSelections.length === 0) {
  325. toArchivesId = null
  326. } else {
  327. toArchivesId = this.moveSelections[0].id
  328. // if (this.collectLevel === 3) {
  329. // if (this.tabIndex === 1) {
  330. // toArchivesId = this.moveSelections[0].id
  331. // } else {
  332. // if (this.selectedCategory.arrangeType === 1) {
  333. // toArchivesId = this.moveSelections[0].id
  334. // } else {
  335. // toArchivesId = null
  336. // }
  337. // }
  338. // } else {
  339. // toArchivesId = this.moveSelections[0].id
  340. // }
  341. }
  342. this.btnLoading = true
  343. const params = {
  344. 'reserve': this.isReserve, // 是否保留原条目 true 保留 false 删除
  345. 'categoryId': this.selectedCategory.id, // 需要移动的门类总id
  346. 'categoryLevel': this.collectLevel, // 需要移动的门类级别
  347. 'archivesIds': archivesIds, // 需要移动的档案id集合
  348. 'toCategoryId': this.currentCategory.id, // 移动到的门类id
  349. 'toCategoryLevel': this.toCategoryLevel, // 移动到的门类级别
  350. 'toArchivesId': toArchivesId // 移动到的档案id (选填)
  351. }
  352. console.log(params)
  353. FetchMove(params).then((res) => {
  354. console.log(res)
  355. if (res.code !== 500) {
  356. this.$message({ message: '移动成功', type: 'success', offset: 8 })
  357. this.$emit('close-dialog')
  358. } else {
  359. this.$message({ message: '移动失败', type: 'error', offset: 8 })
  360. }
  361. this.handleCloseDialog()
  362. this.btnLoading = false
  363. })
  364. },
  365. handleSizeChange(size) {
  366. this.page.size = size
  367. this.page.page = 1
  368. this.getViewTableList()
  369. },
  370. handleCurrentPage(val) {
  371. this.page.page = val
  372. this.getViewTableList()
  373. },
  374. handleCloseDialog(done) {
  375. // 重置表单数据
  376. this.query.search = null
  377. this.tableDisplayFields = []
  378. this.tableData = []
  379. this.$refs.table.clearSelection()
  380. this.moveSelections = []
  381. this.collectMoveFileVisible = false
  382. this.isReserve = false
  383. // 关闭弹框
  384. // done()
  385. }
  386. }
  387. }
  388. </script>
  389. <style lang='scss' scoped>
  390. .collectMoveFile-dialog{
  391. ::v-deep .el-dialog{
  392. width: 1000px;
  393. .search-btn-box{
  394. .el-button{
  395. margin-left: 10px;
  396. }
  397. }
  398. }
  399. }
  400. .collectMove-main{
  401. display: flex;
  402. justify-content: space-between;
  403. width: 100%;
  404. height: 557px;
  405. border: 1px solid #E6E8ED;
  406. .collectMove-left{
  407. width: 260px;
  408. overflow: hidden;
  409. overflow-y: scroll;
  410. .elect-cont-left{
  411. width: auto !important;
  412. margin-right: 0 !important;
  413. }
  414. ::v-deep .container-left{
  415. min-height: calc(100%) !important;
  416. }
  417. }
  418. .collectMove-right{
  419. width: calc(100% - 260px);
  420. flex: 1;
  421. border-left: 1px solid #E6E8ED;
  422. .head-search{
  423. // padding: 0 20px 0 0;
  424. flex: 1;
  425. justify-content: flex-end;
  426. margin-bottom: 0;
  427. }
  428. .table-list{
  429. height: 440px;
  430. border-bottom: 1px solid #E6E8ED;
  431. .el-pagination{
  432. margin: 15px 0 !important;
  433. }
  434. }
  435. .move-checked{
  436. display: flex;
  437. justify-content: flex-start;
  438. padding: 0 30px;
  439. height: 42px;
  440. line-height: 42px;
  441. .checkbox-style{
  442. font-size: 14px;
  443. color: #0C0E1E;
  444. margin-right: 30px;
  445. }
  446. .el-checkbox{
  447. margin-right: 20px;
  448. ::v-deep .el-checkbox__input.is-disabled .el-checkbox__inner{
  449. border-color: #0348f3;
  450. background-color: #0348f3;
  451. }
  452. ::v-deep .el-checkbox__label{
  453. opacity: 0;
  454. margin-left: -100px;
  455. padding-left: 0;
  456. }
  457. }
  458. }
  459. }
  460. }
  461. .collectMove-header{
  462. display: flex;
  463. justify-content: space-between;
  464. align-items: center;
  465. padding: 20px 20px 20px 0;
  466. .detail-tab .tab-nav{
  467. margin: 0;
  468. border-bottom: none;
  469. }
  470. .detail-tab .tab-nav li{
  471. margin-right: 20px;
  472. }
  473. .detail-tab .tab-nav li.active-tab-nav{
  474. padding-bottom: 0;
  475. }
  476. }
  477. .dialog-footer{
  478. margin-top: 20px;
  479. }
  480. </style>