diff --git a/ZR.Admin.WebApi/Controllers/CommonController.cs b/ZR.Admin.WebApi/Controllers/CommonController.cs
index d331494..7e3424c 100644
--- a/ZR.Admin.WebApi/Controllers/CommonController.cs
+++ b/ZR.Admin.WebApi/Controllers/CommonController.cs
@@ -82,7 +82,7 @@ namespace ZR.Admin.WebApi.Controllers
[ActionPermissionFilter(Permission = "system")]
public IActionResult UploadFile([FromForm(Name = "file")] IFormFile formFile)
{
- if (formFile == null) throw new CustomException(ResultCode.PARAM_ERROR, "上传图片不能为空");
+ if (formFile == null) throw new CustomException(ResultCode.PARAM_ERROR, "上传文件不能为空");
string fileExt = Path.GetExtension(formFile.FileName);
string fileName = FileUtil.HashFileName(Guid.NewGuid().ToString()).ToLower() + fileExt;
string finalFilePath = Path.Combine(WebHostEnvironment.WebRootPath, FileUtil.GetdirPath("uploads"), fileName);
@@ -99,23 +99,28 @@ namespace ZR.Admin.WebApi.Controllers
}
string accessPath = $"{OptionsSetting.Upload.UploadUrl}/{FileUtil.GetdirPath("uploads").Replace("\\", " /")}{fileName}";
- return ToResponse(ResultCode.SUCCESS, accessPath);
+ return ToResponse(ResultCode.SUCCESS, new
+ {
+ url = accessPath,
+ fileName
+ });
}
///
/// 存储文件到阿里云
///
///
+ /// 上传文件夹路径
///
[HttpPost]
[Verify]
[ActionPermissionFilter(Permission = "system")]
- public IActionResult UploadFileAliyun([FromForm(Name = "file")] IFormFile formFile)
+ public IActionResult UploadFileAliyun([FromForm(Name = "file")] IFormFile formFile, string fileDir = "")
{
if (formFile == null) throw new CustomException(ResultCode.PARAM_ERROR, "上传文件不能为空");
string fileExt = Path.GetExtension(formFile.FileName);
string[] AllowedFileExtensions = new string[] { ".jpg", ".gif", ".png", ".jpeg", ".webp", ".svga", ".xls" };
- int MaxContentLength = 1024 * 1024 * 4;
+ int MaxContentLength = 1024 * 1024 * 5;
if (!AllowedFileExtensions.Contains(fileExt))
{
@@ -126,9 +131,13 @@ namespace ZR.Admin.WebApi.Controllers
{
return ToResponse(ResultCode.CUSTOM_ERROR, "上传文件过大,不能超过 " + (MaxContentLength / 1024).ToString() + " MB");
}
- (bool, string) result = SysFileService.SaveFile("", formFile);
+ (bool, string, string) result = SysFileService.SaveFile(fileDir, formFile);
- return ToResponse(ResultCode.SUCCESS, result.Item2);
+ return ToResponse(ResultCode.SUCCESS, new
+ {
+ url = result.Item2,
+ fileName = result.Item3
+ });
}
#endregion
}
diff --git a/ZR.Admin.WebApi/Controllers/System/CodeGeneratorController.cs b/ZR.Admin.WebApi/Controllers/System/CodeGeneratorController.cs
index 61fc996..f554632 100644
--- a/ZR.Admin.WebApi/Controllers/System/CodeGeneratorController.cs
+++ b/ZR.Admin.WebApi/Controllers/System/CodeGeneratorController.cs
@@ -195,36 +195,35 @@ namespace ZR.Admin.WebApi.Controllers
sortField = genTableDto.SortField,
sortType = genTable.SortType
});
- int rows = GenTableService.UpdateGenTable(genTable);
- if (rows > 0)
+ int updateCount = 0;
+ bool result = GenTableService.UseTran2(() =>
{
- GenTableColumnService.UpdateGenTableColumn(genTable.Columns);
- }
- return SUCCESS(rows);
+ int rows = GenTableService.UpdateGenTable(genTable);
+ if (rows > 0)
+ {
+ updateCount = GenTableColumnService.UpdateGenTableColumn(genTable.Columns);
+ }
+ });
+
+ return SUCCESS(updateCount);
}
///
/// 预览代码
///
- ///
+ ///
///
- [HttpGet("preview/{tableId}")]
+ [HttpPost("preview/{tableId}")]
[ActionPermissionFilter(Permission = "tool:gen:preview")]
- public IActionResult Preview(long tableId)
+ public IActionResult Preview([FromBody] GenerateDto dto)
{
- if (tableId <= 0)
+ if (dto == null || dto.TableId <= 0)
{
throw new CustomException(ResultCode.CUSTOM_ERROR, "请求参数为空");
}
- var genTableInfo = GenTableService.GetGenTableInfo(tableId);
- genTableInfo.Columns = GenTableColumnService.GenTableColumns(tableId);
+ var genTableInfo = GenTableService.GetGenTableInfo(dto.TableId);
+ genTableInfo.Columns = GenTableColumnService.GenTableColumns(dto.TableId);
- //var dictList = genTableInfo.Columns.FindAll(x => !string.IsNullOrEmpty(x.DictType));
- //foreach (var item in dictList)
- //{
- // item.DictDatas = SysDictDataService.SelectDictDataByType(item.DictType);
- //}
- GenerateDto dto = new();
dto.GenTable = genTableInfo;
dto.ZipPath = Path.Combine(WebHostEnvironment.WebRootPath, "Generatecode");
dto.GenCodePath = Path.Combine(dto.ZipPath, DateTime.Now.ToString("yyyyMMdd"));
diff --git a/ZR.Admin.WebApi/Controllers/System/SysRoleController.cs b/ZR.Admin.WebApi/Controllers/System/SysRoleController.cs
index 5242149..5c1859a 100644
--- a/ZR.Admin.WebApi/Controllers/System/SysRoleController.cs
+++ b/ZR.Admin.WebApi/Controllers/System/SysRoleController.cs
@@ -128,7 +128,7 @@ namespace ZR.Admin.WebApi.Controllers.System
{
if (sysRoleDto == null || sysRoleDto.RoleId <= 0) return ToResponse(ApiResult.Error(101, "请求参数错误"));
- sysRoleDto.Create_by = HttpContextExtension.GetName(HttpContext);
+ sysRoleDto.Create_by = HttpContext.GetName();
//删除角色菜单
sysRoleService.DeleteRoleMenuByRoleId(sysRoleDto.RoleId);
sysRoleService.InsertRoleMenu(sysRoleDto);
diff --git a/ZR.Admin.WebApi/Framework/JwtUtil.cs b/ZR.Admin.WebApi/Framework/JwtUtil.cs
index 75f237a..83c8e46 100644
--- a/ZR.Admin.WebApi/Framework/JwtUtil.cs
+++ b/ZR.Admin.WebApi/Framework/JwtUtil.cs
@@ -25,7 +25,7 @@ namespace ZR.Admin.WebApi.Framework
///
public static LoginUser GetLoginUser(HttpContext httpContext)
{
- string token = HttpContextExtension.GetToken(httpContext);
+ string token = httpContext.GetToken();
if (!string.IsNullOrEmpty(token))
{
@@ -44,6 +44,8 @@ namespace ZR.Admin.WebApi.Framework
JwtSettings jwtSettings = new();
ConfigUtils.Instance.Bind("JwtSettings", jwtSettings);
+ var authTime = DateTime.Now;
+ var expiresAt = authTime.AddMinutes(jwtSettings.Expire);
var tokenHandler = new JwtSecurityTokenHandler();
var key = Encoding.ASCII.GetBytes(jwtSettings.SecretKey);
claims.Add(new Claim("Audience", jwtSettings.Audience));
@@ -54,8 +56,9 @@ namespace ZR.Admin.WebApi.Framework
Subject = new ClaimsIdentity(claims),
Issuer = jwtSettings.Issuer,
Audience = jwtSettings.Audience,
- IssuedAt = DateTime.Now,//token生成时间
- Expires = DateTime.Now.AddMinutes(jwtSettings.Expire),
+ IssuedAt = authTime,//token生成时间
+ Expires = expiresAt,
+ //NotBefore = authTime,
TokenType = "Bearer",
//对称秘钥,签名证书
SigningCredentials = new SigningCredentials(new SymmetricSecurityKey(key), SecurityAlgorithms.HmacSha256Signature)
@@ -83,7 +86,8 @@ namespace ZR.Admin.WebApi.Framework
ValidAudience = jwtSettings.Audience,
IssuerSigningKey = new SymmetricSecurityKey(key),
ValidateLifetime = true,//是否验证Token有效期,使用当前时间与Token的Claims中的NotBefore和Expires对比
- RequireExpirationTime = true,//过期时间
+ ClockSkew = TimeSpan.FromSeconds(30)
+ //RequireExpirationTime = true,//过期时间
};
return tokenDescriptor;
}
diff --git a/ZR.Admin.WebApi/NLog.config b/ZR.Admin.WebApi/NLog.config
index a6d075c..4982ce8 100644
--- a/ZR.Admin.WebApi/NLog.config
+++ b/ZR.Admin.WebApi/NLog.config
@@ -30,6 +30,15 @@
keepFileOpen="false"
layout="${longdate} | ${event-properties:item=EventId_Id} | ${uppercase:${level}} | ${logger} | ${aspnet-request-iP} | ${event-properties:item=user} | ${aspnet-request-url} | ${message} | ${event-properties:item=requestParam} | ${event-properties:item=jsonResult} | ${onexception:${exception:format=tostring}"/>
+
+
+
@@ -46,6 +55,7 @@
+
diff --git a/ZR.Admin.WebApi/ZR.Admin.WebApi.csproj b/ZR.Admin.WebApi/ZR.Admin.WebApi.csproj
index 0b71c00..8339601 100644
--- a/ZR.Admin.WebApi/ZR.Admin.WebApi.csproj
+++ b/ZR.Admin.WebApi/ZR.Admin.WebApi.csproj
@@ -67,7 +67,7 @@
-
+
diff --git a/ZR.Admin.WebApi/appsettings.json b/ZR.Admin.WebApi/appsettings.json
index bd00d8f..e062474 100644
--- a/ZR.Admin.WebApi/appsettings.json
+++ b/ZR.Admin.WebApi/appsettings.json
@@ -15,13 +15,13 @@
"urls": "http://localhost:8888", //Ŀurl
"sysConfig": {
"DBCommandTimeout": 10,
- "cors": "http://localhost:8887" //ַǰĿ","
+ "cors": "http://localhost:8887" //ַǰĿǰ˷뵥Ҫã","
},
"JwtSettings": {
- "Issuer": "https://localhost:8888",
- "Audience": "https://localhost:8888",
- "SecretKey": "Hello-key-ZRADMIN.NET-20210101",
- "Expire": 5
+ "Issuer": "ZRAdmin.NET",
+ "Audience": "ZRAdmin.NET",
+ "SecretKey": "SecretKey-ZRADMIN.NET-20210101",
+ "Expire": 30
},
"DemoMode": false, //Ƿʾģʽ
"DbKey": "", //ݿkey
diff --git a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplControllers.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplControllers.txt
index 91f9590..c3dd147 100644
--- a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplControllers.txt
+++ b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplControllers.txt
@@ -26,7 +26,7 @@ namespace ${options.ApiControllerNamespace}.Controllers
/// @date ${replaceDto.AddTime}
///
[Verify]
- [Route("${genTable.ModuleName}/${replaceDto.ModelTypeName}")]
+ [Route("${genTable.ModuleName}/${genTable.BusinessName}")]
public class ${replaceDto.ModelTypeName}Controller : BaseController
{
///
@@ -51,7 +51,18 @@ namespace ${options.ApiControllerNamespace}.Controllers
var predicate = Expressionable.Create<${replaceDto.ModelTypeName}>();
//搜索条件查询语法参考Sqlsugar
-${QueryCondition}
+$foreach(column in genTable.Columns)
+$if(column.IsQuery)
+$if(column.CsharpType == "string")
+ predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.${column.CsharpField}), ${codeTool.QueryExp(column.CsharpField, column.QueryType)};
+$elseif(column.CsharpType == "DateTime")
+ predicate = predicate.AndIF(parm.Begin${column.CsharpField} != null, it => it.${column.CsharpField} >= parm.Begin${column.CsharpField});
+ predicate = predicate.AndIF(parm.End${column.CsharpField} != null, it => it.${column.CsharpField} <= parm.End${column.CsharpField});
+$elseif(column.CsharpType == "int" || column.CsharpType == "long")
+ predicate = predicate.AndIF(parm.${column.CsharpField} != null, ${codeTool.QueryExp(column.CsharpField, column.QueryType)};
+$end
+$end
+$end
$if(genTable.SortField != "" && genTable.SortField != null)
var response = _${replaceDto.ModelTypeName}Service.GetPages(predicate.ToExpression(), parm, x => x.${genTable.SortField}, "${genTable.SortType}");
$else
diff --git a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplDto.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplDto.txt
index 68c509a..a424ac5 100644
--- a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplDto.txt
+++ b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplDto.txt
@@ -14,7 +14,7 @@ $foreach(item in genTable.Columns)
$if((item.IsInsert || item.IsEdit || item.IsPk || item.IsIncrement))
public $item.CsharpType$item.RequiredStr $item.CsharpField { get; set; }
$end
-${end}
+$end
}
///
@@ -27,8 +27,8 @@ $if(item.IsQuery && item.htmlType == "datetime")
public DateTime? Begin$item.CsharpField { get; set; }
public DateTime? End$item.CsharpField { get; set; }
$elseif(item.IsQuery)
- public $item.CsharpType $item.CsharpField { get; set; }
+ public $item.CsharpType$if(item.CsharpType != "string")?$end $item.CsharpField { get; set; }
+$end
$end
-${end}
}
}
diff --git a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVue.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVue.txt
index 8f42fec..76d6a07 100644
--- a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVue.txt
+++ b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVue.txt
@@ -8,7 +8,6 @@ ${vueQueryFormHtml}
重置
-
@@ -20,9 +19,11 @@ ${vueQueryFormHtml}
删除
+$if(replaceDto.ShowBtnExport)
导出
+$end
$if(genTable.SortField != "" && 1 == 2)
修改排序
@@ -32,15 +33,13 @@ $end
-
+
${VueViewListContent}
编辑
-
- 删除
-
+ 删除
@@ -50,7 +49,7 @@ ${VueViewListContent}
- ${VueViewFormContent}
+${VueViewFormContent}
+
+ 动态标题
+
+
保存配置
@@ -88,17 +94,20 @@ export default {
},
topNav: {
get() {
- return this.$store.state.settings.topNav
+ return this.$store.state.settings.topNav;
},
set(val) {
- this.$store.dispatch('settings/changeSetting', {
- key: 'topNav',
- value: val
- })
+ this.$store.dispatch("settings/changeSetting", {
+ key: "topNav",
+ value: val,
+ });
if (!val) {
- this.$store.commit("SET_SIDEBAR_ROUTERS", this.$store.state.permission.defaultRoutes);
+ this.$store.commit(
+ "SET_SIDEBAR_ROUTERS",
+ this.$store.state.permission.defaultRoutes
+ );
}
- }
+ },
},
tagsView: {
get() {
@@ -122,6 +131,17 @@ export default {
});
},
},
+ dynamicTitle: {
+ get() {
+ return this.$store.state.settings.dynamicTitle;
+ },
+ set(val) {
+ this.$store.dispatch("settings/changeSetting", {
+ key: "dynamicTitle",
+ value: val,
+ });
+ },
+ },
},
methods: {
themeChange(val) {
@@ -154,6 +174,7 @@ export default {
"tagsView":${this.tagsView},
"fixedHeader":${this.fixedHeader},
"sidebarLogo":${this.sidebarLogo},
+ "dynamicTitle":${this.dynamicTitle},
"sideTheme":"${this.sideTheme}",
"theme":"${this.theme}"
}`
diff --git a/ZR.Vue/src/main.js b/ZR.Vue/src/main.js
index fa6dc78..3720641 100644
--- a/ZR.Vue/src/main.js
+++ b/ZR.Vue/src/main.js
@@ -29,6 +29,8 @@ import DictTag from '@/components/DictTag'
// import DictData from '@/components/DictData'
// 上传图片
import UploadImage from '@/components/UploadImage/index';
+// 上传文件
+import UploadFile from '@/components/FileUpload/index';
// 全局方法挂载
Vue.prototype.getDicts = getDicts
@@ -60,10 +62,11 @@ Vue.component('RightToolbar', RightToolbar)
Vue.component('DictTag', DictTag)
Vue.component('Editor', Editor)
Vue.component('UploadImage', UploadImage)
+Vue.component('UploadFile', UploadFile)
Vue.use(permission)
Vue.use(Element, {
- size: Cookies.get('size') || 'medium' // set element-ui default size
+ size: Cookies.get('size') || 'small' // set element-ui default size
})
Vue.config.productionTip = false
diff --git a/ZR.Vue/src/permission.js b/ZR.Vue/src/permission.js
index 924803a..4ec5adc 100644
--- a/ZR.Vue/src/permission.js
+++ b/ZR.Vue/src/permission.js
@@ -13,9 +13,10 @@ const whiteList = ['/login', '/auth-redirect', '/bind', '/register', '/demo']
router.beforeEach((to, from, next) => {
NProgress.start()
- console.log('router to ' + to.path);
+ console.log('path=' + to.path);
if (getToken()) {
+ to.meta.title && store.dispatch('settings/setTitle', to.meta.title)
/* has token*/
if (to.path === '/login') {
next({ path: '/' })
diff --git a/ZR.Vue/src/settings.js b/ZR.Vue/src/settings.js
index 2b3221c..27e509d 100644
--- a/ZR.Vue/src/settings.js
+++ b/ZR.Vue/src/settings.js
@@ -3,11 +3,11 @@ module.exports = {
* 框架版本号
*/
version: '3.7.0',
- title: 'ZrAdmin.NET',
+ title: 'ZrAdmin.NET-管理系统',
/**
* 主题颜色
*/
- theme: '#13C2C2',
+ theme: '#409EFF',
/**
* 侧边栏主题 深色主题theme-dark,浅色主题theme-light
*/
@@ -37,7 +37,10 @@ module.exports = {
* 是否显示logo
*/
sidebarLogo: true,
-
+ /**
+ * 是否显示动态标题
+ */
+ dynamicTitle: false,
/**
* @type {string | array} 'production' | ['production', 'development']
* @description Need show err logs component.
diff --git a/ZR.Vue/src/store/getters.js b/ZR.Vue/src/store/getters.js
index adcf1d8..ec52d5f 100644
--- a/ZR.Vue/src/store/getters.js
+++ b/ZR.Vue/src/store/getters.js
@@ -7,6 +7,7 @@ const getters = {
token: state => state.user.token,
avatar: state => state.user.avatar,
name: state => state.user.name,
+ userId: state => state.user.userInfo.userId,
introduction: state => state.user.introduction,
roles: state => state.user.roles,
permissions: state => state.user.permissions,
diff --git a/ZR.Vue/src/store/modules/settings.js b/ZR.Vue/src/store/modules/settings.js
index 907cede..67c5567 100644
--- a/ZR.Vue/src/store/modules/settings.js
+++ b/ZR.Vue/src/store/modules/settings.js
@@ -1,9 +1,10 @@
import defaultSettings from '@/settings'
-const { theme, sideTheme, showSettings, topNav, tagsView, fixedHeader, sidebarLogo } = defaultSettings
+const { theme, sideTheme, showSettings, topNav, tagsView, fixedHeader, sidebarLogo, dynamicTitle } = defaultSettings
const storageSetting = JSON.parse(localStorage.getItem('layout-setting')) || ''
const state = {
+ title: '',
theme: storageSetting.theme || theme, //主题颜色
sideTheme: storageSetting.sideTheme || sideTheme, //侧边主题样式
topNav: storageSetting.topNav === undefined ? topNav : storageSetting.topNav,
@@ -11,7 +12,7 @@ const state = {
tagsView: storageSetting.tagsView === undefined ? tagsView : storageSetting.tagsView,
fixedHeader: storageSetting.fixedHeader === undefined ? fixedHeader : storageSetting.fixedHeader,
sidebarLogo: storageSetting.sidebarLogo === undefined ? sidebarLogo : storageSetting.sidebarLogo,
- // dynamicTitle: storageSetting.dynamicTitle === undefined ? dynamicTitle : storageSetting.dynamicTitle
+ dynamicTitle: storageSetting.dynamicTitle === undefined ? dynamicTitle : storageSetting.dynamicTitle
}
const mutations = {
@@ -26,6 +27,11 @@ const actions = {
//修改布局设置
changeSetting({ commit }, data) {
commit('CHANGE_SETTING', data)
+ },
+ // 设置网页标题
+ setTitle({ commit }, title) {
+ state.title = title;
+ document.title = state.dynamicTitle ? `${title} - ${process.env.VUE_APP_TITLE}` : process.env.VUE_APP_TITLE;
}
}
diff --git a/ZR.Vue/src/utils/request.js b/ZR.Vue/src/utils/request.js
index 9cf7d49..4336d66 100644
--- a/ZR.Vue/src/utils/request.js
+++ b/ZR.Vue/src/utils/request.js
@@ -26,6 +26,7 @@ service.interceptors.request.use(config => {
if (getToken()) {
//将token放到请求头发送给服务器,将tokenkey放在请求头中
config.headers['Authorization'] = 'Bearer ' + getToken();
+ config.headers['userid'] = store.getters.userId;
} else {
// console.log(config)
}
@@ -42,7 +43,7 @@ service.interceptors.response.use(res => {
return;
}
// 未设置状态码则默认成功状态
- const { code , msg } = res.data;
+ const { code, msg } = res.data;
if (code == 401) {
MessageBox.confirm('登录状态已过期,请重新登录', '系统提示', {
@@ -137,4 +138,4 @@ export function postForm(url, data, config) {
})
})
}
-export default service
+export default service
\ No newline at end of file
diff --git a/ZR.Vue/src/utils/ruoyi.js b/ZR.Vue/src/utils/ruoyi.js
index fd86973..03e3587 100644
--- a/ZR.Vue/src/utils/ruoyi.js
+++ b/ZR.Vue/src/utils/ruoyi.js
@@ -66,8 +66,7 @@ export function addDateRange(params, dateRange) {
}
export function addDateRange2(dateRange, index) {
- console.log(dateRange);
- var time = "";
+ var time = undefined;
if (null != dateRange && '' != dateRange) {
if (dateRange.length <= 2) {
time = dateRange[index];
diff --git a/ZR.Vue/src/views/login.vue b/ZR.Vue/src/views/login.vue
index 86c89b3..9d69617 100644
--- a/ZR.Vue/src/views/login.vue
+++ b/ZR.Vue/src/views/login.vue
@@ -1,7 +1,7 @@
- {{title}}后台管理系统
+ {{title}}
diff --git a/ZR.Vue/src/views/system/role/index.vue b/ZR.Vue/src/views/system/role/index.vue
index 88cdcfe..7d0a4ec 100644
--- a/ZR.Vue/src/views/system/role/index.vue
+++ b/ZR.Vue/src/views/system/role/index.vue
@@ -2,7 +2,8 @@
-
+
-
-
-
-
- {{form.roleKey}}
-
-
- 展开/折叠
- 全选/全不选
- 父子联动
-
-
-
- 保存
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 修改
+ 删除
+ 数据权限
+
+
+
+
+
+
+
+ {{form.roleKey}}
+
+
+ 展开/折叠
+ 全选/全不选
+ 父子联动
+
+
+
+
+
+
@@ -119,7 +122,6 @@ import {
// treeselect as deptTreeselect,
// roleDeptTreeselect,
// } from "@/api/system/dept";
-import { downloadFile } from "@/utils/zipdownload.js";
export default {
name: "Role",
@@ -420,7 +422,7 @@ export default {
roleId: row.roleId,
roleName: row.roleName,
roleKey: row.roleKey,
- menuCheckStrictly: true
+ menuCheckStrictly: true,
};
},
/** 提交按钮 */
@@ -460,6 +462,7 @@ export default {
dataScope(this.form).then((response) => {
this.msgSuccess("修改成功");
this.getList();
+ this.showRoleScope = false;
this.handleDataScope({ roleId: this.form.roleId });
});
} else {
diff --git a/ZR.Vue/src/views/system/roleusers/index.vue b/ZR.Vue/src/views/system/roleusers/index.vue
index 6d74979..b6791ef 100644
--- a/ZR.Vue/src/views/system/roleusers/index.vue
+++ b/ZR.Vue/src/views/system/roleusers/index.vue
@@ -1,22 +1,27 @@
-
-
-
-
+
+
+
+
-
-
+
+
- 添加用户
- 批量取消授权
+ 添加用户
+
+
+ 批量取消授权
-
+
@@ -24,13 +29,15 @@
-
+
- 取消授权
+ 取消授权
@@ -53,7 +60,8 @@
-
+
@@ -128,7 +136,7 @@ export default {
this.delSelections.push(element.userId);
});
if (this.delSelections.length === 0) {
- console.log('未选中')
+ console.log("未选中");
return;
}
this.$confirm(
diff --git a/ZR.Vue/src/views/system/user/index.vue b/ZR.Vue/src/views/system/user/index.vue
index ec2631c..eefb908 100644
--- a/ZR.Vue/src/views/system/user/index.vue
+++ b/ZR.Vue/src/views/system/user/index.vue
@@ -2,7 +2,7 @@
-
+
diff --git a/ZR.Vue/src/views/tool/gen/editTable.vue b/ZR.Vue/src/views/tool/gen/editTable.vue
index 5f50c81..e816f66 100644
--- a/ZR.Vue/src/views/tool/gen/editTable.vue
+++ b/ZR.Vue/src/views/tool/gen/editTable.vue
@@ -1,6 +1,6 @@
-
+
@@ -31,11 +31,6 @@
-
-
-
-
-
@@ -71,6 +66,11 @@
+
+
+
+
+
@@ -89,7 +89,8 @@
-
+
{{ dict.dictName }}
{{ dict.dictType }}
@@ -177,13 +178,14 @@ export default {
if (validateResult) {
const genTable = Object.assign({}, basicForm.model, genForm.model);
genTable.columns = this.cloumns;
- // genTable.params = {
- // treeCode: genTable.treeCode,
- // treeName: genTable.treeName,
- // treeParentCode: genTable.treeParentCode,
- // parentMenuId: genTable.parentMenuId,
- // };
- // console.log(JSON.stringify(genTable));
+ genTable.params = {
+ // treeCode: genTable.treeCode,
+ // treeName: genTable.treeName,
+ // treeParentCode: genTable.treeParentCode,
+ //parentMenuId: genTable.parentMenuId,
+ };
+ console.log("genForm", genTable);
+ // return;
updateGenTable(genTable).then((res) => {
this.msgSuccess(res.msg);
if (res.code === 200) {
@@ -207,21 +209,32 @@ export default {
this.$store.dispatch("tagsView/delView", this.$route);
this.$router.push({ path: "/tool/gen", query: { t: Date.now() } });
},
+ sortTable(columns) {
+ const el = this.$refs.dragTable.$el.querySelectorAll(
+ ".el-table__body-wrapper > table > tbody"
+ )[0];
+ var that = this;
+ const sortable = Sortable.create(el, {
+ handle: ".allowDrag",
+ onEnd: (evt) => {
+ const targetRow = that.cloumns.splice(evt.oldIndex, 1)[0];
+ columns.splice(evt.newIndex, 0, targetRow);
+ for (let index in columns) {
+ columns[index].sort = parseInt(index) + 1;
+ }
+ this.$nextTick(() => {
+ this.columns = columns;
+ });
+ },
+ });
+ },
},
- mounted() {
- const el = this.$refs.dragTable.$el.querySelectorAll(
- ".el-table__body-wrapper > table > tbody"
- )[0];
- const sortable = Sortable.create(el, {
- handle: ".allowDrag",
- onEnd: (evt) => {
- const targetRow = this.cloumns.splice(evt.oldIndex, 1)[0];
- this.cloumns.splice(evt.newIndex, 0, targetRow);
- for (let index in this.cloumns) {
- this.cloumns[index].sort = parseInt(index) + 1;
- }
+ watch: {
+ cloumns: {
+ handler(val) {
+ this.sortTable(val);
},
- });
+ },
},
};
diff --git a/ZR.Vue/src/views/tool/gen/genInfoForm.vue b/ZR.Vue/src/views/tool/gen/genInfoForm.vue
index 54ff5f5..c6ef96e 100644
--- a/ZR.Vue/src/views/tool/gen/genInfoForm.vue
+++ b/ZR.Vue/src/views/tool/gen/genInfoForm.vue
@@ -28,7 +28,7 @@
生成模块名
-
+
@@ -237,10 +237,10 @@ export default {
{ required: true, message: "请选择生成模板", trigger: "blur" },
],
moduleName: [
- { required: true, message: "请输入生成模块名", trigger: "blur" },
+ { required: true, message: "请输入生成模块名", trigger: "blur", pattern:/^[A-Za-z]+$/ },
],
businessName: [
- { required: true, message: "请输入生成业务名", trigger: "blur" },
+ { required: true, message: "请输入生成业务名", trigger: "blur", pattern:/^[A-Za-z]+$/},
],
functionName: [
{ required: true, message: "请输入生成功能名", trigger: "blur" },
diff --git a/ZR.Vue/src/views/tool/gen/index.vue b/ZR.Vue/src/views/tool/gen/index.vue
index 85f48ce..edfc8ec 100644
--- a/ZR.Vue/src/views/tool/gen/index.vue
+++ b/ZR.Vue/src/views/tool/gen/index.vue
@@ -29,17 +29,18 @@
-
+
- 预览
+ 预览
编辑
删除
- 同步
- 生成代码
+
+ 生成代码
+
@@ -56,9 +57,24 @@
-
+
-
+
+
+
+ 添加
+
+
+ 修改
+
+
+ 删除
+
+
+ 导出
+
+
+
mySql
sqlServer
@@ -103,7 +119,8 @@ export default {
activeName: "0",
},
showGenerate: false,
- checkedCodeGenerateForm: [1, 2, 3, 4, 5, 6, 7, 8],
+ // 显示的button
+ checkedBtnForm: [1, 2, 3],
rules: {},
// 表数据
tableData: [],
@@ -151,15 +168,28 @@ export default {
},
// 代码预览
handlePreview(row) {
- previewTable(row.tableId).then((res) => {
+ var seachdata = {
+ tableId: this.currentSelected.tableId,
+ checkedBtn: this.checkedBtnForm,
+ dbType: this.dbType,
+ };
+ previewTable(row.tableId, seachdata).then((res) => {
if (res.code === 200) {
+ this.showGenerate = false;
this.preview.open = true;
this.preview.data = res.data;
}
});
},
- handleShowDialog(row) {
+ // 打开对话框、预览、生成
+ handleShowDialog(row, type) {
this.showGenerate = true;
+ if (type == "generate") {
+ this.preview.title = "代码生成";
+ }
+ if (type == "preview") {
+ this.preview.title = "预览";
+ }
this.currentSelected = row;
},
/**
@@ -167,6 +197,10 @@ export default {
*/
handleGenerate: async function () {
console.log(JSON.stringify(this.currentSelected));
+ if (this.preview.title == "预览") {
+ this.handlePreview(this.currentSelected);
+ return;
+ }
if (!this.currentSelected) {
this.msgError("请先选择要生成代码的数据表");
return false;
@@ -184,8 +218,7 @@ export default {
var seachdata = {
tableId: this.currentSelected.tableId,
tableName: this.currentSelected.name,
- // genCodeFiles: this.checkedCodeGenerateForm,
- // coverd: this.coverd,
+ checkedBtn: this.checkedBtnForm,
dbType: this.dbType,
// queryColumn: this.checkedQueryColumn,
};
diff --git a/ZR.Vue/vue.config.js b/ZR.Vue/vue.config.js
index a366f0e..8e08514 100644
--- a/ZR.Vue/vue.config.js
+++ b/ZR.Vue/vue.config.js
@@ -1,7 +1,6 @@
'use strict'
const path = require('path')
const defaultSettings = require('./src/settings.js')
-// const FileManagerPlugin = require('filemanager-webpack-plugin');
function resolve(dir) {
return path.join(__dirname, dir)
@@ -53,17 +52,6 @@ module.exports = {
}
},
plugins: [
- // new FileManagerPlugin({
- // events: {
- // onEnd: {
- // //首先需要删除项目根目录下的dist.zip
- // delete: ["./dist/*.zip"],
-
- // //然后我们选择dist文件夹将之打包成dist.zip并放在根目录
- // archive: [{ source: "./dist", destination: "./dist/dist.zip" }]
- // }
- // }
- // })
]
},
chainWebpack(config) {
diff --git a/document/admin-mysql.sql b/document/admin-mysql.sql
index 5ca36d6..d3dfecf 100644
--- a/document/admin-mysql.sql
+++ b/document/admin-mysql.sql
@@ -251,7 +251,7 @@ INSERT INTO sys_menu VALUES (102, '菜单管理', 1, 3, 'menu', 'system/menu/ind
INSERT INTO sys_menu VALUES (103, '部门管理', 1, 4, 'dept', 'system/dept/index', 0, 0, 'C', '0', '0', 'system:dept:list', 'tree', '', SYSDATE(), '', NULL, '部门管理菜单');
INSERT INTO sys_menu VALUES (104, '岗位管理', 1, 5, 'post', 'system/post/index', 0, 0, 'C', '0', '0', 'system:post:list', 'post', '', SYSDATE(), '', NULL, '岗位管理菜单');
INSERT INTO sys_menu VALUES (105, '字典管理', 1, 6, 'dict', 'system/dict/index', 0, 0, 'C', '0', '0', 'system:dict:list', 'dict', '', SYSDATE(), '', NULL, '');
-INSERT INTO sys_menu VALUES (106, '角色分配', 1, 2, 'roleusers', 'system/roleusers/index', 0, 0, 'C', '0', '0', 'system:role:list', 'people', '', SYSDATE(), '', NULL, NULL);
+INSERT INTO sys_menu VALUES (106, '用户角色', 1, 2, 'roleusers', 'system/roleusers/index', 0, 0, 'C', '0', '0', 'system:role:list', 'people', '', SYSDATE(), '', NULL, NULL);
INSERT into sys_menu VALUES (107, '参数设置', 1, 8, 'config','system/config/index', 0, 0, 'C', '0', '0', 'system:config:list','edit', '', SYSDATE(), '', NULL, '');
INSERT INTO sys_menu VALUES (108, '日志管理', 1, 9, 'log', '' , 0, 0, 'M', '0', '0', '', 'log', '', SYSDATE(), '', NULL, '日志管理菜单');
INSERT INTO sys_menu VALUES (110, '定时任务', 2, 10, 'job', 'monitor/job/index', 0, 0, 'C', '0', '0', '', 'job', '', SYSDATE(), '', NULL, '定时任务菜单');
diff --git a/document/admin-sqlserver.sql b/document/admin-sqlserver.sql
index 5487c3c..8e3e93b 100644
Binary files a/document/admin-sqlserver.sql and b/document/admin-sqlserver.sql differ