Administrator
3 years ago
19 changed files with 4140 additions and 194 deletions
@ -0,0 +1,322 @@ |
|||||
|
using Magicodes.ExporterAndImporter.Core; |
||||
|
using Magicodes.ExporterAndImporter.Csv; |
||||
|
using Magicodes.ExporterAndImporter.Excel; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Guids; |
||||
|
using Win.Sfs.BaseData.ImportExcelCommon; |
||||
|
using Win.Sfs.SettleAccount.Entities.WMSKanBan; |
||||
|
using Win.Sfs.Shared.Filter; |
||||
|
using Shouldly; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Volo.Abp.Caching; |
||||
|
using Win.Abp.Snowflakes; |
||||
|
using Win.Sfs.SettleAccount.CommonManagers; |
||||
|
using Volo.Abp; |
||||
|
using Microsoft.AspNetCore.Http; |
||||
|
using Win.Sfs.SettleAccount.ExcelImporter; |
||||
|
using EFCore.BulkExtensions; |
||||
|
using Win.Sfs.SettleAccount.ExportReports; |
||||
|
using Volo.Abp.Domain.Repositories; |
||||
|
using Win.Sfs.SettleAccount.Constant; |
||||
|
using Microsoft.AspNetCore.Authorization; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
|
||||
|
namespace Win.Sfs.SettleAccount.Entities.WMS_KanBan |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 大众看板发货明细
|
||||
|
/// </summary>
|
||||
|
//[Authorize(SettleAccountPermissions.SettleAccounts.Default)]
|
||||
|
//[AllowAnonymous]
|
||||
|
[Route("api/settleaccount/WMSVWKanBan")] |
||||
|
public class WMSKanBanAppService : SettleAccountApplicationBase<WMSKanBanSettle>, IWMSVWKanBanAppService |
||||
|
{ |
||||
|
private readonly IGuidGenerator _guidGenerator; |
||||
|
|
||||
|
private readonly IExcelImportAppService _excelImportService; |
||||
|
|
||||
|
private readonly ISettleAccountBranchEfCoreRepository<WMSKanBanVersion, Guid> _versionRepository; |
||||
|
|
||||
|
private readonly ISettleAccountBranchEfCoreRepository<WMSKanBanSettle, Guid> _repository; |
||||
|
/// <summary>
|
||||
|
/// 构建方法
|
||||
|
/// </summary>
|
||||
|
/// <param name="guidGenerator">构建UID</param>
|
||||
|
/// <param name="repository">仓储接口</param>
|
||||
|
/// <param name="cache">缓存</param>
|
||||
|
public WMSKanBanAppService(IGuidGenerator guidGenerator, |
||||
|
ISettleAccountBranchEfCoreRepository<WMSKanBanVersion, Guid> versionRepository, |
||||
|
ISettleAccountBranchEfCoreRepository<WMSKanBanSettle, Guid> repository, |
||||
|
IDistributedCache<WMSKanBanSettle> cache, |
||||
|
IExcelImportAppService excelImportService, |
||||
|
ISnowflakeIdGenerator snowflakeIdGenerator, |
||||
|
ICommonManager commonManager |
||||
|
) : base(cache, excelImportService, snowflakeIdGenerator, commonManager) |
||||
|
{ |
||||
|
_versionRepository = versionRepository; |
||||
|
_guidGenerator = guidGenerator; |
||||
|
_excelImportService = excelImportService; |
||||
|
_repository = repository; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 导入功能
|
||||
|
/// </summary>
|
||||
|
/// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPost] |
||||
|
[Route("ExcelImport")] |
||||
|
[DisableRequestSizeLimit] |
||||
|
//[Authorize(SettleAccountPermissions.SettleAccounts.Default)]
|
||||
|
public async Task<string> WMSVWKanBanUploadExcelImport([FromForm] IFormFileCollection files, Guid branchId, string year, string period, string version, string customerCode) |
||||
|
{ |
||||
|
if (string.IsNullOrEmpty(version)) |
||||
|
{ |
||||
|
throw new BusinessException("版本不能空,必须传入!"); |
||||
|
} |
||||
|
List<WMSVWKanBanImportDto> listImport = new List<WMSVWKanBanImportDto>(); |
||||
|
ExportImporter _exportImporter = new ExportImporter(); |
||||
|
var result = await _exportImporter.UploadExcelImport<WMSVWKanBanImportDto>(files, _excelImportService); |
||||
|
var entityList = ObjectMapper.Map<List<WMSVWKanBanImportDto>, List<WMSKanBanSettle>>(result); |
||||
|
//删除版本
|
||||
|
var _versionQuery = _versionRepository.Where(p => p.Version == version); |
||||
|
await _versionQuery.BatchDeleteAsync(); |
||||
|
//删除明细
|
||||
|
var _query = _repository.Where(p => p.Version == version); |
||||
|
await _query.BatchDeleteAsync(); |
||||
|
//插入数据前检验
|
||||
|
var checkList = new List<ErrorExportDto>(); |
||||
|
var _group = entityList.GroupBy(x => new { x.Kanban, x.MaterialCode, x.Version }).Select(p => new { Count = p.Count(), Kanban = p.Key.Kanban, MaterialCode = p.Key.MaterialCode }); |
||||
|
foreach (var itm in _group) |
||||
|
{ |
||||
|
if (itm.Count > 1) |
||||
|
{ |
||||
|
checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("导入的零件号{0},其看板条码号{1}有重复数据,请检查!", itm.MaterialCode, itm.Kanban), string.Empty)); |
||||
|
} |
||||
|
} |
||||
|
var _id = GuidGenerator.Create(); |
||||
|
var _bomList = new List<WMSKanBanVersion>(); |
||||
|
_bomList.Add(new WMSKanBanVersion(_id, branchId, year, period, version, customerCode)); |
||||
|
foreach (var itm in entityList) |
||||
|
{ |
||||
|
itm.SetValue(GuidGenerator.Create(), branchId, year, period, version, _id); |
||||
|
} |
||||
|
if (checkList.Count > 0) |
||||
|
{ |
||||
|
return await ExportErrorReportAsync(checkList); |
||||
|
} |
||||
|
await _repository.GetDbContext().BulkInsertAsync<WMSKanBanSettle>(entityList); |
||||
|
await _versionRepository.GetDbContext().BulkInsertAsync(_bomList); |
||||
|
return ApplicationConsts.SuccessStr; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 按ID获取唯一实体
|
||||
|
/// </summary>
|
||||
|
/// <remarks>
|
||||
|
/// 返回实体全部属性
|
||||
|
/// </remarks>
|
||||
|
/// <param name="id">ID</param>
|
||||
|
/// <returns>实体DTO</returns>
|
||||
|
[HttpGet] |
||||
|
[Route("{id}")] |
||||
|
[Authorize(SettleAccountPermissions.SettleAccounts.Default)] |
||||
|
virtual public async Task<WMSVWKanBanDto> GetAsync(Guid id) |
||||
|
{ |
||||
|
var result = await GetFromCacheAsync(id); |
||||
|
var dto = ObjectMapper.Map<WMSKanBanSettle, WMSVWKanBanDto>(result); |
||||
|
return dto; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
private async Task<WMSKanBanSettle> GetFromCacheAsync(Guid id) |
||||
|
{ |
||||
|
var result = await _repository.GetAsync(id); |
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
private async Task<long> GetCountAsync(WMSVWKanBanRequestDto input) |
||||
|
{ |
||||
|
return await _repository.GetCountByFilterAsync(input.BranchId, input.Filters); |
||||
|
} |
||||
|
|
||||
|
private async Task<long> GetCountAsync(WMSVWKanBanVersionRequestDto input) |
||||
|
{ |
||||
|
return await _versionRepository.GetCountByFilterAsync(input.BranchId, input.Filters); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 导出文件
|
||||
|
/// </summary>
|
||||
|
/// <param name="input"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPost] |
||||
|
[Route("Export")] |
||||
|
//[Authorize(SettleAccountPermissions.SettleAccounts.Default)]
|
||||
|
virtual public async Task<string> ExportAsync(WMSVWKanBanRequestDto input) |
||||
|
{ |
||||
|
|
||||
|
IExporter _csv = new CsvExporter(); |
||||
|
IExporter _excel = new ExcelExporter(); |
||||
|
|
||||
|
if (!string.IsNullOrEmpty(input.Version)) |
||||
|
{ |
||||
|
input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "Version", Logic = EnumFilterLogic.And, Value = input.Version }); |
||||
|
} |
||||
|
var entities = await _repository.GetListByFilterAsync(GuidGenerator.Create(), input.Filters, input.Sorting, int.MaxValue, |
||||
|
0, true); |
||||
|
|
||||
|
var dtoDetails = ObjectMapper.Map<List<WMSKanBanSettle>, List<WMSVWKanBanExportDto>>(entities); |
||||
|
|
||||
|
string _fileName = string.Empty; |
||||
|
//声明导出容器
|
||||
|
|
||||
|
byte[] result = null; |
||||
|
switch (input.FileType) |
||||
|
{ |
||||
|
case 0: |
||||
|
_fileName = string.Format("大众看板发货明细_{0}.csv", input.UserId.ToString()); |
||||
|
result = await _csv.ExportAsByteArray(dtoDetails); |
||||
|
break; |
||||
|
case 1: |
||||
|
_fileName = string.Format("大众看板发货明细_{0}.xlsx", input.UserId.ToString()); |
||||
|
result = await _excel.ExportAsByteArray(dtoDetails); |
||||
|
break; |
||||
|
} |
||||
|
result.ShouldNotBeNull(); |
||||
|
|
||||
|
//保存导出文件到服务器存成二进制
|
||||
|
await _excelImportService.SaveBlobAsync( |
||||
|
new SaveExcelImportInputDto |
||||
|
{ |
||||
|
Name = _fileName, |
||||
|
Content = result |
||||
|
} |
||||
|
); |
||||
|
return _fileName; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 根据筛选条件获取实体列表
|
||||
|
/// </summary>
|
||||
|
/// <remarks>
|
||||
|
/// 请求条件包括:筛选条件列表,排序条件,数据数量,页码
|
||||
|
/// </remarks>
|
||||
|
/// <param name="input">请求条件</param>
|
||||
|
/// <returns>实体DTO列表</returns>
|
||||
|
[HttpPost] |
||||
|
[Route("list")] |
||||
|
//[Authorize(SettleAccountPermissions.SettleAccounts.Default)]
|
||||
|
virtual public async Task<PagedResultDto<WMSVWKanBanDto>> GetListAsync(WMSVWKanBanRequestDto input) |
||||
|
{ |
||||
|
|
||||
|
if (!string.IsNullOrEmpty(input.Version)) |
||||
|
{ |
||||
|
input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "Version", Logic = EnumFilterLogic.And, Value = input.Version }); |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
return new PagedResultDto<WMSVWKanBanDto>(0, new List<WMSVWKanBanDto>()); |
||||
|
} |
||||
|
var entities = await _repository.GetListByFilterAsync(GuidGenerator.Create(), input.Filters, input.Sorting, input.MaxResultCount, |
||||
|
input.SkipCount, true); |
||||
|
var totalCount = await GetCountAsync(input); |
||||
|
var dtos = ObjectMapper.Map<List<WMSKanBanSettle>, List<WMSVWKanBanDto>>(entities); |
||||
|
return new PagedResultDto<WMSVWKanBanDto>(totalCount, dtos); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 获取实体总数
|
||||
|
/// </summary>
|
||||
|
/// <returns>实体总数</returns>
|
||||
|
[HttpGet] |
||||
|
[Route("count")] |
||||
|
[Authorize(SettleAccountPermissions.SettleAccounts.Default)] |
||||
|
virtual public async Task<long> GetTotalCountAsync(Guid branchId) |
||||
|
{ |
||||
|
return await _repository.GetCountAsync(branchId); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 获取全部实体列表
|
||||
|
/// </summary>
|
||||
|
/// <returns>实体DTO列表</returns>
|
||||
|
[HttpGet] |
||||
|
[Route("all")] |
||||
|
//[Authorize(SettleAccountPermissions.SettleAccounts.Default)]
|
||||
|
virtual public async Task<ListResultDto<WMSVWKanBanDto>> GetAllAsync(Guid branchId) |
||||
|
{ |
||||
|
var entities = await _repository.GetAllAsync(branchId, true); |
||||
|
|
||||
|
|
||||
|
var dtos = ObjectMapper.Map<List<WMSKanBanSettle>, List<WMSVWKanBanDto>>(entities); |
||||
|
|
||||
|
|
||||
|
return new ListResultDto<WMSVWKanBanDto>(dtos); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 删除实体
|
||||
|
/// </summary>
|
||||
|
/// <param name="id">ID</param>
|
||||
|
/// <returns>无</returns>
|
||||
|
[HttpDelete] |
||||
|
[Route("{id}")] |
||||
|
/// [Authorize(SettleAccountPermissions.SettleAccounts.Delete)]
|
||||
|
virtual public async Task DeleteAsync(Guid id) |
||||
|
{ |
||||
|
await _repository.DeleteAsync(id); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 按IDs删除实体列表
|
||||
|
/// </summary>
|
||||
|
/// <param name="ids">IDs</param>
|
||||
|
/// <returns>是否执行成功</returns>
|
||||
|
[HttpPost] |
||||
|
[Route("delete")] |
||||
|
// [Authorize(SettleAccountPermissions.SettleAccounts.Delete)]
|
||||
|
virtual public async Task<bool> DeleteListAsync(List<Guid> ids) |
||||
|
{ |
||||
|
foreach (var id in ids) |
||||
|
{ |
||||
|
var entity = await GetFromCacheAsync(id); |
||||
|
//await Cache.DeleteAsync<SettleAccount>(id.ToString());
|
||||
|
} |
||||
|
|
||||
|
return await _repository.DeleteListAsync(ids); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 版本列表查询
|
||||
|
/// </summary>
|
||||
|
/// <param name="input"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPost] |
||||
|
[Route("listversion")] |
||||
|
public async Task<PagedResultDto<WMSVWKanBanVersionDto>> GetVersionListAsync(WMSVWKanBanVersionRequestDto input) |
||||
|
{ |
||||
|
var entities = await _versionRepository.GetListByFilterAsync(input.BranchId, input.Filters, input.Sorting, int.MaxValue, |
||||
|
input.SkipCount, true); |
||||
|
|
||||
|
var totalCount = await GetCountAsync(input); |
||||
|
var dtos = ObjectMapper.Map<List<WMSKanBanVersion>, List<WMSVWKanBanVersionDto>>(entities); |
||||
|
|
||||
|
return new PagedResultDto<WMSVWKanBanVersionDto>(totalCount, dtos); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,326 @@ |
|||||
|
using EFCore.BulkExtensions; |
||||
|
using Magicodes.ExporterAndImporter.Core; |
||||
|
using Magicodes.ExporterAndImporter.Csv; |
||||
|
using Magicodes.ExporterAndImporter.Excel; |
||||
|
using Microsoft.AspNetCore.Authorization; |
||||
|
using Microsoft.AspNetCore.Http; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
using Volo.Abp.Caching; |
||||
|
using Volo.Abp.Domain.Repositories; |
||||
|
using Volo.Abp.Guids; |
||||
|
using Win.Abp.Snowflakes; |
||||
|
using Win.Sfs.BaseData.ImportExcelCommon; |
||||
|
using Win.Sfs.SettleAccount.CommonManagers; |
||||
|
using Win.Sfs.SettleAccount.Constant; |
||||
|
using Win.Sfs.SettleAccount.Entities.WMSSparePart; |
||||
|
using Win.Sfs.SettleAccount.ExcelImporter; |
||||
|
using Win.Sfs.SettleAccount.ExportReports; |
||||
|
using Win.Sfs.Shared.Filter; |
||||
|
using Shouldly; |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
namespace Win.Sfs.SettleAccount.Entities.WMS_SparePart |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 大众备件服务
|
||||
|
/// </summary>
|
||||
|
[Route("api/settleaccount/WMSSparePart")] |
||||
|
public class WMSSparePartAppService : SettleAccountApplicationBase<WMSSparePart>, IWMSSparePartAppService |
||||
|
{ |
||||
|
private readonly IGuidGenerator _guidGenerator; |
||||
|
|
||||
|
private readonly IExcelImportAppService _excelImportService; |
||||
|
|
||||
|
private readonly ISettleAccountBranchEfCoreRepository<WMSSparePartVersion, Guid> _versionRepository; |
||||
|
|
||||
|
private readonly ISettleAccountBranchEfCoreRepository<WMSSparePart, Guid> _repository; |
||||
|
/// <summary>
|
||||
|
/// 构建方法
|
||||
|
/// </summary>
|
||||
|
/// <param name="guidGenerator">构建UID</param>
|
||||
|
/// <param name="repository">仓储接口</param>
|
||||
|
/// <param name="cache">缓存</param>
|
||||
|
public WMSSparePartAppService(IGuidGenerator guidGenerator, |
||||
|
ISettleAccountBranchEfCoreRepository<WMSSparePartVersion, Guid> versionRepository, |
||||
|
ISettleAccountBranchEfCoreRepository<WMSSparePart, Guid> repository, |
||||
|
IDistributedCache<WMSSparePart> cache, |
||||
|
IExcelImportAppService excelImportService, |
||||
|
ISnowflakeIdGenerator snowflakeIdGenerator, |
||||
|
ICommonManager commonManager |
||||
|
) : base(cache, excelImportService, snowflakeIdGenerator, commonManager) |
||||
|
{ |
||||
|
_versionRepository = versionRepository; |
||||
|
_guidGenerator = guidGenerator; |
||||
|
_excelImportService = excelImportService; |
||||
|
_repository = repository; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 导入功能
|
||||
|
/// </summary>
|
||||
|
/// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPost] |
||||
|
[Route("ExcelImport")] |
||||
|
[DisableRequestSizeLimit] |
||||
|
//[Authorize(SettleAccountPermissions.SettleAccounts.Default)]
|
||||
|
public async Task<string> WMSSparePartUploadExcelImport([FromForm] IFormFileCollection files, Guid branchId, string year, string period, string version, string customerCode) |
||||
|
{ |
||||
|
if (string.IsNullOrEmpty(version)) |
||||
|
{ |
||||
|
throw new BusinessException("版本不能空,必须传入!"); |
||||
|
} |
||||
|
ExportImporter _exportImporter = new ExportImporter(); |
||||
|
var result = await _exportImporter.UploadExcelImport<WMSSparePartImportDto>(files, _excelImportService); |
||||
|
var entityList = ObjectMapper.Map<List<WMSSparePartImportDto>, List<WMSSparePart>>(result); |
||||
|
//删除版本
|
||||
|
var _versionQuery = _versionRepository.Where(p => p.Version == version); |
||||
|
await _versionQuery.BatchDeleteAsync(); |
||||
|
//删除明细
|
||||
|
var _query = _repository.Where(p => p.Version == version); |
||||
|
await _query.BatchDeleteAsync(); |
||||
|
//插入数据前检验
|
||||
|
var checkList = new List<ErrorExportDto>(); |
||||
|
var _group = entityList.GroupBy(x => new { x.LineNumber, x.MaterialCode, x.Version }).Select(p => new { Count = p.Count(), LineNumber = p.Key.LineNumber, MaterialCode = p.Key.MaterialCode }); |
||||
|
foreach (var itm in _group) |
||||
|
{ |
||||
|
if (string.IsNullOrEmpty(itm.MaterialCode)) |
||||
|
{ |
||||
|
checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("导入的行号为{0}的物料代码为空,请检查!", itm.LineNumber), string.Empty)); |
||||
|
} |
||||
|
} |
||||
|
var _id = GuidGenerator.Create(); |
||||
|
var _bomList = new List<WMSSparePartVersion>(); |
||||
|
_bomList.Add(new WMSSparePartVersion(_id, branchId, year, period, version, customerCode)); |
||||
|
foreach (var itm in entityList) |
||||
|
{ |
||||
|
itm.SetValue(GuidGenerator.Create(), branchId, year, period, version); |
||||
|
} |
||||
|
if (checkList.Count > 0) |
||||
|
{ |
||||
|
return await ExportErrorReportAsync(checkList); |
||||
|
} |
||||
|
await _repository.GetDbContext().BulkInsertAsync<WMSSparePart>(entityList); |
||||
|
await _versionRepository.GetDbContext().BulkInsertAsync(_bomList); |
||||
|
return ApplicationConsts.SuccessStr; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 按ID获取唯一实体
|
||||
|
/// </summary>
|
||||
|
/// <remarks>
|
||||
|
/// 返回实体全部属性
|
||||
|
/// </remarks>
|
||||
|
/// <param name="id">ID</param>
|
||||
|
/// <returns>实体DTO</returns>
|
||||
|
[HttpGet] |
||||
|
[Route("{id}")] |
||||
|
//[Authorize(SettleAccountPermissions.SettleAccounts.Default)]
|
||||
|
virtual public async Task<WMSSparePartDto> GetAsync(Guid id) |
||||
|
{ |
||||
|
var result = await GetFromCacheAsync(id); |
||||
|
var dto = ObjectMapper.Map<WMSSparePart, WMSSparePartDto>(result); |
||||
|
return dto; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
private async Task<WMSSparePart> GetFromCacheAsync(Guid id) |
||||
|
{ |
||||
|
var result = await _repository.GetAsync(id); |
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
private async Task<long> GetCountAsync(WMSSparePartRequestDto input) |
||||
|
{ |
||||
|
return await _repository.GetCountByFilterAsync(input.BranchId, input.Filters); |
||||
|
} |
||||
|
|
||||
|
private async Task<long> GetCountAsync(WMSSparePartVersionRequestDto input) |
||||
|
{ |
||||
|
return await _versionRepository.GetCountByFilterAsync(input.BranchId, input.Filters); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 导出文件
|
||||
|
/// </summary>
|
||||
|
/// <param name="input"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPost] |
||||
|
[Route("Export")] |
||||
|
//[Authorize(SettleAccountPermissions.SettleAccounts.Default)]
|
||||
|
virtual public async Task<string> ExportAsync(WMSSparePartRequestDto input) |
||||
|
{ |
||||
|
if (string.IsNullOrEmpty(input.Version)) |
||||
|
{ |
||||
|
throw new BusinessException("版本不能空,必须传入!"); |
||||
|
} |
||||
|
IExporter _csv = new CsvExporter(); |
||||
|
IExporter _excel = new ExcelExporter(); |
||||
|
if (!string.IsNullOrEmpty(input.Version)) |
||||
|
{ |
||||
|
input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "Version", Logic = EnumFilterLogic.And, Value = input.Version }); |
||||
|
} |
||||
|
var entities = await _repository.GetListByFilterAsync(input.BranchId, input.Filters, input.Sorting, int.MaxValue, |
||||
|
0, true); |
||||
|
|
||||
|
var dtoDetails = ObjectMapper.Map<List<WMSSparePart>, List<WMSSparePartExportDto>>(entities); |
||||
|
|
||||
|
string _fileName = string.Empty; |
||||
|
//声明导出容器
|
||||
|
|
||||
|
byte[] result = null; |
||||
|
switch (input.FileType) |
||||
|
{ |
||||
|
case 0: |
||||
|
_fileName = string.Format("大众备件发货明细_{0}.csv", input.UserId.ToString()); |
||||
|
result = await _csv.ExportAsByteArray(dtoDetails); |
||||
|
break; |
||||
|
case 1: |
||||
|
_fileName = string.Format("大众备件发货明细_{0}.xlsx", input.UserId.ToString()); |
||||
|
result = await _excel.ExportAsByteArray(dtoDetails); |
||||
|
break; |
||||
|
} |
||||
|
result.ShouldNotBeNull(); |
||||
|
|
||||
|
//保存导出文件到服务器存成二进制
|
||||
|
await _excelImportService.SaveBlobAsync( |
||||
|
new SaveExcelImportInputDto |
||||
|
{ |
||||
|
Name = _fileName, |
||||
|
Content = result |
||||
|
} |
||||
|
); |
||||
|
return _fileName; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 根据筛选条件获取实体列表
|
||||
|
/// </summary>
|
||||
|
/// <remarks>
|
||||
|
/// 请求条件包括:筛选条件列表,排序条件,数据数量,页码
|
||||
|
/// </remarks>
|
||||
|
/// <param name="input">请求条件</param>
|
||||
|
/// <returns>实体DTO列表</returns>
|
||||
|
[HttpPost] |
||||
|
[Route("list")] |
||||
|
//[Authorize(SettleAccountPermissions.SettleAccounts.Default)]
|
||||
|
virtual public async Task<PagedResultDto<WMSSparePartDto>> GetListAsync(WMSSparePartRequestDto input) |
||||
|
{ |
||||
|
if (!string.IsNullOrEmpty(input.Version)) |
||||
|
{ |
||||
|
input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "Version", Logic = EnumFilterLogic.And, Value = input.Version }); |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
return new PagedResultDto<WMSSparePartDto>(0, new List<WMSSparePartDto>()); |
||||
|
} |
||||
|
|
||||
|
var entities = await _repository.GetListByFilterAsync(input.BranchId, input.Filters, input.Sorting, input.MaxResultCount, |
||||
|
input.SkipCount, true); |
||||
|
|
||||
|
var totalCount = await GetCountAsync(input); |
||||
|
var dtos = ObjectMapper.Map<List<WMSSparePart>, List<WMSSparePartDto>>(entities); |
||||
|
|
||||
|
return new PagedResultDto<WMSSparePartDto>(totalCount, dtos); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 获取实体总数
|
||||
|
/// </summary>
|
||||
|
/// <returns>实体总数</returns>
|
||||
|
[HttpGet] |
||||
|
[Route("count")] |
||||
|
[Authorize(SettleAccountPermissions.SettleAccounts.Default)] |
||||
|
virtual public async Task<long> GetTotalCountAsync(Guid branchId) |
||||
|
{ |
||||
|
return await _repository.GetCountAsync(branchId); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 获取全部实体列表
|
||||
|
/// </summary>
|
||||
|
/// <returns>实体DTO列表</returns>
|
||||
|
[HttpGet] |
||||
|
[Route("all")] |
||||
|
//[Authorize(SettleAccountPermissions.SettleAccounts.Default)]
|
||||
|
virtual public async Task<ListResultDto<WMSSparePartDto>> GetAllAsync(Guid branchId) |
||||
|
{ |
||||
|
var entities = await _repository.GetAllAsync(branchId, true); |
||||
|
|
||||
|
|
||||
|
var dtos = ObjectMapper.Map<List<WMSSparePart>, List<WMSSparePartDto>>(entities); |
||||
|
|
||||
|
|
||||
|
return new ListResultDto<WMSSparePartDto>(dtos); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 删除实体
|
||||
|
/// </summary>
|
||||
|
/// <param name="id">ID</param>
|
||||
|
/// <returns>无</returns>
|
||||
|
[HttpDelete] |
||||
|
[Route("{id}")] |
||||
|
/// [Authorize(SettleAccountPermissions.SettleAccounts.Delete)]
|
||||
|
virtual public async Task DeleteAsync(Guid id) |
||||
|
{ |
||||
|
await _repository.DeleteAsync(id); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 按IDs删除实体列表
|
||||
|
/// </summary>
|
||||
|
/// <param name="ids">IDs</param>
|
||||
|
/// <returns>是否执行成功</returns>
|
||||
|
[HttpPost] |
||||
|
[Route("delete")] |
||||
|
// [Authorize(SettleAccountPermissions.SettleAccounts.Delete)]
|
||||
|
virtual public async Task<bool> DeleteListAsync(List<Guid> ids) |
||||
|
{ |
||||
|
foreach (var id in ids) |
||||
|
{ |
||||
|
var entity = await GetFromCacheAsync(id); |
||||
|
//await Cache.DeleteAsync<SettleAccount>(id.ToString());
|
||||
|
} |
||||
|
|
||||
|
return await _repository.DeleteListAsync(ids); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 版本列表查询
|
||||
|
/// </summary>
|
||||
|
/// <param name="input"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPost] |
||||
|
[Route("listversion")] |
||||
|
public async Task<PagedResultDto<WMSSparePartVersionDto>> GetVersionListAsync(WMSSparePartVersionRequestDto input) |
||||
|
{ |
||||
|
var entities = await _versionRepository.GetListByFilterAsync(input.BranchId, input.Filters, input.Sorting, int.MaxValue, |
||||
|
input.SkipCount, true); |
||||
|
|
||||
|
var totalCount = await GetCountAsync(input); |
||||
|
var dtos = ObjectMapper.Map<List<WMSSparePartVersion>, List<WMSSparePartVersionDto>>(entities); |
||||
|
|
||||
|
return new PagedResultDto<WMSSparePartVersionDto>(totalCount, dtos); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,347 @@ |
|||||
|
<!--M100上线信息-明细数据--> |
||||
|
<template> |
||||
|
<div class="cr-body-content"> |
||||
|
<!--表格渲染--> |
||||
|
<el-table |
||||
|
ref="multipleTable" |
||||
|
v-loading="listLoading" |
||||
|
element-loading-text="拼命加载中..." |
||||
|
element-loading-spinner="el-icon-loading" |
||||
|
class="cr-table" |
||||
|
:data="list" |
||||
|
:height="tableHeight" |
||||
|
:cell-style="cellStyle" |
||||
|
:header-cell-style="headerRowStyle" |
||||
|
size="small" |
||||
|
stripe |
||||
|
border |
||||
|
highlight-current-row |
||||
|
style="width: 100%" |
||||
|
@sort-change="sortChange" |
||||
|
@selection-change="handleSelectionChange" |
||||
|
@row-click="handleRowClick" |
||||
|
:row-key="getRowKeys" |
||||
|
:expand-row-keys="expands" |
||||
|
@expand-change="exChange" |
||||
|
> |
||||
|
<!-- <el-table-column type="selection" width="44px"></el-table-column> --> |
||||
|
<!-- <el-table-column |
||||
|
prop="总成名称" |
||||
|
label="erpAssemblyName" |
||||
|
sortable |
||||
|
width="180" |
||||
|
> |
||||
|
</el-table-column> |
||||
|
<el-table-column |
||||
|
prop="erpAssemblyVersion" |
||||
|
label="总成版本号" |
||||
|
sortable |
||||
|
width="180" |
||||
|
> |
||||
|
style="width: calc(100% - 47px)" |
||||
|
class="two-list" |
||||
|
</el-table-column> --> |
||||
|
|
||||
|
<el-table-column type="expand" prop="details"> |
||||
|
<template slot-scope="scope"> |
||||
|
<el-table :data="scope.row.details"> |
||||
|
<el-table-column |
||||
|
prop="partCode" |
||||
|
label="客户零件代码" |
||||
|
></el-table-column> |
||||
|
<el-table-column |
||||
|
prop="partNum" |
||||
|
label="客户零件数量" |
||||
|
></el-table-column> |
||||
|
<el-table-column prop="description" label="描述"></el-table-column> |
||||
|
<el-table-column prop="isKey" label="是否Key件"> |
||||
|
<template slot-scope="scope"> |
||||
|
<span v-if="scope.row.isKey == true"> |
||||
|
<span style="color: #00b46d">是</span> |
||||
|
</span> |
||||
|
<span v-else> |
||||
|
<span style="color: #d75c89">否</span> |
||||
|
</span> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
</el-table> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
<el-table-column |
||||
|
v-for="(item, index) in getDefaultField" |
||||
|
:key="index" |
||||
|
:prop="item.prop" |
||||
|
:label="item.label" |
||||
|
:min-width="item.width" |
||||
|
:formatter="fieldFormatter" |
||||
|
sortable="custom" |
||||
|
show-overflow-tooltip |
||||
|
:gutter="0" |
||||
|
> |
||||
|
<template slot="header" slot-scope="scope"> |
||||
|
{{ scope.column.label }} |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
<el-table-column |
||||
|
prop="erpAssemblyVersion" |
||||
|
label="总成版本号" |
||||
|
sortable |
||||
|
width="360" |
||||
|
> |
||||
|
</el-table-column> |
||||
|
</el-table> |
||||
|
<div class="table-footer"> |
||||
|
<!-- 分页控件 style="margin-top: -25px;margin-bottom:-25px;float:right;"--> |
||||
|
<pagination |
||||
|
v-show="totalCount > 0" |
||||
|
:total="totalCount" |
||||
|
:page.sync="page" |
||||
|
:limit.sync="listQuery.MaxResultCount" |
||||
|
@pagination="getList" |
||||
|
/> |
||||
|
</div> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination |
||||
|
import permission from "@/directive/permission/index.js"; |
||||
|
import CRMTableHead from "../../components/CRMTableHead"; |
||||
|
import { downloadFile } from "@/utils/crmindex.js"; |
||||
|
import Detail from "./detail"; |
||||
|
|
||||
|
export default { |
||||
|
name: "sendUnsettledDiffReport", |
||||
|
components: { Pagination, CRMTableHead, Detail }, |
||||
|
directives: { permission }, |
||||
|
filters: { |
||||
|
IsCustomerSignFilter(status) { |
||||
|
//翻译是否签字 |
||||
|
const statusMap = { |
||||
|
true: "是", |
||||
|
false: "否", |
||||
|
}; |
||||
|
return statusMap[status]; |
||||
|
}, |
||||
|
}, |
||||
|
props: { |
||||
|
customerInfos: { |
||||
|
type: Array, |
||||
|
default: () => { |
||||
|
return []; |
||||
|
}, |
||||
|
}, |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
crmType: "stockFisDiffReport", |
||||
|
rules: { |
||||
|
//前端定义的规则,后端也有验证 |
||||
|
erpMaterialCode: [ |
||||
|
{ required: true, message: "必须输入!", trigger: "blur" }, |
||||
|
], |
||||
|
}, |
||||
|
expands: [], //只展开一行放入当前行id |
||||
|
getRowKeys: (row) => { |
||||
|
return row.id; //这里看这一行中需要根据哪个属性值是id |
||||
|
}, |
||||
|
searchContent: "", // 输入内容 |
||||
|
customerInfo: { |
||||
|
parentId: "", |
||||
|
}, |
||||
|
form: { |
||||
|
dicDetailID: "", |
||||
|
customerId: "", |
||||
|
projectId: "", |
||||
|
}, |
||||
|
list: null, |
||||
|
totalCount: 0, |
||||
|
listLoading: true, |
||||
|
formLoading: false, |
||||
|
// 高级搜索 |
||||
|
filterObj: { |
||||
|
type: Object, |
||||
|
default: () => { |
||||
|
return {}; |
||||
|
}, |
||||
|
}, |
||||
|
listQuery: { |
||||
|
Filters: [ |
||||
|
{ |
||||
|
logic: 0, |
||||
|
column: "Enabled", |
||||
|
action: 0, |
||||
|
value: "true", |
||||
|
}, //默认查询可用的 |
||||
|
], |
||||
|
SkipCount: 0, |
||||
|
MaxResultCount: 15, |
||||
|
id: "", |
||||
|
}, |
||||
|
page: 1, |
||||
|
dialogFormVisible: false, |
||||
|
multipleSelection: [], |
||||
|
formTitle: "", |
||||
|
drawer: false, |
||||
|
showExcelImport: false, |
||||
|
tableHeight: document.documentElement.clientHeight - 260, |
||||
|
isEdit: false, |
||||
|
}; |
||||
|
}, |
||||
|
mounted() { |
||||
|
var self = this; |
||||
|
window.onresize = function () { |
||||
|
var offsetHei = document.documentElement.clientHeight; |
||||
|
self.tableHeight = offsetHei - 190; |
||||
|
}; |
||||
|
}, |
||||
|
created() { |
||||
|
this.getList(); |
||||
|
}, |
||||
|
watch: { |
||||
|
customerInfos: { |
||||
|
handler(newVal) { |
||||
|
if (newVal == "" || newVal == "undefined") { |
||||
|
//TODO |
||||
|
} else { |
||||
|
newVal.forEach((element) => { |
||||
|
this.customerInfo.parentId = element.ParentId; |
||||
|
}); |
||||
|
if (this.customerInfo.parentId != "") { |
||||
|
this.getList(); |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
immediate: true, |
||||
|
}, |
||||
|
}, |
||||
|
computed: { |
||||
|
/** 列表字段 */ |
||||
|
getDefaultField() { |
||||
|
var tempsTabs = []; |
||||
|
tempsTabs.push({ |
||||
|
label: "总成名称", |
||||
|
prop: "erpAssemblyName", |
||||
|
width: 160, |
||||
|
}); |
||||
|
// tempsTabs.push({ |
||||
|
// label: "总成版本号", |
||||
|
// prop: "erpAssemblyName", |
||||
|
// width: 160, |
||||
|
// }); |
||||
|
return tempsTabs; |
||||
|
}, |
||||
|
}, |
||||
|
methods: { |
||||
|
exChange(row, rowList) { |
||||
|
this.loading = true; |
||||
|
|
||||
|
var that = this; |
||||
|
if (rowList.length) { |
||||
|
that.expands = []; |
||||
|
if (row) { |
||||
|
that.expands.push(row.id); // 只展开当前行id |
||||
|
} |
||||
|
} else { |
||||
|
that.expands = []; |
||||
|
} |
||||
|
}, |
||||
|
/** 刷新列表 */ |
||||
|
handleHandle(data) { |
||||
|
if (data.type !== "edit") { |
||||
|
this.getList(); |
||||
|
} |
||||
|
}, |
||||
|
/** 格式化字段 */ |
||||
|
fieldFormatter(row, column) { |
||||
|
return row[column.property] || "--"; |
||||
|
}, |
||||
|
importExcelData() { |
||||
|
//关闭导入窗体时调用 |
||||
|
this.showExcelImport = false; |
||||
|
this.getList(); |
||||
|
}, |
||||
|
getList() { |
||||
|
this.listLoading = true; |
||||
|
console.log("详表条件:" + JSON.stringify(this.customerInfo.parentId)); |
||||
|
this.$axios |
||||
|
.gets("/api/newjit/bill-m100/"+ this.customerInfo.parentId) |
||||
|
.then((response) => { |
||||
|
this.list = response; |
||||
|
setTimeout(() => { |
||||
|
//大数据量加载时 |
||||
|
this.listLoading = false; |
||||
|
}, 500); |
||||
|
}) |
||||
|
.catch(() => { |
||||
|
this.listLoading = false; |
||||
|
}); |
||||
|
}, |
||||
|
/** 筛选操作 */ |
||||
|
handleFilter() { |
||||
|
this.page = 1; |
||||
|
this.getList(); |
||||
|
this.listQuery.Filters = []; |
||||
|
if (this.searchContent != "") { |
||||
|
var column = "partCode"; |
||||
|
let filter = { |
||||
|
logic: 0, |
||||
|
column: column, |
||||
|
action: 6, |
||||
|
value: this.searchContent, |
||||
|
}; |
||||
|
this.listQuery.Filters.push(filter); |
||||
|
} |
||||
|
this.getList(); |
||||
|
}, |
||||
|
resetQuery() {}, |
||||
|
|
||||
|
sortChange(data) { |
||||
|
const { prop, order } = data; |
||||
|
if (!prop || !order) { |
||||
|
this.handleFilter(); |
||||
|
return; |
||||
|
} |
||||
|
this.listQuery.Sorting = prop + " " + order; |
||||
|
this.handleFilter(); |
||||
|
}, |
||||
|
handleSelectionChange(val) { |
||||
|
this.multipleSelection = val; |
||||
|
}, |
||||
|
/** 通过回调控制style */ |
||||
|
cellStyle({ row, column, rowIndex, columnIndex }) { |
||||
|
if ( |
||||
|
column.property === "fisQty" || |
||||
|
column.property === "diffQty" || |
||||
|
column.property === "stockQty" |
||||
|
) { |
||||
|
return { textAlign: "right" }; |
||||
|
} else { |
||||
|
return { textAlign: "left" }; |
||||
|
} |
||||
|
}, |
||||
|
/** 通过回调控制表头style */ |
||||
|
headerRowStyle({ row, column, rowIndex, columnIndex }) { |
||||
|
if ( |
||||
|
column.property === "fisQty" || |
||||
|
column.property === "diffQty" || |
||||
|
column.property === "stockQty" |
||||
|
) { |
||||
|
return { textAlign: "right", background: "#FAFAFA" }; |
||||
|
} else { |
||||
|
return { textAlign: "left", background: "#FAFAFA" }; |
||||
|
} |
||||
|
}, |
||||
|
handleRowClick(row, column, event) { |
||||
|
this.$refs.multipleTable.clearSelection(); |
||||
|
this.$refs.multipleTable.toggleRowSelection(row); |
||||
|
}, |
||||
|
}, |
||||
|
}; |
||||
|
</script> |
||||
|
|
||||
|
|
||||
|
<style lang="scss" scoped> |
||||
|
@import "../../../ux/styles/crmtable.scss"; |
||||
|
</style> |
||||
|
|
@ -0,0 +1,354 @@ |
|||||
|
<!--M100上线信息-明细数据--> |
||||
|
<template> |
||||
|
<div class="cr-body-content"> |
||||
|
<!--表格渲染--> |
||||
|
<el-table |
||||
|
ref="multipleTable" |
||||
|
v-loading="listLoading" |
||||
|
element-loading-text="拼命加载中..." |
||||
|
element-loading-spinner="el-icon-loading" |
||||
|
class="cr-table" |
||||
|
:data="list" |
||||
|
:height="tableHeight" |
||||
|
:cell-style="cellStyle" |
||||
|
:header-cell-style="headerRowStyle" |
||||
|
size="small" |
||||
|
stripe |
||||
|
border |
||||
|
highlight-current-row |
||||
|
style="width: 100%" |
||||
|
@sort-change="sortChange" |
||||
|
@selection-change="handleSelectionChange" |
||||
|
@row-click="handleRowClick" |
||||
|
:row-key="getRowKeys" |
||||
|
:expand-row-keys="expands" |
||||
|
@expand-change="exChange" |
||||
|
> |
||||
|
<!-- <el-table-column type="selection" width="44px"></el-table-column> --> |
||||
|
<!-- <el-table-column |
||||
|
prop="总成名称" |
||||
|
label="erpAssemblyName" |
||||
|
sortable |
||||
|
width="180" |
||||
|
> |
||||
|
</el-table-column> |
||||
|
<el-table-column |
||||
|
prop="erpAssemblyVersion" |
||||
|
label="总成版本号" |
||||
|
sortable |
||||
|
width="180" |
||||
|
> |
||||
|
style="width: calc(100% - 47px)" |
||||
|
class="two-list" |
||||
|
</el-table-column> --> |
||||
|
|
||||
|
<el-table-column type="expand" prop="details"> |
||||
|
<template slot-scope="scope"> |
||||
|
<el-table :data="scope.row.details"> |
||||
|
<el-table-column |
||||
|
prop="partCode" |
||||
|
label="客户零件代码" |
||||
|
></el-table-column> |
||||
|
<el-table-column |
||||
|
prop="partNum" |
||||
|
label="客户零件数量" |
||||
|
></el-table-column> |
||||
|
<el-table-column prop="description" label="描述"></el-table-column> |
||||
|
<el-table-column prop="isKey" label="是否Key件"> |
||||
|
<template slot-scope="scope"> |
||||
|
<span v-if="scope.row.isKey == true"> |
||||
|
<span style="color: #00b46d">是</span> |
||||
|
</span> |
||||
|
<span v-else> |
||||
|
<span style="color: #d75c89">否</span> |
||||
|
</span> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
</el-table> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
<el-table-column |
||||
|
v-for="(item, index) in getDefaultField" |
||||
|
:key="index" |
||||
|
:prop="item.prop" |
||||
|
:label="item.label" |
||||
|
:min-width="item.width" |
||||
|
:formatter="fieldFormatter" |
||||
|
sortable="custom" |
||||
|
show-overflow-tooltip |
||||
|
:gutter="0" |
||||
|
> |
||||
|
<template slot="header" slot-scope="scope"> |
||||
|
{{ scope.column.label }} |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
<el-table-column |
||||
|
prop="erpAssemblyVersion" |
||||
|
label="总成版本号" |
||||
|
sortable |
||||
|
width="360" |
||||
|
> |
||||
|
</el-table-column> |
||||
|
</el-table> |
||||
|
<div class="table-footer"> |
||||
|
<!-- 分页控件 style="margin-top: -25px;margin-bottom:-25px;float:right;"--> |
||||
|
<pagination |
||||
|
v-show="totalCount > 0" |
||||
|
:total="totalCount" |
||||
|
:page.sync="page" |
||||
|
:limit.sync="listQuery.MaxResultCount" |
||||
|
@pagination="getList" |
||||
|
/> |
||||
|
</div> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination |
||||
|
import permission from "@/directive/permission/index.js"; |
||||
|
import CRMTableHead from "../../components/CRMTableHead"; |
||||
|
import { downloadFile } from "@/utils/crmindex.js"; |
||||
|
import Detail from "./detail"; |
||||
|
|
||||
|
export default { |
||||
|
name: "sendUnsettledDiffReport", |
||||
|
components: { Pagination, CRMTableHead, Detail }, |
||||
|
directives: { permission }, |
||||
|
filters: { |
||||
|
IsCustomerSignFilter(status) { |
||||
|
//翻译是否签字 |
||||
|
const statusMap = { |
||||
|
true: "是", |
||||
|
false: "否", |
||||
|
}; |
||||
|
return statusMap[status]; |
||||
|
}, |
||||
|
}, |
||||
|
props: { |
||||
|
customerInfos: { |
||||
|
type: Array, |
||||
|
default: () => { |
||||
|
return []; |
||||
|
}, |
||||
|
}, |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
crmType: "stockFisDiffReport", |
||||
|
rules: { |
||||
|
//前端定义的规则,后端也有验证 |
||||
|
erpMaterialCode: [ |
||||
|
{ required: true, message: "必须输入!", trigger: "blur" }, |
||||
|
], |
||||
|
}, |
||||
|
expands: [], //只展开一行放入当前行id |
||||
|
getRowKeys: (row) => { |
||||
|
return row.id; //这里看这一行中需要根据哪个属性值是id |
||||
|
}, |
||||
|
searchContent: "", // 输入内容 |
||||
|
customerInfo: { |
||||
|
parentId: "", |
||||
|
}, |
||||
|
form: { |
||||
|
dicDetailID: "", |
||||
|
customerId: "", |
||||
|
projectId: "", |
||||
|
}, |
||||
|
list: null, |
||||
|
totalCount: 0, |
||||
|
listLoading: true, |
||||
|
formLoading: false, |
||||
|
// 高级搜索 |
||||
|
filterObj: { |
||||
|
type: Object, |
||||
|
default: () => { |
||||
|
return {}; |
||||
|
}, |
||||
|
}, |
||||
|
listQuery: { |
||||
|
Filters: [ |
||||
|
{ |
||||
|
logic: 0, |
||||
|
column: "Enabled", |
||||
|
action: 0, |
||||
|
value: "true", |
||||
|
}, //默认查询可用的 |
||||
|
], |
||||
|
SkipCount: 0, |
||||
|
MaxResultCount: 15, |
||||
|
id: "", |
||||
|
}, |
||||
|
page: 1, |
||||
|
dialogFormVisible: false, |
||||
|
multipleSelection: [], |
||||
|
formTitle: "", |
||||
|
drawer: false, |
||||
|
showExcelImport: false, |
||||
|
tableHeight: document.documentElement.clientHeight - 260, |
||||
|
isEdit: false, |
||||
|
}; |
||||
|
}, |
||||
|
mounted() { |
||||
|
var self = this; |
||||
|
window.onresize = function () { |
||||
|
var offsetHei = document.documentElement.clientHeight; |
||||
|
self.tableHeight = offsetHei - 190; |
||||
|
}; |
||||
|
}, |
||||
|
created() { |
||||
|
this.getList(); |
||||
|
}, |
||||
|
watch: { |
||||
|
customerInfos: { |
||||
|
handler(newVal) { |
||||
|
if (newVal == "" || newVal == "undefined") { |
||||
|
//TODO |
||||
|
} else { |
||||
|
newVal.forEach((element) => { |
||||
|
this.customerInfo.parentId = element.ParentId; |
||||
|
}); |
||||
|
if (this.customerInfo.parentId != "") { |
||||
|
this.getList(); |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
immediate: true, |
||||
|
}, |
||||
|
}, |
||||
|
computed: { |
||||
|
/** 列表字段 */ |
||||
|
getDefaultField() { |
||||
|
var tempsTabs = []; |
||||
|
tempsTabs.push({ |
||||
|
label: "总成编号", |
||||
|
prop: "erpAssemblyCode", |
||||
|
width: 160, |
||||
|
}); |
||||
|
tempsTabs.push({ |
||||
|
label: "总成名称", |
||||
|
prop: "erpAssemblyName", |
||||
|
width: 160, |
||||
|
}); |
||||
|
// tempsTabs.push({ |
||||
|
// label: "总成版本号", |
||||
|
// prop: "erpAssemblyName", |
||||
|
// width: 160, |
||||
|
// }); |
||||
|
return tempsTabs; |
||||
|
}, |
||||
|
}, |
||||
|
methods: { |
||||
|
exChange(row, rowList) { |
||||
|
this.loading = true; |
||||
|
|
||||
|
var that = this; |
||||
|
if (rowList.length) { |
||||
|
that.expands = []; |
||||
|
if (row) { |
||||
|
that.expands.push(row.id); // 只展开当前行id |
||||
|
} |
||||
|
} else { |
||||
|
that.expands = []; |
||||
|
} |
||||
|
}, |
||||
|
/** 刷新列表 */ |
||||
|
handleHandle(data) { |
||||
|
if (data.type !== "edit") { |
||||
|
this.getList(); |
||||
|
} |
||||
|
}, |
||||
|
/** 格式化字段 */ |
||||
|
fieldFormatter(row, column) { |
||||
|
return row[column.property] || "--"; |
||||
|
}, |
||||
|
importExcelData() { |
||||
|
//关闭导入窗体时调用 |
||||
|
this.showExcelImport = false; |
||||
|
this.getList(); |
||||
|
}, |
||||
|
getList() { |
||||
|
this.listLoading = true; |
||||
|
console.log("详表条件:" + JSON.stringify(this.customerInfo.parentId)); |
||||
|
//alert("详表条件:" + JSON.stringify(this.customerInfo.parentId)); |
||||
|
let vehicleAssemblyId = { vehicleAssemblyId: this.customerInfo.parentId }; |
||||
|
this.$axios |
||||
|
.gets("/api/newjit/assembly-cfg-vehicle/list", vehicleAssemblyId) |
||||
|
.then((response) => { |
||||
|
this.list = response; |
||||
|
setTimeout(() => { |
||||
|
//大数据量加载时 |
||||
|
this.listLoading = false; |
||||
|
}, 500); |
||||
|
}) |
||||
|
.catch(() => { |
||||
|
this.listLoading = false; |
||||
|
}); |
||||
|
}, |
||||
|
/** 筛选操作 */ |
||||
|
handleFilter() { |
||||
|
this.page = 1; |
||||
|
this.getList(); |
||||
|
this.listQuery.Filters = []; |
||||
|
if (this.searchContent != "") { |
||||
|
var column = "partCode"; |
||||
|
let filter = { |
||||
|
logic: 0, |
||||
|
column: column, |
||||
|
action: 6, |
||||
|
value: this.searchContent, |
||||
|
}; |
||||
|
this.listQuery.Filters.push(filter); |
||||
|
} |
||||
|
this.getList(); |
||||
|
}, |
||||
|
resetQuery() {}, |
||||
|
|
||||
|
sortChange(data) { |
||||
|
const { prop, order } = data; |
||||
|
if (!prop || !order) { |
||||
|
this.handleFilter(); |
||||
|
return; |
||||
|
} |
||||
|
this.listQuery.Sorting = prop + " " + order; |
||||
|
this.handleFilter(); |
||||
|
}, |
||||
|
handleSelectionChange(val) { |
||||
|
this.multipleSelection = val; |
||||
|
}, |
||||
|
/** 通过回调控制style */ |
||||
|
cellStyle({ row, column, rowIndex, columnIndex }) { |
||||
|
if ( |
||||
|
column.property === "fisQty" || |
||||
|
column.property === "diffQty" || |
||||
|
column.property === "stockQty" |
||||
|
) { |
||||
|
return { textAlign: "right" }; |
||||
|
} else { |
||||
|
return { textAlign: "left" }; |
||||
|
} |
||||
|
}, |
||||
|
/** 通过回调控制表头style */ |
||||
|
headerRowStyle({ row, column, rowIndex, columnIndex }) { |
||||
|
if ( |
||||
|
column.property === "fisQty" || |
||||
|
column.property === "diffQty" || |
||||
|
column.property === "stockQty" |
||||
|
) { |
||||
|
return { textAlign: "right", background: "#FAFAFA" }; |
||||
|
} else { |
||||
|
return { textAlign: "left", background: "#FAFAFA" }; |
||||
|
} |
||||
|
}, |
||||
|
handleRowClick(row, column, event) { |
||||
|
this.$refs.multipleTable.clearSelection(); |
||||
|
this.$refs.multipleTable.toggleRowSelection(row); |
||||
|
}, |
||||
|
}, |
||||
|
}; |
||||
|
</script> |
||||
|
|
||||
|
|
||||
|
<style lang="scss" scoped> |
||||
|
@import "../../../ux/styles/crmtable.scss"; |
||||
|
</style> |
||||
|
|
@ -0,0 +1,354 @@ |
|||||
|
<!--M100上线信息-明细数据--> |
||||
|
<template> |
||||
|
<div class="cr-body-content"> |
||||
|
<!--表格渲染--> |
||||
|
<el-table |
||||
|
ref="multipleTable" |
||||
|
v-loading="listLoading" |
||||
|
element-loading-text="拼命加载中..." |
||||
|
element-loading-spinner="el-icon-loading" |
||||
|
class="cr-table" |
||||
|
:data="list" |
||||
|
:height="tableHeight" |
||||
|
:cell-style="cellStyle" |
||||
|
:header-cell-style="headerRowStyle" |
||||
|
size="small" |
||||
|
stripe |
||||
|
border |
||||
|
highlight-current-row |
||||
|
style="width: 100%" |
||||
|
@sort-change="sortChange" |
||||
|
@selection-change="handleSelectionChange" |
||||
|
@row-click="handleRowClick" |
||||
|
:row-key="getRowKeys" |
||||
|
:expand-row-keys="expands" |
||||
|
@expand-change="exChange" |
||||
|
> |
||||
|
<!-- <el-table-column type="selection" width="44px"></el-table-column> --> |
||||
|
<!-- <el-table-column |
||||
|
prop="总成名称" |
||||
|
label="erpAssemblyName" |
||||
|
sortable |
||||
|
width="180" |
||||
|
> |
||||
|
</el-table-column> |
||||
|
<el-table-column |
||||
|
prop="erpAssemblyVersion" |
||||
|
label="总成版本号" |
||||
|
sortable |
||||
|
width="180" |
||||
|
> |
||||
|
style="width: calc(100% - 47px)" |
||||
|
class="two-list" |
||||
|
</el-table-column> --> |
||||
|
|
||||
|
<el-table-column type="expand" prop="details"> |
||||
|
<template slot-scope="scope"> |
||||
|
<el-table :data="scope.row.details"> |
||||
|
<el-table-column |
||||
|
prop="partCode" |
||||
|
label="客户零件代码" |
||||
|
></el-table-column> |
||||
|
<el-table-column |
||||
|
prop="partNum" |
||||
|
label="客户零件数量" |
||||
|
></el-table-column> |
||||
|
<el-table-column prop="description" label="描述"></el-table-column> |
||||
|
<el-table-column prop="isKey" label="是否Key件"> |
||||
|
<template slot-scope="scope"> |
||||
|
<span v-if="scope.row.isKey == true"> |
||||
|
<span style="color: #00b46d">是</span> |
||||
|
</span> |
||||
|
<span v-else> |
||||
|
<span style="color: #d75c89">否</span> |
||||
|
</span> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
</el-table> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
<el-table-column |
||||
|
v-for="(item, index) in getDefaultField" |
||||
|
:key="index" |
||||
|
:prop="item.prop" |
||||
|
:label="item.label" |
||||
|
:min-width="item.width" |
||||
|
:formatter="fieldFormatter" |
||||
|
sortable="custom" |
||||
|
show-overflow-tooltip |
||||
|
:gutter="0" |
||||
|
> |
||||
|
<template slot="header" slot-scope="scope"> |
||||
|
{{ scope.column.label }} |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
<el-table-column |
||||
|
prop="erpAssemblyVersion" |
||||
|
label="总成版本号" |
||||
|
sortable |
||||
|
width="360" |
||||
|
> |
||||
|
</el-table-column> |
||||
|
</el-table> |
||||
|
<div class="table-footer"> |
||||
|
<!-- 分页控件 style="margin-top: -25px;margin-bottom:-25px;float:right;"--> |
||||
|
<pagination |
||||
|
v-show="totalCount > 0" |
||||
|
:total="totalCount" |
||||
|
:page.sync="page" |
||||
|
:limit.sync="listQuery.MaxResultCount" |
||||
|
@pagination="getList" |
||||
|
/> |
||||
|
</div> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination |
||||
|
import permission from "@/directive/permission/index.js"; |
||||
|
import CRMTableHead from "../../components/CRMTableHead"; |
||||
|
import { downloadFile } from "@/utils/crmindex.js"; |
||||
|
import Detail from "./detail"; |
||||
|
|
||||
|
export default { |
||||
|
name: "sendUnsettledDiffReport", |
||||
|
components: { Pagination, CRMTableHead, Detail }, |
||||
|
directives: { permission }, |
||||
|
filters: { |
||||
|
IsCustomerSignFilter(status) { |
||||
|
//翻译是否签字 |
||||
|
const statusMap = { |
||||
|
true: "是", |
||||
|
false: "否", |
||||
|
}; |
||||
|
return statusMap[status]; |
||||
|
}, |
||||
|
}, |
||||
|
props: { |
||||
|
customerInfos: { |
||||
|
type: Array, |
||||
|
default: () => { |
||||
|
return []; |
||||
|
}, |
||||
|
}, |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
crmType: "stockFisDiffReport", |
||||
|
rules: { |
||||
|
//前端定义的规则,后端也有验证 |
||||
|
erpMaterialCode: [ |
||||
|
{ required: true, message: "必须输入!", trigger: "blur" }, |
||||
|
], |
||||
|
}, |
||||
|
expands: [], //只展开一行放入当前行id |
||||
|
getRowKeys: (row) => { |
||||
|
return row.id; //这里看这一行中需要根据哪个属性值是id |
||||
|
}, |
||||
|
searchContent: "", // 输入内容 |
||||
|
customerInfo: { |
||||
|
parentId: "", |
||||
|
}, |
||||
|
form: { |
||||
|
dicDetailID: "", |
||||
|
customerId: "", |
||||
|
projectId: "", |
||||
|
}, |
||||
|
list: null, |
||||
|
totalCount: 0, |
||||
|
listLoading: true, |
||||
|
formLoading: false, |
||||
|
// 高级搜索 |
||||
|
filterObj: { |
||||
|
type: Object, |
||||
|
default: () => { |
||||
|
return {}; |
||||
|
}, |
||||
|
}, |
||||
|
listQuery: { |
||||
|
Filters: [ |
||||
|
{ |
||||
|
logic: 0, |
||||
|
column: "Enabled", |
||||
|
action: 0, |
||||
|
value: "true", |
||||
|
}, //默认查询可用的 |
||||
|
], |
||||
|
SkipCount: 0, |
||||
|
MaxResultCount: 15, |
||||
|
id: "", |
||||
|
}, |
||||
|
page: 1, |
||||
|
dialogFormVisible: false, |
||||
|
multipleSelection: [], |
||||
|
formTitle: "", |
||||
|
drawer: false, |
||||
|
showExcelImport: false, |
||||
|
tableHeight: document.documentElement.clientHeight - 260, |
||||
|
isEdit: false, |
||||
|
}; |
||||
|
}, |
||||
|
mounted() { |
||||
|
var self = this; |
||||
|
window.onresize = function () { |
||||
|
var offsetHei = document.documentElement.clientHeight; |
||||
|
self.tableHeight = offsetHei - 190; |
||||
|
}; |
||||
|
}, |
||||
|
created() { |
||||
|
this.getList(); |
||||
|
}, |
||||
|
watch: { |
||||
|
customerInfos: { |
||||
|
handler(newVal) { |
||||
|
if (newVal == "" || newVal == "undefined") { |
||||
|
//TODO |
||||
|
} else { |
||||
|
newVal.forEach((element) => { |
||||
|
this.customerInfo.parentId = element.ParentId; |
||||
|
}); |
||||
|
if (this.customerInfo.parentId != "") { |
||||
|
this.getList(); |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
immediate: true, |
||||
|
}, |
||||
|
}, |
||||
|
computed: { |
||||
|
/** 列表字段 */ |
||||
|
getDefaultField() { |
||||
|
var tempsTabs = []; |
||||
|
tempsTabs.push({ |
||||
|
label: "总成编号", |
||||
|
prop: "erpAssemblyCode", |
||||
|
width: 160, |
||||
|
}); |
||||
|
tempsTabs.push({ |
||||
|
label: "总成名称", |
||||
|
prop: "erpAssemblyName", |
||||
|
width: 160, |
||||
|
}); |
||||
|
// tempsTabs.push({ |
||||
|
// label: "总成版本号", |
||||
|
// prop: "erpAssemblyName", |
||||
|
// width: 160, |
||||
|
// }); |
||||
|
return tempsTabs; |
||||
|
}, |
||||
|
}, |
||||
|
methods: { |
||||
|
exChange(row, rowList) { |
||||
|
this.loading = true; |
||||
|
|
||||
|
var that = this; |
||||
|
if (rowList.length) { |
||||
|
that.expands = []; |
||||
|
if (row) { |
||||
|
that.expands.push(row.id); // 只展开当前行id |
||||
|
} |
||||
|
} else { |
||||
|
that.expands = []; |
||||
|
} |
||||
|
}, |
||||
|
/** 刷新列表 */ |
||||
|
handleHandle(data) { |
||||
|
if (data.type !== "edit") { |
||||
|
this.getList(); |
||||
|
} |
||||
|
}, |
||||
|
/** 格式化字段 */ |
||||
|
fieldFormatter(row, column) { |
||||
|
return row[column.property] || "--"; |
||||
|
}, |
||||
|
importExcelData() { |
||||
|
//关闭导入窗体时调用 |
||||
|
this.showExcelImport = false; |
||||
|
this.getList(); |
||||
|
}, |
||||
|
getList() { |
||||
|
this.listLoading = true; |
||||
|
console.log("详表条件:" + JSON.stringify(this.customerInfo.parentId)); |
||||
|
//alert("详表条件:" + JSON.stringify(this.customerInfo.parentId)); |
||||
|
let vehicleAssemblyId = { vehicleAssemblyId: this.customerInfo.parentId }; |
||||
|
this.$axios |
||||
|
.gets("/api/newjit/assembly-cfg-vehicle/list", vehicleAssemblyId) |
||||
|
.then((response) => { |
||||
|
this.list = response; |
||||
|
setTimeout(() => { |
||||
|
//大数据量加载时 |
||||
|
this.listLoading = false; |
||||
|
}, 500); |
||||
|
}) |
||||
|
.catch(() => { |
||||
|
this.listLoading = false; |
||||
|
}); |
||||
|
}, |
||||
|
/** 筛选操作 */ |
||||
|
handleFilter() { |
||||
|
this.page = 1; |
||||
|
this.getList(); |
||||
|
this.listQuery.Filters = []; |
||||
|
if (this.searchContent != "") { |
||||
|
var column = "partCode"; |
||||
|
let filter = { |
||||
|
logic: 0, |
||||
|
column: column, |
||||
|
action: 6, |
||||
|
value: this.searchContent, |
||||
|
}; |
||||
|
this.listQuery.Filters.push(filter); |
||||
|
} |
||||
|
this.getList(); |
||||
|
}, |
||||
|
resetQuery() {}, |
||||
|
|
||||
|
sortChange(data) { |
||||
|
const { prop, order } = data; |
||||
|
if (!prop || !order) { |
||||
|
this.handleFilter(); |
||||
|
return; |
||||
|
} |
||||
|
this.listQuery.Sorting = prop + " " + order; |
||||
|
this.handleFilter(); |
||||
|
}, |
||||
|
handleSelectionChange(val) { |
||||
|
this.multipleSelection = val; |
||||
|
}, |
||||
|
/** 通过回调控制style */ |
||||
|
cellStyle({ row, column, rowIndex, columnIndex }) { |
||||
|
if ( |
||||
|
column.property === "fisQty" || |
||||
|
column.property === "diffQty" || |
||||
|
column.property === "stockQty" |
||||
|
) { |
||||
|
return { textAlign: "right" }; |
||||
|
} else { |
||||
|
return { textAlign: "left" }; |
||||
|
} |
||||
|
}, |
||||
|
/** 通过回调控制表头style */ |
||||
|
headerRowStyle({ row, column, rowIndex, columnIndex }) { |
||||
|
if ( |
||||
|
column.property === "fisQty" || |
||||
|
column.property === "diffQty" || |
||||
|
column.property === "stockQty" |
||||
|
) { |
||||
|
return { textAlign: "right", background: "#FAFAFA" }; |
||||
|
} else { |
||||
|
return { textAlign: "left", background: "#FAFAFA" }; |
||||
|
} |
||||
|
}, |
||||
|
handleRowClick(row, column, event) { |
||||
|
this.$refs.multipleTable.clearSelection(); |
||||
|
this.$refs.multipleTable.toggleRowSelection(row); |
||||
|
}, |
||||
|
}, |
||||
|
}; |
||||
|
</script> |
||||
|
|
||||
|
|
||||
|
<style lang="scss" scoped> |
||||
|
@import "../../../ux/styles/crmtable.scss"; |
||||
|
</style> |
||||
|
|
@ -0,0 +1,270 @@ |
|||||
|
<!--未知总成-明细数据--> |
||||
|
<template> |
||||
|
<div class="cr-body-content"> |
||||
|
<!--表格渲染--> |
||||
|
<el-table |
||||
|
ref="multipleTable" |
||||
|
v-loading="listLoading" |
||||
|
element-loading-text="拼命加载中..." |
||||
|
element-loading-spinner="el-icon-loading" |
||||
|
class="cr-table" |
||||
|
:data="list" |
||||
|
:height="tableHeight" |
||||
|
:cell-style="cellStyle" |
||||
|
:header-cell-style="headerRowStyle" |
||||
|
size="small" |
||||
|
stripe |
||||
|
border |
||||
|
highlight-current-row |
||||
|
style="width: 100%" |
||||
|
@sort-change="sortChange" |
||||
|
@selection-change="handleSelectionChange" |
||||
|
@row-click="handleRowClick" |
||||
|
> |
||||
|
<!-- <el-table-column type="selection" width="44px"></el-table-column> --> |
||||
|
<el-table-column |
||||
|
label="客户零件代码" |
||||
|
prop="partCode " |
||||
|
sortable="custom" |
||||
|
align="center" |
||||
|
width="220px" |
||||
|
> |
||||
|
<template slot-scope="scope"> |
||||
|
<span>{{ scope.row.partCode }}</span> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
<el-table-column |
||||
|
v-for="(item, index) in getDefaultField" |
||||
|
:key="index" |
||||
|
:prop="item.prop" |
||||
|
:label="item.label" |
||||
|
:min-width="item.width" |
||||
|
:formatter="fieldFormatter" |
||||
|
sortable="custom" |
||||
|
show-overflow-tooltip |
||||
|
:gutter="0" |
||||
|
> |
||||
|
<template slot="header" slot-scope="scope"> |
||||
|
{{ scope.column.label }} |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
</el-table> |
||||
|
<div class="table-footer"> |
||||
|
<!-- 分页控件 style="margin-top: -25px;margin-bottom:-25px;float:right;"--> |
||||
|
<pagination |
||||
|
v-show="totalCount > 0" |
||||
|
:total="totalCount" |
||||
|
:page.sync="page" |
||||
|
:limit.sync="listQuery.MaxResultCount" |
||||
|
@pagination="getList" |
||||
|
/> |
||||
|
</div> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination |
||||
|
import permission from "@/directive/permission/index.js"; |
||||
|
import CRMTableHead from "../../components/CRMTableHead"; |
||||
|
import { downloadFile } from "@/utils/crmindex.js"; |
||||
|
import Detail from "./detail"; |
||||
|
|
||||
|
export default { |
||||
|
name: "sendUnsettledDiffReport", |
||||
|
components: { Pagination, CRMTableHead, Detail }, |
||||
|
directives: { permission }, |
||||
|
filters: { |
||||
|
IsCustomerSignFilter(status) { |
||||
|
//翻译是否签字 |
||||
|
const statusMap = { |
||||
|
true: "是", |
||||
|
false: "否", |
||||
|
}; |
||||
|
return statusMap[status]; |
||||
|
}, |
||||
|
}, |
||||
|
props: { |
||||
|
customerInfos: { |
||||
|
type: Array, |
||||
|
default: () => { |
||||
|
return []; |
||||
|
}, |
||||
|
}, |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
crmType: "stockFisDiffReport", |
||||
|
rules: { |
||||
|
//前端定义的规则,后端也有验证 |
||||
|
erpMaterialCode: [ |
||||
|
{ required: true, message: "必须输入!", trigger: "blur" }, |
||||
|
], |
||||
|
}, |
||||
|
searchContent: "", // 输入内容 |
||||
|
customerInfo: { |
||||
|
parentId: "", |
||||
|
}, |
||||
|
form: { |
||||
|
dicDetailID: "", |
||||
|
customerId: "", |
||||
|
projectId: "", |
||||
|
}, |
||||
|
list: null, |
||||
|
totalCount: 0, |
||||
|
listLoading: true, |
||||
|
formLoading: false, |
||||
|
// 高级搜索 |
||||
|
filterObj: { |
||||
|
type: Object, |
||||
|
default: () => { |
||||
|
return {}; |
||||
|
}, |
||||
|
}, |
||||
|
listQuery: { |
||||
|
Filters: [ |
||||
|
{ |
||||
|
logic: 0, |
||||
|
column: "Enabled", |
||||
|
action: 0, |
||||
|
value: "true", |
||||
|
}, //默认查询可用的 |
||||
|
], |
||||
|
SkipCount: 0, |
||||
|
MaxResultCount: 15, |
||||
|
id: "", |
||||
|
}, |
||||
|
page: 1, |
||||
|
dialogFormVisible: false, |
||||
|
multipleSelection: [], |
||||
|
formTitle: "", |
||||
|
drawer: false, |
||||
|
showExcelImport: false, |
||||
|
tableHeight: document.documentElement.clientHeight - 260, |
||||
|
isEdit: false, |
||||
|
}; |
||||
|
}, |
||||
|
mounted() { |
||||
|
var self = this; |
||||
|
window.onresize = function () { |
||||
|
var offsetHei = document.documentElement.clientHeight; |
||||
|
self.tableHeight = offsetHei - 190; |
||||
|
}; |
||||
|
}, |
||||
|
created() { |
||||
|
this.getList(); |
||||
|
}, |
||||
|
watch: { |
||||
|
customerInfos: { |
||||
|
handler(newVal) { |
||||
|
if (newVal == "" || newVal == "undefined") { |
||||
|
//TODO |
||||
|
} else { |
||||
|
newVal.forEach((element) => { |
||||
|
this.customerInfo.parentId = element.ParentId; |
||||
|
}); |
||||
|
if (this.customerInfo.parentId != "") { |
||||
|
this.getList(); |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
immediate: true, |
||||
|
}, |
||||
|
}, |
||||
|
computed: { |
||||
|
/** 列表字段 */ |
||||
|
getDefaultField() { |
||||
|
var tempsTabs = []; |
||||
|
//tempsTabs.push({ label: "客户零件代码", prop: "partCode ", width: 120 }); |
||||
|
tempsTabs.push({ label: "客户零件数量", prop: "partNum", width: 95 }); |
||||
|
tempsTabs.push({ label: "描述", prop: "description", width: 280 }); |
||||
|
return tempsTabs; |
||||
|
}, |
||||
|
}, |
||||
|
methods: { |
||||
|
/** 刷新列表 */ |
||||
|
handleHandle(data) { |
||||
|
if (data.type !== "edit") { |
||||
|
this.getList(); |
||||
|
} |
||||
|
}, |
||||
|
/** 格式化字段 */ |
||||
|
// fieldFormatter(row, column) { |
||||
|
// return row[column.property] || "--"; |
||||
|
// }, |
||||
|
importExcelData() { |
||||
|
//关闭导入窗体时调用 |
||||
|
this.showExcelImport = false; |
||||
|
this.getList(); |
||||
|
}, |
||||
|
getList() { |
||||
|
this.listLoading = true; |
||||
|
console.log("详表条件:" + JSON.stringify(this.customerInfo.parentId)); |
||||
|
this.$axios |
||||
|
.gets("/api/newjit/unknown-assembly/" + this.customerInfo.parentId) |
||||
|
.then((response) => { |
||||
|
this.list = response.item.unknownAssemblyParts; |
||||
|
setTimeout(() => { |
||||
|
//大数据量加载时 |
||||
|
this.listLoading = false; |
||||
|
}, 500); |
||||
|
}) |
||||
|
.catch(() => { |
||||
|
this.listLoading = false; |
||||
|
}); |
||||
|
}, |
||||
|
/** 筛选操作 */ |
||||
|
handleFilter() { |
||||
|
this.page = 1; |
||||
|
this.getList(); |
||||
|
this.listQuery.Filters = []; |
||||
|
if (this.searchContent != "") { |
||||
|
var column = "partCode"; |
||||
|
let filter = { |
||||
|
logic: 0, |
||||
|
column: column, |
||||
|
action: 6, |
||||
|
value: this.searchContent, |
||||
|
}; |
||||
|
this.listQuery.Filters.push(filter); |
||||
|
} |
||||
|
this.getList(); |
||||
|
}, |
||||
|
resetQuery() {}, |
||||
|
|
||||
|
sortChange(data) { |
||||
|
const { prop, order } = data; |
||||
|
if (!prop || !order) { |
||||
|
this.handleFilter(); |
||||
|
return; |
||||
|
} |
||||
|
this.listQuery.Sorting = prop + " " + order; |
||||
|
this.handleFilter(); |
||||
|
}, |
||||
|
handleSelectionChange(val) { |
||||
|
this.multipleSelection = val; |
||||
|
}, |
||||
|
/** 通过回调控制style */ |
||||
|
cellStyle({ row, column, rowIndex, columnIndex }) { |
||||
|
return { textAlign: "left" }; |
||||
|
}, |
||||
|
/** 通过回调控制表头style */ |
||||
|
headerRowStyle({ row, column, rowIndex, columnIndex }) { |
||||
|
return { textAlign: "left", background: "#FAFAFA" }; |
||||
|
}, |
||||
|
handleRowClick(row, column, event) { |
||||
|
this.$refs.multipleTable.clearSelection(); |
||||
|
this.$refs.multipleTable.toggleRowSelection(row); |
||||
|
}, |
||||
|
}, |
||||
|
}; |
||||
|
</script> |
||||
|
|
||||
|
|
||||
|
<style lang="scss" scoped> |
||||
|
@import "../../styles/crmtable.scss"; |
||||
|
</style> |
||||
|
|
||||
|
<style lang="scss"> |
||||
|
.el-table .cell.el-tooltip { |
||||
|
white-space: pre-wrap; |
||||
|
} |
File diff suppressed because it is too large
Loading…
Reference in new issue