This commit is contained in:
Timer
2026-03-08 17:41:53 +08:00
parent d70325751e
commit debeec23da
15 changed files with 323 additions and 68 deletions

View File

@ -165,7 +165,8 @@ public class EquipmentPlanTypeController {
String id = request.getParameter("id"); String id = request.getParameter("id");
EquipmentPlanType equipmentPlanType = this.equipmentPlanTypeService.selectById(id); EquipmentPlanType equipmentPlanType = this.equipmentPlanTypeService.selectById(id);
model.addAttribute("equipmentPlanType", equipmentPlanType); model.addAttribute("equipmentPlanType", equipmentPlanType);
return "maintenance/equipmentPlanTypeView"; // Return edit page so user can view parent and manage child records
return "maintenance/equipmentPlanTypeEdit";
} }
/** /**
* 打开编辑界面 * 打开编辑界面
@ -235,6 +236,12 @@ public class EquipmentPlanTypeController {
/** /**
* 根据code获取类型下拉数据 * 根据code获取类型下拉数据
* 支持多种数据结构:
* 1. 标准结构code='wx'的父记录 -> 返回其子记录
* 2. 简化结构code='wx'的父记录无子记录 -> 返回该父记录本身
* 3. 子记录结构无code='wx'父记录但有type='0'的子记录 -> 返回这些子记录
* 4. 扁平结构只有type='0'的记录(无论pid) -> 返回这些记录
* 5. 最终兜底:返回所有相关类型的记录
* @param request * @param request
* @param model * @param model
* @return * @return
@ -242,31 +249,98 @@ public class EquipmentPlanTypeController {
@RequestMapping("/getSelectList4Code.do") @RequestMapping("/getSelectList4Code.do")
public String getSelectList4Code(HttpServletRequest request,Model model){ public String getSelectList4Code(HttpServletRequest request,Model model){
String code = request.getParameter("code"); String code = request.getParameter("code");
String wherestr = "where 1=1 ";
String pid = "";
EquipmentPlanType equipmentPlanType = equipmentPlanTypeService.selectByWhere("where code = '"+code+"' ");
if(equipmentPlanType!=null){
pid = equipmentPlanType.getId();//获取大类id
}
if(pid!=null && !pid.equals("")){
wherestr += " and pid = '"+pid+"'";
}else {
wherestr += " and pid = '-1'";
}
List<EquipmentPlanType> list = this.equipmentPlanTypeService.selectListByWhere(wherestr+"order by morder asc");
JSONArray json = new JSONArray(); JSONArray json = new JSONArray();
if(list!=null && list.size()>0){
for(int i=0;i<list.size();i++){ if(code == null || code.isEmpty()){
JSONObject jsonObject =new JSONObject(); model.addAttribute("result", json.toString());
jsonObject.put("id", list.get(i).getId()); return "result";
jsonObject.put("text", list.get(i).getName()); }
String typeValue = getTypeValueByCode(code);
// Step 1: Try to find parent record by code
EquipmentPlanType parentType = equipmentPlanTypeService.selectByWhere("where code = '"+code+"' ");
if(parentType != null){
// Parent found, try to get children
String pid = parentType.getId();
List<EquipmentPlanType> list = this.equipmentPlanTypeService.selectListByWhere("where pid = '"+pid+"' order by morder asc");
if(list != null && list.size() > 0){
// Standard case: return children
for(int i = 0; i < list.size(); i++){
JSONObject jsonObject = new JSONObject();
jsonObject.put("id", list.get(i).getId());
jsonObject.put("text", list.get(i).getName());
json.add(jsonObject);
}
} else {
// No children, return parent itself as the only option
JSONObject jsonObject = new JSONObject();
jsonObject.put("id", parentType.getId());
jsonObject.put("text", parentType.getName());
json.add(jsonObject); json.add(jsonObject);
} }
} else if(typeValue != null){
// Step 2: No parent with code, try multiple fallback strategies
// 2a: First try child records with specific type (pid != '-1')
List<EquipmentPlanType> list = this.equipmentPlanTypeService.selectListByWhere(
"where type = '"+typeValue+"' and pid != '-1' order by morder asc");
if(list != null && list.size() > 0){
for(int i = 0; i < list.size(); i++){
JSONObject jsonObject = new JSONObject();
jsonObject.put("id", list.get(i).getId());
jsonObject.put("text", list.get(i).getName());
json.add(jsonObject);
}
} else {
// 2b: Try all records with specific type (including root records with pid='-1')
list = this.equipmentPlanTypeService.selectListByWhere(
"where type = '"+typeValue+"' order by morder asc");
if(list != null && list.size() > 0){
for(int i = 0; i < list.size(); i++){
JSONObject jsonObject = new JSONObject();
jsonObject.put("id", list.get(i).getId());
jsonObject.put("text", list.get(i).getName());
json.add(jsonObject);
}
} else {
// 2c: Final fallback - return all root records (pid='-1')
// This handles the case where user added parent records without setting type
list = this.equipmentPlanTypeService.selectListByWhere(
"where pid = '-1' order by morder asc");
if(list != null && list.size() > 0){
for(int i = 0; i < list.size(); i++){
JSONObject jsonObject = new JSONObject();
jsonObject.put("id", list.get(i).getId());
jsonObject.put("text", list.get(i).getName());
json.add(jsonObject);
}
}
}
}
} }
model.addAttribute("result", json.toString()); model.addAttribute("result", json.toString());
return "result"; return "result";
} }
/**
* 根据code获取对应的type值
* @param code
* @return type值
*/
private String getTypeValueByCode(String code){
if(EquipmentPlanType.Code_Type_Wx.equals(code)){
return EquipmentPlanType.Type_Wx; // "0"
} else if(EquipmentPlanType.Code_Type_By.equals(code)){
return EquipmentPlanType.Type_Ty; // "1"
} else if(EquipmentPlanType.Code_Type_Dx.equals(code)){
return EquipmentPlanType.Type_Dx; // "5"
}
return null;
}
} }

View File

@ -50,6 +50,12 @@ public class PipelineDataController {
if (request.getParameter("search_pipeline_area") != null && !request.getParameter("search_pipeline_area").isEmpty()) { if (request.getParameter("search_pipeline_area") != null && !request.getParameter("search_pipeline_area").isEmpty()) {
wherestr += " and pipeline_area = '" + request.getParameter("search_pipeline_area") + "'"; wherestr += " and pipeline_area = '" + request.getParameter("search_pipeline_area") + "'";
} }
if (request.getParameter("search_pipe_material") != null && !request.getParameter("search_pipe_material").isEmpty()) {
wherestr += " and pipe_material like '%" + request.getParameter("search_pipe_material") + "%'";
}
if (request.getParameter("search_associated_plant") != null && !request.getParameter("search_associated_plant").isEmpty()) {
wherestr += " and associated_plant like '%" + request.getParameter("search_associated_plant") + "%'";
}
PageHelper.startPage(page, rows); PageHelper.startPage(page, rows);
List<PipelineData> list = this.pipelineDataService.selectListByWhere(wherestr + orderstr); List<PipelineData> list = this.pipelineDataService.selectListByWhere(wherestr + orderstr);
PageInfo<PipelineData> pInfo = new PageInfo<PipelineData>(list); PageInfo<PipelineData> pInfo = new PageInfo<PipelineData>(list);

View File

@ -444,7 +444,11 @@ public class MPointController {
if (dbCount != esCount) { if (dbCount != esCount) {
// 数据不一致将数据库全量数据更新到ES // 数据不一致将数据库全量数据更新到ES
logger.info("ES与DB数据总数不一致执行全量同步并返回数据库结果"); logger.info("ES与DB数据总数不一致执行全量同步并返回数据库结果");
this.mPointService.syncAllDbDataToEs(); try {
this.syncAllDbDataToEs();
} catch (Exception e) {
logger.error("执行全量同步ES异常", e);
}
// 构建数据库查询条件,返回数据库结果至前端 // 构建数据库查询条件,返回数据库结果至前端
String wherestr = " where 1=1 "; String wherestr = " where 1=1 ";
@ -587,6 +591,33 @@ public class MPointController {
return new ModelAndView("result"); return new ModelAndView("result");
} }
public void syncAllDbDataToEs() {
logger.info("ES与数据库数据总数不一致开始全量同步数据库数据到ES...");
MPoint query = new MPoint();
query.setWhere("where 1=1");
List<MPoint> allDbData = mPointService.selectListAllByWhere(query);
if (allDbData != null && !allDbData.isEmpty()) {
List<MPointES> esList = new ArrayList<>();
for (MPoint mPoint : allDbData) {
try {
MPointES mPointES = MPointES.format(mPoint);
esList.add(mPointES);
} catch (Exception e) {
logger.error("转换MPointES失败, id=" + mPoint.getId() + ", error=" + e.getMessage());
}
}
if (!esList.isEmpty()) {
try {
mPointRepo.saveAll(esList);
logger.info("全量同步完成,共同步 " + esList.size() + " 条数据到ES");
} catch (Exception e) {
logger.error("批量保存ES失败: " + e.getMessage());
e.printStackTrace();
}
}
}
}
private static String getKeyword(String searchName, List<Unit> units) { private static String getKeyword(String searchName, List<Unit> units) {
int lastMatchNum = 1; int lastMatchNum = 1;
String keyword = ""; String keyword = "";

View File

@ -77,6 +77,18 @@ public class PipelineData extends SQLAdapter implements Serializable {
@Column(name = "pipeline_area", length = 20) @Column(name = "pipeline_area", length = 20)
private String pipelineArea; private String pipelineArea;
/**
* 管道材质
*/
@Column(name = "pipe_material", length = 50)
private String pipeMaterial;
/**
* 所属厂站
*/
@Column(name = "associated_plant", length = 100)
private String associatedPlant;
// 构造方法 // 构造方法
public PipelineData() { public PipelineData() {
} }
@ -162,6 +174,22 @@ public class PipelineData extends SQLAdapter implements Serializable {
this.pipelineArea = pipelineArea; this.pipelineArea = pipelineArea;
} }
public String getPipeMaterial() {
return pipeMaterial;
}
public void setPipeMaterial(String pipeMaterial) {
this.pipeMaterial = pipeMaterial;
}
public String getAssociatedPlant() {
return associatedPlant;
}
public void setAssociatedPlant(String associatedPlant) {
this.associatedPlant = associatedPlant;
}
@Override @Override
public String toString() { public String toString() {
return "PipelineData{" + return "PipelineData{" +
@ -175,6 +203,8 @@ public class PipelineData extends SQLAdapter implements Serializable {
", endGroundElevationM=" + endGroundElevationM + ", endGroundElevationM=" + endGroundElevationM +
", pipelineInvertElevationM=" + pipelineInvertElevationM + ", pipelineInvertElevationM=" + pipelineInvertElevationM +
", pipelineArea='" + pipelineArea + '\'' + ", pipelineArea='" + pipelineArea + '\'' +
", pipeMaterial='" + pipeMaterial + '\'' +
", associatedPlant='" + associatedPlant + '\'' +
'}'; '}';
} }
} }

View File

@ -12,10 +12,13 @@
<result column="end_ground_elevation_m" property="endGroundElevationM" jdbcType="DECIMAL" /> <result column="end_ground_elevation_m" property="endGroundElevationM" jdbcType="DECIMAL" />
<result column="pipeline_invert_elevation_m" property="pipelineInvertElevationM" jdbcType="DECIMAL" /> <result column="pipeline_invert_elevation_m" property="pipelineInvertElevationM" jdbcType="DECIMAL" />
<result column="pipeline_area" property="pipelineArea" jdbcType="VARCHAR" /> <result column="pipeline_area" property="pipelineArea" jdbcType="VARCHAR" />
<result column="pipe_material" property="pipeMaterial" jdbcType="VARCHAR" />
<result column="associated_plant" property="associatedPlant" jdbcType="VARCHAR" />
</resultMap> </resultMap>
<sql id="Base_Column_List" > <sql id="Base_Column_List" >
id, pipeline_name, diameter_mm, length_m, start_burial_depth_m, end_burial_depth_m, id, pipeline_name, diameter_mm, length_m, start_burial_depth_m, end_burial_depth_m,
start_ground_elevation_m, end_ground_elevation_m, pipeline_invert_elevation_m, pipeline_area start_ground_elevation_m, end_ground_elevation_m, pipeline_invert_elevation_m, pipeline_area,
pipe_material, associated_plant
</sql> </sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" > <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
select select
@ -31,11 +34,12 @@
insert into tb_pipeline_data (pipeline_name, diameter_mm, insert into tb_pipeline_data (pipeline_name, diameter_mm,
length_m, start_burial_depth_m, end_burial_depth_m, length_m, start_burial_depth_m, end_burial_depth_m,
start_ground_elevation_m, end_ground_elevation_m, start_ground_elevation_m, end_ground_elevation_m,
pipeline_invert_elevation_m, pipeline_area) pipeline_invert_elevation_m, pipeline_area, pipe_material, associated_plant)
values (#{pipelineName,jdbcType=VARCHAR}, #{diameterMm,jdbcType=DECIMAL}, values (#{pipelineName,jdbcType=VARCHAR}, #{diameterMm,jdbcType=DECIMAL},
#{lengthM,jdbcType=DECIMAL}, #{startBurialDepthM,jdbcType=DECIMAL}, #{endBurialDepthM,jdbcType=DECIMAL}, #{lengthM,jdbcType=DECIMAL}, #{startBurialDepthM,jdbcType=DECIMAL}, #{endBurialDepthM,jdbcType=DECIMAL},
#{startGroundElevationM,jdbcType=DECIMAL}, #{endGroundElevationM,jdbcType=DECIMAL}, #{startGroundElevationM,jdbcType=DECIMAL}, #{endGroundElevationM,jdbcType=DECIMAL},
#{pipelineInvertElevationM,jdbcType=DECIMAL}, #{pipelineArea,jdbcType=VARCHAR}) #{pipelineInvertElevationM,jdbcType=DECIMAL}, #{pipelineArea,jdbcType=VARCHAR},
#{pipeMaterial,jdbcType=VARCHAR}, #{associatedPlant,jdbcType=VARCHAR})
</insert> </insert>
<insert id="insertSelective" parameterType="com.sipai.entity.pipeline.PipelineData" useGeneratedKeys="true" keyProperty="id" > <insert id="insertSelective" parameterType="com.sipai.entity.pipeline.PipelineData" useGeneratedKeys="true" keyProperty="id" >
insert into tb_pipeline_data insert into tb_pipeline_data
@ -68,6 +72,12 @@
<if test="pipelineArea != null" > <if test="pipelineArea != null" >
pipeline_area, pipeline_area,
</if> </if>
<if test="pipeMaterial != null" >
pipe_material,
</if>
<if test="associatedPlant != null" >
associated_plant,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides="," > <trim prefix="values (" suffix=")" suffixOverrides="," >
@ -98,6 +108,12 @@
<if test="pipelineArea != null" > <if test="pipelineArea != null" >
#{pipelineArea,jdbcType=VARCHAR}, #{pipelineArea,jdbcType=VARCHAR},
</if> </if>
<if test="pipeMaterial != null" >
#{pipeMaterial,jdbcType=VARCHAR},
</if>
<if test="associatedPlant != null" >
#{associatedPlant,jdbcType=VARCHAR},
</if>
</trim> </trim>
</insert> </insert>
<update id="updateByPrimaryKeySelective" parameterType="com.sipai.entity.pipeline.PipelineData" > <update id="updateByPrimaryKeySelective" parameterType="com.sipai.entity.pipeline.PipelineData" >
@ -130,6 +146,12 @@
<if test="pipelineArea != null" > <if test="pipelineArea != null" >
pipeline_area = #{pipelineArea,jdbcType=VARCHAR}, pipeline_area = #{pipelineArea,jdbcType=VARCHAR},
</if> </if>
<if test="pipeMaterial != null" >
pipe_material = #{pipeMaterial,jdbcType=VARCHAR},
</if>
<if test="associatedPlant != null" >
associated_plant = #{associatedPlant,jdbcType=VARCHAR},
</if>
</set> </set>
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
@ -143,7 +165,9 @@
start_ground_elevation_m = #{startGroundElevationM,jdbcType=DECIMAL}, start_ground_elevation_m = #{startGroundElevationM,jdbcType=DECIMAL},
end_ground_elevation_m = #{endGroundElevationM,jdbcType=DECIMAL}, end_ground_elevation_m = #{endGroundElevationM,jdbcType=DECIMAL},
pipeline_invert_elevation_m = #{pipelineInvertElevationM,jdbcType=DECIMAL}, pipeline_invert_elevation_m = #{pipelineInvertElevationM,jdbcType=DECIMAL},
pipeline_area = #{pipelineArea,jdbcType=VARCHAR} pipeline_area = #{pipelineArea,jdbcType=VARCHAR},
pipe_material = #{pipeMaterial,jdbcType=VARCHAR},
associated_plant = #{associatedPlant,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
<select id="selectListByWhere" parameterType="java.lang.String" resultMap="BaseResultMap"> <select id="selectListByWhere" parameterType="java.lang.String" resultMap="BaseResultMap">

View File

@ -17,15 +17,14 @@ import com.sipai.service.equipment.EquipmentCardService;
import com.sipai.service.user.UnitService; import com.sipai.service.user.UnitService;
import com.sipai.service.work.ModbusFigService; import com.sipai.service.work.ModbusFigService;
import com.sipai.service.work.ScadaPic_MPointService; import com.sipai.service.work.ScadaPic_MPointService;
import com.sipai.tools.CommString; import com.sipai.tools.*;
import com.sipai.tools.CommUtil;
import com.sipai.tools.ValueTypeEnum;
import net.sf.json.JSONArray; import net.sf.json.JSONArray;
import net.sf.json.JSONObject; import net.sf.json.JSONObject;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.apache.poi.hssf.usermodel.*; import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.usermodel.DateUtil;
import org.apache.poi.ss.util.CellRangeAddress; import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.usermodel.XSSFCell; import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow; import org.apache.poi.xssf.usermodel.XSSFRow;
@ -713,32 +712,6 @@ public class MPointService {
/** /**
* 将数据库全量数据同步到ES * 将数据库全量数据同步到ES
*/ */
public void syncAllDbDataToEs() {
logger.info("ES与数据库数据总数不一致开始全量同步数据库数据到ES...");
MPoint query = new MPoint();
query.setWhere("where 1=1");
List<MPoint> allDbData = mPointDao.selectListByWhere(query);
if (allDbData != null && allDbData.size() > 0) {
List<MPointES> esList = new ArrayList<>();
for (MPoint mPoint : allDbData) {
try {
MPointES mPointES = MPointES.format(mPoint);
esList.add(mPointES);
} catch (Exception e) {
logger.error("转换MPointES失败, id=" + mPoint.getId() + ", error=" + e.getMessage());
}
}
if (esList.size() > 0) {
try {
mPointRepo.saveAll(esList);
logger.info("全量同步完成,共同步 " + esList.size() + " 条数据到ES");
} catch (Exception e) {
logger.error("批量保存ES失败: " + e.getMessage());
e.printStackTrace();
}
}
}
}
@Transactional @Transactional
public int updateValue(String bizId, MPoint entity, MPointHistory mPointHistory) { public int updateValue(String bizId, MPoint entity, MPointHistory mPointHistory) {
@ -1818,4 +1791,9 @@ public class MPointService {
} }
return result; return result;
} }
@DataSourceTypeAnno(value = DataSources.SCADA_0533JS)
public List<MPoint> selectListAllByWhere(MPoint query) {
return mPointDao.selectListByWhere(query);
}
} }

View File

@ -2,6 +2,9 @@ package com.sipai.tools;
import org.aspectj.lang.JoinPoint; import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.Signature; import org.aspectj.lang.Signature;
import org.aspectj.lang.reflect.MethodSignature;
import java.lang.reflect.Method;
/*@Aspect // for aop /*@Aspect // for aop
@Component // for auto scan @Component // for auto scan
@ -20,11 +23,19 @@ public class DataSourceInterceptor {
// return; // return;
// } // }
String fullMethodPath = signature.toString(); String fullMethodPath = signature.toString();
MethodSignature methodSignature = (MethodSignature) signature;
Method method = methodSignature.getMethod();
DataSourceTypeAnno typeAnno = method.getAnnotation(DataSourceTypeAnno.class);
DataSources sourceEnum = null;
if (typeAnno != null) {
sourceEnum = typeAnno.value();
}
// Object argus = argusObjects[0]; // Object argus = argusObjects[0];
if (fullMethodPath.contains(".scada.")) { String packageName = method.getDeclaringClass().getName();
DataSourceHolder.setDataSources(DataSources.valueOf("SCADA_0533JS")); if (fullMethodPath.contains(".scada.") || packageName.contains(".scada.") || (sourceEnum == DataSources.SCADA_0533JS)) {
DataSourceHolder.setDataSources(DataSources.SCADA_0533JS);
} else { } else {
DataSourceHolder.setDataSources(DataSources.valueOf("MASTER")); DataSourceHolder.setDataSources(DataSources.MASTER);
} }
} }

View File

@ -0,0 +1,17 @@
package com.sipai.tools;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* 自定义注解
*/
@Retention(RetentionPolicy.RUNTIME) // 在运行时可见
@Target(ElementType.METHOD) // 注解可以用在方法上
public @interface DataSourceTypeAnno {
//使用方式在service层方法上添加@DataSourceTypeAnno(DataSourceEnum.数据源枚举类型)用于指定所使用的数据源
DataSources value() default DataSources.MASTER;
// DataSourceEnum value() default DataSourceEnum.SCADA_JSWS;
}

View File

@ -250,8 +250,10 @@
</tx:advice> </tx:advice>
<bean id="dataSourceScadaBean" class="com.sipai.tools.DataSourceInterceptor"/> <bean id="dataSourceScadaBean" class="com.sipai.tools.DataSourceInterceptor"/>
<aop:config> <aop:config>
<aop:pointcut id="transactionPointcut" expression="execution(public * com.sipai.dao.scada.*.*(..))"/> <!-- <aop:pointcut id="transactionPointcut" expression="execution(public * com.sipai.dao.scada.*.*(..))"/>-->
<aop:pointcut id="dataSourceScadaPointcut" expression="execution(public * com.sipai.dao.scada.*.*(..)))"/> <!-- <aop:pointcut id="dataSourceScadaPointcut" expression="execution(public * com.sipai.dao.scada.*.*(..)))"/>-->
<aop:pointcut id="transactionPointcut" expression="execution(public * com.sipai.service.*.*(..))"/>
<aop:pointcut id="dataSourceScadaPointcut" expression="execution(public * com.sipai.service.scada.*.*(..)))"/>
<aop:advisor pointcut-ref="transactionPointcut" <aop:advisor pointcut-ref="transactionPointcut"
advice-ref="txAdvice"/> advice-ref="txAdvice"/>
<aop:aspect ref="dataSourceScadaBean" order="0"> <aop:aspect ref="dataSourceScadaBean" order="0">

View File

@ -70,8 +70,18 @@
var selectType = $("#repairTypeName").select2({minimumResultsForSearch: 10}); var selectType = $("#repairTypeName").select2({minimumResultsForSearch: 10});
$.post(ext.contextPath + "/maintenance/equipmentPlanType/getSelectList4Code.do", {code:'${Code_Type_Wx}'}, function(data) { $.post(ext.contextPath + "/maintenance/equipmentPlanType/getSelectList4Code.do", {code:'${Code_Type_Wx}'}, function(data) {
$("#repairTypeName").empty(); $("#repairTypeName").empty();
// Parse data if it's a string
var jsonData = data;
if(typeof data === 'string') {
try {
jsonData = JSON.parse(data);
} catch(e) {
console.error('Failed to parse JSON:', e);
jsonData = [];
}
}
var selelct_ =$("#repairTypeName").select2({ var selelct_ =$("#repairTypeName").select2({
data: data, data: jsonData,
placeholder:'请选择',//默认文字提示 placeholder:'请选择',//默认文字提示
allowClear: false,//允许清空 allowClear: false,//允许清空
escapeMarkup: function (markup) { return markup; }, // 自定义格式化防止xss注入 escapeMarkup: function (markup) { return markup; }, // 自定义格式化防止xss注入
@ -85,7 +95,9 @@
selelct_.on('change',function(e){ selelct_.on('change',function(e){
$('#repairType').val(e.target.value); $('#repairType').val(e.target.value);
}) })
},'json'); },'json').fail(function(xhr, status, error) {
console.error('Failed to load repair types:', error);
});
}) })

View File

@ -73,8 +73,18 @@
var selectType = $("#repairTypeName").select2({minimumResultsForSearch: 10}); var selectType = $("#repairTypeName").select2({minimumResultsForSearch: 10});
$.post(ext.contextPath + "/maintenance/equipmentPlanType/getSelectList4Code.do", {code:'${Code_Type_Wx}'}, function(data) { $.post(ext.contextPath + "/maintenance/equipmentPlanType/getSelectList4Code.do", {code:'${Code_Type_Wx}'}, function(data) {
$("#repairTypeName").empty(); $("#repairTypeName").empty();
// Parse data if it's a string
var jsonData = data;
if(typeof data === 'string') {
try {
jsonData = JSON.parse(data);
} catch(e) {
console.error('Failed to parse JSON:', e);
jsonData = [];
}
}
var selelct_ =$("#repairTypeName").select2({ var selelct_ =$("#repairTypeName").select2({
data: data, data: jsonData,
placeholder:'请选择',//默认文字提示 placeholder:'请选择',//默认文字提示
allowClear: false,//允许清空 allowClear: false,//允许清空
escapeMarkup: function (markup) { return markup; }, // 自定义格式化防止xss注入 escapeMarkup: function (markup) { return markup; }, // 自定义格式化防止xss注入
@ -84,11 +94,17 @@
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('${repair.repairType}').trigger("change"); // Set saved value if exists
var savedRepairType = '${repair.repairType}';
if(savedRepairType && savedRepairType !== ''){
selelct_.val(savedRepairType).trigger("change");
}
selelct_.on('change',function(e){ selelct_.on('change',function(e){
$('#repairType').val(e.target.value); $('#repairType').val(e.target.value);
}) })
},'json'); },'json').fail(function(xhr, status, error) {
console.error('Failed to load repair types:', error);
});
$('#planDate').datepicker({ $('#planDate').datepicker({
language: 'zh-CN', language: 'zh-CN',
@ -103,7 +119,7 @@
$('#planDate').datepicker('setDate','${repair.planDate.substring(0, 10)}'); $('#planDate').datepicker('setDate','${repair.planDate.substring(0, 10)}');
//加载维修库table //加载维修库table
getWorkContentRepair('${repair.id}','${repair.unitId}','${repair.equipmentId}'); <%--getWorkContentRepair('${repair.id}','${repair.unitId}','${repair.equipmentId}');--%>
//加载消耗品table //加载消耗品table
getWorkConsume('${repair.id}','${repair.unitId}'); getWorkConsume('${repair.id}','${repair.unitId}');
//加载绩效table //加载绩效table

View File

@ -116,6 +116,18 @@
</select> </select>
</div> </div>
</div> </div>
<div class="form-group">
<label class="col-sm-3 control-label">管道材质</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="pipeMaterial" name="pipeMaterial" placeholder="请输入管道材质">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">所属厂站</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="associatedPlant" name="associatedPlant" placeholder="请输入所属厂站">
</div>
</div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">直径(mm)</label> <label class="col-sm-3 control-label">直径(mm)</label>
<div class="col-sm-8"> <div class="col-sm-8">

View File

@ -119,6 +119,20 @@
</select> </select>
</div> </div>
</div> </div>
<div class="form-group">
<label class="col-sm-3 control-label">管道材质</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="pipeMaterial" name="pipeMaterial"
value="${pipelineData.pipeMaterial}" placeholder="请输入管道材质">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">所属厂站</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="associatedPlant" name="associatedPlant"
value="${pipelineData.associatedPlant}" placeholder="请输入所属厂站">
</div>
</div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">直径(mm)</label> <label class="col-sm-3 control-label">直径(mm)</label>
<div class="col-sm-8"> <div class="col-sm-8">

View File

@ -138,7 +138,9 @@
sort: params.sort, sort: params.sort,
order: params.order, order: params.order,
search_name: $('#search_name').val(), search_name: $('#search_name').val(),
search_pipeline_area: $('#search_pipeline_area').val() search_pipeline_area: $('#search_pipeline_area').val(),
search_pipe_material: $('#search_pipe_material').val(),
search_associated_plant: $('#search_associated_plant').val()
}; };
} }
@ -184,6 +186,18 @@
} }
return value; return value;
} }
}, {
field: 'pipeMaterial',
title: '管道材质',
align: 'center',
valign: 'middle',
width: '10%'
}, {
field: 'associatedPlant',
title: '所属厂站',
align: 'center',
valign: 'middle',
width: '10%'
}, { }, {
field: 'diameterMm', field: 'diameterMm',
title: '直径(mm)', title: '直径(mm)',
@ -292,7 +306,9 @@
<option value="OUT_SIDE">场外管道</option> <option value="OUT_SIDE">场外管道</option>
<option value="In_SIDE">场内管道</option> <option value="In_SIDE">场内管道</option>
</select> </select>
<div class="input-group input-group-sm" style="width: 250px;"> <input type="text" id="search_pipe_material" name="search_pipe_material" class="form-control input-sm" placeholder="管道材质" style="width: 100px;">
<input type="text" id="search_associated_plant" name="search_associated_plant" class="form-control input-sm" placeholder="所属厂站" style="width: 100px;">
<div class="input-group input-group-sm" style="width: 200px;">
<input type="text" id="search_name" name="search_name" class="form-control pull-right" placeholder="管道名称"> <input type="text" id="search_name" name="search_name" class="form-control pull-right" placeholder="管道名称">
<div class="input-group-btn"> <div class="input-group-btn">
<button type="button" class="btn btn-default" onclick="dosearch();"> <button type="button" class="btn btn-default" onclick="dosearch();">

View File

@ -44,6 +44,18 @@
</p> </p>
</div> </div>
</div> </div>
<div class="form-group">
<label class="col-sm-3 control-label">管道材质</label>
<div class="col-sm-8">
<p class="form-control-static">${pipelineData.pipeMaterial}</p>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">所属厂站</label>
<div class="col-sm-8">
<p class="form-control-static">${pipelineData.associatedPlant}</p>
</div>
</div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">直径(mm)</label> <label class="col-sm-3 control-label">直径(mm)</label>
<div class="col-sm-8"> <div class="col-sm-8">