Commit e19ff7a6 by 宋祥

1.提交代码

parent a6284edf
......@@ -233,6 +233,18 @@ public class HPSqlConstant {
}
/**
* HPKC013 SQL 定义
*
* @author:songx
* @date:2024/1/20,16:45
*/
public class HPKC013 {
// 锁
public static final String UPDATE_STATUS = "HPKC013.updatestatus";
}
/**
* HPPZ010 SQL 定义
*
* @author:songx
......
package com.baosight.hpjx.hp.pz.domain;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.util.StringUtils;
import java.util.HashMap;
import java.util.Map;
/**
* Project: <br>
* Title:THppz013.java <br>
* Description: <br>
*
* Copyrigth:Baosight Software LTD.co Copyright (c) 2019. <br>
*
* @version 1.0
* @history 2024-03-07 11:17:57 create
*/
public class HPPZ01301 extends HPPZ013 {
private static final long serialVersionUID = 1L;
public static final String FIELD_GENDER = "gender"; /* 性别*/
public static final String FIELD_MOBILE = "mobile"; /* 联系方式*/
public static final String COL_GENDER = "GENDER"; /* 性别*/
public static final String COL_MOBILE = "MOBILE"; /* 联系方式*/
private String gender = " "; /* 性别*/
private String mobile = " "; /* 联系方式*/
/**
* initialize the metadata.
*/
public void initMetaData() {
EiColumn eiColumn;
eiColumn = new EiColumn(FIELD_GENDER);
eiColumn.setDescName("性别");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_MOBILE);
eiColumn.setDescName("联系方式");
eiMetadata.addMeta(eiColumn);
}
/**
* the constructor.
*/
public HPPZ01301() {
initMetaData();
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
/**
* get the value from Map.
*
* @param map - source data map
*/
@Override
public void fromMap(Map map) {
super.fromMap(map);
setGender(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_GENDER)), gender));
setMobile(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_MOBILE)), mobile));
}
/**
* set the value to Map.
*/
@Override
public Map toMap() {
Map map = super.toMap();
map.put(FIELD_GENDER, StringUtils.toString(gender, eiMetadata.getMeta(FIELD_GENDER)));
map.put(FIELD_MOBILE, StringUtils.toString(mobile, eiMetadata.getMeta(FIELD_MOBILE)));
return map;
}
}
......@@ -9,7 +9,6 @@ import com.baosight.hpjx.hp.xs.tools.HPXSTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.DateUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.RsaUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
......@@ -17,7 +16,6 @@ import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.core.service.soa.XLocalManager;
import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import com.baosight.xservices.xs.constants.LoginConstants;
import java.util.HashMap;
import java.util.List;
......@@ -128,7 +126,7 @@ public class ServiceHPPZ009 extends ServiceBase {
// 此处不能使用DaoUtils方法insert
dao.insert(HPPZ009.INSERT, fPz009);
// 默认新增企业管理员账号
this.initUser(fPz009);
HPXSTools.XsUser.addUser(fPz009.getCompanyCode(), fPz009.getCompanyName());
// 关联企业管理员角色
this.insertGroupMember(fPz009);
}
......@@ -171,34 +169,6 @@ public class ServiceHPPZ009 extends ServiceBase {
}
/**
* 初始化用户
*
* @param hppz009
*/
private void initUser(HPPZ009 hppz009) throws Exception {
String companyCode = hppz009.getCompanyCode();
Map inInfoRowMap = new HashMap();
inInfoRowMap.put("userId", companyCode);
inInfoRowMap.put("loginName", companyCode);
inInfoRowMap.put("userName", hppz009.getCompanyName());
// 使用公钥加密密码
String password = RsaUtils.encryptByPublicKey(LoginConstants.rsaPublicKey, companyCode);
inInfoRowMap.put("password", password);
inInfoRowMap.put("rePass", password);
inInfoRowMap.put("email", " ");
inInfoRowMap.put("mobile", " ");
inInfoRowMap.put("companyCode", hppz009.getCompanyCode());
EiInfo inInfo = new EiInfo();
inInfo.addBlock("details").addRow(inInfoRowMap);
inInfo.set(EiConstant.serviceName, "XS0102");
inInfo.set(EiConstant.methodName, "insert");
EiInfo outInfo = XLocalManager.call(inInfo);
if (outInfo.getStatus() < 0) {
throw new PlatException(outInfo.getMsg());
}
}
/**
* 用户关联角色
*
* @param hppz009
......
package com.baosight.hpjx.hp.pz.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.pz.domain.HPPZ013;
import com.baosight.hpjx.hp.pz.domain.HPPZ01301;
import com.baosight.hpjx.hp.xs.tools.HPXSTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 用工管理
*
* @author:songx
* @date:2024/1/18,17:15
*/
public class ServiceHPPZ013 extends ServiceBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "用工管理", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.FACTORY_RECORD_BLOCK_ID), null, false);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.GROUP_RECORD_BLOCK_ID), null, false);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPPZ01301().eiMetadata);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询数据列表
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "用工管理", operType = "查询", operDesc = "查询")
public EiInfo query(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HPPZ013.QUERY, new HPPZ01301());
// 设置用户信息
HPXSTools.XsUser.setUserInfo(inInfo, HPPZ01301.FIELD_USER_ID);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 保存操作.
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "用工管理", operType = "新增", operDesc = "保存操作")
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 数据校验
this.checkSaveData(resultRows);
// 写入数据
this.saveData(resultRows);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 校验保存的数据
*
* @param resultRows
*/
private void checkSaveData(List<Map> resultRows) {
for (Map resultRow : resultRows) {
HPPZ01301 fPz01301 = new HPPZ01301();
fPz01301.fromMap(resultRow);
AssertUtils.isEmpty(fPz01301.getFactoryCode(), "请选择工厂");
AssertUtils.isEmpty(fPz01301.getGroupType(), "请选择生产组类型");
AssertUtils.isEmpty(fPz01301.getGroupCode(), "请选择生产组");
AssertUtils.isEmpty(fPz01301.getUserName(), "请输入姓名");
AssertUtils.isEmpty(fPz01301.getGender(), "请选择性别");
AssertUtils.isEmpty(fPz01301.getMobile(), "请输入联系方式");
}
}
/**
* 保存数据
*
* @param resultRows
*/
private void saveData(List<Map> resultRows) {
for (Map resultRow : resultRows) {
HPPZ01301 fPz01301 = new HPPZ01301();
fPz01301.fromMap(resultRow);
// 设置基础信息
this.setBaseInfo(fPz01301);
if (fPz01301.getId() == null || fPz01301.getId() == 0) {
this.add(fPz01301);
} else {
this.modify(fPz01301);
}
}
}
/**
* 设置基础信息
*
* @param fPz01301
*/
private void setBaseInfo(HPPZ01301 fPz01301) {
// 厂区名称
fPz01301.setFactoryName(HPXSTools.XsOrg.get(fPz01301.getFactoryCode()).getOrgCname());
// 组名称
fPz01301.setGroupName(HPXSTools.XsOrg.get(fPz01301.getGroupCode()).getOrgCname());
}
/**
* 新增数据
*
* @param fPz01301
*/
private void add(HPPZ01301 fPz01301) {
// 新增用户信息
// String userId =
// HPXSTools.XsUser.addUser(fPz009.getCompanyCode(), fPz01301.getUserName());
fPz01301.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HPPZ013.INSERT, fPz01301);
}
/**
* 修改数据
*
* @param fPz01301
*/
private void modify(HPPZ01301 fPz01301) {
DaoUtils.update(HPSqlConstant.HPKC013.UPDATE_STATUS, fPz01301);
}
/**
* 删除操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "用工登记", operType = "删除", operDesc = "删除操作")
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (Map resultRow : resultRows) {
HPPZ013 fPz013 = new HPPZ013();
fPz013.fromMap(resultRow);
fPz013.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.update(HPPZ013.DELETE, fPz013);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "修改失败");
}
return inInfo;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HPPZ013">
<sql id="column">
ID as "id",
COMPANY_CODE as "companyCode", <!-- 企业编码 -->
DEP_CODE as "depCode", <!-- 部门编码 -->
CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_NAME as "createdName", <!-- 创建人名称 -->
CREATED_TIME as "createdTime", <!-- 创建时间 -->
UPDATED_BY as "updatedBy", <!-- 更新人 -->
UPDATED_NAME as "updatedName", <!-- 更新人名称 -->
UPDATED_TIME as "updatedTime", <!-- 更新时间 -->
DELETE_FLAG as "deleteFlag", <!-- 0.否1.是 -->
FACTORY_CODE as "factoryCode", <!-- 工厂编码 -->
FACTORY_NAME as "factoryName", <!-- 工厂名称 -->
DEPT_TYPE as "deptType", <!-- 部门类型 -->
GROUP_CODE as "groupCode", <!-- 生产组编码 -->
GROUP_NAME as "groupName", <!-- 生产组名称 -->
USER_ID as "userId", <!-- 用户ID -->
USER_NAME as "userName", <!-- 用户名称 -->
STATUS as "status", <!-- 状态:1-在职,2-离职 -->
REMARK as "remark" <!-- 备注 -->
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCode">
FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryName">
FACTORY_NAME = #factoryName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deptType">
DEPT_TYPE = #deptType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupCode">
GROUP_CODE = #groupCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupName">
GROUP_NAME = #groupName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userId">
USER_ID = #userId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userName">
USER_NAME = #userName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
STATUS = #status#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="remark">
REMARK = #remark#
</isNotEmpty>
</sql>
<!-- 公共修改字段 -->
<sql id="updateRevise">
UPDATED_BY = #updatedBy#,
UPDATED_NAME = #updatedName#,
UPDATED_TIME = #updatedTime#
</sql>
<sql id="order">
<dynamic prepend="ORDER BY">
<isNotEmpty property="order">
$order$
</isNotEmpty>
<isEmpty property="order">
ID asc
</isEmpty>
</dynamic>
</sql>
<select id="query" resultClass="com.baosight.hpjx.hp.pz.domain.HPPZ013">
SELECT
<include refid="column"/>
FROM ${hpjxSchema}.T_HPPZ013 WHERE 1=1
<include refid="condition"/>
<include refid="order"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hpjxSchema}.T_HPPZ013 WHERE 1=1
<include refid="condition"/>
</select>
<insert id="insert">
INSERT INTO ${hpjxSchema}.T_HPPZ013 (
COMPANY_CODE, <!-- 企业编码 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 -->
DELETE_FLAG, <!-- 0.否1.是 -->
FACTORY_CODE, <!-- 工厂编码 -->
FACTORY_NAME, <!-- 工厂名称 -->
DEPT_TYPE, <!-- 部门类型 -->
GROUP_CODE, <!-- 生产组编码 -->
GROUP_NAME, <!-- 生产组名称 -->
USER_ID, <!-- 用户ID -->
USER_NAME, <!-- 用户名称 -->
STATUS, <!-- 状态:1-在职,2-离职 -->
REMARK <!-- 备注 -->
) VALUES (
#companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#deleteFlag#, #factoryCode#, #factoryName#, #deptType#, #groupCode#,
#groupName#, #userId#, #userName#, #status#, #remark#
)
</insert>
<!-- 逻辑删除 -->
<delete id="delete">
UPDATE FROM ${hpjxSchema}.T_HPPZ013
SET DELETE_FLAG = #deleteFlag#
WHERE ID = #id#
</delete>
<!-- 修改状态 -->
<update id="updateStatus">
UPDATE ${hpjxSchema}.T_HPPZ013
SET
STATUS = #status#, <!-- 状态:1-在职,2-离职 -->
REMARK = #remark#, <!-- 备注 -->
<include refid="updateRevise"/>
WHERE ID = #id#
</update>
</sqlMap>
......@@ -8,6 +8,14 @@ import java.io.Serializable;
*/
public class User implements Serializable {
public static final String FIELD_USER_ID = "userId"; /* 用户ID*/
public static final String FIELD_USER_NAME = "userName"; /* 用户中文名*/
public static final String FIELD_LOGIN_NAME = "loginName"; /* 登录ID*/
public static final String FIELD_GENDER = "gender"; /* 性别*/
public static final String FIELD_MOBILE = "mobile"; /* 手机号*/
public static final String FIELD_EMAIL = "email"; /* 邮箱*/
public static final String FIELD_COMPANY_CODE = "companyCode"; /* 企业代码*/
/**
* 用户ID
*/
......@@ -24,6 +32,11 @@ public class User implements Serializable {
private String loginName;
/**
* 性别
*/
private String gender;
/**
* 手机号
*/
private String mobile;
......@@ -85,4 +98,12 @@ public class User implements Serializable {
public void setCompanyCode(String companyCode) {
this.companyCode = companyCode;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
}
......@@ -26,6 +26,7 @@
USER_ID as "userId", <!-- 用户id -->
USER_NAME as "userName", <!-- 用户名 -->
LOGIN_NAME as "loginName", <!-- 登录id -->
GENDER as "gender", <!-- 性别 -->
MOBILE as "mobile", <!-- 手机号 -->
EMAIL as "email", <!-- 邮箱 -->
COMPANY_CODE as "companyCode" <!-- 企业编码 -->
......
......@@ -5,12 +5,21 @@ import com.baosight.hpjx.core.enums.OrgTypeEnum;
import com.baosight.hpjx.hp.xs.domain.Org;
import com.baosight.hpjx.hp.xs.domain.User;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.MapUtils;
import com.baosight.hpjx.util.ObjectUtils;
import com.baosight.hpjx.util.RsaUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.soa.XLocalManager;
import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import com.baosight.xservices.xs.constants.LoginConstants;
import org.springframework.util.CollectionUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author:songx
......@@ -61,6 +70,85 @@ public class HPXSTools {
List<User> results = DaoBase.getInstance().query("HPXSUser.query", paramMap);
return CollectionUtils.isEmpty(results) ? null : results.get(0);
}
/**
* 查询
*
* @param loginNames
* @return
*/
public static List<User> list(List<String> loginNames) {
if (CollectionUtils.isEmpty(loginNames)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put("loginNames", loginNames);
return DaoBase.getInstance().query("HPXSUser.query", queryMap);
}
/**
* 查询
*
* @param loginNames
* @return
*/
public static Map<String, User> map(List<String> loginNames) {
List<User> results = list(loginNames);
if (CollectionUtils.isEmpty(results)) {
return null;
}
return results.stream().collect(Collectors.toMap(User::getLoginName, item -> item));
}
/**
* 初始化新增用户
*
* @param companyCode
*/
public static void addUser(String companyCode, String userName) throws Exception {
Map inInfoRowMap = new HashMap();
inInfoRowMap.put("userId", companyCode);
inInfoRowMap.put("loginName", companyCode);
inInfoRowMap.put("userName", userName);
// 使用公钥加密密码
String password = RsaUtils.encryptByPublicKey(LoginConstants.rsaPublicKey, companyCode);
inInfoRowMap.put("password", password);
inInfoRowMap.put("rePass", password);
inInfoRowMap.put("email", " ");
inInfoRowMap.put("mobile", " ");
inInfoRowMap.put("companyCode", companyCode);
EiInfo inInfo = new EiInfo();
inInfo.addBlock("details").addRow(inInfoRowMap);
inInfo.set(EiConstant.serviceName, "XS0102");
inInfo.set(EiConstant.methodName, "insert");
EiInfo outInfo = XLocalManager.call(inInfo);
if (outInfo.getStatus() < 0) {
throw new PlatException(outInfo.getMsg());
}
}
/**
* 设置用户信息
*
* @param inInfo
* @param keyName
*/
public static void setUserInfo(EiInfo inInfo, String keyName) {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
List<String> keyValues = ObjectUtils.listKey(resultRows, keyName);
Map<String, User> resultMap = map(keyValues);
if (MapUtils.isEmpty(resultMap)) {
return;
}
for (Map resultRow : resultRows) {
String keyValue = MapUtils.getString(resultRow, keyName);
User dbUser = resultMap.get(keyValue);
resultRow.put(User.FIELD_USER_NAME, dbUser == null ? "" : dbUser.getUserName());
resultRow.put(User.FIELD_GENDER, dbUser == null ? "" : dbUser.getGender());
resultRow.put(User.FIELD_MOBILE, dbUser == null ? "" : dbUser.getMobile());
resultRow.put(User.FIELD_EMAIL, dbUser == null ? "" : dbUser.getEmail());
}
}
}
/**
......
let groupGlobalData = [];
$(function () {
IPLATUI.EFGrid.result = {
pageable: {
pageSize: 20,
pageSizes: [10, 20, 50, 70, 100],
},
columns: [ {
field: "groupCode",
template: function (dataItem) {
for (let i = 0; i < groupGlobalData.length; i++) {
if (groupGlobalData[i]['valueField'] === dataItem['groupCode']) {
return groupGlobalData[i]['textField'];
}
}
return "";
},
editor: function (container, options) {
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-parentOrgId", options.model["factoryCode"]);
inInfo.set("inqu_status-0-isSplicingSymbol", false);
inInfo.set("serviceName", "HPXSOrg");
inInfo.set("methodName", "queryGroupComboBox");
inInfo.set("blockId", "group_record_block_id");
inInfo.set("field", options.field);
refreshSelect(container, inInfo);
}
}],
loadComplete: function (grid) {
},
onSave: function (e) {
// 阻止默认请求,使用自定义保存
e.preventDefault();
save();
},
onDelete: function (e) {
// 阻止默认请求,使用自定义删除
e.preventDefault();
deleteFunc();
},
onSuccess: function (e) {
}
}
// 查询
$("#QUERY").on("click", query);
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 生产部门
initGroup();
// 查询
query();
});
/**
* 初始化生产部门
*/
let initGroup = function () {
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-parentOrgId", 'root');
inInfo.set("inqu_status-0-isSplicingSymbol", false);
EiCommunicator.send("HPXSOrg", "queryGroupComboBox", inInfo, {
onSuccess: function (ei) {
groupGlobalData = ei.getBlock("group_record_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
}
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1);
}
/**
* 保存
*/
let save = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
$.each(rows, function(index, item) {
let whCode= item.get("whCode");
let inventCode= item.get("inventCode");
let inventRecordId= item.get("inventRecordId");
let inventType= item.get("inventType");
let warnNum= item.get("warnNum");
if(isBlank(inventType)){
message("选中的第"+(index+1)+"行\"存货类型\",不能为空!");
flag = false;
return false;
}
if(isBlank(whCode)){
message("选中的第"+(index+1)+"行\"仓库名称\",不能为空!");
flag = false;
return false;
}
if(isBlank(inventCode)){
message("选中的第"+(index+1)+"行\"存货名称\",不能为空!");
flag = false;
return false;
}
if(isBlank(inventRecordId)){
message("选中的第"+(index+1)+"行\"规格\",不能为空!");
flag = false;
return false;
}
if(!isPositiveInteger(warnNum)){
message("选中的第"+(index+1)+"行\"预警值\",必须是大于0的整数!");
flag = false;
return false;
}
});
if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPPZ012", "save", true);
}
});
}
}
/**
* 删除
*/
let deleteFunc = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPPZ012", "delete", true);
}
});
}
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="用工管理">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFSelect cname="工厂" blockId="inqu_status" ename="factoryCode" row="0" colWidth="3" filter="contains">
<EF:EFOptions blockId="factory_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect cname="部门类型" blockId="inqu_status" ename="groupType" row="0" colWidth="3" filter="contains"
defultValue="">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="xs.og.orgType" condition="ITEM_CODE IN ('prodGroup', 'cutGroup')"/>
</EF:EFSelect>
<EF:EFSelect cname="生产部门" blockId="inqu_status" ename="groupCode" row="0" colWidth="3" filter="contains">
<EF:EFOptions blockId="groupCode_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFInput cname="姓名" blockId="inqu_status" ename="userName" row="0" colWidth="3"/>
</div>
<div class="row">
<EF:EFSelect cname="性别" blockId="inqu_status" ename="gender" row="0" colWidth="3">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="xservices.xs.sex"/>
</EF:EFSelect>
<EF:EFInput cname="联系方式" blockId="inqu_status" ename="mobile" row="0" colWidth="3"/>
<EF:EFSelect cname="状态" blockId="inqu_status" ename="status" row="0" colWidth="3">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="ctdy.hppz.userStatus"/>
</EF:EFSelect>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="override" checkMode="row">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFComboColumn ename="factoryCode" cname="厂区" width="110" align="center" defaultValue="" required="true"
filter="contains" readonly="true">
<EF:EFOptions blockId="factory_record_block_id" valueField="valueField" textField="textField"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="groupType" cname="部门类型" width="80" align="center" required="true"
readonly="true">
<EF:EFCodeOption codeName="xs.og.orgType" condition="ITEM_CODE IN ('prodGroup', 'cutGroup')"/>
</EF:EFComboColumn>
<EF:EFColumn ename="groupCode" cname="生产部门" width="120" align="center" required="true" readonly="true"/>
<EF:EFComboColumn ename="gender" cname="性别" valueField="valueField" textField="textField" align="center">
<EF:EFCodeOption codeName="xservices.xs.sex"/>
</EF:EFComboColumn>
<EF:EFColumn ename="mobile" cname="联系方式" width="120" align="center" required="true" readonly="true"/>
<EF:EFComboColumn ename="status" cname="状态" valueField="valueField" textField="textField" align="center">
<EF:EFCodeOption codeName="ctdy.hppz.userStatus"/>
</EF:EFComboColumn>
<EF:EFColumn ename="remark" cname="备注" width="150"/>
</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