528
parent
afc41d099e
commit
1cc29a2b98
|
@ -80,4 +80,8 @@
|
|||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="SeedData\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -91,4 +91,10 @@ public class PrintCodeDetail : EntityBase
|
|||
[SugarColumn(ColumnName = "WarehouseID", ColumnDescription = "仓库ID")]
|
||||
public long? WarehouseID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 父节点ID
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "FatherId", ColumnDescription = "父节点ID")]
|
||||
public long? FatherId { get; set; }
|
||||
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ namespace Admin.NET.Application.Entity;
|
|||
[SugarTable("SysUnit","单位")]
|
||||
public class SysUnit : EntityTenant
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 创建者部门Id
|
||||
/// </summary>
|
||||
|
@ -83,4 +82,10 @@ public class SysUnit : EntityTenant
|
|||
[SugarColumn(ColumnName = "GroupUnitId", ColumnDescription = "单位组ID")]
|
||||
public long? GroupUnitId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 子单位数量
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "ChildUnitCount", ColumnDescription = "子单位数量")]
|
||||
public int ChildUnitCount { get; set; }
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -65,6 +65,11 @@ public class PrintCodeDetailDto
|
|||
/// </summary>
|
||||
public long? WarehouseID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 父节点ID
|
||||
/// </summary>
|
||||
public long? FatherId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 打码时间
|
||||
/// </summary>
|
||||
|
|
|
@ -48,21 +48,25 @@ public class PrintCodeDetailBaseInput
|
|||
/// </summary>
|
||||
public virtual int? ChildCount { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 打印单ID
|
||||
/// </summary>
|
||||
public long? TempListId { get; set; }
|
||||
public virtual long? TempListId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 汇报单ID
|
||||
/// </summary>
|
||||
public long? ReportTableId { get; set; }
|
||||
public virtual long? ReportTableId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 父节点ID
|
||||
/// </summary>
|
||||
public virtual long? FatherId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 仓库ID
|
||||
/// </summary>
|
||||
public long? WarehouseID { get; set; }
|
||||
public virtual long? WarehouseID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 打码时间
|
||||
|
@ -166,6 +170,21 @@ public class PrintCodeDetailInput : BasePageInput
|
|||
/// </summary>
|
||||
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>
|
||||
|
|
|
@ -65,6 +65,11 @@ public class PrintCodeDetailOutput
|
|||
/// </summary>
|
||||
public long? WarehouseID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 父节点ID
|
||||
/// </summary>
|
||||
public long? FatherId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 打码时间
|
||||
/// </summary>
|
||||
|
|
|
@ -110,7 +110,7 @@ public class PrintDataService : IDynamicApiController, ITransient
|
|||
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>();
|
||||
if (string.IsNullOrEmpty(codeName))
|
||||
|
|
|
@ -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; }
|
||||
}
|
|
@ -17,13 +17,15 @@ public class ReportTableService : IDynamicApiController, ITransient
|
|||
private readonly PrintCodeDetailService _codeDetailService;
|
||||
private readonly ReportDetailTableService _reportDetailTable;
|
||||
private readonly UserManager _userManager;
|
||||
private readonly PrintDataService _printDataService;
|
||||
|
||||
public ReportTableService(SqlSugarRepository<ReportTable> rep,
|
||||
UserManager userManager,
|
||||
SysUnitService repUnit,
|
||||
SysUnitGroupService repUnitGroup,
|
||||
PrintCodeDetailService codeDetailService,
|
||||
ReportDetailTableService reportDetailTable)
|
||||
ReportDetailTableService reportDetailTable,
|
||||
PrintDataService printDataService)
|
||||
{
|
||||
_rep = rep;
|
||||
_repUnit = repUnit;
|
||||
|
@ -31,6 +33,7 @@ public class ReportTableService : IDynamicApiController, ITransient
|
|||
_codeDetailService = codeDetailService;
|
||||
_reportDetailTable = reportDetailTable;
|
||||
_userManager = userManager;
|
||||
_printDataService = printDataService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -176,9 +179,10 @@ public class ReportTableService : IDynamicApiController, ITransient
|
|||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[ApiDescriptionSettings(Name = "AddReport")]
|
||||
public async Task AddPrintList(AddReportContext input)
|
||||
[ApiDescriptionSettings(Name = "AddPrintList")]
|
||||
public async Task<List<PrintCodeTreeData>> AddPrintList(AddReportContext input)
|
||||
{
|
||||
var result = new List<PrintCodeTreeData>();
|
||||
var unitGroup = await _repUnitGroup.Detail(new QueryByIdSysUnitGroupInput() { Id = input.UnitGroupId });
|
||||
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 addReport = await Add(newReport);
|
||||
var others = units.FindAll(a => a.Rate < unit.Rate).OrderBy(a => a.Rate).ToList();
|
||||
int toltalCount = 1;
|
||||
foreach (var other in others)
|
||||
{
|
||||
toltalCount *= other.Rate.ToInt();
|
||||
}
|
||||
others.Reverse();
|
||||
int toltalCount = unit.Rate.ToInt();
|
||||
var baseUnit = others.Count > 0 ? others.LastOrDefault().Name : unit.Name;
|
||||
var userId = _userManager.UserId;
|
||||
var userName = _userManager.RealName;
|
||||
List<SysUnitOutput> tempUnits = new List<SysUnitOutput>();
|
||||
tempUnits.AddRange(others);
|
||||
foreach (var item in input.PrintDatas)
|
||||
{
|
||||
var code = string.IsNullOrEmpty(item.BarCode) ? item.QrCode : 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 };
|
||||
if (others.Count>0)
|
||||
{
|
||||
detail.ChildCount = others.LastOrDefault().Rate;
|
||||
}
|
||||
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 };
|
||||
var detailId = await _codeDetailService.Add(detail);
|
||||
|
||||
for (int i = 0; i < others.Count; i++)
|
||||
var treeData1 = detail.Adapt<PrintCodeTreeData>();
|
||||
if (others.Count < 1)
|
||||
{
|
||||
var current = others[i];
|
||||
int count = current.Rate.ToInt();
|
||||
if (i < others.Count - 1)
|
||||
result.Add(treeData1);
|
||||
continue;
|
||||
}
|
||||
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();
|
||||
if (ends.Count>0)
|
||||
treeData2.Children = new List<PrintCodeTreeData>();
|
||||
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);
|
||||
}
|
||||
|
||||
var entity = input.Adapt<ReportTable>();
|
||||
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,113 +1,117 @@
|
|||
namespace Admin.NET.Application;
|
||||
|
||||
/// <summary>
|
||||
/// 单位输出参数
|
||||
/// </summary>
|
||||
public class SysUnitDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 单位输出参数
|
||||
/// 主键Id
|
||||
/// </summary>
|
||||
public class SysUnitDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键Id
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 租户Id
|
||||
/// </summary>
|
||||
public long? TenantId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime? CreateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新时间
|
||||
/// </summary>
|
||||
public DateTime? UpdateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建者Id
|
||||
/// </summary>
|
||||
public long? CreateUserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建者姓名
|
||||
/// </summary>
|
||||
public string? CreateUserName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改者Id
|
||||
/// </summary>
|
||||
public long? UpdateUserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改者姓名
|
||||
/// </summary>
|
||||
public string? UpdateUserName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建者部门Id
|
||||
/// </summary>
|
||||
public long? CreateOrgId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建者部门名称
|
||||
/// </summary>
|
||||
public string? CreateOrgName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 软删除
|
||||
/// </summary>
|
||||
public bool IsDelete { 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 int? Rate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 作为基本单位
|
||||
/// </summary>
|
||||
public bool? IsBaseUnit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 精度
|
||||
/// </summary>
|
||||
public int? Accuracy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 外部编码
|
||||
/// </summary>
|
||||
public string? ExternalNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string? Remarks { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单位组ID
|
||||
/// </summary>
|
||||
public long? GroupUnitId { get; set; }
|
||||
|
||||
}
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 租户Id
|
||||
/// </summary>
|
||||
public long? TenantId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime? CreateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新时间
|
||||
/// </summary>
|
||||
public DateTime? UpdateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建者Id
|
||||
/// </summary>
|
||||
public long? CreateUserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建者姓名
|
||||
/// </summary>
|
||||
public string? CreateUserName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改者Id
|
||||
/// </summary>
|
||||
public long? UpdateUserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改者姓名
|
||||
/// </summary>
|
||||
public string? UpdateUserName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建者部门Id
|
||||
/// </summary>
|
||||
public long? CreateOrgId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建者部门名称
|
||||
/// </summary>
|
||||
public string? CreateOrgName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 软删除
|
||||
/// </summary>
|
||||
public bool IsDelete { 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 int? Rate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 作为基本单位
|
||||
/// </summary>
|
||||
public bool? IsBaseUnit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 精度
|
||||
/// </summary>
|
||||
public int? Accuracy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 外部编码
|
||||
/// </summary>
|
||||
public string? ExternalNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string? Remarks { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单位组ID
|
||||
/// </summary>
|
||||
public long? GroupUnitId { get; set; }
|
||||
/// <summary>
|
||||
/// 子单位数量
|
||||
/// </summary>
|
||||
public int ChildUnitCount { get; set; }
|
||||
|
||||
}
|
||||
|
|
|
@ -3,216 +3,224 @@ using System.ComponentModel.DataAnnotations;
|
|||
|
||||
namespace Admin.NET.Application;
|
||||
|
||||
/// <summary>
|
||||
/// 单位基础输入参数
|
||||
/// </summary>
|
||||
public class SysUnitBaseInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 单位基础输入参数
|
||||
/// 租户Id
|
||||
/// </summary>
|
||||
public class SysUnitBaseInput
|
||||
{
|
||||
/// <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; }
|
||||
|
||||
}
|
||||
public virtual long? TenantId { 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; }
|
||||
|
||||
}
|
||||
public virtual DateTime? CreateTime { 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; }
|
||||
|
||||
}
|
||||
public virtual DateTime? UpdateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单位删除输入参数
|
||||
/// 创建者Id
|
||||
/// </summary>
|
||||
public class DeleteSysUnitInput : BaseIdInput
|
||||
{
|
||||
}
|
||||
public virtual long? CreateUserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单位更新输入参数
|
||||
/// 创建者姓名
|
||||
/// </summary>
|
||||
public class UpdateSysUnitInput : SysUnitBaseInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键Id
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "主键Id不能为空")]
|
||||
public long Id { get; set; }
|
||||
|
||||
}
|
||||
public virtual string? CreateUserName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单位主键查询输入参数
|
||||
/// 修改者Id
|
||||
/// </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
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -9,107 +9,112 @@ public class SysUnitOutput
|
|||
/// 主键Id
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 租户Id
|
||||
/// </summary>
|
||||
public long? TenantId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime? CreateTime { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 更新时间
|
||||
/// </summary>
|
||||
public DateTime? UpdateTime { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 创建者Id
|
||||
/// </summary>
|
||||
public long? CreateUserId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 创建者姓名
|
||||
/// </summary>
|
||||
public string? CreateUserName { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 修改者Id
|
||||
/// </summary>
|
||||
public long? UpdateUserId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 修改者姓名
|
||||
/// </summary>
|
||||
public string? UpdateUserName { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 创建者部门Id
|
||||
/// </summary>
|
||||
public long? CreateOrgId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 创建者部门名称
|
||||
/// </summary>
|
||||
public string? CreateOrgName { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 软删除
|
||||
/// </summary>
|
||||
public bool IsDelete { 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 int? Rate { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 作为基本单位
|
||||
/// </summary>
|
||||
public bool? IsBaseUnit { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 精度
|
||||
/// </summary>
|
||||
public int? Accuracy { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 外部编码
|
||||
/// </summary>
|
||||
public string? ExternalNumber { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string? Remarks { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 单位组ID
|
||||
/// </summary>
|
||||
public long? GroupUnitId { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 子单位数量
|
||||
/// </summary>
|
||||
public int ChildUnitCount { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ public class SysUnitService : IDynamicApiController, ITransient
|
|||
[ApiDescriptionSettings(Name = "List")]
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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; }
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -330,10 +330,18 @@ public static class SqlSugarSetup
|
|||
var entityInfo = dbProvider.EntityMaintenance.GetEntityInfo(entityType);
|
||||
if (entityInfo.Columns.Any(u => u.IsPrimarykey))
|
||||
{
|
||||
// 按主键进行批量增加和更新
|
||||
var storage = dbProvider.StorageableByObject(seedData.ToList()).ToStorage();
|
||||
storage.AsInsertable.ExecuteCommand();
|
||||
storage.AsUpdateable.ExecuteCommand();
|
||||
try
|
||||
{
|
||||
// 按主键进行批量增加和更新
|
||||
var storage = dbProvider.StorageableByObject(seedData.ToList()).ToStorage();
|
||||
storage.AsInsertable.ExecuteCommand();
|
||||
storage.AsUpdateable.ExecuteCommand();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -148,6 +148,14 @@ export interface AddSysUnitInput {
|
|||
*/
|
||||
groupUnitId?: number | null;
|
||||
|
||||
/**
|
||||
* 子单位数量
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof AddSysUnitInput
|
||||
*/
|
||||
childUnitCount?: number | null;
|
||||
|
||||
/**
|
||||
* 软删除
|
||||
*
|
||||
|
|
|
@ -123,4 +123,12 @@ export interface SysUnitInput {
|
|||
* @memberof SysUnitInput
|
||||
*/
|
||||
groupUnitId?: number | null;
|
||||
|
||||
/**
|
||||
* 子单位数量
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof SysUnitInput
|
||||
*/
|
||||
childUnitCount?: number | null;
|
||||
}
|
||||
|
|
|
@ -187,4 +187,12 @@ export interface SysUnitOutput {
|
|||
* @memberof SysUnitOutput
|
||||
*/
|
||||
groupUnitId?: number | null;
|
||||
|
||||
/**
|
||||
* 子单位数量
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof SysUnitOutput
|
||||
*/
|
||||
childUnitCount?: number | null;
|
||||
}
|
||||
|
|
|
@ -187,4 +187,12 @@ export interface SysUnit {
|
|||
* @memberof SysUnit
|
||||
*/
|
||||
groupUnitId?: number | null;
|
||||
|
||||
/**
|
||||
* 子单位数量
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof SysUnit
|
||||
*/
|
||||
childUnitCount?: number | null;
|
||||
}
|
||||
|
|
|
@ -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 },
|
||||
});
|
||||
|
||||
|
|
@ -232,7 +232,7 @@ const state = reactive({
|
|||
const openDialog = async (row: any) => {
|
||||
ruleFormRef.value?.resetFields();
|
||||
//state.selectedTabName = '0'; // 重置为第一个 tab 页
|
||||
//state.ruleForm = JSON.parse(JSON.stringify(row));
|
||||
//let rowData = JSON.parse(JSON.stringify(row));
|
||||
if (row.id != undefined) {
|
||||
state.matterFrom=row;
|
||||
//var resRole = await getAPI(MaterialsApi).apiMaterialsDetailGet(row.id);
|
||||
|
|
|
@ -1,327 +1,215 @@
|
|||
<!-- 物料 -->
|
||||
<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>
|
||||
<div class="materials-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.name" 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.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">
|
||||
<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"/>
|
||||
<editDialog
|
||||
ref="editDialogRef"
|
||||
:title="editMaterialsTitle"
|
||||
@reloadTable="handleQuery"
|
||||
/>
|
||||
</el-card>
|
||||
</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;
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup="" name="matter">
|
||||
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/basics-date/matter/component/editOpenAccess.vue'
|
||||
import { pageMaterials, deleteMaterials } from '/@/api/main/materials';
|
||||
|
||||
|
||||
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 editMaterialsTitle = ref("");
|
||||
|
||||
// 改变高级查询的控件显示状态
|
||||
const changeAdvanceQueryUI = () => {
|
||||
showAdvanceQueryUI.value = !showAdvanceQueryUI.value;
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
|
||||
// 查询操作
|
||||
const handleQuery = async () => {
|
||||
loading.value = true;
|
||||
var res = await pageMaterials(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 openAddMaterials = () => {
|
||||
editMaterialsTitle.value = '添加物料';
|
||||
editDialogRef.value.openDialog({});
|
||||
};
|
||||
|
||||
|
||||
// 打开编辑页面
|
||||
const openEditMaterials = (row: any) => {
|
||||
editMaterialsTitle.value = '编辑物料';
|
||||
editDialogRef.value.openDialog(row);
|
||||
};
|
||||
|
||||
// 删除
|
||||
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();
|
||||
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>
|
||||
</script>
|
||||
<style scoped>
|
||||
:deep(.el-ipnut),
|
||||
:deep(.el-select),
|
||||
:deep(.el-input-number) {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
|
@ -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>
|
|
@ -13,7 +13,6 @@
|
|||
<el-input v-model="formInline.codeNum" placeholder="请输入编码" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
|
||||
<el-form-item>
|
||||
|
@ -26,14 +25,12 @@
|
|||
</div>
|
||||
|
||||
<div class="main-table common-box">
|
||||
|
||||
<div class="tab-left">
|
||||
<div style="display: flex; justify-content: space-between; margin-bottom: 10px;">
|
||||
<div>
|
||||
单位组
|
||||
</div>
|
||||
<div>
|
||||
|
||||
<el-button type="success" link
|
||||
@click.prevent="addUnitGroup"
|
||||
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 title="状态" width="60" fixed="right" show-overflow>
|
||||
<vxe-column title="状态" width="" fixed="right" show-overflow>
|
||||
<template #default="{ row }">
|
||||
{{ row.isEnable ? '启用' : '关闭' }}
|
||||
<!-- <vxe-button type="text" icon="vxe-icon-delete"></vxe-button> -->
|
||||
|
@ -79,6 +76,7 @@
|
|||
<!-- <vxe-button type="text" icon="vxe-icon-delete"></vxe-button> -->
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="childUnitCount" sortable title="子单位数" width=""></vxe-column>
|
||||
<vxe-column field="rate" sortable title="换算率" width=""></vxe-column>
|
||||
<vxe-column field="isBaseUnit" sortable title="作为基本单位" width="">
|
||||
<template #default="{ row }">
|
||||
|
@ -103,8 +101,8 @@
|
|||
</div>
|
||||
|
||||
</div>
|
||||
<el-dialog v-model="dialogTableVisible" :title="mTitle" width="850">
|
||||
<el-form :inline="true" :model="unitFrom" class="demo-form-inline" label-width="70px">
|
||||
<el-dialog v-model="dialogTableVisible" :title="mTitle" width="860">
|
||||
<el-form :inline="true" :model="unitFrom" class="demo-form-inline" label-width="80px">
|
||||
<el-row>
|
||||
|
||||
<el-col :span="8">
|
||||
|
@ -133,21 +131,21 @@
|
|||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="换算率">
|
||||
<el-input v-model="unitFrom.rate" placeholder="请输入" clearable />
|
||||
<el-form-item label="子单位数" :rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
|
||||
<el-input v-model="unitFrom.childUnitCount" placeholder="下级单位数量" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="8">
|
||||
<el-form-item label="代码">
|
||||
<el-input v-model="unitFrom.code" placeholder="请输入" clearable />
|
||||
<el-form-item label="换算率" :rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
|
||||
<el-input v-model="unitFrom.rate" placeholder="基本单位数量" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
<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 label="代码">
|
||||
<el-input v-model="unitFrom.code" placeholder="请输入" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
|
@ -161,11 +159,19 @@
|
|||
</el-form-item>
|
||||
</el-col>
|
||||
</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-switch v-model="unitFrom.isEnable" inline-prompt active-text="启用" inactive-text="禁用" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
</el-form>
|
||||
<el-row style="display: flex; justify-content: space-around;">
|
||||
<el-button style="width: 100px;" type="primary" @click="unitSubmit">提交</el-button>
|
||||
|
@ -207,7 +213,7 @@
|
|||
import { onMounted, reactive, ref } from 'vue'
|
||||
import { getAPI } from '/@/utils/axios-utils';
|
||||
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 { ElMessageBox, ElMessage } from 'element-plus';
|
||||
|
||||
|
@ -228,7 +234,7 @@ let unitGroupModel=reactive<any>({isEnable:true,isDelete:false});
|
|||
let mGroupTitle = ref('新增');
|
||||
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=()=>{
|
||||
isShowDialog.value=false
|
||||
|
@ -284,13 +290,13 @@ const addUnit= ()=>{
|
|||
//提交
|
||||
const unitSubmit = async () => {
|
||||
if(mTitle.value=='新增'){
|
||||
let res = await getAPI(SysUnitApi).apiSysUnitAddPost(unitFrom);
|
||||
let res = await getAPI(SysUnitApi).apiSysUnitAddPost(unitFrom.value);
|
||||
if (res.data.code===200) {
|
||||
dialogTableVisible.value = false;
|
||||
unitPage();
|
||||
}
|
||||
}else{
|
||||
let res = await getAPI(SysUnitApi).apiSysUnitUpdatePost(unitFrom);
|
||||
let res = await getAPI(SysUnitApi).apiSysUnitUpdatePost(unitFrom.value);
|
||||
if (res.data.code===200) {
|
||||
dialogTableVisible.value = false;
|
||||
unitPage();
|
||||
|
@ -300,7 +306,7 @@ const unitSubmit = async () => {
|
|||
}
|
||||
|
||||
const editUnit=async(row:any)=>{
|
||||
unitFrom=row;
|
||||
unitFrom.value=row;
|
||||
mTitle.value='编辑'
|
||||
dialogTableVisible.value=true;
|
||||
}
|
||||
|
@ -312,7 +318,6 @@ const deleteUnit=async(row:any)=>{
|
|||
type: 'warning',
|
||||
})
|
||||
.then(async () => {
|
||||
console.log(row)
|
||||
let res = await getAPI(SysUnitApi).apiSysUnitDeletePost(row);
|
||||
if (res.data.code == 200) {
|
||||
ElMessage({ message: '成功', type: 'success', })
|
||||
|
@ -325,9 +330,8 @@ const deleteUnit=async(row:any)=>{
|
|||
}
|
||||
|
||||
const addUnitGroup=()=>{
|
||||
|
||||
isShowDialog.value=true
|
||||
|
||||
isShowDialog.value=true
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<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-row>
|
||||
<el-col :span="8">
|
||||
|
@ -16,7 +16,7 @@
|
|||
</el-form-item>
|
||||
</el-col>
|
||||
<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-option v-for="item in state.unitData" :key="item.id" :label="item.name" :value="item.name" />
|
||||
</el-select>
|
||||
|
@ -26,8 +26,10 @@
|
|||
<el-row>
|
||||
|
||||
<!-- <el-col :span="8">
|
||||
<el-form-item label="包装单位">
|
||||
<el-input v-model="printInfoFrom.packageUnit" placeholder="请输入" clearable />
|
||||
<el-form-item label="包装单位" prop="packageUnit" :rules="[{ required: true, message: '包装单位不能为空', trigger: 'blur' }]">
|
||||
<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-col> -->
|
||||
<el-col :span="8">
|
||||
|
@ -37,6 +39,11 @@
|
|||
</el-select>
|
||||
</el-form-item>
|
||||
</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>
|
||||
|
||||
|
@ -73,8 +80,8 @@
|
|||
<script setup lang="ts">
|
||||
import { onMounted, reactive,ref } from 'vue'
|
||||
import { getAPI } from '/@/utils/axios-utils';
|
||||
import { SysUnitApi, MaterialsApi, SysPrintApi, PrintDataApi } from '/@/api-services/api';
|
||||
import { SysUnitOutput, MaterialsOutput, SysPrint, PrintDataInput, PrintData, PrintDataMaterialsInput } from '/@/api-services/models';
|
||||
import { SysUnitApi, SysPrintApi, PrintDataApi } from '/@/api-services/api';
|
||||
import { SysUnitOutput, MaterialsOutput, SysPrint, PrintData } from '/@/api-services/models';
|
||||
import { ElMessageBox, ElMessage, TabsPaneContext } from 'element-plus';
|
||||
import VueJsonPretty from 'vue-json-pretty';
|
||||
import 'vue-json-pretty/lib/styles.css';
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
:scroll-y="{ gt: 20 }">
|
||||
<vxe-column type="seq" title="序号" width="70" sortable></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="brand" sortable title="品牌" width=""></vxe-column>
|
||||
<vxe-column field="unit" sortable title="基本单位" width=""></vxe-column>
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
||||
|
||||
|
|
@ -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>
|
||||
|
||||
|
Loading…
Reference in New Issue