7 Commits

Author SHA1 Message Date
fe0f67a777 111 2026-02-14 18:23:42 +08:00
3c8bb51c41 保存进度 2026-02-09 00:42:01 +08:00
858b79942d 1、增加文件名中特殊字符编码功能,防止生成url时出现错误。
2、前端加入保留文件名原名。
2026-02-06 19:31:22 +08:00
e9c3aee252 保存进度 2026-02-06 01:01:30 +08:00
f6f9543455 保存进度 2026-02-05 20:04:40 +08:00
7b4e79b2eb 保存进度 2026-02-05 20:01:27 +08:00
4d12c3b794 保存进度! 2026-02-05 18:43:16 +08:00
12 changed files with 874 additions and 610 deletions

View File

@@ -2,7 +2,7 @@
* @Author: Kane Wang <wangkane@qq.com>
* @Date: 2025-10-16 09:46:42
* @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
* @Description:
*
@@ -128,7 +128,7 @@ public class SaveUploadFile
file.transferTo( destFile );
uploadedFile = new UploadedFile( fileName, fullPath, relativeFilePath );
uploadedFile = new UploadedFile( file.getOriginalFilename(), fileName, fullPath, relativeFilePath );
savedFiles.add( uploadedFile );
}
@@ -175,4 +175,54 @@ public class SaveUploadFile
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";
}

View File

@@ -2,7 +2,7 @@
* @Author: Kane Wang <wangkane@qq.com>
* @Date: 2025-10-31 17:33:13
* @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
* @Description:
*
@@ -18,6 +18,9 @@ import com.fasterxml.jackson.annotation.JsonProperty;
*/
public class UploadedFile
{
@JsonProperty("originFileName")
private String originFileName;
@JsonProperty( "fileName" )
private String fileName;
@@ -60,17 +63,21 @@ public class 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.absoluteFilePath = absoluteFilePath;
this.relativeFilePath = relativeFilePath;
}
public UploadedFile( String fileName, String absoluteFilePath )
public String getOriginFileName()
{
this.fileName = fileName;
this.absoluteFilePath = absoluteFilePath;
this.relativeFilePath = "";
return originFileName;
}
public void setOriginFileName( String originFileName )
{
this.originFileName = originFileName;
}
}

View File

@@ -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";
}

File diff suppressed because it is too large Load Diff

View File

@@ -10,30 +10,30 @@
},
"dependencies": {
"scss": "^0.2.4",
"vue": "^3.5.27",
"vue": "^3.5.28",
"vue-router": "^5.0.2"
},
"devDependencies": {
"@element-plus/icons-vue": "^2.3.2",
"@eslint/css": "^0.14.1",
"@eslint/js": "^9.39.2",
"@eslint/json": "^1.0.0",
"@stylistic/eslint-plugin": "^5.7.1",
"@eslint/js": "^10.0.1",
"@eslint/json": "^1.0.1",
"@stylistic/eslint-plugin": "^5.8.0",
"@stylistic/eslint-plugin-js": "^4.4.1",
"@stylistic/eslint-plugin-jsx": "^4.4.1",
"@stylistic/eslint-plugin-plus": "^4.4.1",
"@stylistic/eslint-plugin-ts": "^4.4.1",
"@types/node": "^25.2.0",
"@typescript-eslint/eslint-plugin": "^8.54.0",
"@typescript-eslint/parser": "^8.54.0",
"@types/node": "^25.2.3",
"@typescript-eslint/eslint-plugin": "^8.55.0",
"@typescript-eslint/parser": "^8.55.0",
"@vitejs/plugin-vue": "^6.0.4",
"@vue-office/docx": "^1.6.3",
"@vue-office/excel": "^1.7.14",
"@vue-office/pdf": "^2.0.10",
"@vue/tsconfig": "^0.8.1",
"axios": "^1.13.4",
"axios": "^1.13.5",
"element-plus": "^2.13.2",
"eslint": "^9.39.2",
"eslint": "^10.0.0",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-vue": "^10.7.0",
"globals": "^17.3.0",
@@ -43,7 +43,7 @@
"path": "^0.12.7",
"sass": "^1.97.3",
"typescript": "~5.9.3",
"typescript-eslint": "^8.54.0",
"typescript-eslint": "^8.55.0",
"vite": "^7.3.1",
"vue-demi": "^0.14.10",
"vue-eslint-parser": "^10.2.0",

View File

@@ -15,7 +15,6 @@ import * as ElementPlusIconsVue from "@element-plus/icons-vue";
import "element-plus/dist/index.css";
// eslint-disable-next-line
const app = createApp( AppMain );
app.use( ElementPlus );
@@ -29,5 +28,4 @@ for ( const [key, component,] of Object.entries( ElementPlusIconsVue ))
app.mount( "#app" );
// eslint-disable-next-line
// createApp( App ).mount( "#app" );

View File

@@ -18,6 +18,7 @@ interface RegulatoryData {
}
interface RegulatoryFile {
regulatory_file_name_original: string;
regulatory_file_name: string;
file_url: string;
local_file_path: string;

View File

@@ -2,7 +2,7 @@
* @Author: Kane Wang <wangkane@qq.com>
* @Date: 2025-11-21 10:19:11
* @LastEditors: Kane Wang
* @LastModified: 2025-11-27 17:41:28
* @LastModified: 2026-02-06 17:43:15
* @FilePath: src/types/upload_file.ts
* @Description:
*
@@ -18,6 +18,7 @@ interface UploadFileResponse
interface UploadedFile
{
originFileName: string;
fileName: string;
absoluteFilePath: string;
relativeFilePath: string;

View File

@@ -21,6 +21,7 @@ interface AddNewRegulatoryResponse
interface Render {
( resonse: AddNewRegulatoryResponse ) :void, }
type CallBackRender = ( response: AddNewRegulatoryResponse ) => void;
/**
*
* @param regulatory RegulatoryData类型制度对象用于发送请求。
@@ -68,5 +69,6 @@ function addNewRegulatory( regulatory: RegulatoryData, render: Render ): void
export {
addNewRegulatory,
type AddNewRegulatoryResponse,
type Render
type Render,
type CallBackRender
};

View File

@@ -53,4 +53,35 @@ function getFileType( filePath: string ): string
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 };

View File

@@ -12,7 +12,11 @@ Copyright © CPIC All rights reserved
<span>名称</span>
</el-col>
<el-col :span="10">
<el-input v-model.trim.lazy="ui.newRegulatory.regulatory_name" style="text-align:center;" />
<el-input
ref="regulatoryName"
v-model.trim.lazy="ui.newRegulatory.regulatory_name"
style="text-align:center;"
/>
</el-col>
</el-row>
<el-row :gutter="10">
@@ -20,7 +24,10 @@ Copyright © CPIC All rights reserved
<span>部门</span>
</el-col>
<el-col :span="4">
<el-input v-model.trim="ui.newRegulatory.department_name" />
<el-input
ref="departmentName"
v-model.trim="ui.newRegulatory.department_name"
/>
</el-col>
<el-col :span="2">
<span>发布修订年份</span>
@@ -34,13 +41,21 @@ Copyright © CPIC All rights reserved
<span>备注</span>
</el-col>
<el-col :span="10">
<el-input v-model.lazy.trim="ui.newRegulatory.comment" type="textarea" :rows="3" />
<el-input
v-model.lazy.trim="ui.newRegulatory.comment"
type="textarea"
:rows="3"
/>
</el-col>
</el-row>
<el-row :gutter="10">
<el-col :span="3">
<div class="button-wrapper-left">
<el-button type="primary" icon="document" @click="showUploadFileDialog">
<el-button
type="primary"
icon="document"
@click="showUploadFileDialog"
>
新增文档
</el-button>
</div>
@@ -49,8 +64,9 @@ Copyright © CPIC All rights reserved
<el-col :span="3">
<div class="button-wrapper-right">
<el-button
type="primary" icon="document"
@click="onPreviewUploadedFile(1)"
type="primary"
icon="document"
@click="onCreateNewRegulatory()"
>
提交
</el-button>
@@ -59,32 +75,46 @@ Copyright © CPIC All rights reserved
</el-row>
</div>
<el-table
width="100%" stripe
width="100%"
stripe
border="true"
:head-cell-style="headerCellStyle"
:row-class-name="tableRowClassName"
empty-text="请上传文件"
:data="ui.newRegulatory.regulatory_files"
>
<el-table-column label="文件名" align="center">
<el-table-column
label="文件名"
align="center"
>
<template #default="file">
<span>{{ file.row.regulatory_file_name }}</span>
</template>
</el-table-column>
<el-table-column label="文件类型" align="center" width="200px">
<el-table-column
label="文件类型"
align="center"
width="200px"
>
<template #default="file">
<span>{{ file.row.file_type }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="200px">
<el-table-column
label="操作"
align="center"
width="200px"
>
<template #default="file">
<el-button
type="primary" icon="search"
type="primary"
icon="search"
circle
@click="onPreviewUploadedFile(file.row.rowIndex)"
/>
<el-button
type="danger" icon="delete"
type="danger"
icon="delete"
circle
@click="onDeleteUploadedFile(file.row.rowIndex)"
/>
@@ -93,9 +123,11 @@ Copyright © CPIC All rights reserved
</el-table>
<div class="upload-dialog-wrapper">
<el-dialog
v-model="ui.showUploadDialog" title="上传文件"
v-model="ui.showUploadDialog"
title="上传文件"
width="600px"
:close-on-click-model="false" :close-on-press-escape="false"
:close-on-click-model="false"
:close-on-press-escape="false"
:show-close="true"
>
<el-upload
@@ -105,6 +137,7 @@ Copyright © CPIC All rights reserved
:show-file-list="false"
:data="ui.uploadParameters"
:on-success="onUploadSuccess"
:before-upload="onBeforeUpload"
>
<el-icon class="el-icon--upload">
<upload-filled />
@@ -115,7 +148,8 @@ Copyright © CPIC All rights reserved
</el-upload>
</el-dialog>
<el-dialog
v-model="ui.isPDF" :close-on-click-model="false"
v-model="ui.isPDF"
:close-on-click-model="false"
:close-on-press-escape="false"
:show-close="true"
align-center
@@ -123,13 +157,15 @@ Copyright © CPIC All rights reserved
width="1024px"
>
<VueOfficePdf
v-if="ui.isPDF" :src="ui.fileURL"
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"
v-model="ui.isDOCX"
:close-on-click-model="false"
:close-on-press-escape="false"
:show-close="true"
align-center
@@ -137,13 +173,15 @@ Copyright © CPIC All rights reserved
width="1024px"
>
<VueOfficeDocx
v-if="ui.isDOCX" :src="ui.fileURL"
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"
v-model="ui.isXLSX"
:close-on-click-model="false"
:close-on-press-escape="false"
:show-close="true"
align-center
@@ -171,7 +209,7 @@ 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";
@@ -193,7 +231,9 @@ interface UI{
export default {
name: "NewRegulatory",
components: {VueOfficePdf, VueOfficeDocx, VueOfficeExcel,},
components: {VueOfficePdf,
VueOfficeDocx,
VueOfficeExcel,},
setup()
{
const ui: UI = reactive({
@@ -218,6 +258,9 @@ export default {
fileURL: "",
});
const regulatoryName = ref<any>( null );
const render: Render = function ( response: AddNewRegulatoryResponse ) :void
{
// if ( response.success === true )
@@ -238,7 +281,7 @@ export default {
ui.showUploadDialog = true;
};
/*表格操作相关 */
/* 表格操作相关 */
/**
* 删除对应的上传文件记录。
* @param rowId 行号
@@ -262,14 +305,12 @@ export default {
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;
ui.fileURL = encodeURI( ui.newRegulatory.regulatory_files[rowId]?.file_url + "/" + ui.newRegulatory.regulatory_files[rowId]?.regulatory_file_name );
console.log( "完整路径:", ui.fileURL );
@@ -298,7 +339,8 @@ export default {
* 其中给row加一个参数rowIndex用行号赋值。
* @param element-plus给于的参数
*/
const tableRowClassName = ({row, rowIndex,}: {row:any, rowIndex:number}): void =>
const tableRowClassName = ({row, rowIndex,}: {row:any,
rowIndex:number}): void =>
{
console.log( `${row}设置行号${rowIndex}` );
@@ -313,7 +355,7 @@ export default {
*/
const onUploadSuccess: UploadProps["onSuccess"] = ( response: UploadFileResponse, uploadFile: UploadFile, uploadFiles: UploadFiles ): void =>
{
console.log( `上传制度文件响应:${response}` );
console.log( "上传制度文件响应:", response.fileList );
console.log( `上传文件:${uploadFile}` );
console.log( `上传多文件:${uploadFiles}` );
@@ -340,6 +382,7 @@ export default {
}
const uploadedFile: RegulatoryFile = {
regulatory_file_name_original: response.fileList[0].originFileName ?? "",
regulatory_file_name: response.fileList[0].fileName ?? "",
local_file_path: response.fileList[0]?.absoluteFilePath ?? "",
file_type: getFileType( response.fileList[0]?.fileName ),
@@ -366,13 +409,39 @@ export default {
}
};
const onBeforeUpload = ( uploadFile: UploadFile ): boolean =>
{
let result = true;
console.log( "上传的文件名", uploadFile.name );
return result;
};
const errorHandle = ()=>
{
ElMessage.error( "渲染文档出错!" );
};
/**
* 创建新制度事件
*/
const onCreateNewRegulatory = () =>
{
console.log( "制度对象:", ui.newRegulatory );
// 防御验证
if ( ui.newRegulatory.department_name.length === 0 )
{
ElMessage.error( "制度名称为空!" );
console.log( regulatoryName );
regulatoryName.value.focus();
}
};
return {
ui,
regulatoryName,
headerCellStyle,
cellStyle,
onUploadSuccess,
@@ -380,6 +449,8 @@ export default {
showUploadFileDialog,
onDeleteUploadedFile,
onPreviewUploadedFile,
onCreateNewRegulatory,
onBeforeUpload,
errorHandle,
};
},

View File

@@ -160,3 +160,142 @@ new Error().stack.split('\n');
new Error().stack!.split('\n');
```
# mysql
my.cnf 文件
```
[client]
port = 3306
socket =/mysql/data/mysqltmp/mysqld.sock
default-character-set = utf8mb4
[mysql]
prompt = [\\u@\\h][\\d]>\\_
[mysqld]
# basic settings #
port = 3306 #服务器的端口号
#路径设置,必须和上文的一致
basedir = /mysql/mysql-9.5.0
datadir = /mysql/data/mysqldata_u01/mysqldb
socket = /mysql/data/mysqltmp/mysqld.sock
pid-file = /mysql/mysql-9.5.0/mysqld.pid
tmpdir = /mysql/data/mysqltmp
user = mysql
sql_mode = "STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER"
autocommit = 1
character_set_server=utf8mb4
transaction_isolation = READ-COMMITTED
explicit_defaults_for_timestamp = 1
max_allowed_packet = 96M
slave_pending_jobs_size_max= 100M
event_scheduler = 1
lower_case_table_names = 1
# connection #
interactive_timeout = 1800
wait_timeout = 1800
lock_wait_timeout = 1800
skip_name_resolve = 1
max_connections = 1000
max_user_connections = 1000
max_connect_errors = 10
# session memory setting #
read_buffer_size = 2M
read_rnd_buffer_size = 4M
sort_buffer_size = 4M
tmp_table_size = 8M
join_buffer_size = 8M
# log settings #
slow_query_log = 1
log-error =/mysqlslowlog/error.log
slow-query-log-file=/mysqlslowlog/slowquery.log
general_log_file = /mysqlslowlog/general.log
log_queries_not_using_indexes = 1
log_slow_admin_statements = 1
log_slow_slave_statements = 1
log_throttle_queries_not_using_indexes = 10
expire_logs_days = 5
long_query_time = 2
min_examined_row_limit = 100
binlog-rows-query-log-events = 1
log-bin-trust-function-creators = 1
log-slave-updates = 1
# innodb settings #
innodb_page_size = 16K
innodb_buffer_pool_size=20G
innodb_buffer_pool_instances = 16
innodb_buffer_pool_load_at_startup = 1
innodb_buffer_pool_dump_at_shutdown = 1
innodb_lru_scan_depth = 1024
innodb_lock_wait_timeout = 5
innodb_io_capacity = 2048
innodb_io_capacity_max = 4096
innodb_flush_method = O_DIRECT
innodb_file_format = Barracuda
innodb_file_format_max = Barracuda
innodb_undo_logs = 128
innodb_undo_tablespaces = 3
innodb_flush_neighbors = 1
innodb_log_file_size = 1G
innodb_log_files_in_group = 2
innodb_log_buffer_size = 2M
innodb_purge_threads = 4
innodb_large_prefix = 1
innodb_thread_concurrency = 16
innodb_print_all_deadlocks = 1
innodb_strict_mode = 1
innodb_sort_buffer_size = 4M
innodb_write_io_threads = 4
innodb_read_io_threads = 4
innodb_file_per_table = 1
innodb_stats_persistent_sample_pages = 64
innodb_autoinc_lock_mode = 2
# semi sync replication settings #
plugin_load = "validate_password.so;rpl_semi_sync_master=semisync_master.so;rpl_semi_sync_slave=semisync_slave.so"
rpl_semi_sync_master_enabled = 1
rpl_semi_sync_master_timeout = 3000
rpl_semi_sync_slave_enabled = 1
# password plugin #
#密码策略密码16字节长数字字母大小写和特殊字符每种至少两个字符。
validate_password_policy=2
validate_password_length=16
validate_password_mixed_case_count=2
validate_password_number_count=2
validate_password_special_char_count=3
# 5.7 #
# new innodb setting #
loose_innodb_numa_interleave=1
innodb_buffer_pool_dump_pct = 40
innodb_page_cleaners = 4
innodb_undo_log_truncate = 1
innodb_max_undo_log_size = 2G
innodb_purge_rseg_truncate_frequency = 128
# new replication setting #
slave-parallel-type = LOGICAL_CLOCK
slave-parallel-workers = 8
slave_preserve_commit_order=1
slave_transaction_retries=128
# other change setting #
binlog_gtid_simple_recovery=1
log_timestamps=system
show_compatibility_56=on
# patch #
symbolic_links=0
```
初始化
```
/mysql/mysql-9.5.0/bin/mysqld --defaults-file=/etc/my.cnf --user=mysql --initialize --console
```
root密码 p)daqvACh5<s