erp2successbid.js

来自「anewssystem新闻发布系统集成使用了spring hibernate f」· JavaScript 代码 · 共 508 行 · 第 1/2 页

JS
508
字号
                                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 = {
            bidCode     : bidCode.getValue(),
            bidContent  : bidContent.getValue(),
            publishDate : publishDate.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');
        var form = this.form;
        this.id = id;

        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(){
                EditForm.form.reset();
            }
        });
        form.addButton({
            text:'取消',
            handler:closeTagHandler
        });
        form.render("update-form");
        form.load({url:'./loadData.htm?id=' + id});

        // 初始化级联的信息
        Ext.lib.Ajax.request(
            'GET',
            './loadData.htm?id=' + this.id,
            {success:function(response){
                var entity = Ext.decode(response.responseText);
                var inviteBid = entity[0].erp2InviteBid;
                var bidId = inviteBid.erp2Bid.id;
                var bidCode = inviteBid.erp2Bid.code;
                var inviteBidId = inviteBid.id;
                var supplierName = inviteBid.erp2Supplier.name;

                form.findField('bidCode').setValue(bidId);
                form.findField('bidCodeId2').setRawValue(bidCode);
                form.findField('supplierName').setValue(inviteBidId);
                form.findField('supplierNameId2').setRawValue(supplierName);
            },failure:function(){}}
        );

        return form;
    },
    createForm : function(url, waitMsgTarget) {
        var form = new Ext.form.Form({
            labelAlign:'right',
            labelWidth:150,
            url:url,
            method: 'POST',
            waitMsgTarget:waitMsgTarget,
            reader : new Ext.data.JsonReader({}, [
                {name:'publishDate'},
                {name:'bidContent'},
                {name:'price'},
                {name:'descn'}
            ])
        });

        var publishDate = new Ext.form.DateField({
                id:'publishDate',
                name:'publishDate',
                readOnly:true,
                fieldLabel:'公示结果日期',
                format:'Y-m-d',
                width:400
            });

        var bidCode = new Ext.form.ComboBox({
                id:'bidCodeId2',
                name:'bidCode',
                readOnly:true,
                fieldLabel:'所投标书编号',
                hiddenName:'bidCode',
                store: new Ext.data.Store({
                    proxy: new Ext.data.HttpProxy({url:'../erp2bid/pagedQueryForCombo.htm'}),
                    reader: new Ext.data.JsonReader({
                        root          : "result",
                        totalProperty : "totalCount",
                        id            : "id"
                    },['id','code'])
                }),
                valueField:'id',
                displayField:'code',
                typeAhead:true,
                mode:'remote',
                triggerAction:'all',
                emptyText:'请选择',
                selectOnFocus:true,
                width:400,
                allowBlank:false,
                pageSize:10
            });
        var supplierDataStore = new Ext.data.Store({
                    proxy: new Ext.data.HttpProxy({url:'../erp2invitebid/pagedQueryByBidId.htm'}),
                    reader: new Ext.data.JsonReader({
                        root          : "result",
                        totalProperty : "totalCount",
                        id            : "id"
                    },['id',{name:'name',mapping:'erp2Supplier.name'}])
                });
        var supplierName = new Ext.form.ComboBox({
                id:'supplierNameId2',
                name:'supplierName',
                readOnly:true,
                fieldLabel:'中标单位名称',
                hiddenName:'supplierName',
                store: supplierDataStore,
                valueField:'id',
                displayField:'name',
                typeAhead:true,
                mode:'local',
                triggerAction:'all',
                emptyText:'请选择',
                selectOnFocus:true,
                width:400,
                allowBlank:false,
                pageSize:10
            });
        bidCode.on('select', function() {
            bidId = bidCode.getValue();
            supplierName.clearValue();
            supplierDataStore.load({
                params:{bidCode:bidId}
            });
        });

        var bidContent = new Ext.form.TextField({
                fieldLabel:'招标内容',
                name:'bidContent',
                width:400,
                allowBlank:false
            });

        var price = new Ext.form.NumberField({
                fieldLabel:'中标成交金额(元)',
                name:'price',
                width:400
            });

        var descn = new Ext.form.TextArea({
                fieldLabel:'中标、成交项目主要内容',
                name:'descn',
                width:400,
                height:100
            });

        form.fieldset(
            {legend:'中标结果', hideLabels:false},
            publishDate,
            bidCode,
            supplierName,
            bidContent,
            price,
            descn
        );
        //
        this.form = form;
    }
};

⌨️ 快捷键说明

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