index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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. if (this.ListDownload.length) {
  76. this.dialogTableVisible = true
  77. }
  78. })
  79. }
  80. },
  81. methods: {
  82. handleClick(item) {
  83. if (item.isPwd) {
  84. this.$prompt('请输入下载密码', '提示', {
  85. confirmButtonText: '确定',
  86. cancelButtonText: '取消',
  87. inputValidator: value => {
  88. if (!value) {
  89. return '密码不能为空!'
  90. }
  91. }
  92. })
  93. .then(({ value }) => {
  94. downloadFiles('com/list/download', {
  95. id: item.id,
  96. downloadPwd: value
  97. })
  98. })
  99. .catch(() => {})
  100. } else {
  101. downloadFiles('com/list/download', {
  102. id: item.id
  103. })
  104. }
  105. },
  106. handleClickOutside() {
  107. this.$store.dispatch('app/closeSideBar', { withoutAnimation: false })
  108. }
  109. }
  110. }
  111. </script>
  112. <style lang="scss" scoped>
  113. @import '~@/styles/mixin.scss';
  114. @import '~@/styles/variables.scss';
  115. .app-wrapper {
  116. @include clearfix;
  117. position: relative;
  118. height: 100%;
  119. width: 100%;
  120. &.mobile.openSidebar {
  121. position: fixed;
  122. top: 0;
  123. }
  124. }
  125. .drawer-bg {
  126. background: #000;
  127. opacity: 0.3;
  128. width: 100%;
  129. top: 0;
  130. height: 100%;
  131. position: absolute;
  132. z-index: 999;
  133. }
  134. .fixed-header {
  135. position: fixed;
  136. top: 0;
  137. right: 0;
  138. z-index: 999;
  139. width: calc(100% - #{$sideBarWidth});
  140. transition: width 0.28s;
  141. }
  142. .hideSidebar .fixed-header {
  143. width: calc(100% - 54px);
  144. }
  145. .mobile .fixed-header {
  146. width: 100%;
  147. }
  148. </style>