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

1069 lines
39 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 months ago
2 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year 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; flex-wrap: wrap;':'' ">
  11. <div class="head-search" :style="isRecycle?'margin-bottom: 10px;':''">
  12. <!-- 搜索 -->
  13. <el-tooltip
  14. class="item"
  15. effect="dark"
  16. content="可搜索标题、收文号、来文字号、主办部门"
  17. placement="top-start"
  18. >
  19. <el-input v-model="search" clearable size="small" placeholder="请输入关键字搜索" prefix-icon="el-icon-search" style="width: 220px;" class="filter-item" @clear="handleSearch" @keyup.enter.native="handleSearch" />
  20. </el-tooltip>
  21. <!-- <rrOperation /> -->
  22. <!-- 密级 -->
  23. <el-select v-model="query.securityClass" clearable placeholder="密级" style="width: 110px;" @change="crud.toQuery">
  24. <el-option v-for="item in securityClassOptions" :key="item.dictionaryCode" :label="item.dictionaryName" :value="item.dictionaryName" />
  25. </el-select>
  26. <!-- 紧急程度 -->
  27. <el-select v-model="query.emergencyDegree" clearable placeholder="紧急程度" style="width: 110px;" @change="crud.toQuery">
  28. <el-option v-for="item in emergencyDegreeOptions" :key="item.dictionaryCode" :label="item.dictionaryName" :value="item.dictionaryName" />
  29. </el-select>
  30. <!-- 传阅状态 -->
  31. <el-select v-model="query.readType" clearable size="small" placeholder="传阅状态" class="filter-item" style="width: 110px" @change="crud.toQuery">
  32. <el-option v-for="item in readTypeOptions" :key="item.dictionaryCode" :label="item.dictionaryName" :value="item.dictionaryName" />
  33. </el-select>
  34. <!-- 登记日期范围 -->
  35. <date-range-picker v-model="blurryTime" class="date-item" @change="crud.toQuery" />
  36. <!-- 需传阅者 -->
  37. <el-select v-model="distributorIds" clearable multiple collapse-tags placeholder="需传阅者" style="width: 170px" @clear="handleClear" @change="crud.toQuery"> <el-option v-for="item in distributorsOptions" :key="item.id" :label="item.borrowName" :value="item.id" />
  38. </el-select>
  39. <el-button class="filter-item filter-search" size="mini" type="success" icon="el-icon-search" @click="handleSearch">搜索</el-button>
  40. <el-button class="filter-item filter-refresh" size="mini" type="warning" icon="el-icon-refresh-left" @click="resetQuery">重置</el-button>
  41. </div>
  42. <crudOperation v-if="!isRecycle" :permission="permission">
  43. <template v-slot:left>
  44. <!-- 新增 -->
  45. <el-button size="mini" @click="handleForm('add')"><i class="iconfont icon-xinzeng" />新增</el-button>
  46. <!-- 修改 -->
  47. <el-button size="mini" :disabled="crud.selections.length !== 1" @click="handleForm('edit')"><i class="iconfont icon-bianji" />编辑</el-button>
  48. <!-- 删除btn 多选 -->
  49. <el-button size="mini" :loading="crud.delAllLoading" :disabled="crud.selections.length === 0" @click="toDelete(crud.selections)"><i class="iconfont icon-shanchu" />删除</el-button>
  50. <el-button :loading="crud.downloadLoading" size="mini" :disabled="crud.selections.length === 0" @click="doExport('0',crud.selections)">
  51. <i class="iconfont icon-daochu" />
  52. 导出
  53. </el-button>
  54. <el-button v-if="selectedDocument.isType===3 || selectedDocument.isType===4" :loading="allDownloadLoading" size="mini" :disabled="crud.selections.length !== 0" @click="doExport('1')">
  55. <i class="iconfont icon-daochu" />
  56. 批量导出
  57. </el-button>
  58. </template>
  59. <template v-slot:rightButtonGroup>
  60. <div>
  61. <el-button size="mini" :disabled="crud.selections.length === 0" @click="doPrint(crud.selections)"><i class="iconfont icon-dayin" />打印处理单</el-button>
  62. </div>
  63. </template>
  64. </crudOperation>
  65. <div v-if="isRecycle">
  66. <el-button size="mini" type="success" @click="toRecover(crud.selections)"><i class="iconfont icon-huifu" />恢复</el-button>
  67. <el-button size="mini" type="success" @click="toCompletelyDelete(crud.selections)"><i class="iconfont icon-shanchu" />彻底删除</el-button>
  68. </div>
  69. </div>
  70. <!--表格渲染-->
  71. <div class="container-right">
  72. <span class="right-top-line" />
  73. <span class="left-bottom-line" />
  74. <el-table
  75. ref="table"
  76. v-loading="crud.loading"
  77. class="archives-table"
  78. :data="crud.data"
  79. style="width: 100%;"
  80. height="calc(100vh - 374px)"
  81. @row-click="clickRowHandler"
  82. @select="crud.selectChange"
  83. @select-all="crud.selectAllChange"
  84. @selection-change="crud.selectionChangeHandler"
  85. @cell-dblclick="tableDoubleClick"
  86. >
  87. <el-table-column type="selection" align="center" width="55" />
  88. <el-table-column v-for="field in tableDisplayFields" :key="field.id" :label="field.fieldCnName" :align="field.displayformatType" :width="field.displayLength" show-overflow-tooltip>
  89. <template slot="header">
  90. <el-tooltip
  91. class="item"
  92. effect="dark"
  93. :content="field.fieldCnName"
  94. placement="top-start"
  95. >
  96. <span>{{ field.fieldCnName }}</span>
  97. </el-tooltip>
  98. </template>
  99. <template slot-scope="scope">
  100. <!-- 仅针对read_type字段添加特殊处理 -->
  101. <span
  102. v-if="field.fieldName === 'read_type'"
  103. :class="{
  104. 'row-state row-packing': scope.row.read_type === '未传阅',
  105. 'row-state row-binding state-active': scope.row.read_type === '传阅中',
  106. 'row-state row-physical state-active': scope.row.read_type === '已完成',
  107. }"
  108. >
  109. {{ scope.row[field.fieldName] }}
  110. </span>
  111. <span v-else>{{ scope.row[field.fieldName] }}</span>
  112. </template>
  113. </el-table-column>
  114. </el-table>
  115. <!--分页组件-->
  116. <pagination v-if="crud.data.length !== 0" />
  117. </div>
  118. <detail ref="archivesInfo" :selected-document="selectedDocument" :parent-info="parentInfo" :page-type="pageType" />
  119. <!--新增 / 编辑 表单组件-->
  120. <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">
  121. <span class="dialog-right-top" />
  122. <span class="dialog-left-bottom" />
  123. <div class="setting-dialog">
  124. <PreviewForm
  125. ref="previewForm"
  126. :form-preview-data.sync="formPreviewData"
  127. :selected-category="selectedCategory"
  128. :parents-id="parentsId"
  129. :arc-id="arcId"
  130. :is-des-form-type="isDesFormType"
  131. :is-disabled="isDisabled"
  132. :selected-document="selectedDocument"
  133. :is-has-code="isHasCode"
  134. :archives-type="archivesType"
  135. :is-miod-save-bind="isMiodSaveBind"
  136. @close-dialog="closeDialog"
  137. @formLoadingShow="formLoadingShow"
  138. @refreshTree="refreshTreeList"
  139. @resetQuery="resetQuery"
  140. @getInitDocumentBind="getInitDocumentBind"
  141. />
  142. <div slot="footer" class="dialog-footer" style="margin-top: 20px !important;">
  143. <el-button type="text" @click="closeDialog">取消</el-button>
  144. <el-button :loading="archivesBtnLoading" type="primary" @click="handlerArchivesSubmit(false)">保存</el-button>
  145. <el-button v-if="archivesType === 'edit'" :loading="bindSaveLoading" type="primary" @click="handlerArchivesSubmit(true)">保存并绑定原文</el-button>
  146. </div>
  147. </div>
  148. </el-dialog>
  149. <!--表单组件-->
  150. <el-dialog class="tip-dialog" :close-on-click-modal="false" :modal-append-to-body="false" append-to-body title="提示" :visible.sync="printVisible">
  151. <div class="setting-dialog">
  152. <div class="tip-content">
  153. <p class="tipMsg">此操作将打印所选公文库数据</p>
  154. </div>
  155. <el-radio-group v-model="printType" style="padding-left: 36px;">
  156. <el-radio :label="2">彩打</el-radio>
  157. <el-radio :label="1">套打</el-radio>
  158. </el-radio-group>
  159. <div slot="footer" class="dialog-footer">
  160. <el-button @click.native="printVisible = false">取消</el-button>
  161. <el-button type="primary" @click.native="handlePrint">确定</el-button>
  162. </div>
  163. </div>
  164. </el-dialog>
  165. </div>
  166. </div>
  167. <!-- 注册PDF对话框组件 -->
  168. <PdfDialog ref="pdfDialog" />
  169. </div>
  170. </template>
  171. <script>
  172. import CRUD, { presenter, header } from '@crud/crud'
  173. import { miodLibraryCrud } from './mixins/index'
  174. import crudDocumentArchives, { FetchDelArchives, FetchCompleteDelArchives, FetchRestoreArchives, FetchInitDistributorAllByDocumentId, FetchBorrowerdsByIds, FetchInitDocumentDetailsList, FetchReadGW, FetchBingdingLabel } from '@/api/system/documentArchives'
  175. import crudOperation from '@crud/CRUD.operation'
  176. import pagination from '@crud/Pagination'
  177. import TreeList from './treeList'
  178. import PreviewForm from '@/views/components/category/PreviewForm'
  179. import detail from './module/detail'
  180. import { exportFile } from '@/utils/index'
  181. import qs from 'qs'
  182. import { mapGetters } from 'vuex'
  183. import DateRangePicker from '@/components/DateRangePicker'
  184. import PdfDialog from './module/pdfDialog'
  185. import { FetchDictionaryTree } from '@/api/system/dict'
  186. import { FetchInitBorrowerListOrderNo } from '@/api/system/borrower'
  187. export default {
  188. name: 'MiodLibrary',
  189. components: { TreeList, PreviewForm, detail, crudOperation, pagination, PdfDialog, DateRangePicker },
  190. cruds() {
  191. return [
  192. CRUD({
  193. title: '收发文', url: 'api/documentArchives/initPreDocument',
  194. crudMethod: { ...crudDocumentArchives },
  195. optShow: {
  196. add: false,
  197. edit: false,
  198. del: false,
  199. download: false,
  200. group: false,
  201. reset: false
  202. },
  203. queryOnPresenterCreated: false
  204. })
  205. ]
  206. },
  207. provide() {
  208. return {
  209. parentsData: this
  210. }
  211. },
  212. mixins: [presenter(), header(), miodLibraryCrud],
  213. props: {
  214. isRecycle: {
  215. type: Boolean,
  216. default: false
  217. },
  218. isdel: {
  219. type: Boolean,
  220. default: false
  221. }
  222. },
  223. data() {
  224. return {
  225. archivesBtnLoading: false,
  226. bindSaveLoading: false,
  227. permission: {
  228. add: ['admin', 'prearchiveLibrary:add'],
  229. edit: ['admin', 'prearchiveLibrary:edit'],
  230. del: ['admin', 'prearchiveLibrary:del'],
  231. sort: ['admin', 'prearchiveLibrary:sort']
  232. },
  233. tableDisplayFields: [], // table-list-title字段
  234. arrySort: [],
  235. selectedDocument: {},
  236. form: {},
  237. formVisible: false,
  238. formTitle: '新增文件',
  239. formPreviewData: [],
  240. selectedCategory: null,
  241. parentsId: null,
  242. arcId: null,
  243. isDesFormType: 'miodLibrary',
  244. isDisabled: false,
  245. isHasCode: false,
  246. printVisible: false,
  247. printType: 2,
  248. pdfSources: [],
  249. printSelections: [],
  250. archivesType: null,
  251. search: '',
  252. parentInfo: null,
  253. pageType: null,
  254. allDownloadLoading: false,
  255. isMiodSaveBind: null,
  256. securityClassOptions: [],
  257. emergencyDegreeOptions: [],
  258. readTypeOptions: [],
  259. blurryTime: [],
  260. distributorsOptions: [],
  261. distributorIds: []
  262. }
  263. },
  264. computed: {
  265. ...mapGetters([
  266. 'baseApi'
  267. ])
  268. },
  269. watch: {
  270. isdel: function(newValue, oldValue) {
  271. },
  272. isRecycle: function(newValue, oldValue) {
  273. }
  274. },
  275. created() {
  276. this.getDictsList()
  277. },
  278. methods: {
  279. getDictsList() {
  280. FetchDictionaryTree().then((res) => {
  281. const filterCodes = ['security_class']
  282. const filteredItems = JSON.parse(JSON.stringify(res)).filter(item => filterCodes.includes(item.dictionaryCode))
  283. this.securityClassOptions = filteredItems[0].childDictionarys
  284. const filterCodes2 = ['emergency_degree']
  285. const filteredItems2 = JSON.parse(JSON.stringify(res)).filter(item => filterCodes2.includes(item.dictionaryCode))
  286. this.emergencyDegreeOptions = filteredItems2[0].childDictionarys
  287. const filterCodes3 = ['read_type']
  288. const filteredItems3 = JSON.parse(JSON.stringify(res)).filter(item => filterCodes3.includes(item.dictionaryCode))
  289. this.readTypeOptions = filteredItems3[0].childDictionarys
  290. }).catch(err => {
  291. console.log(err)
  292. })
  293. },
  294. handleClear() {
  295. this.distributorIds = []
  296. this.crud.query.distributorIds = null
  297. },
  298. fetchDeptsList() {
  299. // console.log('this.selectedDocument', this.selectedDocument)
  300. let documentId
  301. if (this.selectedDocument.isType === 2) {
  302. documentId = this.selectedDocument.id
  303. } else {
  304. documentId = this.selectedDocument.documentId
  305. }
  306. const param = {
  307. 'documentId': documentId,
  308. 'isBindReadNo': true // 排除格子
  309. }
  310. console.log('param', param)
  311. FetchInitBorrowerListOrderNo(param)
  312. .then(res => {
  313. // console.log('res', res)
  314. this.distributorsOptions = res || []
  315. })
  316. .catch(error => {
  317. this.$message.error('获取数据失败,请稍后重试')
  318. console.error('获取部门/人员列表失败', error)
  319. })
  320. .finally(() => {
  321. })
  322. },
  323. handleSearch() {
  324. this.crud.query.search = this.search
  325. this.crud.toQuery()
  326. },
  327. refreshTreeList() {
  328. this.$refs.treeList.refreshData()
  329. },
  330. resetQuery() {
  331. this.crud.query.securityClass = ''
  332. this.crud.query.emergencyDegree = ''
  333. this.crud.query.readType = ''
  334. this.search = ''
  335. this.crud.query.search = ''
  336. if (this.selectedDocument.isType === 3) {
  337. this.crud.query.docDepartment = this.selectedDocument.label
  338. this.crud.query.archiveYear = null
  339. } else if (this.selectedDocument.isType === 4) {
  340. this.crud.query.docDepartment = null
  341. this.crud.query.archiveYear = this.selectedDocument.label
  342. } else {
  343. this.crud.query.docDepartment = null
  344. this.crud.query.archiveYear = null
  345. }
  346. this.blurryTime = []
  347. this.crud.query.startTime = null
  348. this.crud.query.endTime = null
  349. this.distributorIds = []
  350. this.crud.query.distributorIds = null
  351. this.crud.toQuery()
  352. },
  353. [CRUD.HOOK.beforeRefresh]() {
  354. if (this.selectedDocument.isType === 2) {
  355. this.crud.query.documentId = this.selectedDocument.id
  356. } else {
  357. this.crud.query.documentId = this.selectedDocument.documentId
  358. }
  359. if (this.blurryTime && this.blurryTime.length !== 0) {
  360. this.crud.query.startTime = this.blurryTime[0].split(' ')[0]
  361. this.crud.query.endTime = this.blurryTime[1].split(' ')[0]
  362. } else {
  363. this.crud.query.startTime = null
  364. this.crud.query.endTime = null
  365. }
  366. if (this.distributorIds && this.distributorIds.length !== 0) {
  367. this.crud.query.distributorIds = this.distributorIds.join(',')
  368. } else {
  369. this.crud.query.distributorIds = null
  370. }
  371. this.crud.query.isdel = this.isdel
  372. // this.crud.query.ignore = false
  373. this.crud.query.fondsAffiliation = this.selectedDocument.fondsId
  374. this.crud.query.sort = this.arrySort
  375. },
  376. formLoadingShow(loadingType) {
  377. this.archivesBtnLoading = loadingType
  378. },
  379. handleNodeClick(data, type) {
  380. // if (type && type === 'targetNode') {
  381. // console.log('非手动点击tree')
  382. // } else {
  383. // this.search = ''
  384. // this.crud.query.search = ''
  385. // }
  386. this.selectedDocument = data
  387. let documentId = null
  388. if (data.isType === 2) {
  389. documentId = data.id
  390. } else {
  391. documentId = data.documentId
  392. }
  393. this.fetchDeptsList()
  394. this.getInitDocumentsViewTable(documentId, type)
  395. },
  396. // table字段项
  397. getInitDocumentsViewTable(documentId, type) {
  398. crudDocumentArchives.FetchInitDocumentsViewTable({ documentId: documentId }).then(data => {
  399. if (data) {
  400. this.arrySort = []
  401. this.tableDisplayFields = data
  402. const orderSortArry = this.tableDisplayFields.filter(item => item.queue).sort((a, b) => a.queue - b.queue)
  403. orderSortArry.forEach(item => {
  404. if (item.displayOrderBy) {
  405. this.arrySort.push(item.fieldName + ',' + item.displayOrderBy)
  406. }
  407. })
  408. this.$nextTick(() => {
  409. if (this.selectedDocument.isType === 3) {
  410. this.crud.query.docDepartment = this.selectedDocument.label
  411. this.crud.query.archiveYear = null
  412. } else if (this.selectedDocument.isType === 4) {
  413. this.crud.query.docDepartment = this.selectedDocument.dictionaryName
  414. this.crud.query.archiveYear = this.selectedDocument.label
  415. } else {
  416. // this.search = ''
  417. // this.crud.query.search = ''
  418. this.crud.query.docDepartment = null
  419. this.crud.query.archiveYear = null
  420. }
  421. if (type && type === 'targetNode') {
  422. this.crud.refresh()
  423. } else {
  424. this.crud.toQuery()
  425. }
  426. })
  427. }
  428. })
  429. },
  430. handleForm(type) {
  431. const { selectedDocument, crud } = this
  432. this.selectedCategory = selectedDocument
  433. this.isDesFormType = 'miodLibrary'
  434. let documentId
  435. if (selectedDocument.isType === 2) {
  436. documentId = selectedDocument.id
  437. } else {
  438. documentId = selectedDocument.documentId
  439. }
  440. const params = { documentId }
  441. if (type === 'add') {
  442. console.log('add')
  443. this.formTitle = '新增文件'
  444. params.archivesId = null
  445. } else if (type === 'edit') {
  446. console.log('edit')
  447. this.formTitle = '编辑文件'
  448. const { id: archivesId } = crud.selections[0]
  449. this.arcId = archivesId
  450. params.archivesId = archivesId
  451. }
  452. this.getFormInfo(params, type)
  453. },
  454. getFormInfo(params, type) {
  455. this.archivesType = type
  456. crudDocumentArchives.FetchDoeditDocument(params).then(data => {
  457. const showFiledAll = data.showFiled.filter(item => item.isSequence).sort((a, b) => a.isSequence - b.isSequence)
  458. this.$nextTick(() => {
  459. this.formPreviewData = showFiledAll
  460. this.formVisible = true
  461. this.$nextTick(() => {
  462. this.$refs.previewForm.fileOriginal = null
  463. this.$refs.previewForm.fileJsonString = null
  464. if (type === 'edit') {
  465. showFiledAll.map(item => {
  466. if (item.isInputClass === 'select' && item.isRadio && item.isLine) {
  467. data.echo[item.fieldName] = JSON.parse(data.echo[item.fieldName])
  468. }
  469. })
  470. this.$set(this.$refs.previewForm, 'addOrUpdateForm', data.echo)
  471. if (data.fileecho) {
  472. this.$refs.previewForm.fileOriginal = data.fileecho.file_name || null
  473. this.$refs.previewForm.fileJsonString = JSON.stringify([data.fileecho])
  474. } else {
  475. this.$refs.previewForm.fileOriginal = ''
  476. this.$refs.previewForm.fileJsonString = ''
  477. }
  478. // 获取借阅者
  479. FetchInitDistributorAllByDocumentId(params).then(res => {
  480. if (res && res.length !== 0) {
  481. console.log('res', res)
  482. this.$refs.previewForm.miodDeptsTags = res
  483. const ids = res.map(item => item.id).join(',')
  484. console.log('ids', ids)
  485. this.$set(this.$refs.previewForm.addOrUpdateForm, 'miodDepts', ids)
  486. } else {
  487. this.$set(this.$refs.previewForm.addOrUpdateForm, 'miodDepts', null)
  488. }
  489. })
  490. console.log('data.echo', data.echo)
  491. if (data.echo.host_department) {
  492. const hostParams = {
  493. 'search': data.echo.host_department
  494. }
  495. FetchBorrowerdsByIds(hostParams).then(res => {
  496. if (res && res.length !== 0) {
  497. console.log('res-hostDepartmentTags', res)
  498. this.$refs.previewForm.hostDepartmentTags = res
  499. const ids = res.map(item => item.id).join(',')
  500. this.$set(this.$refs.previewForm.addOrUpdateForm, 'host_department', ids)
  501. } else {
  502. this.$set(this.$refs.previewForm.addOrUpdateForm, 'host_department', null)
  503. }
  504. })
  505. } else {
  506. this.$refs.previewForm.hostDepartmentTags = []
  507. }
  508. } else {
  509. console.log('add')
  510. }
  511. })
  512. })
  513. })
  514. },
  515. handlerArchivesSubmit(type) {
  516. this.isMiodSaveBind = type
  517. this.$nextTick(() => {
  518. let documentId
  519. if (this.selectedDocument.isType === 2) {
  520. documentId = this.selectedDocument.id
  521. } else {
  522. documentId = this.selectedDocument.documentId
  523. }
  524. this.$refs.previewForm.submitForm('addOrUpdateForm', documentId)
  525. })
  526. },
  527. getInitDocumentBind() {
  528. this.bindSaveLoading = true
  529. let documentId
  530. if (this.selectedDocument.isType === 2) {
  531. documentId = this.selectedDocument.id
  532. } else {
  533. documentId = this.selectedDocument.documentId
  534. }
  535. const params = {
  536. documentId,
  537. archivesId: this.arcId
  538. }
  539. FetchInitDocumentDetailsList(params).then(data => {
  540. // id,parents_id,reg_no,details_type,pass_location,folder_location,read_type,tid,is_destroy,create_by,create_time,update_by,update_time
  541. // id,公文id,登记号,文件类别(1.原文 2.复印件),传阅所在位置,文件夹所在位置,传阅状态,tid,是否销毁,创建人,创建时间,更新人,更新时间
  542. const jsonData = this.convertData(data)
  543. const fileOriginal = jsonData.filter(item => item.details_type === 1)
  544. console.log('jsonData', jsonData)
  545. console.log('fileOriginal', fileOriginal)
  546. this.bindingTag(fileOriginal[0])
  547. }).catch(error => {
  548. console.error('获取文档详情列表失败:', error)
  549. })
  550. },
  551. convertData(data) {
  552. return data.map(item => {
  553. const fieldNames = [
  554. 'id', 'parents_id', 'reg_no', 'details_type', 'pass_location', 'folder_location',
  555. 'read_type', 'tid', 'is_destroy', 'create_by', 'create_time',
  556. 'update_by', 'update_time'
  557. ]
  558. const obj = {}
  559. fieldNames.forEach((field, index) => {
  560. obj[field] = item[index]
  561. })
  562. return obj
  563. })
  564. },
  565. // 绑定标签
  566. bindingTag(row) {
  567. console.log('bindingTag', row)
  568. if (row.tid && (row.tid !== '' || row.tid !== null)) {
  569. this.$confirm('该原件已绑定' + '<span>是否重新绑定?</span>', '提示', {
  570. confirmButtonText: '重新绑定',
  571. cancelButtonText: '取消',
  572. type: 'warning',
  573. dangerouslyUseHTMLString: true
  574. }).then(() => {
  575. this.handlBind(row, 'hasLabel')
  576. }).catch(() => {
  577. this.closeDialog()
  578. this.crud.refresh()
  579. this.refreshTreeList()
  580. this.bindSaveLoading = false
  581. })
  582. } else {
  583. this.handlBind(row)
  584. }
  585. },
  586. handlBind(row, type) {
  587. console.log('row', row)
  588. const sDevID = process.env.NODE_ENV === 'production' ? window.g.sDevID : process.env.VUE_APP_SDEVID
  589. const param = {
  590. 'sDevID': sDevID
  591. }
  592. FetchReadGW(param).then((res) => {
  593. if (!res) {
  594. this.$message({ message: '绑定失败', type: 'error', offset: 8 })
  595. this.bindSaveLoading = false
  596. } else {
  597. const result = JSON.parse(res)
  598. console.log('result', result)
  599. if (result.code === '0') {
  600. console.log('读取成功')
  601. // let coverLabel
  602. // if (type === 'hasLabel' && row.tid === result.data[0].uid) {
  603. // coverLabel = true
  604. // } else {
  605. // coverLabel = false
  606. // }
  607. const documentId = this.selectedDocument.isType === 2
  608. ? this.selectedDocument.id
  609. : this.selectedDocument.documentId
  610. const data = {
  611. coverLabel: !!type,
  612. documentId: documentId, // 公文库id
  613. parentsId: row.id, // 需要绑定的公文id
  614. detailsType: row.details_type,
  615. labelType: 1, // 目前只能绑定公文 填1就好了
  616. tid: result.data[0].uid, // 标签读取的id
  617. eas: '1' // 这个和以前一样写吧
  618. }
  619. console.log('data', data)
  620. FetchBingdingLabel(data).then((res) => {
  621. console.log('FetchBingdingLabel', res)
  622. if (res === '当前标签已被绑定') {
  623. this.$message({ message: '当前标签已被绑定', type: 'error', offset: 8 })
  624. } else {
  625. this.$message({ message: '绑定成功', type: 'success', offset: 8 })
  626. }
  627. this.closeDialog()
  628. this.bindSaveLoading = false
  629. setTimeout(() => {
  630. const selectedItem = this.crud.selections[0]
  631. this.tableDoubleClick(selectedItem)
  632. this.refreshTreeList()
  633. this.crud.refresh()
  634. }, 500)
  635. }).catch(error => {
  636. console.error(error)
  637. this.bindSaveLoading = false
  638. })
  639. } else if (result.code === '-1') {
  640. this.$message({ message: result.message, type: 'error', offset: 8 })
  641. this.bindSaveLoading = false
  642. } else if (result.code === '-1000') {
  643. // 读写器超时未响应
  644. this.$message({ message: result.message, type: 'error', offset: 8 })
  645. this.bindSaveLoading = false
  646. }
  647. }
  648. }).catch(error => {
  649. console.error(error)
  650. this.bindSaveLoading = false
  651. })
  652. },
  653. clickRowHandler(row) {
  654. this.$refs.table.clearSelection()
  655. this.$refs.table.toggleRowSelection(row)
  656. },
  657. // 双击查看详情
  658. tableDoubleClick(row) {
  659. console.log('tableDoubleClick', row)
  660. this.parentInfo = row
  661. this.$nextTick(() => {
  662. this.$refs.archivesInfo.archivesInfoVisible = true
  663. this.$refs.archivesInfo.archivesTabIndex = 0
  664. // this.$refs.archivesInfo.parentInfo = row
  665. this.$refs.archivesInfo.getDetial()
  666. })
  667. },
  668. // 删除
  669. toDelete(datas) {
  670. this.$confirm('此操作将删除当前所选公文库数据' + '<span>你是否还要继续?</span>', '提示', {
  671. confirmButtonText: '继续',
  672. cancelButtonText: '取消',
  673. type: 'warning',
  674. dangerouslyUseHTMLString: true
  675. }).then(() => {
  676. this.crud.delAllLoading = true
  677. const ids = []
  678. datas.forEach(val => {
  679. ids.push(val.id)
  680. })
  681. let documentId
  682. if (this.selectedDocument.isType === 2) {
  683. documentId = this.selectedDocument.id
  684. } else {
  685. documentId = this.selectedDocument.documentId
  686. }
  687. const params = {
  688. 'documentId': documentId,
  689. 'archivesIds': ids
  690. }
  691. FetchDelArchives(params).then((res) => {
  692. console.log('res', res)
  693. if (res.code !== 500) {
  694. this.crud.notify('删除成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
  695. this.crud.refresh()
  696. } else {
  697. this.crud.notify('删除失败', CRUD.NOTIFICATION_TYPE.ERROR)
  698. }
  699. this.crud.delAllLoading = false
  700. }).catch(err => {
  701. this.crud.delAllLoading = false
  702. console.log(err)
  703. })
  704. }).catch(() => {
  705. })
  706. },
  707. // 导出
  708. doExport(type, datas) {
  709. if (type === '0') {
  710. this.crud.downloadLoading = true
  711. } else {
  712. this.allDownloadLoading = true
  713. }
  714. const tip = type === '0' ? '此操作将导出所选数据' : '此操作将批量导出所有数据'
  715. this.$confirm(tip + '<span>你是否还要继续?</span>', '提示', {
  716. confirmButtonText: '继续',
  717. cancelButtonText: '取消',
  718. type: 'warning',
  719. dangerouslyUseHTMLString: true
  720. }).then(() => {
  721. const ids = []
  722. if (type === '0') {
  723. datas.forEach(val => {
  724. ids.push(val.id)
  725. })
  726. }
  727. let documentId
  728. if (this.selectedDocument.isType === 2) {
  729. documentId = this.selectedDocument.id
  730. } else {
  731. documentId = this.selectedDocument.documentId
  732. }
  733. console.log('this.selectedDocument', this.selectedDocument)
  734. const params = {
  735. 'documentId': documentId,
  736. 'ids': ids,
  737. 'docDepartment': type === '1' ? (this.selectedDocument.isType === 4 ? this.selectedDocument.dictionaryName : this.selectedDocument.label) : null,
  738. 'archivesYear': type === '1' ? (this.selectedDocument.isType === 4 ? this.selectedDocument.label : null) : null,
  739. 'search': type === '1' ? this.search : null,
  740. 'securityClass': type === '1' ? this.crud.query.securityClass : null,
  741. 'emergencyDegree': type === '1' ? this.crud.query.emergencyDegree : null,
  742. 'readType': type === '1' ? this.crud.query.readType : null,
  743. 'startTime': type === '1' ? (this.blurryTime.length !== 0 ? this.blurryTime[0].split(' ')[0] : null) : null,
  744. 'endTime': type === '1' ? (this.blurryTime.length !== 0 ? this.blurryTime[1].split(' ')[0] : null) : null,
  745. 'distributorIds': type === '1' ? (this.blurryTime.distributorIds !== 0 ? this.distributorIds.join(',') : null) : null
  746. }
  747. console.log('exportFile', params)
  748. exportFile(this.baseApi + '/api/documentArchives/downloadDocumentArchives?' + qs.stringify(params, { indices: false, allowDots: true, skipNulls: false }))
  749. if (type === '0') {
  750. this.crud.downloadLoading = false
  751. } else {
  752. this.allDownloadLoading = false
  753. }
  754. }).catch(() => {
  755. if (type === '0') {
  756. this.crud.downloadLoading = false
  757. } else {
  758. this.allDownloadLoading = false
  759. }
  760. })
  761. },
  762. doPrint(datas) {
  763. this.printVisible = true
  764. this.printSelections = datas
  765. },
  766. handlePrint() {
  767. this.printVisible = false
  768. let documentId
  769. if (this.selectedDocument.isType === 2) {
  770. documentId = this.selectedDocument.id
  771. } else {
  772. documentId = this.selectedDocument.documentId
  773. }
  774. const ids = this.printSelections.map(item => item.id)
  775. console.log('ids', ids)
  776. const params = {
  777. 'archivesId': ids,
  778. 'documentId': documentId,
  779. 'printType': this.printType // 1 套打 2 彩打
  780. }
  781. this.$refs.pdfDialog.openDialog(params)
  782. // this.getHandleDocument()
  783. },
  784. async getHandleDocument() {
  785. try {
  786. // console.log('params', params)
  787. // FetchHandleDocument(params).then(async(res) => {
  788. // console.log(res)
  789. // this.pdfSources = res.map(item => {
  790. // // 如果后端返回的是带前缀的Base64,可以直接使用
  791. // return item.startsWith('data:application/pdf;base64,')
  792. // ? item
  793. // : `data:application/pdf;base64,${item}`
  794. // })
  795. // })
  796. } catch (error) {
  797. console.error(error)
  798. }
  799. },
  800. // 回收站 - 恢复
  801. toRecover(datas) {
  802. if (datas.length === 0) {
  803. this.$message({ message: '您还未勾选需要操作的条目,请先确认!', offset: 8 })
  804. return false
  805. }
  806. this.$confirm('此恢复将会把所选条目及其子集一并恢复' + '<span>你是否还要继续?</span>', '提示', {
  807. confirmButtonText: '继续',
  808. cancelButtonText: '取消',
  809. type: 'warning',
  810. dangerouslyUseHTMLString: true
  811. }).then(() => {
  812. const archivesIds = []
  813. datas.forEach(val => {
  814. archivesIds.push(val.id)
  815. })
  816. let documentId
  817. if (this.selectedDocument.isType === 2) {
  818. documentId = this.selectedDocument.id
  819. } else {
  820. documentId = this.selectedDocument.documentId
  821. }
  822. const params = {
  823. 'documentId': documentId,
  824. 'archivesIds': archivesIds
  825. }
  826. console.log('params', params)
  827. FetchRestoreArchives(params).then((res) => {
  828. console.log('res', res)
  829. if (res.code !== 500) {
  830. if (res.includes('成功')) {
  831. this.$message({ message: res, type: 'success', offset: 8 })
  832. this.crud.refresh()
  833. this.refreshTreeList()
  834. } else {
  835. this.$message({ message: res, type: 'error', offset: 8 })
  836. }
  837. } else {
  838. this.$message({ message: '恢复所选档案失败', type: 'error', offset: 8 })
  839. }
  840. }).catch(err => {
  841. console.log(err)
  842. })
  843. }).catch(() => {
  844. })
  845. },
  846. // 回收站 - 彻底删除
  847. toCompletelyDelete(datas) {
  848. if (datas.length === 0) {
  849. this.$message({ message: '您还未勾选需要操作的条目,请先确认!', offset: 8 })
  850. return false
  851. }
  852. this.$confirm('此删除将把会所选条目与其子集彻底删除' + '<span>你是否还要继续?</span>', '提示', {
  853. confirmButtonText: '继续',
  854. cancelButtonText: '取消',
  855. type: 'warning',
  856. dangerouslyUseHTMLString: true
  857. }).then(() => {
  858. const archivesIds = []
  859. datas.forEach(val => {
  860. archivesIds.push(val.id)
  861. })
  862. let documentId
  863. if (this.selectedDocument.isType === 2) {
  864. documentId = this.selectedDocument.id
  865. } else {
  866. documentId = this.selectedDocument.documentId
  867. }
  868. const params = {
  869. 'documentId': documentId,
  870. 'archivesIds': archivesIds
  871. }
  872. console.log('params', params)
  873. FetchCompleteDelArchives(params).then((res) => {
  874. if (res.code !== 500) {
  875. this.$message({ message: res, type: 'success', offset: 8 })
  876. this.crud.refresh()
  877. this.refreshTreeList()
  878. } else {
  879. this.$message({ message: '删除所选档案失败', type: 'error', offset: 8 })
  880. }
  881. }).catch(err => {
  882. console.log(err)
  883. })
  884. }).catch(() => {
  885. })
  886. },
  887. closeDialog() {
  888. this.formVisible = false
  889. this.$refs.previewForm.miodDeptsTags = []
  890. this.$refs.previewForm.miodDeptsSelections = []
  891. this.$refs.previewForm.hostDepartmentTags = []
  892. this.$refs.previewForm.hostDepartmentSelections = []
  893. this.$refs.previewForm.deptsValid = false
  894. if (this.$refs.previewForm.$refs['addOrUpdateForm']) {
  895. this.$refs.previewForm.$refs['addOrUpdateForm'].clearValidate()
  896. this.$refs.previewForm.$refs['addOrUpdateForm'].resetFields()
  897. }
  898. this.bindSaveLoading = false
  899. }
  900. }
  901. }
  902. </script>
  903. <style>
  904. @media print {
  905. html,body{
  906. height: inherit;
  907. }
  908. .print-container {
  909. position: absolute;
  910. top: 0;
  911. right: 0;
  912. bottom: 0;
  913. left: 0;
  914. }
  915. @page {
  916. size: A4;
  917. margin: 2cm;
  918. }
  919. }
  920. </style>
  921. <style lang='scss' scoped>
  922. @import "~@/assets/styles/collect-reorganizi.scss";
  923. @mixin management-fixed-style{
  924. [data-theme="dark"] & {
  925. background-color: #031435 !important;
  926. -webkit-box-shadow: -5px 5px 10px 1px rgba(15,164,222,.16);
  927. box-shadow: -5px 5px 10px 1px rgba(15,164,222,.16);
  928. }
  929. [data-theme="light"] & {
  930. background-color: #fff;
  931. }
  932. }
  933. .el-table {
  934. ::v-deep .el-table__fixed-right {
  935. @include management-fixed-style;
  936. }
  937. }
  938. .preview-dialog .el-dialog .preview-content {
  939. height: calc(100vh - 264px) !important;
  940. }
  941. .elect-cont-right .container-right {
  942. min-height: calc(100vh - 284px);
  943. }
  944. .dialog-footer .el-button.el-button--primary,
  945. .el-message-box__btns .el-button.el-button--primary{
  946. width: auto;
  947. height: auto;
  948. line-height:normal;
  949. padding: 6px 20px;
  950. }
  951. .tip-dialog{
  952. ::v-deep .el-dialog{
  953. width: 504px;
  954. .setting-dialog{
  955. padding: 10px 10px 0 10px;
  956. }
  957. .tip-content{
  958. padding-left: 34px;
  959. font-size: 14px;
  960. line-height: 24px;
  961. color: #0C0E1E;
  962. background: url("~@/assets/images/icon/tip-icon.png") no-repeat left top;
  963. background-size: 24px 24px;
  964. padding-bottom: 20px;
  965. span{
  966. font-size: 12px;
  967. color: #ED4A41;
  968. }
  969. }
  970. }
  971. .dialog-footer{
  972. margin-top: 27px;
  973. }
  974. }
  975. .intoExamine{
  976. position: fixed;
  977. left: 50%;
  978. top: 50%;
  979. transform: translate(-50%,-50%);
  980. z-index: 99;
  981. }
  982. /* 基础样式 */
  983. .print-container {
  984. position: fixed;
  985. left: 50%;
  986. top: 50%;
  987. transform: translate(-50%,-50%);
  988. z-index: 99;
  989. padding: 0 0 40px 0;
  990. }
  991. /* 标题样式 */
  992. .print-title {
  993. font-size: 22pt;
  994. font-family: "华文中宋";
  995. color: #ff0000;
  996. margin: 20px 0;
  997. }
  998. /* 表格样式 */
  999. .official-table {
  1000. border-collapse: collapse;
  1001. width: 100%;
  1002. }
  1003. .label-cell, .content-cell {
  1004. border: 1px solid #ff0000;
  1005. padding: 8px;
  1006. }
  1007. .label-cell {
  1008. background: #ffffff;
  1009. text-align: center;
  1010. font-size: 12pt;
  1011. color: #ff0000;
  1012. vertical-align: middle;
  1013. }
  1014. .content-cell {
  1015. background: #ffffff;
  1016. font-size: 12pt;
  1017. vertical-align: top;
  1018. }
  1019. .content-left {
  1020. text-align: left;
  1021. }
  1022. .content-center {
  1023. text-align: center;
  1024. }
  1025. .header-cell {
  1026. border: none;
  1027. padding: 20px 0;
  1028. text-align: center;
  1029. }
  1030. .header-text {
  1031. font-family: "华文中宋";
  1032. font-size: 22pt;
  1033. color: #ff0000;
  1034. margin: 0;
  1035. }
  1036. </style>