码迷,mamicode.com
首页 > 其他好文 > 详细

KISSY对vm的抽取

时间:2015-07-13 11:57:03      阅读:116      评论:0      收藏:0      [点我收藏+]

标签:

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‘]
});

 

KISSY对vm的抽取

标签:

原文地址:http://www.cnblogs.com/tuifeideyouran/p/4642346.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!