|
@@ -13,25 +13,50 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div ref="ele" style="height:calc(100vh - 255px);overflow-y:scroll" class="container normal-panel">
|
|
|
- <el-row :gutter="10" class="folder-list">
|
|
|
- <el-col :span="3" v-for="folder in list" :key="folder.id">
|
|
|
- <div class="folder-item" :class="folder.ischeck?'checked':''">
|
|
|
- <el-checkbox class="folder-checkbox" v-model="folder.ischeck" @change="onChange(folder)"></el-checkbox>
|
|
|
- <div @click.stop="folderDetails(folder)" class="img-panel">
|
|
|
- <img v-if="folder.postfix === 'DOC' || folder.postfix === 'DOCX'" src="../../../assets/file_icons/word.png" alt="">
|
|
|
- <img v-else-if="folder.postfix === 'PDF'" src="../../../assets/file_icons/PDF.png" alt="">
|
|
|
- <img v-else-if="folder.postfix === 'MP4' || folder.postfix === 'AVI'" src="../../../assets/file_icons/video.png" alt="">
|
|
|
- <img v-else-if="folder.postfix === 'XLS' || folder.postfix === 'XLSX'" src="../../../assets/file_icons/excel.png" alt="">
|
|
|
- <img v-else-if="folder.postfix === 'PNG' || folder.postfix === 'JPG'|| folder.postfix === 'JPEG'" src="../../../assets/file_icons/image.png" alt="">
|
|
|
- <img v-else-if="folder.postfix === 'PPT' || folder.postfix === 'PPTX'" src="../../../assets/file_icons/PPT.png" alt="">
|
|
|
- <img v-else-if="folder.postfix === 'FOLDER'" src="../../../assets/file_icons/folder.png" alt="">
|
|
|
- <img v-else src="../../../assets/file_icons/unknow.png" alt="">
|
|
|
+ <div class="flex-align-center normal-margin">
|
|
|
+ <el-button v-if="fileRouter.length > 1" type="text" size="mini" class="inline-16" @click="toPreFile">返回上一级</el-button>
|
|
|
+ <div class="fileRouter__history" v-for="(route,index) in fileRouter" :key="route.index" @click="folderDetails(route,index)">{{route.document}} <span v-show="fileRouter.length - 1 !== index"> > </span> </div>
|
|
|
+ </div>
|
|
|
+ <div class="flex-align-stretch flex-warp">
|
|
|
+ <div v-for="(folder,index) in list" :key="folder.id" class="folder-item" :class="folder.ischeck?'checked':''">
|
|
|
+ <el-checkbox class="folder-checkbox" v-model="folder.ischeck" @change="onChange(folder)"></el-checkbox>
|
|
|
+ <div class="op__panel">
|
|
|
+ <delete-temp :self="true" :checklist="[folder]" style="margin-right:5px" @onSuccess="queryAttachment"></delete-temp>
|
|
|
+ <operation-temp :ref="'edit' + index" :self="true" :checklist="[folder]" @restName="restName" @onSuccess="queryAttachment"></operation-temp>
|
|
|
+ </div>
|
|
|
+ <div @click.stop="folderDetails(folder)" class="img-panel">
|
|
|
+ <div class="image__item__panel" v-if="folder.postfix === 'DOC' || folder.postfix === 'DOCX'">
|
|
|
+ <img src="@/assets/file_icons/word.png" alt="">
|
|
|
+ </div>
|
|
|
+ <div class="image__item__panel" v-else-if="folder.postfix === 'PDF'">
|
|
|
+ <img src="@/assets/file_icons/PDF.png" alt="">
|
|
|
+ </div>
|
|
|
+ <div class="image__item__panel" v-else-if="folder.postfix === 'MP4' || folder.postfix === 'AVI'" >
|
|
|
+ <img src="@/assets/file_icons/video.png" alt="">
|
|
|
+ </div>
|
|
|
+ <div class="image__item__panel" v-else-if="folder.postfix === 'XLS' || folder.postfix === 'XLSX'">
|
|
|
+ <img src="@/assets/file_icons/excel.png" alt="">
|
|
|
+ </div>
|
|
|
+ <div class="image__item__panel" v-else-if="folder.postfix === 'PNG' || folder.postfix === 'JPG'|| folder.postfix === 'JPEG'" >
|
|
|
+ <img :src="folder.url" alt="">
|
|
|
+ </div>
|
|
|
+ <div class="image__item__panel" v-else-if="folder.postfix === 'SVG'" >
|
|
|
+ <img src="@/assets/file_icons/image.png" alt="">
|
|
|
+ </div>
|
|
|
+ <div class="image__item__panel" v-else-if="folder.postfix === 'PPT' || folder.postfix === 'PPTX'">
|
|
|
+ <img src="@/assets/file_icons/PPT.png" alt="">
|
|
|
+ </div>
|
|
|
+ <div class="image__item__panel" v-else-if="folder.postfix === 'FOLDER'">
|
|
|
+ <img src="@/assets/file_icons/folder.png" alt="">
|
|
|
+ </div>
|
|
|
+ <div class="image__item__panel" v-else >
|
|
|
+ <img src="@/assets/file_icons/unknow.png" alt="">
|
|
|
</div>
|
|
|
- <input v-if="folder.newfolder" type="text" v-model="folder.document" autofocus size="mini" @blur="changeFolderName(folder)">
|
|
|
- <p v-else>{{folder.document}}</p>
|
|
|
</div>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
+ <input v-if="folder.newfolder" type="text" v-model="folder.document" autofocus size="mini" @keyup.enter="changeFolderName(folder,index)" @blur="changeFolderName(folder,index)">
|
|
|
+ <p v-else>{{folder.document}}</p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
<div v-if="list.length === 0" class="flex-align-center" style="height:calc(100vh - 200px);justify-content:space-around">
|
|
|
<el-empty description="暂无文件,请点击左上角的“上传”按钮添加"></el-empty>
|
|
|
</div>
|
|
@@ -52,6 +77,9 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import operationTemp from './moreOperation.vue'
|
|
|
+import deleteTemp from './delete.vue'
|
|
|
+
|
|
|
export default {
|
|
|
data () {
|
|
|
return {
|
|
@@ -71,8 +99,17 @@ export default {
|
|
|
sort:[],
|
|
|
total:0,
|
|
|
currentPage:0,
|
|
|
+ clickArea:'',
|
|
|
+ fileRouter:[{
|
|
|
+ postfix:'FOLDER',
|
|
|
+ document:'全部文件'
|
|
|
+ }]
|
|
|
}
|
|
|
},
|
|
|
+ components:{
|
|
|
+ operationTemp,
|
|
|
+ deleteTemp
|
|
|
+ },
|
|
|
methods:{
|
|
|
// 排序
|
|
|
onSort (sort) {
|
|
@@ -101,8 +138,31 @@ export default {
|
|
|
this.params.content.pageNumber = val
|
|
|
this.queryAttachment(this.params.content.where.parentid)
|
|
|
},
|
|
|
- changeFolderName (folder) {
|
|
|
- this.$emit('onNameChange',folder)
|
|
|
+ async changeFolderName (folder,index) {
|
|
|
+ if (this.clickArea === 'self') {
|
|
|
+ let param = {
|
|
|
+ "classname": "system.attachment.MediaCenter",
|
|
|
+ "method": "changeAttachment",
|
|
|
+ "content": {
|
|
|
+ "files": [
|
|
|
+ {
|
|
|
+ "attachmentid": folder.attachmentid,
|
|
|
+ "document": folder.document,
|
|
|
+ "parentid":folder.parentid//文件夹iD
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const res = await this.$api.requested(param)
|
|
|
+ folder.newfolder = false
|
|
|
+ this.list.forEach((e,index) => {
|
|
|
+ if (e.attachmentid === folder.attachmentid) {
|
|
|
+ this.$set(this.list, index, folder);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$emit('onNameChange',folder)
|
|
|
+ }
|
|
|
},
|
|
|
onChange (folder) {
|
|
|
let checkArray = []
|
|
@@ -113,11 +173,19 @@ export default {
|
|
|
})
|
|
|
this.$emit('folderChecked',checkArray)
|
|
|
},
|
|
|
- folderDetails (folder) {
|
|
|
- event.stopPropagation();
|
|
|
+ folderDetails (folder,index) {
|
|
|
+ console.log(folder,index)
|
|
|
if (folder.postfix === 'FOLDER') {
|
|
|
- this.$router.push({path:'/mediaStock',query:{id:folder.attachmentid}})
|
|
|
- this.$emit('toFolderDetail',folder.attachmentid)
|
|
|
+ if (index >= 0) {
|
|
|
+ this.fileRouter = this.fileRouter.slice(0,index + 1)
|
|
|
+ console.log(this.fileRouter)
|
|
|
+ } else {
|
|
|
+ let _isSame = this.fileRouter.some(m=>folder.attachmentid === m.attachmentid)
|
|
|
+
|
|
|
+ _isSame?'':this.fileRouter.push(folder)
|
|
|
+ }
|
|
|
+ this.$router.replace({path:'/mediaStock',query:{id:folder.attachmentid}})
|
|
|
+
|
|
|
this.queryAttachment(folder.attachmentid)
|
|
|
}
|
|
|
},
|
|
@@ -125,7 +193,21 @@ export default {
|
|
|
this.list.forEach((e,index)=>{
|
|
|
e.ischeck = false
|
|
|
})
|
|
|
+ },
|
|
|
+ restName (item) {
|
|
|
+ this.clickArea = 'self'
|
|
|
+ item.newfolder = true
|
|
|
+ this.list.forEach((e,index) => {
|
|
|
+ if (e.attachmentid === item.attachmentid) {
|
|
|
+ this.$set(this.list, index, item);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ toPreFile () {
|
|
|
+ console.log(this.fileRouter.pop())
|
|
|
+ this.$router.replace({path:'/mediaStock',query:{id:this.fileRouter.pop().attachmentid}})
|
|
|
}
|
|
|
+
|
|
|
},
|
|
|
mounted () {
|
|
|
// 根据容器高度计算需要的数据条数
|
|
@@ -146,19 +228,25 @@ export default {
|
|
|
<style>
|
|
|
.folder-item {
|
|
|
position: relative;
|
|
|
+ width: 120px;
|
|
|
padding:10px 5px;
|
|
|
text-align: center;
|
|
|
color:#333;
|
|
|
margin-bottom: 15px;
|
|
|
+ margin-left:30px;
|
|
|
cursor: pointer;
|
|
|
font-size: 14px;
|
|
|
- /* min-height: 110px; */
|
|
|
}
|
|
|
-
|
|
|
+.flex-warp {
|
|
|
+ flex-wrap: wrap;
|
|
|
+}
|
|
|
.folder-item p{
|
|
|
- line-height: 25px;
|
|
|
- width: calc(100% - 20px);
|
|
|
+ width: 100px;
|
|
|
+ margin:0 auto;
|
|
|
padding: 0 10px;
|
|
|
+ line-height: 25px;
|
|
|
+ text-align: center;
|
|
|
+ font-size: 12px;
|
|
|
/* margin-top:10px; */
|
|
|
word-break: break-all;
|
|
|
|
|
@@ -168,7 +256,7 @@ export default {
|
|
|
|
|
|
-webkit-box-orient: vertical;
|
|
|
|
|
|
- -webkit-line-clamp: 1; /* 这里是超出几行省略 */
|
|
|
+ -webkit-line-clamp: 2; /* 这里是超出几行省略 */
|
|
|
|
|
|
overflow: hidden;
|
|
|
}
|
|
@@ -179,7 +267,7 @@ export default {
|
|
|
}
|
|
|
.img-panel {
|
|
|
width: 64px;
|
|
|
- /* height: 64px; */
|
|
|
+ height: 64px;
|
|
|
margin:0 auto;
|
|
|
text-align: center;
|
|
|
}
|
|
@@ -211,4 +299,33 @@ export default {
|
|
|
.border-bottom{
|
|
|
border-bottom: 1px solid #f1f2f3;
|
|
|
}
|
|
|
+.image__item__panel{
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-around;
|
|
|
+ height: 64px;
|
|
|
+ width: 64px;
|
|
|
+ margin: 0 auto;
|
|
|
+ overflow: hidden;
|
|
|
+}
|
|
|
+.image__item__panel img{
|
|
|
+ height: 70%;
|
|
|
+ max-width: 64px;
|
|
|
+}
|
|
|
+.op__panel{
|
|
|
+ display: none;
|
|
|
+ position: absolute;
|
|
|
+ right:0px;
|
|
|
+ top:0px;
|
|
|
+ padding: 0px 5px;
|
|
|
+ background: #fff;
|
|
|
+}
|
|
|
+.folder-item:hover .op__panel{
|
|
|
+ display: block;
|
|
|
+}
|
|
|
+.fileRouter__history {
|
|
|
+ font-size: 12px;
|
|
|
+ line-height: 30px;
|
|
|
+ cursor: pointer;
|
|
|
+}
|
|
|
</style>
|