Authored by xwx

Merge branch 'master' of http://113.200.75.45:82/monitor_v3/hg-monitor-web into master-v32-xwx

... ... @@ -56,3 +56,6 @@ custom-class="config-dialog"
.select-all .el-button{
height:42px;
}
.button-more{
position: absolute;right: 0;top: 33px;z-index: 1;background: #f5f7fa;width: 80px; padding: 10px;
}
\ No newline at end of file
... ...
... ... @@ -92,8 +92,43 @@
<!--列表-->
<div v-if="activeBtn == 'list'">
<cm-table-page :columns="columns" :dataList="dataList" @loaddata="getPage" :showIndex="true"
:showBorder="false" :showSelection="false"
:showPage="false" :height="height - 54"></cm-table-page>
:showBorder="false" :showSelection="false" :showTools="isEditName"
:showPage="false" :height="height - 54">
<template #default="{row,prop,column}">
<div class="fileName-div" style="display: flex; align-items: center;" v-if="isEditName && prop == 'fileName'" @click="getFile(row)">
<i :class="['iconfont', iconclass[row.type] == undefined ? 'icon-wenjian' : iconclass[row.type]]" style="font-size: 22px;margin-right: 10px;"></i>
<div>
<span @click.stop="editFileName(row,index)" v-if="isInput!=row.id">{{row.fileName}}</span>
</div>
<el-input @click.stop="" @blur="reNameFile(row,true)" v-if="isInput==row.id" type="text" v-model="row.fileName"></el-input>
</div>
</template>
<template #tools="{scope}" >
<div >
<el-button type="text" size="small" @click.prevent="getFile(scope.row)">
<i class="el-icon-view"/>查看 <i @mouseenter="moreShow=scope.row.id" :class="{'el-icon-arrow-down':moreShow!=scope.row.id,'el-icon-arrow-up':moreShow==scope.row.id}"></i>
</el-button>
<div class="button-more" v-if="moreShow==scope.row.id" @mouseleave="moreShow=''">
<ul>
<li>
<el-button type="text" size="small" @click.prevent="handleDownloadFile(scope.row,scope.$index)">
<i class="el-icon-download"/>下载
</el-button>
</li>
<li>
<el-button type="text" size="small" @click.prevent="handleDelete(scope.row,scope.$index)">
<i class="el-icon-delete"/>删除
</el-button>
</li>
</ul>
</div>
</div>
</template>
</cm-table-page>
</div>
<div v-if="activeBtn == 'view'" style="background-color: white" :style="{'height':(height -50) +'px','max-height':(height -50) + 'px','overflow':'auto'}">
<div style="text-align: left;margin: 6px;border-bottom: solid 1px #F2F6FC;padding-bottom: 5px;">
... ...
... ... @@ -46,6 +46,11 @@ export default {
isSelect:{
type:Boolean,
default:false
},
//是否编辑文件名称
isEditName:{
type:Boolean,
default:false
}
},
data() {
... ... @@ -67,6 +72,8 @@ export default {
},
setup(props, {attrs, slots, emit}) {
const {proxy} = Vue.getCurrentInstance();
//是否编辑文档名称
const isInput=Vue.ref();
let height = Vue.ref(window.innerHeight - 20);
let iconclass = {
'folder': 'icon-wenjianjia',
... ... @@ -173,7 +180,8 @@ export default {
// return `<i class="iconfont ${cls}" style="font-size: 22px;margin-right: 10px;"></i><input value="${inputFileName}"></input>`
return `<i class="iconfont ${cls}" style="font-size: 22px;margin-right: 10px;"></i><span>${row.fileName}</span>`
}
}, {
},
{
prop: 'createUser',
label: '提交人',
sortable: true,
... ... @@ -184,8 +192,8 @@ export default {
sortable: true,
width: '180px'
}
/* ,{
prop: '',
/*,{
prop: 'handle',
label: '操作',
sortable: false,
width: '180px',
... ... @@ -330,6 +338,31 @@ export default {
}
}
/*
* 单个删除文档
* lu
* */
let handleDelete =(row,index)=>{
dataList.value.filter((v)=>{
if(v.id==row.id){
v.checked = true
}
})
deleteDocument(row.id,row.type)
}
/*
* 下载单个文档
* lu
* */
let handleDownloadFile=(row,index)=>{
dataList.value.filter((v)=>{
if(v.id==row.id){
v.checked = true
}
})
downloadFile();
}
const moreShow=Vue.ref();//更多按钮是否显示
/**
* 将文档放入回收站
... ... @@ -702,17 +735,55 @@ export default {
proxy.$global.showMsg(msg, 'warning');
}
}
isInput.value='';
})
reNameFileFlg.value[item.id] = false;
}
}
/*表格列表添加文件大小列
*lu
* */
let addColumns=()=>{
let newColumns= {
prop: 'fileSize',
label:'文件大小',
width:'120px',
render:function (row){
let fileSizeB=0;
if(row.fileSize){
fileSizeB=row.fileSize;
}
let fileSize=filterType(fileSizeB)
return `<span>${fileSize}</span>`
}
}
if(props.isEditName){
columns.value.splice(1,0,newColumns)
}
}
/*文件大小单位转换
* lu
* */
let filterType=(val)=>{
if (val==0) return "0 B";
let k=1024;
let sizes=["B","KB","GB","TB","PB","EB","ZB","YB"];
let i=Math.floor(Math.log(val) / Math.log(k));
return (val/Math.pow(k,i)).toPrecision(3) + " "+sizes[i];
}
/**
* 挂载完
*/
Vue.onMounted(() => {
//表格列表添加文件大小列
addColumns();
getUserList();
// 预览模式 不展示左侧树
if (!props.isView) {
... ... @@ -782,8 +853,15 @@ export default {
},function (){},false)
}
//点击文件名称编辑
const editFileName=(item)=>{
isInput.value=item.id;
}
return {
/* viewEdit,*/
editFileName,
isInput,
iconclass,
layout,
height,
... ... @@ -832,7 +910,12 @@ export default {
editType,
selectAll,
isAllSelect,
selectText
selectText,
handleDelete,
handleDownloadFile,
moreShow,
addColumns,
filterType
}
}
... ...
<div class="container">
<cm-document :isSelect="true"></cm-document>
<cm-document :isSelect="true" :isEditName="true"></cm-document>
</div>
... ...