123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 |
- <template>
- <div :class="classObj" class="app-wrapper">
- <div v-if="device === 'mobile' && sidebar.opened" class="drawer-bg" @click="handleClickOutside" />
- <sidebar class="sidebar-container" />
- <div :class="{ hasTagsView: needTagsView }" class="main-container">
- <div :class="{ 'fixed-header': fixedHeader }">
- <navbar />
- <tags-view v-if="needTagsView" />
- </div>
- <app-main />
- </div>
- <el-dialog title="文件下发通知" width="700px" :visible.sync="dialogTableVisible">
- <el-table :data="ListDownload" size="mini">
- <el-table-column property="title" label="标题"></el-table-column>
- <el-table-column property="createTime" label="下发时间" width="120"></el-table-column>
- <el-table-column label="操作" width="120">
- <template slot-scope="scope">
- <el-button @click="handleClick(scope.row)" type="text" size="small">确认接受并且下载</el-button>
- </template>
- </el-table-column>
- </el-table>
- </el-dialog>
- </div>
- </template>
- <script>
- import { Navbar, Sidebar, AppMain } from './components'
- import TagsView from './components/TagsView/index'
- import ResizeMixin from './mixin/ResizeHandler'
- import { comListDownloadGet } from '@/api/common'
- import { exportFile } from '@/api/universal/universal_list'
- import { downloadFiles } from '@/utils/util'
- export default {
- name: 'Layout',
- components: {
- Navbar,
- Sidebar,
- AppMain,
- TagsView
- },
- mixins: [ResizeMixin],
- computed: {
- sidebar() {
- return this.$store.state.app.sidebar
- },
- device() {
- return this.$store.state.app.device
- },
- fixedHeader() {
- return this.$store.state.settings.fixedHeader
- },
- needTagsView() {
- return this.$store.state.settings.tagsView
- },
- classObj() {
- return {
- hideSidebar: !this.sidebar.opened,
- openSidebar: this.sidebar.opened,
- withoutAnimation: this.sidebar.withoutAnimation,
- mobile: this.device === 'mobile'
- }
- }
- },
- data() {
- return {
- dialogTableVisible: false,
- ListDownload: []
- }
- },
- mounted() {
- if (window.localStorage.getItem('dakaitishichuangkou')) {
- window.localStorage.removeItem('dakaitishichuangkou')
- // 打开提示窗口
- comListDownloadGet({ pageNo: 1, pageSize: -1 }).then(res => {
- this.ListDownload = res.data.records
- console.log(this.ListDownload)
- if (this.ListDownload.length) {
- this.dialogTableVisible = true
- }
- })
- }
- },
- methods: {
- handleClick(item) {
- if (item.isPwd) {
- this.$prompt('请输入下载密码', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- inputValidator: value => {
- if (!value) {
- return '密码不能为空!'
- }
- }
- })
- .then(({ value }) => {
- downloadFiles('com/list/download', {
- id: item.id,
- downloadPwd: value
- })
- })
- .catch(() => {})
- } else {
- downloadFiles('com/list/download', {
- id: item.id
- })
- }
- },
- handleClickOutside() {
- this.$store.dispatch('app/closeSideBar', { withoutAnimation: false })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- @import '~@/styles/mixin.scss';
- @import '~@/styles/variables.scss';
- .app-wrapper {
- @include clearfix;
- position: relative;
- height: 100%;
- width: 100%;
- &.mobile.openSidebar {
- position: fixed;
- top: 0;
- }
- }
- .drawer-bg {
- background: #000;
- opacity: 0.3;
- width: 100%;
- top: 0;
- height: 100%;
- position: absolute;
- z-index: 999;
- }
- .fixed-header {
- position: fixed;
- top: 0;
- right: 0;
- z-index: 999;
- width: calc(100% - #{$sideBarWidth});
- transition: width 0.28s;
- }
- .hideSidebar .fixed-header {
- width: calc(100% - 54px);
- }
- .mobile .fixed-header {
- width: 100%;
- }
- </style>
|