zoukankan      html  css  js  c++  java
  • 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']
    });
  • 相关阅读:
    Redis命令行之Hash
    Redis命令行之String
    Redis配置
    访问者模式【行为模式】
    状态模式【行为模式】
    责任链模式【行为模式】
    观察者模式【行为模式】
    策略模式【行为模式】
    模板方法模式【行为模式】
    组合模式【结构模式】
  • 原文地址:https://www.cnblogs.com/tuifeideyouran/p/4642346.html
Copyright © 2011-2022 走看看