交通管理局公文项目
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.

522 lines
19 KiB

2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
  1. <template>
  2. <div class="app-container">
  3. <!-- 门类列表 -->
  4. <div class="container-main">
  5. <div class="elect-cont-left">
  6. <TreeList ref="treeList" @nodeClick="handleNodeClick" />
  7. </div>
  8. <div v-if="selectedDocument.isType!==1" class="elect-cont-right">
  9. <!--工具栏-->
  10. <div class="head-container" :style="isRecycle?'display:flex;justify-content: space-between; align-items: center;':'' ">
  11. <div class="head-search" :style="isRecycle?'margin: 0;':''">
  12. <!-- 搜索 -->
  13. <el-input v-model="query.search" clearable size="small" placeholder="输入题名搜索" prefix-icon="el-icon-search" style="width: 200px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
  14. <rrOperation />
  15. <el-button class="filter-item filter-refresh" size="mini" type="warning" icon="el-icon-refresh-left" @click="resetQuery">重置</el-button>
  16. </div>
  17. <crudOperation v-if="!isRecycle" :permission="permission">
  18. <template v-slot:left>
  19. <!-- 新增 -->
  20. <el-button size="mini" @click="handleForm('add')"><i class="iconfont icon-xinzeng" />新增</el-button>
  21. <!-- 修改 -->
  22. <el-button size="mini" :disabled="crud.selections.length !== 1" @click="handleForm('edit')"><i class="iconfont icon-bianji" />编辑</el-button>
  23. <!-- 删除btn 多选 -->
  24. <el-button size="mini" :loading="crud.delAllLoading" :disabled="crud.selections.length === 0" @click="toDelete(crud.selections)"><i class="iconfont icon-shanchu" />删除</el-button>
  25. <el-button :loading="crud.downloadLoading" size="mini" :disabled="crud.selections.length === 0" @click="doExport(crud.selections)">
  26. <i class="iconfont icon-daochu" />
  27. 导出
  28. </el-button>
  29. </template>
  30. <template v-slot:rightButtonGroup>
  31. <div>
  32. <el-button size="mini" :disabled="crud.selections.length === 0" @click="doPrint(crud.selections)"><i class="iconfont icon-dayin" />打印处理单</el-button>
  33. </div>
  34. </template>
  35. </crudOperation>
  36. <div v-if="isRecycle">
  37. <el-button size="mini" type="success" @click="toRecover"><i class="iconfont icon-huifu" />恢复</el-button>
  38. <el-button size="mini" type="success" @click="toCompletelyDelete"><i class="iconfont icon-shanchu" />彻底删除</el-button>
  39. </div>
  40. </div>
  41. <!--表格渲染-->
  42. <div class="container-right">
  43. <span class="right-top-line" />
  44. <span class="left-bottom-line" />
  45. <el-table
  46. ref="table"
  47. v-loading="crud.loading"
  48. class="archives-table"
  49. :data="crud.data"
  50. style="width: 100%;"
  51. @row-click="clickRowHandler"
  52. @select="crud.selectChange"
  53. @select-all="crud.selectAllChange"
  54. @selection-change="crud.selectionChangeHandler"
  55. @cell-dblclick="tableDoubleClick"
  56. >
  57. <el-table-column type="selection" align="center" width="55" />
  58. <el-table-column v-for="field in tableDisplayFields" :key="field.id" :label="field.fieldCnName" :align="field.displayformatType" :width="field.displayLength" show-overflow-tooltip>
  59. <template slot="header">
  60. <el-tooltip
  61. class="item"
  62. effect="dark"
  63. :content="field.fieldCnName"
  64. placement="top-start"
  65. >
  66. <span>{{ field.fieldCnName }}</span>
  67. </el-tooltip>
  68. </template>
  69. <template slot-scope="scope">
  70. <!-- 仅针对read_type字段添加特殊处理 -->
  71. <span
  72. v-if="field.fieldName === 'read_type'"
  73. :class="{
  74. 'row-state row-packing': scope.row.read_type === '未传阅',
  75. 'row-state row-warehousing state-active': scope.row.read_type === '传阅中',
  76. 'row-state row-binding state-active': scope.row.read_type === '已完成',
  77. }"
  78. >
  79. {{ scope.row[field.fieldName] }}
  80. </span>
  81. <span v-else>{{ scope.row[field.fieldName] }}</span>
  82. </template>
  83. </el-table-column>
  84. </el-table>
  85. <!--分页组件-->
  86. <pagination v-if="crud.data.length !== 0" />
  87. </div>
  88. <detail ref="archivesInfo" :selected-document="selectedDocument" />
  89. <!--新增 / 编辑 表单组件-->
  90. <el-dialog class="preview-dialog" :modal-append-to-body="false" :close-on-click-modal="false" append-to-body :before-close="closeDialog" :visible="formVisible" :title="formTitle">
  91. <span class="dialog-right-top" />
  92. <span class="dialog-left-bottom" />
  93. <div class="setting-dialog">
  94. <PreviewForm
  95. ref="previewForm"
  96. :form-preview-data.sync="formPreviewData"
  97. :selected-category="selectedCategory"
  98. :parents-id="parentsId"
  99. :arc-id="arcId"
  100. :is-des-form-type="isDesFormType"
  101. :is-disabled="isDisabled"
  102. :selected-document="selectedDocument"
  103. :is-has-code="isHasCode"
  104. @close-dialog="closeDialog"
  105. @formLoadingShow="formLoadingShow"
  106. @refreshTree="refreshTreeList"
  107. />
  108. <div slot="footer" class="dialog-footer" style="margin-top: 20px !important;">
  109. <el-button type="text" @click="closeDialog">取消</el-button>
  110. <el-button :loading="archivesBtnLoading" type="primary" @click="handlerArchivesSubmit">保存</el-button>
  111. <!-- @click="handlerArchivesSubmit" -->
  112. <el-button :loading="bindSaveLoading" type="primary">保存并绑定标签</el-button>
  113. </div>
  114. </div>
  115. </el-dialog>
  116. <!--表单组件-->
  117. <el-dialog class="tip-dialog" :close-on-click-modal="false" :modal-append-to-body="false" append-to-body title="提示" :visible.sync="printVisible">
  118. <div class="setting-dialog">
  119. <div class="tip-content">
  120. <p class="tipMsg">此操作将打印所选公文库数据</p>
  121. </div>
  122. <el-radio-group v-model="printType" style="padding-left: 36px;">
  123. <el-radio :label="0">套打</el-radio>
  124. <el-radio :label="1">彩打</el-radio>
  125. </el-radio-group>
  126. <div slot="footer" class="dialog-footer">
  127. <el-button @click.native="printVisible = false">取消</el-button>
  128. <el-button type="primary" @click.native="handlePrint">确定</el-button>
  129. </div>
  130. </div>
  131. </el-dialog>
  132. </div>
  133. </div>
  134. </div>
  135. </template>
  136. <script>
  137. import CRUD, { presenter, header } from '@crud/crud'
  138. import { miodLibraryCrud } from './mixins/index'
  139. import crudDocumentArchives, { FetchDelArchives } from '@/api/system/documentArchives'
  140. import rrOperation from '@crud/RR.operation'
  141. import crudOperation from '@crud/CRUD.operation'
  142. import pagination from '@crud/Pagination'
  143. import TreeList from './treeList'
  144. import PreviewForm from '@/views/components/category/PreviewForm'
  145. import detail from './module/detail'
  146. import { exportFile } from '@/utils/index'
  147. import qs from 'qs'
  148. import { mapGetters } from 'vuex'
  149. export default {
  150. name: 'MiodLibrary',
  151. components: { TreeList, PreviewForm, detail, rrOperation, crudOperation, pagination },
  152. cruds() {
  153. return [
  154. CRUD({
  155. title: '收发文', url: 'api/documentArchives/initPreDocument',
  156. crudMethod: { ...crudDocumentArchives },
  157. optShow: {
  158. add: false,
  159. edit: false,
  160. del: false,
  161. download: false,
  162. group: false,
  163. reset: false
  164. },
  165. queryOnPresenterCreated: false
  166. })
  167. ]
  168. },
  169. provide() {
  170. return {
  171. parentsData: this
  172. }
  173. },
  174. mixins: [presenter(), header(), miodLibraryCrud],
  175. props: {
  176. isRecycle: {
  177. type: Boolean,
  178. default: false
  179. },
  180. isdel: {
  181. type: Boolean,
  182. default: false
  183. }
  184. },
  185. data() {
  186. return {
  187. archivesBtnLoading: false,
  188. bindSaveLoading: false,
  189. permission: {
  190. add: ['admin', 'prearchiveLibrary:add'],
  191. edit: ['admin', 'prearchiveLibrary:edit'],
  192. del: ['admin', 'prearchiveLibrary:del'],
  193. sort: ['admin', 'prearchiveLibrary:sort']
  194. },
  195. tableDisplayFields: [], // table-list-title字段
  196. arrySort: [],
  197. selectedDocument: {},
  198. form: {},
  199. formVisible: false,
  200. formTitle: '新增文件',
  201. formPreviewData: [],
  202. selectedCategory: null,
  203. parentsId: null,
  204. arcId: null,
  205. isDesFormType: 'miodLibrary',
  206. isDisabled: false,
  207. isHasCode: false,
  208. printVisible: false,
  209. printType: 0
  210. }
  211. },
  212. computed: {
  213. ...mapGetters([
  214. 'baseApi'
  215. ])
  216. },
  217. watch: {
  218. isdel: function(newValue, oldValue) {
  219. },
  220. isRecycle: function(newValue, oldValue) {
  221. }
  222. },
  223. created() {
  224. },
  225. methods: {
  226. refreshTreeList() {
  227. this.$refs.treeList.refreshData()
  228. },
  229. resetQuery() {
  230. if (this.selectedDocument.isType === 3) {
  231. this.crud.query.docDepartment = this.selectedDocument.label
  232. this.crud.query.archiveYear = null
  233. this.crud.query.search = null
  234. } else if (this.selectedDocument.isType === 4) {
  235. this.crud.query.docDepartment = null
  236. this.crud.query.archiveYear = this.selectedDocument.label
  237. this.crud.query.search = null
  238. } else {
  239. this.crud.query.search = null
  240. this.crud.query.docDepartment = null
  241. this.crud.query.archiveYear = null
  242. }
  243. this.crud.toQuery()
  244. },
  245. [CRUD.HOOK.beforeRefresh]() {
  246. if (this.selectedDocument.isType === 2) {
  247. this.crud.query.documentId = this.selectedDocument.id
  248. } else {
  249. this.crud.query.documentId = this.selectedDocument.documentId
  250. }
  251. this.crud.query.isdel = this.isdel
  252. // this.crud.query.ignore = false
  253. this.crud.query.fondsAffiliation = this.selectedDocument.fondsId
  254. this.crud.query.sort = this.arrySort
  255. },
  256. formLoadingShow(loadingType) {
  257. this.archivesBtnLoading = loadingType
  258. },
  259. handleNodeClick(data) {
  260. this.selectedDocument = data
  261. let documentId = null
  262. if (data.isType === 2) {
  263. documentId = data.id
  264. } else {
  265. documentId = data.documentId
  266. }
  267. this.getInitDocumentsViewTable(documentId)
  268. },
  269. // table字段项
  270. getInitDocumentsViewTable(documentId) {
  271. crudDocumentArchives.FetchInitDocumentsViewTable({ documentId: documentId }).then(data => {
  272. if (data) {
  273. this.arrySort = []
  274. this.tableDisplayFields = data
  275. const orderSortArry = this.tableDisplayFields.filter(item => item.queue).sort((a, b) => a.queue - b.queue)
  276. orderSortArry.forEach(item => {
  277. if (item.displayOrderBy) {
  278. this.arrySort.push(item.fieldName + ',' + item.displayOrderBy)
  279. }
  280. })
  281. this.$nextTick(() => {
  282. if (this.selectedDocument.isType === 3) {
  283. this.crud.query.docDepartment = this.selectedDocument.label
  284. this.crud.query.archiveYear = null
  285. } else if (this.selectedDocument.isType === 4) {
  286. this.crud.query.docDepartment = null
  287. this.crud.query.archiveYear = this.selectedDocument.label
  288. } else {
  289. this.crud.query.search = null
  290. this.crud.query.docDepartment = null
  291. this.crud.query.archiveYear = null
  292. }
  293. this.crud.toQuery()
  294. })
  295. }
  296. })
  297. },
  298. handleForm(type) {
  299. const { selectedDocument, crud } = this
  300. if (!selectedDocument) {
  301. console.warn('selectedDocument 未定义,无法继续操作')
  302. return
  303. }
  304. this.selectedCategory = selectedDocument
  305. this.isDesFormType = 'miodLibrary'
  306. let documentId
  307. if (selectedDocument.isType === 2) {
  308. documentId = selectedDocument.id
  309. } else {
  310. documentId = selectedDocument.documentId
  311. }
  312. const params = { documentId }
  313. if (type === 'add') {
  314. this.formTitle = '新增文件'
  315. params.archivesId = null
  316. } else if (type === 'edit') {
  317. this.formTitle = '编辑文件'
  318. const { id: archivesId } = crud.selections[0]
  319. this.arcId = archivesId
  320. params.archivesId = archivesId
  321. }
  322. this.getFormInfo(params, type)
  323. },
  324. getFormInfo(params, type) {
  325. crudDocumentArchives.FetchDoeditDocument(params).then(data => {
  326. console.log('data', data)
  327. const showFiledAll = data.showFiled.filter(item => item.isSequence).sort((a, b) => a.isSequence - b.isSequence)
  328. this.$nextTick(() => {
  329. this.formPreviewData = showFiledAll
  330. this.formVisible = true
  331. this.$nextTick(() => {
  332. this.$refs.previewForm.fileOriginal = null
  333. this.$refs.previewForm.fileJsonString = null
  334. if (type === 'edit') {
  335. this.$refs.previewForm.archivesType = 'edit'
  336. this.$refs.previewForm.addOrUpdateForm = data.echo
  337. if (data.fileecho) {
  338. const fileecho = []
  339. fileecho.push(data.fileecho)
  340. this.$refs.previewForm.fileOriginal = fileecho[0].file_name
  341. this.$refs.previewForm.fileJsonString = JSON.stringify(fileecho)
  342. } else {
  343. this.$refs.previewForm.fileOriginal = ''
  344. this.$refs.previewForm.fileJsonString = ''
  345. }
  346. } else {
  347. this.$refs.previewForm.archivesType = 'add'
  348. }
  349. })
  350. })
  351. })
  352. },
  353. handlerArchivesSubmit() {
  354. let documentId
  355. if (this.selectedDocument.isType === 2) {
  356. documentId = this.selectedDocument.id
  357. } else {
  358. documentId = this.selectedDocument.documentId
  359. }
  360. this.$refs.previewForm.submitForm('addOrUpdateForm', documentId)
  361. },
  362. clickRowHandler(row) {
  363. this.$refs.table.clearSelection()
  364. this.$refs.table.toggleRowSelection(row)
  365. },
  366. // 双击查看详情
  367. tableDoubleClick(row) {
  368. console.log('tableDoubleClick', row)
  369. this.$refs.archivesInfo.archivesInfoVisible = true
  370. this.$refs.archivesInfo.archivesTabIndex = 0
  371. this.$refs.archivesInfo.parentInfo = row
  372. this.$refs.archivesInfo.getDetial(row.id)
  373. },
  374. // 删除
  375. toDelete(datas) {
  376. this.$confirm('此操作将删除当前所选公文库数据' + '<span>你是否还要继续?</span>', '提示', {
  377. confirmButtonText: '继续',
  378. cancelButtonText: '取消',
  379. type: 'warning',
  380. dangerouslyUseHTMLString: true
  381. }).then(() => {
  382. this.crud.delAllLoading = true
  383. const ids = []
  384. datas.forEach(val => {
  385. ids.push(val.id)
  386. })
  387. let documentId
  388. if (this.selectedDocument.isType === 2) {
  389. documentId = this.selectedDocument.id
  390. } else {
  391. documentId = this.selectedDocument.documentId
  392. }
  393. const params = {
  394. 'documentId': documentId,
  395. 'archivesIds': ids
  396. }
  397. FetchDelArchives(params).then((res) => {
  398. console.log('res', res)
  399. if (res.code !== 500) {
  400. this.crud.notify('删除成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
  401. this.crud.refresh()
  402. } else {
  403. this.crud.notify('删除失败', CRUD.NOTIFICATION_TYPE.ERROR)
  404. }
  405. this.crud.delAllLoading = false
  406. }).catch(err => {
  407. this.crud.delAllLoading = false
  408. console.log(err)
  409. })
  410. }).catch(() => {
  411. })
  412. },
  413. // 导出
  414. doExport(datas) {
  415. this.crud.downloadLoading = true
  416. this.$confirm('此操作将导出所选数据' + '<span>你是否还要继续?</span>', '提示', {
  417. confirmButtonText: '继续',
  418. cancelButtonText: '取消',
  419. type: 'warning',
  420. dangerouslyUseHTMLString: true
  421. }).then(() => {
  422. const ids = []
  423. datas.forEach(val => {
  424. ids.push(val.id)
  425. })
  426. const params = {
  427. 'documentId': this.selectedDocument.id,
  428. 'ids': ids
  429. }
  430. exportFile(this.baseApi + '/api/re-document/download?' + qs.stringify(params, { indices: false }))
  431. this.crud.downloadLoading = false
  432. }).catch(() => {
  433. this.crud.downloadLoading = false
  434. })
  435. },
  436. doPrint(datas) {
  437. this.printVisible = true
  438. },
  439. handlePrint() {
  440. this.printVisible = false
  441. },
  442. closeDialog() {
  443. this.formVisible = false
  444. if (this.$refs.previewForm.$refs['addOrUpdateForm']) {
  445. this.$refs.previewForm.$refs['addOrUpdateForm'].clearValidate()
  446. this.$refs.previewForm.$refs['addOrUpdateForm'].resetFields()
  447. }
  448. }
  449. }
  450. }
  451. </script>
  452. <style lang='scss' scoped>
  453. @import "~@/assets/styles/collect-reorganizi.scss";
  454. @mixin management-fixed-style{
  455. [data-theme="dark"] & {
  456. background-color: #031435 !important;
  457. -webkit-box-shadow: -5px 5px 10px 1px rgba(15,164,222,.16);
  458. box-shadow: -5px 5px 10px 1px rgba(15,164,222,.16);
  459. }
  460. [data-theme="light"] & {
  461. background-color: #fff;
  462. }
  463. }
  464. .el-table {
  465. ::v-deep .el-table__fixed-right {
  466. @include management-fixed-style;
  467. }
  468. }
  469. .preview-dialog .el-dialog .preview-content {
  470. height: calc(100vh - 264px) !important;
  471. }
  472. .elect-cont-right .container-right {
  473. min-height: calc(100vh - 284px);
  474. }
  475. .dialog-footer .el-button.el-button--primary,
  476. .el-message-box__btns .el-button.el-button--primary{
  477. width: auto;
  478. height: auto;
  479. line-height:normal;
  480. padding: 6px 20px;
  481. }
  482. .tip-dialog{
  483. ::v-deep .el-dialog{
  484. width: 504px;
  485. .setting-dialog{
  486. padding: 10px 10px 0 10px;
  487. }
  488. .tip-content{
  489. padding-left: 34px;
  490. font-size: 14px;
  491. line-height: 24px;
  492. color: #0C0E1E;
  493. background: url("~@/assets/images/icon/tip-icon.png") no-repeat left top;
  494. background-size: 24px 24px;
  495. padding-bottom: 20px;
  496. span{
  497. font-size: 12px;
  498. color: #ED4A41;
  499. }
  500. }
  501. }
  502. .dialog-footer{
  503. margin-top: 27px;
  504. }
  505. }
  506. </style>