KISSY对vm的抽取
vm
<script type="text/javascript"> KISSY.use(['bops/js/forced-closure', 'common/js/tip-util'],function(S, forcedClosure, TipUitl){ //保存 S.one('#btnReason').on('click', function(){ TipUitl.confirm('', '确定提交吗?', function(){ var opinion = S.one('input[name=opinion]:checked').val(); new S.IO({ url: '/stationQuit/forcedAudit.json', data: { orgId: S.one("#orgId").val(), stationApplyId: S.one("#stationApplyId").val(), remarks: S.one("#remarks").val(), opinion: opinion }, success: function(res, textStatus, io){ if (!res.hasError) { if (res.content.success) { TipUitl.success('审核成功!'); } else { TipUitl.error(res.content.exceptionDesc); } } } }); }); }); }); </script>
KISSY:
KISSY.add('bops/js/forced-closure',function(S, TipUitl){
//停业原因
S.one('#reason').on('change',function(){
if(S.one(this).val() == 'OTHER'){
S.one('.js-reason-other').show();
} else {
S.one('.js-reason-other').hide();
}
});
//保存
S.one('#btnReason').on('click', function(){
TipUitl.confirm('', '确定提交吗?', function(){
if(S.one('#reason').val() == 'OTHER'){
if(S.trim(S.one('#reason-other').val()) === ""){
TipUitl.error('请填写原因!');
return false;
}
}
new S.IO({
url: '/stationQuit/forcedClosure.json',
data: {
orgId: S.one("#orgId").val(),
stationApplyId: S.one("#stationApplyId").val(),
reason: S.one('#reason').val(),
remarks: S.one('#reason-other').val()
},
success: function(res, textStatus, io){
if (!res.hasError) {
if (res.content.success) {
TipUitl.success('发送成功!');
}
else {
TipUitl.error(res.content.exceptionDesc);
}
}
}
});
});
});
}, {
requires: ['common/js/tip-util']
});
vm
<script type="text/javascript"> KISSY.use(['bops/js/forced-closure', 'common/js/tip-util'],function(S, forcedClosure, TipUitl){ //保存 S.one('#btnReason').on('click', function(){ TipUitl.confirm('', '确定提交吗?', function(){ var opinion = S.one('input[name=opinion]:checked').val(); new S.IO({ url: '/stationQuit/forcedAudit.json', data: { orgId: S.one("#orgId").val(), stationApplyId: S.one("#stationApplyId").val(), remarks: S.one("#remarks").val(), opinion: opinion }, success: function(res, textStatus, io){ if (!res.hasError) { if (res.content.success) { TipUitl.success('审核成功!'); } else { TipUitl.error(res.content.exceptionDesc); } } } }); }); }); }); </script>
KISSY
KISSY.add('bops/js/forced-audit',function(S, TipUitl){
//保存
S.one('#btnReason').on('click', function(){
TipUitl.confirm('', '确定提交吗?', function(){
var opinion = S.one('input[name=opinion]:checked').val();
new S.IO({
url: '/stationQuit/forcedAudit.json',
data: {
orgId: S.one("#orgId").val(),
stationApplyId: S.one("#stationApplyId").val(),
remarks: S.one("#remarks").val(),
opinion: opinion
},
success: function(res, textStatus, io){
if (!res.hasError) {
if (res.content.success) {
TipUitl.success('审核成功!');
}
else {
TipUitl.error(res.content.exceptionDesc);
}
}
}
});
});
});
}, {
requires: ['common/js/tip-util']
});