This commit is contained in:
ly19960718 2021-07-29 12:22:17 +08:00
parent 6794457654
commit c92130ea21
3 changed files with 106 additions and 62 deletions

View File

@ -26,31 +26,31 @@ public class HttpUtil {
* @return
*/
public static String sendGet(String url) {
HttpGet httpget = new HttpGet(url);
CloseableHttpResponse response = null;
try {
response = httpclient.execute(httpget);
} catch (IOException e1) {
e1.printStackTrace();
}
String result = null;
try {
HttpEntity entity = response.getEntity();
if (entity != null) {
result = EntityUtils.toString(entity);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
response.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return result;
HttpGet httpget = new HttpGet(url);
CloseableHttpResponse response = null;
try {
response = httpclient.execute(httpget);
} catch (IOException e1) {
e1.printStackTrace();
}
String result = null;
try {
HttpEntity entity = response.getEntity();
if (entity != null) {
result = EntityUtils.toString(entity);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
response.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return result;
}
/**
* 发送HttpPost请求参数为map
* @param url
@ -58,49 +58,49 @@ public class HttpUtil {
* @return
*/
public static String sendPost(String url, Map<String, String> map) {
List<NameValuePair> formparams = new ArrayList<NameValuePair>();
for (Map.Entry<String, String> entry : map.entrySet()) {
formparams.add(new BasicNameValuePair(entry.getKey(), entry.getValue()));
}
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formparams, Consts.UTF_8);
HttpPost httppost = new HttpPost(url);
httppost.setEntity(entity);
CloseableHttpResponse response = null;
try {
response = httpclient.execute(httppost);
} catch (IOException e) {
e.printStackTrace();
}
HttpEntity entity1 = response.getEntity();
String result = null;
try {
result = EntityUtils.toString(entity1);
} catch (Exception e) {
e.printStackTrace();
}
return result;
List<NameValuePair> formparams = new ArrayList<NameValuePair>();
for (Map.Entry<String, String> entry : map.entrySet()) {
formparams.add(new BasicNameValuePair(entry.getKey(), entry.getValue()));
}
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formparams, Consts.UTF_8);
HttpPost httppost = new HttpPost(url);
httppost.setEntity(entity);
CloseableHttpResponse response = null;
try {
response = httpclient.execute(httppost);
} catch (IOException e) {
e.printStackTrace();
}
HttpEntity entity1 = response.getEntity();
String result = null;
try {
result = EntityUtils.toString(entity1);
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
/**
* 发送不带参数的HttpPost请求
* @param url
* @return
*/
public static String sendPost(String url) {
HttpPost httppost = new HttpPost(url);
CloseableHttpResponse response = null;
try {
response = httpclient.execute(httppost);
} catch (IOException e) {
e.printStackTrace();
}
HttpEntity entity = response.getEntity();
String result = null;
try {
result = EntityUtils.toString(entity);
} catch (Exception e) {
e.printStackTrace();
}
return result;
HttpPost httppost = new HttpPost(url);
CloseableHttpResponse response = null;
try {
response = httpclient.execute(httppost);
} catch (IOException e) {
e.printStackTrace();
}
HttpEntity entity = response.getEntity();
String result = null;
try {
result = EntityUtils.toString(entity);
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
}

View File

@ -44,4 +44,11 @@ public class ConfigTableRouteController extends DefaultBaseController {
return new ModelAndView("configtable/list-field");
}
@GetMapping("input-field")
public ModelAndView inputField() {
return new ModelAndView("configtable/input-field");
}
}

View File

@ -128,6 +128,7 @@
</select>
</script>
</div>
<iframe src="" id="attribute" style="width: 100%;margin-top: -29px" frameborder="0" ></iframe>
</div>
</div>
</form>
@ -259,6 +260,31 @@
<script type="text/javascript" src="assets/js/vendor/sortable/moduleSet.js"></script>
<script type="text/javascript" src="assets/js/vendor/sortable/Sortable.min.js"></script>
<script>
/* var configArray = [{id:'',type:'', baseConfig:{name:'姓名',code:'name'},customConfig:{}}];*/
var configMap = new Map();
initMap();
//初始化配置
function initMap(){
configMap.set("2", {baseConfig:{name:'姓名',code:'name'},customConfig:{}})
}
//根据id获取配置
function getMapById(id){
return configMap.get(id);
}
//设置扩展属性
function setMapCustomData(id,key,value){
configMap.get(id).customConfig[key] = value;
}
//设置基础属性
function setBaseData(id,key,value){
configMap.get(id).baseConfig[key] = value;
}
layui.config({
base: 'assets/layuiadmin/' //静态资源所在路径
}).extend({
@ -275,6 +301,10 @@
var configTableId = top.restAjax.params(window.location.href).configTableId;
var fieldList = [];
var height = $win.height() - 60
//iframe height
document.getElementById("attribute").height = height;
// 通过ID获取某个字段对象
function getField(fieldId) {
for(var i = 0 ; i < fieldList.length ; i++ ) {
@ -516,7 +546,14 @@
console.log(evt);
console.log(evt.item);
console.log(evt.nextSibling);
}
},
onChoose: function (evt) {
console.log("点击")
console.log(evt.item.id)
evt.oldIndex; // element index within parent
var path = top.restAjax.path('route/configtable/input-field?id={id}', [213])
$('#attribute').attr('src',path)
},
});
form.render(null, 'dataForm');
}, function(code, data) {