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

529 lines
18 KiB

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