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

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