Compare commits

5 Commits

Author SHA1 Message Date
2ca6153cda bug 2026-04-21 23:45:48 +08:00
6738104534 bug 2026-04-16 01:13:03 +08:00
e5da30098f Merge branch 'deng' of http://101.43.41.9:13000/xzzn/SIPAIIS_WMS_JSSW into deng 2026-04-14 20:13:49 +08:00
65c2a978b8 feat(main_JS_Company): 重构主配置与企业模块数据加载逻辑 2026-04-14 20:13:47 +08:00
80fa5872fd bug 2026-04-13 21:37:01 +08:00
16 changed files with 1046 additions and 662 deletions

View File

@ -2217,12 +2217,27 @@ public class EquipmentCardController {
HttpServletResponse response, Model model) throws IOException { HttpServletResponse response, Model model) throws IOException {
String wherestr = " where 1=1 "; String wherestr = " where 1=1 ";
String unitId = request.getParameter("unitId"); String unitId = request.getParameter("unitId");
if (unitId == null || unitId.isEmpty()) {
unitId = request.getParameter("companyId");
}
String search_name = request.getParameter("search_name"); String search_name = request.getParameter("search_name");
if (search_name == null || search_name.trim().isEmpty()) {
search_name = request.getParameter("equipmentName");
}
String processSectionId = request.getParameter("processSectionId"); String processSectionId = request.getParameter("processSectionId");
if (processSectionId == null || processSectionId.trim().isEmpty() || "undefined".equals(processSectionId)) {
processSectionId = request.getParameter("processSection");
}
String equipmentClassId = request.getParameter("equipmentClassId"); String equipmentClassId = request.getParameter("equipmentClassId");
if (equipmentClassId == null || equipmentClassId.trim().isEmpty() || "undefined".equals(equipmentClassId)) {
equipmentClassId = request.getParameter("search_pid1");
}
String equipmentLevel = request.getParameter("equipmentLevel"); String equipmentLevel = request.getParameter("equipmentLevel");
String equipmentClassCode = request.getParameter("equipmentClassCode");//类似竹一的计量表 该页面仅显示一种设备类型的 String equipmentClassCode = request.getParameter("equipmentClassCode");//类似竹一的计量表 该页面仅显示一种设备类型的
String ids = request.getParameter("ids");//页面勾选的设备id String ids = request.getParameter("ids");//页面勾选的设备id
if (ids == null || ids.trim().isEmpty()) {
ids = request.getParameter("equipmentIds");
}
if (unitId != null && !unitId.isEmpty()) { if (unitId != null && !unitId.isEmpty()) {
//获取公司下所有子节点 //获取公司下所有子节点
@ -2272,6 +2287,26 @@ public class EquipmentCardController {
// System.out.println(wherestr); // System.out.println(wherestr);
if (ids != null && !ids.trim().isEmpty()) {
// 兼容前端可能携带的首尾逗号与空白,确保仅导出选中设备。
String[] idArr = ids.split(",");
StringBuilder selectedIds = new StringBuilder();
for (String id : idArr) {
if (id != null) {
String trimmedId = id.trim();
if (!trimmedId.isEmpty()) {
if (selectedIds.length() > 0) {
selectedIds.append("','");
}
selectedIds.append(trimmedId);
}
}
}
if (selectedIds.length() > 0) {
wherestr += " and id in ('" + selectedIds + "') ";
}
}
List<EquipmentCard> equipmentCards = this.equipmentCardService.selectListByWhere(wherestr); List<EquipmentCard> equipmentCards = this.equipmentCardService.selectListByWhere(wherestr);
//导出文件到指定目录,兼容Linux //导出文件到指定目录,兼容Linux
this.equipmentCardService.downloadEquipmentExcel(response, equipmentCards); this.equipmentCardService.downloadEquipmentExcel(response, equipmentCards);

View File

@ -104,7 +104,7 @@ public class KpiPlanController {
if (StringUtils.isNotBlank(positonTypeList)) { if (StringUtils.isNotBlank(positonTypeList)) {
wherestr += " and j.level_type = " + positonTypeList; wherestr += " and j.level_type = " + positonTypeList;
} }
wherestr += "and p.create_user_id ='" + id + "'"; wherestr += " and p.create_user_id ='" + id + "'";
PageHelper.startPage(page, rows); PageHelper.startPage(page, rows);
List<KpiPlan> list = kpiPlanService.selectListByWhere(wherestr + orderstr); List<KpiPlan> list = kpiPlanService.selectListByWhere(wherestr + orderstr);
@ -387,7 +387,8 @@ public class KpiPlanController {
@RequestMapping("/export.do") @RequestMapping("/export.do")
public void export(HttpServletRequest request, HttpServletResponse response, public void export(HttpServletRequest request, HttpServletResponse response,
@RequestParam(value = "periodTypeName", required = false) String periodTypeList, @RequestParam(value = "periodTypeName", required = false) String periodTypeList,
@RequestParam(value = "positionType", required = false) String positonTypeList) throws IOException { @RequestParam(value = "positionType", required = false) String positonTypeList,
@RequestParam(value = "ids", required = false) String ids) throws IOException {
// 摘自列表查询接口 start // 摘自列表查询接口 start
User cu = (User) request.getSession().getAttribute("cu"); User cu = (User) request.getSession().getAttribute("cu");
String id = cu.getId(); String id = cu.getId();
@ -399,6 +400,10 @@ public class KpiPlanController {
if (StringUtils.isNotBlank(positonTypeList) && !"null".equals(positonTypeList)) { if (StringUtils.isNotBlank(positonTypeList) && !"null".equals(positonTypeList)) {
wherestr += " and j.level_type = " + positonTypeList; wherestr += " and j.level_type = " + positonTypeList;
} }
if (StringUtils.isNotBlank(ids)) {
String idstr = ids.replace("'", "").replace(",", "','");
wherestr += " and p.id in ('" + idstr + "')";
}
wherestr += "and p.create_user_id ='" + id + "'"; wherestr += "and p.create_user_id ='" + id + "'";
List<KpiPlan> list = kpiPlanService.selectListByWhere(wherestr + orderstr); List<KpiPlan> list = kpiPlanService.selectListByWhere(wherestr + orderstr);

View File

@ -222,18 +222,50 @@ public class SafetyCertificateController {
@RequestMapping("/deletes.do") @RequestMapping("/deletes.do")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public String delete(HttpServletRequest request, Model model, String[] ids) throws IOException { public String delete(HttpServletRequest request, Model model,
@RequestParam(value = "ids", required = false) String ids,
@RequestParam(value = "staffIds", required = false) String staffIds) throws IOException {
int result = 0; int result = 0;
for (String id : ids) {
// 兼容:支持 ids/staffIds 传 CSV也支持重复参数数组
Set<String> idSet = new LinkedHashSet<>(parseRequestIds(request, "ids", ids));
idSet.addAll(parseRequestIds(request, "staffIds", staffIds));
for (String id : idSet) {
result += service.deleteById(id); result += service.deleteById(id);
}
for (String id : ids) {
safetyFilesService.deleteByBizId(id); safetyFilesService.deleteByBizId(id);
} }
model.addAttribute("result", result); model.addAttribute("result", result);
return "result"; return "result";
} }
private List<String> parseRequestIds(HttpServletRequest request, String paramName, String rawIds) {
List<String> result = new ArrayList<>(parseIdTokens(rawIds));
String[] values = request.getParameterValues(paramName);
if (values != null) {
for (String value : values) {
result.addAll(parseIdTokens(value));
}
}
return result;
}
private List<String> parseIdTokens(String rawIds) {
List<String> result = new ArrayList<>();
if (org.apache.commons.lang3.StringUtils.isBlank(rawIds) || "null".equals(rawIds)) {
return result;
}
String[] split = rawIds.split(",");
for (String id : split) {
String value = org.apache.commons.lang3.StringUtils.trim(id);
if (org.apache.commons.lang3.StringUtils.isNotBlank(value) && value.matches("^[0-9A-Za-z_-]+$")) {
result.add(value);
}
}
return result;
}
/** /**
* 跳转导入页面 * 跳转导入页面
* *

View File

@ -339,16 +339,39 @@ public class SafetyExternalCertificateController {
@RequestMapping("/deletes.do") @RequestMapping("/deletes.do")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public String delete(HttpServletRequest request, Model model, String[] ids) throws IOException { public String delete(HttpServletRequest request, Model model,
@RequestParam(value = "ids", required = false) String ids,
@RequestParam(value = "staffIds", required = false) String staffIds) throws IOException {
int result = 0; int result = 0;
for (String id : ids) {
// 兼容:支持 ids/staffIds 传 CSV也支持重复参数数组
Set<String> certificateIdSet = new LinkedHashSet<>(parseRequestIds(request, "ids", ids));
Set<String> staffIdSet = new LinkedHashSet<>(parseRequestIds(request, "staffIds", staffIds));
for (String id : certificateIdSet) {
result += service.deleteById(id); result += service.deleteById(id);
safetyFilesService.deleteByBizId(id); safetyFilesService.deleteByBizId(id);
} }
for (String staffId : staffIdSet) {
safetyExternalStaffService.deleteById(staffId);
}
model.addAttribute("result", result); model.addAttribute("result", result);
return "result"; return "result";
} }
private List<String> parseRequestIds(HttpServletRequest request, String paramName, String rawIds) {
List<String> result = new ArrayList<>(parseExportIds(rawIds));
String[] values = request.getParameterValues(paramName);
if (values != null) {
for (String value : values) {
result.addAll(parseExportIds(value));
}
}
return result;
}
/** /**
* 跳转导入页面 * 跳转导入页面
* *
@ -536,67 +559,61 @@ public class SafetyExternalCertificateController {
public void export(HttpServletRequest request, HttpServletResponse response, public void export(HttpServletRequest request, HttpServletResponse response,
@RequestParam(value = "issueDate", required = false) String issueDate, @RequestParam(value = "issueDate", required = false) String issueDate,
@RequestParam(value = "jobType", required = false) String jobType, @RequestParam(value = "jobType", required = false) String jobType,
@RequestParam(value = "companyParam", required = false) String companyParam) throws IOException { @RequestParam(value = "companyParam", required = false) String companyParam,
// 摘自列表查询接口 start @RequestParam(value = "search_name", required = false) String searchName,
User cu = (User) request.getSession().getAttribute("cu"); @RequestParam(value = "ids", required = false) String ids,
@RequestParam(value = "staffIds", required = false) String staffIds) throws IOException {
// 与列表接口保持一致,避免“页面有数据但导出为空”
String sort = " sc.userid, sc.create_time "; String sort = " sc.userid, sc.create_time ";
String order = " desc "; String order = " desc ";
String orderstr = " order by " + sort + " " + order; String orderstr = " order by " + sort + " " + order;
String wherestr = " where flag='2' "; String wherestr = " where 1=1 ";
if (request.getParameter("search_code") != null && !request.getParameter("search_code").isEmpty()) {
List<Unit> unitlist = unitService.getUnitChildrenById(request.getParameter("search_code"));
String pidstr = "";
for (int i = 0; i < unitlist.size(); i++) {
pidstr += "'" + unitlist.get(i).getId() + "',";
}
if (pidstr != "") {
pidstr = pidstr.substring(0, pidstr.length() - 1);
wherestr += "and u.pid in (" + pidstr + ") ";
}
} else {
Company company = unitService.getCompanyByUserId(cu.getId());
String companyId = "-1";
if (company != null) {
companyId = company.getId();
}
List<User> users = unitService.getChildrenUsersById(companyId);
String userIds = "";
for (User user : users) {
if (!userIds.isEmpty()) {
userIds += "','";
}
userIds += user.getId();
}
if (!userIds.isEmpty()) {
wherestr += "and u.id in ('" + userIds + "') ";
}
}
// 搜索框筛选 // 搜索框筛选
if (request.getParameter("search_name") != null && !request.getParameter("search_name").isEmpty()) { if (StringUtils.isNotBlank(searchName)) {
wherestr += " and (sc.certificate_name like '%" + request.getParameter("search_name") + "%'" + wherestr += " and (sc.certificate_name like '%" + searchName + "%'" +
" or ses.name like '%" + request.getParameter("search_name") + "%')"; " or ses.name like '%" + searchName + "%')";
} }
// 领证时间筛选 // 领证时间筛选
if (StringUtils.isNotBlank(issueDate) && !"null".equals(issueDate)) { if (StringUtils.isNotBlank(issueDate) && !"null".equals(issueDate)) {
String[] split = issueDate.split("~"); String[] split = issueDate.split("~");
if (split.length == 2) {
String issueDate_param_start_time = split[0].trim(); String issueDate_param_start_time = split[0].trim();
String issueDate_param_end_time = split[1].trim(); String issueDate_param_end_time = split[1].trim();
wherestr += " and sc.issue_date >= '" + issueDate_param_start_time + "'" + wherestr += " and sc.issue_date >= '" + issueDate_param_start_time + "'" +
" and sc.issue_date <= '" + issueDate_param_end_time + "'"; " and sc.issue_date <= '" + issueDate_param_end_time + "'";
} }
}
//作业类型 // 作业类型
if (StringUtils.isNotBlank(jobType) && !"null".equals(jobType)) { if (StringUtils.isNotBlank(jobType) && !"null".equals(jobType)) {
wherestr += " and sc.job_type = '" + jobType + "'"; wherestr += " and sc.job_type = '" + jobType + "'";
} }
//施工单位 // 施工单位
if (StringUtils.isNotBlank(companyParam) && !"null".equals(companyParam)) { if (StringUtils.isNotBlank(companyParam) && !"null".equals(companyParam)) {
wherestr += " and ses.company = '" + companyParam + "'"; wherestr += " and ses.company = '" + companyParam + "'";
} }
// 勾选导出:有勾选则仅导出勾选数据;无勾选则按筛选条件导出全部
List<String> certificateIdList = parseExportIds(ids);
List<String> staffIdList = parseExportIds(staffIds);
if (!CollectionUtils.isEmpty(certificateIdList) || !CollectionUtils.isEmpty(staffIdList)) {
StringBuilder selectedWhere = new StringBuilder(" and (");
if (!CollectionUtils.isEmpty(certificateIdList)) {
selectedWhere.append("sc.id in (").append(joinForSqlIn(certificateIdList)).append(")");
}
if (!CollectionUtils.isEmpty(staffIdList)) {
if (!CollectionUtils.isEmpty(certificateIdList)) {
selectedWhere.append(" or ");
}
selectedWhere.append("ses.id in (").append(joinForSqlIn(staffIdList)).append(")");
}
selectedWhere.append(")");
wherestr += selectedWhere;
}
List<SafetyExternalCertificateVo> list = this.service.selectListByConditionForExternal(wherestr + orderstr); List<SafetyExternalCertificateVo> list = this.service.selectListByConditionForExternal(wherestr + orderstr);
List<SafetyExternalCertificateExcel> excelList = new ArrayList<>(); List<SafetyExternalCertificateExcel> excelList = new ArrayList<>();
SafetyExternalCertificateExcel excelEntity = null; SafetyExternalCertificateExcel excelEntity = null;
@ -605,7 +622,7 @@ public class SafetyExternalCertificateController {
BeanUtils.copyProperties(vo, excelEntity); BeanUtils.copyProperties(vo, excelEntity);
excelList.add(excelEntity); excelList.add(excelEntity);
} }
// 摘自列表查询接口 end
response.setContentType("application/vnd.ms-excel"); response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("utf8"); response.setCharacterEncoding("utf8");
response.setHeader("Content-disposition", "attachment;filename=" + java.net.URLEncoder.encode("外部人员证书信息", "UTF-8") + ".xlsx"); response.setHeader("Content-disposition", "attachment;filename=" + java.net.URLEncoder.encode("外部人员证书信息", "UTF-8") + ".xlsx");
@ -616,4 +633,31 @@ public class SafetyExternalCertificateController {
excelWriter.finish(); excelWriter.finish();
} }
} }
private List<String> parseExportIds(String rawIds) {
List<String> result = new ArrayList<>();
if (StringUtils.isBlank(rawIds) || "null".equals(rawIds)) {
return result;
}
String[] split = rawIds.split(",");
for (String id : split) {
String value = StringUtils.trim(id);
// 仅保留安全字符,避免拼接 SQL 时引入非法字符
if (StringUtils.isNotBlank(value) && value.matches("^[0-9A-Za-z_-]+$")) {
result.add(value);
}
}
return result;
}
private String joinForSqlIn(List<String> idList) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < idList.size(); i++) {
if (i > 0) {
sb.append(",");
}
sb.append("'").append(idList.get(i)).append("'");
}
return sb.toString();
}
} }

View File

@ -134,6 +134,12 @@ public class SewageController {
public String dosave(HttpServletRequest request,Model model, public String dosave(HttpServletRequest request,Model model,
@ModelAttribute Sewage sewage) { @ModelAttribute Sewage sewage) {
User cu = (User) request.getSession().getAttribute("cu"); User cu = (User) request.getSession().getAttribute("cu");
String contractNumber = sewage.getContractNumber() == null ? null : sewage.getContractNumber().trim();
sewage.setContractNumber(contractNumber);
if (this.sewageService.existsByContractNumber(contractNumber)) {
model.addAttribute("result", "{\"res\":\"合同编号已存在,不可重复\"}");
return "result";
}
sewage.setId(CommUtil.getUUID()); sewage.setId(CommUtil.getUUID());
int result = this.sewageService.save(sewage); int result = this.sewageService.save(sewage);
String resultstr = "{\"res\":\""+result+"\",\"id\":\""+sewage.getId()+"\"}"; String resultstr = "{\"res\":\""+result+"\",\"id\":\""+sewage.getId()+"\"}";
@ -193,6 +199,12 @@ public class SewageController {
public String doupdate(HttpServletRequest request,Model model, public String doupdate(HttpServletRequest request,Model model,
@ModelAttribute Sewage sewage) { @ModelAttribute Sewage sewage) {
User cu = (User) request.getSession().getAttribute("cu"); User cu = (User) request.getSession().getAttribute("cu");
String contractNumber = sewage.getContractNumber() == null ? null : sewage.getContractNumber().trim();
sewage.setContractNumber(contractNumber);
if (this.sewageService.existsByContractNumberExcludeId(contractNumber, sewage.getId())) {
model.addAttribute("result", "{\"res\":\"合同编号已存在,不可重复\"}");
return "result";
}
int result = this.sewageService.update(sewage); int result = this.sewageService.update(sewage);
String resstr="{\"res\":\""+result+"\",\"id\":\""+sewage.getId()+"\"}"; String resstr="{\"res\":\""+result+"\",\"id\":\""+sewage.getId()+"\"}";
model.addAttribute("result", resstr); model.addAttribute("result", resstr);
@ -348,7 +360,8 @@ public class SewageController {
@RequestMapping(value = "downloadExcelFun.do") @RequestMapping(value = "downloadExcelFun.do")
public ModelAndView downloadExcelFun(HttpServletRequest request, public ModelAndView downloadExcelFun(HttpServletRequest request,
HttpServletResponse response, Model model) throws IOException { HttpServletResponse response, Model model) throws IOException {
this.sewageService.outExcelFun(response); String ids = request.getParameter("ids");
this.sewageService.outExcelFun(response, ids);
return null; return null;
} }

View File

@ -1252,22 +1252,15 @@ public class WorkorderDetailController {
@RequestMapping("/doExportRepair.do") @RequestMapping("/doExportRepair.do")
public ModelAndView doExportRepair(HttpServletRequest request, public ModelAndView doExportRepair(HttpServletRequest request,
HttpServletResponse response, Model model, HttpServletResponse response, Model model,
@RequestParam(value = "ids") String ids, @RequestParam(value = "ids", required = false) String ids,
@RequestParam(value = "type") String type) throws IOException { @RequestParam(value = "type") String type) throws IOException {
if (ids != null && !ids.equals("")) { String whereStr = buildExportWhereByIdsAndType(ids, type);
String[] id = ids.split(",");
String workorderDetailsIds = "";
for (String s : id) {
workorderDetailsIds += "'" + s + "',";
}
String whereStr = "where id in (" + workorderDetailsIds.substring(0, workorderDetailsIds.length() - 1) + ")";
try { try {
List<WorkorderDetail> workorderDetails = workorderDetailService.selectListByWhere(whereStr); List<WorkorderDetail> workorderDetails = workorderDetailService.selectListByWhere(whereStr);
this.workorderDetailService.doExportRepair(response, workorderDetails, type); this.workorderDetailService.doExportRepair(response, workorderDetails, type);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
}
return null; return null;
} }
@ -1292,22 +1285,15 @@ public class WorkorderDetailController {
@RequestMapping("/doExportRepairJS.do") @RequestMapping("/doExportRepairJS.do")
public ModelAndView doExportRepairJS(HttpServletRequest request, public ModelAndView doExportRepairJS(HttpServletRequest request,
HttpServletResponse response, Model model, HttpServletResponse response, Model model,
@RequestParam(value = "ids") String ids, @RequestParam(value = "ids", required = false) String ids,
@RequestParam(value = "type") String type) throws IOException { @RequestParam(value = "type") String type) throws IOException {
if (ids != null && !ids.equals("")) { String whereStr = buildExportWhereByIdsAndType(ids, type);
String[] id = ids.split(",");
String workorderDetailsIds = "";
for (String s : id) {
workorderDetailsIds += "'" + s + "',";
}
String whereStr = "where id in (" + workorderDetailsIds.substring(0, workorderDetailsIds.length() - 1) + ")";
try { try {
List<WorkorderDetail> workorderDetails = workorderDetailService.selectListByWhere(whereStr); List<WorkorderDetail> workorderDetails = workorderDetailService.selectListByWhere(whereStr);
this.workorderDetailService.doExportRepairJS(response, workorderDetails, type); this.workorderDetailService.doExportRepairJS(response, workorderDetails, type);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
}
return null; return null;
} }
@ -1332,26 +1318,47 @@ public class WorkorderDetailController {
@RequestMapping("/doExportMain.do") @RequestMapping("/doExportMain.do")
public ModelAndView doExportMain(HttpServletRequest request, public ModelAndView doExportMain(HttpServletRequest request,
HttpServletResponse response, Model model, HttpServletResponse response, Model model,
@RequestParam(value = "ids") String ids, @RequestParam(value = "ids", required = false) String ids,
@RequestParam(value = "type") String type) throws IOException { @RequestParam(value = "type") String type) throws IOException {
if (ids != null && !ids.equals("")) { String whereStr = buildExportWhereByIdsAndType(ids, type);
String[] id = ids.split(",");
String workorderDetailsIds = "";
for (String s : id) {
workorderDetailsIds += "'" + s + "',";
}
String whereStr = "where id in (" + workorderDetailsIds.substring(0, workorderDetailsIds.length() - 1) + ")";
// System.out.println(whereStr);
try { try {
List<WorkorderDetail> workorderDetails = workorderDetailService.selectListByWhere(whereStr); List<WorkorderDetail> workorderDetails = workorderDetailService.selectListByWhere(whereStr);
this.workorderDetailService.doExportMain(response, workorderDetails, type); this.workorderDetailService.doExportMain(response, workorderDetails, type);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
}
return null; return null;
} }
private String buildExportWhereByIdsAndType(String ids, String type) {
String normalizedIds = normalizeIds(ids);
if (!normalizedIds.isEmpty()) {
String[] idArr = normalizedIds.split(",");
StringBuilder idBuilder = new StringBuilder();
for (String item : idArr) {
String id = item.trim();
if (id.isEmpty()) {
continue;
}
if (idBuilder.length() > 0) {
idBuilder.append(",");
}
idBuilder.append("'").append(id).append("'");
}
if (idBuilder.length() > 0) {
return "where id in (" + idBuilder + ")";
}
}
return "where type = '" + type + "'";
}
private String normalizeIds(String ids) {
if (ids == null || ids.trim().isEmpty()) {
return "";
}
return ids.replace("'", "").replace(" ", "").replaceAll(",+$", "");
}
/** /**
* 日历中弹出指定日期的 维修单 * 日历中弹出指定日期的 维修单
* *

View File

@ -5,6 +5,7 @@ import com.sipai.entity.sparepart.Sewage;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List; import java.util.List;
import java.util.Map;
@Repository @Repository
public class SewageDao extends CommDaoImpl<Sewage> { public class SewageDao extends CommDaoImpl<Sewage> {
@ -17,4 +18,12 @@ public class SewageDao extends CommDaoImpl<Sewage> {
return list; return list;
} }
public Integer selectCountByContractNumber(String contractNumber) {
return getSqlSession().selectOne(this.getMappernamespace() + "." + Thread.currentThread().getStackTrace()[1].getMethodName(), contractNumber);
}
public Integer selectCountByContractNumberExcludeId(Map<String, String> params) {
return getSqlSession().selectOne(this.getMappernamespace() + "." + Thread.currentThread().getStackTrace()[1].getMethodName(), params);
}
} }

View File

@ -312,6 +312,17 @@
delete from TB_Sewage_Source delete from TB_Sewage_Source
${where} ${where}
</delete> </delete>
<select id="selectCountByContractNumber" resultType="java.lang.Integer" parameterType="java.lang.String" >
select count(1)
from TB_Sewage_Source
where contract_number = #{contractNumber,jdbcType=VARCHAR}
</select>
<select id="selectCountByContractNumberExcludeId" resultType="java.lang.Integer" parameterType="java.util.Map" >
select count(1)
from TB_Sewage_Source
where contract_number = #{contractNumber,jdbcType=VARCHAR}
and id != #{id,jdbcType=VARCHAR}
</select>
<select id="selectDistinctCityByWhere" resultMap="BaseResultMap" parameterType="java.lang.String" > <select id="selectDistinctCityByWhere" resultMap="BaseResultMap" parameterType="java.lang.String" >
select Distinct [city] as [city] select Distinct [city] as [city]
from TB_Sewage_Source from TB_Sewage_Source

View File

@ -26,8 +26,11 @@ import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import static org.apache.poi.ss.usermodel.CellType.STRING; import static org.apache.poi.ss.usermodel.CellType.STRING;
@ -142,6 +145,28 @@ public class SewageService implements CommService<Sewage> {
return list; return list;
} }
public boolean existsByContractNumber(String contractNumber) {
if (contractNumber == null || contractNumber.trim().isEmpty()) {
return false;
}
Integer count = SewageDao.selectCountByContractNumber(contractNumber.trim());
return count != null && count > 0;
}
public boolean existsByContractNumberExcludeId(String contractNumber, String id) {
if (contractNumber == null || contractNumber.trim().isEmpty()) {
return false;
}
if (id == null || id.trim().isEmpty()) {
return existsByContractNumber(contractNumber);
}
Map<String, String> params = new HashMap<String, String>();
params.put("contractNumber", contractNumber.trim());
params.put("id", id.trim());
Integer count = SewageDao.selectCountByContractNumberExcludeId(params);
return count != null && count > 0;
}
/** /**
* xls文件数据转换 * xls文件数据转换
* *
@ -298,6 +323,10 @@ public class SewageService implements CommService<Sewage> {
} }
public void outExcelFun(HttpServletResponse response) throws IOException { public void outExcelFun(HttpServletResponse response) throws IOException {
outExcelFun(response, null);
}
public void outExcelFun(HttpServletResponse response, String ids) throws IOException {
String fileName = "金山卫污水厂纳管企业表.xls"; String fileName = "金山卫污水厂纳管企业表.xls";
String title = "纳管企业"; String title = "纳管企业";
// 声明一个工作薄 // 声明一个工作薄
@ -428,7 +457,7 @@ public class SewageService implements CommService<Sewage> {
// smcell.setCellStyle(tipStyle); // smcell.setCellStyle(tipStyle);
// smcell.setCellValue("注:日期格式(xxxx-xx-xx或xxxx/xx/xx), 班组类型,班组, 班次(根据系统配置名称填写),模式(填写巡检菜单里面的巡检模式) 排版日期,班组类型,班组,班次,模式都为必填项(集控班组可不填模式)。"); // smcell.setCellValue("注:日期格式(xxxx-xx-xx或xxxx/xx/xx), 班组类型,班组, 班次(根据系统配置名称填写),模式(填写巡检菜单里面的巡检模式) 排版日期,班组类型,班组,班次,模式都为必填项(集控班组可不填模式)。");
List<Sewage> list = this.selectListByWhere("where 1=1 order by contract_order asc"); List<Sewage> list = this.selectListByWhere(buildExportWhere(ids));
int n = 1; int n = 1;
if (list != null && list.size() > 0) { if (list != null && list.size() > 0) {
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
@ -577,6 +606,29 @@ public class SewageService implements CommService<Sewage> {
} }
} }
private String buildExportWhere(String ids) {
String orderBy = " order by contract_order asc";
if (ids == null || ids.trim().isEmpty()) {
return "where 1=1" + orderBy;
}
String[] arr = ids.split(",");
List<String> idList = new ArrayList<String>();
for (String item : arr) {
if (item == null) {
continue;
}
String id = item.trim();
if (!id.isEmpty() && id.matches("[A-Za-z0-9-]+")) {
idList.add("'" + id + "'");
}
}
if (idList.isEmpty()) {
return "where 1=1" + orderBy;
}
String idstr = String.join(",", idList);
return "where id in (" + idstr + ")" + orderBy;
}
/** /**
* 获取树三层结构processSection为根节点sewage为子节点 * 获取树三层结构processSection为根节点sewage为子节点
* *

View File

@ -296,8 +296,18 @@
function exportExcel() { function exportExcel() {
var periodTypeName = $('#periodTypeList').val(); var periodTypeName = $('#periodTypeList').val();
var positionType = $('#positionTypeList').val(); var positionType = $('#positionTypeList').val();
let checkedItems = $("#table").bootstrapTable('getSelections');
let ids = "";
$.each(checkedItems, function (index, item) {
ids += item.id + ",";
});
if (ids !== "") {
ids = ids.substring(0, ids.length - 1);
window.open(ext.contextPath + "/kpi/kpiPlan/export.do?periodTypeName=" + periodTypeName + "&positionType=" + positionType + "&ids=" + encodeURIComponent(ids));
} else {
window.open(ext.contextPath + "/kpi/kpiPlan/export.do?periodTypeName=" + periodTypeName + "&positionType=" + positionType); window.open(ext.contextPath + "/kpi/kpiPlan/export.do?periodTypeName=" + periodTypeName + "&positionType=" + positionType);
} }
}
</script> </script>

View File

@ -636,22 +636,29 @@
var enterpriseTotal = 0; var enterpriseTotal = 0;
var enterpriseOnline = 0; var enterpriseOnline = 0;
var enterpriseList = []; var enterpriseList = [];
var enterprisePageSize = 20; // 每页20条
var enterpriseCurrentPage = 1; // 当前页码
// 加载企业数据 // 加载企业数据(分页)
function loadEnterpriseData() { function loadEnterpriseData() {
loadEnterpriseList(enterpriseCurrentPage);
}
// 加载企业列表(分页)
function loadEnterpriseList(page) {
enterpriseCurrentPage = page;
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: ext.contextPath + '/sparepart/sewage/getList.do', url: ext.contextPath + '/sparepart/sewage/getList.do',
data: { data: {
page: 1, page: page,
rows: 1000, rows: enterprisePageSize,
sort: "displacement", sort: "displacement",
order: "asc", order: "asc",
unitId: defaultUnitId, unitId: defaultUnitId,
}, },
// async: true, async: true,
// dataType: 'json', globle: false,
// globle: false,
error: function () { error: function () {
// loadEnterpriseDataMock(); // loadEnterpriseDataMock();
return false; return false;
@ -662,12 +669,37 @@
if (dataList && dataList.rows) { if (dataList && dataList.rows) {
var list = dataList.rows || []; var list = dataList.rows || [];
enterpriseTotal = dataList.total; enterpriseTotal = dataList.total;
// 统计在线数量(全部数据,不仅仅是当前页)
enterpriseOnline = list.filter(function(item) { enterpriseOnline = list.filter(function(item) {
return item._input; return item._input;
}).length; }).length;
enterpriseList = list; enterpriseList = list;
// 为每个企业查询瞬时流量
var promises = [];
list.forEach(function(item) {
if (item.ventNum) {
var mpointCode = item.ventNum + '_SSLL';
promises.push(
getMpointValueAsync(mpointCode).then(function(value) {
item.flow = value.parmvalue || '0';
})
);
} else {
item.flow = '--';
}
});
// 等待所有瞬时流量查询完成后渲染
Promise.all(promises).then(function() {
renderEnterpriseStats(); renderEnterpriseStats();
renderEnterpriseList(list); renderEnterpriseList(list);
renderEnterprisePagination();
}).catch(function() {
renderEnterpriseStats();
renderEnterpriseList(list);
renderEnterprisePagination();
});
} else { } else {
loadEnterpriseDataMock(); loadEnterpriseDataMock();
} }
@ -700,9 +732,10 @@
$('#enterprise_total').text(enterpriseTotal); $('#enterprise_total').text(enterpriseTotal);
$('#enterprise_online').text(enterpriseOnline); $('#enterprise_online').text(enterpriseOnline);
$('#enterprise_offline').text(enterpriseTotal - enterpriseOnline); $('#enterprise_offline').text(enterpriseTotal - enterpriseOnline);
// 计算总流量 // 计算总流量(当前页)
var totalFlow = enterpriseList.reduce(function(sum, item) { var totalFlow = enterpriseList.reduce(function(sum, item) {
return sum + (item.attributes && item.attributes.flow ? item.attributes.flow : 0); var flow = item.flow || 0;
return sum + (typeof flow === 'number' ? flow : 0);
}, 0); }, 0);
$('#enterprise_total_flow').text(formatNumber(totalFlow)); $('#enterprise_total_flow').text(formatNumber(totalFlow));
} }
@ -713,7 +746,7 @@
list.forEach(function(item) { list.forEach(function(item) {
var name = item.name || item.text || '--'; var name = item.name || item.text || '--';
var status = item._input ? 'online' : 'offline'; var status = item._input ? 'online' : 'offline';
var flow = item.attributes && item.attributes.flow ? item.attributes.flow : 0; var flow = item.flow || '--';
var statusClass = status === 'online' ? 'online' : 'offline'; var statusClass = status === 'online' ? 'online' : 'offline';
var statusText = status === 'online' ? '已接入' : '未接入'; var statusText = status === 'online' ? '已接入' : '未接入';
@ -734,9 +767,34 @@
$('#enterprise_list').html(html); $('#enterprise_list').html(html);
} }
// 渲染企业分页控件
function renderEnterprisePagination() {
var totalPages = Math.ceil(enterpriseTotal / enterprisePageSize);
// 更新分页信息
var pageInfo = '第 ' + enterpriseCurrentPage + '/' + totalPages + ' 页,共 ' + enterpriseTotal + ' 条';
$('#enterprise_page_info').text(pageInfo);
// 更新分页按钮
var btnHtml = '';
btnHtml += '<button class="pagination-btn" onclick="enterpriseGoToPage(1)" ' + (enterpriseCurrentPage === 1 ? 'disabled' : '') + '>首页</button>';
btnHtml += '<button class="pagination-btn" onclick="enterpriseGoToPage(' + (enterpriseCurrentPage - 1) + ')" ' + (enterpriseCurrentPage === 1 ? 'disabled' : '') + '>上一页</button>';
btnHtml += '<button class="pagination-btn" onclick="enterpriseGoToPage(' + (enterpriseCurrentPage + 1) + ')" ' + (enterpriseCurrentPage >= totalPages ? 'disabled' : '') + '>下一页</button>';
btnHtml += '<button class="pagination-btn" onclick="enterpriseGoToPage(' + totalPages + ')" ' + (enterpriseCurrentPage >= totalPages ? 'disabled' : '') + '>末页</button>';
$('#enterprise_page_btns').html(btnHtml);
}
// 企业列表分页跳转
function enterpriseGoToPage(page) {
var totalPages = Math.ceil(enterpriseTotal / enterprisePageSize);
if (page < 1) page = 1;
if (page > totalPages) page = totalPages;
loadEnterpriseList(page);
}
// 格式化数字 // 格式化数字
function formatNumber(num) { function formatNumber(num) {
if (num === null || num === undefined) return '--'; if (num === null || num === undefined || num === '--') return '--';
return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ','); return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
} }
@ -857,11 +915,12 @@
// } // }
initProcessListByConfig(code, divid); initProcessListByConfig(code, divid);
// 如果没有告警配置,使用默认数据 // // 如果没有告警配置,使用默认数据
var hasAlarmConfig = mpcode.some(function(item) { return item.type === 'alarm'; }); // var hasAlarmConfig = mpcode.some(function(item) { return item.type === 'alarm'; });
if (!hasAlarmConfig) { // if (!hasAlarmConfig) {
initAlarmList(); // initAlarmList();
} // }
initAlarmListByConfig(code, divid)
} }
function initData() { function initData() {
@ -1110,16 +1169,24 @@
return data; return data;
} }
// 根据配置初始化工艺列表 - 调用工艺段接口 // 根据配置初始化工艺列表 - 调用工艺段接口(支持分页)
// /TGLW/user/processSection/getlist.do?rows=50&page=1&order=asc&search_code=0533JS&unitId=0533JS&search_name=&_=1775558221772 // /TGLW/user/processSection/getlist.do?rows=50&page=1&order=asc&search_code=0533JS&unitId=0533JS&search_name=&_=1775558221772
var processTotal = 0; // 工艺段总数
function initProcessListByConfig(mpointCode, containerId) { function initProcessListByConfig(mpointCode, containerId) {
loadProcessList(processCurrentPage);
}
// 加载工艺列表(分页)
function loadProcessList(page) {
processCurrentPage = page;
$.ajax({ $.ajax({
type: 'GET', type: 'GET',
url: ext.contextPath + '/user/processSection/getlist.do', url: ext.contextPath + '/user/processSection/getlist.do',
data: { data: {
unitId: defaultUnitId, unitId: defaultUnitId,
rows: 50, rows: processPageSize,
page: 1, page: page,
}, },
async: true, async: true,
dataType: 'json', dataType: 'json',
@ -1131,6 +1198,9 @@
}, },
success: function (data) { success: function (data) {
if (data && data.rows) { if (data && data.rows) {
// 更新总数
processTotal = data.total || data.rows.length;
// 将接口返回的工艺段数据转换为表格格式 // 将接口返回的工艺段数据转换为表格格式
processData = []; processData = [];
var rows = data.rows || []; var rows = data.rows || [];
@ -1153,9 +1223,10 @@
var mpointCodeParam = item.id + '_' + suffix; var mpointCodeParam = item.id + '_' + suffix;
promises.push( promises.push(
getMpointValueAsync(mpointCodeParam).then(function(value) { getMpointValueAsync(mpointCodeParam).then(function(value) {
if (suffix === '1') processItem.param1 = value; let values = (value.parmname || '--') + ':' + (value.parmvalue || '--') + (value.unit || '')
else if (suffix === '2') processItem.param2 = value; if (suffix === '1') processItem.param1 = values;
else if (suffix === '3') processItem.param3 = value; else if (suffix === '2') processItem.param2 = values;
else if (suffix === '3') processItem.param3 = values;
}) })
); );
}); });
@ -1164,8 +1235,10 @@
// 等待所有测点值获取完成后渲染表格 // 等待所有测点值获取完成后渲染表格
Promise.all(promises).then(function() { Promise.all(promises).then(function() {
renderProcessTable(); renderProcessTable();
renderProcessPagination();
}).catch(function() { }).catch(function() {
renderProcessTable(); renderProcessTable();
renderProcessPagination();
}); });
} else { } else {
// processData = generateProcessData(); // processData = generateProcessData();
@ -1190,7 +1263,8 @@
globle: false, globle: false,
success: function(data) { success: function(data) {
if (data && data.parmvalue !== undefined && data.parmvalue !== null) { if (data && data.parmvalue !== undefined && data.parmvalue !== null) {
resolve(data.parmname + ':' + data.parmvalue + data.unit); resolve(data);
// resolve(data.parmname + ':' + data.parmvalue + data.unit);
} else { } else {
resolve('--'); resolve('--');
} }
@ -1226,36 +1300,65 @@
return data; return data;
} }
// 根据配置初始化告警列表 // 根据配置初始化告警列表 - 调用告警接口
// 参考 proAlarmList.jsp 的接口调用
function initAlarmListByConfig(mpointCode, containerId) { function initAlarmListByConfig(mpointCode, containerId) {
// 获取当前时间和7天前时间
var endTime = new Date();
var startTime = new Date(endTime.getTime() - 7 * 24 * 60 * 60 * 1000);
var formatDate = function(date) {
return date.getFullYear() + '-' +
String(date.getMonth() + 1).padStart(2, '0') + '-' +
String(date.getDate()).padStart(2, '0') + ' ' +
String(date.getHours()).padStart(2, '0') + ':' +
String(date.getMinutes()).padStart(2, '0');
};
$.ajax({ $.ajax({
type: 'GET', type: 'POST',
url: ext.contextPath + '/work/mpoint/getAlarmList.do?unitId=' + unitId + '&mpointCode=' + mpointCode, url: ext.contextPath + '/alarm/proAlarm/getlist.do',
data: {
companyId: defaultUnitId,
search_name: '',
pSectionCode: '',
alarmType: '',
alarmlevel: '',
status: '',
sdt: formatDate(startTime),
edt: formatDate(endTime)
},
async: true, async: true,
dataType: 'json',
globle: false, globle: false,
error: function () { error: function () {
alarmData = generateAlarmData(); // alarmData = generateAlarmData();
renderAlarmTable(); // renderAlarmTable();
return false; return false;
}, },
success: function (data) { success: function (data) {
if (data != null && data !== '') { if (data && data.rows && data.rows.length > 0) {
try { // 将接口返回的告警数据转换为表格格式
var result = eval('(' + data + ')'); alarmData = [];
if (result.status === 'pass' && result.alarmList) { data.rows.forEach(function(item) {
alarmData = result.alarmList; alarmData.push({
id: item.id,
process: item.pointName || item.processSectionName || '--',
pointCode: item.pointCode || '',
status: item.status || '',
alarmLevel: item.alarmLevel || '',
alarmTime: item.alarmTime || '',
describe: item.describe || '',
alarmTypeName: item.alarmTypeName || '',
confirmerName: item.confirmerName || '',
confirmTime: item.confirmTime || '',
time: item.alarmTime ? item.alarmTime.substring(0, 16) : '--',
bizId: item.bizId || ''
});
});
renderAlarmTable(); renderAlarmTable();
} else { } else {
alarmData = generateAlarmData(); // alarmData = generateAlarmData();
renderAlarmTable(); // renderAlarmTable();
}
} catch (e) {
alarmData = generateAlarmData();
renderAlarmTable();
}
} else {
alarmData = generateAlarmData();
renderAlarmTable();
} }
} }
}); });
@ -1267,14 +1370,11 @@
} }
function renderProcessTable() { function renderProcessTable() {
var start = (processCurrentPage - 1) * processPageSize; // 服务端分页processData 已经是当前页数据
var end = Math.min(start + processPageSize, processData.length);
var pageData = processData.slice(start, end);
var html = ''; var html = '';
pageData.forEach(function(process) { processData.forEach(function(process) {
html += '<tr>'; html += '<tr>';
html += '<td>' + process.name + '</td>'; html += '<td>' + (process.processName || process.name || '--') + '</td>';
html += '<td>' + process.param1 + '</td>'; html += '<td>' + process.param1 + '</td>';
html += '<td>' + process.param2 + '</td>'; html += '<td>' + process.param2 + '</td>';
html += '<td>' + process.param3 + '</td>'; html += '<td>' + process.param3 + '</td>';
@ -1282,26 +1382,30 @@
html += '</tr>'; html += '</tr>';
}); });
$('#process_table tbody').html(html); $('#process_table tbody').html(html);
}
// 渲染工艺列表分页控件
function renderProcessPagination() {
var totalPages = Math.ceil(processTotal / processPageSize);
// 更新分页信息 // 更新分页信息
var totalPages = Math.ceil(processData.length / processPageSize); $('#process_page_info').text('第 ' + processCurrentPage + '/' + totalPages + ' 页,共 ' + processTotal + ' 条');
$('#process_page_info').text('第 ' + processCurrentPage + '/' + totalPages + ' 页,共 ' + processData.length + ' 条');
// 更新分页按钮 // 更新分页按钮
var btnHtml = ''; var btnHtml = '';
btnHtml += '<button class="pagination-btn" onclick="processGoToPage(1)" ' + (processCurrentPage === 1 ? 'disabled' : '') + '>首页</button>'; btnHtml += '<button class="pagination-btn" onclick="processGoToPage(1)" ' + (processCurrentPage === 1 ? 'disabled' : '') + '>首页</button>';
btnHtml += '<button class="pagination-btn" onclick="processGoToPage(' + (processCurrentPage - 1) + ')" ' + (processCurrentPage === 1 ? 'disabled' : '') + '>上一页</button>'; btnHtml += '<button class="pagination-btn" onclick="processGoToPage(' + (processCurrentPage - 1) + ')" ' + (processCurrentPage === 1 ? 'disabled' : '') + '>上一页</button>';
btnHtml += '<button class="pagination-btn" onclick="processGoToPage(' + (processCurrentPage + 1) + ')" ' + (processCurrentPage === totalPages ? 'disabled' : '') + '>下一页</button>'; btnHtml += '<button class="pagination-btn" onclick="processGoToPage(' + (processCurrentPage + 1) + ')" ' + (processCurrentPage >= totalPages ? 'disabled' : '') + '>下一页</button>';
// btnHtml += '<button class="pagination-btn" onclick="processGoToPage(' + totalPages + ')" ' + (processCurrentPage === totalPages ? 'disabled' : '') + '>末页</button>'; btnHtml += '<button class="pagination-btn" onclick="processGoToPage(' + totalPages + ')" ' + (processCurrentPage >= totalPages ? 'disabled' : '') + '>末页</button>';
$('#process_page_btns').html(btnHtml); $('#process_page_btns').html(btnHtml);
} }
// 工艺列表分页跳转
function processGoToPage(page) { function processGoToPage(page) {
var totalPages = Math.ceil(processData.length / processPageSize); var totalPages = Math.ceil(processTotal / processPageSize);
if (page < 1) page = 1; if (page < 1) page = 1;
if (page > totalPages) page = totalPages; if (page > totalPages) page = totalPages;
processCurrentPage = page; loadProcessList(page);
renderProcessTable();
} }
function initAlarmList() { function initAlarmList() {
@ -1653,6 +1757,12 @@
<div class="enterprise-list-wrapper" id="enterprise_list"> <div class="enterprise-list-wrapper" id="enterprise_list">
<!-- 企业卡片将通过JS动态生成 --> <!-- 企业卡片将通过JS动态生成 -->
</div> </div>
<!-- 企业分页 -->
<div class="pagination">
<span class="pagination-info" id="enterprise_page_info"></span>
<div class="pagination-btns" id="enterprise_page_btns"></div>
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -55,6 +55,7 @@
.table-hover > tbody > tr:hover { .table-hover > tbody > tr:hover {
cursor: pointer; cursor: pointer;
} }
.input-clear-a { .input-clear-a {
color: white; color: white;
@ -98,8 +99,8 @@
let text = "您确定要删除此 证书 信息?"; let text = "您确定要删除此 证书 信息?";
let delUrl = ext.contextPath + '/safety/externalCertificate/delete.do'; let delUrl = ext.contextPath + '/safety/externalCertificate/delete.do';
if(!id){ if (!id) {
id =staffId;//外部员工ID id = staffId;//外部员工ID
text = "您确定要删除此 人员 信息?" text = "您确定要删除此 人员 信息?"
delUrl = ext.contextPath + '/safety/externalStaff/delete.do'; delUrl = ext.contextPath + '/safety/externalStaff/delete.do';
} }
@ -143,11 +144,15 @@
} }
var deletesFun = function () { var deletesFun = function () {
var checkedItems = $("#table").bootstrapTable('getSelections'); var checkedItems = $("#table").bootstrapTable('getSelections');
var datas = ""; var ids = [];
var staffIds = [];
$.each(checkedItems, function (index, item) { $.each(checkedItems, function (index, item) {
datas += item.id + ","; if (item.id) {
ids.push(item.id);
staffIds.push(item.staffId || "");
}
}); });
if (datas == "") { if (ids.length === 0 && staffIds.length === 0) {
showAlert('d', '请先选择记录', 'mainAlertdiv'); showAlert('d', '请先选择记录', 'mainAlertdiv');
} else { } else {
swal({ swal({
@ -171,7 +176,10 @@
} }
}).then(function (willDelete) { }).then(function (willDelete) {
if (willDelete) { if (willDelete) {
$.post(ext.contextPath + '/safety/externalCertificate/deletes.do', {ids: datas}, function (data) { $.post(ext.contextPath + '/safety/externalCertificate/deletes.do', {
ids: ids.join(","),
staffIds: staffIds.join(",")
}, function (data) {
if (data > 0) { if (data > 0) {
$("#table").bootstrapTable('refresh'); $("#table").bootstrapTable('refresh');
// 初始化 作业类型 // 初始化 作业类型
@ -204,11 +212,24 @@
var companyParam = $('#companyParam').val(); var companyParam = $('#companyParam').val();
var issueDate = $('#reservationtimeD').val(); var issueDate = $('#reservationtimeD').val();
window.open(ext.contextPath + "/safety/externalCertificate/exportExcel.do?search_name=" + search_name var checkedItems = $("#table").bootstrapTable('getSelections');
+ "&search_code=" + search_code var ids = [];
+ "&jobType=" + jobType var staffIds = [];
+ "&issueDate=" + issueDate $.each(checkedItems, function (index, item) {
+ "&companyParam=" + companyParam if (item.id) {
ids.push(item.id);
} else if (item.staffId) {
staffIds.push(item.staffId);
}
});
window.open(ext.contextPath + "/safety/externalCertificate/exportExcel.do?search_name=" + encodeURIComponent(search_name || "")
+ "&search_code=" + encodeURIComponent(search_code || "")
+ "&jobType=" + encodeURIComponent(jobType || "")
+ "&issueDate=" + encodeURIComponent(issueDate || "")
+ "&companyParam=" + encodeURIComponent(companyParam || "")
+ "&ids=" + encodeURIComponent(ids.join(","))
+ "&staffIds=" + encodeURIComponent(staffIds.join(","))
); );
} }
@ -234,6 +255,7 @@
// 初始化 表格数据 // 初始化 表格数据
initFun(); initFun();
}); });
// 时间筛选 // 时间筛选
function initDate1() { function initDate1() {
var locale = { var locale = {
@ -288,6 +310,7 @@
} }
}); });
} }
//作业类型下拉数据 //作业类型下拉数据
function jobTypePulldown() { function jobTypePulldown() {
//选择 从事岗位 //选择 从事岗位
@ -316,8 +339,9 @@
}); });
}, 'json'); }, 'json');
} }
//施工单位下拉数据 //施工单位下拉数据
function companyPulldown(){ function companyPulldown() {
$.post(ext.contextPath + "/safety/externalStaff/companyPulldown.do", {}, function (data) { $.post(ext.contextPath + "/safety/externalStaff/companyPulldown.do", {}, function (data) {
$("#companyParam").empty(); $("#companyParam").empty();
var selelct_ = $("#companyParam").select2({ var selelct_ = $("#companyParam").select2({
@ -343,6 +367,7 @@
}); });
}, 'json'); }, 'json');
} }
// 初始表格 // 初始表格
var nowDate = new Date(); var nowDate = new Date();
var initFun = function () { var initFun = function () {
@ -391,17 +416,17 @@
field: 'company', // 返回json数据中的name field: 'company', // 返回json数据中的name
title: '施工单位名称', // 表格表头显示文字 title: '施工单位名称', // 表格表头显示文字
align: 'center', // 左右居中 align: 'center', // 左右居中
valign: 'middle', // 上下居中 valign: 'middle' // 上下居中
}, { }, {
field: 'certificateName', // 返回json数据中的name field: 'certificateName', // 返回json数据中的name
title: '证书名称', // 表格表头显示文字 title: '证书名称', // 表格表头显示文字
align: 'center', // 左右居中 align: 'center', // 左右居中
valign: 'middle', // 上下居中 valign: 'middle' // 上下居中
}, { }, {
field: 'certificateNo', // 返回json数据中的name field: 'certificateNo', // 返回json数据中的name
title: '证书编号', // 表格表头显示文字 title: '证书编号', // 表格表头显示文字
align: 'center', // 左右居中 align: 'center', // 左右居中
valign: 'middle', // 上下居中 valign: 'middle' // 上下居中
}, { }, {
field: 'jobCode', // 返回json数据中的name field: 'jobCode', // 返回json数据中的name
title: '作业项目代码', // 表格表头显示文字 title: '作业项目代码', // 表格表头显示文字
@ -411,39 +436,49 @@
field: 'jobType', // 返回json数据中的name field: 'jobType', // 返回json数据中的name
title: '作业类型', // 表格表头显示文字 title: '作业类型', // 表格表头显示文字
align: 'center', // 左右居中 align: 'center', // 左右居中
valign: 'middle', // 上下居中 valign: 'middle' // 上下居中
},{ }, {
field: 'issuingAuthority', // 返回json数据中的name field: 'issuingAuthority', // 返回json数据中的name
title: '发证部门', // 表格表头显示文字 title: '发证部门', // 表格表头显示文字
align: 'center', // 左右居中 align: 'center', // 左右居中
valign: 'middle', // 上下居中 valign: 'middle' // 上下居中
}, { }, {
field: 'issueDate', // 返回json数据中的name field: 'issueDate', // 返回json数据中的name
title: '领证时间', // 表格表头显示文字 title: '领证时间', // 表格表头显示文字
align: 'center', // 左右居中 align: 'center', // 左右居中
valign: 'middle', // 上下居中 valign: 'middle' // 上下居中
}, { }, {
field: 'expirationDate', // 返回json数据中的name field: 'expirationDate', // 返回json数据中的name
title: '有效期至', // 表格表头显示文字 title: '有效期至', // 表格表头显示文字
align: 'center', // 左右居中 align: 'center', // 左右居中
valign: 'middle', // 上下居中 valign: 'middle', // 上下居中
cellStyle:function(value,row,index){// 修改列(单元格)的颜色 cellStyle: function (value, row, index) {// 修改列(单元格)的颜色
if(value){ if (value) {
var stime = Date.parse(nowDate); var stime = Date.parse(nowDate);
var etime = Date.parse(new Date(value)); var etime = Date.parse(new Date(value));
// 两个时间戳相差的毫秒数 // 两个时间戳相差的毫秒数
var usedTime = etime - stime; var usedTime = etime - stime;
if(usedTime > 0){ if (usedTime > 0) {
// 计算相差的天数 // 计算相差的天数
var days = Math.floor(usedTime / (24 * 3600 * 1000)); var days = Math.floor(usedTime / (24 * 3600 * 1000));
if(days <= 30){ if (days <= 30) {
return {css:{"background-color":"rgba(220,29,54,1)","color":"rgba(255,255,255,1)"}}; return {
css: {
"background-color": "rgba(220,29,54,1)",
"color": "rgba(255,255,255,1)"
} }
}else{ };
return {css:{"background-color":"rgba(220,29,54,1)","color":"rgba(255,255,255,1)"}}; }
} else {
return {
css: {
"background-color": "rgba(220,29,54,1)",
"color": "rgba(255,255,255,1)"
}
};
} }
} }
return {css:{}}; return {css: {}};
} }
}, { }, {
title: "操作", title: "操作",
@ -454,7 +489,7 @@
var buts = ''; var buts = '';
buts += '<button class="btn btn-default btn-sm" title="编辑" onclick="editFun(\'' + row.id + '\')"><i class="fa fa-edit"></i><span class="hidden-md hidden-lg"> 编辑</span></button>'; buts += '<button class="btn btn-default btn-sm" title="编辑" onclick="editFun(\'' + row.id + '\')"><i class="fa fa-edit"></i><span class="hidden-md hidden-lg"> 编辑</span></button>';
buts += '<button class="btn btn-default btn-sm" title="删除" onclick="deleteFun(\'' + row.id + '\',\''+row.staffId+'\')"><i class="fa fa fa-trash-o"></i><span class="hidden-md hidden-lg">删除</span></button>'; buts += '<button class="btn btn-default btn-sm" title="删除" onclick="deleteFun(\'' + row.id + '\',\'' + row.staffId + '\')"><i class="fa fa fa-trash-o"></i><span class="hidden-md hidden-lg">删除</span></button>';
buts += '<button class="btn btn-default btn-sm" title="下载" onclick="fileDownload(\'' + row.fileId + '\')"><i class="fa fa-paperclip"></i><span class="hidden-md hidden-lg">下载</span></button>'; buts += '<button class="btn btn-default btn-sm" title="下载" onclick="fileDownload(\'' + row.fileId + '\')"><i class="fa fa-paperclip"></i><span class="hidden-md hidden-lg">下载</span></button>';
// buts += '<button class="btn btn-default btn-sm" title="查看详情" onclick="viewFun(\'' + row.id + '\')"><i class="fa fa-eye"></i><span class="hidden-md hidden-lg">查看详情</span></button>'; // buts += '<button class="btn btn-default btn-sm" title="查看详情" onclick="viewFun(\'' + row.id + '\')"><i class="fa fa-eye"></i><span class="hidden-md hidden-lg">查看详情</span></button>';
@ -500,14 +535,14 @@
* @param colspan 合并列 * @param colspan 合并列
* @param target 目标表格对象 * @param target 目标表格对象
*/ */
function mergeCells(data,fieldName,colspan,target){ function mergeCells(data, fieldName, colspan, target) {
//声明一个map计算相同属性值在data对象出现的次数和 //声明一个map计算相同属性值在data对象出现的次数和
var sortMap = {}; var sortMap = {};
for(var i = 0 ; i < data.length ; i++){ for (var i = 0; i < data.length; i++) {
for(var prop in data[i]){ for (var prop in data[i]) {
if(prop == fieldName){ if (prop == fieldName) {
var key = data[i][prop] var key = data[i][prop]
if(sortMap.hasOwnProperty(key)){ if (sortMap.hasOwnProperty(key)) {
sortMap[key] = sortMap[key] * 1 + 1; sortMap[key] = sortMap[key] * 1 + 1;
} else { } else {
sortMap[key] = 1; sortMap[key] = 1;
@ -516,17 +551,28 @@
} }
} }
} }
for(var prop in sortMap){ for (var prop in sortMap) {
// console.log(prop,sortMap[prop]) // console.log(prop,sortMap[prop])
} }
var index = 0; var index = 0;
for(var prop in sortMap){ for (var prop in sortMap) {
var count = sortMap[prop] * 1; var count = sortMap[prop] * 1;
$(target).bootstrapTable('mergeCells',{index:index, field:fieldName, colspan: colspan, rowspan: count}); $(target).bootstrapTable('mergeCells', {
$(target).bootstrapTable('mergeCells',{index:index, field:'company', colspan: colspan, rowspan: count}); index: index,
field: fieldName,
colspan: colspan,
rowspan: count
});
$(target).bootstrapTable('mergeCells', {
index: index,
field: 'company',
colspan: colspan,
rowspan: count
});
index += count; index += count;
} }
} }
var timedel = function () { var timedel = function () {
$('#reservationtimeD').val(''); $('#reservationtimeD').val('');
timeRangeEnd = null; timeRangeEnd = null;
@ -554,10 +600,12 @@
<div> <div>
<div class="form-group" style="padding:0;"> <div class="form-group" style="padding:0;">
<div class="btn-group" style="width: 300px;padding-bottom:10px;"> <div class="btn-group" style="width: 300px;padding-bottom:10px;">
<button type="button" class="btn btn-default btn-sm" onclick="addFun();" style="margin-right: 15px"><i <button type="button" class="btn btn-default btn-sm" onclick="addFun();"
style="margin-right: 15px"><i
class="fa fa-plus"></i> 新增 class="fa fa-plus"></i> 新增
</button> </button>
<button type="button" class="btn btn-default btn-sm" onclick="deletesFun();" style="margin-right: 15px"><i <button type="button" class="btn btn-default btn-sm" onclick="deletesFun();"
style="margin-right: 15px"><i
class="fa fa-trash-o"></i> 删除 class="fa fa-trash-o"></i> 删除
</button> </button>
<button type="button" class="btn btn-default btn-sm" style="margin-right: 15px" <button type="button" class="btn btn-default btn-sm" style="margin-right: 15px"
@ -575,12 +623,14 @@
<div class="form-group pull-right form-inline"> <div class="form-group pull-right form-inline">
<div class="form-group"> <div class="form-group">
<label class="form-label">施工单位名称:</label> <label class="form-label">施工单位名称:</label>
<select class="form-control select2" id="companyParam" name="companyParam" style="width: 180px;"> <select class="form-control select2" id="companyParam" name="companyParam"
style="width: 180px;">
</select> </select>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="form-label">作业类型:</label> <label class="form-label">作业类型:</label>
<select class="form-control select2" id="jobTypeParam" name="jobTypeParam" style="width: 180px;"> <select class="form-control select2" id="jobTypeParam" name="jobTypeParam"
style="width: 180px;">
</select> </select>
</div> </div>
<div class="input-group input-group-sm" style="width: 200px;"> <div class="input-group input-group-sm" style="width: 200px;">

View File

@ -129,11 +129,17 @@
}; };
var deletesFun = function () { var deletesFun = function () {
var checkedItems = $("#table").bootstrapTable('getSelections'); var checkedItems = $("#table").bootstrapTable('getSelections');
var datas = ""; var ids = [];
var staffIds = [];
$.each(checkedItems, function (index, item) { $.each(checkedItems, function (index, item) {
datas += item.id + ","; if (item.id) {
ids.push(item.id);
} else if (item.staffId) {
// 兼容模式若后续行模型提供备用ID批删也可工作
staffIds.push(item.staffId);
}
}); });
if (datas == "") { if (ids.length === 0 && staffIds.length === 0) {
showAlert('d', '请先选择记录', 'mainAlertdiv'); showAlert('d', '请先选择记录', 'mainAlertdiv');
} else { } else {
swal({ swal({
@ -157,7 +163,10 @@
} }
}).then(function (willDelete) { }).then(function (willDelete) {
if (willDelete) { if (willDelete) {
$.post(ext.contextPath + '/safety/internalCertificate/deletes.do', {ids: datas}, function (data) { $.post(ext.contextPath + '/safety/internalCertificate/deletes.do', {
ids: ids.join(","),
staffIds: staffIds.join(",")
}, function (data) {
if (data > 0) { if (data > 0) {
$("#table").bootstrapTable('refresh'); $("#table").bootstrapTable('refresh');
// 初始化 作业类型 // 初始化 作业类型
@ -313,17 +322,17 @@
field: 'jobType', // 返回json数据中的name field: 'jobType', // 返回json数据中的name
title: '作业类型', // 表格表头显示文字 title: '作业类型', // 表格表头显示文字
align: 'center', // 左右居中 align: 'center', // 左右居中
valign: 'middle', // 上下居中 valign: 'middle' // 上下居中
}, { }, {
field: 'issuingAuthority', // 返回json数据中的name field: 'issuingAuthority', // 返回json数据中的name
title: '发证机构', // 表格表头显示文字 title: '发证机构', // 表格表头显示文字
align: 'center', // 左右居中 align: 'center', // 左右居中
valign: 'middle', // 上下居中 valign: 'middle' // 上下居中
}, { }, {
field: 'issueDate', // 返回json数据中的name field: 'issueDate', // 返回json数据中的name
title: '领证时间', // 表格表头显示文字 title: '领证时间', // 表格表头显示文字
align: 'center', // 左右居中 align: 'center', // 左右居中
valign: 'middle', // 上下居中 valign: 'middle' // 上下居中
}, { }, {
field: 'expirationDate', // 返回json数据中的name field: 'expirationDate', // 返回json数据中的name
title: '有效期至', // 表格表头显示文字 title: '有效期至', // 表格表头显示文字

View File

@ -400,8 +400,18 @@
//导出 //导出
function downloadExcelFun() { function downloadExcelFun() {
var checkedItems = $("#table").bootstrapTable('getSelections');
var ids = "";
$.each(checkedItems, function(index, item){
ids += item.id + ",";
});
if(ids !== ""){
ids = ids.substring(0, ids.length - 1);
window.open(ext.contextPath + "/sparepart/sewage/downloadExcelFun.do?ids=" + encodeURIComponent(ids));
}else{
window.open(ext.contextPath + "/sparepart/sewage/downloadExcelFun.do"); window.open(ext.contextPath + "/sparepart/sewage/downloadExcelFun.do");
} }
}
</script> </script>
</head> </head>
<body onload="initMenu()" class="hold-transition ${cu.themeclass} sidebar-mini"> <body onload="initMenu()" class="hold-transition ${cu.themeclass} sidebar-mini">

View File

@ -418,10 +418,6 @@
var getExs = function () { var getExs = function () {
var datas = selectionIds.toString(); var datas = selectionIds.toString();
if (datas === "") {
showAlert('d', '请选中之后导出', 'mainAlertdiv');
} else {
// window.open(ext.contextPath + "/workorder/workorderDetail/doExportMain.do?ids=" + datas + "&type=maintain");
var params = { var params = {
responseType: 'blob', responseType: 'blob',
ids: datas, ids: datas,
@ -429,7 +425,6 @@
}; };
postExcelFile(params, ext.contextPath + '/workorder/workorderDetail/doExportMain.do'); postExcelFile(params, ext.contextPath + '/workorder/workorderDetail/doExportMain.do');
} }
}
function postExcelFile(params, url) { //params是post请求需要的参数url是请求url地址 function postExcelFile(params, url) { //params是post请求需要的参数url是请求url地址
var form = document.createElement("form"); var form = document.createElement("form");

View File

@ -117,21 +117,14 @@
//金山项目导出(暂时不用) //金山项目导出(暂时不用)
var getExs_JS = function () { var getExs_JS = function () {
var datas = selectionIds; var datas = selectionIds;
if (datas == 0) {
showAlert('d', '请选中之后导出', 'mainAlertdiv');
} else {
window.open(ext.contextPath + "/workorder/workorderDetail/doExportRepairJS.do?ids=" + datas + "&type=repair"); window.open(ext.contextPath + "/workorder/workorderDetail/doExportRepairJS.do?ids=" + datas + "&type=repair");
} }
}
/** /**
* 导出excel * 导出excel
*/ */
var getExs = function () { var getExs = function () {
var datas = selectionIds; var datas = selectionIds;
if (datas == 0) {
showAlert('d', '请选中之后导出', 'mainAlertdiv');
} else {
var params = { var params = {
responseType: 'blob', responseType: 'blob',
ids: datas, ids: datas,
@ -139,7 +132,6 @@
}; };
postExcelFile(params, ext.contextPath + '/workorder/workorderDetail/doExportRepair.do'); postExcelFile(params, ext.contextPath + '/workorder/workorderDetail/doExportRepair.do');
} }
}
function postExcelFile(params, url) { //params是post请求需要的参数url是请求url地址 function postExcelFile(params, url) { //params是post请求需要的参数url是请求url地址
var form = document.createElement("form"); var form = document.createElement("form");