houseFill.js
7.95 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
var slsqxx;
// 材料标识吗
var bsmCl;
$(function () {
//设置步骤条信息
setAcceptFlow(GetQueryString('bsm_slsq'), GetQueryString('businessno'));
slsqxx = getApplyRecord(GetQueryString('bsm_slsq'), GetQueryString('businessno'));
LoadClxxDiv();
console.log(111, slsqxx)
})
layui.use('element', function () {
let element = layui.element; //导航的hover效果、二级菜单等功能,需要依赖element模块
});
addTabs('#wssq')
// form 表单
// layui.use('form', function () {
// var form = layui.form;
// form.on('select(typeId)', function (data) {
// console.log(data.value);
// });
// //自定义验证规则
// form.verify({
// title: function (value) {
// if (value.length == 0) {
// return '权利人不能为空';
// } else if (value.length < 2) {
// return '权利人至少得2个字符啊';
// }
// }
// });
// //监听提交
// form.on('submit(demo1)', function (data) {
// layer.alert(JSON.stringify(data.field), {
// title: '最终的提交信息'
// })
// return false;
// });
// })
$('.radioInfo').click(function () {
let index = $(this).attr("value")
if (index == 2 || index == 3) {
$('.add_form').show()
} else {
$('.add_form').hide()
}
})
// form 添加
$('.add_form').click(function () {
$('.layui-form').append(
'<div class="layui-form-item">' +
'<div class="layui-inline">' +
'<label class="layui-form-label">姓名</label>' +
'<div class="layui-input-block">' +
'<input type="text" name="name" required lay-verify="name" placeholder="请输权利人" class="layui-input">' +
'</div>' +
'</div>' +
'<div class="layui-inline idCard">' +
'<label class="layui-form-label">身份证类型</label>' +
'<div class="layui-input-block">' +
'<select lay-filter="typeId">' +
'<option value="1">身份证</option>' +
'<option value="2">军官证</option>' +
'</select>' +
'</div>' +
'</div>' +
'<div class="layui-inline">' +
'<label class="layui-form-label">证件号码</label>' +
'<div class="layui-input-block">' +
'<input type="tel" name="card" maxlength="18" required lay-verify="card" placeholder="请输证件号码" class="layui-input">' +
'</div>' +
'</div>' +
'<div class="layui-inline">' +
'<label class="layui-form-label">联系方式</label>' +
'<div class="layui-input-block">' +
'<input type="tel" name="phone" maxlength="11" required lay-verify="phone" placeholder="请输联系方式" class="layui-input">' +
'</div>' +
'</div>' +
'<i class="layui-icon layui-icon-reduce-circle"></i>' +
'</div>'
)
layui.use('form', function () {
var form = layui.form;
form.render('select');
form.on('select(typeId)', function (data) {
console.log(data.value);
});
})
// 编辑
$(document).on("click", ".layui-icon-reduce-circle", function (e) {
$(this).parent().remove()
})
})
// 图片上传
// 询问笔录
$('.record').click(function (event) {
event.stopPropagation();
})
//config的设置是全局的
layui.config({
base: '../../staticJs/'
}).extend({
common: 'cityCommon'
})
layui.use(['form', 'common'], function () {
var common = layui.common,
form = layui.form;
//三级地址联动
common.showCity('province', 'city');
//区域选择
form.on('select(selectCity)', function (data) {
return false;
});
});
// 领证方式
$('.formRadio').click(function () {
let value = $(this).attr('value')
if (value == 2) {
$('.shipping_method').show()
$('.submitButton').hide()
} else {
$('.shipping_method').hide()
$('.submitButton').show()
}
})
//下一步事件
function skipClick() {
// skipNextPage(GetQueryString('bsm_slsq'),GetQueryString('businessno'));
_uploadSlcl(flieList)
}
function LoadClxxDiv() {
let clxxDic = $("#clxx");
let clxxContent;
$.each(slsqxx.slclList, function (index, item) {
clxxContent = '<div class="img_update">';
clxxContent += '<div class="fileBox">';
clxxContent += '<div class="fileSpan vm">';
clxxContent += '<input type="file" multiple id="fileInput' + index + '" onchange="handleUpdate(this,' + index + ', ' + slsqxx.slclList[index].fs + ')"/>';
clxxContent += '<div class="pictureUpload"></div>';
clxxContent += '<div class="file_name">';
clxxContent += '<img class="update" src="../../staticImages/update.png">';
clxxContent += '<p class="updatetext">点击文件上传</p>';
clxxContent += '</div>';
clxxContent += '<ul class="fileListName" id="fileULName' + index + '"></ul>';
clxxContent += '</div>';
clxxContent += '<div class="certificate">' + slsqxx.slclList[index].clmc + '【' + slsqxx.slclList[index].wjlxmc + '】(' + slsqxx.slclList[index].fs + '份)</div>';
clxxContent += '</div>';
clxxContent += '</div>';
clxxDic.append(clxxContent);
});
}
function handleUpdate(e, index, sizeNum) {
let name = e.files[0].name;
let fileul = $("#fileULName" + index);
if (fileul.find("li").length >= slsqxx.slclList[index].fs) {
return false
} else {
_uploadSlcl(e.files[0], slsqxx.slclList[index].bsmCl, $("#fileULName" + index), sizeNum);
fileul.append('<li class="fileName">' + '<span title="' + name + '">' + name + '</span>' + '<img class="operation" src="../../staticImages/chacha.png">' + '</li>');
}
}
$(document).on("click", ".pictureUpload", function (e) {
layer.msg('已经完成上传最大限度', { icon: 5 });
})
$(document).on("click", ".fileListName .fileName .operation", function (e) {
var that = this
$.ajax({
type: "post", //提交方式
url: portal.api_url + "/portal/FillInformation/deleteSlcl",//路径
dataType: "json",
data: {
'bsmSlclmx': $(that).attr('bsmSlclmx')
},
//数据,这里使用的是Json格式进行传输
success: function (result) {//返回数据根据结果进行相应的处理
if (result.code == 200) {
$(that).parent().remove();
layer.msg('删除成功!');
} else {
layer.msg('删除失败!');
}
}
});
})
// // 图片上传
function _uploadSlcl(flieList, bsmCl, fileul, sizeNum) {
var formData = new FormData();
formData.append('bsmCl', bsmCl);
formData.append('files', flieList);
$.ajax({
type: "post", //提交方式
url: portal.api_url + "/portal/FillInformation/uploadSlcl",//路径
dataType: "json",
cache: false, //上传文件不需要缓存
processData: false, // 告诉jQuery不要去处理发送的数据
contentType: false, // 告诉jQuery不要去设置Content-Type请求头
data: formData,
//数据,这里使用的是Json格式进行传输
success: function (result) {//返回数据根据结果进行相应的处理
if (result.code == 200) {
fileul.parent().find('.fileListName .fileName').eq(fileul.find("li").length - 1).find('.operation').attr('bsmSlclmx', result.data[0].bsmSlclmx)
if (fileul.find('.fileName').length === sizeNum) {
fileul.parent().find('.pictureUpload').show()
layer.msg('上传成功,并且以上传最大限度!');
fileul.parent().find('.file_name').css("z-index", "15");
fileul.parent().find('.updatetext').hide()
fileul.parent().find('.update').attr('src', '../../staticImages/Yes.png')
} else {
layer.msg('上传成功!');
}
}
}
});
}