😎优化系统流水号相关代码
This commit is contained in:
parent
695780afbf
commit
5430cea7f7
@ -60,15 +60,15 @@
|
|||||||
<PackageReference Include="TencentCloudSDK.Sms" Version="3.0.1273" />
|
<PackageReference Include="TencentCloudSDK.Sms" Version="3.0.1273" />
|
||||||
<PackageReference Include="UAParser" Version="3.1.47" />
|
<PackageReference Include="UAParser" Version="3.1.47" />
|
||||||
<PackageReference Include="Yitter.IdGenerator" Version="1.0.14" />
|
<PackageReference Include="Yitter.IdGenerator" Version="1.0.14" />
|
||||||
<PackageReference Include="microsoft.semantickernel" Version="1.61.0" />
|
<PackageReference Include="microsoft.semantickernel" Version="1.62.0" />
|
||||||
<PackageReference Include="Microsoft.SemanticKernel.Agents.Core" Version="1.61.0" />
|
<PackageReference Include="Microsoft.SemanticKernel.Agents.Core" Version="1.62.0" />
|
||||||
<PackageReference Include="Microsoft.SemanticKernel.Connectors.Amazon" Version="1.56.0-alpha" />
|
<PackageReference Include="Microsoft.SemanticKernel.Connectors.Amazon" Version="1.56.0-alpha" />
|
||||||
<PackageReference Include="Microsoft.SemanticKernel.Connectors.Google" Version="1.54.0-alpha" />
|
<PackageReference Include="Microsoft.SemanticKernel.Connectors.Google" Version="1.54.0-alpha" />
|
||||||
<PackageReference Include="Microsoft.SemanticKernel.Connectors.HuggingFace" Version="1.56.0-preview" />
|
<PackageReference Include="Microsoft.SemanticKernel.Connectors.HuggingFace" Version="1.56.0-preview" />
|
||||||
<PackageReference Include="Microsoft.SemanticKernel.Connectors.Ollama" Version="1.54.0-alpha" />
|
<PackageReference Include="Microsoft.SemanticKernel.Connectors.Ollama" Version="1.54.0-alpha" />
|
||||||
<PackageReference Include="Microsoft.SemanticKernel.Connectors.Qdrant" Version="1.54.0-preview" />
|
<PackageReference Include="Microsoft.SemanticKernel.Connectors.Qdrant" Version="1.54.0-preview" />
|
||||||
<PackageReference Include="Microsoft.SemanticKernel.PromptTemplates.Handlebars" Version="1.61.0" />
|
<PackageReference Include="Microsoft.SemanticKernel.PromptTemplates.Handlebars" Version="1.62.0" />
|
||||||
<PackageReference Include="Microsoft.SemanticKernel.Yaml" Version="1.61.0" />
|
<PackageReference Include="Microsoft.SemanticKernel.Yaml" Version="1.62.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
|
<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
|
||||||
|
|||||||
@ -24,23 +24,23 @@ public class SysSerial : EntityTenantId
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 有效期
|
/// 有效期
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Required]
|
|
||||||
[IgnoreUpdateSeedColumn]
|
[IgnoreUpdateSeedColumn]
|
||||||
[SugarColumn(ColumnDescription = "有效期")]
|
[SugarColumn(ColumnDescription = "有效期")]
|
||||||
|
[Required]
|
||||||
public virtual DateTime Expy { get; set; }
|
public virtual DateTime Expy { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 使用分类
|
/// 使用分类
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Required]
|
|
||||||
[SugarColumn(ColumnDescription = "使用分类")]
|
[SugarColumn(ColumnDescription = "使用分类")]
|
||||||
|
[Required]
|
||||||
public virtual SerialTypeEnum Type { get; set; }
|
public virtual SerialTypeEnum Type { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 重置间隔
|
/// 重置间隔
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Required]
|
|
||||||
[SugarColumn(ColumnDescription = "重置间隔")]
|
[SugarColumn(ColumnDescription = "重置间隔")]
|
||||||
|
[Required]
|
||||||
public virtual ResetIntervalEnum ResetInterval { get; set; }
|
public virtual ResetIntervalEnum ResetInterval { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -71,8 +71,8 @@ public class SysSerial : EntityTenantId
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 状态
|
/// 状态
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Required]
|
|
||||||
[SugarColumn(ColumnDescription = "状态")]
|
[SugarColumn(ColumnDescription = "状态")]
|
||||||
|
[Required]
|
||||||
public virtual StatusEnum Status { get; set; } = StatusEnum.Enable;
|
public virtual StatusEnum Status { get; set; } = StatusEnum.Enable;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -186,7 +186,7 @@ public class SysMenuSeedData : ISqlSugarEntitySeedData<SysMenu>
|
|||||||
//new SysMenu{ Id=1310000000463, Pid=1310000000461, Title="删除", Permission="dbBackup/delete", Type=MenuTypeEnum.Btn, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=100 },
|
//new SysMenu{ Id=1310000000463, Pid=1310000000461, Title="删除", Permission="dbBackup/delete", Type=MenuTypeEnum.Btn, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=100 },
|
||||||
//new SysMenu{ Id=1310000000464, Pid=1310000000461, Title="增加", Permission="dbBackup/add", Type=MenuTypeEnum.Btn, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=100 },
|
//new SysMenu{ Id=1310000000464, Pid=1310000000461, Title="增加", Permission="dbBackup/add", Type=MenuTypeEnum.Btn, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=100 },
|
||||||
|
|
||||||
new SysMenu{ Id=1310000000471, Pid=1310000000301, Title="流水管理", Path="/platform/serial", Name="sysSerial", Component="/system/serial/index", Icon="ele-Link", Type=MenuTypeEnum.Menu, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=250 },
|
new SysMenu{ Id=1310000000471, Pid=1310000000301, Title="流水序号", Path="/platform/serial", Name="sysSerial", Component="/system/serial/index", Icon="ele-Link", Type=MenuTypeEnum.Menu, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=250 },
|
||||||
new SysMenu{ Id=1310000000472, Pid=1310000000471, Title="查询", Permission="sysSerial/page", Type=MenuTypeEnum.Btn, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=100 },
|
new SysMenu{ Id=1310000000472, Pid=1310000000471, Title="查询", Permission="sysSerial/page", Type=MenuTypeEnum.Btn, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=100 },
|
||||||
new SysMenu{ Id=1310000000473, Pid=1310000000471, Title="编辑", Permission="sysSerial/update", Type=MenuTypeEnum.Btn, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=100 },
|
new SysMenu{ Id=1310000000473, Pid=1310000000471, Title="编辑", Permission="sysSerial/update", Type=MenuTypeEnum.Btn, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=100 },
|
||||||
new SysMenu{ Id=1310000000474, Pid=1310000000471, Title="增加", Permission="sysSerial/add", Type=MenuTypeEnum.Btn, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=100 },
|
new SysMenu{ Id=1310000000474, Pid=1310000000471, Title="增加", Permission="sysSerial/add", Type=MenuTypeEnum.Btn, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=100 },
|
||||||
|
|||||||
@ -65,7 +65,6 @@ public class SerialBaseInput
|
|||||||
/// 租户Id
|
/// 租户Id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual long? TenantId { get; set; }
|
public virtual long? TenantId { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -89,7 +88,6 @@ public class PageSerialInput : BasePageInput
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[Dict(nameof(StatusEnum), AllowNullValue = true)]
|
[Dict(nameof(StatusEnum), AllowNullValue = true)]
|
||||||
public StatusEnum? Status { get; set; }
|
public StatusEnum? Status { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -140,7 +138,6 @@ public class AddSerialInput : SerialBaseInput
|
|||||||
/// 备注
|
/// 备注
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public override string Remark { get; set; }
|
public override string Remark { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -210,7 +207,6 @@ public class UpdateSerialInput : SerialBaseInput
|
|||||||
/// 备注
|
/// 备注
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public override string Remark { get; set; }
|
public override string Remark { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PreviewSysSerialInput
|
public class PreviewSysSerialInput
|
||||||
|
|||||||
@ -38,12 +38,12 @@ public class SysSerialService : IDynamicApiController, ITransient
|
|||||||
public async Task<SqlSugarPagedList<PageSerialOutput>> Page(PageSerialInput input)
|
public async Task<SqlSugarPagedList<PageSerialOutput>> Page(PageSerialInput input)
|
||||||
{
|
{
|
||||||
input.Keyword = input.Keyword?.Trim();
|
input.Keyword = input.Keyword?.Trim();
|
||||||
var query = _sysSerialRep.AsQueryable().Where(u => u.TenantId == _userManager.TenantId)
|
var query = _sysSerialRep.AsQueryable()
|
||||||
|
.Where(u => u.TenantId == _userManager.TenantId)
|
||||||
.WhereIF(input.Type != null, u => u.Type == input.Type)
|
.WhereIF(input.Type != null, u => u.Type == input.Type)
|
||||||
.WhereIF(input.Status != null, u => u.Status == input.Status)
|
.WhereIF(input.Status != null, u => u.Status == input.Status)
|
||||||
.Select<PageSerialOutput>();
|
.Select<PageSerialOutput>();
|
||||||
query = query.MergeTable();
|
return await query.MergeTable().OrderBuilder(input).ToPagedListAsync(input.Page, input.PageSize);
|
||||||
return await query.OrderBuilder(input).ToPagedListAsync(input.Page, input.PageSize);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -53,7 +53,7 @@ public class SysSerialService : IDynamicApiController, ITransient
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[DisplayName("获取本地序列详情")]
|
[DisplayName("获取本地序列详情")]
|
||||||
[ApiDescriptionSettings(Name = "Detail"), HttpGet]
|
[ApiDescriptionSettings(Name = "Detail"), HttpGet]
|
||||||
public async Task<SysSerial> Detail([FromQuery]BaseIdInput input)
|
public async Task<SysSerial> Detail([FromQuery] BaseIdInput input)
|
||||||
{
|
{
|
||||||
return await _sysSerialRep.GetFirstAsync(u => u.Id == input.Id);
|
return await _sysSerialRep.GetFirstAsync(u => u.Id == input.Id);
|
||||||
}
|
}
|
||||||
@ -67,8 +67,7 @@ public class SysSerialService : IDynamicApiController, ITransient
|
|||||||
[ApiDescriptionSettings(Name = "Add"), HttpPost]
|
[ApiDescriptionSettings(Name = "Add"), HttpPost]
|
||||||
public async Task<long> Add(AddSerialInput input)
|
public async Task<long> Add(AddSerialInput input)
|
||||||
{
|
{
|
||||||
var isExist = await _sysSerialRep.IsAnyAsync(u => u.Type == input.Type && u.TenantId == _userManager.TenantId);
|
if (await _sysSerialRep.IsAnyAsync(u => u.Type == input.Type && u.TenantId == _userManager.TenantId)) throw Oops.Oh(ErrorCodeEnum.D1006);
|
||||||
if (isExist) throw Oops.Oh(ErrorCodeEnum.D1006);
|
|
||||||
|
|
||||||
var entity = input.Adapt<SysSerial>();
|
var entity = input.Adapt<SysSerial>();
|
||||||
entity.Expy = DateTime.Now;
|
entity.Expy = DateTime.Now;
|
||||||
@ -86,8 +85,7 @@ public class SysSerialService : IDynamicApiController, ITransient
|
|||||||
public async Task Update(UpdateSerialInput input)
|
public async Task Update(UpdateSerialInput input)
|
||||||
{
|
{
|
||||||
var seq = await _sysSerialRep.GetFirstAsync(u => u.Id == input.Id) ?? throw Oops.Oh(ErrorCodeEnum.D1002);
|
var seq = await _sysSerialRep.GetFirstAsync(u => u.Id == input.Id) ?? throw Oops.Oh(ErrorCodeEnum.D1002);
|
||||||
var isExist = await _sysSerialRep.IsAnyAsync(u => u.Type == input.Type && u.TenantId == _userManager.TenantId && input.Id != seq.Id);
|
if (await _sysSerialRep.IsAnyAsync(u => u.Type == input.Type && u.TenantId == _userManager.TenantId && input.Id != seq.Id)) throw Oops.Oh(ErrorCodeEnum.D1006);
|
||||||
if (isExist) throw Oops.Oh(ErrorCodeEnum.D1006);
|
|
||||||
|
|
||||||
var entity = input.Adapt<SysSerial>();
|
var entity = input.Adapt<SysSerial>();
|
||||||
await _sysSerialRep.AsUpdateable(entity).IgnoreColumns(u => new { u.Expy, u.Seq }).ExecuteCommandAsync();
|
await _sysSerialRep.AsUpdateable(entity).IgnoreColumns(u => new { u.Expy, u.Seq }).ExecuteCommandAsync();
|
||||||
@ -103,7 +101,7 @@ public class SysSerialService : IDynamicApiController, ITransient
|
|||||||
public async Task Delete(BaseIdInput input)
|
public async Task Delete(BaseIdInput input)
|
||||||
{
|
{
|
||||||
var entity = await _sysSerialRep.GetFirstAsync(u => u.Id == input.Id) ?? throw Oops.Oh(ErrorCodeEnum.D1002);
|
var entity = await _sysSerialRep.GetFirstAsync(u => u.Id == input.Id) ?? throw Oops.Oh(ErrorCodeEnum.D1002);
|
||||||
await _sysSerialRep.DeleteAsync(entity); //真删除
|
await _sysSerialRep.DeleteAsync(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -227,6 +225,7 @@ public class SysSerialService : IDynamicApiController, ITransient
|
|||||||
{
|
{
|
||||||
case ResetIntervalEnum.Never:
|
case ResetIntervalEnum.Never:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ResetIntervalEnum.Day:
|
case ResetIntervalEnum.Day:
|
||||||
if (nowDate.Date != seq.Expy.Date)
|
if (nowDate.Date != seq.Expy.Date)
|
||||||
{
|
{
|
||||||
@ -234,6 +233,7 @@ public class SysSerialService : IDynamicApiController, ITransient
|
|||||||
seq.Seq = seq.Min;
|
seq.Seq = seq.Min;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ResetIntervalEnum.Month:
|
case ResetIntervalEnum.Month:
|
||||||
if (nowDate.Month != seq.Expy.Month || nowDate.Year != seq.Expy.Year)
|
if (nowDate.Month != seq.Expy.Month || nowDate.Year != seq.Expy.Year)
|
||||||
{
|
{
|
||||||
@ -241,6 +241,7 @@ public class SysSerialService : IDynamicApiController, ITransient
|
|||||||
seq.Seq = seq.Min;
|
seq.Seq = seq.Min;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ResetIntervalEnum.Year:
|
case ResetIntervalEnum.Year:
|
||||||
if (nowDate.Year != seq.Expy.Year)
|
if (nowDate.Year != seq.Expy.Year)
|
||||||
{
|
{
|
||||||
@ -248,6 +249,7 @@ public class SysSerialService : IDynamicApiController, ITransient
|
|||||||
seq.Seq = seq.Min;
|
seq.Seq = seq.Min;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw Oops.Oh(ErrorCodeEnum.S0006);
|
throw Oops.Oh(ErrorCodeEnum.S0006);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,10 +4,9 @@
|
|||||||
//
|
//
|
||||||
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||||
|
|
||||||
using System.Text.Json;
|
|
||||||
using Minio.DataModel;
|
|
||||||
using NewLife.IO;
|
using NewLife.IO;
|
||||||
using NewLife.Reflection;
|
using NewLife.Reflection;
|
||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
namespace Admin.NET.Core;
|
namespace Admin.NET.Core;
|
||||||
|
|
||||||
@ -597,6 +596,7 @@ public static class SqlSugarExtension
|
|||||||
#endregion 简称操作
|
#endregion 简称操作
|
||||||
|
|
||||||
#region 流水号操作
|
#region 流水号操作
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 包含流水号特性的类型属性缓存表
|
/// 包含流水号特性的类型属性缓存表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -647,5 +647,6 @@ public static class SqlSugarExtension
|
|||||||
.GetResult();
|
.GetResult();
|
||||||
entityInfo.SetValue(serial);
|
entityInfo.SetValue(serial);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion 流水号操作
|
#endregion 流水号操作
|
||||||
}
|
}
|
||||||
@ -58,7 +58,7 @@ export interface AddSerialInput {
|
|||||||
resetInterval: ResetIntervalEnum;
|
resetInterval: ResetIntervalEnum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 格式化
|
* 表达式
|
||||||
*
|
*
|
||||||
* @type {string}
|
* @type {string}
|
||||||
* @memberof AddSerialInput
|
* @memberof AddSerialInput
|
||||||
|
|||||||
@ -60,7 +60,7 @@ export interface PageSerialOutput {
|
|||||||
resetInterval?: ResetIntervalEnum;
|
resetInterval?: ResetIntervalEnum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 格式化
|
* 表达式
|
||||||
*
|
*
|
||||||
* @type {string}
|
* @type {string}
|
||||||
* @memberof PageSerialOutput
|
* @memberof PageSerialOutput
|
||||||
|
|||||||
@ -68,7 +68,7 @@ export interface SysSerial {
|
|||||||
resetInterval: ResetIntervalEnum;
|
resetInterval: ResetIntervalEnum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 格式化
|
* 格式化表达式
|
||||||
*
|
*
|
||||||
* @type {string}
|
* @type {string}
|
||||||
* @memberof SysSerial
|
* @memberof SysSerial
|
||||||
|
|||||||
@ -60,7 +60,7 @@ export interface UpdateSerialInput {
|
|||||||
resetInterval: ResetIntervalEnum;
|
resetInterval: ResetIntervalEnum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 格式化
|
* 表达式
|
||||||
*
|
*
|
||||||
* @type {string}
|
* @type {string}
|
||||||
* @memberof UpdateSerialInput
|
* @memberof UpdateSerialInput
|
||||||
|
|||||||
@ -3,7 +3,8 @@
|
|||||||
<el-dialog v-model="state.showDialog" :width="800" draggable :close-on-click-modal="false">
|
<el-dialog v-model="state.showDialog" :width="800" draggable :close-on-click-modal="false">
|
||||||
<template #header>
|
<template #header>
|
||||||
<div style="color: #fff">
|
<div style="color: #fff">
|
||||||
<span>{{ state.title }}</span>
|
<el-icon size="16" style="margin-right: 3px; display: inline; vertical-align: middle"> <ele-Edit /> </el-icon>
|
||||||
|
<span> {{ props.title }} </span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<el-form :model="state.ruleForm" ref="ruleFormRef" label-width="auto" :rules="rules">
|
<el-form :model="state.ruleForm" ref="ruleFormRef" label-width="auto" :rules="rules">
|
||||||
@ -18,20 +19,16 @@
|
|||||||
<g-sys-dict v-model="state.ruleForm.type" :code="'SerialTypeEnum'" render-as="select" clearable :disabled="state.disabled" />
|
<g-sys-dict v-model="state.ruleForm.type" :code="'SerialTypeEnum'" render-as="select" clearable :disabled="state.disabled" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
|
||||||
<el-form-item label="重置间隔" prop="resetInterval">
|
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
|
||||||
<g-sys-dict v-model="state.ruleForm.resetInterval" :code="'ResetIntervalEnum'" render-as="select" clearable :disabled="state.disabled" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
|
||||||
<el-form-item label="表达式" prop="formater">
|
<el-form-item label="表达式" prop="formater">
|
||||||
<el-input v-model="state.ruleForm.formater" placeholder="表达式样例:R{yyyy}{MM}{dd}{HH}{mm}{ss}{SEQ}" clearable :disabled="state.disabled">
|
<el-input v-model="state.ruleForm.formater" placeholder="表达式样例:R{yyyy}{MM}{dd}{HH}{mm}{ss}{SEQ}" clearable :disabled="state.disabled">
|
||||||
<template #append>
|
<template #append>
|
||||||
<el-dropdown placement="bottom" @command="(val: any) => state.ruleForm.formater += val">
|
<el-dropdown placement="bottom" @command="(val: any) => (state.ruleForm.formater += val)">
|
||||||
<el-button> 插槽 </el-button>
|
<el-button> 插槽 </el-button>
|
||||||
<template #dropdown>
|
<template #dropdown>
|
||||||
<el-dropdown-menu>
|
<el-dropdown-menu>
|
||||||
<el-dropdown-item v-for="key in state.slotList" :key="key" :command="key">{{key}}</el-dropdown-item>
|
<el-dropdown-item v-for="key in state.slotList" :key="key" :command="key">{{ key }}</el-dropdown-item>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</template>
|
</template>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
@ -44,19 +41,24 @@
|
|||||||
<el-input-number v-model="state.ruleForm.min" placeholder="请输入最小值" clearable :disabled="state.disabled" class="w100" />
|
<el-input-number v-model="state.ruleForm.min" placeholder="请输入最小值" clearable :disabled="state.disabled" class="w100" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
|
||||||
<el-form-item label="排序" prop="orderNo">
|
|
||||||
<el-input-number v-model="state.ruleForm.orderNo" placeholder="请输入排序" clearable :disabled="state.disabled" class="w100" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
||||||
<el-form-item label="最大值" prop="max">
|
<el-form-item label="最大值" prop="max">
|
||||||
<el-input-number v-model="state.ruleForm.max" placeholder="请输入最大值" clearable :disabled="state.disabled" class="w100" />
|
<el-input-number v-model="state.ruleForm.max" placeholder="请输入最大值" clearable :disabled="state.disabled" class="w100" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
||||||
<el-form-item label="备注" prop="remark">
|
<el-form-item label="重置间隔" prop="resetInterval">
|
||||||
<el-input v-model="state.ruleForm.remark" placeholder="请输入备注" clearable :disabled="state.disabled" />
|
<g-sys-dict v-model="state.ruleForm.resetInterval" :code="'ResetIntervalEnum'" render-as="select" clearable :disabled="state.disabled" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
||||||
|
<el-form-item label="排序">
|
||||||
|
<el-input-number v-model="state.ruleForm.orderNo" placeholder="请输入排序" clearable :disabled="state.disabled" class="w100" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
|
||||||
|
<el-form-item label="备注">
|
||||||
|
<el-input v-model="state.ruleForm.remark" placeholder="请输入备注" clearable :disabled="state.disabled" type="textarea" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20" v-if="state.previewSeqNo">
|
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20" v-if="state.previewSeqNo">
|
||||||
@ -68,29 +70,33 @@
|
|||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<span class="dialog-footer">
|
<span class="dialog-footer">
|
||||||
<el-button @click="() => (state.showDialog = false)">取 消</el-button>
|
|
||||||
<el-button type="warning" icon="ele-View" @click="preview" v-reclick="500">预览</el-button>
|
<el-button type="warning" icon="ele-View" @click="preview" v-reclick="500">预览</el-button>
|
||||||
<el-button v-if="!state.disabled" @click="submit" type="primary" v-reclick="1000">确 定</el-button>
|
<el-button icon="ele-CircleCloseFilled" @click="() => (state.showDialog = false)">{{ $t('message.list.cancelButtonText') }}</el-button>
|
||||||
|
<el-button v-if="!state.disabled" type="primary" v-reclick="1000" icon="ele-CircleCheckFilled" @click="submit">{{ $t('message.list.confirmButtonText') }}</el-button>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" name="sysSerial" setup>
|
|
||||||
|
<script lang="ts" setup name="sysSerial">
|
||||||
import { ref, reactive, onMounted } from 'vue';
|
import { ref, reactive, onMounted } from 'vue';
|
||||||
import { ElMessage } from 'element-plus';
|
import { ElMessage } from 'element-plus';
|
||||||
import type { FormRules } from 'element-plus';
|
import type { FormRules } from 'element-plus';
|
||||||
|
|
||||||
import { getAPI } from '/@/utils/axios-utils';
|
import { getAPI } from '/@/utils/axios-utils';
|
||||||
import { SysSerialApi } from '/@/api-services/system/api';
|
import { SysSerialApi } from '/@/api-services/system/api';
|
||||||
import { UpdateSerialInput } from '/@/api-services/system/models';
|
import { UpdateSerialInput } from '/@/api-services/system/models';
|
||||||
|
|
||||||
//父级传递来的函数,用于回调
|
const props = defineProps({
|
||||||
|
title: String,
|
||||||
|
});
|
||||||
const emit = defineEmits(['handleQuery']);
|
const emit = defineEmits(['handleQuery']);
|
||||||
const ruleFormRef = ref();
|
const ruleFormRef = ref();
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
title: '',
|
title: '',
|
||||||
loading: false,
|
loading: false,
|
||||||
disabled: false,
|
disabled: false as any,
|
||||||
showDialog: false,
|
showDialog: false,
|
||||||
previewSeqNo: '',
|
previewSeqNo: '',
|
||||||
slotList: [] as any[],
|
slotList: [] as any[],
|
||||||
@ -103,24 +109,29 @@ const rules = ref<FormRules>({
|
|||||||
formater: [{ required: true, message: '请选择格式化!', trigger: 'blur' }],
|
formater: [{ required: true, message: '请选择格式化!', trigger: 'blur' }],
|
||||||
resetInterval: [{ required: true, message: '请选择重置方式!', trigger: 'blur' }],
|
resetInterval: [{ required: true, message: '请选择重置方式!', trigger: 'blur' }],
|
||||||
min: [{ required: true, message: '请输入最小值!', trigger: 'blur' }],
|
min: [{ required: true, message: '请输入最小值!', trigger: 'blur' }],
|
||||||
orderNo: [{ required: true, message: '请输入排序!', trigger: 'blur' }],
|
|
||||||
max: [{ required: true, message: '请输入最大值!', trigger: 'blur' }],
|
max: [{ required: true, message: '请输入最大值!', trigger: 'blur' }],
|
||||||
status: [{ required: true, message: '请选择状态!', trigger: 'change' }],
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// 页面加载时
|
// 页面加载时
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
state.slotList = await getAPI(SysSerialApi).apiSysSerialSlotListGet().then(({data}) => data.result ?? []);
|
state.slotList = await getAPI(SysSerialApi)
|
||||||
|
.apiSysSerialSlotListGet()
|
||||||
|
.then(({ data }) => data.result ?? []);
|
||||||
});
|
});
|
||||||
|
|
||||||
// 打开弹窗
|
// 打开弹窗
|
||||||
const openDialog = async (row: any, title: string) => {
|
const openDialog = async (row: any) => {
|
||||||
state.title = title;
|
state.disabled = props.title?.endsWith('详情');
|
||||||
state.disabled = title?.endsWith('详情');
|
|
||||||
|
row = JSON.parse(JSON.stringify(row));
|
||||||
|
state.ruleForm = row.id
|
||||||
|
? await getAPI(SysSerialApi)
|
||||||
|
.apiSysSerialDetailGet(row.id)
|
||||||
|
.then((res) => res.data.result ?? row)
|
||||||
|
: row;
|
||||||
state.showDialog = true;
|
state.showDialog = true;
|
||||||
ruleFormRef.value?.resetFields();
|
ruleFormRef.value?.resetFields();
|
||||||
row = JSON.parse(JSON.stringify(row ?? { status: 1, orderNo: 100 }));
|
|
||||||
state.ruleForm = row.id ? await getAPI(SysSerialApi).apiSysSerialDetailGet(row.id).then((res) => res.data.result ?? row) : row;
|
|
||||||
state.ruleForm.formater ??= '';
|
state.ruleForm.formater ??= '';
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -132,40 +143,35 @@ const closeDialog = () => {
|
|||||||
|
|
||||||
// 预览
|
// 预览
|
||||||
const preview = () => {
|
const preview = () => {
|
||||||
getAPI(SysSerialApi).apiSysSerialPreviewPost(state.ruleForm).then(res => {
|
getAPI(SysSerialApi)
|
||||||
|
.apiSysSerialPreviewPost(state.ruleForm)
|
||||||
|
.then((res) => {
|
||||||
if (res.data.result) {
|
if (res.data.result) {
|
||||||
ElMessage.success("获取成功");
|
ElMessage.success('获取成功');
|
||||||
state.previewSeqNo = res.data.result;
|
state.previewSeqNo = res.data.result;
|
||||||
state.ruleForm.seq ??= 0;
|
state.ruleForm.seq ??= 0;
|
||||||
state.ruleForm.seq += 1;
|
state.ruleForm.seq += 1;
|
||||||
} else {
|
} else {
|
||||||
ElMessage.error("预览失败");
|
ElMessage.error('预览失败');
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
// 提交
|
// 提交
|
||||||
const submit = async () => {
|
const submit = async () => {
|
||||||
ruleFormRef.value.validate(async (isValid: boolean, fields?: any) => {
|
ruleFormRef.value.validate(async (valid: boolean) => {
|
||||||
if (isValid) {
|
if (!valid) return;
|
||||||
|
|
||||||
let values = JSON.parse(JSON.stringify(state.ruleForm));
|
let values = JSON.parse(JSON.stringify(state.ruleForm));
|
||||||
// 处理多选字段值
|
|
||||||
if (state.ruleForm.id) {
|
if (state.ruleForm.id) {
|
||||||
await getAPI(SysSerialApi).apiSysSerialUpdatePost(values);
|
await getAPI(SysSerialApi).apiSysSerialUpdatePost(values);
|
||||||
} else {
|
} else {
|
||||||
await getAPI(SysSerialApi).apiSysSerialAddPost(values);
|
await getAPI(SysSerialApi).apiSysSerialAddPost(values);
|
||||||
}
|
}
|
||||||
closeDialog();
|
closeDialog();
|
||||||
} else {
|
|
||||||
ElMessage({
|
|
||||||
message: `表单有${Object.keys(fields).length}处验证失败,请修改后再提交`,
|
|
||||||
type: 'error',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
//将属性或者函数暴露给父组件
|
// 将属性或者函数暴露给父组件
|
||||||
defineExpose({ openDialog });
|
defineExpose({ openDialog });
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped></style>
|
|
||||||
@ -53,10 +53,12 @@
|
|||||||
</template>
|
</template>
|
||||||
</vxe-grid>
|
</vxe-grid>
|
||||||
</vxe-card>
|
</vxe-card>
|
||||||
<EditSysSerialDialog ref="editSysSerialDialogRef" @handleQuery="handleQuery" />
|
|
||||||
|
<EditSerial ref="editSerialRef" :title="state.title" @handleQuery="handleQuery" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<!-- 流水号 -->
|
||||||
<script lang="ts" setup name="sysSerial">
|
<script lang="ts" setup name="sysSerial">
|
||||||
import { onMounted, reactive, ref } from 'vue';
|
import { onMounted, reactive, ref } from 'vue';
|
||||||
import { ElMessageBox, ElMessage } from 'element-plus';
|
import { ElMessageBox, ElMessage } from 'element-plus';
|
||||||
@ -64,15 +66,19 @@ import { VxeGridInstance, VxeGridListeners, VxeGridPropTypes } from 'vxe-table';
|
|||||||
import { useVxeTable } from '/@/hooks/useVxeTableOptionsHook';
|
import { useVxeTable } from '/@/hooks/useVxeTableOptionsHook';
|
||||||
import commonFunction from '/@/utils/commonFunction';
|
import commonFunction from '/@/utils/commonFunction';
|
||||||
import { Local } from '/@/utils/storage';
|
import { Local } from '/@/utils/storage';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
|
import ModifyRecord from '/@/components/table/modifyRecord.vue';
|
||||||
|
import EditSerial from './component/editSerial.vue';
|
||||||
|
|
||||||
import { getAPI } from '/@/utils/axios-utils';
|
import { getAPI } from '/@/utils/axios-utils';
|
||||||
import { SysSerialApi } from '/@/api-services/system/api';
|
import { SysSerialApi } from '/@/api-services/system/api';
|
||||||
import { PageSerialInput, PageSerialOutput } from '/@/api-services/system/models';
|
import { PageSerialInput, PageSerialOutput } from '/@/api-services/system/models';
|
||||||
import ModifyRecord from '/@/components/table/modifyRecord.vue';
|
|
||||||
import EditSysSerialDialog from './component/editSysSerialDialog.vue';
|
|
||||||
|
|
||||||
|
const i18n = useI18n();
|
||||||
const commonFun = commonFunction();
|
const commonFun = commonFunction();
|
||||||
const xGrid = ref<VxeGridInstance>();
|
const xGrid = ref<VxeGridInstance>();
|
||||||
const editSysSerialDialogRef = ref<InstanceType<typeof EditSysSerialDialog>>();
|
const editSerialRef = ref<InstanceType<typeof EditSerial>>();
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
queryParams: {} as PageSerialInput,
|
queryParams: {} as PageSerialInput,
|
||||||
showAdvanceQueryUI: false,
|
showAdvanceQueryUI: false,
|
||||||
@ -81,6 +87,7 @@ const state = reactive({
|
|||||||
defaultSort: { field: 'id', order: 'asc', descStr: 'desc' },
|
defaultSort: { field: 'id', order: 'asc', descStr: 'desc' },
|
||||||
},
|
},
|
||||||
visible: false,
|
visible: false,
|
||||||
|
title: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
// 本地存储参数
|
// 本地存储参数
|
||||||
@ -150,30 +157,33 @@ const resetQuery = async () => {
|
|||||||
|
|
||||||
// 打开新增页面
|
// 打开新增页面
|
||||||
const handleAdd = () => {
|
const handleAdd = () => {
|
||||||
editSysSerialDialogRef.value?.openDialog(undefined, '添加流水号');
|
state.title = '添加流水号'; // i18n.t('message.list.addPosition');
|
||||||
|
editSerialRef.value?.openDialog({ status: 1, orderNo: 100 });
|
||||||
};
|
};
|
||||||
|
|
||||||
// 打开编辑页面
|
// 打开编辑页面
|
||||||
const handleEdit = async (row: any) => {
|
const handleEdit = async (row: any) => {
|
||||||
editSysSerialDialogRef.value?.openDialog(row, '编辑流水号');
|
state.title = '编辑流水号'; //i18n.t('message.list.editPosition');
|
||||||
|
editSerialRef.value?.openDialog(row);
|
||||||
};
|
};
|
||||||
|
|
||||||
// 打开详情页面
|
// 打开详情页面
|
||||||
const handleDetail = async (row: any) => {
|
const handleDetail = async (row: any) => {
|
||||||
editSysSerialDialogRef.value?.openDialog(row, '流水号详情');
|
state.title = '流水号详情'; //i18n.t('message.list.editPosition');
|
||||||
|
editSerialRef.value?.openDialog(row);
|
||||||
};
|
};
|
||||||
|
|
||||||
// 删除
|
// 删除
|
||||||
const handleDelete = (row: any) => {
|
const handleDelete = (row: any) => {
|
||||||
ElMessageBox.confirm(`确定删除记录?`, '提示', {
|
ElMessageBox.confirm(i18n.t('message.list.confirmDeletePosition', { name: row.name }), i18n.t('message.list.hint'), {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: i18n.t('message.list.confirmButtonText'),
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: i18n.t('message.list.cancelButtonText'),
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
})
|
})
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
await getAPI(SysSerialApi).apiSysSerialDeletePost({ id: row.id });
|
await getAPI(SysSerialApi).apiSysSerialDeletePost({ id: row.id });
|
||||||
await handleQuery();
|
handleQuery();
|
||||||
ElMessage.success('删除成功');
|
ElMessage.success(i18n.t('message.list.successDelete'));
|
||||||
})
|
})
|
||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
};
|
};
|
||||||
@ -192,6 +202,7 @@ const gridEvents: VxeGridListeners<PageSerialOutput> = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
:deep(.el-card) {
|
:deep(.el-card) {
|
||||||
overflow: visible !important;
|
overflow: visible !important;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user