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

358 lines
13 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <template>
  2. <div class="app-container">
  3. <!-- 门类列表 -->
  4. <div class="container-main">
  5. <div class="elect-cont-left">
  6. <TreeList @nodeClick="handleNodeClick" />
  7. </div>
  8. <div class="elect-cont-right">
  9. <!--工具栏-->
  10. <div class="head-container">
  11. <div class="head-search">
  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. </div>
  16. <crudOperation :permission="permission">
  17. <template v-slot:left>
  18. <!-- 新增 -->
  19. <el-button size="mini" @click="handleForm('add')"><i class="iconfont icon-xinzeng" />新增</el-button>
  20. <!-- 修改 -->
  21. <el-button size="mini" :disabled="crud.selections.length !== 1" @click="handleForm('edit')"><i class="iconfont icon-bianji" />编辑</el-button>
  22. <!-- 删除btn 多选 -->
  23. <el-button size="mini" :loading="crud.delAllLoading" :disabled="crud.selections.length === 0" @click="toDelete(crud.selections)"><i class="iconfont icon-shanchu" />删除</el-button>
  24. <el-button :loading="crud.downloadLoading" size="mini" :disabled="crud.selections.length === 0" @click="doExport(crud.selections)">
  25. <i class="iconfont icon-daochu" />
  26. 导出
  27. </el-button>
  28. </template>
  29. <template v-slot:rightButtonGroup>
  30. <div>
  31. <el-button size="mini" :disabled="crud.selections.length === 0" @click="handleBatch(crud.selections)"><i class="iconfont icon-piliangchengjian" />批量成件</el-button>
  32. <el-button size="mini" :disabled="crud.selections.length === 0" @click="handelMerge(crud.selections)"><i class="iconfont icon-hebingchengjian" />合并成件</el-button>
  33. <el-button size="mini" :disabled="crud.selections.length === 0" @click="handleMove"><i class="iconfont icon-yidong" />移动</el-button>
  34. </div>
  35. </template>
  36. </crudOperation>
  37. </div>
  38. <!--表格渲染-->
  39. <div class="container-right">
  40. <span class="right-top-line" />
  41. <span class="left-bottom-line" />
  42. <el-table
  43. ref="table"
  44. v-loading="crud.loading"
  45. :data="crud.data"
  46. @select="crud.selectChange"
  47. @select-all="crud.selectAllChange"
  48. @selection-change="crud.selectionChangeHandler"
  49. >
  50. <el-table-column type="selection" align="center" width="55" />
  51. <el-table-column v-for="field in tableDisplayFields" :key="field.id" :label="field.fieldCnName" :align="field.displayformatType" :width="field.displayLength" show-overflow-tooltip>
  52. <template slot="header">
  53. <el-tooltip
  54. class="item"
  55. effect="dark"
  56. :content="field.fieldCnName"
  57. placement="top-start"
  58. >
  59. <span>{{ field.fieldCnName }}</span>
  60. </el-tooltip>
  61. </template>
  62. <template slot-scope="scope">
  63. {{ scope.row[field.fieldName] }}
  64. </template>
  65. </el-table-column>
  66. </el-table>
  67. <!--分页组件-->
  68. <pagination v-if="crud.data.length !== 0" />
  69. </div>
  70. <!-- 批量成件 -->
  71. <batchFile ref="batchForm" :selected-document="selectedDocument" @refresh="crud.refresh" />
  72. <!-- 移动 -->
  73. <moveFile ref="moveForm" />
  74. <!-- 合并成件 -->
  75. <el-dialog class="dialog-middle" :modal-append-to-body="false" :close-on-click-modal="false" :before-close="handleClose" :visible="mergeVisible" title="合并成件">
  76. <span class="dialog-right-top" />
  77. <span class="dialog-left-bottom" />
  78. <div class="setting-dialog">
  79. <el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="80px">
  80. <el-form-item label="档案门类" prop="categoryId">
  81. <treeselect
  82. v-model="form.categoryId"
  83. :options="categoryTree"
  84. style="width: 400px;"
  85. :normalizer="normalizer"
  86. flat
  87. :multiple="false"
  88. placeholder="请选择档案门类"
  89. @select="handleSelectCategory"
  90. />
  91. </el-form-item>
  92. </el-form>
  93. <div slot="footer" class="dialog-footer">
  94. <el-button type="text" @click="mergeVisible = false">取消</el-button>
  95. <el-button type="primary" @click="handleForm('add')">确定</el-button>
  96. </div>
  97. </div>
  98. </el-dialog>
  99. <!--新增 / 编辑 表单组件-->
  100. <el-dialog class="preview-dialog" :modal-append-to-body="false" :close-on-click-modal="false" append-to-body :before-close="handleClose" :visible="formVisible" :title="formTitle">
  101. <span class="dialog-right-top" />
  102. <span class="dialog-left-bottom" />
  103. <div class="setting-dialog">
  104. <PreviewForm ref="previewForm" :form-preview-data.sync="formPreviewData" :selected-category="selectedCategory" :parents-id="parentsId" :arc-id="arcId" :is-des-form-type="isDesFormType" :is-disabled="isDisabled" :is-has-code="isHasCode" @close-dialog="closeDialog" />
  105. <div slot="footer" class="dialog-footer">
  106. <el-button type="text" @click="formVisible = false">取消</el-button>
  107. <el-button type="primary" @click="handlerArchivesSubmit">确定</el-button>
  108. </div>
  109. </div>
  110. </el-dialog>
  111. </div>
  112. </div>
  113. </div>
  114. </template>
  115. <script>
  116. import CRUD, { presenter, header } from '@crud/crud'
  117. import { preLibraryCrud } from './mixins/index'
  118. import { FetchCategoryMenu } from '@/api/system/category/category'
  119. import PrearchiveCrud from '@/api/prearchiveLibrary/prearchiveLibrary'
  120. import rrOperation from '@crud/RR.operation'
  121. import crudOperation from '@crud/CRUD.operation'
  122. import pagination from '@crud/Pagination'
  123. import Treeselect from '@riophae/vue-treeselect'
  124. import '@riophae/vue-treeselect/dist/vue-treeselect.css'
  125. import TreeList from './treeList'
  126. import PreviewForm from '@/views/components/category/PreviewForm'
  127. import batchFile from './module/batchFile'
  128. import moveFile from './module/moveFile'
  129. import { exportFile } from '@/utils/index'
  130. import qs from 'qs'
  131. import { mapGetters } from 'vuex'
  132. export default {
  133. name: 'PrearchiveLibrary',
  134. components: { TreeList, PreviewForm, batchFile, moveFile, Treeselect, rrOperation, crudOperation, pagination },
  135. cruds() {
  136. return [
  137. CRUD({
  138. title: '预归档库', url: 'api/re-document/initPreDocument',
  139. crudMethod: { ...PrearchiveCrud },
  140. optShow: {
  141. add: false,
  142. edit: false,
  143. del: false,
  144. download: false,
  145. group: false,
  146. reset: true
  147. },
  148. queryOnPresenterCreated: false
  149. })
  150. ]
  151. },
  152. mixins: [presenter(), header(), preLibraryCrud],
  153. data() {
  154. return {
  155. permission: {
  156. add: ['admin', 'prearchiveLibrary:add'],
  157. edit: ['admin', 'prearchiveLibrary:edit'],
  158. del: ['admin', 'prearchiveLibrary:del'],
  159. sort: ['admin', 'prearchiveLibrary:sort']
  160. },
  161. tableDisplayFields: [], // table-list-title字段
  162. arrySort: [],
  163. selectedDocument: {},
  164. mergeVisible: false,
  165. categoryTree: [],
  166. form: {},
  167. loadSource: [],
  168. rules: {
  169. target: [
  170. { required: true, message: '请选择档案门类', trigger: 'input' }
  171. ]
  172. },
  173. formVisible: false,
  174. formTitle: '新增文件',
  175. formPreviewData: [],
  176. selectedCategory: null,
  177. parentsId: null,
  178. arcId: null,
  179. isDesFormType: 'prearchiveLibrary',
  180. isDisabled: false,
  181. isHasCode: false
  182. }
  183. },
  184. computed: {
  185. ...mapGetters([
  186. 'baseApi'
  187. ])
  188. },
  189. created() {
  190. },
  191. methods: {
  192. [CRUD.HOOK.beforeRefresh]() {
  193. this.crud.query.documentId = this.selectedDocument.id
  194. this.crud.query.sort = this.arrySort
  195. },
  196. handleNodeClick(data) {
  197. this.selectedDocument = data
  198. this.getInitDocumentsViewTable()
  199. },
  200. // 字段项
  201. getInitDocumentsViewTable() {
  202. PrearchiveCrud.FetchInitDocumentsViewTable({ documentId: this.selectedDocument.id }).then(data => {
  203. if (data) {
  204. this.arrySort = []
  205. this.tableDisplayFields = data
  206. const orderSortArry = this.tableDisplayFields.filter(item => item.displayOrder).sort((a, b) => a.displayOrder - b.displayOrder)
  207. orderSortArry.forEach(item => {
  208. if (item.displayOrderBy) {
  209. this.arrySort.push(item.fieldName + ',' + item.displayOrderBy)
  210. }
  211. })
  212. this.$nextTick(() => {
  213. this.crud.toQuery()
  214. })
  215. }
  216. })
  217. },
  218. // 著录界面-form/详情-api
  219. handleForm(type) {
  220. this.mergeVisible = false
  221. this.selectedCategory = this.selectedDocument
  222. let params
  223. if (type === 'add') {
  224. this.formTitle = '新增文件'
  225. params = {
  226. documentId: this.selectedDocument.id,
  227. archivesId: null
  228. }
  229. } else if (type === 'edit') {
  230. this.formTitle = '编辑文件'
  231. this.arcId = this.crud.selections[0].id
  232. params = {
  233. documentId: this.selectedDocument.id,
  234. archivesId: this.crud.selections[0].id
  235. }
  236. }
  237. this.getFormInfo(params, type)
  238. },
  239. getFormInfo(params, type) {
  240. PrearchiveCrud.FetchDoeditDocument(params).then(data => {
  241. const showFiledAll = data.showFiled.filter(item => item.displayOrder).sort((a, b) => a.displayOrder - b.displayOrder)
  242. this.$nextTick(() => {
  243. this.formPreviewData = showFiledAll
  244. this.formVisible = true
  245. this.$nextTick(() => {
  246. this.$refs.previewForm.fileOriginal = null
  247. this.$refs.previewForm.fileJsonString = null
  248. if (type === 'edit') {
  249. this.$refs.previewForm.addOrUpdateForm = data.echo
  250. const fileecho = []
  251. fileecho.push(data.fileecho)
  252. this.$refs.previewForm.fileOriginal = fileecho[0].file_name
  253. this.$refs.previewForm.fileJsonString = JSON.stringify(fileecho)
  254. }
  255. })
  256. })
  257. })
  258. },
  259. handlerArchivesSubmit() {
  260. this.$refs.previewForm.submitForm('addOrUpdateForm', this.selectedDocument.id)
  261. },
  262. // 删除
  263. toDelete(datas) {
  264. this.$confirm('此操作将删除当前所选预归档数据' + '<span>你是否还要继续?</span>', '提示', {
  265. confirmButtonText: '继续',
  266. cancelButtonText: '取消',
  267. type: 'warning',
  268. dangerouslyUseHTMLString: true
  269. }).then(() => {
  270. this.crud.delAllLoading = true
  271. const ids = []
  272. datas.forEach(val => {
  273. ids.push(val.id)
  274. })
  275. const params = {
  276. 'documentId': this.selectedDocument.id,
  277. 'ids': ids
  278. }
  279. PrearchiveCrud.del(params).then(() => {
  280. this.crud.notify('删除成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
  281. this.crud.delAllLoading = false
  282. this.crud.refresh()
  283. }).catch(err => {
  284. this.crud.delAllLoading = false
  285. console.log(err)
  286. })
  287. }).catch(() => {
  288. })
  289. },
  290. // 导出
  291. doExport(datas) {
  292. this.crud.downloadLoading = true
  293. this.$confirm('此操作将导出所选数据' + '<span>你是否还要继续?</span>', '提示', {
  294. confirmButtonText: '继续',
  295. cancelButtonText: '取消',
  296. type: 'warning',
  297. dangerouslyUseHTMLString: true
  298. }).then(() => {
  299. const ids = []
  300. datas.forEach(val => {
  301. ids.push(val.id)
  302. })
  303. const params = {
  304. 'documentId': this.selectedDocument.id,
  305. 'ids': ids
  306. }
  307. exportFile(this.baseApi + '/api/re-document/download?' + qs.stringify(params, { indices: false }))
  308. this.crud.downloadLoading = false
  309. }).catch(() => {
  310. })
  311. },
  312. handleBatch() {
  313. this.$refs.batchForm.batchVisible = true
  314. this.$refs.batchForm.selectionsArc = this.crud.selections
  315. },
  316. handelMerge() {
  317. this.mergeVisible = true
  318. this.getCategoryDataTree()
  319. },
  320. getCategoryDataTree() {
  321. FetchCategoryMenu().then(res => {
  322. this.categoryTree = this.filterData(res)
  323. })
  324. },
  325. handleSelectCategory(val) {
  326. // this.selectedCategoryName = val.cnName
  327. },
  328. normalizer(node) {
  329. if (node.children && !node.children.length) {
  330. delete node.children
  331. }
  332. return {
  333. id: node.id,
  334. label: node.cnName,
  335. children: node.children,
  336. isDisabled: node.isType !== 2
  337. }
  338. },
  339. handleClose(done) {
  340. this.mergeVisible = false
  341. this.formVisible = false
  342. done()
  343. },
  344. closeDialog() {
  345. this.formVisible = false
  346. },
  347. handleMove() {
  348. this.$refs.moveForm.moveVisible = true
  349. }
  350. }
  351. }
  352. </script>
  353. <style lang='scss' scoped>
  354. </style>