getSale();
getTheme();
getThemeType();
function getThemeType() {
var Response = HttpRequest("/ThemeType");
console.log(Response);
FillingContainer("#ThemeType",Response,true)
}
function getTheme() {
var Response = HttpRequest("/Theme");
console.log(Response);
FillingContainer("#ThemeID",Response,true)
}
function getSale() {
var Response = HttpRequest("/Salesperson");
console.log(Response);
FillingContainer("#cardRuleId",Response,true)
}
function FillingContainer(ContainerId,JsonData,Empty) {
var $ = layui.jquery,
data = JsonData;
console.log("FillingContainer-JSON:")
console.log(JsonData);
if(Empty = true){
$(ContainerId).empty();
}
if(data.data.length>0){
$(ContainerId).append("<option value=''>--直接选择或搜索选择--</option>");
for(var i=0;i<data.data.length;i++){
var item=data.data[i];
$(ContainerId).append("<option value="+item.id+">"+item.name+"</option>");
console.log(item.name);
}
}else {
$(ContainerId).append("<option value=''>--请新建规则--</option>");
}
layui.form.render();
}
function HttpRequest(RequestURL,RequestMethod,RequestData,RequestDataType,RequestContentType){
var Response = '';
layui.jquery.ajax({
async:false,
url: RequestURL,
data:RequestData,
method:RequestMethod,
dataType:RequestDataType,
contentType:RequestContentType,
success:function (ret) {
console.log(ret);
Response = ret;
}
})
return Response;
}
{"code":0,"msg":"","data":[{"id":1,"name":"测试内容","state":null}]}