liangzongpeng 2024-05-28 18:30:50 +08:00
parent afc41d099e
commit 1cc29a2b98
29 changed files with 1579 additions and 745 deletions

View File

@ -80,4 +80,8 @@
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="SeedData\" />
</ItemGroup>
</Project> </Project>

View File

@ -91,4 +91,10 @@ public class PrintCodeDetail : EntityBase
[SugarColumn(ColumnName = "WarehouseID", ColumnDescription = "仓库ID")] [SugarColumn(ColumnName = "WarehouseID", ColumnDescription = "仓库ID")]
public long? WarehouseID { get; set; } public long? WarehouseID { get; set; }
/// <summary>
/// 父节点ID
/// </summary>
[SugarColumn(ColumnName = "FatherId", ColumnDescription = "父节点ID")]
public long? FatherId { get; set; }
} }

View File

@ -7,7 +7,6 @@ namespace Admin.NET.Application.Entity;
[SugarTable("SysUnit","单位")] [SugarTable("SysUnit","单位")]
public class SysUnit : EntityTenant public class SysUnit : EntityTenant
{ {
/// <summary> /// <summary>
/// 创建者部门Id /// 创建者部门Id
/// </summary> /// </summary>
@ -83,4 +82,10 @@ public class SysUnit : EntityTenant
[SugarColumn(ColumnName = "GroupUnitId", ColumnDescription = "单位组ID")] [SugarColumn(ColumnName = "GroupUnitId", ColumnDescription = "单位组ID")]
public long? GroupUnitId { get; set; } public long? GroupUnitId { get; set; }
/// <summary>
/// 子单位数量
/// </summary>
[SugarColumn(ColumnName = "ChildUnitCount", ColumnDescription = "子单位数量")]
public int ChildUnitCount { get; set; }
} }

View File

@ -1,27 +0,0 @@
using Admin.NET.Core;
using Admin.NET.Application.Entity;
namespace Admin.NET.Application.SeedData;
/// <summary>
/// 打印条码详情 表种子数据
/// </summary>
public class PrintCodeDetailSeedData: ISqlSugarEntitySeedData<PrintCodeDetail>
{
/// <summary>
/// 种子数据
/// </summary>
/// <returns></returns>
public IEnumerable<PrintCodeDetail> HasData()
{
string recordsJSON = @"
[]
";
List<PrintCodeDetail> records = Newtonsoft.Json.JsonConvert.DeserializeObject<List<PrintCodeDetail>>(recordsJSON);
// 后处理数据的特殊字段
//for (int i = 0; i < records.Count; i++) { }
return records;
}
}

View File

@ -65,6 +65,11 @@ public class PrintCodeDetailDto
/// </summary> /// </summary>
public long? WarehouseID { get; set; } public long? WarehouseID { get; set; }
/// <summary>
/// 父节点ID
/// </summary>
public long? FatherId { get; set; }
/// <summary> /// <summary>
/// 打码时间 /// 打码时间
/// </summary> /// </summary>

View File

@ -48,21 +48,25 @@ public class PrintCodeDetailBaseInput
/// </summary> /// </summary>
public virtual int? ChildCount { get; set; } public virtual int? ChildCount { get; set; }
/// <summary> /// <summary>
/// 打印单ID /// 打印单ID
/// </summary> /// </summary>
public long? TempListId { get; set; } public virtual long? TempListId { get; set; }
/// <summary> /// <summary>
/// 汇报单ID /// 汇报单ID
/// </summary> /// </summary>
public long? ReportTableId { get; set; } public virtual long? ReportTableId { get; set; }
/// <summary>
/// 父节点ID
/// </summary>
public virtual long? FatherId { get; set; }
/// <summary> /// <summary>
/// 仓库ID /// 仓库ID
/// </summary> /// </summary>
public long? WarehouseID { get; set; } public virtual long? WarehouseID { get; set; }
/// <summary> /// <summary>
/// 打码时间 /// 打码时间
@ -166,6 +170,21 @@ public class PrintCodeDetailInput : BasePageInput
/// </summary> /// </summary>
public int? ChildCount { get; set; } public int? ChildCount { get; set; }
/// <summary>
/// 打印单ID
/// </summary>
public long? TempListId { get; set; }
/// <summary>
/// 汇报单ID
/// </summary>
public long? ReportTableId { get; set; }
/// <summary>
/// 父节点ID
/// </summary>
public long? FatherId { get; set; }
/// <summary> /// <summary>
/// 打码时间 /// 打码时间
/// </summary> /// </summary>

View File

@ -65,6 +65,11 @@ public class PrintCodeDetailOutput
/// </summary> /// </summary>
public long? WarehouseID { get; set; } public long? WarehouseID { get; set; }
/// <summary>
/// 父节点ID
/// </summary>
public long? FatherId { get; set; }
/// <summary> /// <summary>
/// 打码时间 /// 打码时间
/// </summary> /// </summary>

View File

@ -110,7 +110,7 @@ public class PrintDataService : IDynamicApiController, ITransient
return await GetPrintDatas(input.CodeHead, input.CodeType, input.Count); return await GetPrintDatas(input.CodeHead, input.CodeType, input.Count);
} }
private async Task<List<PrintData>> GetPrintDatas(string codeName,string codeType,int count) public async Task<List<PrintData>> GetPrintDatas(string codeName,string codeType,int count)
{ {
var result = new List<PrintData>(); var result = new List<PrintData>();
if (string.IsNullOrEmpty(codeName)) if (string.IsNullOrEmpty(codeName))

View File

@ -0,0 +1,49 @@
namespace Admin.NET.Application;
/// <summary>
/// 汇报单输出参数
/// </summary>
public class PrintCodeTreeData
{
/// <summary>
/// 条码
/// </summary>
public string? Code { get; set; }
/// <summary>
/// 上级码
/// </summary>
public string? FatherCode { get; set; }
/// <summary>
/// 条码类型
/// </summary>
public string? CodeName { get; set; }
/// <summary>
/// 数量
/// </summary>
public int? Count { get; set; }
/// <summary>
/// 单位
/// </summary>
public string? Unit { get; set; }
/// <summary>
/// 基本数量
/// </summary>
public int? BaseCount { get; set; }
/// <summary>
/// 基本单位
/// </summary>
public string? BaseUnit { get; set; }
/// <summary>
/// 子码数
/// </summary>
public int? ChildCount { get; set; }
public List<PrintCodeTreeData> Children { get; set; }
}

View File

@ -17,13 +17,15 @@ public class ReportTableService : IDynamicApiController, ITransient
private readonly PrintCodeDetailService _codeDetailService; private readonly PrintCodeDetailService _codeDetailService;
private readonly ReportDetailTableService _reportDetailTable; private readonly ReportDetailTableService _reportDetailTable;
private readonly UserManager _userManager; private readonly UserManager _userManager;
private readonly PrintDataService _printDataService;
public ReportTableService(SqlSugarRepository<ReportTable> rep, public ReportTableService(SqlSugarRepository<ReportTable> rep,
UserManager userManager, UserManager userManager,
SysUnitService repUnit, SysUnitService repUnit,
SysUnitGroupService repUnitGroup, SysUnitGroupService repUnitGroup,
PrintCodeDetailService codeDetailService, PrintCodeDetailService codeDetailService,
ReportDetailTableService reportDetailTable) ReportDetailTableService reportDetailTable,
PrintDataService printDataService)
{ {
_rep = rep; _rep = rep;
_repUnit = repUnit; _repUnit = repUnit;
@ -31,6 +33,7 @@ public class ReportTableService : IDynamicApiController, ITransient
_codeDetailService = codeDetailService; _codeDetailService = codeDetailService;
_reportDetailTable = reportDetailTable; _reportDetailTable = reportDetailTable;
_userManager = userManager; _userManager = userManager;
_printDataService = printDataService;
} }
/// <summary> /// <summary>
@ -176,9 +179,10 @@ public class ReportTableService : IDynamicApiController, ITransient
/// <param name="input"></param> /// <param name="input"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
[ApiDescriptionSettings(Name = "AddReport")] [ApiDescriptionSettings(Name = "AddPrintList")]
public async Task AddPrintList(AddReportContext input) public async Task<List<PrintCodeTreeData>> AddPrintList(AddReportContext input)
{ {
var result = new List<PrintCodeTreeData>();
var unitGroup = await _repUnitGroup.Detail(new QueryByIdSysUnitGroupInput() { Id = input.UnitGroupId }); var unitGroup = await _repUnitGroup.Detail(new QueryByIdSysUnitGroupInput() { Id = input.UnitGroupId });
if (unitGroup == null) if (unitGroup == null)
{ {
@ -196,45 +200,66 @@ public class ReportTableService : IDynamicApiController, ITransient
var newReport = new AddReportTableInput() { CreateTime = DateTime.Now, IsDelete = false, OddNumber = DateTime.Now.ToString("yyyyMMddhhmmss"), State = 1 }; var newReport = new AddReportTableInput() { CreateTime = DateTime.Now, IsDelete = false, OddNumber = DateTime.Now.ToString("yyyyMMddhhmmss"), State = 1 };
var addReport = await Add(newReport); var addReport = await Add(newReport);
var others = units.FindAll(a => a.Rate < unit.Rate).OrderBy(a => a.Rate).ToList(); var others = units.FindAll(a => a.Rate < unit.Rate).OrderBy(a => a.Rate).ToList();
int toltalCount = 1; others.Reverse();
foreach (var other in others) int toltalCount = unit.Rate.ToInt();
{ var baseUnit = others.Count > 0 ? others.LastOrDefault().Name : unit.Name;
toltalCount *= other.Rate.ToInt(); var userId = _userManager.UserId;
} var userName = _userManager.RealName;
List<SysUnitOutput> tempUnits = new List<SysUnitOutput>();
tempUnits.AddRange(others);
foreach (var item in input.PrintDatas) foreach (var item in input.PrintDatas)
{ {
var code = string.IsNullOrEmpty(item.BarCode) ? item.QrCode : item.BarCode; var code = string.IsNullOrEmpty(item.BarCode) ? item.QrCode : item.BarCode;
var codeType = string.IsNullOrEmpty(item.BarCode) ? "二维码" : "条码"; var codeType = string.IsNullOrEmpty(item.BarCode) ? "二维码" : "条码";
var detail = new AddPrintCodeDetailInput() { TempListId = addReport, Code = code, CodeName = codeType, Count = 1, Unit = unit.Name, BaseCount = toltalCount, BaseUnit = others.FirstOrDefault()?.Name, PrintCodeTime = DateTime.Now, CreateUserId = _userManager.UserId, CreateUserName = _userManager.RealName }; var detail = new AddPrintCodeDetailInput() { TempListId = addReport, Code = code, CodeName = codeType, ChildCount = unit.ChildUnitCount, Count = 1, Unit = unit.Name, BaseCount = toltalCount, BaseUnit = baseUnit, PrintCodeTime = DateTime.Now, CreateUserId = userId, CreateUserName = userName };
if (others.Count>0)
{
detail.ChildCount = others.LastOrDefault().Rate;
}
var detailId = await _codeDetailService.Add(detail); var detailId = await _codeDetailService.Add(detail);
var treeData1 = detail.Adapt<PrintCodeTreeData>();
for (int i = 0; i < others.Count; i++) if (others.Count < 1)
{ {
var current = others[i]; result.Add(treeData1);
int count = current.Rate.ToInt(); continue;
if (i < others.Count - 1) }
treeData1.Children = new List<PrintCodeTreeData>();
var currUnit = tempUnits.FirstOrDefault();
var printDatas = await _printDataService.GetPrintDatas(currUnit.Name, codeType, currUnit.ChildUnitCount);
foreach (var dt in printDatas)
{
var code2 = string.IsNullOrEmpty(dt.BarCode) ? dt.QrCode : dt.BarCode;
var detail2 = new AddPrintCodeDetailInput() { TempListId = addReport, FatherCode = code, FatherId = detailId, Code = code2, ChildCount = currUnit.ChildUnitCount, CodeName = codeType, Count = 1, Unit = currUnit.Name, BaseCount = currUnit.Rate, BaseUnit = baseUnit, PrintCodeTime = DateTime.Now, CreateUserId = userId, CreateUserName = userName };
var detailId2 = await _codeDetailService.Add(detail2);
var treeData2 = detail2.Adapt<PrintCodeTreeData>();
if (tempUnits.Count > 1)
{ {
var ends = others.Skip(i + 1).ToList(); treeData2.Children = new List<PrintCodeTreeData>();
if (ends.Count>0) var currUnit3 = tempUnits[1];
var printDatas3 = await _printDataService.GetPrintDatas(currUnit3.Name, codeType, currUnit3.ChildUnitCount);
foreach (var dt3 in printDatas3)
{ {
foreach (var ss in ends) var code3 = string.IsNullOrEmpty(dt3.BarCode) ? dt3.QrCode : dt3.BarCode;
var detail3 = new AddPrintCodeDetailInput() { TempListId = addReport, FatherCode = code2, FatherId = detailId2, Code = code3, ChildCount = currUnit3.ChildUnitCount, CodeName = codeType, Count = 1, Unit = currUnit3.Name, BaseCount = currUnit3.Rate, BaseUnit = baseUnit, PrintCodeTime = DateTime.Now, CreateUserId = userId, CreateUserName = userName };
var detailId3 = await _codeDetailService.Add(detail3);
var treeData3 = detail3.Adapt<PrintCodeTreeData>();
if (tempUnits.Count > 2)
{ {
count /= ss.Rate.ToInt(); treeData3.Children = new List<PrintCodeTreeData>();
var currUnit4 = tempUnits[2];
var printDatas4 = await _printDataService.GetPrintDatas(currUnit4.Name, codeType, currUnit4.ChildUnitCount);
foreach (var dt4 in printDatas4)
{
var code4 = string.IsNullOrEmpty(dt4.BarCode) ? dt4.QrCode : dt4.BarCode;
var detail4 = new AddPrintCodeDetailInput() { TempListId = addReport, FatherCode = code3, FatherId = detailId3, Code = code4, ChildCount = currUnit4.ChildUnitCount, CodeName = codeType, Count = 1, Unit = currUnit4.Name, BaseCount = currUnit4.Rate, BaseUnit = baseUnit, PrintCodeTime = DateTime.Now, CreateUserId = userId, CreateUserName = userName };
var treeData4 = detail4.Adapt<PrintCodeTreeData>();
treeData3.Children.Add(treeData4);
}
} }
treeData2.Children.Add(treeData3);
} }
} }
treeData1.Children.Add(treeData2);
} }
result.Add(treeData1);
} }
return result;
var entity = input.Adapt<ReportTable>();
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
} }
} }

View File

@ -1,113 +1,117 @@
namespace Admin.NET.Application; namespace Admin.NET.Application;
/// <summary>
/// 单位输出参数
/// </summary>
public class SysUnitDto
{
/// <summary> /// <summary>
/// 单位输出参数 /// 主键Id
/// </summary> /// </summary>
public class SysUnitDto public long Id { get; set; }
{
/// <summary> /// <summary>
/// 主键Id /// 租户Id
/// </summary> /// </summary>
public long Id { get; set; } public long? TenantId { get; set; }
/// <summary> /// <summary>
/// 租户Id /// 创建时间
/// </summary> /// </summary>
public long? TenantId { get; set; } public DateTime? CreateTime { get; set; }
/// <summary> /// <summary>
/// 创建时间 /// 更新时间
/// </summary> /// </summary>
public DateTime? CreateTime { get; set; } public DateTime? UpdateTime { get; set; }
/// <summary> /// <summary>
/// 更新时间 /// 创建者Id
/// </summary> /// </summary>
public DateTime? UpdateTime { get; set; } public long? CreateUserId { get; set; }
/// <summary> /// <summary>
/// 创建者Id /// 创建者姓名
/// </summary> /// </summary>
public long? CreateUserId { get; set; } public string? CreateUserName { get; set; }
/// <summary> /// <summary>
/// 创建者姓名 /// 修改者Id
/// </summary> /// </summary>
public string? CreateUserName { get; set; } public long? UpdateUserId { get; set; }
/// <summary> /// <summary>
/// 修改者Id /// 修改者姓名
/// </summary> /// </summary>
public long? UpdateUserId { get; set; } public string? UpdateUserName { get; set; }
/// <summary> /// <summary>
/// 修改者姓名 /// 创建者部门Id
/// </summary> /// </summary>
public string? UpdateUserName { get; set; } public long? CreateOrgId { get; set; }
/// <summary> /// <summary>
/// 创建者部门Id /// 创建者部门名称
/// </summary> /// </summary>
public long? CreateOrgId { get; set; } public string? CreateOrgName { get; set; }
/// <summary> /// <summary>
/// 创建者部门名称 /// 软删除
/// </summary> /// </summary>
public string? CreateOrgName { get; set; } public bool IsDelete { get; set; }
/// <summary> /// <summary>
/// 软删除 /// 名称
/// </summary> /// </summary>
public bool IsDelete { get; set; } public string Name { get; set; }
/// <summary> /// <summary>
/// 名称 /// 编码
/// </summary> /// </summary>
public string Name { get; set; } public string CodeNum { get; set; }
/// <summary> /// <summary>
/// 编码 /// 是否启用
/// </summary> /// </summary>
public string CodeNum { get; set; } public bool IsEnable { get; set; }
/// <summary> /// <summary>
/// 是否启用 /// 代码
/// </summary> /// </summary>
public bool IsEnable { get; set; } public string? Code { get; set; }
/// <summary> /// <summary>
/// 代码 /// 换算率
/// </summary> /// </summary>
public string? Code { get; set; } public int? Rate { get; set; }
/// <summary> /// <summary>
/// 换算率 /// 作为基本单位
/// </summary> /// </summary>
public int? Rate { get; set; } public bool? IsBaseUnit { get; set; }
/// <summary> /// <summary>
/// 作为基本单位 /// 精度
/// </summary> /// </summary>
public bool? IsBaseUnit { get; set; } public int? Accuracy { get; set; }
/// <summary> /// <summary>
/// 精度 /// 外部编码
/// </summary> /// </summary>
public int? Accuracy { get; set; } public string? ExternalNumber { get; set; }
/// <summary> /// <summary>
/// 外部编码 /// 备注
/// </summary> /// </summary>
public string? ExternalNumber { get; set; } public string? Remarks { get; set; }
/// <summary> /// <summary>
/// 备注 /// 单位组ID
/// </summary> /// </summary>
public string? Remarks { get; set; } public long? GroupUnitId { get; set; }
/// <summary>
/// <summary> /// 子单位数量
/// 单位组ID /// </summary>
/// </summary> public int ChildUnitCount { get; set; }
public long? GroupUnitId { get; set; }
}
}

View File

@ -3,216 +3,224 @@ using System.ComponentModel.DataAnnotations;
namespace Admin.NET.Application; namespace Admin.NET.Application;
/// <summary>
/// 单位基础输入参数
/// </summary>
public class SysUnitBaseInput
{
/// <summary> /// <summary>
/// 单位基础输入参数 /// 租户Id
/// </summary> /// </summary>
public class SysUnitBaseInput public virtual long? TenantId { get; set; }
{
/// <summary>
/// 租户Id
/// </summary>
public virtual long? TenantId { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public virtual DateTime? CreateTime { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public virtual DateTime? UpdateTime { get; set; }
/// <summary>
/// 创建者Id
/// </summary>
public virtual long? CreateUserId { get; set; }
/// <summary>
/// 创建者姓名
/// </summary>
public virtual string? CreateUserName { get; set; }
/// <summary>
/// 修改者Id
/// </summary>
public virtual long? UpdateUserId { get; set; }
/// <summary>
/// 修改者姓名
/// </summary>
public virtual string? UpdateUserName { get; set; }
/// <summary>
/// 创建者部门Id
/// </summary>
public virtual long? CreateOrgId { get; set; }
/// <summary>
/// 创建者部门名称
/// </summary>
public virtual string? CreateOrgName { get; set; }
/// <summary>
/// 软删除
/// </summary>
public virtual bool IsDelete { get; set; }
/// <summary>
/// 名称
/// </summary>
public virtual string Name { get; set; }
/// <summary>
/// 编码
/// </summary>
public virtual string CodeNum { get; set; }
/// <summary>
/// 是否启用
/// </summary>
public virtual bool IsEnable { get; set; }
/// <summary>
/// 代码
/// </summary>
public virtual string? Code { get; set; }
/// <summary>
/// 换算率
/// </summary>
public virtual int? Rate { get; set; }
/// <summary>
/// 作为基本单位
/// </summary>
public virtual bool? IsBaseUnit { get; set; }
/// <summary>
/// 精度
/// </summary>
public virtual int? Accuracy { get; set; }
/// <summary>
/// 外部编码
/// </summary>
public virtual string? ExternalNumber { get; set; }
/// <summary>
/// 备注
/// </summary>
public virtual string? Remarks { get; set; }
/// <summary>
/// 单位组ID
/// </summary>
public virtual long? GroupUnitId { get; set; }
}
/// <summary> /// <summary>
/// 单位分页查询输入参数 /// 创建时间
/// </summary> /// </summary>
public class SysUnitInput : BasePageInput public virtual DateTime? CreateTime { get; set; }
{
/// <summary>
/// 关键字查询
/// </summary>
public string? SearchKey { get; set; }
/// <summary>
/// 创建者部门名称
/// </summary>
public string? CreateOrgName { get; set; }
/// <summary>
/// 名称
/// </summary>
public string? Name { get; set; }
/// <summary>
/// 编码
/// </summary>
public string? CodeNum { get; set; }
/// <summary>
/// 是否启用
/// </summary>
public bool? IsEnable { get; set; }
/// <summary>
/// 代码
/// </summary>
public string? Code { get; set; }
/// <summary>
/// 外部编码
/// </summary>
public string? ExternalNumber { get; set; }
/// <summary>
/// 单位组ID
/// </summary>
public long? GroupUnitId { get; set; }
}
/// <summary> /// <summary>
/// 单位增加输入参数 /// 更新时间
/// </summary> /// </summary>
public class AddSysUnitInput : SysUnitBaseInput public virtual DateTime? UpdateTime { get; set; }
{
/// <summary>
/// 软删除
/// </summary>
[Required(ErrorMessage = "软删除不能为空")]
public override bool IsDelete { get; set; }
/// <summary>
/// 名称
/// </summary>
[Required(ErrorMessage = "名称不能为空")]
public override string Name { get; set; }
/// <summary>
/// 编码
/// </summary>
[Required(ErrorMessage = "编码不能为空")]
public override string CodeNum { get; set; }
/// <summary>
/// 是否启用
/// </summary>
[Required(ErrorMessage = "是否启用不能为空")]
public override bool IsEnable { get; set; }
}
/// <summary> /// <summary>
/// 单位删除输入参数 /// 创建者Id
/// </summary> /// </summary>
public class DeleteSysUnitInput : BaseIdInput public virtual long? CreateUserId { get; set; }
{
}
/// <summary> /// <summary>
/// 单位更新输入参数 /// 创建者姓名
/// </summary> /// </summary>
public class UpdateSysUnitInput : SysUnitBaseInput public virtual string? CreateUserName { get; set; }
{
/// <summary>
/// 主键Id
/// </summary>
[Required(ErrorMessage = "主键Id不能为空")]
public long Id { get; set; }
}
/// <summary> /// <summary>
/// 单位主键查询输入参数 /// 修改者Id
/// </summary> /// </summary>
public class QueryByIdSysUnitInput : DeleteSysUnitInput public virtual long? UpdateUserId { get; set; }
{
} /// <summary>
/// 修改者姓名
/// </summary>
public virtual string? UpdateUserName { get; set; }
/// <summary>
/// 创建者部门Id
/// </summary>
public virtual long? CreateOrgId { get; set; }
/// <summary>
/// 创建者部门名称
/// </summary>
public virtual string? CreateOrgName { get; set; }
/// <summary>
/// 软删除
/// </summary>
public virtual bool IsDelete { get; set; }
/// <summary>
/// 名称
/// </summary>
public virtual string Name { get; set; }
/// <summary>
/// 编码
/// </summary>
public virtual string CodeNum { get; set; }
/// <summary>
/// 是否启用
/// </summary>
public virtual bool IsEnable { get; set; }
/// <summary>
/// 代码
/// </summary>
public virtual string? Code { get; set; }
/// <summary>
/// 换算率
/// </summary>
public virtual int? Rate { get; set; }
/// <summary>
/// 作为基本单位
/// </summary>
public virtual bool? IsBaseUnit { get; set; }
/// <summary>
/// 精度
/// </summary>
public virtual int? Accuracy { get; set; }
/// <summary>
/// 外部编码
/// </summary>
public virtual string? ExternalNumber { get; set; }
/// <summary>
/// 备注
/// </summary>
public virtual string? Remarks { get; set; }
/// <summary>
/// 单位组ID
/// </summary>
public virtual long? GroupUnitId { get; set; }
/// <summary>
/// 子单位数量
/// </summary>
public virtual int ChildUnitCount { get; set; }
}
/// <summary>
/// 单位分页查询输入参数
/// </summary>
public class SysUnitInput : BasePageInput
{
/// <summary>
/// 关键字查询
/// </summary>
public string? SearchKey { get; set; }
/// <summary>
/// 创建者部门名称
/// </summary>
public string? CreateOrgName { get; set; }
/// <summary>
/// 名称
/// </summary>
public string? Name { get; set; }
/// <summary>
/// 编码
/// </summary>
public string? CodeNum { get; set; }
/// <summary>
/// 是否启用
/// </summary>
public bool? IsEnable { get; set; }
/// <summary>
/// 代码
/// </summary>
public string? Code { get; set; }
/// <summary>
/// 外部编码
/// </summary>
public string? ExternalNumber { get; set; }
/// <summary>
/// 单位组ID
/// </summary>
public long? GroupUnitId { get; set; }
/// <summary>
/// 子单位数量
/// </summary>
public int ChildUnitCount { get; set; }
}
/// <summary>
/// 单位增加输入参数
/// </summary>
public class AddSysUnitInput : SysUnitBaseInput
{
/// <summary>
/// 软删除
/// </summary>
[Required(ErrorMessage = "软删除不能为空")]
public override bool IsDelete { get; set; }
/// <summary>
/// 名称
/// </summary>
[Required(ErrorMessage = "名称不能为空")]
public override string Name { get; set; }
/// <summary>
/// 编码
/// </summary>
[Required(ErrorMessage = "编码不能为空")]
public override string CodeNum { get; set; }
/// <summary>
/// 是否启用
/// </summary>
[Required(ErrorMessage = "是否启用不能为空")]
public override bool IsEnable { get; set; }
}
/// <summary>
/// 单位删除输入参数
/// </summary>
public class DeleteSysUnitInput : BaseIdInput
{
}
/// <summary>
/// 单位更新输入参数
/// </summary>
public class UpdateSysUnitInput : SysUnitBaseInput
{
/// <summary>
/// 主键Id
/// </summary>
[Required(ErrorMessage = "主键Id不能为空")]
public long Id { get; set; }
}
/// <summary>
/// 单位主键查询输入参数
/// </summary>
public class QueryByIdSysUnitInput : DeleteSysUnitInput
{
}

View File

@ -9,107 +9,112 @@ public class SysUnitOutput
/// 主键Id /// 主键Id
/// </summary> /// </summary>
public long Id { get; set; } public long Id { get; set; }
/// <summary> /// <summary>
/// 租户Id /// 租户Id
/// </summary> /// </summary>
public long? TenantId { get; set; } public long? TenantId { get; set; }
/// <summary> /// <summary>
/// 创建时间 /// 创建时间
/// </summary> /// </summary>
public DateTime? CreateTime { get; set; } public DateTime? CreateTime { get; set; }
/// <summary> /// <summary>
/// 更新时间 /// 更新时间
/// </summary> /// </summary>
public DateTime? UpdateTime { get; set; } public DateTime? UpdateTime { get; set; }
/// <summary> /// <summary>
/// 创建者Id /// 创建者Id
/// </summary> /// </summary>
public long? CreateUserId { get; set; } public long? CreateUserId { get; set; }
/// <summary> /// <summary>
/// 创建者姓名 /// 创建者姓名
/// </summary> /// </summary>
public string? CreateUserName { get; set; } public string? CreateUserName { get; set; }
/// <summary> /// <summary>
/// 修改者Id /// 修改者Id
/// </summary> /// </summary>
public long? UpdateUserId { get; set; } public long? UpdateUserId { get; set; }
/// <summary> /// <summary>
/// 修改者姓名 /// 修改者姓名
/// </summary> /// </summary>
public string? UpdateUserName { get; set; } public string? UpdateUserName { get; set; }
/// <summary> /// <summary>
/// 创建者部门Id /// 创建者部门Id
/// </summary> /// </summary>
public long? CreateOrgId { get; set; } public long? CreateOrgId { get; set; }
/// <summary> /// <summary>
/// 创建者部门名称 /// 创建者部门名称
/// </summary> /// </summary>
public string? CreateOrgName { get; set; } public string? CreateOrgName { get; set; }
/// <summary> /// <summary>
/// 软删除 /// 软删除
/// </summary> /// </summary>
public bool IsDelete { get; set; } public bool IsDelete { get; set; }
/// <summary> /// <summary>
/// 名称 /// 名称
/// </summary> /// </summary>
public string Name { get; set; } public string Name { get; set; }
/// <summary> /// <summary>
/// 编码 /// 编码
/// </summary> /// </summary>
public string CodeNum { get; set; } public string CodeNum { get; set; }
/// <summary> /// <summary>
/// 是否启用 /// 是否启用
/// </summary> /// </summary>
public bool IsEnable { get; set; } public bool IsEnable { get; set; }
/// <summary> /// <summary>
/// 代码 /// 代码
/// </summary> /// </summary>
public string? Code { get; set; } public string? Code { get; set; }
/// <summary> /// <summary>
/// 换算率 /// 换算率
/// </summary> /// </summary>
public int? Rate { get; set; } public int? Rate { get; set; }
/// <summary> /// <summary>
/// 作为基本单位 /// 作为基本单位
/// </summary> /// </summary>
public bool? IsBaseUnit { get; set; } public bool? IsBaseUnit { get; set; }
/// <summary> /// <summary>
/// 精度 /// 精度
/// </summary> /// </summary>
public int? Accuracy { get; set; } public int? Accuracy { get; set; }
/// <summary> /// <summary>
/// 外部编码 /// 外部编码
/// </summary> /// </summary>
public string? ExternalNumber { get; set; } public string? ExternalNumber { get; set; }
/// <summary> /// <summary>
/// 备注 /// 备注
/// </summary> /// </summary>
public string? Remarks { get; set; } public string? Remarks { get; set; }
/// <summary> /// <summary>
/// 单位组ID /// 单位组ID
/// </summary> /// </summary>
public long? GroupUnitId { get; set; } public long? GroupUnitId { get; set; }
} /// <summary>
/// 子单位数量
/// </summary>
public int ChildUnitCount { get; set; }
}

View File

@ -115,7 +115,7 @@ public class SysUnitService : IDynamicApiController, ITransient
[ApiDescriptionSettings(Name = "List")] [ApiDescriptionSettings(Name = "List")]
public async Task<List<SysUnitOutput>> ListByGroupId(long unitGroupId) public async Task<List<SysUnitOutput>> ListByGroupId(long unitGroupId)
{ {
return await _rep.AsQueryable().WhereIF(unitGroupId > 0, u => u.GroupUnitId == unitGroupId).Where(a => !a.IsDelete).Select<SysUnitOutput>().ToListAsync(); return await _rep.AsQueryable().WhereIF(unitGroupId > 0, u => u.GroupUnitId == unitGroupId && !u.IsDelete).OrderBy(a => a.Rate).Select<SysUnitOutput>().ToListAsync();
} }

View File

@ -0,0 +1,22 @@
namespace Admin.NET.Application;
/// <summary>
/// 打印条码树形数据
/// </summary>
public class TreeData
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 名称
/// </summary>
public string Label { get; set; }
public List<TreeData> Children { get; set; }
}

View File

@ -330,10 +330,18 @@ public static class SqlSugarSetup
var entityInfo = dbProvider.EntityMaintenance.GetEntityInfo(entityType); var entityInfo = dbProvider.EntityMaintenance.GetEntityInfo(entityType);
if (entityInfo.Columns.Any(u => u.IsPrimarykey)) if (entityInfo.Columns.Any(u => u.IsPrimarykey))
{ {
// 按主键进行批量增加和更新 try
var storage = dbProvider.StorageableByObject(seedData.ToList()).ToStorage(); {
storage.AsInsertable.ExecuteCommand(); // 按主键进行批量增加和更新
storage.AsUpdateable.ExecuteCommand(); var storage = dbProvider.StorageableByObject(seedData.ToList()).ToStorage();
storage.AsInsertable.ExecuteCommand();
storage.AsUpdateable.ExecuteCommand();
}
catch (Exception ex)
{
}
} }
else else
{ {

View File

@ -148,6 +148,14 @@ export interface AddSysUnitInput {
*/ */
groupUnitId?: number | null; groupUnitId?: number | null;
/**
*
*
* @type {number}
* @memberof AddSysUnitInput
*/
childUnitCount?: number | null;
/** /**
* *
* *

View File

@ -123,4 +123,12 @@ export interface SysUnitInput {
* @memberof SysUnitInput * @memberof SysUnitInput
*/ */
groupUnitId?: number | null; groupUnitId?: number | null;
/**
*
*
* @type {number}
* @memberof SysUnitInput
*/
childUnitCount?: number | null;
} }

View File

@ -187,4 +187,12 @@ export interface SysUnitOutput {
* @memberof SysUnitOutput * @memberof SysUnitOutput
*/ */
groupUnitId?: number | null; groupUnitId?: number | null;
/**
*
*
* @type {number}
* @memberof SysUnitOutput
*/
childUnitCount?: number | null;
} }

View File

@ -187,4 +187,12 @@ export interface SysUnit {
* @memberof SysUnit * @memberof SysUnit
*/ */
groupUnitId?: number | null; groupUnitId?: number | null;
/**
*
*
* @type {number}
* @memberof SysUnit
*/
childUnitCount?: number | null;
} }

View File

@ -0,0 +1,50 @@
import request from '/@/utils/request';
enum Api {
AddMaterials = '/api/materials/add',
DeleteMaterials = '/api/materials/delete',
UpdateMaterials = '/api/materials/update',
PageMaterials = '/api/materials/page',
DetailMaterials = '/api/materials/detail',
}
// 增加物料
export const addMaterials = (params?: any) =>
request({
url: Api.AddMaterials,
method: 'post',
data: params,
});
// 删除物料
export const deleteMaterials = (params?: any) =>
request({
url: Api.DeleteMaterials,
method: 'post',
data: params,
});
// 编辑物料
export const updateMaterials = (params?: any) =>
request({
url: Api.UpdateMaterials,
method: 'post',
data: params,
});
// 分页查询物料
export const pageMaterials = (params?: any) =>
request({
url: Api.PageMaterials,
method: 'post',
data: params,
});
// 详情物料
export const detailMaterials = (id: any) =>
request({
url: Api.DetailMaterials,
method: 'get',
data: { id },
});

View File

@ -232,7 +232,7 @@ const state = reactive({
const openDialog = async (row: any) => { const openDialog = async (row: any) => {
ruleFormRef.value?.resetFields(); ruleFormRef.value?.resetFields();
//state.selectedTabName = '0'; // tab //state.selectedTabName = '0'; // tab
//state.ruleForm = JSON.parse(JSON.stringify(row)); //let rowData = JSON.parse(JSON.stringify(row));
if (row.id != undefined) { if (row.id != undefined) {
state.matterFrom=row; state.matterFrom=row;
//var resRole = await getAPI(MaterialsApi).apiMaterialsDetailGet(row.id); //var resRole = await getAPI(MaterialsApi).apiMaterialsDetailGet(row.id);

View File

@ -1,327 +1,215 @@
<!-- 物料 -->
<template> <template>
<div class="main"> <div class="materials-container">
<div class="main-from common-box"> <el-card shadow="hover" :body-style="{ paddingBottom: '0' }">
<el-form :inline="true" :model="state.queryParams" class="demo-form-inline" label-width="70px"> <el-form :model="queryParams" ref="queryForm" labelWidth="90">
<el-row> <el-row>
<el-col :span="8"> <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10">
<el-form-item label="名称"> <el-form-item label="关键字">
<el-input v-model="state.queryParams.name" placeholder="请输入名称" clearable /> <el-input v-model="queryParams.searchKey" clearable="" placeholder="请输入模糊查询关键字"/>
</el-form-item>
</el-col> </el-form-item>
<el-col :span="8"> </el-col>
<el-form-item label="编码"> <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-input v-model="state.queryParams.codeNum" placeholder="请输入编码" clearable /> <el-form-item label="名称">
</el-form-item> <el-input v-model="queryParams.name" clearable="" placeholder="请输入名称"/>
</el-col>
</el-row> </el-form-item>
<el-row> </el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="分类">
<el-input v-model="queryParams.classify" clearable="" placeholder="请输入分类"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="编码">
<el-input v-model="queryParams.codeNum" clearable="" placeholder="请输入编码"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="别名">
<el-input v-model="queryParams.aliasName" clearable="" placeholder="请输入别名"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="助记码">
<el-input v-model="queryParams.simpleNumber" clearable="" placeholder="请输入助记码"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="规格型号">
<el-input v-model="queryParams.specifications" clearable="" placeholder="请输入规格型号"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="备注">
<el-input v-model="queryParams.remarks" clearable="" placeholder="请输入备注"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6" class="mb10">
<el-form-item>
<el-button-group style="display: flex; align-items: center;">
<el-button type="primary" icon="ele-Search" @click="handleQuery" v-auth="'materials:page'"> </el-button>
<el-button icon="ele-Refresh" @click="() => queryParams = {}"> 重置 </el-button>
<el-button icon="ele-ZoomIn" @click="changeAdvanceQueryUI" v-if="!showAdvanceQueryUI" style="margin-left:5px;"> </el-button>
<el-button icon="ele-ZoomOut" @click="changeAdvanceQueryUI" v-if="showAdvanceQueryUI" style="margin-left:5px;"> </el-button>
<el-button type="primary" style="margin-left:5px;" icon="ele-Plus" @click="openAddMaterials" v-auth="'materials:add'"> </el-button>
</el-button-group>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
<el-card class="full-table" shadow="hover" style="margin-top: 5px">
<el-table
:data="tableData"
style="width: 100%"
v-loading="loading"
tooltip-effect="light"
row-key="id"
@sort-change="sortChange"
border="">
<el-table-column type="index" label="序号" width="55" align="center"/>
<el-table-column prop="name" label="名称" width="140" show-overflow-tooltip="" />
<el-table-column prop="codeNum" label="编码" width="140" show-overflow-tooltip="" />
<el-table-column prop="aliasName" label="别名" width="140" show-overflow-tooltip="" />
<el-table-column prop="simpleNumber" label="助记码" width="140" show-overflow-tooltip="" />
<el-table-column prop="specifications" label="规格型号" width="140" show-overflow-tooltip="" />
<el-table-column prop="isEnable" label="可用状态" width="120" show-overflow-tooltip="">
<template #default="scope">
<el-tag v-if="scope.row.isEnable"> </el-tag>
<el-tag type="danger" v-else> </el-tag>
</template>
</el-table-column>
<el-table-column prop="remarks" label="备注" width="200" show-overflow-tooltip="" />
<el-table-column label="操作" width="140" align="center" fixed="right" show-overflow-tooltip="" v-if="auth('materials:update') || auth('materials:delete')">
<template #default="scope">
<el-button icon="ele-Edit" size="small" text="" type="primary" @click="openEditMaterials(scope.row)" v-auth="'materials:update'"> </el-button>
<el-button icon="ele-Delete" size="small" text="" type="primary" @click="delMaterials(scope.row)" v-auth="'materials:delete'"> </el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
v-model:currentPage="tableParams.page"
v-model:page-size="tableParams.pageSize"
:total="tableParams.total"
:page-sizes="[10, 20, 50, 100, 200, 500]"
small=""
background=""
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes, prev, pager, next, jumper"
/>
<el-col :span="8"> <editDialog
<el-form-item label="规格型号"> ref="editDialogRef"
<el-input v-model="state.queryParams.specifications" placeholder="请输入" clearable /> :title="editMaterialsTitle"
</el-form-item> @reloadTable="handleQuery"
</el-col> />
<el-col :span="8"> </el-card>
<el-form-item label="关键字">
<el-input v-model="state.queryParams.searchKey" placeholder="请输入" clearable />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="品牌">
<el-select v-model="state.queryParams.brand" placeholder="请选择" clearable>
<el-option :label="item.name" :value="item.id" v-for="item, index in state.brandDate"
:key="index" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-form-item>
<el-button type="primary" @click="onSubmit"></el-button>
<el-button type="primary" @click="add"></el-button>
<el-dropdown style="margin-left: 10px;">
<el-button type="primary">
更多操作<el-icon class="el-icon--right"><arrow-down /></el-icon>
</el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item>导入</el-dropdown-item>
<el-dropdown-item>导出</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</el-form-item>
</el-form>
</div>
<div class="main-table common-box">
<div class="tab-hed">
<el-select v-model="state.queryParams.classify" placeholder="分类" clearable style="width: 200px;">
<el-option :label="item.name" :value="item.id" v-for="item, index in fyListData" :key="index" />
</el-select>
<div>
<el-button type="success" link
style="border-right: 1px #515a6e solid; border-radius: 0px; margin-right: 3px; padding: 0 3px;">新增</el-button>
<el-dropdown>
<span class="el-dropdown-link">
更多
<el-icon class="el-icon--right">
<arrow-down />
</el-icon>
</span>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item>查看</el-dropdown-item>
<el-dropdown-item>修改</el-dropdown-item>
<el-dropdown-item>删除</el-dropdown-item>
<el-dropdown-item>刷新</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</div>
</div>
<div class="tab">
<vxe-table show-overflow height="100%" :data="state.tableData" :border=true :tree-config="{ transform: true }"
:scroll-y="{ gt: 20 }">
<vxe-column field="codeNum" sortable title="编码" width=""></vxe-column>
<vxe-column field="name" sortable title="名称" width=""></vxe-column>
<vxe-column field="isEnable" sortable title="可用状态" width="">
<template #default="{ row }">
<!-- <el-switch v-model="row.isEnable" inline-prompt active-text="" inactive-text="" /> -->
{{ row.isEnable ? '启用' : '禁用' }}
</template>
</vxe-column>
<vxe-column field="barcode" sortable title="仓库条码" width=""></vxe-column>
<vxe-column field="createTime" sortable title="创建时间" width=""></vxe-column>
<vxe-column title="操作" width="200" fixed="right" show-overflow>
<template #default="{ row }">
<vxe-button type="text">查看</vxe-button>
<vxe-button type="text" @click="editDelete(row)"></vxe-button>
<vxe-button @click="matterDelete(row)" type="text" style="color: rgb(223, 65, 65)">删除</vxe-button>
<!-- <vxe-button type="text" icon="vxe-icon-delete"></vxe-button> -->
</template>
</vxe-column>
</vxe-table>
</div>
<div>
<vxe-pager v-model:current-page="pageVO1.currentPage" v-model:page-size="pageVO1.pageSize"
:total="pageVO1.total" />
</div>
</div>
<EditAccess ref="editOpenAccessRef" :title="state.editOpenAccessTitle" :orgData="state.orgTreeData" @handleQuery="handleQuery"/>
</div> </div>
</template> </template>
<script setup lang="ts" name="matter"> <script lang="ts" setup="" name="matter">
import { onMounted, reactive, ref, watch } from 'vue'; import { ref } from "vue";
import { getAPI } from '/@/utils/axios-utils'; import { ElMessageBox, ElMessage } from "element-plus";
import { BrandApi, MaterialClassifyApi, MaterialsApi} from '/@/api-services/api'; import { auth } from '/@/utils/authFunction';
import { AddMaterialsInput, BrandOutput, DeleteMaterialsInput, MaterialsOutput} from '/@/api-services/models'; // import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils';
import { ElMessageBox, ElMessage, TabsPaneContext } from 'element-plus'; // import { formatDate } from '/@/utils/formatTime';
import EditAccess from '/@/views/basics-date/matter/component/editOpenAccess.vue';
import editDialog from '/@/views/basics-date/matter/component/editOpenAccess.vue'
const editOpenAccessRef = ref<InstanceType<typeof EditAccess>>(); import { pageMaterials, deleteMaterials } from '/@/api/main/materials';
//
let fyListData = ref();
const showAdvanceQueryUI = ref(false);
const fyListGet = async () => { const editDialogRef = ref();
let res = await getAPI(MaterialClassifyApi).apiMaterialClassifyListGet(); const loading = ref(false);
if (res.data.code === 200) { const tableData = ref<any>([]);
fyListData.value = res.data.result; const queryParams = ref<any>({});
const tableParams = ref({
page: 1,
pageSize: 10,
total: 0,
});
const editMaterialsTitle = ref("");
//
const changeAdvanceQueryUI = () => {
showAdvanceQueryUI.value = !showAdvanceQueryUI.value;
} }
}
const state = reactive({ //
loading: false, const handleQuery = async () => {
editOpenAccessTitle:'新增', loading.value = true;
tableData: [] as Array<MaterialsOutput>, var res = await pageMaterials(Object.assign(queryParams.value, tableParams.value));
orgTreeData: [] as Array<MaterialsOutput>, tableData.value = res.data.result?.items ?? [];
brandDate:[] as Array<BrandOutput>, tableParams.value.total = res.data.result?.total;
tableParams: { loading.value = false;
page: 1, };
pageSize: 10,
total: 0 as any, //
}, const sortChange = async (column: any) => {
queryParams: { queryParams.value.field = column.prop;
name: '',// queryParams.value.order = column.order;
brand: '',// await handleQuery();
isEnable: "",// };
codeNum: '',//
searchKey: "",// //
specifications: "",// const openAddMaterials = () => {
classify: "" editMaterialsTitle.value = '添加物料';
}, editDialogRef.value.openDialog({});
editPrintTitle: '', };
});
const pageVO1 = reactive({ //
currentPage: 1, const openEditMaterials = (row: any) => {
pageSize: 10, editMaterialsTitle.value = '编辑物料';
total: 0 editDialogRef.value.openDialog(row);
}) };
onMounted(() => { //
fyListGet(); const delMaterials = (row: any) => {
ElMessageBox.confirm(`确定要删除吗?`, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(async () => {
await deleteMaterials(row);
handleQuery();
ElMessage.success("删除成功");
})
.catch(() => {});
};
//
const handleSizeChange = (val: number) => {
tableParams.value.pageSize = val;
handleQuery();
};
//
const handleCurrentChange = (val: number) => {
tableParams.value.page = val;
handleQuery();
};
handleQuery(); handleQuery();
getBrandList(); </script>
}) <style scoped>
:deep(.el-ipnut),
:deep(.el-select),
const handleQuery = async () => { :deep(.el-input-number) {
state.loading = true; width: 100%;
let params = Object.assign(state.queryParams, state.tableParams); }
let res = await getAPI(MaterialsApi).apiMaterialsPagePost(params); </style>
if (res.data.code === 200) {
state.tableData = res.data.result?.items!;
state.tableParams.total = res.data.result?.total!;
}
state.loading = false;
}
const onSubmit = () => {
handleQuery();
}
//
let brandDate = ref([] as BrandOutput[]);
const getBrandList = async () => {
let res = await getAPI(BrandApi).apiBrandListGet();
if (res.data.code === 200) {
brandDate.value = res.data.result!;
}
}
//
//let mTitle = ref('');
let dialogTableVisible = ref(false);
let matterFrom = reactive({} as AddMaterialsInput)
const add = () => {
state.editOpenAccessTitle = '新增';
editOpenAccessRef.value?.openDialog({ id: undefined });
}
const activeName = ref('基本信息')
const handleClick = (tab: TabsPaneContext, event: Event) => {
console.log(tab, event)
}
const clearFormValues = (formObject) => {
for (let key in formObject) {
if (formObject.hasOwnProperty(key)) {
formObject[key] = ''; // null
}
}
};
let key = ref(0)
watch(dialogTableVisible, (newValue, oldValue) => {
if (!newValue) {
clearFormValues(matterFrom)
//infoDate = [];
activeName.value = '基本信息';
}else{
key.value = Math.random();
}
})
//
const matterDelete = async (row: any) => {
ElMessageBox.confirm(`确定删除?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(async () => {
let deleteRow = {} as DeleteMaterialsInput
deleteRow.id=row.id
let res = await getAPI(MaterialsApi).apiMaterialsDeletePost(deleteRow);
//console.log(res)
if (res.data.code == 200) {
ElMessage({ message: '成功', type: 'success', })
handleQuery()
//state.tableData.handleList();
} else
ElMessage.error(res.data.message!)
})
.catch(() => {});
}
//
const editDelete = async (row: any) => {
let res = await getAPI(MaterialsApi).apiMaterialsDetailGet(row.id);
if (res.data.code === 200) {
//dialogTableVisible.value = true;
state.editOpenAccessTitle = '编辑';
//Object.assign(matterFrom, res.data.result)
editOpenAccessRef.value?.openDialog(row);
}
}
/**
* 单位组值变更
* @param clearBindUserId 是否清空
*/
// const unitGroupChange = async (clearBindUserId: boolean = true) => {
// var res = await getAPI(SysUnitApi).apiSysUnitListUnitGroupIdGet(groupId);
// state.userData = res.data.result ?? [];
// if (clearBindUserId) {
// state.ruleForm.bindUserId = undefined!;
// }
// };
</script>
<style lang="scss" scoped>
.main {
padding: 10px;
display: flex;
flex-direction: column;
.main-from {
// height: 300px;
width: 100%;
padding: 20px 10px;
.el-row {
width: 100%;
}
}
.main-table {
margin-top: 20px;
box-sizing: border-box;
padding: 10px;
flex-grow: 1;
height: 0;
display: flex;
flex-direction: column;
.tab {
flex: 1;
overflow: scroll;
}
.tab-hed {
display: flex;
justify-content: space-between;
margin: 5px;
align-items: center;
}
}
}
</style>

View File

@ -0,0 +1,327 @@
<!-- -->
<template>
<div class="main">
<div class="main-from common-box">
<el-form :inline="true" :model="state.queryParams" class="demo-form-inline" label-width="70px">
<el-row>
<el-col :span="8">
<el-form-item label="名称">
<el-input v-model="state.queryParams.name" placeholder="请输入名称" clearable />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="编码">
<el-input v-model="state.queryParams.codeNum" placeholder="请输入编码" clearable />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="规格型号">
<el-input v-model="state.queryParams.specifications" placeholder="请输入" clearable />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="关键字">
<el-input v-model="state.queryParams.searchKey" placeholder="请输入" clearable />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="品牌">
<el-select v-model="state.queryParams.brand" placeholder="请选择" clearable>
<el-option :label="item.name" :value="item.id" v-for="item, index in state.brandDate"
:key="index" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-form-item>
<el-button type="primary" @click="onSubmit"></el-button>
<el-button type="primary" @click="add"></el-button>
<el-dropdown style="margin-left: 10px;">
<el-button type="primary">
<el-icon class="el-icon--right"><arrow-down /></el-icon>
</el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item></el-dropdown-item>
<el-dropdown-item></el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</el-form-item>
</el-form>
</div>
<div class="main-table common-box">
<div class="tab-hed">
<el-select v-model="state.queryParams.classify" placeholder="分类" clearable style="width: 200px;">
<el-option :label="item.name" :value="item.id" v-for="item, index in fyListData" :key="index" />
</el-select>
<div>
<el-button type="success" link
style="border-right: 1px #515a6e solid; border-radius: 0px; margin-right: 3px; padding: 0 3px;"></el-button>
<el-dropdown>
<span class="el-dropdown-link">
<el-icon class="el-icon--right">
<arrow-down />
</el-icon>
</span>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item></el-dropdown-item>
<el-dropdown-item></el-dropdown-item>
<el-dropdown-item></el-dropdown-item>
<el-dropdown-item></el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</div>
</div>
<div class="tab">
<vxe-table show-overflow height="100%" :data="state.tableData" :border=true :tree-config="{ transform: true }"
:scroll-y="{ gt: 20 }">
<vxe-column field="codeNum" sortable title="编码" width=""></vxe-column>
<vxe-column field="name" sortable title="名称" width=""></vxe-column>
<vxe-column field="isEnable" sortable title="可用状态" width="">
<template #default="{ row }">
<!-- <el-switch v-model="row.isEnable" inline-prompt active-text="启用" inactive-text="禁用" /> -->
{{ row.isEnable ? '启用' : '禁用' }}
</template>
</vxe-column>
<vxe-column field="barcode" sortable title="仓库条码" width=""></vxe-column>
<vxe-column field="createTime" sortable title="创建时间" width=""></vxe-column>
<vxe-column title="操作" width="200" fixed="right" show-overflow>
<template #default="{ row }">
<vxe-button type="text"></vxe-button>
<vxe-button type="text" @click="editDelete(row)"></vxe-button>
<vxe-button @click="matterDelete(row)" type="text" style="color: rgb(223, 65, 65)"></vxe-button>
<!-- <vxe-button type="text" icon="vxe-icon-delete"></vxe-button> -->
</template>
</vxe-column>
</vxe-table>
</div>
<div>
<vxe-pager v-model:current-page="pageVO1.currentPage" v-model:page-size="pageVO1.pageSize"
:total="pageVO1.total" />
</div>
</div>
<EditAccess ref="editOpenAccessRef" :title="state.editOpenAccessTitle" :orgData="state.orgTreeData" @handleQuery="handleQuery"/>
</div>
</template>
<script setup lang="ts" name="matter">
import { onMounted, reactive, ref, watch } from 'vue';
import { getAPI } from '/@/utils/axios-utils';
import { BrandApi, MaterialClassifyApi, MaterialsApi} from '/@/api-services/api';
import { AddMaterialsInput, BrandOutput, DeleteMaterialsInput, MaterialsOutput} from '/@/api-services/models';
import { ElMessageBox, ElMessage, TabsPaneContext } from 'element-plus';
import EditAccess from '/@/views/basics-date/matter/component/editOpenAccess.vue';
const editOpenAccessRef = ref<InstanceType<typeof EditAccess>>();
//获取物料分类
let fyListData = ref();
const fyListGet = async () => {
let res = await getAPI(MaterialClassifyApi).apiMaterialClassifyListGet();
if (res.data.code === 200) {
fyListData.value = res.data.result;
}
}
const state = reactive({
loading: false,
editOpenAccessTitle:'新增',
tableData: [] as Array<MaterialsOutput>,
orgTreeData: [] as Array<MaterialsOutput>,
brandDate:[] as Array<BrandOutput>,
tableParams: {
page: 1,
pageSize: 10,
total: 0 as any,
},
queryParams: {
name: '',//名称
brand: '',//品牌
isEnable: "",//可用状态
codeNum: '',//编码
searchKey: "",//助记码
specifications: "",//规格型号
classify: ""
},
editPrintTitle: '',
});
const pageVO1 = reactive({
currentPage: 1,
pageSize: 10,
total: 0
})
onMounted(() => {
fyListGet();
handleQuery();
getBrandList();
})
const handleQuery = async () => {
state.loading = true;
let params = Object.assign(state.queryParams, state.tableParams);
let res = await getAPI(MaterialsApi).apiMaterialsPagePost(params);
if (res.data.code === 200) {
state.tableData = res.data.result?.items!;
state.tableParams.total = res.data.result?.total!;
}
state.loading = false;
}
const onSubmit = () => {
handleQuery();
}
//获取品牌数据
let brandDate = ref([] as BrandOutput[]);
const getBrandList = async () => {
let res = await getAPI(BrandApi).apiBrandListGet();
if (res.data.code === 200) {
brandDate.value = res.data.result!;
}
}
//新增
//let mTitle = ref('新增');
let dialogTableVisible = ref(false);
let matterFrom = reactive({} as AddMaterialsInput)
const add = () => {
state.editOpenAccessTitle = '新增';
editOpenAccessRef.value?.openDialog({ id: undefined });
}
const activeName = ref('基本信息')
const handleClick = (tab: TabsPaneContext, event: Event) => {
console.log(tab, event)
}
const clearFormValues = (formObject) => {
for (let key in formObject) {
if (formObject.hasOwnProperty(key)) {
formObject[key] = ''; // 或者 null
}
}
};
let key = ref(0)
watch(dialogTableVisible, (newValue, oldValue) => {
if (!newValue) {
clearFormValues(matterFrom)
//infoDate = [];
activeName.value = '基本信息';
}else{
key.value = Math.random();
}
})
//删除
const matterDelete = async (row: any) => {
ElMessageBox.confirm(`确定删除?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(async () => {
let deleteRow = {} as DeleteMaterialsInput
deleteRow.id=row.id
let res = await getAPI(MaterialsApi).apiMaterialsDeletePost(deleteRow);
//console.log(res)
if (res.data.code == 200) {
ElMessage({ message: '成功', type: 'success', })
handleQuery()
//state.tableData.handleList();
} else
ElMessage.error(res.data.message!)
})
.catch(() => {});
}
//编辑
const editDelete = async (row: any) => {
let res = await getAPI(MaterialsApi).apiMaterialsDetailGet(row.id);
if (res.data.code === 200) {
//dialogTableVisible.value = true;
state.editOpenAccessTitle = '编辑';
//Object.assign(matterFrom, res.data.result)
editOpenAccessRef.value?.openDialog(row);
}
}
/**
*
* @param clearBindUserId
*/
// const unitGroupChange = async (clearBindUserId: boolean = true) => {
// var res = await getAPI(SysUnitApi).apiSysUnitListUnitGroupIdGet(groupId);
// state.userData = res.data.result ?? [];
// if (clearBindUserId) {
// state.ruleForm.bindUserId = undefined!;
// }
// };
</script>
<style lang="scss" scoped>
.main {
padding: 10px;
display: flex;
flex-direction: column;
.main-from {
// height: 300px;
width: 100%;
padding: 20px 10px;
.el-row {
width: 100%;
}
}
.main-table {
margin-top: 20px;
box-sizing: border-box;
padding: 10px;
flex-grow: 1;
height: 0;
display: flex;
flex-direction: column;
.tab {
flex: 1;
overflow: scroll;
}
.tab-hed {
display: flex;
justify-content: space-between;
margin: 5px;
align-items: center;
}
}
}
</style>

View File

@ -13,7 +13,6 @@
<el-input v-model="formInline.codeNum" placeholder="请输入编码" clearable /> <el-input v-model="formInline.codeNum" placeholder="请输入编码" clearable />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-form-item> <el-form-item>
@ -26,14 +25,12 @@
</div> </div>
<div class="main-table common-box"> <div class="main-table common-box">
<div class="tab-left"> <div class="tab-left">
<div style="display: flex; justify-content: space-between; margin-bottom: 10px;"> <div style="display: flex; justify-content: space-between; margin-bottom: 10px;">
<div> <div>
单位组 单位组
</div> </div>
<div> <div>
<el-button type="success" link <el-button type="success" link
@click.prevent="addUnitGroup" @click.prevent="addUnitGroup"
style="border-right: 1px #515a6e solid; border-radius: 0px; margin-right: 3px; padding: 0 3px;">新增</el-button> style="border-right: 1px #515a6e solid; border-radius: 0px; margin-right: 3px; padding: 0 3px;">新增</el-button>
@ -47,7 +44,7 @@
<vxe-column field="name" sortable title="名称" width=""></vxe-column> <vxe-column field="name" sortable title="名称" width=""></vxe-column>
<vxe-column title="状态" width="60" fixed="right" show-overflow> <vxe-column title="状态" width="" fixed="right" show-overflow>
<template #default="{ row }"> <template #default="{ row }">
{{ row.isEnable ? '启用' : '关闭' }} {{ row.isEnable ? '启用' : '关闭' }}
<!-- <vxe-button type="text" icon="vxe-icon-delete"></vxe-button> --> <!-- <vxe-button type="text" icon="vxe-icon-delete"></vxe-button> -->
@ -79,6 +76,7 @@
<!-- <vxe-button type="text" icon="vxe-icon-delete"></vxe-button> --> <!-- <vxe-button type="text" icon="vxe-icon-delete"></vxe-button> -->
</template> </template>
</vxe-column> </vxe-column>
<vxe-column field="childUnitCount" sortable title="子单位数" width=""></vxe-column>
<vxe-column field="rate" sortable title="换算率" width=""></vxe-column> <vxe-column field="rate" sortable title="换算率" width=""></vxe-column>
<vxe-column field="isBaseUnit" sortable title="作为基本单位" width=""> <vxe-column field="isBaseUnit" sortable title="作为基本单位" width="">
<template #default="{ row }"> <template #default="{ row }">
@ -103,8 +101,8 @@
</div> </div>
</div> </div>
<el-dialog v-model="dialogTableVisible" :title="mTitle" width="850"> <el-dialog v-model="dialogTableVisible" :title="mTitle" width="860">
<el-form :inline="true" :model="unitFrom" class="demo-form-inline" label-width="70px"> <el-form :inline="true" :model="unitFrom" class="demo-form-inline" label-width="80px">
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
@ -133,21 +131,21 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="换算率"> <el-form-item label="子单位数" :rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-input v-model="unitFrom.rate" placeholder="请输入" clearable /> <el-input v-model="unitFrom.childUnitCount" placeholder="下级单位数量" clearable />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="代码"> <el-form-item label="换算率" :rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-input v-model="unitFrom.code" placeholder="请输入" clearable /> <el-input v-model="unitFrom.rate" placeholder="基本单位数量" clearable />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="基本单位"> <el-form-item label="代码">
<el-switch v-model="unitFrom.isBaseUnit" inline-prompt active-text="" inactive-text="" /> <el-input v-model="unitFrom.code" placeholder="请输入" clearable />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
@ -161,11 +159,19 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-col :span="8"> <el-row>
<el-col :span="8">
<el-form-item label="基本单位">
<el-switch v-model="unitFrom.isBaseUnit" inline-prompt active-text="" inactive-text="" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="是否启用"> <el-form-item label="是否启用">
<el-switch v-model="unitFrom.isEnable" inline-prompt active-text="" inactive-text="" /> <el-switch v-model="unitFrom.isEnable" inline-prompt active-text="" inactive-text="" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row>
</el-form> </el-form>
<el-row style="display: flex; justify-content: space-around;"> <el-row style="display: flex; justify-content: space-around;">
<el-button style="width: 100px;" type="primary" @click="unitSubmit"></el-button> <el-button style="width: 100px;" type="primary" @click="unitSubmit"></el-button>
@ -207,7 +213,7 @@
import { onMounted, reactive, ref } from 'vue' import { onMounted, reactive, ref } from 'vue'
import { getAPI } from '/@/utils/axios-utils'; import { getAPI } from '/@/utils/axios-utils';
import { SysUnitApi, SysUnitGroupApi } from '/@/api-services/api'; import { SysUnitApi, SysUnitGroupApi } from '/@/api-services/api';
import { AddSysUnitInput, SqlSugarPagedListSysUnitOutput, SysUnitGroupOutput,AddSysUnitGroupInput, SysUnitInput} from '/@/api-services/models'; import { AddSysUnitInput, SqlSugarPagedListSysUnitOutput, SysUnitGroupOutput, SysUnitInput} from '/@/api-services/models';
import type { FormRules } from "element-plus"; import type { FormRules } from "element-plus";
import { ElMessageBox, ElMessage } from 'element-plus'; import { ElMessageBox, ElMessage } from 'element-plus';
@ -228,7 +234,7 @@ let unitGroupModel=reactive<any>({isEnable:true,isDelete:false});
let mGroupTitle = ref('新增'); let mGroupTitle = ref('新增');
let dialogTableVisible = ref(false); let dialogTableVisible = ref(false);
let unitFrom = reactive<any>({isEnable:true,isDelete:false,name:'',codeNum:''}) const unitFrom = ref<any>({isEnable:true,isDelete:false,name:'',codeNum:''})
const cancel=()=>{ const cancel=()=>{
isShowDialog.value=false isShowDialog.value=false
@ -284,13 +290,13 @@ const addUnit= ()=>{
// //
const unitSubmit = async () => { const unitSubmit = async () => {
if(mTitle.value=='新增'){ if(mTitle.value=='新增'){
let res = await getAPI(SysUnitApi).apiSysUnitAddPost(unitFrom); let res = await getAPI(SysUnitApi).apiSysUnitAddPost(unitFrom.value);
if (res.data.code===200) { if (res.data.code===200) {
dialogTableVisible.value = false; dialogTableVisible.value = false;
unitPage(); unitPage();
} }
}else{ }else{
let res = await getAPI(SysUnitApi).apiSysUnitUpdatePost(unitFrom); let res = await getAPI(SysUnitApi).apiSysUnitUpdatePost(unitFrom.value);
if (res.data.code===200) { if (res.data.code===200) {
dialogTableVisible.value = false; dialogTableVisible.value = false;
unitPage(); unitPage();
@ -300,7 +306,7 @@ const unitSubmit = async () => {
} }
const editUnit=async(row:any)=>{ const editUnit=async(row:any)=>{
unitFrom=row; unitFrom.value=row;
mTitle.value='编辑' mTitle.value='编辑'
dialogTableVisible.value=true; dialogTableVisible.value=true;
} }
@ -312,7 +318,6 @@ const deleteUnit=async(row:any)=>{
type: 'warning', type: 'warning',
}) })
.then(async () => { .then(async () => {
console.log(row)
let res = await getAPI(SysUnitApi).apiSysUnitDeletePost(row); let res = await getAPI(SysUnitApi).apiSysUnitDeletePost(row);
if (res.data.code == 200) { if (res.data.code == 200) {
ElMessage({ message: '成功', type: 'success', }) ElMessage({ message: '成功', type: 'success', })
@ -325,9 +330,8 @@ const deleteUnit=async(row:any)=>{
} }
const addUnitGroup=()=>{ const addUnitGroup=()=>{
isShowDialog.value=true
isShowDialog.value=true
} }

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="sys-open-access-container"> <div class="sys-open-access-container">
<el-dialog v-model="state.isShowDialog" :title="props.title" width="1000"> <el-dialog v-model="state.isShowDialog" :title="props.title" width="900">
<el-form :inline="true" :model="printInfoFrom" class="demo-form-inline" label-width="90px"> <el-form :inline="true" :model="printInfoFrom" class="demo-form-inline" label-width="90px">
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
@ -16,7 +16,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="单位" prop="unit" :rules="[{ required: true, message: '基本单位不能为空', trigger: 'blur' }]"> <el-form-item label="基本单位" prop="unit" :rules="[{ required: true, message: '基本单位不能为空', trigger: 'blur' }]">
<el-select v-model="printInfoFrom.unit" placeholder="基本单位" filterable default-first-option style="width: 100%"> <el-select v-model="printInfoFrom.unit" placeholder="基本单位" filterable default-first-option style="width: 100%">
<el-option v-for="item in state.unitData" :key="item.id" :label="item.name" :value="item.name" /> <el-option v-for="item in state.unitData" :key="item.id" :label="item.name" :value="item.name" />
</el-select> </el-select>
@ -26,8 +26,10 @@
<el-row> <el-row>
<!-- <el-col :span="8"> <!-- <el-col :span="8">
<el-form-item label="包装单位"> <el-form-item label="包装单位" prop="packageUnit" :rules="[{ required: true, message: '包装单位不能为空', trigger: 'blur' }]">
<el-input v-model="printInfoFrom.packageUnit" placeholder="请输入" clearable /> <el-select v-model="printInfoFrom.packageUnit" placeholder="包装单位" filterable default-first-option style="width: 100%">
<el-option v-for="item in codeConfigData" :key="item.id" :label="item.name" :value="item.name" />
</el-select>
</el-form-item> </el-form-item>
</el-col> --> </el-col> -->
<el-col :span="8"> <el-col :span="8">
@ -37,6 +39,11 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<!-- <el-col :span="8">
<el-form-item label="标签数量">
<el-input v-model="printInfoFrom.printCount" placeholder="请输入编码" clearable disabled/>
</el-form-item>
</el-col> -->
</el-row> </el-row>
<el-row> <el-row>
@ -73,8 +80,8 @@
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, reactive,ref } from 'vue' import { onMounted, reactive,ref } from 'vue'
import { getAPI } from '/@/utils/axios-utils'; import { getAPI } from '/@/utils/axios-utils';
import { SysUnitApi, MaterialsApi, SysPrintApi, PrintDataApi } from '/@/api-services/api'; import { SysUnitApi, SysPrintApi, PrintDataApi } from '/@/api-services/api';
import { SysUnitOutput, MaterialsOutput, SysPrint, PrintDataInput, PrintData, PrintDataMaterialsInput } from '/@/api-services/models'; import { SysUnitOutput, MaterialsOutput, SysPrint, PrintData } from '/@/api-services/models';
import { ElMessageBox, ElMessage, TabsPaneContext } from 'element-plus'; import { ElMessageBox, ElMessage, TabsPaneContext } from 'element-plus';
import VueJsonPretty from 'vue-json-pretty'; import VueJsonPretty from 'vue-json-pretty';
import 'vue-json-pretty/lib/styles.css'; import 'vue-json-pretty/lib/styles.css';

View File

@ -34,7 +34,7 @@
:scroll-y="{ gt: 20 }"> :scroll-y="{ gt: 20 }">
<vxe-column type="seq" title="序号" width="70" sortable></vxe-column> <vxe-column type="seq" title="序号" width="70" sortable></vxe-column>
<vxe-column field="name" sortable title="物料名称" width="300"></vxe-column> <vxe-column field="name" sortable title="物料名称" width="300"></vxe-column>
<vxe-column field="codeNum" sortable title="编码" width="120"></vxe-column> <vxe-column field="codeNum" sortable title="编码" width="160"></vxe-column>
<vxe-column field="specifications" sortable title="规格型号" width=""></vxe-column> <vxe-column field="specifications" sortable title="规格型号" width=""></vxe-column>
<vxe-column field="brand" sortable title="品牌" width=""></vxe-column> <vxe-column field="brand" sortable title="品牌" width=""></vxe-column>
<vxe-column field="unit" sortable title="基本单位" width=""></vxe-column> <vxe-column field="unit" sortable title="基本单位" width=""></vxe-column>

View File

@ -0,0 +1,170 @@
<template>
<div class="reportTable-container">
<el-dialog v-model="isShowDialog" :width="800" draggable="">
<template #header>
<div style="color: #fff">
<!--<el-icon size="16" style="margin-right: 3px; display: inline; vertical-align: middle"> <ele-Edit /> </el-icon>-->
<span>{{ props.title }}</span>
</div>
</template>
<el-form :model="ruleForm" ref="ruleFormRef" label-width="auto" :rules="rules">
<el-row :gutter="35">
<el-form-item v-show="false">
<el-input v-model="ruleForm.id" />
</el-form-item>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="单号" prop="oddNumber">
<el-input v-model="ruleForm.oddNumber" placeholder="请输入单号" maxlength="32" show-word-limit clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="业务日期" prop="startDate">
<el-date-picker v-model="ruleForm.startDate" type="date" placeholder="业务日期" />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="状态" prop="state">
<el-input-number v-model="ruleForm.state" placeholder="请输入状态" clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="生产类型" prop="productType">
<el-input v-model="ruleForm.productType" placeholder="请输入生产类型" maxlength="32" show-word-limit clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="生产线" prop="productionLine">
<el-input v-model="ruleForm.productionLine" placeholder="请输入生产线" maxlength="32" show-word-limit clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="生产线编码" prop="codeNum">
<el-input v-model="ruleForm.codeNum" placeholder="请输入生产线编码" maxlength="32" show-word-limit clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="源单号" prop="sourceNumber">
<el-input v-model="ruleForm.sourceNumber" placeholder="请输入源单号" maxlength="32" show-word-limit clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="备注" prop="remarks">
<el-input v-model="ruleForm.remarks" placeholder="请输入备注" maxlength="64" show-word-limit clearable />
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="cancel"> </el-button>
<el-button type="primary" @click="submit"> </el-button>
</span>
</template>
</el-dialog>
</div>
</template>
<style scoped>
:deep(.el-select),
:deep(.el-input-number) {
width: 100%;
}
</style>
<script lang="ts" setup>
import { ref,onMounted } from "vue";
import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils';
import { ElMessage } from "element-plus";
import type { FormRules } from "element-plus";
import { addReportTable, updateReportTable, detailReportTable } from "/@/api/main/reportTable";
//
var props = defineProps({
title: {
type: String,
default: "",
},
});
//
const emit = defineEmits(["reloadTable"]);
const ruleFormRef = ref();
const isShowDialog = ref(false);
const ruleForm = ref<any>({});
//
const rules = ref<FormRules>({
});
//
const openDialog = async (row: any) => {
// ruleForm.value = JSON.parse(JSON.stringify(row));
// detail
let rowData = JSON.parse(JSON.stringify(row));
if (rowData.id)
ruleForm.value = (await detailReportTable(rowData.id)).data.result;
else
ruleForm.value = rowData;
isShowDialog.value = true;
};
//
const closeDialog = () => {
emit("reloadTable");
isShowDialog.value = false;
};
//
const cancel = () => {
isShowDialog.value = false;
};
//
const submit = async () => {
ruleFormRef.value.validate(async (isValid: boolean, fields?: any) => {
if (isValid) {
let values = ruleForm.value;
if (ruleForm.value.id == undefined || ruleForm.value.id == null || ruleForm.value.id == "" || ruleForm.value.id == 0) {
await addReportTable(values);
} else {
await updateReportTable(values);
}
closeDialog();
} else {
ElMessage({
message: `表单有${Object.keys(fields).length}处验证失败,请修改后再提交`,
type: "error",
});
}
});
};
//
onMounted(async () => {
});
//
defineExpose({ openDialog });
</script>

View File

@ -0,0 +1,218 @@
<template>
<div class="reportTable-container">
<el-card shadow="hover" :body-style="{ paddingBottom: '0' }">
<el-form :model="queryParams" ref="queryForm" labelWidth="90">
<el-row>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10">
<el-form-item label="关键字">
<el-input v-model="queryParams.searchKey" clearable="" placeholder="请输入模糊查询关键字"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="单号">
<el-input v-model="queryParams.oddNumber" clearable="" placeholder="请输入单号"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="业务日期">
<el-date-picker placeholder="请选择业务日期" value-format="YYYY/MM/DD" type="daterange" v-model="queryParams.startDateRange" />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="状态">
<el-input-number v-model="queryParams.state" clearable="" placeholder="请输入状态"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="生产类型">
<el-input v-model="queryParams.productType" clearable="" placeholder="请输入生产类型"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="生产线">
<el-input v-model="queryParams.productionLine" clearable="" placeholder="请输入生产线"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="生产线编码">
<el-input v-model="queryParams.codeNum" clearable="" placeholder="请输入生产线编码"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="源单号">
<el-input v-model="queryParams.sourceNumber" clearable="" placeholder="请输入源单号"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="备注">
<el-input v-model="queryParams.remarks" clearable="" placeholder="请输入备注"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6" class="mb10">
<el-form-item>
<el-button-group style="display: flex; align-items: center;">
<el-button type="primary" icon="ele-Search" @click="handleQuery" v-auth="'reportTable:page'"> </el-button>
<el-button icon="ele-Refresh" @click="() => queryParams = {}"> 重置 </el-button>
<el-button icon="ele-ZoomIn" @click="changeAdvanceQueryUI" v-if="!showAdvanceQueryUI" style="margin-left:5px;"> </el-button>
<el-button icon="ele-ZoomOut" @click="changeAdvanceQueryUI" v-if="showAdvanceQueryUI" style="margin-left:5px;"> </el-button>
<!-- <el-button type="primary" style="margin-left:5px;" icon="ele-Plus" @click="openAddReportTable" v-auth="'reportTable:add'"> </el-button> -->
</el-button-group>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
<el-card class="full-table" shadow="hover" style="margin-top: 5px">
<el-table
:data="tableData"
style="width: 100%"
v-loading="loading"
tooltip-effect="light"
row-key="id"
@sort-change="sortChange"
border="">
<el-table-column type="index" label="序号" width="55" align="center"/>
<el-table-column prop="oddNumber" label="单号" width="140" show-overflow-tooltip="" />
<el-table-column prop="startDate" label="业务日期" width="140" show-overflow-tooltip="" />
<el-table-column prop="state" label="状态" width="140" show-overflow-tooltip="" />
<el-table-column prop="productType" label="生产类型" width="140" show-overflow-tooltip="" />
<el-table-column prop="productionLine" label="生产线" width="140" show-overflow-tooltip="" />
<el-table-column prop="codeNum" label="生产线编码" width="140" show-overflow-tooltip="" />
<el-table-column prop="sourceNumber" label="源单号" width="140" show-overflow-tooltip="" />
<el-table-column prop="remarks" label="备注" width="140" show-overflow-tooltip="" />
<el-table-column label="操作" width="140" align="center" fixed="right" show-overflow-tooltip="" v-if="auth('reportTable:update') || auth('reportTable:delete')">
<template #default="scope">
<el-button icon="ele-Edit" size="small" text="" type="primary" @click="openEditReportTable(scope.row)" v-auth="'reportTable:update'"> </el-button>
<el-button icon="ele-Delete" size="small" text="" type="primary" @click="delReportTable(scope.row)" v-auth="'reportTable:delete'"> </el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
v-model:currentPage="tableParams.page"
v-model:page-size="tableParams.pageSize"
:total="tableParams.total"
:page-sizes="[10, 20, 50, 100, 200, 500]"
small=""
background=""
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes, prev, pager, next, jumper"
/>
<editDialog
ref="editDialogRef"
:title="editReportTableTitle"
@reloadTable="handleQuery"
/>
</el-card>
</div>
</template>
<script lang="ts" setup="" name="printDataDetail">
import { ref } from "vue";
import { ElMessageBox, ElMessage } from "element-plus";
import { auth } from '/@/utils/authFunction';
import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils';
import { formatDate } from '/@/utils/formatTime';
import editDialog from '/@/views/productionCenter/reportTable/component/editDialog.vue'
import { pageReportTable, deleteReportTable } from '/@/api/main/reportTable';
const showAdvanceQueryUI = ref(false);
const editDialogRef = ref();
const loading = ref(false);
const tableData = ref<any>([]);
const queryParams = ref<any>({});
const tableParams = ref({
page: 1,
pageSize: 10,
total: 0,
});
const editReportTableTitle = ref("");
//
const changeAdvanceQueryUI = () => {
showAdvanceQueryUI.value = !showAdvanceQueryUI.value;
}
//
const handleQuery = async () => {
loading.value = true;
var res = await pageReportTable(Object.assign(queryParams.value, tableParams.value));
tableData.value = res.data.result?.items ?? [];
tableParams.value.total = res.data.result?.total;
loading.value = false;
};
//
const sortChange = async (column: any) => {
queryParams.value.field = column.prop;
queryParams.value.order = column.order;
await handleQuery();
};
//
const openAddReportTable = () => {
editReportTableTitle.value = '添加汇报单';
editDialogRef.value.openDialog({});
};
//
const openEditReportTable = (row: any) => {
editReportTableTitle.value = '编辑汇报单';
editDialogRef.value.openDialog(row);
};
//
const delReportTable = (row: any) => {
ElMessageBox.confirm(`确定要删除吗?`, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(async () => {
await deleteReportTable(row);
handleQuery();
ElMessage.success("删除成功");
})
.catch(() => {});
};
//
const handleSizeChange = (val: number) => {
tableParams.value.pageSize = val;
handleQuery();
};
//
const handleCurrentChange = (val: number) => {
tableParams.value.page = val;
handleQuery();
};
handleQuery();
</script>
<style scoped>
:deep(.el-ipnut),
:deep(.el-select),
:deep(.el-input-number) {
width: 100%;
}
</style>