|
@@ -1,51 +1,55 @@
|
|
|
<template>
|
|
|
- <div>
|
|
|
- <div class="flex-align-center flex-between border-bottom container normal-panel">
|
|
|
+ <div>
|
|
|
+ <div class="flex-align-center flex-between border-bottom container normal-panel">
|
|
|
<div class="flex-align-center">
|
|
|
<slot name="upload"></slot>
|
|
|
<slot name="add"></slot>
|
|
|
<slot name="btngroup"></slot>
|
|
|
</div>
|
|
|
<div class="flex-align-center">
|
|
|
- <el-input size="small" style="width:160px;margin-right:16px" prefix-icon="el-icon-search" v-model="params.content.where.condition" @keyup.enter.native="queryAttachment(params.content.pageNumber = 1)" @clear="queryAttachment(params.content.pageNumber = 1)" placeholder="搜索全部" clearable></el-input>
|
|
|
+ <el-input size="small" style="width:160px;margin-right:16px" prefix-icon="el-icon-search"
|
|
|
+ v-model="params.content.where.condition" @keyup.enter.native="queryAttachment(params.content.pageNumber = 1)"
|
|
|
+ @clear="queryAttachment(params.content.pageNumber = 1)" placeholder="搜索全部" clearable></el-input>
|
|
|
<sort :sort="sort" @onSort="onSort"></sort>
|
|
|
- <i class="el-icon-refresh" style="margin-left:16px" @click="queryAttachment(params.content.where.condition = '')"></i>
|
|
|
+ <i class="el-icon-refresh" style="margin-left:16px"
|
|
|
+ @click="queryAttachment(params.content.where.condition = '')"></i>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div ref="ele" id="scroll" style="height:calc(100vh - 255px);overflow-y:scroll" class="container normal-panel">
|
|
|
<el-row :gutter="10" class="folder-list">
|
|
|
<el-col :span="2" v-for="folder in list" :key="folder.id">
|
|
|
- <div class="folder-item" :class="folder.ischeck?'checked':''">
|
|
|
+ <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="">
|
|
|
+ <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>
|
|
|
- <input v-if="folder.newfolder" type="text" v-model="folder.document" autofocus size="mini" @blur="changeFolderName(folder)">
|
|
|
+ <input v-if="folder.newfolder" type="text" v-model="folder.document" autofocus size="mini"
|
|
|
+ @blur="changeFolderName(folder)">
|
|
|
<!-- <p v-else>{{folder.document}}</p> -->
|
|
|
- <p v-else>{{folder.document}}</p>
|
|
|
+ <p v-else>{{ folder.document }}</p>
|
|
|
</div>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
- <div v-if="list.length === 0" class="flex-align-center" style="height:calc(100vh - 200px);justify-content:space-around">
|
|
|
+ <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>
|
|
|
</div>
|
|
|
<div style="margin:16px 0;text-align:right">
|
|
|
- <el-pagination
|
|
|
- background
|
|
|
- small
|
|
|
- @size-change="handleSizeChange"
|
|
|
- @current-change="handleCurrentChange"
|
|
|
- :current-page="currentPage"
|
|
|
- :page-size="params.content.pageSize"
|
|
|
- layout="total, prev, pager, next, jumper"
|
|
|
+ <el-pagination background small @size-change="handleSizeChange" @current-change="handleCurrentChange"
|
|
|
+ :current-page="currentPage" :page-size="params.content.pageSize" layout="total, prev, pager, next, jumper"
|
|
|
:total="total">
|
|
|
</el-pagination>
|
|
|
</div>
|
|
@@ -54,39 +58,39 @@
|
|
|
|
|
|
<script>
|
|
|
export default {
|
|
|
- data () {
|
|
|
+ data() {
|
|
|
return {
|
|
|
- params:{
|
|
|
+ params: {
|
|
|
"classname": "webmanage.saletool.salematerial.salematerial",
|
|
|
"method": "selectList",
|
|
|
"content": {
|
|
|
- "parentid":0,
|
|
|
- "pageNumber":1,
|
|
|
- "pageSize":20,
|
|
|
- "where":{
|
|
|
- "condition":""
|
|
|
- }
|
|
|
+ "parentid": 0,
|
|
|
+ "pageNumber": 1,
|
|
|
+ "pageSize": 20,
|
|
|
+ "where": {
|
|
|
+ "condition": ""
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
- list:[],
|
|
|
- sort:[],
|
|
|
- total:0,
|
|
|
- currentPage:0,
|
|
|
- isLoad:true,
|
|
|
- msg:"正在加载"
|
|
|
+ list: [],
|
|
|
+ sort: [],
|
|
|
+ total: 0,
|
|
|
+ currentPage: 0,
|
|
|
+ isLoad: true,
|
|
|
+ msg: "正在加载"
|
|
|
}
|
|
|
},
|
|
|
- methods:{
|
|
|
+ methods: {
|
|
|
// 排序
|
|
|
- onSort (sort) {
|
|
|
+ onSort(sort) {
|
|
|
this.params.content.sort = [sort]
|
|
|
this.queryAttachment(this.params.content.parentid)
|
|
|
},
|
|
|
- async queryAttachment () {
|
|
|
- this.params.content.parentid = this.$route.query.id?this.$route.query.id:JSON.parse(sessionStorage.getItem('folderid')).appfolderid
|
|
|
+ async queryAttachment() {
|
|
|
+ this.params.content.parentid = this.$route.query.id ? this.$route.query.id : JSON.parse(sessionStorage.getItem("folderid")).salematerialfolderid
|
|
|
const res = await this.$api.requested(this.params)
|
|
|
- res.data.map(e=>{
|
|
|
- e.postfix = e.postfix.toUpperCase()
|
|
|
+ res.data.map(e => {
|
|
|
+ e.postfix = e.postfix.toUpperCase()
|
|
|
e.ischeck = false
|
|
|
})
|
|
|
this.list = res.data
|
|
@@ -104,46 +108,46 @@ export default {
|
|
|
this.params.content.pageNumber = val
|
|
|
this.queryAttachment(this.params.content.parentid)
|
|
|
},
|
|
|
- changeFolderName (folder) {
|
|
|
- this.$emit('onNameChange',folder)
|
|
|
+ changeFolderName(folder) {
|
|
|
+ this.$emit('onNameChange', folder)
|
|
|
},
|
|
|
- onChange (folder) {
|
|
|
+ onChange(folder) {
|
|
|
let checkArray = []
|
|
|
- this.list.forEach((e,index)=>{
|
|
|
+ this.list.forEach((e, index) => {
|
|
|
if (e.ischeck === true) {
|
|
|
checkArray.push(e)
|
|
|
}
|
|
|
})
|
|
|
- this.$emit('folderChecked',checkArray)
|
|
|
+ this.$emit('folderChecked', checkArray)
|
|
|
},
|
|
|
- folderDetails (folder) {
|
|
|
+ folderDetails(folder) {
|
|
|
if (folder.postfix === 'FOLDER') {
|
|
|
- this.$router.push({path:'/archvies_mag',query:{id:folder.attachmentid}})
|
|
|
- this.$emit('toFolderDetail',folder.attachmentid)
|
|
|
+ this.$router.push({ path: '/archvies_mag', query: { id: folder.attachmentid } })
|
|
|
+ this.$emit('toFolderDetail', folder.attachmentid)
|
|
|
this.queryAttachment(folder.attachmentid)
|
|
|
}
|
|
|
},
|
|
|
- restChecked () {
|
|
|
- this.list.forEach((e,index)=>{
|
|
|
+ restChecked() {
|
|
|
+ this.list.forEach((e, index) => {
|
|
|
e.ischeck = false
|
|
|
})
|
|
|
},
|
|
|
},
|
|
|
|
|
|
- mounted () {
|
|
|
+ mounted() {
|
|
|
// 根据容器高度计算需要的数据条数
|
|
|
var heightCss = window.getComputedStyle(this.$refs.ele).height
|
|
|
- this.params.content.pageSize = Math.ceil((heightCss.match(/\d+/g) / 114)) *12
|
|
|
+ this.params.content.pageSize = Math.ceil((heightCss.match(/\d+/g) / 114)) * 12
|
|
|
this.queryAttachment()
|
|
|
},
|
|
|
// 离开这个页面销毁滚动条事件,不然会给每一个页面都触发
|
|
|
beforeDestroy() {
|
|
|
},
|
|
|
- watch:{
|
|
|
- $route () {
|
|
|
+ watch: {
|
|
|
+ $route() {
|
|
|
this.queryAttachment()
|
|
|
// 路由发生变化的时候初始化选择数组
|
|
|
- this.$emit('folderChecked',[])
|
|
|
+ this.$emit('folderChecked', [])
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -152,16 +156,16 @@ export default {
|
|
|
<style>
|
|
|
.folder-item {
|
|
|
position: relative;
|
|
|
- padding:10px 5px;
|
|
|
+ padding: 10px 5px;
|
|
|
text-align: center;
|
|
|
- color:#333;
|
|
|
+ color: #333;
|
|
|
margin-bottom: 15px;
|
|
|
cursor: pointer;
|
|
|
font-size: 14px;
|
|
|
/* min-height: 110px; */
|
|
|
}
|
|
|
|
|
|
-.folder-item p{
|
|
|
+.folder-item p {
|
|
|
line-height: 25px;
|
|
|
width: calc(100% - 20px);
|
|
|
padding: 0 10px;
|
|
@@ -174,47 +178,56 @@ export default {
|
|
|
|
|
|
-webkit-box-orient: vertical;
|
|
|
|
|
|
- -webkit-line-clamp: 1; /* 这里是超出几行省略 */
|
|
|
+ -webkit-line-clamp: 1;
|
|
|
+ /* 这里是超出几行省略 */
|
|
|
|
|
|
overflow: hidden;
|
|
|
}
|
|
|
-.folder-item input{
|
|
|
+
|
|
|
+.folder-item input {
|
|
|
width: calc(100% - 8px);
|
|
|
padding: 2px;
|
|
|
- margin-top:10px;
|
|
|
+ margin-top: 10px;
|
|
|
}
|
|
|
+
|
|
|
.img-panel {
|
|
|
width: 64px;
|
|
|
/* height: 64px; */
|
|
|
- margin:0 auto;
|
|
|
+ margin: 0 auto;
|
|
|
text-align: center;
|
|
|
}
|
|
|
-.img-panel > img{
|
|
|
+
|
|
|
+.img-panel>img {
|
|
|
width: 80%;
|
|
|
}
|
|
|
-.folder-checkbox{
|
|
|
+
|
|
|
+.folder-checkbox {
|
|
|
display: none;
|
|
|
position: absolute;
|
|
|
- top:5px;
|
|
|
+ top: 5px;
|
|
|
left: 5px;
|
|
|
}
|
|
|
-.checked{
|
|
|
+
|
|
|
+.checked {
|
|
|
background: #f1f2f3;
|
|
|
border-radius: 3px;
|
|
|
}
|
|
|
+
|
|
|
.checked .folder-checkbox {
|
|
|
display: block;
|
|
|
}
|
|
|
+
|
|
|
.folder-item:hover .folder-checkbox {
|
|
|
display: block;
|
|
|
}
|
|
|
+
|
|
|
.folder-item:hover {
|
|
|
background: #f1f2f3;
|
|
|
border-radius: 3px;
|
|
|
}
|
|
|
</style>
|
|
|
<style scoped>
|
|
|
-.border-bottom{
|
|
|
+.border-bottom {
|
|
|
border-bottom: 1px solid #f1f2f3;
|
|
|
}
|
|
|
</style>
|