Compare commits

11 Commits

40 changed files with 1068 additions and 693 deletions

24
pom.xml
View File

@ -21,6 +21,12 @@
<!-- 数据<E695B0>?--> <!-- 数据<E695B0>?-->
</properties> </properties>
<dependencies> <dependencies>
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
<version>5.4.0</version>
</dependency>
<!-- spring核心<E6A0B8>?--> <!-- spring核心<E6A0B8>?-->
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
@ -781,11 +787,11 @@
<version>1.6.1</version> <version>1.6.1</version>
</dependency> </dependency>
<!-- jna --> <!-- jna -->
<dependency> <!-- <dependency>-->
<groupId>net.java.dev.jna</groupId> <!-- <groupId>net.java.dev.jna</groupId>-->
<artifactId>jna</artifactId> <!-- <artifactId>jna</artifactId>-->
<version>1.0</version> <!-- <version>1.0</version>-->
</dependency> <!-- </dependency>-->
<!-- jna examples --> <!-- jna examples -->
<dependency> <dependency>
<groupId>net.java.dev.jna</groupId> <groupId>net.java.dev.jna</groupId>
@ -796,6 +802,14 @@
<build> <build>
<finalName>TGLW</finalName> <finalName>TGLW</finalName>
<resources> <resources>
<!-- <resource>-->
<!-- <directory>libs/win64</directory>-->
<!-- <targetPath>win64</targetPath>-->
<!-- <includes>-->
<!-- <include>*.dll</include>-->
<!-- </includes>-->
<!-- <filtering>false</filtering>-->
<!-- </resource>-->
<resource> <resource>
<directory>src/main/java</directory> <directory>src/main/java</directory>
<includes> <includes>

View File

@ -1,9 +0,0 @@
package com.sipai.activiti;
public class Test {
public static void main(String[] args) {
int a = 3;
int b = 3;
System.out.println(a % b);
}
}

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

@ -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

@ -242,11 +242,20 @@ public class ProcessSectionController {
@RequestMapping("/getProcessSection4Select.do") @RequestMapping("/getProcessSection4Select.do")
public String getProcessSection4Select(HttpServletRequest request, Model model) { public String getProcessSection4Select(HttpServletRequest request, Model model) {
String companyId = request.getParameter("companyId"); // 默认查询JSBZ??? String companyId = request.getParameter("companyId"); // 默认查询JSBZ???
// 使用unitService获取Unit信息因为companyId来自tb_unit // companyId在不同页面可能来自tb_unit或tb_company统一兼容两种来源
Unit unit = this.unitService.getUnitById(companyId); Unit unit = this.unitService.getUnitById(companyId);
String unitType = null;
if (unit != null) {
unitType = unit.getType();
} else if (companyId != null && !companyId.isEmpty()) {
Company company = this.unitService.getCompById(companyId);
if (company != null) {
unitType = company.getType();
}
}
String wherestr = "where 1=1 and active='" + CommString.Active_True + "' "; String wherestr = "where 1=1 and active='" + CommString.Active_True + "' ";
if (unit != null && unit.getType().equals(CommString.UNIT_TYPE_COMPANY)) { // "C";//公司 if (CommString.UNIT_TYPE_COMPANY.equals(unitType)) { // "C";//公司
String bizs = "";//公司下属所有厂id String bizs = "";//公司下属所有厂id
List<Unit> blist = this.unitService.getParentCompanyChildrenBizByUnitid(companyId); List<Unit> blist = this.unitService.getParentCompanyChildrenBizByUnitid(companyId);
if (blist != null && blist.size() > 0) { if (blist != null && blist.size() > 0) {
@ -258,7 +267,7 @@ public class ProcessSectionController {
} }
bizs = bizs.replace(",", "','"); bizs = bizs.replace(",", "','");
wherestr += " and (unit_id='" + ProcessSection.UnitId_Sys + "' or (code not in (select code from tb_process_section where unit_id='" + ProcessSection.UnitId_Sys + "')) and unit_id in ('" + bizs + "') ) "; wherestr += " and (unit_id='" + ProcessSection.UnitId_Sys + "' or (code not in (select code from tb_process_section where unit_id='" + ProcessSection.UnitId_Sys + "')) and unit_id in ('" + bizs + "') ) ";
} else if (unit != null && unit.getType().equals(CommString.UNIT_TYPE_BIZ)) { // B 水厂 } else if (CommString.UNIT_TYPE_BIZ.equals(unitType)) { // B 水厂
wherestr += " and unit_id='" + companyId + "' "; wherestr += " and unit_id='" + companyId + "' ";
} }
if (request.getParameter("search_name") != null && !request.getParameter("search_name").isEmpty()) { if (request.getParameter("search_name") != null && !request.getParameter("search_name").isEmpty()) {
@ -273,13 +282,16 @@ public class ProcessSectionController {
for (int i = 0; i < processSections.size(); i++) { for (int i = 0; i < processSections.size(); i++) {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("id", processSections.get(i).getCode()); jsonObject.put("id", processSections.get(i).getCode());
if (unit != null && unit.getType().equals(CommString.UNIT_TYPE_COMPANY)) { // "C";//公司 if (CommString.UNIT_TYPE_COMPANY.equals(unitType)) { // "C";//公司
if (!processSections.get(i).getUnitId().equals(ProcessSection.UnitId_Sys)) { if (!processSections.get(i).getUnitId().equals(ProcessSection.UnitId_Sys)) {
jsonObject.put("text", processSections.get(i).getSname() + "(" + processSections.get(i).getCompanySname() + ")"); jsonObject.put("text", processSections.get(i).getSname() + "(" + processSections.get(i).getCompanySname() + ")");
} else { } else {
jsonObject.put("text", processSections.get(i).getSname()); jsonObject.put("text", processSections.get(i).getSname());
} }
} else if (unit != null && unit.getType().equals(CommString.UNIT_TYPE_BIZ)) { // "B";//水厂 } else if (CommString.UNIT_TYPE_BIZ.equals(unitType)) { // "B";//水厂
jsonObject.put("text", processSections.get(i).getSname());
} else {
// 兜底避免前端下拉出现有id无text导致显示为空
jsonObject.put("text", processSections.get(i).getSname()); jsonObject.put("text", processSections.get(i).getSname());
} }

View File

@ -89,11 +89,26 @@ public class KPIPointController {
// List<MPointHistory> lists = mPointHistoryService.selectListByTableAWhere("tb_mp_11_GNJ1_F","MeasureDT='2016-01-10 10:16:57'"); // List<MPointHistory> lists = mPointHistoryService.selectListByTableAWhere("tb_mp_11_GNJ1_F","MeasureDT='2016-01-10 10:16:57'");
// int dd= mPointHistoryService.deleteByTableAWhere("tb_mp_11_GNJ1_F","MeasureDT='2016-01-10 10:16:57'"); // int dd= mPointHistoryService.deleteByTableAWhere("tb_mp_11_GNJ1_F","MeasureDT='2016-01-10 10:16:57'");
for (int i=0; i < list.size(); i++) { for (int i=0; i < list.size(); i++) {
ProcessSection processSection = this.processSectionService.selectById(list.get(i).getProcesssectionid()); String rawBizId = list.get(i).getBizid();
ProcessSection processSection = this.processSectionService.selectById(list.get(i).getProcesssectionid());
if (processSection == null && list.get(i).getProcesssectionid() != null && !list.get(i).getProcesssectionid().isEmpty()) {
// KPI里历史数据存在按code保存工艺段的场景优先按厂区code匹配再回退到系统库
List<ProcessSection> processSectionList = this.processSectionService.selectSimpleListByWhere(
"where code='" + list.get(i).getProcesssectionid() + "' and unit_id='" + rawBizId + "' "
);
if (processSectionList == null || processSectionList.isEmpty()) {
processSectionList = this.processSectionService.selectSimpleListByWhere(
"where code='" + list.get(i).getProcesssectionid() + "' and unit_id='" + ProcessSection.UnitId_Sys + "' "
);
}
if (processSectionList != null && !processSectionList.isEmpty()) {
processSection = processSectionList.get(0);
}
}
if (processSection != null) { if (processSection != null) {
list.get(i).setProcessectionname(processSection.getName()); list.get(i).setProcessectionname(processSection.getName());
} }
Company company = this.unitService.getCompById(list.get(i).getBizid()); Company company = this.unitService.getCompById(rawBizId);
if (company != null) { if (company != null) {
list.get(i).setBizid(company.getName()); list.get(i).setBizid(company.getName());
} }

View File

@ -1252,21 +1252,14 @@ 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(","); try {
String workorderDetailsIds = ""; List<WorkorderDetail> workorderDetails = workorderDetailService.selectListByWhere(whereStr);
for (String s : id) { this.workorderDetailService.doExportRepair(response, workorderDetails, type);
workorderDetailsIds += "'" + s + "',"; } catch (Exception e) {
} e.printStackTrace();
String whereStr = "where id in (" + workorderDetailsIds.substring(0, workorderDetailsIds.length() - 1) + ")";
try {
List<WorkorderDetail> workorderDetails = workorderDetailService.selectListByWhere(whereStr);
this.workorderDetailService.doExportRepair(response, workorderDetails, type);
} catch (Exception e) {
e.printStackTrace();
}
} }
return null; return null;
} }
@ -1292,21 +1285,14 @@ 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(","); try {
String workorderDetailsIds = ""; List<WorkorderDetail> workorderDetails = workorderDetailService.selectListByWhere(whereStr);
for (String s : id) { this.workorderDetailService.doExportRepairJS(response, workorderDetails, type);
workorderDetailsIds += "'" + s + "',"; } catch (Exception e) {
} e.printStackTrace();
String whereStr = "where id in (" + workorderDetailsIds.substring(0, workorderDetailsIds.length() - 1) + ")";
try {
List<WorkorderDetail> workorderDetails = workorderDetailService.selectListByWhere(whereStr);
this.workorderDetailService.doExportRepairJS(response, workorderDetails, type);
} catch (Exception e) {
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(","); try {
String workorderDetailsIds = ""; List<WorkorderDetail> workorderDetails = workorderDetailService.selectListByWhere(whereStr);
for (String s : id) { this.workorderDetailService.doExportMain(response, workorderDetails, type);
workorderDetailsIds += "'" + s + "',"; } catch (Exception e) {
} e.printStackTrace();
String whereStr = "where id in (" + workorderDetailsIds.substring(0, workorderDetailsIds.length() - 1) + ")";
// System.out.println(whereStr);
try {
List<WorkorderDetail> workorderDetails = workorderDetailService.selectListByWhere(whereStr);
this.workorderDetailService.doExportMain(response, workorderDetails, type);
} catch (Exception e) {
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> {
@ -16,5 +17,13 @@ public class SewageDao extends CommDaoImpl<Sewage> {
List<Sewage> list = getSqlSession().selectList(this.getMappernamespace()+"."+Thread.currentThread().getStackTrace()[1].getMethodName(), sewage); List<Sewage> list = getSqlSession().selectList(this.getMappernamespace()+"."+Thread.currentThread().getStackTrace()[1].getMethodName(), 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

@ -20,9 +20,12 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
@ -377,12 +380,12 @@ public class CommonFileServiceImpl implements CommonFileService {
try { try {
// 安全获取文件名(自动检测编码) // 安全获取文件名(自动检测编码)
fileName = getSafeFileName(item); fileName = getSafeFileName(item);
// 生成MinIO安全的对象名称 // 生成MinIO安全的对象名称
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss"); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss");
String timestamp = dateFormat.format(new Date()); String timestamp = dateFormat.format(new Date());
filePath = generateMinioObjectName(fileName, timestamp); filePath = generateMinioObjectName(fileName, timestamp);
InputStream in = item.getInputStream(); InputStream in = item.getInputStream();
String contentType = item.getContentType(); String contentType = item.getContentType();
minioTemplate.makeBucket(nameSpace); minioTemplate.makeBucket(nameSpace);
@ -391,7 +394,7 @@ public class CommonFileServiceImpl implements CommonFileService {
CommonFile commonFile = new CommonFile(); CommonFile commonFile = new CommonFile();
commonFile.setId(CommUtil.getUUID()); commonFile.setId(CommUtil.getUUID());
commonFile.setMasterid(masterId); commonFile.setMasterid(masterId);
// 20210105 YYJ 用于文件表绑定料节点用字段 tb_doc_file内和masterId一样 // 20210105 YYJ 用于文件表绑定<EFBFBD><EFBFBD>料节点用字段 tb_doc_file内和masterId一样
// commonFile.setPid(masterId); // commonFile.setPid(masterId);
commonFile.setFilename(fileName); // 保存原始文件名用于显示 commonFile.setFilename(fileName); // 保存原始文件名用于显示
commonFile.setType(contentType); commonFile.setType(contentType);
@ -400,6 +403,19 @@ public class CommonFileServiceImpl implements CommonFileService {
commonFile.setAbspath(filePath); // 保存MinIO对象名称 commonFile.setAbspath(filePath); // 保存MinIO对象名称
commonFile.setInsdt(CommUtil.nowDate()); commonFile.setInsdt(CommUtil.nowDate());
commonFile.setSize((int) item.getSize()); commonFile.setSize((int) item.getSize());
// 获取当前用户ID并设置
try {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
if (attributes != null) {
HttpServletRequest request = attributes.getRequest();
User cu = (User) request.getSession().getAttribute("cu");
if (cu != null) {
commonFile.setInsuser(cu.getId());
}
}
} catch (Exception e) {
logger.warn("无法获取当前用户信息: {}", e.getMessage());
}
res = this.insertByTable(tableName, commonFile); res = this.insertByTable(tableName, commonFile);
} catch (Exception e) { } catch (Exception e) {
logger.error("Failed to update file to MinIO for masterId: {}", masterId, e); logger.error("Failed to update file to MinIO for masterId: {}", masterId, e);

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

@ -116,8 +116,11 @@ var getFileListMinioPic = function (divId, status, entityId, previews, previewCo
tbName: tbName, tbName: tbName,
bucketName: bucketName bucketName: bucketName
}, function (data) { }, function (data) {
// 清空数组而不是重新赋值,这样可以保持引用不变
previews.length = 0;
previewConfigs.length = 0;
if (data.length > 0) { if (data.length > 0) {
previews = new Array();
$('#maintenancefile').show(); $('#maintenancefile').show();
for (var i = 0; i < data.length; i++) { for (var i = 0; i < data.length; i++) {
var previewConfig = new Object(); var previewConfig = new Object();
@ -133,10 +136,9 @@ var getFileListMinioPic = function (divId, status, entityId, previews, previewCo
} }
previewConfigs.push(previewConfig); previewConfigs.push(previewConfig);
} }
showFileInput_new(divId, previews, previewConfigs);
} else {
$('#' + divId).hide();
} }
// 无论是否有数据都重新初始化控件
showFileInput_new(divId, previews, previewConfigs);
}, 'json'); }, 'json');
}; };

View File

@ -1,9 +1,10 @@
<%@ page language="java" pageEncoding="UTF-8" %> <%@ page language="java" pageEncoding="UTF-8" %>
<script type="text/javascript"> <script type="text/javascript">
var previews = new Array(); // 不重新定义这些变量,直接使用主页面的全局变量
var previewConfigs = new Array(); // var previews = new Array();
var filelist = new Array(); // var previewConfigs = new Array();
// var filelist = new Array();
//初始化fileinput控件第一次初始化 //初始化fileinput控件第一次初始化
function initFileInput(ctrlName, uploadUrl) { function initFileInput(ctrlName, uploadUrl) {
@ -55,9 +56,10 @@
//导入文件上传完成之后的事件 //导入文件上传完成之后的事件
control.on("fileuploaded", function (event, data, previewId, index) { control.on("fileuploaded", function (event, data, previewId, index) {
if (data.response.suc) { if (data.response.suc) {
<%--getFileListMinioPic('${param.divId}','edit');--%> // 直接使用主页面的全局变量重新加载文件列表
// getFileListMinioPic('abnormityFileId', 'edit', '', previews, previewConfigs);
getFileListMinioPic('${param.divId}', 'edit', '', previews, previewConfigs); getFileListMinioPic('${param.divId}', 'edit', '', previews, previewConfigs);
// 关闭上传弹窗,返回主页面
closeModal('fileInputModal');
} }
}); });
} }

View File

@ -296,7 +296,17 @@
function exportExcel() { function exportExcel() {
var periodTypeName = $('#periodTypeList').val(); var periodTypeName = $('#periodTypeList').val();
var positionType = $('#positionTypeList').val(); var positionType = $('#positionTypeList').val();
window.open(ext.contextPath + "/kpi/kpiPlan/export.do?periodTypeName=" + periodTypeName + "&positionType=" + positionType); 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);
}
} }
</script> </script>

View File

@ -636,45 +636,77 @@
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: '0533JS', unitId: defaultUnitId,
}, },
// async: true, async: true,
// dataType: 'json', globle: false,
// globle: false,
error: function () { error: function () {
// loadEnterpriseDataMock(); // loadEnterpriseDataMock();
return false; return false;
}, },
success: function (data) { success: function (data) {
if (typeof data === "string") { if (typeof data === "string") {
var dataList = JSON.parse(data); var dataList = JSON.parse(data);
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) { // 统计在线数量(全部数据,不仅仅是当前页)
return item._input; enterpriseOnline = list.filter(function(item) {
}).length; return item._input;
enterpriseList = list; }).length;
renderEnterpriseStats(); enterpriseList = list;
renderEnterpriseList(list);
} else { // 为每个企业查询瞬时流量
loadEnterpriseDataMock(); 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();
renderEnterpriseList(list);
renderEnterprisePagination();
}).catch(function() {
renderEnterpriseStats();
renderEnterpriseList(list);
renderEnterprisePagination();
});
} else {
loadEnterpriseDataMock();
}
} }
} }
} });
}); }
}
// Mock企业数据 // Mock企业数据
function loadEnterpriseDataMock() { function 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, ',');
} }
@ -746,7 +804,7 @@
type: 'GET', type: 'GET',
url: ext.contextPath + '/base/mainConfig/getJson.do', url: ext.contextPath + '/base/mainConfig/getJson.do',
async: true, async: true,
data: {unitId: unitId}, data: {unitId: defaultUnitId},
globle: false, globle: false,
error: function () { error: function () {
console.error('获取主配置数据失败'); console.error('获取主配置数据失败');
@ -849,18 +907,20 @@
if (!hasPumpConfig) { if (!hasPumpConfig) {
initPumpStations(); initPumpStations();
} }
// // 如果没有工艺配置,使用默认数据
// var hasProcessConfig = mpcode.some(function(item) { return item.type === 'process'; });
// if (!hasProcessConfig) {
// initProcessList();
// }
initProcessListByConfig(code, divid);
// 如果没有工艺配置,使用默认数据 // // 如果没有告警配置,使用默认数据
var hasProcessConfig = mpcode.some(function(item) { return item.type === 'process'; }); // var hasAlarmConfig = mpcode.some(function(item) { return item.type === 'alarm'; });
if (!hasProcessConfig) { // if (!hasAlarmConfig) {
initProcessList(); // initAlarmList();
} // }
initAlarmListByConfig(code, divid)
// 如果没有告警配置,使用默认数据
var hasAlarmConfig = mpcode.some(function(item) { return item.type === 'alarm'; });
if (!hasAlarmConfig) {
initAlarmList();
}
} }
function initData() { function initData() {
@ -900,7 +960,7 @@
page: page, page: page,
sort: 'equipmentcardid', sort: 'equipmentcardid',
order: 'asc', order: 'asc',
unitId: unitId, unitId: defaultUnitId,
}, },
async: true, async: true,
globle: false, globle: false,
@ -1109,41 +1169,113 @@
return data; return data;
} }
// 根据配置初始化工艺列表 // 根据配置初始化工艺列表 - 调用工艺段接口(支持分页)
// /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 + '/work/mpoint/getProcessList.do?unitId=' + unitId + '&mpointCode=' + mpointCode, url: ext.contextPath + '/user/processSection/getlist.do',
data: {
unitId: defaultUnitId,
rows: processPageSize,
page: page,
},
async: true, async: true,
dataType: 'json',
globle: false, globle: false,
error: function () { error: function () {
processData = generateProcessData(); // processData = generateProcessData();
renderProcessTable(); // renderProcessTable();
return false; return false;
}, },
success: function (data) { success: function (data) {
if (data != null && data !== '') { if (data && data.rows) {
try { // 更新总数
var result = eval('(' + data + ')'); processTotal = data.total || data.rows.length;
if (result.status === 'pass' && result.processList) {
processData = result.processList; // 将接口返回的工艺段数据转换为表格格式
renderProcessTable(); processData = [];
} else { var rows = data.rows || [];
processData = generateProcessData();
renderProcessTable(); // 为每个工艺段获取测点值
} var promises = [];
} catch (e) { rows.forEach(function(item, index) {
processData = generateProcessData(); var processItem = {
...item,
processName: item.text || item.name || '--',
param1: '--',
param2: '--',
param3: '--',
deviceId: item.id || ''
};
processData.push(processItem);
// 为param1, param2, param3创建获取值的Promise
['1', '2', '3'].forEach(function(suffix) {
var mpointCodeParam = item.id + '_' + suffix;
promises.push(
getMpointValueAsync(mpointCodeParam).then(function(value) {
let values = (value.parmname || '--') + ':' + (value.parmvalue || '--') + (value.unit || '')
if (suffix === '1') processItem.param1 = values;
else if (suffix === '2') processItem.param2 = values;
else if (suffix === '3') processItem.param3 = values;
})
);
});
});
// 等待所有测点值获取完成后渲染表格
Promise.all(promises).then(function() {
renderProcessTable(); renderProcessTable();
} renderProcessPagination();
}).catch(function() {
renderProcessTable();
renderProcessPagination();
});
} else { } else {
processData = generateProcessData(); // processData = generateProcessData();
renderProcessTable(); // renderProcessTable();
} }
} }
}); });
} }
// 异步获取测点值
function getMpointValueAsync(mpointCode) {
return new Promise(function(resolve) {
$.ajax({
type: 'GET',
url: ext.contextPath + '/work/mpoint/getValue.do',
data: {
unitId: defaultUnitId,
mpointCode: mpointCode
},
async: true,
dataType: 'json',
globle: false,
success: function(data) {
if (data && data.parmvalue !== undefined && data.parmvalue !== null) {
resolve(data);
// resolve(data.parmname + ':' + data.parmvalue + data.unit);
} else {
resolve('--');
}
},
error: function() {
resolve('--');
}
});
});
}
// 生成告警列表mock数据 // 生成告警列表mock数据
function generateAlarmData() { function generateAlarmData() {
var processNames = ['粗格栅间', '细格栅间', '曝气沉砂池', '厌氧池', '缺氧池', '好氧池', '二沉池', '消毒池', '污泥浓缩池', '污泥脱水间']; var processNames = ['粗格栅间', '细格栅间', '曝气沉砂池', '厌氧池', '缺氧池', '好氧池', '二沉池', '消毒池', '污泥浓缩池', '污泥脱水间'];
@ -1168,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({
renderAlarmTable(); id: item.id,
} else { process: item.pointName || item.processSectionName || '--',
alarmData = generateAlarmData(); pointCode: item.pointCode || '',
renderAlarmTable(); status: item.status || '',
} alarmLevel: item.alarmLevel || '',
} catch (e) { alarmTime: item.alarmTime || '',
alarmData = generateAlarmData(); describe: item.describe || '',
renderAlarmTable(); alarmTypeName: item.alarmTypeName || '',
} confirmerName: item.confirmerName || '',
} else { confirmTime: item.confirmTime || '',
alarmData = generateAlarmData(); time: item.alarmTime ? item.alarmTime.substring(0, 16) : '--',
bizId: item.bizId || ''
});
});
renderAlarmTable(); renderAlarmTable();
} else {
// alarmData = generateAlarmData();
// renderAlarmTable();
} }
} }
}); });
@ -1209,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>';
@ -1224,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() {
@ -1595,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

@ -173,8 +173,8 @@
return repo.text; return repo.text;
} // 函数用于呈现当前的选择 } // 函数用于呈现当前的选择
}); });
selelct_.val('').trigger("change"); selelct_.val('').trigger("change.select2");
selelct_.on('change', function () { selelct_.off("select2:select select2:clear").on("select2:select select2:clear", function () {
//工艺段选择后,清空原有工艺段选择的设备 //工艺段选择后,清空原有工艺段选择的设备
$("#equipmentIds").val(""); $("#equipmentIds").val("");
$("#equipname").val(""); $("#equipname").val("");

View File

@ -159,8 +159,8 @@
formatResult: function formatRepo(repo){return repo.text;}, // 函数用来渲染结果 formatResult: function formatRepo(repo){return repo.text;}, // 函数用来渲染结果
formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择 formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择
}); });
selelct_.val('${abnormity.processSectionId}').trigger("change"); selelct_.val('${abnormity.processSectionId}').trigger("change.select2");
},'json'); },'json');
}; };
var companyId = "${abnormity.bizId}"; var companyId = "${abnormity.bizId}";
$(function(){ $(function(){
@ -181,9 +181,9 @@
formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择 formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择
}); });
if(data!=null && data.length>0){ if(data!=null && data.length>0){
selelct_.val('${abnormity.processSectionId}').trigger("change"); selelct_.val('${abnormity.processSectionId}').trigger("change.select2");
} }
selelct_.on('change',function(){ selelct_.off("select2:select select2:clear").on("select2:select select2:clear",function(){
//工艺段选择后,清空原有工艺段选择的设备 //工艺段选择后,清空原有工艺段选择的设备
$("#equipmentIds").val(""); $("#equipmentIds").val("");
$("#equipname").val(""); $("#equipname").val("");

View File

@ -195,8 +195,8 @@
formatResult: function formatRepo(repo){return repo.text;}, // 函数用来渲染结果 formatResult: function formatRepo(repo){return repo.text;}, // 函数用来渲染结果
formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择 formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择
}); });
selelct_.val('').trigger("change"); selelct_.val('').trigger("change.select2");
selelct_.on("change",function(e){ selelct_.off("select2:select select2:clear").on("select2:select select2:clear",function(e){
dosearch(); dosearch();
}); });
},'json'); },'json');

View File

@ -156,8 +156,8 @@
return repo.text; return repo.text;
} // 函数用于呈现当前的选择 } // 函数用于呈现当前的选择
}); });
selelct_.val('').trigger("change"); selelct_.val('').trigger("change.select2");
selelct_.on("change", function (e) { selelct_.off("select2:select select2:clear").on("select2:select select2:clear", function (e) {
initAPPFun(); initAPPFun();
}); });
}, 'json'); }, 'json');
@ -493,8 +493,8 @@
return repo.text; return repo.text;
} // 函数用于呈现当前的选择 } // 函数用于呈现当前的选择
}); });
selelct_.val('').trigger("change"); selelct_.val('').trigger("change.select2");
selelct_.on("change", function (e) { selelct_.off("select2:select select2:clear").on("select2:select select2:clear", function (e) {
// dosearch(); // dosearch();
$("#table").bootstrapTable('refresh'); $("#table").bootstrapTable('refresh');
}); });

View File

@ -170,16 +170,16 @@
return repo.text; return repo.text;
} // 函数用于呈现当前的选择 } // 函数用于呈现当前的选择
}); });
selelct_.val('').trigger("change"); selelct_.val('').trigger("change.select2");
selelct_.on("change", function (e) { selelct_.off("select2:select select2:clear").on("select2:select select2:clear", function (e) {
dosearch(); dosearch();
}); });
}, 'json'); }, 'json');
var statusSelect = $("#statusSelect").select2({ var statusSelect = $("#statusSelect").select2({
minimumResultsForSearch: 10, minimumResultsForSearch: 10,
placeholder: '请选择', placeholder: '请选择',
}).val('').trigger("change"); }).val('').trigger("change.select2");
statusSelect.on("change", function (e) { statusSelect.off("select2:select select2:clear").on("select2:select select2:clear", function (e) {
dosearch(); dosearch();
}); });
$("#table").bootstrapTable({ // 对应table标签的id $("#table").bootstrapTable({ // 对应table标签的id

View File

@ -174,8 +174,8 @@
return repo.text; return repo.text;
} // 函数用于呈现当前的选择 } // 函数用于呈现当前的选择
}); });
selelct_.val("").trigger("change"); selelct_.val("").trigger("change.select2");
selelct_.on("change", function (e) { selelct_.off("select2:select select2:clear").on("select2:select select2:clear", function (e) {
dosearch(); dosearch();
}); });
}, 'json'); }, 'json');

View File

@ -354,7 +354,7 @@
</div>--%> </div>--%>
<div class="form-group" style="margin:8px"> <div class="form-group" style="margin:8px">
<button type="button" class="btn btn-default btn-file" onclick="fileinputPic('maintenanceDetailFile')" <button type="button" class="btn btn-default btn-file" onclick="fileinputPic('abnormityFileId')"
id="btn_save"><i id="btn_save"><i
class="fa fa-paperclip"></i>上传图片 class="fa fa-paperclip"></i>上传图片
</button> </button>

View File

@ -187,8 +187,8 @@
return repo.text; return repo.text;
} // 函数用于呈现当前的选择 } // 函数用于呈现当前的选择
}); });
selelct_.val("").trigger("change"); selelct_.val("").trigger("change.select2");
selelct_.on("change", function (e) { selelct_.off("select2:select select2:clear").on("select2:select select2:clear", function (e) {
dosearch(); dosearch();
}); });
}, 'json'); }, 'json');

View File

@ -271,8 +271,8 @@
formatResult: function formatRepo(repo) { return repo.text; }, // 函数用来渲染结果 formatResult: function formatRepo(repo) { return repo.text; }, // 函数用来渲染结果
formatSelection: function formatRepoSelection(repo) { return repo.text; } // 函数用于呈现当前的选择 formatSelection: function formatRepoSelection(repo) { return repo.text; } // 函数用于呈现当前的选择
}); });
selelct_.val("").trigger("change"); selelct_.val("").trigger("change.select2");
selelct_.on("change", function (e) { selelct_.off("select2:select select2:clear").on("select2:select select2:clear", function (e) {
dosearch(); dosearch();
}); });
}, 'json'); }, 'json');

View File

@ -400,7 +400,17 @@
//导出 //导出
function downloadExcelFun() { function downloadExcelFun() {
window.open(ext.contextPath + "/sparepart/sewage/downloadExcelFun.do"); 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");
}
} }
</script> </script>
</head> </head>

View File

@ -113,7 +113,7 @@ var selectMPint = function(pid) {
formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择 formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择
}); });
if(data!=null && data.length>0){ if(data!=null && data.length>0){
selelct_.val(data[0].id).trigger("change"); selelct_.val(data[0].id).trigger("change.select2");
} }
},'json'); },'json');
}else{ }else{
@ -131,8 +131,8 @@ var selectMPint = function(pid) {
formatResult: function formatRepo(repo){return repo.text;}, // 函数用来渲染结果 formatResult: function formatRepo(repo){return repo.text;}, // 函数用来渲染结果
formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择 formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择
}); });
selelct.val('').trigger("change"); selelct.val('').trigger("change.select2");
selelct.on("change",function(e){ selelct.off("select2:select select2:clear").on("select2:select select2:clear",function(){
var companyId= $(this).val(); var companyId= $(this).val();
$.post(ext.contextPath + "/user/processSection/getProcessSection4Select.do", {companyId:companyId}, function(data) { $.post(ext.contextPath + "/user/processSection/getProcessSection4Select.do", {companyId:companyId}, function(data) {
$("#processsectionid").empty(); $("#processsectionid").empty();
@ -147,8 +147,8 @@ var selectMPint = function(pid) {
formatResult: function formatRepo(repo){return repo.text;}, // 函数用来渲染结果 formatResult: function formatRepo(repo){return repo.text;}, // 函数用来渲染结果
formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择 formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择
}); });
selelct_.val('${kPIPoint.processsectionid}').trigger("change"); selelct_.val('${kPIPoint.processsectionid}').trigger("change.select2");
},'json'); },'json');
}); });
} }
},'json'); },'json');

View File

@ -89,8 +89,8 @@ var selectMPint = function(pid) {
formatResult: function formatRepo(repo){return repo.text;}, // 函数用来渲染结果 formatResult: function formatRepo(repo){return repo.text;}, // 函数用来渲染结果
formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择 formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择
}); });
selelct_.val('${kPIPoint.processsectionid}').trigger("change"); selelct_.val('${kPIPoint.processsectionid}').trigger("change.select2");
},'json'); },'json');
}; };
$(function(){ $(function(){
@ -116,8 +116,8 @@ var selectMPint = function(pid) {
formatResult: function formatRepo(repo){return repo.text;}, // 函数用来渲染结果 formatResult: function formatRepo(repo){return repo.text;}, // 函数用来渲染结果
formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择 formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择
}); });
selelct_.val('${kPIPoint.processsectionid}').trigger("change"); selelct_.val('${kPIPoint.processsectionid}').trigger("change.select2");
},'json'); },'json');
}else{ }else{
$("#hidden_bizid").attr("disabled","disabled"); $("#hidden_bizid").attr("disabled","disabled");
$("#input_bizid").css("display", "none"); $("#input_bizid").css("display", "none");
@ -133,8 +133,8 @@ var selectMPint = function(pid) {
formatResult: function formatRepo(repo){return repo.text;}, // 函数用来渲染结果 formatResult: function formatRepo(repo){return repo.text;}, // 函数用来渲染结果
formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择 formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择
}); });
selelct.val('${kPIPoint.bizid}').trigger("change"); selelct.val('${kPIPoint.bizid}').trigger("change.select2");
selelct.on("change",function(e){ selelct.off("select2:select select2:clear").on("select2:select select2:clear",function(){
var companyId= $(this).val(); var companyId= $(this).val();
$.post(ext.contextPath + "/user/processSection/getProcessSection4Select.do", {companyId:companyId}, function(data) { $.post(ext.contextPath + "/user/processSection/getProcessSection4Select.do", {companyId:companyId}, function(data) {
$("#processsectionid").empty(); $("#processsectionid").empty();
@ -149,8 +149,8 @@ var selectMPint = function(pid) {
formatResult: function formatRepo(repo){return repo.text;}, // 函数用来渲染结果 formatResult: function formatRepo(repo){return repo.text;}, // 函数用来渲染结果
formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择 formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择
}); });
selelct_.val('').trigger("change"); selelct_.val('').trigger("change.select2");
},'json'); },'json');
}); });
} }
},'json'); },'json');

View File

@ -1,406 +1,435 @@
<%@ page language="java" pageEncoding="UTF-8"%> <%@ page language="java" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%> <%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ page import="com.sipai.entity.base.ServerObject"%> <%@ page import="com.sipai.entity.base.ServerObject" %>
<%@ taglib uri="http://www.springsecurity.org/jsp" prefix="security"%> <%@ taglib uri="http://www.springsecurity.org/jsp" prefix="security" %>
<!DOCTYPE html> <!DOCTYPE html>
<!-- <html lang="zh-CN"> --> <!-- <html lang="zh-CN"> -->
<!-- BEGIN HEAD --> <!-- BEGIN HEAD -->
<head> <head>
<title><%= ServerObject.atttable.get("TOPTITLE")%></title> <title><%= ServerObject.atttable.get("TOPTITLE")%>
</title>
<!-- 引用页头及CSS页--> <!-- 引用页头及CSS页-->
<jsp:include page="/jsp/inc.jsp"></jsp:include> <jsp:include page="/jsp/inc.jsp"></jsp:include>
<style type="text/css"> <style type="text/css">
.select2-container .select2-selection--single{ .select2-container .select2-selection--single {
height:34px; height: 34px;
line-height: 34px; line-height: 34px;
} }
.select2-selection__arrow{
margin-top:3px;
}
</style>
<script type="text/javascript">
var companyId = "";
var showMaintenanceList = function(id) {
$.post(ext.contextPath + '/maintenance/showMaintenanceList4Equipment.do', {equipmentId:id} , function(data) {
$("#subDiv").html(data);
openModal('subMaintenanceModal');
});
};
var showHandleDetailList = function(id) {
stopBubbleDefaultEvent();
$.post(ext.contextPath + '/maintenance/showHandleDetailList4Equipment.do', {equipmentId:id} , function(data) {
$("#subDiv").html(data);
openModal('handleDetailModal');
});
};
var viewEquipmentFun = function(equipmentName,equipmentCardID,id) {
$.post(ext.contextPath + '/equipment/viewEquipmentCard.do', {equipmentName:equipmentName,equipmentCardID:equipmentCardID,id:id} , function(data) {
$("#subEquipmentDiv").html(data);
openModal('subEquipmentModal');
});
};
var addFun = function() { .select2-selection__arrow {
$.post(ext.contextPath + '/work/kpipoint/add.do', {} , function(data) { margin-top: 3px;
$("#subDiv").html(data); }
openModal('subModal'); </style>
}); <script type="text/javascript">
}; var companyId = "";
var showMaintenanceList = function (id) {
$.post(ext.contextPath + '/maintenance/showMaintenanceList4Equipment.do', {equipmentId: id}, function (data) {
$("#subDiv").html(data);
openModal('subMaintenanceModal');
});
};
var showHandleDetailList = function (id) {
stopBubbleDefaultEvent();
$.post(ext.contextPath + '/maintenance/showHandleDetailList4Equipment.do', {equipmentId: id}, function (data) {
$("#subDiv").html(data);
openModal('handleDetailModal');
});
};
var viewEquipmentFun = function (equipmentName, equipmentCardID, id) {
$.post(ext.contextPath + '/equipment/viewEquipmentCard.do', {
equipmentName: equipmentName,
equipmentCardID: equipmentCardID,
id: id
}, function (data) {
$("#subEquipmentDiv").html(data);
openModal('subEquipmentModal');
});
};
var editFun = function(id) { var addFun = function () {
stopBubbleDefaultEvent(); $.post(ext.contextPath + '/work/kpipoint/add.do', {}, function (data) {
$.post(ext.contextPath + '/work/kpipoint/edit.do', {id:id} , function(data) { $("#subDiv").html(data);
$("#subDiv").html(data); openModal('subModal');
openModal('subModal'); });
}); };
};
var viewFun = function(id){ var editFun = function (id) {
$.post(ext.contextPath + '/work/kpipoint/view.do', {id:id} , function(data) { stopBubbleDefaultEvent();
$("#subDiv").html(data); $.post(ext.contextPath + '/work/kpipoint/edit.do', {id: id}, function (data) {
openModal('subModal'); $("#subDiv").html(data);
}); openModal('subModal');
}; });
};
var viewFun = function (id) {
$.post(ext.contextPath + '/work/kpipoint/view.do', {id: id}, function (data) {
$("#subDiv").html(data);
openModal('subModal');
});
};
var deleteFun = function (id) {
stopBubbleDefaultEvent();
swal({
text: "您确定要删除此记录?",
dangerMode: true,
buttons: {
cancel: {
text: "取消",
value: null,
visible: true,
className: "btn btn-default btn-sm",
closeModal: true,
},
confirm: {
text: "确定",
value: true,
visible: true,
className: "btn btn-danger btn-sm",
closeModal: true
}
}
})
.then(function (willDelete) {
if (willDelete) {
$.post(ext.contextPath + '/work/kpipoint/delete.do', {id: id}, function (data) {
if (data == 1) {
$("#table").bootstrapTable('refresh');
} else {
showAlert('d', '删除失败', 'mainAlertdiv');
}
});
var deleteFun = function(id) {
stopBubbleDefaultEvent();
swal({
text: "您确定要删除此记录?",
dangerMode: true,
buttons: {
cancel: {
text: "取消",
value: null,
visible: true,
className: "btn btn-default btn-sm",
closeModal: true,
},
confirm: {
text: "确定",
value: true,
visible: true,
className: "btn btn-danger btn-sm",
closeModal: true
}
}
})
.then(function(willDelete) {
if (willDelete) {
$.post(ext.contextPath + '/work/kpipoint/delete.do', {id : id}, function(data) {
if(data==1){
$("#table").bootstrapTable('refresh');
}else{
showAlert('d','删除失败','mainAlertdiv');
} }
}); });
};
} //删除多条资产类型数据
}); var deletesFun = function () {
}; var checkedItems = $("#table").bootstrapTable('getSelections');
//删除多条资产类型数据 var datas = "";
var deletesFun = function() { $.each(checkedItems, function (index, item) {
var checkedItems = $("#table").bootstrapTable('getSelections'); datas += item.id + ",";
var datas=""; });
$.each(checkedItems, function(index, item){ if (datas == "") {
datas+=item.id+","; showAlert('d', '请先选择记录', 'mainAlertdiv');
}); } else {
if(datas==""){ swal({
showAlert('d','请先选择记录','mainAlertdiv'); text: "您确定要删除此记录?",
}else{ dangerMode: true,
swal({ buttons: {
text: "您确定要删除此记录?", cancel: {
dangerMode: true, text: "取消",
buttons: { value: null,
cancel: { visible: true,
text: "取消", className: "btn btn-default btn-sm",
value: null, closeModal: true,
visible: true, },
className: "btn btn-default btn-sm", confirm: {
closeModal: true, text: "确定",
}, value: true,
confirm: { visible: true,
text: "确定", className: "btn btn-danger btn-sm",
value: true, closeModal: true
visible: true, }
className: "btn btn-danger btn-sm", }
closeModal: true })
} .then(function (willDelete) {
} if (willDelete) {
}) $.post(ext.contextPath + '/work/kpipoint/deletes.do', {ids: datas}, function (data) {
.then(function(willDelete) { if (data > 0) {
if (willDelete) { $("#table").bootstrapTable('refresh');
$.post(ext.contextPath + '/work/kpipoint/deletes.do', {ids:datas} , function(data) { } else {
if(data>0){ showAlert('d', '删除失败', 'mainAlertdiv');
$("#table").bootstrapTable('refresh'); }
}else{ });
showAlert('d','删除失败','mainAlertdiv');
} }
}); });
}
} };
}); var dosearch = function () {
} $("#table").bootstrapTable('refresh');
}; };
var dosearch = function() { var loadProcessSectionSelect = function (bizId) {
$("#table").bootstrapTable('refresh'); if (!bizId) {
}; refreshSelect();
var refreshSelect = function() { return;
var selelct_ =$("#processSection").select2({ }
data: null, $.post(ext.contextPath + "/user/processSection/getProcessSection4Select.do", {companyId: bizId}, function (data) {
placeholder:'请选择',//默认文字提示 $("#processSection").empty();
allowClear: true,//允许清空 var selelct_ = $("#processSection").select2({
escapeMarkup: function (markup) { return markup; }, // 自定义格式化防止xss注入 data: data,
language: "zh-CN", cache: false,
minimumInputLength: 0, placeholder: '请选择',
minimumResultsForSearch: 10,//数据超过十个启用搜索框 allowClear: true,
}); escapeMarkup: function (markup) {
$("#processSection").empty(); return markup;
// $("#table").bootstrapTable('refresh', {data:null}); },
$(".select2-selection--single").css({'height':'30px','paddingTop':'4px'}) language: "zh-CN",
}; minimumInputLength: 0,
minimumResultsForSearch: 10,
formatResult: function formatRepo(repo) {
$(function() { return repo.text;
$.post(ext.contextPath + "/user/getSearchBizsByUserId4Select.do", {}, function(data) { },
if(data.length == 1){ formatSelection: function formatRepoSelection(repo) {
//选择厂区为一个厂时隐藏选择框 return repo.text;
$("#search_code").css("display", "none"); }
$("#company").text(data[0].text); });
companyId=data[0].id; $(".select2-selection--single").css({'height': '30px', 'paddingTop': '4px'});
dosearch(); // 初始化时仅刷新控件显示,不触发查询
$.post(ext.contextPath + "/user/processSection/getProcessSection4Select.do", {companyId:companyId}, function(data) { selelct_.val('').trigger("change.select2");
$("#processSection").empty(); // 用select2事件触发查询避免普通change导致选中文本被立即重置
var selelct_ =$("#processSection").select2({ selelct_.off("select2:select select2:clear").on("select2:select select2:clear", function () {
// 让select2先完成渲染再执行查询
setTimeout(function () {
dosearch();
}, 0);
});
}, 'json');
};
var refreshSelect = function () {
var selelct_ = $("#processSection").select2({
data: null,
placeholder: '请选择',//默认文字提示
allowClear: true,//允许清空
escapeMarkup: function (markup) {
return markup;
}, // 自定义格式化防止xss注入
language: "zh-CN",
minimumInputLength: 0,
minimumResultsForSearch: 10,//数据超过十个启用搜索框
});
$("#processSection").empty();
// $("#table").bootstrapTable('refresh', {data:null});
$(".select2-selection--single").css({'height': '30px', 'paddingTop': '4px'})
};
$(function () {
$.post(ext.contextPath + "/user/getSearchBizsByUserId4Select.do", {}, function (data) {
if (data.length == 1) {
//选择厂区为一个厂时隐藏选择框
$("#search_code").css("display", "none");
$("#company").text(data[0].text);
companyId = data[0].id;
loadProcessSectionSelect(companyId);
dosearch();
} else {
// 当前页面可能不展示厂区下拉search_code被注释兜底按当前厂区/首个厂区加载工艺段
if ($("#search_code").length == 0) {
companyId = (typeof unitId !== "undefined" && unitId) ? unitId : data[0].id;
loadProcessSectionSelect(companyId);
dosearch();
return;
}
$("#company").css("display", "none");
var selelct = $("#search_code").select2({
data: data, data: data,
cache : false, placeholder: '请选择',//默认文字提示
placeholder:'请选择',//默认文字提示
allowClear: true,//允许清空 allowClear: true,//允许清空
escapeMarkup: function (markup) { return markup; }, // 自定义格式化防止xss注入 escapeMarkup: function (markup) {
language: "zh-CN", return markup;
}, // 自定义格式化防止xss注入
language: "zh-CN",
minimumInputLength: 0, minimumInputLength: 0,
minimumResultsForSearch: 10,//数据超过十个启用搜索框 minimumResultsForSearch: 10,//数据超过十个启用搜索框
formatResult: function formatRepo(repo){return repo.text;}, // 函数用来渲染结果 formatResult: function formatRepo(repo) {
formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择 return repo.text;
}); }, // 函数用来渲染结果
$(".select2-selection--single").css({'height':'30px','paddingTop':'4px'}) formatSelection: function formatRepoSelection(repo) {
selelct_.val('').trigger("change"); return repo.text;
selelct_.on("change",function(e){ } // 函数用于呈现当前的选择
dosearch(); });
}); $(".select2-selection--single").css({'height': '30px', 'paddingTop': '4px'})
selelct.val('').trigger("change.select2");
},'json'); refreshSelect();
}else{ selelct.off("select2:select select2:clear").on("select2:select select2:clear", function () {
$("#company").css("display", "none"); companyId = $(this).val();
var selelct=$("#search_code").select2({ dosearch();
data : data , refreshSelect();
placeholder:'请选择',//默认文字提示 loadProcessSectionSelect(companyId);
allowClear: true,//允许清空 });
escapeMarkup: function (markup) { return markup; }, // 自定义格式化防止xss注入
language: "zh-CN",
minimumInputLength: 0,
minimumResultsForSearch: 10,//数据超过十个启用搜索框
formatResult: function formatRepo(repo){return repo.text;}, // 函数用来渲染结果
formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择
});
$(".select2-selection--single").css({'height':'30px','paddingTop':'4px'})
selelct.val('').trigger("change");
refreshSelect();
selelct.on("change",function(e){
companyId= $(this).val();
dosearch();
refreshSelect();
$.post(ext.contextPath + "/user/processSection/getProcessSection4Select.do", {companyId:companyId}, function(data) {
$("#processSection").empty();
var selelct_ =$("#processSection").select2({
data: data,
cache : false,
placeholder:'请选择',//默认文字提示
allowClear: true,//允许清空
escapeMarkup: function (markup) { return markup; }, // 自定义格式化防止xss注入
language: "zh-CN",
minimumInputLength: 0,
minimumResultsForSearch: 10,//数据超过十个启用搜索框
formatResult: function formatRepo(repo){return repo.text;}, // 函数用来渲染结果
formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择
});
$(".select2-selection--single").css({'height':'30px','paddingTop':'4px'})
selelct_.val('').trigger("change");
selelct_.on("change",function(e){
dosearch();
});
},'json');
});
}
},'json');
$("#table").bootstrapTable({ // 对应table标签的id
url: ext.contextPath + '/work/kpipoint/getlist.do', // 获取表格数据的url
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
striped: true, //表格显示条纹默认为false
pagination: true, // 在表格底部显示分页组件默认false
pageList: [10, 20,50], // 设置页面可以显示的数据条数
pageSize: 50, // 页面数据条数
pageNumber: 1, // 首页页码
sidePagination: 'server', // 设置为服务器端分页
queryParams: function (params) { // 请求服务器数据时发送的参数可以在这里添加额外的查询参数返回false则终止请求
return {
rows: params.limit, // 每页要显示的数据条数
page: params.offset/params.limit+1, // 每页显示数据的开始页码
sort: params.sort, // 要排序的字段
order: params.order,
search_name : $('#search_name').val(),
companyId: unitId,
pSectionId: $("#processSection").val(),
} }
}, }, 'json');
sortName: 'grade', // 要排序的字段
sortOrder: 'asc', // 排序规则 $("#table").bootstrapTable({ // 对应table标签的id
onClickRow: function (row) {//单击行事件,执行查看功能 url: ext.contextPath + '/work/kpipoint/getlist.do', // 获取表格数据的url
viewFun(row.id); cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
}, striped: true, //表格显示条纹默认为false
columns: [ pagination: true, // 在表格底部显示分页组件默认false
{ pageList: [10, 20, 50], // 设置页面可以显示的数据条数
checkbox: true, // 显示一个勾选框 pageSize: 50, // 页面数据条数
},{ pageNumber: 1, // 首页页码
field: 'mpointid', // 返回json数据中的name sidePagination: 'server', // 设置为服务器端分页
title: '测量点编号', // 表格表头显示文字 queryParams: function (params) { // 请求服务器数据时发送的参数可以在这里添加额外的查询参数返回false则终止请求
align: 'center', // 左右居中 return {
valign: 'middle' // 上下居中 rows: params.limit, // 每页要显示的数据条数
},{ page: params.offset / params.limit + 1, // 每页显示数据的开始页码
field: 'mpointname', // 返回json数据中的name sort: params.sort, // 要排序的字段
title: '测量点名称', // 表格表头显示文字 order: params.order,
align: 'center', // 左右居中 search_name: $('#search_name').val(),
valign: 'middle' // 上下居中 companyId: companyId,
},{ pSectionId: $("#processSection").val(),
field: 'bizid', // 返回json数据中的name
title: '所属厂区', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle' // 上下居中
},{
field: 'processectionname', // 返回json数据中的name
title: '工艺段', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle' // 上下居中
},{
field: 'grade', // 返回json数据中的name
title: '重要等级', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle'
},{
title: "操作",
align: 'center',
valign: 'middle',
width: 120, // 定义列的宽度单位为像素px
formatter: function (value, row, index) {
var buts="";
buts+= '<security:authorize buttonUrl="work/scadaPic/edit.do">';
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+= '</security:authorize>';
buts+= '<security:authorize buttonUrl="work/scadaPic/delete.do">';
buts+='<button class="btn btn-default btn-sm" title="删除" onclick="deleteFun(\''+row.id+'\')"><i class="fa fa fa-trash-o"></i><span class="hidden-md hidden-lg">删除</span></button';
buts+= '</security:authorize>';
buts='<div class="btn-group" >'+buts+'</div>';
return buts;
} }
},
sortName: 'grade', // 要排序的字段
sortOrder: 'asc', // 排序规则
onClickRow: function (row) {//单击行事件,执行查看功能
viewFun(row.id);
},
columns: [
{
checkbox: true, // 显示一个勾选框
}, {
field: 'mpointid', // 返回json数据中的name
title: '测量点编号', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle' // 上下居中
}, {
field: 'mpointname', // 返回json数据中的name
title: '测量点名称', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle' // 上下居中
}, {
field: 'bizid', // 返回json数据中的name
title: '所属厂区', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle' // 上下居中
}, {
field: 'processectionname', // 返回json数据中的name
title: '工艺段', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle' // 上下居中
}, {
field: 'grade', // 返回json数据中的name
title: '重要等级', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle'
}, {
title: "操作",
align: 'center',
valign: 'middle',
width: 120, // 定义列的宽度单位为像素px
formatter: function (value, row, index) {
var buts = "";
buts += '<security:authorize buttonUrl="work/scadaPic/edit.do">';
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 += '</security:authorize>';
buts += '<security:authorize buttonUrl="work/scadaPic/delete.do">';
buts += '<button class="btn btn-default btn-sm" title="删除" onclick="deleteFun(\'' + row.id + '\')"><i class="fa fa fa-trash-o"></i><span class="hidden-md hidden-lg">删除</span></button';
buts += '</security:authorize>';
buts = '<div class="btn-group" >' + buts + '</div>';
return buts;
}
}
],
onLoadSuccess: function () { //加载成功时执行
adjustBootstrapTableView("table");
},
onLoadError: function () { //加载失败时执行
console.info("加载数据失败");
} }
],
onLoadSuccess: function(){ //加载成功时执行 })
adjustBootstrapTableView("table");
},
onLoadError: function(){ //加载失败时执行 });
console.info("加载数据失败"); </script>
}
})
});
</script>
</head> </head>
<body onload="initMenu()" class="hold-transition ${cu.themeclass} sidebar-mini"> <body onload="initMenu()" class="hold-transition ${cu.themeclass} sidebar-mini">
<div class="wrapper"> <div class="wrapper">
<!-- 引用top --> <!-- 引用top -->
<%-- <jsp:include page="/jsp/top.jsp"></jsp:include> --%> <%-- <jsp:include page="/jsp/top.jsp"></jsp:include> --%>
<!-- 菜单栏 --> <!-- 菜单栏 -->
<%-- <jsp:include page="/jsp/left.jsp"></jsp:include> --%> <%-- <jsp:include page="/jsp/left.jsp"></jsp:include> --%>
<div class="content-wrapper"> <div class="content-wrapper">
<!-- Content Header (Page header) --> <!-- Content Header (Page header) -->
<section class="content-header"> <section class="content-header">
<h1 id ="head_title"></h1> <h1 id="head_title"></h1>
<ol class="breadcrumb"> <ol class="breadcrumb">
<li><a id ='head_firstlevel' href="#"><i class="fa fa-dashboard"></i> </a></li> <li><a id='head_firstlevel' href="#"><i class="fa fa-dashboard"></i> </a></li>
<!-- <li class="active">Here</li> --> <!-- <li class="active">Here</li> -->
</ol> </ol>
</section> </section>
<!-- Main content --> <!-- Main content -->
<section class="content container-fluid"> <section class="content container-fluid">
<div id="mainAlertdiv"></div> <div id="mainAlertdiv"></div>
<div id="subDiv"></div> <div id="subDiv"></div>
<div id="mpSubDiv"></div> <div id="mpSubDiv"></div>
<div > <div>
<!-- <div class="form-group"> <!-- <div class="form-group">
<label class="form-label" id="companylabel">水厂:</label> <label class="form-label" id="companylabel">水厂:</label>
<label class="form-label" id="company" style="width:180px;border: none;background: transparent;" ></label> <label class="form-label" id="company" style="width:180px;border: none;background: transparent;" ></label>
<select class="form-control select2 " id="search_code" name ="search_code" style="width: 220px;"></select> <select class="form-control select2 " id="search_code" name ="search_code" style="width: 220px;"></select>
</div> --> </div> -->
<div class="form-group form-inline" style="padding:0;"> <div class="form-group form-inline" style="padding:0;">
<div class="form-group form-inline">
<div class="form-group form-inline"> <div class="form-group form-inline">
<div class="form-group form-inline"> <div class="btn-group" style="width: 220px;padding-bottom:10px;">
<div class="btn-group" style="width: 220px;padding-bottom:10px;"> <security:authorize buttonUrl="work/scadaPic/add.do">
<security:authorize buttonUrl="work/scadaPic/add.do"> <button type="button" class="btn btn-default btn-sm" onclick="addFun();"><i
<button type="button" class="btn btn-default btn-sm" onclick="addFun();"><i class="fa fa-plus"></i> 新增</button> class="fa fa-plus"></i> 新增
<button type="button" class="btn btn-default btn-sm" onclick="deletesFun();"><i class="fa fa-trash-o"></i> 删除</button> </button>
</security:authorize> <button type="button" class="btn btn-default btn-sm" onclick="deletesFun();"><i
</div> class="fa fa-trash-o"></i> 删除
</div> </button>
</div> </security:authorize>
<div class="form-group pull-right" >
<div class="input-group input-group-sm" style="width: 250px;">
<input type="text" id="search_name" name="search_name" class="form-control pull-right" placeholder="编号">
<div class="input-group-btn">
<button class="btn btn-default" onclick="dosearch();"><i class="fa fa-search"></i></button>
</div>
</div> </div>
</div> </div>
<div class="form-group pull-right">
<label class="form-label">工艺段</label>
<select class="form-control select2 " id="processSection" name ="processSection" style="width: 220px;"></select>
</div>
</div> </div>
<div class="form-group pull-right">
<table id="table"></table> <div class="input-group input-group-sm" style="width: 250px;">
<input type="text" id="search_name" name="search_name" class="form-control pull-right"
placeholder="编号">
<div class="input-group-btn">
<button class="btn btn-default" onclick="dosearch();"><i class="fa fa-search"></i>
</button>
</div>
</div>
</div>
<div class="form-group pull-right">
<label class="form-label">工艺段</label>
<select class="form-control select2 " id="processSection" name="processSection"
style="width: 220px;"></select>
</div>
</div> </div>
<table id="table"></table>
</div>
</section>
<!-- /.content -->
</div> </section>
<%-- <jsp:include page="/jsp/bottom.jsp"></jsp:include> --%> <!-- /.content -->
<%-- <jsp:include page="/jsp/side.jsp"></jsp:include> --%>
</div> </div>
<%-- <jsp:include page="/jsp/bottom.jsp"></jsp:include> --%>
<%-- <jsp:include page="/jsp/side.jsp"></jsp:include> --%>
</div>
</body> </body>
<!-- 文件上传--> <!-- 文件上传-->
<link rel="stylesheet" href="<%=request.getContextPath()%>/node_modules/bootstrap-fileinput/css/fileinput.min.css"/> <link rel="stylesheet" href="<%=request.getContextPath()%>/node_modules/bootstrap-fileinput/css/fileinput.min.css"/>
<%-- <script type="text/javascript" src="<%=request.getContextPath()%>/node_modules/bootstrap-fileinput/js/fileinput.min.js" charset="utf-8"></script> <%-- <script type="text/javascript" src="<%=request.getContextPath()%>/node_modules/bootstrap-fileinput/js/fileinput.min.js" charset="utf-8"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/node_modules/bootstrap-fileinput/js/locales/zh.js" charset="utf-8"></script> --%> <script type="text/javascript" src="<%=request.getContextPath()%>/node_modules/bootstrap-fileinput/js/locales/zh.js" charset="utf-8"></script> --%>
<script type="text/javascript"> <script type="text/javascript">
document.write("<scr"+"ipt src=\"<%=request.getContextPath()%>/node_modules/bootstrap-fileinput/js/fileinput.min.js\"></sc"+"ript>") document.write("<scr" + "ipt src=\"<%=request.getContextPath()%>/node_modules/bootstrap-fileinput/js/fileinput.min.js\"></sc" + "ript>")
document.write("<scr"+"ipt src=\"<%=request.getContextPath()%>/node_modules/bootstrap-fileinput/js/locales/zh.js\"></sc"+"ript>") document.write("<scr" + "ipt src=\"<%=request.getContextPath()%>/node_modules/bootstrap-fileinput/js/locales/zh.js\"></sc" + "ript>")
</script> </script>
<!-- 引入ChartJS--> <!-- 引入ChartJS-->
<script type="text/javascript" src="<%=request.getContextPath()%>/node_modules/chart.js/dist/Chart.min.js" charset="utf-8"></script> <script type="text/javascript" src="<%=request.getContextPath()%>/node_modules/chart.js/dist/Chart.min.js"
<script type="text/javascript" src="<%=request.getContextPath()%>/node_modules/chart.js/dist/Chart.bundle.min.js" charset="utf-8"></script> charset="utf-8"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/node_modules/chart.js/dist/Chart.bundle.min.js"
charset="utf-8"></script>
<!-- 引入daterangepicker--> <!-- 引入daterangepicker-->
<link rel="stylesheet" href="<%=request.getContextPath()%>/plugins/bootstrap-daterangepicker/daterangepicker.css"/> <link rel="stylesheet" href="<%=request.getContextPath()%>/plugins/bootstrap-daterangepicker/daterangepicker.css"/>
<script type="text/javascript" src="<%=request.getContextPath()%>/plugins/bootstrap-daterangepicker/moment.min.js" charset="utf-8"></script> <script type="text/javascript" src="<%=request.getContextPath()%>/plugins/bootstrap-daterangepicker/moment.min.js"
<script type="text/javascript" src="<%=request.getContextPath()%>/plugins/bootstrap-daterangepicker/daterangepicker.js" charset="utf-8"></script> charset="utf-8"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/plugins/bootstrap-daterangepicker/daterangepicker.js"
charset="utf-8"></script>
<!-- echarts--> <!-- echarts-->
<script type="text/javascript" src="<%=request.getContextPath()%>/plugins/echarts/echarts.js" charset="utf-8"></script> <script type="text/javascript" src="<%=request.getContextPath()%>/plugins/echarts/echarts.js" charset="utf-8"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/plugins/echarts/macarons.js" charset="utf-8"></script> <script type="text/javascript" src="<%=request.getContextPath()%>/plugins/echarts/macarons.js" charset="utf-8"></script>

View File

@ -139,6 +139,34 @@ var companyId = "";
var dosearch = function() { var dosearch = function() {
$("#table").bootstrapTable('refresh'); $("#table").bootstrapTable('refresh');
}; };
var loadProcessSectionSelect = function(companyId) {
if (!companyId) {
refreshSelect();
return;
}
$.post(ext.contextPath + "/user/processSection/getProcessSection4Select.do", {companyId:companyId}, function(data) {
$("#processSection").empty();
var selelct_ =$("#processSection").select2({
data: data,
cache : false,
placeholder:'请选择',
allowClear: true,
escapeMarkup: function (markup) { return markup; },
language: "zh-CN",
minimumInputLength: 0,
minimumResultsForSearch: 10,
formatResult: function formatRepo(repo){return repo.text;},
formatSelection: function formatRepoSelection(repo){return repo.text;}
});
$(".select2-selection--single").css({'height':'30px','paddingTop':'4px'});
selelct_.val('').trigger("change.select2");
selelct_.off("select2:select select2:clear").on("select2:select select2:clear",function(){
setTimeout(function(){
dosearch();
},0);
});
},'json');
};
var refreshSelect = function() { var refreshSelect = function() {
var selelct_ =$("#processSection").select2({ var selelct_ =$("#processSection").select2({
data: null, data: null,
@ -163,27 +191,7 @@ var companyId = "";
$("#company").text(data[0].text); $("#company").text(data[0].text);
companyId=data[0].id; companyId=data[0].id;
dosearch(); dosearch();
$.post(ext.contextPath + "/user/processSection/getProcessSection4Select.do", {companyId:companyId}, function(data) { loadProcessSectionSelect(companyId);
$("#processSection").empty();
var selelct_ =$("#processSection").select2({
data: data,
cache : false,
placeholder:'请选择',//默认文字提示
allowClear: true,//允许清空
escapeMarkup: function (markup) { return markup; }, // 自定义格式化防止xss注入
language: "zh-CN",
minimumInputLength: 0,
minimumResultsForSearch: 10,//数据超过十个启用搜索框
formatResult: function formatRepo(repo){return repo.text;}, // 函数用来渲染结果
formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择
});
$(".select2-selection--single").css({'height':'30px','paddingTop':'4px'})
selelct_.val('').trigger("change");
selelct_.on("change",function(e){
dosearch();
});
},'json');
}else{ }else{
$("#company").css("display", "none"); $("#company").css("display", "none");
var selelct=$("#search_code").select2({ var selelct=$("#search_code").select2({
@ -198,33 +206,14 @@ var companyId = "";
formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择 formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择
}); });
$(".select2-selection--single").css({'height':'30px','paddingTop':'4px'}) $(".select2-selection--single").css({'height':'30px','paddingTop':'4px'})
selelct.val('').trigger("change"); selelct.val('').trigger("change.select2");
refreshSelect(); refreshSelect();
selelct.on("change",function(e){ selelct.off("select2:select select2:clear").on("select2:select select2:clear",function(){
companyId= $(this).val(); companyId= $(this).val();
dosearch(); dosearch();
refreshSelect(); refreshSelect();
$.post(ext.contextPath + "/user/processSection/getProcessSection4Select.do", {companyId:companyId}, function(data) { loadProcessSectionSelect(companyId);
$("#processSection").empty(); });
var selelct_ =$("#processSection").select2({
data: data,
cache : false,
placeholder:'请选择',//默认文字提示
allowClear: true,//允许清空
escapeMarkup: function (markup) { return markup; }, // 自定义格式化防止xss注入
language: "zh-CN",
minimumInputLength: 0,
minimumResultsForSearch: 10,//数据超过十个启用搜索框
formatResult: function formatRepo(repo){return repo.text;}, // 函数用来渲染结果
formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择
});
$(".select2-selection--single").css({'height':'30px','paddingTop':'4px'})
selelct_.val('').trigger("change");
selelct_.on("change",function(e){
dosearch();
});
},'json');
});
} }
},'json'); },'json');

View File

@ -366,8 +366,8 @@
} // 函数用于呈现当前的选择 } // 函数用于呈现当前的选择
}); });
$(".select2-selection--single").css({'height': '30px', 'paddingTop': '4px'}) $(".select2-selection--single").css({'height': '30px', 'paddingTop': '4px'})
selelct_.val('').trigger("change"); selelct_.val('').trigger("change.select2");
selelct_.on("change", function (e) { selelct_.off("select2:select select2:clear").on("select2:select select2:clear", function (e) {
dosearch(); dosearch();
}); });
}, 'json'); }, 'json');
@ -394,9 +394,8 @@
} // 函数用于呈现当前的选择 } // 函数用于呈现当前的选择
}); });
$(".select2-selection--single").css({'height': '30px', 'paddingTop': '4px'}) $(".select2-selection--single").css({'height': '30px', 'paddingTop': '4px'})
selelct.val('').trigger("change"); selelct.val('').trigger("change.select2");
//refreshSelect(); selelct.off("select2:select select2:clear").on("select2:select select2:clear", function (e) {
selelct.on("change", function (e) {
companyId = $(this).val(); companyId = $(this).val();
//dosearch(); //dosearch();
//refreshSelect(); //refreshSelect();
@ -422,8 +421,8 @@
} // 函数用于呈现当前的选择 } // 函数用于呈现当前的选择
}); });
$(".select2-selection--single").css({'height': '30px', 'paddingTop': '4px'}) $(".select2-selection--single").css({'height': '30px', 'paddingTop': '4px'})
selelct_.val('').trigger("change"); selelct_.val('').trigger("change.select2");
selelct_.on("change", function (e) { selelct_.off("select2:select select2:clear").on("select2:select select2:clear", function (e) {
dosearch(); dosearch();
}); });
}, 'json'); }, 'json');

View File

@ -325,8 +325,8 @@
} // 函数用于呈现当前的选择 } // 函数用于呈现当前的选择
}); });
$(".select2-selection--single").css({'height': '30px', 'paddingTop': '4px'}) $(".select2-selection--single").css({'height': '30px', 'paddingTop': '4px'})
selelct_.val('').trigger("change"); selelct_.val('').trigger("change.select2");
selelct_.on("change", function (e) { selelct_.off("select2:select select2:clear").on("select2:select select2:clear", function (e) {
dosearch(); dosearch();
}); });
}, 'json'); }, 'json');
@ -353,9 +353,8 @@
} // 函数用于呈现当前的选择 } // 函数用于呈现当前的选择
}); });
$(".select2-selection--single").css({'height': '30px', 'paddingTop': '4px'}) $(".select2-selection--single").css({'height': '30px', 'paddingTop': '4px'})
selelct.val('').trigger("change"); selelct.val('').trigger("change.select2");
//refreshSelect(); selelct.off("select2:select select2:clear").on("select2:select select2:clear", function (e) {
selelct.on("change", function (e) {
companyId = $(this).val(); companyId = $(this).val();
//dosearch(); //dosearch();
//refreshSelect(); //refreshSelect();
@ -381,8 +380,8 @@
} // 函数用于呈现当前的选择 } // 函数用于呈现当前的选择
}); });
$(".select2-selection--single").css({'height': '30px', 'paddingTop': '4px'}) $(".select2-selection--single").css({'height': '30px', 'paddingTop': '4px'})
selelct_.val('').trigger("change"); selelct_.val('').trigger("change.select2");
selelct_.on("change", function (e) { selelct_.off("select2:select select2:clear").on("select2:select select2:clear", function (e) {
dosearch(); dosearch();
}); });
}, 'json'); }, 'json');

View File

@ -133,8 +133,8 @@
formatSelection: function formatRepoSelection(repo) { return repo.text; } // 函数用于呈现当前的选择 formatSelection: function formatRepoSelection(repo) { return repo.text; } // 函数用于呈现当前的选择
}); });
$(".select2-selection--single").css({ 'height': '30px', 'paddingTop': '4px' }) $(".select2-selection--single").css({ 'height': '30px', 'paddingTop': '4px' })
selelct_.val('').trigger("change"); selelct_.val('').trigger("change.select2");
selelct_.on("change", function (e) { selelct_.off("select2:select select2:clear").on("select2:select select2:clear", function () {
$("#table").bootstrapTable('refresh'); $("#table").bootstrapTable('refresh');
}); });

View File

@ -149,8 +149,8 @@
minimumInputLength: 0, minimumInputLength: 0,
minimumResultsForSearch: 10,//数据超过十个启用搜索框 minimumResultsForSearch: 10,//数据超过十个启用搜索框
}); });
select.val('').trigger("change"); select.val('').trigger("change.select2");
select.on("change", function (e) { select.off("select2:select select2:clear").on("select2:select select2:clear", function () {
$("#table").bootstrapTable('refresh'); $("#table").bootstrapTable('refresh');
}); });
@ -166,8 +166,8 @@
minimumInputLength: 0, minimumInputLength: 0,
minimumResultsForSearch: 10,//数据超过十个启用搜索框 minimumResultsForSearch: 10,//数据超过十个启用搜索框
}); });
select.val("").trigger("change"); select.val("").trigger("change.select2");
select.on("change", function (e) { select.off("select2:select select2:clear").on("select2:select select2:clear", function () {
$("#table").bootstrapTable('refresh'); $("#table").bootstrapTable('refresh');
}); });
@ -196,8 +196,8 @@
} // 函数用于呈现当前的选择 } // 函数用于呈现当前的选择
}); });
$(".select2-selection--single").css({'height': '30px', 'paddingTop': '4px'}) $(".select2-selection--single").css({'height': '30px', 'paddingTop': '4px'})
selelct_.val('').trigger("change"); selelct_.val('').trigger("change.select2");
selelct_.on("change", function (e) { selelct_.off("select2:select select2:clear").on("select2:select select2:clear", function () {
$("#table").bootstrapTable('refresh'); $("#table").bootstrapTable('refresh');
}); });

View File

@ -181,8 +181,8 @@
minimumInputLength: 0, minimumInputLength: 0,
minimumResultsForSearch: 10,//数据超过十个启用搜索框 minimumResultsForSearch: 10,//数据超过十个启用搜索框
}); });
select.val('').trigger("change"); select.val('').trigger("change.select2");
select.on("change", function (e) { select.off("select2:select select2:clear").on("select2:select select2:clear", function () {
$("#table").bootstrapTable('refresh', {pageNumber: 1}); $("#table").bootstrapTable('refresh', {pageNumber: 1});
}); });
@ -200,8 +200,8 @@
minimumInputLength: 0, minimumInputLength: 0,
minimumResultsForSearch: 10,//数据超过十个启用搜索框 minimumResultsForSearch: 10,//数据超过十个启用搜索框
}); });
select.val("").trigger("change"); select.val("").trigger("change.select2");
select.on("change", function (e) { select.off("select2:select select2:clear").on("select2:select select2:clear", function () {
$("#table").bootstrapTable('refresh', {pageNumber: 1}); $("#table").bootstrapTable('refresh', {pageNumber: 1});
}); });
@ -231,8 +231,8 @@
} // 函数用于呈现当前的选择 } // 函数用于呈现当前的选择
}); });
$(".select2-selection--single").css({'height': '30px', 'paddingTop': '4px'}) $(".select2-selection--single").css({'height': '30px', 'paddingTop': '4px'})
selelct_.val('').trigger("change"); selelct_.val('').trigger("change.select2");
selelct_.on("change", function (e) { selelct_.off("select2:select select2:clear").on("select2:select select2:clear", function () {
$("#table").bootstrapTable('refresh', {pageNumber: 1}); $("#table").bootstrapTable('refresh', {pageNumber: 1});
}); });

View File

@ -108,7 +108,7 @@
formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择 formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择
}); });
if(data!=null && data.length>0){ if(data!=null && data.length>0){
selelct_.val(data[0].id).trigger("change"); selelct_.val(data[0].id).trigger("change.select2");
} }
},'json'); },'json');
}else{ }else{
@ -126,7 +126,7 @@
formatResult: function formatRepo(repo){return repo.text;}, // 函数用来渲染结果 formatResult: function formatRepo(repo){return repo.text;}, // 函数用来渲染结果
formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择 formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择
}); });
selelct.on("change",function(e){ selelct.off("select2:select select2:clear").on("select2:select select2:clear",function(){
companyId= $(this).val(); companyId= $(this).val();
//重新选择厂区后清空设备和工艺段数据 //重新选择厂区后清空设备和工艺段数据
$("#equipname").val(""); $("#equipname").val("");
@ -134,7 +134,7 @@
$("#processSectionId").val(""); $("#processSectionId").val("");
$("#processectionname").val(""); $("#processectionname").val("");
}); });
selelct.val('').trigger("change"); selelct.val('').trigger("change.select2");
} }
},'json'); },'json');
@ -149,9 +149,9 @@
.updateStatus('plannedenddt', 'NOT_VALIDATED',null) .updateStatus('plannedenddt', 'NOT_VALIDATED',null)
.validateField('plannedenddt'); .validateField('plannedenddt');
}); });
$("#active").select2({minimumResultsForSearch: 10}).val('${Active_True}').trigger("change"); $("#active").select2({minimumResultsForSearch: 10}).val('${Active_True}').trigger("change.select2");
$("#maintenanceWay").select2({minimumResultsForSearch: 10}).val('${INTER_MAINTENANCE}').trigger("change"); $("#maintenanceWay").select2({minimumResultsForSearch: 10}).val('${INTER_MAINTENANCE}').trigger("change.select2");
}); });
//选择设备根据厂区id选择厂内设备 //选择设备根据厂区id选择厂内设备
var selectEquipmentCard = function() { var selectEquipmentCard = function() {
$.post(ext.contextPath + '/equipment/showEquipmentCardForSelect.do', {companyId:companyId, equipmentId:$("#equipid").val()} , function(data) { $.post(ext.contextPath + '/equipment/showEquipmentCardForSelect.do', {companyId:companyId, equipmentId:$("#equipid").val()} , function(data) {

View File

@ -101,7 +101,7 @@
formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择 formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择
}); });
if(data!=null && data.length>0){ if(data!=null && data.length>0){
selelct_.val(data[0].id).trigger("change"); selelct_.val(data[0].id).trigger("change.select2");
} }
},'json'); },'json');
}else{ }else{
@ -119,7 +119,7 @@
formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择 formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择
}); });
selelct.on("change",function(e){ selelct.off("select2:select select2:clear").on("select2:select select2:clear", function(e){
companyId = $(this).val(); companyId = $(this).val();
//重新选择厂区后清空设备和工艺段数据 //重新选择厂区后清空设备和工艺段数据
if(companyId != "${maintenanceDetail.companyid}"){ if(companyId != "${maintenanceDetail.companyid}"){
@ -129,10 +129,10 @@
$("#processectionname").val(""); $("#processectionname").val("");
} }
}); });
selelct.val('${maintenanceDetail.companyid}').trigger("change"); selelct.val('${maintenanceDetail.companyid}').trigger("change.select2");
} }
},'json'); },'json');
$("#maintenanceWay").select2({minimumResultsForSearch: 10}).val("${maintenanceDetail.maintenanceWay}").trigger("change"); $("#maintenanceWay").select2({minimumResultsForSearch: 10}).val("${maintenanceDetail.maintenanceWay}").trigger("change.select2");
//选择时间 //选择时间
$('#startDate').datepicker({ $('#startDate').datepicker({
language: 'zh-CN', language: 'zh-CN',

View File

@ -133,8 +133,8 @@
formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择 formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择
}); });
$(".select2-selection--single").css({'height':'30px','paddingTop':'4px'}) $(".select2-selection--single").css({'height':'30px','paddingTop':'4px'})
selelct_.val('').trigger("change"); selelct_.val('').trigger("change.select2");
selelct_.on("change",function(e){ selelct_.off("select2:select select2:clear").on("select2:select select2:clear",function(){
dosearch(); dosearch();
}); });
@ -153,9 +153,9 @@
formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择 formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择
}); });
$(".select2-selection--single").css({'height':'30px','paddingTop':'4px'}) $(".select2-selection--single").css({'height':'30px','paddingTop':'4px'})
selelct.val('').trigger("change"); selelct.val('').trigger("change.select2");
refreshSelect(); refreshSelect();
selelct.on("change",function(e){ selelct.off("select2:select select2:clear").on("select2:select select2:clear",function(){
companyId= $(this).val(); companyId= $(this).val();
dosearch(); dosearch();
refreshSelect(); refreshSelect();
@ -174,8 +174,8 @@
formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择 formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择
}); });
$(".select2-selection--single").css({'height':'30px','paddingTop':'4px'}) $(".select2-selection--single").css({'height':'30px','paddingTop':'4px'})
selelct_.val('').trigger("change"); selelct_.val('').trigger("change.select2");
selelct_.on("change",function(e){ selelct_.off("select2:select select2:clear").on("select2:select select2:clear",function(){
dosearch(); dosearch();
}); });
},'json'); },'json');

View File

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

View File

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