0510
parent
bff1b2efb7
commit
c347d7eed8
|
@ -7,7 +7,7 @@
|
|||
{
|
||||
"Group": "Default",
|
||||
"Title": "Admin.NET 通用权限开发平台",
|
||||
"Description": "让 .NET 开发更简单、更通用、更流行。前后端分离架构(.NET6/Vue3),开箱即用紧随前沿技术。<br/><a href='https://gitee.com/zuohuaijun/Admin.NET/'>https://gitee.com/zuohuaijun/Admin.NET</a>",
|
||||
"Description": "让 .NET 开发更简单、更通用、更流行。",
|
||||
"Version": "1.0.0"
|
||||
//"TermsOfService": "https://dotnetchina.gitee.io/furion/",
|
||||
//"Contact": {
|
||||
|
@ -19,7 +19,7 @@
|
|||
{
|
||||
"Group": "All Groups",
|
||||
"Title": "所有接口",
|
||||
"Description": "让 .NET 开发更简单、更通用、更流行。前后端分离架构(.NET6/Vue3),开箱即用紧随前沿技术。<br/><a href='https://gitee.com/zuohuaijun/Admin.NET/'>https://gitee.com/zuohuaijun/Admin.NET</a>",
|
||||
"Description": "让 .NET 开发更简单、更通用、更流行。",
|
||||
"Version": "1.0.0"
|
||||
//"TermsOfService": "https://dotnetchina.gitee.io/furion/",
|
||||
//"Contact": {
|
||||
|
|
|
@ -132,7 +132,7 @@ public class Materials : EntityTenant
|
|||
[Navigate(NavigateType.OneToOne, nameof(Id))]
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public List<PackageInfoOutput> PackageInfos { get; set; }
|
||||
public List<PackageInfoOutput>? PackageInfos { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 推广ID
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
using Admin.NET.Core;
|
||||
namespace Admin.NET.Application.Entity;
|
||||
|
||||
/// <summary>
|
||||
/// 网址信息
|
||||
/// </summary>
|
||||
[SugarTable("UrlInfo","网址信息")]
|
||||
public class UrlInfo : EntityBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "Name", ColumnDescription = "名称", Length = 32)]
|
||||
public string? Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 网址
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "Url", ColumnDescription = "网址", Length = 128)]
|
||||
public string? Url { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 网址类型ID
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "UrlTypeId", ColumnDescription = "网址类型ID")]
|
||||
public long? UrlTypeId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 网址类型
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "UrlType", ColumnDescription = "网址类型", Length = 32)]
|
||||
public string? UrlType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "IsEnable", ColumnDescription = "是否启用")]
|
||||
public bool? IsEnable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "Remarks", ColumnDescription = "备注", Length = 32)]
|
||||
public string? Remarks { get; set; }
|
||||
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
using Admin.NET.Core;
|
||||
namespace Admin.NET.Application.Entity;
|
||||
|
||||
/// <summary>
|
||||
/// 地址类型
|
||||
/// </summary>
|
||||
[SugarTable("UrlType","地址类型")]
|
||||
public class UrlType : EntityBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "Name", ColumnDescription = "名称", Length = 32)]
|
||||
public string? Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "Remarks", ColumnDescription = "备注", Length = 64)]
|
||||
public string? Remarks { get; set; }
|
||||
|
||||
}
|
|
@ -44,7 +44,79 @@ public class MaterialsOutput
|
|||
/// 可用状态
|
||||
/// </summary>
|
||||
public bool IsEnable { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 品牌
|
||||
/// </summary>
|
||||
public string? Brand { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 保质期
|
||||
/// </summary>
|
||||
public int? ShelfLife { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 保质期单位
|
||||
/// </summary>
|
||||
public string? ShelfLifeUnit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 统一零售价
|
||||
/// </summary>
|
||||
public decimal? Price { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 条形码
|
||||
/// </summary>
|
||||
public string? BarCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单位组ID
|
||||
/// </summary>
|
||||
public long? UnitGroupId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 基本单位
|
||||
/// </summary>
|
||||
public string? Unit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 生产单位
|
||||
/// </summary>
|
||||
public string? ProductUnit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 采购单位
|
||||
/// </summary>
|
||||
public string? ProcureUnit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 库存单位
|
||||
/// </summary>
|
||||
public string? InventoryUnit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 销售单位
|
||||
/// </summary>
|
||||
public string? SaleUnit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 分销单位
|
||||
/// </summary>
|
||||
public string? RetailStoreUnit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 包装关系ID
|
||||
/// </summary>
|
||||
public long? PackagId { get; set; }
|
||||
|
||||
public List<PackageInfoOutput>? PackageInfos { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 推广ID
|
||||
/// </summary>
|
||||
public long? PromotionId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
namespace Admin.NET.Application;
|
||||
|
||||
/// <summary>
|
||||
/// 网址信息输出参数
|
||||
/// </summary>
|
||||
public class UrlInfoDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键Id
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public string? Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 网址
|
||||
/// </summary>
|
||||
public string? Url { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 网址类型ID
|
||||
/// </summary>
|
||||
public long? UrlTypeId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 网址类型
|
||||
/// </summary>
|
||||
public string? UrlType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用
|
||||
/// </summary>
|
||||
public bool? IsEnable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string? Remarks { 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>
|
||||
/// 软删除
|
||||
/// </summary>
|
||||
public bool IsDelete { get; set; }
|
||||
|
||||
}
|
|
@ -0,0 +1,144 @@
|
|||
using Admin.NET.Core;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Admin.NET.Application;
|
||||
|
||||
/// <summary>
|
||||
/// 网址信息基础输入参数
|
||||
/// </summary>
|
||||
public class UrlInfoBaseInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public virtual string? Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 网址
|
||||
/// </summary>
|
||||
public virtual string? Url { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 网址类型ID
|
||||
/// </summary>
|
||||
public virtual long? UrlTypeId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 网址类型
|
||||
/// </summary>
|
||||
public virtual string? UrlType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用
|
||||
/// </summary>
|
||||
public virtual bool? IsEnable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public virtual string? Remarks { 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>
|
||||
/// 软删除
|
||||
/// </summary>
|
||||
public virtual bool IsDelete { get; set; }
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 网址信息分页查询输入参数
|
||||
/// </summary>
|
||||
public class UrlInfoInput : BasePageInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 关键字查询
|
||||
/// </summary>
|
||||
public string? SearchKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public string? Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 网址
|
||||
/// </summary>
|
||||
public string? Url { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 网址类型
|
||||
/// </summary>
|
||||
public string? UrlType { get; set; }
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 网址信息增加输入参数
|
||||
/// </summary>
|
||||
public class AddUrlInfoInput : UrlInfoBaseInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 软删除
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "软删除不能为空")]
|
||||
public override bool IsDelete { get; set; }
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 网址信息删除输入参数
|
||||
/// </summary>
|
||||
public class DeleteUrlInfoInput : BaseIdInput
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 网址信息更新输入参数
|
||||
/// </summary>
|
||||
public class UpdateUrlInfoInput : UrlInfoBaseInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键Id
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "主键Id不能为空")]
|
||||
public long Id { get; set; }
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 网址信息主键查询输入参数
|
||||
/// </summary>
|
||||
public class QueryByIdUrlInfoInput : DeleteUrlInfoInput
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
namespace Admin.NET.Application;
|
||||
|
||||
/// <summary>
|
||||
/// 网址信息输出参数
|
||||
/// </summary>
|
||||
public class UrlInfoOutput
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键Id
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public string? Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 网址
|
||||
/// </summary>
|
||||
public string? Url { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 网址类型ID
|
||||
/// </summary>
|
||||
public long? UrlTypeId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 网址类型
|
||||
/// </summary>
|
||||
public string? UrlType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用
|
||||
/// </summary>
|
||||
public bool? IsEnable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string? Remarks { 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>
|
||||
/// 软删除
|
||||
/// </summary>
|
||||
public bool IsDelete { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,111 @@
|
|||
using Admin.NET.Core.Service;
|
||||
using Admin.NET.Application.Const;
|
||||
using Admin.NET.Application.Entity;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
namespace Admin.NET.Application;
|
||||
/// <summary>
|
||||
/// 网址信息服务
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(ApplicationConst.GroupName, Order = 100)]
|
||||
[AllowAnonymous]
|
||||
public class UrlInfoService : IDynamicApiController, ITransient
|
||||
{
|
||||
private readonly SqlSugarRepository<UrlInfo> _rep;
|
||||
public UrlInfoService(SqlSugarRepository<UrlInfo> rep)
|
||||
{
|
||||
_rep = rep;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 分页查询网址信息
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[ApiDescriptionSettings(Name = "Page")]
|
||||
public async Task<SqlSugarPagedList<UrlInfoOutput>> Page(UrlInfoInput input)
|
||||
{
|
||||
var query = _rep.AsQueryable()
|
||||
.WhereIF(!string.IsNullOrWhiteSpace(input.SearchKey), u =>
|
||||
u.Name.Contains(input.SearchKey.Trim())
|
||||
|| u.Url.Contains(input.SearchKey.Trim())
|
||||
|| u.UrlType.Contains(input.SearchKey.Trim())
|
||||
)
|
||||
.WhereIF(!string.IsNullOrWhiteSpace(input.Name), u => u.Name.Contains(input.Name.Trim()))
|
||||
.WhereIF(!string.IsNullOrWhiteSpace(input.Url), u => u.Url.Contains(input.Url.Trim()))
|
||||
.WhereIF(!string.IsNullOrWhiteSpace(input.UrlType), u => u.UrlType.Contains(input.UrlType.Trim()))
|
||||
.Select<UrlInfoOutput>();
|
||||
return await query.OrderBuilder(input).ToPagedListAsync(input.Page, input.PageSize);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 增加网址信息
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[ApiDescriptionSettings(Name = "Add")]
|
||||
public async Task<long> Add(AddUrlInfoInput input)
|
||||
{
|
||||
var entity = input.Adapt<UrlInfo>();
|
||||
await _rep.InsertAsync(entity);
|
||||
return entity.Id;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除网址信息
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[ApiDescriptionSettings(Name = "Delete")]
|
||||
public async Task Delete(DeleteUrlInfoInput input)
|
||||
{
|
||||
var entity = await _rep.GetFirstAsync(u => u.Id == input.Id) ?? throw Oops.Oh(ErrorCodeEnum.D1002);
|
||||
await _rep.FakeDeleteAsync(entity); //假删除
|
||||
//await _rep.DeleteAsync(entity); //真删除
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新网址信息
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[ApiDescriptionSettings(Name = "Update")]
|
||||
public async Task Update(UpdateUrlInfoInput input)
|
||||
{
|
||||
var entity = input.Adapt<UrlInfo>();
|
||||
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取网址信息
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[ApiDescriptionSettings(Name = "Detail")]
|
||||
public async Task<UrlInfo> Detail([FromQuery] QueryByIdUrlInfoInput input)
|
||||
{
|
||||
return await _rep.GetFirstAsync(u => u.Id == input.Id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取网址信息列表
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[ApiDescriptionSettings(Name = "List")]
|
||||
public async Task<List<UrlInfoOutput>> List()
|
||||
{
|
||||
return await _rep.AsQueryable().Select<UrlInfoOutput>().ToListAsync();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
namespace Admin.NET.Application;
|
||||
|
||||
/// <summary>
|
||||
/// 地址类型输出参数
|
||||
/// </summary>
|
||||
public class UrlTypeDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键Id
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public string? Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string? Remarks { 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>
|
||||
/// 软删除
|
||||
/// </summary>
|
||||
public bool IsDelete { get; set; }
|
||||
|
||||
}
|
|
@ -0,0 +1,114 @@
|
|||
using Admin.NET.Core;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Admin.NET.Application;
|
||||
|
||||
/// <summary>
|
||||
/// 地址类型基础输入参数
|
||||
/// </summary>
|
||||
public class UrlTypeBaseInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public virtual string? Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public virtual string? Remarks { 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>
|
||||
/// 软删除
|
||||
/// </summary>
|
||||
public virtual bool IsDelete { get; set; }
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 地址类型分页查询输入参数
|
||||
/// </summary>
|
||||
public class UrlTypeInput : BasePageInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 关键字查询
|
||||
/// </summary>
|
||||
public string? SearchKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public string? Name { get; set; }
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 地址类型增加输入参数
|
||||
/// </summary>
|
||||
public class AddUrlTypeInput : UrlTypeBaseInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 软删除
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "软删除不能为空")]
|
||||
public override bool IsDelete { get; set; }
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 地址类型删除输入参数
|
||||
/// </summary>
|
||||
public class DeleteUrlTypeInput : BaseIdInput
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 地址类型更新输入参数
|
||||
/// </summary>
|
||||
public class UpdateUrlTypeInput : UrlTypeBaseInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键Id
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "主键Id不能为空")]
|
||||
public long Id { get; set; }
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 地址类型主键查询输入参数
|
||||
/// </summary>
|
||||
public class QueryByIdUrlTypeInput : DeleteUrlTypeInput
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
namespace Admin.NET.Application;
|
||||
|
||||
/// <summary>
|
||||
/// 地址类型输出参数
|
||||
/// </summary>
|
||||
public class UrlTypeOutput
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键Id
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public string? Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string? Remarks { 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>
|
||||
/// 软删除
|
||||
/// </summary>
|
||||
public bool IsDelete { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,107 @@
|
|||
using Admin.NET.Core.Service;
|
||||
using Admin.NET.Application.Const;
|
||||
using Admin.NET.Application.Entity;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
namespace Admin.NET.Application;
|
||||
/// <summary>
|
||||
/// 地址类型服务
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(ApplicationConst.GroupName, Order = 100)]
|
||||
[AllowAnonymous]
|
||||
public class UrlTypeService : IDynamicApiController, ITransient
|
||||
{
|
||||
private readonly SqlSugarRepository<UrlType> _rep;
|
||||
public UrlTypeService(SqlSugarRepository<UrlType> rep)
|
||||
{
|
||||
_rep = rep;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 分页查询地址类型
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[ApiDescriptionSettings(Name = "Page")]
|
||||
public async Task<SqlSugarPagedList<UrlTypeOutput>> Page(UrlTypeInput input)
|
||||
{
|
||||
var query = _rep.AsQueryable()
|
||||
.WhereIF(!string.IsNullOrWhiteSpace(input.SearchKey), u =>
|
||||
u.Name.Contains(input.SearchKey.Trim())
|
||||
|| u.Remarks.Contains(input.SearchKey.Trim())
|
||||
)
|
||||
.WhereIF(!string.IsNullOrWhiteSpace(input.Name), u => u.Name.Contains(input.Name.Trim()))
|
||||
.Select<UrlTypeOutput>();
|
||||
return await query.OrderBuilder(input).ToPagedListAsync(input.Page, input.PageSize);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 增加地址类型
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[ApiDescriptionSettings(Name = "Add")]
|
||||
public async Task<long> Add(AddUrlTypeInput input)
|
||||
{
|
||||
var entity = input.Adapt<UrlType>();
|
||||
await _rep.InsertAsync(entity);
|
||||
return entity.Id;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除地址类型
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[ApiDescriptionSettings(Name = "Delete")]
|
||||
public async Task Delete(DeleteUrlTypeInput input)
|
||||
{
|
||||
var entity = await _rep.GetFirstAsync(u => u.Id == input.Id) ?? throw Oops.Oh(ErrorCodeEnum.D1002);
|
||||
await _rep.FakeDeleteAsync(entity); //假删除
|
||||
//await _rep.DeleteAsync(entity); //真删除
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新地址类型
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[ApiDescriptionSettings(Name = "Update")]
|
||||
public async Task Update(UpdateUrlTypeInput input)
|
||||
{
|
||||
var entity = input.Adapt<UrlType>();
|
||||
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取地址类型
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[ApiDescriptionSettings(Name = "Detail")]
|
||||
public async Task<UrlType> Detail([FromQuery] QueryByIdUrlTypeInput input)
|
||||
{
|
||||
return await _rep.GetFirstAsync(u => u.Id == input.Id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取地址类型列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[ApiDescriptionSettings(Name = "List")]
|
||||
public async Task<List<UrlTypeOutput>> List()
|
||||
{
|
||||
return await _rep.AsQueryable().Select<UrlTypeOutput>().ToListAsync();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
# 本地环境
|
||||
ENV = development
|
||||
|
||||
# 本地环境接口地址
|
||||
VITE_API_URL = http://localhost:5005
|
||||
# 本地环境接口地址http://localhost:5005
|
||||
VITE_API_URL = http://139.199.191.197:9005
|
|
@ -14,7 +14,7 @@
|
|||
/>
|
||||
<link rel="stylesheet" type="text/css" media="print" href="/print-lock.css">
|
||||
<link rel="icon" href="./public/logo-mini.svg" />
|
||||
<title>冠威科技</title>
|
||||
<title>广东海方程</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
|
|
@ -20,6 +20,14 @@
|
|||
*/
|
||||
export interface AddMaterialsInput {
|
||||
|
||||
/**
|
||||
* 雪花Id
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof AddDictDataInput
|
||||
*/
|
||||
id?: number;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { PackageInfo } from './package-info';
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
|
@ -84,13 +85,133 @@ export interface MaterialsOutput {
|
|||
*/
|
||||
isEnable?: boolean;
|
||||
|
||||
/**
|
||||
* 品牌
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof MaterialsOutput
|
||||
*/
|
||||
brand?: string | null;
|
||||
|
||||
/**
|
||||
* 保质期
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof MaterialsOutput
|
||||
*/
|
||||
shelflife?: number | null;
|
||||
|
||||
/**
|
||||
* 保质期单位
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof MaterialsOutput
|
||||
*/
|
||||
shelflifeunit?: string | null;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof MaterialsOutput
|
||||
*/
|
||||
price?: number | null;
|
||||
|
||||
/**
|
||||
* 条形码
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof MaterialsOutput
|
||||
*/
|
||||
barcode?: string | null;
|
||||
|
||||
/**
|
||||
* 单位组ID
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof MaterialsOutput
|
||||
*/
|
||||
unitGroupId?: number | null;
|
||||
|
||||
/**
|
||||
* 基本单位
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof MaterialsOutput
|
||||
*/
|
||||
unit?: string | null;
|
||||
|
||||
/**
|
||||
* 生产单位
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof MaterialsOutput
|
||||
*/
|
||||
productunit?: string | null;
|
||||
|
||||
/**
|
||||
* 采购单位
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof MaterialsOutput
|
||||
*/
|
||||
procureunit?: string | null;
|
||||
|
||||
/**
|
||||
* 库存单位
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof MaterialsOutput
|
||||
*/
|
||||
inventoryunit?: string | null;
|
||||
|
||||
/**
|
||||
* 销售单位
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof MaterialsOutput
|
||||
*/
|
||||
saleunit?: string | null;
|
||||
|
||||
/**
|
||||
* 分销单位
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof MaterialsOutput
|
||||
*/
|
||||
retailstoreunit?: string | null;
|
||||
|
||||
/**
|
||||
* 包装关系ID
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof MaterialsOutput
|
||||
*/
|
||||
packagid?: number | null;
|
||||
|
||||
/**
|
||||
* 包装关系
|
||||
*
|
||||
* @type {PackageInfo[]}
|
||||
* @memberof MaterialsOutput
|
||||
*/
|
||||
packageinfos?: PackageInfo[] | null;
|
||||
|
||||
/**
|
||||
* 推广id
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof MaterialsOutput
|
||||
*/
|
||||
promotionid?: number | null;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof MaterialsOutput
|
||||
*/
|
||||
remarks?: string | null;
|
||||
remarks?: string | null;
|
||||
|
||||
/**
|
||||
* 租户Id
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<template>
|
||||
<div class="layout-footer pb15">
|
||||
<div class="layout-footer-warp">
|
||||
<div>Admin.NET</div>
|
||||
<div class="mt5">Copyright © 2023 Daming All rights reserved.</div>
|
||||
<div>冠威科技</div>
|
||||
<div class="mt5">Copyright © 2024 GuanWei All rights reserved.</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -0,0 +1,437 @@
|
|||
<!-- 物料 -->
|
||||
<template>
|
||||
<div class="sys-open-access-container">
|
||||
<el-dialog v-model="state.isShowDialog" :title="props.title" width="1000">
|
||||
<el-form :inline="true" :model="state.matterFrom" class="demo-form-inline" label-width="90px">
|
||||
<el-row>
|
||||
|
||||
<el-col :span="8">
|
||||
<el-form-item label="名称">
|
||||
<el-input v-model="state.matterFrom.name" placeholder="请输入名称" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="编码">
|
||||
<el-input v-model="state.matterFrom.codeNum" placeholder="请输入编码" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="分类">
|
||||
<el-select v-model="state.matterFrom.classify" placeholder="请选择" clearable>
|
||||
<el-option :label="item.name" :value="item.id" v-for="item, index in fyListData"
|
||||
:key="index" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
|
||||
<el-col :span="8">
|
||||
<el-form-item label="规格型号">
|
||||
<el-input v-model="state.matterFrom.specifications" placeholder="请输入" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="助记码">
|
||||
<el-input v-model="state.matterFrom.simpleNumber" placeholder="请输入" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="备注">
|
||||
<el-input v-model="state.matterFrom.remarks" placeholder="请输入" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="可用状态">
|
||||
<el-switch v-model="state.matterFrom.isEnable" inline-prompt active-text="启用" inactive-text="禁用" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick" :key="key">
|
||||
<el-tab-pane label="基本信息" name="基本信息">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="品牌">
|
||||
<el-select v-model="state.matterFrom.brand" placeholder="请选择" clearable>
|
||||
<el-option v-for="item in brandDate" :key="item.id" :label="item.name" :value="item.name" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="保质期">
|
||||
<el-input v-model="state.matterFrom.shelfLife" placeholder="请输入保质期" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="保质期单位">
|
||||
<el-input v-model="state.matterFrom.shelfLifeUnit" placeholder="请输入保质期单位" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="商品条形码">
|
||||
<el-input v-model="state.matterFrom.barCode" placeholder="请输入商品条形码" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="统一零售价">
|
||||
<el-input v-model="state.matterFrom.price" placeholder="请输入统一零售价" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="单位信息" name="单位信息">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="单位组" prop="unitgroupid" :rules="[{ required: true, message: '单位组不能为空', trigger: 'blur' }]">
|
||||
<el-select v-model="state.matterFrom.unitGroupId" placeholder="单位组" filterable default-first-option style="width: 100%" @change="unitGroupChange">
|
||||
<el-option v-for="item in state.unitGroupData" :key="item.id" :label="item.name" :value="item.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="8">
|
||||
<el-form-item label="基本单位" prop="unit" :rules="[{ required: true, message: '基本单位不能为空', trigger: 'blur' }]">
|
||||
<el-select v-model="state.matterFrom.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>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="生产单位" prop="productUnit" :rules="[{ required: true, message: '生产单位不能为空', trigger: 'blur' }]">
|
||||
<el-select v-model="state.matterFrom.productUnit" 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>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="采购单位" prop="procureUnit" :rules="[{ required: true, message: '采购单位不能为空', trigger: 'blur' }]">
|
||||
<el-select v-model="state.matterFrom.procureUnit" 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>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="库存单位" prop="inventoryUnit" :rules="[{ required: true, message: '库存单位不能为空', trigger: 'blur' }]">
|
||||
<el-select v-model="state.matterFrom.inventoryUnit" 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>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="销售单位">
|
||||
<el-select v-model="state.matterFrom.saleUnit" placeholder="请选择" clearable>
|
||||
<el-option label="袋" value="袋" />
|
||||
<el-option label="箱" value="箱" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="分销单位">
|
||||
<el-select v-model="state.matterFrom.retailStoreUnit" placeholder="请选择" clearable>
|
||||
<el-option label="袋" value="袋" />
|
||||
<el-option label="箱" value="箱" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="包装关系" name="包装关系" v-if="infoDate.length > 0">
|
||||
<vxe-table show-overflow height="100%" :data="infoDate" :border=true
|
||||
:tree-config="{ transform: true }" :scroll-y="{ gt: 20 }"
|
||||
:edit-config="{ trigger: 'click', mode: 'row' }">
|
||||
|
||||
<vxe-column field="isEnable" sortable title="可用状态" width="" :edit-render="{}">
|
||||
<template #default="{ row }">
|
||||
<span>{{ row.isEnable ? '启用' : '禁用' }}</span>
|
||||
</template>
|
||||
<template #edit="{ row }">
|
||||
<el-switch v-model="row.isEnable" inline-prompt active-text="启用"
|
||||
inactive-text="禁用" />
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="codeTypeNum" sortable title="条码类型编码" width=""
|
||||
:edit-render="{}"></vxe-column>
|
||||
<vxe-column field="codeType" sortable title="条码类型" width="" :edit-render="{}"></vxe-column>
|
||||
<!-- <vxe-column field="packageName" sortable title="包装关系名" width="" :edit-render="{}">
|
||||
<template #edit="{ row }">
|
||||
<vxe-input v-model="row.packageName" type="text" placeholder="请输入单位"></vxe-input>
|
||||
</template>
|
||||
</vxe-column> -->
|
||||
<vxe-column field="unit" sortable title="单位" width="" :edit-render="{}">
|
||||
<template #edit="{ row }">
|
||||
<vxe-select v-model="row.unit" placeholder="请选择" clearable>
|
||||
<vxe-option label="袋" value="袋" />
|
||||
<vxe-option label="箱" value="箱" />
|
||||
</vxe-select>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="productCount" title="产品数量" width="" :edit-render="{}">
|
||||
<template #edit="{ row }">
|
||||
<vxe-input v-model="row.productCount" type="number" placeholder="请输入数值"></vxe-input>
|
||||
</template>
|
||||
</vxe-column>
|
||||
</vxe-table>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-form>
|
||||
<el-row style="display: flex; justify-content: space-around;">
|
||||
<el-button style="width: 100px;" type="primary" @click="matterSubmit">提交</el-button>
|
||||
<el-button style="width: 100px;" @click="closeDialog">取消</el-button>
|
||||
</el-row>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, reactive, ref, watch } from 'vue';
|
||||
import { getAPI } from '/@/utils/axios-utils';
|
||||
import { BrandApi, MaterialClassifyApi, MaterialsApi, PackageInfoApi, SysUnitGroupApi,SysUnitApi } from '/@/api-services/api';
|
||||
import { AddMaterialsInput, BrandOutput, UpdateMaterialsInput, MaterialsOutput, PackageInfoOutput, SysUnitGroupOutput, SysUnitOutput} from '/@/api-services/models';
|
||||
import { ElMessageBox, ElMessage, TabsPaneContext } from 'element-plus';
|
||||
|
||||
const props = defineProps({
|
||||
title: String,
|
||||
orgData: Array<MaterialsOutput>,
|
||||
});
|
||||
const emits = defineEmits(['handleQuery']);
|
||||
|
||||
const ruleFormRef = ref();
|
||||
//获取物料分类
|
||||
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,
|
||||
isShowDialog:false,
|
||||
editOpenAccessTitle:'新增',
|
||||
tableData: [] as Array<MaterialsOutput>,
|
||||
orgTreeData: [] as Array<MaterialsOutput>,
|
||||
matterFrom: {} as AddMaterialsInput,
|
||||
queryParams: {
|
||||
name: undefined,
|
||||
},
|
||||
tableParams: {
|
||||
page: 1,
|
||||
pageSize: 10,
|
||||
total: 0 as any,
|
||||
},
|
||||
editPrintTitle: '',
|
||||
unitGroupData:[] as Array<SysUnitGroupOutput>,
|
||||
unitData:[] as Array<SysUnitOutput>,
|
||||
});
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = async (row: any) => {
|
||||
ruleFormRef.value?.resetFields();
|
||||
//state.selectedTabName = '0'; // 重置为第一个 tab 页
|
||||
//state.ruleForm = JSON.parse(JSON.stringify(row));
|
||||
if (row.id != undefined) {
|
||||
state.matterFrom=row;
|
||||
//var resRole = await getAPI(MaterialsApi).apiMaterialsDetailGet(row.id);
|
||||
//state.ruleForm.roleIdList = resRole.data.result;
|
||||
}
|
||||
state.isShowDialog = true;
|
||||
};
|
||||
|
||||
|
||||
// 关闭弹窗
|
||||
const closeDialog = () => {
|
||||
emits('handleQuery');
|
||||
state.isShowDialog = false;
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
fyListGet();
|
||||
getBrandList();
|
||||
getunitGroupList();
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
const onSubmit = () => {
|
||||
console.log('submit!')
|
||||
|
||||
}
|
||||
|
||||
//获取品牌数据
|
||||
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 unitGroupData = ref([] as SysUnitGroupOutput[]);
|
||||
|
||||
const getunitGroupList = async () => {
|
||||
let res = await getAPI(SysUnitGroupApi).apiSysUnitGroupListGet();
|
||||
if (res.data.code === 200) {
|
||||
state.unitGroupData = res.data.result!;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//新增
|
||||
//let mTitle = ref('新增');
|
||||
|
||||
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(state.isShowDialog, (newValue, oldValue) => {
|
||||
if (!newValue) {
|
||||
clearFormValues(state.matterFrom)
|
||||
infoDate = [];
|
||||
|
||||
activeName.value = '基本信息';
|
||||
}else{
|
||||
key.value = Math.random();
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
//提交
|
||||
const matterSubmit = async () => {
|
||||
let res;
|
||||
console.log(state.matterFrom);
|
||||
if (props.title=='新增'){
|
||||
res = await getAPI(MaterialsApi).apiMaterialsAddPost(state.matterFrom);
|
||||
}
|
||||
else {
|
||||
let update = {} as UpdateMaterialsInput
|
||||
Object.assign(update,state.matterFrom)
|
||||
res = await getAPI(MaterialsApi).apiMaterialsUpdatePost(update);
|
||||
await UpdateInfoApi(infoDate)
|
||||
}
|
||||
console.log('res');
|
||||
console.log(res);
|
||||
if (res.data.code === 200) {
|
||||
state.isShowDialog = false;
|
||||
ElMessage({
|
||||
message: '成功',
|
||||
type: 'success',
|
||||
})
|
||||
//state.tableData.handleList();
|
||||
} else
|
||||
ElMessage.error(res.data.message!)
|
||||
//MaterialsPage({})
|
||||
closeDialog();
|
||||
}
|
||||
|
||||
|
||||
|
||||
const pageVO1 = reactive({
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
total: 0
|
||||
})
|
||||
|
||||
//获取包装关系
|
||||
let infoDate = reactive([] as PackageInfoOutput[])
|
||||
const getPackageInfoApi = async (id: number) => {
|
||||
let res = await getAPI(PackageInfoApi).apiPackageInfoListMaterialsIdGet(id);
|
||||
if (res.data.code === 200) {
|
||||
infoDate = res.data.result!;
|
||||
}
|
||||
}
|
||||
|
||||
//批量更新包装关系
|
||||
const UpdateInfoApi = async (paramsList: any[]) => {
|
||||
const requests = paramsList.map(params => getAPI(PackageInfoApi).apiPackageInfoUpdatePost(params));
|
||||
|
||||
// 使用 Promise.all 等待所有请求完成
|
||||
Promise.all(requests)
|
||||
.then(responses => {
|
||||
// 所有请求都已完成,responses 是一个包含所有响应的数组
|
||||
console.log('所有请求完成:', responses);
|
||||
})
|
||||
.catch(error => {
|
||||
// 如果任何一个请求失败,则会进入这里
|
||||
console.error('请求失败:', error);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 单位组值变更
|
||||
* @param clearBindUserId 是否清空
|
||||
*/
|
||||
const unitGroupChange = async (clearBindUserId: boolean = true) => {
|
||||
var res = await getAPI(SysUnitApi).apiSysUnitListUnitGroupIdGet(state.matterFrom.unitGroupId ?? 0);
|
||||
state.unitData = res.data.result ?? [];
|
||||
if (clearBindUserId) {
|
||||
//state.matterFrom.id = undefined!;
|
||||
}
|
||||
};
|
||||
|
||||
// 导出对象
|
||||
defineExpose({ openDialog });
|
||||
</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>
|
|
@ -1,3 +1,4 @@
|
|||
<!-- 物料 -->
|
||||
<template>
|
||||
<div class="main">
|
||||
<div class="main-from common-box">
|
||||
|
@ -37,14 +38,14 @@
|
|||
<el-col :span="8">
|
||||
<el-form-item label="品牌">
|
||||
<el-select v-model="formInline.brand" placeholder="请选择" clearable>
|
||||
<el-option :label="item.name" :value="item.id" v-for="item, index in brandDate"
|
||||
<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="MaterialsPage">查询</el-button>
|
||||
<el-button type="primary" @click="handleQuery">查询</el-button>
|
||||
<el-button type="primary" @click="onSubmit">重置</el-button>
|
||||
<el-button @click="onSubmit">保存</el-button>
|
||||
<el-button type="primary" @click="add">新增</el-button>
|
||||
|
@ -93,7 +94,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="tab">
|
||||
<vxe-table show-overflow height="100%" :data="tableData" :border=true :tree-config="{ transform: true }"
|
||||
<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>
|
||||
|
@ -104,14 +105,14 @@
|
|||
</template>
|
||||
</vxe-column>
|
||||
|
||||
<vxe-column field="" sortable title="仓库条码" width=""></vxe-column>
|
||||
<vxe-column field="barcode" sortable title="仓库条码" width=""></vxe-column>
|
||||
<vxe-column field="createTime" sortable title="创建时间" width=""></vxe-column>
|
||||
<vxe-column field="f" sortable title="仓库扩展字符串扩展字段1" 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.id)">编辑</vxe-button>
|
||||
<vxe-button @click="matterDelete(row.id)" 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>
|
||||
|
@ -124,211 +125,20 @@
|
|||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<el-dialog v-model="dialogTableVisible" :title="mTitle" width="1000">
|
||||
<el-form :inline="true" :model="matterFrom" class="demo-form-inline" label-width="90px">
|
||||
<el-row>
|
||||
|
||||
<el-col :span="8">
|
||||
<el-form-item label="名称">
|
||||
<el-input v-model="matterFrom.name" placeholder="请输入名称" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="编码">
|
||||
<el-input v-model="matterFrom.codeNum" placeholder="请输入编码" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="分类">
|
||||
<el-select v-model="matterFrom.classify" placeholder="请选择" clearable>
|
||||
<el-option :label="item.name" :value="item.id" v-for="item, index in fyListData"
|
||||
:key="index" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
|
||||
<el-col :span="8">
|
||||
<el-form-item label="规格型号">
|
||||
<el-input v-model="matterFrom.specifications" placeholder="请输入" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="助记码">
|
||||
<el-input v-model="matterFrom.simpleNumber" placeholder="请输入" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="备注">
|
||||
<el-input v-model="matterFrom.remarks" placeholder="请输入" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="可用状态">
|
||||
<el-switch v-model="matterFrom.isEnable" inline-prompt active-text="启用" inactive-text="禁用" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick" :key="key">
|
||||
<el-tab-pane label="基本信息" name="基本信息">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="品牌">
|
||||
<el-select v-model="matterFrom.brand" placeholder="请选择" clearable>
|
||||
<el-option :label="item.name" :value="item.id" v-for="item, index in brandDate"
|
||||
:key="index" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="保质期">
|
||||
<el-input v-model="matterFrom.shelfLife" placeholder="请输入保质期" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="保质期单位">
|
||||
<el-input v-model="matterFrom.shelfLifeUnit" placeholder="请输入保质期单位" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="商品条形码">
|
||||
<el-input v-model="matterFrom.barCode" placeholder="请输入商品条形码" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="统一零售价">
|
||||
<el-input v-model="matterFrom.price" placeholder="请输入统一零售价" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="单位信息" name="单位信息">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="单位组">
|
||||
<el-select v-model="matterFrom.brand" placeholder="请选择" clearable>
|
||||
<el-option :label="item.name" :value="item.id" v-for="item, index in brandDate"
|
||||
:key="index" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="基本单位">
|
||||
<el-select v-model="matterFrom.unit" placeholder="请选择" clearable>
|
||||
<el-option label="袋" value="袋" />
|
||||
<el-option label="箱" value="箱" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="生产单位">
|
||||
<el-select v-model="matterFrom.productUnit" placeholder="请选择" clearable>
|
||||
<el-option label="袋" value="袋" />
|
||||
<el-option label="箱" value="箱" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="采购单位">
|
||||
<el-select v-model="matterFrom.procureUnit" placeholder="请选择" clearable>
|
||||
<el-option label="袋" value="袋" />
|
||||
<el-option label="箱" value="箱" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="库存单位">
|
||||
<el-select v-model="matterFrom.inventoryUnit" placeholder="请选择" clearable>
|
||||
<el-option label="袋" value="袋" />
|
||||
<el-option label="箱" value="箱" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="销售单位">
|
||||
<el-select v-model="matterFrom.saleUnit" placeholder="请选择" clearable>
|
||||
<el-option label="袋" value="袋" />
|
||||
<el-option label="箱" value="箱" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="分销单位">
|
||||
<el-select v-model="matterFrom.retailStoreUnit" placeholder="请选择" clearable>
|
||||
<el-option label="袋" value="袋" />
|
||||
<el-option label="箱" value="箱" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="包装关系" name="包装关系" v-if="infoDate.length > 0">
|
||||
<vxe-table show-overflow height="100%" :data="infoDate" :border=true
|
||||
:tree-config="{ transform: true }" :scroll-y="{ gt: 20 }"
|
||||
:edit-config="{ trigger: 'click', mode: 'row' }">
|
||||
|
||||
<vxe-column field="isEnable" sortable title="可用状态" width="" :edit-render="{}">
|
||||
<template #default="{ row }">
|
||||
<span>{{ row.isEnable ? '启用' : '禁用' }}</span>
|
||||
</template>
|
||||
<template #edit="{ row }">
|
||||
<el-switch v-model="row.isEnable" inline-prompt active-text="启用"
|
||||
inactive-text="禁用" />
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="codeTypeNum" sortable title="条码类型编码" width=""
|
||||
:edit-render="{}"></vxe-column>
|
||||
<vxe-column field="codeType" sortable title="条码类型" width="" :edit-render="{}"></vxe-column>
|
||||
<vxe-column field="packageName" sortable title="包装关系名" width="" :edit-render="{}">
|
||||
<template #edit="{ row }">
|
||||
<vxe-input v-model="row.packageName" type="text" placeholder="请输入单位"></vxe-input>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="unit" sortable title="单位" width="" :edit-render="{}">
|
||||
<template #edit="{ row }">
|
||||
<vxe-select v-model="row.unit" placeholder="请选择" clearable>
|
||||
<vxe-option label="袋" value="袋" />
|
||||
<vxe-option label="箱" value="箱" />
|
||||
</vxe-select>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="productCount" title="产品数量" width="" :edit-render="{}">
|
||||
<template #edit="{ row }">
|
||||
<vxe-input v-model="row.productCount" type="number" placeholder="请输入数值"></vxe-input>
|
||||
</template>
|
||||
</vxe-column>
|
||||
</vxe-table>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-form>
|
||||
<el-row style="display: flex; justify-content: space-around;">
|
||||
<el-button style="width: 100px;" type="primary" @click="matterSubmit">提交</el-button>
|
||||
<el-button style="width: 100px;" @click="dialogTableVisible = false">取消</el-button>
|
||||
</el-row>
|
||||
</el-dialog>
|
||||
<EditAccess ref="editOpenAccessRef" :title="state.editOpenAccessTitle" :orgData="state.orgTreeData" @handleQuery="handleQuery"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, reactive, ref, watch } from 'vue';
|
||||
import { getAPI } from '/@/utils/axios-utils';
|
||||
import { BrandApi, MaterialClassifyApi, MaterialsApi, PackageInfoApi } from '/@/api-services/api';
|
||||
import { AddMaterialsInput, BrandOutput, DeleteMaterialsInput, MaterialsOutput, PackageInfoOutput } from '/@/api-services/models';
|
||||
import { ElMessage, TabsPaneContext } from 'element-plus';
|
||||
import { BrandApi, MaterialClassifyApi, MaterialsApi, SysUnitGroupApi, SysUnitApi } from '/@/api-services/api';
|
||||
import { AddMaterialsInput, BrandOutput, DeleteMaterialsInput, MaterialsOutput, SysUnitGroupOutput, SysUnitOutput} 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 () => {
|
||||
|
@ -338,11 +148,33 @@ const fyListGet = async () => {
|
|||
}
|
||||
}
|
||||
|
||||
const state = reactive({
|
||||
loading: false,
|
||||
editOpenAccessTitle:'新增',
|
||||
tableData: [] as Array<MaterialsOutput>,
|
||||
orgTreeData: [] as Array<MaterialsOutput>,
|
||||
brandDate:[] as Array<BrandOutput>,
|
||||
queryParams: {
|
||||
name: undefined,
|
||||
},
|
||||
tableParams: {
|
||||
page: 1,
|
||||
pageSize: 10,
|
||||
total: 0 as any,
|
||||
},
|
||||
editPrintTitle: '',
|
||||
});
|
||||
|
||||
const pageVO1 = reactive({
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
total: 0
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
fyListGet();
|
||||
MaterialsPage({});
|
||||
getBrandList()
|
||||
handleQuery();
|
||||
getBrandList();
|
||||
})
|
||||
|
||||
//获取物料列表数据
|
||||
|
@ -356,14 +188,15 @@ const formInline = reactive({
|
|||
classify: ""
|
||||
})
|
||||
|
||||
const tableData = ref<MaterialsOutput[]>([]);
|
||||
|
||||
const MaterialsPage = async (data) => {
|
||||
const handleQuery = async () => {
|
||||
state.loading = true;
|
||||
let res = await getAPI(MaterialsApi).apiMaterialsPagePost({ page: 1, pageSize: 10, ...formInline });
|
||||
if (res.data.code === 200) {
|
||||
pageVO1.total = res.data.result?.total!;
|
||||
tableData.value = res.data.result?.items!;
|
||||
state.tableData = res.data.result?.items!;
|
||||
}
|
||||
state.loading = false;
|
||||
}
|
||||
|
||||
const onSubmit = () => {
|
||||
|
@ -371,7 +204,6 @@ const onSubmit = () => {
|
|||
}
|
||||
|
||||
//获取品牌数据
|
||||
|
||||
let brandDate = ref([] as BrandOutput[]);
|
||||
|
||||
const getBrandList = async () => {
|
||||
|
@ -381,40 +213,15 @@ const getBrandList = async () => {
|
|||
}
|
||||
}
|
||||
|
||||
//获取包装关系
|
||||
|
||||
let infoDate = reactive([] as PackageInfoOutput[])
|
||||
const getPackageInfoApi = async (id: number) => {
|
||||
let res = await getAPI(PackageInfoApi).apiPackageInfoListMaterialsIdGet(id);
|
||||
if (res.data.code === 200) {
|
||||
infoDate = res.data.result!;
|
||||
}
|
||||
}
|
||||
|
||||
//批量更新包装关系
|
||||
const UpdateInfoApi = async (paramsList: any[]) => {
|
||||
const requests = paramsList.map(params => getAPI(PackageInfoApi).apiPackageInfoUpdatePost(params));
|
||||
|
||||
// 使用 Promise.all 等待所有请求完成
|
||||
Promise.all(requests)
|
||||
.then(responses => {
|
||||
// 所有请求都已完成,responses 是一个包含所有响应的数组
|
||||
console.log('所有请求完成:', responses);
|
||||
})
|
||||
.catch(error => {
|
||||
// 如果任何一个请求失败,则会进入这里
|
||||
console.error('请求失败:', error);
|
||||
});
|
||||
}
|
||||
|
||||
//新增
|
||||
let mTitle = ref('新增');
|
||||
//let mTitle = ref('新增');
|
||||
let dialogTableVisible = ref(false);
|
||||
|
||||
let matterFrom = reactive({} as AddMaterialsInput)
|
||||
|
||||
const add = () => {
|
||||
dialogTableVisible.value = true;
|
||||
mTitle.value = '新增';
|
||||
state.editOpenAccessTitle = '新增';
|
||||
editOpenAccessRef.value?.openDialog({ id: undefined });
|
||||
}
|
||||
|
||||
const activeName = ref('基本信息')
|
||||
|
@ -422,6 +229,7 @@ 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)) {
|
||||
|
@ -433,7 +241,7 @@ let key = ref(0)
|
|||
watch(dialogTableVisible, (newValue, oldValue) => {
|
||||
if (!newValue) {
|
||||
clearFormValues(matterFrom)
|
||||
infoDate = [];
|
||||
//infoDate = [];
|
||||
|
||||
activeName.value = '基本信息';
|
||||
}else{
|
||||
|
@ -442,57 +250,57 @@ watch(dialogTableVisible, (newValue, oldValue) => {
|
|||
})
|
||||
|
||||
|
||||
//提交
|
||||
const matterSubmit = async () => {
|
||||
let res;
|
||||
if (mTitle.value == '新增')
|
||||
res = await getAPI(MaterialsApi).apiMaterialsAddPost(matterFrom);
|
||||
else {
|
||||
res = await getAPI(MaterialsApi).apiMaterialsUpdatePost(matterFrom);
|
||||
await UpdateInfoApi(infoDate)
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (res.data.code === 200) {
|
||||
dialogTableVisible.value = false;
|
||||
ElMessage({
|
||||
message: '成功',
|
||||
type: 'success',
|
||||
})
|
||||
} else
|
||||
ElMessage.error(res.data.message!)
|
||||
MaterialsPage({})
|
||||
}
|
||||
|
||||
//删除
|
||||
const matterDelete = async (id: any) => {
|
||||
let res = await getAPI(MaterialsApi).apiMaterialsDeletePost({ id });
|
||||
if (res.data.code === 200) {
|
||||
ElMessage({
|
||||
message: '成功',
|
||||
type: 'success',
|
||||
})
|
||||
MaterialsPage({})
|
||||
} else
|
||||
ElMessage.error(res.data.message!)
|
||||
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 (id) => {
|
||||
getPackageInfoApi(id)
|
||||
let res = await getAPI(MaterialsApi).apiMaterialsDetailGet(id);
|
||||
const editDelete = async (row: any) => {
|
||||
let res = await getAPI(MaterialsApi).apiMaterialsDetailGet(row.id);
|
||||
if (res.data.code === 200) {
|
||||
dialogTableVisible.value = true;
|
||||
mTitle.value = '编辑';
|
||||
Object.assign(matterFrom, res.data.result)
|
||||
//dialogTableVisible.value = true;
|
||||
state.editOpenAccessTitle = '编辑';
|
||||
//Object.assign(matterFrom, res.data.result)
|
||||
editOpenAccessRef.value?.openDialog(row);
|
||||
}
|
||||
}
|
||||
const pageVO1 = reactive({
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
total: 0
|
||||
})
|
||||
|
||||
|
||||
/**
|
||||
* 单位组值变更
|
||||
* @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>
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
<template>
|
||||
<a>ssssssssssssssssssssssssssssssssssss</a>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="packageinfo">
|
||||
import { onMounted, reactive,ref } from 'vue';
|
||||
|
||||
const formInline = reactive({
|
||||
name:'',//名称
|
||||
isEnable:"",//可用状态
|
||||
codeNum:'',//编码
|
||||
})
|
||||
|
||||
|
||||
onMounted(() => {
|
||||
console.log('startPackageInfo')
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
</style>
|
|
@ -0,0 +1,207 @@
|
|||
<template>
|
||||
<div class="sys-open-access-container">
|
||||
<el-dialog v-model="dialogTableVisible" :title="mTitle" width="1000">
|
||||
<el-form :inline="true" :model="printInfoFrom" class="demo-form-inline" label-width="90px">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="打印模板">
|
||||
<el-select v-model="printInfoFrom.printData" placeholder="请选择" clearable>
|
||||
<el-option :label="item.name" :value="item" v-for="item, index in state.printData"
|
||||
:key="index" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="标签数量">
|
||||
<el-input v-model="printInfoFrom.printCount" placeholder="请输入编码" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="单位">
|
||||
<el-select v-model="printInfoFrom.unit" placeholder="请选择" clearable>
|
||||
<el-option :label="item.name" :value="item.id" v-for="item, index in unitListData"
|
||||
:key="index" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
|
||||
<el-col :span="8">
|
||||
<el-form-item label="包装单位">
|
||||
<el-input v-model="printInfoFrom.packageUnit" placeholder="请输入" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="包装">
|
||||
<el-input v-model="printInfoFrom.package" placeholder="请输入" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
|
||||
<el-col :span="8">
|
||||
<el-form-item label="生产日期">
|
||||
<el-date-picker v-model="printInfoFrom.productDate" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="失效日期" >
|
||||
<el-date-picker v-model="printInfoFrom.loseDate" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="批次">
|
||||
<el-input v-model="printInfoFrom.batch" placeholder="1" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
</el-form>
|
||||
<el-row style="display: flex; justify-content: space-around;">
|
||||
<el-button style="width: 100px;" @click="dialogTableVisible = false">取消</el-button>
|
||||
<el-button style="width: 100px;" type="primary" @click="printSubmit">打印</el-button>
|
||||
</el-row>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, reactive,ref } from 'vue'
|
||||
import { getAPI } from '/@/utils/axios-utils';
|
||||
import { SysUnitApi, MaterialsApi, SysPrintApi } from '/@/api-services/api';
|
||||
import { SysUnitOutput, MaterialsOutput, SysPrint } from '/@/api-services/models';
|
||||
import { ElMessageBox, ElMessage, TabsPaneContext } from 'element-plus';
|
||||
|
||||
let dialogTableVisible = ref(false);
|
||||
const mTitle='标签打印'
|
||||
const fyListData=ref([]);
|
||||
const unitListData=ref<SysUnitOutput[]>([]);
|
||||
//定义printInfoFrom字段
|
||||
const printInfoFrom = reactive({
|
||||
name: '',
|
||||
printData: {} as SysPrint,
|
||||
printCount: 100,
|
||||
unit: '',
|
||||
packageUnit: 1,
|
||||
package: '',
|
||||
productDate: Date,
|
||||
loseDate: Date,
|
||||
batch:1,
|
||||
})
|
||||
|
||||
const state = reactive({
|
||||
loading: false,
|
||||
printData: [] as Array<SysPrint>,
|
||||
queryParams: {
|
||||
name: undefined,
|
||||
},
|
||||
tableParams: {
|
||||
page: 1,
|
||||
pageSize: 10,
|
||||
total: 0 as any,
|
||||
},
|
||||
editPrintTitle: '',
|
||||
});
|
||||
|
||||
// 查询操作
|
||||
const handleQuery = async () => {
|
||||
state.loading = true;
|
||||
let params = Object.assign(state.queryParams, state.tableParams);
|
||||
var res = await getAPI(SysPrintApi).apiSysPrintPagePost(params);
|
||||
state.printData = res.data.result?.items ?? [];
|
||||
state.tableParams.total = res.data.result?.total;
|
||||
state.loading = false;
|
||||
};
|
||||
|
||||
// 查询操作
|
||||
const queryUnitByGroupId = async (groupId:number|null|undefined) => {
|
||||
state.loading = true;
|
||||
var res = await getAPI(SysUnitApi).apiSysUnitListUnitGroupIdGet(groupId);
|
||||
const units = res.data.result ?? [];
|
||||
unitListData.value=units
|
||||
console.log(units)
|
||||
};
|
||||
|
||||
|
||||
|
||||
//定义matterSubmit方法
|
||||
const printSubmit = () => {
|
||||
console.log(printInfoFrom)
|
||||
|
||||
}
|
||||
|
||||
const formInline = reactive({
|
||||
user: '',
|
||||
region: '',
|
||||
date: '',
|
||||
})
|
||||
|
||||
const onSubmit = () => {
|
||||
console.log('submit!')
|
||||
}
|
||||
|
||||
|
||||
const pageVO1 = reactive({
|
||||
currentPage: 1,
|
||||
pageSize: 30,
|
||||
total: 8
|
||||
})
|
||||
|
||||
const tableData = ref<MaterialsOutput[]>([]);
|
||||
|
||||
const MaterialsPage = async (data) => {
|
||||
let res = await getAPI(MaterialsApi).apiMaterialsPagePost({ page: 1, pageSize: 10, ...formInline });
|
||||
if (res.data.code === 200) {
|
||||
pageVO1.total = res.data.result?.total!;
|
||||
tableData.value = res.data.result?.items!;
|
||||
}
|
||||
}
|
||||
|
||||
//定义printLabel方法,打开打印设置界面
|
||||
const printLabel = (data:MaterialsOutput) => {
|
||||
const unitGroupId = data.unitgroupid
|
||||
queryUnitByGroupId(unitGroupId)
|
||||
dialogTableVisible.value = true;
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
MaterialsPage({});
|
||||
handleQuery();
|
||||
|
||||
})
|
||||
|
||||
</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;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -44,12 +44,12 @@
|
|||
<vxe-table show-overflow height="100%" :data="tableData" :border=true :tree-config="{ transform: true }"
|
||||
:scroll-y="{ gt: 20 }">
|
||||
<vxe-column type="seq" title="序号" width="70" sortable></vxe-column>
|
||||
<vxe-column field="b" sortable title="物料名称" width=""></vxe-column>
|
||||
<vxe-column field="c" sortable title="规格型号" width=""></vxe-column>
|
||||
<vxe-column field="d" sortable title="品牌" width=""></vxe-column>
|
||||
<vxe-column field="name" 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 title="操作" width="200" fixed="right" show-overflow>
|
||||
<template #default="{ row }">
|
||||
<vxe-button type="text" >打印标签</vxe-button>
|
||||
<vxe-button type="text" @click="printLabel(row)">打印标签</vxe-button>
|
||||
<!-- <vxe-button type="text" icon="vxe-icon-delete"></vxe-button> -->
|
||||
</template>
|
||||
</vxe-column>
|
||||
|
@ -62,11 +62,77 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<EditAccess ref="editOpenAccessRef" :title="state.editOpenAccessTitle" @handleQuery="handleQuery" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { reactive } from 'vue'
|
||||
import { onMounted, reactive,ref } from 'vue'
|
||||
import { getAPI } from '/@/utils/axios-utils';
|
||||
import { SysUnitApi, MaterialsApi, SysPrintApi } from '/@/api-services/api';
|
||||
import { SysUnitOutput, MaterialsOutput, SysPrint } from '/@/api-services/models';
|
||||
import { ElMessageBox, ElMessage, TabsPaneContext } from 'element-plus';
|
||||
import EditAccess from '/@/views/labelPrinting/materialPrinting/index.vue';
|
||||
|
||||
const editOpenAccessRef = ref<InstanceType<typeof EditAccess>>();
|
||||
let dialogTableVisible = ref(false);
|
||||
const mTitle='标签打印'
|
||||
const fyListData=ref([]);
|
||||
const unitListData=ref<SysUnitOutput[]>([]);
|
||||
//定义printInfoFrom字段
|
||||
const printInfoFrom = reactive({
|
||||
name: '',
|
||||
printData: {} as SysPrint,
|
||||
printCount: 100,
|
||||
unit: '',
|
||||
packageUnit: 1,
|
||||
package: '',
|
||||
productDate: Date,
|
||||
loseDate: Date,
|
||||
batch:1,
|
||||
})
|
||||
|
||||
const state = reactive({
|
||||
loading: false,
|
||||
editOpenAccessTitle:'打印信息',
|
||||
printData: [] as Array<SysPrint>,
|
||||
queryParams: {
|
||||
name: undefined,
|
||||
},
|
||||
tableParams: {
|
||||
page: 1,
|
||||
pageSize: 10,
|
||||
total: 0 as any,
|
||||
},
|
||||
editPrintTitle: '',
|
||||
});
|
||||
|
||||
// 查询操作
|
||||
const handleQuery = async () => {
|
||||
state.loading = true;
|
||||
let params = Object.assign(state.queryParams, state.tableParams);
|
||||
var res = await getAPI(SysPrintApi).apiSysPrintPagePost(params);
|
||||
state.printData = res.data.result?.items ?? [];
|
||||
state.tableParams.total = res.data.result?.total;
|
||||
state.loading = false;
|
||||
};
|
||||
|
||||
// 查询操作
|
||||
const queryUnitByGroupId = async (groupId:number|null|undefined) => {
|
||||
state.loading = true;
|
||||
var res = await getAPI(SysUnitApi).apiSysUnitListUnitGroupIdGet(groupId);
|
||||
const units = res.data.result ?? [];
|
||||
unitListData.value=units
|
||||
console.log(units)
|
||||
};
|
||||
|
||||
|
||||
|
||||
//定义matterSubmit方法
|
||||
const printSubmit = () => {
|
||||
console.log(printInfoFrom)
|
||||
|
||||
}
|
||||
|
||||
const formInline = reactive({
|
||||
user: '',
|
||||
|
@ -79,38 +145,35 @@ const onSubmit = () => {
|
|||
}
|
||||
|
||||
|
||||
|
||||
import { ref } from 'vue'
|
||||
|
||||
const tableData = ref([
|
||||
{
|
||||
id:1,
|
||||
a:'WL0585334',
|
||||
b:'示例数据(导入时请删除)',
|
||||
c:'500ml',
|
||||
d:'海天品牌',
|
||||
},
|
||||
{
|
||||
id:1,
|
||||
a:'WL00002',
|
||||
b:' 海天白糖1KG*3',
|
||||
c:'1KG*3',
|
||||
d:'海天品牌',
|
||||
},
|
||||
{
|
||||
id:1,
|
||||
a:'WL00001',
|
||||
b:'500g产品',
|
||||
c:'500g',
|
||||
d:'海天品牌',
|
||||
},
|
||||
])
|
||||
|
||||
const pageVO1 = reactive({
|
||||
currentPage: 1,
|
||||
pageSize: 30,
|
||||
total: 8
|
||||
})
|
||||
|
||||
const tableData = ref<MaterialsOutput[]>([]);
|
||||
|
||||
const MaterialsPage = async (data) => {
|
||||
let res = await getAPI(MaterialsApi).apiMaterialsPagePost({ page: 1, pageSize: 10, ...formInline });
|
||||
if (res.data.code === 200) {
|
||||
pageVO1.total = res.data.result?.total!;
|
||||
tableData.value = res.data.result?.items!;
|
||||
}
|
||||
}
|
||||
|
||||
//定义printLabel方法,打开打印设置界面
|
||||
const printLabel = (data:MaterialsOutput) => {
|
||||
const unitGroupId = data.unitgroupid
|
||||
queryUnitByGroupId(unitGroupId)
|
||||
dialogTableVisible.value = true;
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
MaterialsPage({});
|
||||
handleQuery();
|
||||
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
@ -137,16 +137,16 @@ const state = reactive({
|
|||
height: 147.6,
|
||||
},
|
||||
B3: {
|
||||
width: 500,
|
||||
height: 352.6,
|
||||
width: 120,
|
||||
height: 80,
|
||||
},
|
||||
B4: {
|
||||
width: 250,
|
||||
height: 352.6,
|
||||
width: 100,
|
||||
height: 60,
|
||||
},
|
||||
B5: {
|
||||
width: 250,
|
||||
height: 175.6,
|
||||
width: 80,
|
||||
height: 50,
|
||||
},
|
||||
},
|
||||
scaleValue: 1,
|
||||
|
|
Loading…
Reference in New Issue