Commit 79ec23d8 by wuwenlong

项目立项dev;

parent 80ef1525
package com.baosight.hggp.hg.sc.service;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.sc.domain.HGSC001;
import com.baosight.hggp.hg.sc.domain.HGSC001A;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.hg.xs.domain.Dept;
import com.baosight.hggp.hg.xs.domain.User;
import com.baosight.hggp.util.*;
import com.baosight.iplat4j.core.ei.EiBlock;
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.resource.I18nMessages;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.math.BigDecimal;
import java.util.*;
/**
* @Author wwl
* @Date 2024/5/6 19:48
*/
public class ServiceHGSC001 extends ServiceBase {
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HGSC001.QUERY, new HGSC001());
Map map = new HashMap();
map.put("accountCode", UserSessionUtils.getAccountCode());
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJ_TYPE_BLOCK_ID), map,false);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
public EiInfo query(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HGSC001.QUERY, new HGSC001());
Map map = new HashMap();
map.put("accountCode", UserSessionUtils.getAccountCode());
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJ_TYPE_BLOCK_ID), map,false);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
@Override
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 销售单号
List<Long> ids = ObjectUtils.listKey(resultRows, "id");
DaoUtils.update(HGSC001.BATCH_DELETE, new HashMap<String,Object>(){{put("ids",ids);}});
HGSCTools.THGSC001A.deleteByProIds(ids);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
public EiInfo save(EiInfo inInfo){
try {
Map resultMap = EiInfoUtils.getFirstRow(inInfo,EiConstant.resultBlock);
HGSC001 hgsc001 = new HGSC001();
hgsc001.fromMap(resultMap);
this.checkSaveData(hgsc001);
if(Objects.nonNull(hgsc001.getId())&&hgsc001.getId()!=0){
DaoUtils.update(HGSC001.UPDATE, hgsc001);
}else {
DaoUtils.insert(HGSC001.INSERT, hgsc001);
}
List<Map> detailRows = inInfo.getBlock(CommonConstant.Field.DETAIL).getRows();
// 处理项目负责人
List<HGSC001A> hgsc001AList = HGSCTools.THGSC001A.convertToObj(detailRows);
HGSCTools.THGSC001A.checkProjMgData(hgsc001AList);
HGSCTools.THGSC001A.save(hgsc001AList,hgsc001.getId());
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 校验保存的数据
*
* @param hgsc001
*/
private void checkSaveData(HGSC001 hgsc001) {
AssertUtils.isEmpty(UserSessionUtils.getAccountCode(), "当前用户未绑定公司,无法操作数据,请联系管理员!");
AssertUtils.isEmpty(UserSessionUtils.getOrgId(), "当前用户未绑定部门,无法操作数据,请联系管理员!");
AssertUtils.isEmpty(hgsc001.getCompanyCode(), "请选择公司!");
AssertUtils.isEmpty(hgsc001.getDepCode(), "请选择部门!");
AssertUtils.isEmpty(hgsc001.getSubcontractCode(), "请选择分包方!");
AssertUtils.isEmpty(hgsc001.getGenralContractCode(), "请选择总包方!");
AssertUtils.isEmpty(hgsc001.getProjCode(), "请填写项目编号!");
AssertUtils.isEmpty(hgsc001.getProjName(), "请填写项目名称!");
AssertUtils.isEmpty(hgsc001.getContractName(), "请填写合同名称!");
AssertUtils.isEmpty(hgsc001.getProjType(), "请选择项目性质!");
AssertUtils.isEmpty(hgsc001.getPermissStartDate(), "请选择准许开工日期!");
AssertUtils.isEmpty(hgsc001.getStartDate(), "请选择开工日期!");
AssertUtils.isEmpty(hgsc001.getEndDate(), "请选择完工日期!");
AssertUtils.isNull(hgsc001.getProjStatus(), "请选择项目状态!");
AssertUtils.isEmpty(hgsc001.getContractWorkTxt(), "请填写合同工作量!");
}
/**
* 部门下拉框
* @param inInfo
* @return
*/
public EiInfo depByCompanyComboBox(EiInfo inInfo){
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String companyCode = MapUtils.getString(queryMap, HGSC001.FIELD_company_code);
EiInfoUtils.addBlock(inInfo,"depByCompany", UserSessionUtils.getDepByCompany(companyCode), Dept.class);
CommonMethod.comboBoxDefaultValue(inInfo,"depByCompany","depCode","depName");
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
return inInfo;
}
/**
* 客户档案下拉框
* @param inInfo
* @return
*/
public EiInfo genralContractComboBox(EiInfo inInfo){
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String companyCode = MapUtils.getString(queryMap, HGSC001.FIELD_subcontract_code);
Map map = new HashMap();
map.put("accountCode", UserSessionUtils.getAccountCode());
// map.put("companyCode", companyCode);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.CUSTOMER_RECORD_BLOCK_ID), map,false);
CommonMethod.comboBoxDefaultValue(inInfo,DdynamicEnum.CUSTOMER_RECORD_BLOCK_ID.getBlockId());
return inInfo;
}
/**
* 用户下拉框
* @param inInfo
* @return
*/
public EiInfo userByCompanyComboBox(EiInfo inInfo) throws InstantiationException, IllegalAccessException {
String companyCode = inInfo.getCellStr(EiConstant.queryBlock,EiConstant.STATUS_DEFAULT,HGSC001.FIELD_company_code);
EiInfoUtils.addBlock(inInfo,"userByCompany", UserSessionUtils.getUserByCompany(companyCode), User.class);
CommonMethod.comboBoxDefaultValue(inInfo,DdynamicEnum.CUSTOMER_RECORD_BLOCK_ID.getBlockId(),"loginName","userName");
return inInfo;
}
}
package com.baosight.hggp.hg.sc.service;
import com.baosight.hggp.hg.sc.domain.HGSC001A;
import com.baosight.hggp.util.LogUtils;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
/**
* @Author wwl
* @Date 2024/5/6 19:48
*/
public class ServiceHGSC001A extends ServiceBase {
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HGSC001A.QUERY, new HGSC001A());
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
}
package com.baosight.hggp.hg.sc.service;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.sc.domain.HGSC001;
import com.baosight.hggp.hg.sc.domain.HGSC001A;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.hg.xs.domain.Dept;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
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 com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.util.*;
/**
* @Author wwl
* @Date 2024/5/6 19:48
*/
public class ServiceHGSC001C extends ServiceBase {
public EiInfo initLoad(EiInfo inInfo) {
try {
HGSC001 hgsc001 = new HGSC001();
hgsc001.setProjCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.PROJ_NUMBER));
EiInfoUtils.addBlock(inInfo,EiConstant.resultBlock,new ArrayList(){{add(hgsc001);}},HGSC001.class);
inInfo.addBlock(CommonConstant.Field.DETAIL).addBlockMeta(new HGSC001A().eiMetadata);
Map map = new HashMap();
map.put("accountCode", UserSessionUtils.getAccountCode());
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJ_TYPE_BLOCK_ID), map,false);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.CUSTOMER_RECORD_BLOCK_ID), map,false);
EiInfoUtils.addBlock(inInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
return inInfo;
}
}
package com.baosight.hggp.hg.sc.service;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.sc.domain.HGSC001;
import com.baosight.hggp.hg.sc.domain.HGSC001A;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.hg.xs.domain.Dept;
import com.baosight.hggp.hg.xs.domain.User;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.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 com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.util.*;
/**
* @Author wwl
* @Date 2024/5/6 19:48
*/
public class ServiceHGSC001D extends ServiceBase {
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo = super.query(inInfo,HGSC001.QUERY,new HGSC001());
Map resultMap = EiInfoUtils.getFirstRow(inInfo,EiConstant.resultBlock);
List<HGSC001A> hgsc001AList = HGSCTools.THGSC001A.getByProjId(
Long.valueOf(String.valueOf(resultMap.get(HGSC001.FIELD_id))));
EiInfoUtils.addBlock(inInfo,CommonConstant.Field.DETAIL, hgsc001AList, HGSC001A.class);
Map map = new HashMap();
map.put("accountCode", UserSessionUtils.getAccountCode());
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJ_TYPE_BLOCK_ID), map,false);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.CUSTOMER_RECORD_BLOCK_ID), map,false);
EiInfoUtils.addBlock(inInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class);
EiInfoUtils.addBlock(inInfo,"depByCompany", UserSessionUtils.getDepByCompany((String) resultMap.get(HGSC001.FIELD_company_code)), Dept.class);
EiInfoUtils.addBlock(inInfo,"userByCompany", UserSessionUtils.getUserByCompany((String) resultMap.get(HGSC001.FIELD_company_code)), User.class);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
return inInfo;
}
}
package com.baosight.hggp.hg.sc.service;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.sc.domain.HGSC001;
import com.baosight.hggp.hg.sc.domain.HGSC001A;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.hg.xs.domain.Dept;
import com.baosight.hggp.hg.xs.domain.User;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
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.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Author wwl
* @Date 2024/5/6 19:48
*/
public class ServiceHGSC001U extends ServiceBase {
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo = super.query(inInfo,HGSC001.QUERY,new HGSC001());
Map resultMap = EiInfoUtils.getFirstRow(inInfo,EiConstant.resultBlock);
List<HGSC001A> hgsc001AList = HGSCTools.THGSC001A.getByProjId(
Long.valueOf(String.valueOf(resultMap.get(HGSC001.FIELD_id))));
EiInfoUtils.addBlock(inInfo,CommonConstant.Field.DETAIL, hgsc001AList, HGSC001A.class);
Map map = new HashMap();
map.put("accountCode", UserSessionUtils.getAccountCode());
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJ_TYPE_BLOCK_ID), map,false);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.CUSTOMER_RECORD_BLOCK_ID), map,false);
EiInfoUtils.addBlock(inInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class);
EiInfoUtils.addBlock(inInfo,"depByCompany", UserSessionUtils.getDepByCompany((String) resultMap.get(HGSC001.FIELD_company_code)), Dept.class);
EiInfoUtils.addBlock(inInfo,"userByCompany", UserSessionUtils.getUserByCompany((String) resultMap.get(HGSC001.FIELD_company_code)), User.class);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
return inInfo;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd"> <!-- table information
Generate time : 2024-05-09 14:45:44
Version : 1.0
schema : hggp
tableName : HGSC001A
id BIGINT NOT NULL primarykey,
proj_id BIGINT NOT NULL,
user_code VARCHAR,
user_name VARCHAR,
user_phone VARCHAR,
user_dep_code VARCHAR,
user_dep_name VARCHAR,
dep_code VARCHAR,
dep_name VARCHAR,
account_code VARCHAR NOT NULL,
created_by VARCHAR,
created_name VARCHAR,
created_time VARCHAR,
updated_by VARCHAR,
updated_name VARCHAR,
updated_time VARCHAR
-->
<sqlMap namespace="HGSC001A">
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
id = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projId">
proj_id = #projId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userCode">
user_code = #userCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userName">
user_name = #userName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userPhone">
user_phone = #userPhone#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userDepCode">
user_dep_code = #userDepCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userDepName">
user_dep_name = #userDepName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
dep_code = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depName">
dep_name = #depName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
account_code = #accountCode#
</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>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hggp.hg.sc.domain.HGSC001A">
SELECT
id as "id",
proj_id as "projId", <!-- 项目ID -->
user_code as "userCode", <!-- 用户编码 -->
user_name as "userName", <!-- 用户名称 -->
user_phone as "userPhone", <!-- 用户手机号 -->
user_dep_code as "userDepCode", <!-- 部门编码 -->
user_dep_name as "userDepName", <!-- 部门名称 -->
dep_code as "depCode", <!-- 部门编码 -->
dep_name as "depName", <!-- 部门名称 -->
account_code as "accountCode", <!-- 帐套 -->
created_by as "createdBy", <!-- 创建人 -->
created_name as "createdName", <!-- 创建人名称 -->
created_time as "createdTime", <!-- 创建时间 -->
updated_by as "updatedBy", <!-- 更新人 -->
updated_name as "updatedName", <!-- 修改人名称 -->
updated_time as "updatedTime" <!-- 更新时间 -->
FROM ${hggpSchema}.HGSC001A WHERE 1=1
<include refid="condition" />
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
id asc
</isEmpty>
</dynamic>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGSC001A WHERE 1=1
<include refid="condition" />
</select>
<!--
<isNotEmpty prepend=" AND " property="id">
id = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projId">
proj_id = #projId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userCode">
user_code = #userCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userName">
user_name = #userName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userPhone">
user_phone = #userPhone#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userDepCode">
user_dep_code = #userDepCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userDepName">
user_dep_name = #userDepName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
dep_code = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depName">
dep_name = #depName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
account_code = #accountCode#
</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>
-->
<insert id="insert">
INSERT INTO ${hggpSchema}.HGSC001A (id,
proj_id, <!-- 项目ID -->
user_code, <!-- 用户编码 -->
user_name, <!-- 用户名称 -->
user_phone, <!-- 用户手机号 -->
user_dep_code, <!-- 部门编码 -->
user_dep_name, <!-- 部门名称 -->
dep_code, <!-- 部门编码 -->
dep_name, <!-- 部门名称 -->
account_code, <!-- 帐套 -->
created_by, <!-- 创建人 -->
created_name, <!-- 创建人名称 -->
created_time, <!-- 创建时间 -->
updated_by, <!-- 更新人 -->
updated_name, <!-- 修改人名称 -->
updated_time <!-- 更新时间 -->
)
VALUES (#id#, #projId#, #userCode#, #userName#, #userPhone#, #userDepCode#, #userDepName#, #depCode#, #depName#, #accountCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#)
</insert>
<delete id="delete">
DELETE FROM ${hggpSchema}.HGSC001A WHERE
id = #id#
</delete>
<delete id="deleteByProjId">
DELETE FROM ${hggpSchema}.HGSC001A WHERE
proj_id = #projId#
</delete>
<delete id="deleteByProjIds">
DELETE FROM ${hggpSchema}.HGSC001A WHERE
proj_id IN <iterate close=")" open="(" conjunction="," property="projIds">#projIds[]#</iterate>
</delete>
<update id="update">
UPDATE ${hggpSchema}.HGSC001A
SET
proj_id = #projId#, <!-- 项目ID -->
user_code = #userCode#, <!-- 用户编码 -->
user_name = #userName#, <!-- 用户名称 -->
user_phone = #userPhone#, <!-- 用户手机号 -->
user_dep_code = #userDepCode#, <!-- 部门编码 -->
user_dep_name = #userDepName#, <!-- 部门名称 -->
dep_code = #depCode#, <!-- 部门编码 -->
dep_name = #depName#, <!-- 部门名称 -->
account_code = #accountCode#, <!-- 帐套 -->
created_by = #createdBy#, <!-- 创建人 -->
created_name = #createdName#, <!-- 创建人名称 -->
created_time = #createdTime#, <!-- 创建时间 -->
updated_by = #updatedBy#, <!-- 更新人 -->
updated_name = #updatedName#, <!-- 修改人名称 -->
updated_time = #updatedTime# <!-- 更新时间 -->
WHERE
id = #id#
</update>
</sqlMap>
package com.baosight.hggp.hg.sc.tools;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.sc.domain.HGSC001A;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.ListUtils;
import org.apache.commons.collections.CollectionUtils;
import java.util.*;
/**
* @Author wwl
* @Date 2024/5/7 16:17
*/
public class HGSCTools {
public static class THGSC001A{
/**
* 通过项目ID查询项目负责人*
* @param projId
* @return
*/
public static List<HGSC001A> getByProjId(Long projId){
AssertUtils.isNull(projId, "项目ID不能为空!");
Map paramMap = new HashMap();
paramMap.put(HGSC001A.FIELD_proj_id, projId);
List<HGSC001A> results = DaoBase.getInstance().query(HGSC001A.QUERY, paramMap);
return CollectionUtils.isEmpty(results) ? null : results;
}
public static List<HGSC001A> convertToObj(List<Map> resultRows){
List<HGSC001A> objList= new ArrayList<>();
for (Map resultRow : resultRows) {
HGSC001A hgsc001A = new HGSC001A();
hgsc001A.fromMap(resultRow);
objList.add(hgsc001A);
}
return objList;
}
/**
* 校验保存的数据
*
* @param objList
*/
public static void checkProjMgData(List<HGSC001A> objList) {
AssertUtils.isEmpty(objList, "项目负责人不能为空!");
AssertUtils.isTrue(ListUtils.allSameProperty(objList,HGSC001A::getUserCode), "项目负责人重复!");
}
public static List<HGSC001A> save(List<HGSC001A> hgsc001AList, Long projId){
if(CollectionUtils.isNotEmpty(hgsc001AList)&&Objects.nonNull(projId)) {
//删除历史数据
DaoUtils.update(HGSC001A.DELETE_BY_PROJID, projId);
hgsc001AList.forEach(obj -> {
obj.setProjId(projId);
DaoUtils.insert(HGSC001A.INSERT,obj);
});
}
return hgsc001AList;
}
public static void deleteByProIds(List<Long> projIds){
if(CollectionUtils.isNotEmpty(projIds)) {
//删除历史数据
DaoUtils.update(HGSC001A.DELETE_BY_PROJIDS, new HashMap<String,Object>(){{put("proIds",projIds);}});
}
}
}
}
......@@ -268,4 +268,20 @@ public class CommonMethod {
}
return eiMetadata;
}
public static void comboBoxDefaultValue(EiInfo inInfo, String blockId) {
comboBoxDefaultValue(inInfo,blockId,HGConstants.VALUE_FIELD,HGConstants.TEXT_FIELD);
}
public static void comboBoxDefaultValue(EiInfo inInfo, String blockId, String valueFieldName, String textFieldName) {
List rows = inInfo.getBlock(blockId).getRows();
List newRows = new ArrayList(){{
add(new HashMap<String,Object>(){{
put(valueFieldName,"");
put(textFieldName,"-- 请选择 --");
}});
}};
newRows.addAll(rows);
inInfo.getBlock(blockId).setRows(newRows);
}
}
package com.baosight.hggp.util;
import java.util.List;
import java.util.Objects;
import java.util.function.Function;
/**
* @Author wwl
* @Date 2024/5/10 10:11
*/
public class ListUtils {
public static <T> boolean allSameProperty(List<T> list, Function<T, ?> propertyExtractor) {
if (list == null || list.isEmpty()) {
return true;
}
Object firstValue = propertyExtractor.apply(list.get(0));
return list.stream().allMatch(item -> Objects.equals(firstValue, propertyExtractor.apply(item)));
}
}
$(function () {
var projTypeList = __eiInfo.getBlock("proj_type_block_id").getMappedRows();
$("#QUERY").on("click", function () {
resultGrid.dataSource.page(1);
});
IPLATUI.EFGrid.result = {
pageable: {
pageSize: 20,
pageSizes: [10, 20, 50, 70, 100],
},
columns: [
{
field: "projType",
template: function (item) {
let template = "";
if(item.projType&&projTypeList&&projTypeList.length>0){
var projTypes = item.projType.split(",");
for(let i=0;i<projTypes.length;i++){
for(let j=0;j<projTypeList.length;j++){
if(projTypes[i] === projTypeList[j]['valueField']){
if(template === ""){
template = projTypeList[j]['textField']
}else{
template += projTypeList[j]['textField']
}
}
}
}
}
return template;
}
},
{
field: "operator",
template: function (item) {
let template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' +
'onclick="showInfo(' + item.id + ')" >立项详情</a>';
return template;
}
}
],
loadComplete: function(grid){
// 新增
$("#add").click(create);
//修改
$("#BNT_UPDATE").on("click", update);
},
onAdd: function(e) {
e.preventDefault();
},
onSuccess: function (e) {
if(e.eiInfo.extAttr.methodName == 'save'||e.eiInfo.extAttr.methodName == 'delete' ){
query();
}
},
onAdd: function (e) {
e.preventDefault();
create();
}
}
});
function showInfo(id) {
JSColorbox.open({
href: "HGSC001D?inqu_status-0-id=" + id + "&efParentFormEname=HGSC001",
title: "<div style='text-align: center;'>查看项目</div>",
width: "90%",
height: "90%",
callbackName: windowCallback
});}
function create() {
JSColorbox.open({
href: "HGSC001C?methodName=initLoad&efParentFormEname=HGSC001",
title: "<div style='text-align: center;'>新增项目</div>",
width: "90%",
height: "90%",
callbackName: windowCallback
});
}
function update() {
let rows = resultGrid.getCheckedRows()
if (rows.length < 1||rows.length > 1) {
message("请选择一条需要修改的数据");
return;
}
let id = rows[0].id;
JSColorbox.open({
href: "HGSC001U??methodName=initLoad&inqu_status-0-id=" + id + "&efParentFormEname=HGSC001",
title: "<div style='text-align: center;'>修改项目</div>",
width: "90%",
height: "90%",
callbackName: windowCallback
});}
function windowCallback() {
// 刷新列表
resultGrid.dataSource.page(1);
// 关闭弹窗
JSColorbox.close();
}
<!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}"/>
<script>
var ctx = "${ctx}";
</script>
<head>
</head>
<EF:EFPage title="项目立项">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFInput ename="inqu_status-0-companyName" cname="公司名称" colWidth="3"/>
<EF:EFInput ename="inqu_status-0-subcontractName" cname="分包方" colWidth="3"/>
<EF:EFInput ename="inqu_status-0-genralContractName" cname="总包方" colWidth="3"/>
<EF:EFInput ename="inqu_status-0-projName" cname="项目名称" colWidth="3"/>
<EF:EFSelect cname="项目性质" ename="inqu_status-0-projType" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="proj_type_block_id" valueField="valueField" textField="textField"/>
</EF:EFSelect>
<EF:EFSelect cname="提交状态" ename="inqu_status-0-approvalStatus" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hggp.commitStatus" />
</EF:EFSelect>
<EF:EFSelect cname="项目状态" ename="inqu_status-0-projStatus" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hggp.projStatus" />
</EF:EFSelect>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="no" isFloat="true">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="100" align="center"/>
<EF:EFColumn ename="companyName" cname="公司名称" enable="false" width="120" align="center"/>
<EF:EFColumn ename="projCode" cname="项目编码" enable="false" width="120" align="center"/>
<EF:EFColumn ename="projName" cname="项目名称" enable="false" width="120" align="center"/>
<EF:EFColumn ename="subcontractName" cname="分包方" enable="false" width="120" align="center"/>
<EF:EFColumn ename="genralContractName" cname="总包方" enable="false" width="120" align="center"/>
<EF:EFColumn ename="projType" cname="项目性质" enable="false" width="120" align="center"/>
<EF:EFColumn ename="permissStartDate" cname="准许开工日期" enable="false" width="120" align="center"/>
<EF:EFColumn ename="startDate" cname="开工日期" enable="false" width="120" align="center"/>
<EF:EFColumn ename="endDate" cname="完工日期" enable="false" width="120" align="center"/>
<EF:EFComboColumn ename="projStatus" cname="项目状态" width="80" align="center" required="true"
readonly="true">
<EF:EFCodeOption codeName="hggp.projStatus"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="approvalStatus" cname="提交状态" width="80" align="center" required="true"
readonly="true">
<EF:EFCodeOption codeName="hggp.commitStatus"/>
</EF:EFComboColumn>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
$(function () {
var userByCompany ;//= __eiInfo.getBlock("userByCompany").getMappedRows();
IPLATUI.EFGrid.detail = {
pageable: {
pageSize: 20,
pageSizes: [10, 20, 50, 70, 100],
},
columns: [{
field: "userCode",
template: function (dataItem) {
for (let i = 0; i < userByCompany.length; i++) {
if (userByCompany[i]['loginName'] === dataItem['userCode']) {
dataItem['userName'] = userByCompany[i]['userName'];
dataItem['userPhone'] = userByCompany[i]['mobile'];
dataItem['userDepCode'] = userByCompany[i]['depCode'];
dataItem['userDepName'] = userByCompany[i]['depName'];
return userByCompany[i]['userName'];
}
}
return dataItem["userName"];
},
editor: function (container, options) {
var input = $('<input />');
input.attr("name", options.field);
input.attr("id", options.field);
input.appendTo(container);
input.kendoDropDownList({
dataSource: userByCompany,
minLength: 0,
dataTextField: "userName",
dataValueField: "loginName",
optionLabelTemplate: "[#:loginName#]#:userName#-#:depName#",
valueTemplate: "[#:loginName#]#:userName#-#:depName#",
template: "[#:loginName#]#:userName#-#:depName#",
filter: "contains"
});
}
}],
loadComplete: function(grid) {
// 此 grid 对象
// 处理父子级联动,通过监听 change 事件,判断父级节点是否发生变化
grid.dataSource.bind("change", function(e) {
// 判断父级节点是否发生变化
if (e.field == "userCode") {
loadChange(grid,e,"userName");
loadChange(grid,e,"userPhone");
loadChange(grid,e,"userDepCode");
loadChange(grid,e,"userDepName");
}
});
},
onAdd: function(e) {
if(!userByCompany){
message("请选择分包方!");
e.preventDefault();
return;
}
},
onSuccess: function (e) {
if(e.eiInfo.extAttr.methodName == 'save'||e.eiInfo.extAttr.methodName == 'delete' ){
query();
}
}
}
$("#result-0-companyCode").change(function () {
let textField = IPLAT.EFSelect.text($("#result-0-companyCode"));
$("#result-0-companyName").val(textField);
})
$("#result-0-depCode").change(function () {
let textField = IPLAT.EFSelect.text($("#result-0-depCode"));
$("#result-0-depName").val(textField);
});
$("#result-0-subcontractCode").change(function () {
let textField = IPLAT.EFSelect.text($("#result-0-subcontractCode"));
$("#result-0-subcontractName").val(textField);
loadProjMg(IPLAT.EFSelect.value($("#result-0-subcontractCode")));
});
$("#result-0-genralContractCode").change(function () {
let textField = IPLAT.EFSelect.text($("#result-0-genralContractCode"));
$("#result-0-genralContractName").val(textField);
});
/**
* 加载项目负责人选项数据*
* @param companyCode
*/
function loadProjMg(companyCode){
var inInfo=new EiInfo();
inInfo.set("inqu_status-0-companyCode",companyCode);
EiCommunicator.send("HGSC001", "userByCompanyComboBox", inInfo, {
onSuccess: function (ei) {
var input=$("#inqu_status-0-groupCode");
userByCompany=ei.getBlock("userByCompany").getMappedRows();
}, onFail: function (ei) {
}
}, {async: false});
}
/**
* 取消
*/
$('#cancel').on('click', function () {
// 关闭弹窗
parent.JSColorbox.close();
})
/**
* 保存*
*/
$("#btn_save").on("click",function(){
JSUtils.confirm("确定对数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGrid("detail", "HGSC001", "save", {isAlldata:true,onSuccessCallback:saveCallback});
}
});
});
var saveCallback = function(ei){
if (ei.getStatus() >= 0) {
parent.JSColorbox.close();
}
}
});
<!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:EFInput ename="result-0-companyName" cname="公司名称" type="hidden"/>
<EF:EFSelect cname="公司" ename="result-0-companyCode" colWidth="4" required="true" filter="contains">
<EF:EFOption label="-- 请选择 --" value="" />
<EF:EFOptions blockId="roleCompany" valueField="companyCode" textField="companyName"/>
</EF:EFSelect>
<EF:EFInput ename="result-0-depName" cname="部门名称" type="hidden"/>
<EF:EFCascadeSelect cascadeFrom="result-0-companyCode" cname="部门" ename="result-0-depCode"
colWidth="4" required="true" filter="contains" defaultValue=""
serviceName="HGSC001" methodName="depByCompanyComboBox" resultId="depByCompany"
textField="depName" valueField="depCode" >
</EF:EFCascadeSelect>
</div>
<div class="row">
<EF:EFInput ename="result-0-subcontractName" cname="分包方名称" type="hidden"/>
<EF:EFSelect cname="分包方" ename="result-0-subcontractCode" colWidth="4" required="true" filter="contains">
<EF:EFOption label="-- 请选择 --" value="" />
<EF:EFOptions blockId="roleCompany" valueField="companyCode" textField="companyName"/>
</EF:EFSelect>
<EF:EFInput ename="result-0-genralContractName" cname="总包方名称" type="hidden"/>
<EF:EFCascadeSelect cascadeFrom="result-0-subcontractCode" cname="总包方" ename="result-0-genralContractCode"
colWidth="4" required="true" filter="contains" defaultValue=""
serviceName="HGSC001" methodName="genralContractComboBox" resultId="customer_record_block_id"
textField="textField" valueField="valueField" >
</EF:EFCascadeSelect>
<EF:EFInput ename="result-0-projCode" cname="项目编号" colWidth="4" required="true" readonly="true"/>
</div>
<div class="row">
<EF:EFInput ename="result-0-projName" cname="项目名称" colWidth="4" required="true" readonly="false"/>
<EF:EFInput ename="result-0-contractName" cname="合同名称" colWidth="4" required="true" readonly="false"/>
<EF:EFMultiSelect ename="result-0-projType" cname="项目性质"
colWidth="4" required="true" readonly="false">
<EF:EFOptions blockId="proj_type_block_id" textField="textField"
valueField="valueField"/>
</EF:EFMultiSelect>
</div>
<div class="row">
<EF:EFDatePicker cname="准许开工日期" ename="result-0-permissStartDate" colWidth="4"
format="yyyy-MM-dd" required="true" readonly="false"/>
<EF:EFDatePicker cname="开工日期" ename="result-0-startDate" colWidth="4"
format="yyyy-MM-dd" required="true" readonly="false"/>
<EF:EFDatePicker cname="完工日期" ename="result-0-endDate" colWidth="4"
format="yyyy-MM-dd" required="true" readonly="false"/>
</div>
<div class="row">
<EF:EFSelect cname="项目状态" ename="result-0-projStatus" colWidth="4" filter="contains" required="true" readonly="false">
<EF:EFCodeOption codeName="hggp.projStatus" />
</EF:EFSelect>
<EF:EFInput ename="result-0-partyPmName" cname="甲方项目经理名称" colWidth="4" readonly="false"/>
<EF:EFInput ename="result-0-partyPmHpone" cname="甲方项目经理电话" colWidth="4" readonly="false"/>
</div>
<div class="row">
<EF:EFInput ename="result-0-contractWorkTxt" cname="合同工作量" type="textarea" colWidth="8" ratio="2:8" required="true" readonly="false"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="detail" title="部门负责人信息">
<EF:EFGrid blockId="detail" autoDraw="no" isFloat="true">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="userName" cname="负责人名称" required="true" hidden="true"/>
<EF:EFColumn ename="userDepCode" cname="负责人部门编码" required="true" hidden="true"/>
<EF:EFColumn ename="userCode" cname="负责人名称" required="true" align="center"/>
<%-- <EF:EFComboColumn ename="userCode" cname="负责人名称"--%>
<%-- columnTemplate="#=userName#" itemTemplate="[#=loginName#]#=userName#-#=depName#"--%>
<%-- textField="userName" valueField="loginName"--%>
<%-- maxLength="16" readonly="true" width="160" required="true"--%>
<%-- align="center" filter="contains" sort="true">--%>
<%-- <EF:EFOptions blockId="userByCompany" textField="userName" valueField="loginName"/>--%>
<%-- </EF:EFComboColumn>--%>
<EF:EFColumn ename="userDepName" cname="所属部门" required="true" enable="false" align="center"/>
<EF:EFColumn ename="userPhone" cname="电话" required="true" enable="false" align="center"/>
</EF:EFGrid>
</EF:EFRegion>
<div class="row" style="display:flex;justify-content:center;">
<EF:EFButton ename="cancel" cname="取消" type="button" class="btn-center"/>
<EF:EFButton ename="btn_save" cname="保存" type="button" class="btn-center"/>
</div>
</EF:EFPage>
$(function () {
var userByCompany = __eiInfo.getBlock("userByCompany").getMappedRows();
IPLATUI.EFGrid.detail = {
pageable: {
pageSize: 20,
pageSizes: [10, 20, 50, 70, 100],
},
columns: [{
field: "userCode",
template: function (dataItem) {
for (let i = 0; i < userByCompany.length; i++) {
if (userByCompany[i]['loginName'] === dataItem['userCode']) {
dataItem['userName'] = userByCompany[i]['userName'];
dataItem['userPhone'] = userByCompany[i]['mobile'];
dataItem['userDepCode'] = userByCompany[i]['depCode'];
dataItem['userDepName'] = userByCompany[i]['depName'];
return userByCompany[i]['userName'];
}
}
return dataItem["userName"];
},
editor: function (container, options) {
var input = $('<input />');
input.attr("name", options.field);
input.attr("id", options.field);
input.appendTo(container);
input.kendoDropDownList({
dataSource: userByCompany,
minLength: 0,
dataTextField: "userName",
dataValueField: "loginName",
optionLabelTemplate: "[#:loginName#]#:userName#-#:depName#",
valueTemplate: "[#:loginName#]#:userName#-#:depName#",
template: "[#:loginName#]#:userName#-#:depName#",
filter: "contains"
});
}
}],
loadComplete: function(grid) {
// 此 grid 对象
// 处理父子级联动,通过监听 change 事件,判断父级节点是否发生变化
grid.dataSource.bind("change", function(e) {
// 判断父级节点是否发生变化
if (e.field == "userCode") {
loadChange(grid,e,"userName");
loadChange(grid,e,"userPhone");
loadChange(grid,e,"userDepCode");
loadChange(grid,e,"userDepName");
}
});
}
}
$("#result-0-companyCode").change(function () {
let textField = IPLAT.EFSelect.text($("#result-0-companyCode"));
$("#result-0-companyName").val(textField);
})
$("#result-0-depCode").change(function () {
let textField = IPLAT.EFSelect.text($("#result-0-depCode"));
$("#result-0-depName").val(textField);
});
$("#result-0-subcontractCode").change(function () {
let textField = IPLAT.EFSelect.text($("#result-0-subcontractCode"));
$("#result-0-subcontractName").val(textField);
loadProjMg(IPLAT.EFSelect.value($("#result-0-subcontractCode")));
});
$("#result-0-genralContractCode").change(function () {
let textField = IPLAT.EFSelect.text($("#result-0-genralContractCode"));
$("#result-0-genralContractName").val(textField);
});
/**
* 加载项目负责人选项数据*
* @param companyCode
*/
function loadProjMg(companyCode){
var inInfo=new EiInfo();
inInfo.set("inqu_status-0-companyCode",companyCode);
EiCommunicator.send("HGSC001", "userByCompanyComboBox", inInfo, {
onSuccess: function (ei) {
var input=$("#inqu_status-0-groupCode");
userByCompany=ei.getBlock("userByCompany").getMappedRows();
}, onFail: function (ei) {
}
}, {async: false});
}
});
<!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:EFInput ename="result-0-companyName" cname="公司名称" type="hidden"/>
<EF:EFSelect cname="公司" ename="result-0-companyCode" colWidth="4" required="true" filter="contains">
<EF:EFOption label="-- 请选择 --" value="" />
<EF:EFOptions blockId="roleCompany" valueField="companyCode" textField="companyName"/>
</EF:EFSelect>
<EF:EFInput ename="result-0-depName" cname="部门名称" type="hidden"/>
<EF:EFCascadeSelect cascadeFrom="result-0-companyCode" cname="部门" ename="result-0-depCode"
colWidth="4" required="true" filter="contains" defaultValue=""
serviceName="HGSC001" methodName="depByCompanyComboBox" resultId="depByCompany"
textField="depName" valueField="depCode" >
</EF:EFCascadeSelect>
</div>
<div class="row">
<EF:EFInput ename="result-0-subcontractName" cname="分包方名称" type="hidden"/>
<EF:EFSelect cname="分包方" ename="result-0-subcontractCode" colWidth="4" required="true" filter="contains">
<EF:EFOption label="-- 请选择 --" value="" />
<EF:EFOptions blockId="roleCompany" valueField="companyCode" textField="companyName"/>
</EF:EFSelect>
<EF:EFInput ename="result-0-genralContractName" cname="总包方名称" type="hidden"/>
<EF:EFCascadeSelect cascadeFrom="result-0-subcontractCode" cname="总包方" ename="result-0-genralContractCode"
colWidth="4" required="true" filter="contains" defaultValue=""
serviceName="HGSC001" methodName="genralContractComboBox" resultId="customer_record_block_id"
textField="textField" valueField="valueField" >
</EF:EFCascadeSelect>
<EF:EFInput ename="result-0-projCode" cname="项目编号" colWidth="4" required="true" readonly="true"/>
</div>
<div class="row">
<EF:EFInput ename="result-0-projName" cname="项目名称" colWidth="4" required="true" readonly="true"/>
<EF:EFInput ename="result-0-contractName" cname="合同名称" colWidth="4" required="true" readonly="true"/>
<EF:EFMultiSelect ename="result-0-projType" cname="项目性质"
colWidth="4" required="true" readonly="true">
<EF:EFOptions blockId="proj_type_block_id" textField="textField"
valueField="valueField"/>
</EF:EFMultiSelect>
</div>
<div class="row">
<EF:EFDatePicker cname="准许开工日期" ename="result-0-permissStartDate" colWidth="4"
format="yyyy-MM-dd" required="true" readonly="true"/>
<EF:EFDatePicker cname="开工日期" ename="result-0-startDate" colWidth="4"
format="yyyy-MM-dd" required="true" readonly="true"/>
<EF:EFDatePicker cname="完工日期" ename="result-0-endDate" colWidth="4"
format="yyyy-MM-dd" required="true" readonly="true"/>
</div>
<div class="row">
<EF:EFSelect cname="项目状态" ename="result-0-projStatus" colWidth="4" filter="contains" required="true" readonly="true">
<EF:EFCodeOption codeName="hggp.projStatus" />
</EF:EFSelect>
<EF:EFInput ename="result-0-partyPmName" cname="甲方项目经理名称" colWidth="4" readonly="true"/>
<EF:EFInput ename="result-0-partyPmHpone" cname="甲方项目经理电话" colWidth="4" readonly="true"/>
</div>
<div class="row">
<EF:EFInput ename="result-0-contractWorkTxt" cname="合同工作量" type="textarea" colWidth="8" ratio="2:8" required="true" readonly="true"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="detail" title="部门负责人信息">
<EF:EFGrid blockId="detail" autoDraw="no" isFloat="true">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="userName" cname="负责人名称" required="true" hidden="true"/>
<EF:EFColumn ename="userDepCode" cname="负责人部门编码" required="true" hidden="true"/>
<EF:EFColumn ename="userCode" cname="负责人名称" required="true" align="center"/>
<%-- <EF:EFComboColumn ename="userCode" cname="负责人名称"--%>
<%-- columnTemplate="#=userName#" itemTemplate="[#=loginName#]#=userName#-#=depName#"--%>
<%-- textField="userName" valueField="loginName"--%>
<%-- maxLength="16" readonly="true" width="160" required="true"--%>
<%-- align="center" filter="contains" sort="true">--%>
<%-- <EF:EFOptions blockId="userByCompany" textField="userName" valueField="loginName"/>--%>
<%-- </EF:EFComboColumn>--%>
<EF:EFColumn ename="userDepName" cname="所属部门" required="true" enable="false" align="center"/>
<EF:EFColumn ename="userPhone" cname="电话" required="true" enable="false" align="center"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
$(function () {
var userByCompany = __eiInfo.getBlock("userByCompany").getMappedRows();
IPLATUI.EFGrid.detail = {
pageable: {
pageSize: 20,
pageSizes: [10, 20, 50, 70, 100],
},
columns: [{
field: "userCode",
template: function (dataItem) {
for (let i = 0; i < userByCompany.length; i++) {
if (userByCompany[i]['loginName'] === dataItem['userCode']) {
dataItem['userName'] = userByCompany[i]['userName'];
dataItem['userPhone'] = userByCompany[i]['mobile'];
dataItem['userDepCode'] = userByCompany[i]['depCode'];
dataItem['userDepName'] = userByCompany[i]['depName'];
return userByCompany[i]['userName'];
}
}
return dataItem["userName"];
},
editor: function (container, options) {
var input = $('<input />');
input.attr("name", options.field);
input.attr("id", options.field);
input.appendTo(container);
input.kendoDropDownList({
dataSource: userByCompany,
minLength: 0,
dataTextField: "userName",
dataValueField: "loginName",
optionLabelTemplate: "[#:loginName#]#:userName#-#:depName#",
valueTemplate: "[#:loginName#]#:userName#-#:depName#",
template: "[#:loginName#]#:userName#-#:depName#",
filter: "contains"
});
}
}],
loadComplete: function(grid) {
// 此 grid 对象
// 处理父子级联动,通过监听 change 事件,判断父级节点是否发生变化
grid.dataSource.bind("change", function(e) {
// 判断父级节点是否发生变化
if (e.field == "userCode") {
loadChange(grid,e,"userName");
loadChange(grid,e,"userPhone");
loadChange(grid,e,"userDepCode");
loadChange(grid,e,"userDepName");
}
});
},
onAdd: function(e) {
if(!userByCompany){
message("请选择分包方!");
e.preventDefault();
return;
}
},
onSuccess: function (e) {
if(e.eiInfo.extAttr.methodName == 'save'||e.eiInfo.extAttr.methodName == 'delete' ){
query();
}
}
}
$("#result-0-companyCode").change(function () {
let textField = IPLAT.EFSelect.text($("#result-0-companyCode"));
$("#result-0-companyName").val(textField);
})
$("#result-0-depCode").change(function () {
let textField = IPLAT.EFSelect.text($("#result-0-depCode"));
$("#result-0-depName").val(textField);
});
$("#result-0-subcontractCode").change(function () {
let textField = IPLAT.EFSelect.text($("#result-0-subcontractCode"));
$("#result-0-subcontractName").val(textField);
loadProjMg(IPLAT.EFSelect.value($("#result-0-subcontractCode")));
});
$("#result-0-genralContractCode").change(function () {
let textField = IPLAT.EFSelect.text($("#result-0-genralContractCode"));
$("#result-0-genralContractName").val(textField);
});
/**
* 加载项目负责人选项数据*
* @param companyCode
*/
function loadProjMg(companyCode){
var inInfo=new EiInfo();
inInfo.set("inqu_status-0-companyCode",companyCode);
EiCommunicator.send("HGSC001", "userByCompanyComboBox", inInfo, {
onSuccess: function (ei) {
var input=$("#inqu_status-0-groupCode");
userByCompany=ei.getBlock("userByCompany").getMappedRows();
}, onFail: function (ei) {
}
}, {async: false});
}
/**
* 取消
*/
$('#cancel').on('click', function () {
// 关闭弹窗
parent.JSColorbox.close();
})
/**
* 保存*
*/
$("#btn_save").on("click",function(){
JSUtils.confirm("确定对数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGrid("detail", "HGSC001", "save", {isAlldata:true,onSuccessCallback:saveCallback});
}
});
});
var saveCallback = function(ei){
if (ei.getStatus() >= 0) {
parent.JSColorbox.close();
}
}
});
<!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:EFInput ename="result-0-companyName" cname="公司名称" type="hidden"/>
<EF:EFSelect cname="公司" ename="result-0-companyCode" colWidth="4" required="true" filter="contains">
<EF:EFOption label="-- 请选择 --" value="" />
<EF:EFOptions blockId="roleCompany" valueField="companyCode" textField="companyName"/>
</EF:EFSelect>
<EF:EFInput ename="result-0-depName" cname="部门名称" type="hidden"/>
<EF:EFCascadeSelect cascadeFrom="result-0-companyCode" cname="部门" ename="result-0-depCode"
colWidth="4" required="true" filter="contains" defaultValue=""
serviceName="HGSC001" methodName="depByCompanyComboBox" resultId="depByCompany"
textField="depName" valueField="depCode" >
</EF:EFCascadeSelect>
</div>
<div class="row">
<EF:EFInput ename="result-0-subcontractName" cname="分包方名称" type="hidden"/>
<EF:EFSelect cname="分包方" ename="result-0-subcontractCode" colWidth="4" required="true" filter="contains">
<EF:EFOption label="-- 请选择 --" value="" />
<EF:EFOptions blockId="roleCompany" valueField="companyCode" textField="companyName"/>
</EF:EFSelect>
<EF:EFInput ename="result-0-genralContractName" cname="总包方名称" type="hidden"/>
<EF:EFCascadeSelect cascadeFrom="result-0-subcontractCode" cname="总包方" ename="result-0-genralContractCode"
colWidth="4" required="true" filter="contains" defaultValue=""
serviceName="HGSC001" methodName="genralContractComboBox" resultId="customer_record_block_id"
textField="textField" valueField="valueField" >
</EF:EFCascadeSelect>
<EF:EFInput ename="result-0-projCode" cname="项目编号" colWidth="4" required="true" readonly="true"/>
</div>
<div class="row">
<EF:EFInput ename="result-0-projName" cname="项目名称" colWidth="4" required="true" readonly="false"/>
<EF:EFInput ename="result-0-contractName" cname="合同名称" colWidth="4" required="true" readonly="false"/>
<EF:EFMultiSelect ename="result-0-projType" cname="项目性质"
colWidth="4" required="true" readonly="false">
<EF:EFOptions blockId="proj_type_block_id" textField="textField"
valueField="valueField"/>
</EF:EFMultiSelect>
</div>
<div class="row">
<EF:EFDatePicker cname="准许开工日期" ename="result-0-permissStartDate" colWidth="4"
format="yyyy-MM-dd" required="true" readonly="false"/>
<EF:EFDatePicker cname="开工日期" ename="result-0-startDate" colWidth="4"
format="yyyy-MM-dd" required="true" readonly="false"/>
<EF:EFDatePicker cname="完工日期" ename="result-0-endDate" colWidth="4"
format="yyyy-MM-dd" required="true" readonly="false"/>
</div>
<div class="row">
<EF:EFSelect cname="项目状态" ename="result-0-projStatus" colWidth="4" filter="contains" required="true" readonly="false">
<EF:EFCodeOption codeName="hggp.projStatus" />
</EF:EFSelect>
<EF:EFInput ename="result-0-partyPmName" cname="甲方项目经理名称" colWidth="4" readonly="false"/>
<EF:EFInput ename="result-0-partyPmHpone" cname="甲方项目经理电话" colWidth="4" readonly="false"/>
</div>
<div class="row">
<EF:EFInput ename="result-0-contractWorkTxt" cname="合同工作量" type="textarea" colWidth="8" ratio="2:8" required="true" readonly="false"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="detail" title="部门负责人信息">
<EF:EFGrid blockId="detail" autoDraw="no" isFloat="true">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="userName" cname="负责人名称" required="true" hidden="true"/>
<EF:EFColumn ename="userDepCode" cname="负责人部门编码" required="true" hidden="true"/>
<EF:EFColumn ename="userCode" cname="负责人名称" required="true" align="center"/>
<EF:EFColumn ename="userDepName" cname="所属部门" required="true" enable="false" align="center"/>
<EF:EFColumn ename="userPhone" cname="电话" required="true" enable="false" align="center"/>
</EF:EFGrid>
</EF:EFRegion>
<div class="row" style="display:flex;justify-content:center;">
<EF:EFButton ename="cancel" cname="取消" type="button" class="btn-center"/>
<EF:EFButton ename="btn_save" cname="保存" type="button" class="btn-center"/>
</div>
</EF:EFPage>
......@@ -545,4 +545,28 @@ function isExcelFile(uploadFileUrl) {
&& uploadFileUrl.indexOf("xlsx") === -1
&& uploadFileUrl.indexOf("XLS") === -1
&& uploadFileUrl.indexOf("XLSX") === -1;
}
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
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