字典页面与字典信息页面完成增删改查

This commit is contained in:
chenchun
2022-09-10 20:25:39 +08:00
parent 9f23b911c1
commit b5ad7a1721
8 changed files with 96 additions and 14 deletions

View File

@@ -130,6 +130,20 @@
</summary> </summary>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.DictionaryController.DelList(System.Collections.Generic.List{System.Int64})">
<summary>
id范围删除
</summary>
<param name="ids"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.DictionaryController.Update(Yi.Framework.Model.Models.DictionaryEntity)">
<summary>
更新
</summary>
<param name="dic"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.DictionaryInfoController.PageList(Yi.Framework.Model.Models.DictionaryInfoEntity,Yi.Framework.Common.Models.PageParModel)"> <member name="M:Yi.Framework.ApiMicroservice.Controllers.DictionaryInfoController.PageList(Yi.Framework.Model.Models.DictionaryInfoEntity,Yi.Framework.Common.Models.PageParModel)">
<summary> <summary>
动态条件分页查询 动态条件分页查询
@@ -159,6 +173,20 @@
<param name="ids"></param> <param name="ids"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.DictionaryInfoController.Update(Yi.Framework.Model.Models.DictionaryInfoEntity)">
<summary>
更新
</summary>
<param name="dicInfo"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.DictionaryInfoController.GetById(System.Int64)">
<summary>
根据字典id获取字典信息表
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="T:Yi.Framework.ApiMicroservice.Controllers.FileController"> <member name="T:Yi.Framework.ApiMicroservice.Controllers.FileController">
<summary> <summary>
文件 文件

View File

@@ -5,6 +5,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Yi.Framework.Common.Helper;
using Yi.Framework.Common.Models; using Yi.Framework.Common.Models;
using Yi.Framework.Interface; using Yi.Framework.Interface;
using Yi.Framework.Model.Models; using Yi.Framework.Model.Models;
@@ -73,5 +74,29 @@ namespace Yi.Framework.ApiMicroservice.Controllers
{ {
return Result.Success().SetData(await _iDictionaryService._repository.GetListAsync()); return Result.Success().SetData(await _iDictionaryService._repository.GetListAsync());
} }
/// <summary>
/// id范围删除
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
[HttpDelete]
public async Task<Result> DelList(List<long> ids)
{
return Result.Success().SetStatus(await _iDictionaryService._repository.DeleteByIdsAsync(ids.ToDynamicArray()));
}
/// <summary>
/// 更新
/// </summary>
/// <param name="dic"></param>
/// <returns></returns>
[HttpPut]
public async Task<Result> Update(DictionaryEntity dic)
{
return Result.Success().SetStatus(await _iDictionaryService._repository.UpdateIgnoreNullAsync(dic));
}
} }
} }

View File

@@ -76,5 +76,29 @@ namespace Yi.Framework.ApiMicroservice.Controllers
return Result.Success().SetStatus(await _iDictionaryInfoService._repository.DeleteByIdsAsync(ids.ToDynamicArray())); return Result.Success().SetStatus(await _iDictionaryInfoService._repository.DeleteByIdsAsync(ids.ToDynamicArray()));
} }
/// <summary>
/// 更新
/// </summary>
/// <param name="dicInfo"></param>
/// <returns></returns>
[HttpPut]
public async Task<Result> Update(DictionaryInfoEntity dicInfo)
{
return Result.Success().SetStatus(await _iDictionaryInfoService._repository.UpdateIgnoreNullAsync(dicInfo));
}
/// <summary>
/// 根据字典id获取字典信息表
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet]
[Route("{id}")]
public async Task<Result> GetById(long id)
{
return Result.Success().SetData(await _iDictionaryInfoService._repository.GetByIdAsync(id));
}
} }
} }

View File

@@ -12,7 +12,7 @@ export function listData(query) {
// 查询字典数据详细 // 查询字典数据详细
export function getData(dictCode) { export function getData(dictCode) {
return request({ return request({
url: '/system/dict/data/' + dictCode, url: '/dictionaryInfo/getById/' + dictCode,
method: 'get' method: 'get'
}) })
} }
@@ -37,7 +37,7 @@ export function addData(data) {
// 修改字典数据 // 修改字典数据
export function updateData(data) { export function updateData(data) {
return request({ return request({
url: '/system/dict/data', url: '/dictionaryInfo/update',
method: 'put', method: 'put',
data: data data: data
}) })

View File

@@ -29,7 +29,7 @@ export function addType(data) {
// 修改字典类型 // 修改字典类型
export function updateType(data) { export function updateType(data) {
return request({ return request({
url: '/system/dict/type', url: '/dictionary/update',
method: 'put', method: 'put',
data: data data: data
}) })
@@ -37,9 +37,14 @@ export function updateType(data) {
// 删除字典类型 // 删除字典类型
export function delType(dictId) { export function delType(dictId) {
if("string"==typeof(dictId))
{
dictId=[dictId];
}
return request({ return request({
url: '/system/dict/type/' + dictId, url: '/dictionary/delList',
method: 'delete' method: 'delete',
data:dictId
}) })
} }

View File

@@ -221,7 +221,7 @@ const data = reactive({
pageSize: 10, pageSize: 10,
dictName: undefined, dictName: undefined,
dictType: undefined, dictType: undefined,
isDeleted: undefined isDeleted: false
}, },
rules: { rules: {
dictLabel: [{ required: true, message: "数据标签不能为空", trigger: "blur" }], dictLabel: [{ required: true, message: "数据标签不能为空", trigger: "blur" }],

View File

@@ -19,9 +19,9 @@
@keyup.enter="handleQuery" @keyup.enter="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="状态" prop="status"> <el-form-item label="状态" prop="isDeleted">
<el-select <el-select
v-model="queryParams.status" v-model="queryParams.isDeleted"
placeholder="字典状态" placeholder="字典状态"
clearable clearable
style="width: 240px" style="width: 240px"
@@ -206,7 +206,7 @@ const data = reactive({
pageSize: 10, pageSize: 10,
dictName: undefined, dictName: undefined,
dictType: undefined, dictType: undefined,
isDeleted: undefined isDeleted: false
}, },
rules: { rules: {
dictName: [{ required: true, message: "字典名称不能为空", trigger: "blur" }], dictName: [{ required: true, message: "字典名称不能为空", trigger: "blur" }],
@@ -233,7 +233,7 @@ function cancel() {
/** 表单重置 */ /** 表单重置 */
function reset() { function reset() {
form.value = { form.value = {
Id: undefined, id: undefined,
dictName: undefined, dictName: undefined,
dictType: undefined, dictType: undefined,
isDeleted: false, isDeleted: false,
@@ -260,14 +260,14 @@ function handleAdd() {
} }
/** 多选框选中数据 */ /** 多选框选中数据 */
function handleSelectionChange(selection) { function handleSelectionChange(selection) {
ids.value = selection.map(item => item.dictId); ids.value = selection.map(item => item.id);
single.value = selection.length != 1; single.value = selection.length != 1;
multiple.value = !selection.length; multiple.value = !selection.length;
} }
/** 修改按钮操作 */ /** 修改按钮操作 */
function handleUpdate(row) { function handleUpdate(row) {
reset(); reset();
const dictId = row.dictId || ids.value; const dictId = row.id || ids.value;
getType(dictId).then(response => { getType(dictId).then(response => {
form.value = response.data; form.value = response.data;
open.value = true; open.value = true;
@@ -278,7 +278,7 @@ function handleUpdate(row) {
function submitForm() { function submitForm() {
proxy.$refs["dictRef"].validate(valid => { proxy.$refs["dictRef"].validate(valid => {
if (valid) { if (valid) {
if (form.value.dictId != undefined) { if (form.value.id != undefined) {
updateType(form.value).then(response => { updateType(form.value).then(response => {
proxy.$modal.msgSuccess("修改成功"); proxy.$modal.msgSuccess("修改成功");
open.value = false; open.value = false;
@@ -296,7 +296,7 @@ function submitForm() {
} }
/** 删除按钮操作 */ /** 删除按钮操作 */
function handleDelete(row) { function handleDelete(row) {
const dictIds = row.dictId || ids.value; const dictIds = row.id || ids.value;
proxy.$modal.confirm('是否确认删除字典编号为"' + dictIds + '"的数据项?').then(function() { proxy.$modal.confirm('是否确认删除字典编号为"' + dictIds + '"的数据项?').then(function() {
return delType(dictIds); return delType(dictIds);
}).then(() => { }).then(() => {