⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 erp2buycontract.js

📁 anewssystem新闻发布系统集成使用了spring hibernate freemarker EXTJS等开源框架 可以作为学习参考
💻 JS
📖 第 1 页 / 共 2 页
字号:
                        var ids = new Array();
                        for(var i = 0, len = selections.length; i < len; i++){
                            try {
                                selections[i].get("id");
                                ids[i] = selections[i].get("id");
                                dataStore.remove(selections[i]);//从表格中删除
                            } catch (e) {
                            }
                        }
                        Ext.Ajax.request({
                            url     : 'remove.htm?ids=' + ids,
                            success : function() {
                                Ext.MessageBox.alert('提示', '删除成功!');
                                //dataStore.reload();
                            },
                            failure : function(){Ext.MessageBox.alert('提示', '删除失败!');}
                        });
                    }
                });
            } else {
                Ext.MessageBox.alert('警告', '至少要选择一条记录');
            }
        }
    });

    dataStore.on('beforeload', function() {
        dataStore.baseParams = {
            code : code.getValue(),
            status : status.getValue(),
            name : name.getValue(),
            contractDate : contractDate.getValue()
        };
    });

    dataStore.load({
        params:{start:0, limit:paging.pageSize}
    });
});


EditForm = {
    getInsertForm : function(closeTagHandler) {
        this.createForm('./insert.htm', 'insert-box');
        var form = this.form;

        form.addButton({
            text:'提交',
            handler:function(){
                if (form.isValid()) {
                    form.submit({
                        success:function(form, action){
                            Ext.MessageBox.confirm('提示', '保存添加成功,是否继续添加' , function(btn){
                                if (btn == 'yes') {
                                    form.reset();
                                } else {
                                    closeTagHandler();
                                }
                            });
                        }
                        ,failure:function(form, action){
                            Ext.suggest.msg('错误', action.result.response);
                        }
                        ,waitMsg:'提交中...'
                    });
                }
            }
        });
        form.addButton({
            text:'重置',
            handler:function(){
                EditForm.form.reset();
            }
        });
        form.addButton({
            text:'取消',
            handler:closeTagHandler
        });
        form.render("insert-form");

        return form;
    },
    getUpdateForm : function(closeTagHandler, id) {
        this.createForm('./insert.htm', 'update-box');
        this.id = id;
        var form = this.form;

        form.addButton({
            text:'提交',
            handler:function(){
                if (form.isValid()) {
                    form.submit({
                        params:{id:EditForm.id},
                        success:function(form, action){
                            Ext.MessageBox.confirm('提示', '保存修改成功,是否返回' , function(btn){
                                if (btn == 'yes') {
                                    closeTagHandler();
                                } else {
                                    form.reset();
                                }
                            });
                        }
                        ,failure:function(form, action){
                            Ext.suggest.msg('错误', action.result.response);
                        }
                        ,waitMsg:'提交中...'
                    });
                }
            }
        });
        form.addButton({
            text:'重置',
            handler:function(){
                form.reset();
            }
        });
        form.addButton({
            text:'取消',
            handler:closeTagHandler
        });
        form.render("update-form");
        form.load({url:'./loadData.htm?id=' + id});

        return form;
    },
    createForm : function(url, waitMsgTarget) {
        var form = new Ext.form.Form({
            labelAlign:'right',
            labelWidth:80,
            url:url,
            method: 'POST',
            waitMsgTarget:waitMsgTarget,
            reader : new Ext.data.JsonReader({}, [
                {name:'code'},
                {name:'status'},
                {name:'name'},
                {name:'supplier',mapping:"erp2Supplier.name"},
                {name:'linkman'},
                {name:'provideDate'},
                {name:'receipt'},
                {name:'contractDate'},
                {name:'username'}
            ])
        });

        form.fieldset(
            {legend:'采购合同信息', hideLabels:false},
            new Ext.form.TextField({
                fieldLabel:'合同编号',
                name:'code',
                width:400,
                allowBlank:false
            }),

            new Ext.form.TextField({
                fieldLabel:'合同状态',
                name:'status',
                width:400,
                allowBlank:false
            }),

            new Ext.form.TextField({
                fieldLabel:'合同名称',
                name:'name',
                width:400,
                allowBlank:false
            }),

            new Ext.form.ComboBox({
                id:'supplierNameId2',
                name:'supplier',
                readOnly:true,
                fieldLabel:'供应商',
                hiddenName:'supplier',
                store: new Ext.data.Store({
                    proxy: new Ext.data.HttpProxy({url:'../erp2supplier/pagedQueryForCombo.htm'}),
                    reader: new Ext.data.JsonReader({
                        root          : "result",
                        totalProperty : "totalCount",
                        id            : "id"
                    },['id','name'])
                }),
                valueField:'id',
                displayField:'name',
                typeAhead:true,
                mode:'remote',
                triggerAction:'all',
                emptyText:'请选择',
                selectOnFocus:true,
                width:400,
                allowBlank:false,
                pageSize:10
            }),

            new Ext.form.TextField({
                fieldLabel:'联系人',
                name:'linkman',
                width:400,
                allowBlank:false
            }),

            new Ext.form.DateField({
                fieldLabel:'要求供货日期',
                name:'provideDate',
                format:'Y-m-d',
                width:400,
                allowBlank:false
            }),

            new Ext.form.TextField({
                fieldLabel:'收货状态',
                name:'receipt',
                width:400,
                allowBlank:false
            }),

            new Ext.form.DateField({
                fieldLabel:'签订日期',
                name:'contractDate',
                format:'Y-m-d',
                width:400,
                allowBlank:false
            }),

            new Ext.form.TextField({
                fieldLabel:'订单签订人员',
                name:'username',
                width:400,
                allowBlank:false
            })
        );

        //
        this.form = form;
    }
};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -