|
|
|
@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
|
|
|
|
|
<template> |
|
|
|
|
<div class="subfile_main"> |
|
|
|
|
<div class="subfile_main" v-loading="subloading"> |
|
|
|
|
<div class="block"> |
|
|
|
|
<el-date-picker |
|
|
|
|
v-model="value2" |
|
|
|
@ -11,45 +11,104 @@
@@ -11,45 +11,104 @@
|
|
|
|
|
end-placeholder="结束日期" |
|
|
|
|
:picker-options="pickerOptions"> |
|
|
|
|
</el-date-picker> |
|
|
|
|
<el-button type="primary" icon="el-icon-search">搜索</el-button> |
|
|
|
|
<el-button class="sou_bottom" type="primary" icon="el-icon-search">搜索</el-button> |
|
|
|
|
</div> |
|
|
|
|
<div> |
|
|
|
|
<!-- 目录数据列表 --> |
|
|
|
|
<div class="folder_bottom"> |
|
|
|
|
<!-- <span>目录:</span> --> |
|
|
|
|
<a v-for="data in dirdata" :key="data.id" :href="'#/filemange/subfile?id='+data.id"><el-button type="warning" icon="el-icon-notebook-1">{{data.directory}}</el-button></a> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<div class="use_button textright"> |
|
|
|
|
<el-button type="primary" icon="el-icon-edit" @click="dirbox = true">创建目录</el-button> |
|
|
|
|
<el-button type="primary" icon="el-icon-edit" @click="rmdirm">删除目录</el-button> |
|
|
|
|
<el-button type="primary" icon="el-icon-edit">重命名</el-button> |
|
|
|
|
<el-button type="primary">上传<i class="el-icon-upload el-icon--right"></i></el-button> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<!-- 文件数据列表 --> |
|
|
|
|
<el-table |
|
|
|
|
:data="tableData" |
|
|
|
|
border |
|
|
|
|
style="width: 100%"> |
|
|
|
|
<el-table-column |
|
|
|
|
prop="date" |
|
|
|
|
label="时间" |
|
|
|
|
width="auto"> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column |
|
|
|
|
label="图片" |
|
|
|
|
width="auto"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<img :src="'http://192.168.0.100/'+scope.row.image" alt="图片"/> |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column |
|
|
|
|
prop="name" |
|
|
|
|
label="名称"> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column |
|
|
|
|
label="操作"> |
|
|
|
|
<div class="file_caozuo vercenter"> |
|
|
|
|
<el-button size="mini">重命名</el-button> |
|
|
|
|
<el-button size="mini">下载</el-button> |
|
|
|
|
</div> |
|
|
|
|
<div class="file_caozuo2 vercenter"> |
|
|
|
|
<el-button size="mini">移动</el-button> |
|
|
|
|
<el-button size="mini" type="danger">删除</el-button> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
</el-table-column> |
|
|
|
|
</el-table> |
|
|
|
|
|
|
|
|
|
<!-- 创建目录弹框 --> |
|
|
|
|
<el-dialog title="创建目录" :visible.sync="dirbox"> |
|
|
|
|
<el-form :model="dirform"> |
|
|
|
|
<el-form-item label="目录名称" :label-width="formLabelWidth"> |
|
|
|
|
<el-input v-model="dirform.dir" autocomplete="off"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<!-- <el-form-item label="父级目录" :label-width="formLabelWidth"> |
|
|
|
|
<el-select v-model="form.region" placeholder="请选择父级目录"> |
|
|
|
|
<el-option label="区域一" value="shanghai"></el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</el-form-item> --> |
|
|
|
|
</el-form> |
|
|
|
|
<div slot="footer" class="dialog-footer"> |
|
|
|
|
<el-button @click="dirbox = false">取 消</el-button> |
|
|
|
|
<el-button type="primary" @click="mkdirs" :loading="mkdirloadings">确 定</el-button> |
|
|
|
|
</div> |
|
|
|
|
</el-dialog> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
|
|
|
|
|
import { mirlist } from '@/api/user' |
|
|
|
|
import EventBus from '@/utils/EventBus.js' |
|
|
|
|
import { mirlist, mkdir } from '@/api/user' |
|
|
|
|
import defaultSettings from '@/settings.js' |
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
|
|
|
|
|
|
watch: { |
|
|
|
|
// 点击不同目录请求不同接口 |
|
|
|
|
$route(to, from) { |
|
|
|
|
|
|
|
|
|
let can = {}; |
|
|
|
|
const menusindex = window.location.href |
|
|
|
|
if (menusindex.indexOf('?id') != -1) { |
|
|
|
|
//console.log(menusindex.split('?id=')[1]); |
|
|
|
|
can.id = menusindex.split('?id=')[1] |
|
|
|
|
this.getFileData(); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// beforeRouteUpdate(to, from, next) { |
|
|
|
|
// alert(0); |
|
|
|
|
// next(); |
|
|
|
|
// }, |
|
|
|
|
|
|
|
|
|
created() { |
|
|
|
|
this.getFileData(); |
|
|
|
|
|
|
|
|
|
mirlist(can).then(response => { |
|
|
|
|
let datamain = response.data; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}).catch(function (error) { |
|
|
|
|
thiss.$message({ |
|
|
|
|
showClose: true, |
|
|
|
|
message: error, |
|
|
|
|
type: 'error' |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
filters: { |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
@ -82,14 +141,142 @@ export default {
@@ -82,14 +141,142 @@ export default {
|
|
|
|
|
} |
|
|
|
|
}] |
|
|
|
|
}, |
|
|
|
|
value2: '' |
|
|
|
|
}; |
|
|
|
|
value2: '', |
|
|
|
|
|
|
|
|
|
tableData: [], |
|
|
|
|
|
|
|
|
|
// 创建目录弹出框数据 |
|
|
|
|
dirbox: false, |
|
|
|
|
dirform: { |
|
|
|
|
dir: '', |
|
|
|
|
parent: '' |
|
|
|
|
}, |
|
|
|
|
created() { |
|
|
|
|
formLabelWidth: '', |
|
|
|
|
|
|
|
|
|
// 更新当前目录的子目录 |
|
|
|
|
dirdata: [], |
|
|
|
|
|
|
|
|
|
subloading: false, //切换目录loading |
|
|
|
|
mkdirloadings: false |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
getFileData() { |
|
|
|
|
let can = {}; |
|
|
|
|
const menusindex = window.location.href |
|
|
|
|
if (menusindex.indexOf('?id') != -1) { |
|
|
|
|
//console.log(menusindex.split('?id=')[1]); |
|
|
|
|
can.id = menusindex.split('?id=')[1] |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
let thiss = this; |
|
|
|
|
this.subloading = true; |
|
|
|
|
mirlist(can).then(response => { |
|
|
|
|
let datamain = response.data; |
|
|
|
|
let maindata = datamain.data.dirTree; |
|
|
|
|
if (datamain.code == 1) { |
|
|
|
|
//console.log(maindata.directories.length); |
|
|
|
|
this.dirdata = [] |
|
|
|
|
this.tableData = [] |
|
|
|
|
if (maindata.directories) { |
|
|
|
|
this.dirdata = maindata.directories; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (maindata.files) { |
|
|
|
|
this.tableData = this.forObjectData(maindata.files); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.dirform.parent = maindata.realpath; |
|
|
|
|
this.subloading = false; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}).catch(function (error) { |
|
|
|
|
thiss.$message({ |
|
|
|
|
showClose: true, |
|
|
|
|
message: error, |
|
|
|
|
type: 'error' |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
forObjectData(objectd) { |
|
|
|
|
let newObject = null, arrObjs = []; |
|
|
|
|
|
|
|
|
|
Object.keys(objectd).forEach(item => { |
|
|
|
|
|
|
|
|
|
newObject = { |
|
|
|
|
date: '2016-05-03', |
|
|
|
|
image: objectd[item].path, |
|
|
|
|
name: objectd[item].filename |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
arrObjs.push(newObject); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
return arrObjs; |
|
|
|
|
//console.log(arrObjs); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 创建目录 |
|
|
|
|
mkdirs() { |
|
|
|
|
this.mkdirloadings = true; |
|
|
|
|
EventBus.$emit('mkdirSuccess'); |
|
|
|
|
mkdir(this.dirform).then(response => { |
|
|
|
|
let datamain = response.data; |
|
|
|
|
let maindata = datamain.data.dirTree; |
|
|
|
|
if (datamain.code == 1) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//this.subloading = false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.mkdirloadings = false; |
|
|
|
|
this.dirbox = false; |
|
|
|
|
}).catch(function (error) { |
|
|
|
|
thiss.$message({ |
|
|
|
|
showClose: true, |
|
|
|
|
message: error, |
|
|
|
|
type: 'error' |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 删除目录 |
|
|
|
|
rmdirm() { |
|
|
|
|
this.rmdirloadings = true; |
|
|
|
|
mkdir(this.dirform).then(response => { |
|
|
|
|
let datamain = response.data; |
|
|
|
|
let maindata = datamain.data.dirTree; |
|
|
|
|
if (datamain.code == 1) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//this.subloading = false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.dirbox = false; |
|
|
|
|
}).catch(function (error) { |
|
|
|
|
thiss.$message({ |
|
|
|
|
showClose: true, |
|
|
|
|
message: error, |
|
|
|
|
type: 'error' |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
<style lang="scss"> |
|
|
|
|
.subfile_main{ |
|
|
|
|
padding:26px 5% 12px 5%; |
|
|
|
|
.block{margin:0 0 28px 0;} |
|
|
|
|
.sou_bottom{margin-left:10px;} |
|
|
|
|
.use_button{margin:15px 0 16px 0;} |
|
|
|
|
.file_caozuo2{margin:6px 0 0 0;} |
|
|
|
|
.el-table td{padding:9px 0} |
|
|
|
|
.folder_bottom a{margin:0 6px;} |
|
|
|
|
.el-table__body-wrapper img{width:100px;} |
|
|
|
|
} |
|
|
|
|
</style> |
|
|
|
|