wssq.js
3.29 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
$(function () {
layui.use('element', function () {
let element = layui.element; //导航的hover效果、二级菜单等功能,需要依赖element模块
//监听导航点击
element.on('nav(demo)', function (elem) {
layer.msg(elem.text());
});
});
addTabs('#wssq')
//config的设置是全局的
layui.config({
base: '../../staticJs/'
}).extend({ //设定模块别名
common: 'cityCommon'
});
$(document).on("click", ".area_list li", function (e) {
$(".area_list li").removeClass("active2")
$(this).addClass("active2");
_businessList($(this).attr("data-id"))
})
layui.use(['form', 'common'], function () {
var common = layui.common,
form = layui.form;
//三级地址联动
common.showCity('province', 'city');
//区域选择
form.on('select(selectCity)', function (data) {
return false;
});
});
_initData()
// 网上申请
$(document).on("click", ".handleBus", function (e) {
getInitiateFLow($(this).attr("ywid"));
})
})
// 初始化数据
function _initData() {
var area_list = $(".area_list");
area_list.empty();
var li
$.ajax({
type: "get", //提交方式
url: portal.api_url + "/cms/district/queryAllDistrict",//路径
dataType: "json",
//数据,这里使用的是Json格式进行传输
success: function (result) {//返回数据根据结果进行相应的处理
if (result.code == 200 && result.data != null) {
let data = result.data[0].children[0].children
for (var i = 0; i < data.length; i++) {
li = '<li data-id="' + data[i].id + '">' + data[i].name + '</li>';
area_list.append(li);
}
}
}
});
}
// 获取申请业务列表
function _businessList(districtId) {
$.ajax({
type: "post", //提交方式
url: portal.api_url + "/portal/ApplyBusinessService/getApplyBusiness",//路径
dataType: "json",
data: {
"districtId": districtId,
},
//数据,这里使用的是Json格式进行传输
success: function (result) {//返回数据根据结果进行相应的处理
if (result.code == 200 && result.data != null) {
// 即时办结
data.immediateList = result.data.forthwith
data.settlementList = result.data.onlineAudit
}
layui.use('laytpl', function () {
laytpl = layui.laytpl;
var getTpl = document.getElementById('immediatelist').innerHTML
, view = document.getElementById('immediate');
laytpl(getTpl).render(data, function (html) {
view.innerHTML = html;
});
// 网上预审
var getTpl = document.getElementById('settlementlist').innerHTML
, view = document.getElementById('settlement');
laytpl(getTpl).render(data, function (html) {
view.innerHTML = html;
});
});
}
});
}
var data = { //数据
"immediateList": [],
"settlementList": []
};