SOURCE

function allReadyEdit() {
    var mstform = Ext.getCmp('p_form0000700129_m'); 

mstform.on('dataready',function(){
    var ocode=mstform.getItem('ocode').getValue();
    mstform.getItem('phid_pc').addListener('beforetriggerclick', function () {
        this.setClientSqlFilter('cat_phid='+ocode); 
    }); 

    if (otype == $Otype.ADD ) {
        var pc=mstform.getItem('phid_pc').getValue();
        mstform.getItem('tjzq').addListener('change', function () {
            var tjzq=mstform.getItem('tjzq').getValue();
            var byzxcz=mstform.getItem('byzxcz').getValue();
            if(pc){
                if(tjzq){
                    callServer('zcz', [{'pc': pc}], function (res) {
                        if(res){
                            mstform.getItem('kgljcz').setValue(res.record[0].zcz+byzxcz);
                        }
                    });
                }
                callServer('jcsh', [{'pc': pc}], function (res) {
                    if(res.count!='0'){
                        var a=res.record[0].ischeck;     
                        if(a==0){
                            Ext.Msg.alert('提示', '该项目有未核准的产值填报单,单据将自动关闭!');
                            setTimeout(function(){window.close();},1000);
                            return false;
                        } 
                    }
                }); 
            }else{
                Ext.Msg.alert('提示', '请先选择项目名称!');
                mstform.getItem('tjzq').setValue('');
            }
        });
        mstform.getItem('byzxcz').addListener('change', function () {
            var tjzq=mstform.getItem('tjzq').getValue();
            var byzxcz=mstform.getItem('byzxcz').getValue();
            if(tjzq){
                callServer('zcz', [{'pc': pc}], function (res) {
                    mstform.getItem('kgljcz').setValue(res.record[0].zcz+byzxcz);
                });
            }
        });            
    }

    if (otype == $Otype.EDIT || otype == $Otype.VIEW ) {
        var pc=mstform.getItem('phid_pc').getValue();
        var tjzq=mstform.getItem('tjzq').getValue();
        mstform.getItem ('tjzq').userSetReadOnly(true);   

        mstform.getItem('byzxcz').addListener('change', function () {
            var mouthsjcz=mstform.getItem('byzxcz').getValue();
            if(tjzq){
                callServer('zcz', [{'pc': pc}], function (res) {
                    mstform.getItem('kgljcz').setValue(res.record[0].zcz+mouthsjcz);
                });

            }else{
                Ext.Msg.alert('提示', '请先填写统计周期!');
                mstform.getItem('byzxcz').setValue('');
            }
        });
    }
});      
}

function beforeSaveEdit () {
    var mstform = Ext.getCmp('p_form0000700129_m');
    var num=1; 
    var asr_flg=mstform.getItem('asr_flg').getValue();
    if(asr_flg==0){
        var msg=Ext.Msg.alert('提示', '请上传附件!');
        setTimeout(function () {msg.close();}, 1000);
        num=0;
        return false;
    }
    if(num){
        return true;
    } else {
        return false;
    }
}
console 命令行工具 X clear

                    
>
console