Commit 8b937322 authored by 全洪江's avatar 全洪江

客户信息列表展示

parent 260f4ee1
var gridManager = null;
$(document).ready(function() {
initializationUI();
loadCustomerListGrid();
});
function initializationUI() {
UICtrl.layout("#layout",{leftWidth: 3});
}
function loadCustomerListGrid() {
var toolbarOptions = UICtrl.getDefaultToolbarOptions({
updateHandler: function(){
updateHandler();
}
});
gridManager = UICtrl.grid("#customerInfoListGrid", {
columns: [
{ display: "客户编码", name: "customerCode", width: 100, minWidth: 60, type: "string", align: "left" },
{ display: "客户名称", name: "customerShortName", width: 120, minWidth: 60, type: "string", align: "left" },
// { display: "客户工作时间", name: "customerWorkTime", width: 120, minWidth: 60, type: "datetime", align: "left" },
{ display: "客户英文名称", name: "customerEnName", width: 120, minWidth: 60, type: "string", align: "left" },
{ display: "客户英文名称简称", name: "customer_en_short_name", width: 100, minWidth: 60, type: "string", align: "left" },
{ display: "所属地区", name: "provinceId", width: 150, minWidth: 60, type: "string", align: "left" }
// { display: "客户等级", name: "customerLevel", width: 100, minWidth: 60, type: "string", align: "left" },
// { display: "工厂代号", name: "customerFactoryCode", width: 140, minWidth: 60, type: "string", align: "left" },
// { display: "地址", name: "customer_address", width: 140, minWidth: 60, type: "string", align: "left" },
// { display: "所属集团", name: "customerGroup", width: 140, minWidth: 60, type: "string", align: "left" },
// { display: "邮编", name: "customerZipCode", width: 140, minWidth: 60, type: "string", align: "left" }
],
dataType: "server",
url: web_app.name + '/customer/findCustomerInfo.ajax',
pageSize: 20,
usePager: true,
toolbar: toolbarOptions,
width: "50%",
height: "100%",
heightDiff: -8,
checkbox: true,
fixedCellHeight: true,
selectRowButtonOnly: true,
onDblClickRow : function(data, rowindex, rowobj) {
updateHandler(data);
}
});
UICtrl.setSearchAreaToggle(gridManager);
}
// parms: {
// page: 0,
// size: 30
// },
function updateHandler(data) {
var id = data.customerId;
if (!id) {
id = DataUtil.getUpdateRowId(gridManager);
if (!id) {
return;
}
}
var url=DataUtil.composeURLByParam('/customer/forwardCustomerInfoDetails.do',{ data: JSON.stringify(data) });
UICtrl.addTabItem({tabid:'viewFlowChart' + id, text:"客户详细信息",url:url});
// debugger;
// UICtrl.addTabItem({
// tabid: 'viewFlowChart' + id,
// text: "产品信息",
// url: web_app.name + '/bizFlowChart/showViewFlowchart.load?businessProcessId=' + id
// });
}
var gridManager = null;
$(document).ready(function () {
initializateUI();
loadCustomerInfoListGrid();
});
function initializateUI() {
UICtrl.layout("#layout", {leftWidth: 3});
}
function loadCustomerInfoListGrid() {
var toolbarOptions = UICtrl.getDefaultToolbarOptions({
addHandler: function () {
addHandler();
},
updateHandler: function () {
updateHandler();
},
deleteHandler: function () {
updateHandler();
}
});
gridManager = UICtrl.grid("#customerInfoListGrid", {
columns: [
{display: "客户编码", name: "customerCode", width: 120, minWidth: 60, type: "string", align: "left"},
{display: "客户名称", name: "customerShortName", width: 120, minWidth: 60, type: "string", align: "left"},
{display: "客户英文名称", name: "customerEnName", width: 140, minWidth: 60, type: "string", align: "left"},
{display: "客户英文名称简称", name: "customerEnShortName", width: 160, minWidth: 60, type: "string", align: "left"},
{display: "客户工作时间", name: "customerWorkTime", width: 120, minWidth: 60, type: "datetime", align: "left"},
{display: "客户等级", name: "customerLevel", width: 120, minWidth: 60, type: "string", align: "left"},
{display: "工厂代号", name: "customerFactoryCode", width: 120, minWidth: 60, type: "string", align: "left"},
{display: "地址", name: "customerAddress", width: 160, minWidth: 60, type: "string", align: "left"},
{display: "所属集团", name: "customerGroup", width: 120, minWidth: 60, type: "string", align: "left"},
{display: "邮编", name: "customerZipCode", width: 120, minWidth: 60, type: "string", align: "left"},
],
dataAction: "server",
url: web_app.name + '/customer/findCustomer.ajax',
pageSize: 20,
usePager: true,
toolbar: toolbarOptions,
width: "100%",
height: "100%",
heightDiff: -8,
checkbox: true,
fixedCellHeight: true,
selectRowButtonOnly: true,
onDblClickRow: function (data, rowindex, rowobj) {
doView(data);
}
});
UICtrl.setSearchAreaToggle(gridManager);
}
function query(obj) {
var param = $(obj).formToJSON();
UICtrl.gridSearch(gridManager, param);
}
function reloadGrid() {
gridManager.loadData();
}
function resetForm(obj) {
$(obj).formClean();
}
//删除按钮
function deleteHandler() {
DataUtil.del({
action: 'proofingMake/deleteProofingMakeByProofingMakeId.ajax',
gridManager: gridManager, idFieldName: 'proofingMakeId',
onSuccess: function () {
reloadGrid();
}
});
}
// parms: {
// page: 0,
// size: 30
// },
function doView(data) {
var id = data.customerId;
if (!id) {
id = DataUtil.getUpdateRowId(gridManager);
if (!id) {
return;
}
}
var url = DataUtil.composeURLByParam('/customer/forwardCustomerDetail.do', {id: JSON.stringify(id)});
UICtrl.addTabItem({tabid: 'viewFlowChart' + id, text: "客户详细信息", url: url});
// debugger;
// UICtrl.addTabItem({
// tabid: 'viewFlowChart' + id,
// text: "产品信息",
// url: web_app.name + '/bizFlowChart/showViewFlowchart.load?businessProcessId=' + id
// });
}
...@@ -7,13 +7,29 @@ ...@@ -7,13 +7,29 @@
<x:base include="layout,dialog,grid,tree,combox,commonTree" /> <x:base include="layout,dialog,grid,tree,combox,commonTree" />
<x:script src='/system/opm/js/OpmUtil.js'/> <x:script src='/system/opm/js/OpmUtil.js'/>
<x:script src='/biz/topsun/common/purchaseCommon.js'/> <x:script src='/biz/topsun/common/purchaseCommon.js'/>
<x:script src='/biz/topsun/customer/customerInfoList.js'/> <x:script src='/biz/topsun/customer/customerList.js'/>
</head> </head>
<body> <body>
<div position="center" title="客户信息管理"> <div class="container-fluid">
<div class="ui-hide">
<x:select name="processType" dictionary="processType"/>
<x:select name="yesorno" dictionary="yesorno"/>
</div>
<div id="layout">
<div position="center" title="客户信息管理">
<x:title title="common.button.search" hideTable="queryMainForm" isHide="true"/>
<%--查询表单--%>
<form class="hg-form ui-hide" method="post" action="" id="queryMainForm">
<x:inputC name="ruleKind" required="false" label="客户名称" labelCol="1"/>
<x:searchButtons/>
</form>
<div class="blank_div clearfix"></div>
<div id="customerInfoListGrid" style="margin: 2px;"></div> <div id="customerInfoListGrid" style="margin: 2px;"></div>
</div>
</div>
</div> </div>
</body> </body>
</html> </html>
package com.huigou.topsun.customer.application; package com.huigou.topsun.customer.application;
import com.huigou.topsun.customer.domain.query.CustomerQueryRequest;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* 分页查询客户信息数据 * 分页查询客户信息数据
*/ */
public interface CustomerInfoApplication { public interface CustomerApplication {
List<Map<String, Object>> findCustomerInfoPage(int page, int size); Map<String, Object> findCustomerByPage(CustomerQueryRequest customerQueryRequest);
} }
package com.huigou.topsun.customer.application; package com.huigou.topsun.customer.application;
import com.huigou.topsun.customer.domain.Province; import com.huigou.topsun.customer.domain.vo.Province;
import java.util.List; import java.util.List;
......
package com.huigou.topsun.customer.application.Impl;
import com.huigou.cache.DictUtil;
import com.huigou.data.query.model.QueryDescriptor;
import com.huigou.data.query.model.QueryModel;
import com.huigou.topsun.customer.application.CustomerApplication;
import com.huigou.topsun.customer.domain.query.CustomerQueryRequest;
import com.huigou.topsun.customer.repository.CustomerRepository;
import com.huigou.uasp.bmp.common.application.BaseApplication;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
@Service
public class CustomerApplicationImpl extends BaseApplication implements CustomerApplication {
public static final String QUERY_XML_FILE_PATH = "config/topsun/customer/customerMapper.xml";
@Autowired
private CustomerRepository customerRepository;
/**
* 分页查询客户信息数据
* @param customerQueryRequest
* @return
*/
@Override
public Map<String, Object> findCustomerByPage(CustomerQueryRequest customerQueryRequest) {
QueryDescriptor queryDescriptor = this.sqlExecutorDao.getQuery(QUERY_XML_FILE_PATH, "customerList");
QueryModel model = this.sqlExecutorDao.getQueryModel(queryDescriptor, customerQueryRequest);
model.putDictionary("processType", DictUtil.getDictionary("processType"));
return this.sqlExecutorDao.executeSlicedQuery(model);
}
}
package com.huigou.topsun.customer.application.Impl; package com.huigou.topsun.customer.application.Impl;
import com.huigou.topsun.customer.application.CustomerBaseInfoApplication; import com.huigou.topsun.customer.application.CustomerBaseInfoApplication;
import com.huigou.topsun.customer.domain.Province; import com.huigou.topsun.customer.domain.vo.Province;
import com.huigou.topsun.customer.repository.ProvinceRepository; import com.huigou.topsun.customer.repository.ProvinceRepository;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
......
package com.huigou.topsun.customer.application.Impl;
import com.huigou.topsun.customer.application.CustomerInfoApplication;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
@Service
public class CustomerInfoApplicationImpl implements CustomerInfoApplication {
/**
* 分页查询客户信息数据
* @param page
* @param size
* @return
*/
@Override
public List<Map<String, Object>> findCustomerInfoPage(int page, int size) {
return null;
}
}
package com.huigou.topsun.customer.controller; package com.huigou.topsun.customer.controller;
import com.huigou.topsun.customer.application.CustomerBaseInfoApplication; import com.huigou.topsun.customer.application.CustomerBaseInfoApplication;
import com.huigou.topsun.customer.application.CustomerInfoApplication; import com.huigou.topsun.customer.application.CustomerApplication;
import com.huigou.topsun.customer.domain.Province; import com.huigou.topsun.customer.domain.query.CustomerQueryRequest;
import com.huigou.topsun.customer.domain.vo.Province;
import com.huigou.uasp.annotation.ControllerMapping; import com.huigou.uasp.annotation.ControllerMapping;
import com.huigou.uasp.client.CommonController; import com.huigou.uasp.client.CommonController;
import com.huigou.util.SDO; import com.huigou.util.SDO;
...@@ -18,12 +19,12 @@ import java.util.stream.Collectors; ...@@ -18,12 +19,12 @@ import java.util.stream.Collectors;
@Controller @Controller
@ControllerMapping("/customerInfo") @ControllerMapping("/customer")
public class CustomerInfoController extends CommonController { public class CustomerController extends CommonController {
@Autowired @Autowired
private CustomerBaseInfoApplication customerBaseInfoApplication; private CustomerBaseInfoApplication customerBaseInfoApplication;
@Autowired @Autowired
private CustomerInfoApplication customerInfoApplication; private CustomerApplication customerApplication;
@Override @Override
protected String getPagePath() { protected String getPagePath() {
...@@ -34,42 +35,37 @@ public class CustomerInfoController extends CommonController { ...@@ -34,42 +35,37 @@ public class CustomerInfoController extends CommonController {
* 转跳到客户信息列表页面 * 转跳到客户信息列表页面
* @return * @return
*/ */
public String forwardCustomerInfoList() { public String forwardCustomerList() {
return forward("customerInfoList"); return forward("customerList");
} }
/** /**
* 展示客户信息列表 * 分页展示客户信息列表
* @return * @return
*/ */
public String findCustomerInfo() { public String findCustomer() {
List<Map<String,Object>> customerInfoPage = customerInfoApplication.findCustomerInfoPage(0,30); SDO sdo = this.getSDO();
HashMap<Object, Object> map = new HashMap<>(3); CustomerQueryRequest customerQueryRequest = sdo.toQueryRequest(CustomerQueryRequest.class);
map.put("Rows",customerInfoPage);
return toResult(map);
}
/** return toResult(customerApplication.findCustomerByPage(customerQueryRequest));
* 转跳到客户列表页面
* @return
*/
public String forwardCustomerInfo() {
return forward("customerInfoList");
} }
/** /**
* 转跳到客户详细信息页面 * 转跳到客户详细信息页面
* @return * @return
*/ */
public String forwardCustomerDetail() { public String forwardCustomerDetail() {
return forward("customerInfoDetail");
return forward("customerDetail");
} }
/** /**
* 展示客户省市数据,如果客户的省份编码是省级行政单位,直接返回省份数据, * 展示客户省市数据,如果客户的省份编码是省级行政单位,直接返回省份数据,
* 如果客户的省份编码是二级或者三级行政单位,则需要返回对应的省级或者市级行政单位 * 如果客户的省份编码是二级或者三级行政单位,则需要返回对应的省级或者市级行政单位
* @return * @return
*/ */
public String findProvinceInfo() { public String findProvince() {
SDO sdo = this.getSDO(); SDO sdo = this.getSDO();
//获取省份编码 //获取省份编码
String provinceCode = sdo.getString("provinceCode"); String provinceCode = sdo.getString("provinceCode");
......
package com.huigou.topsun.customer.domain.query;
import com.huigou.data.domain.query.QueryAbstractRequest;
import java.util.Date;
public class CustomerQueryRequest extends QueryAbstractRequest {
/**
* 客户id
*/
private String customerId;
/**
* 客户编码
*/
private String customerCode;
/**
* 客户全称
*/
private String customerName;
/**
* 客户简称
*/
private String customerShortName;
/**
* 客户工作时间
*/
private Date customerWorkTime;
/**
* 客户英文名称
*/
private String customerEnName;
/**
* 客户英文名称简称
*/
private String customerEnShortName;
/**
* 省份编码
*/
private String provinceId;
/**
* 客户等级
*/
private String customerLevel;
/**
* 工厂代号
*/
private String customerFactoryCode;
/**
* 地址
*/
private String customerAddress;
/**
* 所属集团
*/
private String customerGroup;
/**
* 邮编
*/
private String customerZipCode;
public String getCustomerId() {
return customerId;
}
public void setCustomerId(String customerId) {
this.customerId = customerId;
}
public String getCustomerCode() {
return customerCode;
}
public void setCustomerCode(String customerCode) {
this.customerCode = customerCode;
}
public String getCustomerName() {
return customerName;
}
public void setCustomerName(String customerName) {
this.customerName = customerName;
}
public String getCustomerShortName() {
return customerShortName;
}
public void setCustomerShortName(String customerShortName) {
this.customerShortName = customerShortName;
}
public Date getCustomerWorkTime() {
return customerWorkTime;
}
public void setCustomerWorkTime(Date customerWorkTime) {
this.customerWorkTime = customerWorkTime;
}
public String getCustomerEnName() {
return customerEnName;
}
public void setCustomerEnName(String customerEnName) {
this.customerEnName = customerEnName;
}
public String getCustomerEnShortName() {
return customerEnShortName;
}
public void setCustomerEnShortName(String customerEnShortName) {
this.customerEnShortName = customerEnShortName;
}
public String getProvinceId() {
return provinceId;
}
public void setProvinceId(String provinceId) {
this.provinceId = provinceId;
}
public String getCustomerLevel() {
return customerLevel;
}
public void setCustomerLevel(String customerLevel) {
this.customerLevel = customerLevel;
}
public String getCustomerFactoryCode() {
return customerFactoryCode;
}
public void setCustomerFactoryCode(String customerFactoryCode) {
this.customerFactoryCode = customerFactoryCode;
}
public String getCustomerAddress() {
return customerAddress;
}
public void setCustomerAddress(String customerAddress) {
this.customerAddress = customerAddress;
}
public String getCustomerGroup() {
return customerGroup;
}
public void setCustomerGroup(String customerGroup) {
this.customerGroup = customerGroup;
}
public String getCustomerZipCode() {
return customerZipCode;
}
public void setCustomerZipCode(String customerZipCode) {
this.customerZipCode = customerZipCode;
}
}
package com.huigou.topsun.customer.domain.vo;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;
import lombok.Data;
import org.hibernate.annotations.GenericGenerator;
/**
* 客户基础信息
* @TableName customer
*/
@Table(name="customer")
@Data
@Entity
public class Customer implements Serializable {
/**
* 客户id
*/
@Id
@GeneratedValue(generator = "system-uuid")
@GenericGenerator(name = "system-uuid", strategy = "guid")
@Column(name = "province_id")
private String customerId;
/**
* 客户编码
*/
@Column(name = "customer_code")
private String customerCode;
/**
* 客户全称
*/
@Column(name = "customer_name")
private String customerName;
/**
* 客户简称
*/
@Column(name = "customer_short_name")
private String customerShortName;
/**
* 客户工作时间
*/
@Column(name = "customer_work_time")
private Date customerWorkTime;
/**
* 客户英文名称
*/
@Column(name = "customer_en_name")
private String customerEnName;
/**
* 客户英文名称简称
*/
@Column(name = "customer_en_short_name")
private String customerEnShortName;
/**
* 省份编码
*/
@Column(name = "province_code")
private String provinceCode;
/**
* 客户等级
*/
@Column(name = "customer_level")
private String customerLevel;
/**
* 工厂代号
*/
@Column(name = "customer_factory_code")
private String customerFactoryCode;
/**
* 地址
*/
@Column(name = "customer_address")
private String customerAddress;
/**
* 所属集团
*/
@Column(name = "customer_group")
private String customerGroup;
/**
* 邮编
*/
@Column(name = "customer_zip_code")
private String customerZipCode;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.huigou.topsun.customer.domain; package com.huigou.topsun.customer.domain.vo;
import java.io.Serializable; import java.io.Serializable;
import javax.persistence.*; import javax.persistence.*;
......
package com.huigou.topsun.customer.repository;
import com.huigou.topsun.customer.domain.vo.Customer;
import org.springframework.data.jpa.repository.JpaRepository;
public interface CustomerRepository extends JpaRepository<Customer,String> {
}
package com.huigou.topsun.customer.repository; package com.huigou.topsun.customer.repository;
import com.huigou.topsun.customer.domain.Province; import com.huigou.topsun.customer.domain.vo.Province;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
......
<?xml version="1.0" encoding="UTF-8" ?>
<query-mappings>
<query name="customerList" label="客户信息表" table="customer">
<sql-query>
select c.* from customer c where 1=1
</sql-query>
<condition column="customer_name" name="customerName" type="java.lang.String" symbol="like" alias="c"/>
</query>
</query-mappings>
\ 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