@@ -1,31 +1,32 @@
(function () {
var colDataItemArr = ['GenderNo'];
var colDataItemCode = ['usersex'];
var colDataItemBank = ['DepositBank'];
var page = {
isScroll: false,
init: function ($page) {
// 获取登录者信息
var userinfo = learun.storage.get('userinfo');
//tab切换
$page.find('.welTab div').on('tap', function () {
var ind = $(this).index();
$(this).addClass('active').siblings().removeClass('active');
$('.welBox').css('display', 'none').eq(ind).fadeIn()
})
//增加联系人
$page.find('.welT i').on('tap', function () {
$page.find('.welAdd ').on('tap', function () {
var FamilyHtml = '<div class="welCon"><form class="welConForm">' +
'<div class="welInput">' +
'<span>姓名</span>' +
'<input type="text" name="Name" placeholder="请填写姓名" />' +
'<input class="welInputs" type="text" name="Name" placeholder="请填写姓名" />' +
'</div>' +
'<div class="welInput">' +
'<span>与本人关系</span>' +
'<div name="Relation" value=""></div>' +
'</div>' +
'<div class="welInput">' +
'<span>性别</span>' +
'<div name="Sex" value=""></div>' +
'</div>' +
'<div class="welInput">' +
'<span>年龄</span>' +
'<input type="text" name="Age" placeholder="请填写年龄" />' +
'<input class="welInputs" type="text" name="Age" placeholder="请填写年龄" />' +
'</div>' +
'<div class="welInput">' +
'<span>政治面貌</span>' +
@@ -40,37 +41,55 @@
var EmergePeopleHtml = '<div class="welCon"><form class="welConForm">' +
'<div class="welInput">' +
'<span>姓名</span>' +
'<input type="text" name="Name" placeholder="请填写姓名" />' +
'<input class="welInputs" type="text" name="Name" placeholder="请填写姓名" />' +
'</div>' +
'<div class="welInput">' +
'<span>与本人关系</span>' +
'<input type="text" name="Relation" placeholder="请填写与本人关系" / >' +
'<div name="Relation" value=""></div >' +
'</div>' +
'<div class="welInput">' +
'<span>手机号码</span>' +
'<input type="text" name="Telephone" placeholder="请填写手机号码" />' +
'<input class="welInputs" type="text" name="Telephone" placeholder="请填写手机号码" />' +
'</div>' +
'<div class="welInput">' +
'<span>座机号码</span>' +
'<input type="text" name="Mobile" placeholder="请填写座机号码" />' +
'<input class="welInputs" type="text" name="Mobile" placeholder="请填写座机号码" />' +
'</div>' +
'<div class="welInput">' +
'<span>联系地址</span>' +
'<input type="text" name="Address" placeholder="请填写联系地址" />' +
'<input class="welInputs" type="text" name="Address" placeholder="请填写联系地址" />' +
'</div>' +
'<div class="welDel"> <i class="iconfont icon-move"></i> </div>' +
'</form></div>';
var obj = $(this).parent().next( );
var obj = $(this).parents('.welBox').find('.welUrgent' );
if ($(this).attr('title') == '紧急联系人') {
obj.append(EmergePeopleHtml);
} else {
obj.append(FamilyHtml);
//政治面貌
var Politicy = $(obj).find('[name="Politicy"]:last');
Politicy.lrpickerex({
code: 'BCdPartyFace',
type: 'sourceData',
ivalue: 'partyfaceno',
itext: 'partyface'
});
//赋值
Politicy.lrpickerSet(Politicy.attr('value'));
}
page.bind($page);
//与本人关系
var Relation = $(obj).find('[name="Relation"]:last');
Relation.lrpickerex({
code: 'FamilyRelation',
type: 'dataItem'
});
//赋值
Relation.lrpickerSet(Relation.attr('value'));
// page.bind($page);
})
//删除联系人
$page.find('.welBox').on('tap', '.welDel i', function () {
@@ -81,7 +100,7 @@
})
//上传照片
var inputNode = $page.find('#files');
$page.find('#welImgBtn ').on('tap', function () {
$page.find('#PhotoImg ').on('tap', function () {
var evt = new MouseEvent("click", {
bubbles: false,
cancelable: true,
@@ -92,142 +111,205 @@
inputNode.on('change', function () {
previewFile();
});
//数据绑定
learun.layer.loading(true, '获取数据中');
learun.httpget(config.webapi + "StuInfoFresh/stuInfoFreshEntity", userinfo.baseinfo.account, (
data) => {
//console.log('datadata',data);
if (data) {
if(!data['StuInfoFreshEntity'])
{
learun.layer.loading(false);
learun.layer.toast('未查询到新生数据,请确认是否为新生。');
return;
}
//基本信息
for (var id in data['StuInfoFreshEntity']) {
var dom = $('#' + id)[0];
if (dom) {
if (dom.tagName.toLowerCase() == "span") {
$('#' + id).html(data['StuInfoFreshEntity']['' + id + '']);
//数据字典
if ($.inArray(id, colDataItemArr) >= 0) {
learun.clientdata.get('dataItem', {
code: colDataItemCode[$.inArray(id,
colDataItemArr)],
key: data['StuInfoFreshEntity']['' + id + ''],
callback: function(data, op) {
$('#' + id).html(data.text);
}
});
}
if (id == "PartyFaceNo") {
learun.clientdata.get('sourceData', {
code: 'BCdPartyFace',
key: data['StuInfoFreshEntity']['' + id + ''],
keyId: 'partyfaceno',
callback: function(data, op) {
$("#PartyFaceNo").html(data.partyface);
}
});
}
if (id == "#DepositBank") {
learun.clientdata.get('sourceData', {
code: 'DepositBank',
key: data['StuInfoFreshEntity']['' + id + ''],
keyId: 'DepositBank',
callback: function(data, op) {
$("#DepositBank").html(data.text);
}
});
}
} else if (dom.tagName.toLowerCase() == "input") {
$('#' + id).val(data['StuInfoFreshEntity']['' + id + '']);
}
}
}
$("#Birthday").html($("#Birthday").text().substr(0, $("#Birthday").text()
.indexOf(' ')));
$("#DepositBank").lrpickerSet(data.StuInfoFreshEntity.DepositBank);
//头像
$('#PhotoImg').attr('src', config.web + data['Url']);
//家庭成员
if(data['StuInfoFreshFamilyList'].length>0){
$('#StuInfoFreshFamily').html("");
$.each(data['StuInfoFreshFamilyList'], function(i, item) {
var html = '<div class="welCon"><form class="welConForm">' +
'<div class="welInput">' +
'<span>姓名</span>' +
'<input class="welInputs" type="text" name="Name" placeholder="请填写姓名" value="' +
item.Name + '"/>' +
'</div >' +
'<div class="welInput">' +
'<span>与本人关系</span>' +
'<div name="Relation" value="' + item.Relation + '"></div>' +
'</div>' +
'<div class="welInput">' +
'<span>年龄</span>' +
'<input class="welInputs" type="text" name="Age" placeholder="请填写年龄" value="' +
item.Age + '"/>' +
'</div>' +
'<div class="welInput">' +
'<span>政治面貌</span>' +
'<div name="Politicy" value="' + item.Politicy + '"/>' +
'</div>' +
'<div class="welDel"> <i class="iconfont icon-move"></i> </div>' +
'</form></div> ';
$('#StuInfoFreshFamily').append(html);
//数据绑定
learun.layer.loading(true, '获取数据中');
learun.httpget(config.webapi + "StuInfoFresh/stuInfoFreshEntity", userinfo.baseinfo.account, (data) => {
if (data) {
//基本信息
for (var id in data['StuInfoFreshEntity']) {
var dom = $('#' + id)[0];
if (dom) {
if (dom.tagName.toLowerCase() == "span") {
$('#' + id).html(data['StuInfoFreshEntity']['' + id + '']);
//数据字典
if ($.inArray(id, colDataItemArr) >= 0) {
learun.clientdata.get('dataItem', {
code: colDataItemCode[$.inArray(id, colDataItemArr)],
key: data['StuInfoFreshEntity']['' + id + ''],
callback: function (data, op) {
$('#' + id).html(data.text);
}
});
}
if (id == "PartyFaceNo") {
learun.clientdata.get('sourceData', {
code: 'BCdPartyFace',
key: data['StuInfoFreshEntity']['' + id + ''],
keyId: 'partyfaceno',
callback: function (data, op) {
$("#PartyFaceNo").html(data.partyface);
}
});
}
} else if (dom.tagName.toLowerCase() == "input") {
$('#' + id).val(data['StuInfoFreshEntity']['' + id + '']);
}
}
}
$("#Birthday").html($("#Birthday").text().substr(0, $("#Birthday").text().indexOf(' ')));
//头像
$('#PhotoImg').attr('src', config.web + data['Url']);
//家庭成员
$('#StuInfoFreshFamily').html("");
$.each(data['StuInfoFreshFamilyList'], function (i, item) {
var html = '<div class="welCon"><form class="welConForm">' +
'<div class="welInput">' +
'<span>姓名</span>' +
'<input type="text" name="Name" placeholder="请填写姓名" value="' + item.Name + '"/>' +
'</div >' +
'<div class="welInput">' +
'<span>与本人关系</span>' +
//'<input type="text" name="Relation" placeholder="请填写与本人关系" value="' + item.Relation + '"/>' +
'<div name="Relation" value="' + item.Relation + '"></div>' +
'</div>' +
'<div class="welInput">' +
'<span>性别</span>' +
//'<input type="text" name="Sex" placeholder="请填写性别" value="' + item.Sex + '"/>' +
'<div name="Sex" value="' + item.Sex + '"></div>' +
'</div>' +
'<div class="welInput">' +
'<span>年龄</span>' +
'<input type="text" name="Age" placeholder="请填写年龄" value="' + item.Age + '"/>' +
'</div>' +
'<div class="welInput">' +
'<span>政治面貌</span>' +
//'<input type="text" name="Politicy" placeholder="请填写政治面貌" value="' + item.Politicy + '"/>' +
'<div name="Politicy" value="' + item.Politicy + '"/>' +
'</div>' +
//'<div class="welInput">' +
//'<span>身份证号</span>' +
//'<input type="text" name="IdCard" placeholder="请填写身份证号" value="' + item.IdCard + '"/>' +
//'</div>' +
'<div class="welDel"> <i class="iconfont icon-move"></i> </div>' +
'</form></div> ';
$('#StuInfoFreshFamily').append(html);
});}
});
//紧急联系人
if(data['StuInfoFreshEmergePeopleList'].length>0){
$('#StuInfoFreshEmergePeople').html("");
$.each(data['StuInfoFreshEmergePeopleList'], function(i, item) {
var html = '<div class="welCon"><form class="welConForm">' +
'<div class="welInput">' +
'<span>姓名</span>' +
'<input class="welInputs" type="text" name="Name" placeholder="请填写姓名" value="' +
item.Name + '"/>' +
'</div >' +
'<div class="welInput">' +
'<span>与本人关系</span>' +
'<div name="Relation" value="' +item.Relation + '"></div>' +
'</div>' +
'<div class="welInput">' +
'<span>手机号码</span>' +
'<input class="welInputs Telephone" type="text" name="Telephone" placeholder="请填写手机号码" value="' +
item.Telephone + '"/>' +
'</div>' +
'<div class="welInput">' +
'<span>座机号码</span>' +
'<input class="welInputs Telephone2" type="text" name="Mobile" placeholder="请填写座机号码" value="' +
item.Mobile + '"/>' +
'</div>' +
'<div class="welInput">' +
'<span>联系地址</span>' +
'<input class="welInputs" type="text" name="Address" placeholder="请填写联系地址" value="' +item.Address + '"/>' +
'</div>' +
//'<div class="welDel"> <i class="iconfont icon-move"></i> </div>' +
'</form></div > ';
$('#StuInfoFreshEmergePeople').append(html);
//紧急联系人
$('#StuInfoFreshEmergePeople').html("");
$.each(data['StuInfoFreshEmergePeopleList'], function (i, item) {
var html = '<div class="welCon"><form class="welConForm">' +
'<div class="welInput">' +
'<span>姓名</span>' +
'<input type="text" name="Name" placeholder="请填写姓名" value="' + item.Name + '"/>' +
'</div >' +
'<div class="welInput">' +
'<span>与本人关系</span>' +
'<input type="text" name="Relation" placeholder="请填写与本人关系" value="' + item.Relation + '"/>' +
'</div>' +
'<div class="welInput">' +
'<span>手机号码</span>' +
'<input type="text" name="Telephone" placeholder="请填写手机号码" value="' + item.Telephone + '"/>' +
'</div>' +
'<div class="welInput">' +
'<span>座机号码</span>' +
'<input type="text" name="Mobile" placeholder="请填写座机号码" value="' + item.Mobile + '"/>' +
'</div>' +
'<div class="welInput">' +
'<span>联系地址</span>' +
'<input type="text" name="Address" placeholder="请填写联系地址" value="' + item.Address + '"/>' +
'</div>' +
'<div class="welDel"> <i class="iconfont icon-move"></i> </div>' +
'</form></div > ';
$('#StuInfoFreshEmergePeople').append(html);
});
}
$('.Telephone').on('blur',function(item){
var reg = new RegExp("^[0-9]*$")
if(!reg.test($(".Telephone").val())){
});
$(".Telephone").val("")
$('.Telephone').attr('placeholder',"手机号只能为数字");
learun.layer.loading(true, '手机号只能为数字');
setTimeout(function(){
learun.layer.loading(false);
},1000)
}
page.bind($page);
learun.layer.loading(false);
})
}
$('.Telephone2').on('blur',function(item){
var reg = new RegExp(/^\d{3}-\d{7,8}|\d{4}-\d{7,8}$/)
if(!reg.test($(".Telephone2").val())){
});
$(".Telephone2").val("")
$('.Telephone2').attr('placeholder',"座机号只能为数字");
learun.layer.loading(true, '座机号只能为数字');
setTimeout(function(){
learun.layer.loading(false);
},1000)
}
})
page.bind($page);
learun.layer.loading(false);
}
});
//保存
$page.find('#saveBtn').on('tap', function () {
var postdata = {
ID: $('#ID').val(),
RegionNo: $('#RegionNo').val(),
FamilyAddress: $('#FamilyAddress').val(),
telephone: $('#telephone').val(),
Photo: $('#Photo').val(),
StuInfoFreshFamilyEntities: family(),
StuInfoFreshEmergePeopleEntities: emergePeople()
};
$page.find('.saveBtn').on('tap', function () {
var postdata = {
ID: $('#ID').val(),
RegionNo: $('#RegionNo').val(),
FamilyAddress: $('#FamilyAddress').val(),
telephone: $('#telephone').val(),
Photo: $('#Photo').val(),
DepositBank: $('#DepositBank').lrpickerGet(),
BankCard: $('#BankCard').val(),
BankLocation: $('#BankLocation').val(),
StuInfoFreshFamilyEntities: family(),
StuInfoFreshEmergePeopleEntities: emergePeople()
};
//console.log(postdata)
//return
learun.layer.loading(true, '正在提交数据');
learun.httpget(config.webapi + "StuInfoFresh/saveStuInfoFresh", postdata, (data) => {
learun.layer.loading(false);
if (data) {
learun.layer.toast('保存成功');
location.reload();
learun.nav.closeCurrent();
learun.nav.go({ path: 'notice2', title: '新生入校流程', type: 'right' });
}
});
});
page.bind($page);
},
bind: function ($page) {
//性别
@@ -251,7 +333,7 @@
$(item).lrpickerSet($(item).attr('value'));
});
//与本人关系
$.each($page.find('#StuInfoFreshFamily').find(' [name="Relation"]'), function (i, item) {
$.each($page.find('[name="Relation"]'), function (i, item) {
$page.find(item).lrpickerex({
code: 'FamilyRelation',
type: 'dataItem'
@@ -259,6 +341,19 @@
//赋值
$(item).lrpickerSet($(item).attr('value'));
});
//开户银行
$page.find('#DepositBank').lrpickerex({
code: 'DepositBank',
type: 'dataItem'
});
/* $.each($page.find('[name="DepositBank"]'), function (i, item) {
$page.find(item).lrpickerex({
code: 'DepositBank',
type: 'dataItem'
});
//赋值
$(item).lrpickerSet($(item).attr('value'));
}); */
}
};
//数据处理
@@ -277,6 +372,7 @@
var list = new Array();
$.each($('#StuInfoFreshEmergePeople').children('.welCon'), function (i, item) {
var o = $(item).children(".welConForm").serializeObject();
o.Relation = $(item).find('[name="Relation"]').lrpickerGet();
list.push(o);
});
return list;