Authored by qinchao

主机管理修复bug

... ... @@ -2,8 +2,6 @@ package com.ui.ctrl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ui.common.TagTypeEnum;
import com.ui.contants.HttpUriContants;
import com.ui.http.HttpRestClient;
... ... @@ -11,20 +9,18 @@ import com.ui.model.BaseResponse;
import com.ui.model.req.HostInfoReq;
import com.ui.model.req.SetHostTagsReq;
import com.ui.model.req.TagReq;
import com.ui.model.req.User;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by yoho on 2016/6/14.
... ... @@ -45,7 +41,7 @@ public class HostInfoCtrl {
mv.setViewName("host/hostInfoList");
mv.addObject("tagTypeList", TagTypeEnum.getAllType());
mv.addObject("tagsListJson", this.getHostTagsByType("").getData());
mv.addObject("tagsListJson", this.getHostTagsByType("","groupName").getData());
return mv;
}
... ... @@ -57,7 +53,7 @@ public class HostInfoCtrl {
*/
@RequestMapping("/getHostTagsByType")
@ResponseBody
public BaseResponse getHostTagsByType(String type){
public BaseResponse getHostTagsByType(String type,String idMark){
if(type==null){
type="";
}
... ... @@ -70,7 +66,11 @@ public class HostInfoCtrl {
for (Map<String, String> m : hostGroups) {
HashMap map = new HashMap();
map.put("text", m.get("groupName"));
map.put("id", m.get("id"));
if("groupName".equals(idMark)){
map.put("id", m.get("groupName"));
}else{
map.put("id", m.get("id"));
}
tags.add(map);
}
}
... ...
... ... @@ -165,7 +165,7 @@
function refreshTagsByType(){
var tagType=$("#tagType").val();
$.ajax({
url : contextPath +"hostInfoList/getHostTagsByType?type="+tagType,
url : contextPath +"hostInfoList/getHostTagsByType?idMark=groupName&type="+tagType,
type : 'post',
async : false,
dataType : "json",
... ...