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

352 lines
12 KiB

  1. <template>
  2. <div>
  3. <div class="head-container">
  4. <div>
  5. <el-button size="mini" @click="toAdd">
  6. <i class="iconfont icon-xinzeng" />
  7. 新增
  8. </el-button>
  9. <el-button size="mini" :disabled="crud.selections.length !== 1" @click="toEdit(crud.selections[0])">
  10. <i class="iconfont icon-bianji" />
  11. 编辑
  12. </el-button>
  13. <el-button slot="reference" size="mini" :disabled="crud.selections.length === 0" @click="toDelete(crud.selections)">
  14. <i class="iconfont icon-shanchu" />
  15. 删除
  16. </el-button>
  17. <el-button :disabled="crud.selections.length === 0" size="mini" @click="doExport(crud.selections)">
  18. <i class="iconfont icon-daochu" />
  19. 导出
  20. </el-button>
  21. </div>
  22. <div class="online-right-handle">
  23. <el-button size="mini" @click="handleUpload"><i class="iconfont icon-shangchuan2" />附件上传</el-button>
  24. <el-button size="mini" :disabled="crud.selections.length === 0" @click="toPublish(crud.selections)"><i class="iconfont icon-fabu" />发布</el-button>
  25. <el-button size="mini"><i class="iconfont icon-huifu" />取消发布</el-button>
  26. </div>
  27. </div>
  28. <el-table
  29. ref="table"
  30. :data="crud.data"
  31. row-key="id"
  32. style="width: 100%;"
  33. height="calc(100vh - 485px)"
  34. @cell-dblclick="tableDoubleClick"
  35. @selection-change="crud.selectionChangeHandler"
  36. >
  37. <el-table-column type="selection" :reserve-selection="true" width="55" align="center" />
  38. <el-table-column type="index" label="序号" width="55" align="center" />
  39. <el-table-column prop="username" label="文档名称" align="center" />
  40. <el-table-column prop="browser" label="创建人" align="center" />
  41. <el-table-column prop="createTime" label="加入时间" width="200">
  42. <template slot-scope="scope">
  43. <div>{{ scope.row.createTime | parseTime }}</div>
  44. </template>
  45. </el-table-column>
  46. <el-table-column prop="username" label="状态" align="center" />
  47. </el-table>
  48. <pagination v-if="crud.data.length !== 0" />
  49. <el-dialog class="fileUpload-dialog" title="附件上传" :close-on-click-modal="false" :modal-append-to-body="false" append-to-body :visible.sync="uploadVisible">
  50. <div class="setting-dialog">
  51. <div class="upload-container">
  52. <i v-if="fileList.length === 0" class="iconfont icon-tianjiawenjian upload-icon" />
  53. <div v-for="item in fileList" :key="item.name" class="file-list">
  54. <i class="iconfont icon-xiaowenjian" />
  55. {{ item.name }}
  56. <i class="el-icon-close" @click="deleteFile(item)" />
  57. </div>
  58. <div class="upload-input">
  59. <input ref="fileInput" :key="key" type="file" :accept="'.zip'" @change="handleFileChange">
  60. <div class="upload-zip"><i class="iconfont icon-shangchuan2" />点击上传</div>
  61. </div>
  62. <div class="el-upload__tip">上传限制文件类型zip</div>
  63. </div>
  64. <div slot="footer" class="dialog-footer">
  65. <el-button type="text" @click="uploadVisible = false">取消</el-button>
  66. <el-button type="primary" @click="handleUploadConfirm">保存</el-button>
  67. </div>
  68. </div>
  69. </el-dialog>
  70. <el-dialog class="detail-dialog" title="编研详情" :close-on-click-modal="false" :modal-append-to-body="false" append-to-body :visible.sync="onlineEditDetail" :before-close="handleCloseDialog">
  71. <div class="setting-dialog">
  72. <div class="detail-tab tab-content">
  73. <!-- tab -->
  74. <ul class="tab-nav">
  75. <li :class="{'active-tab-nav': onlineTabIndex == 0}" @click="changeOnlineTab(0)">文档正文</li>
  76. <li :class="{'active-tab-nav': onlineTabIndex == 1}" @click="changeOnlineTab(1)">文档附件</li>
  77. </ul>
  78. <div v-if="onlineTabIndex===0">文档正文</div>
  79. <el-table
  80. v-if="onlineTabIndex===1"
  81. ref="table"
  82. :data="detailArcData"
  83. row-key="id"
  84. style="width: 100%;"
  85. height="calc(100vh - 560px)"
  86. >
  87. <el-table-column type="index" label="序号" align="center" width="55" />
  88. <el-table-column prop="title" label="附件名称">
  89. <template>
  90. <div class="title-style"><span>文件</span>档号题名</div>
  91. </template>
  92. </el-table-column>
  93. <el-table-column prop="title" label="格式" />
  94. <el-table-column prop="title" label="大小" />
  95. <el-table-column prop="title" label="操作者" />
  96. <el-table-column prop="title" label="加入时间" />
  97. </el-table>
  98. </div>
  99. </div>
  100. </el-dialog>
  101. <OnlineAdd ref="onlineAdd" />
  102. </div>
  103. </template>
  104. <script>
  105. import CRUD, { presenter, crud } from '@crud/crud'
  106. import pagination from '@crud/Pagination'
  107. import OnlineAdd from './onlineAdd'
  108. import { upload } from '@/utils/upload'
  109. import { mapGetters } from 'vuex'
  110. export default {
  111. name: 'OnlineEditing',
  112. components: { pagination, OnlineAdd },
  113. mixins: [presenter(), crud()],
  114. cruds() {
  115. return CRUD({
  116. url: 'api/log/initLog',
  117. title: '在线编研',
  118. optShow: {
  119. add: false,
  120. edit: false,
  121. del: false,
  122. download: false,
  123. reset: false,
  124. group: false
  125. }
  126. })
  127. },
  128. props: {
  129. activeIndex: {
  130. type: Number,
  131. default: 0
  132. }
  133. },
  134. data() {
  135. return {
  136. selections: [],
  137. keyWord: null,
  138. options: [
  139. { value: 'username', label: '利用人' },
  140. { value: 'account', label: '利用事由' }
  141. ],
  142. optionVal: '',
  143. startTime: null,
  144. endTime: null,
  145. lendDetail: false,
  146. form: {
  147. user: '张三',
  148. process: '档案借阅流程-张三-2023-01-01',
  149. startDate: '2016-09-21 08:50:08',
  150. endDate: '2016-10-21 08:50:08',
  151. remark: '利用事由'
  152. },
  153. detailArcData: [],
  154. checkList: ['电子查看', '实体借阅'],
  155. onlineEditDetail: false,
  156. onlineTabIndex: 0,
  157. uploadVisible: false,
  158. fileList: []
  159. }
  160. },
  161. computed: {
  162. ...mapGetters([
  163. 'baseApi'
  164. ])
  165. },
  166. watch: {
  167. activeIndex: function(newValue, oldValue) {
  168. console.log('newValue', newValue)
  169. this.crud.query.isType = newValue
  170. this.crud.toQuery()
  171. }
  172. },
  173. mounted() {
  174. },
  175. methods: {
  176. [CRUD.HOOK.beforeRefresh]() {
  177. this.crud.query.isType = this.activeIndex
  178. },
  179. changeOnlineTab(data) {
  180. this.onlineTabIndex = data
  181. },
  182. toAdd() {
  183. this.$refs.onlineAdd.onlineTitle = '新增在线编研'
  184. this.$refs.onlineAdd.onlineAddVisible = true
  185. },
  186. toEdit() {
  187. this.$refs.onlineAdd.onlineTitle = '编辑在线编研'
  188. this.$refs.onlineAdd.onlineAddVisible = true
  189. },
  190. tableDoubleClick() {
  191. this.onlineEditDetail = true
  192. },
  193. toDelete(data) {
  194. if (data.length === 0) {
  195. this.$message({ message: '您还未勾选需要操作的条目,请先确认!', offset: 8 })
  196. return false
  197. }
  198. this.$confirm('此操作将删除当前所选编研主题' + '<span>你是否还要继续?</span>', '提示', {
  199. confirmButtonText: '继续',
  200. cancelButtonText: '取消',
  201. type: 'warning',
  202. dangerouslyUseHTMLString: true
  203. }).then(() => {
  204. const archivesIds = []
  205. this.selections.forEach(val => {
  206. archivesIds.push(val.id)
  207. })
  208. const params = {
  209. 'categoryId': this.selectedCategory.id,
  210. 'categoryLevel': this.collectLevel,
  211. 'archivesIds': archivesIds
  212. }
  213. console.log(params)
  214. }).catch(() => {
  215. })
  216. },
  217. // 导出
  218. doExport(data) {
  219. if (data.length === 0) {
  220. this.$message({ message: '您还未勾选需要操作的条目,请先确认!', offset: 8 })
  221. return false
  222. }
  223. this.$confirm('此操作将导出所选数据' + '<span>你是否还要继续?</span>', '提示', {
  224. confirmButtonText: '继续',
  225. cancelButtonText: '取消',
  226. type: 'warning',
  227. dangerouslyUseHTMLString: true
  228. }).then(() => {
  229. const archivesIds = []
  230. this.selections.forEach(val => {
  231. archivesIds.push(val.id)
  232. })
  233. const params = {
  234. 'categoryId': this.selectedCategory.id,
  235. 'categoryLevel': this.collectLevel,
  236. 'archivesIds': archivesIds
  237. }
  238. console.log(params)
  239. // exportFile(this.baseApi + '/api/collect/exportDate?' + qs.stringify(params, { indices: false }))
  240. }).catch(() => {
  241. })
  242. },
  243. toPublish(data) {
  244. if (data.length === 0) {
  245. this.$message({ message: '您还未勾选需要操作的条目,请先确认!', offset: 8 })
  246. return false
  247. }
  248. this.$confirm('此操作将发布当前所选文档' + '<span>你是否还要继续?</span>', '提示', {
  249. confirmButtonText: '继续',
  250. cancelButtonText: '取消',
  251. type: 'warning',
  252. dangerouslyUseHTMLString: true
  253. }).then(() => {
  254. const archivesIds = []
  255. this.selections.forEach(val => {
  256. archivesIds.push(val.id)
  257. })
  258. const params = {
  259. 'categoryId': this.selectedCategory.id,
  260. 'categoryLevel': this.collectLevel,
  261. 'archivesIds': archivesIds
  262. }
  263. console.log(params)
  264. }).catch(() => {
  265. })
  266. },
  267. handleUpload() {
  268. if (this.crud.selections.length !== 1) {
  269. this.$message({ message: '只可勾选唯一目标条目,请先确认!', offset: 8 })
  270. return false
  271. }
  272. this.uploadVisible = true
  273. },
  274. handleFileChange(e) {
  275. const files = e.target.files
  276. this.file = files[0]
  277. this.key++
  278. const maxMessage = '上传文件大小不能超过 10MB,可使用大文件上传!'
  279. const maxSize = 10 * 1024 * 1024
  280. if (this.file && this.file.size > maxSize) {
  281. this.$message({ message: maxMessage, type: 'warning', offset: 8 })
  282. this.fileList = []
  283. e.target.value = ''
  284. return false
  285. }
  286. if (this.fileList.length !== 0) {
  287. const existingFile = this.fileList.some(file => file.name === this.file.name)
  288. if (existingFile) {
  289. this.$message({ message: '文件已存在', type: 'warning', offset: 8 })
  290. return false
  291. }
  292. }
  293. for (let i = 0; i < files.length; i++) {
  294. if (this.uploadType === 2) {
  295. this.fileList = []
  296. this.fileList.push(files[i])
  297. } else {
  298. this.fileList.push(files[i])
  299. }
  300. }
  301. },
  302. handleUploadConfirm() {
  303. if (this.fileList.length === 0) {
  304. this.$message({ message: '请先选择相关文件!', offset: 8 })
  305. return false
  306. }
  307. // 原文目录上传
  308. upload(this.baseApi + '/api/collect/catalogUpload',
  309. this.fileList[0]
  310. ).then(res => {
  311. if (res.data.code === 200) {
  312. // 暂不用写太详细的失败成功信息,只要200,就操作成功
  313. // this.$message.success('成功追加' + res.data.data + '附件')
  314. this.$message({ message: '操作成功', type: 'success', offset: 8 })
  315. // this.$emit('close-dialog')
  316. this.uploadVisible = false
  317. } else {
  318. this.$message({ message: '操作失败', type: 'error', offset: 8 })
  319. }
  320. })
  321. },
  322. handleCloseDialog(done) {
  323. this.lendDetail = false
  324. this.onlineEditDetail = false
  325. // 关闭弹框
  326. // done()
  327. }
  328. }
  329. }
  330. </script>
  331. <style lang="scss" scoped>
  332. .head-container{
  333. display: flex;
  334. justify-content: space-between;
  335. margin: 20px 0;
  336. }
  337. // ::v-deep .el-checkbox-group{
  338. // .el-checkbox{
  339. // margin-right: 10px !important;
  340. // }
  341. // }
  342. ::v-deep .el-pagination{
  343. margin: 24px 0 10px 0 !important
  344. }
  345. </style>