Commit 6f6f5639 authored by 莫林毅's avatar 莫林毅

修改 '新增参数后 页面不展示'bug 调整界面 '参数'部分的UI

parent e7853639
...@@ -9,7 +9,11 @@ import java.io.UnsupportedEncodingException; ...@@ -9,7 +9,11 @@ import java.io.UnsupportedEncodingException;
import java.net.SocketException; import java.net.SocketException;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
...@@ -46,10 +50,11 @@ import com.hp.cmsz.web.PageURLController; ...@@ -46,10 +50,11 @@ import com.hp.cmsz.web.PageURLController;
* 模型维护的控制类 * 模型维护的控制类
* *
* @author Zhang Wei * @author Zhang Wei
*
*/ */
@Controller @Controller
@RequestMapping(value = "/ModelManage/ModelMaintain") @RequestMapping(value="/ModelManage/ModelMaintain")
public class ModelMaintainController { public class ModelMaintainController {
@Autowired @Autowired
...@@ -72,12 +77,12 @@ public class ModelMaintainController { ...@@ -72,12 +77,12 @@ public class ModelMaintainController {
private CmszOperationLogService cmszOperationLogService; private CmszOperationLogService cmszOperationLogService;
@RequestMapping(value = "") @RequestMapping(value = "")
public String modelMaintainHome(Map model) { public String modelMaintainHome(Map model){
List<DataModelType> dataModelTypeList = (List<DataModelType>) dataModelTypeDao.findAll(); List<DataModelType> dataModelTypeList = (List<DataModelType>)dataModelTypeDao.findAll();
List<DeployedServer> deployedServerList = (List<DeployedServer>) deployedServerDao.findAll(); List<DeployedServer>deployedServerList = (List<DeployedServer>) deployedServerDao.findAll();
List<DataType> dataTypeList = (List<DataType>) dataTypeDao.findAll(); List<DataType> dataTypeList =(List<DataType>) dataTypeDao.findAll();
model.put("dataModelTypeList", dataModelTypeList); model.put("dataModelTypeList", dataModelTypeList);
model.put("deployedServerList", deployedServerList); model.put("deployedServerList", deployedServerList);
...@@ -86,76 +91,57 @@ public class ModelMaintainController { ...@@ -86,76 +91,57 @@ public class ModelMaintainController {
return PageURLController.ModelMaintain; return PageURLController.ModelMaintain;
} }
// private List<Long> dataModelIdList = new ArrayList<Long>(); private List<Long> dataModelIdList = new ArrayList<Long>();
private List<Long> dataModelIdList = new Vector<Long>();
//新增模型参数 //新增模型参数
@RequestMapping(value = "/createModelParam", method = RequestMethod.GET) @RequestMapping(value = "/createModelParam*", method = RequestMethod.GET)
@ResponseBody @ResponseBody
public void createModelParam( public void createModelParam(
@RequestParam(value = "paramName") String paramName, @RequestParam(value="paramName") String paramName,
@RequestParam(value = "paramValue") String paramValue, @RequestParam(value="paramValue") String paramValue,
@RequestParam(value = "paramType") String paramType, @RequestParam(value="paramType") String paramType,
HttpServletResponse response, HttpServletRequest request) { HttpServletResponse response,HttpServletRequest request) {
/*paramName=java.net.URLDecoder.decode(paramName, "UTF-8");//一次解码 /*paramName=java.net.URLDecoder.decode(paramName, "UTF-8");//一次解码
paramValue=java.net.URLDecoder.decode(paramValue, "UTF-8");//一次解码 paramValue=java.net.URLDecoder.decode(paramValue, "UTF-8");//一次解码
paramType=java.net.URLDecoder.decode(paramType, "UTF-8");//一次解码 paramType=java.net.URLDecoder.decode(paramType, "UTF-8");//一次解码
*/ */
ModelParameter modelParameter = new ModelParameter(); ModelParameter modelParameter = new ModelParameter();
if (!paramName.trim().equals("")) { if(!paramName.trim().equals("")){modelParameter.setParameterName(paramName);}
modelParameter.setParameterName(paramName); if(!paramValue.trim().equals("")){modelParameter.setParameterValue(paramValue);}
} if(!paramType.trim().equals("")){modelParameter.setParameterDataType(paramType);}
if (!paramValue.trim().equals("")) {
modelParameter.setParameterValue(paramValue);
}
if (!paramType.trim().equals("")) {
modelParameter.setParameterDataType(paramType);
}
modelParameter.setIfSystemDefault(0L); modelParameter.setIfSystemDefault(0L);
modelParameterDao.save(modelParameter); modelParameterDao.save(modelParameter);
Long dataModelId = modelParameter.getParameterId(); Long dataModelId = modelParameter.getParameterId();
dataModelIdList.add(dataModelId); dataModelIdList.add(dataModelId);
} }
//新增模型参数 by molinyyi //新增模型参数 add by molinyi
@RequestMapping(value = "/createModelParams", method = RequestMethod.GET) @RequestMapping(value = "/createModelParams", method = RequestMethod.GET)
@ResponseBody @ResponseBody
public void createModelParams( public void createModelParams(
@RequestParam(value = "paramName") String paramName, @RequestParam(value="paramName") String paramName,
@RequestParam(value = "paramCode") String paramCode, @RequestParam(value="paramCode") String paramCode,
@RequestParam(value = "paramValue") String paramValue, @RequestParam(value="paramValue") String paramValue,
@RequestParam(value = "paramType") String paramType, @RequestParam(value="paramType") String paramType,
HttpServletResponse response, HttpServletRequest request) { HttpServletResponse response,HttpServletRequest request) {
System.out.println("paramName " + paramName);
System.out.println("paramCode " + paramCode);
System.out.println("paramValue " + paramValue);
System.out.println("paramType " + paramType);
ModelParameter modelParameter = new ModelParameter(); ModelParameter modelParameter = new ModelParameter();
if (!paramName.trim().equals("")) { if(!paramName.trim().equals("")){modelParameter.setParameterName(paramName);}
modelParameter.setParameterName(paramName); if(!paramCode.trim().equals("")){modelParameter.setParameterCode(paramCode);}
} if(!paramValue.trim().equals("")){modelParameter.setParameterValue(paramValue);}
if (!paramCode.trim().equals("")) { if(!paramType.trim().equals("")){modelParameter.setParameterDataType(paramType);}
modelParameter.setParameterCode(paramCode);
}
if (!paramValue.trim().equals("")) {
modelParameter.setParameterValue(paramValue);
}
if (!paramType.trim().equals("")) {
modelParameter.setParameterDataType(paramType);
}
modelParameter.setIfSystemDefault(0L); modelParameter.setIfSystemDefault(0L);
modelParameterDao.save(modelParameter); modelParameterDao.save(modelParameter);
Long dataModelId = modelParameter.getParameterId(); Long dataModelId = modelParameter.getParameterId();
dataModelIdList.add(dataModelId); dataModelIdList.add(dataModelId);
} }
//新增数据模型 molinyi had modified
//新增数据模型
@RequestMapping(value = "/saveModelDataForm", method = RequestMethod.POST) @RequestMapping(value = "/saveModelDataForm", method = RequestMethod.POST)
public String saveModelDataForm(HttpServletResponse response, HttpServletRequest request) throws ParseException { public String saveModelDataForm(HttpServletResponse response,HttpServletRequest request) throws ParseException{
String modelSavePath = systemParameterDao.findByParameterName("MODEL_SCRIPT_FILE_DIR").get(0).getParameterValue(); String modelSavePath = systemParameterDao.findByParameterName("MODEL_SCRIPT_FILE_DIR").get(0).getParameterValue();
String dataModelName = ""; String dataModelName = "";
String modelDesc = ""; String modelDesc = "";
...@@ -173,116 +159,92 @@ public class ModelMaintainController { ...@@ -173,116 +159,92 @@ public class ModelMaintainController {
Date publishTime = new Date(); Date publishTime = new Date();
Date updateTime = new Date(); Date updateTime = new Date();
DataModel dataModel = new DataModel(); DataModel dataModel = new DataModel();
if (ServletFileUpload.isMultipartContent(request)) { try{
DiskFileItemFactory disk = new DiskFileItemFactory(); if(ServletFileUpload.isMultipartContent(request)){
disk.setSizeThreshold(20 * 1024); DiskFileItemFactory disk = new DiskFileItemFactory();
disk.setRepository(disk.getRepository()); disk.setSizeThreshold(20*1024);
ServletFileUpload up = new ServletFileUpload(disk); disk.setRepository(disk.getRepository());
try { ServletFileUpload up = new ServletFileUpload(disk);
List list = up.parseRequest(request); List list = up.parseRequest(request);
Iterator i = list.iterator(); Iterator i = list.iterator();
while (i.hasNext()) { while(i.hasNext()){
FileItem fm = (FileItem) i.next(); FileItem fm = (FileItem) i.next();
if (fm.isFormField()) { if(fm.isFormField()){
String formName = fm.getFieldName(); String formName = fm.getFieldName();
String tempName = fm.getString("UTF-8"); String tempName = fm.getString("UTF-8");
if (formName.equals("dataModelName")) { if(formName.equals("dataModelName")){
dataModelName = tempName; dataModelName = tempName;
} else if (formName.equals("modelDesc")) { }else if(formName.equals("modelDesc")){
modelDesc = tempName; modelDesc = tempName;
} else if (formName.equals("ruleDefinition")) { }else if(formName.equals("ruleDefinition")){
ruleDefinition = tempName; ruleDefinition = tempName;
} else if (formName.equals("evaluationMethod")) { }else if(formName.equals("evaluationMethod")){
evaluationMethod = tempName; evaluationMethod = tempName;
} else if (formName.equals("evaluationStandard")) { }else if(formName.equals("evaluationStandard")){
evaluationStandard = tempName; evaluationStandard = tempName;
} else if (formName.equals("modelType")) { }else if(formName.equals("modelType")){
modelType = tempName; modelType = tempName;
} else if (formName.equals("deployedServer")) { }else if(formName.equals("deployedServer")){
deployedServer = tempName; deployedServer = tempName;
} else if (formName.equals("modelStatus")) { }else if(formName.equals("modelStatus")){
modelStatus = tempName; modelStatus = tempName;
} else if (formName.equals("kpiTypeId")) { }else if(formName.equals("kpiTypeId")){
kpiTypeId = tempName; kpiTypeId = tempName;
} else if (formName.equals("businessStartTime")) { }/*else if(formName.equals("cycleMinutes")){
cycleMinutes = tempName;
}*/else if(formName.equals("businessStartTime")){
businessStartTime = tempName; businessStartTime = tempName;
} else if (formName.equals("businessEndTime")) { }else if(formName.equals("businessEndTime")){
businessEndTime = tempName; businessEndTime = tempName;
} }
} else { }else{
String fullFilePath = fm.getName(); String fullFilePath = fm.getName();
int startIndex = fullFilePath.lastIndexOf("\\"); int startIndex=fullFilePath.lastIndexOf("\\");
if (startIndex != -1) { if(startIndex!=-1){
modelExeScriptName = fullFilePath.substring(startIndex + 1); modelExeScriptName = fullFilePath.substring(startIndex+1);
} else { }else{
modelExeScriptName = fullFilePath; modelExeScriptName = fullFilePath;
} }
if (!modelExeScriptName.trim().equals("")) { if(!modelExeScriptName.trim().equals("")){
dataModel.setModelScriptName(modelExeScriptName); dataModel.setModelScriptName(modelExeScriptName);
//File file = new File(modelSavePath, modelExeScriptName); File file = new File(modelSavePath,modelExeScriptName);
modelSavePath = "E:\\files"; if(!file.exists()){
modelExeScriptName = System.currentTimeMillis()+"_"+modelExeScriptName;
uploadFile(fm, modelSavePath,modelExeScriptName);
/*if (!file.exists()) {
fm.write(file); fm.write(file);
}else { }
throw new Exception("文件已存在");
}*/
} }
} }
} }
} catch (Exception e) {
e.printStackTrace();
e.getMessage();
return e.getMessage();
} }
}catch(Exception e){
e.printStackTrace();
} }
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
SimpleDateFormat batchFormat = new SimpleDateFormat("yyyyMMdd000001"); SimpleDateFormat batchFormat = new SimpleDateFormat("yyyyMMdd000001");
dataModel.setBatchNo(Long.parseLong(batchFormat.format(sd.parse(businessStartTime)))); dataModel.setBatchNo(Long.parseLong(batchFormat.format(sd.parse(businessStartTime))));
dataModel.setDataModelName(dataModelName); dataModel.setDataModelName(dataModelName);
if (!modelDesc.trim().equals("")) { if(!modelDesc.trim().equals("")){dataModel.setModelDesc(modelDesc);}
dataModel.setModelDesc(modelDesc); if(!ruleDefinition.trim().equals("")){dataModel.setRuleDefinition(ruleDefinition);}
} if(!evaluationMethod.trim().equals("")){dataModel.setEvaluationMethod(evaluationMethod);}
if (!ruleDefinition.trim().equals("")) { if(!evaluationStandard.trim().equals("")){dataModel.setEvaluationStandard(evaluationStandard);}
dataModel.setRuleDefinition(ruleDefinition); if(!modelType.trim().equals("")){dataModel.setDataModelTypeId(Long.parseLong(modelType));}
} if(!deployedServer.trim().equals("")){dataModel.setServerId(Long.parseLong(deployedServer));}
if (!evaluationMethod.trim().equals("")) { if(!modelStatus.trim().equals("")){dataModel.setModelStatus(Long.parseLong(modelStatus));}
dataModel.setEvaluationMethod(evaluationMethod); if(!kpiTypeId.trim().equals("")){dataModel.setKpiTypeId(Long.parseLong(kpiTypeId));}
}
if (!evaluationStandard.trim().equals("")) {
dataModel.setEvaluationStandard(evaluationStandard);
}
if (!modelType.trim().equals("")) {
dataModel.setDataModelTypeId(Long.parseLong(modelType));
}
if (!deployedServer.trim().equals("")) {
dataModel.setServerId(Long.parseLong(deployedServer));
}
if (!modelStatus.trim().equals("")) {
dataModel.setModelStatus(Long.parseLong(modelStatus));
}
if (!kpiTypeId.trim().equals("")) {
dataModel.setKpiTypeId(Long.parseLong(kpiTypeId));
}
/*if(!cycleMinutes.trim().equals("")){dataModel.setCycleMinutes(Long.parseLong(cycleMinutes));}*/ /*if(!cycleMinutes.trim().equals("")){dataModel.setCycleMinutes(Long.parseLong(cycleMinutes));}*/
dataModel.setModelPublishTime(publishTime); dataModel.setModelPublishTime(publishTime);
dataModel.setModelUpdateTime(updateTime); dataModel.setModelUpdateTime(updateTime);
dataModel.setBusinessStartTime(sd.parse(businessStartTime)); dataModel.setBusinessStartTime(sd.parse(businessStartTime));
dataModel.setBusinessEndTime(sd.parse(businessEndTime)); dataModel.setBusinessEndTime(sd.parse(businessEndTime));
dataModelDao.save(dataModel); dataModelDao.save(dataModel);
cmszOperationLogService.createLog("增加", "新建数据模型", "fxjm_data_model_info_t. DATA_MODEL_ID=" + dataModel.getDataModelId().toString()); cmszOperationLogService.createLog("增加","新建数据模型","fxjm_data_model_info_t. DATA_MODEL_ID="+dataModel.getDataModelId().toString());
Long dataModelId = dataModel.getDataModelId(); Long dataModelId = dataModel.getDataModelId();
if (!dataModelIdList.isEmpty()) { if(!dataModelIdList.isEmpty()){
modelParameterService.updateParameterByParameterIds(dataModelId, dataModelIdList); modelParameterService.updateParameterByParameterIds(dataModelId, dataModelIdList);
dataModelIdList.clear(); dataModelIdList.clear();
} }
List<DeployedServer> deployedServerList = deployedServerDao.findByServerId(Long.parseLong(deployedServer)); List<DeployedServer> deployedServerList = deployedServerDao.findByServerId(Long.parseLong(deployedServer));
if (!deployedServerList.isEmpty()) { if(!deployedServerList.isEmpty()){
if (deployedServerList.get(0).getIfWebserver().equals("0")) { if(deployedServerList.get(0).getIfWebserver().equals("0")){
String ftpServer = deployedServerList.get(0).getServerIpAddress(); String ftpServer = deployedServerList.get(0).getServerIpAddress();
String ftpUser = deployedServerList.get(0).getFtpUser(); String ftpUser = deployedServerList.get(0).getFtpUser();
...@@ -292,7 +254,7 @@ public class ModelMaintainController { ...@@ -292,7 +254,7 @@ public class ModelMaintainController {
String ftpFileName = modelExeScriptName; String ftpFileName = modelExeScriptName;
FileInputStream ftpFileInput = null; FileInputStream ftpFileInput = null;
try { try {
ftpFileInput = new FileInputStream(new File(modelSavePath, ftpFileName)); ftpFileInput = new FileInputStream(new File(modelSavePath,ftpFileName));
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
...@@ -305,7 +267,7 @@ public class ModelMaintainController { ...@@ -305,7 +267,7 @@ public class ModelMaintainController {
//连接ftp //连接ftp
ftpClient.connect(ftpServer); ftpClient.connect(ftpServer);
//使用用户名和密码登陆 //使用用户名和密码登陆
if (ftpClient.login(ftpUser, ftpPwd)) { if(ftpClient.login(ftpUser, ftpPwd)){
//变更到文件存储目录 //变更到文件存储目录
ftpClient.changeWorkingDirectory(ftpFilePath); ftpClient.changeWorkingDirectory(ftpFilePath);
//保存文件 //保存文件
...@@ -325,11 +287,11 @@ public class ModelMaintainController { ...@@ -325,11 +287,11 @@ public class ModelMaintainController {
} catch (IOException e) { } catch (IOException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} finally { }finally{
if (ftpClient.isConnected()) { if(ftpClient.isConnected()){
try { try{
ftpClient.disconnect(); ftpClient.disconnect();
} catch (IOException ioe) { }catch(IOException ioe){
ioe.printStackTrace(); ioe.printStackTrace();
} }
} }
...@@ -341,8 +303,8 @@ public class ModelMaintainController { ...@@ -341,8 +303,8 @@ public class ModelMaintainController {
} }
//判断模型名称是否已存在 //判断模型名称是否已存在
@RequestMapping(value = "/select_modelName/{modelName}", method = RequestMethod.GET) @RequestMapping(value = "/select_modelName/{modelName}" ,method=RequestMethod.GET)
public void select_modelName(@PathVariable("modelName") String modelName, HttpServletResponse response, HttpServletRequest request) throws UnsupportedEncodingException { public void select_modelName(@PathVariable("modelName")String modelName,HttpServletResponse response,HttpServletRequest request) throws UnsupportedEncodingException{
Long modelNumber = dataModelDao.getNumOfDataModelByDataModelName(modelName); Long modelNumber = dataModelDao.getNumOfDataModelByDataModelName(modelName);
Gson gson = new Gson(); Gson gson = new Gson();
...@@ -356,15 +318,4 @@ public class ModelMaintainController { ...@@ -356,15 +318,4 @@ public class ModelMaintainController {
e.printStackTrace(); e.printStackTrace();
} }
} }
private static void uploadFile(FileItem item, String realPath,String fileName) throws Exception {
try {
/* String fileName = item.getName().trim();
fileName = System.currentTimeMillis() + "_" + fileName;*/
item.write(new File(realPath, fileName));
} catch (Exception e) {
throw new Exception("文件上传失败");
}
}
} }
...@@ -177,6 +177,7 @@ public class ModelParameterConfigurationController { ...@@ -177,6 +177,7 @@ public class ModelParameterConfigurationController {
modelParameter.setParameterCode(paramCode); modelParameter.setParameterCode(paramCode);
modelParameter.setParameterValue(paramValue); modelParameter.setParameterValue(paramValue);
modelParameter.setParameterDataType(paramType); modelParameter.setParameterDataType(paramType);
modelParameter.setIfSystemDefault(0L);
modelParameterDao.save(modelParameter); modelParameterDao.save(modelParameter);
}else{ }else{
// modelParameterService.updateParameterByParameterId(paramName, paramValue, paramType, Long.parseLong(paramId.split(":")[1])); // modelParameterService.updateParameterByParameterId(paramName, paramValue, paramType, Long.parseLong(paramId.split(":")[1]));
......
...@@ -15,6 +15,7 @@ import org.springframework.ui.ModelMap; ...@@ -15,6 +15,7 @@ import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.ServletRequest; import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
...@@ -95,8 +96,28 @@ public class AssociateDiagosisDetailController { ...@@ -95,8 +96,28 @@ public class AssociateDiagosisDetailController {
return ""; return "";
} }
@RequestMapping("") @RequestMapping("")
public String lis(Map model, ServletRequest request, HttpSession session)
throws UnsupportedEncodingException, ParseException {
List<Province> provinceList =(List<Province>) provinceDao.findProvince();
model.put("provinceList", provinceList);
return PageURLController.AssociateDiagosisDetail;
}
@RequestMapping("/tableList")
@ResponseBody
public String tableList(){
return "";
}
@RequestMapping("/aaa")
public String list(Map model, ServletRequest request, HttpSession session) public String list(Map model, ServletRequest request, HttpSession session)
throws UnsupportedEncodingException, ParseException { throws UnsupportedEncodingException, ParseException {
......
...@@ -91,8 +91,14 @@ ...@@ -91,8 +91,14 @@
<tr><td>业务开始时间(<font color="red">必填</font>):</td><td><input id="businessStartTime" name="businessStartTime" class="form-control" type="text" onFocus="WdatePicker({maxDate:'#F{$dp.$D(\'businessEndTime\')}'})"> </td></tr> <tr><td>业务开始时间(<font color="red">必填</font>):</td><td><input id="businessStartTime" name="businessStartTime" class="form-control" type="text" onFocus="WdatePicker({maxDate:'#F{$dp.$D(\'businessEndTime\')}'})"> </td></tr>
<tr><td>已添加参数:</td> <tr><td>已添加参数:</td>
<td><table class="table table-hover table-striped" id="displayParam"> <td><table class="table table-hover table-striped" id="displayParam">
<thead> <thead class='col-md-15'>
<tr><th>参数名</th><th>参数编码</th><th>参数值</th><th>参数类型</th><th><a href="javascript:deleteAllTr()">删除所有参数</a></th></tr> <tr>
<th class="col-3 text-center">参数名</th>
<th class="col-3 text-center">参数编码</th>
<th class="col-3 text-center">参数值</th>
<th class="col-3 text-center">参数类型</th>
<th class="col-3 text-center"><a href="javascript:deleteAllTr()">删除所有参数</a></th>
</tr>
</thead> </thead>
<tbody id="addTr"></tbody> <tbody id="addTr"></tbody>
</table></td></tr> </table></td></tr>
...@@ -217,7 +223,7 @@ ...@@ -217,7 +223,7 @@
$.alert("参数编码不能为空"); $.alert("参数编码不能为空");
}else{ }else{
if($("#addTr").find("tr.orange-tr").html()==null){ if($("#addTr").find("tr.orange-tr").html()==null){
var addRow = $("<tr><td>"+paramName+"</td><td>"+paramCode+"</td><td>"+paramValue+"</td><td>"+paramDataType+"</td><td><a href='javascript:;' title='' onclick='deleteRow(this)'>删除</a>&nbsp;&nbsp;<a href='javascript:;' onclick='updateRow(this)'>修改</a></td></tr>"); var addRow = $("<tr><td>"+paramName+"</td><td>"+paramCode+"</td><td>"+paramValue+"</td><td>"+paramDataType+"</td><td><a href='javascript:;' title='' onclick='deleteRow(this)'>删除</a><a href='javascript:;' onclick='updateRow(this)'>修改</a></td></tr>");
$("#addTr").append(addRow); $("#addTr").append(addRow);
$("#paramName").attr("value",""); $("#paramName").attr("value","");
$("#paramValue").attr("value",""); $("#paramValue").attr("value","");
...@@ -262,7 +268,6 @@ ...@@ -262,7 +268,6 @@
ok: function(){ ok: function(){
$("#modelSubmit").attr("disabled",true); $("#modelSubmit").attr("disabled",true);
var i = $("#addTr").find("tr").size(); var i = $("#addTr").find("tr").size();
console.log("i "+i);
if(i==0){ if(i==0){
var createForm=$("#modelMaintainForm"); var createForm=$("#modelMaintainForm");
createForm.attr("action","${ctx}/ModelManage/ModelMaintain/saveModelDataForm"); createForm.attr("action","${ctx}/ModelManage/ModelMaintain/saveModelDataForm");
...@@ -275,8 +280,7 @@ ...@@ -275,8 +280,7 @@
var paramCode = $(this).find("td").eq(1).html(); var paramCode = $(this).find("td").eq(1).html();
var paramValue = $(this).find("td").eq(2).html(); var paramValue = $(this).find("td").eq(2).html();
var paramType = $(this).find("td").eq(3).html(); var paramType = $(this).find("td").eq(3).html();
console.log("paramName "+paramName);
console.log("paramCode "+paramCode);
$.ajax({ $.ajax({
type : "GET", type : "GET",
contentType : "application/json", contentType : "application/json",
...@@ -302,11 +306,8 @@ ...@@ -302,11 +306,8 @@
cancelValue: "取消", cancelValue: "取消",
}); });
}else{ }else{
alert(2);
$("#modelSubmit").attr("disabled",true); $("#modelSubmit").attr("disabled",true);
var i = $("#addTr").find("tr").size(); var i = $("#addTr").find("tr").size();
alert("i "+i);
if(i==0){ if(i==0){
var createForm=$("#modelMaintainForm"); var createForm=$("#modelMaintainForm");
...@@ -320,10 +321,7 @@ ...@@ -320,10 +321,7 @@
var paramCode = $(this).find("td").eq(1).html(); var paramCode = $(this).find("td").eq(1).html();
var paramValue = $(this).find("td").eq(2).html(); var paramValue = $(this).find("td").eq(2).html();
var paramType = $(this).find("td").eq(3).html(); var paramType = $(this).find("td").eq(3).html();
alert("paramName "+paramName);
alert("paramCode "+paramCode);
console.log("paramName "+paramName);
console.log("paramCode "+paramCode);
$.ajax({ $.ajax({
type : "GET", type : "GET",
contentType : "application/json", contentType : "application/json",
......
...@@ -93,21 +93,32 @@ ...@@ -93,21 +93,32 @@
<tr><td>业务开始时间(<font color="red">必填</font>):</td><td><input id="businessStartTime" name="businessStartTime" class="form-control" type="text" onFocus="WdatePicker({maxDate:'#F{$dp.$D(\'businessEndTime\')}'})"> </td></tr> <tr><td>业务开始时间(<font color="red">必填</font>):</td><td><input id="businessStartTime" name="businessStartTime" class="form-control" type="text" onFocus="WdatePicker({maxDate:'#F{$dp.$D(\'businessEndTime\')}'})"> </td></tr>
<tr><td>业务结束时间(<font color="red">必填</font>):</td><td><input type="text" class="form-control" id="businessEndTime" name="businessEndTime" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'businessStartTime\')}'})" /></td></tr> <tr><td>业务结束时间(<font color="red">必填</font>):</td><td><input type="text" class="form-control" id="businessEndTime" name="businessEndTime" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'businessStartTime\')}'})" /></td></tr>
<tr><td>参数:</td> <tr><td>参数:</td>
<td><table class="table table-hover table-striped" id="displayParam"> <td>
<thead> <table class="table table-hover table-striped" id="displayParam">
<tr><th>参数名</th><th>参数编码</th><th>参数值</th><th>参数类型</th><th><a href="javascript:deleteAllTr()">删除所有参数</a></th></tr> <thead class='col-md-15'>
</thead> <tr class="row mx-0">
<tbody id="addTr"> <th class="col-3 text-center">参数名</th>
<c:forEach var="modelParameterList" items="${modelParameterList}"> <th class="col-3 text-center">参数编码</th>
<tr> <th class="col-3 text-center">参数值</th>
<td>${modelParameterList.parameterCode}</td> <th class="col-3 text-center">参数类型</th>
<td>${modelParameterList.parameterName}</td> <th class="col-3 text-center"><a href="javascript:deleteAllTr()">删除所有参数</a></th>
<td>${modelParameterList.parameterValue}</td> </tr>
<td>${modelParameterList.parameterDataType}</td> </thead>
<td><a href="javascript:;" title="参数ID:${modelParameterList.parameterId}" onclick="deleteRow(this,'${modelParameterList.parameterId}')">删除</a>&nbsp;&nbsp;<a href="javascript:;" onclick="updateRow(this)">修改</a></td></tr> <tbody id="addTr" class='col-md-15'>
</c:forEach> <c:forEach var="modelParameterList" items="${modelParameterList}">
</tbody> <tr class='row mx-0'>
</table></td></tr> <td class='col-3'>${modelParameterList.parameterCode}</td>
<td class='col-3'>${modelParameterList.parameterName}</td>
<td class='col-3'>${modelParameterList.parameterValue}</td>
<td class='col-3'>${modelParameterList.parameterDataType}</td>
<td class='col-3'>
<a href="javascript:;" title="参数ID:${modelParameterList.parameterId}" onclick="deleteRow(this,'${modelParameterList.parameterId}')">删除</a><a href="javascript:;" onclick="updateRow(this)">修改</a>
</td>
</tr>
</c:forEach>
</tbody>
</table>
</td></tr>
<tr><td>参数数据类型:</td> <tr><td>参数数据类型:</td>
<td><select class="form-control" id="paramDataType" name="paramDataType"> <td><select class="form-control" id="paramDataType" name="paramDataType">
<c:forEach var="dataTypes" items="${dataTypeList}"> <c:forEach var="dataTypes" items="${dataTypeList}">
...@@ -276,7 +287,7 @@ ...@@ -276,7 +287,7 @@
$.alert("参数编码不能为空"); $.alert("参数编码不能为空");
}else{ }else{
if($("#addTr").find("tr.orange-tr").html()==null){ if($("#addTr").find("tr.orange-tr").html()==null){
var addRow = $("<tr><td>"+paramName+"</td><td>"+paramCode+"</td><td>"+paramValue+"</td><td>"+paramDataType+"</td><td><a href='javascript:;' title='' onclick='deleteRow(this,\"\")'>删除</a>&nbsp;&nbsp;<a href='javascript:;' onclick='updateRow(this)'>修改</a></td></tr>"); var addRow = $("<tr class='row mx-0'><td class='col-3'>"+paramName+"</td><td class='col-3'>"+paramCode+"</td><td class='col-3'>"+paramValue+"</td><td class='col-3'>"+paramDataType+"</td><td class='col-3'><a href='javascript:;' title='' onclick='deleteRow(this,\"\")'>删除</a><a href='javascript:;' onclick='updateRow(this)'>修改</a></td></tr>");
$("#addTr").append(addRow); $("#addTr").append(addRow);
$("#paramName").attr("value",""); $("#paramName").attr("value","");
$("#paramCode").attr("value",""); $("#paramCode").attr("value","");
...@@ -312,7 +323,7 @@ ...@@ -312,7 +323,7 @@
}else if($("#businessEndTime").val()==""){ }else if($("#businessEndTime").val()==""){
$.alert("业务结束时间不能为空"); $.alert("业务结束时间不能为空");
}else{ }else{
if($.trim($("#paramName").val())!=""){ if($.trim($("#paramName").val())!=""){//如果 参数填写框 存在未填写的 数据
$.dialog({ $.dialog({
title: "提醒", title: "提醒",
content: "有参数尚未添加,确定提交", content: "有参数尚未添加,确定提交",
...@@ -325,58 +336,60 @@ ...@@ -325,58 +336,60 @@
form.attr("action","#"); form.attr("action","#");
}else{ }else{
$("#addTr").find("tr").each(function(){ $("#addTr").find("tr").each(function(){
var paramName = $(this).find("td").eq(0).html(); var paramName = $(this).find("td").eq(0).html();
var paramCode = $(this).find("td").eq(1).html(); var paramCode = $(this).find("td").eq(1).html();
var paramValue = $(this).find("td").eq(2).html(); var paramValue = $(this).find("td").eq(2).html();
var paramType = $(this).find("td").eq(3).html(); var paramType = $(this).find("td").eq(3).html();
var paramId = $(this).find("td").find("a").attr("title"); var paramId = $(this).find("td").find("a").attr("title");
if(paramId!=""){
$.ajax({
type : "GET",
contentType : "application/json",
//url:"${ctx}/ModelManage/ModelParameterConfiguration/updateParameter?paramName="+encodeURIComponent(paramName)+"&paramValue="+encodeURIComponent(paramValue)+"&paramType="+encodeURIComponent(paramType)+"&paramId="+paramId,
url:"${ctx}/ModelManage/ModelParameterConfiguration/UpdateParameter?paramName="+encodeURIComponent(paramCode)+"&paramCode="+encodeURIComponent(paramName)+"&paramValue="+encodeURIComponent(paramValue)+"&paramType="+encodeURIComponent(paramType)+"&paramId="+paramId,
dataType : "text",
async: false,
beforeSend: function(data){},
success:function(){
i--;
if(i==0){
var form = $("#modelUpdateForm");
form.attr("action","${ctx}/ModelManage/ModelParameterConfiguration/updateDataModelForm");
form.submit();
form.attr("action","#");
}
}
});
}else{
$.ajax({
type : "GET",
contentType : "application/json",
//url:"${ctx}/ModelManage/ModelParameterConfiguration/updateParameter?dataModelId="+getDataModelId+"&paramName="+encodeURIComponent(paramName)+"&paramValue="+encodeURIComponent(paramValue)+"&paramType="+encodeURIComponent(paramType),
url:"${ctx}/ModelManage/ModelParameterConfiguration/UpdateParameter?dataModelId="+getDataModelId+"&paramName="+encodeURIComponent(paramCode)+"&paramCode="+encodeURIComponent(paramName)+"&paramValue="+encodeURIComponent(paramValue)+"&paramType="+encodeURIComponent(paramType),
dataType : "text",
beforeSend: function(data){ },
success:function(){
i--;
if(i==0){
var form = $("#modelUpdateForm");
form.attr("action","${ctx}/ModelManage/ModelParameterConfiguration/updateDataModelForm");
form.submit(); if(paramId!=""){//不是新增参数
form.attr("action","#"); $.ajax({
} type : "GET",
contentType : "application/json",
//url:"${ctx}/ModelManage/ModelParameterConfiguration/updateParameter?paramName="+encodeURIComponent(paramName)+"&paramValue="+encodeURIComponent(paramValue)+"&paramType="+encodeURIComponent(paramType)+"&paramId="+paramId,
url:"${ctx}/ModelManage/ModelParameterConfiguration/UpdateParameter?paramName="+encodeURIComponent(paramCode)+"&paramCode="+encodeURIComponent(paramName)+"&paramValue="+encodeURIComponent(paramValue)+"&paramType="+encodeURIComponent(paramType)+"&paramId="+paramId,
dataType : "text",
async: false,
beforeSend: function(data){},
success:function(){
i--;
if(i==0){
var form = $("#modelUpdateForm");
form.attr("action","${ctx}/ModelManage/ModelParameterConfiguration/updateDataModelForm");
form.submit();
form.attr("action","#");
}
}
});
} }
}); else{//是新增参数
} $.ajax({
}); type : "GET",
} contentType : "application/json",
//url:"${ctx}/ModelManage/ModelParameterConfiguration/updateParameter?dataModelId="+getDataModelId+"&paramName="+encodeURIComponent(paramName)+"&paramValue="+encodeURIComponent(paramValue)+"&paramType="+encodeURIComponent(paramType),
url:"${ctx}/ModelManage/ModelParameterConfiguration/UpdateParameter?dataModelId="+getDataModelId+"&paramName="+encodeURIComponent(paramCode)+"&paramCode="+encodeURIComponent(paramName)+"&paramValue="+encodeURIComponent(paramValue)+"&paramType="+encodeURIComponent(paramType),
dataType : "text",
beforeSend: function(data){ },
success:function(){
i--;
if(i==0){
var form = $("#modelUpdateForm");
form.attr("action","${ctx}/ModelManage/ModelParameterConfiguration/updateDataModelForm");
form.submit();
form.attr("action","#");
}
}
});
}
});
}
}, },
okValue: "确定", okValue: "确定",
cancel:function(){}, cancel:function(){},
cancelValue: "取消" cancelValue: "取消"
}); });
}else{ }else{//如果 参数填写框 不存在未填写的 数据
var i = $("#addTr").find("tr").size(); var i = $("#addTr").find("tr").size();
if(0==i){ if(0==i){
var form = $("#modelUpdateForm"); var form = $("#modelUpdateForm");
...@@ -390,12 +403,13 @@ ...@@ -390,12 +403,13 @@
var paramValue = $(this).find("td").eq(2).html(); var paramValue = $(this).find("td").eq(2).html();
var paramType = $(this).find("td").eq(3).html(); var paramType = $(this).find("td").eq(3).html();
var paramId = $(this).find("td").find("a").attr("title"); var paramId = $(this).find("td").find("a").attr("title");
if(paramId!=""){ if(paramId!=""){//不是新增参数
$.ajax({ $.ajax({
type : "GET", type : "GET",
contentType : "application/json", contentType : "application/json",
//url:"${ctx}/ModelManage/ModelParameterConfiguration/updateParameter?paramName="+encodeURIComponent(paramName)+"&paramValue="+encodeURIComponent(paramValue)+"&paramType="+encodeURIComponent(paramType)+"&paramId="+paramId, //url:"${ctx}/ModelManage/ModelParameterConfiguration/updateParameter?paramName="+encodeURIComponent(paramName)+"&paramValue="+encodeURIComponent(paramValue)+"&paramType="+encodeURIComponent(paramType)+"&paramId="+paramId,
url:"${ctx}/ModelManage/ModelParameterConfiguration/UpdateParameter?paramName="+encodeURIComponent(paramName)+"&paramValue="+encodeURIComponent(paramValue)+"&paramType="+encodeURIComponent(paramType)+"&paramId="+paramId, //url:"${ctx}/ModelManage/ModelParameterConfiguration/UpdateParameter?paramName="+encodeURIComponent(paramName)+"&paramValue="+encodeURIComponent(paramValue)+"&paramType="+encodeURIComponent(paramType)+"&paramId="+paramId,
url:"${ctx}/ModelManage/ModelParameterConfiguration/UpdateParameter?paramName="+encodeURIComponent(paramCode)+"&paramCode="+encodeURIComponent(paramName)+"&paramValue="+encodeURIComponent(paramValue)+"&paramType="+encodeURIComponent(paramType)+"&paramId="+paramId,
dataType : "text", dataType : "text",
async: false, async: false,
beforeSend: function(data){}, beforeSend: function(data){},
...@@ -409,12 +423,13 @@ ...@@ -409,12 +423,13 @@
} }
} }
}); });
}else{ }else{//是新增参数
$.ajax({ $.ajax({
type : "GET", type : "GET",
contentType : "application/json", contentType : "application/json",
//url:"${ctx}/ModelManage/ModelParameterConfiguration/updateParameter?dataModelId="+getDataModelId+"&paramName="+encodeURIComponent(paramName)+"&paramValue="+encodeURIComponent(paramValue)+"&paramType="+encodeURIComponent(paramType), //url:"${ctx}/ModelManage/ModelParameterConfiguration/updateParameter?dataModelId="+getDataModelId+"&paramName="+encodeURIComponent(paramName)+"&paramValue="+encodeURIComponent(paramValue)+"&paramType="+encodeURIComponent(paramType),
url:"${ctx}/ModelManage/ModelParameterConfiguration/UpdateParameter?dataModelId="+getDataModelId+"&paramName="+encodeURIComponent(paramName)+"&paramValue="+encodeURIComponent(paramValue)+"&paramType="+encodeURIComponent(paramType), //url:"${ctx}/ModelManage/ModelParameterConfiguration/UpdateParameter?dataModelId="+getDataModelId+"&paramName="+encodeURIComponent(paramName)+"&paramValue="+encodeURIComponent(paramValue)+"&paramType="+encodeURIComponent(paramType),
url:"${ctx}/ModelManage/ModelParameterConfiguration/UpdateParameter?dataModelId="+getDataModelId+"&paramName="+encodeURIComponent(paramCode)+"&paramCode="+encodeURIComponent(paramName)+"&paramValue="+encodeURIComponent(paramValue)+"&paramType="+encodeURIComponent(paramType),
dataType : "text", dataType : "text",
beforeSend: function(data){ }, beforeSend: function(data){ },
success:function(){ success:function(){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment