callApi.html
4.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<form class="r4" style="max-height:250px;overflow: auto;">
<div class="fgroup" data-prop="path" required>
<label>{{SystemEnv.getHtmlNoteName(6007)}}:</label> <!-- 接口名称: -->
<select id="ref-list-api" data-placeholder="{{SystemEnv.getHtmlNoteName(6008)}}"><!-- 请选择调用的接口 -->
<option></option>
{{
APIList.reduce(function(prev, item) {
prev += "<option data-remark='"+ item.basic.remark + "' data-type='"+ item.basic.front.requestMethod + "' data-cfg='"+ item.basic.return.contentType + "' data-id='"+ item.basic.id + "' value='"+ item.basic.front.path + "'>" + item.basic.name + "</option>";
return prev;
}, '')
}}
</select>
</div>
<div class="fgroup hide" id="ref-list-type" data-prop="type">
<input type="text"/><!-- 请求方式 -->
</div>
<div class="fgroup hide" id="ref-list-cfg" data-prop="cfg">
<input type="text"/><!-- 数据类型 -->
</div>
<div class="fgroup" id="ref-list-params" data-params="json" data-prop="params">
<label class="param-des" style="display: none;">{{SystemEnv.getHtmlNoteName(4982)}}</label><!-- 描述: -->
<span class="param-des" id="ref-list-remark" style="vertical-align: middle;color: #888;display: none;"></span>
<br class="param-des" style="display: none;" />
<br class="param-des" style="display: none;" />
<label class="param-item" style="display: none;">{{SystemEnv.getHtmlNoteName(4983)}}</label><!-- 参数: -->
<div class="f-params normal param-item" style="display: none;">
</div>
</div>
<script>
(function() {
require(['components/common','i18n/lang'], function(common,lang) {
$("#ref-list-api").on("change", function() {
var $this = $(this);
var remark = $this.find(":selected").data("remark"),
id = $this.find(":selected").data("id"),
type = $this.find(":selected").data("type"),
cfg = $this.find(":selected").data("cfg"),html;
var $param = $('#ref-list-params').children('.f-params'),
$remark = $('#ref-list-remark'),
$type = $('#ref-list-type input'),
$cfg = $('#ref-list-cfg input'),
$remarkLine = $('.param-des'),
$paramLine = $('.param-item');
$remark.html(lang.parse(String(remark)));
$remarkLine.toggle(!!remark);
if(type==='ANY'){
$type.val('');
}else{
$type.val(type);
}
$cfg.val(cfg);
if(!id){
$param.html('');
$remark.html('');
$type.val('');
$cfg.val('');
$remarkLine.hide();
$paramLine.hide();
}else{
common.api('api', {
action: "info",
type: "get",
data: { id: id }
}).then(function(res) {
var data = res.data.frontParameter;
var html = '';
html = data.reduce(function(prev,item){
prev += '<div>\
<input class="f-params-key" type="text" value="'+item.name+'" placeholder="'+SystemEnv.getHtmlNoteName(5113)+'"/><!-- 参数名称 -->\
<span>=</span>\
<input class="f-params-value" type="text" placeholder="'+lang.parse(item.remark)+'"/><!-- 参数值 -->\
</div>';
return prev;
},'');
$param.html(html);
$paramLine.toggle(!!html);
});
}
});
})
})()
</script>
</form>