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

512 lines
18 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
  1. <template>
  2. <div class="app-container archives-container">
  3. <div class="container-main" style="justify-content: flex-start;">
  4. <div class="elect-cont-left">
  5. <div class="container-left">
  6. <span class="right-top-line" />
  7. <span class="left-bottom-line" />
  8. <div class="arc-left-tree">
  9. <h3 class="arc-title arc-title-top">档案门类</h3>
  10. <div class="tree-scroll">
  11. <el-tree ref="categroyTree" v-loading="crud.loading" class="arc-tree arc-tree-01" :data="crud.data" :props="defaultProps" node-key="id" :expand-on-click-node="false" highlight-current @node-click="handleNodeClick">
  12. <span slot-scope="{ node, data }" class="custom-tree-node">
  13. <span v-if="data.isType === 1 " class="iconFolder">
  14. {{ data.cnName }}
  15. </span>
  16. <span v-if="data.isType === 2" class="iconArch">
  17. {{ data.cnName }}
  18. </span>
  19. <span v-if="data.isType === 3" class="iconFile">
  20. {{ data.cnName }}
  21. </span>
  22. </span>
  23. </el-tree>
  24. </div>
  25. <h3 class="arc-title arc-title-bottom">快速筛选</h3>
  26. <el-tree
  27. ref="classifyTree"
  28. v-loading="classifyLoading"
  29. class="arc-tree arc-tree-02"
  30. :data="classifyTree"
  31. :props="defaultClassifyProps"
  32. node-key="id"
  33. :expand-on-click-node="false"
  34. highlight-current
  35. @node-click="handleClassifyFilter"
  36. >
  37. <span slot-scope="{ node, data }" class="custom-tree-node">
  38. <span v-if="data.childDictionarys || data.fondsName" class="iconClassify">
  39. {{ data.dictionaryName || data.fondsName }}
  40. </span>
  41. <span v-else class="iconClassify-child">
  42. {{ data.dictionaryName }}
  43. </span>
  44. </span>
  45. </el-tree>
  46. </div>
  47. </div>
  48. </div>
  49. <!--用户数据-->
  50. <div v-if="selectedCategory.isType !== 1" class="elect-cont-right">
  51. <div class="container-right tab-content">
  52. <span class="right-top-line" />
  53. <span class="left-bottom-line" />
  54. <Project v-if="selectedCategory.arrangeType === 3" ref="projectEle" :selected-category="selectedCategory" :data="sharedData" :is-recycle="isRecycle" :smart-query="smartQuery" @openAnjuan="handleOpenAnjuan" @myYearEvent="handleYearData" />
  55. <Anjuan v-if="selectedCategory.arrangeType === 1 || selectedCategory.arrangeType === 2 || selectedCategory.arrangeType === 3" ref="anjuanEle" :selected-category="selectedCategory" :data="sharedData" :is-recycle="isRecycle" :smart-query="smartQuery" @openJuannei="handleOpenJuannei" @myYearEvent="handleYearData" />
  56. <Juannei v-if="selectedCategory.arrangeType === 2 || selectedCategory.arrangeType === 3" ref="juanneiEle" :data="sharedData" :selected-category="selectedCategory" :is-recycle="isRecycle" :smart-query="smartQuery" @openFile="handleOpenFile" />
  57. <File v-if="selectedCategory.arrangeType === 1 || selectedCategory.arrangeType === 2 || selectedCategory.arrangeType === 3" ref="fileEle" :is-recycle="isRecycle" :selected-category="selectedCategory" :smart-query="smartQuery" />
  58. </div>
  59. </div>
  60. </div>
  61. </div>
  62. </template>
  63. <script>
  64. import crudCategory from '@/api/category/category'
  65. import { manageLibraryCrud } from './mixins/index'
  66. import { FetchDictionaryTreeByCategoryId } from '@/api/system/dict'
  67. import CRUD, { presenter, header } from '@crud/crud'
  68. import Project from './project/index'
  69. import Anjuan from './anjuan/index'
  70. import Juannei from './juannei/index'
  71. import File from './file/index'
  72. export default {
  73. name: 'ManagementLibrary',
  74. components: { Project, Anjuan, Juannei, File },
  75. cruds() {
  76. return [
  77. CRUD({
  78. title: '收集库', url: 'api/category/menu',
  79. crudMethod: { ...crudCategory },
  80. optShow: {
  81. add: false,
  82. edit: false,
  83. del: false,
  84. download: false,
  85. group: false
  86. }
  87. })
  88. ]
  89. },
  90. mixins: [presenter(), header(), manageLibraryCrud],
  91. props: {
  92. isRecycle: {
  93. type: Boolean,
  94. default: false
  95. },
  96. isdel: {
  97. type: Boolean,
  98. default: false
  99. }
  100. },
  101. provide() {
  102. return {
  103. parentsData: this
  104. }
  105. },
  106. data() {
  107. return {
  108. defaultProps: {
  109. children: 'children',
  110. label: 'cnName'
  111. },
  112. defaultClassifyProps: {
  113. children: 'childDictionarys' || null,
  114. label: 'dictionaryName' || 'fondsName'
  115. },
  116. defaultFondsProps: {
  117. children: 'children',
  118. label: 'fondsName'
  119. },
  120. sharedData: '',
  121. selectedCategory: {},
  122. yearChildData: '',
  123. parentsProjectId: null,
  124. parentsAnjuanId: null,
  125. parentsJuanneiId: null,
  126. smartQuery: {
  127. 'retention': null, // 保管期限
  128. 'security_class': null, // 密级
  129. 'doc_type': null, // 文种
  130. 'medium_type': null, // 载体类型
  131. 'archive_year': null, // 年度
  132. 'fonds_no': null // 全宗
  133. },
  134. fixedStatusBar: false
  135. }
  136. },
  137. watch: {
  138. isRecycle: function(newValue, oldValue) {
  139. }
  140. },
  141. created() {
  142. },
  143. mounted() {
  144. },
  145. methods: {
  146. handleYearData(data) {
  147. this.yearChildData = data
  148. this.classifyLoading = true
  149. setTimeout(() => {
  150. if (this.classifyTree[0].dictionaryName === '年度') {
  151. this.classifyTree = this.classifyTree.slice(1)
  152. }
  153. if (this.yearChildData.length !== 0) {
  154. const newYearArr = this.yearChildData.map((item, index) => {
  155. const json = {}
  156. json.id = index
  157. json.dictionaryName = item
  158. json.childDictionarys = []
  159. return json
  160. })
  161. this.classifyTree.unshift({ id: -1, dictionaryName: '年度', dictionaryCode: 'archive_year', childDictionarys: newYearArr })
  162. }
  163. this.classifyLoading = false
  164. }, 500)
  165. },
  166. filterData(data) {
  167. return data.filter(node => {
  168. if (node.children && node.children.length > 0) {
  169. node.children = this.filterData(node.children) // 递归处理子节点
  170. }
  171. return node.isType !== 3 // 过滤掉isType为3的节点
  172. })
  173. },
  174. // 逆归实现 获取指定元素
  175. findNode(tree, func) {
  176. for (const node of tree) {
  177. if (func(node)) return node
  178. if (node.children) {
  179. const res = this.findNode(node.children, func)
  180. if (res) return res
  181. }
  182. }
  183. return null
  184. },
  185. // 展开选中的父级
  186. expandParents(node) {
  187. node.expanded = true
  188. if (node.parent) {
  189. this.expandParents(node.parent)
  190. }
  191. },
  192. [CRUD.HOOK.afterRefresh]() {
  193. this.crud.data = this.filterData(this.crud.data)
  194. this.$nextTick(() => {
  195. let currentKey
  196. if (localStorage.getItem('currentArchivesKey')) {
  197. currentKey = JSON.parse(localStorage.getItem('currentArchivesKey'))
  198. // 删除门类节点后
  199. if (this.$refs.categroyTree.getCurrentKey(currentKey.id) == null) {
  200. localStorage.removeItem('currentArchivesKey')
  201. }
  202. // 缓存的门类节点判断
  203. if (currentKey.isType === 1) {
  204. if (currentKey.children.length !== 0) {
  205. currentKey = this.findNode(currentKey.children, (node) => {
  206. return node.isType !== 1
  207. })
  208. }
  209. }
  210. } else {
  211. // 默认
  212. if (this.crud.data[0].isType === 1) {
  213. currentKey = this.findNode(this.crud.data[0].children, (node) => {
  214. return node.isType !== 1
  215. })
  216. } else {
  217. currentKey = this.crud.data[0]
  218. }
  219. }
  220. if (currentKey.id) {
  221. // 设置某个节点的当前选中状态
  222. this.$refs.categroyTree.setCurrentKey(currentKey.id)
  223. this.$nextTick(() => {
  224. // 设置某个节点的父级展开
  225. const selectedKey = this.$refs.categroyTree.getCurrentNode()
  226. if (this.$refs.categroyTree.getNode(selectedKey) && this.$refs.categroyTree.getNode(selectedKey).parent) {
  227. this.expandParents(this.$refs.categroyTree.getNode(selectedKey).parent)
  228. }
  229. // 选中节点的门类详情
  230. this.handleNodeClick(selectedKey)
  231. })
  232. }
  233. })
  234. },
  235. handleNodeClick(val) {
  236. this.smartQuery = {
  237. 'retention': null, // 保管期限
  238. 'security_class': null, // 密级
  239. 'doc_type': null, // 文种
  240. 'medium_type': null, // 载体类型
  241. 'archive_year': null, // 年度
  242. 'fonds_no': null // 全宗
  243. }
  244. console.log('测试fixedStatusBar', this.fixedStatusBar)
  245. // if (localStorage.getItem('statusBarFixedType') !== 'undefined') {
  246. // this.fixedStatusBar = JSON.parse(localStorage.getItem('statusBarFixedType')) === true
  247. // }
  248. console.log(this)
  249. this.parentsProjectId = null
  250. this.parentsAnjuanId = null
  251. this.parentsJuanneiId = null
  252. // 缓存当前的选中的
  253. localStorage.setItem('currentArchivesKey', JSON.stringify(val))
  254. this.selectedCategory = val
  255. if (this.selectedCategory.isType !== 1) {
  256. this.getDictionaryTreeByCategoryId(val.id)
  257. } else {
  258. this.classifyTree = []
  259. }
  260. this.$nextTick(() => {
  261. this.handlePageList()
  262. })
  263. },
  264. handlePageList(isQuickFilter) {
  265. if (this.selectedCategory.arrangeType === 3) {
  266. const tablistEle = this.$refs.projectEle
  267. // 项目下
  268. if (isQuickFilter) {
  269. tablistEle.$refs.collectHeaderRef.getInitArchivesClass()
  270. tablistEle.getTableDisplayFieldsLoading = true
  271. tablistEle.getViewTableList(1, null, isQuickFilter)
  272. } else {
  273. this.$refs.projectEle.getCommonData(1)
  274. }
  275. } else if (this.selectedCategory.arrangeType === 2) {
  276. const tablistEle = this.$refs.anjuanEle.$refs.ajContent.$refs.tableList
  277. // 案卷下
  278. if (isQuickFilter) {
  279. tablistEle.$refs.collectHeaderRef.getInitArchivesClass()
  280. tablistEle.getTableDisplayFieldsLoading = true
  281. tablistEle.getViewTableList(2, null, isQuickFilter)
  282. } else {
  283. tablistEle.getCommonData(2)
  284. }
  285. } else if (this.selectedCategory.arrangeType === 1) {
  286. const tablistEle = this.$refs.anjuanEle.$refs.ajContent.$refs.tableList
  287. // 文件下
  288. if (isQuickFilter) {
  289. tablistEle.$refs.collectHeaderRef.getInitArchivesClass()
  290. tablistEle.getTableDisplayFieldsLoading = true
  291. tablistEle.getViewTableList(3, null, isQuickFilter)
  292. } else {
  293. tablistEle.getCommonData(3)
  294. }
  295. }
  296. if (this.$refs.anjuanEle) {
  297. this.$refs.anjuanEle.anjuanDrawer = false
  298. if (this.$refs.anjuanEle.$refs.ajContent) {
  299. this.$refs.anjuanEle.$refs.ajContent.activeIndex = 0
  300. }
  301. }
  302. if (this.$refs.juanneiEle) {
  303. this.$refs.juanneiEle.juanneiDrawer = false
  304. }
  305. if (this.$refs.fileEle) {
  306. this.$refs.fileEle.fileDrawer = false
  307. }
  308. },
  309. getDictionaryTreeByCategoryId(categoryId) {
  310. this.classifyLoading = true
  311. const params = {
  312. 'categoryId': categoryId
  313. }
  314. FetchDictionaryTreeByCategoryId(params).then((res) => {
  315. let fonds
  316. if (res.fonds.length <= 1) {
  317. fonds = []
  318. } else {
  319. fonds = res.fonds
  320. }
  321. this.classifyTree = res.dictionarys.concat(fonds)
  322. this.classifyLoading = false
  323. }).catch(err => {
  324. console.log(err)
  325. })
  326. },
  327. handleClassifyFilter(data, node, ele) {
  328. this.smartQuery = {
  329. 'retention': null, // 保管期限
  330. 'security_class': null, // 密级
  331. 'doc_type': null, // 文种
  332. 'medium_type': null, // 载体类型
  333. 'archive_year': null, // 年度
  334. 'fonds_no': null // 全宗
  335. }
  336. if (data) {
  337. if (node.childNodes.length === 0) {
  338. const selectedKey = this.$refs.classifyTree.getCurrentNode()
  339. this.treeCurrentNode = ele.$el
  340. if (ele.$el.classList.contains('is-current')) {
  341. this.treeCurrentNode.classList.remove('is-current')
  342. } else {
  343. this.treeCurrentNode.classList.add('is-current')
  344. if (Object.keys(selectedKey).includes('fondsId')) {
  345. this.smartQuery.fonds_no = selectedKey.fondsNo
  346. } else {
  347. const selectedParentVal = this.$refs.classifyTree.getNode(selectedKey).parent.data.dictionaryCode
  348. switch (selectedParentVal) {
  349. case 'security_class':
  350. if (selectedKey.dictionaryCode !== 'security_class') {
  351. this.smartQuery.security_class = selectedKey.dictionaryName
  352. }
  353. break
  354. case 'retention':
  355. if (selectedKey.dictionaryCode !== 'retention') {
  356. this.smartQuery.retention = selectedKey.dictionaryName
  357. }
  358. break
  359. case 'doc_type':
  360. if (selectedKey.dictionaryCode !== 'doc_type') {
  361. this.smartQuery.doc_type = selectedKey.dictionaryName
  362. }
  363. break
  364. case 'medium_type':
  365. if (selectedKey.dictionaryCode !== 'medium_type') {
  366. this.smartQuery.medium_type = selectedKey.dictionaryName
  367. }
  368. break
  369. default:
  370. if (selectedKey.dicCode !== 'archive_year') {
  371. this.smartQuery.archive_year = selectedKey.dictionaryName
  372. }
  373. }
  374. }
  375. }
  376. this.$nextTick(() => {
  377. this.handlePageList('quickFilter')
  378. })
  379. }
  380. }
  381. },
  382. handleOpenAnjuan(data, parentId) {
  383. this.parentsProjectId = parentId
  384. console.log('this.parentsProjectId', this.parentsProjectId)
  385. this.$refs.anjuanEle.anjuanDrawer = true
  386. this.activeIndex = 0
  387. if (this.$refs.anjuanEle.$refs.ajContent) {
  388. this.$refs.anjuanEle.$refs.ajContent.activeIndex = 0
  389. }
  390. this.$nextTick(() => {
  391. this.$refs.anjuanEle.$refs.ajContent.$refs.tableList.getCommonData(2, this.parentsProjectId)
  392. this.$refs.anjuanEle.$refs.ajContent.test = data
  393. })
  394. },
  395. handleOpenJuannei(data, parentId) {
  396. this.parentsAnjuanId = parentId
  397. console.log('this.parentsAnjuanId', this.parentsAnjuanId)
  398. if (this.selectedCategory.arrangeType === 1 || (this.selectedCategory.arrangeType === 3 && this.$refs.anjuanEle.$refs.ajContent.activeIndex === 1) || (this.selectedCategory.arrangeType === 2 && this.$refs.anjuanEle.$refs.ajContent.activeIndex === 1)) {
  399. this.$refs.fileEle.fileDrawer = true
  400. this.$nextTick(() => {
  401. this.$refs.fileEle.getCommonData(4, this.parentsAnjuanId)
  402. this.$refs.fileEle.test = data
  403. this.$refs.fileEle.isAjNo = 1
  404. })
  405. } else {
  406. this.$refs.juanneiEle.juanneiDrawer = true
  407. this.$nextTick(() => {
  408. this.$refs.juanneiEle.getCommonData(3, this.parentsAnjuanId)
  409. this.$refs.juanneiEle.test = data
  410. this.$refs.fileEle.isAjNo = 0
  411. })
  412. }
  413. },
  414. handleOpenFile(data, parentId) {
  415. this.parentsJuanneiId = parentId
  416. console.log('this.parentsJuanneiId', this.parentsJuanneiId)
  417. this.$refs.fileEle.fileDrawer = true
  418. this.$nextTick(() => {
  419. this.$refs.fileEle.getCommonData(4, this.parentsJuanneiId)
  420. this.$refs.fileEle.test = data
  421. })
  422. }
  423. }
  424. }
  425. </script>
  426. <style lang="scss" scoped>
  427. .elect-cont-left{
  428. width: 276px;
  429. padding: 0 !important;
  430. }
  431. .hideSidebar .elect-cont-left {
  432. width: 265px !important;
  433. }
  434. [data-theme=light] .elect-cont-left .container-left {
  435. min-height: calc(100vh - 140px);
  436. }
  437. [data-theme=dark] .elect-cont-left .container-left {
  438. min-height: calc(100vh - 160px);
  439. }
  440. .openSidebar .elect-cont-right {
  441. width: calc(100vw - 592px);
  442. }
  443. [data-theme=light] .elect-cont-right .container-right.tab-content {
  444. min-height: calc(100vh - 180px) !important;
  445. }
  446. .arc-title{
  447. position: relative;
  448. height: 48px;
  449. line-height: 48px;
  450. text-align: center;
  451. font-size: 16px;
  452. color: #0C0E1E;
  453. background-color: #F3F5F8;
  454. &::after{
  455. content: "";
  456. position: absolute;
  457. right: 12px;
  458. bottom: 0;
  459. }
  460. }
  461. .arc-title-top{
  462. &::after{
  463. width: 44px;
  464. height: 35px;
  465. background: url("~@/assets/images/collect/daml.png") no-repeat;
  466. background-size: 100% 100%;
  467. }
  468. }
  469. .arc-title-bottom{
  470. &::after{
  471. width: 41px;
  472. height: 40px;
  473. background: url("~@/assets/images/collect/kssx.png") no-repeat;
  474. background-size: 100% 100%;
  475. }
  476. }
  477. .arc-tree{
  478. padding: 0 20px;
  479. background-color: red;
  480. }
  481. .arc-tree-01{
  482. height: 400px;
  483. overflow: hidden;
  484. overflow-y: scroll;
  485. }
  486. [data-theme=dark] .arc-tree-01{
  487. height: 370px;
  488. }
  489. .arc-tree-02{
  490. height: calc(100vh - 720px);
  491. overflow: hidden;
  492. overflow-y: scroll;
  493. }
  494. ::v-deep .el-tree-node__children .custom-tree-node{
  495. font-size: 14px;
  496. }
  497. [data-theme=light] .elect-cont-right {
  498. padding: 0 20px !important;
  499. }
  500. [data-theme=dark] .elect-cont-right {
  501. margin-top: 0 !important;
  502. }
  503. </style>