ftp文件上传前端页面修改

This commit is contained in:
20932067@zju.edu.cn 2021-02-20 12:45:40 +08:00
parent db118aec37
commit 9bfb1cea20
10 changed files with 84 additions and 12 deletions

View File

@ -64,10 +64,11 @@ export function getRoleAll(){
}) })
} }
export function downloadFile(fileId){ // 获取文件夹列表
export function getFolder(){
return request({ return request({
url:'/system/file/download/'+fileId, url:'/system/file/folder',
method:'get' method:'get',
}) })
} }

View File

@ -173,6 +173,16 @@
<el-dialog :title="fileForm.title" :visible.sync="fileForm.open" width="500px" append-to-body> <el-dialog :title="fileForm.title" :visible.sync="fileForm.open" width="500px" append-to-body>
<el-form ref="uploadFrom" :model="form" :rules="rules" label-width="80px"> <el-form ref="uploadFrom" :model="form" :rules="rules" label-width="80px">
<el-form-item label="文件夹">
<el-select v-model="form.pId" multiple placeholder="请选择">
<el-option
v-for="item in folderOptions"
:key="item.fileId"
:label="item.fileName"
:value="item.fileId"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="角色"> <el-form-item label="角色">
<el-select v-model="form.roleIds" multiple placeholder="请选择"> <el-select v-model="form.roleIds" multiple placeholder="请选择">
<el-option <el-option
@ -216,7 +226,7 @@
</template> </template>
<script> <script>
import {listFile, getFile, delFile, addFile, updateFile, exportFile, getRoleAll} from "@/api/system/file"; import {listFile, getFile, delFile, addFile, updateFile, exportFile, getRoleAll, getFolder} from "@/api/system/file";
import {downloadFile} from '@/api/system/download' import {downloadFile} from '@/api/system/download'
import ImageUpload from '@/components/ImageUpload'; import ImageUpload from '@/components/ImageUpload';
import FileUpload from '@/components/FileUpload'; import FileUpload from '@/components/FileUpload';
@ -255,6 +265,7 @@ export default {
// //
title: "", title: "",
isAdd: true, isAdd: true,
folderOptions: [],
// (:folder,:file) // (:folder,:file)
fileTypeOptions: [], fileTypeOptions: [],
// //
@ -289,6 +300,9 @@ export default {
getRoleAll().then(res => { getRoleAll().then(res => {
this.roleOptions = res.data this.roleOptions = res.data
}) })
getFolder().then(res =>{
this.folderOptions = res.data
})
}, },
methods: { methods: {
/** 查询文件信息列表 */ /** 查询文件信息列表 */
@ -336,14 +350,14 @@ export default {
this.reset(); this.reset();
}, },
// //
handleDownload(row){ handleDownload(row) {
this.$confirm("是否确认下载"+row.fileName+"?","警告",{ this.$confirm("是否确认下载" + row.fileName + "?", "警告", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning" type: "warning"
}).then(function (){ }).then(function () {
return downloadFile(row.fileId) return downloadFile(row.fileId)
}).then(res =>{ }).then(res => {
this.download(res.data.msg); this.download(res.data.msg);
}) })
}, },

View File

@ -24,7 +24,7 @@
<el-form-item label="状态" prop="status"> <el-form-item label="状态" prop="status">
<el-select <el-select
v-model="queryParams.status" v-model="queryParams.status"
placeholder="角色状态" placeholder="请选择角色状态"
clearable clearable
size="small" size="small"
style="width: 240px" style="width: 240px"
@ -37,6 +37,18 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="角色类型" prop="status">
<el-select
v-model="queryParams.roleType"
placeholder="请选择角色类型"
clearable
size="small"
style="width: 240px"
>
<el-option label="系统角色" :value="1"/>
<el-option label="文件管理角色" :value="2"/>
</el-select>
</el-form-item>
<el-form-item label="创建时间"> <el-form-item label="创建时间">
<el-date-picker <el-date-picker
v-model="dateRange" v-model="dateRange"
@ -315,6 +327,7 @@ export default {
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
roleType :undefined,
roleName: undefined, roleName: undefined,
roleKey: undefined, roleKey: undefined,
status: undefined status: undefined

View File

@ -75,6 +75,21 @@ public class FileController extends HcyBaseController {
} }
} }
@GetMapping("/folder")
public AjaxResult getFolder(){
try {
ServerResult<List<SysFile>> serverResult = fileService.selectFileFolder();
if (serverResult.isStart()){
return AjaxResult.success(serverResult.getData());
}else {
return AjaxResult.error(serverResult.getMsg());
}
} catch (RuntimeException e) {
logger.error(e.getMessage());
return AjaxResult.error(ReturnConstants.SYS_ERROR);
}
}
/** /**
* 导出文件信息列表 * 导出文件信息列表
*/ */

View File

@ -83,7 +83,7 @@ public class SysRole extends BaseEntity {
*/ */
private Long[] deptIds; private Long[] deptIds;
private Integer roleType = 1; private Integer roleType = 0;
public SysRole() { public SysRole() {
} }

View File

@ -27,6 +27,13 @@ public interface FileDao {
*/ */
List<SysFile> selectFileList(SysFile sysFile); List<SysFile> selectFileList(SysFile sysFile);
/**
* 查询文件夹列表
* @return
*/
List<SysFile> selectFileFolder();
/** /**
* 新增文件信息 * 新增文件信息
* *

View File

@ -31,6 +31,12 @@ public interface FileService {
*/ */
ServerResult<List<SysFile>> selectFileList(SysFile sysFile); ServerResult<List<SysFile>> selectFileList(SysFile sysFile);
/**
* 查询文件夹基本信息
* @return
*/
ServerResult<List<SysFile>> selectFileFolder();
/** /**
* 新增文件信息 * 新增文件信息
* *

View File

@ -73,6 +73,17 @@ public class FileServiceImpl implements FileService {
} }
} }
@Override
public ServerResult<List<SysFile>> selectFileFolder() {
try {
List<SysFile> sysFiles = fileDao.selectFileFolder();
return new ServerResult<>(true,sysFiles);
}catch (RuntimeException e){
logger.error(e.getMessage());
return new ServerResult<List<SysFile>>(false, ReturnConstants.DB_EX);
}
}
/** /**
* 新增文件信息 * 新增文件信息
* *

View File

@ -25,7 +25,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql> </sql>
<select id="selectFileList" parameterType="SysFile" resultMap="FileResult"> <select id="selectFileList" parameterType="SysFile" resultMap="FileResult">
<include refid="selectFileVo"/> <include refid="selectFileVo"/>
<where> <where>
and is_public != '3'
<if test="fileName != null and fileName != ''"> and file_name like concat('%', #{fileName}, '%')</if> <if test="fileName != null and fileName != ''"> and file_name like concat('%', #{fileName}, '%')</if>
<if test="fileAddr != null and fileAddr != ''"> and file_addr like concat('%', #{fileAddr}, '%')</if> <if test="fileAddr != null and fileAddr != ''"> and file_addr like concat('%', #{fileAddr}, '%')</if>
<if test="fileType != null and fileType != ''"> and file_type = #{fileType}</if> <if test="fileType != null and fileType != ''"> and file_type = #{fileType}</if>
@ -34,6 +35,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where> </where>
</select> </select>
<select id="selectFileFolder" resultMap="FileResult">
<include refid="selectFileVo"/>
where is_public = '3'
</select>
<select id="selectFileById" parameterType="Long" resultMap="FileResult"> <select id="selectFileById" parameterType="Long" resultMap="FileResult">
<include refid="selectFileVo"/> <include refid="selectFileVo"/>
where file_id = #{fileId} where file_id = #{fileId}

View File

@ -34,7 +34,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectRoleList" parameterType="SysRole" resultMap="SysRoleResult"> <select id="selectRoleList" parameterType="SysRole" resultMap="SysRoleResult">
<include refid="selectRoleVo"/> <include refid="selectRoleVo"/>
where r.del_flag = '0' where r.del_flag = '0'
<if test="roleType != 0"> <if test="roleType != 0 and roleType != null">
and r.role_type = #{roleType} and r.role_type = #{roleType}
</if> </if>
<if test="roleName != null and roleName != ''"> <if test="roleName != null and roleName != ''">