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

424 lines
13 KiB

7 months ago
7 months ago
2 years ago
7 months ago
7 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" @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 :loading="btnLoading" 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. btnLoading: false,
  110. query: {
  111. search: null
  112. },
  113. currentCategory: null,
  114. currentLevel: null,
  115. collectMoveFileVisible: false,
  116. toCategoryLevel: null,
  117. loading: false,
  118. arrySort: [],
  119. tableData: [],
  120. tableDisplayFields: [],
  121. moveSelections: [],
  122. page: {
  123. page: 1,
  124. size: 10,
  125. total: 0
  126. },
  127. moveFile: true,
  128. isReserve: false,
  129. tabIndex: 0
  130. }
  131. },
  132. mounted() {
  133. },
  134. methods: {
  135. resetQuery() {
  136. this.query.search = null
  137. this.getViewTableList()
  138. },
  139. getRowKey(row) {
  140. return row.id
  141. },
  142. handleNodeClick(data) {
  143. if (data) {
  144. this.currentCategory = data
  145. if (this.currentCategory.isType !== 1) {
  146. this.getViewTable()
  147. } else {
  148. this.tableDisplayFields = []
  149. this.tableData = []
  150. }
  151. }
  152. },
  153. open() {
  154. if (this.currentCategory) {
  155. this.getViewTable()
  156. }
  157. },
  158. getViewTable() {
  159. this.loading = true
  160. this.tableDisplayFields = []
  161. if (this.currentCategory.arrangeType === 1) {
  162. this.currentLevel = 3
  163. } else if (this.currentCategory.arrangeType === 2) {
  164. this.currentLevel = 2
  165. } else {
  166. if (this.tabIndex === 1) {
  167. this.currentLevel = 2
  168. } else {
  169. this.currentLevel = 1
  170. }
  171. }
  172. FetchInitCategoryViewTable({ categoryId: this.currentCategory.id, categoryLevel: this.currentLevel }).then((res) => {
  173. if (res) {
  174. this.arrySort = []
  175. this.tableDisplayFields = res
  176. const orderSortArry = this.tableDisplayFields.filter(item => item.displayOrder).sort((a, b) => a.displayOrder - b.displayOrder)
  177. orderSortArry.forEach(item => {
  178. if (item.displayOrderBy) {
  179. this.arrySort.push(item.fieldName + ',' + item.displayOrderBy)
  180. }
  181. })
  182. this.$nextTick(() => {
  183. this.getViewTableList()
  184. })
  185. this.loading = false
  186. }
  187. })
  188. },
  189. getViewTableList() {
  190. this.tableData = []
  191. this.loading = true
  192. const params = {
  193. 'categoryId': this.currentCategory.id,
  194. 'categoryLevel': this.currentLevel,
  195. 'ignore': false,
  196. 'search': this.query.search,
  197. 'page': this.page.page - 1,
  198. 'size': this.page.size
  199. }
  200. FetchInitCategoryView(params).then((res) => {
  201. console.log(res)
  202. if (res.code !== 500) {
  203. this.tableData = res.list.content
  204. this.page.total = res.list.totalElements
  205. }
  206. this.loading = false
  207. })
  208. },
  209. changeActiveTab(data) {
  210. this.tabIndex = data
  211. this.getViewTable()
  212. this.moveSelections = []
  213. },
  214. clickRowHandler(row) {
  215. this.moveSelections = []
  216. this.$refs.table.clearSelection()
  217. this.$refs.table.toggleRowSelection(row)
  218. // this.moveSelections.push(row)
  219. },
  220. selectionChangeHandler(selection, row) {
  221. this.moveSelections = selection
  222. },
  223. handleComfireCollectMoveFile() {
  224. if (this.moveSelections.length > 1) {
  225. this.$message({ message: '该操作只可勾选唯一目标条目,请先确认!', offset: 8 })
  226. return false
  227. }
  228. if (this.currentCategory.arrangeType === 1) {
  229. this.toCategoryLevel = 3
  230. } else if (this.currentCategory.arrangeType === 2) {
  231. this.toCategoryLevel = 2
  232. } else {
  233. console.log(this.collectLevel)
  234. if (this.collectLevel === 3) {
  235. if (this.moveSelections.length === 0) {
  236. this.toCategoryLevel = 3
  237. } else {
  238. if (this.tabIndex === 1) {
  239. this.toCategoryLevel = 2
  240. } else {
  241. this.toCategoryLevel = 3
  242. }
  243. }
  244. } else {
  245. if (this.tabIndex === 1) {
  246. this.toCategoryLevel = 2
  247. } else {
  248. this.toCategoryLevel = 1
  249. }
  250. }
  251. }
  252. if (this.collectLevel === 2) {
  253. if (this.toCategoryLevel === 3) {
  254. this.$message({ message: '案卷级的案卷不可移动到文件级,请先确认!', offset: 8 })
  255. return false
  256. }
  257. }
  258. if (this.selectedCategory.id === this.currentCategory.id) {
  259. this.$message({ message: '正在移动的档案只可移动到其他位置,不可选择本身!', offset: 8 })
  260. return false
  261. }
  262. const archivesIds = this.selections.map(item => item.id)
  263. // const toArchivesIds = this.moveSelections.map(item => item.id)
  264. let toArchivesId
  265. if (this.moveSelections.length === 0) {
  266. toArchivesId = null
  267. } else {
  268. if (this.collectLevel === 3) {
  269. if (this.tabIndex === 1) {
  270. toArchivesId = this.moveSelections[0].id
  271. } else {
  272. if (this.selectedCategory.arrangeType === 1) {
  273. toArchivesId = this.moveSelections[0].id
  274. } else {
  275. toArchivesId = null
  276. }
  277. }
  278. } else {
  279. toArchivesId = this.moveSelections[0].id
  280. }
  281. }
  282. this.btnLoading = true
  283. const params = {
  284. 'reserve': this.isReserve, // 是否保留原条目 true 保留 false 删除
  285. 'categoryId': this.selectedCategory.id, // 需要移动的门类总id
  286. 'categoryLevel': this.collectLevel, // 需要移动的门类级别
  287. 'archivesIds': archivesIds, // 需要移动的档案id集合
  288. 'toCategoryId': this.currentCategory.id, // 移动到的门类id
  289. 'toCategoryLevel': this.toCategoryLevel, // 移动到的门类级别
  290. 'toArchivesId': toArchivesId // 移动到的档案id (选填)
  291. }
  292. console.log(params)
  293. FetchMove(params).then((res) => {
  294. console.log(res)
  295. if (res.code !== 500) {
  296. this.$message({ message: '移动成功', type: 'success', offset: 8 })
  297. this.$emit('close-dialog')
  298. } else {
  299. this.$message({ message: '移动失败', type: 'error', offset: 8 })
  300. }
  301. this.handleCloseDialog()
  302. this.btnLoading = false
  303. })
  304. },
  305. handleSizeChange(size) {
  306. this.page.size = size
  307. this.page.page = 1
  308. this.getViewTableList()
  309. },
  310. handleCurrentPage(val) {
  311. this.page.page = val
  312. this.getViewTableList()
  313. },
  314. handleCloseDialog(done) {
  315. // 重置表单数据
  316. this.query.search = null
  317. this.tableDisplayFields = []
  318. this.tableData = []
  319. this.$refs.table.clearSelection()
  320. this.moveSelections = []
  321. this.collectMoveFileVisible = false
  322. this.isReserve = false
  323. // 关闭弹框
  324. // done()
  325. }
  326. }
  327. }
  328. </script>
  329. <style lang='scss' scoped>
  330. .collectMoveFile-dialog{
  331. ::v-deep .el-dialog{
  332. width: 1000px;
  333. .search-btn-box{
  334. .el-button{
  335. margin-left: 10px;
  336. }
  337. }
  338. }
  339. }
  340. .collectMove-main{
  341. display: flex;
  342. justify-content: space-between;
  343. width: 100%;
  344. height: 557px;
  345. border: 1px solid #E6E8ED;
  346. .collectMove-left{
  347. width: 260px;
  348. overflow: hidden;
  349. overflow-y: scroll;
  350. .elect-cont-left{
  351. width: auto !important;
  352. margin-right: 0 !important;
  353. }
  354. ::v-deep .container-left{
  355. min-height: calc(100%) !important;
  356. }
  357. }
  358. .collectMove-right{
  359. width: calc(100% - 260px);
  360. flex: 1;
  361. border-left: 1px solid #E6E8ED;
  362. .head-search{
  363. // padding: 0 20px 0 0;
  364. flex: 1;
  365. justify-content: flex-end;
  366. margin-bottom: 0;
  367. }
  368. .table-list{
  369. height: 440px;
  370. border-bottom: 1px solid #E6E8ED;
  371. .el-pagination{
  372. margin: 15px 0 !important;
  373. }
  374. }
  375. .move-checked{
  376. display: flex;
  377. justify-content: flex-start;
  378. padding: 0 30px;
  379. height: 42px;
  380. line-height: 42px;
  381. .checkbox-style{
  382. font-size: 14px;
  383. color: #0C0E1E;
  384. margin-right: 30px;
  385. }
  386. .el-checkbox{
  387. margin-right: 20px;
  388. ::v-deep .el-checkbox__input.is-disabled .el-checkbox__inner{
  389. border-color: #0348f3;
  390. background-color: #0348f3;
  391. }
  392. ::v-deep .el-checkbox__label{
  393. opacity: 0;
  394. margin-left: -100px;
  395. padding-left: 0;
  396. }
  397. }
  398. }
  399. }
  400. }
  401. .collectMove-header{
  402. display: flex;
  403. justify-content: space-between;
  404. align-items: center;
  405. padding: 20px 20px 20px 0;
  406. .detail-tab .tab-nav{
  407. margin: 0;
  408. border-bottom: none;
  409. }
  410. .detail-tab .tab-nav li{
  411. margin-right: 20px;
  412. }
  413. .detail-tab .tab-nav li.active-tab-nav{
  414. padding-bottom: 0;
  415. }
  416. }
  417. .dialog-footer{
  418. margin-top: 20px;
  419. }
  420. </style>