diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/base-data/bei-jian.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/base-data/bei-jian.js index 1dbaf4c1..6dbb4b13 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/base-data/bei-jian.js +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/base-data/bei-jian.js @@ -34,6 +34,10 @@ const schema = { title: "合同号", type: "string", }, + isCancel: { + type: "boolean", + title: "是否已停用", + }, }, }; diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/base-data/xiao-shou.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/base-data/xiao-shou.js index 3cc2d226..2a0d5f7b 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/base-data/xiao-shou.js +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/base-data/xiao-shou.js @@ -33,6 +33,10 @@ const schema = { title: "合同号", type: "string", }, + isCancel: { + type: "boolean", + title: "是否已停用", + }, }, }; diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/input/jie-suan.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/input/jie-suan.js index ed1229f6..341acd5e 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/input/jie-suan.js +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/input/jie-suan.js @@ -38,6 +38,13 @@ export default function (type, meta) { }, }; + if (type.indexOf("HBPO") > -1) { + schema.properties.place = { + type: "string", + title: "地点", + }; + } + const querySchema = { title: "结算数据", type: "object", diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/router/base-data.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/router/base-data.js index 4d273df5..937125ee 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/router/base-data.js +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/router/base-data.js @@ -56,7 +56,13 @@ export default [ // }, { ...createPage("bei-jian", "title=备件价格单"), - children: [createButton("query", "title=查询&isTop=true"), createButton("import", "title=导入&isTop=true"), createButton("export", "title=导出&isTop=true&pattern=paged")], + children: [ + createButton("query", "title=查询&isTop=true"), + createButton("import", "title=导入&isTop=true"), + createButton("export", "title=导出&isTop=true&pattern=paged"), + createButton("enable", "title=启用&disabled=o=>o.isCancel===false"), + createButton("disable", "title=停用&disabled=o=>o.isCancel===true"), + ], }, // { // ...createPage("cai-gou", "title=采购价格单"), @@ -64,7 +70,13 @@ export default [ // }, { ...createPage("xiao-shou", "title=销售价格单"), - children: [createButton("query", "title=查询&isTop=true"), createButton("import", "title=导入&isTop=true"), createButton("export", "title=导出&isTop=true&pattern=paged")], + children: [ + createButton("query", "title=查询&isTop=true"), + createButton("import", "title=导入&isTop=true"), + createButton("export", "title=导出&isTop=true&pattern=paged"), + createButton("enable", "title=启用&disabled=o=>o.isCancel===false"), + createButton("disable", "title=停用&disabled=o=>o.isCancel===true"), + ], }, // { // ...createPage("ke-hu", "title=客户库位关系表"), diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/base-data/bei-jian.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/base-data/bei-jian.js index 6c6985ca..210421b4 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/base-data/bei-jian.js +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/base-data/bei-jian.js @@ -1,2 +1,26 @@ -import useList from "../_list.js"; -export default useList("base-data/bei-jian"); +import html from "html"; +import { ref } from "vue"; +import request from "../../request/index.js"; +import AppList from "../../components/list/index.js"; +import useConfig from "../../models/base-data/bei-jian.js"; + +export default { + components: { AppList }, + template: html``, + setup() { + const appListRef = ref(null); + const config = useConfig(); + const onCommand = async (item, rows) => { + const url = `${config.baseUrl}/${item.path}`; + if (item.path === "enable" || item.path === "disable") { + await appListRef.value.onClick( + async () => + await request("settleaccount/price-list-app-service-bj/update", { id: rows[0].id, isCancel: item.path === "enable" ? false : true }, { method: "POST" }, true), + `确认${item.path === "open-version" ? "启用" : "停用"}选中的${rows.length}行数据吗?`, + true + ); + } + }; + return { appListRef, config, onCommand }; + }, +}; diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/base-data/xiao-shou.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/base-data/xiao-shou.js index bb80ff15..28d0f058 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/base-data/xiao-shou.js +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/base-data/xiao-shou.js @@ -1,2 +1,25 @@ -import useList from "../_list.js"; -export default useList("base-data/xiao-shou"); +import html from "html"; +import { ref } from "vue"; +import request from "../../request/index.js"; +import AppList from "../../components/list/index.js"; +import useConfig from "../../models/base-data/xiao-shou.js"; + +export default { + components: { AppList }, + template: html``, + setup() { + const appListRef = ref(null); + const config = useConfig(); + const onCommand = async (item, rows) => { + const url = `${config.baseUrl}/${item.path}`; + if (item.path === "enable" || item.path === "disable") { + await appListRef.value.onClick( + async () => await request("settleaccount/price-list/update", { id: rows[0].id, isCancel: item.path === "enable" ? false : true }, { method: "POST" }, true), + `确认${item.path === "open-version" ? "启用" : "停用"}选中的${rows.length}行数据吗?`, + true + ); + } + }; + return { appListRef, config, onCommand }; + }, +}; diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs index f5b8d390..5930002b 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs @@ -256,19 +256,19 @@ public class PriceListAppService : SettleAccountApplicationBase entity.IsCancel = input.IsCancel; if (entity.IsCancel == false) { - var existsPriceList = _settleAccountDbContext.Set() + var existPriceList = _settleAccountDbContext.Set() .Where(t => t.LU == entity.LU) .Where(t => t.IsCancel == false) .Where(t => t.Id != entity.Id) .ToList(); - var existsPrice = existsPriceList.Find(t => (entity.BeginTime >= t.BeginTime && entity.BeginTime < t.EndTime) || (t.BeginTime >= entity.BeginTime && t.BeginTime < entity.EndTime)); - if (existsPrice != null) + var existPrice = existPriceList.Find(t => (entity.BeginTime >= t.BeginTime && entity.BeginTime < t.EndTime) || (t.BeginTime >= entity.BeginTime && t.BeginTime < entity.EndTime)); + if (existPrice != null) { - throw new UserFriendlyException($"无法启用!此记录启用时间区间与区间【{existsPrice.BeginTime:yyyy-MM-dd}至{existsPrice.EndTime:yyyy-MM-dd}】存在交集", "400"); + throw new UserFriendlyException($"无法启用!此记录启用时间区间与区间【{existPrice.BeginTime:yyyy-MM-dd}至{existPrice.EndTime:yyyy-MM-dd}】存在交集", "400"); } } - _settleAccountDbContext.Set().Update(entity); + await _settleAccountDbContext.SaveChangesAsync().ConfigureAwait(false); var dto = ObjectMapper.Map(entity); return dto; } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs index f4cf5dc8..d274e04e 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs @@ -214,19 +214,19 @@ public class PriceListAppServiceBJ : SettleAccountApplicationBase entity.IsCancel = input.IsCancel; if (entity.IsCancel == false) { - var existsPriceBjList = _settleAccountDbContext.Set() + var existPriceBjList = _settleAccountDbContext.Set() .Where(t => t.LU == entity.LU) .Where(t => t.IsCancel == false) .Where(t => t.Id != entity.Id) .ToList(); - var existsPriceBj = existsPriceBjList.Find(t => (entity.BeginDate >= t.BeginDate && entity.BeginDate < t.EndDate) || (t.BeginDate >= entity.BeginDate && t.BeginDate < entity.EndDate)); - if (existsPriceBj != null) + var existPriceBj = existPriceBjList.Find(t => (entity.BeginDate >= t.BeginDate && entity.BeginDate < t.EndDate) || (t.BeginDate >= entity.BeginDate && t.BeginDate < entity.EndDate)); + if (existPriceBj != null) { - throw new UserFriendlyException($"无法启用!此记录启用时间区间与区间【{existsPriceBj.BeginDate:yyyy-MM-dd}至{existsPriceBj.EndDate:yyyy-MM-dd}】存在交集", "400"); + throw new UserFriendlyException($"无法启用!此记录启用时间区间与区间【{existPriceBj.BeginDate:yyyy-MM-dd}至{existPriceBj.EndDate:yyyy-MM-dd}】存在交集", "400"); } } - _settleAccountDbContext.Set().Update(entity); + await _settleAccountDbContext.SaveChangesAsync().ConfigureAwait(false); var dto = ObjectMapper.Map(entity); return dto; }