index.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. <template>
  2. <div :class="classObj" class="app-wrapper">
  3. <div v-if="device === 'mobile' && sidebar.opened" class="drawer-bg" @click="handleClickOutside" />
  4. <sidebar class="sidebar-container" />
  5. <div :class="{ hasTagsView: needTagsView }" class="main-container">
  6. <div :class="{ 'fixed-header': fixedHeader }">
  7. <navbar />
  8. <tags-view v-if="needTagsView" />
  9. </div>
  10. <app-main />
  11. </div>
  12. <el-dialog title="文件下发通知" width="700px" :visible.sync="dialogTableVisible">
  13. <el-table :data="ListDownload" size="mini">
  14. <el-table-column property="title" label="标题"></el-table-column>
  15. <el-table-column property="createTime" label="下发时间" width="120"></el-table-column>
  16. <el-table-column label="操作" width="120">
  17. <template slot-scope="scope">
  18. <el-button @click="handleClick(scope.row)" type="text" size="small">确认接受并且下载</el-button>
  19. </template>
  20. </el-table-column>
  21. </el-table>
  22. </el-dialog>
  23. </div>
  24. </template>
  25. <script>
  26. import { Navbar, Sidebar, AppMain } from './components'
  27. import TagsView from './components/TagsView/index'
  28. import ResizeMixin from './mixin/ResizeHandler'
  29. import { comListDownloadGet } from '@/api/common'
  30. import { exportFile } from '@/api/universal/universal_list'
  31. import { downloadFiles } from '@/utils/util'
  32. export default {
  33. name: 'Layout',
  34. components: {
  35. Navbar,
  36. Sidebar,
  37. AppMain,
  38. TagsView
  39. },
  40. mixins: [ResizeMixin],
  41. computed: {
  42. sidebar() {
  43. return this.$store.state.app.sidebar
  44. },
  45. device() {
  46. return this.$store.state.app.device
  47. },
  48. fixedHeader() {
  49. return this.$store.state.settings.fixedHeader
  50. },
  51. needTagsView() {
  52. return this.$store.state.settings.tagsView
  53. },
  54. classObj() {
  55. return {
  56. hideSidebar: !this.sidebar.opened,
  57. openSidebar: this.sidebar.opened,
  58. withoutAnimation: this.sidebar.withoutAnimation,
  59. mobile: this.device === 'mobile'
  60. }
  61. }
  62. },
  63. data() {
  64. return {
  65. dialogTableVisible: false,
  66. ListDownload: []
  67. }
  68. },
  69. mounted() {
  70. if (window.localStorage.getItem('dakaitishichuangkou')) {
  71. window.localStorage.removeItem('dakaitishichuangkou')
  72. // 打开提示窗口
  73. comListDownloadGet({ pageNo: 1, pageSize: -1 }).then(res => {
  74. this.ListDownload = res.data.records
  75. console.log(this.ListDownload)
  76. if (this.ListDownload.length) {
  77. this.dialogTableVisible = true
  78. }
  79. })
  80. }
  81. },
  82. methods: {
  83. handleClick(item) {
  84. if (item.isPwd) {
  85. this.$prompt('请输入下载密码', '提示', {
  86. confirmButtonText: '确定',
  87. cancelButtonText: '取消',
  88. inputValidator: value => {
  89. if (!value) {
  90. return '密码不能为空!'
  91. }
  92. }
  93. })
  94. .then(({ value }) => {
  95. downloadFiles('com/list/download', {
  96. id: item.id,
  97. downloadPwd: value
  98. })
  99. })
  100. .catch(() => {})
  101. } else {
  102. downloadFiles('com/list/download', {
  103. id: item.id
  104. })
  105. }
  106. },
  107. handleClickOutside() {
  108. this.$store.dispatch('app/closeSideBar', { withoutAnimation: false })
  109. }
  110. }
  111. }
  112. </script>
  113. <style lang="scss" scoped>
  114. @import '~@/styles/mixin.scss';
  115. @import '~@/styles/variables.scss';
  116. .app-wrapper {
  117. @include clearfix;
  118. position: relative;
  119. height: 100%;
  120. width: 100%;
  121. &.mobile.openSidebar {
  122. position: fixed;
  123. top: 0;
  124. }
  125. }
  126. .drawer-bg {
  127. background: #000;
  128. opacity: 0.3;
  129. width: 100%;
  130. top: 0;
  131. height: 100%;
  132. position: absolute;
  133. z-index: 999;
  134. }
  135. .fixed-header {
  136. position: fixed;
  137. top: 0;
  138. right: 0;
  139. z-index: 999;
  140. width: calc(100% - #{$sideBarWidth});
  141. transition: width 0.28s;
  142. }
  143. .hideSidebar .fixed-header {
  144. width: calc(100% - 54px);
  145. }
  146. .mobile .fixed-header {
  147. width: 100%;
  148. }
  149. </style>