From e89e48b1dd56c37f395f979e27c125e6db96cf33 Mon Sep 17 00:00:00 2001 From: wanggang <76527413@qq.com> Date: Sat, 22 Jul 2023 14:47:00 +0800 Subject: [PATCH] update --- .../wwwroot/assets/demo/pages/component.html | 24 ++++++- .../Entities/BQ/VmiAppService.cs | 66 +++++++++++++++++++ .../Entities/BQ/VmiService.cs | 56 ---------------- 3 files changed, 87 insertions(+), 59 deletions(-) create mode 100644 code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs delete mode 100644 code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiService.cs diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/assets/demo/pages/component.html b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/assets/demo/pages/component.html index fb7249ed..28d4a38e 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/assets/demo/pages/component.html +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/assets/demo/pages/component.html @@ -28,7 +28,7 @@ const simpleComponent = { components: {},//组件注册 template: ` - `, + `, props: ['modelValue'], emit: ["update:modelValue"], setup(props, context) { @@ -39,10 +39,18 @@ alert('child method'); } + const callback = (result) => { + alert(`paretn method callback: ${result}`); + } + const onClick = () => { + context.emit('click', 'call parent method from child', callback) + }; + context.expose({ childMethod }); return { model, - childMethod + childMethod, + onClick }; } }; @@ -59,11 +67,21 @@ value: "test" }); const onClick = () => { + console.log(props, context); childRef.value.childMethod(); }; - const parentMethod = o => alert(o); + const parentMethod = (o, callback) => { + alert(o); + callback('from parent'); + }; + + onMounted(() => { + console.log(childRef.value) + }); + return { model, + childRef, onClick, parentMethod }; diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs new file mode 100644 index 00000000..4cf373a7 --- /dev/null +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs @@ -0,0 +1,66 @@ +using System; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Application.Services; +using Volo.Abp.DependencyInjection; +using Win.Sfs.SettleAccount.Entities.BQ.Dtos; +using Win.Sfs.SettleAccount.Entities.BQ.Vmi; +using Win.Sfs.Shared.RepositoryBase; + +namespace Win.Sfs.SettleAccount.Entities.BQ; + +public interface IVmiService : IApplicationService, ITransientDependency, IJobService +{ + string Test(); + + void In(VmiCategory category, string erpToLoc, string partCode, string lu, decimal count, object message); + + void Out(VmiCategory category, string erpToLoc, string partCode, string lu, decimal count, object message); + + Task> Query(RequestDto request); +} + +[AllowAnonymous] +[Route("api/settleaccount/[controller]/[action]")] +public class VmiAppService : ApplicationService, IVmiService, IJobService, ITransientDependency +{ + private readonly INormalEfCoreRepository _repository; + + public VmiAppService(INormalEfCoreRepository repository) + { + this._repository = repository; + } + + [HttpPost] + public void Invoke() + { + Console.WriteLine($"{nameof(VmiAppService)}:{DateTime.Now}"); + } + + [HttpPost] + public void In(VmiCategory category, string erpToLoc, string partCode, string lu, decimal count, object message) + { + } + + [HttpPost] + public void Out(VmiCategory category, string erpToLoc, string partCode, string lu, decimal count, object message) + { + } + + [HttpPost] + public async Task> Query(RequestDto input) + { + var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true).ConfigureAwait(false); + var totalCount = await _repository.GetCountByFilterAsync(input.Filters).ConfigureAwait(false); + //var dtos = ObjectMapper.Map, List>(entities); + return new PagedResultDto(totalCount, entities); + } + + [HttpGet] + public string Test() + { + return "Test"; + } +} diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiService.cs deleted file mode 100644 index 1532415e..00000000 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiService.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System; -using System.Linq; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using Volo.Abp.Application.Services; -using Volo.Abp.DependencyInjection; -using Win.Sfs.SettleAccount.Entities.BQ.Vmi; - -namespace Win.Sfs.SettleAccount.Entities.BQ; - -public interface IVmiService : IApplicationService, ITransientDependency, IJobService -{ - string Test(); - - void In(); - - void Out(); - - IQueryable Query(); -} - -[ApiExplorerSettings(IgnoreApi = true)] -[AllowAnonymous] -[Route("api/settleaccount/[controller]/[action]")] -public class VmiService : IVmiService -{ - [NonAction] - public void Invoke() - { - Console.WriteLine($"{nameof(VmiService)}:{DateTime.Now}"); - } - - [NonAction] - public void In() - { - throw new System.NotImplementedException(); - } - - [NonAction] - public void Out() - { - throw new System.NotImplementedException(); - } - - [HttpPost] - public IQueryable Query() - { - throw new System.NotImplementedException(); - } - - [HttpGet] - public string Test() - { - return "Test"; - } -}