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

View File

@ -44,4 +44,11 @@ public class ConfigTableRouteController extends DefaultBaseController {
return new ModelAndView("configtable/list-field"); 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> </select>
</script> </script>
</div> </div>
<iframe src="" id="attribute" style="width: 100%;margin-top: -29px" frameborder="0" ></iframe>
</div> </div>
</div> </div>
</form> </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/moduleSet.js"></script>
<script type="text/javascript" src="assets/js/vendor/sortable/Sortable.min.js"></script> <script type="text/javascript" src="assets/js/vendor/sortable/Sortable.min.js"></script>
<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({ layui.config({
base: 'assets/layuiadmin/' //静态资源所在路径 base: 'assets/layuiadmin/' //静态资源所在路径
}).extend({ }).extend({
@ -275,6 +301,10 @@
var configTableId = top.restAjax.params(window.location.href).configTableId; var configTableId = top.restAjax.params(window.location.href).configTableId;
var fieldList = []; var fieldList = [];
var height = $win.height() - 60
//iframe height
document.getElementById("attribute").height = height;
// 通过ID获取某个字段对象 // 通过ID获取某个字段对象
function getField(fieldId) { function getField(fieldId) {
for(var i = 0 ; i < fieldList.length ; i++ ) { for(var i = 0 ; i < fieldList.length ; i++ ) {
@ -516,7 +546,14 @@
console.log(evt); console.log(evt);
console.log(evt.item); console.log(evt.item);
console.log(evt.nextSibling); 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'); form.render(null, 'dataForm');
}, function(code, data) { }, function(code, data) {