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

23-12-8: Class 调整。 调整传输数据格式。

parent 28ea8694
var rawData={};
$(document).ready(function() {
initializeUI();
initializeToobarContainer();
......@@ -25,7 +25,6 @@ function initializeUI() {
});
}
function loadDataTest() {
console.log("loadData")
var params = new URLSearchParams(document.location.search);
......@@ -33,6 +32,7 @@ function loadDataTest() {
Public.ajax(web_app.name + "/product/loadProductDetail.ajax", {
productId: paramsData.productId
}, function (data) {
rawData = data;
$('#submitForm').formSet(data);
var fronData = {};
fronData.Rows = data.fronColors;
......@@ -53,7 +53,6 @@ function faceGrid(elId, data) {
}
}
});
debugger;
var gridManager = UICtrl.grid(elId, {
columns: [
{ display: "颜色名称", name: "productFaceColorId", width: 140, minWidth: 60, type: "string", align: "left" },
......@@ -71,12 +70,32 @@ function faceGrid(elId, data) {
});
}
function save() {
$('#submitForm').ajaxSubmit({
url: web_app.name + '/product/saveProductAndDetail.ajax',
param:{ rawData: JSON.stringify(rawData) },
success: function(data) {
debugger;
}
});
}
function initializeToobarContainer(){
$('#toolBarCenter').attr('position','bottom');
var toolBarOptions= {
dropup: $('#toolBar').data('dropup') === true,//显示更多按钮时 是否向上打开菜单
items: [{
id: 'save',
remark: '保存',
name: 'common.button.save',
icon: 'fa-save',
delay: true,
relation: 'advance',
event: save
}]
};
$('#toolBar').toolBar(toolBarOptions);
//dropup==true 更多按钮向上展示
$('#toolBar').data('dropup',true).removeClass('job-button-fixed-top').addClass('job-button-fixed-bottom');
UICtrl.layout($("#jobPageLayout"), {heightDiff:-2,topHeight:40,bottomHeight:40,onSizeChanged:function(){
}});
}
// checkbox: true,
// enabledSort: false,
......
......@@ -8,24 +8,13 @@
<%@ page language="java" contentType="text/html; charset=utf-8"%>
<%@taglib uri="/WEB-INF/taglib.tld" prefix="x"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<head>
<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'/>
</head>
<html>
<body>
<div class="container-fluid" style="position: relative; display: inline-flex; flex-direction: column; height: 97%;
background-color: #f3f3f4 !important;" >
<%-- style="position: relative; display: inline-flex; flex-direction: column;"--%>
<%-- <x:hidden name="productDetailId" />--%>
<%-- <x:hidden name="productId"/>--%>
<div class="panelX" id="panelContainer" >
<x:hidden name="productDetailId" />
<%-- <div class="hg-form-cols">--%>
<%-- <div labelCol="15"> </div>--%>
<%-- </div>--%>
<%-- style="overflow: 98vh;"--%>
<form class="hg-form" method="post" action="" id="submitForm">
<div class="hg-form-row">
<x:title title="基本属性" name="group" hideTable="#info" />
......@@ -79,17 +68,46 @@
</div>
</form>
<div id="toolBarCenter" class="footer" style="background: none repeat scroll 0 0 #fff; border-top: 1px solid #e7eaec;
position: absolute; bottom: 0; width: 100%; display:flex; justify-content:center;">
<%-- style=""--%>
<div id='toolBar' checkAccess="false">
<a> aaa </a>
</div>
<div id="toolBarCenter" class="panel-footerX" >
<div id="toolBar"></div>
</div>
</div>
</body>
<head>
<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'/>
<style>
.panelX{
height: 98%;
width: 100%;
padding: 5px;
position: relative;
display: inline-flex;
flex-direction: column;
/*background-color: #f3f3f4 !important;*/
}
.panelX > div:first-child { margin-bottom: 38px; }
.panelX > form { margin-bottom: 38px; }
.panel-footerX {
width: 100%;
left: -1px;
bottom: 0;
padding: 1px 99px;
position: fixed;
display:flex;
justify-content:center;
background: none repeat scroll 0 0 #fff0;
/*border-top: 1px solid #e7eaec;*/
/*background: none repeat scroll 0 0 #fff;*/
}
.panel-footerX > div { margin: 2px; }
</style>
</head>
</html>
......@@ -4,6 +4,7 @@ import com.huigou.topsun.product.domain.Product;
import org.springframework.data.domain.Page;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -20,7 +21,7 @@ public interface ProductApplication {
* @param size 页大小
* @return org.springframework.data.domain.Page<com.huigou.topsun.product.domain.Product>
* @author qinzhenguan
* @create: 2023/11/29 9:34
* @createDate 2023/11/29 9:34
*/
ArrayList<Map<String, Object>> findProductPage(int page, int size);
......@@ -29,7 +30,17 @@ public interface ProductApplication {
* @param productId 产品ID
* @return java.util.Map<java.lang.String, java.lang.Object>
* @author qinzhenguan
* @create: 2023/11/29 9:33
* @createDate 2023/11/29 9:33
*/
Map<String, Object> queryDetailAll(int productId);
/**
* description 对比所有对象,并保存更改的数据。
* @param rawMap 原数据
* @param updateMap 提交的数据
* @return java.util.HashMap<java.lang.String, java.lang.Object>
* @author qinzhenguan
* @createDate 2023/12/8 17:19
*/
HashMap<String, Object> saveProductAndDetail(HashMap<String, Object> rawMap, HashMap<String, Object> updateMap);
}
package com.huigou.topsun.product.controller;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.huigou.cache.DictUtil;
import com.huigou.topsun.base.coderule.domain.model.CodeRuleKind;
import com.huigou.topsun.product.domain.Product;
import com.huigou.topsun.product.application.ProductApplication;
import com.huigou.topsun.resource.vo.ResourceFiledVo;
import org.springframework.data.domain.Page;
import com.huigou.uasp.annotation.ControllerMapping;
import com.huigou.uasp.client.CommonController;
import com.huigou.util.SDO;
......@@ -16,14 +13,13 @@ import org.springframework.stereotype.Controller;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* ProductController
*
* @author qinzhenguan
* @date 2023/11/27 11:19
* @createDate 2023/11/27 11:19
**/
@Controller
@ControllerMapping("/product")
......@@ -40,15 +36,12 @@ public class ProductController extends CommonController {
/**
* description
* @author qinzhenguan
* @date 2023/11/27 11:49
* @createDate 2023/11/27 11:49
* @return null
*/
public String findProduct() {//需要特定类型返回值
SDO sdo = this.getSDO();
// int page = sdo.getInteger("page");
// int size = sdo.getInteger("size");
ArrayList<Map<String,Object>> productPage = productService.findProductPage(0, 30);
HashMap<Object, Object> map = new HashMap<>();
HashMap<Object, Object> map = new HashMap<>(3);
map.put("Rows",productPage);
return toResult(map);
}
......@@ -63,7 +56,7 @@ public class ProductController extends CommonController {
public String forwardProduct() {
// 通过此方法可以查看系统配置的 字典 的数据结构
DictUtil.getDictionaryList("technologyType");
Map<String, Object> map4 = new HashMap<>();
Map<String, Object> map4 = new HashMap<>(10);
map4.put("六六六", "666");
map4.put("七七七", "777");
map4.put("八八八", "888");
......@@ -74,9 +67,9 @@ public class ProductController extends CommonController {
public String forwardProductDetail() {
ObjectMapper mapper = new ObjectMapper();
SDO sdo = this.getSDO();
Map param = null;
HashMap<String, Object> param;
try {
param = mapper.readValue(sdo.getString("data"), Map.class);
param = mapper.readValue(sdo.getString("data"), new TypeReference<HashMap<String, Object>>() {});
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
......@@ -84,13 +77,24 @@ public class ProductController extends CommonController {
}
public String loadProductDetail() {
ObjectMapper mapper = new ObjectMapper();
SDO sdo = this.getSDO();
String productId = sdo.getString("productId");
Map<String, Object> resultMap = productService.queryDetailAll(Integer.parseInt(productId));
return toResult(resultMap);
}
public String saveProductAndDetail() throws JsonProcessingException {
ObjectMapper mapper = new ObjectMapper();
SDO sdo = this.getSDO();
String updateJson = sdo.toString();
HashMap<String,Object> updateMap = mapper.readValue(updateJson, new TypeReference<HashMap<String,Object>>() {});
HashMap<String,Object> rawMap = mapper.readValue(updateMap.get("rawData") + "", new TypeReference<HashMap<String,Object>>() {});
updateMap.remove("rawData");
HashMap<String,Object> resultMap = productService.saveProductAndDetail(rawMap, updateMap);
return success(resultMap);
}
}
\ No newline at end of file
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