This commit is contained in:
神仙都没用 2025-02-20 00:17:24 +08:00
parent 75aeb24bcf
commit d9a13b33c3
71 changed files with 4368 additions and 6637 deletions

1
.gitignore vendored
View File

@ -1,7 +1,6 @@
.DS_Store .DS_Store
node_modules/ node_modules/
/dist/ /dist/
/build/
dist-ssr/ dist-ssr/
# Log files # Log files

9
.prettierrc Normal file
View File

@ -0,0 +1,9 @@
{
"tabWidth": 4,
"useTabs": true,
"semi": true,
"jsxBracketSameLine": true,
"singleQuote": false,
"printWidth": 100,
"trailingComma": "none"
}

2528
build/cool/eps.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

1
build/cool/eps.json Normal file

File diff suppressed because one or more lines are too long

View File

@ -13,7 +13,7 @@
"format": "prettier --write src/" "format": "prettier --write src/"
}, },
"dependencies": { "dependencies": {
"@cool-vue/crud": "^8.0.0", "@cool-vue/crud": "^8.0.1",
"@element-plus/icons-vue": "^2.3.1", "@element-plus/icons-vue": "^2.3.1",
"@vueuse/core": "^12.5.0", "@vueuse/core": "^12.5.0",
"@wangeditor/editor": "^5.1.23", "@wangeditor/editor": "^5.1.23",

View File

@ -407,6 +407,9 @@ declare namespace ClTable {
on?: { on?: {
[key: string]: (...args: any[]) => void; [key: string]: (...args: any[]) => void;
}; };
props?: {
[key: string]: any;
};
plugins?: Plugin[]; plugins?: Plugin[];
onRowContextmenu?(row: T, column: any, event: any): void; onRowContextmenu?(row: T, column: any, event: any): void;
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "@cool-vue/crud", "name": "@cool-vue/crud",
"version": "8.0.0", "version": "8.0.1",
"private": false, "private": false,
"main": "./dist/index.umd.js", "main": "./dist/index.umd.js",
"module": "./dist/index.es.js", "module": "./dist/index.es.js",

View File

@ -57,7 +57,9 @@ export default defineComponent({
// 权限 // 权限
permission: {}, permission: {},
// 事件 // 事件
mitt mitt,
// 配置
config
}, },
cloneDeep({ dict, permission }) cloneDeep({ dict, permission })
) )

View File

@ -25,6 +25,11 @@ export function useTable(props: any) {
config.on = {}; config.on = {};
} }
// 参数
if (!config.props) {
config.props = {};
}
return { Table, config }; return { Table, config };
} }

View File

@ -126,6 +126,7 @@ export default defineComponent({
<el-table class="cl-table" ref={Table} v-loading={crud.loading} />, <el-table class="cl-table" ref={Table} v-loading={crud.loading} />,
{ {
...config.on, ...config.on,
...config.props,
// config // config
maxHeight: config.autoHeight ? ctx.maxHeight.value : null, maxHeight: config.autoHeight ? ctx.maxHeight.value : null,
@ -145,7 +146,6 @@ export default defineComponent({
highlightCurrentRow: style.table.highlightCurrentRow, highlightCurrentRow: style.table.highlightCurrentRow,
resizable: style.table.resizable, resizable: style.table.resizable,
stripe: style.table.stripe, stripe: style.table.stripe,
}, },
{ {
default() { default() {

View File

@ -1027,6 +1027,9 @@ export declare function useTable(props: any): {
on?: { on?: {
[key: string]: (...args: any[]) => void; [key: string]: (...args: any[]) => void;
}; };
props?: {
[key: string]: any;
};
plugins?: ClTable.Plugin[]; plugins?: ClTable.Plugin[];
onRowContextmenu?: (row: any, column: any, event: any) => void; onRowContextmenu?: (row: any, column: any, event: any) => void;
}; };

10
pnpm-lock.yaml generated
View File

@ -9,8 +9,8 @@ importers:
.: .:
dependencies: dependencies:
'@cool-vue/crud': '@cool-vue/crud':
specifier: ^8.0.0 specifier: ^8.0.1
version: 8.0.0(typescript@5.5.4) version: 8.0.1(typescript@5.5.4)
'@element-plus/icons-vue': '@element-plus/icons-vue':
specifier: ^2.3.1 specifier: ^2.3.1
version: 2.3.1(vue@3.5.13(typescript@5.5.4)) version: 2.3.1(vue@3.5.13(typescript@5.5.4))
@ -331,8 +331,8 @@ packages:
resolution: {integrity: sha512-Y3IR1cRnOxOCDvMmNiym7XpXQ93iGDDPHx+Zj+NM+rg0fBaShfQLkg+hKPaZCEvg5N/LeCo4+Rj/i3FuJsIQaw==} resolution: {integrity: sha512-Y3IR1cRnOxOCDvMmNiym7XpXQ93iGDDPHx+Zj+NM+rg0fBaShfQLkg+hKPaZCEvg5N/LeCo4+Rj/i3FuJsIQaw==}
engines: {node: '>=6.9.0'} engines: {node: '>=6.9.0'}
'@cool-vue/crud@8.0.0': '@cool-vue/crud@8.0.1':
resolution: {integrity: sha512-4KneWQBEwf9WNkhNe97p+ua7ae5+tANhRP9DdiclJSXvriSEjdXV5VzeMh4vnJJFtYkNBMZWKIti+MCWzPNW9Q==} resolution: {integrity: sha512-qITCLcmc5gCiqF2J2I5KsiywqTc/+4Umqy9MBx1dFsYvYfrGcqoRcybcz8cTO4CEDyIv0icymt4PRuKOf01igw==}
'@cool-vue/vite-plugin@8.0.0': '@cool-vue/vite-plugin@8.0.0':
resolution: {integrity: sha512-XNVTF+NUyyW5qVfyOusD6KUVT5IbbX11zI5PuFjUXXwMjMauwGN2/BT7/TM5IoWwa7Cwul8TPG5rr+h3KyA5sg==} resolution: {integrity: sha512-XNVTF+NUyyW5qVfyOusD6KUVT5IbbX11zI5PuFjUXXwMjMauwGN2/BT7/TM5IoWwa7Cwul8TPG5rr+h3KyA5sg==}
@ -3079,7 +3079,7 @@ snapshots:
'@babel/helper-string-parser': 7.25.9 '@babel/helper-string-parser': 7.25.9
'@babel/helper-validator-identifier': 7.25.9 '@babel/helper-validator-identifier': 7.25.9
'@cool-vue/crud@8.0.0(typescript@5.5.4)': '@cool-vue/crud@8.0.1(typescript@5.5.4)':
dependencies: dependencies:
'@vue/runtime-core': 3.5.13 '@vue/runtime-core': 3.5.13
element-plus: 2.9.4(vue@3.5.13(typescript@5.5.4)) element-plus: 2.9.4(vue@3.5.13(typescript@5.5.4))

View File

@ -1,8 +1,29 @@
{ {
"删除": "Delete",
"新增成员": "Add Member",
"目录": "Directory",
"菜单": "Menu",
"权限": "Permission",
"是否显示": "Show/Hide",
"图标": "Icon",
"节点路由": "Node Route",
"路由缓存": "Route Cache",
"文件路径": "File Path",
"排序号": "Sorting Number",
"节点类型": "Node Type",
"节点名称": "Node Name",
"上级节点": "Parent Node",
"请输入节点路由,如:/test": "Please enter the node route, e.g.: /test",
"开启": "Enable",
"关闭": "Disable",
"请填写排序号": "Please fill in the sorting number",
"导入": "Import",
"如遇到问题无法导入菜单,请检查文件并尝试重新导入。": "If you encounter problems importing the menu, please check the file and try to import again.",
"角色标签": "Character Tag",
"请填写新密码": "Please fill in the new password", "请填写新密码": "Please fill in the new password",
"保存修改": "Save Changes", "保存修改": "Save Changes",
"修改成功": "Modification Successful", "修改成功": "Modification Successful",
"拼命加载中": "Loading hard", "拼命加载中": "Loading拼命",
"转移": "Transfer", "转移": "Transfer",
"搜索用户名、姓名": "Search Username, Name", "搜索用户名、姓名": "Search Username, Name",
"用户列表": "User List", "用户列表": "User List",
@ -11,7 +32,7 @@
"部门名称": "Department Name", "部门名称": "Department Name",
"角色": "Role", "角色": "Role",
"状态": "Status", "状态": "Status",
"手机号码": "Mobile Number", "手机号码": "Mobile Phone Number",
"选择头像": "Select Avatar", "选择头像": "Select Avatar",
"密码": "Password", "密码": "Password",
"密码长度在 6 到 16 个字符": "Password length should be between 6 and 16 characters", "密码长度在 6 到 16 个字符": "Password length should be between 6 and 16 characters",
@ -19,7 +40,6 @@
"启用": "Enable", "启用": "Enable",
"禁用": "Disable", "禁用": "Disable",
"部门转移": "Department Transfer", "部门转移": "Department Transfer",
"角色标签": "Character Tag",
"请输入备注": "Please enter remarks", "请输入备注": "Please enter remarks",
"清空": "Clear", "清空": "Clear",
"日志保存天数": "Log save days", "日志保存天数": "Log save days",
@ -27,12 +47,12 @@
"用户ID": "User ID", "用户ID": "User ID",
"用户昵称": "User nickname", "用户昵称": "User nickname",
"请求地址": "Request address", "请求地址": "Request address",
"参数": "Parameters", "参数": "Parameter",
"请求时间": "Request time", "请求时间": "Request time",
"保存成功": "Saved successfully", "保存成功": "Save successful",
"是否要清空日志?": "Do you want to clear the log?", "是否要清空日志?": "Do you want to clear the log?",
"提示": "Tip", "提示": "Tip",
"清空成功": "Cleared successfully", "清空成功": "Clear successful",
"基本信息": "Basic information", "基本信息": "Basic information",
"头像": "Avatar", "头像": "Avatar",
"昵称": "Nickname", "昵称": "Nickname",
@ -40,26 +60,6 @@
"原密码": "Original password", "原密码": "Original password",
"请填写原密码": "Please fill in the original password", "请填写原密码": "Please fill in the original password",
"新密码": "New password", "新密码": "New password",
"个人中心": "Personal Center",
"正在加载资源...": "Loading resources...",
"初次加载资源可能需要较多时间,请耐心等待": "It may take some time for the initial resource loading. Please wait patiently.",
"搜索名称": "Search Name",
"是否关联上下级": "Whether to associate with upper and lower levels",
"名称": "Name",
"标识": "Identifier",
"备注": "Remark",
"功能权限": "Function Permission",
"数据权限": "Data Permission",
"创建时间": "Creation Time",
"更新时间": "Update Time",
"数据类型": "Data Type",
"搜索名称、keyName": "Search Name, keyName",
"字符串": "String",
"富文本": "Rich Text",
"文件": "File",
"请输入Key": "Please enter Key",
"类型": "Type",
"数据": "Data",
"菜单导入": "Menu Import", "菜单导入": "Menu Import",
"添加": "Add", "添加": "Add",
"导入成功": "Import Success", "导入成功": "Import Success",
@ -74,52 +74,12 @@
"关闭当前": "Close Current", "关闭当前": "Close Current",
"关闭其他": "Close Others", "关闭其他": "Close Others",
"关闭所有": "Close All", "关闭所有": "Close All",
"{label} 没有子菜单,请先添加": "{label} has no submenus, please add first", "{label} 没有子菜单,请先添加": "{label} has no sub-menus. Please add them first",
"快速开发后台权限管理系统": "Quick Development Background Permission Management System", "快速开发后台权限管理系统": "Quick Development Background Permission Management System",
"请输入用户名": "Please enter username", "请输入用户名": "Please enter your username",
"请输入密码": "Please enter password", "请输入密码": "Please enter your password",
"验证码": "Verification Code", "验证码": "Verification Code",
"登录": "Log in", "登录": "Log in",
"删除": "Delete",
"新增成员": "Add Member",
"目录": "Directory",
"菜单": "Menu",
"权限": "Permission",
"是否显示": "Display",
"图标": "Icon",
"节点路由": "Node Route",
"路由缓存": "Route Cache",
"文件路径": "File Path",
"排序号": "Sorting Number",
"节点类型": "Node Type",
"节点名称": "Node Name",
"上级节点": "Parent Node",
"请输入节点路由,如:/test": "Please enter the node route, e.g.: /test",
"开启": "Enable",
"关闭": "Disable",
"请填写排序号": "Please fill in the sorting number",
"导入": "Import",
"如遇到问题无法导入菜单,请检查文件并尝试重新导入。": "If you encounter problems importing the menu, please check the file and try re-importing.",
"选择部门": "Select Department",
"请选择部门": "Please select department",
"转移到新部门,是否继续?": "Transfer to a new department. Do you want to continue?",
"转移成功": "Transfer successful",
"组织架构": "Organization Structure",
"刷新": "Refresh",
"拖动排序": "Drag to sort",
"编辑部门": "Edit Department",
"上级部门": "Superior Department",
"排序": "Sort",
"新增部门 “{name}” 成功": "Successfully added a new department “{name}”",
"删除成功": "Delete successful",
"“{name}” 部门的用户已成功转移到 “{parentName}” 部门。": "The users in the “{name}” department have been successfully transferred to the “{parentName}” department.",
"此操作将会删除 “{name}” 部门的所有用户,是否确认?": "This operation will delete all users in the “{name}” department. Are you sure?",
"直接删除": "Delete directly",
"保留用户": "Keep users",
"部门架构已发生改变,是否保存?": "The department structure has changed. Do you want to save?",
"更新排序成功": "Successfully updated the sort",
"新增": "Add",
"编辑": "Edit",
"用户名不能为空": "Username cannot be empty", "用户名不能为空": "Username cannot be empty",
"密码不能为空": "Password cannot be empty", "密码不能为空": "Password cannot be empty",
"图片验证码不能为空": "Image verification code cannot be empty", "图片验证码不能为空": "Image verification code cannot be empty",
@ -134,10 +94,50 @@
"返回登录页": "Return to login page", "返回登录页": "Return to login page",
"自定义输入": "Custom input", "自定义输入": "Custom input",
"请输入": "Please enter", "请输入": "Please enter",
"输入关键字进行过滤": "Enter keyword to filter", "输入关键字进行过滤": "Enter keywords for filtering",
"复制": "Copy", "复制": "Copy",
"行为": "Behavior", "行为": "Behavior",
"ip": "IP", "ip": "IP",
"数据类型 0-字符串 1-富文本 2-文件 ": "Data type 0 - String 1 - Rich text 2 - File", "数据类型 0-字符串 1-富文本 2-文件 ": "Data type 0 - String 1 - Rich text 2 - File",
"键": "Key" "键": "Key",
"选择部门": "Select Department",
"请选择部门": "Please Select Department",
"转移到新部门,是否继续?": "Transfer to a new department. Continue?",
"转移成功": "Transfer Successful",
"组织架构": "Organization Structure",
"刷新": "Refresh",
"拖动排序": "Drag to Sort",
"编辑部门": "Edit Department",
"上级部门": "Superior Department",
"排序": "Sort",
"新增部门 “{name}” 成功": "Successfully added new department “{name}”",
"删除成功": "Delete Successful",
"“{name}” 部门的用户已成功转移到 “{parentName}” 部门。": "Users in the “{name}” department have been successfully transferred to the “{parentName}” department.",
"此操作将会删除 “{name}” 部门的所有用户,是否确认?": "This operation will delete all users in the “{name}” department. Are you sure?",
"直接删除": "Delete Directly",
"保留用户": "Keep Users",
"部门架构已发生改变,是否保存?": "The department structure has changed. Do you want to save?",
"更新排序成功": "Successfully updated sorting",
"新增": "Add",
"编辑": "Edit",
"个人中心": "Personal Center",
"正在加载资源...": "Loading resources...",
"初次加载资源可能需要较多时间,请耐心等待": "It may take some time for the initial resource loading. Please wait patiently.",
"搜索名称": "Search Name",
"是否关联上下级": "Whether to associate with superiors and subordinates",
"名称": "Name",
"标识": "Identifier",
"备注": "Remarks",
"功能权限": "Function Permissions",
"数据权限": "Data Permissions",
"创建时间": "Creation Time",
"更新时间": "Update Time",
"数据类型": "Data Type",
"搜索名称、keyName": "Search Name, keyName",
"字符串": "String",
"富文本": "Rich Text",
"文件": "File",
"请输入Key": "Please enter Key",
"类型": "Type",
"数据": "Data"
} }

View File

@ -1,105 +1,4 @@
{ {
"个人中心": "個人中心",
"正在加载资源...": "正在加載資源...",
"初次加载资源可能需要较多时间,请耐心等待": "初次加載資源可能需要較多時間,請耐心等待",
"搜索名称": "搜索名稱",
"是否关联上下级": "是否關聯上下級",
"名称": "名稱",
"标识": "標識",
"备注": "備註",
"功能权限": "功能權限",
"数据权限": "數據權限",
"创建时间": "創建時間",
"更新时间": "更新時間",
"数据类型": "數據類型",
"搜索名称、keyName": "搜索名稱、keyName",
"字符串": "字串",
"富文本": "富文本",
"文件": "文件",
"请输入Key": "請輸入Key",
"类型": "類型",
"数据": "數據",
"用户名不能为空": "用戶名不得為空",
"密码不能为空": "密碼不得為空",
"图片验证码不能为空": "圖片驗證碼不得為空",
"验证码获取失败": "驗證碼獲取失敗",
"马上回来": "馬上回來",
"糟糕,出了点问题": "糟糕,出了點問題",
"找不到您要查找的页面": "找不到您要查找的頁面",
"您无权访问此页面": "您無權訪問此頁面",
"认证失败,请重新登录!": "認證失敗,請重新登錄!",
"返回首页": "返回首頁",
"重新登录": "重新登錄",
"返回登录页": "返回登錄頁",
"自定义输入": "自定義輸入",
"请输入": "請輸入",
"输入关键字进行过滤": "輸入關鍵字進行過濾",
"复制": "複製",
"行为": "行為",
"ip": "IP",
"数据类型 0-字符串 1-富文本 2-文件 ": "數據類型 0-字串 1-富文本 2-文件 ",
"键": "鍵",
"请输入备注": "請輸入備註",
"清空": "清空",
"日志保存天数": "日誌保存天數",
"搜索请求地址、用户昵称、ip": "搜索請求地址、用戶暱稱、ip",
"用户ID": "用戶ID",
"用户昵称": "用戶暱稱",
"请求地址": "請求地址",
"参数": "參數",
"请求时间": "請求時間",
"保存成功": "保存成功",
"是否要清空日志?": "是否要清空日誌?",
"提示": "提示",
"清空成功": "清空成功",
"基本信息": "基本信息",
"头像": "頭像",
"昵称": "暱稱",
"请填写昵称": "請填寫暱稱",
"原密码": "原密碼",
"请填写原密码": "請填寫原密碼",
"新密码": "新密碼",
"选择部门": "選擇部門",
"请选择部门": "請選擇部門",
"转移到新部门,是否继续?": "轉移到新部門,是否繼續?",
"转移成功": "轉移成功",
"组织架构": "組織架構",
"刷新": "刷新",
"拖动排序": "拖動排序",
"编辑部门": "編輯部門",
"上级部门": "上級部門",
"排序": "排序",
"新增部门 “{name}” 成功": "新增部門 “{name}” 成功",
"删除成功": "刪除成功",
"“{name}” 部门的用户已成功转移到 “{parentName}” 部门。": "“{name}” 部門的用戶已成功轉移到 “{parentName}” 部門。",
"此操作将会删除 “{name}” 部门的所有用户,是否确认?": "此操作將會刪除 “{name}” 部門的所有用戶,是否確認?",
"直接删除": "直接刪除",
"保留用户": "保留用戶",
"部门架构已发生改变,是否保存?": "部門架構已發生改變,是否保存?",
"更新排序成功": "更新排序成功",
"新增": "新增",
"编辑": "編輯",
"角色标签": "角色標籤",
"删除": "刪除",
"新增成员": "新增成員",
"目录": "目錄",
"菜单": "菜單",
"权限": "權限",
"是否显示": "是否顯示",
"图标": "圖標",
"节点路由": "節點路由",
"路由缓存": "路由緩存",
"文件路径": "文件路徑",
"排序号": "排序號",
"节点类型": "節點類型",
"节点名称": "節點名稱",
"上级节点": "上級節點",
"请输入节点路由,如:/test": "請輸入節點路由,如:/test",
"开启": "開啟",
"关闭": "關閉",
"请填写排序号": "請填寫排序號",
"导入": "導入",
"如遇到问题无法导入菜单,请检查文件并尝试重新导入。": "如遇到問題無法導入菜單,請檢查文件並嘗試重新導入。",
"请填写新密码": "請填寫新密碼", "请填写新密码": "請填寫新密碼",
"保存修改": "保存修改", "保存修改": "保存修改",
"修改成功": "修改成功", "修改成功": "修改成功",
@ -120,6 +19,87 @@
"启用": "啟用", "启用": "啟用",
"禁用": "禁用", "禁用": "禁用",
"部门转移": "部門轉移", "部门转移": "部門轉移",
"请输入备注": "請輸入備註",
"清空": "清空",
"日志保存天数": "日誌保存天數",
"搜索请求地址、用户昵称、ip": "搜索請求地址、用戶暱稱、ip",
"用户ID": "用戶ID",
"用户昵称": "用戶暱稱",
"请求地址": "請求地址",
"参数": "參數",
"请求时间": "請求時間",
"保存成功": "保存成功",
"是否要清空日志?": "是否要清空日誌?",
"提示": "提示",
"清空成功": "清空成功",
"基本信息": "基本信息",
"头像": "頭像",
"昵称": "暱稱",
"请填写昵称": "請填寫暱稱",
"原密码": "原密碼",
"请填写原密码": "請填寫原密碼",
"新密码": "新密碼",
"角色标签": "角色標籤",
"个人中心": "個人中心",
"正在加载资源...": "正在加載資源...",
"初次加载资源可能需要较多时间,请耐心等待": "初次加載資源可能需要較多時間,請耐心等待",
"搜索名称": "搜索名稱",
"是否关联上下级": "是否關聯上下級",
"名称": "名稱",
"标识": "標識",
"备注": "備註",
"功能权限": "功能權限",
"数据权限": "數據權限",
"创建时间": "創建時間",
"更新时间": "更新時間",
"数据类型": "數據類型",
"搜索名称、keyName": "搜索名稱、keyName",
"字符串": "字串",
"富文本": "富文本",
"文件": "文件",
"请输入Key": "請輸入Key",
"类型": "類型",
"数据": "數據",
"删除": "刪除",
"新增成员": "新增成員",
"目录": "目錄",
"菜单": "菜單",
"权限": "權限",
"是否显示": "是否顯示",
"图标": "圖標",
"节点路由": "節點路由",
"路由缓存": "路由緩存",
"文件路径": "文件路徑",
"排序号": "排序號",
"节点类型": "節點類型",
"节点名称": "節點名稱",
"上级节点": "上級節點",
"请输入节点路由,如:/test": "請輸入節點路由,如:/test",
"开启": "開啟",
"关闭": "關閉",
"请填写排序号": "請填寫排序號",
"导入": "導入",
"如遇到问题无法导入菜单,请检查文件并尝试重新导入。": "如遇到問題無法導入菜單,請檢查文件並嘗試重新導入。",
"用户名不能为空": "用戶名不得為空",
"密码不能为空": "密碼不得為空",
"图片验证码不能为空": "圖片驗證碼不得為空",
"验证码获取失败": "驗證碼獲取失敗",
"马上回来": "馬上回來",
"糟糕,出了点问题": "糟糕,出了點問題",
"找不到您要查找的页面": "找不到您要查找的頁面",
"您无权访问此页面": "您無權訪問此頁面",
"认证失败,请重新登录!": "認證失敗,請重新登錄!",
"返回首页": "返回首頁",
"重新登录": "重新登錄",
"返回登录页": "返回登錄頁",
"自定义输入": "自定義輸入",
"请输入": "請輸入",
"输入关键字进行过滤": "輸入關鍵字進行過濾",
"复制": "複製",
"行为": "行為",
"ip": "IP",
"数据类型 0-字符串 1-富文本 2-文件 ": "數據類型 0-字串 1-富文本 2-文件 ",
"键": "鍵",
"菜单导入": "菜單導入", "菜单导入": "菜單導入",
"添加": "添加", "添加": "添加",
"导入成功": "導入成功", "导入成功": "導入成功",
@ -139,5 +119,25 @@
"请输入用户名": "請輸入用戶名", "请输入用户名": "請輸入用戶名",
"请输入密码": "請輸入密碼", "请输入密码": "請輸入密碼",
"验证码": "驗證碼", "验证码": "驗證碼",
"登录": "登錄" "登录": "登錄",
"选择部门": "選擇部門",
"请选择部门": "請選擇部門",
"转移到新部门,是否继续?": "轉移到新部門,是否繼續?",
"转移成功": "轉移成功",
"组织架构": "組織架構",
"刷新": "刷新",
"拖动排序": "拖動排序",
"编辑部门": "編輯部門",
"上级部门": "上級部門",
"排序": "排序",
"新增部门 “{name}” 成功": "新增部門 “{name}” 成功",
"删除成功": "刪除成功",
"“{name}” 部门的用户已成功转移到 “{parentName}” 部门。": "“{name}” 部門的用戶已成功轉移到 “{parentName}” 部門。",
"此操作将会删除 “{name}” 部门的所有用户,是否确认?": "此操作將會刪除 “{name}” 部門的所有用戶,是否確認?",
"直接删除": "直接刪除",
"保留用户": "保留用戶",
"部门架构已发生改变,是否保存?": "部門架構已發生改變,是否保存?",
"更新排序成功": "更新排序成功",
"新增": "新增",
"编辑": "編輯"
} }

View File

@ -3,22 +3,22 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { isFunction, orderBy } from 'lodash-es'; import { isFunction, orderBy } from "lodash-es";
import { markRaw, onMounted, shallowRef } from 'vue'; import { markRaw, onMounted, shallowRef } from "vue";
import { module } from '/@/cool'; import { module } from "/@/cool";
const list = shallowRef<any[]>([]); const list = shallowRef<any[]>([]);
async function refresh() { async function refresh() {
const arr = orderBy( const arr = orderBy(
module.list.filter(e => e.enable !== false && !!e.global).map(e => e.global), module.list.filter((e) => e.enable !== false && !!e.global).map((e) => e.global),
'order' "order"
); );
list.value = await Promise.all( list.value = await Promise.all(
arr arr
.filter(e => e?.component) .filter((e) => e?.component)
.map(async e => { .map(async (e) => {
if (e) { if (e) {
const c = await (isFunction(e.component) ? e.component() : e.component); const c = await (isFunction(e.component) ? e.component() : e.component);
@ -29,8 +29,6 @@ async function refresh() {
} }
}) })
); );
console.log(list.value);
} }
onMounted(() => { onMounted(() => {

View File

@ -23,17 +23,7 @@
</cl-row> </cl-row>
<cl-row> <cl-row>
<cl-table <cl-table ref="Table">
ref="Table"
row-key="id"
lazy
:load="onChildrenLoad"
:tree-props="{
children: 'children',
hasChildren: 'hasChildren'
}"
@row-click="onRowClick"
>
<!-- 图标 --> <!-- 图标 -->
<template #column-icon="{ scope }"> <template #column-icon="{ scope }">
<cl-svg :name="scope.row.icon" :size="16" /> <cl-svg :name="scope.row.icon" :size="16" />
@ -97,22 +87,14 @@ defineOptions({
import { useCrud, useTable, useUpsert } from '@cool-vue/crud'; import { useCrud, useTable, useUpsert } from '@cool-vue/crud';
import { useCool } from '/@/cool'; import { useCool } from '/@/cool';
import { deepTree } from '/@/cool/utils';
import { useStore } from '/$/base/store'; import { useStore } from '/$/base/store';
import { isEmpty } from 'lodash-es'; import { reactive } from 'vue';
import { useI18n } from 'vue-i18n';
import { Plugins } from '/#/crud';
import MenuImp from './components/imp.vue'; import MenuImp from './components/imp.vue';
import MenuExp from './components/exp.vue'; import MenuExp from './components/exp.vue';
import AutoMenu from '/$/helper/components/auto-menu.vue'; import AutoMenu from '/$/helper/components/auto-menu.vue';
import AutoPerms from '/$/helper/components/auto-perms.vue'; import AutoPerms from '/$/helper/components/auto-perms.vue';
import { onMounted, reactive } from 'vue';
import { useI18n } from 'vue-i18n';
import { Plugins } from '/#/crud';
interface Item extends Eps.BaseSysMenuEntity {
children?: Item[];
_children?: Item[];
hasChildren?: boolean;
}
const { service, mitt } = useCool(); const { service, mitt } = useCool();
const { menu } = useStore(); const { menu } = useStore();
@ -219,8 +201,9 @@ const Table = useTable({
{ {
prop: 'orderNum', prop: 'orderNum',
label: t('排序号'), label: t('排序号'),
width: 90, width: 100,
fixed: 'right' fixed: 'right',
sortable: 'asc'
}, },
{ {
prop: 'updateTime', prop: 'updateTime',
@ -246,6 +229,17 @@ const Table = useTable({
]; ];
} }
} }
],
plugins: [
Plugins.Table.toTree({
lazy: true,
async onRefresh() {
return service.base.sys.menu.list().then(res => {
menu.get();
return res;
});
}
})
] ]
}); });
@ -372,16 +366,13 @@ const Upsert = useUpsert({
// cl-crud // cl-crud
const Crud = useCrud( const Crud = useCrud(
{ {
service: service.base.sys.menu, service: service.base.sys.menu
onRefresh(_, { render }) {
service.base.sys.menu.list().then(list => {
render(onData(list));
menu.get();
});
}
}, },
app => { app => {
app.refresh(); app.refresh({
prop: 'orderNum',
order: 'asc'
});
} }
); );
@ -390,49 +381,8 @@ function refresh(params?: any) {
Crud.value?.refresh(params); Crud.value?.refresh(params);
} }
//
function onData(list: Item[]) {
const data = deepTree(list);
//
const deep = (arr: Item[]) => {
arr.forEach(e => {
const nodes: { [key: number]: Item[] } =
Table.value?.Table.store.states.lazyTreeNodeMap.value || {};
if (nodes[e.id!]) {
nodes[e.id!] = e.children || [];
}
if (!isEmpty(e.children)) {
e.hasChildren = true;
e._children = e.children;
delete e.children;
deep(e._children || []);
}
});
};
deep(data);
return data;
}
//
function onChildrenLoad(row: Item, treeNode: unknown, resolve: (data: Item[]) => void) {
resolve(row._children || []);
}
//
function onRowClick(row: Item) {
if (row._children) {
Table.value?.Table.store.loadOrToggle(row);
}
}
// //
function append({ type = 0, id }: Item) { function append({ type = 0, id }: Eps.BaseSysMenuEntity) {
Crud.value?.rowAppend({ Crud.value?.rowAppend({
parentId: id, parentId: id,
parentType: type, parentType: type,
@ -443,7 +393,7 @@ function append({ type = 0, id }: Item) {
} }
// //
function addPermission({ id }: Item) { function addPermission({ id }: Eps.BaseSysMenuEntity) {
Crud.value?.rowAppend({ Crud.value?.rowAppend({
parentId: id, parentId: id,
type: 2 type: 2
@ -451,8 +401,4 @@ function addPermission({ id }: Item) {
} }
mitt.on('helper.createMenu', refresh); mitt.on('helper.createMenu', refresh);
onMounted(() => {
console.log(Table.value);
});
</script> </script>

View File

@ -33,10 +33,10 @@
"余额": "Balance", "余额": "Balance",
"标题": "Title", "标题": "Title",
"ID": "ID", "ID": "ID",
"创建时间": "Creation Time", "创建时间": "Create Time",
"更新时间": "Update Time", "更新时间": "Update Time",
"搜索手机号、昵称": "Search Mobile Number, Nickname", "搜索手机号、昵称": "Search Mobile Number, Nickname",
"{year}年": "{year}", "{year}年": "{year} Year",
"销售金额": "Sales Amount", "销售金额": "Sales Amount",
"销售订单": "Sales Order", "销售订单": "Sales Order",
"{i}月": "{i} Month", "{i}月": "{i} Month",
@ -48,7 +48,7 @@
"排名": "Ranking", "排名": "Ranking",
"商品名称": "Product Name", "商品名称": "Product Name",
"商品金额": "Product Amount", "商品金额": "Product Amount",
"下单次数": "Order Quantity", "下单次数": "Order Placed Times",
"日涨幅": "Daily Increase", "日涨幅": "Daily Increase",
"上架时间": "上架时间" "上架时间": "Listing Time"
} }

View File

@ -11,6 +11,26 @@
"类别占比": "類別占比", "类别占比": "類別占比",
"启用": "啟用", "启用": "啟用",
"描述": "描述", "描述": "描述",
"未知": "未知",
"男": "男",
"女": "女",
"禁用": "禁用",
"正常": "正常",
"已注销": "已註銷",
"小程序": "小程序",
"公众号": "公眾號",
"H5": "H5",
"登录唯一ID": "登錄唯一ID",
"头像": "頭像",
"昵称": "暱稱",
"手机号": "手機號",
"性别": "性別",
"状态": "狀態",
"登录方式": "登錄方式",
"来源": "來源",
"密码": "密碼",
"介绍": "介紹",
"余额": "餘額",
"标题": "標題", "标题": "標題",
"ID": "ID", "ID": "ID",
"创建时间": "創建時間", "创建时间": "創建時間",
@ -30,25 +50,5 @@
"商品金额": "商品金額", "商品金额": "商品金額",
"下单次数": "下單次數", "下单次数": "下單次數",
"日涨幅": "日漲幅", "日涨幅": "日漲幅",
"上架时间": "上架時間", "上架时间": "上架時間"
"未知": "未知",
"男": "男",
"女": "女",
"禁用": "禁用",
"正常": "正常",
"已注销": "已註銷",
"小程序": "小程序",
"公众号": "公眾號",
"H5": "H5",
"登录唯一ID": "登錄唯一ID",
"头像": "頭像",
"昵称": "昵稱",
"手机号": "手機號",
"性别": "性別",
"状态": "狀態",
"登录方式": "登錄方式",
"来源": "來源",
"密码": "密碼",
"介绍": "介紹",
"余额": "餘額"
} }

View File

@ -1,6 +1,5 @@
{ {
"搜索名称": "Search Name", "搜索名称": "Search Name",
"新增": "New",
"请填写值": "Please fill in the value", "请填写值": "Please fill in the value",
"使用文件": "Use File", "使用文件": "Use File",
"类型": "Type", "类型": "Type",
@ -10,7 +9,8 @@
"值": "Value", "值": "Value",
"排序": "Sort", "排序": "Sort",
"备注": "Remarks", "备注": "Remarks",
"新增": "Add",
"ID": "ID", "ID": "ID",
"创建时间": "Creation Time", "创建时间": "Create Time",
"更新时间": "Update Time" "更新时间": "Update Time"
} }

View File

@ -1,6 +1,5 @@
{ {
"搜索名称": "搜索名称", "搜索名称": "搜索名称",
"新增": "新增",
"请填写值": "请填写值", "请填写值": "请填写值",
"使用文件": "使用文件", "使用文件": "使用文件",
"类型": "类型", "类型": "类型",
@ -10,6 +9,7 @@
"值": "值", "值": "值",
"排序": "排序", "排序": "排序",
"备注": "备注", "备注": "备注",
"新增": "新增",
"ID": "ID", "ID": "ID",
"创建时间": "创建时间", "创建时间": "创建时间",
"更新时间": "更新时间" "更新时间": "更新时间"

View File

@ -1,6 +1,5 @@
{ {
"搜索名称": "搜尋名稱", "搜索名称": "搜尋名稱",
"新增": "新增",
"请填写值": "請填寫值", "请填写值": "請填寫值",
"使用文件": "使用文件", "使用文件": "使用文件",
"类型": "類型", "类型": "類型",
@ -10,6 +9,7 @@
"值": "值", "值": "值",
"排序": "排序", "排序": "排序",
"备注": "備註", "备注": "備註",
"新增": "新增",
"ID": "ID", "ID": "ID",
"创建时间": "創建時間", "创建时间": "創建時間",
"更新时间": "更新時間" "更新时间": "更新時間"

View File

@ -18,18 +18,7 @@
<cl-row> <cl-row>
<!-- 数据表格 --> <!-- 数据表格 -->
<cl-table ref="Table" row-key="id" @row-click="onRowClick"> <cl-table ref="Table" />
<template #slot-btn="{ scope }">
<el-button
text
type="success"
@click="append(scope.row)"
v-permission="service.dict.info.permission.add"
>
{{ $t('新增') }}
</el-button>
</template>
</cl-table>
</cl-row> </cl-row>
<cl-row> <cl-row>
@ -39,23 +28,22 @@
<!-- 新增编辑 --> <!-- 新增编辑 -->
<cl-upsert ref="Upsert"> <cl-upsert ref="Upsert">
<template #slot-value="{ scope }"> <template #slot-value="{ scope }">
<div class="form-value"> <div>
<el-input <el-input
v-model="scope.value" v-model="scope.value"
:placeholder="$t('请填写值')" :placeholder="$t('请填写值')"
clearable clearable
type="textarea" type="textarea"
:rows="4" :rows="4"
class="mb-2"
/> />
<div class="op">
<cl-upload-space <cl-upload-space
:text="$t('使用文件')" :text="$t('使用文件')"
:limit="1" :limit="1"
@confirm="onFileConfirm" @confirm="onFileConfirm"
/> />
</div> </div>
</div>
</template> </template>
</cl-upsert> </cl-upsert>
</cl-crud> </cl-crud>
@ -70,9 +58,6 @@ defineOptions({
import { useCrud, useTable, useUpsert } from '@cool-vue/crud'; import { useCrud, useTable, useUpsert } from '@cool-vue/crud';
import { useCool } from '/@/cool'; import { useCool } from '/@/cool';
import { computed } from 'vue';
import { deepTree } from '/@/cool/utils';
import { cloneDeep } from 'lodash-es';
import { useDict } from '../index'; import { useDict } from '../index';
import { useViewGroup } from '/@/plugins/view'; import { useViewGroup } from '/@/plugins/view';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
@ -89,7 +74,9 @@ const { ViewGroup } = useViewGroup({
onSelect(item) { onSelect(item) {
refresh({ refresh({
typeId: item.id, typeId: item.id,
page: 1 page: 1,
prop: 'orderNum',
order: 'desc'
}); });
}, },
onEdit() { onEdit() {
@ -139,41 +126,14 @@ const Upsert = useUpsert({
label: t('上级节点'), label: t('上级节点'),
prop: 'parentId', prop: 'parentId',
component: { component: {
name: 'el-tree-select', name: 'cl-select',
props: { props: {
data: computed(() => { labelKey: 'name',
const data = cloneDeep(Table.value?.data); valueKey: 'id',
checkStrictly: true,
function deep(d: any, f: boolean) { tree: true,
if (d.id && d.id == Upsert.value?.getForm('id')) { current: true,
f = true; defaultExpandAll: true
}
if (f) {
d.disabled = true;
}
if (d.children) {
d.children.forEach((e: any) => {
deep(e, f);
});
}
}
deep({ children: data }, false);
return data;
}),
props: {
label: 'name',
value: 'id',
children: 'children',
disabled: 'disabled'
},
clearable: true,
filterable: true,
'default-expand-all': true,
'check-strictly': true
} }
} }
}, },
@ -271,29 +231,37 @@ const Table = useTable({
{ {
type: 'op', type: 'op',
width: 250, width: 250,
buttons: ['slot-btn', 'edit', 'delete'] buttons: [
{
label: t('新增'),
type: 'success',
hidden: !service.dict.info._permission.add,
onClick({ scope }) {
append(scope.row);
} }
},
'edit',
'delete'
]
}
],
plugins: [
Plugins.Table.toTree({
async onRefresh(params) {
return service.dict.info.list(params).then(res => {
//
dict.refresh([ViewGroup.value?.selected?.key]);
return res;
});
}
})
] ]
}); });
// cl-crud // cl-crud
const Crud = useCrud({ const Crud = useCrud({
service: service.dict.info, service: service.dict.info
onRefresh(params, { render }) {
service.dict.info
.list({
...params,
page: undefined,
size: undefined
})
.then(res => {
//
render(deepTree(res, params.sort));
//
dict.refresh([ViewGroup.value?.selected?.key]);
});
}
}); });
// //
@ -301,13 +269,6 @@ function refresh(params?: any) {
Crud.value?.refresh(params); Crud.value?.refresh(params);
} }
//
function onRowClick(row: any, column: any) {
if (column?.property && row.children) {
Table.value?.toggleRowExpansion(row);
}
}
// //
function append(row: any) { function append(row: any) {
Crud.value?.rowAppend({ Crud.value?.rowAppend({
@ -321,11 +282,3 @@ function onFileConfirm(selection: any[]) {
Upsert.value?.setForm('value', selection[0]?.url); Upsert.value?.setForm('value', selection[0]?.url);
} }
</script> </script>
<style lang="scss" scoped>
.form-value {
.op {
margin-top: 10px;
}
}
</style>

View File

@ -1,32 +1,77 @@
<template> <template>
<div class="cl-comm__icon" @click="toCode"> <div class="cl-comm__icon" @click="toCode">
Ai <div class="t1"><cl-svg name="quick" class="mr-2" /> {{ $t("AI极速编码") }}</div>
<cl-svg name="quick" class="ml-2 mr-2" /> <div class="t2">Start</div>
{{ $t('极速编码') }}
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { useCool } from '/@/cool'; import { useCool } from "/@/cool";
const { router } = useCool(); const { router } = useCool();
function toCode() { function toCode() {
router.push('/helper/ai-code'); router.push("/helper/ai-code");
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.cl-comm__icon { .cl-comm__icon {
width: auto; width: auto;
padding: 0 10px;
border-color: var(--el-color-primary);
color: var(--el-color-primary);
font-size: 14px; font-size: 14px;
line-height: 1; line-height: 1;
position: relative;
overflow: hidden;
width: 120px;
.cl-svg { .t1,
color: var(--el-color-primary); .t2 {
display: flex;
align-items: center;
justify-content: center;
transition: top 0.5s;
letter-spacing: 1px;
background: linear-gradient(to right, #9f9f9f 0, #fff 10%, #868686 20%);
background-position: 0;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
animation: shine 3s infinite linear;
animation-fill-mode: forwards;
-webkit-text-size-adjust: none;
}
.t1 {
position: absolute;
width: 100%;
top: 50%;
left: 0;
transform: translateY(-50%);
}
.t2 {
position: absolute;
width: 100%;
top: 150%;
left: 0;
transform: translateY(-50%);
}
&:hover .t1 {
top: -100%;
}
&:hover .t2 {
top: 50%;
}
}
@keyframes shine {
0% {
background-position: 0;
}
100% {
background-position: 100px;
} }
} }
</style> </style>

View File

@ -1,19 +1,4 @@
{ {
"请选择数据结构": "Please select data structure",
"数据结构": "Data structure",
"上级节点": "Parent node",
"请选择上级节点": "Please select parent node",
"菜单名称": "Menu name",
"请输入菜单名称": "Please enter menu name",
"菜单路由": "Menu route",
"请输入菜单路由,如:/test": "Please enter menu route, e.g.: /test",
"必须以 / 开头": "Must start with /",
"菜单排序": "Menu sorting",
"请填写菜单排序": "Please fill in menu sorting",
"菜单图标": "Menu icon",
"请选择图标": "Please select icon",
"路由缓存": "Route cache",
"开始创建": "Start creating",
"搜索插件名称": "Search Plugin Name", "搜索插件名称": "Search Plugin Name",
"后端": "Backend", "后端": "Backend",
"未知": "Unknown", "未知": "Unknown",
@ -30,9 +15,9 @@
"已安装": "Installed", "已安装": "Installed",
"全部插件": "All Plugins", "全部插件": "All Plugins",
"插件开发": "Plugin Development", "插件开发": "Plugin Development",
"插件安装成功": "Plugin Installed Successfully",
"提示": "Tip", "提示": "Tip",
"继续": "Continue", "继续": "Continue",
"插件安装成功": "Plugin installed successfully",
"确定要卸载插件【{name}】吗?": "Are you sure you want to uninstall the plugin [{name}]?", "确定要卸载插件【{name}】吗?": "Are you sure you want to uninstall the plugin [{name}]?",
"卸载成功": "Uninstall success", "卸载成功": "Uninstall success",
"启用成功": "Enable success", "启用成功": "Enable success",
@ -43,15 +28,37 @@
"修改成功": "Modify success", "修改成功": "Modify success",
"检测到插件,是否安装": "Plugin detected. Install?", "检测到插件,是否安装": "Plugin detected. Install?",
"安装": "Install", "安装": "Install",
"确定要退出编码吗?": "Are you sure you want to exit encoding?",
"创建目录:{name}": "Create directory: {name}",
"创建菜单:{name}": "Create menu: {name}",
"创建 Node 文件": "Create Node file",
"正在重启服务": "Restarting service",
"创建 Vue 文件": "Create Vue file",
"自动添加": "Auto add", "自动添加": "Auto add",
"权限名称": "Permission name", "权限名称": "Permission name",
"实体数据": "Entity data", "实体数据": "Entity data",
"自动添加权限": "Auto add permission", "自动添加权限": "Auto add permission",
"一键添加": "Add in one click", "一键添加": "Add in one click",
"权限列表": "Permission list", "权限列表": "Permission List",
"请选择实体数据": "Please select entity data", "请选择实体数据": "Please Select Entity Data",
"请填写权限名称": "Please fill in the permission name", "请填写权限名称": "Please Fill in Permission Name",
"请至少选择一个权限": "Please select at least one permission", "请至少选择一个权限": "Please Select at Least One Permission",
"添加权限成功": "Add permission success", "添加权限成功": "Permission Added Successfully",
"快速创建": "Quick create" "快速创建": "Quick Create",
"请选择数据结构": "Please Select Data Structure",
"数据结构": "Data Structure",
"上级节点": "Parent Node",
"请选择上级节点": "Please Select Parent Node",
"菜单名称": "Menu Name",
"请输入菜单名称": "Please Enter Menu Name",
"菜单路由": "Menu Route",
"请输入菜单路由,如:/test": "Please Enter Menu Route, e.g.: /test",
"必须以 / 开头": "Must Start with /",
"菜单排序": "Menu Sort",
"请填写菜单排序": "Please Fill in Menu Sort",
"菜单图标": "Menu Icon",
"请选择图标": "Please Select Icon",
"路由缓存": "Route Cache",
"开始创建": "Start Creation",
"极速编码": "Fast Encoding"
} }

View File

@ -15,9 +15,9 @@
"已安装": "已安装", "已安装": "已安装",
"全部插件": "全部插件", "全部插件": "全部插件",
"插件开发": "插件开发", "插件开发": "插件开发",
"插件安装成功": "插件安装成功",
"提示": "提示", "提示": "提示",
"继续": "继续", "继续": "继续",
"插件安装成功": "插件安装成功",
"确定要卸载插件【{name}】吗?": "确定要卸载插件【{name}】吗?", "确定要卸载插件【{name}】吗?": "确定要卸载插件【{name}】吗?",
"卸载成功": "卸载成功", "卸载成功": "卸载成功",
"启用成功": "启用成功", "启用成功": "启用成功",
@ -28,6 +28,12 @@
"修改成功": "修改成功", "修改成功": "修改成功",
"检测到插件,是否安装": "检测到插件,是否安装", "检测到插件,是否安装": "检测到插件,是否安装",
"安装": "安装", "安装": "安装",
"确定要退出编码吗?": "确定要退出编码吗?",
"创建目录:{name}": "创建目录:{name}",
"创建菜单:{name}": "创建菜单:{name}",
"创建 Node 文件": "创建 Node 文件",
"正在重启服务": "正在重启服务",
"创建 Vue 文件": "创建 Vue 文件",
"自动添加": "自动添加", "自动添加": "自动添加",
"权限名称": "权限名称", "权限名称": "权限名称",
"实体数据": "实体数据", "实体数据": "实体数据",
@ -53,5 +59,6 @@
"菜单图标": "菜单图标", "菜单图标": "菜单图标",
"请选择图标": "请选择图标", "请选择图标": "请选择图标",
"路由缓存": "路由缓存", "路由缓存": "路由缓存",
"开始创建": "开始创建" "开始创建": "开始创建",
"极速编码": "极速编码"
} }

View File

@ -1,8 +1,10 @@
{ {
"开始创建": "開始創建",
"极速编码": "極速編碼",
"搜索插件名称": "搜尋插件名稱", "搜索插件名称": "搜尋插件名稱",
"后端": "後端", "后端": "後端",
"未知": "未知", "未知": "未知",
"暂无描述": "暫無描述", "暂无描述": "暂无描述",
"示例": "示例", "示例": "示例",
"预览": "預覽", "预览": "預覽",
"文档": "文檔", "文档": "文檔",
@ -15,34 +17,25 @@
"已安装": "已安裝", "已安装": "已安裝",
"全部插件": "全部插件", "全部插件": "全部插件",
"插件开发": "插件開發", "插件开发": "插件開發",
"插件安装成功": "插件安裝成功",
"提示": "提示", "提示": "提示",
"继续": "繼續", "继续": "繼續",
"插件安装成功": "插件安裝成功",
"确定要卸载插件【{name}】吗?": "確定要卸載插件【{name}】嗎?", "确定要卸载插件【{name}】吗?": "確定要卸載插件【{name}】嗎?",
"请选择数据结构": "請選擇資料結構",
"数据结构": "資料結構",
"上级节点": "上級節點",
"请选择上级节点": "請選擇上級節點",
"菜单名称": "菜單名稱",
"请输入菜单名称": "請輸入菜單名稱",
"菜单路由": "菜單路由",
"请输入菜单路由,如:/test": "請輸入菜單路由,如:/test",
"必须以 / 开头": "必須以 / 開頭",
"菜单排序": "菜單排序",
"请填写菜单排序": "請填寫菜單排序",
"菜单图标": "菜單圖示",
"请选择图标": "請選擇圖示",
"路由缓存": "路由快取",
"开始创建": "開始建立",
"卸载成功": "卸載成功", "卸载成功": "卸載成功",
"启用成功": "啟用成功", "启用成功": "啟用成功",
"禁用成功": "禁用成功", "禁用成功": "禁用成功",
"参数格式错误": "參數格式錯誤", "参数格式错误": "參數格式錯誤",
"设置": "設定", "设置": "設置",
"参数": "參數", "参数": "參數",
"修改成功": "修改成功", "修改成功": "修改成功",
"检测到插件,是否安装": "檢測到插件,是否安裝", "检测到插件,是否安装": "檢測到插件,是否安裝",
"安装": "安裝", "安装": "安裝",
"确定要退出编码吗?": "確定要退出編碼嗎?",
"创建目录:{name}": "創建目錄:{name}",
"创建菜单:{name}": "創建菜單:{name}",
"创建 Node 文件": "創建 Node 文件",
"正在重启服务": "正在重啟服務",
"创建 Vue 文件": "創建 Vue 文件",
"自动添加": "自動添加", "自动添加": "自動添加",
"权限名称": "權限名稱", "权限名称": "權限名稱",
"实体数据": "實體數據", "实体数据": "實體數據",
@ -53,5 +46,19 @@
"请填写权限名称": "請填寫權限名稱", "请填写权限名称": "請填寫權限名稱",
"请至少选择一个权限": "請至少選擇一個權限", "请至少选择一个权限": "請至少選擇一個權限",
"添加权限成功": "添加權限成功", "添加权限成功": "添加權限成功",
"快速创建": "快速創建" "快速创建": "快速創建",
"请选择数据结构": "請選擇數據結構",
"数据结构": "數據結構",
"上级节点": "上級節點",
"请选择上级节点": "請選擇上級節點",
"菜单名称": "菜單名稱",
"请输入菜单名称": "請輸入菜單名稱",
"菜单路由": "菜單路由",
"请输入菜单路由,如:/test": "請輸入菜單路由,如:/test",
"必须以 / 开头": "必須以 / 開頭",
"菜单排序": "菜單排序",
"请填写菜单排序": "請填寫菜單排序",
"菜单图标": "菜單圖標",
"请选择图标": "請選擇圖標",
"路由缓存": "路由緩存"
} }

View File

@ -8,7 +8,7 @@
"创建时间": "Creation Time", "创建时间": "Creation Time",
"恢复": "Restore", "恢复": "Restore",
"此操作将恢复被删除的数据,是否继续?": "This operation will restore the deleted data. Do you want to continue?", "此操作将恢复被删除的数据,是否继续?": "This operation will restore the deleted data. Do you want to continue?",
"提示": "Prompt", "提示": "Tip",
"数据恢复成功": "Data Recovery Successful", "数据恢复成功": "Data Recovery Successful",
"姓名": "Name" "姓名": "Name"
} }

View File

@ -1,7 +1,7 @@
{ {
"取消": "Cancel", "取消": "Cancel",
"选择 {count}/{limit} 个": "Select {count}/{limit} items", "选择 {count}/{limit} 个": "Select {count}/{limit}",
"选择文件": "Select Files", "选择文件": "Select File",
"文件空间": "File Space", "文件空间": "File Space",
"点击上传": "Click to Upload", "点击上传": "Click to Upload",
"刷新": "Refresh", "刷新": "Refresh",
@ -11,9 +11,9 @@
"分类": "Category", "分类": "Category",
"文件列表": "File List", "文件列表": "File List",
"名称": "Name", "名称": "Name",
"最多只能选择{limit}个文件": "You can select a maximum of {limit} files", "最多只能选择{limit}个文件": "You can select up to {limit} files",
"此操作将删除文件, 是否继续?": "This operation will delete the files. Do you want to continue?", "此操作将删除文件, 是否继续?": "This operation will delete the file. Do you want to continue?",
"提示": "Prompt", "提示": "Tip",
"删除成功": "Delete Successful", "删除成功": "Delete Successful",
"类型": "Type", "类型": "Type",
"分类ID": "Category ID" "分类ID": "Category ID"

View File

@ -6,7 +6,7 @@
"点击上传": "點擊上傳", "点击上传": "點擊上傳",
"刷新": "刷新", "刷新": "刷新",
"删除选中文件": "刪除選中文件", "删除选中文件": "刪除選中文件",
"将文件拖到此处,或点击按钮上传": "將文件拖到此處,或點擊按鈕上傳", "将文件拖到此处,或点击按钮上传": "將文件拖到此处,或點擊按鈕上傳",
"共 {total} 条": "共 {total} 條", "共 {total} 条": "共 {total} 條",
"分类": "分類", "分类": "分類",
"文件列表": "文件列表", "文件列表": "文件列表",

View File

@ -12,7 +12,7 @@
"状态 0-停止 1-运行": "Status 0 - Stopped 1 - Running", "状态 0-停止 1-运行": "Status 0 - Stopped 1 - Running",
"状态 0-系统 1-用户": "Status 0 - System 1 - User", "状态 0-系统 1-用户": "Status 0 - System 1 - User",
"执行服务": "Execute Service", "执行服务": "Execute Service",
"定时规则": "Scheduling Rule", "定时规则": "Scheduled Rule",
"间隔{every}秒执行": "Execute every {every} seconds", "间隔{every}秒执行": "Execute every {every} seconds",
"进行中": "In Progress", "进行中": "In Progress",
"已停止": "Stopped", "已停止": "Stopped",
@ -27,7 +27,7 @@
"间隔(秒)": "Interval (seconds)", "间隔(秒)": "Interval (seconds)",
"开始时间": "Start Time", "开始时间": "Start Time",
"备注": "Remarks", "备注": "Remarks",
"保存成功": "Save Successful", "保存成功": "Save Success",
"暂停": "Pause", "暂停": "Pause",
"开始": "Start", "开始": "Start",
"立即执行": "Execute Immediately" "立即执行": "Execute Immediately"

View File

@ -1,13 +1,4 @@
{ {
"全选": "Select All",
"搜索昵称、手机号": "Search Nickname, Mobile Number",
"已选": "Selected",
"选择": "Select",
"人": "Person",
"取消": "Cancel",
"启用": "Enable",
"操作": "Operation",
"姓名": "Name",
"小程序": "Mini Program", "小程序": "Mini Program",
"公众号": "Official Account", "公众号": "Official Account",
"H5": "H5", "H5": "H5",
@ -24,8 +15,6 @@
"登录方式": "Login Method", "登录方式": "Login Method",
"状态": "Status", "状态": "Status",
"创建时间": "Creation Time", "创建时间": "Creation Time",
"添加": "Add", "选择用户": "Select User",
"移除": "Remove", "姓名": "Name"
"请选择用户": "Please Select User",
"选择用户": "Select User"
} }

View File

@ -15,17 +15,6 @@
"登录方式": "登录方式", "登录方式": "登录方式",
"状态": "状态", "状态": "状态",
"创建时间": "创建时间", "创建时间": "创建时间",
"添加": "添加",
"移除": "移除",
"请选择用户": "请选择用户",
"选择用户": "选择用户", "选择用户": "选择用户",
"全选": "全选",
"搜索昵称、手机号": "搜索昵称、手机号",
"已选": "已选",
"选择": "选择",
"人": "人",
"取消": "取消",
"启用": "启用",
"操作": "操作",
"姓名": "姓名" "姓名": "姓名"
} }

View File

@ -1,13 +1,4 @@
{ {
"全选": "全選",
"搜索昵称、手机号": "搜尋暱稱、手機號",
"已选": "已選",
"选择": "選擇",
"人": "人",
"取消": "取消",
"启用": "啟用",
"操作": "操作",
"姓名": "姓名",
"小程序": "小程序", "小程序": "小程序",
"公众号": "公眾號", "公众号": "公眾號",
"H5": "H5", "H5": "H5",
@ -24,8 +15,6 @@
"登录方式": "登錄方式", "登录方式": "登錄方式",
"状态": "狀態", "状态": "狀態",
"创建时间": "創建時間", "创建时间": "創建時間",
"添加": "添加", "选择用户": "選擇用戶",
"移除": "移除", "姓名": "姓名"
"请选择用户": "請選擇用戶",
"选择用户": "選擇用戶"
} }

View File

@ -1,7 +1,7 @@
import { useCrud, useForm } from '@cool-vue/crud'; import { useCrud, useForm, } from '@cool-vue/crud';
import { isEmpty, isString } from 'lodash-es'; import { cloneDeep, isEmpty, isFunction, isString } from 'lodash-es';
import { computed, defineComponent, type PropType, type Ref, toValue, useModel } from 'vue'; import { computed, defineComponent, onMounted, type PropType, ref, type Ref, toValue, useModel } from 'vue';
import { parsePx } from '/@/cool/utils'; import { deepTree, parsePx } from '/@/cool/utils';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useCool } from '/@/cool'; import { useCool } from '/@/cool';
import { CrudProps } from '../../comm'; import { CrudProps } from '../../comm';
@ -25,13 +25,23 @@ export default defineComponent({
type: String, type: String,
default: 'value' default: 'value'
}, },
// 请求接口,如果是字符串,则使用 crud 下的方法
api: [String, Function],
width: [String, Number], width: [String, Number],
// 是否树形 // 是否树形
tree: Boolean, tree: Boolean,
// 是否返回选中层级下的所有值 // 是否返回选中层级下的所有值
allLevelsId: Boolean, allLevelsId: Boolean,
// 是否父子不互相关联 // 是否父子不互相关联
checkStrictly: Boolean, checkStrictly: Boolean,
// 默认展开所有
defaultExpandAll: Boolean,
// 顶级标签
topLabel: String,
// 是否选择当前表格数据,如果是,则不能选择自身及其下级
current: Boolean,
// 值变化刷新 // 值变化刷新
refreshOnChange: { refreshOnChange: {
type: Boolean, type: Boolean,
@ -54,11 +64,55 @@ export default defineComponent({
// 是否用于搜索 // 是否用于搜索
const isSearch = computed(() => !Form.value || Form.value?.name === 'search'); const isSearch = computed(() => !Form.value || Form.value?.name === 'search');
// 选项
const options = ref<Dict.Item[]>()
// 选中值 // 选中值
const value = useModel(props, 'modelValue'); const value = useModel(props, 'modelValue');
// 列表 // 列表
const list = computed(() => toValue(props.options) || []); const list = computed(() => {
let data: any[] = []
if (props.current) {
data = cloneDeep(toValue(Crud.value?.['cl-table']?.data));
// 禁用自身及其下级
function deep(d: any, f: boolean) {
if (d.id && d.id == Form.value?.getForm('id')) {
f = true;
}
if (f) {
d.disabled = true;
}
if (d.children) {
d.children.forEach((e: any) => {
deep(e, f);
});
}
}
deep({ children: data }, false);
} else {
data = toValue(options.value || props.options) || [];
}
// 如果存在顶级标签
if (props.topLabel) {
return [
{
[props.labelKey]: props.topLabel,
[props.valueKey]: 0,
children: data
}
]
}
return data
});
// 获取值 // 获取值
function getValue(val: any): any | any[] { function getValue(val: any): any | any[] {
@ -108,6 +162,29 @@ export default defineComponent({
refs.select?.$.proxy.$el?.querySelector('.el-select__wrapper')?.click(); refs.select?.$.proxy.$el?.querySelector('.el-select__wrapper')?.click();
} }
// 获取选项数据
function refresh() {
let req: Promise<any> | null = null
if (isString(props.api)) {
req = Crud.value?.service[props.api]()
}
if (isFunction(props.api)) {
req = props.api()
}
if (req) {
req.then(res => {
options.value = deepTree(res);
})
}
}
onMounted(() => {
refresh()
})
expose({ expose({
focus focus
}); });
@ -121,6 +198,7 @@ export default defineComponent({
// 占位符 // 占位符
const placeholder = isSearch.value ? t('全部') : t('请选择'); const placeholder = isSearch.value ? t('全部') : t('请选择');
// 树形下拉框 // 树形下拉框
const TreeSelect = ( const TreeSelect = (
<el-tree-select <el-tree-select
@ -130,6 +208,7 @@ export default defineComponent({
placeholder={placeholder} placeholder={placeholder}
data={list.value} data={list.value}
checkStrictly={props.allLevelsId || props.checkStrictly} checkStrictly={props.allLevelsId || props.checkStrictly}
defaultExpandAll={props.defaultExpandAll}
props={{ props={{
label: props.labelKey, label: props.labelKey,
value: props.valueKey value: props.valueKey

View File

@ -1,10 +1,10 @@
import { type ModuleConfig, type Merge } from '/@/cool'; import { type ModuleConfig, type Merge } from "/@/cool";
import { config } from '/@/config'; import { config } from "/@/config";
import { Plugins } from './plugins'; import { Plugins } from "./plugins";
// npm // npm
import { Crud, locale } from '@cool-vue/crud'; import { Crud, locale } from "@cool-vue/crud";
import '@cool-vue/crud/dist/index.css'; import "@cool-vue/crud/dist/index.css";
// 调试、自定义crud // 调试、自定义crud
// import { Crud, locale } from '/~/crud/src'; // import { Crud, locale } from '/~/crud/src';
@ -15,7 +15,7 @@ export default (): Merge<ModuleConfig, CrudOptions> => {
order: 99, order: 99,
// 组件全注册 // 组件全注册
components: Object.values(import.meta.glob('./components/**/*.{vue,tsx}')), components: Object.values(import.meta.glob("./components/**/*.{vue,tsx}")),
// 配置参数,具体配置点 CrudOptions 查看 // 配置参数,具体配置点 CrudOptions 查看
options: { options: {
@ -28,7 +28,7 @@ export default (): Merge<ModuleConfig, CrudOptions> => {
// contextMenu: [] // contextMenu: []
}, },
form: { form: {
labelPosition: 'top', labelPosition: "top",
// 插件列表 // 插件列表
plugins: [ plugins: [
// 自动聚焦插件 // 自动聚焦插件
@ -46,8 +46,8 @@ export default (): Merge<ModuleConfig, CrudOptions> => {
dict: { dict: {
// 排序字段 // 排序字段
sort: { sort: {
prop: 'order', prop: "order",
order: 'sort' order: "sort"
}, },
// 按钮及提示文案 // 按钮及提示文案
label: locale[config.i18n.locale] label: locale[config.i18n.locale]
@ -57,12 +57,12 @@ export default (): Merge<ModuleConfig, CrudOptions> => {
// 安装 // 安装
install: Crud.install, install: Crud.install,
label: 'CRUD', label: "CRUD",
description: '快速增删改查及一系列辅助组件', description: "快速增删改查及一系列辅助组件",
author: 'COOL', author: "COOL",
version: '1.1.2', version: "1.1.2",
updateTime: '2024-12-31', updateTime: "2024-12-31",
doc: 'https://vue.cool-admin.com/src/guide/plugins/crud.html', doc: "https://vue.cool-admin.com/src/guide/plugins/crud.html",
demo: '/demo/crud' demo: "/demo/crud"
}; };
}; };

View File

@ -1,4 +1,11 @@
{ {
"已选": "Selected",
"选择": "Select",
"人": "Person",
"操作": "Operation",
"全部": "All",
"起": "Start",
"止": "End",
"今日": "Today", "今日": "Today",
"本周": "This Week", "本周": "This Week",
"本月": "This Month", "本月": "This Month",
@ -22,7 +29,7 @@
"确定要开启吗?": "Are you sure you want to enable it?", "确定要开启吗?": "Are you sure you want to enable it?",
"确定要关闭吗?": "Are you sure you want to disable it?", "确定要关闭吗?": "Are you sure you want to disable it?",
"提示": "Tip", "提示": "Tip",
"全部": "All", "添加": "Add",
"起": "Start", "移除": "Remove",
"止": "End" "全选": "Select all"
} }

View File

@ -16,6 +16,13 @@
"确定要开启吗?": "确定要开启吗?", "确定要开启吗?": "确定要开启吗?",
"确定要关闭吗?": "确定要关闭吗?", "确定要关闭吗?": "确定要关闭吗?",
"提示": "提示", "提示": "提示",
"添加": "添加",
"移除": "移除",
"全选": "全选",
"已选": "已选",
"选择": "选择",
"人": "人",
"操作": "操作",
"全部": "全部", "全部": "全部",
"起": "起", "起": "起",
"止": "止", "止": "止",

View File

@ -1,9 +1,16 @@
{ {
"已选": "已選",
"选择": "選擇",
"人": "人",
"操作": "操作",
"全部": "全部",
"起": "起",
"止": "止",
"今日": "今日", "今日": "今日",
"本周": "本周", "本周": "本周",
"本月": "本月", "本月": "本月",
"今年": "今年", "今年": "今年",
"自定义列": "自定義欄", "自定义列": "自定義列",
"重置": "重置", "重置": "重置",
"请输入": "請輸入", "请输入": "請輸入",
"保存": "保存", "保存": "保存",
@ -22,7 +29,7 @@
"确定要开启吗?": "確定要開啟嗎?", "确定要开启吗?": "確定要開啟嗎?",
"确定要关闭吗?": "確定要關閉嗎?", "确定要关闭吗?": "確定要關閉嗎?",
"提示": "提示", "提示": "提示",
"全部": "全部", "添加": "添加",
"起": "起", "移除": "移除",
"止": "止" "全选": "全選"
} }

View File

@ -1,5 +1,7 @@
import { rowEdit } from './rowEdit'; import { rowEdit } from './rowEdit';
import { toTree } from './toTree';
export const Table = { export const Table = {
rowEdit rowEdit,
toTree
}; };

View File

@ -6,6 +6,10 @@ import { cloneDeep } from 'lodash-es';
import { nextTick, reactive } from 'vue'; import { nextTick, reactive } from 'vue';
import { useRefs } from '/@/cool'; import { useRefs } from '/@/cool';
/**
*
* @returns
*/
export function rowEdit() { export function rowEdit() {
return ({ exposed }) => { return ({ exposed }) => {
const Crud = useCrud(); const Crud = useCrud();

View File

@ -0,0 +1,94 @@
import { useCrud } from "@cool-vue/crud";
import { deepTree } from "/@/cool/utils";
import { isEmpty } from "lodash-es";
interface Item extends Eps.BaseSysMenuEntity {
children?: Item[];
_children?: Item[];
hasChildren?: boolean;
}
/**
*
* @param options.lazy
* @param options.onRefresh
* @returns
*/
export function toTree(
options: { lazy?: boolean; onRefresh?: (params: any) => Promise<any[]> } = {}
) {
return ({ exposed }) => {
const Crud = useCrud();
// 设置刷新方法
if (Crud.value) {
Crud.value.config.onRefresh = (params: any, { render }: any) => {
const req = options.onRefresh
? options.onRefresh(params)
: Crud.value?.service.list(params);
if (req) {
req.then((list) => {
render(onData(list, params.sort));
});
}
};
}
// 数据处理
const onData = (list: Item[], sort: "desc" | "asc") => {
const data = deepTree(list, sort);
// 递归处理
const deep = (arr: Item[]) => {
arr.forEach((e) => {
const nodes: { [key: number]: Item[] } =
exposed.Table.value?.store.states.lazyTreeNodeMap.value || {};
if (nodes[e.id!]) {
nodes[e.id!] = e.children || [];
}
if (!isEmpty(e.children)) {
e.hasChildren = true;
e._children = e.children;
if (options.lazy) {
delete e.children;
}
deep(e._children || []);
}
});
};
deep(data);
return data;
};
// 层级参数
exposed.config.props.lazy = true;
exposed.config.props["row-key"] = "id";
exposed.config.props["tree-props"] = {
children: "children",
hasChildren: "hasChildren"
};
// 层级事件
exposed.config.on.load = (
row: Item,
treeNode: unknown,
resolve: (data: Item[]) => void
) => {
resolve(row._children || []);
};
// 行点击
exposed.config.on.onRowClick = (row: Item) => {
if (row._children) {
exposed.Table.value?.store.loadOrToggle(row);
}
};
};
}

View File

@ -5,9 +5,9 @@
"文档": "Document", "文档": "Document",
"刷新": "Refresh", "刷新": "Refresh",
"搜索关键字": "Search Keyword", "搜索关键字": "Search Keyword",
"Eps 错误,请在后端代码中设置:": "Eps Error, please set in backend code:", "Eps 错误,请在后端代码中设置:": "Eps error, please set in backend code:",
"没有可用的字典": "No available dictionary", "没有可用的字典": "No available dictionary",
"请添加新的字典条目": "Please add a new dictionary entry", "请添加新的字典条目": "Please add new dictionary entry",
"去添加": "Go to add", "去添加": "Go to add",
"是否删除该账号?": "Delete this account?", "是否删除该账号?": "Delete this account?",
"提示": "Tip" "提示": "Tip"

View File

@ -1,7 +1,7 @@
{ {
"代理请求": "代理請求", "代理请求": "代理請求",
"字典": "字典", "字典": "字典",
"账号": "帳號", "账号": "賬號",
"文档": "文檔", "文档": "文檔",
"刷新": "刷新", "刷新": "刷新",
"搜索关键字": "搜索關鍵字", "搜索关键字": "搜索關鍵字",
@ -9,6 +9,6 @@
"没有可用的字典": "沒有可用的字典", "没有可用的字典": "沒有可用的字典",
"请添加新的字典条目": "請添加新的字典條目", "请添加新的字典条目": "請添加新的字典條目",
"去添加": "去添加", "去添加": "去添加",
"是否删除该账号?": "是否刪除該帳號?", "是否删除该账号?": "是否刪除該賬號?",
"提示": "提示" "提示": "提示"
} }

View File

@ -3,7 +3,7 @@
"下载模版": "Download Template", "下载模版": "Download Template",
"重新上传": "Re-upload", "重新上传": "Re-upload",
"批量删除": "Batch Delete", "批量删除": "Batch Delete",
"序号": "No.", "序号": "Serial Number",
"操作": "Operation", "操作": "Operation",
"删除": "Delete", "删除": "Delete",
"请按照模版填写信息": "Please fill in the information according to the template", "请按照模版填写信息": "Please fill in the information according to the template",
@ -12,6 +12,6 @@
"[cl-import-btn] onSubmit is required": "[cl-import-btn] onSubmit is required", "[cl-import-btn] onSubmit is required": "[cl-import-btn] onSubmit is required",
"导出数据异常": "Export data exception", "导出数据异常": "Export data exception",
"导出": "Export", "导出": "Export",
"选择列": "Select columns", "选择列": "Select Columns",
"请先选择要导出的列": "Please select the columns to be exported first" "请先选择要导出的列": "Please select the columns to be exported first"
} }

View File

@ -2,7 +2,7 @@
"默认": "Default", "默认": "Default",
"翠绿": "Emerald", "翠绿": "Emerald",
"紫檀": "Rosewood", "紫檀": "Rosewood",
"金橙": "Golden Orange", "金橙": "Gold Orange",
"樱桃": "Cherry", "樱桃": "Cherry",
"薄荷": "Mint", "薄荷": "Mint",
"青灰": "Slate Gray", "青灰": "Slate Gray",

View File

@ -1,5 +1,5 @@
{ {
"默认": "預設", "默认": "默認",
"翠绿": "翠綠", "翠绿": "翠綠",
"紫檀": "紫檀", "紫檀": "紫檀",
"金橙": "金橙", "金橙": "金橙",
@ -7,10 +7,10 @@
"薄荷": "薄荷", "薄荷": "薄荷",
"青灰": "青灰", "青灰": "青灰",
"珊瑚": "珊瑚", "珊瑚": "珊瑚",
"设置主题": "設定主題", "设置主题": "設置主題",
"推荐": "推薦", "推荐": "推薦",
"自定义主色": "自訂主色", "自定义主色": "自定義主色",
"菜单分组显示": "選單分組顯示", "菜单分组显示": "菜單分組顯示",
"转场动画": "轉場動畫", "转场动画": "轉場動畫",
"切换主题": "切換主題" "切换主题": "切換主題"
} }

View File

@ -9,13 +9,13 @@
"拖拽排序": "Drag and sort", "拖拽排序": "Drag and sort",
"拖拽上传": "Drag and upload", "拖拽上传": "Drag and upload",
"上传": "Upload", "上传": "Upload",
"文件不能大于100k": "The file cannot be larger than 100k", "文件不能大于100k": "File cannot be larger than 100k",
"点击上传或将文件拖动到此处,文件大小限制{n}M": "Click to upload or drag the file here, file size limit {n}M", "点击上传或将文件拖动到此处,文件大小限制{n}M": "Click to upload or drag the file here, file size limit {n}M",
"选择文件": "Select file", "选择文件": "Select file",
"最多只能上传{n}个文件": "Up to {n} files can be uploaded at most", "最多只能上传{n}个文件": "Up to {n} files can be uploaded at most",
"上传文件大小不能超过 {n}MB!": "The uploaded file size cannot exceed {n}MB!", "上传文件大小不能超过 {n}MB!": "The uploaded file size cannot exceed {n}MB!",
"文档预览": "Document preview", "文档预览": "Document preview",
"加载失败": "Loading failed", "加载失败": "Load failed",
"预览": "Preview", "预览": "Preview",
"复制链接": "Copy link", "复制链接": "Copy link",
"删除": "Delete" "删除": "Delete"

View File

@ -6,8 +6,8 @@
"选择头像": "選擇頭像", "选择头像": "選擇頭像",
"选择图片": "選擇圖片", "选择图片": "選擇圖片",
"文件上传": "文件上傳", "文件上传": "文件上傳",
"拖拽排序": "拖曳排序", "拖拽排序": "拖拽排序",
"拖拽上传": "拖曳上傳", "拖拽上传": "拖拽上傳",
"上传": "上傳", "上传": "上傳",
"文件不能大于100k": "文件不能大於100k", "文件不能大于100k": "文件不能大於100k",
"点击上传或将文件拖动到此处,文件大小限制{n}M": "點擊上傳或將文件拖動到此處,文件大小限制{n}M", "点击上传或将文件拖动到此处,文件大小限制{n}M": "點擊上傳或將文件拖動到此處,文件大小限制{n}M",

4949
stats.html

File diff suppressed because one or more lines are too long

View File

@ -1,13 +1,13 @@
import { fileURLToPath, URL } from 'node:url'; import { fileURLToPath, URL } from "node:url";
import { ConfigEnv, UserConfig } from 'vite'; import { ConfigEnv, UserConfig } from "vite";
import vue from '@vitejs/plugin-vue'; import vue from "@vitejs/plugin-vue";
import vueJsx from '@vitejs/plugin-vue-jsx'; import vueJsx from "@vitejs/plugin-vue-jsx";
import vueDevTools from 'vite-plugin-vue-devtools'; import compression from "vite-plugin-compression";
import compression from 'vite-plugin-compression'; import VueI18nPlugin from "@intlify/unplugin-vue-i18n/vite";
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite'; import vueDevTools from "vite-plugin-vue-devtools";
import { visualizer } from 'rollup-plugin-visualizer'; import { visualizer } from "rollup-plugin-visualizer";
import { proxy } from './src/config/proxy'; import { proxy } from "./src/config/proxy";
import { cool } from '@cool-vue/vite-plugin'; import { cool } from "@cool-vue/vite-plugin";
function toPath(dir: string) { function toPath(dir: string) {
return fileURLToPath(new URL(dir, import.meta.url)); return fileURLToPath(new URL(dir, import.meta.url));
@ -15,7 +15,7 @@ function toPath(dir: string) {
// https://vitejs.dev/config // https://vitejs.dev/config
export default ({ mode }: ConfigEnv): UserConfig => { export default ({ mode }: ConfigEnv): UserConfig => {
const isDev = mode === 'development'; const isDev = mode === "development";
return { return {
plugins: [ plugins: [
@ -24,23 +24,23 @@ export default ({ mode }: ConfigEnv): UserConfig => {
vueJsx(), vueJsx(),
// vueDevTools(), // vueDevTools(),
cool({ cool({
type: 'admin', type: "admin",
proxy, proxy,
eps: { eps: {
enable: true enable: true
}, },
demo: mode == 'demo' // 是否开启演示模式 demo: mode == "demo" // 是否开启演示模式
}),
visualizer({
open: false,
gzipSize: true,
brotliSize: true
}), }),
// visualizer({
// open: false,
// gzipSize: true,
// brotliSize: true
// }),
VueI18nPlugin({ VueI18nPlugin({
include: [toPath('./src/{modules,plugins}/**/locales/**')] include: [toPath("./src/{modules,plugins}/**/locales/**")]
}) })
], ],
base: '/', base: "/",
server: { server: {
port: 9000, port: 9000,
proxy, proxy,
@ -52,23 +52,23 @@ export default ({ mode }: ConfigEnv): UserConfig => {
preprocessorOptions: { preprocessorOptions: {
scss: { scss: {
charset: false, charset: false,
api: 'modern-compiler' api: "modern-compiler"
} }
} }
}, },
resolve: { resolve: {
alias: { alias: {
'/@': toPath('./src'), "/@": toPath("./src"),
'/$': toPath('./src/modules'), "/$": toPath("./src/modules"),
'/#': toPath('./src/plugins'), "/#": toPath("./src/plugins"),
'/~': toPath('./packages') "/~": toPath("./packages")
} }
}, },
esbuild: { esbuild: {
drop: isDev ? [] : ['console', 'debugger'] drop: isDev ? [] : ["console", "debugger"]
}, },
build: { build: {
minify: 'esbuild', minify: "esbuild",
// terserOptions: { // terserOptions: {
// compress: { // compress: {
// drop_console: true, // drop_console: true,
@ -78,23 +78,23 @@ export default ({ mode }: ConfigEnv): UserConfig => {
sourcemap: isDev, sourcemap: isDev,
rollupOptions: { rollupOptions: {
output: { output: {
chunkFileNames: 'static/js/[name]-[hash].js', chunkFileNames: "static/js/[name]-[hash].js",
entryFileNames: 'static/js/[name]-[hash].js', entryFileNames: "static/js/[name]-[hash].js",
assetFileNames: 'static/[ext]/[name]-[hash].[ext]', assetFileNames: "static/[ext]/[name]-[hash].[ext]",
manualChunks(id) { manualChunks(id) {
if (id.includes('node_modules')) { if (id.includes("node_modules")) {
if (!['@cool-vue/crud'].find(e => id.includes(e))) { if (!["@cool-vue/crud"].find((e) => id.includes(e))) {
if (id.includes('prettier')) { if (id.includes("prettier")) {
return; return;
} }
return id return id
.toString() .toString()
.split('node_modules/')[1] .split("node_modules/")[1]
.replace('.pnpm/', '') .replace(".pnpm/", "")
.split('/')[0]; .split("/")[0];
} else { } else {
return 'comm'; return "comm";
} }
} }
} }