Commit 8c782c98 by liuyang

2024/03/13 添加生产组和员工下拉联动

parent dad2c8e1
...@@ -235,7 +235,7 @@ public enum DdynamicEnum { ...@@ -235,7 +235,7 @@ public enum DdynamicEnum {
* 用途:用户查询 * 用途:用户查询
* 编写:ly * 编写:ly
*/ */
USER_ID_BLOCK_ID("user_id_block_id","userId","userName","HPXS001.queryUserId"), USER_ID_BLOCK_ID("user_id_block_id","userId","userName","factoryCode","groupCode","HPXS001.queryUserId"),
/** /**
* 模块:系统管理 * 模块:系统管理
......
...@@ -102,4 +102,14 @@ public class ServiceHPXS001 extends ServiceEPBase { ...@@ -102,4 +102,14 @@ public class ServiceHPXS001 extends ServiceEPBase {
new HashMap<String,Object>(){{put("companyCode",companyCode);put("factoryCode",factoryCode);}}); new HashMap<String,Object>(){{put("companyCode",companyCode);put("factoryCode",factoryCode);}});
return inInfo; return inInfo;
} }
public EiInfo queryGroupCode(EiInfo inInfo) {
final String companyCode = UserSessionUtils.getCompanyCode();
String factoryCode = inInfo.getString("factoryCode");
String groupCode = inInfo.getString("groupCode");
CommonMethod.initBlock(inInfo,
Arrays.asList(DdynamicEnum.USER_ID_BLOCK_ID),
new HashMap<String,Object>(){{put("companyCode",companyCode);put("factoryCode",factoryCode);put("groupCode",groupCode);}});
return inInfo;
}
} }
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
PRDT_CODE = #prdtCode# PRDT_CODE = #prdtCode#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="prdtName"> <isNotEmpty prepend=" AND " property="prdtName">
PRDT_NAME = #prdtName# PRDT_NAME LIKE CONCAT('%', #prdtName#, '%')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="weight"> <isNotEmpty prepend=" AND " property="weight">
WEIGHT = #weight# WEIGHT = #weight#
...@@ -302,11 +302,19 @@ ...@@ -302,11 +302,19 @@
<select id="queryUserId" parameterClass="java.util.HashMap" resultClass="java.util.HashMap"> <select id="queryUserId" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
SELECT DISTINCT SELECT DISTINCT
USER_ID as "userId", USER_ID as "userId",
USER_NAME as "userName" USER_NAME as "userName",
FACTORY_CODE AS factoryCode,
GROUP_CODE as "groupCode"
FROM ${hpjxSchema}.T_HPPZ013 WHERE 1=1 and STATUS = '1' FROM ${hpjxSchema}.T_HPPZ013 WHERE 1=1 and STATUS = '1'
<isNotEmpty prepend=" AND " property="companyCode"> <isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode# COMPANY_CODE = #companyCode#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCode">
FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupCode">
GROUP_CODE = #groupCode#
</isNotEmpty>
<dynamic prepend="ORDER BY"> <dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy"> <isNotEmpty property="orderBy">
$orderBy$ $orderBy$
......
...@@ -40,7 +40,6 @@ $(function () { ...@@ -40,7 +40,6 @@ $(function () {
return currShortDate(); return currShortDate();
} }
},{ },{
// 定义子级 column
field: "groupCode", field: "groupCode",
title: "生产组", title: "生产组",
filter: function (options) { filter: function (options) {
...@@ -49,7 +48,23 @@ $(function () { ...@@ -49,7 +48,23 @@ $(function () {
// 返回我们过滤后的数据集 // 返回我们过滤后的数据集
/*return options.values[0][province];*/ /*return options.values[0][province];*/
return _.filter(options.values, function (item) { return _.filter(options.values, function (item) {
return item["factoryCode"]==province; return item["param1Field"]==province;
})
} else {
return [];
}
}
},{
field: "userId",
title: "员工",
filter: function (options) {
var province = options.model['factoryCode'];
var groupCode = options.model['groupCode'];
if(province) {
// 返回我们过滤后的数据集
/*return options.values[0][province];*/
return _.filter(options.values, function (item) {
return item["param1Field"]==province && item["param2Field"]==groupCode;
}) })
} else { } else {
return []; return [];
...@@ -62,26 +77,10 @@ $(function () { ...@@ -62,26 +77,10 @@ $(function () {
grid.dataSource.bind("change", function(e) { grid.dataSource.bind("change", function(e) {
// 判断父级节点是否发生变化 // 判断父级节点是否发生变化
if (e.field == "factoryCode") { if (e.field == "factoryCode") {
// cell_label 表示子级节点 ,that 表示此 grid loadChange(grid,e,"groupCode");
var cell_label = "groupCode",that = grid;
// locked 表示是否为固定列
var locked = that.isCellLocked(cell_label);
// tr 表示 locked 和非 locked 的行,index 表示此行的第几列
var tr,index;
// 获取此 model 元素信息
var item = e.items[0];
var _uid = item.uid;
if (locked) {
tr = $(".k-grid-content-locked tr[data-uid="+ _uid +"]");
index = $("th[data-field='"+cell_label+"']").data("index");
} else {
tr = $(".k-grid-content tr[data-uid="+ _uid +"]");
index = parseInt($("th[data-field='"+cell_label+"']").data("index")) - that.lockedHeader.find("th").length;
} }
// 获取子 cell(td) else if (e.field == "groupCode") {
var td = tr.children("td:eq("+index+")"); loadChange(grid,e,"userId");
// 触发 td.click 事件,
td.trigger("click");
} }
}); });
}, },
...@@ -123,10 +122,33 @@ $(function () { ...@@ -123,10 +122,33 @@ $(function () {
var inInfo=new EiInfo(); var inInfo=new EiInfo();
var factoryCode=$("#inqu_status-0-factoryCode").val(); var factoryCode=$("#inqu_status-0-factoryCode").val();
inInfo.set("factoryCode",factoryCode); inInfo.set("factoryCode",factoryCode);
EiCommunicator.send("HPXS001", "queryComboBox", inInfo, { EiCommunicator.send("HPXS001", "queryFactoryCode", inInfo, {
onSuccess: function (ei) { onSuccess: function (ei) {
var input=$("#inqu_status-0-groupCode"); var input=$("#inqu_status-0-groupCode");
dataEdition=ei.getBlock("productionGroupCode_block_id").getMappedRows(); dataEdition=ei.getBlock("group_code_block_id").getMappedRows();
input.kendoDropDownList({
valuePrimitive: true,
dataTextField: "textField",
dataValueField: "valueField",
optionLabel:"请选择",
dataSource: dataEdition,
template: "#=textField#"
});
}, onFail: function (ei) {
}
}, {async: false});
});
//生产组下拉联动
$('input[name="inqu_status-0-groupCode"]').change(function () {
var inInfo=new EiInfo();
var factoryCode=$("#inqu_status-0-factoryCode").val();
inInfo.set("factoryCode",factoryCode);
var groupCode=$("#inqu_status-0-groupCode").val();
inInfo.set("groupCode",groupCode);
EiCommunicator.send("HPXS001", "queryGroupCode", inInfo, {
onSuccess: function (ei) {
var input=$("#inqu_status-0-userId");
dataEdition=ei.getBlock("user_id_block_id").getMappedRows();
input.kendoDropDownList({ input.kendoDropDownList({
valuePrimitive: true, valuePrimitive: true,
dataTextField: "textField", dataTextField: "textField",
...@@ -322,3 +344,25 @@ function saveDetail(btn) { ...@@ -322,3 +344,25 @@ function saveDetail(btn) {
}); });
} }
} }
function loadChange(grid,e,field) {
var cell_label = field,that = grid;
// locked 表示是否为固定列
var locked = that.isCellLocked(cell_label);
// tr 表示 locked 和非 locked 的行,index 表示此行的第几列
var tr,index;
// 获取此 model 元素信息
var item = e.items[0];
var _uid = item.uid;
if (locked) {
tr = $(".k-grid-content-locked tr[data-uid="+ _uid +"]");
index = $("th[data-field='"+cell_label+"']").data("index");
} else {
tr = $(".k-grid-content tr[data-uid="+ _uid +"]");
index = parseInt($("th[data-field='"+cell_label+"']").data("index")) - that.lockedHeader.find("th").length;
}
// 获取子 cell(td)
var td = tr.children("td:eq("+index+")");
// 触发 td.click 事件,
td.trigger("click");
}
\ No newline at end of file
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
Time: 11:20 Time: 11:20
To change this template use File | Settings | File Templates. To change this template use File | Settings | File Templates.
--%> --%>
<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %> <%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
...@@ -17,13 +18,19 @@ ...@@ -17,13 +18,19 @@
<EF:EFSelect cname="工厂" ename="factoryCode" blockId="inqu_status" row="0" colWidth="3" <EF:EFSelect cname="工厂" ename="factoryCode" blockId="inqu_status" row="0" colWidth="3"
filter="contains" defultValue=""> filter="contains" defultValue="">
<EF:EFOption label="全部" value=""/> <EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="plantCode_block_id" textField="textField" valueField="valueField"/> <EF:EFOptions blockId="factory_code_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect> </EF:EFSelect>
<EF:EFSelect cname="生产组" ename="groupCode" blockId="inqu_status" row="0" colWidth="3" <EF:EFSelect cname="生产组" ename="groupCode" blockId="inqu_status" row="0" colWidth="3"
filter="contains" defultValue=""> filter="contains" defultValue="">
<EF:EFOption label="全部" value=""/> <EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="productionGroupCode_block_id" textField="textField" valueField="valueField"/> <EF:EFOptions blockId="group_code_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect> </EF:EFSelect>
<EF:EFSelect cname="员工" ename="userId" blockId="inqu_status" row="0" colWidth="3"
filter="contains" defultValue="">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="user_id_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFInput cname="产品" blockId="inqu_status" ename="prdtName" row="0" colWidth="3"/>
<EF:EFDateSpan startCname="登记日期" endCname="至" blockId="inqu_status" <EF:EFDateSpan startCname="登记日期" endCname="至" blockId="inqu_status"
startName="createdDateFrom" endName="createdDateTo" row="0" role="date" startName="createdDateFrom" endName="createdDateTo" row="0" role="date"
format="yyyy-MM-dd" satrtRatio="4:8" endRatio="4:8"> format="yyyy-MM-dd" satrtRatio="4:8" endRatio="4:8">
...@@ -41,35 +48,35 @@ ...@@ -41,35 +48,35 @@
<EF:EFColumn ename="companyCode" cname="企业编码" hidden="true"/> <EF:EFColumn ename="companyCode" cname="企业编码" hidden="true"/>
<EF:EFColumn ename="registerDate" cname="登记日期" width="160" align="center" editType="date" readonly="true" <EF:EFColumn ename="registerDate" cname="登记日期" width="160" align="center" editType="date" readonly="true"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/> dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>
<EF:EFComboColumn ename="factoryCode" cname="工厂" blockName="plantCode_block_id" <EF:EFComboColumn ename="factoryCode" cname="工厂" blockName="factory_code_block_id"
columnTemplate="#=textField#" itemTemplate="#=textField#" columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField" textField="textField" valueField="valueField"
maxLength="16" readonly="true" width="120" maxLength="16" readonly="true" width="120" required="true"
align="center" filter="contains" sort="true"> align="center" filter="contains" sort="true">
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFComboColumn ename="groupCode" cname="生产组" blockName="productionGroupCode_block_id" <EF:EFComboColumn ename="groupCode" cname="生产组" blockName="group_code_block_id"
columnTemplate="#=textField#" itemTemplate="#=textField#" columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField" textField="textField" valueField="valueField"
maxLength="16" readonly="true" width="120" maxLength="16" readonly="true" width="120" required="true"
align="center" filter="contains" sort="true"> align="center" filter="contains" sort="true">
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFComboColumn ename="userId" cname="员工" blockName="staff_block_id" <EF:EFComboColumn ename="userId" cname="员工" blockName="user_id_block_id"
columnTemplate="#=textField#" itemTemplate="#=textField#" columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField" textField="textField" valueField="valueField"
maxLength="16" readonly="true" width="100" maxLength="16" readonly="true" width="100" required="true"
align="center" filter="contains" sort="true"> align="center" filter="contains" sort="true">
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFComboColumn ename="groupType" cname="生产类型" <EF:EFComboColumn ename="groupType" cname="生产类型"
columnTemplate="#=textField#" itemTemplate="#=textField#" columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField" textField="textField" valueField="valueField"
maxLength="16" readonly="true" width="100" maxLength="16" readonly="true" width="100" required="true"
align="center" filter="contains" sort="true"> align="center" filter="contains" sort="true">
<EF:EFCodeOption codeName="hpjx.hpjx.productionType" /> <EF:EFCodeOption codeName="hpjx.hpjx.productionType" />
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="prdtName" cname="产品" enable="true" width="160" align="center"/> <EF:EFColumn ename="prdtName" cname="产品" enable="true" width="160" align="center" required="true"/>
<EF:EFColumn ename="weight" cname="产量(T)" width="150" enable="true" format="{0:N3}" editType="text" <EF:EFColumn ename="weight" cname="产量(T)" width="150" enable="true" format="{0:N3}" editType="text"
displayType="0.000" sort="true" align="right" readonly="true" displayType="0.000" sort="true" align="right" readonly="true"
data-regex="/^-?[0-9]{1,16}([.][0-9]{1,3})?$/" maxLength="20" data-regex="/^-?[0-9]{1,16}([.][0-9]{1,3})?$/" maxLength="20" required="true"
data-errorprompt="请输入数字,该值最大可设置17位整数和3位小数!" data-errorprompt="请输入数字,该值最大可设置17位整数和3位小数!"
/> />
<EF:EFColumn ename="remark" cname="备注" enable="true" width="200"/> <EF:EFColumn ename="remark" cname="备注" enable="true" width="200"/>
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
Time: 14:06 Time: 14:06
To change this template use File | Settings | File Templates. To change this template use File | Settings | File Templates.
--%> --%>
<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %> <%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
......
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