| | |
| | | <template> |
| | | <div class="zs-main"> |
| | | <div class="zs-main" style="background-color: #fff"> |
| | | <el-row class="search-title"> |
| | | <el-col :span="18" class="title"> |
| | | <div class="zs-title">云盘智搜</div> |
| | |
| | | <el-aside width="210px" style="background-color: #fff;text-align: center;"> |
| | | <el-button class="add-folder-but" @click="dialogFormVisible = true">新增</el-button> |
| | | <el-popconfirm title="是否删除目录?" @onConfirm="delFolder()"> |
| | | <el-button slot="reference" class="hr-but-all" type="danger">删除</el-button> |
| | | <el-button slot="reference" class="pri-del-btn" type="primary">删除</el-button> |
| | | </el-popconfirm> |
| | | <el-dialog |
| | | title="新增文件夹" |
| | |
| | | prop="foldername" |
| | | > |
| | | <el-input v-model="folderform.foldername" autocomplete="off" /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="上级文件夹:" :label-width="formLabelWidth" prop="parentId"> |
| | | <treeselect |
| | | v-model="folderform.parentId" |
| | | :multiple="false" |
| | | :options="activitiesTree" |
| | | :clear-value-text="$t('common.clear')" |
| | | placeholder=" " |
| | | style="width:100%" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="文件夹排序:" :label-width="formLabelWidth" prop="sort"> |
| | | <el-input-number |
| | |
| | | >确 定</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | <el-timeline> |
| | | <el-tree |
| | | ref="deptTree" |
| | | :data="activitiesTree" |
| | | :check-strictly="false" |
| | | accordion |
| | | node-key="id" |
| | | default-expand-all |
| | | :expand-on-click-node="false" |
| | | highlight-current |
| | | :filter-node-method="filterNode" |
| | | @node-click="nodeClick" |
| | | /> |
| | | <!-- <el-timeline> |
| | | <el-timeline-item |
| | | v-for="(activity, index) in activities" |
| | | :key="index" |
| | |
| | | > |
| | | {{ activity.timestamp }}</span> |
| | | </el-timeline-item> |
| | | </el-timeline> |
| | | </el-timeline>--> |
| | | </el-aside> |
| | | <el-container> |
| | | <el-header class="text-header"> |
| | |
| | | />提示:文件不要超过10个,单个文件大小不超过200M,单击或者拖动文件到下面区域,支持单个或批量文件的上传。</el-col> |
| | | </el-row> |
| | | <el-row style="background-color: rgba(0,0,0,0.2);"> |
| | | <el-col :span="17"> |
| | | <el-col :span="16"> |
| | | <el-checkbox |
| | | v-model="checkAll" |
| | | class="myRedCheckBox" |
| | | style="color: #000; margin-left: 20px;" |
| | | @change="checkAllMethods()" |
| | | >全选</el-checkbox></el-col> |
| | | <el-col :span="7"> |
| | | <el-col :span="8"> |
| | | <el-button |
| | | type="primary" |
| | | icon="el-icon-download" |
| | |
| | | >下载</el-button> |
| | | <el-button |
| | | type="primary" |
| | | class="pri-del-btn" |
| | | icon="el-icon-search" |
| | | size="mini" |
| | | @click="delFile()" |
| | | >删除</el-button> |
| | | <el-popconfirm title="是否移动文件?" @onConfirm="mvdialogFormVisible = true"> |
| | | <el-button slot="reference" class="hr-but" type="danger">移动</el-button> |
| | | <el-button slot="reference" type="danger">转存</el-button> |
| | | </el-popconfirm> |
| | | <el-button type="warning" @click="openUpdateFileName()">重命名</el-button> |
| | | </el-col> |
| | | </el-row> |
| | | </el-header> |
| | | |
| | | <el-dialog title="修改文件名" :visible.sync="updateFileNameFormVisible" width="20%"> |
| | | <el-form ref="updateFileName" :model="file" :rules="rules"> |
| | | <el-form-item label="文件名" :label-width="formLabelWidth" prop="fileName"> |
| | | <el-input v-model="file.fileName" autocomplete="off" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button @click="updateFileNameFormVisible = false">取 消</el-button> |
| | | <el-button type="primary" @click="updateFileName('updateFileName')">确 定</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | |
| | | <el-dialog |
| | | title="移动文件" |
| | | :visible.sync="mvdialogFormVisible" |
| | | width="25%" |
| | | class="add-label" |
| | | > |
| | | <el-form ref="mvfolderform" :model="folderform" :rules="mvrules"> |
| | | <el-form ref="mvfolderform" :model="mvfolderform"> |
| | | <el-form-item |
| | | label="目录名称:" |
| | | :label-width="formLabelWidth" |
| | | prop="folderid" |
| | | > |
| | | <el-select v-model="folderform.folderid" placeholder="请选择移动的目录"> |
| | | <el-option |
| | | v-for="item in activities" |
| | | :key="item.id" |
| | | :value="item.id" |
| | | :label="item.timestamp" |
| | | /> |
| | | </el-select> |
| | | <treeselect |
| | | v-model="mvfolderform.folderid" |
| | | :multiple="false" |
| | | :options="activitiesTree" |
| | | :clear-value-text="$t('common.clear')" |
| | | placeholder=" " |
| | | style="width:100%" |
| | | /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button @click="mvdialogFormVisible = false">取 消</el-button> |
| | | <el-button |
| | | type="primary" |
| | | @click="mvfolder('mvfolderform')" |
| | | @click="mvfolder()" |
| | | >确 定</el-button> |
| | | </div> |
| | | </el-dialog> |
| | |
| | | <el-card |
| | | shadow="never" |
| | | > |
| | | <img |
| | | <el-image |
| | | v-if="'tif,bmp,jpg,png,gif'.indexOf(node.filesformat) == -1" |
| | | :src="showFileImg(node.filesformat)" |
| | | class="uploading-image" |
| | | @click="clickCard(index * rowCount + nodeIndex)" |
| | | > |
| | | <el-tooltip class="item" effect="dark" :content="node.filesname" placement="bottom"> |
| | | :preview-src-list="srcList" |
| | | @click="clickImg(node)" |
| | | /> |
| | | <el-tooltip v-if="'tif,bmp,jpg,png,gif'.indexOf(node.filesformat) == -1" class="item" effect="dark" :content="node.filesname" placement="bottom"> |
| | | <div style="padding-top: 14px;"> |
| | | <el-checkbox v-model="checkedArr[index * rowCount + nodeIndex].isChecked" class="myRedCheckBox">{{ node.filesname }}</el-checkbox> |
| | | </div> |
| | | </el-tooltip> |
| | | <el-tooltip v-if="'tif,bmp,jpg,png,gif'.indexOf(node.filesformat) != -1" class="item" effect="dark" :content="node.filesname" placement="bottom"> |
| | | <div style="padding-top: 14px;"> |
| | | <el-image |
| | | style="width: 100px; height: 80px;margin-top: -10px;" |
| | | :src="getImg+node.filesid" |
| | | :preview-src-list="srcList" |
| | | @click="clickImg(node)" |
| | | /> |
| | | <el-checkbox v-model="checkedArr[index * rowCount + nodeIndex].isChecked" class="myRedCheckBox"> |
| | | |
| | | {{ node.filesname }} |
| | | </el-checkbox> |
| | | </div> |
| | | </el-tooltip> |
| | | </el-card> |
| | |
| | | <script> |
| | | import { getToken } from '@/utils/auth' |
| | | import { pages } from '@/settings' |
| | | |
| | | import { Loading } from 'element-ui' |
| | | import Treeselect from '@riophae/vue-treeselect' |
| | | import '@riophae/vue-treeselect/dist/vue-treeselect.css' |
| | | export default { |
| | | components: { |
| | | Treeselect |
| | | }, |
| | | data() { |
| | | return { |
| | | url: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg', |
| | | activitiesTree: [], |
| | | srcList: [], |
| | | getImg: pages.getFilesUploadImage, |
| | | updateFileNameFormVisible: false, |
| | | file: { |
| | | fileName: '' |
| | | }, |
| | | rowCount: 12, |
| | | mvrules: { |
| | | folderid: [{ required: true, message: '请选择目录', trigger: 'change' }] |
| | | folderid: [{ required: true, message: '请选择目录', trigger: 'blur' }] |
| | | }, |
| | | filesUploadUrl: pages.filesUploadUrl, |
| | | fileDate: { |
| | |
| | | dialogDelVisible: false, |
| | | dialogFormVisible: false, |
| | | folderform: { |
| | | parentId: '', |
| | | folderid: '', |
| | | foldername: '', |
| | | sort: 0 |
| | | }, |
| | | mvfolderform: { |
| | | folderid: '' |
| | | }, |
| | | rules: { |
| | | foldername: [ |
| | | { required: true, message: '请输入文件夹名称', trigger: 'blur' }, |
| | | { min: 3, max: 10, message: '长度在 3 到 10 个字符', trigger: 'blur' } |
| | | ], |
| | | fileName: [ |
| | | { required: true, message: '请输入文件名称', trigger: 'blur' }, |
| | | { min: 3, max: 10, message: '长度在 3 到 20 个字符', trigger: 'blur' } |
| | | ], |
| | | sort: [{ required: true, message: '请输入排序', type: 'number', trigger: 'blur' }] |
| | | }, |
| | | formLabelWidth: '100px', |
| | | formLabelWidth: '120px', |
| | | beforeIndex: 0, |
| | | fileName: '', |
| | | checkedArr: [], |
| | | checkAll: false, |
| | | activities: [], |
| | | filesUploadData: [], |
| | | updateNum: 0 |
| | | updateNum: 0, |
| | | folderid: '' |
| | | } |
| | | }, |
| | | mounted() { |
| | |
| | | this.initFolder() |
| | | }, |
| | | methods: { |
| | | filterNode(value, data) { |
| | | if (!value) return true |
| | | return data.label.indexOf(value) !== -1 |
| | | }, |
| | | nodeClick(data) { |
| | | this.folderform.parentId = data.parentId |
| | | if (this.folderform.parentId === '0') { |
| | | this.folderform.parentId = null |
| | | } |
| | | this.folderform.sort = data.orderNum |
| | | this.folderform.foldername = data.label |
| | | this.folderform.folderid = data.id |
| | | // eslint-disable-next-line no-unused-vars |
| | | var params = {} |
| | | this.folderid = data.id |
| | | params = { |
| | | folderid: data.id, |
| | | filesname: this.fileName |
| | | } |
| | | this.initFile(params) |
| | | }, |
| | | clickImg(node) { |
| | | this.srcList = [] |
| | | if ('tif,bmp,jpg,png,gif'.indexOf(node.filesformat) >= 0) { |
| | | this.srcList.push(this.getImg + node.filesid) |
| | | } |
| | | }, |
| | | updateFileName(formName) { |
| | | this.$refs[formName].validate(valid => { |
| | | if (valid) { |
| | | var checke = '' |
| | | this.checkedArr.forEach((v, i) => { |
| | | if (v.isChecked) { |
| | | checke = v.filesid |
| | | } |
| | | }) |
| | | // 生成查询文件的条件 |
| | | var params = { filesid: checke, filesname: this.file.fileName } |
| | | this.$put('hr/filesUpload', { ...params }).then(() => { |
| | | this.$message({ |
| | | message: '重命名成功!', |
| | | type: 'success' |
| | | }) |
| | | this.updateFileNameFormVisible = false |
| | | this.file.fileName = '' |
| | | var folderid = this.activities[0].id |
| | | if (this.folderform.folderid !== '' && this.folderform.folderid !== null) { |
| | | folderid = this.folderform.folderid |
| | | } |
| | | // 生成查询文件的条件 |
| | | var initFileParams = { |
| | | folderid: folderid, |
| | | filesname: this.fileName |
| | | } |
| | | this.initFile(initFileParams) |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | openUpdateFileName() { |
| | | var checke = [] |
| | | this.checkedArr.forEach((v, i) => { |
| | | if (v.isChecked) { |
| | | checke.push(v.filesid) |
| | | } |
| | | }) |
| | | |
| | | if (checke.length <= 0) { |
| | | this.$message({ |
| | | message: '请选择一个需要重命名的文件!', |
| | | type: 'warning' |
| | | }) |
| | | } else { |
| | | this.updateFileNameFormVisible = true |
| | | } |
| | | }, |
| | | async initFolder() { |
| | | await this.$get('hr/folder').then(r => { |
| | | await this.$get('hr/folder/treeList').then(r => { |
| | | this.activities = [] |
| | | this.beforeIndex = 0 |
| | | r.data.data.forEach((v, i) => { |
| | | this.activitiesTree = r.data.data.rows |
| | | r.data.data.rows.forEach((v, i) => { |
| | | if (i === 0) { |
| | | this.activities.push({ |
| | | timestamp: v.foldername, |
| | | id: v.folderid, |
| | | timestamp: v.label, |
| | | id: v.id, |
| | | color: '#a32c30' |
| | | }) |
| | | } else { |
| | | this.activities.push({ timestamp: v.foldername, id: v.folderid }) |
| | | this.activities.push({ timestamp: v.label, id: v.id }) |
| | | } |
| | | }) |
| | | }) |
| | |
| | | }, |
| | | delFolder() { |
| | | // 生成查询文件的条件 |
| | | var params = { folderid: this.activities[this.beforeIndex].id } |
| | | var params = { folderid: this.folderid } |
| | | this.$delete('hr/folder', { ...params }).then(() => { |
| | | this.dialogFormVisible = false |
| | | this.$message({ |
| | |
| | | switch (type) { |
| | | case 'txt': |
| | | return require('../../assets/uploading/txt.png') |
| | | case 'xls': |
| | | return require('../../assets/uploading/xls.png') |
| | | case 'xlsx': |
| | | return require('../../assets/uploading/xls.png') |
| | | case 'apk': |
| | | return require('../../assets/uploading/apk.png') |
| | | case 'csv': |
| | |
| | | return require('../../assets/uploading/word.png') |
| | | case 'zip': |
| | | return require('../../assets/uploading/zip.png') |
| | | case 'jpg': |
| | | return require('../../assets/uploading/jpg.png') |
| | | case 'png': |
| | | return require('../../assets/uploading/png.png') |
| | | case 'doc': |
| | |
| | | } |
| | | }, |
| | | beforeAvatarUpload(file) { |
| | | this.fileDate.folderid = this.activities[this.beforeIndex].id |
| | | const isLt50M = file.size / 1024 / 1024 < 50 |
| | | if (this.folderform.folderid === '' || this.folderform.folderid === null) { |
| | | this.fileDate.folderid = this.activities[0].id |
| | | } else { |
| | | this.fileDate.folderid = this.folderform.folderid |
| | | } |
| | | |
| | | const isLt50M = file.size / 1024 / 1024 < 200 |
| | | if (!isLt50M) { |
| | | this.$message.error('上传文件不能超过 50MB!') |
| | | this.$message.error('上传文件不能超过 200MB!') |
| | | } |
| | | return isLt50M |
| | | }, |
| | |
| | | this.updateNum++ |
| | | if (this.updateNum === fileList.length) { |
| | | this.updateNum = 0 |
| | | var folderid = this.activities[0].id |
| | | if (this.folderform.folderid !== '' && this.folderform.folderid !== null) { |
| | | folderid = this.folderform.folderid |
| | | } |
| | | |
| | | // 生成查询文件的条件 |
| | | var params = { |
| | | folderid: this.activities[this.beforeIndex].id, |
| | | folderid: folderid, |
| | | filesname: this.fileName |
| | | } |
| | | this.initFile(params) |
| | |
| | | type: 'warning' |
| | | }) |
| | | } else { |
| | | var filename = '下载文件' |
| | | if (this.folderform.folderid === '' || this.folderform.folderid === null) { |
| | | filename = this.activities[0].timestamp |
| | | } else { |
| | | filename = this.folderform.foldername |
| | | } |
| | | |
| | | const loadingInstance = Loading.service({ fullscreen: true }) |
| | | // 生成查询文件的条件 |
| | | var params = { fileids: checke.join(',') } |
| | | this.$download('hr/filesUpload/download', { ...params }, this.activities[this.beforeIndex].timestamp + '.zip').then(() => { |
| | | this.$download('hr/filesUpload/download', { ...params }, filename + '.zip').then(() => { |
| | | loadingInstance.close() |
| | | this.$message({ |
| | | message: '下载成功!', |
| | | type: 'success' |
| | |
| | | } |
| | | }, |
| | | mvfolder(formName) { |
| | | if (this.folderform.folderid === this.activities[this.beforeIndex].id) { |
| | | // if (this.mvfolderform.folderid === this.activities[this.beforeIndex].id) { |
| | | // this.$message({ |
| | | // message: '文件在同一目录!', |
| | | // type: 'warning' |
| | | // }) |
| | | // return |
| | | // } |
| | | if (this.mvfolderform.folderid === '') { |
| | | this.$message({ |
| | | message: '文件在同一目录!', |
| | | message: '选择文件夹!', |
| | | type: 'warning' |
| | | }) |
| | | return |
| | |
| | | type: 'warning' |
| | | }) |
| | | } else { |
| | | this.$refs[formName].validate(valid => { |
| | | if (valid) { |
| | | // 生成查询文件的条件 |
| | | var params = { fileids: checke.join(','), folderid: this.folderform.folderid } |
| | | this.$post('hr/filesUpload/mvFiles', { ...params }).then(() => { |
| | | this.$message({ |
| | | message: '移动成功!', |
| | | type: 'success' |
| | | }) |
| | | this.mvdialogFormVisible = false |
| | | // 生成查询文件的条件 |
| | | var initFileParams = { |
| | | folderid: this.activities[this.beforeIndex].id, |
| | | filesname: this.fileName |
| | | } |
| | | this.initFile(initFileParams) |
| | | }) |
| | | // 生成查询文件的条件 |
| | | var params = { fileids: checke.join(','), folderid: this.mvfolderform.folderid } |
| | | this.$post('hr/filesUpload/mvFiles', { ...params }).then(() => { |
| | | this.$message({ |
| | | message: '移动成功!', |
| | | type: 'success' |
| | | }) |
| | | this.mvdialogFormVisible = false |
| | | this.mvfolderform.folderid = '' |
| | | // 生成查询文件的条件 |
| | | var initFileParams = { |
| | | folderid: this.activities[this.beforeIndex].id, |
| | | filesname: this.fileName |
| | | } |
| | | this.initFile(initFileParams) |
| | | }) |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | .add-folder-but { |
| | | background: #fff !important; |
| | | color: #a32c30 !important; |
| | | background: #a32c30 !important; |
| | | color: #fff !important; |
| | | margin-bottom: 20px; |
| | | } |
| | | padding: 0 15px 0 15px; |
| | |
| | | line-height: 60px; |
| | | } |
| | | .uploading-image { |
| | | width: 100%; |
| | | height: 100%; |
| | | width: 70%; |
| | | height: 70%; |
| | | display: block; |
| | | margin-left: 30px; |
| | | } |
| | | } |
| | | |
| | |
| | | .myRedCheckBox .el-checkbox__inner:hover { |
| | | border-color: #a32c30; |
| | | } |
| | | |
| | | .myRedCheckBox .el-checkbox__label { |
| | | overflow: hidden; |
| | | text-overflow:ellipsis; |
| | | white-space: nowrap; |
| | | } |
| | | .myRedCheckBox { |
| | | margin-left: -10px; |
| | | } |
| | | .myRedCheckBox .el-checkbox__input { |
| | | vertical-align: text-top; |
| | | } |
| | | .avatar-uploader{ |
| | | .el-upload-dragger{ |
| | | width: 65px !important; |
| | | height: 65px !important; |
| | | width: 75px !important; |
| | | height: 75px !important; |
| | | .el-icon-upload{ |
| | | font-size: 40px; |
| | | color: #8c939d; |
| | |
| | | width: 100px; |
| | | height: 100px; |
| | | } |
| | | |
| | | .zs-main { |
| | | .el-tree .el-tree-node__content{ |
| | | font-size:16px; |
| | | color: #333; |
| | | height: 35px; |
| | | line-height: 35px; |
| | | } |
| | | .el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content { |
| | | background-color: #e8f2fd; |
| | | border-radius: 4px; |
| | | } |
| | | } |
| | | </style> |
| | | <style lang="scss" scoped> |
| | | .el-main { |
| | |
| | | .el-input-number { |
| | | width: 100%; |
| | | } |
| | | .pri-del-btn { |
| | | background-color: rgb(64, 158, 255) !important; |
| | | border-color: rgb(64, 158, 255) !important; |
| | | } |
| | | </style> |
| | | |