系统设置--上传文件管理

This commit is contained in:
gooking 2018-05-19 06:36:22 +08:00
parent 29b90815e9
commit c3203e89d7
8 changed files with 238 additions and 8 deletions

28
src/api/apiExtDfs.js Normal file
View File

@ -0,0 +1,28 @@
import request from '@/utils/request'
export function fetchDataList(page, pageSize, data) {
return request({
url: '/user/apiExtDfs/list',
method: 'post',
data: {
page,
pageSize,
...data
}
})
}
export function statistics() {
return request({
url: '/user/apiExtDfs/statistics',
method: 'get'
})
}
export function delData(id) {
return request({
url: '/user/apiExtDfs/del',
method: 'post',
data: { id }
})
}

View File

@ -67,8 +67,7 @@ export function resetpwd(mobile, pwd, smsCode) {
export function checkToken() {
return request({
url: '/user/checkToken',
method: 'get',
params: { }
method: 'get'
})
}

1
src/icons/svg/files.svg Normal file
View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1526631786252" class="icon" style="" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2052" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M405.333333 874.666667h213.333334v-42.666667H405.333333v42.666667z m554.666667-213.333334h-42.666667V256c0-6.4-2.133333-10.666667-6.4-14.933333l-192-192c-4.266667-4.266667-8.533333-6.4-14.933333-6.4H256c-12.8 0-21.333333 8.533333-21.333333 21.333333v64H128c-12.8 0-21.333333 8.533333-21.333333 21.333333v512H64c-12.8 0-21.333333 8.533333-21.333333 21.333334v277.333333c0 12.8 8.533333 21.333333 21.333333 21.333333h896c12.8 0 21.333333-8.533333 21.333333-21.333333V682.666667c0-12.8-8.533333-21.333333-21.333333-21.333334zM725.333333 115.2l119.466667 119.466667H725.333333V115.2zM277.333333 85.333333h405.333334v170.666667c0 12.8 8.533333 21.333333 21.333333 21.333333h170.666667v384h-149.333334c-4.266667 0-8.533333 0-10.666666 2.133334L612.266667 725.333333h-200.533334l-102.4-61.866666c-2.133333-2.133333-6.4-2.133333-10.666666-2.133334h-21.333334V85.333333zM149.333333 170.666667h85.333334v490.666666H149.333333V170.666667z m789.333334 768H85.333333V704h206.933334l102.4 61.866667c2.133333 2.133333 6.4 2.133333 10.666666 2.133333h213.333334c4.266667 0 8.533333 0 10.666666-2.133333l102.4-61.866667H938.666667v234.666667zM392.533333 275.2l34.133334-17.066667 34.133333 17.066667c6.4 2.133333 12.8 2.133333 19.2 0l34.133333-17.066667 34.133334 17.066667c0 2.133333 2.133333 2.133333 6.4 2.133333s6.4 0 8.533333-2.133333l32-17.066667 34.133333 17.066667 19.2-38.4-42.666666-21.333333c-6.4-2.133333-12.8-2.133333-19.2 0l-32 17.066666-34.133334-17.066666c-6.4-2.133333-12.8-2.133333-19.2 0l-32 17.066666-34.133333-17.066666c-6.4-2.133333-12.8-2.133333-19.2 0l-32 17.066666-32-17.066666-19.2 38.4 42.666667 21.333333c4.266667 2.133333 12.8 2.133333 17.066666 0z m0 128l34.133334-17.066667 34.133333 17.066667c6.4 2.133333 12.8 2.133333 19.2 0l34.133333-17.066667 4.266667 2.133334 27.733333 14.933333c2.133333 2.133333 4.266667 2.133333 8.533334 2.133333s6.4 0 8.533333-2.133333l32-17.066667 34.133333 17.066667c6.4 2.133333 12.8 2.133333 19.2 0l34.133334-17.066667 34.133333 17.066667c2.133333 2.133333 4.266667 2.133333 8.533333 2.133333s6.4 0 8.533334-2.133333l32-17.066667 34.133333 17.066667 19.2-38.4-42.666667-21.333333c-6.4-2.133333-12.8-2.133333-19.2 0l-32 17.066666-34.133333-17.066666c-6.4-2.133333-12.8-2.133333-19.2 0l-32 17.066666-34.133333-17.066666c-2.133333-2.133333-4.266667-2.133333-8.533334-2.133334s-6.4 0-10.666666 2.133334l-10.666667 6.4-21.333333 10.666666-34.133334-17.066666c-6.4-2.133333-12.8-2.133333-19.2 0l-32 17.066666-34.133333-17.066666c-6.4-2.133333-12.8-2.133333-19.2 0l-32 17.066666-32-17.066666-19.2 38.4 42.666667 21.333333c4.266667 2.133333 12.8 2.133333 17.066666 0z" p-id="2053"></path></svg>

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -59,6 +59,26 @@ export const constantRouterMap = [
}]
},
{
name: '系统设置',
path: '/user/apiExtDfs',
component: Layout,
redirect: '/user/apiExtDfs/list',
meta: { title: '系统设置', icon: 'setting' },
children: [{
name: '上传文件管理',
path: 'list',
component: () => import('@/views/apiExtDfs/list'),
meta: { title: '上传文件管理', icon: 'files' }
},
{
name: '我的资源包2',
path: 'dashboard3',
component: () => import('@/views/dashboard/index'),
meta: { title: '我的资源包2', icon: 'setting' }
}]
},
{
path: '/example',
component: Layout,

View File

@ -1,9 +1,5 @@
const getters = {
sidebar: state => state.app.sidebar,
device: state => state.app.device,
token: state => state.user.token,
avatar: state => state.user.avatar,
name: state => state.user.name,
roles: state => state.user.roles
device: state => state.app.device
}
export default getters

View File

@ -0,0 +1,161 @@
<template>
<div class="app-container">
<div class="filter-container">
<el-select clearable style="width: 200px" class="filter-item" v-model="searchData.fileType" placeholder="文件类型">
<el-option label="图片" value="0"></el-option>
<el-option label="音频" value="1"></el-option>
<el-option label="其他" value="2"></el-option>
</el-select>
<el-input clearable @keyup.enter.native="fetchData" style="width: 200px;" class="filter-item" placeholder="文件后缀" v-model="searchData.suffix">
</el-input>
<el-input clearable @keyup.enter.native="fetchData" style="width: 200px;" class="filter-item" placeholder="文件名称" v-model="searchData.urlLike">
</el-input>
<el-date-picker type="date" placeholder="上传时间起" v-model="searchData.dateAddBegin" style="width: 200px;" class="filter-item"></el-date-picker>
<el-date-picker type="date" placeholder="上传时间止" v-model="searchData.dateAddEnd" style="width: 200px;" class="filter-item"></el-date-picker>
<el-button class="filter-item" type="primary" icon="el-icon-search" @click="fetchData">搜索</el-button>
</div>
<el-table :data="list" v-loading.body="listLoading" element-loading-text="Loading" border fit highlight-current-row empty-text="暂无数据" @selection-change="handleSelectionChange">
<el-table-column type="selection" align="center" width="55" row-key="id"></el-table-column>
<el-table-column prop="fileTypeStr" label="类型"></el-table-column>
<el-table-column prop="suffix" label="文件后缀"></el-table-column>
<el-table-column prop="sizeStr" label="容量"></el-table-column>
<el-table-column label="Url">
<template slot-scope="scope">
<a :href="scope.row.urlFull" target="_blank">{{ scope.row.urlFull }}</a>
</template>
</el-table-column>
<el-table-column prop="dateAdd" label="购买时间"></el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button type="text" class='delete' @click="delData(scope.row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-button style='margin-top:20px' type="danger" @click="delDataMore">批量删除</el-button>
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="page"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="totalRow" style="margin-top:20px;">
</el-pagination>
</div>
</template>
<script>
import { fetchDataList, statistics, delData } from '@/api/apiExtDfs'
import { Message, MessageBox } from 'element-ui'
export default {
data() {
return {
page:1,
pageSize:10,
totalRow:0,
searchData:{
fileType:undefined,
suffix:'',
urlLike:'',
dateAddBegin:'',
dateAddEnd:''
},
multipleSelection: [],
list: null,
listLoading: true,
statisticsData:{}
}
},
created() {
this.fetchData()
this.statistics()
},
methods: {
handleSizeChange(val) {
this.pageSize = val;
this.fetchData();
},
handleCurrentChange(val) {
this.page = val
this.fetchData()
},
handleSelectionChange(val) {
this.multipleSelection = val
},
fetchData() {
this.list = null
this.listLoading = true
fetchDataList(this.page, this.pageSize, this.searchData).then(response => {
if (response.code == 0) {
this.list = response.data.result
this.totalRow = response.data.totalRow
}
this.listLoading = false
})
},
statistics(){
statistics().then(res => {
//
this.statisticsData = res.data
})
},
delData(id){
this.$confirm('删除无法恢复, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
delData(id).then(res => {
Message({
message: '删除成功',
type: 'success',
duration: 1 * 1000,
onClose: () => {
this.fetchData()
}
})
})
}).catch(() => {});
},
delDataMore(){
if (!this.multipleSelection.length) {
Message({
message: '请先选择需要删除的数据',
type: 'error',
duration: 1 * 1000
})
return
}
this.$confirm('删除无法恢复, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.multipleSelection.forEach(obj => {
delData(obj.id).then(res => {
this.fetchData()
})
})
}).catch(() => {});
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss">
.filter-container {
padding-bottom: 10px;
.filter-item {
display: inline-block;
vertical-align: middle;
margin-bottom: 10px;
}
}
</style>

View File

@ -59,7 +59,7 @@
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="totalRow">
:total="totalRow" style="margin-top:20px;">
</el-pagination>

View File

@ -1,5 +1,30 @@
<template>
<div class="app-container">
<div class="filter-container">
<el-input @keyup.enter.native="handleFilter" style="width: 200px;" class="filter-item" :placeholder="$t('table.title')" v-model="listQuery.title">
</el-input>
<el-select clearable style="width: 90px" class="filter-item" v-model="listQuery.importance" :placeholder="$t('table.importance')">
<el-option v-for="item in importanceOptions" :key="item" :label="item" :value="item">
</el-option>
</el-select>
<el-select clearable class="filter-item" style="width: 130px" v-model="listQuery.type" :placeholder="$t('table.type')">
<el-option v-for="item in calendarTypeOptions" :key="item.key" :label="item.display_name+'('+item.key+')'" :value="item.key">
</el-option>
</el-select>
<el-select @change='handleFilter' style="width: 140px" class="filter-item" v-model="listQuery.sort">
<el-option v-for="item in sortOptions" :key="item.key" :label="item.label" :value="item.key">
</el-option>
</el-select>
<el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">{{$t('table.search')}}</el-button>
<el-button class="filter-item" style="margin-left: 10px;" @click="handleCreate" type="primary" icon="el-icon-edit">{{$t('table.add')}}</el-button>
<el-button class="filter-item" type="primary" :loading="downloadLoading" v-waves icon="el-icon-download" @click="handleDownload">{{$t('table.export')}}</el-button>
<el-checkbox class="filter-item" style='margin-left:15px;' @change='tableKey=tableKey+1' v-model="showReviewer">{{$t('table.reviewer')}}</el-checkbox>
</div>
<el-table :data="list" v-loading.body="listLoading" element-loading-text="Loading" border fit highlight-current-row>
<el-table-column align="center" label='ID' width="95">
<template slot-scope="scope">