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

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