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

530 lines
19 KiB

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