Compare commits

...

22 Commits

Author SHA1 Message Date
616ab06f0e 后端 2025-12-30 00:56:14 +08:00
49a8256638 1 2025-12-29 01:19:33 +08:00
29cca0e4dd 保存进度! 2025-12-26 21:06:55 +08:00
5c410e3837 保存进度! 2025-12-25 23:37:43 +08:00
534d7c4d01 xxx 2025-12-01 18:42:37 +08:00
2ae751bc4c 保存进度! 2025-12-01 12:26:55 +08:00
cdc0f5b51b 保存进度 2025-11-30 23:32:12 +08:00
8e97044faa 保存进度 2025-11-30 14:59:27 +08:00
835e812d4e 保存进度! 2025-11-27 18:18:22 +08:00
bf6e78b423 保存进度 2025-11-26 09:11:13 +08:00
88ba348242 保存进度 2025-11-24 21:43:08 +08:00
51cf0da474 保存进度 2025-11-24 21:40:18 +08:00
de68525230 保存进度 2025-11-24 21:33:33 +08:00
207e5aeb0c 保存进度 2025-11-24 21:30:20 +08:00
91adce0fef 保存进度 2025-11-23 18:06:00 +08:00
1e20eeb0d1 保存进度! 2025-11-21 18:01:17 +08:00
d22b29f45d baocun 2025-11-20 00:21:22 +08:00
c9c2493671 保存进度 2025-11-19 01:13:28 +08:00
e73ce4b4b0 保存进度! 2025-11-18 19:37:20 +08:00
9e1fdcdd6a 保存进度! 2025-11-18 15:30:57 +08:00
de0b396bcb Merge branch 'feature-制度管理界面' of http://222.76.244.118:3000/CPICXIM/regulatory-management-system into feature-制度管理界面 2025-11-17 19:01:01 +08:00
5d7aee0e7c 保存进度! 2025-11-17 19:00:39 +08:00
23 changed files with 1059 additions and 183 deletions

View File

@@ -1,4 +1,4 @@
{ {
"java.configuration.updateBuildConfiguration": "interactive", "java.configuration.updateBuildConfiguration": "automatic",
"java.compile.nullAnalysis.mode": "automatic" "java.compile.nullAnalysis.mode": "automatic"
} }

View File

@@ -16,11 +16,11 @@
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>18</maven.compiler.source> <maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>18</maven.compiler.target> <maven.compiler.target>21</maven.compiler.target>
<spring.version>6.2.11</spring.version> <spring.version>6.2.11</spring.version>
<log4j.version>2.24.3</log4j.version> <log4j.version>2.25.3</log4j.version>
<jackson.version>2.18.3</jackson.version> <jackson.version>2.20.1</jackson.version>
</properties> </properties>
<dependencies> <dependencies>
@@ -76,6 +76,7 @@
<artifactId>log4j-api</artifactId> <artifactId>log4j-api</artifactId>
<version>${log4j.version}</version> <version>${log4j.version}</version>
</dependency> </dependency>
<!-- jackson --> <!-- jackson -->
<dependency> <dependency>
<groupId>com.fasterxml.jackson.core</groupId> <groupId>com.fasterxml.jackson.core</groupId>
@@ -90,7 +91,7 @@
<dependency> <dependency>
<groupId>com.fasterxml.jackson.core</groupId> <groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId> <artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version> <version>2.20</version>
</dependency> </dependency>
<dependency> <dependency>
@@ -107,7 +108,7 @@
<dependency> <dependency>
<groupId>commons-io</groupId> <groupId>commons-io</groupId>
<artifactId>commons-io</artifactId> <artifactId>commons-io</artifactId>
<version>2.18.0</version> <version>2.21.0</version>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@@ -2,7 +2,7 @@
* @Author: Kane Wang <wangkane@qq.com> * @Author: Kane Wang <wangkane@qq.com>
* @Date: 2025-10-16 09:46:42 * @Date: 2025-10-16 09:46:42
* @LastEditors: Kane Wang * @LastEditors: Kane Wang
* @LastModified: 2025-11-13 15:25:07 * @LastModified: 2025-12-01 18:42:31
* @FilePath: src/main/java/com/cpic/xim/utils/files/SaveUploadFile.java * @FilePath: src/main/java/com/cpic/xim/utils/files/SaveUploadFile.java
* @Description: * @Description:
* *
@@ -80,25 +80,34 @@ public class SaveUploadFile
return savedFiles; return savedFiles;
} }
/**
* 将files参数中上传的文件保存到tempFilePath指定的路径文件名加上毫秒数避免重复。
*
* @param files
* @param absoluteFilePath
* @return 返回UploadedFile对象数组
* @throws ProcessUploadedFileException
*/
public static Vector<UploadedFile> saveUploadFiles( public static Vector<UploadedFile> saveUploadFiles(
MultipartFile[] files, MultipartFile[] files,
String tempFilePath String absoluteFilePath,
String relativeFilePath
) )
throws ProcessUploadedFileException throws ProcessUploadedFileException
{ {
Vector<UploadedFile> savedFiles = new Vector<>(); Vector<UploadedFile> savedFiles = new Vector<>();
UploadedFile uploadedFile = null; UploadedFile uploadedFile = null;
// File dir = new File( tempFilePath ); // File dir = new File( tempFilePath );
String fileName = ""; String fileName = "";
String fullPath; String fullPath = null;
if ( !(tempFilePath.endsWith( "/" ) || tempFilePath.endsWith( "\\" )) ) if ( !(absoluteFilePath.endsWith( "/" ) || absoluteFilePath.endsWith( "\\" )) )
{ {
fullPath = tempFilePath + "/"; fullPath = absoluteFilePath + "/";
} }
else else
{ {
fullPath = tempFilePath; fullPath = absoluteFilePath;
} }
try try
@@ -114,19 +123,19 @@ public class SaveUploadFile
// 文件名前加上时间戳,避免覆盖 // 文件名前加上时间戳,避免覆盖
Long milliSecond = LocalDateTime.now().toInstant( ZoneOffset.of( "+8" ) ).toEpochMilli(); Long milliSecond = LocalDateTime.now().toInstant( ZoneOffset.of( "+8" ) ).toEpochMilli();
fileName = String.valueOf( milliSecond ) + " - " + file.getOriginalFilename(); fileName = String.valueOf( milliSecond ) + "-" + file.getOriginalFilename();
File destFile = new File( tempFilePath, fileName ); File destFile = new File( fullPath, fileName );
file.transferTo( destFile ); file.transferTo( destFile );
uploadedFile = new UploadedFile(fileName, fullPath); uploadedFile = new UploadedFile( fileName, fullPath, relativeFilePath );
savedFiles.add( uploadedFile ); savedFiles.add( uploadedFile );
} }
} }
catch ( IOException error ) catch ( IOException error )
{ {
throw new ProcessUploadedFileException( "临时目录" + tempFilePath + "保存文件" + fileName + "失败!" ); throw new ProcessUploadedFileException( "临时目录" + absoluteFilePath + "保存文件" + fileName + "失败!" );
} }
return savedFiles; return savedFiles;
@@ -135,14 +144,35 @@ public class SaveUploadFile
/** /**
* *
* @param originFilePath 文件路径 * @param originFilePath 文件路径
* @param newFilePath 新文件存放路径 * @param newFilePath 新文件存放路径
* @throws MoveUploadedFileException * @throws MoveUploadedFileException
*/ */
public static void MoveUploadedFile( public static void MoveUploadedFile(
String originFilePath, String originFilePath,
String newFilePath String newFilePath
) throws MoveUploadedFileException )
throws MoveUploadedFileException
{ {
// 防御性验证
File originFile = new File( originFilePath );
File dest = new File( newFilePath );
// 文件如果不存在就抛出异常
if ( originFile.exists() == false )
{
throw new MoveUploadedFileException( "文件不存在!" );
}
// 目的路径有同名文件
if ( dest.exists() == true )
{
throw new MoveUploadedFileException( "目的路径已存在同名文件!" );
}
// 不知道具体原因
if ( originFile.renameTo( dest ) == false )
{
throw new MoveUploadedFileException( "移动文件失败!" );
}
} }
} }

View File

@@ -2,19 +2,30 @@
* @Author: Kane Wang <wangkane@qq.com> * @Author: Kane Wang <wangkane@qq.com>
* @Date: 2025-10-31 17:33:13 * @Date: 2025-10-31 17:33:13
* @LastEditors: Kane Wang * @LastEditors: Kane Wang
* @LastModified: 2025-10-31 17:36:03 * @LastModified: 2025-12-26 21:58:32
* @FilePath: src/main/java/com/cpic/xim/web/controllers/fileupload/UploadedFile.java * @FilePath: src/main/java/com/cpic/xim/utils/files/UploadedFile.java
* @Description: * @Description:
* *
* Copyright (c) 2025 by Kane All rights reserved * Copyright (c) 2025 by Kane All rights reserved
*/ */
package com.cpic.xim.utils.files; package com.cpic.xim.utils.files;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* 描述上传文件的类。
*
*/
public class UploadedFile public class UploadedFile
{ {
@JsonProperty( "fileName" )
private String fileName; private String fileName;
private String localFilePath;
@JsonProperty( "absoluteFilePath" )
private String absoluteFilePath;
@JsonProperty( "relativeFilePath" )
private String relativeFilePath;
public String getFileName() public String getFileName()
{ {
@@ -26,19 +37,40 @@ public class UploadedFile
this.fileName = fileName; this.fileName = fileName;
} }
public String getLocalFilePath() public String getAbsoluteFilePath()
{ {
return localFilePath; return absoluteFilePath;
} }
public void setLocalFilePath( String localFilePath ) public void setAbsoluteFilePath( String absoluteFilePath )
{ {
this.localFilePath = localFilePath; this.absoluteFilePath = absoluteFilePath;
} }
public UploadedFile( String fileName, String localFilePath ) public String getRelativeFilePath()
{ {
this.fileName = fileName; return relativeFilePath;
this.localFilePath = localFilePath; }
public void setRelativeFilePath( String relativeFilePath )
{
this.relativeFilePath = relativeFilePath;
}
public UploadedFile()
{}
public UploadedFile( String fileName, String absoluteFilePath, String relativeFilePath )
{
this.fileName = fileName;
this.absoluteFilePath = absoluteFilePath;
this.relativeFilePath = relativeFilePath;
}
public UploadedFile( String fileName, String absoluteFilePath )
{
this.fileName = fileName;
this.absoluteFilePath = absoluteFilePath;
this.relativeFilePath = "";
} }
} }

View File

@@ -0,0 +1,51 @@
/**
* @Author: Kane Wang <wangkane@qq.com>
* @Date: 2025-11-17 17:49:58
* @LastEditors: Kane Wang
* @LastModified: 2025-11-18 15:19:46
* @FilePath: src/main/java/com/cpic/xim/web/controllers/fileupload/MoveFileRequest.java
* @Description:
*
* Copyright (c) 2025 by Kane All rights reserved
*/
package com.cpic.xim.web.controllers.fileupload;
import com.fasterxml.jackson.annotation.JsonProperty;
public class MoveFileRequest
{
@JsonProperty("originFilePath")
private String originFilePath;
@JsonProperty("destFilePath")
private String destFilePath;
public MoveFileRequest()
{}
public MoveFileRequest( String originFilePath, String destFilePath )
{
this.originFilePath = originFilePath;
this.destFilePath = destFilePath;
}
public String getOriginFilePath()
{
return originFilePath;
}
public void setOriginFilePath( String originFilePath )
{
this.originFilePath = originFilePath;
}
public String getDestFilePath()
{
return destFilePath;
}
public void setDestFilePath( String destFilePath )
{
this.destFilePath = destFilePath;
}
}

View File

@@ -0,0 +1,48 @@
/**
* @Author: Kane Wang <wangkane@qq.com>
* @Date: 2025-11-17 17:31:15
* @LastEditors: Kane Wang
* @LastModified: 2025-11-17 17:31:16
* @FilePath: src/main/java/com/cpic/xim/web/controllers/fileupload/MoveFileResult.java
* @Description:
*
* Copyright (c) 2025 by Kane All rights reserved
*/
package com.cpic.xim.web.controllers.fileupload;
import com.cpic.xim.web.controllers.QueryResponse;
import com.fasterxml.jackson.annotation.JsonProperty;
public class MoveFileResponse extends QueryResponse
{
@JsonProperty("new-file-path")
private String newFilePath;
public MoveFileResponse()
{
super();
}
public MoveFileResponse(
boolean success,
String message,
String newFilePath
)
{
super( success, message );
this.newFilePath = newFilePath;
}
public String getNewFilePath()
{
return newFilePath;
}
public void setNewFilePath( String newFilePath )
{
this.newFilePath = newFilePath;
}
}

View File

@@ -14,6 +14,7 @@ import java.io.File;
import java.util.Vector; import java.util.Vector;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
@@ -21,6 +22,7 @@ import org.springframework.web.multipart.MultipartFile;
import com.cpic.xim.utils.files.SaveUploadFile; import com.cpic.xim.utils.files.SaveUploadFile;
import com.cpic.xim.utils.files.UploadedFile; import com.cpic.xim.utils.files.UploadedFile;
import com.cpic.xim.utils.files.exceptions.MoveUploadedFileException;
import com.cpic.xim.utils.files.exceptions.ProcessUploadedFileException; import com.cpic.xim.utils.files.exceptions.ProcessUploadedFileException;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
@@ -28,7 +30,7 @@ import jakarta.servlet.http.HttpServletRequest;
// @SuppressWarnings( "unused" ) // @SuppressWarnings( "unused" )
@Controller @Controller
@RequestMapping( path = "/file" ) @RequestMapping( path = "/file" )
public class FileUpload public class UploadFileController
{ {
/** /**
* 接收上传文件并保存到临时目录 * 接收上传文件并保存到临时目录
@@ -44,28 +46,29 @@ public class FileUpload
*/ */
@RequestMapping( path = "/file-upload.do" ) @RequestMapping( path = "/file-upload.do" )
@ResponseBody @ResponseBody
public FileUploadResult saveUploadFile( public UploadFileResponse saveUploadFile(
@RequestParam( "file-name" ) String fileName, @RequestParam( "fileName" ) String fileName,
@RequestParam( "files" ) MultipartFile file, @RequestParam( "files" ) MultipartFile file,
HttpServletRequest request HttpServletRequest request
) )
{ {
// session id用来创建临时目录避免重复 // session id用来创建临时目录避免重复
String sessionID = request.getSession().getId(); String sessionID = request.getSession().getId();
FileUploadResult result = new FileUploadResult(); UploadFileResponse result = new UploadFileResponse();
MultipartFile[] files = new MultipartFile[1]; MultipartFile[] files = new MultipartFile[1];
result.setSuccess( true ); result.setSuccess( true );
result.setMessage( "上传成功!" ); result.setMessage( "上传成功!" );
String filePath = request.getServletContext().getRealPath( "/temp/upload/" + sessionID ); String relativeFilePath = "/temp/upload/" + sessionID;
File dir = new File( filePath ); String absolutefilePath = request.getServletContext().getRealPath( relativeFilePath );
File dir = new File( absolutefilePath );
// 创建临时目录 // 创建临时目录
if ( (!dir.exists()) && (!dir.mkdirs()) ) if ( (!dir.exists()) && (!dir.mkdirs()) )
{ {
result.setSuccess( false ); result.setSuccess( false );
result.setMessage( "创建临时目录失败:" + filePath ); result.setMessage( "创建临时目录失败:" + absolutefilePath );
return result; return result;
} }
@@ -74,7 +77,9 @@ public class FileUpload
{ {
files[0] = file; files[0] = file;
Vector<UploadedFile> uploadFiles = SaveUploadFile.saveUploadFiles( files, filePath ); Vector<UploadedFile> uploadFiles = SaveUploadFile.saveUploadFiles( files,
absolutefilePath,
relativeFilePath );
result.setFileList( uploadFiles ); result.setFileList( uploadFiles );
} }
@@ -86,4 +91,28 @@ public class FileUpload
return result; return result;
} }
@RequestMapping( path = "/move-file.do" )
@ResponseBody
public MoveFileResponse moveFile( @RequestBody MoveFileRequest request )
{
MoveFileResponse response = new MoveFileResponse( false, null, null );
try
{
SaveUploadFile.MoveUploadedFile( request.getOriginFilePath(), request.getDestFilePath() );
response.setSuccess( true );
response.setMessage( "移动文件路径完成!" );
response.setNewFilePath( request.getDestFilePath() );
}
catch ( MoveUploadedFileException error )
{
response.setSuccess( false );
response.setMessage( error.getMessage() );
response.setNewFilePath( request.getDestFilePath() );
}
return response;
}
} }

View File

@@ -23,9 +23,9 @@ import com.cpic.xim.web.controllers.QueryResponse;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
@SuppressWarnings( "unused" ) @SuppressWarnings( "unused" )
public class FileUploadResult extends QueryResponse public class UploadFileResponse extends QueryResponse
{ {
public FileUploadResult() public UploadFileResponse()
{ {
super(); super();
} }
@@ -37,7 +37,7 @@ public class FileUploadResult extends QueryResponse
* @param message 消息字符串 * @param message 消息字符串
* @param fileList 文件绝对路径字符串数组 * @param fileList 文件绝对路径字符串数组
*/ */
public FileUploadResult( public UploadFileResponse(
boolean success, boolean success,
String message, String message,
Vector<UploadedFile> fileList Vector<UploadedFile> fileList

View File

@@ -0,0 +1,69 @@
/**
* @Author: Kane Wang <wangkane@qq.com>
* @Date: 2025-12-26 17:16:22
* @LastEditors: Kane Wang
* @LastModified: 2025-12-26 17:16:22
* @FilePath: src/main/java/com/cpic/xim/web/controllers/regulatory/AddNewRegulatoryController.java
* @Description: 新增制度的控制器
*
* Copyright (c) 2025 by Kane All rights reserved
*/
package com.cpic.xim.web.controllers.regulatory;
import java.io.File;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.cpic.xim.utils.files.UploadedFile;
@Controller
@RequestMapping( "/regulatory" )
public class AddNewRegulatoryController
{
// 制度库文件的基础目录
private static final String baseDirectory = "D:/制度库/";
@RequestMapping( path = "/add-new-regulatory.do", method = RequestMethod.POST )
@ResponseBody
public static AddNewRegulatoryResponse addNewRegulatory( @RequestBody AddNewRegulatoryRequest request )
{
AddNewRegulatoryResponse response = new AddNewRegulatoryResponse();
// 验证文件是否存在,并判断目睹路径是否有同名文件存在
for ( UploadedFile file : request.getRegulatoryFiles() )
{
String destFilePath = baseDirectory + "/" + request.getRegulatoryName() + "/" + file.getFileName();
File uploadFile = new File( file.getAbsoluteFilePath() );
File dest = new File( destFilePath );
if ( uploadFile.exists() == false )
{
response.setSuccess( false );
response.setMessage( "文件" + file.getAbsoluteFilePath() + "不存在!" );
return response;
}
// 判断目的路径是否有同名文件
if ( dest.exists() == true )
{
response.setSuccess( false );
response.setMessage( "文件" + file.getAbsoluteFilePath() + "存在同名文件!" );
return response;
}
}
// 复制文件
for ( UploadedFile file : request.getRegulatoryFiles() )
{
File uploadFile = new File( file.getAbsoluteFilePath() );
}
return response;
}
}

View File

@@ -0,0 +1,108 @@
/**
* @Author: Kane Wang <wangkane@qq.com>
* @Date: 2025-12-26 17:25:13
* @LastEditors: Kane Wang
* @LastModified: 2025-12-26 21:23:04
* @FilePath: src/main/java/com/cpic/xim/web/controllers/regulatory/AddNewRegulatoryRequest.java
* @Description:
*
* Copyright (c) 2025 by Kane All rights reserved
*/
package com.cpic.xim.web.controllers.regulatory;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.cpic.xim.utils.files.UploadedFile;
import java.util.Vector;
public class AddNewRegulatoryRequest
{
public AddNewRegulatoryRequest()
{
this.regulatoryName = "";
this.departmentName = "";
this.releaseYear = "";
this.comment = "";
this.regulatoryFiles = new Vector<UploadedFile>();
}
public AddNewRegulatoryRequest(
String regulatoryName,
String departmentName,
String releaseYear,
String comment,
Vector<UploadedFile> regulatoryFiles
)
{
this.regulatoryName = regulatoryName;
this.departmentName = departmentName;
this.releaseYear = releaseYear;
this.comment = comment;
this.regulatoryFiles = regulatoryFiles;
}
public String getRegulatoryName()
{
return regulatoryName;
}
public void setRegulatoryName( String regulatoryName )
{
this.regulatoryName = regulatoryName;
}
public String getDepartmentName()
{
return departmentName;
}
public void setDepartmentName( String departmentName )
{
this.departmentName = departmentName;
}
public String getReleaseYear()
{
return releaseYear;
}
public void setReleaseYear( String releaseYear )
{
this.releaseYear = releaseYear;
}
public String getComment()
{
return comment;
}
public void setComment( String comment )
{
this.comment = comment;
}
public Vector<UploadedFile> getRegulatoryFiles()
{
return regulatoryFiles;
}
public void setRegulatoryFiles( Vector<UploadedFile> regulatoryFiles )
{
this.regulatoryFiles = regulatoryFiles;
}
@JsonProperty("regulatory_name")
private String regulatoryName;
@JsonProperty("department_name")
private String departmentName;
@JsonProperty("release_year")
private String releaseYear;
@JsonProperty("comment")
private String comment;
@JsonProperty("regulatory_files")
private Vector<UploadedFile> regulatoryFiles;
}

View File

@@ -0,0 +1,22 @@
/**
* @Author: Kane Wang <wangkane@qq.com>
* @Date: 2025-12-26 21:42:12
* @LastEditors: Kane Wang
* @LastModified: 2025-12-26 21:43:54
* @FilePath: src/main/java/com/cpic/xim/web/controllers/regulatory/AddNewRegulatoryResponse.java
* @Description:
*
* Copyright (c) 2025 by Kane All rights reserved
*/
package com.cpic.xim.web.controllers.regulatory;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.cpic.xim.web.controllers.QueryResponse;
public class AddNewRegulatoryResponse extends QueryResponse
{
public AddNewRegulatoryResponse()
{
super( false, "");
}
}

View File

@@ -13,4 +13,9 @@ VITE_APP_MOCK_DATA=true
VITE_APP_CORS_ORIGIN=http://localhost:3000 VITE_APP_CORS_ORIGIN=http://localhost:3000
VITE_APP_TIMEOUT=5000 VITE_APP_TIMEOUT=5000
VITE_APP_RETRY_ATTEMPTS=3 VITE_APP_RETRY_ATTEMPTS=3
VITE_APP_CACHE_ENABLED=true VITE_APP_CACHE_ENABLED=true
#上传文件
VITE_APP_URL_UPLOAD_FILE=http://222.76.244.118:8081/RegulatoryManagementBackend/file/file-upload.do
VITE_APP_URL_MOVE_FILE=http://222.76.244.118:8081/RegulatoryManagementBackend/file/move-file.do
VITE_APP_URL_PREFIX=http://222.76.244.118:8081/RegulatoryManagementBackend/

View File

@@ -21,7 +21,7 @@ module.exports = {
}, },
extends:["eslint:recommended",], extends:["eslint:recommended",],
rules:{ rules:{
indent: ["warn", 4,], // indent: ["warn", 4,],
// 圆括号中的空格,为空不加空格,紧跟花括号、方括号、圆括号时也不加入空格 // 圆括号中的空格,为空不加空格,紧跟花括号、方括号、圆括号时也不加入空格
"space-in-parens": ["error", "always", { exceptions: ["{}", "[]", "()", "empty",], },], "space-in-parens": ["error", "always", { exceptions: ["{}", "[]", "()", "empty",], },],
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off", "no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
@@ -81,7 +81,7 @@ module.exports = {
"plugin:@typescript-eslint/recommended", "plugin:@typescript-eslint/recommended",
], ],
rules: { rules: {
indent: ["warn", 4,], // indent: ["warn", 4,],
"no-trailing-spaces": ["error", {"ignoreComments": true,},], "no-trailing-spaces": ["error", {"ignoreComments": true,},],
// 圆括号中的空格,为空不加空格,紧跟花括号、方括号、圆括号时也不加入空格 // 圆括号中的空格,为空不加空格,紧跟花括号、方括号、圆括号时也不加入空格
"space-in-parens": ["error", "always", { exceptions: ["{}", "[]", "()", "empty",], },], "space-in-parens": ["error", "always", { exceptions: ["{}", "[]", "()", "empty",], },],
@@ -121,7 +121,7 @@ module.exports = {
},], },],
// typescript // typescript
// "@typescript-eslint/indent": ["warn", 4,], // "@typescript-eslint/indent": ["warn", 4,],
"@stylistic/indent": ["warn", 4,], "@stylistic/indent": ["warn", 4, { "SwitchCase": 1, },],
"@typescript-eslint/no-explicit-any": "warn", "@typescript-eslint/no-explicit-any": "warn",
// "@typescript-eslint/no-unsafe-argument": "warn", // "@typescript-eslint/no-unsafe-argument": "warn",
"@typescript-eslint/no-extra-semi": "off", "@typescript-eslint/no-extra-semi": "off",
@@ -173,7 +173,7 @@ module.exports = {
"@typescript-eslint/no-explicit-any": "off", "@typescript-eslint/no-explicit-any": "off",
// "@typescript-eslint/no-unsafe-argument": "warn", // "@typescript-eslint/no-unsafe-argument": "warn",
// "@typescript-eslint/indent": ["error", 4,], // "@typescript-eslint/indent": ["error", 4,],
"@stylistic/indent": ["warn", 4,], "@stylistic/indent": ["warn", 4, { "SwitchCase": 1, },],
"@typescript-eslint/no-extra-semi": "off", "@typescript-eslint/no-extra-semi": "off",
"@typescript-eslint/no-inferrable-types": "off", "@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-unused-vars": "warn", "@typescript-eslint/no-unused-vars": "warn",

View File

@@ -14,11 +14,11 @@
}, },
"devDependencies": { "devDependencies": {
"@element-plus/icons-vue": "^2.3.2", "@element-plus/icons-vue": "^2.3.2",
"@stylistic/eslint-plugin": "^5.5.0", "@stylistic/eslint-plugin": "^5.6.1",
"@types/node": "^24.10.1", "@types/node": "^24.10.1",
"@typescript-eslint/eslint-plugin": "^8.46.4", "@typescript-eslint/eslint-plugin": "^8.47.0",
"@typescript-eslint/parser": "^8.46.4", "@typescript-eslint/parser": "^8.47.0",
"@vitejs/plugin-vue": "^6.0.1", "@vitejs/plugin-vue": "^6.0.2",
"@vue-office/docx": "^1.6.3", "@vue-office/docx": "^1.6.3",
"@vue-office/excel": "^1.7.14", "@vue-office/excel": "^1.7.14",
"@vue-office/pdf": "^2.0.10", "@vue-office/pdf": "^2.0.10",
@@ -26,15 +26,15 @@
"axios": "^1.13.2", "axios": "^1.13.2",
"element-plus": "^2.11.8", "element-plus": "^2.11.8",
"eslint": "^9.39.1", "eslint": "^9.39.1",
"eslint-plugin-vue": "^10.5.1", "eslint-plugin-vue": "^10.6.0",
"path": "^0.12.7", "path": "^0.12.7",
"sass": "^1.94.0", "sass": "^1.94.2",
"typescript": "~5.9.3", "typescript": "~5.9.3",
"vite": "^7.2.2", "vite": "^7.2.4",
"vue-demi": "^0.14.10", "vue-demi": "^0.14.10",
"vue-eslint-parser": "^10.2.0", "vue-eslint-parser": "^10.2.0",
"vue-pdf-embed": "^2.1.3", "vue-pdf-embed": "^2.1.3",
"vue-tsc": "^3.1.3" "vue-tsc": "^3.1.5"
} }
}, },
"node_modules/@babel/helper-string-parser": { "node_modules/@babel/helper-string-parser": {
@@ -1391,9 +1391,9 @@
} }
}, },
"node_modules/@rolldown/pluginutils": { "node_modules/@rolldown/pluginutils": {
"version": "1.0.0-beta.29", "version": "1.0.0-beta.50",
"resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-beta.29.tgz", "resolved": "https://registry.npmmirror.com/@rolldown/pluginutils/-/pluginutils-1.0.0-beta.50.tgz",
"integrity": "sha512-NIJgOsMjbxAXvoGq/X0gD7VPMQ8j9g0BiDaNjVNVjvl+iKXxL3Jre0v31RmBYeLEmkbj2s02v8vFTbUXi5XS2Q==", "integrity": "sha512-5e76wQiQVeL1ICOZVUg4LSOVYg9jyhGCin+icYozhsUzM+fHE7kddi1bdiE0jwVqTfkjba3jUFbEkoC9WkdvyA==",
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
@@ -1678,14 +1678,14 @@
] ]
}, },
"node_modules/@stylistic/eslint-plugin": { "node_modules/@stylistic/eslint-plugin": {
"version": "5.5.0", "version": "5.6.1",
"resolved": "https://registry.npmmirror.com/@stylistic/eslint-plugin/-/eslint-plugin-5.5.0.tgz", "resolved": "https://registry.npmmirror.com/@stylistic/eslint-plugin/-/eslint-plugin-5.6.1.tgz",
"integrity": "sha512-IeZF+8H0ns6prg4VrkhgL+yrvDXWDH2cKchrbh80ejG9dQgZWp10epHMbgRuQvgchLII/lfh6Xn3lu6+6L86Hw==", "integrity": "sha512-JCs+MqoXfXrRPGbGmho/zGS/jMcn3ieKl/A8YImqib76C8kjgZwq5uUFzc30lJkMvcchuRn6/v8IApLxli3Jyw==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@eslint-community/eslint-utils": "^4.9.0", "@eslint-community/eslint-utils": "^4.9.0",
"@typescript-eslint/types": "^8.46.1", "@typescript-eslint/types": "^8.47.0",
"eslint-visitor-keys": "^4.2.1", "eslint-visitor-keys": "^4.2.1",
"espree": "^10.4.0", "espree": "^10.4.0",
"estraverse": "^5.3.0", "estraverse": "^5.3.0",
@@ -1762,17 +1762,17 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/@typescript-eslint/eslint-plugin": { "node_modules/@typescript-eslint/eslint-plugin": {
"version": "8.46.4", "version": "8.47.0",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.46.4.tgz", "resolved": "https://registry.npmmirror.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.47.0.tgz",
"integrity": "sha512-R48VhmTJqplNyDxCyqqVkFSZIx1qX6PzwqgcXn1olLrzxcSBDlOsbtcnQuQhNtnNiJ4Xe5gREI1foajYaYU2Vg==", "integrity": "sha512-fe0rz9WJQ5t2iaLfdbDc9T80GJy0AeO453q8C3YCilnGozvOyCG5t+EZtg7j7D88+c3FipfP/x+wzGnh1xp8ZA==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@eslint-community/regexpp": "^4.10.0", "@eslint-community/regexpp": "^4.10.0",
"@typescript-eslint/scope-manager": "8.46.4", "@typescript-eslint/scope-manager": "8.47.0",
"@typescript-eslint/type-utils": "8.46.4", "@typescript-eslint/type-utils": "8.47.0",
"@typescript-eslint/utils": "8.46.4", "@typescript-eslint/utils": "8.47.0",
"@typescript-eslint/visitor-keys": "8.46.4", "@typescript-eslint/visitor-keys": "8.47.0",
"graphemer": "^1.4.0", "graphemer": "^1.4.0",
"ignore": "^7.0.0", "ignore": "^7.0.0",
"natural-compare": "^1.4.0", "natural-compare": "^1.4.0",
@@ -1786,23 +1786,23 @@
"url": "https://opencollective.com/typescript-eslint" "url": "https://opencollective.com/typescript-eslint"
}, },
"peerDependencies": { "peerDependencies": {
"@typescript-eslint/parser": "^8.46.4", "@typescript-eslint/parser": "^8.47.0",
"eslint": "^8.57.0 || ^9.0.0", "eslint": "^8.57.0 || ^9.0.0",
"typescript": ">=4.8.4 <6.0.0" "typescript": ">=4.8.4 <6.0.0"
} }
}, },
"node_modules/@typescript-eslint/parser": { "node_modules/@typescript-eslint/parser": {
"version": "8.46.4", "version": "8.47.0",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/parser/-/parser-8.46.4.tgz", "resolved": "https://registry.npmmirror.com/@typescript-eslint/parser/-/parser-8.47.0.tgz",
"integrity": "sha512-tK3GPFWbirvNgsNKto+UmB/cRtn6TZfyw0D6IKrW55n6Vbs7KJoZtI//kpTKzE/DUmmnAFD8/Ca46s7Obs92/w==", "integrity": "sha512-lJi3PfxVmo0AkEY93ecfN+r8SofEqZNGByvHAI3GBLrvt1Cw6H5k1IM02nSzu0RfUafr2EvFSw0wAsZgubNplQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"peer": true, "peer": true,
"dependencies": { "dependencies": {
"@typescript-eslint/scope-manager": "8.46.4", "@typescript-eslint/scope-manager": "8.47.0",
"@typescript-eslint/types": "8.46.4", "@typescript-eslint/types": "8.47.0",
"@typescript-eslint/typescript-estree": "8.46.4", "@typescript-eslint/typescript-estree": "8.47.0",
"@typescript-eslint/visitor-keys": "8.46.4", "@typescript-eslint/visitor-keys": "8.47.0",
"debug": "^4.3.4" "debug": "^4.3.4"
}, },
"engines": { "engines": {
@@ -1818,14 +1818,14 @@
} }
}, },
"node_modules/@typescript-eslint/project-service": { "node_modules/@typescript-eslint/project-service": {
"version": "8.46.4", "version": "8.47.0",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/project-service/-/project-service-8.46.4.tgz", "resolved": "https://registry.npmmirror.com/@typescript-eslint/project-service/-/project-service-8.47.0.tgz",
"integrity": "sha512-nPiRSKuvtTN+no/2N1kt2tUh/HoFzeEgOm9fQ6XQk4/ApGqjx0zFIIaLJ6wooR1HIoozvj2j6vTi/1fgAz7UYQ==", "integrity": "sha512-2X4BX8hUeB5JcA1TQJ7GjcgulXQ+5UkNb0DL8gHsHUHdFoiCTJoYLTpib3LtSDPZsRET5ygN4qqIWrHyYIKERA==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@typescript-eslint/tsconfig-utils": "^8.46.4", "@typescript-eslint/tsconfig-utils": "^8.47.0",
"@typescript-eslint/types": "^8.46.4", "@typescript-eslint/types": "^8.47.0",
"debug": "^4.3.4" "debug": "^4.3.4"
}, },
"engines": { "engines": {
@@ -1840,14 +1840,14 @@
} }
}, },
"node_modules/@typescript-eslint/scope-manager": { "node_modules/@typescript-eslint/scope-manager": {
"version": "8.46.4", "version": "8.47.0",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/scope-manager/-/scope-manager-8.46.4.tgz", "resolved": "https://registry.npmmirror.com/@typescript-eslint/scope-manager/-/scope-manager-8.47.0.tgz",
"integrity": "sha512-tMDbLGXb1wC+McN1M6QeDx7P7c0UWO5z9CXqp7J8E+xGcJuUuevWKxuG8j41FoweS3+L41SkyKKkia16jpX7CA==", "integrity": "sha512-a0TTJk4HXMkfpFkL9/WaGTNuv7JWfFTQFJd6zS9dVAjKsojmv9HT55xzbEpnZoY+VUb+YXLMp+ihMLz/UlZfDg==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@typescript-eslint/types": "8.46.4", "@typescript-eslint/types": "8.47.0",
"@typescript-eslint/visitor-keys": "8.46.4" "@typescript-eslint/visitor-keys": "8.47.0"
}, },
"engines": { "engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0" "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@@ -1858,9 +1858,9 @@
} }
}, },
"node_modules/@typescript-eslint/tsconfig-utils": { "node_modules/@typescript-eslint/tsconfig-utils": {
"version": "8.46.4", "version": "8.47.0",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.46.4.tgz", "resolved": "https://registry.npmmirror.com/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.47.0.tgz",
"integrity": "sha512-+/XqaZPIAk6Cjg7NWgSGe27X4zMGqrFqZ8atJsX3CWxH/jACqWnrWI68h7nHQld0y+k9eTTjb9r+KU4twLoo9A==", "integrity": "sha512-ybUAvjy4ZCL11uryalkKxuT3w3sXJAuWhOoGS3T/Wu+iUu1tGJmk5ytSY8gbdACNARmcYEB0COksD2j6hfGK2g==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
@@ -1875,15 +1875,15 @@
} }
}, },
"node_modules/@typescript-eslint/type-utils": { "node_modules/@typescript-eslint/type-utils": {
"version": "8.46.4", "version": "8.47.0",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/type-utils/-/type-utils-8.46.4.tgz", "resolved": "https://registry.npmmirror.com/@typescript-eslint/type-utils/-/type-utils-8.47.0.tgz",
"integrity": "sha512-V4QC8h3fdT5Wro6vANk6eojqfbv5bpwHuMsBcJUJkqs2z5XnYhJzyz9Y02eUmF9u3PgXEUiOt4w4KHR3P+z0PQ==", "integrity": "sha512-QC9RiCmZ2HmIdCEvhd1aJELBlD93ErziOXXlHEZyuBo3tBiAZieya0HLIxp+DoDWlsQqDawyKuNEhORyku+P8A==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@typescript-eslint/types": "8.46.4", "@typescript-eslint/types": "8.47.0",
"@typescript-eslint/typescript-estree": "8.46.4", "@typescript-eslint/typescript-estree": "8.47.0",
"@typescript-eslint/utils": "8.46.4", "@typescript-eslint/utils": "8.47.0",
"debug": "^4.3.4", "debug": "^4.3.4",
"ts-api-utils": "^2.1.0" "ts-api-utils": "^2.1.0"
}, },
@@ -1900,9 +1900,9 @@
} }
}, },
"node_modules/@typescript-eslint/types": { "node_modules/@typescript-eslint/types": {
"version": "8.46.4", "version": "8.47.0",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/types/-/types-8.46.4.tgz", "resolved": "https://registry.npmmirror.com/@typescript-eslint/types/-/types-8.47.0.tgz",
"integrity": "sha512-USjyxm3gQEePdUwJBFjjGNG18xY9A2grDVGuk7/9AkjIF1L+ZrVnwR5VAU5JXtUnBL/Nwt3H31KlRDaksnM7/w==", "integrity": "sha512-nHAE6bMKsizhA2uuYZbEbmp5z2UpffNrPEqiKIeN7VsV6UY/roxanWfoRrf6x/k9+Obf+GQdkm0nPU+vnMXo9A==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
@@ -1914,16 +1914,16 @@
} }
}, },
"node_modules/@typescript-eslint/typescript-estree": { "node_modules/@typescript-eslint/typescript-estree": {
"version": "8.46.4", "version": "8.47.0",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/typescript-estree/-/typescript-estree-8.46.4.tgz", "resolved": "https://registry.npmmirror.com/@typescript-eslint/typescript-estree/-/typescript-estree-8.47.0.tgz",
"integrity": "sha512-7oV2qEOr1d4NWNmpXLR35LvCfOkTNymY9oyW+lUHkmCno7aOmIf/hMaydnJBUTBMRCOGZh8YjkFOc8dadEoNGA==", "integrity": "sha512-k6ti9UepJf5NpzCjH31hQNLHQWupTRPhZ+KFF8WtTuTpy7uHPfeg2NM7cP27aCGajoEplxJDFVCEm9TGPYyiVg==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@typescript-eslint/project-service": "8.46.4", "@typescript-eslint/project-service": "8.47.0",
"@typescript-eslint/tsconfig-utils": "8.46.4", "@typescript-eslint/tsconfig-utils": "8.47.0",
"@typescript-eslint/types": "8.46.4", "@typescript-eslint/types": "8.47.0",
"@typescript-eslint/visitor-keys": "8.46.4", "@typescript-eslint/visitor-keys": "8.47.0",
"debug": "^4.3.4", "debug": "^4.3.4",
"fast-glob": "^3.3.2", "fast-glob": "^3.3.2",
"is-glob": "^4.0.3", "is-glob": "^4.0.3",
@@ -1943,16 +1943,16 @@
} }
}, },
"node_modules/@typescript-eslint/utils": { "node_modules/@typescript-eslint/utils": {
"version": "8.46.4", "version": "8.47.0",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/utils/-/utils-8.46.4.tgz", "resolved": "https://registry.npmmirror.com/@typescript-eslint/utils/-/utils-8.47.0.tgz",
"integrity": "sha512-AbSv11fklGXV6T28dp2Me04Uw90R2iJ30g2bgLz529Koehrmkbs1r7paFqr1vPCZi7hHwYxYtxfyQMRC8QaVSg==", "integrity": "sha512-g7XrNf25iL4TJOiPqatNuaChyqt49a/onq5YsJ9+hXeugK+41LVg7AxikMfM02PC6jbNtZLCJj6AUcQXJS/jGQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@eslint-community/eslint-utils": "^4.7.0", "@eslint-community/eslint-utils": "^4.7.0",
"@typescript-eslint/scope-manager": "8.46.4", "@typescript-eslint/scope-manager": "8.47.0",
"@typescript-eslint/types": "8.46.4", "@typescript-eslint/types": "8.47.0",
"@typescript-eslint/typescript-estree": "8.46.4" "@typescript-eslint/typescript-estree": "8.47.0"
}, },
"engines": { "engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0" "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@@ -1967,13 +1967,13 @@
} }
}, },
"node_modules/@typescript-eslint/visitor-keys": { "node_modules/@typescript-eslint/visitor-keys": {
"version": "8.46.4", "version": "8.47.0",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/visitor-keys/-/visitor-keys-8.46.4.tgz", "resolved": "https://registry.npmmirror.com/@typescript-eslint/visitor-keys/-/visitor-keys-8.47.0.tgz",
"integrity": "sha512-/++5CYLQqsO9HFGLI7APrxBJYo+5OCMpViuhV8q5/Qa3o5mMrF//eQHks+PXcsAVaLdn817fMuS7zqoXNNZGaw==", "integrity": "sha512-SIV3/6eftCy1bNzCQoPmbWsRLujS8t5iDIZ4spZOBHqrM+yfX2ogg8Tt3PDTAVKw3sSCiUgg30uOAvK2r9zGjQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@typescript-eslint/types": "8.46.4", "@typescript-eslint/types": "8.47.0",
"eslint-visitor-keys": "^4.2.1" "eslint-visitor-keys": "^4.2.1"
}, },
"engines": { "engines": {
@@ -1998,13 +1998,13 @@
} }
}, },
"node_modules/@vitejs/plugin-vue": { "node_modules/@vitejs/plugin-vue": {
"version": "6.0.1", "version": "6.0.2",
"resolved": "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-6.0.1.tgz", "resolved": "https://registry.npmmirror.com/@vitejs/plugin-vue/-/plugin-vue-6.0.2.tgz",
"integrity": "sha512-+MaE752hU0wfPFJEUAIxqw18+20euHHdxVtMvbFcOEpjEyfqXH/5DCoTHiVJ0J29EhTJdoTkjEv5YBKU9dnoTw==", "integrity": "sha512-iHmwV3QcVGGvSC1BG5bZ4z6iwa1SOpAPWmnjOErd4Ske+lZua5K9TtAVdx0gMBClJ28DViCbSmZitjWZsWO3LA==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@rolldown/pluginutils": "1.0.0-beta.29" "@rolldown/pluginutils": "1.0.0-beta.50"
}, },
"engines": { "engines": {
"node": "^20.19.0 || >=22.12.0" "node": "^20.19.0 || >=22.12.0"
@@ -2154,9 +2154,9 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/@vue/language-core": { "node_modules/@vue/language-core": {
"version": "3.1.3", "version": "3.1.5",
"resolved": "https://registry.npmmirror.com/@vue/language-core/-/language-core-3.1.3.tgz", "resolved": "https://registry.npmmirror.com/@vue/language-core/-/language-core-3.1.5.tgz",
"integrity": "sha512-KpR1F/eGAG9D1RZ0/T6zWJs6dh/pRLfY5WupecyYKJ1fjVmDMgTPw9wXmKv2rBjo4zCJiOSiyB8BDP1OUwpMEA==", "integrity": "sha512-FMcqyzWN+sYBeqRMWPGT2QY0mUasZMVIuHvmb5NT3eeqPrbHBYtCP8JWEUCDCgM+Zr62uuWY/qoeBrPrzfa78w==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -2533,7 +2533,7 @@
}, },
"node_modules/cssesc": { "node_modules/cssesc": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", "resolved": "https://registry.npmmirror.com/cssesc/-/cssesc-3.0.0.tgz",
"integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
@@ -2825,16 +2825,16 @@
} }
}, },
"node_modules/eslint-plugin-vue": { "node_modules/eslint-plugin-vue": {
"version": "10.5.1", "version": "10.6.0",
"resolved": "https://registry.npmmirror.com/eslint-plugin-vue/-/eslint-plugin-vue-10.5.1.tgz", "resolved": "https://registry.npmmirror.com/eslint-plugin-vue/-/eslint-plugin-vue-10.6.0.tgz",
"integrity": "sha512-SbR9ZBUFKgvWAbq3RrdCtWaW0IKm6wwUiApxf3BVTNfqUIo4IQQmreMg2iHFJJ6C/0wss3LXURBJ1OwS/MhFcQ==", "integrity": "sha512-TsoFluWxOpsJlE/l2jJygLQLWBPJ3Qdkesv7tBIunICbTcG0dS1/NBw/Ol4tJw5kHWlAVds4lUmC29/vlPUcEQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@eslint-community/eslint-utils": "^4.4.0", "@eslint-community/eslint-utils": "^4.4.0",
"natural-compare": "^1.4.0", "natural-compare": "^1.4.0",
"nth-check": "^2.1.1", "nth-check": "^2.1.1",
"postcss-selector-parser": "^6.0.15", "postcss-selector-parser": "^7.1.0",
"semver": "^7.6.3", "semver": "^7.6.3",
"xml-name-validator": "^4.0.0" "xml-name-validator": "^4.0.0"
}, },
@@ -3898,9 +3898,9 @@
} }
}, },
"node_modules/postcss-selector-parser": { "node_modules/postcss-selector-parser": {
"version": "6.1.2", "version": "7.1.0",
"resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.1.2.tgz", "resolved": "https://registry.npmmirror.com/postcss-selector-parser/-/postcss-selector-parser-7.1.0.tgz",
"integrity": "sha512-Q8qQfPiZ+THO/3ZrOrO0cJJKfpYCagtMUkXbnEfmgUjwXg6z/WBeOyS9APBBPCTSiDV+s4SwQGu8yFsiMRIudg==", "integrity": "sha512-8sLjZwK0R+JlxlYcTuVnyT2v+htpdrjDOKuMcOVdYjt52Lh8hWRYpxBPoKx/Zg+bcjc3wx6fmQevMmUztS/ccA==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -4069,9 +4069,9 @@
} }
}, },
"node_modules/sass": { "node_modules/sass": {
"version": "1.94.0", "version": "1.94.2",
"resolved": "https://registry.npmmirror.com/sass/-/sass-1.94.0.tgz", "resolved": "https://registry.npmmirror.com/sass/-/sass-1.94.2.tgz",
"integrity": "sha512-Dqh7SiYcaFtdv5Wvku6QgS5IGPm281L+ZtVD1U2FJa7Q0EFRlq8Z3sjYtz6gYObsYThUOz9ArwFqPZx+1azILQ==", "integrity": "sha512-N+7WK20/wOr7CzA2snJcUSSNTCzeCGUTFY3OgeQP3mZ1aj9NMQ0mSTXwlrnd89j33zzQJGqIN52GIOmYrfq46A==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"peer": true, "peer": true,
@@ -4272,15 +4272,15 @@
}, },
"node_modules/util-deprecate": { "node_modules/util-deprecate": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "resolved": "https://registry.npmmirror.com/util-deprecate/-/util-deprecate-1.0.2.tgz",
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==",
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/vite": { "node_modules/vite": {
"version": "7.2.2", "version": "7.2.4",
"resolved": "https://registry.npmmirror.com/vite/-/vite-7.2.2.tgz", "resolved": "https://registry.npmmirror.com/vite/-/vite-7.2.4.tgz",
"integrity": "sha512-BxAKBWmIbrDgrokdGZH1IgkIk/5mMHDreLDmCJ0qpyJaAteP8NvMhkwr/ZCQNqNH97bw/dANTE9PDzqwJghfMQ==", "integrity": "sha512-NL8jTlbo0Tn4dUEXEsUg8KeyG/Lkmc4Fnzb8JXN/Ykm9G4HNImjtABMJgkQoVjOBN/j2WAwDTRytdqJbZsah7w==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"peer": true, "peer": true,
@@ -4477,14 +4477,14 @@
} }
}, },
"node_modules/vue-tsc": { "node_modules/vue-tsc": {
"version": "3.1.3", "version": "3.1.5",
"resolved": "https://registry.npmmirror.com/vue-tsc/-/vue-tsc-3.1.3.tgz", "resolved": "https://registry.npmmirror.com/vue-tsc/-/vue-tsc-3.1.5.tgz",
"integrity": "sha512-StMNfZHwPIXQgY3KxPKM0Jsoc8b46mDV3Fn2UlHCBIwRJApjqrSwqeMYgWf0zpN+g857y74pv7GWuBm+UqQe1w==", "integrity": "sha512-L/G9IUjOWhBU0yun89rv8fKqmKC+T0HfhrFjlIml71WpfBv9eb4E9Bev8FMbyueBIU9vxQqbd+oOsVcDa5amGw==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@volar/typescript": "2.4.23", "@volar/typescript": "2.4.23",
"@vue/language-core": "3.1.3" "@vue/language-core": "3.1.5"
}, },
"bin": { "bin": {
"vue-tsc": "bin/vue-tsc.js" "vue-tsc": "bin/vue-tsc.js"

View File

@@ -15,11 +15,11 @@
}, },
"devDependencies": { "devDependencies": {
"@element-plus/icons-vue": "^2.3.2", "@element-plus/icons-vue": "^2.3.2",
"@stylistic/eslint-plugin": "^5.5.0", "@stylistic/eslint-plugin": "^5.6.1",
"@types/node": "^24.10.1", "@types/node": "^24.10.1",
"@typescript-eslint/eslint-plugin": "^8.46.4", "@typescript-eslint/eslint-plugin": "^8.47.0",
"@typescript-eslint/parser": "^8.46.4", "@typescript-eslint/parser": "^8.47.0",
"@vitejs/plugin-vue": "^6.0.1", "@vitejs/plugin-vue": "^6.0.2",
"@vue-office/docx": "^1.6.3", "@vue-office/docx": "^1.6.3",
"@vue-office/excel": "^1.7.14", "@vue-office/excel": "^1.7.14",
"@vue-office/pdf": "^2.0.10", "@vue-office/pdf": "^2.0.10",
@@ -27,14 +27,14 @@
"axios": "^1.13.2", "axios": "^1.13.2",
"element-plus": "^2.11.8", "element-plus": "^2.11.8",
"eslint": "^9.39.1", "eslint": "^9.39.1",
"eslint-plugin-vue": "^10.5.1", "eslint-plugin-vue": "^10.6.0",
"path": "^0.12.7", "path": "^0.12.7",
"sass": "^1.94.0", "sass": "^1.94.2",
"typescript": "~5.9.3", "typescript": "~5.9.3",
"vite": "^7.2.2", "vite": "^7.2.4",
"vue-demi": "^0.14.10", "vue-demi": "^0.14.10",
"vue-eslint-parser": "^10.2.0", "vue-eslint-parser": "^10.2.0",
"vue-pdf-embed": "^2.1.3", "vue-pdf-embed": "^2.1.3",
"vue-tsc": "^3.1.3" "vue-tsc": "^3.1.5"
} }
} }

View File

@@ -14,13 +14,14 @@ interface RegulatoryData {
release_year: string; release_year: string;
regulatory_name: string; regulatory_name: string;
comment: string; comment: string;
regulatory_files: null | RegulatoryFile[] regulatory_files: RegulatoryFile[];
} }
interface RegulatoryFile { interface RegulatoryFile {
regulatory_file_name: string; regulatory_file_name: string;
file_url: string; file_url: string;
file_type: string local_file_path: string;
file_type: string;
} }
export { type RegulatoryData, type RegulatoryFile }; export { type RegulatoryData, type RegulatoryFile };

View File

@@ -0,0 +1,29 @@
/**
* @Author: Kane Wang <wangkane@qq.com>
* @Date: 2025-11-21 10:19:11
* @LastEditors: Kane Wang
* @LastModified: 2025-11-27 17:41:28
* @FilePath: src/types/upload_file.ts
* @Description:
*
* Copyright (c) 2025 by Kane All rights reserved
*/
interface UploadFileResponse
{
success: boolean;
message: string;
fileList: UploadedFile[];
}
interface UploadedFile
{
fileName: string;
absoluteFilePath: string;
relativeFilePath: string;
}
export {
type UploadedFile,
type UploadFileResponse
};

View File

@@ -0,0 +1,59 @@
/**
* @Author: Kane Wang <wangkane@qq.com>
* @Date: 2025-12-18 10:02:42
* @LastEditors: Kane Wang
* @LastModified: 2025-12-25 18:01:56
* @FilePath: src/utils/api/request.ts
* @Description:
*
* Copyright (c) 2025 by Kane All rights reserved
*/
import axios, {type AxiosInstance } from "axios";
const service: AxiosInstance = axios.create(
{
baseURL: "",
timeout: 30000,
}
);
// #region 1111
// #endregion
// 请求拦截
service.interceptors.request.use(
/**
* 请求拦截器config对象用于给开发人员配置请求
* @param config 配置对象在配置中加入需要的token
* @returns 返回配置好的config
*/
( config ) =>
{
config.headers.token = "123";
return config;
},
async ( error: any ) =>
{
console.log( `配置请求拦截器错误:${error}` );
return await Promise.reject( error );
}
);
/**
* 响应拦截器
*/
service.interceptors.response.use(
( response ) =>
{
return response;
},
async ( error ) =>
{
console.log( `配置响应拦截器失败:${error}` );
return await Promise.reject( error );
}
);
export { service };

View File

@@ -0,0 +1,19 @@
/**
* @Author: Kane Wang <wangkane@qq.com>
* @Date: 2025-11-21 09:39:59
* @LastEditors: Kane Wang
* @LastModified: 2025-11-21 09:40:00
* @FilePath: src/utils/config.ts
* @Description: 保存应用的配置参数。
*
* Copyright (c) 2025 by Kane All rights reserved
*/
const API_URL= {
URL_UPLOAD_FILE: import.meta.env.VITE_APP_URL_UPLOAD_FILE,
URL_MOVE_FILE: import.meta.env.VITE_APP_URL_MOVE_FILE,
URL_PREFIX: import.meta.env.VITE_APP_URL_PREFIX,
};
console.log( API_URL );
export { API_URL };

View File

@@ -2,9 +2,55 @@
* @Author: Kane Wang <wangkane@qq.com> * @Author: Kane Wang <wangkane@qq.com>
* @Date: 2025-10-23 16:52:10 * @Date: 2025-10-23 16:52:10
* @LastEditors: Kane Wang * @LastEditors: Kane Wang
* @LastModified: 2025-10-23 17:04:54 * @LastModified: 2025-11-21 11:17:40
* @FilePath: src/utils/utils.ts * @FilePath: src/utils/utils.ts
* @Description: * @Description: 提供 一些功能性的函数
* *
* Copyright (c) 2025 by Kane All rights reserved * Copyright (c) 2025 by Kane All rights reserved
*/ */
/**
* 取文件路径末尾的扩展名作为文件类型
* @param filePath 文件路径
* @returns 文件类型字符串
*/
function getFileType( filePath: string ): string
{
let type = "未知类型";
if ( filePath == null || filePath.length == 0 )
{
return type;
}
const startIndex = filePath.lastIndexOf( "." );
const fileType = filePath.slice( startIndex + 1 ).toUpperCase();
// ignore-eslint-next-line
switch( fileType )
{
case "DOCX":
type = "WPS文档";
break;
case "XLSX":
type = "WPS表格";
break;
case "PDF":
type = "PDF文档";
break;
case "JPG":
case "PNG":
case "BMP":
case "GIF":
type = "图片文件";
break;
default:
type = "未知文件类型";
}
// type = fileType.length != 0 ? fileType + "文件" : "未知类型";
return type;
}
export { getFileType };

View File

@@ -12,7 +12,7 @@ Copyright © CPIC All rights reserved
<span>名称</span> <span>名称</span>
</el-col> </el-col>
<el-col :span="10"> <el-col :span="10">
<el-input style="text-align:center;" /> <el-input v-model.trim.lazy="ui.newRegulatory.regulatory_name" style="text-align:center;" />
</el-col> </el-col>
</el-row> </el-row>
<el-row :gutter="10"> <el-row :gutter="10">
@@ -20,13 +20,13 @@ Copyright © CPIC All rights reserved
<span>部门</span> <span>部门</span>
</el-col> </el-col>
<el-col :span="4"> <el-col :span="4">
<el-input /> <el-input v-model.trim="ui.newRegulatory.department_name" />
</el-col> </el-col>
<el-col :span="2"> <el-col :span="2">
<span>发布修订年份</span> <span>发布修订年份</span>
</el-col> </el-col>
<el-col :span="4"> <el-col :span="4">
<el-input /> <el-input v-model.lazy.number.trim="ui.newRegulatory.release_year" />
</el-col> </el-col>
</el-row> </el-row>
<el-row :gutter="10"> <el-row :gutter="10">
@@ -34,7 +34,7 @@ Copyright © CPIC All rights reserved
<span>备注</span> <span>备注</span>
</el-col> </el-col>
<el-col :span="10"> <el-col :span="10">
<el-input type="textarea" :rows="3" /> <el-input v-model.lazy.trim="ui.newRegulatory.comment" type="textarea" :rows="3" />
</el-col> </el-col>
</el-row> </el-row>
<el-row :gutter="10"> <el-row :gutter="10">
@@ -43,15 +43,15 @@ Copyright © CPIC All rights reserved
<el-button type="primary" icon="document" @click="showUploadFileDialog"> <el-button type="primary" icon="document" @click="showUploadFileDialog">
新增文档 新增文档
</el-button> </el-button>
<el-button type="primary" icon="document">
新增文档
</el-button>
</div> </div>
</el-col> </el-col>
<el-col :span="5" /> <el-col :span="5" />
<el-col :span="3"> <el-col :span="3">
<div class="button-wrapper-right"> <div class="button-wrapper-right">
<el-button type="primary" icon="document"> <el-button
type="primary" icon="document"
@click="onPreviewUploadedFile(1)"
>
提交 提交
</el-button> </el-button>
</div> </div>
@@ -60,24 +60,35 @@ Copyright © CPIC All rights reserved
</div> </div>
<el-table <el-table
width="100%" stripe width="100%" stripe
border border="true"
:head-cell-style="headerCellStyle" :head-cell-style="headerCellStyle"
:row-class-name="tableRowClassName"
empty-text="请上传文件" empty-text="请上传文件"
:data="ui.newRegulatory.regulatory_files"
> >
<el-table-column label="文件名" align="center" width="200px"> <el-table-column label="文件名" align="center">
<template #default="file"> <template #default="file">
<span>{{ file.row.filename }}</span> <span>{{ file.row.regulatory_file_name }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="文件类型" align="center"> <el-table-column label="文件类型" align="center" width="200px">
<template #default="file"> <template #default="file">
<span>{{ file.row.filename }}</span> <span>{{ file.row.file_type }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" width="200px"> <el-table-column label="操作" align="center" width="200px">
<el-button type="primary" icon="search"> <template #default="file">
查看 <el-button
</el-button> type="primary" icon="search"
circle
@click="onPreviewUploadedFile(file.row.rowIndex)"
/>
<el-button
type="danger" icon="delete"
circle
@click="onDeleteUploadedFile(file.row.rowIndex)"
/>
</template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<div class="upload-dialog-wrapper"> <div class="upload-dialog-wrapper">
@@ -103,25 +114,107 @@ Copyright © CPIC All rights reserved
</div> </div>
</el-upload> </el-upload>
</el-dialog> </el-dialog>
<el-dialog
v-model="ui.isPDF" :close-on-click-model="false"
:close-on-press-escape="false"
:show-close="true"
align-center
title="文件预览"
width="1024px"
>
<VueOfficePdf
v-if="ui.isPDF" :src="ui.fileURL"
style="height:calc(100vh - 100px);"
@error="errorHandle"
/>
</el-dialog>
<el-dialog
v-model="ui.isDOCX" :close-on-click-model="false"
:close-on-press-escape="false"
:show-close="true"
align-center
title="文件预览"
width="1024px"
>
<VueOfficeDocx
v-if="ui.isDOCX" :src="ui.fileURL"
style="height:calc(100vh - 100px);"
@error="errorHandle"
/>
</el-dialog>
<el-dialog
v-model="ui.isXLSX" :close-on-click-model="false"
:close-on-press-escape="false"
:show-close="true"
align-center
title="文件预览"
width="1024px"
>
<VueOfficeExcel
:src="ui.fileURL"
style="height:calc(100vh - 100px);"
@error="errorHandle"
/>
</el-dialog>
</div> </div>
</div> </div>
</template> </template>
<script lang="ts"> <script lang="ts">
import {reactive, ref} from "vue"; import {reactive, ref} from "vue";
import { type UploadProps, type UploadFile, type UploadFiles, ElMessage, ElMessageBox } from "element-plus";
import {type RegulatoryData, type RegulatoryFile} from "@/types/regulatory/regulatory.ts";
import { type UploadedFile, type UploadFileResponse } from "@/types/upload_file.ts";
import {API_URL} from "@/utils/config.ts";
import { getFileType } from "@/utils/utils";
import VueOfficePdf from "@vue-office/pdf";
import VueOfficeDocx from "@vue-office/docx";
import VueOfficeExcel from "@vue-office/excel";
//引入相关样式
import "@vue-office/docx/lib/index.css";
import "@vue-office/excel/lib/index.css";
interface UI{
showUI: boolean;
showUploadDialog: boolean;
showPreviewDialog: boolean;
urlFileUpload: string;
uploadParameters: {
fileName: string;
};
newRegulatory: RegulatoryData;
showFileList: boolean;
isPDF: boolean;
isDOCX: boolean;
isXLSX: boolean;
fileURL: string;
};
export default { export default {
name: "NewRegulatory", name: "NewRegulatory",
components: {}, components: {VueOfficePdf, VueOfficeDocx, VueOfficeExcel,},
setup() setup()
{ {
const ui = reactive({ const ui: UI = reactive({
showUI: true, showUI: true,
showUploadDialog: false, showUploadDialog: false,
urlFileUpload: "", showPreviewDialog: false,
urlFileUpload: API_URL.URL_UPLOAD_FILE,
uploadParameters: { uploadParameters: {
"file-name": "1234", fileName: "1234",
},
newRegulatory: {
department_name: "",
release_year: "",
regulatory_name: "",
comment: "",
regulatory_files: [],
}, },
showFileList: false, showFileList: false,
isPDF: false,
isDOCX: false,
isXLSX: false,
fileURL: "",
}); });
const headerCellStyle = reactive( const headerCellStyle = reactive(
@@ -133,19 +226,154 @@ export default {
textAlign: "center", textAlign: "center",
}); });
const onUploadSuccess = ()=> {};
const showUploadFileDialog = (): void => const showUploadFileDialog = (): void =>
{ {
ui.showUploadDialog = true; ui.showUploadDialog = true;
}; };
/*表格操作相关 */
/**
* 删除对应的上传文件记录。
* @param rowId 行号
*/
const onDeleteUploadedFile = ( rowId: number ): void =>
{
console.log( `点击的rowid${rowId}` );
ElMessage.info( `选取的行号:${rowId}` );
ElMessageBox.confirm(
"确认删除文件?",
"删除文件",
{
confirmButtonText: "确定",
type: "warning",
center: true,
}
)
.then(()=>
{
ui.newRegulatory.regulatory_files?.splice( rowId, 1 );
})
.catch(()=>{});
};
const onPreviewUploadedFile = ( rowId: number ): void =>
{
// ui.showPreviewDialog = true;
ui.fileURL = ui.newRegulatory.regulatory_files[rowId]?.file_url + "/" + ui.newRegulatory.regulatory_files[rowId]?.regulatory_file_name;
console.log( "完整路径:", ui.fileURL );
ui.isDOCX = false;
ui.isPDF = false;
ui.isXLSX = false;
switch ( ui.newRegulatory.regulatory_files[rowId].file_type )
{
case "WPS文档":
ui.isDOCX = true;
break;
case "WPS表格":
ui.isXLSX = true;
break;
case "PDF文档":
ui.isPDF = true;
break;
default:
break;
}
};
/**
* 用来给 el-table 行设置样式。
* 其中给row加一个参数rowIndex用行号赋值。
* @param element-plus给于的参数
*/
const tableRowClassName = ({row, rowIndex,}: {row:any, rowIndex:number}): void =>
{
console.log( `${row}设置行号${rowIndex}` );
row.rowIndex = rowIndex;
};
/**
* 上传成功的响应函数。
* @param response
* @param uploadFile
* @param uploadFiles
*/
const onUploadSuccess: UploadProps["onSuccess"] = ( response: UploadFileResponse, uploadFile: UploadFile, uploadFiles: UploadFiles ): void =>
{
console.log( `上传制度文件响应:${response}` );
console.log( `上传文件:${uploadFile}` );
console.log( `上传多文件:${uploadFiles}` );
ui.showUploadDialog = false;
// 先判断成功标志位
if ( response.success )
{
// 成功,把文件写入清单
if ( response.fileList === null || response.fileList.length === 0 )
{
// 上传文件路径有问题,提示一下
ElMessageBox.confirm(
"上传文件的保存路径有误,请联系开发人员。",
"上传文件错误",
{
confirmButtonText: "确定",
type: "warning",
center: true,
}
)
.then((): void => {})
.catch((): void => {});
}
const uploadedFile: RegulatoryFile = {
regulatory_file_name: response.fileList[0].fileName ?? "",
local_file_path: response.fileList[0]?.absoluteFilePath ?? "",
file_type: getFileType( response.fileList[0]?.fileName ),
file_url: API_URL.URL_PREFIX + "/" + response.fileList[0]?.relativeFilePath,
};
ui.newRegulatory.regulatory_files?.push( uploadedFile );
console.log( "文件列表", ui.newRegulatory.regulatory_files );
}
else
{
// 失败了,提示一下
ElMessageBox.confirm(
response.message,
"上传文件错误",
{
confirmButtonText: "确定",
type: "warning",
center: true,
}
)
.then((): void => {})
.catch((): void => {});
}
};
const errorHandle = ()=>
{
ElMessage.error( "渲染文档出错!" );
};
return { return {
ui, ui,
headerCellStyle, headerCellStyle,
cellStyle, cellStyle,
onUploadSuccess, onUploadSuccess,
tableRowClassName,
showUploadFileDialog, showUploadFileDialog,
onDeleteUploadedFile,
onPreviewUploadedFile,
errorHandle,
}; };
}, },
}; };
@@ -171,4 +399,9 @@ export default {
:deep(.el-input) .el-input__inner { :deep(.el-input) .el-input__inner {
text-align: center; text-align: center;
} }
:deep(.el-dialog) {
min-width: calc(100wh - 100px);
max-width: calc(100wh - 100px);
}
</style> </style>

View File

@@ -41,11 +41,11 @@ export default {
const ui = reactive({ const ui = reactive({
showUI: true, showUI: true,
isPDF: false, isPDF: false,
isDocx: true, isDocx: false,
isXlsx: false, isXlsx: true,
fileURLPDF: "http://10.39.0.1:8080/regulatory/%E4%BF%A1%E6%81%AF%E6%8A%80%E6%9C%AF%E9%83%A8/%E5%85%B3%E4%BA%8E%E5%8D%B0%E5%8F%91%E3%80%8A%E5%A4%AA%E5%B9%B3%E6%B4%8B%E4%BA%A7%E9%99%A9%E5%8E%A6%E9%97%A8%E5%88%86%E5%85%AC%E5%8F%B8IT%E8%B5%84%E4%BA%A7%E7%AE%A1%E7%90%86%E5%8A%9E%E6%B3%95%E3%80%8B%EF%BC%882019%E5%B9%B4%E4%BF%AE%E8%AE%A2%EF%BC%89%E7%9A%84%E9%80%9A%E7%9F%A5/%E5%8E%A6%E5%A4%AA%E4%BF%9D%E4%BA%A7%E5%8F%91%E3%80%902019%E3%80%9146%E5%8F%B7%E5%85%B3%E4%BA%8E%E5%8D%B0%E5%8F%91%E3%80%8A%E5%A4%AA%E5%B9%B3%E6%B4%8B%E4%BA%A7%E9%99%A9%E5%8E%A6%E9%97%A8%E5%88%86%E5%85%AC%E5%8F%B8IT%E8%B5%84%E4%BA%A7%E7%AE%A1%E7%90%86%E5%8A%9E%E6%B3%95%E3%80%8B%EF%BC%882019%E5%B9%B4%E4%BF%AE%E8%AE%A2%EF%BC%89%E7%9A%84%E9%80%9A%E7%9F%A5.pdf", fileURLPDF: "http://10.39.0.1:8080/regulatory/%E4%BF%A1%E6%81%AF%E6%8A%80%E6%9C%AF%E9%83%A8/%E5%85%B3%E4%BA%8E%E5%8D%B0%E5%8F%91%E3%80%8A%E5%A4%AA%E5%B9%B3%E6%B4%8B%E4%BA%A7%E9%99%A9%E5%8E%A6%E9%97%A8%E5%88%86%E5%85%AC%E5%8F%B8IT%E8%B5%84%E4%BA%A7%E7%AE%A1%E7%90%86%E5%8A%9E%E6%B3%95%E3%80%8B%EF%BC%882019%E5%B9%B4%E4%BF%AE%E8%AE%A2%EF%BC%89%E7%9A%84%E9%80%9A%E7%9F%A5/%E5%8E%A6%E5%A4%AA%E4%BF%9D%E4%BA%A7%E5%8F%91%E3%80%902019%E3%80%9146%E5%8F%B7%E5%85%B3%E4%BA%8E%E5%8D%B0%E5%8F%91%E3%80%8A%E5%A4%AA%E5%B9%B3%E6%B4%8B%E4%BA%A7%E9%99%A9%E5%8E%A6%E9%97%A8%E5%88%86%E5%85%AC%E5%8F%B8IT%E8%B5%84%E4%BA%A7%E7%AE%A1%E7%90%86%E5%8A%9E%E6%B3%95%E3%80%8B%EF%BC%882019%E5%B9%B4%E4%BF%AE%E8%AE%A2%EF%BC%89%E7%9A%84%E9%80%9A%E7%9F%A5.pdf",
fileURLDocx: "http://10.39.0.1:8080/regulatory/%E4%BF%A1%E6%81%AF%E6%8A%80%E6%9C%AF%E9%83%A8/%E5%85%B3%E4%BA%8E%E5%8D%B0%E5%8F%91%E3%80%8A%E5%A4%AA%E5%B9%B3%E6%B4%8B%E4%BA%A7%E9%99%A9%E5%8E%A6%E9%97%A8%E5%88%86%E5%85%AC%E5%8F%B8%E8%BD%AF%E4%BB%B6%E5%BC%80%E5%8F%91%E9%9C%80%E6%B1%82%E7%AE%A1%E7%90%86%E5%8A%9E%E6%B3%95%EF%BC%882020%E5%B9%B4%E4%BF%AE%E8%AE%A2%EF%BC%89%E3%80%8B%E7%9A%84%E9%80%9A%E7%9F%A5/%E9%99%84%E4%BB%B62%EF%BC%9A%E4%B8%9A%E5%8A%A1%E9%9C%80%E6%B1%82%E8%AF%B4%E6%98%8E%E4%B9%A6.docx", fileURLDocx: "http://10.39.0.1:8080/regulatory/%E4%BF%A1%E6%81%AF%E6%8A%80%E6%9C%AF%E9%83%A8/%E5%85%B3%E4%BA%8E%E5%8D%B0%E5%8F%91%E3%80%8A%E5%A4%AA%E5%B9%B3%E6%B4%8B%E4%BA%A7%E9%99%A9%E5%8E%A6%E9%97%A8%E5%88%86%E5%85%AC%E5%8F%B8%E8%BD%AF%E4%BB%B6%E5%BC%80%E5%8F%91%E9%9C%80%E6%B1%82%E7%AE%A1%E7%90%86%E5%8A%9E%E6%B3%95%EF%BC%882020%E5%B9%B4%E4%BF%AE%E8%AE%A2%EF%BC%89%E3%80%8B%E7%9A%84%E9%80%9A%E7%9F%A5/%E9%99%84%E4%BB%B62%EF%BC%9A%E4%B8%9A%E5%8A%A1%E9%9C%80%E6%B1%82%E8%AF%B4%E6%98%8E%E4%B9%A6.docx",
fileURLXlsx: "http://10.39.0.1:8080/regulatory/%E4%BF%A1%E6%81%AF%E6%8A%80%E6%9C%AF%E9%83%A8/%E5%85%B3%E4%BA%8E%E5%8D%B0%E5%8F%91%E3%80%8A%E5%A4%AA%E5%B9%B3%E6%B4%8B%E4%BA%A7%E9%99%A9%E5%8E%A6%E9%97%A8%E5%88%86%E5%85%AC%E5%8F%B8%E8%BD%AF%E4%BB%B6%E5%BC%80%E5%8F%91%E9%9C%80%E6%B1%82%E7%AE%A1%E7%90%86%E5%8A%9E%E6%B3%95%EF%BC%882020%E5%B9%B4%E4%BF%AE%E8%AE%A2%EF%BC%89%E3%80%8B%E7%9A%84%E9%80%9A%E7%9F%A5/%E9%99%84%E4%BB%B64%EF%BC%9A%E5%88%86%E5%85%AC%E5%8F%B8%E8%87%AA%E5%BB%BA%E7%B3%BB%E7%BB%9F%E9%83%A8%E7%BD%B2%E6%83%85%E5%86%B5%E7%99%BB%E8%AE%B0%E8%A1%A8.xlsx", fileURLXlsx: "http://10.39.0.1:8081/regulatory/%E4%BF%A1%E6%81%AF%E6%8A%80%E6%9C%AF%E9%83%A8/%E5%85%B3%E4%BA%8E%E5%8D%B0%E5%8F%91%E3%80%8A%E5%A4%AA%E5%B9%B3%E6%B4%8B%E4%BA%A7%E9%99%A9%E5%8E%A6%E9%97%A8%E5%88%86%E5%85%AC%E5%8F%B8%E8%BD%AF%E4%BB%B6%E5%BC%80%E5%8F%91%E9%9C%80%E6%B1%82%E7%AE%A1%E7%90%86%E5%8A%9E%E6%B3%95%EF%BC%882020%E5%B9%B4%E4%BF%AE%E8%AE%A2%EF%BC%89%E3%80%8B%E7%9A%84%E9%80%9A%E7%9F%A5/%E9%99%84%E4%BB%B64%EF%BC%9A%E5%88%86%E5%85%AC%E5%8F%B8%E8%87%AA%E5%BB%BA%E7%B3%BB%E7%BB%9F%E9%83%A8%E7%BD%B2%E6%83%85%E5%86%B5%E7%99%BB%E8%AE%B0%E8%A1%A8.xlsx",
}); });

View File

@@ -65,4 +65,98 @@ tomcat 默认是不支持跨域的不做配置使用vue下载文件会有Acce
### pdf预览组件 ### pdf预览组件
使用 使用
## 技术
### element-plus 文件上传
element-plus 文件上传组件的响应函数,作为:on-success属性值。要传递的参数作为:data属性值。
```typescript
import { type FileUploadResponse } from "@/utils/fileUpload.js";
import { type UploadProps, type UploadFile, type UploadFiles, ElMessage, ElMessageBox } from "element-plus";
const onUploadSuccess: UploadProps["onSuccess"] = ( response: FileUploadResponse, uploadFile: UploadFile, uploadFiles: UploadFiles ): void =>
{
// 先判断成功标志位
if ( response.success )
{
// 成功,发出导入报表请求
if ( response.fileList.length === 0 )
{
// 上传文件路径有问题,提示一下
ElMessageBox.confirm(
"上传文件的保存路径有误,请联系开发人员。",
"上传文件错误",
{
confirmButtonText: "确定",
type: "warning",
center: true,
}
)
.then((): void => {})
.catch((): void => {});
}
const request: ImportBIReportRequest = {
filePath: response.fileList[0],
reportType: ui.selectedReportType,
firstRow: ui.firstRow,
sheetIndex: ui.sheetIndex,
};
console.log( "请求参数", request );
// 发出请求
importBIReport( request, importResponseHandler );
}
else
{
// 失败了,提示一下
ElMessageBox.confirm(
response.message,
"上传文件错误",
{
confirmButtonText: "确定",
type: "warning",
center: true,
}
)
.then((): void => {})
.catch((): void => {});
}
};
```
### typescript 的安全链式调用 和 强制链式调用
在链式调用时,在成员访问操作符前加上?,表示安全链式调用;加上!表示强制链式调用。
如果前的属性存在则正常调用否则返回null。
```typescript
// 这里 Error对象定义的stack是可选参数如果这样写的话编译器会提示
// 出错 TS2532: Object is possibly 'undefined'.
return new Error().stack.split('\n');
// 我们可以添加?操作符当stack属性存在时调用 stack.split。
// 若stack不存在则返回空
return new Error().stack?.split('\n');
// 以上代码等同以下代码, 感谢 @dingyanhe 的监督
const err = new Error();
return err.stack && err.stack.split('\n');
```
强制链式调用表示!前的属性一定会存在。
```typescript
// 这里 Error对象定义的stack是可选参数如果这样写的话编译器会提示
// 出错 TS2532: Object is possibly 'undefined'.
new Error().stack.split('\n');
// 我们确信这个字段100%出现,那么就可以添加!,强调这个字段一定存在
new Error().stack!.split('\n');
```