新增前端vue
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
package com.jeesite.modules.biz.dao;
|
||||
|
||||
import com.jeesite.common.dao.CrudDao;
|
||||
import com.jeesite.common.mybatis.annotation.MyBatisDao;
|
||||
import com.jeesite.modules.biz.entity.BizFolders;
|
||||
|
||||
/**
|
||||
* 文件夹信息DAO接口
|
||||
* @author gaoxq
|
||||
* @version 2025-12-18
|
||||
*/
|
||||
@MyBatisDao(dataSourceName="work")
|
||||
public interface BizFoldersDao extends CrudDao<BizFolders> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.jeesite.modules.biz.dao;
|
||||
|
||||
import com.jeesite.common.dao.CrudDao;
|
||||
import com.jeesite.common.mybatis.annotation.MyBatisDao;
|
||||
import com.jeesite.modules.biz.entity.BizMyfiles;
|
||||
|
||||
/**
|
||||
* 文件信息DAO接口
|
||||
* @author gaoxq
|
||||
* @version 2025-12-18
|
||||
*/
|
||||
@MyBatisDao(dataSourceName="work")
|
||||
public interface BizMyfilesDao extends CrudDao<BizMyfiles> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.jeesite.modules.biz.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable;
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
import com.jeesite.common.entity.DataEntity;
|
||||
import com.jeesite.common.mybatis.annotation.Column;
|
||||
import com.jeesite.common.mybatis.annotation.Table;
|
||||
import com.jeesite.common.mybatis.mapper.query.QueryType;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField.Align;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelFields;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 文件夹信息Entity
|
||||
* @author gaoxq
|
||||
* @version 2025-12-18
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table(name="biz_folders", alias="a", label="文件夹信息信息", columns={
|
||||
@Column(name="create_time", attrName="createTime", label="记录时间", isUpdate=false, isUpdateForce=true),
|
||||
@Column(name="folder_id", attrName="folderId", label="文件夹标识", isPK=true),
|
||||
@Column(name="folder_name", attrName="folderName", label="文件夹名称", queryType=QueryType.LIKE),
|
||||
@Column(name="parent_id", attrName="parentId", label="父文件夹"),
|
||||
@Column(name="user_name", attrName="userName", label="用户姓名", isQuery=false),
|
||||
@Column(name="login_code", attrName="loginCode", label="用户名称"),
|
||||
@Column(name="update_time", attrName="updateTime", label="更新时间", isQuery=false, isUpdateForce=true),
|
||||
@Column(name="is_deleted", attrName="isDeleted", label="是否删除"),
|
||||
@Column(name="description", attrName="description", label="文件夹描述", queryType=QueryType.LIKE),
|
||||
}, orderBy="a.create_time DESC"
|
||||
)
|
||||
@Data
|
||||
public class BizFolders extends DataEntity<BizFolders> implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Date createTime; // 记录时间
|
||||
private String folderId; // 文件夹标识
|
||||
private String folderName; // 文件夹名称
|
||||
private String parentId; // 父文件夹
|
||||
private String userName; // 用户姓名
|
||||
private String loginCode; // 用户名称
|
||||
private Date updateTime; // 更新时间
|
||||
private Integer isDeleted; // 是否删除
|
||||
private String description; // 文件夹描述
|
||||
|
||||
@ExcelFields({
|
||||
@ExcelField(title="记录时间", attrName="createTime", align=Align.CENTER, sort=10, dataFormat="yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title="文件夹标识", attrName="folderId", align=Align.CENTER, sort=20),
|
||||
@ExcelField(title="文件夹名称", attrName="folderName", align=Align.CENTER, sort=30),
|
||||
@ExcelField(title="父文件夹", attrName="parentId", align=Align.CENTER, sort=40),
|
||||
@ExcelField(title="用户姓名", attrName="userName", align=Align.CENTER, sort=50),
|
||||
@ExcelField(title="用户名称", attrName="loginCode", align=Align.CENTER, sort=60),
|
||||
@ExcelField(title="更新时间", attrName="updateTime", align=Align.CENTER, sort=70, dataFormat="yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title="是否删除", attrName="isDeleted", dictType="sys_yes_no", align=Align.CENTER, sort=80),
|
||||
@ExcelField(title="文件夹描述", attrName="description", align=Align.CENTER, sort=90),
|
||||
})
|
||||
public BizFolders() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public BizFolders(String id){
|
||||
super(id);
|
||||
}
|
||||
|
||||
public Date getCreateTime_gte() {
|
||||
return sqlMap.getWhere().getValue("create_time", QueryType.GTE);
|
||||
}
|
||||
|
||||
public void setCreateTime_gte(Date createTime) {
|
||||
sqlMap.getWhere().and("create_time", QueryType.GTE, createTime);
|
||||
}
|
||||
|
||||
public Date getCreateTime_lte() {
|
||||
return sqlMap.getWhere().getValue("create_time", QueryType.LTE);
|
||||
}
|
||||
|
||||
public void setCreateTime_lte(Date createTime) {
|
||||
sqlMap.getWhere().and("create_time", QueryType.LTE, createTime);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
package com.jeesite.modules.biz.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable;
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
import com.jeesite.common.entity.DataEntity;
|
||||
import com.jeesite.common.mybatis.annotation.Column;
|
||||
import com.jeesite.common.mybatis.annotation.Table;
|
||||
import com.jeesite.common.mybatis.mapper.query.QueryType;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField.Align;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelFields;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 文件信息Entity
|
||||
* @author gaoxq
|
||||
* @version 2025-12-18
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table(name="biz_myfiles", alias="a", label="文件信息信息", columns={
|
||||
@Column(name="create_time", attrName="createTime", label="记录时间", isUpdate=false, isUpdateForce=true),
|
||||
@Column(name="id", attrName="tid", label="文件标识", isPK=true),
|
||||
@Column(name="file_name", attrName="fileName", label="原始名称", queryType=QueryType.LIKE),
|
||||
@Column(name="file_path", attrName="filePath", label="存储路径", isQuery=false),
|
||||
@Column(name="file_hash", attrName="fileHash", label="文件MD5"),
|
||||
@Column(name="file_size", attrName="fileSize", label="文件大小", isQuery=false),
|
||||
@Column(name="file_ext", attrName="fileExt", label="文件扩展名", isQuery=false),
|
||||
@Column(name="mime_type", attrName="mimeType", label="文件类型", isQuery=false),
|
||||
@Column(name="folder_id", attrName="folderId", label="文件夹标识"),
|
||||
@Column(name="user_name", attrName="userName", label="用户姓名", isUpdate=false, isQuery=false),
|
||||
@Column(name="login_code", attrName="loginCode", label="用户名称", isUpdate=false),
|
||||
@Column(name="download_count", attrName="downloadCount", label="下载次数", isUpdate=false, isQuery=false, isUpdateForce=true),
|
||||
@Column(name="view_count", attrName="viewCount", label="查看次数", isUpdate=false, isQuery=false, isUpdateForce=true),
|
||||
@Column(name="expire_time", attrName="expireTime", label="过期时间", isQuery=false, isUpdateForce=true),
|
||||
@Column(name="is_delete", attrName="isDelete", label="是否删除", isUpdateForce=true),
|
||||
@Column(name="update_time", attrName="updateTime", label="更新时间", isQuery=false, isUpdateForce=true),
|
||||
}, orderBy="a.create_time DESC"
|
||||
)
|
||||
@Data
|
||||
public class BizMyfiles extends DataEntity<BizMyfiles> implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Date createTime; // 记录时间
|
||||
private Long tid; // 文件标识
|
||||
private String fileName; // 原始名称
|
||||
private String filePath; // 存储路径
|
||||
private String fileHash; // 文件MD5
|
||||
private Long fileSize; // 文件大小
|
||||
private String fileExt; // 文件扩展名
|
||||
private String mimeType; // 文件类型
|
||||
private String folderId; // 文件夹标识
|
||||
private String userName; // 用户姓名
|
||||
private String loginCode; // 用户名称
|
||||
private Integer downloadCount; // 下载次数
|
||||
private Integer viewCount; // 查看次数
|
||||
private Date expireTime; // 过期时间
|
||||
private Integer isDelete; // 是否删除
|
||||
private Date updateTime; // 更新时间
|
||||
|
||||
@ExcelFields({
|
||||
@ExcelField(title="记录时间", attrName="createTime", align=Align.CENTER, sort=10, dataFormat="yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title="文件标识", attrName="tid", align=Align.CENTER, sort=20),
|
||||
@ExcelField(title="原始名称", attrName="fileName", align=Align.CENTER, sort=30),
|
||||
@ExcelField(title="存储路径", attrName="filePath", align=Align.CENTER, sort=40),
|
||||
@ExcelField(title="文件MD5", attrName="fileHash", align=Align.CENTER, sort=50),
|
||||
@ExcelField(title="文件大小", attrName="fileSize", align=Align.CENTER, sort=60),
|
||||
@ExcelField(title="文件扩展名", attrName="fileExt", align=Align.CENTER, sort=70),
|
||||
@ExcelField(title="文件类型", attrName="mimeType", align=Align.CENTER, sort=80),
|
||||
@ExcelField(title="文件夹标识", attrName="folderId", align=Align.CENTER, sort=90),
|
||||
@ExcelField(title="用户姓名", attrName="userName", align=Align.CENTER, sort=100),
|
||||
@ExcelField(title="用户名称", attrName="loginCode", align=Align.CENTER, sort=110),
|
||||
@ExcelField(title="下载次数", attrName="downloadCount", align=Align.CENTER, sort=120),
|
||||
@ExcelField(title="查看次数", attrName="viewCount", align=Align.CENTER, sort=130),
|
||||
@ExcelField(title="过期时间", attrName="expireTime", align=Align.CENTER, sort=140, dataFormat="yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title="是否删除", attrName="isDelete", dictType="sys_yes_no", align=Align.CENTER, sort=150),
|
||||
@ExcelField(title="更新时间", attrName="updateTime", align=Align.CENTER, sort=160, dataFormat="yyyy-MM-dd hh:mm"),
|
||||
})
|
||||
public BizMyfiles() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public BizMyfiles(String id){
|
||||
super(id);
|
||||
}
|
||||
|
||||
public Date getCreateTime_gte() {
|
||||
return sqlMap.getWhere().getValue("create_time", QueryType.GTE);
|
||||
}
|
||||
|
||||
public void setCreateTime_gte(Date createTime) {
|
||||
sqlMap.getWhere().and("create_time", QueryType.GTE, createTime);
|
||||
}
|
||||
|
||||
public Date getCreateTime_lte() {
|
||||
return sqlMap.getWhere().getValue("create_time", QueryType.LTE);
|
||||
}
|
||||
|
||||
public void setCreateTime_lte(Date createTime) {
|
||||
sqlMap.getWhere().and("create_time", QueryType.LTE, createTime);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package com.jeesite.modules.biz.service;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.service.CrudService;
|
||||
import com.jeesite.modules.biz.entity.BizFolders;
|
||||
import com.jeesite.modules.biz.dao.BizFoldersDao;
|
||||
import com.jeesite.common.service.ServiceException;
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.validator.ValidatorUtils;
|
||||
import com.jeesite.common.utils.excel.ExcelImport;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import jakarta.validation.ConstraintViolation;
|
||||
import jakarta.validation.ConstraintViolationException;
|
||||
|
||||
/**
|
||||
* 文件夹信息Service
|
||||
* @author gaoxq
|
||||
* @version 2025-12-18
|
||||
*/
|
||||
@Service
|
||||
public class BizFoldersService extends CrudService<BizFoldersDao, BizFolders> {
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param bizFolders 主键
|
||||
*/
|
||||
@Override
|
||||
public BizFolders get(BizFolders bizFolders) {
|
||||
return super.get(bizFolders);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param bizFolders 查询条件
|
||||
* @param bizFolders page 分页对象
|
||||
*/
|
||||
@Override
|
||||
public Page<BizFolders> findPage(BizFolders bizFolders) {
|
||||
return super.findPage(bizFolders);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
* @param bizFolders 查询条件
|
||||
*/
|
||||
@Override
|
||||
public List<BizFolders> findList(BizFolders bizFolders) {
|
||||
return super.findList(bizFolders);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param bizFolders 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void save(BizFolders bizFolders) {
|
||||
super.save(bizFolders);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
* @param file 导入的数据文件
|
||||
*/
|
||||
@Transactional
|
||||
public String importData(MultipartFile file) {
|
||||
if (file == null){
|
||||
throw new ServiceException(text("请选择导入的数据文件!"));
|
||||
}
|
||||
int successNum = 0; int failureNum = 0;
|
||||
StringBuilder successMsg = new StringBuilder();
|
||||
StringBuilder failureMsg = new StringBuilder();
|
||||
try(ExcelImport ei = new ExcelImport(file, 2, 0)){
|
||||
List<BizFolders> list = ei.getDataList(BizFolders.class);
|
||||
for (BizFolders bizFolders : list) {
|
||||
try{
|
||||
ValidatorUtils.validateWithException(bizFolders);
|
||||
this.save(bizFolders);
|
||||
successNum++;
|
||||
successMsg.append("<br/>" + successNum + "、编号 " + bizFolders.getId() + " 导入成功");
|
||||
} catch (Exception e) {
|
||||
failureNum++;
|
||||
String msg = "<br/>" + failureNum + "、编号 " + bizFolders.getId() + " 导入失败:";
|
||||
if (e instanceof ConstraintViolationException){
|
||||
ConstraintViolationException cve = (ConstraintViolationException)e;
|
||||
for (ConstraintViolation<?> violation : cve.getConstraintViolations()) {
|
||||
msg += Global.getText(violation.getMessage()) + " ("+violation.getPropertyPath()+")";
|
||||
}
|
||||
}else{
|
||||
msg += e.getMessage();
|
||||
}
|
||||
failureMsg.append(msg);
|
||||
logger.error(msg, e);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
failureMsg.append(e.getMessage());
|
||||
return failureMsg.toString();
|
||||
}
|
||||
if (failureNum > 0) {
|
||||
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
|
||||
throw new ServiceException(failureMsg.toString());
|
||||
}else{
|
||||
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
|
||||
}
|
||||
return successMsg.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
* @param bizFolders 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateStatus(BizFolders bizFolders) {
|
||||
super.updateStatus(bizFolders);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param bizFolders 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void delete(BizFolders bizFolders) {
|
||||
super.delete(bizFolders);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
package com.jeesite.modules.biz.service;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.service.CrudService;
|
||||
import com.jeesite.modules.biz.entity.BizMyfiles;
|
||||
import com.jeesite.modules.biz.dao.BizMyfilesDao;
|
||||
import com.jeesite.common.service.ServiceException;
|
||||
import com.jeesite.modules.file.utils.FileUploadUtils;
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.validator.ValidatorUtils;
|
||||
import com.jeesite.common.utils.excel.ExcelImport;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import jakarta.validation.ConstraintViolation;
|
||||
import jakarta.validation.ConstraintViolationException;
|
||||
|
||||
/**
|
||||
* 文件信息Service
|
||||
* @author gaoxq
|
||||
* @version 2025-12-18
|
||||
*/
|
||||
@Service
|
||||
public class BizMyfilesService extends CrudService<BizMyfilesDao, BizMyfiles> {
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param bizMyfiles 主键
|
||||
*/
|
||||
@Override
|
||||
public BizMyfiles get(BizMyfiles bizMyfiles) {
|
||||
return super.get(bizMyfiles);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param bizMyfiles 查询条件
|
||||
* @param bizMyfiles page 分页对象
|
||||
*/
|
||||
@Override
|
||||
public Page<BizMyfiles> findPage(BizMyfiles bizMyfiles) {
|
||||
return super.findPage(bizMyfiles);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
* @param bizMyfiles 查询条件
|
||||
*/
|
||||
@Override
|
||||
public List<BizMyfiles> findList(BizMyfiles bizMyfiles) {
|
||||
return super.findList(bizMyfiles);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param bizMyfiles 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void save(BizMyfiles bizMyfiles) {
|
||||
super.save(bizMyfiles);
|
||||
// 保存上传附件
|
||||
FileUploadUtils.saveFileUpload(bizMyfiles, bizMyfiles.getId(), "bizMyfiles_file");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
* @param file 导入的数据文件
|
||||
*/
|
||||
@Transactional
|
||||
public String importData(MultipartFile file) {
|
||||
if (file == null){
|
||||
throw new ServiceException(text("请选择导入的数据文件!"));
|
||||
}
|
||||
int successNum = 0; int failureNum = 0;
|
||||
StringBuilder successMsg = new StringBuilder();
|
||||
StringBuilder failureMsg = new StringBuilder();
|
||||
try(ExcelImport ei = new ExcelImport(file, 2, 0)){
|
||||
List<BizMyfiles> list = ei.getDataList(BizMyfiles.class);
|
||||
for (BizMyfiles bizMyfiles : list) {
|
||||
try{
|
||||
ValidatorUtils.validateWithException(bizMyfiles);
|
||||
this.save(bizMyfiles);
|
||||
successNum++;
|
||||
successMsg.append("<br/>" + successNum + "、编号 " + bizMyfiles.getId() + " 导入成功");
|
||||
} catch (Exception e) {
|
||||
failureNum++;
|
||||
String msg = "<br/>" + failureNum + "、编号 " + bizMyfiles.getId() + " 导入失败:";
|
||||
if (e instanceof ConstraintViolationException){
|
||||
ConstraintViolationException cve = (ConstraintViolationException)e;
|
||||
for (ConstraintViolation<?> violation : cve.getConstraintViolations()) {
|
||||
msg += Global.getText(violation.getMessage()) + " ("+violation.getPropertyPath()+")";
|
||||
}
|
||||
}else{
|
||||
msg += e.getMessage();
|
||||
}
|
||||
failureMsg.append(msg);
|
||||
logger.error(msg, e);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
failureMsg.append(e.getMessage());
|
||||
return failureMsg.toString();
|
||||
}
|
||||
if (failureNum > 0) {
|
||||
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
|
||||
throw new ServiceException(failureMsg.toString());
|
||||
}else{
|
||||
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
|
||||
}
|
||||
return successMsg.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
* @param bizMyfiles 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateStatus(BizMyfiles bizMyfiles) {
|
||||
super.updateStatus(bizMyfiles);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param bizMyfiles 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void delete(BizMyfiles bizMyfiles) {
|
||||
super.delete(bizMyfiles);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
package com.jeesite.modules.biz.web;
|
||||
|
||||
import java.util.List;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.collect.ListUtils;
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.lang.DateUtils;
|
||||
import com.jeesite.common.utils.excel.ExcelExport;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField.Type;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.biz.entity.BizFolders;
|
||||
import com.jeesite.modules.biz.service.BizFoldersService;
|
||||
|
||||
/**
|
||||
* 文件夹信息Controller
|
||||
* @author gaoxq
|
||||
* @version 2025-12-18
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/biz/folders")
|
||||
public class BizFoldersController extends BaseController {
|
||||
|
||||
private final BizFoldersService bizFoldersService;
|
||||
|
||||
public BizFoldersController(BizFoldersService bizFoldersService) {
|
||||
this.bizFoldersService = bizFoldersService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
@ModelAttribute
|
||||
public BizFolders get(String folderId, boolean isNewRecord) {
|
||||
return bizFoldersService.get(folderId, isNewRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
@RequestMapping(value = {"list", ""})
|
||||
public String list(BizFolders bizFolders, Model model) {
|
||||
model.addAttribute("bizFolders", bizFolders);
|
||||
return "modules/biz/bizFoldersList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
*/
|
||||
@RequestMapping(value = "listData")
|
||||
@ResponseBody
|
||||
public Page<BizFolders> listData(BizFolders bizFolders, HttpServletRequest request, HttpServletResponse response) {
|
||||
bizFolders.setPage(new Page<>(request, response));
|
||||
Page<BizFolders> page = bizFoldersService.findPage(bizFolders);
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看编辑表单
|
||||
*/
|
||||
@RequestMapping(value = "form")
|
||||
public String form(BizFolders bizFolders, Model model) {
|
||||
model.addAttribute("bizFolders", bizFolders);
|
||||
return "modules/biz/bizFoldersForm";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
*/
|
||||
@PostMapping(value = "save")
|
||||
@ResponseBody
|
||||
public String save(@Validated BizFolders bizFolders) {
|
||||
bizFoldersService.save(bizFolders);
|
||||
return renderResult(Global.TRUE, text("保存文件夹信息成功!"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*/
|
||||
@RequestMapping(value = "exportData")
|
||||
public void exportData(BizFolders bizFolders, HttpServletResponse response) {
|
||||
List<BizFolders> list = bizFoldersService.findList(bizFolders);
|
||||
String fileName = "文件夹信息" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
|
||||
try(ExcelExport ee = new ExcelExport("文件夹信息", BizFolders.class)){
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载模板
|
||||
*/
|
||||
@RequestMapping(value = "importTemplate")
|
||||
public void importTemplate(HttpServletResponse response) {
|
||||
BizFolders bizFolders = new BizFolders();
|
||||
List<BizFolders> list = ListUtils.newArrayList(bizFolders);
|
||||
String fileName = "文件夹信息模板.xlsx";
|
||||
try(ExcelExport ee = new ExcelExport("文件夹信息", BizFolders.class, Type.IMPORT)){
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping(value = "importData")
|
||||
public String importData(MultipartFile file) {
|
||||
try {
|
||||
String message = bizFoldersService.importData(file);
|
||||
return renderResult(Global.TRUE, "posfull:"+message);
|
||||
} catch (Exception ex) {
|
||||
return renderResult(Global.FALSE, "posfull:"+ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*/
|
||||
@RequestMapping(value = "delete")
|
||||
@ResponseBody
|
||||
public String delete(BizFolders bizFolders) {
|
||||
bizFoldersService.delete(bizFolders);
|
||||
return renderResult(Global.TRUE, text("删除文件夹信息成功!"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
package com.jeesite.modules.biz.web;
|
||||
|
||||
import java.util.List;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.collect.ListUtils;
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.lang.DateUtils;
|
||||
import com.jeesite.common.utils.excel.ExcelExport;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField.Type;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.biz.entity.BizMyfiles;
|
||||
import com.jeesite.modules.biz.service.BizMyfilesService;
|
||||
|
||||
/**
|
||||
* 文件信息Controller
|
||||
* @author gaoxq
|
||||
* @version 2025-12-18
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/biz/myfiles")
|
||||
public class BizMyfilesController extends BaseController {
|
||||
|
||||
private final BizMyfilesService bizMyfilesService;
|
||||
|
||||
public BizMyfilesController(BizMyfilesService bizMyfilesService) {
|
||||
this.bizMyfilesService = bizMyfilesService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
@ModelAttribute
|
||||
public BizMyfiles get(Long tid, boolean isNewRecord) {
|
||||
return bizMyfilesService.get(tid, isNewRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
@RequestMapping(value = {"list", ""})
|
||||
public String list(BizMyfiles bizMyfiles, Model model) {
|
||||
model.addAttribute("bizMyfiles", bizMyfiles);
|
||||
return "modules/biz/bizMyfilesList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
*/
|
||||
@RequestMapping(value = "listData")
|
||||
@ResponseBody
|
||||
public Page<BizMyfiles> listData(BizMyfiles bizMyfiles, HttpServletRequest request, HttpServletResponse response) {
|
||||
bizMyfiles.setPage(new Page<>(request, response));
|
||||
Page<BizMyfiles> page = bizMyfilesService.findPage(bizMyfiles);
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看编辑表单
|
||||
*/
|
||||
@RequestMapping(value = "form")
|
||||
public String form(BizMyfiles bizMyfiles, Model model) {
|
||||
model.addAttribute("bizMyfiles", bizMyfiles);
|
||||
return "modules/biz/bizMyfilesForm";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
*/
|
||||
@PostMapping(value = "save")
|
||||
@ResponseBody
|
||||
public String save(@Validated BizMyfiles bizMyfiles) {
|
||||
bizMyfilesService.save(bizMyfiles);
|
||||
return renderResult(Global.TRUE, text("保存文件信息成功!"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*/
|
||||
@RequestMapping(value = "exportData")
|
||||
public void exportData(BizMyfiles bizMyfiles, HttpServletResponse response) {
|
||||
List<BizMyfiles> list = bizMyfilesService.findList(bizMyfiles);
|
||||
String fileName = "文件信息" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
|
||||
try(ExcelExport ee = new ExcelExport("文件信息", BizMyfiles.class)){
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载模板
|
||||
*/
|
||||
@RequestMapping(value = "importTemplate")
|
||||
public void importTemplate(HttpServletResponse response) {
|
||||
BizMyfiles bizMyfiles = new BizMyfiles();
|
||||
List<BizMyfiles> list = ListUtils.newArrayList(bizMyfiles);
|
||||
String fileName = "文件信息模板.xlsx";
|
||||
try(ExcelExport ee = new ExcelExport("文件信息", BizMyfiles.class, Type.IMPORT)){
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping(value = "importData")
|
||||
public String importData(MultipartFile file) {
|
||||
try {
|
||||
String message = bizMyfilesService.importData(file);
|
||||
return renderResult(Global.TRUE, "posfull:"+message);
|
||||
} catch (Exception ex) {
|
||||
return renderResult(Global.FALSE, "posfull:"+ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*/
|
||||
@RequestMapping(value = "delete")
|
||||
@ResponseBody
|
||||
public String delete(BizMyfiles bizMyfiles) {
|
||||
bizMyfilesService.delete(bizMyfiles);
|
||||
return renderResult(Global.TRUE, text("删除文件信息成功!"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.jeesite.modules.biz.dao.BizFoldersDao">
|
||||
|
||||
<!-- 查询数据
|
||||
<select id="findList" resultType="BizFolders">
|
||||
SELECT ${sqlMap.column.toSql()}
|
||||
FROM ${sqlMap.table.toSql()}
|
||||
<where>
|
||||
${sqlMap.where.toSql()}
|
||||
</where>
|
||||
ORDER BY ${sqlMap.order.toSql()}
|
||||
</select> -->
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.jeesite.modules.biz.dao.BizMyfilesDao">
|
||||
|
||||
<!-- 查询数据
|
||||
<select id="findList" resultType="BizMyfiles">
|
||||
SELECT ${sqlMap.column.toSql()}
|
||||
FROM ${sqlMap.table.toSql()}
|
||||
<where>
|
||||
${sqlMap.where.toSql()}
|
||||
</where>
|
||||
ORDER BY ${sqlMap.order.toSql()}
|
||||
</select> -->
|
||||
|
||||
</mapper>
|
||||
52
web-vue/packages/biz/api/biz/folders.ts
Normal file
52
web-vue/packages/biz/api/biz/folders.ts
Normal file
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
* @author gaoxq
|
||||
*/
|
||||
import { defHttp } from '@jeesite/core/utils/http/axios';
|
||||
import { useGlobSetting } from '@jeesite/core/hooks/setting';
|
||||
import { BasicModel, Page } from '@jeesite/core/api/model/baseModel';
|
||||
import { UploadApiResult } from '@jeesite/core/api/sys/upload';
|
||||
import { UploadFileParams } from '@jeesite/types/axios';
|
||||
import { AxiosProgressEvent } from 'axios';
|
||||
|
||||
const { ctxPath, adminPath } = useGlobSetting();
|
||||
|
||||
export interface BizFolders extends BasicModel<BizFolders> {
|
||||
createTime?: string; // 记录时间
|
||||
folderId?: string; // 文件夹标识
|
||||
folderName: string; // 文件夹名称
|
||||
parentId?: string; // 父文件夹
|
||||
userName: string; // 用户姓名
|
||||
loginCode: string; // 用户名称
|
||||
updateTime?: string; // 更新时间
|
||||
isDeleted: number; // 是否删除
|
||||
description?: string; // 文件夹描述
|
||||
}
|
||||
|
||||
export const bizFoldersList = (params?: BizFolders | any) =>
|
||||
defHttp.get<BizFolders>({ url: adminPath + '/biz/folders/list', params });
|
||||
|
||||
export const bizFoldersListData = (params?: BizFolders | any) =>
|
||||
defHttp.post<Page<BizFolders>>({ url: adminPath + '/biz/folders/listData', params });
|
||||
|
||||
export const bizFoldersForm = (params?: BizFolders | any) =>
|
||||
defHttp.get<BizFolders>({ url: adminPath + '/biz/folders/form', params });
|
||||
|
||||
export const bizFoldersSave = (params?: any, data?: BizFolders | any) =>
|
||||
defHttp.postJson<BizFolders>({ url: adminPath + '/biz/folders/save', params, data });
|
||||
|
||||
export const bizFoldersImportData = (
|
||||
params: UploadFileParams,
|
||||
onUploadProgress: (progressEvent: AxiosProgressEvent) => void,
|
||||
) =>
|
||||
defHttp.uploadFile<UploadApiResult>(
|
||||
{
|
||||
url: ctxPath + adminPath + '/biz/folders/importData',
|
||||
onUploadProgress,
|
||||
},
|
||||
params,
|
||||
);
|
||||
|
||||
export const bizFoldersDelete = (params?: BizFolders | any) =>
|
||||
defHttp.get<BizFolders>({ url: adminPath + '/biz/folders/delete', params });
|
||||
58
web-vue/packages/biz/api/biz/myfiles.ts
Normal file
58
web-vue/packages/biz/api/biz/myfiles.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
/**
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
* @author gaoxq
|
||||
*/
|
||||
import { defHttp } from '@jeesite/core/utils/http/axios';
|
||||
import { useGlobSetting } from '@jeesite/core/hooks/setting';
|
||||
import { BasicModel, Page } from '@jeesite/core/api/model/baseModel';
|
||||
import { UploadApiResult } from '@jeesite/core/api/sys/upload';
|
||||
import { UploadFileParams } from '@jeesite/types/axios';
|
||||
import { AxiosProgressEvent } from 'axios';
|
||||
|
||||
const { ctxPath, adminPath } = useGlobSetting();
|
||||
|
||||
export interface BizMyfiles extends BasicModel<BizMyfiles> {
|
||||
createTime?: string; // 记录时间
|
||||
fileName: string; // 原始名称
|
||||
filePath?: string; // 存储路径
|
||||
fileHash?: string; // 文件MD5
|
||||
fileSize: number; // 文件大小
|
||||
fileExt?: string; // 文件扩展名
|
||||
mimeType?: string; // 文件类型
|
||||
folderId?: string; // 文件夹标识
|
||||
userName?: string; // 用户姓名
|
||||
loginCode?: string; // 用户名称
|
||||
downloadCount?: number; // 下载次数
|
||||
viewCount?: number; // 查看次数
|
||||
expireTime?: string; // 过期时间
|
||||
isDelete?: number; // 是否删除
|
||||
updateTime?: string; // 更新时间
|
||||
}
|
||||
|
||||
export const bizMyfilesList = (params?: BizMyfiles | any) =>
|
||||
defHttp.get<BizMyfiles>({ url: adminPath + '/biz/myfiles/list', params });
|
||||
|
||||
export const bizMyfilesListData = (params?: BizMyfiles | any) =>
|
||||
defHttp.post<Page<BizMyfiles>>({ url: adminPath + '/biz/myfiles/listData', params });
|
||||
|
||||
export const bizMyfilesForm = (params?: BizMyfiles | any) =>
|
||||
defHttp.get<BizMyfiles>({ url: adminPath + '/biz/myfiles/form', params });
|
||||
|
||||
export const bizMyfilesSave = (params?: any, data?: BizMyfiles | any) =>
|
||||
defHttp.postJson<BizMyfiles>({ url: adminPath + '/biz/myfiles/save', params, data });
|
||||
|
||||
export const bizMyfilesImportData = (
|
||||
params: UploadFileParams,
|
||||
onUploadProgress: (progressEvent: AxiosProgressEvent) => void,
|
||||
) =>
|
||||
defHttp.uploadFile<UploadApiResult>(
|
||||
{
|
||||
url: ctxPath + adminPath + '/biz/myfiles/importData',
|
||||
onUploadProgress,
|
||||
},
|
||||
params,
|
||||
);
|
||||
|
||||
export const bizMyfilesDelete = (params?: BizMyfiles | any) =>
|
||||
defHttp.get<BizMyfiles>({ url: adminPath + '/biz/myfiles/delete', params });
|
||||
139
web-vue/packages/biz/views/biz/folders/form.vue
Normal file
139
web-vue/packages/biz/views/biz/folders/form.vue
Normal file
@@ -0,0 +1,139 @@
|
||||
<!--
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
* @author gaoxq
|
||||
-->
|
||||
<template>
|
||||
<BasicDrawer
|
||||
v-bind="$attrs"
|
||||
:showFooter="true"
|
||||
:okAuth="'biz:folders:edit'"
|
||||
@register="registerDrawer"
|
||||
@ok="handleSubmit"
|
||||
width="70%"
|
||||
>
|
||||
<template #title>
|
||||
<Icon :icon="getTitle.icon" class="m-1 pr-1" />
|
||||
<span> {{ getTitle.value }} </span>
|
||||
</template>
|
||||
<BasicForm @register="registerForm" />
|
||||
</BasicDrawer>
|
||||
</template>
|
||||
<script lang="ts" setup name="ViewsBizFoldersForm">
|
||||
import { ref, unref, computed } from 'vue';
|
||||
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
|
||||
import { useMessage } from '@jeesite/core/hooks/web/useMessage';
|
||||
import { router } from '@jeesite/core/router';
|
||||
import { Icon } from '@jeesite/core/components/Icon';
|
||||
import { BasicForm, FormSchema, useForm } from '@jeesite/core/components/Form';
|
||||
import { BasicDrawer, useDrawerInner } from '@jeesite/core/components/Drawer';
|
||||
import { BizFolders, bizFoldersSave, bizFoldersForm } from '@jeesite/biz/api/biz/folders';
|
||||
|
||||
const emit = defineEmits(['success', 'register']);
|
||||
|
||||
const { t } = useI18n('biz.folders');
|
||||
const { showMessage } = useMessage();
|
||||
const { meta } = unref(router.currentRoute);
|
||||
const record = ref<BizFolders>({} as BizFolders);
|
||||
|
||||
const getTitle = computed(() => ({
|
||||
icon: meta.icon || 'i-ant-design:book-outlined',
|
||||
value: record.value.isNewRecord ? t('新增文件夹信息') : t('编辑文件夹信息'),
|
||||
}));
|
||||
|
||||
const inputFormSchemas: FormSchema<BizFolders>[] = [
|
||||
{
|
||||
label: t('文件夹名称'),
|
||||
field: 'folderName',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
maxlength: 255,
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: t('父文件夹'),
|
||||
field: 'parentId',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
maxlength: 52,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('用户姓名'),
|
||||
field: 'userName',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
maxlength: 32,
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: t('用户名称'),
|
||||
field: 'loginCode',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
maxlength: 32,
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: t('是否删除'),
|
||||
field: 'isDeleted',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
dictType: 'sys_yes_no',
|
||||
allowClear: true,
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: t('文件夹描述'),
|
||||
field: 'description',
|
||||
component: 'InputTextArea',
|
||||
componentProps: {
|
||||
maxlength: 500,
|
||||
},
|
||||
colProps: { md: 24, lg: 24 },
|
||||
},
|
||||
];
|
||||
|
||||
const [registerForm, { resetFields, setFieldsValue, validate }] = useForm<BizFolders>({
|
||||
labelWidth: 120,
|
||||
schemas: inputFormSchemas,
|
||||
baseColProps: { md: 24, lg: 12 },
|
||||
});
|
||||
|
||||
const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
|
||||
setDrawerProps({ loading: true });
|
||||
await resetFields();
|
||||
const res = await bizFoldersForm(data);
|
||||
record.value = (res.bizFolders || {}) as BizFolders;
|
||||
record.value.__t = new Date().getTime();
|
||||
await setFieldsValue(record.value);
|
||||
setDrawerProps({ loading: false });
|
||||
});
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const data = await validate();
|
||||
setDrawerProps({ confirmLoading: true });
|
||||
const params: any = {
|
||||
isNewRecord: record.value.isNewRecord,
|
||||
folderId: record.value.folderId || data.folderId,
|
||||
};
|
||||
// console.log('submit', params, data, record);
|
||||
const res = await bizFoldersSave(params, data);
|
||||
showMessage(res.message);
|
||||
setTimeout(closeDrawer);
|
||||
emit('success', data);
|
||||
} catch (error: any) {
|
||||
if (error && error.errorFields) {
|
||||
showMessage(error.message || t('common.validateError'));
|
||||
}
|
||||
console.log('error', error);
|
||||
} finally {
|
||||
setDrawerProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
103
web-vue/packages/biz/views/biz/folders/formImport.vue
Normal file
103
web-vue/packages/biz/views/biz/folders/formImport.vue
Normal file
@@ -0,0 +1,103 @@
|
||||
<!--
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
* @author gaoxq
|
||||
-->
|
||||
<template>
|
||||
<BasicModal
|
||||
v-bind="$attrs"
|
||||
:title="t('导入文件夹信息')"
|
||||
:okText="t('导入')"
|
||||
@register="registerModal"
|
||||
@ok="handleSubmit"
|
||||
:minHeight="120"
|
||||
:width="400"
|
||||
>
|
||||
<Upload accept=".xls,.xlsx" :file-list="fileList" :before-upload="beforeUpload" @remove="handleRemove">
|
||||
<a-button> <Icon icon="ant-design:upload-outlined" /> {{ t('选择文件') }} </a-button>
|
||||
<span class="ml-4">{{ uploadInfo }}</span>
|
||||
</Upload>
|
||||
<div class="ml-4 mt-4">
|
||||
{{ t('提示:仅允许导入“xls”或“xlsx”格式文件!') }}
|
||||
</div>
|
||||
<div class="mt-4">
|
||||
<a-button @click="handleDownloadTemplate()" type="text">
|
||||
<Icon icon="i-fa:file-excel-o" />
|
||||
{{ t('下载模板') }}
|
||||
</a-button>
|
||||
</div>
|
||||
</BasicModal>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import { Upload } from 'ant-design-vue';
|
||||
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
|
||||
import { useMessage } from '@jeesite/core/hooks/web/useMessage';
|
||||
import { useGlobSetting } from '@jeesite/core/hooks/setting';
|
||||
import { downloadByUrl } from '@jeesite/core/utils/file/download';
|
||||
import { Icon } from '@jeesite/core/components/Icon';
|
||||
import { BasicModal, useModalInner } from '@jeesite/core/components/Modal';
|
||||
import { bizFoldersImportData } from '@jeesite/biz/api/biz/folders';
|
||||
import { FileType } from 'ant-design-vue/es/upload/interface';
|
||||
import { AxiosProgressEvent } from 'axios';
|
||||
|
||||
const emit = defineEmits(['success', 'register']);
|
||||
|
||||
const { t } = useI18n('biz.folders');
|
||||
const { showMessage, showMessageModal } = useMessage();
|
||||
|
||||
const fileList = ref<FileType[]>([]);
|
||||
const uploadInfo = ref('');
|
||||
|
||||
const beforeUpload = (file: FileType) => {
|
||||
fileList.value = [file];
|
||||
return false;
|
||||
};
|
||||
|
||||
const handleRemove = () => {
|
||||
fileList.value = [];
|
||||
};
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(() => {
|
||||
fileList.value = [];
|
||||
uploadInfo.value = '';
|
||||
});
|
||||
|
||||
async function handleDownloadTemplate() {
|
||||
const { ctxAdminPath } = useGlobSetting();
|
||||
downloadByUrl({ url: ctxAdminPath + '/biz/folders/importTemplate' });
|
||||
}
|
||||
|
||||
function onUploadProgress(progressEvent: AxiosProgressEvent) {
|
||||
const complete = ((progressEvent.loaded / (progressEvent.total || 1)) * 100) | 0;
|
||||
if (complete != 100) {
|
||||
uploadInfo.value = t('正在导入,请稍候') + ' ' + complete + '%...';
|
||||
} else {
|
||||
uploadInfo.value = '';
|
||||
}
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
if (fileList.value.length == 0) {
|
||||
showMessage(t('请选择要导入的数据文件'));
|
||||
return;
|
||||
}
|
||||
setModalProps({ confirmLoading: true });
|
||||
const params = {
|
||||
file: fileList.value[0],
|
||||
};
|
||||
const { data } = await bizFoldersImportData(params, onUploadProgress);
|
||||
showMessageModal({ content: data.message });
|
||||
setTimeout(closeModal);
|
||||
emit('success');
|
||||
} catch (error: any) {
|
||||
if (error && error.errorFields) {
|
||||
showMessage(error.message || t('common.validateError'));
|
||||
}
|
||||
console.log('error', error);
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
258
web-vue/packages/biz/views/biz/folders/list.vue
Normal file
258
web-vue/packages/biz/views/biz/folders/list.vue
Normal file
@@ -0,0 +1,258 @@
|
||||
<!--
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
* @author gaoxq
|
||||
-->
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable">
|
||||
<template #tableTitle>
|
||||
<Icon :icon="getTitle.icon" class="m-1 pr-1" />
|
||||
<span> {{ getTitle.value }} </span>
|
||||
</template>
|
||||
<template #toolbar>
|
||||
<a-button type="default" :loading="loading" @click="handleExport()">
|
||||
<Icon icon="i-ant-design:download-outlined" /> {{ t('导出') }}
|
||||
</a-button>
|
||||
<a-button type="default" @click="handleImport()">
|
||||
<Icon icon="i-ant-design:import-outlined" /> {{ t('导入') }}
|
||||
</a-button>
|
||||
<a-button type="primary" @click="handleForm({})" v-auth="'biz:folders:edit'">
|
||||
<Icon icon="i-fluent:add-12-filled" /> {{ t('新增') }}
|
||||
</a-button>
|
||||
</template>
|
||||
<template #firstColumn="{ record }">
|
||||
<a @click="handleForm({ folderId: record.folderId })" :title="record.createTime">
|
||||
{{ record.createTime }}
|
||||
</a>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<InputForm @register="registerDrawer" @success="handleSuccess" />
|
||||
<FormImport @register="registerImportModal" @success="handleSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup name="ViewsBizFoldersList">
|
||||
import { onMounted, ref, unref } from 'vue';
|
||||
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
|
||||
import { useMessage } from '@jeesite/core/hooks/web/useMessage';
|
||||
import { useGlobSetting } from '@jeesite/core/hooks/setting';
|
||||
import { downloadByUrl } from '@jeesite/core/utils/file/download';
|
||||
import { router } from '@jeesite/core/router';
|
||||
import { Icon } from '@jeesite/core/components/Icon';
|
||||
import { BasicTable, BasicColumn, useTable } from '@jeesite/core/components/Table';
|
||||
import { BizFolders, bizFoldersList } from '@jeesite/biz/api/biz/folders';
|
||||
import { bizFoldersDelete, bizFoldersListData } from '@jeesite/biz/api/biz/folders';
|
||||
import { useDrawer } from '@jeesite/core/components/Drawer';
|
||||
import { useModal } from '@jeesite/core/components/Modal';
|
||||
import { FormProps } from '@jeesite/core/components/Form';
|
||||
import InputForm from './form.vue';
|
||||
import FormImport from './formImport.vue';
|
||||
|
||||
const { t } = useI18n('biz.folders');
|
||||
const { showMessage } = useMessage();
|
||||
const { meta } = unref(router.currentRoute);
|
||||
const record = ref<BizFolders>({} as BizFolders);
|
||||
|
||||
const getTitle = {
|
||||
icon: meta.icon || 'i-ant-design:book-outlined',
|
||||
value: meta.title || t('文件夹信息管理'),
|
||||
};
|
||||
const loading = ref(false);
|
||||
|
||||
const searchForm: FormProps<BizFolders> = {
|
||||
baseColProps: { md: 8, lg: 6 },
|
||||
labelWidth: 90,
|
||||
schemas: [
|
||||
{
|
||||
label: t('记录时间起'),
|
||||
field: 'createTime_gte',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
format: 'YYYY-MM-DD HH:mm',
|
||||
showTime: { format: 'HH:mm' },
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('记录时间止'),
|
||||
field: 'createTime_lte',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
format: 'YYYY-MM-DD HH:mm',
|
||||
showTime: { format: 'HH:mm' },
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('文件夹名称'),
|
||||
field: 'folderName',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: t('父文件夹'),
|
||||
field: 'parentId',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: t('用户名称'),
|
||||
field: 'loginCode',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: t('是否删除'),
|
||||
field: 'isDeleted',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
dictType: 'sys_yes_no',
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('文件夹描述'),
|
||||
field: 'description',
|
||||
component: 'Input',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const tableColumns: BasicColumn<BizFolders>[] = [
|
||||
{
|
||||
title: t('记录时间'),
|
||||
dataIndex: 'createTime',
|
||||
key: 'a.create_time',
|
||||
sorter: true,
|
||||
width: 230,
|
||||
align: 'left',
|
||||
slot: 'firstColumn',
|
||||
},
|
||||
{
|
||||
title: t('文件夹名称'),
|
||||
dataIndex: 'folderName',
|
||||
key: 'a.folder_name',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('父文件夹'),
|
||||
dataIndex: 'parentId',
|
||||
key: 'a.parent_id',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('用户姓名'),
|
||||
dataIndex: 'userName',
|
||||
key: 'a.user_name',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('用户名称'),
|
||||
dataIndex: 'loginCode',
|
||||
key: 'a.login_code',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('更新时间'),
|
||||
dataIndex: 'updateTime',
|
||||
key: 'a.update_time',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: t('是否删除'),
|
||||
dataIndex: 'isDeleted',
|
||||
key: 'a.is_deleted',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'center',
|
||||
dictType: 'sys_yes_no',
|
||||
},
|
||||
{
|
||||
title: t('文件夹描述'),
|
||||
dataIndex: 'description',
|
||||
key: 'a.description',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
];
|
||||
|
||||
const actionColumn: BasicColumn<BizFolders> = {
|
||||
width: 160,
|
||||
actions: (record: BizFolders) => [
|
||||
{
|
||||
icon: 'i-clarity:note-edit-line',
|
||||
title: t('编辑文件夹信息'),
|
||||
onClick: handleForm.bind(this, { folderId: record.folderId }),
|
||||
auth: 'biz:folders:edit',
|
||||
},
|
||||
{
|
||||
icon: 'i-ant-design:delete-outlined',
|
||||
color: 'error',
|
||||
title: t('删除文件夹信息'),
|
||||
popConfirm: {
|
||||
title: t('是否确认删除文件夹信息'),
|
||||
confirm: handleDelete.bind(this, record),
|
||||
},
|
||||
auth: 'biz:folders:edit',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const [registerTable, { reload, getForm }] = useTable<BizFolders>({
|
||||
api: bizFoldersListData,
|
||||
beforeFetch: (params) => {
|
||||
return params;
|
||||
},
|
||||
columns: tableColumns,
|
||||
actionColumn: actionColumn,
|
||||
formConfig: searchForm,
|
||||
showTableSetting: true,
|
||||
useSearchForm: true,
|
||||
canResize: true,
|
||||
});
|
||||
|
||||
onMounted(async () => {
|
||||
const res = await bizFoldersList();
|
||||
record.value = (res.bizFolders || {}) as BizFolders;
|
||||
await getForm().setFieldsValue(record.value);
|
||||
});
|
||||
|
||||
const [registerDrawer, { openDrawer }] = useDrawer();
|
||||
|
||||
function handleForm(record: Recordable) {
|
||||
openDrawer(true, record);
|
||||
}
|
||||
|
||||
async function handleExport() {
|
||||
loading.value = true;
|
||||
const { ctxAdminPath } = useGlobSetting();
|
||||
await downloadByUrl({
|
||||
url: ctxAdminPath + '/biz/folders/exportData',
|
||||
params: getForm().getFieldsValue(),
|
||||
});
|
||||
loading.value = false;
|
||||
}
|
||||
|
||||
const [registerImportModal, { openModal: importModal }] = useModal();
|
||||
|
||||
function handleImport() {
|
||||
importModal(true, {});
|
||||
}
|
||||
|
||||
async function handleDelete(record: Recordable) {
|
||||
const params = { folderId: record.folderId };
|
||||
const res = await bizFoldersDelete(params);
|
||||
showMessage(res.message);
|
||||
await handleSuccess(record);
|
||||
}
|
||||
|
||||
async function handleSuccess(record: Recordable) {
|
||||
await reload({ record });
|
||||
}
|
||||
</script>
|
||||
151
web-vue/packages/biz/views/biz/folders/select.ts
Normal file
151
web-vue/packages/biz/views/biz/folders/select.ts
Normal file
@@ -0,0 +1,151 @@
|
||||
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
|
||||
import { BasicColumn, BasicTableProps, FormProps } from '@jeesite/core/components/Table';
|
||||
import { bizFoldersListData } from '@jeesite/biz/api/biz/folders';
|
||||
|
||||
const { t } = useI18n('biz.folders');
|
||||
|
||||
const modalProps = {
|
||||
title: t('文件夹信息选择'),
|
||||
};
|
||||
|
||||
const searchForm: FormProps<BizFolders> = {
|
||||
baseColProps: { md: 8, lg: 6 },
|
||||
labelWidth: 90,
|
||||
schemas: [
|
||||
{
|
||||
label: t('记录时间起'),
|
||||
field: 'createTime_gte',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
format: 'YYYY-MM-DD HH:mm',
|
||||
showTime: { format: 'HH:mm' },
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('记录时间止'),
|
||||
field: 'createTime_lte',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
format: 'YYYY-MM-DD HH:mm',
|
||||
showTime: { format: 'HH:mm' },
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('文件夹名称'),
|
||||
field: 'folderName',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: t('父文件夹'),
|
||||
field: 'parentId',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: t('用户名称'),
|
||||
field: 'loginCode',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: t('是否删除'),
|
||||
field: 'isDeleted',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
dictType: 'sys_yes_no',
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('文件夹描述'),
|
||||
field: 'description',
|
||||
component: 'Input',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const tableColumns: BasicColumn<BizFolders>[] = [
|
||||
{
|
||||
title: t('记录时间'),
|
||||
dataIndex: 'createTime',
|
||||
key: 'a.create_time',
|
||||
sorter: true,
|
||||
width: 230,
|
||||
align: 'left',
|
||||
slot: 'firstColumn',
|
||||
},
|
||||
{
|
||||
title: t('文件夹名称'),
|
||||
dataIndex: 'folderName',
|
||||
key: 'a.folder_name',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('父文件夹'),
|
||||
dataIndex: 'parentId',
|
||||
key: 'a.parent_id',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('用户姓名'),
|
||||
dataIndex: 'userName',
|
||||
key: 'a.user_name',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('用户名称'),
|
||||
dataIndex: 'loginCode',
|
||||
key: 'a.login_code',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('更新时间'),
|
||||
dataIndex: 'updateTime',
|
||||
key: 'a.update_time',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: t('是否删除'),
|
||||
dataIndex: 'isDeleted',
|
||||
key: 'a.is_deleted',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'center',
|
||||
dictType: 'sys_yes_no',
|
||||
},
|
||||
{
|
||||
title: t('文件夹描述'),
|
||||
dataIndex: 'description',
|
||||
key: 'a.description',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
];
|
||||
|
||||
const tableProps: BasicTableProps = {
|
||||
api: bizFoldersListData,
|
||||
beforeFetch: (params) => {
|
||||
params['isAll'] = true;
|
||||
return params;
|
||||
},
|
||||
columns: tableColumns,
|
||||
formConfig: searchForm,
|
||||
rowKey: 'folderId',
|
||||
};
|
||||
|
||||
export default {
|
||||
modalProps,
|
||||
tableProps,
|
||||
itemCode: 'folderId',
|
||||
itemName: 'folderId',
|
||||
isShowCode: false,
|
||||
};
|
||||
182
web-vue/packages/biz/views/biz/myfiles/form.vue
Normal file
182
web-vue/packages/biz/views/biz/myfiles/form.vue
Normal file
@@ -0,0 +1,182 @@
|
||||
<!--
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
* @author gaoxq
|
||||
-->
|
||||
<template>
|
||||
<BasicDrawer
|
||||
v-bind="$attrs"
|
||||
:showFooter="true"
|
||||
:okAuth="'biz:myfiles:edit'"
|
||||
@register="registerDrawer"
|
||||
@ok="handleSubmit"
|
||||
width="70%"
|
||||
>
|
||||
<template #title>
|
||||
<Icon :icon="getTitle.icon" class="m-1 pr-1" />
|
||||
<span> {{ getTitle.value }} </span>
|
||||
</template>
|
||||
<BasicForm @register="registerForm" />
|
||||
</BasicDrawer>
|
||||
</template>
|
||||
<script lang="ts" setup name="ViewsBizMyfilesForm">
|
||||
import { ref, unref, computed } from 'vue';
|
||||
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
|
||||
import { useMessage } from '@jeesite/core/hooks/web/useMessage';
|
||||
import { router } from '@jeesite/core/router';
|
||||
import { Icon } from '@jeesite/core/components/Icon';
|
||||
import { BasicForm, FormSchema, useForm } from '@jeesite/core/components/Form';
|
||||
import { BasicDrawer, useDrawerInner } from '@jeesite/core/components/Drawer';
|
||||
import { BizMyfiles, bizMyfilesSave, bizMyfilesForm } from '@jeesite/biz/api/biz/myfiles';
|
||||
|
||||
const emit = defineEmits(['success', 'register']);
|
||||
|
||||
const { t } = useI18n('biz.myfiles');
|
||||
const { showMessage } = useMessage();
|
||||
const { meta } = unref(router.currentRoute);
|
||||
const record = ref<BizMyfiles>({} as BizMyfiles);
|
||||
|
||||
const getTitle = computed(() => ({
|
||||
icon: meta.icon || 'i-ant-design:book-outlined',
|
||||
value: record.value.isNewRecord ? t('新增文件信息') : t('编辑文件信息'),
|
||||
}));
|
||||
|
||||
const inputFormSchemas: FormSchema<BizMyfiles>[] = [
|
||||
{
|
||||
label: t('原始名称'),
|
||||
field: 'fileName',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
maxlength: 255,
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: t('文件大小'),
|
||||
field: 'fileSize',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
maxlength: 18,
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: t('文件扩展名'),
|
||||
field: 'fileExt',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
maxlength: 50,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('文件类型'),
|
||||
field: 'mimeType',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
maxlength: 100,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('文件夹标识'),
|
||||
field: 'folderId',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
maxlength: 52,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('下载次数'),
|
||||
field: 'downloadCount',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
maxlength: 8,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('查看次数'),
|
||||
field: 'viewCount',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
maxlength: 8,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('过期时间'),
|
||||
field: 'expireTime',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
format: 'YYYY-MM-DD HH:mm',
|
||||
showTime: { format: 'HH:mm' },
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('是否删除'),
|
||||
field: 'isDelete',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
dictType: 'sys_yes_no',
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('更新时间'),
|
||||
field: 'updateTime',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
format: 'YYYY-MM-DD HH:mm',
|
||||
showTime: { format: 'HH:mm' },
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('附件上传'),
|
||||
field: 'dataMap',
|
||||
component: 'Upload',
|
||||
componentProps: {
|
||||
loadTime: computed(() => record.value.__t),
|
||||
bizKey: computed(() => record.value.id),
|
||||
bizType: 'bizMyfiles_file',
|
||||
uploadType: 'all',
|
||||
},
|
||||
colProps: { md: 24, lg: 24 },
|
||||
},
|
||||
];
|
||||
|
||||
const [registerForm, { resetFields, setFieldsValue, validate }] = useForm<BizMyfiles>({
|
||||
labelWidth: 120,
|
||||
schemas: inputFormSchemas,
|
||||
baseColProps: { md: 24, lg: 12 },
|
||||
});
|
||||
|
||||
const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
|
||||
setDrawerProps({ loading: true });
|
||||
await resetFields();
|
||||
const res = await bizMyfilesForm(data);
|
||||
record.value = (res.bizMyfiles || {}) as BizMyfiles;
|
||||
record.value.__t = new Date().getTime();
|
||||
await setFieldsValue(record.value);
|
||||
setDrawerProps({ loading: false });
|
||||
});
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const data = await validate();
|
||||
setDrawerProps({ confirmLoading: true });
|
||||
const params: any = {
|
||||
isNewRecord: record.value.isNewRecord,
|
||||
tid: record.value.tid || data.tid,
|
||||
};
|
||||
// console.log('submit', params, data, record);
|
||||
const res = await bizMyfilesSave(params, data);
|
||||
showMessage(res.message);
|
||||
setTimeout(closeDrawer);
|
||||
emit('success', data);
|
||||
} catch (error: any) {
|
||||
if (error && error.errorFields) {
|
||||
showMessage(error.message || t('common.validateError'));
|
||||
}
|
||||
console.log('error', error);
|
||||
} finally {
|
||||
setDrawerProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
103
web-vue/packages/biz/views/biz/myfiles/formImport.vue
Normal file
103
web-vue/packages/biz/views/biz/myfiles/formImport.vue
Normal file
@@ -0,0 +1,103 @@
|
||||
<!--
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
* @author gaoxq
|
||||
-->
|
||||
<template>
|
||||
<BasicModal
|
||||
v-bind="$attrs"
|
||||
:title="t('导入文件信息')"
|
||||
:okText="t('导入')"
|
||||
@register="registerModal"
|
||||
@ok="handleSubmit"
|
||||
:minHeight="120"
|
||||
:width="400"
|
||||
>
|
||||
<Upload accept=".xls,.xlsx" :file-list="fileList" :before-upload="beforeUpload" @remove="handleRemove">
|
||||
<a-button> <Icon icon="ant-design:upload-outlined" /> {{ t('选择文件') }} </a-button>
|
||||
<span class="ml-4">{{ uploadInfo }}</span>
|
||||
</Upload>
|
||||
<div class="ml-4 mt-4">
|
||||
{{ t('提示:仅允许导入“xls”或“xlsx”格式文件!') }}
|
||||
</div>
|
||||
<div class="mt-4">
|
||||
<a-button @click="handleDownloadTemplate()" type="text">
|
||||
<Icon icon="i-fa:file-excel-o" />
|
||||
{{ t('下载模板') }}
|
||||
</a-button>
|
||||
</div>
|
||||
</BasicModal>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import { Upload } from 'ant-design-vue';
|
||||
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
|
||||
import { useMessage } from '@jeesite/core/hooks/web/useMessage';
|
||||
import { useGlobSetting } from '@jeesite/core/hooks/setting';
|
||||
import { downloadByUrl } from '@jeesite/core/utils/file/download';
|
||||
import { Icon } from '@jeesite/core/components/Icon';
|
||||
import { BasicModal, useModalInner } from '@jeesite/core/components/Modal';
|
||||
import { bizMyfilesImportData } from '@jeesite/biz/api/biz/myfiles';
|
||||
import { FileType } from 'ant-design-vue/es/upload/interface';
|
||||
import { AxiosProgressEvent } from 'axios';
|
||||
|
||||
const emit = defineEmits(['success', 'register']);
|
||||
|
||||
const { t } = useI18n('biz.myfiles');
|
||||
const { showMessage, showMessageModal } = useMessage();
|
||||
|
||||
const fileList = ref<FileType[]>([]);
|
||||
const uploadInfo = ref('');
|
||||
|
||||
const beforeUpload = (file: FileType) => {
|
||||
fileList.value = [file];
|
||||
return false;
|
||||
};
|
||||
|
||||
const handleRemove = () => {
|
||||
fileList.value = [];
|
||||
};
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(() => {
|
||||
fileList.value = [];
|
||||
uploadInfo.value = '';
|
||||
});
|
||||
|
||||
async function handleDownloadTemplate() {
|
||||
const { ctxAdminPath } = useGlobSetting();
|
||||
downloadByUrl({ url: ctxAdminPath + '/biz/myfiles/importTemplate' });
|
||||
}
|
||||
|
||||
function onUploadProgress(progressEvent: AxiosProgressEvent) {
|
||||
const complete = ((progressEvent.loaded / (progressEvent.total || 1)) * 100) | 0;
|
||||
if (complete != 100) {
|
||||
uploadInfo.value = t('正在导入,请稍候') + ' ' + complete + '%...';
|
||||
} else {
|
||||
uploadInfo.value = '';
|
||||
}
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
if (fileList.value.length == 0) {
|
||||
showMessage(t('请选择要导入的数据文件'));
|
||||
return;
|
||||
}
|
||||
setModalProps({ confirmLoading: true });
|
||||
const params = {
|
||||
file: fileList.value[0],
|
||||
};
|
||||
const { data } = await bizMyfilesImportData(params, onUploadProgress);
|
||||
showMessageModal({ content: data.message });
|
||||
setTimeout(closeModal);
|
||||
emit('success');
|
||||
} catch (error: any) {
|
||||
if (error && error.errorFields) {
|
||||
showMessage(error.message || t('common.validateError'));
|
||||
}
|
||||
console.log('error', error);
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
314
web-vue/packages/biz/views/biz/myfiles/list.vue
Normal file
314
web-vue/packages/biz/views/biz/myfiles/list.vue
Normal file
@@ -0,0 +1,314 @@
|
||||
<!--
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
* @author gaoxq
|
||||
-->
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable">
|
||||
<template #tableTitle>
|
||||
<Icon :icon="getTitle.icon" class="m-1 pr-1" />
|
||||
<span> {{ getTitle.value }} </span>
|
||||
</template>
|
||||
<template #toolbar>
|
||||
<a-button type="default" :loading="loading" @click="handleExport()">
|
||||
<Icon icon="i-ant-design:download-outlined" /> {{ t('导出') }}
|
||||
</a-button>
|
||||
<a-button type="default" @click="handleImport()">
|
||||
<Icon icon="i-ant-design:import-outlined" /> {{ t('导入') }}
|
||||
</a-button>
|
||||
<a-button type="primary" @click="handleForm({})" v-auth="'biz:myfiles:edit'">
|
||||
<Icon icon="i-fluent:add-12-filled" /> {{ t('新增') }}
|
||||
</a-button>
|
||||
</template>
|
||||
<template #firstColumn="{ record }">
|
||||
<a @click="handleForm({ tid: record.tid })" :title="record.createTime">
|
||||
{{ record.createTime }}
|
||||
</a>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<InputForm @register="registerDrawer" @success="handleSuccess" />
|
||||
<FormImport @register="registerImportModal" @success="handleSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup name="ViewsBizMyfilesList">
|
||||
import { onMounted, ref, unref } from 'vue';
|
||||
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
|
||||
import { useMessage } from '@jeesite/core/hooks/web/useMessage';
|
||||
import { useGlobSetting } from '@jeesite/core/hooks/setting';
|
||||
import { downloadByUrl } from '@jeesite/core/utils/file/download';
|
||||
import { router } from '@jeesite/core/router';
|
||||
import { Icon } from '@jeesite/core/components/Icon';
|
||||
import { BasicTable, BasicColumn, useTable } from '@jeesite/core/components/Table';
|
||||
import { BizMyfiles, bizMyfilesList } from '@jeesite/biz/api/biz/myfiles';
|
||||
import { bizMyfilesDelete, bizMyfilesListData } from '@jeesite/biz/api/biz/myfiles';
|
||||
import { useDrawer } from '@jeesite/core/components/Drawer';
|
||||
import { useModal } from '@jeesite/core/components/Modal';
|
||||
import { FormProps } from '@jeesite/core/components/Form';
|
||||
import InputForm from './form.vue';
|
||||
import FormImport from './formImport.vue';
|
||||
|
||||
const { t } = useI18n('biz.myfiles');
|
||||
const { showMessage } = useMessage();
|
||||
const { meta } = unref(router.currentRoute);
|
||||
const record = ref<BizMyfiles>({} as BizMyfiles);
|
||||
|
||||
const getTitle = {
|
||||
icon: meta.icon || 'i-ant-design:book-outlined',
|
||||
value: meta.title || t('文件信息管理'),
|
||||
};
|
||||
const loading = ref(false);
|
||||
|
||||
const searchForm: FormProps<BizMyfiles> = {
|
||||
baseColProps: { md: 8, lg: 6 },
|
||||
labelWidth: 90,
|
||||
schemas: [
|
||||
{
|
||||
label: t('记录时间起'),
|
||||
field: 'createTime_gte',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
format: 'YYYY-MM-DD HH:mm',
|
||||
showTime: { format: 'HH:mm' },
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('记录时间止'),
|
||||
field: 'createTime_lte',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
format: 'YYYY-MM-DD HH:mm',
|
||||
showTime: { format: 'HH:mm' },
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('原始名称'),
|
||||
field: 'fileName',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: t('文件MD5'),
|
||||
field: 'fileHash',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: t('文件夹标识'),
|
||||
field: 'folderId',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: t('用户名称'),
|
||||
field: 'loginCode',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: t('是否删除'),
|
||||
field: 'isDelete',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
dictType: 'sys_yes_no',
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const tableColumns: BasicColumn<BizMyfiles>[] = [
|
||||
{
|
||||
title: t('记录时间'),
|
||||
dataIndex: 'createTime',
|
||||
key: 'a.create_time',
|
||||
sorter: true,
|
||||
width: 230,
|
||||
align: 'left',
|
||||
slot: 'firstColumn',
|
||||
},
|
||||
{
|
||||
title: t('原始名称'),
|
||||
dataIndex: 'fileName',
|
||||
key: 'a.file_name',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('存储路径'),
|
||||
dataIndex: 'filePath',
|
||||
key: 'a.file_path',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('文件MD5'),
|
||||
dataIndex: 'fileHash',
|
||||
key: 'a.file_hash',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('文件大小'),
|
||||
dataIndex: 'fileSize',
|
||||
key: 'a.file_size',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: t('文件扩展名'),
|
||||
dataIndex: 'fileExt',
|
||||
key: 'a.file_ext',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('文件类型'),
|
||||
dataIndex: 'mimeType',
|
||||
key: 'a.mime_type',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('文件夹标识'),
|
||||
dataIndex: 'folderId',
|
||||
key: 'a.folder_id',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('用户姓名'),
|
||||
dataIndex: 'userName',
|
||||
key: 'a.user_name',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('用户名称'),
|
||||
dataIndex: 'loginCode',
|
||||
key: 'a.login_code',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('下载次数'),
|
||||
dataIndex: 'downloadCount',
|
||||
key: 'a.download_count',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: t('查看次数'),
|
||||
dataIndex: 'viewCount',
|
||||
key: 'a.view_count',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: t('过期时间'),
|
||||
dataIndex: 'expireTime',
|
||||
key: 'a.expire_time',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: t('是否删除'),
|
||||
dataIndex: 'isDelete',
|
||||
key: 'a.is_delete',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'center',
|
||||
dictType: 'sys_yes_no',
|
||||
},
|
||||
{
|
||||
title: t('更新时间'),
|
||||
dataIndex: 'updateTime',
|
||||
key: 'a.update_time',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'center',
|
||||
},
|
||||
];
|
||||
|
||||
const actionColumn: BasicColumn<BizMyfiles> = {
|
||||
width: 160,
|
||||
actions: (record: BizMyfiles) => [
|
||||
{
|
||||
icon: 'i-clarity:note-edit-line',
|
||||
title: t('编辑文件信息'),
|
||||
onClick: handleForm.bind(this, { tid: record.tid }),
|
||||
auth: 'biz:myfiles:edit',
|
||||
},
|
||||
{
|
||||
icon: 'i-ant-design:delete-outlined',
|
||||
color: 'error',
|
||||
title: t('删除文件信息'),
|
||||
popConfirm: {
|
||||
title: t('是否确认删除文件信息'),
|
||||
confirm: handleDelete.bind(this, record),
|
||||
},
|
||||
auth: 'biz:myfiles:edit',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const [registerTable, { reload, getForm }] = useTable<BizMyfiles>({
|
||||
api: bizMyfilesListData,
|
||||
beforeFetch: (params) => {
|
||||
return params;
|
||||
},
|
||||
columns: tableColumns,
|
||||
actionColumn: actionColumn,
|
||||
formConfig: searchForm,
|
||||
showTableSetting: true,
|
||||
useSearchForm: true,
|
||||
canResize: true,
|
||||
});
|
||||
|
||||
onMounted(async () => {
|
||||
const res = await bizMyfilesList();
|
||||
record.value = (res.bizMyfiles || {}) as BizMyfiles;
|
||||
await getForm().setFieldsValue(record.value);
|
||||
});
|
||||
|
||||
const [registerDrawer, { openDrawer }] = useDrawer();
|
||||
|
||||
function handleForm(record: Recordable) {
|
||||
openDrawer(true, record);
|
||||
}
|
||||
|
||||
async function handleExport() {
|
||||
loading.value = true;
|
||||
const { ctxAdminPath } = useGlobSetting();
|
||||
await downloadByUrl({
|
||||
url: ctxAdminPath + '/biz/myfiles/exportData',
|
||||
params: getForm().getFieldsValue(),
|
||||
});
|
||||
loading.value = false;
|
||||
}
|
||||
|
||||
const [registerImportModal, { openModal: importModal }] = useModal();
|
||||
|
||||
function handleImport() {
|
||||
importModal(true, {});
|
||||
}
|
||||
|
||||
async function handleDelete(record: Recordable) {
|
||||
const params = { tid: record.tid };
|
||||
const res = await bizMyfilesDelete(params);
|
||||
showMessage(res.message);
|
||||
await handleSuccess(record);
|
||||
}
|
||||
|
||||
async function handleSuccess(record: Recordable) {
|
||||
await reload({ record });
|
||||
}
|
||||
</script>
|
||||
207
web-vue/packages/biz/views/biz/myfiles/select.ts
Normal file
207
web-vue/packages/biz/views/biz/myfiles/select.ts
Normal file
@@ -0,0 +1,207 @@
|
||||
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
|
||||
import { BasicColumn, BasicTableProps, FormProps } from '@jeesite/core/components/Table';
|
||||
import { bizMyfilesListData } from '@jeesite/biz/api/biz/myfiles';
|
||||
|
||||
const { t } = useI18n('biz.myfiles');
|
||||
|
||||
const modalProps = {
|
||||
title: t('文件信息选择'),
|
||||
};
|
||||
|
||||
const searchForm: FormProps<BizMyfiles> = {
|
||||
baseColProps: { md: 8, lg: 6 },
|
||||
labelWidth: 90,
|
||||
schemas: [
|
||||
{
|
||||
label: t('记录时间起'),
|
||||
field: 'createTime_gte',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
format: 'YYYY-MM-DD HH:mm',
|
||||
showTime: { format: 'HH:mm' },
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('记录时间止'),
|
||||
field: 'createTime_lte',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
format: 'YYYY-MM-DD HH:mm',
|
||||
showTime: { format: 'HH:mm' },
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('原始名称'),
|
||||
field: 'fileName',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: t('文件MD5'),
|
||||
field: 'fileHash',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: t('文件夹标识'),
|
||||
field: 'folderId',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: t('用户名称'),
|
||||
field: 'loginCode',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: t('是否删除'),
|
||||
field: 'isDelete',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
dictType: 'sys_yes_no',
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const tableColumns: BasicColumn<BizMyfiles>[] = [
|
||||
{
|
||||
title: t('记录时间'),
|
||||
dataIndex: 'createTime',
|
||||
key: 'a.create_time',
|
||||
sorter: true,
|
||||
width: 230,
|
||||
align: 'left',
|
||||
slot: 'firstColumn',
|
||||
},
|
||||
{
|
||||
title: t('原始名称'),
|
||||
dataIndex: 'fileName',
|
||||
key: 'a.file_name',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('存储路径'),
|
||||
dataIndex: 'filePath',
|
||||
key: 'a.file_path',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('文件MD5'),
|
||||
dataIndex: 'fileHash',
|
||||
key: 'a.file_hash',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('文件大小'),
|
||||
dataIndex: 'fileSize',
|
||||
key: 'a.file_size',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: t('文件扩展名'),
|
||||
dataIndex: 'fileExt',
|
||||
key: 'a.file_ext',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('文件类型'),
|
||||
dataIndex: 'mimeType',
|
||||
key: 'a.mime_type',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('文件夹标识'),
|
||||
dataIndex: 'folderId',
|
||||
key: 'a.folder_id',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('用户姓名'),
|
||||
dataIndex: 'userName',
|
||||
key: 'a.user_name',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('用户名称'),
|
||||
dataIndex: 'loginCode',
|
||||
key: 'a.login_code',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('下载次数'),
|
||||
dataIndex: 'downloadCount',
|
||||
key: 'a.download_count',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: t('查看次数'),
|
||||
dataIndex: 'viewCount',
|
||||
key: 'a.view_count',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: t('过期时间'),
|
||||
dataIndex: 'expireTime',
|
||||
key: 'a.expire_time',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: t('是否删除'),
|
||||
dataIndex: 'isDelete',
|
||||
key: 'a.is_delete',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'center',
|
||||
dictType: 'sys_yes_no',
|
||||
},
|
||||
{
|
||||
title: t('更新时间'),
|
||||
dataIndex: 'updateTime',
|
||||
key: 'a.update_time',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'center',
|
||||
},
|
||||
];
|
||||
|
||||
const tableProps: BasicTableProps = {
|
||||
api: bizMyfilesListData,
|
||||
beforeFetch: (params) => {
|
||||
params['isAll'] = true;
|
||||
return params;
|
||||
},
|
||||
columns: tableColumns,
|
||||
formConfig: searchForm,
|
||||
rowKey: 'tid',
|
||||
};
|
||||
|
||||
export default {
|
||||
modalProps,
|
||||
tableProps,
|
||||
itemCode: 'tid',
|
||||
itemName: 'tid',
|
||||
isShowCode: false,
|
||||
};
|
||||
@@ -13,7 +13,7 @@
|
||||
<div
|
||||
class="tree-node folder-node"
|
||||
v-for="(folder, index) in folderList"
|
||||
:key="index"
|
||||
:key="folder.folderId"
|
||||
@click="toggleFolder(folder)"
|
||||
@dblclick="doubleClickFolder(folder)"
|
||||
:class="{ active: folder.expanded }"
|
||||
@@ -27,7 +27,7 @@
|
||||
:color="folder.expanded ? '#FF9800' : '#FFB74D'"
|
||||
/>
|
||||
</span>
|
||||
<span class="folder-name">{{ folder.name }}</span>
|
||||
<span class="folder-name">{{ folder.folderName }}</span>
|
||||
</div>
|
||||
<span class="tree-toggle">
|
||||
<Icon
|
||||
@@ -45,7 +45,7 @@
|
||||
class="icon-size"
|
||||
/>
|
||||
</span>
|
||||
<span class="file-name">{{ child.name }}</span>
|
||||
<span class="file-name">{{ child.type === 'folder' ? child.folderName : child.fileName }}</span>
|
||||
<span class="tree-toggle empty"></span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -71,7 +71,7 @@
|
||||
<div class="file-list">
|
||||
<Card
|
||||
v-for="(file, index) in fileList"
|
||||
:key="index"
|
||||
:key="file.tid"
|
||||
class="file-card"
|
||||
:hoverable="true"
|
||||
>
|
||||
@@ -80,9 +80,9 @@
|
||||
<div class="file-card-header">
|
||||
<div class="file-name-wrap">
|
||||
<span class="file-card-icon">📄</span>
|
||||
<span class="file-card-name" :title="file.name">{{ file.name }}</span>
|
||||
<span class="file-card-name" :title="file.fileName">{{ file.fileName }}</span>
|
||||
</div>
|
||||
<span class="file-card-size">{{ file.size }}</span>
|
||||
<span class="file-card-size">{{ formatFileSize(file.fileSize) }}</span>
|
||||
</div>
|
||||
<div class="card-divider"></div>
|
||||
<div class="file-card-actions">
|
||||
@@ -99,8 +99,9 @@
|
||||
<UploadModal @register="uploadregister" />
|
||||
<FolderModal @register="folderregister" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import { ref, computed } from 'vue';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { Input, Card } from 'ant-design-vue';
|
||||
import { Icon } from '@jeesite/core/components/Icon';
|
||||
@@ -112,85 +113,353 @@ const item = ref();
|
||||
const [uploadregister, { openModal: openUploadModal }] = useModal();
|
||||
const [folderregister, { openModal: openfolderModal }] = useModal();
|
||||
|
||||
// 定义类型接口
|
||||
interface FolderItem {
|
||||
name: string;
|
||||
expanded: boolean;
|
||||
children: Array<{
|
||||
name: string;
|
||||
type: 'folder' | 'file';
|
||||
}>;
|
||||
// 定义与后端实体类对应的类型接口
|
||||
interface BizFolders {
|
||||
createTime: Date | string; // 记录时间
|
||||
folderId: string; // 文件夹标识
|
||||
folderName: string; // 文件夹名称
|
||||
parentId: string; // 父文件夹
|
||||
userName: string; // 用户姓名
|
||||
loginCode: string; // 用户名称
|
||||
updateTime: Date | string; // 更新时间
|
||||
isDeleted: number; // 是否删除
|
||||
description: string; // 文件夹描述
|
||||
expanded?: boolean; // 前端扩展字段:是否展开
|
||||
children?: (BizFolders & { type: 'folder' }) | (BizMyfiles & { type: 'file' }); // 前端扩展字段:子节点
|
||||
}
|
||||
|
||||
interface FileItem {
|
||||
name: string;
|
||||
size: string;
|
||||
time: string;
|
||||
path: string;
|
||||
creator: string;
|
||||
interface BizMyfiles {
|
||||
createTime: Date | string; // 记录时间
|
||||
tid: number; // 文件标识
|
||||
fileName: string; // 原始名称
|
||||
filePath: string; // 存储路径
|
||||
fileHash: string; // 文件MD5
|
||||
fileSize: number; // 文件大小(字节)
|
||||
fileExt: string; // 文件扩展名
|
||||
mimeType: string; // 文件类型
|
||||
folderId: string; // 文件夹标识
|
||||
userName: string; // 用户姓名
|
||||
loginCode: string; // 用户名称
|
||||
downloadCount: number; // 下载次数
|
||||
viewCount: number; // 查看次数
|
||||
expireTime: Date | string; // 过期时间
|
||||
isDelete: number; // 是否删除
|
||||
updateTime: Date | string; // 更新时间
|
||||
}
|
||||
|
||||
const folderSearchText = ref<string>('');
|
||||
const fileSearchText = ref<string>('');
|
||||
|
||||
const folderList = ref<FolderItem[]>([
|
||||
// 重构文件夹列表数据,使用后端实体类字段
|
||||
const folderList = ref<BizFolders[]>([
|
||||
{
|
||||
name: '项目文档',
|
||||
folderId: 'folder_001',
|
||||
folderName: '项目文档',
|
||||
parentId: '',
|
||||
userName: '管理员',
|
||||
loginCode: 'admin',
|
||||
createTime: new Date().toISOString(),
|
||||
updateTime: new Date().toISOString(),
|
||||
isDeleted: 0,
|
||||
description: '项目相关文档',
|
||||
expanded: false,
|
||||
children: [
|
||||
{ name: '需求文档', type: 'folder' },
|
||||
{ name: '设计稿', type: 'folder' },
|
||||
{ name: '开发规范.docx', type: 'file' },
|
||||
{ name: '接口文档.pdf', type: 'file' }
|
||||
{
|
||||
folderId: 'folder_001_001',
|
||||
folderName: '需求文档',
|
||||
parentId: 'folder_001',
|
||||
userName: '管理员',
|
||||
loginCode: 'admin',
|
||||
createTime: new Date().toISOString(),
|
||||
updateTime: new Date().toISOString(),
|
||||
isDeleted: 0,
|
||||
description: '需求相关文档',
|
||||
type: 'folder'
|
||||
},
|
||||
{
|
||||
folderId: 'folder_001_002',
|
||||
folderName: '设计稿',
|
||||
parentId: 'folder_001',
|
||||
userName: '管理员',
|
||||
loginCode: 'admin',
|
||||
createTime: new Date().toISOString(),
|
||||
updateTime: new Date().toISOString(),
|
||||
isDeleted: 0,
|
||||
description: '设计相关文档',
|
||||
type: 'folder'
|
||||
},
|
||||
{
|
||||
tid: 1001,
|
||||
fileName: '开发规范.docx',
|
||||
filePath: '/项目文档/开发规范.docx',
|
||||
fileHash: 'md5_123456',
|
||||
fileSize: 1024 * 100, // 100KB
|
||||
fileExt: 'docx',
|
||||
mimeType: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||
folderId: 'folder_001',
|
||||
userName: '管理员',
|
||||
loginCode: 'admin',
|
||||
downloadCount: 0,
|
||||
viewCount: 0,
|
||||
expireTime: '',
|
||||
isDelete: 0,
|
||||
createTime: new Date().toISOString(),
|
||||
updateTime: new Date().toISOString(),
|
||||
type: 'file'
|
||||
},
|
||||
{
|
||||
tid: 1002,
|
||||
fileName: '接口文档.pdf',
|
||||
filePath: '/项目文档/接口文档.pdf',
|
||||
fileHash: 'md5_789012',
|
||||
fileSize: 1024 * 200, // 200KB
|
||||
fileExt: 'pdf',
|
||||
mimeType: 'application/pdf',
|
||||
folderId: 'folder_001',
|
||||
userName: '管理员',
|
||||
loginCode: 'admin',
|
||||
downloadCount: 0,
|
||||
viewCount: 0,
|
||||
expireTime: '',
|
||||
isDelete: 0,
|
||||
createTime: new Date().toISOString(),
|
||||
updateTime: new Date().toISOString(),
|
||||
type: 'file'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: '日常办公',
|
||||
folderId: 'folder_002',
|
||||
folderName: '日常办公',
|
||||
parentId: '',
|
||||
userName: '管理员',
|
||||
loginCode: 'admin',
|
||||
createTime: new Date().toISOString(),
|
||||
updateTime: new Date().toISOString(),
|
||||
isDeleted: 0,
|
||||
description: '日常办公文档',
|
||||
expanded: false,
|
||||
children: [
|
||||
{ name: '周报汇总', type: 'folder' },
|
||||
{ name: '会议纪要.docx', type: 'file' },
|
||||
{ name: '考勤表.xlsx', type: 'file' }
|
||||
{
|
||||
folderId: 'folder_002_001',
|
||||
folderName: '周报汇总',
|
||||
parentId: 'folder_002',
|
||||
userName: '管理员',
|
||||
loginCode: 'admin',
|
||||
createTime: new Date().toISOString(),
|
||||
updateTime: new Date().toISOString(),
|
||||
isDeleted: 0,
|
||||
description: '周报汇总',
|
||||
type: 'folder'
|
||||
},
|
||||
{
|
||||
tid: 1003,
|
||||
fileName: '会议纪要.docx',
|
||||
filePath: '/日常办公/会议纪要.docx',
|
||||
fileHash: 'md5_345678',
|
||||
fileSize: 1024 * 80, // 80KB
|
||||
fileExt: 'docx',
|
||||
mimeType: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||
folderId: 'folder_002',
|
||||
userName: '管理员',
|
||||
loginCode: 'admin',
|
||||
downloadCount: 0,
|
||||
viewCount: 0,
|
||||
expireTime: '',
|
||||
isDelete: 0,
|
||||
createTime: new Date().toISOString(),
|
||||
updateTime: new Date().toISOString(),
|
||||
type: 'file'
|
||||
},
|
||||
{
|
||||
tid: 1004,
|
||||
fileName: '考勤表.xlsx',
|
||||
filePath: '/日常办公/考勤表.xlsx',
|
||||
fileHash: 'md5_901234',
|
||||
fileSize: 1024 * 50, // 50KB
|
||||
fileExt: 'xlsx',
|
||||
mimeType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||
folderId: 'folder_002',
|
||||
userName: '管理员',
|
||||
loginCode: 'admin',
|
||||
downloadCount: 0,
|
||||
viewCount: 0,
|
||||
expireTime: '',
|
||||
isDelete: 0,
|
||||
createTime: new Date().toISOString(),
|
||||
updateTime: new Date().toISOString(),
|
||||
type: 'file'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: '第三季度',
|
||||
folderId: 'folder_003',
|
||||
folderName: '第三季度',
|
||||
parentId: '',
|
||||
userName: '管理员',
|
||||
loginCode: 'admin',
|
||||
createTime: new Date().toISOString(),
|
||||
updateTime: new Date().toISOString(),
|
||||
isDeleted: 0,
|
||||
description: '第三季度相关文档',
|
||||
expanded: false,
|
||||
children: [
|
||||
{ name: '业绩分析.pptx', type: 'file' },
|
||||
{ name: '预算规划.xlsx', type: 'file' },
|
||||
{ name: '工作总结.docx', type: 'file' }
|
||||
{
|
||||
tid: 1005,
|
||||
fileName: '业绩分析.pptx',
|
||||
filePath: '/第三季度/业绩分析.pptx',
|
||||
fileHash: 'md5_567890',
|
||||
fileSize: 1024 * 300, // 300KB
|
||||
fileExt: 'pptx',
|
||||
mimeType: 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
||||
folderId: 'folder_003',
|
||||
userName: '管理员',
|
||||
loginCode: 'admin',
|
||||
downloadCount: 0,
|
||||
viewCount: 0,
|
||||
expireTime: '',
|
||||
isDelete: 0,
|
||||
createTime: new Date().toISOString(),
|
||||
updateTime: new Date().toISOString(),
|
||||
type: 'file'
|
||||
},
|
||||
{
|
||||
tid: 1006,
|
||||
fileName: '预算规划.xlsx',
|
||||
filePath: '/第三季度/预算规划.xlsx',
|
||||
fileHash: 'md5_234567',
|
||||
fileSize: 1024 * 150, // 150KB
|
||||
fileExt: 'xlsx',
|
||||
mimeType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||
folderId: 'folder_003',
|
||||
userName: '管理员',
|
||||
loginCode: 'admin',
|
||||
downloadCount: 0,
|
||||
viewCount: 0,
|
||||
expireTime: '',
|
||||
isDelete: 0,
|
||||
createTime: new Date().toISOString(),
|
||||
updateTime: new Date().toISOString(),
|
||||
type: 'file'
|
||||
},
|
||||
{
|
||||
tid: 1007,
|
||||
fileName: '工作总结.docx',
|
||||
filePath: '/第三季度/工作总结.docx',
|
||||
fileHash: 'md5_890123',
|
||||
fileSize: 1024 * 120, // 120KB
|
||||
fileExt: 'docx',
|
||||
mimeType: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||
folderId: 'folder_003',
|
||||
userName: '管理员',
|
||||
loginCode: 'admin',
|
||||
downloadCount: 0,
|
||||
viewCount: 0,
|
||||
expireTime: '',
|
||||
isDelete: 0,
|
||||
createTime: new Date().toISOString(),
|
||||
updateTime: new Date().toISOString(),
|
||||
type: 'file'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: '临时文件',
|
||||
folderId: 'folder_004',
|
||||
folderName: '临时文件',
|
||||
parentId: '',
|
||||
userName: '管理员',
|
||||
loginCode: 'admin',
|
||||
createTime: new Date().toISOString(),
|
||||
updateTime: new Date().toISOString(),
|
||||
isDeleted: 0,
|
||||
description: '临时文件',
|
||||
expanded: false,
|
||||
children: [
|
||||
{ name: '草稿.txt', type: 'file' },
|
||||
{ name: '截图.png', type: 'file' }
|
||||
{
|
||||
tid: 1008,
|
||||
fileName: '草稿.txt',
|
||||
filePath: '/临时文件/草稿.txt',
|
||||
fileHash: 'md5_456789',
|
||||
fileSize: 1024 * 10, // 10KB
|
||||
fileExt: 'txt',
|
||||
mimeType: 'text/plain',
|
||||
folderId: 'folder_004',
|
||||
userName: '管理员',
|
||||
loginCode: 'admin',
|
||||
downloadCount: 0,
|
||||
viewCount: 0,
|
||||
expireTime: '',
|
||||
isDelete: 0,
|
||||
createTime: new Date().toISOString(),
|
||||
updateTime: new Date().toISOString(),
|
||||
type: 'file'
|
||||
},
|
||||
{
|
||||
tid: 1009,
|
||||
fileName: '截图.png',
|
||||
filePath: '/临时文件/截图.png',
|
||||
fileHash: 'md5_012345',
|
||||
fileSize: 1024 * 500, // 500KB
|
||||
fileExt: 'png',
|
||||
mimeType: 'image/png',
|
||||
folderId: 'folder_004',
|
||||
userName: '管理员',
|
||||
loginCode: 'admin',
|
||||
downloadCount: 0,
|
||||
viewCount: 0,
|
||||
expireTime: '',
|
||||
isDelete: 0,
|
||||
createTime: new Date().toISOString(),
|
||||
updateTime: new Date().toISOString(),
|
||||
type: 'file'
|
||||
}
|
||||
]
|
||||
}
|
||||
]);
|
||||
|
||||
const fileList = ref<FileItem[]>([]);
|
||||
const paths = ['项目文档/需求文档', '日常办公/周报汇总', '第三季度', '临时文件', '项目文档/设计稿'];
|
||||
// 重构文件列表数据,使用后端实体类字段
|
||||
const fileList = ref<BizMyfiles[]>([]);
|
||||
const folderPaths = ['folder_001', 'folder_002', 'folder_003', 'folder_004', 'folder_001_001'];
|
||||
const creators = ['张三', '李四', '王五', '赵六', '钱七'];
|
||||
|
||||
// 初始化文件列表数据
|
||||
for (let i = 0; i < 50; i++) {
|
||||
const randomPath = paths[Math.floor(Math.random() * paths.length)];
|
||||
const randomFolderId = folderPaths[Math.floor(Math.random() * folderPaths.length)];
|
||||
const randomCreator = creators[Math.floor(Math.random() * creators.length)];
|
||||
const randomSize = (Math.floor(Math.random() * 100) + 50) * 1024; // 转换为字节
|
||||
|
||||
fileList.value.push({
|
||||
name: `第三季度开始就大家思考爱睡觉的${i + 1}.docx`,
|
||||
size: `${Math.floor(Math.random() * 100) + 50}kb`,
|
||||
time: '2025-12-17 20:53',
|
||||
path: randomPath,
|
||||
creator: randomCreator
|
||||
tid: 2000 + i,
|
||||
fileName: `第三季度开始就大家思考爱睡觉的${i + 1}.docx`,
|
||||
filePath: `/${randomFolderId}/第三季度开始就大家思考爱睡觉的${i + 1}.docx`,
|
||||
fileHash: `md5_${Math.random().toString(16).substring(2, 10)}`,
|
||||
fileSize: randomSize,
|
||||
fileExt: 'docx',
|
||||
mimeType: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||
folderId: randomFolderId,
|
||||
userName: randomCreator,
|
||||
loginCode: randomCreator.toLowerCase(),
|
||||
downloadCount: 0,
|
||||
viewCount: 0,
|
||||
expireTime: '',
|
||||
isDelete: 0,
|
||||
createTime: new Date().toISOString(),
|
||||
updateTime: new Date().toISOString()
|
||||
});
|
||||
}
|
||||
|
||||
const toggleFolder = (targetFolder: FolderItem) => {
|
||||
// 文件大小格式化函数(字节转KB/MB)
|
||||
const formatFileSize = (bytes: number): string => {
|
||||
if (bytes < 1024) {
|
||||
return `${bytes}B`;
|
||||
} else if (bytes < 1024 * 1024) {
|
||||
return `${(bytes / 1024).toFixed(0)}KB`;
|
||||
} else {
|
||||
return `${(bytes / (1024 * 1024)).toFixed(1)}MB`;
|
||||
}
|
||||
};
|
||||
|
||||
const toggleFolder = (targetFolder: BizFolders) => {
|
||||
if (!targetFolder.expanded) {
|
||||
folderList.value.forEach(folder => {
|
||||
folder.expanded = false;
|
||||
@@ -199,7 +468,7 @@ const toggleFolder = (targetFolder: FolderItem) => {
|
||||
}
|
||||
};
|
||||
|
||||
const doubleClickFolder = (targetFolder: FolderItem) => {
|
||||
const doubleClickFolder = (targetFolder: BizFolders) => {
|
||||
if (targetFolder.expanded) {
|
||||
targetFolder.expanded = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user