From 9173f6e5b34a12c01804676d76842031e9ec6724 Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期三, 26 六月 2024 11:52:16 +0800
Subject: [PATCH] Merge branch 'master' of http://47.108.235.38:8080/r/baifenbaishop
---
CoreCms.Net.Web.Admin/Controllers/Good/CoreCmsProductsController.cs | 16 +++++++-
CoreCms.Net.Repository/Good/CoreCmsProductsRepository.cs | 20 ++++++----
CoreCms.Net.Web.Admin/Controllers/Stock/CoreCmsStockController.cs | 13 +++++-
CoreCms.Net.Web.Admin/wwwroot/views/content/stock/products/index.html | 34 +++++++++++++++--
4 files changed, 66 insertions(+), 17 deletions(-)
diff --git a/CoreCms.Net.Repository/Good/CoreCmsProductsRepository.cs b/CoreCms.Net.Repository/Good/CoreCmsProductsRepository.cs
index 1e87016..51cc9d9 100644
--- a/CoreCms.Net.Repository/Good/CoreCmsProductsRepository.cs
+++ b/CoreCms.Net.Repository/Good/CoreCmsProductsRepository.cs
@@ -112,9 +112,10 @@
List<CoreCmsProducts> page;
if (blUseNoLock)
{
- page = await DbClient.Queryable<CoreCmsGoods, CoreCmsProducts>((good, product) => new JoinQueryInfos(
- JoinType.Inner, good.id == product.goodsId))
- .Select((good, product) => new CoreCmsProducts
+ page = await DbClient.Queryable<CoreCmsGoods, CoreCmsProducts, CoreCmsGoodsCategory>((good, product, Category) => new JoinQueryInfos(
+ JoinType.Inner, good.id == product.goodsId,
+ JoinType.Inner, good.goodsCategoryId == Category.id))
+ .Select((good, product, Category) => new CoreCmsProducts
{
id = product.id,
goodsId = product.goodsId,
@@ -136,7 +137,8 @@
name = good.name,
bn = good.bn,
isMarketable = good.isMarketable,
- unit = good.unit
+ unit = good.unit,
+ CategoryID = Category.id
}).With(SqlWith.NoLock)
.MergeTable()
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
@@ -145,9 +147,10 @@
}
else
{
- page = await DbClient.Queryable<CoreCmsGoods, CoreCmsProducts>((good, product) => new JoinQueryInfos(
- JoinType.Inner, good.id == product.goodsId))
- .Select((good, product) => new CoreCmsProducts
+ page = await DbClient.Queryable<CoreCmsGoods, CoreCmsProducts, CoreCmsGoodsCategory>((good, product, Category) => new JoinQueryInfos(
+ JoinType.Inner, good.id == product.goodsId,
+ JoinType.Inner, good.goodsCategoryId == Category.id))
+ .Select((good, product, Category) => new CoreCmsProducts
{
id = product.id,
goodsId = product.goodsId,
@@ -169,7 +172,8 @@
name = good.name,
bn = good.bn,
isMarketable = good.isMarketable,
- unit = good.unit
+ unit = good.unit,
+ CategoryID = Category.id
})
.MergeTable()
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
diff --git a/CoreCms.Net.Web.Admin/Controllers/Good/CoreCmsProductsController.cs b/CoreCms.Net.Web.Admin/Controllers/Good/CoreCmsProductsController.cs
index 7498747..c88b9b7 100644
--- a/CoreCms.Net.Web.Admin/Controllers/Good/CoreCmsProductsController.cs
+++ b/CoreCms.Net.Web.Admin/Controllers/Good/CoreCmsProductsController.cs
@@ -30,6 +30,7 @@
using Microsoft.AspNetCore.Mvc;
using NPOI.HSSF.UserModel;
using SqlSugar;
+using CoreCms.Net.Services;
namespace CoreCms.Net.Web.Admin.Controllers
{
@@ -45,16 +46,19 @@
{
private readonly IWebHostEnvironment _webHostEnvironment;
private readonly ICoreCmsProductsServices _coreCmsProductsServices;
+ private readonly ICoreCmsGoodsCategoryServices _coreCmsGoodsCategoryServices;
/// <summary>
/// 鏋勯�犲嚱鏁�
///</summary>
public CoreCmsProductsController(IWebHostEnvironment webHostEnvironment
, ICoreCmsProductsServices coreCmsProductsServices
+ , ICoreCmsGoodsCategoryServices coreCmsGoodsCategoryServices
)
{
_webHostEnvironment = webHostEnvironment;
_coreCmsProductsServices = coreCmsProductsServices;
+ _coreCmsGoodsCategoryServices = coreCmsGoodsCategoryServices;
}
#region 鑾峰彇鍒楄〃============================================================
@@ -132,7 +136,12 @@
{
where = where.And(p => p.name.Contains(name));
}
-
+ //鍟嗗搧鍒嗙被 decimal
+ var Category = Request.Form["categoryId"].FirstOrDefault().ToInt32OrDefault();
+ if (Category > 0)
+ {
+ where = where.And(p => p.CategoryID == Category);
+ }
//鑾峰彇鏁版嵁
var list = await _coreCmsProductsServices.QueryDetailPageAsync(where, orderEx, orderBy, pageCurrent, pageSize, true);
//杩斿洖鏁版嵁
@@ -152,10 +161,13 @@
/// <returns></returns>
[HttpPost]
[Description("棣栭〉鏁版嵁")]
- public AdminUiCallBack GetIndex()
+ public async Task<AdminUiCallBack> GetIndexAsync()
{
//杩斿洖鏁版嵁
var jm = new AdminUiCallBack { code = 0 };
+ var categories = await _coreCmsGoodsCategoryServices.QueryListByClauseAsync(p => p.isShow, p => p.sort, OrderByType.Asc, true, true);
+ var categoriesTree = GoodsHelper.GetTree(categories, false);
+ jm.data= categoriesTree;
return jm;
}
#endregion
diff --git a/CoreCms.Net.Web.Admin/Controllers/Stock/CoreCmsStockController.cs b/CoreCms.Net.Web.Admin/Controllers/Stock/CoreCmsStockController.cs
index fb528b9..d737776 100644
--- a/CoreCms.Net.Web.Admin/Controllers/Stock/CoreCmsStockController.cs
+++ b/CoreCms.Net.Web.Admin/Controllers/Stock/CoreCmsStockController.cs
@@ -56,13 +56,15 @@
private readonly ICoreCmsDistributionServices _coreCmsDistributionServices;
private readonly ICoreCmsAreaServices _coreCmsAreaServices;
+ private readonly ICoreCmsGoodsCategoryServices _coreCmsGoodsCategoryServices;
/// <summary>
/// 鏋勯�犲嚱鏁�
///</summary>
public CoreCmsStockController(IWebHostEnvironment webHostEnvironment
, ICoreCmsStockServices stockServices, ICoreCmsProductsServices productsServices, IHttpContextUser user, ICoreCmsStockLogServices stockLogServices, ISysUserServices sysUserServices
, ICoreCmsDistributionServices coreCmsDistributionServices
- , ICoreCmsAreaServices coreCmsAreaServices)
+ , ICoreCmsAreaServices coreCmsAreaServices
+ , ICoreCmsGoodsCategoryServices coreCmsGoodsCategoryServices)
{
_webHostEnvironment = webHostEnvironment;
_stockServices = stockServices;
@@ -72,6 +74,7 @@
_sysUserServices = sysUserServices;
_coreCmsDistributionServices = coreCmsDistributionServices;
_coreCmsAreaServices = coreCmsAreaServices;
+ _coreCmsGoodsCategoryServices = coreCmsGoodsCategoryServices;
}
#region 鑾峰彇鍒楄〃============================================================
@@ -176,16 +179,20 @@
/// <returns></returns>
[HttpPost]
[Description("棣栭〉鏁版嵁")]
- public AdminUiCallBack GetIndex()
+ public async Task<AdminUiCallBack> GetIndex()
{
//杩斿洖鏁版嵁
var jm = new AdminUiCallBack { code = 0 };
var stockType = EnumHelper.EnumToList<GlobalEnumVars.StockType>();
stockType = stockType.Where(p => p.value < 3).ToList();
+
+ var categories = await _coreCmsGoodsCategoryServices.QueryListByClauseAsync(p => p.isShow, p => p.sort, OrderByType.Asc, true, true);
+ var categoriesTree = GoodsHelper.GetTree(categories, false);
jm.data = new
{
- stockType,
+ stockType
+
};
return jm;
}
diff --git a/CoreCms.Net.Web.Admin/wwwroot/views/content/stock/products/index.html b/CoreCms.Net.Web.Admin/wwwroot/views/content/stock/products/index.html
index c6d4a19..27e187f 100644
--- a/CoreCms.Net.Web.Admin/wwwroot/views/content/stock/products/index.html
+++ b/CoreCms.Net.Web.Admin/wwwroot/views/content/stock/products/index.html
@@ -18,6 +18,12 @@
<div class="layui-form coreshop-toolbar-search-form">
<div class="layui-form-item">
<div class="layui-inline">
+ <label class="layui-form-label" for="category">鍟嗗搧鍒嗙被</label>
+ <div class="layui-input-inline" style="width: 200px;">
+ <div id="sel_category_stortPrducts" class="ew-xmselect-tree" lay-reqText="璇烽�夋嫨鍟嗗搧鍒嗙被"></div>
+ </div>
+ </div>
+ <div class="layui-inline">
<div class="layui-input-inline">
<input type="text" name="name" placeholder="璇疯緭鍏ュ晢鍝佸悕绉�" class="layui-input">
</div>
@@ -64,9 +70,9 @@
layui.data.done = function (d) {
//寮�鍚皟璇曟儏鍐典笅鑾峰彇鎺ュ彛璧嬪�兼暟鎹�
if (debug) { console.log(d); }
-
- indexData = d.data;
- layui.use(['index', 'table', 'laydate', 'util', 'coredropdown', 'coreHelper'],
+
+ indexData = d.data.data;
+ layui.use(['index', 'table', 'laydate', 'util', 'coredropdown', 'coreHelper','xmSelect'],
function () {
var $ = layui.$
, admin = layui.admin
@@ -76,6 +82,7 @@
, setter = layui.setter
, coreHelper = layui.coreHelper
, util = layui.util
+ ,xmSelect = layui.xmSelect
, view = layui.view;
//閲嶈浇form
@@ -158,7 +165,26 @@
doDetails(obj);
}
});
-
+ xmSelect.render({
+ el: '#sel_category_stortPrducts',
+ height: '250px',
+ data: indexData,
+ //initValue: mData ? [mData.parentId] : [],
+ //model: { label: { type: 'text' } },
+ name: 'categoryId',
+ prop: {
+ name: 'title',
+ value: 'id'
+ },
+ radio: true,
+ clickClose: true,
+ tree: {
+ show: true,
+ indent: 15,
+ strict: false,
+ expandedKeys: true
+ }
+ });
//鐩戝惉鍗曞厓鏍肩紪杈�
table.on('edit(LAY-app-CoreCmsProducts-tableBox)', function (obj) {
--
Gitblit v1.9.1