13 Commits

Author SHA1 Message Date
a2d30f3e05 保存进度! 2026-03-20 19:42:08 +08:00
2959fd0767 Merge branch 'feature-制度管理界面' of http://222.76.244.118:3000/CPICXIM/regulatory-management-system into feature-制度管理界面 2026-03-20 00:46:37 +08:00
afafc1915d 加入复制制度文件的代码。 2026-03-19 16:27:20 +08:00
60f1fe14d9 保存进度! 2026-03-19 09:09:06 +08:00
06fdb17b75 保存进度! 2026-03-16 19:07:57 +08:00
4a090d54a9 保存进度! 2026-03-16 15:55:02 +08:00
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
19 changed files with 1835 additions and 1659 deletions

View File

@@ -0,0 +1,98 @@
/**
* @Author: Kane Wang <wangkane@qq.com>
* @Date: 2026-03-19 14:43:07
* @LastEditors: Kane Wang
* @LastModified: 2026-03-19 14:43:08
* @FilePath: src/main/java/com/cpic/xim/utils/files/RegulatoryFile.java
* @Description: 用于定义前端 AddNewRegulatoryRequest 请求中 regulatory_files 的json对象。
*
* Copyright (c) 2025 by Kane All rights reserved
*/
package com.cpic.xim.utils.files;
import com.fasterxml.jackson.annotation.JsonProperty;
public class RegulatoryFile
{
public RegulatoryFile()
{
}
public String getFileType()
{
return fileType;
}
public void setFileType( String fileType )
{
this.fileType = fileType;
}
public String getFileURL()
{
return fileURL;
}
public void setFileURL( String fileURL )
{
this.fileURL = fileURL;
}
public String getLocalFilePath()
{
return localFilePath;
}
public void setLocalFilePath( String localFilePath )
{
this.localFilePath = localFilePath;
}
public String getRegulatoryFileName()
{
return regulatoryFileName;
}
public void setRegulatoryFileName( String regulatoryFileName )
{
this.regulatoryFileName = regulatoryFileName;
}
public String getRegulatoryFileNameOriginal()
{
return regulatoryFileNameOriginal;
}
public void setRegulatoryFileNameOriginal( String regulatoryFileNameOriginal )
{
this.regulatoryFileNameOriginal = regulatoryFileNameOriginal;
}
public int getRowIndex()
{
return rowIndex;
}
public void setRowIndex( int rowIndex )
{
this.rowIndex = rowIndex;
}
@JsonProperty("file_type")
private String fileType;
@JsonProperty("file_url")
private String fileURL;
@JsonProperty("local_file_path")
private String localFilePath;
@JsonProperty("regulatory_file_name")
private String regulatoryFileName;
@JsonProperty("regulatory_file_name_original")
private String regulatoryFileNameOriginal;
@JsonProperty("rowIndex")
private int rowIndex;
}

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

View File

@@ -11,13 +11,15 @@
package com.cpic.xim.web.controllers.regulatory;
import java.io.File;
import java.io.IOException;
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 org.apache.commons.io.FileUtils;
import com.cpic.xim.utils.files.UploadedFile;
import com.cpic.xim.utils.files.RegulatoryFile;
@Controller
@RequestMapping( "/regulatory" )
@@ -26,23 +28,38 @@ public class AddNewRegulatoryController
// 制度库文件的基础目录
private static final String baseDirectory = "D:/制度库/";
/**
*
* @param request
* @return
*/
@RequestMapping( path = "/add-new-regulatory.do", method = RequestMethod.POST )
@ResponseBody
public static AddNewRegulatoryResponse addNewRegulatory( @RequestBody AddNewRegulatoryRequest request )
{
AddNewRegulatoryResponse response = new AddNewRegulatoryResponse();
AddNewRegulatoryResponse response = new AddNewRegulatoryResponse();
File regulatoryBaseDirectory = new File( baseDirectory + "/" + request.getRegulatoryName() );
// 创建目录
if ( regulatoryBaseDirectory.mkdirs() == false )
{
response.setSuccess( false );
response.setMessage( "创建制度目录失败,请联系管理员!" );
return response;
}
// 验证文件是否存在,并判断目睹路径是否有同名文件存在
for ( UploadedFile file : request.getRegulatoryFiles() )
for ( RegulatoryFile file : request.getRegulatoryFiles() )
{
String destFilePath = baseDirectory + "/" + request.getRegulatoryName() + "/" + file.getFileName();
File uploadFile = new File( file.getAbsoluteFilePath() );
String destFilePath = baseDirectory + "/" + request.getRegulatoryName() + "/" + file.getRegulatoryFileName();
File uploadFile = new File( file.getLocalFilePath() + "/" + file.getRegulatoryFileName() );
File dest = new File( destFilePath );
if ( uploadFile.exists() == false )
{
response.setSuccess( false );
response.setMessage( "文件" + file.getAbsoluteFilePath() + "不存在!" );
response.setMessage( "文件" + file.getRegulatoryFileName() + "不存在!" );
return response;
}
@@ -51,19 +68,51 @@ public class AddNewRegulatoryController
if ( dest.exists() == true )
{
response.setSuccess( false );
response.setMessage( "文件" + file.getAbsoluteFilePath() + "存在同名文件!" );
response.setMessage( "文件" + file.getRegulatoryFileName() + "存在同名文件!" );
return response;
}
}
// 复制文件
for ( UploadedFile file : request.getRegulatoryFiles() )
{
File uploadFile = new File( file.getAbsoluteFilePath() );
for ( RegulatoryFile file : request.getRegulatoryFiles() )
{
String destFilePath = baseDirectory + "/" + request.getRegulatoryName() + "/" + file.getRegulatoryFileName();
File uploadFile = new File( file.getLocalFilePath() + "/" + file.getRegulatoryFileName() );
File dest = new File( destFilePath );
// 复制文件
try
{
FileUtils.copyFile( uploadFile, dest );
}
catch ( IOException error )
{
// 出现异常,删除文件
try
{
FileUtils.deleteDirectory( regulatoryBaseDirectory );
}
catch ( Exception deleteError )
{
deleteError.printStackTrace();
}
response.setSuccess( false );
response.setMessage( "复制" + file.getRegulatoryFileNameOriginal() + "文件失败,请联系管理员!" );
return response;
}
}
//todo 写入数据库
// TO-DO: 清理上传文件的目录
response.setSuccess( true );
response.setMessage( "文件复制成功!" );
return response;
}
}

View File

@@ -2,7 +2,7 @@
* @Author: Kane Wang <wangkane@qq.com>
* @Date: 2025-12-26 17:25:13
* @LastEditors: Kane Wang
* @LastModified: 2025-12-26 21:23:04
* @LastModified: 2026-03-20 10:55:16
* @FilePath: src/main/java/com/cpic/xim/web/controllers/regulatory/AddNewRegulatoryRequest.java
* @Description:
*
@@ -11,7 +11,8 @@
package com.cpic.xim.web.controllers.regulatory;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.cpic.xim.utils.files.UploadedFile;
import com.cpic.xim.utils.files.RegulatoryFile;
import java.util.Vector;
public class AddNewRegulatoryRequest
@@ -22,22 +23,22 @@ public class AddNewRegulatoryRequest
this.regulatoryName = "";
this.departmentName = "";
this.releaseYear = "";
this.comment = "";
this.regulatoryFiles = new Vector<UploadedFile>();
this.regulatoryDesc = "";
this.regulatoryFiles = new Vector<RegulatoryFile>();
}
public AddNewRegulatoryRequest(
String regulatoryName,
String departmentName,
String releaseYear,
String comment,
Vector<UploadedFile> regulatoryFiles
String regulatoryDesc,
Vector<RegulatoryFile> regulatoryFiles
)
{
this.regulatoryName = regulatoryName;
this.departmentName = departmentName;
this.releaseYear = releaseYear;
this.comment = comment;
this.regulatoryDesc = regulatoryDesc;
this.regulatoryFiles = regulatoryFiles;
}
@@ -73,36 +74,36 @@ public class AddNewRegulatoryRequest
public String getComment()
{
return comment;
return regulatoryDesc;
}
public void setComment( String comment )
public void setComment( String regulatoryDesc )
{
this.comment = comment;
this.regulatoryDesc = regulatoryDesc;
}
public Vector<UploadedFile> getRegulatoryFiles()
public Vector<RegulatoryFile> getRegulatoryFiles()
{
return regulatoryFiles;
}
public void setRegulatoryFiles( Vector<UploadedFile> regulatoryFiles )
public void setRegulatoryFiles( Vector<RegulatoryFile> regulatoryFiles )
{
this.regulatoryFiles = regulatoryFiles;
}
@JsonProperty("regulatory_name")
@JsonProperty( "regulatory_name" )
private String regulatoryName;
@JsonProperty("department_name")
@JsonProperty( "department_name" )
private String departmentName;
@JsonProperty("release_year")
@JsonProperty( "release_year" )
private String releaseYear;
@JsonProperty("comment")
private String comment;
@JsonProperty( "regulatory_desc" )
private String regulatoryDesc;
@JsonProperty("regulatory_files")
private Vector<UploadedFile> regulatoryFiles;
@JsonProperty( "regulatory_files" )
private Vector<RegulatoryFile> regulatoryFiles;
}

File diff suppressed because it is too large Load Diff

View File

@@ -10,44 +10,44 @@
},
"dependencies": {
"scss": "^0.2.4",
"vue": "^3.5.27",
"vue-router": "^5.0.2"
"vue": "^3.5.30",
"vue-router": "^5.0.4"
},
"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/css": "^1.0.0",
"@eslint/js": "^10.0.1",
"@eslint/json": "^1.1.0",
"@stylistic/eslint-plugin": "^5.10.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",
"@vitejs/plugin-vue": "^6.0.4",
"@types/node": "^25.5.0",
"@typescript-eslint/eslint-plugin": "^8.57.1",
"@typescript-eslint/parser": "^8.57.1",
"@vitejs/plugin-vue": "^6.0.5",
"@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",
"element-plus": "^2.13.2",
"eslint": "^9.39.2",
"@vue/tsconfig": "^0.9.0",
"axios": "^1.13.6",
"element-plus": "^2.13.5",
"eslint": "^10.0.3",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-vue": "^10.7.0",
"globals": "^17.3.0",
"eslint-plugin-vue": "^10.8.0",
"globals": "^17.4.0",
"jiti": "^2.6.1",
"lodash": "^4.17.23",
"lodash-es": "^4.17.23",
"path": "^0.12.7",
"sass": "^1.97.3",
"sass": "^1.98.0",
"typescript": "~5.9.3",
"typescript-eslint": "^8.54.0",
"vite": "^7.3.1",
"typescript-eslint": "^8.57.1",
"vite": "^8.0.1",
"vue-demi": "^0.14.10",
"vue-eslint-parser": "^10.2.0",
"vue-pdf-embed": "^2.1.3",
"vue-tsc": "^3.2.4"
"vue-eslint-parser": "^10.4.0",
"vue-pdf-embed": "^2.1.4",
"vue-tsc": "^3.2.6"
}
}

View File

@@ -0,0 +1,77 @@
<template>
<el-container class="layout-container">
<el-header class="layout-header">
<LayoutHeader />
</el-header>
<el-container class="layout-container-down">
<el-aside class="layout-aside">
<LayoutAside />
</el-aside>
<el-main class="layout-main">
<LayoutMain />
</el-main>
</el-container>
</el-container>
</template>
<script lang="ts">
// 组件
import LayoutHeader from "./components/Header.vue";
import LayoutAside from "./components/Aside.vue";
import LayoutMain from "./components/Main.vue";
export default {
name: "MainFrame",
components: {
LayoutHeader,
LayoutAside,
LayoutMain,
},
setup()
{
return {};
},
};
</script>
<style lang="scss" scoped>
@media screen {
.layout-container {
height: 100vh;
width: 100vw;
max-height: 100vh;
max-width: 100vw;
.layout-header {
height: 150px;
width: 100vw;
max-height: 150px;
max-width: 100vw;
padding: 0px;
}
.layout-container-down {
height: calc(100vh - 150px);
max-height: calc(100vh - 150px);
width: 100vw;
max-width: 100vw;
.layout-aside {
height: calc(100vh - 150px);
max-height: calc(100vh - 150px);
min-height: calc(100vh - 150px);
width: 200px;
overflow-x: hidden;
background-color: #2f4156;
}
.layout-main {
padding: 0px;
height: calc(100vh - 150px);
width: calc(100vw - 200px);
}
}
}
}
</style>

View File

@@ -89,7 +89,11 @@ export default {
return userRout.path;
});
return { userRout, routes, currentPath, hasOnlyChild, };
return {
userRout,
routes,
currentPath,
hasOnlyChild, };
},
};
</script>

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

@@ -2,7 +2,7 @@
* @Author: Kane Wang <wangkane@qq.com>
* @Date: 2025-10-13 15:31:41
* @LastEditors: Kane Wang
* @LastModified: 2025-11-05 11:20:46
* @LastModified: 2026-03-20 15:13:33
* @FilePath: src/router/index.ts
* @Description:
*
@@ -54,7 +54,7 @@ const routes = [
component: () => import( "../layout/console/Index.vue" ),
children:[
{
path: "/regulatory-management",
path: "/data/regulatory-management",
name:"RegulatoryManagement",
meta: {
title: "制度文件管理",
@@ -72,7 +72,7 @@ const routes = [
component: ()=> import( "@/views/console/data/RegulatoryManagement.vue" ),
},
{
path: "/new-regulatory",
path: "/data/new-regulatory",
name: "NewRegulatory",
meta: {
title: "测试用 - 新建",

View File

@@ -13,11 +13,12 @@ interface RegulatoryData {
department_name: string;
release_year: string;
regulatory_name: string;
comment: string;
regulatory_desc: string;
regulatory_files: RegulatoryFile[];
}
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

@@ -2,7 +2,7 @@
* @Author: Kane Wang <wangkane@qq.com>
* @Date: 2026-01-05 10:42:42
* @LastEditors: Kane Wang
* @LastModified: 2026-02-04 15:37:20
* @LastModified: 2026-03-19 15:41:22
* @FilePath: src/utils/regulatory_utils.ts
* @Description:
*
@@ -18,15 +18,16 @@ interface AddNewRegulatoryResponse
message: string;
}
interface Render {
interface AddNewRegulatoryResponseRender {
( resonse: AddNewRegulatoryResponse ) :void, }
type CallBackRender = ( response: AddNewRegulatoryResponse ) => void;
/**
*
* @param regulatory RegulatoryData类型制度对象用于发送请求。
* @param render 回调函数,请求成功后调用。
*/
function addNewRegulatory( regulatory: RegulatoryData, render: Render ): void
function addNewRegulatory( regulatory: RegulatoryData, render: AddNewRegulatoryResponseRender ): void
{
// const url = API_URL.URL_ADD_NEW_REGULATORY;
@@ -68,5 +69,6 @@ function addNewRegulatory( regulatory: RegulatoryData, render: Render ): void
export {
addNewRegulatory,
type AddNewRegulatoryResponse,
type Render
type AddNewRegulatoryResponseRender,
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,27 +24,42 @@ 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>
</el-col>
<el-col :span="4">
<el-input v-model.lazy.number.trim="ui.newRegulatory.release_year" />
<el-input
ref="releaseYear"
v-model.lazy.number.trim="ui.newRegulatory.release_year"
/>
</el-col>
</el-row>
<el-row :gutter="10">
<el-col :span="1">
<span>备注</span>
<span>描述</span>
</el-col>
<el-col :span="10">
<el-input v-model.lazy.trim="ui.newRegulatory.comment" type="textarea" :rows="3" />
<el-input
ref="regulatoryDesc"
v-model.lazy.trim="ui.newRegulatory.regulatory_desc"
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 +68,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 +79,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 +127,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 +141,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 +152,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 +161,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 +177,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
@@ -163,7 +205,7 @@ Copyright © CPIC All rights reserved
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 { addNewRegulatory, type AddNewRegulatoryResponse, type Render} from "@/utils/regulatory_utils.ts";
import { addNewRegulatory, type AddNewRegulatoryResponse, type AddNewRegulatoryResponseRender} from "@/utils/regulatory_utils.ts";
import { type UploadedFile, type UploadFileResponse } from "@/types/upload_file.ts";
import {API_URL} from "@/utils/config.ts";
import { getFileType } from "@/utils/utils";
@@ -171,7 +213,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 +235,9 @@ interface UI{
export default {
name: "NewRegulatory",
components: {VueOfficePdf, VueOfficeDocx, VueOfficeExcel,},
components: {VueOfficePdf,
VueOfficeDocx,
VueOfficeExcel,},
setup()
{
const ui: UI = reactive({
@@ -208,7 +252,7 @@ export default {
department_name: "",
release_year: "",
regulatory_name: "",
comment: "",
regulatory_desc: "",
regulatory_files: [],
},
showFileList: false,
@@ -218,11 +262,10 @@ export default {
fileURL: "",
});
const render: Render = function ( response: AddNewRegulatoryResponse ) :void
{
// if ( response.success === true )
// { }
};
const regulatoryName = ref<any>( null );
const departmentName = ref<any>( null );
const releaseYear = ref<any>( null );
const regulatoryDesc = ref<any>( null );
const headerCellStyle = reactive(
{
@@ -238,7 +281,7 @@ export default {
ui.showUploadDialog = true;
};
/*表格操作相关 */
/* 表格操作相关 */
/**
* 删除对应的上传文件记录。
* @param rowId 行号
@@ -262,8 +305,6 @@ export default {
ui.newRegulatory.regulatory_files?.splice( rowId, 1 );
})
.catch(()=>{});
};
const onPreviewUploadedFile = ( rowId: number ): void =>
@@ -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,87 @@ export default {
}
};
const onBeforeUpload = ( uploadFile: UploadFile ): boolean =>
{
const result = true;
console.log( "上传的文件名", uploadFile.name );
return result;
};
const errorHandle = ()=>
{
ElMessage.error( "渲染文档出错!" );
};
const render: AddNewRegulatoryResponseRender = function ( response: AddNewRegulatoryResponse ) :void
{
if ( response?.success !== true )
{
const message = `创建制度失败:${response?.message}`;
ElMessageBox.alert( message, "错误" );
}
};
/**
* 创建新制度事件
*/
const onCreateNewRegulatory = () =>
{
console.log( "准备提交制度对象:", ui.newRegulatory );
// 防御验证
if ( ui.newRegulatory.regulatory_name.length === 0 )
{
ElMessage.error( "制度名称名称不能为空!" );
regulatoryName.value.focus();
return;
}
if ( ui.newRegulatory.department_name.length === 0 )
{
ElMessage.error( "部门名称不能为空!" );
departmentName.value.focus();
return;
}
if ( ui.newRegulatory.release_year.length === 0 )
{
ElMessage.error( "发布年份不能为空!" );
releaseYear.value.focus();
return;
}
if ( ui.newRegulatory.regulatory_desc.length === 0 )
{
ElMessage.error( "制度描述为空!" );
regulatoryDesc.value.focus();
return;
}
if ( ui.newRegulatory.regulatory_files.length === 0 )
{
ElMessage.error( "没有上传相关制度文件!" );
return;
}
addNewRegulatory( ui.newRegulatory, render );
};
return {
ui,
regulatoryName,
headerCellStyle,
cellStyle,
onUploadSuccess,
@@ -380,6 +497,9 @@ export default {
showUploadFileDialog,
onDeleteUploadedFile,
onPreviewUploadedFile,
onCreateNewRegulatory,
render,
onBeforeUpload,
errorHandle,
};
},

View File

@@ -1,22 +1,39 @@
<!--
author: Kane Wang <wangkane@qq.com>
date: 2025-10-23 21:40:24
component: RegulatoryManagement
component: Overview
Copyright © CPIC All rights reserved
-->
<template>
<div class="wrapper">
总览
<ElButton
type="primary"
icon="document"
@click="testRoute()"
>
测试路由
</ElButton>
</div>
</template>
<script lang="ts">
import { ElButton } from "element-plus";
import {useRoute, useRouter} from "vue-router";
export default {
name: "OverViews",
setup()
{
const ui = {};
const route = useRoute();
const router = useRouter();
return { ui, };
const testRoute = () =>
{
console.log("当前Path", route.path );
};
return { ui, testRoute, };
},
};
</script>

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