Commit 6a702e44 by liuyang

2024-05-09 设备计划

parent 28720284
...@@ -168,8 +168,8 @@ public enum DdynamicEnum { ...@@ -168,8 +168,8 @@ public enum DdynamicEnum {
*/ */
PROCESS_CODE_BLOCK_ID("processCode_block_id","processCode","processName","factoryCode","factoryName","unit","HGSJ001.queryProcessCode"), PROCESS_CODE_BLOCK_ID("processCode_block_id","processCode","processName","factoryCode","factoryName","unit","HGSJ001.queryProcessCode"),
/** /**
* 模块:工序编码 * 模块:设备台账编码
* 用途:工序编码下拉框 * 用途:设备区域下拉框
* 编写:ly * 编写:ly
*/ */
GROUP_CODE_BOX_BLOCK_ID("groupCodeBox_block_id","orgEname","orgCname","factoryCode","factoryName","companyCode","companyName","HGSB001.queryGroupCodeBox", GROUP_CODE_BOX_BLOCK_ID("groupCodeBox_block_id","orgEname","orgCname","factoryCode","factoryName","companyCode","companyName","HGSB001.queryGroupCodeBox",
...@@ -179,6 +179,7 @@ public enum DdynamicEnum { ...@@ -179,6 +179,7 @@ public enum DdynamicEnum {
put("orgTypes",new String[]{OrgTypeEnum.COMPANY.getCode(),OrgTypeEnum.FACTORY.getCode()}); put("orgTypes",new String[]{OrgTypeEnum.COMPANY.getCode(),OrgTypeEnum.FACTORY.getCode()});
}} }}
), ),
DEVICE_CODE_BOX_BLOCK_ID("deviceCodeBox_block_id","deviceCode","deviceName","deviceType","HGSB001.queryDeviceCodeBox"),
; ;
......
...@@ -71,10 +71,10 @@ public class HGSB002 extends DaoEPBase { ...@@ -71,10 +71,10 @@ public class HGSB002 extends DaoEPBase {
public static final String COL_PLAN_USER_NAME = "PLAN_USER_NAME"; /* 计划人名称*/ public static final String COL_PLAN_USER_NAME = "PLAN_USER_NAME"; /* 计划人名称*/
public static final String COL_PLAN_STATUS = "PLAN_STATUS"; /* 审批状态 0-停止 1-启用*/ public static final String COL_PLAN_STATUS = "PLAN_STATUS"; /* 审批状态 0-停止 1-启用*/
public static final String QUERY = "hgsb002.query"; public static final String QUERY = "HGSB002.query";
public static final String COUNT = "hgsb002.count"; public static final String COUNT = "HGSB002.count";
public static final String INSERT = "hgsb002.insert"; public static final String INSERT = "HGSB002.insert";
public static final String UPDATE = "hgsb002.update"; public static final String UPDATE = "HGSB002.update";
public static final String UPDATE_STATUS = "HGSB002.updateStatus"; public static final String UPDATE_STATUS = "HGSB002.updateStatus";
public static final String DELETE = "HGSB002.delete"; public static final String DELETE = "HGSB002.delete";
public static final String DELETE_FLAG = "HGSB002.deleteFlag"; public static final String DELETE_FLAG = "HGSB002.deleteFlag";
......
package com.baosight.hggp.hg.sb.service; package com.baosight.hggp.hg.sb.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation; import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.constant.CommonConstant; import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.sb.domain.HGSB001;
import com.baosight.hggp.hg.sb.domain.HGSB002A; import com.baosight.hggp.hg.sb.domain.HGSB002A;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.ErrorCodeUtils; import com.baosight.hggp.util.ErrorCodeUtils;
import com.baosight.hggp.util.LogUtils; import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.contants.ACConstants; import com.baosight.hggp.util.contants.ACConstants;
...@@ -15,6 +18,8 @@ import com.baosight.iplat4j.core.resource.I18nMessages; ...@@ -15,6 +18,8 @@ import com.baosight.iplat4j.core.resource.I18nMessages;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase; import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator; import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -26,7 +31,18 @@ public class ServiceHGSB002A extends ServiceEPBase { ...@@ -26,7 +31,18 @@ public class ServiceHGSB002A extends ServiceEPBase {
@Override @Override
public EiInfo initLoad(EiInfo inInfo) { public EiInfo initLoad(EiInfo inInfo) {
return super.initLoad(inInfo); inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGSB002A.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
String companyCode = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0,HGSB001.FIELD_COMPANY_CODE);
String groupCode = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0,HGSB002A.FIELD_GROUP_CODE);
inInfo = super.query(inInfo, HGSB002A.QUERY, new HGSB002A());
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.GROUP_CODE_BOX_BLOCK_ID),null);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.DEVICE_CODE_BOX_BLOCK_ID),
new HashMap<String,Object>(){{
put(HGSB001.FIELD_COMPANY_CODE,companyCode);
put(HGSB002A.FIELD_GROUP_CODE,groupCode);
put(HGSB002A.FIELD_DELETE_FLAG,CommonConstant.YesNo.NO_0);}}
);
return inInfo;
} }
@Override @Override
...@@ -69,6 +85,7 @@ public class ServiceHGSB002A extends ServiceEPBase { ...@@ -69,6 +85,7 @@ public class ServiceHGSB002A extends ServiceEPBase {
HGSB002A hgsb002a = new HGSB002A(); HGSB002A hgsb002a = new HGSB002A();
hgsb002a.fromMap(resultRows.get(i)); hgsb002a.fromMap(resultRows.get(i));
if (hgsb002a.getId() == null || hgsb002a.getId() == 0) { if (hgsb002a.getId() == null || hgsb002a.getId() == 0) {
hgsb002a.setParentId(Long.valueOf(inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGSB002A.FIELD_PARENT_ID)));
this.add(hgsb002a); this.add(hgsb002a);
} else { } else {
this.modify(hgsb002a); this.modify(hgsb002a);
......
...@@ -340,6 +340,15 @@ ...@@ -340,6 +340,15 @@
ID = #id# ID = #id#
</update> </update>
<select id="queryDeviceCodeBox" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
SELECT distinct
DEVICE_CODE as "deviceCode", <!-- 设备编码 -->
DEVICE_NAME as "deviceName", <!-- 设备名称 -->
DEVICE_TYPE as "deviceType" <!-- 设备类型 -->
FROM ${hggpSchema}.HGSB001 WHERE 1=1
<include refid="condition" />
</select>
<select id="queryGroupCodeBox" parameterClass="java.util.HashMap" resultClass="java.util.HashMap"> <select id="queryGroupCodeBox" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
SELECT distinct SELECT distinct
ORG_ENAME AS "orgEname", ORG_ENAME AS "orgEname",
......
...@@ -164,7 +164,7 @@ ...@@ -164,7 +164,7 @@
$orderBy$ $orderBy$
</isNotEmpty> </isNotEmpty>
<isEmpty property="orderBy"> <isEmpty property="orderBy">
PLAN_DATE desc,ID asc PLAN_DATE desc,CREATED_TIME desc ,ID asc
</isEmpty> </isEmpty>
</dynamic> </dynamic>
......
...@@ -140,7 +140,7 @@ ...@@ -140,7 +140,7 @@
$orderBy$ $orderBy$
</isNotEmpty> </isNotEmpty>
<isEmpty property="orderBy"> <isEmpty property="orderBy">
CREATED_NAME desc,ID asc CREATED_TIME desc,ID asc
</isEmpty> </isEmpty>
</dynamic> </dynamic>
......
...@@ -2,6 +2,7 @@ $(function () { ...@@ -2,6 +2,7 @@ $(function () {
var companyCodeBox = __eiInfo.getBlock("companyBox_block_id").getMappedRows(); var companyCodeBox = __eiInfo.getBlock("companyBox_block_id").getMappedRows();
var groupCodeBox = __eiInfo.getBlock("groupCodeBox_block_id").getMappedRows(); var groupCodeBox = __eiInfo.getBlock("groupCodeBox_block_id").getMappedRows();
var userIdBox = __eiInfo.getBlock("user_block_id").getMappedRows();
$(".row").children().attr("class", "col-md-3"); $(".row").children().attr("class", "col-md-3");
...@@ -30,9 +31,11 @@ $(function () { ...@@ -30,9 +31,11 @@ $(function () {
field: "operator", field: "operator",
title: "操作", title: "操作",
template: function (item) { template: function (item) {
let auditStatus = item.deviceStatus; let auditStatus = item.planStatus;
let template = ''; let template = '';
if (item.companyCode && item.groupCode) { if (item.companyCode && item.groupCode) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showDetail(' + item.id + ',\''+item.companyCode+'\',\''+item.companyName+'\',\''+item.groupCode+'\',\''+item.groupName+'\')" >计划详情</a>';
if (auditStatus == 0) { if (auditStatus == 0) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="updateStatus(' + item.id + ',1)" >启用</a>'; + 'onclick="updateStatus(' + item.id + ',1)" >启用</a>';
...@@ -44,7 +47,15 @@ $(function () { ...@@ -44,7 +47,15 @@ $(function () {
return template; return template;
} }
},{ },{
field: "purchaseDate", field: "planDate",
attributes: {
class: "i-input-readonly"
},
defaultValue: function () {
return currShortDate();
}
}, {
field: "planStartDate",
attributes: { attributes: {
class: "i-input-readonly" class: "i-input-readonly"
}, },
...@@ -52,7 +63,7 @@ $(function () { ...@@ -52,7 +63,7 @@ $(function () {
return currShortDate(); return currShortDate();
} }
}, { }, {
field: "maintainDate", field: "planEndDate",
attributes: { attributes: {
class: "i-input-readonly" class: "i-input-readonly"
}, },
...@@ -71,7 +82,7 @@ $(function () { ...@@ -71,7 +82,7 @@ $(function () {
} }
return dataItem["companyCode"]; return dataItem["companyCode"];
} }
},{ }, {
field: "groupCode", field: "groupCode",
title: "设备区域", title: "设备区域",
filter: function (options) { filter: function (options) {
...@@ -95,10 +106,18 @@ $(function () { ...@@ -95,10 +106,18 @@ $(function () {
} }
return dataItem["groupCode"] return dataItem["groupCode"]
} }
},{ }, {
field: "deviceCode", field: "planUserId",
title: "设备编码", title: "计划人",
template: function (dataItem) {
for (let i = 0; i < userIdBox.length; i++) {
if (userIdBox[i]['valueField'] === dataItem['planUserId']){
dataItem['planUserName'] = userIdBox[i]['textField']
return userIdBox[i]['textField'];
}
}
return dataItem["planUserId"];
}
} }
], ],
loadComplete: function(grid) { loadComplete: function(grid) {
...@@ -218,12 +237,11 @@ let save = function (btnNode) { ...@@ -218,12 +237,11 @@ let save = function (btnNode) {
$.each(rows, function(index, item) { $.each(rows, function(index, item) {
let companyCode= item.get("companyCode"); let companyCode= item.get("companyCode");
let groupCode= item.get("groupCode"); let groupCode= item.get("groupCode");
let deviceType= item.get("deviceType"); let planDate= item.get("planDate");
let deviceCode= item.get("deviceCode"); let planType= item.get("planType");
let deviceName= item.get("deviceName"); let planStartDate= item.get("planStartDate");
let deviceModel= item.get("deviceModel"); let planEndDate= item.get("planEndDate");
let purchaseDate= item.get("purchaseDate"); let planUserId= item.get("planUserId");
let deviceUserId= item.get("deviceUserId");
if(isBlank(companyCode)){ if(isBlank(companyCode)){
message("选中的第"+(index+1)+"行\"公司\",不能为空!"); message("选中的第"+(index+1)+"行\"公司\",不能为空!");
flag = false; flag = false;
...@@ -234,33 +252,28 @@ let save = function (btnNode) { ...@@ -234,33 +252,28 @@ let save = function (btnNode) {
flag = false; flag = false;
return false; return false;
} }
if(isBlank(deviceType)){ if(isBlank(planDate)){
message("选中的第"+(index+1)+"行\"设备类型\",不能为空!"); message("选中的第"+(index+1)+"行\"计划日期\",不能为空!");
flag = false; flag = false;
return false; return false;
} }
if(isBlank(deviceCode)){ if(isBlank(planType)){
message("选中的第"+(index+1)+"行\"设备编码\",不能为空!"); message("选中的第"+(index+1)+"行\"计划类型\",不能为空!");
flag = false; flag = false;
return false; return false;
} }
if(isBlank(deviceName)){ if(isBlank(planStartDate)){
message("选中的第"+(index+1)+"行\"设备名称\",不能为空!"); message("选中的第"+(index+1)+"行\"计划开始日期\",不能为空!");
flag = false; flag = false;
return false; return false;
} }
if(isBlank(deviceModel)){ if(isBlank(planEndDate)){
message("选中的第"+(index+1)+"行\"设备型号\",不能为空!"); message("选中的第"+(index+1)+"行\"计划结束日期\",不能为空!");
flag = false; flag = false;
return false; return false;
} }
if(isBlank(purchaseDate)){ if(isBlank(planUserId)){
message("选中的第"+(index+1)+"行\"购置日期\",不能为空!"); message("选中的第"+(index+1)+"行\"计划人\",不能为空!");
flag = false;
return false;
}
if(isBlank(deviceUserId)){
message("选中的第"+(index+1)+"行\"设备负责人\",不能为空!");
flag = false; flag = false;
return false; return false;
} }
...@@ -268,7 +281,7 @@ let save = function (btnNode) { ...@@ -268,7 +281,7 @@ let save = function (btnNode) {
if(flag) { if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", { JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () { ok: function () {
JSUtils.submitGridsData("result", "HGSB001", "save", true); JSUtils.submitGridsData("result", "HGSB002", "save", true);
btnNode.attr("disabled", false); btnNode.attr("disabled", false);
} }
}); });
...@@ -291,6 +304,21 @@ function updateStatus(id,deviceStatus) { ...@@ -291,6 +304,21 @@ function updateStatus(id,deviceStatus) {
async: false async: false
} }
); );
}
/**
* 显示详情
*/
function showDetail(id,companyCode,companyName,groupCode,groupName) {
JSColorbox.open({
href: "HGSB002A?methodName=initLoad&inqu_status-0-parentId=" + id+"&inqu_status-0-companyCode="+companyCode+"&inqu_status-0-companyName="+companyName+
"&inqu_status-0-groupCode="+groupCode+"&inqu_status-0-groupName="+groupName,
title: "<div style='text-align: center;'>设备计划详情</div>",
width: "80%",
height: "80%",
});
} }
function loadChange(grid,e,field) { function loadChange(grid,e,field) {
......
...@@ -24,13 +24,12 @@ ...@@ -24,13 +24,12 @@
<EF:EFOption label="全部" value=""/> <EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="groupCodeBox_block_id" textField="textField" valueField="valueField"/> <EF:EFOptions blockId="groupCodeBox_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>--%> </EF:EFSelect>--%>
<EF:EFSelect blockId="inqu_status" row="0" ename="deviceType" cname="设备类型" colWidth="3" filter="contains"> <EF:EFSelect blockId="inqu_status" row="0" ename="planType" cname="计划类型" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/> <EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpsb.deviceType"/> <EF:EFCodeOption codeName="hggp.hgsb.planType"/>
</EF:EFSelect> </EF:EFSelect>
<EF:EFDatePicker blockId="inqu_status" row="0" ename="purchaseDate" cname="购置日期" role="date" format="yyyy-MM-dd" parseFormats="['yyyyMMdd']" colWidth="3"/> <EF:EFDatePicker blockId="inqu_status" row="0" ename="planDate" cname="计划日期" role="date" format="yyyy-MM-dd" parseFormats="['yyyyMMdd']" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="deviceCode" cname="设备编码" colWidth="3"/> <EF:EFInput blockId="inqu_status" row="0" ename="planUserName" cname="计划人" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="deviceName" cname="设备名称" colWidth="3"/>
</div> </div>
</EF:EFRegion> </EF:EFRegion>
...@@ -39,7 +38,7 @@ ...@@ -39,7 +38,7 @@
<EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/> <EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/>
<EF:EFColumn ename="accountCode" cname="账套" hidden="true"/> <EF:EFColumn ename="accountCode" cname="账套" hidden="true"/>
<%--blockName="factoryCodeBox_block_id"--%> <%--blockName="factoryCodeBox_block_id"--%>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="80" align="center"/> <EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="120" align="center"/>
<EF:EFComboColumn ename="companyCode" cname="公司名称" <EF:EFComboColumn ename="companyCode" cname="公司名称"
columnTemplate="#=textField#" itemTemplate="#=textField#" columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField" textField="textField" valueField="valueField"
...@@ -54,28 +53,28 @@ ...@@ -54,28 +53,28 @@
align="center" filter="contains" sort="true"> align="center" filter="contains" sort="true">
<EF:EFOptions blockId="groupCodeBox_block_id" textField="textField" valueField="valueField"/> <EF:EFOptions blockId="groupCodeBox_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFComboColumn ename="deviceType" cname="设备类型" <EF:EFColumn ename="planDate" cname="计划日期" width="120" enable="true" readonly="true" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>
<EF:EFColumn ename="planCode" cname="计划单号" width="100" enable="false" readonly="true" align="center" required="true"/>
<EF:EFComboColumn ename="planType" cname="计划类型"
columnTemplate="#=textField#" itemTemplate="#=textField#" columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField" textField="textField" valueField="valueField"
maxLength="16" width="80" readonly="true" required="true" maxLength="16" width="100" readonly="true" required="true"
align="center" filter="contains" sort="true"> align="center" filter="contains" sort="true">
<EF:EFCodeOption codeName="hpjx.hpsb.deviceType" /> <EF:EFCodeOption codeName="hggp.hgsb.planType" />
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="deviceCode" cname="设备编码" width="100" enable="true" readonly="true" align="center" required="true"/> <EF:EFColumn ename="planStartDate" cname="计划开始日期" width="120" align="center" editType="date"
<EF:EFColumn ename="deviceName" cname="设备名称" width="160" enable="true" readonly="true" align="center" required="true"/> dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" readonly="false" required="true"/>
<EF:EFColumn ename="deviceModel" cname="设备型号" width="120" enable="true" readonly="true" align="center" required="true"/> <EF:EFColumn ename="planEndDate" cname="计划结束日期" width="120" align="center" editType="date"
<EF:EFColumn ename="purchaseDate" cname="购置日期" width="120" enable="true" readonly="true" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>
<EF:EFColumn ename="maintainDate" cname="保养日期" width="120" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" readonly="false" required="true"/> dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" readonly="false" required="true"/>
<EF:EFComboColumn ename="deviceUserId" cname="设备负责人" <EF:EFComboColumn ename="planUserId" cname="计划人"
columnTemplate="#=textField#" itemTemplate="#=textField#" columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField" textField="textField" valueField="valueField"
maxLength="16" width="100" readonly="false" required="true" maxLength="16" width="100" readonly="false" required="true"
align="center" filter="contains" sort="true"> align="center" filter="contains" sort="true">
<EF:EFOptions blockId="user_block_id" textField="textField" valueField="valueField"/> <EF:EFOptions blockId="user_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFComboColumn ename="deviceStatus" cname="设备状态" width="80" align="center" readonly="false" required="true" defaultValue="1"> <EF:EFComboColumn ename="planStatus" cname="审批状态" width="80" align="center" readonly="false" required="true" defaultValue="1">
<EF:EFCodeOption codeName="hpjx.hpjx.status"/> <EF:EFCodeOption codeName="hpjx.hpjx.status"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn cname="创建人" ename="createdName" align="center" width="100" readonly="true" required="false" <EF:EFColumn cname="创建人" ename="createdName" align="center" width="100" readonly="true" required="false"
......
$(function () {
var deviceCodeBox = __eiInfo.getBlock("deviceCodeBox_block_id").getMappedRows();
var groupCodeBox = __eiInfo.getBlock("groupCodeBox_block_id").getMappedRows();
$(".row").children().attr("class", "col-md-3");
$("#QUERY").on("click", query);
IPLATUI.EFAutoComplete = {
"inqu_status-0-deviceName": {
minLength: 1,
dataSource: {
pageSize: 10,
serverPaging: true,
serverFiltering: true
}
}
};
IPLATUI.EFGrid= {
"result": {
pageable: {
pageSize: 10,
pageSizes: [10, 20, 50, 100],
},
columns: [
{
field: "groupCode",
attributes: {
class: "i-input-readonly"
},
defaultValue: function () {
return __eiInfo.getBlock("inqu_status").getMappedRows()[0]["groupCode"];
},
template: function (dataItem) {
for (let i = 0; i < groupCodeBox.length; i++) {
if (groupCodeBox[i]['valueField'] === dataItem['groupCode']) {
dataItem['groupName'] = groupCodeBox[i]['textField'].split("]")[1]
return groupCodeBox[i]['textField'].split("]")[1];
}
}
return dataItem["groupCode"]
}
}, {
field: "deviceCode",
filter: function (options) {
var deviceType = options.model['deviceType'];
if(deviceType) {
// 返回我们过滤后的数据集
return _.filter(deviceCodeBox, function (item) {
return item["param1Field"]==deviceType;
})
}
return deviceCodeBox;
},
template: function (dataItem) {
for (let i = 0; i < deviceCodeBox.length; i++) {
if (deviceCodeBox[i]['valueField'] === dataItem['deviceCode']) {
dataItem['deviceName'] = deviceCodeBox[i]['textField']
return deviceCodeBox[i]['textField'];
}
}
return dataItem["deviceCode"]
}
}
],
loadComplete: function(grid) {
// 此 grid 对象
// 处理父子级联动,通过监听 change 事件,判断父级节点是否发生变化
grid.dataSource.bind("change", function(e) {
// 判断父级节点是否发生变化
if (e.field === "deviceType") {
loadChange(grid,e,"deviceCode");
}else if (e.field === "deviceCode") {
if (e.items[0].deviceType.length===0){
loadChange(grid,e,"deviceType");
}
//loadChange(grid,e,"userId");
}
});
},
afterEdit:function (e) {
/*if (e.field === "groupCode" && e.model["companyCode"].length === 0){
for (let i = 0; i < groupCodeBox.length; i++) {
if (e.model[e.field] === groupCodeBox[i]["valueField"]){
e.model["companyCode"]=groupCodeBox[i]["param3Field"]
break;
}
}
}else if (e.field === "userId" && e.model["groupCode"].length === 0){
for (let i = 0; i < userName.length; i++) {
if (e.model[e.field] === userName[i]["valueField"]){
//e.model["factoryCode"]=userName[i]["param1Field"]
e.model["groupCode"]=userName[i]["param2Field"]
break;
}
}
}*/
},
onSave: function (e) {
// 阻止默认请求,使用自定义保存
e.preventDefault();
let btnNode = $(this);
//禁用按钮
btnNode.attr("disabled", true);
save(btnNode);
},
onDelete: function (e) {
// 阻止默认请求,使用自定义删除
//e.preventDefault();
//deleteFunc();
},
onSuccess: function (e) {
if (e.eiInfo.extAttr.methodName == 'save' || e.eiInfo.extAttr.methodName == 'delete') {
query();
}
},
onRowClick: function (e) {
}
}
}
downKeyUp();
});
let query = function () {
resultGrid.dataSource.page(1);
}
/**
* 保存
*/
let save = function (btnNode) {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
$.each(rows, function(index, item) {
let groupCode= item.get("groupCode");
let deviceType= item.get("deviceType");
let deviceCode= item.get("deviceCode");
let checkItem= item.get("checkItem");
if(isBlank(groupCode)){
message("选中的第"+(index+1)+"行\"设备区域\",不能为空!");
flag = false;
return false;
}
if(isBlank(deviceType)){
message("选中的第"+(index+1)+"行\"设备类型\",不能为空!");
flag = false;
return false;
}
if(isBlank(deviceCode)){
message("选中的第"+(index+1)+"行\"设备名称\",不能为空!");
flag = false;
return false;
}
if(isBlank(checkItem)){
message("选中的第"+(index+1)+"行\"检查项\",不能为空!");
flag = false;
return false;
}
});
if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGSB002A", "save", true);
btnNode.attr("disabled", false);
}
});
}
}
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,12 +5,65 @@ ...@@ -5,12 +5,65 @@
Time: 15:02 Time: 15:02
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" %>
<html> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<head> <%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<title>Title</title>
</head>
<body>
</body> <c:set var="ctx" value="${pageContext.request.contextPath}"/>
</html>
<EF:EFPage title="设备计划详情">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFInput blockId="inqu_status" row="0" ename="companyName" cname="公司名称" colWidth="3" readonly="true"/>
<EF:EFInput blockId="inqu_status" row="0" ename="companyCode" cname="公司编码" colWidth="3" type="hidden"/>
<%--<EF:EFSelect blockId="inqu_status" row="0" ename="companyCode" cname="公司名称" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="companyBox_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>--%>
<EF:EFSelect blockId="inqu_status" row="0" ename="deviceType" cname="设备类型" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpsb.deviceType"/>
</EF:EFSelect>
<EF:EFInput blockId="inqu_status" row="0" ename="deviceName" cname="设备名称" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="groupCode" cname="设备区间编码" colWidth="3" type="hidden"/>
<EF:EFInput blockId="inqu_status" row="0" ename="groupName" cname="设备区间名称" colWidth="3" type="hidden"/>
<EF:EFInput blockId="inqu_status" row="0" ename="parentId" cname="上级ID" colWidth="3" type="hidden"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true">
<EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/>
<EF:EFColumn ename="accountCode" cname="账套" hidden="true"/>
<EF:EFComboColumn ename="groupCode" cname="设备区域" enable="false"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="true" width="120" required="true"
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="groupCodeBox_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="deviceType" cname="设备类型"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" width="80" readonly="true" required="true"
align="center" filter="contains" sort="true">
<EF:EFCodeOption codeName="hpjx.hpsb.deviceType" />
</EF:EFComboColumn>
<EF:EFComboColumn ename="deviceCode" cname="设备名称"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="true" width="120" required="true"
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="deviceCodeBox_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="checkItem" cname="检查项" width="100" enable="true" readonly="true" align="center" required="true"/>
<EF:EFColumn ename="checkDescrip" cname="检查描述" type="textarea" width="160" align="center"/>
<EF:EFColumn cname="创建人" ename="createdName" align="center" width="100" readonly="true" required="false"
enable="false"/>
<EF:EFColumn cname="创建时间" ename="createdTime" parseFormats="['yyyyMMddHHmmss']" editType="datetime"
dateFormat="yyyy-MM-dd HH:mm:ss" align="center" width="120" readonly="true" required="false"
enable="false"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
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