Commit e72017b4 authored by 覃振观's avatar 覃振观 👶

23-12-5

parent 75ac4ca3
$(document).ready(function() { $(document).ready(function() {
$('#pageTab').tab();
initializateSelectC(); initializateSelectC();
loadDataTest();
}); });
function initializateSelectC() { function initializateSelectC() {
...@@ -12,7 +14,6 @@ function initializateSelectC() { ...@@ -12,7 +14,6 @@ function initializateSelectC() {
}); });
} }
function loadDataTest() { function loadDataTest() {
console.log("loadData") console.log("loadData")
var params = new URLSearchParams(document.location.search); var params = new URLSearchParams(document.location.search);
...@@ -21,16 +22,51 @@ function loadDataTest() { ...@@ -21,16 +22,51 @@ function loadDataTest() {
productId: paramsData.productId productId: paramsData.productId
}, function (data) { }, function (data) {
debugger; debugger;
var selectedCategory = data.selectedCategory; $('#submitForm').formSet(data);
$("#selectedCategory").ligerComboBox({ var fronData = {};
textField: 'productCategoryName', fronData.Rows = data.fronColor;
valueField: 'productCategoryId', faceGrid("#frontFaceDiv", fronData);
fronData.Rows = data.backColor;
faceGrid("#backFaceDiv", fronData);
// var selectedCategory = data.selectedCategory;
// $("#selectedCategory").ligerComboBox({
// textField: 'productCategoryName',
// valueField: 'productCategoryId',
// columns: [
// { header: 'ID', name: 'productCategoryId', width: 20 },
// { header: '名字', name: 'productCategoryName' }
// ],
// data: selectedCategory,
// selectBoxWidth: 200
// });
});
}
function faceGrid(elId, data) {
var toolbarOptions = UICtrl.getDefaultToolbarOptions({
updateHandler: function(){
updateHandler();
}
});
gridManager = UICtrl.grid("#frontFaceDiv", {
columns: [ columns: [
{ header: 'ID', name: 'productCategoryId', width: 20 }, { display: "颜色名称", name: "productFaceColorId", width: 140, minWidth: 60, type: "string", align: "left" },
{ header: '名字', name: 'productCategoryName' } { display: "油墨覆盖率(%)", name: "coverageRate", width: 120, minWidth: 60, type: "string", align: "left" }
], ],
data: selectedCategory, dataAction: "local",
selectBoxWidth: 200 dataType: "local",
}); data: data,
usePager: false, // 可能无数据时,此参数应设为 false
toolbar: toolbarOptions,
width: "100%",
height: "100%",
heightDiff: -8,
checkbox: true,
fixedCellHeight: true,
selectRowButtonOnly: true,
onDblClickRow : function(data, rowindex, rowobj) {
updateHandler(data);
}
}); });
} }
\ No newline at end of file
...@@ -10,9 +10,15 @@ ...@@ -10,9 +10,15 @@
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<head> <head>
<x:base include="layout,dialog,grid,tree,combox,commonTree" /> <x:base include="layout,dialog,grid,tree,combox,commonTree" />
<x:script src='/javaScript/common.js'/>
<x:script src='/lib/jquery/jquery.contextmenu.js'/>
<x:script src='/system/bpm/BpmUtil.js'/>
<x:script src='/biz/topsun/product/productDetail.js'/> <x:script src='/biz/topsun/product/productDetail.js'/>
</head> </head>
<form class="hg-form" method="post" action="" id="submitForm"> <body>
<div class="container-fluid">
<form class="hg-form" method="post" action="" id="submitForm">
<x:hidden name="productDetailId" /> <x:hidden name="productDetailId" />
<x:hidden name="productId"/> <x:hidden name="productId"/>
...@@ -30,19 +36,39 @@ ...@@ -30,19 +36,39 @@
<x:inputC name="productUnit" required="false" label="单位" labelCol="2" maxLength="32" fieldCol="4" /> <x:inputC name="productUnit" required="false" label="单位" labelCol="2" maxLength="32" fieldCol="4" />
<x:inputC name="productSampleCode" required="false" label="样品编号" labelCol="2" maxLength="32" fieldCol="4" /> <x:inputC name="productSampleCode" required="false" label="样品编号" labelCol="2" maxLength="32" fieldCol="4" />
<x:inputC name="brandName" required="false" label="品牌名称" labelCol="2" maxLength="32" fieldCol="4" /> <x:inputC name="brandName" required="false" label="品牌名称" labelCol="2" maxLength="32" fieldCol="4" />
<x:title title="" name="group" hideTable="#info" />
</div> </div>
<div id='pageTab' style="margin: 0px;">
<div class="ui-tab-links">
<ul id="menu_ul">
<li id="detailForm" divid="detailFormDiv">可选属性</li>
<li id="lossForm" divid="lossFormDiv">客户loss</li>
<li id="materialList" divid="materialListDiv">物料组成</li>
</ul>
</div>
<div class="ui-tab-content" style="padding: 2px; padding-right: 0;">
<div class="layout" id='detailFormDiv'>
<x:inputC name="factoryName" required="true" label="制造工厂" labelCol="2" maxLength="64" fieldCol="4" />
<x:inputC name="customerName" required="true" label="客户名称" labelCol="2" maxLength="64" fieldCol="4" />
<x:title title="外观描述" name="group" hideTable="#info" />
<x:inputC name="productLength" required="true" label="长度" labelCol="2" maxLength="64" fieldCol="4" />
<x:inputC name="productWidth" required="true" label="宽度" labelCol="2" maxLength="64" fieldCol="4" />
<x:title title="排版参数" name="group" hideTable="#info" />
<x:inputC name="modulus" required="true" label="模数" labelCol="2" maxLength="64" fieldCol="4" />
<x:inputC name="row_num" required="true" label="行数" labelCol="2" maxLength="64" fieldCol="4" />
<div id="frontFaceGrid" style="margin: 2px;"></div>
<div id="frontFaceGrid" style="margin: 2px;"></div>
</div>
<div class="layout" id='frontFaceDiv'>
</div>
<div class="layout" id='backFaceDiv'>
</div>
</div>
</div>
</form>
</div>
</body>
</html>
<form2>
</form2>
<form3>
</form3>
<div class="blank_div clearfix"></div>
<x:title title="工序设置" name="group" hideTable="#info" />
<div id="processListGrid" style="margin: 2px;"></div>
</form>
</html>
...@@ -7,8 +7,6 @@ import com.huigou.topsun.product.domain.*; ...@@ -7,8 +7,6 @@ import com.huigou.topsun.product.domain.*;
import com.huigou.topsun.product.repository.*; import com.huigou.topsun.product.repository.*;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.beanutils.BeanUtils;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.lang.reflect.Field; import java.lang.reflect.Field;
...@@ -24,7 +22,7 @@ import java.util.stream.Collectors; ...@@ -24,7 +22,7 @@ import java.util.stream.Collectors;
* @createDate 2023-11-22 10:24:31 * @createDate 2023-11-22 10:24:31
*/ */
@Service @Service
@RequiredArgsConstructor//通过构造方法注入 ProductApplication(Class a) { this.a = a; } @RequiredArgsConstructor //通过构造方法注入 ProductApplication(Class a) { this.a = a; }
public class ProductApplicationImpl implements ProductApplication { public class ProductApplicationImpl implements ProductApplication {
private final ProductRepository productRepository; private final ProductRepository productRepository;
...@@ -85,14 +83,14 @@ public class ProductApplicationImpl implements ProductApplication { ...@@ -85,14 +83,14 @@ public class ProductApplicationImpl implements ProductApplication {
// --------------------------------- 详情查询 --------------------------------- // --------------------------------- 详情查询 ---------------------------------
String strProductId = Long.toString(productId); String strProductId = Long.toString(productId);
ProductTypesetConf typesetConf = typesetConfRepository.findByProductId(strProductId);
ProductLooked looked = lookedRepository.findByProductId(strProductId);
ProductPublishedConf publishedConf = publishedConfRepository.findByProductId(strProductId);
ProductLoss loss = lossRepository.findByProductId(strProductId);
ArrayList<ProductMaterial> material = (ArrayList<ProductMaterial>) materialRepository.findByProductId(strProductId); ArrayList<ProductMaterial> material = (ArrayList<ProductMaterial>) materialRepository.findByProductId(strProductId);
resultMap.put("typesetConf", typesetConf); ArrayList<ProductLoss> loss = (ArrayList<ProductLoss>) lossRepository.findByProductId(strProductId);
resultMap.put("looked", looked); Set<Object> entitys = new HashSet<>();
resultMap.put("publishedConf", publishedConf); entitys.add(typesetConfRepository.findByProductId(strProductId));
entitys.add(lookedRepository.findByProductId(strProductId));
entitys.add(publishedConfRepository.findByProductId(strProductId));
resultMap.putAll(assembleResultOfForm(entitys));
resultMap.put("loss", loss); resultMap.put("loss", loss);
resultMap.put("material", material); resultMap.put("material", material);
...@@ -102,13 +100,19 @@ public class ProductApplicationImpl implements ProductApplication { ...@@ -102,13 +100,19 @@ public class ProductApplicationImpl implements ProductApplication {
ProductFace frontFace = faceRepository.findByProductFaceIdEquals(productDetail.getBackProductFaceId()); ProductFace frontFace = faceRepository.findByProductFaceIdEquals(productDetail.getBackProductFaceId());
ProductFaceColor fronColor = faceColorRepository.findByProductFaceIdEquals(productDetail.getBackProductFaceId()); ProductFaceColor fronColor = faceColorRepository.findByProductFaceIdEquals(productDetail.getBackProductFaceId());
resultMap.put("frontFace", frontFace); resultMap.put("frontFace", frontFace);
resultMap.put("fronColor", fronColor); resultMap.put("fronColor", fronColor == null ? new ProductFaceColor() : fronColor);
} else {
ProductFaceColor fc = new ProductFaceColor();
fc.setProductFaceColorId("111");
resultMap.put("fronColor", fc);
} }
if(productDetail.getBackProductFaceId() != null) { if(productDetail.getBackProductFaceId() != null) {
ProductFace backFace = faceRepository.findByProductFaceIdEquals(productDetail.getBackProductFaceId()); ProductFace backFace = faceRepository.findByProductFaceIdEquals(productDetail.getBackProductFaceId());
ProductFaceColor backColor = faceColorRepository.findByProductFaceIdEquals(productDetail.getBackProductFaceId()); ProductFaceColor backColor = faceColorRepository.findByProductFaceIdEquals(productDetail.getBackProductFaceId());
resultMap.put("backFace", backFace); resultMap.put("backFace", backFace);
resultMap.put("backColor", backColor); resultMap.put("backColor", backColor == null ? new ProductFaceColor() : backColor);
} else {
resultMap.put("backColor", new ProductFaceColor());
} }
} }
ObjectMapper mapper = new ObjectMapper(); ObjectMapper mapper = new ObjectMapper();
...@@ -124,6 +128,26 @@ public class ProductApplicationImpl implements ProductApplication { ...@@ -124,6 +128,26 @@ public class ProductApplicationImpl implements ProductApplication {
return resultMap; return resultMap;
} }
/**
* description 返回页面 Form 所需的数据格式
* @param entitys 所有相关的 实体 (如果需要 update,保留这些实体。提交时候用于比较更新值。)
* @return java.util.HashMap<java.lang.String, java.lang.Object>
* @author qinzhenguan
* @create: 2023/12/5 14:09
*/
public Map<String, Object> assembleResultOfForm(Set<Object> entitys) {
Map<String, Object> map = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
map.put("entitys", entitys);
for(Object item : entitys) {
if(item == null) {
continue;
}
map.putAll(mapper.convertValue(item, Map.class));
}
return map;
}
/** /**
* description * description
* @param clazz Bean * @param clazz Bean
...@@ -136,7 +160,7 @@ public class ProductApplicationImpl implements ProductApplication { ...@@ -136,7 +160,7 @@ public class ProductApplicationImpl implements ProductApplication {
*/ */
public Map<Object, Object> convertToMap(Class<?> clazz, String displayProperty, String valueProperty, public Map<Object, Object> convertToMap(Class<?> clazz, String displayProperty, String valueProperty,
List<?> list) { List<?> list) {
Set<String> set = new HashSet(); Set<String> set = new HashSet<>();
set.add(displayProperty); set.add(displayProperty);
set.add(valueProperty); set.add(valueProperty);
if(checkClassesAndProperties(clazz, set, list.size())) { if(checkClassesAndProperties(clazz, set, list.size())) {
......
...@@ -81,12 +81,6 @@ public class ProductController extends CommonController { ...@@ -81,12 +81,6 @@ public class ProductController extends CommonController {
} catch (JsonProcessingException e) { } catch (JsonProcessingException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
String productId= param.get("productId")+"";
Map<String, Object> resultMap = productService.queryDetailAll(Integer.parseInt(productId));
if(resultMap.get("detail") != null) {
resultMap.putAll(mapper.convertValue(resultMap.get("detail"), Map.class));
}
return forward("productDetail", param); return forward("productDetail", param);
} }
...@@ -95,9 +89,6 @@ public class ProductController extends CommonController { ...@@ -95,9 +89,6 @@ public class ProductController extends CommonController {
SDO sdo = this.getSDO(); SDO sdo = this.getSDO();
String productId = sdo.getString("productId"); String productId = sdo.getString("productId");
Map<String, Object> resultMap = productService.queryDetailAll(Integer.parseInt(productId)); Map<String, Object> resultMap = productService.queryDetailAll(Integer.parseInt(productId));
if(resultMap.get("detail") != null) {
resultMap.putAll(mapper.convertValue(resultMap.get("detail"), Map.class));
}
return toResult(resultMap); return toResult(resultMap);
} }
......
...@@ -3,5 +3,8 @@ package com.huigou.topsun.product.repository; ...@@ -3,5 +3,8 @@ package com.huigou.topsun.product.repository;
import com.huigou.topsun.product.domain.Brand; import com.huigou.topsun.product.domain.Brand;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface BrandRepository extends JpaRepository<Brand, String> { public interface BrandRepository extends JpaRepository<Brand, String> {
List<Brand> findByBrandName(String brandName);
} }
...@@ -3,11 +3,14 @@ package com.huigou.topsun.product.repository; ...@@ -3,11 +3,14 @@ package com.huigou.topsun.product.repository;
import com.huigou.topsun.product.domain.ProductLoss; import com.huigou.topsun.product.domain.ProductLoss;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
/** /**
* @Auther: xin.lu * @Auther: xin.lu
* @Date: 2023/11/22/10:42 * @Date: 2023/11/22/10:42
* @Description: * @Description:
*/ */
public interface ProductLossRepository extends JpaRepository<ProductLoss,String> { public interface ProductLossRepository extends JpaRepository<ProductLoss,String> {
ProductLoss findByProductId(String productId); List<ProductLoss> findByProductId(String productId);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment