Compare commits
3 Commits
e9c3aee252
...
feature-制度
| Author | SHA1 | Date | |
|---|---|---|---|
| fe0f67a777 | |||
| 3c8bb51c41 | |||
| 858b79942d |
@@ -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-12-01 18:42:31
|
* @LastModified: 2026-02-06 19:08:46
|
||||||
* @FilePath: src/main/java/com/cpic/xim/utils/files/SaveUploadFile.java
|
* @FilePath: src/main/java/com/cpic/xim/utils/files/SaveUploadFile.java
|
||||||
* @Description:
|
* @Description:
|
||||||
*
|
*
|
||||||
@@ -128,7 +128,7 @@ public class SaveUploadFile
|
|||||||
|
|
||||||
file.transferTo( destFile );
|
file.transferTo( destFile );
|
||||||
|
|
||||||
uploadedFile = new UploadedFile( fileName, fullPath, relativeFilePath );
|
uploadedFile = new UploadedFile( file.getOriginalFilename(), fileName, fullPath, relativeFilePath );
|
||||||
|
|
||||||
savedFiles.add( uploadedFile );
|
savedFiles.add( uploadedFile );
|
||||||
}
|
}
|
||||||
@@ -175,4 +175,54 @@ public class SaveUploadFile
|
|||||||
throw new MoveUploadedFileException( "移动文件失败!" );
|
throw new MoveUploadedFileException( "移动文件失败!" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String encodeFileName( String originalFileName )
|
||||||
|
{
|
||||||
|
StringBuilder encodedFileName = new StringBuilder( originalFileName.length() * 3 );
|
||||||
|
char[] charArray = originalFileName.toCharArray();
|
||||||
|
|
||||||
|
for ( char c : charArray )
|
||||||
|
{
|
||||||
|
switch ( c )
|
||||||
|
{
|
||||||
|
case '%':
|
||||||
|
encodedFileName.append( PERCENT );
|
||||||
|
break;
|
||||||
|
case ' ':
|
||||||
|
encodedFileName.append( SPACING );
|
||||||
|
break;
|
||||||
|
case '+':
|
||||||
|
encodedFileName.append( PLUS );
|
||||||
|
break;
|
||||||
|
case '/':
|
||||||
|
encodedFileName.append( FORWARD_SLASH );
|
||||||
|
break;
|
||||||
|
case '?':
|
||||||
|
encodedFileName.append( QUESTION_MASK );
|
||||||
|
break;
|
||||||
|
case '&':
|
||||||
|
encodedFileName.append( AMPERSAND );
|
||||||
|
break;
|
||||||
|
case '#':
|
||||||
|
encodedFileName.append( SHARP );
|
||||||
|
break;
|
||||||
|
case '=':
|
||||||
|
encodedFileName.append( PLUS );
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
encodedFileName.append( c );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return encodedFileName.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
static final String SHARP = "%23";
|
||||||
|
static final String PLUS = "%2B";
|
||||||
|
static final String FORWARD_SLASH = "%2F";
|
||||||
|
static final String QUESTION_MASK = "%3F";
|
||||||
|
static final String SPACING = "%20";
|
||||||
|
static final String EQUAL = "%3D";
|
||||||
|
static final String PERCENT = "%25";
|
||||||
|
static final String AMPERSAND = "%26";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* @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-12-26 21:58:32
|
* @LastModified: 2026-02-06 17:41:44
|
||||||
* @FilePath: src/main/java/com/cpic/xim/utils/files/UploadedFile.java
|
* @FilePath: src/main/java/com/cpic/xim/utils/files/UploadedFile.java
|
||||||
* @Description:
|
* @Description:
|
||||||
*
|
*
|
||||||
@@ -18,6 +18,9 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
|||||||
*/
|
*/
|
||||||
public class UploadedFile
|
public class UploadedFile
|
||||||
{
|
{
|
||||||
|
@JsonProperty("originFileName")
|
||||||
|
private String originFileName;
|
||||||
|
|
||||||
@JsonProperty( "fileName" )
|
@JsonProperty( "fileName" )
|
||||||
private String fileName;
|
private String fileName;
|
||||||
|
|
||||||
@@ -60,17 +63,21 @@ public class UploadedFile
|
|||||||
public UploadedFile()
|
public UploadedFile()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
public UploadedFile( String fileName, String absoluteFilePath, String relativeFilePath )
|
public UploadedFile( String originFileName, String fileName, String absoluteFilePath, String relativeFilePath )
|
||||||
{
|
{
|
||||||
|
this.originFileName = originFileName;
|
||||||
this.fileName = fileName;
|
this.fileName = fileName;
|
||||||
this.absoluteFilePath = absoluteFilePath;
|
this.absoluteFilePath = absoluteFilePath;
|
||||||
this.relativeFilePath = relativeFilePath;
|
this.relativeFilePath = relativeFilePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UploadedFile( String fileName, String absoluteFilePath )
|
public String getOriginFileName()
|
||||||
{
|
{
|
||||||
this.fileName = fileName;
|
return originFileName;
|
||||||
this.absoluteFilePath = absoluteFilePath;
|
}
|
||||||
this.relativeFilePath = "";
|
|
||||||
|
public void setOriginFileName( String originFileName )
|
||||||
|
{
|
||||||
|
this.originFileName = originFileName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,65 @@
|
|||||||
|
/**
|
||||||
|
* @Author: Kane Wang <wangkane@qq.com>
|
||||||
|
* @Date: 2026-02-07 21:36:35
|
||||||
|
* @LastEditors: Kane Wang
|
||||||
|
* @LastModified: 2026-02-07 21:36:35
|
||||||
|
* @FilePath: src/main/java/com/cpic/xim/utils/utils.java
|
||||||
|
* @Description:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2025 by Kane All rights reserved
|
||||||
|
*/
|
||||||
|
package com.cpic.xim.utils;
|
||||||
|
|
||||||
|
public class utils
|
||||||
|
{
|
||||||
|
public static String encodeURL( String urlString )
|
||||||
|
{
|
||||||
|
StringBuilder encodedURLString = new StringBuilder( urlString.length() * 3 );
|
||||||
|
char[] charArray = urlString.toCharArray();
|
||||||
|
|
||||||
|
for ( char c : charArray )
|
||||||
|
{
|
||||||
|
switch ( c )
|
||||||
|
{
|
||||||
|
case '%':
|
||||||
|
encodedURLString.append( PERCENT );
|
||||||
|
break;
|
||||||
|
case ' ':
|
||||||
|
encodedURLString.append( SPACING );
|
||||||
|
break;
|
||||||
|
case '+':
|
||||||
|
encodedURLString.append( PLUS );
|
||||||
|
break;
|
||||||
|
case '/':
|
||||||
|
encodedURLString.append( FORWARD_SLASH );
|
||||||
|
break;
|
||||||
|
case '?':
|
||||||
|
encodedURLString.append( QUESTION_MASK );
|
||||||
|
break;
|
||||||
|
case '&':
|
||||||
|
encodedURLString.append( AMPERSAND );
|
||||||
|
break;
|
||||||
|
case '#':
|
||||||
|
encodedURLString.append( SHARP );
|
||||||
|
break;
|
||||||
|
case '=':
|
||||||
|
encodedURLString.append( PLUS );
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
encodedURLString.append( c );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return encodedURLString.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
static final String SHARP = "%23";
|
||||||
|
static final String PLUS = "%2B";
|
||||||
|
static final String FORWARD_SLASH = "%2F";
|
||||||
|
static final String QUESTION_MASK = "%3F";
|
||||||
|
static final String SPACING = "%20";
|
||||||
|
static final String EQUAL = "%3D";
|
||||||
|
static final String PERCENT = "%25";
|
||||||
|
static final String AMPERSAND = "%26";
|
||||||
|
|
||||||
|
}
|
||||||
1031
code/web/regulatory-management-util/package-lock.json
generated
1031
code/web/regulatory-management-util/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -10,30 +10,30 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"scss": "^0.2.4",
|
"scss": "^0.2.4",
|
||||||
"vue": "^3.5.27",
|
"vue": "^3.5.28",
|
||||||
"vue-router": "^5.0.2"
|
"vue-router": "^5.0.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@element-plus/icons-vue": "^2.3.2",
|
"@element-plus/icons-vue": "^2.3.2",
|
||||||
"@eslint/css": "^0.14.1",
|
"@eslint/css": "^0.14.1",
|
||||||
"@eslint/js": "^9.39.2",
|
"@eslint/js": "^10.0.1",
|
||||||
"@eslint/json": "^1.0.0",
|
"@eslint/json": "^1.0.1",
|
||||||
"@stylistic/eslint-plugin": "^5.7.1",
|
"@stylistic/eslint-plugin": "^5.8.0",
|
||||||
"@stylistic/eslint-plugin-js": "^4.4.1",
|
"@stylistic/eslint-plugin-js": "^4.4.1",
|
||||||
"@stylistic/eslint-plugin-jsx": "^4.4.1",
|
"@stylistic/eslint-plugin-jsx": "^4.4.1",
|
||||||
"@stylistic/eslint-plugin-plus": "^4.4.1",
|
"@stylistic/eslint-plugin-plus": "^4.4.1",
|
||||||
"@stylistic/eslint-plugin-ts": "^4.4.1",
|
"@stylistic/eslint-plugin-ts": "^4.4.1",
|
||||||
"@types/node": "^25.2.0",
|
"@types/node": "^25.2.3",
|
||||||
"@typescript-eslint/eslint-plugin": "^8.54.0",
|
"@typescript-eslint/eslint-plugin": "^8.55.0",
|
||||||
"@typescript-eslint/parser": "^8.54.0",
|
"@typescript-eslint/parser": "^8.55.0",
|
||||||
"@vitejs/plugin-vue": "^6.0.4",
|
"@vitejs/plugin-vue": "^6.0.4",
|
||||||
"@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",
|
||||||
"@vue/tsconfig": "^0.8.1",
|
"@vue/tsconfig": "^0.8.1",
|
||||||
"axios": "^1.13.4",
|
"axios": "^1.13.5",
|
||||||
"element-plus": "^2.13.2",
|
"element-plus": "^2.13.2",
|
||||||
"eslint": "^9.39.2",
|
"eslint": "^10.0.0",
|
||||||
"eslint-config-prettier": "^10.1.8",
|
"eslint-config-prettier": "^10.1.8",
|
||||||
"eslint-plugin-vue": "^10.7.0",
|
"eslint-plugin-vue": "^10.7.0",
|
||||||
"globals": "^17.3.0",
|
"globals": "^17.3.0",
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
"path": "^0.12.7",
|
"path": "^0.12.7",
|
||||||
"sass": "^1.97.3",
|
"sass": "^1.97.3",
|
||||||
"typescript": "~5.9.3",
|
"typescript": "~5.9.3",
|
||||||
"typescript-eslint": "^8.54.0",
|
"typescript-eslint": "^8.55.0",
|
||||||
"vite": "^7.3.1",
|
"vite": "^7.3.1",
|
||||||
"vue-demi": "^0.14.10",
|
"vue-demi": "^0.14.10",
|
||||||
"vue-eslint-parser": "^10.2.0",
|
"vue-eslint-parser": "^10.2.0",
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ interface RegulatoryData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface RegulatoryFile {
|
interface RegulatoryFile {
|
||||||
|
regulatory_file_name_original: string;
|
||||||
regulatory_file_name: string;
|
regulatory_file_name: string;
|
||||||
file_url: string;
|
file_url: string;
|
||||||
local_file_path: string;
|
local_file_path: string;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* @Author: Kane Wang <wangkane@qq.com>
|
* @Author: Kane Wang <wangkane@qq.com>
|
||||||
* @Date: 2025-11-21 10:19:11
|
* @Date: 2025-11-21 10:19:11
|
||||||
* @LastEditors: Kane Wang
|
* @LastEditors: Kane Wang
|
||||||
* @LastModified: 2025-11-27 17:41:28
|
* @LastModified: 2026-02-06 17:43:15
|
||||||
* @FilePath: src/types/upload_file.ts
|
* @FilePath: src/types/upload_file.ts
|
||||||
* @Description:
|
* @Description:
|
||||||
*
|
*
|
||||||
@@ -18,6 +18,7 @@ interface UploadFileResponse
|
|||||||
|
|
||||||
interface UploadedFile
|
interface UploadedFile
|
||||||
{
|
{
|
||||||
|
originFileName: string;
|
||||||
fileName: string;
|
fileName: string;
|
||||||
absoluteFilePath: string;
|
absoluteFilePath: string;
|
||||||
relativeFilePath: string;
|
relativeFilePath: string;
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ interface AddNewRegulatoryResponse
|
|||||||
interface Render {
|
interface Render {
|
||||||
( resonse: AddNewRegulatoryResponse ) :void, }
|
( resonse: AddNewRegulatoryResponse ) :void, }
|
||||||
|
|
||||||
|
type CallBackRender = ( response: AddNewRegulatoryResponse ) => void;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param regulatory RegulatoryData类型制度对象,用于发送请求。
|
* @param regulatory RegulatoryData类型制度对象,用于发送请求。
|
||||||
@@ -68,5 +69,6 @@ function addNewRegulatory( regulatory: RegulatoryData, render: Render ): void
|
|||||||
export {
|
export {
|
||||||
addNewRegulatory,
|
addNewRegulatory,
|
||||||
type AddNewRegulatoryResponse,
|
type AddNewRegulatoryResponse,
|
||||||
type Render
|
type Render,
|
||||||
|
type CallBackRender
|
||||||
};
|
};
|
||||||
@@ -53,4 +53,35 @@ function getFileType( filePath: string ): string
|
|||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
export { getFileType };
|
/**
|
||||||
|
* 检查文件名中是否有无法使用的字符。
|
||||||
|
* @param filename 文件名字符串。
|
||||||
|
* @returns 检查结果。true 无问题;false表示文件名含有不合适的字符。
|
||||||
|
*/
|
||||||
|
function checkFileName( filename: string ): boolean
|
||||||
|
{
|
||||||
|
let result = true;
|
||||||
|
|
||||||
|
for ( const c of filename )
|
||||||
|
{
|
||||||
|
switch ( c )
|
||||||
|
{
|
||||||
|
case "%":
|
||||||
|
case " ":
|
||||||
|
case "+":
|
||||||
|
case "/":
|
||||||
|
case "?":
|
||||||
|
case "&":
|
||||||
|
case "#":
|
||||||
|
case "=":
|
||||||
|
result = false;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
export { getFileType, checkFileName };
|
||||||
@@ -137,6 +137,7 @@ Copyright © CPIC All rights reserved
|
|||||||
:show-file-list="false"
|
:show-file-list="false"
|
||||||
:data="ui.uploadParameters"
|
:data="ui.uploadParameters"
|
||||||
:on-success="onUploadSuccess"
|
:on-success="onUploadSuccess"
|
||||||
|
:before-upload="onBeforeUpload"
|
||||||
>
|
>
|
||||||
<el-icon class="el-icon--upload">
|
<el-icon class="el-icon--upload">
|
||||||
<upload-filled />
|
<upload-filled />
|
||||||
@@ -304,14 +305,12 @@ export default {
|
|||||||
ui.newRegulatory.regulatory_files?.splice( rowId, 1 );
|
ui.newRegulatory.regulatory_files?.splice( rowId, 1 );
|
||||||
})
|
})
|
||||||
.catch(()=>{});
|
.catch(()=>{});
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onPreviewUploadedFile = ( rowId: number ): void =>
|
const onPreviewUploadedFile = ( rowId: number ): void =>
|
||||||
{
|
{
|
||||||
// ui.showPreviewDialog = true;
|
// ui.showPreviewDialog = true;
|
||||||
ui.fileURL = ui.newRegulatory.regulatory_files[rowId]?.file_url + "/" + ui.newRegulatory.regulatory_files[rowId]?.regulatory_file_name;
|
ui.fileURL = encodeURI( ui.newRegulatory.regulatory_files[rowId]?.file_url + "/" + ui.newRegulatory.regulatory_files[rowId]?.regulatory_file_name );
|
||||||
|
|
||||||
console.log( "完整路径:", ui.fileURL );
|
console.log( "完整路径:", ui.fileURL );
|
||||||
|
|
||||||
@@ -356,7 +355,7 @@ export default {
|
|||||||
*/
|
*/
|
||||||
const onUploadSuccess: UploadProps["onSuccess"] = ( response: UploadFileResponse, uploadFile: UploadFile, uploadFiles: UploadFiles ): void =>
|
const onUploadSuccess: UploadProps["onSuccess"] = ( response: UploadFileResponse, uploadFile: UploadFile, uploadFiles: UploadFiles ): void =>
|
||||||
{
|
{
|
||||||
console.log( `上传制度文件响应:${response}` );
|
console.log( "上传制度文件响应:", response.fileList );
|
||||||
console.log( `上传文件:${uploadFile}` );
|
console.log( `上传文件:${uploadFile}` );
|
||||||
console.log( `上传多文件:${uploadFiles}` );
|
console.log( `上传多文件:${uploadFiles}` );
|
||||||
|
|
||||||
@@ -383,6 +382,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const uploadedFile: RegulatoryFile = {
|
const uploadedFile: RegulatoryFile = {
|
||||||
|
regulatory_file_name_original: response.fileList[0].originFileName ?? "",
|
||||||
regulatory_file_name: response.fileList[0].fileName ?? "",
|
regulatory_file_name: response.fileList[0].fileName ?? "",
|
||||||
local_file_path: response.fileList[0]?.absoluteFilePath ?? "",
|
local_file_path: response.fileList[0]?.absoluteFilePath ?? "",
|
||||||
file_type: getFileType( response.fileList[0]?.fileName ),
|
file_type: getFileType( response.fileList[0]?.fileName ),
|
||||||
@@ -409,6 +409,15 @@ export default {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onBeforeUpload = ( uploadFile: UploadFile ): boolean =>
|
||||||
|
{
|
||||||
|
let result = true;
|
||||||
|
|
||||||
|
console.log( "上传的文件名", uploadFile.name );
|
||||||
|
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
|
||||||
const errorHandle = ()=>
|
const errorHandle = ()=>
|
||||||
{
|
{
|
||||||
ElMessage.error( "渲染文档出错!" );
|
ElMessage.error( "渲染文档出错!" );
|
||||||
@@ -441,6 +450,7 @@ export default {
|
|||||||
onDeleteUploadedFile,
|
onDeleteUploadedFile,
|
||||||
onPreviewUploadedFile,
|
onPreviewUploadedFile,
|
||||||
onCreateNewRegulatory,
|
onCreateNewRegulatory,
|
||||||
|
onBeforeUpload,
|
||||||
errorHandle,
|
errorHandle,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user