【前端】智能库房综合管理系统前端项目
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.

419 lines
16 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. <template>
  2. <div>
  3. <!--工具栏-->
  4. <div class="head-container">
  5. <div class="head-archives-top">
  6. <div class="head-search">
  7. <!-- 搜索 -->
  8. <el-select v-if="selectedCategory.isType === 3 || selectedCategory.isType === 5" v-model="query.enabled" clearable size="small" placeholder="状态" class="filter-item" style="width: 100px" @change="crud.toQuery">
  9. <i slot="prefix" class="iconfont icon-zhuangtai-fanbai" />
  10. <el-option v-for="item in stateOptions" :key="item.key" :label="item.label" :value="item.key" />
  11. </el-select>
  12. <el-input v-model="query[inputSelect]" clearable size="small" placeholder="请输入关键词" style="width: 200px;" class="input-prepend filter-item" @keyup.enter.native="crud.toQuery">
  13. <el-select slot="prepend" v-model="inputSelect" style="width: 80px" @change="querySelect">
  14. <el-option
  15. v-for="item in queryOption"
  16. :key="item.value"
  17. :label="item.label"
  18. :value="item.value"
  19. />
  20. </el-select>
  21. </el-input>
  22. <rrOperation />
  23. </div>
  24. <el-checkbox v-if="selectedCategory.isType !== 1 && selectedCategory.isType !== 2" v-model="fixedStatusBar">隐藏固定状态栏</el-checkbox>
  25. </div>
  26. <crudOperation :permission="permission">
  27. <template v-slot:right>
  28. <el-button v-permission="permission.del" icon="el-icon-delete" size="mini" :loading="crud.delAllLoading" :disabled="crud.selections.length === 0" @click="toDelete(crud.selections)">删除</el-button>
  29. <el-button v-if="selectedCategory.isType !== 1 && selectedCategory.isType !== 2" v-permission="permission.download" :loading="crud.downloadLoading" :disabled="!crud.data.length" size="mini" icon="el-icon-download" @click="crud.doExport">导出</el-button>
  30. <el-button v-if="selectedCategory.isType === 4 || selectedCategory.isType === 5" :disabled="crud.selections.length !== 1" size="mini" icon="el-icon-download" @click="uploadFile">上传附件</el-button>
  31. </template>
  32. <template v-slot:rightButtonGroup>
  33. <div v-if="selectedCategory.isType === 3 || selectedCategory.isType === 5" class="archives-handler-btn">
  34. <el-button class="packing-btn iconfont icon-weibiaoti-2" type="primary" @click="packingVisible=true">装盒</el-button>
  35. <el-button v-if="selectedCategory.isType === 3" class="part-btn iconfont icon-weibiaoti-2" type="primary">分卷装盒</el-button>
  36. <!-- <el-button class="warehousing-btn iconfont icon-weibiaoti-2" type="primary">入库</el-button> -->
  37. <el-button class="lending-btn iconfont icon-weibiaoti-2" type="primary">借阅</el-button>
  38. <el-button class="binding-btn iconfont icon-weibiaoti-2" type="primary">绑定标签</el-button>
  39. </div>
  40. </template>
  41. </crudOperation>
  42. </div>
  43. <!--新增 / 编辑 表单组件-->
  44. <el-dialog class="preview-dialog" :modal-append-to-body="false" :close-on-click-modal="false" :before-close="crud.cancelCU" :visible="crud.status.cu > 0" :title="crud.status.title">
  45. <span class="dialog-right-top" />
  46. <span class="dialog-left-bottom" />
  47. <div class="setting-dialog">
  48. <!-- form -->
  49. <PreviewForm v-if="formPreviewData.length && archivesTabIndex == 0" ref="previewForm" :is-disabled="false" :form-preview-data.sync="formPreviewData" :selected-category="selectedCategory" :arc-id="arcId" />
  50. <div slot="footer" class="dialog-footer">
  51. <el-button :loading="crud.status.cu === 2" type="primary" @click="handlerArchivesSubmit">保存</el-button>
  52. </div>
  53. </div>
  54. </el-dialog>
  55. <!-- 上传附件 -->
  56. <el-dialog class="upload-dialog" :modal-append-to-body="false" :close-on-click-modal="false" :before-close="handleClose" :visible.sync="uploadFileVisible" title="上传附件">
  57. <span class="dialog-right-top" />
  58. <span class="dialog-left-bottom" />
  59. <div class="setting-dialog">
  60. <UploadFile :is-upload-detail="true" />
  61. <div slot="footer" class="dialog-footer">
  62. <el-button :loading="crud.status.cu === 2" type="primary" @click="uploadFileSave">保存</el-button>
  63. </div>
  64. </div>
  65. </el-dialog>
  66. <!-- 删除档案 -->
  67. <el-dialog title="删除档案" :visible.sync="deleteVisible" :before-close="handleClose">
  68. <span class="dialog-right-top" />
  69. <span class="dialog-left-bottom" />
  70. <div class="setting-dialog">
  71. <div class="dialog-delt">
  72. <p><span>确定删除当前档案吗</span></p>
  73. <p v-if="selectedCategory.isType == 2">数据来源项目 1条数据 案卷 4条数据</p>
  74. <p v-if="selectedCategory.isType == 3">数据来源案卷 1条数据 卷内 2条数据</p>
  75. <p v-if="selectedCategory.isType == 4">数据来源卷内 1条数据</p>
  76. <p v-if="selectedCategory.isType == 5">数据来源卷内 1条数据</p>
  77. <p class="delt-tip"><span>提示如果删除当前档案此档案内所附带的文件会一并删除</span></p>
  78. </div>
  79. <div slot="footer" class="dialog-footer">
  80. <el-button type="primary" @click.native="handleDeltConfirm">确定</el-button>
  81. </div>
  82. </div>
  83. </el-dialog>
  84. <!-- table表格渲染 -->
  85. <el-table ref="table" v-loading="crud.loading || getTableDisplayFieldsLoading" class="archives-table" :data="crud.data" highlight-current-row style="width: 100%; " height="calc(100vh - 370px)" @selection-change="crud.selectionChangeHandler" @row-click="clickRowHandler" @cell-dblclick="tableDoubleClick">
  86. <el-table-column type="selection" width="55" align="center" />
  87. <el-table-column type="index" label="序号" width="55" align="center" />
  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-scope="scope">
  90. {{ scope.row[field.fieldName] }}
  91. </template>
  92. </el-table-column>
  93. <el-table-column v-if="selectedCategory.isType !== 1 && selectedCategory.isType !== 2" label="装盒" width="100" align="center" :fixed="fixedStatusBar?false:'right'">
  94. <!-- state-active 已装/已入/已借/已绑 -->
  95. <template slot-scope="scope">
  96. <!-- 未装 / 已装 -->
  97. <span class="row-state row-packing state-active">{{ scope.row.case_no ? '已装': '未装' }}</span>
  98. </template>
  99. </el-table-column>
  100. <el-table-column v-if="selectedCategory.isType !== 1 && selectedCategory.isType !== 2" label="入库" width="100" align="center" :fixed="fixedStatusBar?false:'right'">
  101. <template slot-scope="">
  102. <!-- 未入 / 已入 -->
  103. <span class="row-state row-warehousing">未入</span>
  104. </template>
  105. </el-table-column>
  106. <el-table-column v-if="selectedCategory.isType === 3 || selectedCategory.isType === 5" label="借阅" width="100" align="center" :fixed="fixedStatusBar?false:'right'">
  107. <template slot-scope="">
  108. <!-- 待借 / 不可借- 表示 / 已借 -->
  109. <span class="row-state row-lending"></span>
  110. </template>
  111. </el-table-column>
  112. <el-table-column v-if="selectedCategory.isType === 3 || selectedCategory.isType === 5" label="标签" width="100" align="center" :fixed="fixedStatusBar?false:'right'">
  113. <template slot-scope="scope">
  114. <!-- 未绑 / 已绑 -->
  115. <span class="row-state row-binding">{{ scope.row.tid ? '已绑': '未绑' }}</span>
  116. </template>
  117. </el-table-column>
  118. </el-table>
  119. <!--分页组件-->
  120. <pagination />
  121. <!-- 档案详情 -->
  122. <el-dialog class="upload-dialog" title="档案详情" :visible.sync="archivesInfoVisible" :before-close="handleClose">
  123. <span class="dialog-right-top" />
  124. <span class="dialog-left-bottom" />
  125. <div class="setting-dialog">
  126. <ArchivesInfo />
  127. <div slot="footer" class="dialog-footer">
  128. <el-button type="primary" @click.native="handleDeltConfirm">确定</el-button>
  129. </div>
  130. </div>
  131. </el-dialog>
  132. <el-dialog class="upload-dialog" title="装盒" :visible.sync="packingVisible" :before-close="handleClose">
  133. <span class="dialog-right-top" />
  134. <span class="dialog-left-bottom" />
  135. <div class="setting-dialog">
  136. <Packing />
  137. </div>
  138. </el-dialog>
  139. </div>
  140. </template>
  141. <script>
  142. import { add, edit, del, getTableDisplayFields, getFormDisplayFields } from '@/api/archivesManage/archivesList'
  143. import CRUD, { presenter, header, form } from '@crud/crud'
  144. import { initData } from '@/api/data'
  145. import crudOperation from '@crud/CRUD.operation'
  146. import rrOperation from '@crud/RR.operation'
  147. import pagination from '@crud/Pagination'
  148. import PreviewForm from '@/views/components/category/PreviewForm'
  149. import UploadFile from './module/uploadFile'
  150. import ArchivesInfo from './module/archivesInfo'
  151. import Packing from './module/packing'
  152. export default {
  153. components: { crudOperation, rrOperation, pagination, PreviewForm, UploadFile, ArchivesInfo, Packing },
  154. mixins: [
  155. presenter(),
  156. header(),
  157. form({})
  158. ],
  159. props: {
  160. selectedCategory: {
  161. type: Object,
  162. default: function() {
  163. return {}
  164. }
  165. }
  166. },
  167. cruds() {
  168. return [
  169. CRUD({
  170. title: '档案',
  171. url: 'api/archives/initArchivesView',
  172. query: { isdel: false },
  173. crudMethod: { add, edit, del },
  174. optShow: {
  175. add: true,
  176. edit: true,
  177. del: false,
  178. reset: false,
  179. download: false,
  180. group: false
  181. },
  182. queryOnPresenterCreated: false,
  183. sort: []
  184. })
  185. ]
  186. },
  187. data() {
  188. return {
  189. stateOptions: [ // 搜索 - 状态选择
  190. { key: '1', label: '全部' },
  191. { key: '2', label: '未装' },
  192. { key: '3', label: '未入' },
  193. { key: '4', label: '在库' },
  194. { key: '5', label: '待借' },
  195. { key: '6', label: '已借' }
  196. ],
  197. queryOption: [
  198. { value: 'maintitle', label: '题名' },
  199. { value: 'archive_no', label: '档号' },
  200. { value: 'archive_year', label: '年度' }
  201. ],
  202. inputSelect: '',
  203. permission: {
  204. add: ['admin', 'archivesList:add'],
  205. edit: ['admin', 'archivesList:edit'],
  206. del: ['admin', 'archivesList:del'],
  207. download: ['admin', 'archivesList:download']
  208. },
  209. fixedStatusBar: false, // table-右侧fixed
  210. deleteVisible: false, // 删除dialog
  211. deleteData: {}, // 删除选中data
  212. tableDisplayFields: [], // table-list-title字段
  213. getTableDisplayFieldsLoading: false, // table-loading
  214. formPreviewData: [], // 预览界面data
  215. isEditOrAdd: '',
  216. selectedData: null,
  217. archivesTabIndex: 0, // 新增
  218. tabDisabled: true,
  219. arcId: null, // 档案ID
  220. arrySort: [],
  221. uploadFileVisible: false, // 上传附件
  222. archivesInfoVisible: false, // 档案详情
  223. packingVisible: false // 装盒
  224. }
  225. },
  226. watch: {
  227. selectedCategory: function(newValue, oldValue) {
  228. // 案卷 卷内 文件
  229. if (newValue.isType === 3 || newValue.isType === 4 || newValue.isType === 5) {
  230. this.crud.query.categoryId = newValue.id
  231. this.crud.refresh()
  232. }
  233. },
  234. tableDisplayFields(val) {
  235. this.doLayout()
  236. }
  237. },
  238. created() {
  239. // 初始化带select的输入框的 - 搜索
  240. this.inputSelect = this.queryOption[0].value
  241. },
  242. mounted() {
  243. },
  244. methods: {
  245. // 搜索-select
  246. querySelect(val) {
  247. this.inputSelect = val
  248. },
  249. [CRUD.HOOK.beforeRefresh]() {
  250. this.getTableDisplayFieldsLoading = true
  251. // 档案列表获取显示列
  252. getTableDisplayFields({ categoryId: this.selectedCategory.id }).then(data => {
  253. this.tableDisplayFields = data
  254. this.getTableDisplayFieldsLoading = false
  255. this.tableDisplayFields.map(item => {
  256. if (item.queue) {
  257. this.arrySort.push(item.fieldName + ', ' + (item.displayOrder === 1 ? 'asc' : 'desc'))
  258. }
  259. })
  260. this.crud.sort = this.arrySort
  261. new Promise((resolve, reject) => {
  262. this.crud.loading = true
  263. // 请求数据
  264. initData(this.crud.url, this.crud.getQueryParams()).then(data => {
  265. const table = this.crud.getTable()
  266. if (table && table.lazy) { // 懒加载子节点数据,清掉已加载的数据
  267. table.store.states.treeData = {}
  268. table.store.states.lazyTreeNodeMap = {}
  269. }
  270. if (data) {
  271. this.crud.page.total = data.totalElements !== null ? data.totalElements : data.length
  272. this.crud.data = data.content ? data.content : data
  273. this.crud.resetDataStatus()
  274. resolve(data)
  275. // time 毫秒后显示表格
  276. setTimeout(() => {
  277. this.crud.loading = false
  278. }, this.crud.time)
  279. }
  280. }).catch(err => {
  281. this.crud.loading = false
  282. reject(err)
  283. })
  284. })
  285. })
  286. return false
  287. },
  288. [CRUD.HOOK.beforeToCU](crud, form, btn) {
  289. this.isEditOrAdd = btn
  290. this.selectedData = crud.selections
  291. this.archivesTabIndex = 0
  292. if (this.isEditOrAdd === 'add') {
  293. this.tabDisabled = true
  294. this.arcId = null
  295. } else if (this.isEditOrAdd === 'edit') {
  296. this.arcId = this.selectedData[0].id
  297. this.tabDisabled = false
  298. }
  299. this.form.dictionaryConfigId = {}
  300. this.formPreviewData = []
  301. // 档案预编辑获取字段
  302. const params = {
  303. categoryId: this.selectedCategory.id,
  304. archivesId: this.arcId
  305. }
  306. this.getFormInfo(params)
  307. },
  308. // 著录界面-form/详情-api
  309. getFormInfo(params) {
  310. getFormDisplayFields(params).then(data => {
  311. // this.formPreviewData = data.showFiled.filter((fields) => { return fields.isInput })
  312. this.formPreviewData = data.showFiled
  313. this.form.categoryId = this.selectedCategory.id
  314. this.$nextTick(() => {
  315. if (this.isEditOrAdd === 'edit') {
  316. this.$refs.previewForm.addOrUpdateForm = data.echo
  317. }
  318. })
  319. })
  320. },
  321. // form - submit
  322. handlerArchivesSubmit() {
  323. this.$refs.previewForm.submitForm('addOrUpdateForm')
  324. },
  325. // table - 双击查看详情
  326. tableDoubleClick(row) {
  327. this.archivesInfoVisible = true
  328. const params = {
  329. categoryId: this.selectedCategory.id,
  330. archivesId: row.id
  331. }
  332. this.getFormInfo(params)
  333. },
  334. // table - 当前选中得row
  335. clickRowHandler(row) {
  336. this.$refs.table.toggleRowSelection(row)
  337. },
  338. // 选择删除
  339. toDelete(data) {
  340. this.deleteData = data
  341. this.deleteVisible = true
  342. },
  343. // 确认删除
  344. handleDeltConfirm() {
  345. this.deleteVisible = false
  346. this.crud.delAllLoading = true
  347. // this.crud.doDelete(this.deleteData)
  348. const ids = []
  349. this.deleteData.forEach(val => {
  350. ids.push(val.id)
  351. })
  352. const params = {
  353. 'ids': ids,
  354. 'categoryId': this.selectedCategory.id
  355. }
  356. // 删除fetch
  357. del(params).then(res => {
  358. this.crud.delAllLoading = false
  359. this.$notify({
  360. title: '删除成功',
  361. type: 'success',
  362. duration: 2500
  363. })
  364. this.crud.refresh()
  365. })
  366. },
  367. // 删除 - 关闭
  368. handleClose(done) {
  369. this.deleteData = {}
  370. done()
  371. },
  372. /* 重新渲染table组件 防止table-fixed 错位 配合watch-table数据 */
  373. doLayout() {
  374. this.$nextTick(() => {
  375. this.$refs.table.doLayout()
  376. })
  377. },
  378. uploadFile() {
  379. this.uploadFileVisible = true
  380. },
  381. uploadFileSave() {
  382. this.uploadFileVisible = false
  383. }
  384. }
  385. }
  386. </script>
  387. <style rel="stylesheet/scss" lang="scss" scoped>
  388. @import "~@/assets/styles/archives-manage.scss";
  389. .preview-dialog {
  390. ::v-deep .el-dialog {
  391. .el-dialog__body{
  392. padding: 0;
  393. }
  394. .preview-content {
  395. width: auto !important;
  396. margin-right: 6px;
  397. overflow: hidden;
  398. overflow-y: auto;
  399. .el-textarea__inner {
  400. border: 1px solid #339cff;
  401. background-color: transparent;
  402. }
  403. }
  404. .dialog-footer{
  405. margin: 0 auto;
  406. padding: 15px 0 20px 0;
  407. }
  408. }
  409. }
  410. </style>