字典类型新增是否系统字典字段
This commit is contained in:
parent
a2644859bd
commit
8f413ebbf6
@ -3,6 +3,7 @@ using Infrastructure.Enums;
|
|||||||
using Infrastructure.Model;
|
using Infrastructure.Model;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using System;
|
using System;
|
||||||
|
using ZR.Admin.WebApi.Extensions;
|
||||||
using ZR.Admin.WebApi.Filters;
|
using ZR.Admin.WebApi.Filters;
|
||||||
using ZR.Common;
|
using ZR.Common;
|
||||||
using ZR.Model;
|
using ZR.Model;
|
||||||
@ -89,7 +90,7 @@ namespace ZR.Admin.WebApi.Controllers.System
|
|||||||
return ToResponse(ApiResult.Error($"修改字典'{dict.DictName}'失败,字典类型已存在"));
|
return ToResponse(ApiResult.Error($"修改字典'{dict.DictName}'失败,字典类型已存在"));
|
||||||
}
|
}
|
||||||
//设置添加人
|
//设置添加人
|
||||||
dict.Update_by = HttpContext.User.Identity.Name;
|
dict.Update_by = HttpContext.GetName();
|
||||||
return SUCCESS(SysDictService.UpdateDictType(dict));
|
return SUCCESS(SysDictService.UpdateDictType(dict));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ namespace ZR.Model.System
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 字典类型表
|
/// 字典类型表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarTable("sys_dict_type")]//当和数据库名称不一样可以设置别名
|
[SugarTable("sys_dict_type")]
|
||||||
[Tenant("0")]
|
[Tenant("0")]
|
||||||
public class SysDictType : SysBase
|
public class SysDictType : SysBase
|
||||||
{
|
{
|
||||||
@ -14,7 +14,6 @@ namespace ZR.Model.System
|
|||||||
/// 字典主键
|
/// 字典主键
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]//主键并且自增 (string不能设置自增)
|
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]//主键并且自增 (string不能设置自增)
|
||||||
//[Key]
|
|
||||||
public long DictId { get; set; }
|
public long DictId { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 字典名称
|
/// 字典名称
|
||||||
@ -29,5 +28,9 @@ namespace ZR.Model.System
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[EpplusIgnore]
|
[EpplusIgnore]
|
||||||
public string Status { get; set; }
|
public string Status { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 系统内置 Y是 N否
|
||||||
|
/// </summary>
|
||||||
|
public string Type { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,6 +28,7 @@ namespace ZR.Repository.System
|
|||||||
exp.AndIF(!string.IsNullOrEmpty(dictType.DictName), it => it.DictName.Contains(dictType.DictName));
|
exp.AndIF(!string.IsNullOrEmpty(dictType.DictName), it => it.DictName.Contains(dictType.DictName));
|
||||||
exp.AndIF(!string.IsNullOrEmpty(dictType.Status), it => it.Status == dictType.Status);
|
exp.AndIF(!string.IsNullOrEmpty(dictType.Status), it => it.Status == dictType.Status);
|
||||||
exp.AndIF(!string.IsNullOrEmpty(dictType.DictType), it => it.DictType.Contains(dictType.DictType));
|
exp.AndIF(!string.IsNullOrEmpty(dictType.DictType), it => it.DictType.Contains(dictType.DictType));
|
||||||
|
exp.AndIF(!string.IsNullOrEmpty(dictType.Type), it => it.Type.Equals(dictType.Type));
|
||||||
|
|
||||||
return GetPages(exp.ToExpression(), pager, f => f.DictId, OrderByType.Desc);
|
return GetPages(exp.ToExpression(), pager, f => f.DictId, OrderByType.Desc);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,18 +2,26 @@
|
|||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
<el-form-item label="字典名称" prop="dictName">
|
<el-form-item label="字典名称" prop="dictName">
|
||||||
<el-input v-model="queryParams.dictName" placeholder="请输入字典名称" clearable size="small" style="width: 240px" @keyup.enter.native="handleQuery" />
|
<el-input v-model="queryParams.dictName" placeholder="请输入字典名称" clearable size="small" style="width: 240px"
|
||||||
|
@keyup.enter.native="handleQuery" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="字典类型" prop="dictType">
|
<el-form-item label="字典类型" prop="dictType">
|
||||||
<el-input v-model="queryParams.dictType" placeholder="请输入字典类型" clearable size="small" style="width: 240px" @keyup.enter.native="handleQuery" />
|
<el-input v-model="queryParams.dictType" placeholder="请输入字典类型" clearable size="small" style="width: 240px"
|
||||||
|
@keyup.enter.native="handleQuery" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="状态" prop="status">
|
<el-form-item label="状态" prop="status">
|
||||||
<el-select v-model="queryParams.status" placeholder="字典状态" clearable size="small" style="width: 240px">
|
<el-select v-model="queryParams.status" placeholder="字典状态" clearable size="small" style="width: 240px">
|
||||||
<el-option v-for="dict in statusOptions" :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-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="是否内置" prop="type">
|
||||||
|
<el-select v-model="queryParams.type" placeholder="是否内置" clearable size="small" style="width: 240px">
|
||||||
|
<el-option v-for="dict in typeOptions" :key="dict.dictValue" :label="dict.dictLabel" :value="dict.dictValue" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="创建时间">
|
<el-form-item label="创建时间">
|
||||||
<el-date-picker v-model="dateRange" size="small" style="width: 240px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
|
<el-date-picker v-model="dateRange" size="small" style="width: 240px" value-format="yyyy-MM-dd" type="daterange" range-separator="-"
|
||||||
|
start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
@ -26,10 +34,12 @@
|
|||||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['system:dict:add']">新增</el-button>
|
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['system:dict:add']">新增</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate" v-hasPermi="['system:dict:edit']">修改</el-button>
|
<el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate" v-hasPermi="['system:dict:edit']">修改
|
||||||
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete" v-hasPermi="['system:dict:remove']">删除</el-button>
|
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
|
||||||
|
v-hasPermi="['system:dict:remove']">删除</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['system:dict:export']">导出</el-button>
|
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['system:dict:export']">导出</el-button>
|
||||||
@ -76,11 +86,16 @@
|
|||||||
<el-form-item label="字典类型" prop="dictType">
|
<el-form-item label="字典类型" prop="dictType">
|
||||||
<el-input v-model="form.dictType" placeholder="请输入字典类型" />
|
<el-input v-model="form.dictType" placeholder="请输入字典类型" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="状态" prop="status">
|
<el-form-item label="字典状态" prop="status">
|
||||||
<el-radio-group v-model="form.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 v-for="dict in statusOptions" :key="dict.dictValue" :label="dict.dictValue">{{dict.dictLabel}}</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="系统内置" prop="type">
|
||||||
|
<el-radio-group v-model="form.type">
|
||||||
|
<el-radio v-for="dict in typeOptions" :key="dict.dictValue" :label="dict.dictValue">{{dict.dictLabel}}</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="备注" prop="remark">
|
<el-form-item label="备注" prop="remark">
|
||||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input>
|
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -136,6 +151,8 @@ export default {
|
|||||||
dictDataVisible: false,
|
dictDataVisible: false,
|
||||||
// 状态数据字典
|
// 状态数据字典
|
||||||
statusOptions: [],
|
statusOptions: [],
|
||||||
|
// 是否内置
|
||||||
|
typeOptions: [],
|
||||||
// 日期范围
|
// 日期范围
|
||||||
dateRange: [],
|
dateRange: [],
|
||||||
// 查询参数
|
// 查询参数
|
||||||
@ -166,16 +183,19 @@ export default {
|
|||||||
this.getDicts("sys_normal_disable").then((response) => {
|
this.getDicts("sys_normal_disable").then((response) => {
|
||||||
this.statusOptions = response.data;
|
this.statusOptions = response.data;
|
||||||
});
|
});
|
||||||
|
this.getDicts("sys_yes_no").then((response) => {
|
||||||
|
this.typeOptions = response.data;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/** 查询字典类型列表 */
|
/** 查询字典类型列表 */
|
||||||
getList() {
|
getList() {
|
||||||
// this.loading = true;
|
this.loading = true;
|
||||||
listType(this.addDateRange(this.queryParams, this.dateRange)).then(
|
listType(this.addDateRange(this.queryParams, this.dateRange)).then(
|
||||||
(response) => {
|
(response) => {
|
||||||
this.typeList = response.data.result;
|
this.typeList = response.data.result;
|
||||||
this.total = response.data.totalNum;
|
this.total = response.data.totalNum;
|
||||||
// this.loading = false;
|
this.loading = false;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@ -195,6 +215,7 @@ export default {
|
|||||||
dictName: undefined,
|
dictName: undefined,
|
||||||
dictType: undefined,
|
dictType: undefined,
|
||||||
status: "0",
|
status: "0",
|
||||||
|
type: "N",
|
||||||
remark: undefined,
|
remark: undefined,
|
||||||
};
|
};
|
||||||
this.resetForm("form");
|
this.resetForm("form");
|
||||||
|
|||||||
@ -184,6 +184,7 @@ CREATE TABLE `sys_dict_type` (
|
|||||||
`dictName` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '字典名称',
|
`dictName` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '字典名称',
|
||||||
`dictType` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '字典类型',
|
`dictType` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '字典类型',
|
||||||
`status` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '状态(0正常 1停用)',
|
`status` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '状态(0正常 1停用)',
|
||||||
|
`type` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'N' COMMENT '系统内置(Y是 N否)',
|
||||||
`create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者',
|
`create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者',
|
||||||
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
|
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
|
||||||
`update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者',
|
`update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者',
|
||||||
@ -196,17 +197,17 @@ CREATE TABLE `sys_dict_type` (
|
|||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Records of sys_dict_type
|
-- Records of sys_dict_type
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
INSERT INTO `sys_dict_type` VALUES (1, '用户性别', 'sys_user_sex', '0', 'admin', '2021-02-24 10:55:26', '', NULL, '用户性别列表');
|
INSERT INTO `sys_dict_type` VALUES (1, '用户性别', 'sys_user_sex', '0', 'Y', 'admin', '2021-02-24 10:55:26', '', NULL, '用户性别列表');
|
||||||
INSERT INTO `sys_dict_type` VALUES (2, '菜单状态', 'sys_show_hide', '0', 'admin', '2021-02-24 10:55:26', '', NULL, '菜单状态列表');
|
INSERT INTO `sys_dict_type` VALUES (2, '菜单状态', 'sys_show_hide', '0', 'Y', 'admin', '2021-02-24 10:55:26', '', NULL, '菜单状态列表');
|
||||||
INSERT INTO `sys_dict_type` VALUES (3, '系统开关', 'sys_normal_disable', '0', 'admin', '2021-02-24 10:55:26', '', NULL, '系统开关列表');
|
INSERT INTO `sys_dict_type` VALUES (3, '系统开关', 'sys_normal_disable', '0', 'Y', 'admin', '2021-02-24 10:55:26', '', NULL, '系统开关列表');
|
||||||
INSERT INTO `sys_dict_type` VALUES (4, '任务状态', 'sys_job_status', '0', 'admin', '2021-02-24 10:55:26', '', NULL, '任务状态列表');
|
INSERT INTO `sys_dict_type` VALUES (4, '任务状态', 'sys_job_status', '0', 'Y', 'admin', '2021-02-24 10:55:26', '', NULL, '任务状态列表');
|
||||||
INSERT INTO `sys_dict_type` VALUES (5, '任务分组', 'sys_job_group', '0', 'admin', '2021-02-24 10:55:26', '', NULL, '任务分组列表');
|
INSERT INTO `sys_dict_type` VALUES (5, '任务分组', 'sys_job_group', '0', 'Y', 'admin', '2021-02-24 10:55:26', '', NULL, '任务分组列表');
|
||||||
INSERT INTO `sys_dict_type` VALUES (6, '系统是否', 'sys_yes_no', '0', 'admin', '2021-02-24 10:55:26', '', NULL, '系统是否列表');
|
INSERT INTO `sys_dict_type` VALUES (6, '系统是否', 'sys_yes_no', '0', 'Y', 'admin', '2021-02-24 10:55:26', '', NULL, '系统是否列表');
|
||||||
INSERT INTO `sys_dict_type` VALUES (7, '通知类型', 'sys_notice_type', '0', 'admin', '2021-02-24 10:55:26', '', NULL, '通知类型列表');
|
INSERT INTO `sys_dict_type` VALUES (7, '通知类型', 'sys_notice_type', '0', 'Y', 'admin', '2021-02-24 10:55:26', '', NULL, '通知类型列表');
|
||||||
INSERT INTO `sys_dict_type` VALUES (8, '通知状态', 'sys_notice_status', '0', 'admin', '2021-02-24 10:55:26', '', NULL, '通知状态列表');
|
INSERT INTO `sys_dict_type` VALUES (8, '通知状态', 'sys_notice_status', '0', 'Y', 'admin', '2021-02-24 10:55:26', '', NULL, '通知状态列表');
|
||||||
INSERT INTO `sys_dict_type` VALUES (9, '操作类型', 'sys_oper_type', '0', 'admin', '2021-02-24 10:55:26', '', NULL, '操作类型列表');
|
INSERT INTO `sys_dict_type` VALUES (9, '操作类型', 'sys_oper_type', '0', 'Y', 'admin', '2021-02-24 10:55:26', '', NULL, '操作类型列表');
|
||||||
INSERT INTO `sys_dict_type` VALUES (10, '系统状态', 'sys_common_status', '0', 'admin', '2021-02-24 10:55:27', '', NULL, '登录状态列表');
|
INSERT INTO `sys_dict_type` VALUES (10, '系统状态', 'sys_common_status', '0', 'Y', 'admin', '2021-02-24 10:55:27', '', NULL, '登录状态列表');
|
||||||
INSERT INTO `sys_dict_type` VALUES (11, '文章状态', 'sys_article_status', '0', 'admin', '2021-08-19 10:34:33', '', NULL, NULL);
|
INSERT INTO `sys_dict_type` VALUES (11, '文章状态', 'sys_article_status', '0', 'Y', 'admin', '2021-08-19 10:34:33', '', NULL, NULL);
|
||||||
|
|
||||||
SET FOREIGN_KEY_CHECKS = 1;
|
SET FOREIGN_KEY_CHECKS = 1;
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user