Merge branch 'master' of https://gitee.com/izory/ZrAdminNetCore
This commit is contained in:
commit
8c95efa9a5
1
.gitignore
vendored
1
.gitignore
vendored
@ -262,3 +262,4 @@ __pycache__/
|
||||
/ZRAdmin/Properties/launchSettings.json
|
||||
/ZRAdmin/Properties/PublishProfiles
|
||||
/ZR.Admin.WebApi/appsettings.Stage.json
|
||||
/CodeGenerate
|
||||
|
||||
@ -7,7 +7,9 @@ namespace Infrastructure
|
||||
public class OptionsSetting
|
||||
{
|
||||
public static string ConnAdmin = "Conn_admin";
|
||||
public static string Conn = "ConnDynamic";
|
||||
public static string DbType = "DbType";
|
||||
public static string CodeGenDbType = "CodeGenDbType";
|
||||
public static string DbKey = "DbKey";
|
||||
|
||||
public string Conn_Admin { get; set; }
|
||||
|
||||
11
README.md
11
README.md
@ -32,7 +32,7 @@ Vue版前端技术栈 :基于vue、vuex、vue-router 、vue-cli 、axios 和 e
|
||||
|
||||
日志管理:NLog、登录日志、操作日志
|
||||
|
||||
工具类:验证码、丰富公共功能
|
||||
工具类:验证码、丰富公共功能、代码生成
|
||||
|
||||
## 🍄快速启动
|
||||
需要安装:VS2019(最新版)、npm或yarn(最新版)
|
||||
@ -59,6 +59,7 @@ Vue版前端技术栈 :基于vue、vuex、vue-router 、vue-cli 、axios 和 e
|
||||
13. [X] 在线构建器:拖动表单元素生成相应的VUE代码。
|
||||
14. [X] 任务系统:基于Quartz.NET定时任务执行。
|
||||
15. [X] 文章管理:可以写文章记录。
|
||||
16. [X] 代码生成:可以一键生成前后端代码。
|
||||
|
||||
## 🍎演示图
|
||||
|
||||
@ -83,6 +84,14 @@ Vue版前端技术栈 :基于vue、vuex、vue-router 、vue-cli 、axios 和 e
|
||||
<td><img src="https://www.izhaorui.cn/images/zradmin/9.png"/></td>
|
||||
<td><img src="https://www.izhaorui.cn/images/zradmin/10.png"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://www.izhaorui.cn/images/zradmin/11.png"/></td>
|
||||
<td><img src="https://www.izhaorui.cn/images/zradmin/12.png"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://www.izhaorui.cn/images/zradmin/13.png"/></td>
|
||||
<td><img src="https://www.izhaorui.cn/images/zradmin/14.png"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
## 🎉优势
|
||||
|
||||
@ -16,34 +16,36 @@ namespace ZR.Admin.WebApi.Controllers
|
||||
public static string TIME_FORMAT_FULL = "yyyy-MM-dd HH:mm:ss";
|
||||
public static string TIME_FORMAT_FULL_2 = "MM-dd HH:mm:ss";
|
||||
|
||||
protected IActionResult SUCCESS(object data, string timeFormatStr = "MM-dd HH:mm:ss")
|
||||
protected IActionResult SUCCESS(object data, string timeFormatStr = "yyyy-MM-dd HH:mm:ss")
|
||||
{
|
||||
string jsonStr = GetJsonStr(GetApiResult(data != null ? ResultCode.SUCCESS : ResultCode.FAIL, data), timeFormatStr);
|
||||
return Content(jsonStr, "application/json");
|
||||
}
|
||||
|
||||
protected IActionResult ToRespose(ResultCode resultCode, object data = null)
|
||||
{
|
||||
string jsonStr = GetJsonStr(GetApiResult(resultCode, data), "");
|
||||
return Content(jsonStr, "application/json");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// json输出带时间格式的
|
||||
/// </summary>
|
||||
/// <param name="apiResult"></param>
|
||||
/// <param name="timeFormatStr"></param>
|
||||
/// <returns></returns>
|
||||
protected IActionResult OutputJson(ApiResult apiResult, string timeFormatStr = "MM-dd HH:mm:ss")
|
||||
protected IActionResult OutputJson(ApiResult apiResult, string timeFormatStr = "yyyy-MM-dd HH:mm:ss")
|
||||
{
|
||||
string jsonStr = GetJsonStr(apiResult, timeFormatStr);
|
||||
|
||||
return Content(jsonStr, "application/json");
|
||||
}
|
||||
protected IActionResult OutputJson(long rows, string timeFormatStr = "MM-dd HH:mm:ss")
|
||||
protected IActionResult OutputJson(long rows, string timeFormatStr = "yyyy-MM-dd HH:mm:ss")
|
||||
{
|
||||
string jsonStr = GetJsonStr(ToJson(rows), timeFormatStr);
|
||||
|
||||
return Content(jsonStr, "application/json");
|
||||
}
|
||||
protected string SerializeObject(object obj)
|
||||
{
|
||||
return JsonConvert.SerializeObject(obj);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 响应返回结果
|
||||
|
||||
90
ZR.Admin.WebApi/Controllers/CodeGeneratorController.cs
Normal file
90
ZR.Admin.WebApi/Controllers/CodeGeneratorController.cs
Normal file
@ -0,0 +1,90 @@
|
||||
using Infrastructure;
|
||||
using Infrastructure.Attribute;
|
||||
using Infrastructure.Enums;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using System.Collections.Generic;
|
||||
using ZR.Admin.WebApi.Filters;
|
||||
using ZR.CodeGenerator;
|
||||
using ZR.CodeGenerator.Model;
|
||||
using ZR.CodeGenerator.Service;
|
||||
using ZR.Model;
|
||||
using ZR.Model.Vo;
|
||||
|
||||
namespace ZR.Admin.WebApi.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// 代码生成
|
||||
/// </summary>
|
||||
[Route("tool/gen")]
|
||||
public class CodeGeneratorController : BaseController
|
||||
{
|
||||
private CodeGeneraterService _CodeGeneraterService = new CodeGeneraterService();
|
||||
|
||||
/// <summary>
|
||||
/// 获取所有数据库的信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("getDbList")]
|
||||
[ActionPermissionFilter(Permission = "tool:gen:list")]
|
||||
public IActionResult GetListDataBase()
|
||||
{
|
||||
var dbList = _CodeGeneraterService.GetAllDataBases();
|
||||
var defaultDb = dbList.Count > 0 ? dbList[0] : null;
|
||||
return SUCCESS(new { dbList, defaultDb });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///获取所有表根据数据名
|
||||
/// </summary>
|
||||
/// <param name="dbName">数据库名</param>
|
||||
/// <param name="tableName">表名</param>
|
||||
/// <param name="pager">分页信息</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("getTableList")]
|
||||
[ActionPermissionFilter(Permission = "tool:gen:list")]
|
||||
public IActionResult FindListTable(string dbName, string tableName, PagerInfo pager)
|
||||
{
|
||||
List<DbTableInfo> list = _CodeGeneraterService.GetAllTables(dbName, tableName, pager);
|
||||
var vm = new VMPageResult<DbTableInfo>(list, pager);
|
||||
|
||||
return SUCCESS(vm);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取表格列
|
||||
/// </summary>
|
||||
/// <param name="dbName"></param>
|
||||
/// <param name="tableName"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("getColumnInfo")]
|
||||
[ActionPermissionFilter(Permission = "tool:gen:list")]
|
||||
public IActionResult QueryColumnInfo(string dbName, string tableName)
|
||||
{
|
||||
if (string.IsNullOrEmpty(dbName) || string.IsNullOrEmpty(tableName))
|
||||
return ToRespose(ResultCode.PARAM_ERROR);
|
||||
|
||||
return SUCCESS(_CodeGeneraterService.GetColumnInfo(dbName, tableName));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 代码生成器
|
||||
/// </summary>
|
||||
/// <param name="dto">数据传输对象</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("genCode")]
|
||||
[Log(Title = "代码生成", BusinessType = BusinessType.GENCODE)]
|
||||
[ActionPermissionFilter(Permission = "tool:gen:code")]
|
||||
public IActionResult Generate([FromBody] GenerateDto dto)
|
||||
{
|
||||
if (string.IsNullOrEmpty(dto.tableName))
|
||||
{
|
||||
throw new CustomException(ResultCode.CUSTOM_ERROR, "请求参数为空");
|
||||
}
|
||||
DbTableInfo dbTableInfo = new() { Name = dto.tableName };
|
||||
CodeGeneratorTool.Generate(dbTableInfo, dto);
|
||||
|
||||
return SUCCESS(dbTableInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -10,13 +10,13 @@ namespace ZR.Admin.WebApi.Extensions
|
||||
{
|
||||
var types = source.GetType();
|
||||
|
||||
var worker = new IdWorker(1, 1);
|
||||
if (types.GetProperty("ID") != null)
|
||||
{
|
||||
long id = worker.NextId();
|
||||
//var worker = new IdWorker(1, 1);
|
||||
//if (types.GetProperty("ID") != null)
|
||||
//{
|
||||
// long id = worker.NextId();
|
||||
|
||||
types.GetProperty("ID").SetValue(source, id.ToString(), null);
|
||||
}
|
||||
// types.GetProperty("ID").SetValue(source, id.ToString(), null);
|
||||
//}
|
||||
|
||||
if (types.GetProperty("CreateTime") != null)
|
||||
{
|
||||
|
||||
@ -54,7 +54,7 @@ namespace ZR.Admin.WebApi.Filters
|
||||
bool isDemoMode = ConfigUtils.Instance.GetAppConfig("DemoMode", false);
|
||||
|
||||
//演示公开环境屏蔽权限
|
||||
string[] denyPerms = new string[] { "update", "add", "remove", "add", "edit", "delete", "import", "run", "start", "stop", "clear" };
|
||||
string[] denyPerms = new string[] { "update", "add", "remove", "add", "edit", "delete", "import", "run", "start", "stop", "clear", "code" };
|
||||
if (isDemoMode && (denyPerms.Any(f => Permission.ToLower().Contains(f.ToLower())) || Permission.Equals("system")))
|
||||
{
|
||||
context.Result = new JsonResult(new { code = ResultCode.FORBIDDEN, msg = "演示模式 , 不允许操作" });
|
||||
|
||||
134
ZR.Admin.WebApi/Template/ControllersTemplate.txt
Normal file
134
ZR.Admin.WebApi/Template/ControllersTemplate.txt
Normal file
@ -0,0 +1,134 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using ZR.Admin.WebApi.Filters;
|
||||
using ZR.Admin.WebApi.Controllers;
|
||||
using ZR.Service.Business;
|
||||
using SqlSugar;
|
||||
using Infrastructure;
|
||||
using Infrastructure.Attribute;
|
||||
using Infrastructure.Enums;
|
||||
using Infrastructure.Model;
|
||||
using Mapster;
|
||||
using ZR.Admin.WebApi.Extensions;
|
||||
using {ModelsNamespace}.Dto;
|
||||
using {ModelsNamespace}.Models;
|
||||
|
||||
namespace ZRAdmin.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// 代码自动生成
|
||||
/// </summary>
|
||||
|
||||
[Verify]
|
||||
[Route("bus/{ModelName}")]
|
||||
public class {ControllerName}Controller: BaseController
|
||||
{
|
||||
/// <summary>
|
||||
/// {FileName}接口
|
||||
/// </summary>
|
||||
private readonly I{ServiceName} _{ServiceName};
|
||||
|
||||
public {ControllerName}Controller(I{ServiceName} {ServiceName})
|
||||
{
|
||||
_{ServiceName} = {ServiceName};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询{FileName}列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("list")]
|
||||
[ActionPermissionFilter(Permission = "{Permission}:list")]
|
||||
public IActionResult Query([FromQuery] {ModelName}QueryDto parm)
|
||||
{
|
||||
//开始拼装查询条件
|
||||
var predicate = Expressionable.Create<{ModelName}>();
|
||||
|
||||
//TODO 搜索条件
|
||||
//predicate = predicate.And(m => m.Name.Contains(parm.Name));
|
||||
|
||||
var response = _{ServiceName}.GetPages(predicate.ToExpression(), parm);
|
||||
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询{FileName}详情
|
||||
/// </summary>
|
||||
/// <param name="{primaryKey}"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{{primaryKey}}")]
|
||||
[ActionPermissionFilter(Permission = "{Permission}:query")]
|
||||
public IActionResult Get({KeyTypeName} {primaryKey})
|
||||
{
|
||||
var response = _{ServiceName}.GetId({primaryKey});
|
||||
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加{FileName}
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[ActionPermissionFilter(Permission = "{Permission}:add")]
|
||||
[Log(Title = "{FileName}添加", BusinessType = BusinessType.INSERT)]
|
||||
public IActionResult Create([FromBody] {ModelName}Dto parm)
|
||||
{
|
||||
if (parm == null)
|
||||
{
|
||||
throw new CustomException("请求参数错误");
|
||||
}
|
||||
//从 Dto 映射到 实体
|
||||
var addModel = parm.Adapt<{ModelName}>().ToCreate();
|
||||
//addModel.CreateID = User.Identity.Name;
|
||||
|
||||
return SUCCESS(_{ServiceName}.Add(addModel));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新{FileName}
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPut]
|
||||
[ActionPermissionFilter(Permission = "{Permission}:update")]
|
||||
[Log(Title = "{FileName}修改", BusinessType = BusinessType.UPDATE)]
|
||||
public IActionResult Update([FromBody] {ModelName}Dto parm)
|
||||
{
|
||||
if (parm == null)
|
||||
{
|
||||
throw new CustomException("请求实体不能为空");
|
||||
}
|
||||
//从 Dto 映射到 实体
|
||||
var updateModel = parm.Adapt<{ModelName}>().ToCreate();
|
||||
//updateModel.CreateID = User.Identity.Name;
|
||||
|
||||
var response = _{ServiceName}.Update(w => w.{primaryKey} == updateModel.{primaryKey}, it => new {ModelName}()
|
||||
{
|
||||
//TODO 字段映射
|
||||
{updateColumn}
|
||||
});
|
||||
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除{FileName}
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("{{primaryKey}}")]
|
||||
[ActionPermissionFilter(Permission = "{Permission}:delete")]
|
||||
[Log(Title = "{FileName}删除", BusinessType = BusinessType.DELETE)]
|
||||
public IActionResult Delete({KeyTypeName} {primaryKey} = 0)
|
||||
{
|
||||
if ({primaryKey} <= 0) { return OutputJson(ApiResult.Error($"删除失败Id 不能为空")); }
|
||||
|
||||
// 删除{FileName}
|
||||
var response = _{ServiceName}.Delete({primaryKey});
|
||||
|
||||
return SUCCESS(response);
|
||||
}
|
||||
}
|
||||
}
|
||||
12
ZR.Admin.WebApi/Template/IServiceTemplate.txt
Normal file
12
ZR.Admin.WebApi/Template/IServiceTemplate.txt
Normal file
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using {ModelsNamespace}.Models;
|
||||
|
||||
namespace {IServicsNamespace}.Business
|
||||
{
|
||||
/// <summary>
|
||||
/// 定义{TableNameDesc}服务接口
|
||||
/// </summary>
|
||||
public interface I{ModelTypeName}Service: IBaseService<{ModelTypeName}>
|
||||
{
|
||||
}
|
||||
}
|
||||
21
ZR.Admin.WebApi/Template/InputDtoTemplate.txt
Normal file
21
ZR.Admin.WebApi/Template/InputDtoTemplate.txt
Normal file
@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using {ModelsNamespace}.Dto;
|
||||
using {ModelsNamespace}.Models;
|
||||
|
||||
namespace {DtosNamespace}.Dto
|
||||
{
|
||||
/// <summary>
|
||||
/// {TableNameDesc}输入对象模型
|
||||
/// </summary>
|
||||
public class {ModelTypeName}Dto
|
||||
{
|
||||
{PropertyName}
|
||||
}
|
||||
|
||||
public class {ModelTypeName}QueryDto: PagerInfo
|
||||
{
|
||||
public DateTime? BeginTime { get; set; }
|
||||
public DateTime? EndTime { get; set; }
|
||||
}
|
||||
}
|
||||
14
ZR.Admin.WebApi/Template/ModelTemplate.txt
Normal file
14
ZR.Admin.WebApi/Template/ModelTemplate.txt
Normal file
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace {ModelsNamespace}.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// {TableNameDesc},数据实体对象
|
||||
/// </summary>
|
||||
[SqlSugar.SugarTable("{TableName}")]
|
||||
public class {ModelTypeName}
|
||||
{
|
||||
{PropertyName}
|
||||
}
|
||||
}
|
||||
25
ZR.Admin.WebApi/Template/RepositoryTemplate.txt
Normal file
25
ZR.Admin.WebApi/Template/RepositoryTemplate.txt
Normal file
@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using Infrastructure.Attribute;
|
||||
using {RepositoriesNamespace}.System;
|
||||
using {ModelsNamespace}.Models;
|
||||
|
||||
namespace {RepositoriesNamespace}
|
||||
{
|
||||
/// <summary>
|
||||
/// 代码生成器生成
|
||||
/// {TableNameDesc}仓储接口的实现
|
||||
/// </summary>
|
||||
[AppService(ServiceLifetime = LifeTime.Transient)]
|
||||
public class {ModelTypeName}Repository : BaseRepository
|
||||
{
|
||||
public {ModelTypeName}Repository()
|
||||
{
|
||||
}
|
||||
|
||||
#region 业务逻辑代码
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
32
ZR.Admin.WebApi/Template/ServiceTemplate.txt
Normal file
32
ZR.Admin.WebApi/Template/ServiceTemplate.txt
Normal file
@ -0,0 +1,32 @@
|
||||
using Infrastructure;
|
||||
using Infrastructure.Attribute;
|
||||
using Infrastructure.Extensions;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using ZR.Common;
|
||||
using {ModelsNamespace}.Models;
|
||||
using {IRepositoriesNamespace};
|
||||
using {ServicesNamespace}.IService;
|
||||
|
||||
namespace {ServicesNamespace}.Business
|
||||
{
|
||||
/// <summary>
|
||||
/// 代码生成器生成
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(I{ModelTypeName}Service), ServiceLifetime = LifeTime.Transient)]
|
||||
public class {ModelTypeName}Service: BaseService<{ModelTypeName}>, I{ModelTypeName}Service
|
||||
{
|
||||
private readonly {ModelTypeName}Repository _repository;
|
||||
public {ModelTypeName}Service({ModelTypeName}Repository repository)
|
||||
{
|
||||
_repository = repository;
|
||||
}
|
||||
|
||||
#region 业务逻辑代码
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
59
ZR.Admin.WebApi/Template/VueJsTemplate.txt
Normal file
59
ZR.Admin.WebApi/Template/VueJsTemplate.txt
Normal file
@ -0,0 +1,59 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
/**
|
||||
* {ModelTypeDesc}分页查询
|
||||
* @param {查询条件} data
|
||||
*/
|
||||
export function list{ModelTypeName}(data) {
|
||||
return request({
|
||||
url: 'bus/{ModelTypeName}/list',
|
||||
method: 'get',
|
||||
params: data,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增{ModelTypeDesc}
|
||||
* @param data
|
||||
*/
|
||||
export function add{ModelTypeName}(data) {
|
||||
return request({
|
||||
url: '/bus/{ModelTypeName}',
|
||||
method: 'post',
|
||||
data: data,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改{ModelTypeDesc}
|
||||
* @param data
|
||||
*/
|
||||
export function update{ModelTypeName}(data) {
|
||||
return request({
|
||||
url: '/bus/{ModelTypeName}',
|
||||
method: 'PUT',
|
||||
data: data,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取{ModelTypeDesc}详情
|
||||
* @param {Id} {ModelTypeDesc}Id
|
||||
*/
|
||||
export function get{ModelTypeName}(id) {
|
||||
return request({
|
||||
url: '/bus/{ModelTypeName}/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param {主键} pid
|
||||
*/
|
||||
export function del{ModelTypeName}(pid) {
|
||||
return request({
|
||||
url: '/bus/{ModelTypeName}/' + pid,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
235
ZR.Admin.WebApi/Template/VueTemplate.txt
Normal file
235
ZR.Admin.WebApi/Template/VueTemplate.txt
Normal file
@ -0,0 +1,235 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- :model属性用于表单验证使用 比如下面的el-form-item 的 prop属性用于对表单值进行验证操作 -->
|
||||
<el-form :model="queryParams" label-position="left" inline ref="queryForm" :label-width="labelWidth" v-show="showSearch" @submit.native.prevent>
|
||||
<el-form-item label="文本文字">
|
||||
<el-input v-model="queryParams.xxx" placeholder="" />
|
||||
</el-form-item>
|
||||
<el-form-item label="数字">
|
||||
<el-input v-model.number="queryParams.xxx" placeholder="" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="下拉框">
|
||||
<el-select v-model="queryParams.xxx" placeholder="">
|
||||
<el-option v-for="dict in statusOptions" :key="dict.dictValue" :label="dict.dictLabel" :value="dict.dictValue" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="时间范围">
|
||||
<el-date-picker size="small" style="width: 240px" v-model="timeRange" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
|
||||
<el-row class="mb8" style="text-align:center">
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-row>
|
||||
</el-form>
|
||||
|
||||
<!-- 工具区域 -->
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" v-hasPermi="['{Permission}:add']" plain icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" :disabled="single" v-hasPermi="['{Permission}:update']" plain icon="el-icon-edit" size="mini" @click="handleUpdate">修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" v-hasPermi="['{Permission}:delete']" plain icon="el-icon-delete" size="mini" @click="handleDelete">删除</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<!-- 数据区域 -->
|
||||
<el-table :data="dataList" ref="table" border @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="50" />
|
||||
{VueViewListContent}
|
||||
<el-table-column label="操作" align="center" width="200">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" v-hasPermi="['{Permission}:update']" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">编辑</el-button>
|
||||
<el-popconfirm title="确定删除吗?" @onConfirm="handleDelete(scope.row)" style="margin-left:10px">
|
||||
<el-button slot="reference" v-hasPermi="['{Permission}:delete']" size="mini" type="text" icon="el-icon-delete">删除</el-button>
|
||||
</el-popconfirm>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination class="mt10" background :total="total" :current-page.sync="queryParams.pageNum" :page-size="queryParams.pageSize" :page-sizes="[20, 30, 50, 100]" layout="total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange" @current-change="getList" />
|
||||
|
||||
<!-- 添加或修改菜单对话框 -->
|
||||
<el-dialog :title="title" :lock-scroll="false" :visible.sync="open" >
|
||||
<el-form ref="form" :model="form" :rules="rules" :label-width="formLabelWidth">
|
||||
{VueViewFormContent}
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer" v-if="btnSubmitVisible">
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import {
|
||||
list{ModelTypeName},
|
||||
add{ModelTypeName},
|
||||
del{ModelTypeName},
|
||||
update{ModelTypeName},
|
||||
get{ModelTypeName}
|
||||
} from '@/api/{fileClassName}.js'
|
||||
|
||||
export default {
|
||||
name: '{ModelTypeName}',
|
||||
data() {
|
||||
return {
|
||||
labelWidth: "100px",
|
||||
formLabelWidth:"100px",
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 查询参数
|
||||
queryParams: {},
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 时间范围数组
|
||||
timeRange: [],
|
||||
// xxx下拉框
|
||||
statusOptions: [],
|
||||
// 数据列表
|
||||
dataList: [],
|
||||
// 总记录数
|
||||
total: 0,
|
||||
// 提交按钮是否显示
|
||||
btnSubmitVisible: true,
|
||||
// 表单校验
|
||||
rules: {
|
||||
{VueViewEditFormRuleContent}
|
||||
},
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
// 列表数据查询
|
||||
this.getList();
|
||||
// 下拉框绑定
|
||||
// this.getDicts("sys_normal_disable").then((response) => {
|
||||
// this.statusOptions = response.data;
|
||||
// });
|
||||
},
|
||||
methods: {
|
||||
// 查询数据
|
||||
getList() {
|
||||
console.log(JSON.stringify(this.queryParams));
|
||||
list{ModelTypeName}(this.addDateRange(this.queryParams, this.timeRange)).then(res => {
|
||||
if (res.code == 200) {
|
||||
this.dataList = res.data.result;
|
||||
this.total = res.data.totalCount;
|
||||
}
|
||||
})
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 重置数据表单
|
||||
reset() {
|
||||
this.form = {
|
||||
{VueViewEditFormContent}
|
||||
//需个性化处理内容
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 重置查询操作 */
|
||||
resetQuery() {
|
||||
this.timeRange = [];
|
||||
this.resetForm("queryForm");
|
||||
this.queryParams = {
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
//TODO 重置字段
|
||||
};
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map((item) => item.{primaryKey});
|
||||
this.single = selection.length!=1
|
||||
this.multiple = !selection.length;
|
||||
},
|
||||
/** 选择每页显示数量*/
|
||||
handleSizeChange(val) {
|
||||
this.queryParams.pageSize = val;
|
||||
this.queryParams.pageNum = 1;
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.getList();
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加";
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
del{ModelTypeName}(row.{primaryKey}).then((res) => {
|
||||
this.msgSuccess("删除成功");
|
||||
this.handleQuery();
|
||||
});
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const {primaryKey} = row.{primaryKey} || this.ids;
|
||||
get{ModelTypeName}({primaryKey}).then((res) => {
|
||||
if(res.code == 200){
|
||||
this.form = res.data;
|
||||
this.open = true;
|
||||
this.title = "修改数据";
|
||||
}
|
||||
});
|
||||
},
|
||||
beforeFileUpload(file) { },
|
||||
//文件上传成功方法
|
||||
{vueJsMethod}
|
||||
/** 提交按钮 */
|
||||
submitForm: function () {
|
||||
this.$refs["form"].validate((valid) => {
|
||||
if (valid) {
|
||||
console.log(JSON.stringify(this.form));
|
||||
|
||||
if (this.form.{primaryKey} != undefined || this.title === '修改数据') {
|
||||
update{ModelTypeName}(this.form).then((res) => {
|
||||
this.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
add{ModelTypeName}(this.form).then((res) => {
|
||||
this.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
.table-td-thumb {
|
||||
width: 80px;
|
||||
}
|
||||
</style>
|
||||
@ -32,6 +32,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ZR.CodeGenerator\ZR.CodeGenerator.csproj" />
|
||||
<ProjectReference Include="..\ZR.Service\ZR.Service.csproj" />
|
||||
<ProjectReference Include="..\ZR.Tasks\ZR.Tasks.csproj" />
|
||||
</ItemGroup>
|
||||
@ -56,6 +57,30 @@
|
||||
<Generator>TextTemplatingFileGenerator</Generator>
|
||||
<LastGenOutput>Controller.cs</LastGenOutput>
|
||||
</None>
|
||||
<None Update="Template\ControllersTemplate.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Template\InputDtoTemplate.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Template\IServiceTemplate.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Template\ModelTemplate.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Template\RepositoryTemplate.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Template\ServiceTemplate.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Template\VueJsTemplate.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Template\VueTemplate.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@ -63,6 +88,16 @@
|
||||
<Folder Include="wwwroot\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Resource Include="Template\RepositoryTemplate.txt" />
|
||||
<Resource Include="Template\ServiceTemplate.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
<Resource Include="Template\VueJsTemplate.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" />
|
||||
</ItemGroup>
|
||||
|
||||
@ -6,9 +6,9 @@
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"appName": "ZR Admin System",
|
||||
"ConnectionStrings": {
|
||||
"Conn_Admin": "server=127.0.0.1;database=admin;user=zr;pwd=abc"
|
||||
"Conn_Admin": "server=127.0.0.1;user=zr;pwd=abc;database=admin",
|
||||
"ConnDynamic": "server=127.0.0.1;user=zr;pwd=abc;database={database}"//代码生成使用
|
||||
},
|
||||
"urls": "http://localhost:8888", //启动url
|
||||
"sysConfig": {
|
||||
@ -18,6 +18,7 @@
|
||||
"DemoMode": false, //是否演示模式
|
||||
"DbKey": "",
|
||||
"DbType": 0, //MySql = 0, SqlServer = 1, Sqlite = 2, Oracle = 3, PostgreSQL = 4,
|
||||
"CodeGenDbType": 0,//代码生成数据库类型
|
||||
"Upload": {
|
||||
"UploadDirectory": "/",
|
||||
"UploadUrl": "http://localhost:8888"
|
||||
|
||||
@ -5,26 +5,5 @@
|
||||
"Microsoft": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"appName": "ZR Admin system",
|
||||
"ConnectionStrings": {
|
||||
"Conn_Admin": "server=127.0.0.1;database=admin;user=zr;pwd=abc"
|
||||
},
|
||||
"urls": "http://localhost:8888",
|
||||
"sysConfig": {
|
||||
"DBCommandTimeout": 10,
|
||||
"cors": "http://localhost:8887"
|
||||
},
|
||||
"DemoMode": false, //ÊÇ·ñÑÝʾģʽ
|
||||
"DbKey": "",
|
||||
"DbType": 0, //MySql = 0, SqlServer = 1, Sqlite = 2, Oracle = 3, PostgreSQL = 4,
|
||||
"Upload": {
|
||||
"UploadDirectory": "/",
|
||||
"UploadUrl": "http://localhost:8888"
|
||||
},
|
||||
"ALYUN_OCS": {
|
||||
"REGIONID": "cn-hangzhou",
|
||||
"KEY": "XX",
|
||||
"SECRET": "XX"
|
||||
}
|
||||
}
|
||||
|
||||
54
ZR.CodeGenerator/CodeGenerateOption.cs
Normal file
54
ZR.CodeGenerator/CodeGenerateOption.cs
Normal file
@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ZR.CodeGenerator
|
||||
{
|
||||
public class CodeGenerateOption
|
||||
{
|
||||
/// <summary>
|
||||
/// 项目命名空间
|
||||
/// </summary>
|
||||
public string BaseNamespace { get; set; }
|
||||
/// <summary>
|
||||
/// 数据实体命名空间
|
||||
/// </summary>
|
||||
public string ModelsNamespace { get; set; }
|
||||
/// <summary>
|
||||
/// 输入输出数据实体名称空间
|
||||
/// </summary>
|
||||
public string DtosNamespace { get; set; }
|
||||
/// <summary>
|
||||
/// 仓储接口命名空间
|
||||
/// </summary>
|
||||
public string IRepositoriesNamespace { get; set; }
|
||||
/// <summary>
|
||||
/// 仓储实现名称空间
|
||||
/// </summary>
|
||||
public string RepositoriesNamespace { get; set; }
|
||||
/// <summary>
|
||||
/// 服务接口命名空间
|
||||
/// </summary>
|
||||
public string IServicsNamespace { get; set; }
|
||||
/// <summary>
|
||||
/// 服务接口实现命名空间
|
||||
/// </summary>
|
||||
public string ServicesNamespace { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Api控制器命名空间
|
||||
/// </summary>
|
||||
public string ApiControllerNamespace { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 去掉的表头字符
|
||||
/// </summary>
|
||||
public string ReplaceTableNameStr { get; set; }
|
||||
/// <summary>
|
||||
/// 要生数据的表,用“,”分割
|
||||
/// </summary>
|
||||
public string TableList { get; set; }
|
||||
}
|
||||
}
|
||||
152
ZR.CodeGenerator/CodeGenerateTemplate.cs
Normal file
152
ZR.CodeGenerator/CodeGenerateTemplate.cs
Normal file
@ -0,0 +1,152 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ZR.CodeGenerator.CodeGenerator;
|
||||
|
||||
namespace ZR.CodeGenerator
|
||||
{
|
||||
public class CodeGenerateTemplate
|
||||
{
|
||||
#region Template
|
||||
|
||||
public static string GetVueJsMethod(DbColumnInfo dbColumnInfo)
|
||||
{
|
||||
string columnName = CodeGeneratorTool.FirstLowerCase(dbColumnInfo.DbColumnName);
|
||||
string js = "";
|
||||
if (CodeGeneratorTool.imageFiled.Any(f => columnName.Contains(f)))
|
||||
{
|
||||
js += $"handleUpload{columnName}Success(res, file) {{\n";
|
||||
js += $" this.form.{columnName} = URL.createObjectURL(file.raw);\n";
|
||||
js += " // this.$refs.upload.clearFiles();\n";
|
||||
js += "},\n";
|
||||
}
|
||||
return js;
|
||||
}
|
||||
|
||||
//rules
|
||||
public static string GetFormRules(DbColumnInfo dbFieldInfo)
|
||||
{
|
||||
string vueViewEditFromRuleContent = "";
|
||||
//Rule 规则验证
|
||||
if (!dbFieldInfo.IsNullable && !dbFieldInfo.IsIdentity)
|
||||
{
|
||||
vueViewEditFromRuleContent += $" {dbFieldInfo.DbColumnName}: [\n";
|
||||
vueViewEditFromRuleContent += $" {{ required: true, message:\"请输入{dbFieldInfo.ColumnDescription}\", trigger: \"blur\"}},\n";
|
||||
//vueViewEditFromRuleContent += " { min: 2, max: 50, message: \"长度在 2 到 50 个字符\", trigger:\"blur\" }\n";
|
||||
vueViewEditFromRuleContent += " ],\n";
|
||||
}
|
||||
|
||||
return vueViewEditFromRuleContent;
|
||||
}
|
||||
|
||||
//model 属性
|
||||
public static string GetModelTemplate(DbColumnInfo dbFieldInfo)
|
||||
{
|
||||
string columnName = dbFieldInfo.DbColumnName.Substring(0, 1).ToUpper() + dbFieldInfo.DbColumnName[1..];
|
||||
var modelcontent = "";
|
||||
modelcontent += " /// <summary>\n";
|
||||
modelcontent += $" /// 描述 :{dbFieldInfo.ColumnDescription}\n";
|
||||
modelcontent += $" /// 空值 :{dbFieldInfo.IsNullable}\n";
|
||||
modelcontent += $" /// 默认 :{dbFieldInfo.DefaultValue}\n";
|
||||
modelcontent += " /// </summary>\n";
|
||||
if (dbFieldInfo.IsIdentity || dbFieldInfo.IsPrimarykey)
|
||||
{
|
||||
modelcontent += $" [SqlSugar.SugarColumn(IsPrimaryKey = {dbFieldInfo.IsPrimarykey.ToString().ToLower()}, IsIdentity = {dbFieldInfo.IsIdentity.ToString().ToLower()})]\n";
|
||||
}
|
||||
modelcontent += $" public {TableMappingHelper.GetPropertyDatatype(dbFieldInfo.DataType)} {columnName} {{ get; set; }}\n\r";
|
||||
return modelcontent;
|
||||
}
|
||||
//DTO model
|
||||
public static string GetDtoContent(DbColumnInfo dbFieldInfo)
|
||||
{
|
||||
string columnName = dbFieldInfo.DbColumnName.Substring(0, 1).ToUpper() + dbFieldInfo.DbColumnName[1..];
|
||||
string InputDtoContent = "";
|
||||
InputDtoContent += $" public {TableMappingHelper.GetPropertyDatatype(dbFieldInfo.DataType)} {columnName} {{ get; set; }}\n\r";
|
||||
|
||||
return InputDtoContent;
|
||||
}
|
||||
|
||||
//form-item
|
||||
public static string GetVueViewFormContent(DbColumnInfo dbFieldInfo)
|
||||
{
|
||||
string columnName = CodeGeneratorTool.FirstLowerCase(dbFieldInfo.DbColumnName);
|
||||
string labelName = CodeGeneratorTool.GetLabelName(dbFieldInfo.ColumnDescription, columnName);
|
||||
string vueViewFromContent = "";
|
||||
string labelDisabled = dbFieldInfo.IsIdentity ? ":disabled=\"true\"" : "";
|
||||
string placeHolder = dbFieldInfo.IsIdentity ? "" : $"请输入{CodeGeneratorTool.GetLabelName(dbFieldInfo.ColumnDescription, columnName)}";
|
||||
|
||||
if (dbFieldInfo.DataType == "datetime")
|
||||
{
|
||||
//时间
|
||||
vueViewFromContent += $" <el-form-item label=\"{labelName}\" :label-width=\"labelWidth\" prop=\"{columnName}\">\n";
|
||||
vueViewFromContent += $" <el-date-picker v-model=\"form.{columnName}\" type=\"datetime\" placeholder=\"选择日期时间\" default-time=\"12:00:00\"> </el-date-picker>\n";
|
||||
vueViewFromContent += " </el-form-item>\n";
|
||||
}
|
||||
else if (CodeGeneratorTool.imageFiled.Any(f => columnName.Contains(f)))
|
||||
{
|
||||
//图片
|
||||
vueViewFromContent += $" <el-form-item label=\"{labelName}\" :label-width=\"labelWidth\" prop=\"{columnName}\">\n";
|
||||
vueViewFromContent += $" <el-upload class=\"avatar-uploader\" name=\"file\" action=\"/api/upload/saveFile/\" :show-file-list=\"false\" :on-success=\"handleUpload{columnName}Success\" :before-upload=\"beforeFileUpload\">\n";
|
||||
vueViewFromContent += $" <img v-if=\"form.{columnName}\" :src=\"form.{columnName}\" class=\"icon\">\n";
|
||||
vueViewFromContent += " <i v-else class=\"el-icon-plus uploader-icon\"></i>\n";
|
||||
vueViewFromContent += " </el-upload>\n";
|
||||
vueViewFromContent += $" <el-input v-model=\"form.{columnName}\" placeholder=\"请上传文件或手动输入文件地址\"></el-input>\n";
|
||||
vueViewFromContent += " </el-form-item>\n";
|
||||
}
|
||||
else if (CodeGeneratorTool.radioFiled.Any(f => columnName.Contains(f)) && (dbFieldInfo.DataType == "bool" || dbFieldInfo.DataType == "tinyint" || dbFieldInfo.DataType == "int"))
|
||||
{
|
||||
vueViewFromContent += $" <el-form-item label=\"{labelName}\" :label-width=\"labelWidth\" prop=\"{columnName}\">";
|
||||
vueViewFromContent += $" <el-radio-group v-model=\"form.{columnName}\">\n";
|
||||
vueViewFromContent += " <el-radio v-for=\"dict in statusOptions\" :key=\"dict.dictValue\" :label=\"dict.dictValue\">{{dict.dictLabel}}</el-radio>\n";
|
||||
vueViewFromContent += " </el-radio-group>\n";
|
||||
vueViewFromContent += " </el-form-item>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
vueViewFromContent += $" <el-form-item label=\"{ CodeGeneratorTool.GetLabelName(dbFieldInfo.ColumnDescription, columnName)}\" :label-width=\"labelWidth\" prop=\"{CodeGeneratorTool.FirstLowerCase(columnName)}\">\n";
|
||||
vueViewFromContent += $" <el-input v-model=\"form.{CodeGeneratorTool.FirstLowerCase(columnName)}\" placeholder=\"{placeHolder}\" {labelDisabled}/>\n";
|
||||
vueViewFromContent += " </el-form-item>\n";
|
||||
}
|
||||
|
||||
return vueViewFromContent;
|
||||
}
|
||||
|
||||
//table-column
|
||||
public static string GetTableColumn(DbColumnInfo dbFieldInfo)
|
||||
{
|
||||
string columnName = CodeGeneratorTool.FirstLowerCase(dbFieldInfo.DbColumnName);
|
||||
string label = CodeGeneratorTool.GetLabelName(dbFieldInfo.ColumnDescription, columnName);
|
||||
string vueViewListContent = "";
|
||||
string showToolTip = dbFieldInfo.DataType.Contains("varchar") ? ":show-overflow-tooltip=\"true\"" : "";
|
||||
|
||||
if (CodeGeneratorTool.imageFiled.Any(f => columnName.ToLower().Contains(f)))
|
||||
{
|
||||
vueViewListContent += $" <el-table-column prop=\"{ columnName}\" label=\"图片\">\n";
|
||||
vueViewListContent += " <template slot-scope=\"scope\">\n";
|
||||
vueViewListContent += $" <el-image class=\"table-td-thumb\" :src=\"scope.row.{columnName}\" :preview-src-list=\"[scope.row.{columnName}]\"></el-image>\n";
|
||||
vueViewListContent += " </template>\n";
|
||||
vueViewListContent += " </el-table-column>\n";
|
||||
}
|
||||
else if (dbFieldInfo.DataType == "bool" || dbFieldInfo.DataType == "tinyint")
|
||||
{
|
||||
vueViewListContent += $" <el-table-column prop=\"{columnName}\" label=\"{label}\" width=\"120\" >\n";
|
||||
vueViewListContent += " <template slot-scope=\"scope\">\n";
|
||||
vueViewListContent += $" <el-tag :type=\"scope.row.{columnName} === true ? 'success' : 'info'\" disable-transitions >";
|
||||
vueViewListContent += $" {{scope.row.{columnName}===true?'启用':'禁用'}} </el-tag>\n";
|
||||
vueViewListContent += " </template>\n";
|
||||
vueViewListContent += " </el-table-column>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
//table-column
|
||||
vueViewListContent += $" <el-table-column prop=\"{CodeGeneratorTool.FirstLowerCase(columnName)}\" label=\"{CodeGeneratorTool.GetLabelName(dbFieldInfo.ColumnDescription, columnName)}\" align=\"center\" width=\"100\" {showToolTip} />\n";
|
||||
}
|
||||
return vueViewListContent;
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
518
ZR.CodeGenerator/CodeGeneratorTool.cs
Normal file
518
ZR.CodeGenerator/CodeGeneratorTool.cs
Normal file
@ -0,0 +1,518 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using ZR.CodeGenerator.Model;
|
||||
using ZR.CodeGenerator.Service;
|
||||
|
||||
namespace ZR.CodeGenerator
|
||||
{
|
||||
/// <summary>
|
||||
/// 代码生成器。
|
||||
/// <remarks>
|
||||
/// 根据指定的实体域名空间生成Repositories和Services层的基础代码文件。
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
public class CodeGeneratorTool
|
||||
{
|
||||
/// <summary>
|
||||
/// 代码生成器配置
|
||||
/// </summary>
|
||||
private static CodeGenerateOption _option = new CodeGenerateOption();
|
||||
/// <summary>
|
||||
/// InputDto输入实体是不包含字段
|
||||
/// </summary>
|
||||
public static readonly string[] inputDtoNoField = new string[] { "DeleteMark", "CreateTime", "updateTime", "addtime" };
|
||||
public static readonly string[] imageFiled = new string[] { "icon", "img", "image", "url", "pic", "photo" };
|
||||
public static readonly string[] selectFiled = new string[] { "status", "type", "state", "sex", "gender" };
|
||||
public static readonly string[] radioFiled = new string[] { "status", "state", "isShow", "isHidden", "ishide" };
|
||||
|
||||
/// <summary>
|
||||
/// 代码生成器入口方法
|
||||
/// </summary>
|
||||
/// <param name="dbTableInfo"></param>
|
||||
/// <param name="dto"></param>
|
||||
public static void Generate(DbTableInfo dbTableInfo, GenerateDto dto)
|
||||
{
|
||||
//_option.BaseNamespace = baseNamespace;
|
||||
//_option.TableList = listTable;
|
||||
_option.ReplaceTableNameStr = dto.replaceTableNameStr;
|
||||
_option.DtosNamespace = "ZR.Model";
|
||||
_option.ModelsNamespace = "ZR.Model";
|
||||
_option.RepositoriesNamespace = "ZR.Repository";
|
||||
_option.IRepositoriesNamespace = "ZR.Repository";
|
||||
_option.IServicsNamespace = "ZR.Service";
|
||||
_option.ServicesNamespace = "ZR.Service";
|
||||
_option.ApiControllerNamespace = "ZR.Admin.WebApi";
|
||||
|
||||
CodeGeneraterService codeGeneraterService = new CodeGeneraterService();
|
||||
|
||||
List<DbColumnInfo> listField = codeGeneraterService.GetColumnInfo(dto.dbName, dbTableInfo.Name);
|
||||
GenerateSingle(listField, dbTableInfo, dto);
|
||||
|
||||
//GenerateDtoProfile(_option.ModelsNamespace, profileContent, ifExsitedCovered);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 单表生成代码
|
||||
/// </summary>
|
||||
/// <param name="listField">表字段集合</param>
|
||||
/// <param name="tableInfo">表信息</param>
|
||||
/// <param name="ifExsitedCovered">如果目标文件存在,是否覆盖。默认为false</param>
|
||||
public static void GenerateSingle(List<DbColumnInfo> listField, DbTableInfo tableInfo, GenerateDto dto)
|
||||
{
|
||||
bool ifExsitedCovered = dto.coverd;
|
||||
var modelTypeName = GetModelClassName(tableInfo.Name);//表名对应C# 实体类名
|
||||
var modelTypeDesc = tableInfo.Description;//表描述
|
||||
var primaryKey = "id";//主键
|
||||
|
||||
string keyTypeName = "int";//主键数据类型
|
||||
string modelContent = "";//数据库模型字段
|
||||
string InputDtoContent = "";//输入模型
|
||||
//string outputDtoContent = "";//输出模型
|
||||
string updateColumn = "";//修改数据映射字段
|
||||
string vueViewListContent = string.Empty;//Vue列表输出内容
|
||||
string vueViewFormContent = string.Empty;//Vue表单输出内容
|
||||
string vueViewEditFromContent = string.Empty;//Vue变量输出内容
|
||||
string vueViewEditFromBindContent = string.Empty;//Vue显示初始化输出内容
|
||||
string vueViewSaveBindContent = string.Empty;//Vue保存时输出内容
|
||||
string vueViewEditFromRuleContent = string.Empty;//Vue数据校验
|
||||
string vueJsMethod = string.Empty;//Vue js自定义方法
|
||||
|
||||
foreach (DbColumnInfo dbFieldInfo in listField)
|
||||
{
|
||||
string columnName = FirstLowerCase(dbFieldInfo.DbColumnName);
|
||||
|
||||
if (dbFieldInfo.DataType == "bool" || dbFieldInfo.DataType == "tinyint")
|
||||
{
|
||||
vueViewEditFromContent += $" {columnName}: 'true',\n";
|
||||
//vueViewEditFromBindContent += $" this.form.{columnName} = res.data.{0}+''\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
vueViewEditFromContent += $" {columnName}: undefined,\n";
|
||||
//vueViewEditFromBindContent += $" {columnName}: row.{columnName},\n";
|
||||
}
|
||||
//vueViewSaveBindContent += string.Format(" '{0}':this.editFrom.{0},\n", columnName);
|
||||
//主键
|
||||
if (dbFieldInfo.IsIdentity || dbFieldInfo.IsPrimarykey)
|
||||
{
|
||||
primaryKey = columnName.Substring(0, 1).ToUpper() + columnName[1..];
|
||||
keyTypeName = dbFieldInfo.DataType;
|
||||
}
|
||||
else
|
||||
{
|
||||
var tempColumnName = columnName.Substring(0, 1).ToUpper() + columnName[1..];
|
||||
updateColumn += $" {tempColumnName} = parm.{tempColumnName},\n";
|
||||
}
|
||||
|
||||
dbFieldInfo.DbColumnName = columnName;
|
||||
modelContent += CodeGenerateTemplate.GetModelTemplate(dbFieldInfo);
|
||||
vueViewFormContent += CodeGenerateTemplate.GetVueViewFormContent(dbFieldInfo);
|
||||
vueJsMethod += CodeGenerateTemplate.GetVueJsMethod(dbFieldInfo);
|
||||
vueViewListContent += CodeGenerateTemplate.GetTableColumn(dbFieldInfo);
|
||||
vueViewEditFromRuleContent += CodeGenerateTemplate.GetFormRules(dbFieldInfo);
|
||||
InputDtoContent += CodeGenerateTemplate.GetDtoContent(dbFieldInfo);
|
||||
}
|
||||
if (dto.genFiles.Contains(1))
|
||||
{
|
||||
GenerateModels(_option.ModelsNamespace, modelTypeName, tableInfo.Name, modelContent, modelTypeDesc, keyTypeName, ifExsitedCovered);
|
||||
}
|
||||
if (dto.genFiles.Contains(2))
|
||||
{
|
||||
GenerateInputDto(_option.ModelsNamespace, modelTypeName, modelTypeDesc, InputDtoContent, keyTypeName, ifExsitedCovered);
|
||||
}
|
||||
if (dto.genFiles.Contains(3))
|
||||
{
|
||||
GenerateRepository(modelTypeName, modelTypeDesc, tableInfo.Name, keyTypeName, ifExsitedCovered);
|
||||
}
|
||||
if (dto.genFiles.Contains(4))
|
||||
{
|
||||
GenerateIService(_option.ModelsNamespace, modelTypeName, modelTypeDesc, keyTypeName, ifExsitedCovered);
|
||||
GenerateService(_option.ModelsNamespace, modelTypeName, modelTypeDesc, keyTypeName, ifExsitedCovered);
|
||||
}
|
||||
if (dto.genFiles.Contains(5))
|
||||
{
|
||||
GenerateControllers(modelTypeName, primaryKey, modelTypeDesc, keyTypeName, updateColumn, ifExsitedCovered);
|
||||
}
|
||||
if (dto.genFiles.Contains(6))
|
||||
{
|
||||
GenerateVueViews(modelTypeName, primaryKey, modelTypeDesc, vueViewListContent, vueViewFormContent, vueViewEditFromContent, vueViewEditFromBindContent, vueViewSaveBindContent, vueViewEditFromRuleContent, vueJsMethod, ifExsitedCovered);
|
||||
}
|
||||
//GenerateIRepository(modelTypeName, modelTypeDesc, keyTypeName, ifExsitedCovered);
|
||||
//GenerateOutputDto(modelTypeName, modelTypeDesc, outputDtocontent, ifExsitedCovered);
|
||||
}
|
||||
|
||||
|
||||
#region 生成Model
|
||||
|
||||
/// <summary>
|
||||
/// 生成Models文件
|
||||
/// </summary>
|
||||
/// <param name="modelsNamespace">命名空间</param>
|
||||
/// <param name="modelTypeName">类名</param>
|
||||
/// <param name="tableName">表名称</param>
|
||||
/// <param name="modelTypeDesc">表描述</param>
|
||||
/// <param name="modelContent">数据库表实体内容</param>
|
||||
/// <param name="keyTypeName">主键数据类型</param>
|
||||
/// <param name="ifExsitedCovered">如果目标文件存在,是否覆盖。默认为false</param>
|
||||
private static Tuple<string, string> GenerateModels(string modelsNamespace, string modelTypeName, string tableName, string modelContent, string modelTypeDesc, string keyTypeName, bool ifExsitedCovered = false)
|
||||
{
|
||||
var parentPath = "..";
|
||||
//../ZR.Model
|
||||
var servicesPath = parentPath + "\\" + modelsNamespace + "\\Models\\";
|
||||
if (!Directory.Exists(servicesPath))
|
||||
{
|
||||
Directory.CreateDirectory(servicesPath);
|
||||
}
|
||||
// ../ZR.Model/Models/User.cs
|
||||
var fullPath = servicesPath + modelTypeName + ".cs";
|
||||
Console.WriteLine(fullPath);
|
||||
if (File.Exists(fullPath) && !ifExsitedCovered)
|
||||
return Tuple.Create(fullPath, "");
|
||||
var content = ReadTemplate("ModelTemplate.txt");
|
||||
content = content
|
||||
.Replace("{ModelsNamespace}", modelsNamespace)
|
||||
.Replace("{ModelTypeName}", modelTypeName)
|
||||
.Replace("{TableNameDesc}", modelTypeDesc)
|
||||
.Replace("{KeyTypeName}", keyTypeName)
|
||||
.Replace("{PropertyName}", modelContent)
|
||||
.Replace("{TableName}", tableName);
|
||||
WriteAndSave(fullPath, content);
|
||||
return Tuple.Create(fullPath, content);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 生成InputDto文件
|
||||
/// </summary>
|
||||
/// <param name="modelsNamespace"></param>
|
||||
/// <param name="modelTypeName"></param>
|
||||
/// <param name="modelTypeDesc"></param>
|
||||
/// <param name="modelContent"></param>
|
||||
/// <param name="keyTypeName"></param>
|
||||
/// <param name="ifExsitedCovered">如果目标文件存在,是否覆盖。默认为false</param>
|
||||
private static Tuple<string, string> GenerateInputDto(string modelsNamespace, string modelTypeName, string modelTypeDesc, string modelContent, string keyTypeName, bool ifExsitedCovered = false)
|
||||
{
|
||||
var parentPath = "..";
|
||||
var servicesPath = parentPath + "\\" + modelsNamespace + "\\Dto\\";
|
||||
if (!Directory.Exists(servicesPath))
|
||||
{
|
||||
Directory.CreateDirectory(servicesPath);
|
||||
}
|
||||
// ../ZR.Model/Dto/User.cs
|
||||
var fullPath = servicesPath + modelTypeName + "Dto.cs";
|
||||
Console.WriteLine(fullPath);
|
||||
if (File.Exists(fullPath) && !ifExsitedCovered)
|
||||
return Tuple.Create(fullPath, ""); ;
|
||||
var content = ReadTemplate("InputDtoTemplate.txt");
|
||||
content = content
|
||||
.Replace("{DtosNamespace}", _option.DtosNamespace)
|
||||
.Replace("{ModelsNamespace}", modelsNamespace)
|
||||
.Replace("{TableNameDesc}", modelTypeDesc)
|
||||
.Replace("{KeyTypeName}", keyTypeName)
|
||||
.Replace("{PropertyName}", modelContent)
|
||||
.Replace("{ModelTypeName}", modelTypeName);
|
||||
WriteAndSave(fullPath, content);
|
||||
return Tuple.Create(fullPath, content);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 生成Repository
|
||||
|
||||
/// <summary>
|
||||
/// 生成Repository层代码文件
|
||||
/// </summary>
|
||||
/// <param name="modelTypeName"></param>
|
||||
/// <param name="modelTypeDesc"></param>
|
||||
/// <param name="tableName">表名</param>
|
||||
/// <param name="keyTypeName"></param>
|
||||
/// <param name="ifExsitedCovered">如果目标文件存在,是否覆盖。默认为false</param>
|
||||
private static Tuple<string, string> GenerateRepository(string modelTypeName, string modelTypeDesc, string tableName, string keyTypeName, bool ifExsitedCovered = false)
|
||||
{
|
||||
var parentPath = "..";
|
||||
var repositoryPath = parentPath + "\\" + _option.RepositoriesNamespace + "\\Repositories\\";
|
||||
if (!Directory.Exists(repositoryPath))
|
||||
{
|
||||
Directory.CreateDirectory(repositoryPath);
|
||||
}
|
||||
var fullPath = repositoryPath + "\\" + modelTypeName + "Repository.cs";
|
||||
Console.WriteLine(fullPath);
|
||||
if (File.Exists(fullPath) && !ifExsitedCovered)
|
||||
return Tuple.Create(fullPath, "");
|
||||
var content = ReadTemplate("RepositoryTemplate.txt");
|
||||
content = content.Replace("{ModelsNamespace}", _option.ModelsNamespace)
|
||||
//.Replace("{IRepositoriesNamespace}", _option.IRepositoriesNamespace)
|
||||
.Replace("{RepositoriesNamespace}", _option.RepositoriesNamespace)
|
||||
.Replace("{ModelTypeName}", modelTypeName)
|
||||
.Replace("{TableNameDesc}", modelTypeDesc)
|
||||
.Replace("{TableName}", tableName)
|
||||
.Replace("{KeyTypeName}", keyTypeName);
|
||||
WriteAndSave(fullPath, content);
|
||||
return Tuple.Create(fullPath, content);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 生成Service
|
||||
/// <summary>
|
||||
/// 生成IService文件
|
||||
/// </summary>
|
||||
/// <param name="modelsNamespace"></param>
|
||||
/// <param name="modelTypeName"></param>
|
||||
/// <param name="modelTypeDesc"></param>
|
||||
/// <param name="keyTypeName"></param>
|
||||
/// <param name="ifExsitedCovered">如果目标文件存在,是否覆盖。默认为false</param>
|
||||
private static Tuple<string, string> GenerateIService(string modelsNamespace, string modelTypeName, string modelTypeDesc, string keyTypeName, bool ifExsitedCovered = false)
|
||||
{
|
||||
var parentPath = "..";
|
||||
var iServicesPath = parentPath + "\\" + _option.IServicsNamespace + "\\Business\\IBusService\\";
|
||||
if (!Directory.Exists(iServicesPath))
|
||||
{
|
||||
Directory.CreateDirectory(iServicesPath);
|
||||
}
|
||||
var fullPath = $"{iServicesPath}\\I{modelTypeName}Service.cs";
|
||||
Console.WriteLine(fullPath);
|
||||
if (File.Exists(fullPath) && !ifExsitedCovered)
|
||||
return Tuple.Create(fullPath, "");
|
||||
var content = ReadTemplate("IServiceTemplate.txt");
|
||||
content = content.Replace("{ModelsNamespace}", modelsNamespace)
|
||||
.Replace("{TableNameDesc}", modelTypeDesc)
|
||||
.Replace("{DtosNamespace}", _option.DtosNamespace)
|
||||
.Replace("{IServicsNamespace}", _option.IServicsNamespace)
|
||||
.Replace("{RepositoriesNamespace}", _option.RepositoriesNamespace)
|
||||
.Replace("{ModelTypeName}", modelTypeName)
|
||||
.Replace("{KeyTypeName}", keyTypeName);
|
||||
WriteAndSave(fullPath, content);
|
||||
return Tuple.Create(fullPath, content);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 生成Service文件
|
||||
/// </summary>
|
||||
/// <param name="modelsNamespace"></param>
|
||||
/// <param name="modelTypeName"></param>
|
||||
/// <param name="modelTypeDesc"></param>
|
||||
/// <param name="keyTypeName"></param>
|
||||
/// <param name="ifExsitedCovered">如果目标文件存在,是否覆盖。默认为false</param>
|
||||
private static Tuple<string, string> GenerateService(string modelsNamespace, string modelTypeName, string modelTypeDesc, string keyTypeName, bool ifExsitedCovered = false)
|
||||
{
|
||||
var parentPath = "..";
|
||||
var servicesPath = parentPath + "\\" + _option.ServicesNamespace + "\\Business\\";
|
||||
if (!Directory.Exists(servicesPath))
|
||||
{
|
||||
Directory.CreateDirectory(servicesPath);
|
||||
}
|
||||
var fullPath = servicesPath + modelTypeName + "Service.cs";
|
||||
Console.WriteLine(fullPath);
|
||||
if (File.Exists(fullPath) && !ifExsitedCovered)
|
||||
return Tuple.Create(fullPath, "");
|
||||
var content = ReadTemplate("ServiceTemplate.txt");
|
||||
content = content
|
||||
.Replace("{IRepositoriesNamespace}", _option.IRepositoriesNamespace)
|
||||
.Replace("{DtosNamespace}", _option.DtosNamespace)
|
||||
.Replace("{IServicsNamespace}", _option.IServicsNamespace)
|
||||
.Replace("{TableNameDesc}", modelTypeDesc)
|
||||
.Replace("{ModelsNamespace}", modelsNamespace)
|
||||
.Replace("{ServicesNamespace}", _option.ServicesNamespace)
|
||||
.Replace("{ModelTypeName}", modelTypeName)
|
||||
.Replace("{KeyTypeName}", keyTypeName);
|
||||
WriteAndSave(fullPath, content);
|
||||
return Tuple.Create(fullPath, content);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 生成Controller
|
||||
/// <summary>
|
||||
/// 生成控制器ApiControllers文件
|
||||
/// </summary>
|
||||
/// <param name="modelTypeName">实体类型名称</param>
|
||||
/// <param name="primaryKey">主键</param>
|
||||
/// <param name="modelTypeDesc">实体描述</param>
|
||||
/// <param name="keyTypeName"></param>
|
||||
/// <param name="ifExsitedCovered">如果目标文件存在,是否覆盖。默认为false</param>
|
||||
private static Tuple<string, string> GenerateControllers(string modelTypeName, string primaryKey, string modelTypeDesc, string keyTypeName, string updateColumn, bool ifExsitedCovered = false)
|
||||
{
|
||||
var parentPath = "..";
|
||||
var servicesPath = parentPath + "\\" + _option.ApiControllerNamespace + "\\Controllers\\business\\";
|
||||
if (!Directory.Exists(servicesPath))
|
||||
{
|
||||
Directory.CreateDirectory(servicesPath);
|
||||
}
|
||||
var fullPath = servicesPath + modelTypeName + "Controller.cs";
|
||||
Console.WriteLine(fullPath);
|
||||
if (File.Exists(fullPath) && !ifExsitedCovered)
|
||||
return Tuple.Create(fullPath, "");
|
||||
var content = ReadTemplate("ControllersTemplate.txt");
|
||||
content = content
|
||||
//.Replace("{DtosNamespace}", _option.DtosNamespace)
|
||||
.Replace("{ControllerName}", modelTypeName)
|
||||
.Replace("{ModelsNamespace}", _option.ModelsNamespace)
|
||||
.Replace("{FileName}", modelTypeDesc)
|
||||
.Replace("{ServiceName}", modelTypeName + "Service")
|
||||
.Replace("{ModelName}", modelTypeName)
|
||||
.Replace("{Permission}", modelTypeName.ToLower())
|
||||
.Replace("{primaryKey}", primaryKey)
|
||||
.Replace("{updateColumn}", updateColumn)
|
||||
.Replace("{KeyTypeName}", keyTypeName);
|
||||
WriteAndSave(fullPath, content);
|
||||
return Tuple.Create(fullPath, content);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 生成Vue页面
|
||||
/// <summary>
|
||||
/// 生成Vue页面
|
||||
/// </summary>
|
||||
/// <param name="modelTypeName">类名</param>
|
||||
/// <param name="modelTypeDesc">表/类描述</param>
|
||||
/// <param name="vueViewListContent"></param>
|
||||
/// <param name="vueViewFromContent"></param>
|
||||
/// <param name="vueViewEditFromContent"></param>
|
||||
/// <param name="vueViewEditFromBindContent"></param>
|
||||
/// <param name="vueViewSaveBindContent"></param>
|
||||
/// <param name="vueViewEditFromRuleContent"></param>
|
||||
/// <param name="ifExsitedCovered">如果目标文件存在,是否覆盖。默认为false</param>
|
||||
private static Tuple<string, string> GenerateVueViews(string modelTypeName, string primaryKey, string modelTypeDesc, string vueViewListContent, string vueViewFromContent, string vueViewEditFromContent, string vueViewEditFromBindContent, string vueViewSaveBindContent, string vueViewEditFromRuleContent, string vueJsMethod, bool ifExsitedCovered = false)
|
||||
{
|
||||
//var parentPath = "..\\CodeGenerate";//若要生成到项目中将路径改成 “..\\ZR.Vue\\src”
|
||||
var parentPath = "..\\ZR.Vue\\src";
|
||||
var servicesPath = parentPath + "\\views\\" + FirstLowerCase(modelTypeName);
|
||||
if (!Directory.Exists(servicesPath))
|
||||
{
|
||||
Directory.CreateDirectory(servicesPath);
|
||||
}
|
||||
var fullPath = servicesPath + "\\" + "index.vue";
|
||||
Console.WriteLine(fullPath);
|
||||
if (File.Exists(fullPath) && !ifExsitedCovered)
|
||||
return Tuple.Create(fullPath, ""); ;
|
||||
var content = ReadTemplate("VueTemplate.txt");
|
||||
content = content
|
||||
.Replace("{fileClassName}", FirstLowerCase(modelTypeName))
|
||||
.Replace("{VueViewListContent}", vueViewListContent)//查询 table列
|
||||
.Replace("{VueViewFormContent}", vueViewFromContent)//添加、修改表单
|
||||
.Replace("{ModelTypeName}", modelTypeName)
|
||||
.Replace("{Permission}", modelTypeName.ToLower())
|
||||
.Replace("{VueViewEditFormContent}", vueViewEditFromContent)
|
||||
.Replace("{vueJsMethod}", vueJsMethod)
|
||||
//.Replace("{VueViewEditFromBindContent}", vueViewEditFromBindContent)
|
||||
//.Replace("{VueViewSaveBindContent}", vueViewSaveBindContent)
|
||||
.Replace("{primaryKey}", FirstLowerCase(primaryKey))
|
||||
.Replace("{VueViewEditFormRuleContent}", vueViewEditFromRuleContent);//添加、修改表单验证规则
|
||||
WriteAndSave(fullPath, content);
|
||||
|
||||
//api js
|
||||
servicesPath = parentPath + "\\api\\";
|
||||
Directory.CreateDirectory(servicesPath);
|
||||
fullPath = servicesPath + "\\" + FirstLowerCase(modelTypeName) + ".js";
|
||||
Console.WriteLine(fullPath);
|
||||
if (File.Exists(fullPath) && !ifExsitedCovered)
|
||||
return Tuple.Create(fullPath, "");
|
||||
content = ReadTemplate("VueJsTemplate.txt");
|
||||
content = content
|
||||
.Replace("{ModelTypeName}", modelTypeName)
|
||||
.Replace("{ModelTypeDesc}", modelTypeDesc);
|
||||
//.Replace("{fileClassName}", fileClassName)
|
||||
WriteAndSave(fullPath, content);
|
||||
return Tuple.Create(fullPath, content);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 帮助方法
|
||||
|
||||
/// <summary>
|
||||
/// 如果有前缀替换将前缀替换成空,替换下划线"_"为空再将首字母大写
|
||||
/// </summary>
|
||||
/// <param name="modelTypeName"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetModelClassName(string modelTypeName)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(_option.ReplaceTableNameStr))
|
||||
{
|
||||
modelTypeName = modelTypeName.Replace(_option.ReplaceTableNameStr.ToString(), "");
|
||||
}
|
||||
modelTypeName = modelTypeName.Replace("_", "");
|
||||
modelTypeName = modelTypeName.Substring(0, 1).ToUpper() + modelTypeName[1..];
|
||||
return modelTypeName;
|
||||
}
|
||||
/// <summary>
|
||||
/// 首字母转小写,输出前端
|
||||
/// </summary>
|
||||
/// <param name="str"></param>
|
||||
/// <returns></returns>
|
||||
public static string FirstLowerCase(string str)
|
||||
{
|
||||
return string.IsNullOrEmpty(str) ? str : str.Substring(0, 1).ToLower() + str[1..];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取前端标签名
|
||||
/// </summary>
|
||||
/// <param name="columnDescription"></param>
|
||||
/// <param name="columnName"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetLabelName(string columnDescription, string columnName)
|
||||
{
|
||||
return string.IsNullOrEmpty(columnDescription) ? columnName : columnDescription;
|
||||
}
|
||||
/// <summary>
|
||||
/// 从代码模板中读取内容
|
||||
/// </summary>
|
||||
/// <param name="templateName">模板名称,应包括文件扩展名称。比如:template.txt</param>
|
||||
/// <returns></returns>
|
||||
private static string ReadTemplate(string templateName)
|
||||
{
|
||||
var path = AppDomain.CurrentDomain.BaseDirectory;
|
||||
string fullName = $"{path}\\Template\\{templateName}";
|
||||
string temp = fullName;
|
||||
string str = "";
|
||||
if (!File.Exists(temp))
|
||||
{
|
||||
return str;
|
||||
}
|
||||
StreamReader sr = null;
|
||||
try
|
||||
{
|
||||
sr = new StreamReader(temp);
|
||||
str = sr.ReadToEnd(); // 读取文件
|
||||
}
|
||||
catch { }
|
||||
sr?.Close();
|
||||
sr?.Dispose();
|
||||
return str;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 写文件
|
||||
/// </summary>
|
||||
/// <param name="fileName"></param>
|
||||
/// <param name="content"></param>
|
||||
private static void WriteAndSave(string fileName, string content)
|
||||
{
|
||||
try
|
||||
{
|
||||
//实例化一个文件流--->与写入文件相关联
|
||||
using var fs = new FileStream(fileName, FileMode.Create, FileAccess.Write);
|
||||
//实例化一个StreamWriter-->与fs相关联
|
||||
using var sw = new StreamWriter(fs);
|
||||
//开始写入
|
||||
sw.Write(content);
|
||||
//清空缓冲区
|
||||
sw.Flush();
|
||||
//关闭流
|
||||
sw.Close();
|
||||
fs.Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("写入文件出错了:" + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
43
ZR.CodeGenerator/DbProvider.cs
Normal file
43
ZR.CodeGenerator/DbProvider.cs
Normal file
@ -0,0 +1,43 @@
|
||||
using Infrastructure;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ZR.CodeGenerator
|
||||
{
|
||||
public class DbProvider
|
||||
{
|
||||
protected static SqlSugarScope CodeDb;
|
||||
|
||||
/// <summary>
|
||||
/// 获取动态连接字符串
|
||||
/// </summary>
|
||||
/// <param name="dbName">数据库名</param>
|
||||
/// <returns></returns>
|
||||
public SqlSugarScope GetSugarDbContext(string dbName = "")
|
||||
{
|
||||
string connStr = ConfigUtils.Instance.GetConnectionStrings(OptionsSetting.Conn).Replace("{database}", dbName);
|
||||
int dbType = ConfigUtils.Instance.GetAppConfig(OptionsSetting.CodeGenDbType, 0);
|
||||
if (string.IsNullOrEmpty(dbName))
|
||||
{
|
||||
connStr = ConfigUtils.Instance.GetConnectionStrings(OptionsSetting.ConnAdmin);
|
||||
dbType = ConfigUtils.Instance.GetAppConfig(OptionsSetting.DbType, 0);
|
||||
}
|
||||
var db = new SqlSugarScope(new List<ConnectionConfig>()
|
||||
{
|
||||
new ConnectionConfig(){
|
||||
ConnectionString = connStr,
|
||||
DbType = (DbType)dbType,
|
||||
IsAutoCloseConnection = true,//开启自动释放模式和EF原理一样
|
||||
InitKeyType = InitKeyType.Attribute,//从特性读取主键和自增列信息
|
||||
},
|
||||
});
|
||||
|
||||
CodeDb = db;
|
||||
return db;
|
||||
}
|
||||
}
|
||||
}
|
||||
34
ZR.CodeGenerator/Model/GenerateDto.cs
Normal file
34
ZR.CodeGenerator/Model/GenerateDto.cs
Normal file
@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ZR.CodeGenerator.Model
|
||||
{
|
||||
public class GenerateDto
|
||||
{
|
||||
public string[] queryColumn { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string dbName { get; set; }
|
||||
/// <summary>
|
||||
/// 项目命名空间
|
||||
/// </summary>
|
||||
public string baseSpace { get; set; }
|
||||
/// <summary>
|
||||
/// 要生成代码的表
|
||||
/// </summary>
|
||||
public string tableName { get; set; }
|
||||
/// <summary>
|
||||
/// 要删除表名的字符串用
|
||||
/// </summary>
|
||||
public string replaceTableNameStr { get; set; }
|
||||
/// <summary>
|
||||
/// 要生成的文件
|
||||
/// </summary>
|
||||
public int[] genFiles { get; set; }
|
||||
public bool coverd { get; set; } = true;
|
||||
}
|
||||
}
|
||||
52
ZR.CodeGenerator/Service/CodeGeneraterService.cs
Normal file
52
ZR.CodeGenerator/Service/CodeGeneraterService.cs
Normal file
@ -0,0 +1,52 @@
|
||||
using SqlSugar;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using ZR.Model;
|
||||
|
||||
namespace ZR.CodeGenerator.Service
|
||||
{
|
||||
public class CodeGeneraterService : DbProvider
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取所有数据库名
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<string> GetAllDataBases()
|
||||
{
|
||||
var db = GetSugarDbContext();
|
||||
var templist = db.DbMaintenance.GetDataBaseList(db.ScopedContext);
|
||||
|
||||
return templist;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取所有表
|
||||
/// </summary>
|
||||
/// <param name="dbName"></param>
|
||||
/// <param name="tableName"></param>
|
||||
/// <param name="pager"></param>
|
||||
/// <returns></returns>
|
||||
public List<DbTableInfo> GetAllTables(string dbName, string tableName, PagerInfo pager)
|
||||
{
|
||||
var tableList = GetSugarDbContext(dbName).DbMaintenance.GetTableInfoList(true);
|
||||
if (!string.IsNullOrEmpty(tableName))
|
||||
{
|
||||
tableList = tableList.Where(f => f.Name.ToLower().Contains(tableName.ToLower())).ToList();
|
||||
}
|
||||
pager.TotalNum = tableList.Count;
|
||||
return tableList.Skip(pager.PageSize * (pager.PageNum - 1)).Take(pager.PageSize).OrderBy(f => f.Name).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取列信息
|
||||
/// </summary>
|
||||
/// <param name="dbName"></param>
|
||||
/// <param name="tableName"></param>
|
||||
/// <returns></returns>
|
||||
public List<DbColumnInfo> GetColumnInfo(string dbName, string tableName)
|
||||
{
|
||||
return GetSugarDbContext(dbName).DbMaintenance.GetColumnInfosByTableName(tableName, true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -34,6 +34,8 @@ namespace ZR.CodeGenerator.CodeGenerator
|
||||
public static string GetClassNamePrefix(string tableName)
|
||||
{
|
||||
string[] arr = tableName.Split('_');
|
||||
if (arr.Length <= 0) return tableName;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 1; i < arr.Length; i++)
|
||||
{
|
||||
|
||||
@ -11,8 +11,13 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Model\" />
|
||||
<Folder Include="Template\" />
|
||||
<PackageReference Include="SqlSugarCoreNoDrive" Version="5.0.3.4" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="Template\ModelTemplate.txt">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
1
ZR.Model/Models/README.txt
Normal file
1
ZR.Model/Models/README.txt
Normal file
@ -0,0 +1 @@
|
||||
此文件夹用于存放业务代码数据库实体类
|
||||
@ -13,7 +13,7 @@ namespace ZR.Model.System
|
||||
/// 菜单ID
|
||||
/// </summary>
|
||||
//[Key]//非自动增长主键时使用ExplicitKey
|
||||
[SqlSugar.SugarColumn(IsPrimaryKey = true)]
|
||||
[SqlSugar.SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||||
public long menuId { get; set; }
|
||||
/// <summary>
|
||||
/// 菜单名称
|
||||
|
||||
@ -27,6 +27,7 @@ namespace ZR.Repository.DbProvider
|
||||
{
|
||||
connStr = NETCore.Encrypt.EncryptProvider.DESDecrypt(connStr, dbKey);
|
||||
}
|
||||
|
||||
Db = new SqlSugarClient(new List<ConnectionConfig>()
|
||||
{
|
||||
new ConnectionConfig(){
|
||||
@ -41,6 +42,7 @@ namespace ZR.Repository.DbProvider
|
||||
//调式代码 用来打印SQL
|
||||
Db.Aop.OnLogExecuting = (sql, pars) =>
|
||||
{
|
||||
Console.BackgroundColor = ConsoleColor.Yellow;
|
||||
Console.WriteLine("【SQL语句】" + sql.ToLower() + "\r\n" + Db.Utilities.SerializeObject(pars.ToDictionary(it => it.ParameterName, it => it.Value)));
|
||||
};
|
||||
//出错打印日志
|
||||
@ -50,5 +52,21 @@ namespace ZR.Repository.DbProvider
|
||||
Console.WriteLine();
|
||||
};
|
||||
}
|
||||
|
||||
public SqlSugarClient GetSugarDbContext(string dbName)
|
||||
{
|
||||
string connStr = ConfigUtils.Instance.GetConnectionStrings(OptionsSetting.Conn).Replace("{DbName}", dbName);
|
||||
int dbType = ConfigUtils.Instance.GetAppConfig(OptionsSetting.DbType, 0);
|
||||
|
||||
return new SqlSugarClient(new List<ConnectionConfig>()
|
||||
{
|
||||
new ConnectionConfig(){
|
||||
ConnectionString = connStr,
|
||||
DbType = (DbType)dbType,
|
||||
IsAutoCloseConnection = true,//开启自动释放模式和EF原理一样
|
||||
InitKeyType = InitKeyType.Attribute,//从特性读取主键和自增列信息
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,7 +29,7 @@ namespace ZR.Repository.System
|
||||
.WhereIF(!string.IsNullOrEmpty(user.UserName), it => it.UserName.Contains(user.UserName))
|
||||
.WhereIF(!string.IsNullOrEmpty(user.Status), it => it.Status == user.Status)
|
||||
.WhereIF(user.BeginTime != DateTime.MinValue && user.BeginTime != null, it => it.Create_time >= user.BeginTime)
|
||||
.WhereIF(user.EndTime != DateTime.MinValue && user.BeginTime != null, it => it.EndTime <= user.EndTime)
|
||||
.WhereIF(user.EndTime != DateTime.MinValue && user.BeginTime != null, it => it.Create_time <= user.EndTime)
|
||||
.WhereIF(user.DeptId != 0, it => it.DeptId == user.DeptId)
|
||||
.OrderBy(it => it.UserId)
|
||||
.ToPageList(pager.PageNum, pager.PageSize, ref totalCount);
|
||||
|
||||
@ -15,4 +15,8 @@
|
||||
<PackageReference Include="NETCore.Encrypt" Version="2.0.9" />
|
||||
<PackageReference Include="SqlSugarCoreNoDrive" Version="5.0.3.4" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Repositories\" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@ -3,8 +3,6 @@ using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading.Tasks;
|
||||
using ZR.Model;
|
||||
|
||||
namespace ZR.Service
|
||||
{
|
||||
@ -138,7 +136,7 @@ namespace ZR.Service
|
||||
/// <param name="where"></param>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
PagedInfo<T> GetPages(Expression<Func<T, bool>> where, PagerInfo parm);
|
||||
PagedInfo<T> GetPages(Expression<Func<T, bool>> where, Model.PagerInfo parm);
|
||||
|
||||
/// <summary>
|
||||
/// 根据条件查询分页
|
||||
@ -148,7 +146,7 @@ namespace ZR.Service
|
||||
/// <param name="order"></param>
|
||||
/// <param name="orderEnum"></param>
|
||||
/// <returns></returns>
|
||||
PagedInfo<T> GetPages(Expression<Func<T, bool>> where, PagerInfo parm, Expression<Func<T, object>> order, string orderEnum = "Asc");
|
||||
PagedInfo<T> GetPages(Expression<Func<T, bool>> where, Model.PagerInfo parm, Expression<Func<T, object>> order, string orderEnum = "Asc");
|
||||
|
||||
/// <summary>
|
||||
/// 根据条件查询数据
|
||||
|
||||
@ -9,4 +9,9 @@
|
||||
<ProjectReference Include="..\ZR.Repository\ZR.Repository.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Business\" />
|
||||
<Folder Include="Business\IBusService\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@ -2,9 +2,13 @@
|
||||
<div class="app-container">
|
||||
<el-row :gutter="24">
|
||||
<!-- :model属性用于表单验证使用 比如下面的el-form-item 的 prop属性用于对表单值进行验证操作 -->
|
||||
<<<<<<< HEAD
|
||||
<el-form :model="queryParams" label-position="left" inline ref="queryForm" label-width="120px" v-show="showSearch" @submit.native.prevent>
|
||||
=======
|
||||
<el-form :model="queryParams" label-position="left" inline ref="queryForm" :label-width="labelWidth" v-show="showSearch" @submit.native.prevent>
|
||||
>>>>>>> db49575a0ded0eef5e8a68461da1448cdacb3d69
|
||||
<el-col :span="6">
|
||||
<el-form-item label="文本">
|
||||
<el-form-item label="文本文字">
|
||||
<el-input v-model="queryParams.xxx" placeholder="" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@ -16,18 +20,18 @@
|
||||
<el-col :span="6">
|
||||
<el-form-item label="下拉框">
|
||||
<el-select v-model="queryParams.xxx" placeholder="">
|
||||
<el-option v-for="dict in options" :key="dict.dictValue" :label="dict.dictLabel" :value="dict.dictValue" />
|
||||
<el-option v-for="dict in statusOptions" :key="dict.dictValue" :label="dict.dictLabel" :value="dict.dictValue" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="时间范围">
|
||||
<el-date-picker v-model="queryParams.timeRange" type="datetimerange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期">
|
||||
<el-date-picker size="small" style="width: 240px" v-model="timeRange" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" style="text-align:center;">
|
||||
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-col>
|
||||
</el-form>
|
||||
@ -44,13 +48,13 @@
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="el-icon-delete" size="mini" @click="handleDelete">删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<!-- <el-col :span="1.5">
|
||||
<el-button type="info" plain icon="el-icon-upload2" size="mini" @click="handleImport">导入</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch"></right-toolbar>
|
||||
</el-col> -->
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<!-- 数据区域 -->
|
||||
@ -86,7 +90,7 @@
|
||||
|
||||
<!-- 添加或修改菜单对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="用户Id" prop="userId">
|
||||
@ -106,7 +110,7 @@
|
||||
<el-col :span="12">
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-radio-group v-model="form.status">
|
||||
<el-radio v-for="dict in options" :key="dict.dictValue" :label="dict.dictValue">{{dict.dictLabel}}</el-radio>
|
||||
<el-radio v-for="dict in statusOptions" :key="dict.dictValue" :label="dict.dictValue">{{dict.dictLabel}}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@ -132,23 +136,23 @@ export default {
|
||||
name: "demo",
|
||||
data() {
|
||||
return {
|
||||
labelWidth: "70px",
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
useridx: undefined,
|
||||
name: undefined,
|
||||
},
|
||||
queryParams: {},
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 时间范围数组
|
||||
timeRange: [],
|
||||
// xxx下拉框
|
||||
options: [],
|
||||
statusOptions: [],
|
||||
// 数据列表
|
||||
dataList: [
|
||||
{
|
||||
@ -170,18 +174,30 @@ export default {
|
||||
// 表单校验
|
||||
rules: {
|
||||
name: [{ required: true, message: "名称不能为空", trigger: "blur" }],
|
||||
userId: [{ required: true, message: "id不能为空", trigger: "blur" }],
|
||||
userId: [
|
||||
{
|
||||
type: "number",
|
||||
required: true,
|
||||
message: "id不能为空,且不能为非数字",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
// 列表数据查询
|
||||
this.getList();
|
||||
// 下拉框绑定
|
||||
// this.getDicts("sys_normal_disable").then((response) => {
|
||||
// this.statusOptions = response.data;
|
||||
// });
|
||||
},
|
||||
methods: {
|
||||
// 查询数据
|
||||
getList() {
|
||||
console.log(JSON.stringify(this.queryParams));
|
||||
// listXXXX().then(res => {
|
||||
// listXXXX(this.addDateRange(this.queryParams, this.timeRange)).then(res => {
|
||||
// if (res.code == 200) {
|
||||
// this.dataList = res.data.result;
|
||||
// this.total = res.data.totalCount;
|
||||
@ -195,7 +211,6 @@ export default {
|
||||
},
|
||||
// 重置数据表单
|
||||
reset() {
|
||||
this.btnSubmitVisible = true;
|
||||
this.form = {
|
||||
Id: undefined,
|
||||
// TODO 其他列字段
|
||||
@ -204,7 +219,12 @@ export default {
|
||||
},
|
||||
/** 重置查询操作 */
|
||||
resetQuery() {
|
||||
this.timeRange = [];
|
||||
this.resetForm("queryForm");
|
||||
this.queryParams = {
|
||||
pageNum: 1,
|
||||
//TODO 重置字段
|
||||
};
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
@ -222,7 +242,10 @@ export default {
|
||||
handleDelete(row) {
|
||||
// delXXX().then((res) => {
|
||||
// this.msgSuccess("删除成功");
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
>>>>>>> db49575a0ded0eef5e8a68461da1448cdacb3d69
|
||||
// this.handleQuery();
|
||||
// });
|
||||
},
|
||||
|
||||
@ -21,11 +21,11 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@riophae/vue-treeselect": "0.4.0",
|
||||
"axios": "^0.21.1",
|
||||
"axios": "^0.21.4",
|
||||
"clipboard": "2.0.4",
|
||||
"core-js": "3.6.5",
|
||||
"echarts": "^5.1.1",
|
||||
"element-ui": "2.13.2",
|
||||
"element-ui": "2.15.6",
|
||||
"file-saver": "2.0.1",
|
||||
"fuse.js": "3.4.4",
|
||||
"js-beautify": "1.10.2",
|
||||
|
||||
@ -1,12 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
||||
<title><%= webpackConfig.name %></title>
|
||||
<title>
|
||||
<%= webpackConfig.name %>
|
||||
</title>
|
||||
<style>
|
||||
html,
|
||||
body,
|
||||
@ -15,193 +18,114 @@
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
.chromeframe {
|
||||
margin: 0.2em 0;
|
||||
background: #ccc;
|
||||
color: #000;
|
||||
padding: 0.2em 0;
|
||||
|
||||
.first-loading-wrp {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 90vh;
|
||||
min-height: 90vh;
|
||||
}
|
||||
|
||||
#loader-wrapper {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 999999;
|
||||
.first-loading-wrp>h1 {
|
||||
font-size: 30px;
|
||||
font-weight: bolder;
|
||||
}
|
||||
|
||||
#loader {
|
||||
display: block;
|
||||
.first-loading-wrp .loading-wrp {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 98px;
|
||||
}
|
||||
|
||||
.dot {
|
||||
position: relative;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
width: 150px;
|
||||
height: 150px;
|
||||
margin: -75px 0 0 -75px;
|
||||
border-radius: 50%;
|
||||
border: 3px solid transparent;
|
||||
border-top-color: #FFF;
|
||||
-webkit-animation: spin 2s linear infinite;
|
||||
-ms-animation: spin 2s linear infinite;
|
||||
-moz-animation: spin 2s linear infinite;
|
||||
-o-animation: spin 2s linear infinite;
|
||||
animation: spin 2s linear infinite;
|
||||
z-index: 1001;
|
||||
box-sizing: border-box;
|
||||
display: inline-block;
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
font-size: 64px;
|
||||
transform: rotate(45deg);
|
||||
animation: antRotate 1.2s infinite linear;
|
||||
}
|
||||
|
||||
#loader:before {
|
||||
content: "";
|
||||
.dot i {
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
left: 5px;
|
||||
right: 5px;
|
||||
bottom: 5px;
|
||||
border-radius: 50%;
|
||||
border: 3px solid transparent;
|
||||
border-top-color: #FFF;
|
||||
-webkit-animation: spin 3s linear infinite;
|
||||
-moz-animation: spin 3s linear infinite;
|
||||
-o-animation: spin 3s linear infinite;
|
||||
-ms-animation: spin 3s linear infinite;
|
||||
animation: spin 3s linear infinite;
|
||||
display: block;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
background-color: #1890ff;
|
||||
border-radius: 100%;
|
||||
opacity: 0.3;
|
||||
transform: scale(0.75);
|
||||
transform-origin: 50% 50%;
|
||||
animation: antSpinMove 1s infinite linear alternate;
|
||||
}
|
||||
|
||||
#loader:after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 15px;
|
||||
left: 15px;
|
||||
right: 15px;
|
||||
bottom: 15px;
|
||||
border-radius: 50%;
|
||||
border: 3px solid transparent;
|
||||
border-top-color: #FFF;
|
||||
-moz-animation: spin 1.5s linear infinite;
|
||||
-o-animation: spin 1.5s linear infinite;
|
||||
-ms-animation: spin 1.5s linear infinite;
|
||||
-webkit-animation: spin 1.5s linear infinite;
|
||||
animation: spin 1.5s linear infinite;
|
||||
}
|
||||
|
||||
|
||||
@-webkit-keyframes spin {
|
||||
0% {
|
||||
-webkit-transform: rotate(0deg);
|
||||
-ms-transform: rotate(0deg);
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
-webkit-transform: rotate(360deg);
|
||||
-ms-transform: rotate(360deg);
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% {
|
||||
-webkit-transform: rotate(0deg);
|
||||
-ms-transform: rotate(0deg);
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
-webkit-transform: rotate(360deg);
|
||||
-ms-transform: rotate(360deg);
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#loader-wrapper .loader-section {
|
||||
position: fixed;
|
||||
.dot i:nth-child(1) {
|
||||
top: 0;
|
||||
width: 51%;
|
||||
height: 100%;
|
||||
background: #7171C6;
|
||||
z-index: 1000;
|
||||
-webkit-transform: translateX(0);
|
||||
-ms-transform: translateX(0);
|
||||
transform: translateX(0);
|
||||
}
|
||||
|
||||
#loader-wrapper .loader-section.section-left {
|
||||
left: 0;
|
||||
}
|
||||
|
||||
#loader-wrapper .loader-section.section-right {
|
||||
.dot i:nth-child(2) {
|
||||
top: 0;
|
||||
right: 0;
|
||||
-webkit-animation-delay: 0.4s;
|
||||
animation-delay: 0.4s;
|
||||
}
|
||||
|
||||
|
||||
.loaded #loader-wrapper .loader-section.section-left {
|
||||
-webkit-transform: translateX(-100%);
|
||||
-ms-transform: translateX(-100%);
|
||||
transform: translateX(-100%);
|
||||
-webkit-transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1.000);
|
||||
transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1.000);
|
||||
.dot i:nth-child(3) {
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
-webkit-animation-delay: 0.8s;
|
||||
animation-delay: 0.8s;
|
||||
}
|
||||
|
||||
.loaded #loader-wrapper .loader-section.section-right {
|
||||
-webkit-transform: translateX(100%);
|
||||
-ms-transform: translateX(100%);
|
||||
transform: translateX(100%);
|
||||
-webkit-transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1.000);
|
||||
transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1.000);
|
||||
.dot i:nth-child(4) {
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
-webkit-animation-delay: 1.2s;
|
||||
animation-delay: 1.2s;
|
||||
}
|
||||
|
||||
.loaded #loader {
|
||||
opacity: 0;
|
||||
-webkit-transition: all 0.3s ease-out;
|
||||
transition: all 0.3s ease-out;
|
||||
@keyframes antRotate {
|
||||
to {
|
||||
-webkit-transform: rotate(405deg);
|
||||
transform: rotate(405deg);
|
||||
}
|
||||
}
|
||||
|
||||
.loaded #loader-wrapper {
|
||||
visibility: hidden;
|
||||
-webkit-transform: translateY(-100%);
|
||||
-ms-transform: translateY(-100%);
|
||||
transform: translateY(-100%);
|
||||
-webkit-transition: all 0.3s 1s ease-out;
|
||||
transition: all 0.3s 1s ease-out;
|
||||
@-webkit-keyframes antRotate {
|
||||
to {
|
||||
-webkit-transform: rotate(405deg);
|
||||
transform: rotate(405deg);
|
||||
}
|
||||
}
|
||||
|
||||
.no-js #loader-wrapper {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.no-js h1 {
|
||||
color: #222222;
|
||||
}
|
||||
|
||||
#loader-wrapper .load_title {
|
||||
font-family: 'Open Sans';
|
||||
color: #FFF;
|
||||
font-size: 19px;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
z-index: 9999999999999;
|
||||
position: absolute;
|
||||
top: 60%;
|
||||
@keyframes antSpinMove {
|
||||
to {
|
||||
opacity: 1;
|
||||
line-height: 30px;
|
||||
}
|
||||
}
|
||||
|
||||
#loader-wrapper .load_title span {
|
||||
font-weight: normal;
|
||||
font-style: italic;
|
||||
font-size: 13px;
|
||||
color: #FFF;
|
||||
opacity: 0.5;
|
||||
@-webkit-keyframes antSpinMove {
|
||||
to {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app">
|
||||
<div id="loader-wrapper">
|
||||
<div id="loader"></div>
|
||||
<div class="loader-section section-left"></div>
|
||||
<div class="loader-section section-right"></div>
|
||||
<div class="load_title">正在加载系统资源,请耐心等待</div>
|
||||
<div class="first-loading-wrp">
|
||||
<div class="loading-wrp">
|
||||
<span class="dot dot-spin"> <i></i> <i></i> <i></i> <i></i> </span>
|
||||
</div>
|
||||
<h2></h2>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
59
ZR.Vue/src/api/gendemo.js
Normal file
59
ZR.Vue/src/api/gendemo.js
Normal file
@ -0,0 +1,59 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param {查询条件} data
|
||||
*/
|
||||
export function listGendemo(data) {
|
||||
return request({
|
||||
url: '/bus/Gendemo/list',
|
||||
method: 'get',
|
||||
params: data,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @param data
|
||||
*/
|
||||
export function addGendemo(data) {
|
||||
return request({
|
||||
url: '/bus/Gendemo',
|
||||
method: 'post',
|
||||
data: data,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param data
|
||||
*/
|
||||
export function updateGendemo(data) {
|
||||
return request({
|
||||
url: '/bus/Gendemo',
|
||||
method: 'PUT',
|
||||
data: data,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取详情
|
||||
* @param {Id} Id
|
||||
*/
|
||||
export function getGendemo(id) {
|
||||
return request({
|
||||
url: '/bus/Gendemo/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param {主键} pid
|
||||
*/
|
||||
export function delGendemo(pid) {
|
||||
return request({
|
||||
url: '/bus/Gendemo/' + pid,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
@ -26,10 +26,10 @@ export function cleanOperlog() {
|
||||
}
|
||||
|
||||
// 导出操作日志
|
||||
export function exportOperlog(query) {
|
||||
return request({
|
||||
url: '/monitor/operlog/export',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
// export function exportOperlog(query) {
|
||||
// return request({
|
||||
// url: '/monitor/operlog/export',
|
||||
// method: 'get',
|
||||
// params: query
|
||||
// })
|
||||
// }
|
||||
|
||||
@ -1,76 +1,84 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询生成表数据
|
||||
export function listTable(query) {
|
||||
return request({
|
||||
url: '/tool/gen/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
// 查询db数据库列表
|
||||
export function listDbTable(query) {
|
||||
return request({
|
||||
url: '/tool/gen/db/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询表详细信息
|
||||
export function getGenTable(tableId) {
|
||||
return request({
|
||||
url: '/tool/gen/' + tableId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 修改代码生成信息
|
||||
export function updateGenTable(data) {
|
||||
return request({
|
||||
url: '/tool/gen',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 导入表
|
||||
export function importTable(data) {
|
||||
return request({
|
||||
url: '/tool/gen/importTable',
|
||||
method: 'post',
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
||||
// 预览生成代码
|
||||
export function previewTable(tableId) {
|
||||
// export function previewTable(tableId) {
|
||||
// return request({
|
||||
// url: '/tool/gen/preview/' + tableId,
|
||||
// method: 'get'
|
||||
// })
|
||||
// }
|
||||
|
||||
/**
|
||||
* 创建数据库连接
|
||||
*/
|
||||
// export function createGetDBConn(data) {
|
||||
// return request({
|
||||
// url: 'tool/gen/CreateDBConn',
|
||||
// method: 'post',
|
||||
// data: data,
|
||||
// })
|
||||
// }
|
||||
/**
|
||||
* 获取数据库
|
||||
*/
|
||||
export function codeGetDBList() {
|
||||
return request({
|
||||
url: '/tool/gen/preview/' + tableId,
|
||||
method: 'get'
|
||||
url: 'tool/gen/getDbList',
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 获取数据库表
|
||||
*/
|
||||
export function codeGetTableList(data) {
|
||||
return request({
|
||||
url: 'tool/gen/getTableList',
|
||||
method: 'get',
|
||||
params: data,
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 生成代码
|
||||
*/
|
||||
export async function codeGenerator(data) {
|
||||
return await request({
|
||||
url: 'tool/gen/genCode',
|
||||
method: 'post',
|
||||
data: data,
|
||||
})
|
||||
}
|
||||
|
||||
// 删除表数据
|
||||
export function delTable(tableId) {
|
||||
/**
|
||||
* 获取表格列信息
|
||||
* @param {*} data
|
||||
* @returns
|
||||
*/
|
||||
export function queryColumnInfo(data) {
|
||||
return request({
|
||||
url: '/tool/gen/' + tableId,
|
||||
method: 'delete'
|
||||
url: 'tool/gen/getColumnInfo',
|
||||
method: 'GET',
|
||||
params: data,
|
||||
})
|
||||
}
|
||||
|
||||
// 生成代码(自定义路径)
|
||||
export function genCode(tableName) {
|
||||
return request({
|
||||
url: '/tool/gen/genCode/' + tableName,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 同步数据库
|
||||
export function synchDb(tableName) {
|
||||
return request({
|
||||
url: '/tool/gen/synchDb/' + tableName,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
// /**
|
||||
// *
|
||||
// * 数据库解密
|
||||
// */
|
||||
// export function dbtoolsConnStrDecrypt(data) {
|
||||
// return request({
|
||||
// url: 'DbTools/ConnStrDecrypt',
|
||||
// method: 'post',
|
||||
// params: data,
|
||||
// })
|
||||
// }
|
||||
// /**
|
||||
// * 数据库加密
|
||||
// */
|
||||
// export function dbtoolsConnStrEncrypt(data) {
|
||||
// return request({
|
||||
// url: 'DbTools/ConnStrEncrypt',
|
||||
// method: 'post',
|
||||
// params: data,
|
||||
// })
|
||||
// }
|
||||
|
||||
@ -480,3 +480,17 @@ aside {
|
||||
position: relative;
|
||||
float: right;
|
||||
}
|
||||
.icon {
|
||||
width: 100px;
|
||||
}
|
||||
// 上传文件按钮样式
|
||||
.uploader-icon {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
line-height: 50px;
|
||||
border: 1px dashed #ccc;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.table-td-thumb {
|
||||
width: 80px;
|
||||
}
|
||||
|
||||
@ -6,9 +6,6 @@
|
||||
<!-- 面包屑导航 -->
|
||||
<breadcrumb id="breadcrumb-container" class="breadcrumb-container" />
|
||||
<!-- <top-nav id="topmenu-container" class="topmenu-container" v-if="!topNav"/> -->
|
||||
<!-- <el-menu class="el-menu">
|
||||
<el-menu-item index="4" text-color="#fff"><a href="/bigdata" target="_blank">大屏数据</a></el-menu-item>
|
||||
</el-menu> -->
|
||||
|
||||
<div class="right-menu">
|
||||
<template v-if="device!=='mobile'">
|
||||
@ -85,9 +82,6 @@ export default {
|
||||
});
|
||||
});
|
||||
},
|
||||
to() {
|
||||
this.$router.replace("/bigdata");
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
@ -2,11 +2,9 @@ import Vue from 'vue'
|
||||
|
||||
import Cookies from 'js-cookie'
|
||||
|
||||
import 'normalize.css/normalize.css' // a modern alternative to CSS resets
|
||||
|
||||
import Element from 'element-ui'
|
||||
import './assets/styles/element-variables.scss'
|
||||
|
||||
import 'normalize.css/normalize.css' // a modern alternative to CSS resets
|
||||
import '@/assets/styles/element-variables.scss'
|
||||
import '@/assets/styles/index.scss' // global css
|
||||
|
||||
import App from './App'
|
||||
@ -62,7 +60,7 @@ Vue.use(permission)
|
||||
*/
|
||||
|
||||
Vue.use(Element, {
|
||||
size: Cookies.get('size') || 'mini' // set element-ui default size
|
||||
size: Cookies.get('size') || 'medium' // set element-ui default size
|
||||
})
|
||||
|
||||
Vue.config.productionTip = false
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { login, logOut, getInfo } from '@/api/login'
|
||||
import { login, logOut, getInfo } from '@/api/system/login'
|
||||
import { getToken, setToken, removeToken } from '@/utils/auth'
|
||||
|
||||
const user = {
|
||||
|
||||
@ -1,218 +0,0 @@
|
||||
|
||||
<template>
|
||||
<div id="big-data-container" class="big-data-container">
|
||||
<div class="head">
|
||||
<h1>大屏数据统计分析显示</h1>
|
||||
</div>
|
||||
<div class="data-container">
|
||||
<div class="data-left">
|
||||
<div class="data-left-item">
|
||||
<div class="title">商品销量分类</div>
|
||||
<div id="chart-left-1" style="height: calc(100% - 30px);"></div>
|
||||
<div class="data-foot-line"></div>
|
||||
</div>
|
||||
<div class="data-left-item">
|
||||
<div class="title">本月商品销量</div>
|
||||
<div id="chart-left-3" style="height: calc(100% - 30px);"></div>
|
||||
|
||||
<div class="data-foot-line"></div>
|
||||
</div>
|
||||
<div class="data-left-item">
|
||||
<div class="title">7日订单销量</div>
|
||||
<div id="chart-left-2" style="height: calc(100% - 30px);"></div>
|
||||
<div class="data-foot-line"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="data-center">
|
||||
<!-- <div class="title">中间位置</div> -->
|
||||
<div class="center-top-num">
|
||||
<div class="item">
|
||||
<div class="text">累计销量</div>
|
||||
<div class="num">220,000</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<div class="text">累计销售金额</div>
|
||||
<div class="num">58,000,000</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<div class="text">购买用户人数</div>
|
||||
<div class="num">15,000</div>
|
||||
</div>
|
||||
<div class="data-foot-line"></div>
|
||||
</div>
|
||||
<div class="center-top">
|
||||
<div class="title">用户活跃信息-1</div>
|
||||
<iview-circle :size="200" style="padding: 8px 0;"></iview-circle>
|
||||
<div class="data-foot-line"></div>
|
||||
</div>
|
||||
<div class="title">订单销售统计</div>
|
||||
<div id="chart-center" class="chart-center"></div>
|
||||
</div>
|
||||
<div class="data-right">
|
||||
<div class="data-right-item">
|
||||
<div class="title">销售情况走势</div>
|
||||
<div id="chart-right-1" style="height: calc(100% - 30px);"></div>
|
||||
<div class="data-foot-line"></div>
|
||||
</div>
|
||||
<div class="data-right-item">
|
||||
<div class="title">用户活跃信息</div>
|
||||
<iview-circle></iview-circle>
|
||||
<div class="data-foot-line"></div>
|
||||
</div>
|
||||
<div class="data-right-item right-3">
|
||||
<div class="title">商品销售排行</div>
|
||||
<div id="chart-right-3" class="right-item">
|
||||
<div class="item">
|
||||
<div class="top">排名</div>
|
||||
<div class="pro-name">商品名称</div>
|
||||
<div class="num">销量</div>
|
||||
<div class="num">销售金额</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<div class="top top-1">
|
||||
<span>1</span>
|
||||
</div>
|
||||
<div class="pro-name">卡帝乐鳄鱼</div>
|
||||
<div class="num">2,200</div>
|
||||
<div class="num">360,00</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<div class="top top-2">
|
||||
<span>2</span>
|
||||
</div>
|
||||
<div class="pro-name">春夏男T恤</div>
|
||||
<div class="num">1,700</div>
|
||||
<div class="num">24,500</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<div class="top top-3">
|
||||
<span>3</span>
|
||||
</div>
|
||||
<div class="pro-name">男女同款休闲鞋</div>
|
||||
<div class="num">1,120</div>
|
||||
<div class="num">12,700</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="boxfoot"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
var echarts = require("echarts");
|
||||
import {
|
||||
chartLeft1,
|
||||
chartLeft2,
|
||||
chartLeft3,
|
||||
chartRight1
|
||||
} from "./bigdata/chart-options";
|
||||
import IviewCircle from "./bigdata/IviewCircle";
|
||||
import "./bigdata/layout.less";
|
||||
export default {
|
||||
components: {
|
||||
"iview-circle": IviewCircle
|
||||
},
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
mounted() {
|
||||
var $chartLeft1 = echarts.init(document.getElementById("chart-left-1"));
|
||||
$chartLeft1.setOption(chartLeft1);
|
||||
|
||||
var $chartLeft2 = echarts.init(document.getElementById("chart-left-2"));
|
||||
$chartLeft2.setOption(chartLeft2);
|
||||
|
||||
var $chartLeft3 = echarts.init(document.getElementById("chart-left-3"));
|
||||
$chartLeft3.setOption(chartLeft3);
|
||||
|
||||
var $chartCenter = echarts.init(document.getElementById("chart-center"));
|
||||
$chartCenter.setOption(chartRight1);
|
||||
|
||||
var $chartRight1 = echarts.init(document.getElementById("chart-right-1"));
|
||||
$chartRight1.setOption(chartRight1);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
/* .chart-center {
|
||||
display: flex;
|
||||
border: 1px solid #0000ff;
|
||||
height: 200px;
|
||||
flex-direction: column;
|
||||
margin-top: 20px;
|
||||
}
|
||||
.chart-center .item {
|
||||
text-align: center;
|
||||
border: 1px solid #00c1b3;
|
||||
flex: 1;
|
||||
} */
|
||||
.right-3 {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
/* margin-top: 20px; */
|
||||
}
|
||||
|
||||
.right-3 .right-item {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.right-3 .item {
|
||||
text-align: left;
|
||||
border-bottom: 1px solid #549069;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
padding: 5px 10px;
|
||||
margin: 0 10px;
|
||||
font-size: 14px;
|
||||
line-height: 30px;
|
||||
}
|
||||
|
||||
.right-3 .item:last-child {
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
.right-3 .item > div {
|
||||
color: white;
|
||||
}
|
||||
|
||||
.right-3 .top {
|
||||
width: 60px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.right-3 .top span {
|
||||
position: absolute;
|
||||
width: 20px;
|
||||
line-height: 20px;
|
||||
top: 5px;
|
||||
text-align: center;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.right-3 .top-1 span {
|
||||
background: #e80d0d;
|
||||
}
|
||||
|
||||
.right-3 .top-2 span {
|
||||
background: #00c935;
|
||||
}
|
||||
|
||||
.right-3 .top-3 span {
|
||||
background: #0083f4;
|
||||
}
|
||||
|
||||
.right-3 .num {
|
||||
width: 88px;
|
||||
}
|
||||
|
||||
.right-3 .pro-name {
|
||||
flex: 1;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,88 +0,0 @@
|
||||
<template>
|
||||
<div class="demo-Circle">
|
||||
<div style>
|
||||
<i-circle :size="size" :trail-width="4" :stroke-width="5" :percent="75" stroke-linecap="square" stroke-color="#43a3fb">
|
||||
<div class="demo-Circle-custom">
|
||||
<h1>1500</h1>
|
||||
<p>昨日活跃用户数量</p>
|
||||
<span>
|
||||
占比
|
||||
<i>{{1500/20000}}%</i>
|
||||
</span>
|
||||
</div>
|
||||
</i-circle>
|
||||
</div>
|
||||
<div style>
|
||||
<i-circle :size="size" :trail-width="4" :stroke-width="5" :percent="75" stroke-linecap="square" stroke-color="#43a3fb">
|
||||
<div class="demo-Circle-custom">
|
||||
<h1>12000</h1>
|
||||
<p>上月活跃用户数量</p>
|
||||
<span>
|
||||
占比
|
||||
<i>{{12000/150000}}%</i>
|
||||
</span>
|
||||
</div>
|
||||
</i-circle>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
size: {
|
||||
type: Number,
|
||||
default: 150,
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
.demo-Circle {
|
||||
display: flex;
|
||||
}
|
||||
.demo-Circle > div {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
}
|
||||
.demo-Circle > div:first-child {
|
||||
padding-left: 10%;
|
||||
}
|
||||
|
||||
.demo-Circle > div:last-child {
|
||||
padding-right: 10%;
|
||||
}
|
||||
</style>
|
||||
<style lang="less" scoped>
|
||||
.demo-Circle-custom {
|
||||
& h1 {
|
||||
color: #ffffff;
|
||||
font-size: 28px;
|
||||
font-weight: normal;
|
||||
}
|
||||
& p {
|
||||
color: #ece8e8;
|
||||
font-size: 14px;
|
||||
margin: 10px 0 15px;
|
||||
}
|
||||
& span {
|
||||
display: block;
|
||||
padding-top: 15px;
|
||||
color: wheat;
|
||||
font-size: 14px;
|
||||
&:before {
|
||||
content: "";
|
||||
display: block;
|
||||
width: 50px;
|
||||
height: 1px;
|
||||
margin: 0 auto;
|
||||
background: #e0e3e6;
|
||||
position: relative;
|
||||
top: -15px;
|
||||
}
|
||||
}
|
||||
& span i {
|
||||
font-style: normal;
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -1,471 +0,0 @@
|
||||
var echarts = require("echarts");
|
||||
let chartLeft1 = {
|
||||
tooltip: {
|
||||
trigger: "axis",
|
||||
axisPointer: {
|
||||
type: "shadow"
|
||||
}
|
||||
},
|
||||
grid: {
|
||||
left: "0%",
|
||||
top: "10px",
|
||||
right: "0%",
|
||||
bottom: "4%",
|
||||
containLabel: true
|
||||
},
|
||||
xAxis: [
|
||||
{
|
||||
type: "category",
|
||||
data: [
|
||||
"商超门店",
|
||||
"教育培训",
|
||||
"房地产",
|
||||
"生活服务",
|
||||
"汽车销售",
|
||||
"旅游酒店",
|
||||
"五金建材"
|
||||
],
|
||||
axisLine: {
|
||||
show: true,
|
||||
lineStyle: {
|
||||
color: "rgba(255,255,255,.1)",
|
||||
width: 1,
|
||||
type: "solid"
|
||||
}
|
||||
},
|
||||
|
||||
axisTick: {
|
||||
show: false
|
||||
},
|
||||
axisLabel: {
|
||||
interval: 0,
|
||||
show: true,
|
||||
splitNumber: 15,
|
||||
textStyle: {
|
||||
color: "rgba(255,255,255,.6)",
|
||||
fontSize: "12"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
yAxis: [
|
||||
{
|
||||
type: "value",
|
||||
axisLabel: {
|
||||
show: true,
|
||||
textStyle: {
|
||||
color: "rgba(255,255,255,.6)",
|
||||
fontSize: "12"
|
||||
}
|
||||
},
|
||||
axisTick: {
|
||||
show: false
|
||||
},
|
||||
axisLine: {
|
||||
show: true,
|
||||
lineStyle: {
|
||||
color: "rgba(255,255,255,.1 )",
|
||||
width: 1,
|
||||
type: "solid"
|
||||
}
|
||||
},
|
||||
splitLine: {
|
||||
lineStyle: {
|
||||
color: "rgba(255,255,255,.1)"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
series: [
|
||||
{
|
||||
type: "bar",
|
||||
data: [200, 600, 300, 900, 1500, 1200, 600],
|
||||
barWidth: "35%",
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: "#2f89cf",
|
||||
opacity: 1,
|
||||
barBorderRadius: 5
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
let chartLeft2 = {
|
||||
tooltip: {
|
||||
trigger: "axis",
|
||||
axisPointer: {
|
||||
type: "shadow"
|
||||
}
|
||||
},
|
||||
grid: {
|
||||
left: "0%",
|
||||
top: "10px",
|
||||
right: "0%",
|
||||
bottom: "4%",
|
||||
containLabel: true
|
||||
},
|
||||
xAxis: [
|
||||
{
|
||||
type: "category",
|
||||
data: [
|
||||
"07.01",
|
||||
"07.02",
|
||||
"07.03",
|
||||
"07.04",
|
||||
"07.05",
|
||||
"07.06",
|
||||
],
|
||||
axisLine: {
|
||||
show: true,
|
||||
lineStyle: {
|
||||
color: "rgba(255,255,255,.1)",
|
||||
width: 1,
|
||||
type: "solid"
|
||||
}
|
||||
},
|
||||
axisTick: {
|
||||
show: false
|
||||
},
|
||||
axisLabel: {
|
||||
interval: 0,
|
||||
// rotate:50,
|
||||
show: true,
|
||||
splitNumber: 15,
|
||||
textStyle: {
|
||||
color: "rgba(255,255,255,.6)",
|
||||
fontSize: "12"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
yAxis: [
|
||||
{
|
||||
type: "value",
|
||||
axisLabel: {
|
||||
show: true,
|
||||
textStyle: {
|
||||
color: "rgba(255,255,255,.6)",
|
||||
fontSize: "12"
|
||||
}
|
||||
},
|
||||
axisTick: {
|
||||
show: false
|
||||
},
|
||||
axisLine: {
|
||||
show: true,
|
||||
lineStyle: {
|
||||
color: "rgba(255,255,255,.1 )",
|
||||
width: 1,
|
||||
type: "solid"
|
||||
}
|
||||
},
|
||||
splitLine: {
|
||||
lineStyle: {
|
||||
color: "rgba(255,255,255,.1)"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type: "value",
|
||||
axisLabel: {
|
||||
show: true,
|
||||
textStyle: {
|
||||
color: "rgba(255,255,255,.6)",
|
||||
fontSize: "12"
|
||||
}
|
||||
},
|
||||
axisTick: {
|
||||
show: false
|
||||
},
|
||||
axisLine: {
|
||||
show: true,
|
||||
lineStyle: {
|
||||
color: "rgba(255,255,255,.1 )",
|
||||
width: 1,
|
||||
type: "solid"
|
||||
}
|
||||
},
|
||||
splitLine: {
|
||||
lineStyle: {
|
||||
color: "rgba(255,255,255,.1)"
|
||||
}
|
||||
}
|
||||
}
|
||||
], series: [
|
||||
{
|
||||
type: "bar",
|
||||
name: "销量",
|
||||
data: [1200, 800, 300, 500, 560, 220],
|
||||
barWidth: "25%",
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: "#2f89cf",
|
||||
opacity: 1,
|
||||
barBorderRadius: 5
|
||||
}
|
||||
}
|
||||
}, {
|
||||
type: "bar",
|
||||
name: "订单",
|
||||
data: [1000, 750, 380, 450, 450, 120],
|
||||
barWidth: "25%",
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: "#46d000",
|
||||
opacity: 1,
|
||||
barBorderRadius: 5
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
let chartLeft3 = {
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: { // 坐标轴指示器,坐标轴触发有效
|
||||
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
|
||||
}
|
||||
},
|
||||
grid: {
|
||||
left: "0%",
|
||||
top: "-5px",
|
||||
right: "3%",
|
||||
bottom: "4%",
|
||||
containLabel: true
|
||||
},
|
||||
xAxis: {
|
||||
type: 'value',
|
||||
axisLabel: {
|
||||
show: true,
|
||||
textStyle: {
|
||||
color: "rgba(255,255,255,.6)",
|
||||
fontSize: "12"
|
||||
}
|
||||
},
|
||||
axisTick: {
|
||||
show: false
|
||||
},
|
||||
axisLine: {
|
||||
show: true,
|
||||
lineStyle: {
|
||||
color: "rgba(255,255,255,.1 )",
|
||||
width: 1,
|
||||
type: "solid"
|
||||
}
|
||||
},
|
||||
splitLine: {
|
||||
lineStyle: {
|
||||
color: "rgba(255,255,255,.1)"
|
||||
}
|
||||
}
|
||||
},
|
||||
yAxis: {
|
||||
type: 'category',
|
||||
axisLabel: {
|
||||
show: true,
|
||||
textStyle: {
|
||||
color: "rgba(255,255,255,.6)",
|
||||
fontSize: "12"
|
||||
}
|
||||
},
|
||||
axisTick: {
|
||||
show: false
|
||||
},
|
||||
axisLine: {
|
||||
show: true,
|
||||
lineStyle: {
|
||||
color: "rgba(255,255,255,.1 )",
|
||||
width: 1,
|
||||
type: "solid"
|
||||
}
|
||||
},
|
||||
splitLine: {
|
||||
lineStyle: {
|
||||
color: "rgba(255,255,255,.1)"
|
||||
}
|
||||
},
|
||||
data: ['周一', '周二', '周三', '周四', '周五']
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '直接访问',
|
||||
type: 'bar',
|
||||
stack: '总量',
|
||||
label: {
|
||||
show: true,
|
||||
position: 'insideRight'
|
||||
},
|
||||
barWidth: "55%",
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: "#2f89cf",
|
||||
opacity: 1,
|
||||
barBorderRadius: 5
|
||||
}
|
||||
},
|
||||
data: [120, 302, 400, 200, 700]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
let chartRight1 = {
|
||||
title: {},
|
||||
tooltip: {
|
||||
trigger: "axis",
|
||||
axisPointer: {
|
||||
type: "cross",
|
||||
label: {
|
||||
backgroundColor: "#6a7985"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
color: ["#ffab6f", "#09b916", "#83cddc"], //图例颜色
|
||||
legend: {
|
||||
top: "0%",
|
||||
icon: "roundRect",
|
||||
data: ["销售订单", "退货订单", "折扣订单"],
|
||||
textStyle: {
|
||||
color: "rgba(255,255,255,.5)",
|
||||
fontSize: "12"
|
||||
}
|
||||
},
|
||||
toolbox: {
|
||||
feature: {}
|
||||
},
|
||||
grid: {
|
||||
left: "10",
|
||||
top: "20",
|
||||
right: "10",
|
||||
bottom: "10",
|
||||
containLabel: true
|
||||
},
|
||||
xAxis: [
|
||||
{
|
||||
type: "category",
|
||||
boundaryGap: false,
|
||||
axisLabel: {
|
||||
textStyle: {
|
||||
color: "rgba(255,255,255,.6)",
|
||||
fontSize: 12
|
||||
}
|
||||
},
|
||||
axisLine: {
|
||||
lineStyle: {
|
||||
color: "rgba(255,255,255,.2)"
|
||||
}
|
||||
},
|
||||
data: [
|
||||
"2020.06.15",
|
||||
"2020.06.16",
|
||||
"2020.06.17",
|
||||
"2020.06.18",
|
||||
"2020.06.19",
|
||||
"2020.06.20",
|
||||
"2020.06.21",
|
||||
"2020.06.22"
|
||||
]
|
||||
}
|
||||
],
|
||||
yAxis: [
|
||||
{
|
||||
type: "value",
|
||||
axisTick: { show: false },
|
||||
minInterval: 60,
|
||||
axisLine: {
|
||||
lineStyle: {
|
||||
color: "rgba(255,255,255,.1)"
|
||||
}
|
||||
},
|
||||
axisLabel: {
|
||||
textStyle: {
|
||||
color: "rgba(255,255,255,.6)",
|
||||
fontSize: 12
|
||||
}
|
||||
},
|
||||
|
||||
splitLine: {
|
||||
lineStyle: {
|
||||
color: "rgba(255,255,255,.1)"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
series: [
|
||||
{
|
||||
name: "销售订单",
|
||||
type: "line",
|
||||
smooth: true,
|
||||
lineStyle: {
|
||||
color: "#45d4ba",
|
||||
width: 1
|
||||
}, //线条的样式
|
||||
areaStyle: {
|
||||
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
||||
{
|
||||
offset: 0,
|
||||
color: "#83cddc"
|
||||
},
|
||||
{
|
||||
offset: 1,
|
||||
color: "#bfdffbb5"
|
||||
}
|
||||
])
|
||||
},
|
||||
data: [5, 22, 150, 54, 1, 230, 4, 1]
|
||||
},
|
||||
{
|
||||
name: "退货订单",
|
||||
type: "line",
|
||||
|
||||
smooth: true,
|
||||
lineStyle: {
|
||||
color: "#04a710",
|
||||
width: 1
|
||||
}, //
|
||||
areaStyle: {
|
||||
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
||||
{
|
||||
offset: 0,
|
||||
color: "#0cbf22"
|
||||
},
|
||||
{
|
||||
offset: 1,
|
||||
color: "#b8f7d1b5"
|
||||
}
|
||||
])
|
||||
},
|
||||
data: [10, 150, 1, 250, 20, 100, 10, 150]
|
||||
},
|
||||
{
|
||||
name: "折扣订单",
|
||||
type: "line",
|
||||
|
||||
lineStyle: {
|
||||
color: "#0864c3",
|
||||
width: 1
|
||||
}, //线条的样式
|
||||
smooth: true,
|
||||
areaStyle: {
|
||||
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
||||
{
|
||||
offset: 0,
|
||||
color: "#29d7ff"
|
||||
},
|
||||
{
|
||||
offset: 1,
|
||||
color: "#34ccef85"
|
||||
}
|
||||
])
|
||||
},
|
||||
data: [100, 2, 260, 1, 200, 30, 101, 40]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
export { chartLeft1, chartLeft2,chartLeft3, chartRight1 }
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 7.7 KiB |
@ -1,197 +0,0 @@
|
||||
|
||||
.big-data-container {
|
||||
position: absolute;
|
||||
overflow: hidden;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
background-color: #1400a8;
|
||||
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='100%25' viewBox='0 0 1200 800'%3E%3Cdefs%3E%3CradialGradient id='a' cx='0' cy='800' r='800' gradientUnits='userSpaceOnUse'%3E%3Cstop offset='0' stop-color='%230e0077'/%3E%3Cstop offset='1' stop-color='%230e0077' stop-opacity='0'/%3E%3C/radialGradient%3E%3CradialGradient id='b' cx='1200' cy='800' r='800' gradientUnits='userSpaceOnUse'%3E%3Cstop offset='0' stop-color='%2314057c'/%3E%3Cstop offset='1' stop-color='%2314057c' stop-opacity='0'/%3E%3C/radialGradient%3E%3CradialGradient id='c' cx='600' cy='0' r='600' gradientUnits='userSpaceOnUse'%3E%3Cstop offset='0' stop-color='%230d0524'/%3E%3Cstop offset='1' stop-color='%230d0524' stop-opacity='0'/%3E%3C/radialGradient%3E%3CradialGradient id='d' cx='600' cy='800' r='600' gradientUnits='userSpaceOnUse'%3E%3Cstop offset='0' stop-color='%231400a8'/%3E%3Cstop offset='1' stop-color='%231400a8' stop-opacity='0'/%3E%3C/radialGradient%3E%3CradialGradient id='e' cx='0' cy='0' r='800' gradientUnits='userSpaceOnUse'%3E%3Cstop offset='0' stop-color='%23000000'/%3E%3Cstop offset='1' stop-color='%23000000' stop-opacity='0'/%3E%3C/radialGradient%3E%3CradialGradient id='f' cx='1200' cy='0' r='800' gradientUnits='userSpaceOnUse'%3E%3Cstop offset='0' stop-color='%23130733'/%3E%3Cstop offset='1' stop-color='%23130733' stop-opacity='0'/%3E%3C/radialGradient%3E%3C/defs%3E%3Crect fill='url(%23a)' width='1200' height='800'/%3E%3Crect fill='url(%23b)' width='1200' height='800'/%3E%3Crect fill='url(%23c)' width='1200' height='800'/%3E%3Crect fill='url(%23d)' width='1200' height='800'/%3E%3Crect fill='url(%23e)' width='1200' height='800'/%3E%3Crect fill='url(%23f)' width='1200' height='800'/%3E%3C/svg%3E");
|
||||
background-attachment: fixed;
|
||||
background-size: cover;
|
||||
.head {
|
||||
height: 75px;
|
||||
/* height: 1.05rem; */
|
||||
background: url(./head_bg.png) no-repeat center center;
|
||||
background-size: 100% 100%;
|
||||
position: relative;
|
||||
z-index: 100;
|
||||
}
|
||||
}
|
||||
|
||||
.head h1 {
|
||||
margin: 0;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
/* font-size: .4rem; */
|
||||
/* line-height: .8rem; */
|
||||
line-height: 71px;
|
||||
}
|
||||
|
||||
.data-container {
|
||||
/* margin: 5px 15px;
|
||||
height:100%; */
|
||||
|
||||
margin: 0px 15px;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 76px;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
.data-container > div {
|
||||
float: left;
|
||||
/* border: 1px solid white; */
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.data-center {
|
||||
padding: 0 0.9rem;
|
||||
width: 40%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
// .center-top{
|
||||
// height: 210px;
|
||||
// background: red;
|
||||
// }
|
||||
.chart-center{
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
.chart-center{
|
||||
width: 100%;
|
||||
display: flex;
|
||||
// background: white;
|
||||
}
|
||||
.data-left,
|
||||
.data-right {
|
||||
width: 30%;
|
||||
display: flex;
|
||||
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.data-left-item,
|
||||
.data-right-item,.center-top,.center-top-num,.chart-center {
|
||||
border: 1px solid rgba(25, 186, 139, 0.17);
|
||||
padding: 0 0.2rem 0.4rem 0.15rem;
|
||||
background: rgba(255, 255, 255, 0.04);
|
||||
background-size: 100% auto;
|
||||
position: relative;
|
||||
margin-bottom: 0.15rem;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.data-foot-line {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.data-foot-line:before,
|
||||
.data-foot-line:after {
|
||||
position: absolute;
|
||||
width: 10px;
|
||||
height:10px;
|
||||
content: "";
|
||||
border-bottom: 2px solid #02a6b5;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
.boxall:before,
|
||||
.data-foot-line:before {
|
||||
border-left: 2px solid #02a6b5;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.boxall:after,
|
||||
.data-foot-line:after {
|
||||
border-right: 2px solid #02a6b5;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.boxall:before,
|
||||
.boxall:after {
|
||||
position: absolute;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
content: "";
|
||||
border-top: 2px solid #02a6b5;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.data-left-item:before,
|
||||
.data-right-item:before,
|
||||
.center-top-num:before,
|
||||
.center-top:before{
|
||||
border-left: 2px solid #02a6b5;
|
||||
left: 0;
|
||||
position: absolute;
|
||||
width: 10px;
|
||||
height:10px;
|
||||
content: "";
|
||||
border-top: 2px solid #02a6b5;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.data-left-item:after,
|
||||
.data-right-item:after,
|
||||
.center-top-num:after,
|
||||
.center-top:after {
|
||||
border-right: 2px solid #02a6b5;
|
||||
right: 0;
|
||||
position: absolute;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
content: "";
|
||||
border-top: 2px solid #02a6b5;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.data-left,
|
||||
.data-right {
|
||||
/* display: flex; */
|
||||
}
|
||||
|
||||
.data-left > .data-left-item,
|
||||
.data-right > .data-right-item {
|
||||
flex: 1;
|
||||
margin-bottom: 0.9rem;
|
||||
}
|
||||
|
||||
.data-center .title,
|
||||
.data-left > .data-left-item .title,
|
||||
.data-right > .data-right-item .title {
|
||||
/* font-size: .2rem; */
|
||||
font-size: 1rem;
|
||||
padding: 7px 0;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
/* line-height: .5rem; */
|
||||
}
|
||||
|
||||
.data-center .chart-center{
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.center-top-num{
|
||||
height: 80px;
|
||||
padding-top: 7px;
|
||||
margin-bottom: 0.8rem;
|
||||
display: flex;
|
||||
.item{
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
}
|
||||
.text{
|
||||
color: #fcf0d8;
|
||||
font-size: 14px;
|
||||
}
|
||||
.num{
|
||||
font-size: 34px;
|
||||
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Helvetica Neue, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol;
|
||||
font-weight: bold;
|
||||
color: #67caca;
|
||||
}
|
||||
}
|
||||
@ -87,35 +87,41 @@
|
||||
<!-- 添加或修改菜单对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="用户Id" prop="userId">
|
||||
|
||||
<el-form-item label="主键" prop="userId">
|
||||
<el-input v-model.number="form.userId" placeholder="" :disabled="form.userId > 0" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="用户昵称" prop="name">
|
||||
|
||||
<el-form-item label="单行文本" prop="name">
|
||||
<el-input v-model="form.name" placeholder="" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="顺序" prop="sortId">
|
||||
|
||||
<el-form-item label="number" prop="sortId">
|
||||
<el-input-number v-model="form.sortId" controls-position="right" :min="0" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="状态" prop="status">
|
||||
|
||||
<el-form-item label="单选按钮" prop="status">
|
||||
<el-radio-group v-model="form.status">
|
||||
<el-radio v-for="dict in statusOptions" :key="dict.dictValue" :label="dict.dictValue">{{dict.dictLabel}}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="content">
|
||||
|
||||
<el-form-item label="photo" :label-width="labelWidth" prop="photo">
|
||||
<el-upload class="avatar-uploader" action="/api/upload/saveFile/" :show-file-list="false" :on-success="handleFileSuccess" :before-upload="beforeFileUpload">
|
||||
<img v-if="form.photo" :src="form.photo" class="icon">
|
||||
<i v-else class="el-icon-plus uploader-icon"></i>
|
||||
</el-upload>
|
||||
<el-input v-model="form.photo"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="时间控件" :label-width="labelWidth" prop="lastLoginTime">
|
||||
<el-date-picker v-model="form.lastLoginTime" type="datetime" placeholder="选择日期时间" default-time="12:00:00"> </el-date-picker>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="多行文本" prop="content">
|
||||
<el-input v-model="form.content" :rows="2" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer" v-if="btnSubmitVisible">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
@ -132,7 +138,7 @@ export default {
|
||||
name: "demo",
|
||||
data() {
|
||||
return {
|
||||
labelWidth: "70px",
|
||||
labelWidth: "100px",
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 显示搜索条件
|
||||
|
||||
279
ZR.Vue/src/views/gendemo/index.vue
Normal file
279
ZR.Vue/src/views/gendemo/index.vue
Normal file
@ -0,0 +1,279 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- :model属性用于表单验证使用 比如下面的el-form-item 的 prop属性用于对表单值进行验证操作 -->
|
||||
<el-form :model="queryParams" label-position="left" inline ref="queryForm" :label-width="labelWidth" v-show="showSearch" @submit.native.prevent>
|
||||
<el-form-item label="文本文字">
|
||||
<el-input v-model="queryParams.xxx" placeholder="" />
|
||||
</el-form-item>
|
||||
<el-form-item label="数字">
|
||||
<el-input v-model.number="queryParams.xxx" placeholder="" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="下拉框">
|
||||
<el-select v-model="queryParams.xxx" placeholder="">
|
||||
<el-option v-for="dict in statusOptions" :key="dict.dictValue" :label="dict.dictLabel" :value="dict.dictValue" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="时间范围">
|
||||
<el-date-picker size="small" style="width: 240px" v-model="timeRange" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
|
||||
<el-row class="mb8" style="text-align:center">
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-row>
|
||||
</el-form>
|
||||
|
||||
<!-- 工具区域 -->
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" v-hasPermi="['gendemo:add']" plain icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" :disabled="single" v-hasPermi="['gendemo:update']" plain icon="el-icon-edit" size="mini" @click="handleUpdate">修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" v-hasPermi="['gendemo:delete']" plain icon="el-icon-delete" size="mini" @click="handleDelete">删除</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<!-- 数据区域 -->
|
||||
<el-table :data="dataList" ref="table" border @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="50" />
|
||||
<el-table-column prop="id" label="自增id" align="center" width="100" />
|
||||
<el-table-column prop="name" label="名称" align="center" width="100" :show-overflow-tooltip="true" />
|
||||
<el-table-column prop="icon" label="图片">
|
||||
<template slot-scope="scope">
|
||||
<el-image class="table-td-thumb" :src="scope.row.icon" :preview-src-list="[scope.row.icon]"></el-image>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="showStatus" label="显示状态" align="center" width="100" />
|
||||
<el-table-column prop="addTime" label="添加时间" align="center" width="100" />
|
||||
|
||||
<el-table-column label="操作" align="center" width="200">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" v-hasPermi="['gendemo:update']" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">编辑</el-button>
|
||||
<el-popconfirm title="确定删除吗?" @onConfirm="handleDelete(scope.row)" style="margin-left:10px">
|
||||
<el-button slot="reference" v-hasPermi="['gendemo:delete']" size="mini" type="text" icon="el-icon-delete">删除</el-button>
|
||||
</el-popconfirm>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination class="mt10" background :total="total" :current-page.sync="queryParams.pageNum" layout="total, sizes, prev, pager, next, jumper" :page-size="queryParams.pageSize" :page-sizes="[20, 30, 50, 100]" @size-change="handleSizeChange"
|
||||
@current-change="getList" />
|
||||
|
||||
<!-- 添加或修改菜单对话框 -->
|
||||
<el-dialog :title="title" :lock-scroll="false" :visible.sync="open">
|
||||
<el-form ref="form" :model="form" :rules="rules" :label-width="formLabelWidth">
|
||||
<el-form-item label="自增id" :label-width="labelWidth" prop="id">
|
||||
<el-input v-model="form.id" placeholder="" :disabled="true" />
|
||||
</el-form-item>
|
||||
<el-form-item label="名称" :label-width="labelWidth" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="图片" :label-width="labelWidth" prop="icon">
|
||||
<el-upload class="avatar-uploader" name="file" action="/api/upload/saveFile/" :show-file-list="false" :on-success="handleUploadiconSuccess" :before-upload="beforeFileUpload">
|
||||
<img v-if="form.icon" :src="form.icon" class="icon">
|
||||
<i v-else class="el-icon-plus uploader-icon"></i>
|
||||
</el-upload>
|
||||
<el-input v-model="form.icon" placeholder="请上传文件或手动输入文件地址"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="显示状态" :label-width="labelWidth" prop="showStatus">
|
||||
<el-input v-model="form.showStatus" placeholder="请输入显示状态" />
|
||||
</el-form-item>
|
||||
<el-form-item label="添加时间" :label-width="labelWidth" prop="addTime">
|
||||
<el-date-picker v-model="form.addTime" type="datetime" placeholder="选择日期时间" default-time="12:00:00"> </el-date-picker>
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer" v-if="btnSubmitVisible">
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import {
|
||||
listGendemo,
|
||||
addGendemo,
|
||||
delGendemo,
|
||||
updateGendemo,
|
||||
getGendemo,
|
||||
} from "@/api/gendemo.js";
|
||||
|
||||
export default {
|
||||
name: "Gendemo",
|
||||
data() {
|
||||
return {
|
||||
labelWidth: "100px",
|
||||
formLabelWidth: "100px",
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 查询参数
|
||||
queryParams: {},
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 时间范围数组
|
||||
timeRange: [],
|
||||
// xxx下拉框
|
||||
statusOptions: [],
|
||||
// 数据列表
|
||||
dataList: [],
|
||||
// 总记录数
|
||||
total: 0,
|
||||
// 提交按钮是否显示
|
||||
btnSubmitVisible: true,
|
||||
// 表单校验
|
||||
rules: {
|
||||
name: [{ required: true, message: "请输入名称", trigger: "blur" }],
|
||||
showStatus: [
|
||||
{ required: true, message: "请输入显示状态", trigger: "blur" },
|
||||
],
|
||||
},
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
// 列表数据查询
|
||||
this.getList();
|
||||
// 下拉框绑定
|
||||
// this.getDicts("sys_normal_disable").then((response) => {
|
||||
// this.statusOptions = response.data;
|
||||
// });
|
||||
},
|
||||
methods: {
|
||||
// 查询数据
|
||||
getList() {
|
||||
console.log(JSON.stringify(this.queryParams));
|
||||
listGendemo(this.addDateRange(this.queryParams, this.timeRange)).then(
|
||||
(res) => {
|
||||
if (res.code == 200) {
|
||||
this.dataList = res.data.result;
|
||||
this.total = res.data.totalCount;
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 重置数据表单
|
||||
reset() {
|
||||
this.form = {
|
||||
id: undefined,
|
||||
name: undefined,
|
||||
icon: undefined,
|
||||
showStatus: undefined,
|
||||
addTime: undefined,
|
||||
|
||||
//需个性化处理内容
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 重置查询操作 */
|
||||
resetQuery() {
|
||||
this.timeRange = [];
|
||||
this.resetForm("queryForm");
|
||||
this.queryParams = {
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
//TODO 重置字段
|
||||
};
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map((item) => item.id);
|
||||
this.single = selection.length != 1;
|
||||
this.multiple = !selection.length;
|
||||
},
|
||||
/** 选择每页显示数量*/
|
||||
handleSizeChange(val) {
|
||||
this.queryParams.pageSize = val;
|
||||
this.queryParams.pageNum = 1;
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.getList();
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加";
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
delGendemo(row.id).then((res) => {
|
||||
this.msgSuccess("删除成功");
|
||||
this.handleQuery();
|
||||
});
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids;
|
||||
getGendemo(id).then((res) => {
|
||||
if (res.code == 200) {
|
||||
this.form = res.data;
|
||||
this.open = true;
|
||||
this.title = "修改数据";
|
||||
}
|
||||
});
|
||||
},
|
||||
beforeFileUpload(file) {},
|
||||
//文件上传成功方法
|
||||
handleUploadiconSuccess(res, file) {
|
||||
this.form.icon = URL.createObjectURL(file.raw);
|
||||
// this.$refs.upload.clearFiles();
|
||||
},
|
||||
|
||||
/** 提交按钮 */
|
||||
submitForm: function () {
|
||||
this.$refs["form"].validate((valid) => {
|
||||
if (valid) {
|
||||
console.log(JSON.stringify(this.form));
|
||||
|
||||
if (this.form.id != undefined || this.title === "修改数据") {
|
||||
updateGendemo(this.form).then((res) => {
|
||||
this.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addGendemo(this.form).then((res) => {
|
||||
this.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
.table-td-thumb {
|
||||
width: 80px;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
@ -23,7 +23,7 @@
|
||||
<div slot="header" class="clearfix">
|
||||
<span>技术选型</span>
|
||||
</div>
|
||||
<el-col :span="6">
|
||||
<el-col :span="10">
|
||||
<h4>后端技术</h4>
|
||||
<ul>
|
||||
<li>NET5</li>
|
||||
@ -35,7 +35,7 @@
|
||||
<li>...</li>
|
||||
</ul>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-col :span="10">
|
||||
<h4>前端技术</h4>
|
||||
<ul>
|
||||
<li>Vue</li>
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getCodeImg } from "@/api/login";
|
||||
import { getCodeImg } from "@/api/system/login";
|
||||
import Cookies from "js-cookie";
|
||||
import { encrypt, decrypt } from "@/utils/jsencrypt";
|
||||
|
||||
|
||||
151
ZR.Vue/src/views/monitor/cache/index.vue
vendored
151
ZR.Vue/src/views/monitor/cache/index.vue
vendored
@ -1,151 +0,0 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-row>
|
||||
<el-col :span="24" class="card-box">
|
||||
<el-card>
|
||||
<div slot="header"><span>基本信息</span></div>
|
||||
<div class="el-table el-table--enable-row-hover el-table--medium">
|
||||
<table cellspacing="0" style="width: 100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><div class="cell">Redis版本</div></td>
|
||||
<td><div class="cell" v-if="cache.info">{{ cache.info.redis_version }}</div></td>
|
||||
<td><div class="cell">运行模式</div></td>
|
||||
<td><div class="cell" v-if="cache.info">{{ cache.info.redis_mode == "standalone" ? "单机" : "集群" }}</div></td>
|
||||
<td><div class="cell">端口</div></td>
|
||||
<td><div class="cell" v-if="cache.info">{{ cache.info.tcp_port }}</div></td>
|
||||
<td><div class="cell">客户端数</div></td>
|
||||
<td><div class="cell" v-if="cache.info">{{ cache.info.connected_clients }}</div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><div class="cell">运行时间(天)</div></td>
|
||||
<td><div class="cell" v-if="cache.info">{{ cache.info.uptime_in_days }}</div></td>
|
||||
<td><div class="cell">使用内存</div></td>
|
||||
<td><div class="cell" v-if="cache.info">{{ cache.info.used_memory_human }}</div></td>
|
||||
<td><div class="cell">使用CPU</div></td>
|
||||
<td><div class="cell" v-if="cache.info">{{ parseFloat(cache.info.used_cpu_user_children).toFixed(2) }}</div></td>
|
||||
<td><div class="cell">内存配置</div></td>
|
||||
<td><div class="cell" v-if="cache.info">{{ cache.info.maxmemory_human }}</div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><div class="cell">AOF是否开启</div></td>
|
||||
<td><div class="cell" v-if="cache.info">{{ cache.info.aof_enabled == "0" ? "否" : "是" }}</div></td>
|
||||
<td><div class="cell">RDB是否成功</div></td>
|
||||
<td><div class="cell" v-if="cache.info">{{ cache.info.rdb_last_bgsave_status }}</div></td>
|
||||
<td><div class="cell">Key数量</div></td>
|
||||
<td><div class="cell" v-if="cache.dbSize">{{ cache.dbSize }} </div></td>
|
||||
<td><div class="cell">网络入口/出口</div></td>
|
||||
<td><div class="cell" v-if="cache.info">{{ cache.info.instantaneous_input_kbps }}kps/{{cache.info.instantaneous_output_kbps}}kps</div></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="card-box">
|
||||
<el-card>
|
||||
<div slot="header"><span>命令统计</span></div>
|
||||
<div class="el-table el-table--enable-row-hover el-table--medium">
|
||||
<div ref="commandstats" style="height: 420px" />
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="card-box">
|
||||
<el-card>
|
||||
<div slot="header">
|
||||
<span>内存信息</span>
|
||||
</div>
|
||||
<div class="el-table el-table--enable-row-hover el-table--medium">
|
||||
<div ref="usedmemory" style="height: 420px" />
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getCache } from "@/api/monitor/cache";
|
||||
// import echarts from "echarts";
|
||||
|
||||
export default {
|
||||
name: "Server",
|
||||
data() {
|
||||
return {
|
||||
// 加载层信息
|
||||
loading: [],
|
||||
// 统计命令信息
|
||||
commandstats: null,
|
||||
// 使用内存
|
||||
usedmemory: null,
|
||||
// cache信息
|
||||
cache: [],
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
this.openLoading();
|
||||
},
|
||||
methods: {
|
||||
/** 查缓存询信息 */
|
||||
getList() {
|
||||
getCache().then((response) => {
|
||||
this.cache = response.data;
|
||||
this.loading.close();
|
||||
|
||||
this.commandstats = echarts.init(this.$refs.commandstats, "macarons");
|
||||
this.commandstats.setOption({
|
||||
tooltip: {
|
||||
trigger: "item",
|
||||
formatter: "{a} <br/>{b} : {c} ({d}%)",
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: "命令",
|
||||
type: "pie",
|
||||
roseType: "radius",
|
||||
radius: [15, 95],
|
||||
center: ["50%", "38%"],
|
||||
data: response.data.commandStats,
|
||||
animationEasing: "cubicInOut",
|
||||
animationDuration: 1000,
|
||||
},
|
||||
],
|
||||
});
|
||||
this.usedmemory = echarts.init(this.$refs.usedmemory, "macarons");
|
||||
this.usedmemory.setOption({
|
||||
tooltip: {
|
||||
formatter: "{b} <br/>{a} : {c}M",
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: "峰值",
|
||||
type: "gauge",
|
||||
detail: {
|
||||
formatter: "{value}M",
|
||||
},
|
||||
data: [
|
||||
{
|
||||
value: parseFloat(this.cache.info.used_memory_human),
|
||||
name: "内存消耗",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
},
|
||||
// 打开加载层
|
||||
openLoading() {
|
||||
this.loading = this.$loading({
|
||||
lock: true,
|
||||
text: "拼命读取中",
|
||||
spinner: "el-icon-loading",
|
||||
background: "rgba(0, 0, 0, 0.7)",
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@ -1,128 +0,0 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px">
|
||||
<el-form-item label="登录地址" prop="ipaddr">
|
||||
<el-input
|
||||
v-model="queryParams.ipaddr"
|
||||
placeholder="请输入登录地址"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户名称" prop="userName">
|
||||
<el-input
|
||||
v-model="queryParams.userName"
|
||||
placeholder="请输入用户名称"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="list.slice((pageNum-1)*pageSize,pageNum*pageSize)"
|
||||
style="width: 100%;"
|
||||
>
|
||||
<el-table-column label="序号" type="index" align="center">
|
||||
<template slot-scope="scope">
|
||||
<span>{{(pageNum - 1) * pageSize + scope.$index + 1}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="会话编号" align="center" prop="tokenId" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="登录名称" align="center" prop="userName" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="部门名称" align="center" prop="deptName" />
|
||||
<el-table-column label="主机" align="center" prop="ipaddr" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="登录地点" align="center" prop="loginLocation" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="浏览器" align="center" prop="browser" />
|
||||
<el-table-column label="操作系统" align="center" prop="os" />
|
||||
<el-table-column label="登录时间" align="center" prop="loginTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.loginTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleForceLogout(scope.row)"
|
||||
v-hasPermi="['monitor:online:forceLogout']"
|
||||
>强退</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-show="total>0" :total="total" :page.sync="pageNum" :limit.sync="pageSize" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { list, forceLogout } from "@/api/monitor/online";
|
||||
|
||||
export default {
|
||||
name: "Online",
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 表格数据
|
||||
list: [],
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
ipaddr: undefined,
|
||||
userName: undefined
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询登录日志列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
list(this.queryParams).then(response => {
|
||||
this.list = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 强退按钮操作 */
|
||||
handleForceLogout(row) {
|
||||
this.$confirm('是否确认强退名称为"' + row.userName + '"的数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(function() {
|
||||
return forceLogout(row.tokenId);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.msgSuccess("强退成功");
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
@ -38,7 +38,7 @@
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="30" align="center" />
|
||||
<el-table-column type="selection" width="50" align="center" />
|
||||
<el-table-column label="日志编号" align="center" prop="operId" />
|
||||
<el-table-column label="系统模块" align="center" prop="title" :show-overflow-tooltip="true"/>
|
||||
<!-- <el-table-column label="操作类型" align="center" prop="businessType" :formatter="typeFormat" /> -->
|
||||
@ -121,11 +121,10 @@ import {
|
||||
cleanOperlog,
|
||||
exportOperlog,
|
||||
} from "@/api/monitor/operlog";
|
||||
import template from "../../../../document/template.vue";
|
||||
import DateRangePicker from '@/components/DateRangePicker'
|
||||
|
||||
export default {
|
||||
components: { template ,DateRangePicker},
|
||||
components: { DateRangePicker},
|
||||
name: "Operlog",
|
||||
data() {
|
||||
return {
|
||||
|
||||
@ -71,8 +71,6 @@ export default {
|
||||
showSearch: true,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
useridx: undefined,
|
||||
name: undefined,
|
||||
},
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
@ -1,117 +0,0 @@
|
||||
<template>
|
||||
<!-- 导入表 -->
|
||||
<el-dialog title="导入表" :visible.sync="visible" width="800px" top="5vh" append-to-body>
|
||||
<el-form :model="queryParams" ref="queryForm" :inline="true">
|
||||
<el-form-item label="表名称" prop="tableName">
|
||||
<el-input
|
||||
v-model="queryParams.tableName"
|
||||
placeholder="请输入表名称"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="表描述" prop="tableComment">
|
||||
<el-input
|
||||
v-model="queryParams.tableComment"
|
||||
placeholder="请输入表描述"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-row>
|
||||
<el-table @row-click="clickRow" ref="table" :data="dbTableList" @selection-change="handleSelectionChange" height="260px">
|
||||
<el-table-column type="selection" width="55"></el-table-column>
|
||||
<el-table-column prop="tableName" label="表名称" :show-overflow-tooltip="true"></el-table-column>
|
||||
<el-table-column prop="tableComment" label="表描述" :show-overflow-tooltip="true"></el-table-column>
|
||||
<el-table-column prop="createTime" label="创建时间"></el-table-column>
|
||||
<el-table-column prop="updateTime" label="更新时间"></el-table-column>
|
||||
</el-table>
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</el-row>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="handleImportTable">确 定</el-button>
|
||||
<el-button @click="visible = false">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listDbTable, importTable } from "@/api/tool/gen";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
visible: false,
|
||||
// 选中数组值
|
||||
tables: [],
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 表数据
|
||||
dbTableList: [],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
tableName: undefined,
|
||||
tableComment: undefined
|
||||
}
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
// 显示弹框
|
||||
show() {
|
||||
this.getList();
|
||||
this.visible = true;
|
||||
},
|
||||
clickRow(row) {
|
||||
this.$refs.table.toggleRowSelection(row);
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.tables = selection.map(item => item.tableName);
|
||||
},
|
||||
// 查询表数据
|
||||
getList() {
|
||||
listDbTable(this.queryParams).then(res => {
|
||||
if (res.code === 200) {
|
||||
this.dbTableList = res.rows;
|
||||
this.total = res.total;
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 导入按钮操作 */
|
||||
handleImportTable() {
|
||||
importTable({ tables: this.tables.join(",") }).then(res => {
|
||||
this.msgSuccess(res.msg);
|
||||
if (res.code === 200) {
|
||||
this.visible = false;
|
||||
this.$emit("ok");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
288
ZR.Vue/src/views/tool/gen/index.vue
Normal file
288
ZR.Vue/src/views/tool/gen/index.vue
Normal file
@ -0,0 +1,288 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
|
||||
<el-form ref="codeform" :inline="true" :rules="rules" :model="codeform" size="small">
|
||||
<el-form-item label="数据库" prop="dbName">
|
||||
<el-select v-model="codeform.dbName" clearable placeholder="请选择" @change="handleShowTable">
|
||||
<el-option v-for="item in selectedDataBase" :key="item" :label="item" :value="item" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="表名">
|
||||
<el-input v-model="codeform.tableName" clearable placeholder="输入要查询的表名" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="项目命名空间:" prop="baseSpace">
|
||||
<el-tooltip class="item" effect="dark" content="系统会根据项目命名空间自动生成IService、Service、Models等子命名空间" placement="bottom">
|
||||
<el-input v-model="codeform.baseSpace" clearable placeholder="如Zr" />
|
||||
</el-tooltip>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="去掉表名前缀:">
|
||||
<el-tooltip class="item" effect="dark" content="表名直接变为类名,去掉表名前缀。" placement="bottom">
|
||||
<el-input v-model="codeform.replaceTableNameStr" clearable width="300" placeholder="例如:sys_" />
|
||||
</el-tooltip>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="handleSearch()">查询</el-button>
|
||||
<el-button type="default" icon="el-icon-refresh" size="small" @click="loadTableData()">刷新</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-table ref="gridtable" v-loading="tableloading" :data="tableData" border stripe highlight-current-row height="500px" style="width: 100%;">
|
||||
<el-table-column prop="name" label="表名" sortable="custom" width="380" />
|
||||
<el-table-column prop="description" label="表描述" />
|
||||
<el-table-column label="操作" align="center" width="200">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" icon="el-icon-view" @click="handlePreview()">预览</el-button>
|
||||
<el-button type="text" icon="el-icon-download" @click="handleShowDialog(scope.row)" v-hasPermi="['tool:gen:code']">生成代码</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination background :current-page="pagination.pageNum" :page-sizes="[5,10,20,50,100, 200, 300, 400]" :page-size="pagination.pagesize" layout="total, sizes, prev, pager, next, jumper" :total="pagination.pageTotal" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
|
||||
|
||||
<el-dialog :visible.sync="showGenerate" title="代码生成" width="800px">
|
||||
<el-form ref="codeGenerateForm" label-width="140px">
|
||||
<el-form-item label="要生成的文件">
|
||||
<el-checkbox-group v-model="checkedCodeGenerateForm">
|
||||
<el-checkbox :label="1">生成Model</el-checkbox>
|
||||
<el-checkbox :label="2">生成Dto</el-checkbox>
|
||||
<el-checkbox :label="3">生成Repository</el-checkbox>
|
||||
<el-checkbox :label="4">生成Service</el-checkbox>
|
||||
<el-checkbox :label="5">生成Controller</el-checkbox>
|
||||
<el-checkbox :label="6">生成Views和api</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="是否覆盖生成">
|
||||
<el-radio v-model="coverd" :label="true">是</el-radio>
|
||||
<el-radio v-model="coverd" :label="false">否</el-radio>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="生成查询的列">
|
||||
<el-table :data="columnData" height="300px">
|
||||
<el-table-column type="selection" width="60" />
|
||||
<el-table-column label="字段列名" prop="dbColumnName" />
|
||||
<el-table-column label="字段描述" prop="columnDescription">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.columnDescription" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="表数据类型" prop="dataType" />
|
||||
<el-table-column label="C#类型">
|
||||
<template slot-scope="scope">
|
||||
<el-select v-model="scope.row.dataType">
|
||||
<el-option value="int">int</el-option>
|
||||
<el-option value="bigint">bigint</el-option>
|
||||
<el-option value="varchar">varchar</el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="显示类型">
|
||||
<el-select v-model="selectType">
|
||||
<el-option value="input">文本框</el-option>
|
||||
<el-option value="textArea">文本域</el-option>
|
||||
<el-option value="select">下拉框</el-option>
|
||||
<el-option value="radio">单选框</el-option>
|
||||
<el-option value="datetime">日期控件</el-option>
|
||||
<el-option value="upload">图片上传</el-option>
|
||||
<el-option value="fileUpload">文件上传</el-option>
|
||||
</el-select>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-form-item> -->
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="handleGenerate">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
// createGetDBConn,
|
||||
codeGetDBList,
|
||||
codeGetTableList,
|
||||
codeGenerator,
|
||||
queryColumnInfo,
|
||||
} from "@/api/tool/gen";
|
||||
// import { downloadFile } from "@/utils/index";
|
||||
import { Loading } from "element-ui";
|
||||
|
||||
export default {
|
||||
name: "CodeGenerator",
|
||||
data() {
|
||||
return {
|
||||
codeform: {
|
||||
dbName: "",
|
||||
tableName: "",
|
||||
baseSpace: "",
|
||||
replaceTableNameStr: "",
|
||||
},
|
||||
showGenerate: false,
|
||||
checkedCodeGenerateForm: [1, 2, 3, 4, 5, 6],
|
||||
rules: {
|
||||
dbName: [
|
||||
{ required: true, message: "请选择数据库名称", trigger: "blur" },
|
||||
],
|
||||
replaceTableNameStr: [
|
||||
{ min: 0, max: 50, message: "长度小于50个字符", trigger: "blur" },
|
||||
],
|
||||
},
|
||||
tableData: [],
|
||||
tableloading: false,
|
||||
pagination: {
|
||||
pageNum: 1,
|
||||
pagesize: 20,
|
||||
pageTotal: 0,
|
||||
},
|
||||
// 选中行的表
|
||||
currentSelected: {},
|
||||
selectedDataBase: [],
|
||||
// 列信息
|
||||
columnData: [],
|
||||
// 选中的列
|
||||
checkedQueryColumn: [],
|
||||
//是否覆盖原先代码
|
||||
coverd: true,
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.pagination.pageNum = 1;
|
||||
this.loadData();
|
||||
this.loadTableData();
|
||||
},
|
||||
methods: {
|
||||
loadData() {
|
||||
codeGetDBList().then((res) => {
|
||||
const { dbList, defaultDb } = res.data;
|
||||
this.codeform.dbName = defaultDb;
|
||||
this.selectedDataBase = dbList;
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 加载页面table数据
|
||||
*/
|
||||
loadTableData() {
|
||||
if (this.codeform.dbName !== "") {
|
||||
this.tableloading = true;
|
||||
var seachdata = {
|
||||
pageNum: this.pagination.pageNum,
|
||||
PageSize: this.pagination.pagesize,
|
||||
tableName: this.codeform.tableName,
|
||||
dbName: this.codeform.dbName,
|
||||
};
|
||||
codeGetTableList(seachdata).then((res) => {
|
||||
this.tableData = res.data.result;
|
||||
this.pagination.pageTotal = res.data.totalNum;
|
||||
this.tableloading = false;
|
||||
});
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 点击查询
|
||||
*/
|
||||
handleSearch() {
|
||||
this.$refs["codeform"].validate((valid) => {
|
||||
if (valid) {
|
||||
this.tableloading = true;
|
||||
this.pagination.pageNum = 1;
|
||||
this.loadTableData();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
handleShowTable() {
|
||||
this.pagination.pageNum = 1;
|
||||
this.loadTableData();
|
||||
},
|
||||
handlePreview() {
|
||||
this.msgError("敬请期待");
|
||||
},
|
||||
handleShowDialog(row) {
|
||||
this.showGenerate = true;
|
||||
this.currentSelected = row;
|
||||
|
||||
queryColumnInfo({
|
||||
dbName: this.codeform.dbName,
|
||||
tableName: row.name,
|
||||
}).then((res) => {
|
||||
if (res.code === 200) {
|
||||
const columnData = res.data;
|
||||
this.columnData = columnData;
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 点击生成服务端代码
|
||||
*/
|
||||
handleGenerate: async function () {
|
||||
console.log(JSON.stringify(this.currentSelected));
|
||||
if (!this.currentSelected) {
|
||||
this.msgError("请先选择要生成代码的数据表");
|
||||
return false;
|
||||
}
|
||||
this.$refs["codeform"].validate((valid) => {
|
||||
if (valid) {
|
||||
var loadop = {
|
||||
lock: true,
|
||||
text: "正在生成代码...",
|
||||
spinner: "el-icon-loading",
|
||||
background: "rgba(0, 0, 0, 0.7)",
|
||||
};
|
||||
const pageLoading = Loading.service(loadop);
|
||||
|
||||
var seachdata = {
|
||||
dbName: this.codeform.dbName,
|
||||
tableName: this.currentSelected.name,
|
||||
baseSpace: this.codeform.baseSpace,
|
||||
replaceTableNameStr: this.codeform.replaceTableNameStr,
|
||||
genFiles: this.checkedCodeGenerateForm,
|
||||
coverd: this.coverd,
|
||||
queryColumn: this.checkedQueryColumn,
|
||||
};
|
||||
console.log(JSON.stringify(seachdata));
|
||||
|
||||
codeGenerator(seachdata)
|
||||
.then((res) => {
|
||||
if (res.code == 200) {
|
||||
// downloadFile(
|
||||
// defaultSettings.fileUrl + res.ResData[0],
|
||||
// res.ResData[1]
|
||||
// );
|
||||
this.showGenerate = false;
|
||||
this.msgSuccess("恭喜你,代码生成完成!");
|
||||
} else {
|
||||
this.msgError(res.msg);
|
||||
}
|
||||
pageLoading.close();
|
||||
})
|
||||
.catch((erre) => {
|
||||
pageLoading.close();
|
||||
});
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 选择每页显示数量
|
||||
*/
|
||||
handleSizeChange(val) {
|
||||
this.pagination.pagesize = val;
|
||||
this.pagination.pageNum = 1;
|
||||
this.loadTableData();
|
||||
},
|
||||
/**
|
||||
* 选择当页面
|
||||
*/
|
||||
handleCurrentChange(val) {
|
||||
this.pagination.pageNum = val;
|
||||
this.loadTableData();
|
||||
},
|
||||
cancel() {
|
||||
this.showGenerate = false;
|
||||
this.currentSelected = {};
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
35
ZRAdmin.xml
35
ZRAdmin.xml
@ -27,6 +27,41 @@
|
||||
<param name="data"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:ZR.Admin.WebApi.Controllers.CodeGeneratorController">
|
||||
<summary>
|
||||
代码生成
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:ZR.Admin.WebApi.Controllers.CodeGeneratorController.GetListDataBase">
|
||||
<summary>
|
||||
获取所有数据库的信息
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:ZR.Admin.WebApi.Controllers.CodeGeneratorController.FindListTable(System.String,System.String,ZR.Model.PagerInfo)">
|
||||
<summary>
|
||||
获取所有表根据数据名
|
||||
</summary>
|
||||
<param name="dbName">数据库名</param>
|
||||
<param name="tableName">表名</param>
|
||||
<param name="pager">分页信息</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:ZR.Admin.WebApi.Controllers.CodeGeneratorController.QueryColumnInfo(System.String,System.String)">
|
||||
<summary>
|
||||
获取表格列
|
||||
</summary>
|
||||
<param name="dbName"></param>
|
||||
<param name="tableName"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:ZR.Admin.WebApi.Controllers.CodeGeneratorController.Generate(ZR.CodeGenerator.Model.GenerateDto)">
|
||||
<summary>
|
||||
代码生成器
|
||||
</summary>
|
||||
<param name="dto">数据传输对象</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:ZR.Admin.WebApi.Controllers.HomeController.Health">
|
||||
<summary>
|
||||
心跳
|
||||
|
||||
Binary file not shown.
BIN
document/images/11.png
Normal file
BIN
document/images/11.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 110 KiB |
BIN
document/images/12.png
Normal file
BIN
document/images/12.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 101 KiB |
BIN
document/images/13.png
Normal file
BIN
document/images/13.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 92 KiB |
BIN
document/images/14.png
Normal file
BIN
document/images/14.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 27 KiB |
@ -236,73 +236,91 @@ CREATE TABLE `sys_menu` (
|
||||
-- ----------------------------
|
||||
-- Records of sys_menu
|
||||
-- ----------------------------
|
||||
INSERT INTO `sys_menu` VALUES (1, '系统管理', 0, 2, 'system', NULL, 0, 0, 'M', '0', '0', '', 'system', 'admin', '2020-11-26 11:53:26', 'admin', '2021-07-13 15:47:55', '系统管理目录');
|
||||
INSERT INTO `sys_menu` VALUES (2, '系统监控', 0, 3, 'monitor', NULL, 0, 0, 'M', '0', '0', '', 'monitor', 'admin', '2020-11-26 11:53:26', '', NULL, '系统监控目录');
|
||||
INSERT INTO `sys_menu` VALUES (3, '系统工具', 0, 6, 'tool', NULL, 0, 0, 'M', '0', '0', '', 'tool', 'admin', '2020-11-26 11:53:26', 'admin', '2021-08-17 17:35:10', '系统工具目录');
|
||||
INSERT INTO `sys_menu` VALUES (4, '外部打开', 0, 1, 'http://www.izhaorui.cn', NULL, 1, 0, 'M', '0', '0', '', 'link', 'admin', '2020-11-26 11:53:26', 'admin', '2021-08-23 14:04:22', '若依官网地址');
|
||||
INSERT INTO `sys_menu` VALUES (100, '用户管理', 1, 2, 'user', 'system/user/index', 0, 0, 'C', '0', '0', 'system:user:list', 'user', 'admin', '2020-11-26 11:53:26', '', NULL, '用户管理菜单');
|
||||
INSERT INTO `sys_menu` VALUES (101, '权限管理', 1, 2, 'role', 'system/role/index', 0, 0, 'C', '0', '0', 'system:role:list', 'peoples', 'admin', '2020-11-26 11:53:26', 'admin', '2021-07-12 16:06:03', '角色管理菜单');
|
||||
INSERT INTO `sys_menu` VALUES (102, '菜单管理', 1, 3, 'menu', 'system/menu/index', 0, 0, 'C', '0', '0', 'system:menu:list', 'tree-table', 'admin', '2020-11-26 11:53:26', '', NULL, '菜单管理菜单');
|
||||
INSERT INTO `sys_menu` VALUES (103, '部门管理', 1, 4, 'dept', 'system/dept/index', 0, 0, 'C', '0', '0', 'system:dept:list', 'tree', 'admin', '2021-04-20 20:51:29', 'admin', '2021-07-07 14:04:49', '部门管理菜单');
|
||||
INSERT INTO `sys_menu` VALUES (104, '岗位管理', 1, 5, 'post', 'system/post/index', 0, 0, 'C', '0', '0', 'system:post:list', 'post', 'admin', '2021-04-20 20:51:29', 'admin', '2021-07-07 14:09:19', '岗位管理菜单');
|
||||
INSERT INTO `sys_menu` VALUES (108, '日志管理', 1, 9, 'log', '', 0, 0, 'M', '0', '0', '', 'log', 'admin', '2020-11-26 11:53:26', '', NULL, '日志管理菜单');
|
||||
INSERT INTO `sys_menu` VALUES (110, '定时任务', 2, 1, 'job', 'monitor/job/index', 0, 0, 'C', '0', '0', '', 'job', 'admin', '2020-11-26 11:53:27', 'admin', '2021-08-10 18:26:15', '定时任务菜单');
|
||||
INSERT INTO `sys_menu` VALUES (112, '服务监控', 2, 4, 'server', 'monitor/server/index', 0, 0, 'C', '0', '0', 'monitor:server:list', 'server', 'admin', '2020-11-26 11:53:27', '', '2021-04-20 19:53:22', '服务监控菜单');
|
||||
INSERT INTO `sys_menu` VALUES (113, '缓存监控', 2, 5, 'cache', 'monitor/cache/index', 0, 0, 'C', '1', '1', 'monitor:cache:list', 'redis', 'admin', '2020-11-26 11:53:27', '', '2021-04-20 19:53:30', '缓存监控菜单');
|
||||
INSERT INTO `sys_menu` VALUES (114, '表单构建', 3, 1, 'build', 'tool/build/index', 0, 0, 'C', '0', '0', 'tool:build:list', 'build', 'admin', '2020-11-26 11:53:27', '', NULL, '表单构建菜单');
|
||||
INSERT INTO `sys_menu` VALUES (116, '系统接口', 3, 3, 'swagger', 'tool/swagger/index', 0, 0, 'C', '0', '0', 'tool:swagger:list', 'swagger', 'admin', '2020-11-26 11:53:27', '', NULL, '系统接口菜单');
|
||||
INSERT INTO `sys_menu` VALUES (500, '操作日志', 108, 1, 'operlog', 'monitor/operlog/index', 0, 0, 'C', '0', '0', 'monitor:operlog:list', 'form', 'admin', '2020-11-26 11:53:27', '', NULL, '操作日志菜单');
|
||||
INSERT INTO `sys_menu` VALUES (501, '登录日志', 108, 2, 'logininfor', 'monitor/logininfor/index', 0, 0, 'C', '0', '0', 'monitor:logininfor:list', 'logininfor', 'admin', '2020-11-26 11:53:27', '', NULL, '登录日志菜单');
|
||||
INSERT INTO `sys_menu` VALUES (1005, '用户导出', 100, 5, '', '', 0, 0, 'F', '0', '0', 'system:user:export', '#', 'admin', '2021-03-01 18:21:35', '', NULL, '');
|
||||
INSERT INTO `sys_menu` VALUES (1006, '用户导入', 100, 6, '', '', 0, 0, 'F', '0', '0', 'system:user:import', '#', 'admin', '2021-03-01 18:21:36', '', NULL, '');
|
||||
INSERT INTO `sys_menu` VALUES (1007, '重置密码', 100, 7, '', '', 0, 0, 'F', '0', '0', 'system:user:resetPwd', '#', 'admin', '2021-03-01 18:21:36', '', NULL, '');
|
||||
INSERT INTO `sys_menu` VALUES (1008, '角色查询', 101, 1, '', '', 0, 0, 'F', '0', '0', 'system:role:query', '#', 'admin', '2021-03-01 18:22:24', 'admin', '2021-07-07 14:27:17', '');
|
||||
INSERT INTO `sys_menu` VALUES (1009, '角色新增', 101, 2, '', '', 0, 0, 'F', '0', '0', 'system:role:add', '#', 'admin', '2021-03-01 18:22:24', '', NULL, '');
|
||||
INSERT INTO `sys_menu` VALUES (1010, '角色修改', 101, 3, '', '', 0, 0, 'F', '0', '0', 'system:role:edit', '#', 'admin', '2021-03-01 18:22:24', '', NULL, '');
|
||||
INSERT INTO `sys_menu` VALUES (1011, '角色删除', 101, 4, '', '', 0, 0, 'F', '0', '0', 'system:role:remove', '#', 'admin', '2021-03-01 18:22:24', '', NULL, '');
|
||||
INSERT INTO `sys_menu` VALUES (1012, '角色导出', 101, 5, '', '', 0, 0, 'F', '0', '0', 'system:role:export', '#', 'admin', '2021-03-01 18:22:24', '', NULL, '');
|
||||
INSERT INTO `sys_menu` VALUES (1013, '菜单查询', 102, 1, '', '', 0, 0, 'F', '0', '0', 'system:menu:query', '#', 'admin', '2021-03-01 18:22:24', '', NULL, '');
|
||||
INSERT INTO `sys_menu` VALUES (1014, '菜单新增', 102, 2, '', '', 0, 0, 'F', '0', '0', 'system:menu:add', '#', 'admin', '2021-03-01 18:22:24', '', NULL, '');
|
||||
INSERT INTO `sys_menu` VALUES (1015, '菜单修改', 102, 3, '', '', 0, 0, 'F', '0', '0', 'system:menu:edit', '#', 'admin', '2021-03-01 18:22:24', '', NULL, '');
|
||||
INSERT INTO `sys_menu` VALUES (1016, '菜单删除', 102, 4, '', '', 0, 0, 'F', '0', '0', 'system:menu:remove', '#', 'admin', '2021-03-01 18:22:24', '', NULL, '');
|
||||
INSERT INTO `sys_menu` VALUES (2013, '控制台', 0, 0, 'dashboard', 'index_v1', 0, 0, 'C', '0', '0', '', 'dashboard', '', '2021-01-08 17:47:35', 'admin', '2021-08-16 14:31:11', '');
|
||||
INSERT INTO `sys_menu` VALUES (2018, '用户添加', 100, 2, '#', NULL, 0, 0, 'F', '0', '0', 'system:user:add', '', '', '2021-02-24 10:30:37', '', NULL, '');
|
||||
INSERT INTO `sys_menu` VALUES (2019, '用户查询', 100, 1, '#', NULL, 0, 0, 'F', '0', '0', 'system:user:query', '', '', '2021-02-24 10:31:33', '', NULL, '');
|
||||
INSERT INTO `sys_menu` VALUES (2020, '用户删除', 100, 4, '#', NULL, 0, 0, 'F', '0', '0', 'system:user:delete', '', '', '2021-02-24 10:32:01', '', NULL, '');
|
||||
INSERT INTO `sys_menu` VALUES (2021, '字典管理', 1, 5, 'dict', 'system/dict/index', 0, 0, 'C', '0', '0', 'system:dict:list', 'dict', '', '2021-02-24 10:37:50', 'admin', '2021-07-07 13:57:59', '');
|
||||
INSERT INTO `sys_menu` VALUES (2029, '分配用户', 1, 3, 'roleusers', 'system/roleusers/index', 0, 0, 'C', '0', '0', 'system:role:list', 'people', 'admin', '2021-04-04 18:44:25', 'admin', '2021-07-13 15:39:01', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (2030, '修改排序', 102, 999, '#', NULL, 0, 0, 'F', '0', '0', 'system:menu:changeSort', '', 'admin', '2021-06-30 17:05:08', 'admin', '2021-06-30 17:07:06', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (2031, '新增用户', 2029, 1, '#', NULL, 0, 0, 'F', '0', '0', 'system:roleusers:add', NULL, 'admin', '2021-06-30 17:08:12', '', NULL, NULL);
|
||||
INSERT INTO `sys_menu` VALUES (2032, '删除用户', 2029, 2, '#', NULL, 0, 0, 'F', '0', '0', 'system:roleusers:del', NULL, 'admin', '2021-06-30 17:08:48', '', NULL, NULL);
|
||||
INSERT INTO `sys_menu` VALUES (2033, '新增', 110, 2, '#', NULL, 0, 0, 'F', '0', '0', 'system:task:add', '', 'admin', '2021-07-02 21:02:06', 'admin', '2021-07-02 21:50:05', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (2034, '删除', 110, 2, '#', NULL, 0, 0, 'F', '0', '0', 'system:task:delete', '', 'admin', '2021-07-02 21:02:42', 'admin', '2021-07-02 21:49:57', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (2035, '修改', 110, 3, '#', NULL, 0, 0, 'F', '0', '0', 'system:task:edit', '', 'admin', '2021-07-02 21:03:09', 'admin', '2021-07-02 21:49:53', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (2036, '启动', 110, 4, '#', NULL, 0, 0, 'F', '0', '0', 'system:task:start', '', 'admin', '2021-07-02 21:03:48', 'admin', '2021-07-02 21:49:49', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (2037, '查询', 110, 1, '#', NULL, 0, 0, 'F', '0', '0', 'system:task:list', '', 'admin', '2021-07-02 21:06:36', 'admin', '2021-07-02 21:50:10', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (2038, '运行', 110, 5, '#', NULL, 0, 0, 'F', '0', '0', 'system:task:run', NULL, 'admin', '2021-07-02 21:49:39', '', NULL, NULL);
|
||||
INSERT INTO `sys_menu` VALUES (2039, '停止', 110, 4, '#', NULL, 0, 0, 'F', '0', '0', 'system:task:stop', NULL, 'admin', '2021-07-02 21:51:18', '', NULL, NULL);
|
||||
INSERT INTO `sys_menu` VALUES (2040, '查询', 103, 1, '#', NULL, 0, 0, 'F', '0', '0', 'system:dept:query', '', 'admin', '2021-07-05 17:16:52', 'admin', '2021-07-07 14:06:24', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (2041, '新增', 103, 2, '#', NULL, 0, 0, 'F', '0', '0', 'system:dept:add', NULL, 'admin', '2021-07-05 17:17:26', '', NULL, NULL);
|
||||
INSERT INTO `sys_menu` VALUES (2042, '修改', 103, 3, '#', NULL, 0, 0, 'F', '0', '0', 'system:dept:update', NULL, 'admin', '2021-07-05 17:17:49', '', NULL, NULL);
|
||||
INSERT INTO `sys_menu` VALUES (2043, '删除', 103, 4, '#', NULL, 0, 0, 'F', '0', '0', 'system:dept:remove', NULL, 'admin', '2021-07-05 17:18:15', '', NULL, NULL);
|
||||
INSERT INTO `sys_menu` VALUES (2044, '查询', 104, 1, '#', NULL, 0, 0, 'F', '0', '0', 'system:post:list', NULL, 'admin', '2021-07-05 17:20:52', '', NULL, NULL);
|
||||
INSERT INTO `sys_menu` VALUES (2045, '添加', 104, 2, '#', NULL, 0, 0, 'F', '0', '0', 'system:post:add', NULL, 'admin', '2021-07-05 17:21:26', '', NULL, NULL);
|
||||
INSERT INTO `sys_menu` VALUES (2046, '岗位删除', 104, 3, '#', NULL, 0, 0, 'F', '0', '0', 'system:post:remove', NULL, 'admin', '2021-07-05 17:21:48', '', NULL, NULL);
|
||||
INSERT INTO `sys_menu` VALUES (2047, '岗位编辑', 104, 4, '#', NULL, 0, 0, 'F', '0', '0', 'system:post:edit', '', 'admin', '2021-07-05 17:27:25', 'admin', '2021-07-07 14:28:45', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (2048, '删除日志', 500, 1, '#', NULL, 0, 0, 'F', '0', '0', 'monitor:operlog:remove', NULL, 'admin', '2021-07-07 13:44:46', '', NULL, NULL);
|
||||
INSERT INTO `sys_menu` VALUES (2049, '删除日志', 501, 1, '#', NULL, 0, 0, 'F', '0', '0', 'monitor:logininfor:remove', '', 'admin', '2021-07-07 13:45:34', 'admin', '2021-07-07 13:45:52', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (2050, '新增', 2021, 1, '#', NULL, 0, 0, 'F', '0', '0', 'system:dict:add', NULL, 'admin', '2021-07-07 13:47:51', '', NULL, NULL);
|
||||
INSERT INTO `sys_menu` VALUES (2051, '修改', 2021, 2, '#', NULL, 0, 0, 'F', '0', '0', 'system:dict:edit', NULL, 'admin', '2021-07-07 13:48:11', '', NULL, NULL);
|
||||
INSERT INTO `sys_menu` VALUES (2052, '删除', 2021, 3, '#', NULL, 0, 0, 'F', '0', '0', 'system:dict:remove', NULL, 'admin', '2021-07-07 13:48:28', '', NULL, NULL);
|
||||
INSERT INTO `sys_menu` VALUES (2053, '查询', 2029, 3, '#', NULL, 0, 0, 'F', '0', '0', 'system:roleusers:query', '', 'admin', '2021-07-07 13:57:02', 'admin', '2021-07-07 13:57:21', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (2054, '用户修改', 100, 3, '#', NULL, 0, 0, 'F', '0', '0', 'system:user:edit', '', 'admin', '2021-07-07 14:19:33', 'admin', '2021-07-07 14:21:32', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (2055, '文章管理', 0, 4, 'article', NULL, 0, 0, 'M', '0', '0', NULL, 'documentation', 'admin', '2021-08-10 16:07:24', 'admin', '2021-08-17 18:32:43', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (2056, '创建文章', 2055, 999, 'publish', 'article/publish', 0, 0, 'C', '1', '0', 'system:article:publish', 'log', 'admin', '2021-08-10 16:09:40', 'admin', '2021-08-18 18:18:33', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (2057, '文章列表', 2055, 999, 'manager', 'article/manager', 0, 0, 'C', '0', '0', 'system:article:list', 'documentation', 'admin', '2021-08-10 16:18:39', 'admin', '2021-08-17 18:32:57', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (2060, '任务日志', 2, 2, '/job/log', 'monitor/job/log', 0, 0, 'C', '0', '0', NULL, 'log', 'admin', '2021-08-10 18:24:23', 'admin', '2021-08-10 18:27:59', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (2062, '新增', 2057, 1, '#', NULL, 0, 0, 'F', '0', '0', 'system:article:add', '', 'admin', '2021-08-18 17:27:18', 'admin', '2021-08-18 17:31:13', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (2063, '修改', 2057, 2, '#', NULL, 0, 0, 'F', '0', '0', 'system:article:update', '', 'admin', '2021-08-18 17:35:55', '', NULL, NULL);
|
||||
INSERT INTO `sys_menu` VALUES (2064, '删除', 2057, 3, '#', NULL, 0, 0, 'F', '0', '0', 'system:article:delete', '', 'admin', '2021-08-18 17:36:17', '', NULL, NULL);
|
||||
-- 一级菜单
|
||||
INSERT INTO sys_menu VALUES (1, '系统管理', 0, 1, 'system', NULL, 0, 0, 'M', '0', '0', '', 'system', '', SYSDATE(), '', NULL, '系统管理目录');
|
||||
INSERT INTO sys_menu VALUES (2, '系统监控', 0, 2, 'monitor', NULL, 0, 0, 'M', '0', '0', '', 'monitor', '', SYSDATE(), '', NULL, '系统监控目录');
|
||||
INSERT INTO sys_menu VALUES (3, '系统工具', 0, 3, 'tool', NULL, 0, 0, 'M', '0', '0', '', 'tool', '', SYSDATE(), '', NULL, '系统工具目录');
|
||||
INSERT INTO sys_menu VALUES (5, '文章管理', 0, 4, 'article', NULL, 0, 0, 'M', '0', '0', NULL, 'documentation', '', SYSDATE(), '', NULL, NULL);
|
||||
INSERT INTO sys_menu VALUES (4, '外部打开', 0, 5, 'http://www.izhaorui.cn', NULL, 1, 0, 'M', '0', '0', '', 'link', '', SYSDATE(), '', NULL, 'Zr官网地址');
|
||||
|
||||
-- 一级菜单 系统管理
|
||||
INSERT INTO sys_menu VALUES (100, '用户管理', 1, 2, 'user', 'system/user/index', 0, 0, 'C', '0', '0', 'system:user:list', 'user', '', SYSDATE(), '', NULL, '用户管理菜单');
|
||||
INSERT INTO sys_menu VALUES (101, '权限管理', 1, 2, 'role', 'system/role/index', 0, 0, 'C', '0', '0', 'system:role:list', 'peoples', '', SYSDATE(), '', NULL, '角色管理菜单');
|
||||
INSERT INTO sys_menu VALUES (102, '菜单管理', 1, 3, 'menu', 'system/menu/index', 0, 0, 'C', '0', '0', 'system:menu:list', 'tree-table', '', SYSDATE(), '', NULL, '菜单管理菜单');
|
||||
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 (108, '日志管理', 1, 9, 'log', '', 0, 0, 'M', '0', '0', '', 'log', '', SYSDATE(), '', NULL, '日志管理菜单');
|
||||
INSERT INTO sys_menu VALUES (105, '字典管理', 1, 5, 'dict', 'system/dict/index', 0, 0, 'C', '0', '0', 'system:dict:list', 'dict', '', SYSDATE(), '', NULL, '');
|
||||
INSERT INTO sys_menu VALUES (106, '分配用户', 1, 3, 'roleusers', 'system/roleusers/index', 0, 0, 'C', '0', '0', 'system:role:list', 'people', '', SYSDATE(), '', NULL, NULL);
|
||||
|
||||
-- 一级菜单 系统工具
|
||||
INSERT INTO sys_menu VALUES (114, '表单构建', 3, 1, 'build', 'tool/build/index', 0, 0, 'C', '0', '0', 'tool:build:list', 'build', '', SYSDATE(), '', NULL, '表单构建菜单');
|
||||
INSERT INTO sys_menu VALUES (115, '代码生成', 3, 1, 'gen', 'tool/gen/index', 0, 0, 'C', '0', '0', 'tool:gen:list', 'code', '', SYSDATE(), '', NULL, '代码生成菜单');
|
||||
INSERT INTO sys_menu VALUES (116, '系统接口', 3, 3, 'swagger', 'tool/swagger/index', 0, 0, 'C', '0', '0', 'tool:swagger:list', 'swagger', '', SYSDATE(), '', NULL, '系统接口菜单');
|
||||
|
||||
-- 一级菜单 缓存监控
|
||||
INSERT INTO sys_menu VALUES (113, '缓存监控', 2, 5, 'cache', 'monitor/cache/index', 0, 0, 'C', '1', '1', 'monitor:cache:list', 'redis', '', SYSDATE(), '', NULL, '缓存监控菜单');
|
||||
|
||||
-- 日志管理
|
||||
INSERT INTO sys_menu VALUES (500, '操作日志', 108, 1, 'operlog', 'monitor/operlog/index', 0, 0, 'C', '0', '0', 'monitor:operlog:list', 'form', '', SYSDATE(), '', NULL, '操作日志菜单');
|
||||
INSERT INTO sys_menu VALUES (501, '登录日志', 108, 2, 'logininfor', 'monitor/logininfor/index', 0, 0, 'C', '0', '0', 'monitor:logininfor:list', 'logininfor', '', SYSDATE(), '', NULL, '登录日志菜单');
|
||||
|
||||
INSERT INTO sys_menu VALUES (110, '定时任务', 2, 1, 'job', 'monitor/job/index', 0, 0, 'C', '0', '0', '', 'job', '', SYSDATE(), '', NULL, '定时任务菜单');
|
||||
INSERT INTO sys_menu VALUES (112, '服务监控', 2, 4, 'server', 'monitor/server/index', 0, 0, 'C', '0', '0', 'monitor:server:list', 'server', '', SYSDATE(), '', NULL, '服务监控菜单');
|
||||
|
||||
|
||||
INSERT INTO sys_menu VALUES (1005, '用户导出', 100, 5, '', '', 0, 0, 'F', '0', '0', 'system:user:export', '#', '', SYSDATE(), '', NULL, '');
|
||||
INSERT INTO sys_menu VALUES (1006, '用户导入', 100, 6, '', '', 0, 0, 'F', '0', '0', 'system:user:import', '#', '', SYSDATE(), '', NULL, '');
|
||||
INSERT INTO sys_menu VALUES (1007, '重置密码', 100, 7, '', '', 0, 0, 'F', '0', '0', 'system:user:resetPwd', '#', '', SYSDATE(), '', NULL, '');
|
||||
INSERT INTO sys_menu VALUES (1008, '角色查询', 101, 1, '', '', 0, 0, 'F', '0', '0', 'system:role:query', '#', '', SYSDATE(), '', NULL, '');
|
||||
INSERT INTO sys_menu VALUES (1009, '角色新增', 101, 2, '', '', 0, 0, 'F', '0', '0', 'system:role:add', '#', '', SYSDATE(), '', NULL, '');
|
||||
INSERT INTO sys_menu VALUES (1010, '角色修改', 101, 3, '', '', 0, 0, 'F', '0', '0', 'system:role:edit', '#', '', SYSDATE(), '', NULL, '');
|
||||
INSERT INTO sys_menu VALUES (1011, '角色删除', 101, 4, '', '', 0, 0, 'F', '0', '0', 'system:role:remove', '#', '', SYSDATE(), '', NULL, '');
|
||||
INSERT INTO sys_menu VALUES (1012, '角色导出', 101, 5, '', '', 0, 0, 'F', '0', '0', 'system:role:export', '#', '', SYSDATE(), '', NULL, '');
|
||||
INSERT INTO sys_menu VALUES (1013, '菜单查询', 102, 1, '', '', 0, 0, 'F', '0', '0', 'system:menu:query', '#', '', SYSDATE(), '', NULL, '');
|
||||
INSERT INTO sys_menu VALUES (1014, '菜单新增', 102, 2, '', '', 0, 0, 'F', '0', '0', 'system:menu:add', '#', '', SYSDATE(), '', NULL, '');
|
||||
INSERT INTO sys_menu VALUES (1015, '菜单修改', 102, 3, '', '', 0, 0, 'F', '0', '0', 'system:menu:edit', '#', '', SYSDATE(), '', NULL, '');
|
||||
INSERT INTO sys_menu VALUES (1016, '菜单删除', 102, 4, '', '', 0, 0, 'F', '0', '0', 'system:menu:remove', '#', '', SYSDATE(), '', NULL, '');
|
||||
INSERT INTO sys_menu VALUES (2013, '控制台', 0, 0, 'dashboard', 'index_v1', 0, 0, 'C', '0', '0', '', 'dashboard', '', SYSDATE(), '', NULL, '');
|
||||
INSERT INTO sys_menu VALUES (2018, '用户添加', 100, 2, '#', NULL, 0, 0, 'F', '0', '0', 'system:user:add', '', '', SYSDATE(), '', NULL, '');
|
||||
INSERT INTO sys_menu VALUES (2019, '用户查询', 100, 1, '#', NULL, 0, 0, 'F', '0', '0', 'system:user:query', '', '', SYSDATE(), '', NULL, '');
|
||||
INSERT INTO sys_menu VALUES (2020, '用户删除', 100, 4, '#', NULL, 0, 0, 'F', '0', '0', 'system:user:delete', '', '', SYSDATE(), '', NULL, '');
|
||||
INSERT INTO sys_menu VALUES (2030, '修改排序', 102, 999, '#', NULL, 0, 0, 'F', '0', '0', 'system:menu:changeSort', '', '', SYSDATE(), '', NULL, NULL);
|
||||
-- 分配用户菜单 权限
|
||||
INSERT INTO sys_menu VALUES (2031, '新增用户', 106, 1, '#', NULL, 0, 0, 'F', '0', '0', 'system:roleusers:add', NULL, '', SYSDATE(), '', NULL, NULL);
|
||||
INSERT INTO sys_menu VALUES (2032, '删除用户', 106, 2, '#', NULL, 0, 0, 'F', '0', '0', 'system:roleusers:del', NULL, '', SYSDATE(), '', NULL, NULL);
|
||||
INSERT INTO sys_menu VALUES (2053, '查询', 106, 3, '#', NULL, 0, 0, 'F', '0', '0', 'system:roleusers:query', '', '', SYSDATE(), '', NULL, NULL);
|
||||
|
||||
INSERT INTO sys_menu VALUES (2033, '新增', 110, 2, '#', NULL, 0, 0, 'F', '0', '0', 'system:task:add', '', '', SYSDATE(), '', NULL, NULL);
|
||||
INSERT INTO sys_menu VALUES (2034, '删除', 110, 2, '#', NULL, 0, 0, 'F', '0', '0', 'system:task:delete', '', '', SYSDATE(), '', NULL, NULL);
|
||||
INSERT INTO sys_menu VALUES (2035, '修改', 110, 3, '#', NULL, 0, 0, 'F', '0', '0', 'system:task:edit', '', '', SYSDATE(), '', NULL, NULL);
|
||||
INSERT INTO sys_menu VALUES (2036, '启动', 110, 4, '#', NULL, 0, 0, 'F', '0', '0', 'system:task:start', '', '', SYSDATE(), '', NULL, NULL);
|
||||
INSERT INTO sys_menu VALUES (2037, '查询', 110, 1, '#', NULL, 0, 0, 'F', '0', '0', 'system:task:list', '', '', SYSDATE(), '', NULL, NULL);
|
||||
INSERT INTO sys_menu VALUES (2038, '运行', 110, 5, '#', NULL, 0, 0, 'F', '0', '0', 'system:task:run', NULL, '', SYSDATE(), '', NULL, NULL);
|
||||
INSERT INTO sys_menu VALUES (2039, '停止', 110, 4, '#', NULL, 0, 0, 'F', '0', '0', 'system:task:stop', NULL, '', SYSDATE(), '', NULL, NULL);
|
||||
INSERT INTO sys_menu VALUES (2040, '查询', 103, 1, '#', NULL, 0, 0, 'F', '0', '0', 'system:dept:query', '', '', SYSDATE(), '', NULL, NULL);
|
||||
INSERT INTO sys_menu VALUES (2041, '新增', 103, 2, '#', NULL, 0, 0, 'F', '0', '0', 'system:dept:add', NULL, '', SYSDATE(), '', NULL, NULL);
|
||||
INSERT INTO sys_menu VALUES (2042, '修改', 103, 3, '#', NULL, 0, 0, 'F', '0', '0', 'system:dept:update', NULL, '', SYSDATE(), '', NULL, NULL);
|
||||
INSERT INTO sys_menu VALUES (2043, '删除', 103, 4, '#', NULL, 0, 0, 'F', '0', '0', 'system:dept:remove', NULL, '', SYSDATE(), '', NULL, NULL);
|
||||
INSERT INTO sys_menu VALUES (2044, '查询', 104, 1, '#', NULL, 0, 0, 'F', '0', '0', 'system:post:list', NULL, '', SYSDATE(), '', NULL, NULL);
|
||||
INSERT INTO sys_menu VALUES (2045, '添加', 104, 2, '#', NULL, 0, 0, 'F', '0', '0', 'system:post:add', NULL, '', SYSDATE(), '', NULL, NULL);
|
||||
INSERT INTO sys_menu VALUES (2046, '岗位删除', 104, 3, '#', NULL, 0, 0, 'F', '0', '0', 'system:post:remove', NULL, '', SYSDATE(), '', NULL, NULL);
|
||||
INSERT INTO sys_menu VALUES (2047, '岗位编辑', 104, 4, '#', NULL, 0, 0, 'F', '0', '0', 'system:post:edit', '', '', SYSDATE(), '', NULL, NULL);
|
||||
INSERT INTO sys_menu VALUES (2048, '删除日志', 500, 1, '#', NULL, 0, 0, 'F', '0', '0', 'monitor:operlog:remove', NULL, '', SYSDATE(), '', NULL, NULL);
|
||||
INSERT INTO sys_menu VALUES (2049, '删除日志', 501, 1, '#', NULL, 0, 0, 'F', '0', '0', 'monitor:logininfor:remove', '', '', SYSDATE(), '', NULL, NULL);
|
||||
-- 字典管理页面-权限
|
||||
INSERT INTO sys_menu VALUES (2050, '新增', 105, 1, '#', NULL, 0, 0, 'F', '0', '0', 'system:dict:add', NULL, '', SYSDATE(), '', NULL, NULL);
|
||||
INSERT INTO sys_menu VALUES (2051, '修改', 105, 2, '#', NULL, 0, 0, 'F', '0', '0', 'system:dict:edit', NULL, '', SYSDATE(), '', NULL, NULL);
|
||||
INSERT INTO sys_menu VALUES (2052, '删除', 105, 3, '#', NULL, 0, 0, 'F', '0', '0', 'system:dict:remove', NULL, '', SYSDATE(), '', NULL, NULL);
|
||||
|
||||
INSERT INTO sys_menu VALUES (2054, '用户修改', 100, 3, '#', NULL, 0, 0, 'F', '0', '0', 'system:user:edit', '', '', SYSDATE(), '', NULL, NULL);
|
||||
|
||||
INSERT INTO sys_menu VALUES (2056, '创建文章', 5, 999, 'publish', 'system/article/publish', 0, 0, 'C', '1', '0', 'system:article:publish', 'log', '', SYSDATE(), '', NULL, NULL);
|
||||
INSERT INTO sys_menu VALUES (2057, '文章列表', 5, 999, 'manager', 'system/article/manager', 0, 0, 'C', '0', '0', 'system:article:list', 'documentation', '', SYSDATE(), '', NULL, NULL);
|
||||
INSERT INTO sys_menu VALUES (2060, '任务日志', 2, 2, '/job/log', 'monitor/job/log', 0, 0, 'C', '0', '0', NULL, 'log', '', SYSDATE(), '', NULL, NULL);
|
||||
INSERT INTO sys_menu VALUES (2062, '新增', 2057, 1, '#', NULL, 0, 0, 'F', '0', '0', 'system:article:add', '', '', SYSDATE(), '', NULL, NULL);
|
||||
INSERT INTO sys_menu VALUES (2063, '修改', 2057, 2, '#', NULL, 0, 0, 'F', '0', '0', 'system:article:update', '', '', SYSDATE(), '', NULL, NULL);
|
||||
INSERT INTO sys_menu VALUES (2064, '删除', 2057, 3, '#', NULL, 0, 0, 'F', '0', '0', 'system:article:delete', '', '', SYSDATE(), '', NULL, NULL);
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
@ -425,8 +443,7 @@ CREATE TABLE `sys_role_menu` (
|
||||
-- ----------------------------
|
||||
-- Records of sys_role_menu
|
||||
-- ----------------------------
|
||||
INSERT INTO `sys_role_menu` VALUES (0, 2009, NULL, NULL);
|
||||
INSERT INTO `sys_role_menu` VALUES (0, 2012, NULL, NULL);
|
||||
|
||||
INSERT INTO `sys_role_menu` VALUES (2, 1, NULL, '2021-07-07 16:32:32');
|
||||
INSERT INTO `sys_role_menu` VALUES (2, 2, NULL, '2021-07-07 16:32:32');
|
||||
INSERT INTO `sys_role_menu` VALUES (2, 3, NULL, '2021-07-07 16:32:32');
|
||||
@ -436,6 +453,7 @@ INSERT INTO `sys_role_menu` VALUES (2, 101, NULL, '2021-07-07 16:32:32');
|
||||
INSERT INTO `sys_role_menu` VALUES (2, 102, NULL, '2021-07-07 16:32:32');
|
||||
INSERT INTO `sys_role_menu` VALUES (2, 103, NULL, '2021-07-07 16:32:32');
|
||||
INSERT INTO `sys_role_menu` VALUES (2, 104, NULL, '2021-07-07 16:32:32');
|
||||
INSERT INTO `sys_role_menu` VALUES (2, 106, NULL, '2021-07-07 16:32:32');
|
||||
INSERT INTO `sys_role_menu` VALUES (2, 108, NULL, '2021-07-07 16:32:32');
|
||||
INSERT INTO `sys_role_menu` VALUES (2, 110, NULL, '2021-07-07 16:32:32');
|
||||
INSERT INTO `sys_role_menu` VALUES (2, 112, NULL, '2021-07-07 16:32:32');
|
||||
@ -447,32 +465,16 @@ INSERT INTO `sys_role_menu` VALUES (2, 1008, NULL, '2021-07-07 16:32:32');
|
||||
INSERT INTO `sys_role_menu` VALUES (2, 1013, NULL, '2021-07-07 16:32:32');
|
||||
INSERT INTO `sys_role_menu` VALUES (2, 2013, NULL, '2021-07-07 16:32:32');
|
||||
INSERT INTO `sys_role_menu` VALUES (2, 2019, NULL, '2021-07-07 16:32:32');
|
||||
INSERT INTO `sys_role_menu` VALUES (2, 2029, NULL, '2021-07-07 16:32:32');
|
||||
INSERT INTO `sys_role_menu` VALUES (2, 2037, NULL, '2021-07-07 16:32:32');
|
||||
INSERT INTO `sys_role_menu` VALUES (2, 2040, NULL, '2021-07-07 16:32:32');
|
||||
INSERT INTO `sys_role_menu` VALUES (2, 2044, NULL, '2021-07-07 16:32:32');
|
||||
INSERT INTO `sys_role_menu` VALUES (2, 2053, NULL, '2021-07-07 16:32:32');
|
||||
INSERT INTO `sys_role_menu` VALUES (3, 2055, 'admin', '2021-08-23 14:32:06');
|
||||
|
||||
INSERT INTO `sys_role_menu` VALUES (3, 2056, 'admin', '2021-08-23 14:32:06');
|
||||
INSERT INTO `sys_role_menu` VALUES (3, 2057, 'admin', '2021-08-23 14:32:06');
|
||||
INSERT INTO `sys_role_menu` VALUES (3, 2062, 'admin', '2021-08-23 14:32:06');
|
||||
INSERT INTO `sys_role_menu` VALUES (3, 2063, 'admin', '2021-08-23 14:32:06');
|
||||
INSERT INTO `sys_role_menu` VALUES (3, 2064, 'admin', '2021-08-23 14:32:06');
|
||||
INSERT INTO `sys_role_menu` VALUES (112, 4, NULL, '2021-08-23 14:28:02');
|
||||
INSERT INTO `sys_role_menu` VALUES (116, 2, NULL, '2021-07-02 21:51:42');
|
||||
INSERT INTO `sys_role_menu` VALUES (116, 110, NULL, '2021-07-02 21:51:42');
|
||||
INSERT INTO `sys_role_menu` VALUES (116, 2006, NULL, '2021-07-02 21:51:42');
|
||||
INSERT INTO `sys_role_menu` VALUES (116, 2007, NULL, '2021-07-02 21:51:42');
|
||||
INSERT INTO `sys_role_menu` VALUES (116, 2009, NULL, '2021-07-02 21:51:42');
|
||||
INSERT INTO `sys_role_menu` VALUES (116, 2010, NULL, '2021-07-02 21:51:42');
|
||||
INSERT INTO `sys_role_menu` VALUES (116, 2011, NULL, '2021-07-02 21:51:42');
|
||||
INSERT INTO `sys_role_menu` VALUES (116, 2014, NULL, '2021-07-02 21:51:42');
|
||||
INSERT INTO `sys_role_menu` VALUES (116, 2015, NULL, '2021-07-02 21:51:42');
|
||||
INSERT INTO `sys_role_menu` VALUES (116, 2016, NULL, '2021-07-02 21:51:42');
|
||||
INSERT INTO `sys_role_menu` VALUES (116, 2017, NULL, '2021-07-02 21:51:42');
|
||||
INSERT INTO `sys_role_menu` VALUES (116, 2036, NULL, '2021-07-02 21:51:42');
|
||||
INSERT INTO `sys_role_menu` VALUES (116, 2037, NULL, '2021-07-02 21:51:42');
|
||||
INSERT INTO `sys_role_menu` VALUES (116, 2038, NULL, '2021-07-02 21:51:42');
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user