0620
parent
7281564696
commit
c358a67e4c
|
@ -8,7 +8,8 @@
|
|||
{
|
||||
//"ConfigId": "1300000000001", // 默认库标识-禁止修改
|
||||
"DbType": "MySql", // MySql、SqlServer、Sqlite、Oracle、PostgreSQL、Dm、Kdbndp、Oscar、MySqlConnector、Access、OpenGauss、QuestDB、HG、ClickHouse、GBase、Odbc、Custom
|
||||
"ConnectionString": "Server=gz-cdb-76wyaumn.sql.tencentcdb.com;Port=29867;Database=guanwei-;Uid=guanwei-dig;Pwd=hfc123456;SslMode=none;AllowPublicKeyRetrieval=True;", // 库连接字符串
|
||||
"ConnectionString": "Server=gz-cdb-blgil7uv.sql.tencentcdb.com;Port=27315;Database=sql-guanwei;Uid=sql-guanwei;Pwd=gw123456;SslMode=none;AllowPublicKeyRetrieval=True;", // 库连接字符串
|
||||
//"ConnectionString": "Server=gz-cdb-76wyaumn.sql.tencentcdb.com;Port=29867;Database=guanwei-;Uid=guanwei-dig;Pwd=hfc123456;SslMode=none;AllowPublicKeyRetrieval=True;", // 库连接字符串
|
||||
//"ConnectionString": "Server=139.199.191.197;Port=3306;Database=b-guanwei;Uid=b-guanwei;Pwd=hfc123456;SslMode=none;AllowPublicKeyRetrieval=True;", // 库连接字符串
|
||||
//"SlaveConnectionConfigs": [ // 读写分离/主从
|
||||
// {
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
using Admin.NET.Core;
|
||||
namespace Admin.NET.Application.Entity;
|
||||
|
||||
/// <summary>
|
||||
/// 防伪扫码记录
|
||||
/// </summary>
|
||||
[SugarTable("AntiFakeRecords","防伪扫码记录")]
|
||||
public class AntiFakeRecords : EntityBaseId
|
||||
{
|
||||
/// <summary>
|
||||
/// 条码
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "Code", ColumnDescription = "条码", Length = 32)]
|
||||
public string? Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// IP地址
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "Ip", ColumnDescription = "IP地址", Length = 32)]
|
||||
public string? Ip { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 城市
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "City", ColumnDescription = "城市", Length = 32)]
|
||||
public string? City { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地域信息
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "Addr", ColumnDescription = "地域信息", Length = 32)]
|
||||
public string? Addr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 城市编码
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "CityCode", ColumnDescription = "城市编码", Length = 32)]
|
||||
public string? CityCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 省份
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "Pro", ColumnDescription = "省份", Length = 32)]
|
||||
public string? Pro { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 扫码时间
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "Date", ColumnDescription = "扫码时间")]
|
||||
public DateTime? Date { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "Remarks", ColumnDescription = "备注", Length = 32)]
|
||||
public string? Remarks { get; set; }
|
||||
|
||||
}
|
|
@ -0,0 +1,180 @@
|
|||
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)]
|
||||
public class AntiFakeRecordsService : IDynamicApiController, ITransient
|
||||
{
|
||||
private readonly SqlSugarRepository<AntiFakeRecords> _rep;
|
||||
private readonly PrintCodeDetailService _printCodeDetailService;
|
||||
private readonly MaterialsService _materialsService;
|
||||
private readonly ReportDetailTableService _reportDetailTableService;
|
||||
public AntiFakeRecordsService(SqlSugarRepository<AntiFakeRecords> rep,
|
||||
PrintCodeDetailService printCodeDetailService,
|
||||
MaterialsService materialsService,
|
||||
ReportDetailTableService reportDetailTableService)
|
||||
{
|
||||
_rep = rep;
|
||||
_printCodeDetailService = printCodeDetailService;
|
||||
_materialsService = materialsService;
|
||||
_reportDetailTableService = reportDetailTableService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 分页查询防伪扫码记录
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[ApiDescriptionSettings(Name = "Page")]
|
||||
public async Task<SqlSugarPagedList<AntiFakeRecordsOutput>> Page(AntiFakeRecordsInput input)
|
||||
{
|
||||
var query = _rep.AsQueryable()
|
||||
.WhereIF(!string.IsNullOrWhiteSpace(input.SearchKey), u =>
|
||||
u.Code.Contains(input.SearchKey.Trim())
|
||||
|| u.Ip.Contains(input.SearchKey.Trim())
|
||||
|| u.City.Contains(input.SearchKey.Trim())
|
||||
|| u.Addr.Contains(input.SearchKey.Trim())
|
||||
|| u.CityCode.Contains(input.SearchKey.Trim())
|
||||
|| u.Pro.Contains(input.SearchKey.Trim())
|
||||
|| u.Remarks.Contains(input.SearchKey.Trim())
|
||||
)
|
||||
.WhereIF(!string.IsNullOrWhiteSpace(input.Code), u => u.Code.Contains(input.Code.Trim()))
|
||||
.WhereIF(!string.IsNullOrWhiteSpace(input.Ip), u => u.Ip.Contains(input.Ip.Trim()))
|
||||
.WhereIF(!string.IsNullOrWhiteSpace(input.City), u => u.City.Contains(input.City.Trim()))
|
||||
.WhereIF(!string.IsNullOrWhiteSpace(input.Addr), u => u.Addr.Contains(input.Addr.Trim()))
|
||||
.WhereIF(!string.IsNullOrWhiteSpace(input.CityCode), u => u.CityCode.Contains(input.CityCode.Trim()))
|
||||
.WhereIF(!string.IsNullOrWhiteSpace(input.Pro), u => u.Pro.Contains(input.Pro.Trim()))
|
||||
.WhereIF(!string.IsNullOrWhiteSpace(input.Remarks), u => u.Remarks.Contains(input.Remarks.Trim()))
|
||||
.Select<AntiFakeRecordsOutput>();
|
||||
if(input.DateRange != null && input.DateRange.Count >0)
|
||||
{
|
||||
DateTime? start= input.DateRange[0];
|
||||
query = query.WhereIF(start.HasValue, u => u.Date > start);
|
||||
if (input.DateRange.Count >1 && input.DateRange[1].HasValue)
|
||||
{
|
||||
var end = input.DateRange[1].Value.AddDays(1);
|
||||
query = query.Where(u => u.Date < end);
|
||||
}
|
||||
}
|
||||
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(AddAntiFakeRecordsInput input)
|
||||
{
|
||||
var entity = input.Adapt<AntiFakeRecords>();
|
||||
await _rep.InsertAsync(entity);
|
||||
return entity.Id;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除防伪扫码记录
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[ApiDescriptionSettings(Name = "Delete")]
|
||||
public async Task Delete(DeleteAntiFakeRecordsInput 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(UpdateAntiFakeRecordsInput input)
|
||||
{
|
||||
var entity = input.Adapt<AntiFakeRecords>();
|
||||
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取防伪扫码记录
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[ApiDescriptionSettings(Name = "Detail")]
|
||||
public async Task<AntiFakeRecords> Detail([FromQuery] QueryByIdAntiFakeRecordsInput input)
|
||||
{
|
||||
return await _rep.GetFirstAsync(u => u.Id == input.Id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取防伪扫码记录列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[ApiDescriptionSettings(Name = "List")]
|
||||
public async Task<List<AntiFakeRecordsOutput>> List()
|
||||
{
|
||||
return await _rep.AsQueryable().Select<AntiFakeRecordsOutput>().ToListAsync();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取防伪扫码记录列表
|
||||
/// </summary>
|
||||
/// <param name="productCode"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[ApiDescriptionSettings(Name = "GetRecords")]
|
||||
public async Task<List<AntiFakeRecordsOutput>> GetRecords(string ?productCode)
|
||||
{
|
||||
return await _rep.AsQueryable().WhereIF(!string.IsNullOrEmpty(productCode), u => u.Code == productCode).Select<AntiFakeRecordsOutput>().ToListAsync();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取打印条码详情
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[ApiDescriptionSettings(Name = "AntiFakeCode")]
|
||||
public async Task<AntiFakeInfoOutput> AntiFakeCode(AddAntiFakeRecordsInput input)
|
||||
{
|
||||
var code = await _printCodeDetailService.GetByProductCode(input.Code);
|
||||
if (code == null)
|
||||
{
|
||||
throw Oops.Oh(ErrorCodeEnum.xg1002);
|
||||
}
|
||||
var material = await _materialsService.GetById(code.MaterialsId);
|
||||
if (material == null)
|
||||
{
|
||||
throw Oops.Oh(ErrorCodeEnum.xg1002);
|
||||
}
|
||||
var model = new AntiFakeInfoOutput()
|
||||
{
|
||||
Addr = input.Addr,
|
||||
Code = code.Code,
|
||||
Brand = material.Brand,
|
||||
Specifications = material.Specifications,
|
||||
};
|
||||
var report = await _reportDetailTableService.Detail(new QueryByIdReportDetailTableInput() { Id = code.ReportTableId.Value });
|
||||
if (report!=null)
|
||||
{
|
||||
model.Batch= report.Batch;
|
||||
}
|
||||
return model;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
namespace Admin.NET.Application;
|
||||
|
||||
/// <summary>
|
||||
/// 防伪扫码输出参数
|
||||
/// </summary>
|
||||
public class AntiFakeInfoOutput
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 条码
|
||||
/// </summary>
|
||||
public string? Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地域信息
|
||||
/// </summary>
|
||||
public string? Addr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string? Remarks { get; set; }
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public string? Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单号
|
||||
/// </summary>
|
||||
public string? OddNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 规格型号
|
||||
/// </summary>
|
||||
public string? Specifications { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 批次
|
||||
/// </summary>
|
||||
public string? Batch { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 品牌
|
||||
/// </summary>
|
||||
public string? Brand { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 生产线
|
||||
/// </summary>
|
||||
public string? ProductionLine { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 经销商
|
||||
/// </summary>
|
||||
public string? Dealer { get; set; }
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
namespace Admin.NET.Application;
|
||||
|
||||
/// <summary>
|
||||
/// 防伪扫码记录输出参数
|
||||
/// </summary>
|
||||
public class AntiFakeRecordsDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键Id
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 条码
|
||||
/// </summary>
|
||||
public string? Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// IP地址
|
||||
/// </summary>
|
||||
public string? Ip { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 城市
|
||||
/// </summary>
|
||||
public string? City { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地域信息
|
||||
/// </summary>
|
||||
public string? Addr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 城市编码
|
||||
/// </summary>
|
||||
public string? CityCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 省份
|
||||
/// </summary>
|
||||
public string? Pro { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 扫码时间
|
||||
/// </summary>
|
||||
public DateTime? Date { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string? Remarks { get; set; }
|
||||
|
||||
}
|
|
@ -0,0 +1,142 @@
|
|||
using Admin.NET.Core;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Admin.NET.Application;
|
||||
|
||||
/// <summary>
|
||||
/// 防伪扫码记录基础输入参数
|
||||
/// </summary>
|
||||
public class AntiFakeRecordsBaseInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 条码
|
||||
/// </summary>
|
||||
public virtual string? Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// IP地址
|
||||
/// </summary>
|
||||
public virtual string? Ip { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 城市
|
||||
/// </summary>
|
||||
public virtual string? City { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地域信息
|
||||
/// </summary>
|
||||
public virtual string? Addr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 城市编码
|
||||
/// </summary>
|
||||
public virtual string? CityCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 省份
|
||||
/// </summary>
|
||||
public virtual string? Pro { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 扫码时间
|
||||
/// </summary>
|
||||
public virtual DateTime? Date { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public virtual string? Remarks { get; set; }
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 防伪扫码记录分页查询输入参数
|
||||
/// </summary>
|
||||
public class AntiFakeRecordsInput : BasePageInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 关键字查询
|
||||
/// </summary>
|
||||
public string? SearchKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 条码
|
||||
/// </summary>
|
||||
public string? Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// IP地址
|
||||
/// </summary>
|
||||
public string? Ip { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 城市
|
||||
/// </summary>
|
||||
public string? City { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地域信息
|
||||
/// </summary>
|
||||
public string? Addr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 城市编码
|
||||
/// </summary>
|
||||
public string? CityCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 省份
|
||||
/// </summary>
|
||||
public string? Pro { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 扫码时间
|
||||
/// </summary>
|
||||
public DateTime? Date { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 扫码时间范围
|
||||
/// </summary>
|
||||
public List<DateTime?> DateRange { get; set; }
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string? Remarks { get; set; }
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 防伪扫码记录增加输入参数
|
||||
/// </summary>
|
||||
public class AddAntiFakeRecordsInput : AntiFakeRecordsBaseInput
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 防伪扫码记录删除输入参数
|
||||
/// </summary>
|
||||
public class DeleteAntiFakeRecordsInput : BaseIdInput
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 防伪扫码记录更新输入参数
|
||||
/// </summary>
|
||||
public class UpdateAntiFakeRecordsInput : AntiFakeRecordsBaseInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键Id
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "主键Id不能为空")]
|
||||
public long Id { get; set; }
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 防伪扫码记录主键查询输入参数
|
||||
/// </summary>
|
||||
public class QueryByIdAntiFakeRecordsInput : DeleteAntiFakeRecordsInput
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
namespace Admin.NET.Application;
|
||||
|
||||
/// <summary>
|
||||
/// 防伪扫码记录输出参数
|
||||
/// </summary>
|
||||
public class AntiFakeRecordsOutput
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键Id
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 条码
|
||||
/// </summary>
|
||||
public string? Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// IP地址
|
||||
/// </summary>
|
||||
public string? Ip { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 城市
|
||||
/// </summary>
|
||||
public string? City { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地域信息
|
||||
/// </summary>
|
||||
public string? Addr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 城市编码
|
||||
/// </summary>
|
||||
public string? CityCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 省份
|
||||
/// </summary>
|
||||
public string? Pro { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 扫码时间
|
||||
/// </summary>
|
||||
public DateTime? Date { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string? Remarks { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -70,6 +70,10 @@ public class PrintCodeDetailDto
|
|||
/// </summary>
|
||||
public long? FatherId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物料ID
|
||||
/// </summary>
|
||||
public long? MaterialsId { get; set; }
|
||||
/// <summary>
|
||||
/// 打码时间
|
||||
/// </summary>
|
||||
|
|
|
@ -63,6 +63,11 @@ public class PrintCodeDetailBaseInput
|
|||
/// </summary>
|
||||
public virtual long? FatherId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物料ID
|
||||
/// </summary>
|
||||
public long? MaterialsId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 仓库ID
|
||||
/// </summary>
|
||||
|
@ -184,6 +189,12 @@ public class PrintCodeDetailInput : BasePageInput
|
|||
/// 父节点ID
|
||||
/// </summary>
|
||||
public long? FatherId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物料ID
|
||||
/// </summary>
|
||||
public long? MaterialsId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 打码时间
|
||||
/// </summary>
|
||||
|
|
|
@ -163,6 +163,5 @@ public class PrintCodeDetailService : IDynamicApiController, ITransient
|
|||
{
|
||||
return await _rep.GetFirstAsync(a => a.Code == productCode);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -2,4 +2,4 @@
|
|||
ENV = production
|
||||
|
||||
# 线上环境接口地址
|
||||
VITE_API_URL = http://139.199.191.197:9005
|
||||
VITE_API_URL = http://49.234.181.176: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>
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
import request from '/@/utils/request';
|
||||
enum Api {
|
||||
AddAntiFakeRecords = '/api/antiFakeRecords/add',
|
||||
DeleteAntiFakeRecords = '/api/antiFakeRecords/delete',
|
||||
UpdateAntiFakeRecords = '/api/antiFakeRecords/update',
|
||||
PageAntiFakeRecords = '/api/antiFakeRecords/page',
|
||||
DetailAntiFakeRecords = '/api/antiFakeRecords/detail',
|
||||
ListAntiFakeRecords = '/api/antiFakeRecords/list',
|
||||
}
|
||||
|
||||
// 增加防伪扫码记录
|
||||
export const addAntiFakeRecords = (params?: any) =>
|
||||
request({
|
||||
url: Api.AddAntiFakeRecords,
|
||||
method: 'post',
|
||||
data: params,
|
||||
});
|
||||
|
||||
// 删除防伪扫码记录
|
||||
export const deleteAntiFakeRecords = (params?: any) =>
|
||||
request({
|
||||
url: Api.DeleteAntiFakeRecords,
|
||||
method: 'post',
|
||||
data: params,
|
||||
});
|
||||
|
||||
// 编辑防伪扫码记录
|
||||
export const updateAntiFakeRecords = (params?: any) =>
|
||||
request({
|
||||
url: Api.UpdateAntiFakeRecords,
|
||||
method: 'post',
|
||||
data: params,
|
||||
});
|
||||
|
||||
// 分页查询防伪扫码记录
|
||||
export const pageAntiFakeRecords = (params?: any) =>
|
||||
request({
|
||||
url: Api.PageAntiFakeRecords,
|
||||
method: 'post',
|
||||
data: params,
|
||||
});
|
||||
|
||||
// 列表防伪扫码记录
|
||||
export const listAntiFakeRecords = () =>
|
||||
request({
|
||||
url: Api.ListAntiFakeRecords,
|
||||
method: 'get',
|
||||
data: { },
|
||||
});
|
||||
|
||||
// 详情防伪扫码记录
|
||||
export const detailAntiFakeRecords = (id: any) =>
|
||||
request({
|
||||
url: Api.DetailAntiFakeRecords,
|
||||
method: 'get',
|
||||
data: { id },
|
||||
});
|
||||
|
||||
|
|
@ -0,0 +1,170 @@
|
|||
<template>
|
||||
<div class="antiFakeRecords-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="code">
|
||||
<el-input v-model="ruleForm.code" 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="IP地址" prop="ip">
|
||||
<el-input v-model="ruleForm.ip" placeholder="请输入IP地址" 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="city">
|
||||
<el-input v-model="ruleForm.city" 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="addr">
|
||||
<el-input v-model="ruleForm.addr" 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="cityCode">
|
||||
<el-input v-model="ruleForm.cityCode" 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="pro">
|
||||
<el-input v-model="ruleForm.pro" 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="date">
|
||||
<el-date-picker v-model="ruleForm.date" 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="remarks">
|
||||
<el-input v-model="ruleForm.remarks" placeholder="请输入备注" maxlength="32" 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 { addAntiFakeRecords, updateAntiFakeRecords, detailAntiFakeRecords } from "/@/api/main/antiFakeRecords";
|
||||
|
||||
//父级传递来的参数
|
||||
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 detailAntiFakeRecords(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 addAntiFakeRecords(values);
|
||||
} else {
|
||||
await updateAntiFakeRecords(values);
|
||||
}
|
||||
closeDialog();
|
||||
} else {
|
||||
ElMessage({
|
||||
message: `表单有${Object.keys(fields).length}处验证失败,请修改后再提交`,
|
||||
type: "error",
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 页面加载时
|
||||
onMounted(async () => {
|
||||
});
|
||||
|
||||
//将属性或者函数暴露给父组件
|
||||
defineExpose({ openDialog });
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,228 @@
|
|||
<template>
|
||||
<div class="antiFakeRecords-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.code" 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="IP地址">
|
||||
<el-input v-model="queryParams.ip" clearable="" placeholder="请输入IP地址"/>
|
||||
|
||||
</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.city" 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.addr" 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.cityCode" 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.pro" 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.dateRange" />
|
||||
|
||||
</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="'antiFakeRecords: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="openAddAntiFakeRecords" v-auth="'antiFakeRecords: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="code" label="条码" width="140" show-overflow-tooltip="" />
|
||||
<el-table-column prop="ip" label="IP地址" width="140" show-overflow-tooltip="" />
|
||||
<el-table-column prop="city" label="城市" width="140" show-overflow-tooltip="" />
|
||||
<el-table-column prop="addr" label="地域信息" width="140" show-overflow-tooltip="" />
|
||||
<el-table-column prop="cityCode" label="城市编码" width="140" show-overflow-tooltip="" />
|
||||
<el-table-column prop="pro" label="省份" width="140" show-overflow-tooltip="" />
|
||||
<el-table-column prop="date" 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('antiFakeRecords:update') || auth('antiFakeRecords:delete')">
|
||||
<template #default="scope">
|
||||
<el-button icon="ele-Edit" size="small" text="" type="primary" @click="openEditAntiFakeRecords(scope.row)" v-auth="'antiFakeRecords:update'"> 编辑 </el-button>
|
||||
<el-button icon="ele-Delete" size="small" text="" type="primary" @click="delAntiFakeRecords(scope.row)" v-auth="'antiFakeRecords: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"
|
||||
/>
|
||||
<printDialog
|
||||
ref="printDialogRef"
|
||||
:title="printAntiFakeRecordsTitle"
|
||||
@reloadTable="handleQuery" />
|
||||
<editDialog
|
||||
ref="editDialogRef"
|
||||
:title="editAntiFakeRecordsTitle"
|
||||
@reloadTable="handleQuery"
|
||||
/>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup="" name="antiFakeRecords">
|
||||
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 printDialog from '/@/views/labelPrinting/print/component/hiprint/preview.vue'
|
||||
import editDialog from '/@/views/main/antiFakeRecords/component/editDialog.vue'
|
||||
import { pageAntiFakeRecords, deleteAntiFakeRecords } from '/@/api/main/antiFakeRecords';
|
||||
|
||||
|
||||
const showAdvanceQueryUI = ref(false);
|
||||
const printDialogRef = ref();
|
||||
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 printAntiFakeRecordsTitle = ref("");
|
||||
const editAntiFakeRecordsTitle = ref("");
|
||||
|
||||
// 改变高级查询的控件显示状态
|
||||
const changeAdvanceQueryUI = () => {
|
||||
showAdvanceQueryUI.value = !showAdvanceQueryUI.value;
|
||||
}
|
||||
|
||||
|
||||
// 查询操作
|
||||
const handleQuery = async () => {
|
||||
loading.value = true;
|
||||
var res = await pageAntiFakeRecords(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 openAddAntiFakeRecords = () => {
|
||||
editAntiFakeRecordsTitle.value = '添加防伪扫码记录';
|
||||
editDialogRef.value.openDialog({});
|
||||
};
|
||||
|
||||
// 打开打印页面
|
||||
const openPrintAntiFakeRecords = async (row: any) => {
|
||||
printAntiFakeRecordsTitle.value = '打印防伪扫码记录';
|
||||
}
|
||||
|
||||
// 打开编辑页面
|
||||
const openEditAntiFakeRecords = (row: any) => {
|
||||
editAntiFakeRecordsTitle.value = '编辑防伪扫码记录';
|
||||
editDialogRef.value.openDialog(row);
|
||||
};
|
||||
|
||||
// 删除
|
||||
const delAntiFakeRecords = (row: any) => {
|
||||
ElMessageBox.confirm(`确定要删除吗?`, "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
})
|
||||
.then(async () => {
|
||||
await deleteAntiFakeRecords(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