打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
ExtJs 页面布局三
 主要是看一下里面的复选框是如何实现的
 

---------------------------------------------------------------------------------------------
// 判断是否存在此对象,如果不存在则新建,否则直接返回
var _showpanel = Ext.getCmp(this.genId("main"));
if (_showpanel) {
return _showpanel;
}
var _this = this;
var _buyASendB=1;//买A送B优惠
var _buyNAandMB=2;//买NA+MB则优惠
var _numberN=3;//第N件优惠
var _limitTime=4;//限时优惠
/**
* 以下参数是从参数页面传递过来的
*/
var _promopacktype=null;//促销类型
var _querytype=null;//查询日期类型
var _begindate=null;//起始日期
var _enddate=null;//结束日期
var _status=null;//促销方案状态
var _promopackname=null;//促销方案名称
var _promopackid=null;//促销单号
var _corpcode=null;//门店编号
var _corpname=null;//门店名称
var _articlasscode=null;//分类编号
var _articlassname=null;//分类名称
var _brandcode=null;//品牌编号
var _brandname=null;//品牌名称
var _articode=null;//商品编号
var _artiname=null;//商品名称

//销售综合查询主表
var promopackMStore = new Ext.data.JsonStore({
url : "data/promopack1.txt",
root : "data",
fields : [ {
name : "promopacktype",
type : "string"
}, {
name : "promopackname",
type : "string"
}, {
name : "begindate",
type : "string"
}, {
name : "enddate",
type : "string"
}, {
name : "begintime",
type : "string"
},{
name : "endtime",
type : "string"
}, {
name : "promopackqty",
type : "string"
}, {
name : "pmon",
type : "string"
}, {
name : "ptue",
type : "string"
},{
name : "pwed",
type : "string"
}, {
name : "pthu",
type : "string"
}, {
name : "pfri",
type : "string"
}, {
name : "psat",
type : "string"
},{
name : "psun",
type : "string"
}, {
name : "pmem",
type : "string"
}, {
name : "status",
type : "string"
}, {
name : "promopackid",
type : "string"
},{
name : "optrid",
type : "string"
}, {
name : "ortrtime",
type : "string"
}, {
name : "checkid",
type : "string"
}, {
name : "checktime",
type : "string"
},{
name : "ROWNUMCNT",
type : "string"
}, {
name : "ROW1",
type : "string"
} ],
listeners : {
scope : this,
beforeload : function(sto, obj) {
sto.baseParams.promopacktype=_promopacktype;
sto.baseParams.promopackid = _promopackid;
sto.baseParams.uerytype = _querytype;//查询日期类型
sto.baseParams.begindate = _begindate;//起始日期
sto.baseParams.enddate= _enddate;//结束日期
sto.baseParams.status= _status;//促销方案状态
sto.baseParams.promopackname = _promopackname;//促销方案名称
sto.baseParams.corpcode = _corpcode;//门店编号
sto.baseParams.corpname = _corpname;//门店名称
sto.baseParams.articlasscode = _articlasscode;//分类编号
sto.baseParams.articlassname = _articlassname;//分类名称
sto.baseParams.brandcode = _brandcode;//品牌编号
sto.baseParams.brandname = _brandname;//品牌名称
sto.baseParams.articode = _articode;//商品编号
sto.baseParams.artiname = _artiname;//商品名称
}
}
});
this.mainRocord=null;
var mainOthgrpcode=null;
//组类型
var _grptypeData=[
['1','购买'],
['2','优惠'],
['3','例外']
];
var _grptypeStore=new Ext.data.SimpleStore({
data:_grptypeData,
fields:['value','text']
});
var _grptypeComboBox=new Ext.form.ComboBox({
store:_grptypeStore,
displayField:'text',
valueField:'value',
mode:'local',
id:this.genId('grptypecombobox'),
name:'grptypecombobox',
triggerAction:'all',
width:120,
allowBlank:false,
editable:false,
emptyText:'请选择...',
listeners:{
change:function(){
}
}
});
//组号
var _corpcodeField=new Ext.form.NumberField({
id:_this.genId('corpcodefield'),
name:'corpcodefield',
enableKeyEvents : true,
listeners : {
keyup: function(src, evt){
var val = src.getValue().toString().replace(/\D/g,'');
src.setValue(val);
}
}
});

//促销方式
var _promotypeData=[
['1','价格'],
['2','折扣']
];
var _promotypeStore=new Ext.data.SimpleStore({
data:_promotypeData,
fields:['value','text']
});
var _promotypeComboBox=new Ext.form.ComboBox({
store:_promotypeStore,
displayField:'text',
valueField:'value',
mode:'local',
id:_this.genId('promotypecombobox'),
name:'promotypecombobox',
triggerAction:'all',
width:120,
allowBlank:false,
editable:false,
emptyText:'请选择...'
});
//数量条件
var _saleqtyField=new Ext.form.NumberField({
id:_this.genId('saleqtyfield'),
name:'saleqtyfield',
enableKeyEvents : true,
listeners : {
keyup: function(src, evt){
var val = src.getValue().toString().replace(/\D/g,'');
src.setValue(val);
}
}
})
//促销值
var _promopriceField=new Ext.form.NumberField({
fieldLabel:'门店编号',
id:_this.genId('promopricefield'),
name:'promopricefield',
enableKeyEvents : true,
listeners : {
keyup: function(obj, evt){
var val = src.getValue().toString().replace(/[^\d\.]/g,'');
src.setValue(val);
}
}
})
//添加商品
_this.fn_addgoods=function(){
alert('goods');
};
//添加分类
_this.fn_addtype=function(){
alert('type');
};
//添加品牌
_this.fn_addbrand=function(){
alert('brand');
}

//添加商品按钮
var _addGoods=new Ext.Button( {
xtype : "button",
text : "添加商品",
id:_this.genId('addGoods'),
icon : "image/chaxun.png",
handler : _this.fn_addgoods
})
//添加分类按钮
var _addType=new Ext.Button({
xtype : "button",
text : "添加分类",
id:_this.genId('addType'),
icon : "image/chaxun.png",
handler : _this.fn_addtype
})
//添加品牌
var _addBrand=new Ext.Button({
xtype : "button",
text : "添加品牌",
id:_this.genId('addBrand'),
icon : "image/chaxun.png",
handler : _this.fn_addbrand
});


var promopackMCheckbox = new Ext.grid.CheckboxSelectionModel({
checkOnly : false,
singleSelect : true,
listeners:{
scope:this,
rowselect:function(opt,rowIndex,record){
_this.mainRocord=promopackMgrid.getSelectionModel().getSelected();
if(record){
_promopackid=record.get('promopackid');
_promopacktype=record.get('promopacktype')
}
promopack2Store.load({
params : {
start : 0,
limit : gLimit
}
});
promopack3Store.load({
params : {
start : 0,
limit : gLimit
}
});
/*
* 第一组:买A送B优惠
*/
if(_promopacktype==_buyNAandMB ){
               }
/*
* 第二组:MA+NB优惠,则"添加分类","添加品牌"按钮无效
*/
if(_promopacktype==_buyNAandMB ){
                   _addType.hide();
                   _addBrand.hide();
               }
/*
* 第三组:第N件优惠,则"添加分类","添加品牌"按钮无效
*/
if(_promopacktype==_numberN){
                   _addType.hide();
                   _addBrand.hide();
               }
/*
* 第四组:限时优惠
*/
if(_promopacktype==_buyNAandMB ){
               }
},
rowdeselect:function(){
mainOthgrpcode=null;
}
}
});
var promopackMCM = new Ext.grid.ColumnModel([ promopackMCheckbox, {
header : "促销类型",
dataIndex : "promopacktype",
width : 70,
hideable : false,
sortable : true,
resizable : true
}, {
header : "促销名称",
dataIndex : "promopackname",
width : 70,
hideable : false,
sortable : true,
resizable : true
}, {
header : "开始日期",
dataIndex : "begindate",
width : 70,
hideable : false,
sortable : true,
resizable : true
}, {
header : "结束日期",
dataIndex : "enddate",
width : 70,
hideable : false,
sortable : true,
resizable : true
}, {
header : "开始时间",
dataIndex : "begintime",
width : 70,
hideable : false,
sortable : true,
resizable : true
},{
header : "结束时间",
dataIndex : "endtime",
width : 70,
hideable : false,
sortable : true,
resizable : true
}, {
header : "限购次数",
dataIndex : "promopackqty",
width : 40,
hideable : false,
sortable : true,
resizable : true
}, {
header : "周一",
dataIndex : "pmon",
width : 40,
hideable : false,
sortable : true,
resizable : true,
editor:new Ext.grid.GridEditor(new Ext.form.Checkbox({
            //allowBlank: false
        })),
        renderer:function(value) {
if(value==1){
return  "<input checked type='checkbox' disabled='disabled'/>";
}
else{
return  "<input type='checkbox' disabled='disabled'/>";
}
       }
}, {
header : "周二",
dataIndex : "ptue",
width : 40,
hideable : false,
sortable : true,
resizable : true,
editor:new Ext.grid.GridEditor(new Ext.form.Checkbox({
            allowBlank: false
        })),
        renderer:function(value) {
if(value==1){
return  "<input checked type='checkbox' disabled='disabled'/>";
}
else{
return  "<input type='checkbox' disabled='disabled'/>";
}
       }
},{
header : "周三",
dataIndex : "pwed",
width : 40,
hideable : false,
sortable : true,
resizable : true,
editor:new Ext.grid.GridEditor(new Ext.form.Checkbox({
            allowBlank: false
        })),
        renderer:function(value) {
           if(value==1){
return  "<input checked type='checkbox' disabled='disabled'/>";
}
else{
return  "<input type='checkbox' disabled='disabled'/>";
}
       }
}, {
header : "周四",
dataIndex : "pthu",
width : 40,
hideable : false,
sortable : true,
resizable : true,
editor:new Ext.grid.GridEditor(new Ext.form.Checkbox({
            allowBlank: false
        })),
        renderer:function(value) {
if(value==1){
return  "<input checked type='checkbox' disabled='disabled'/>";
}
else{
return  "<input type='checkbox' disabled='disabled'/>";
}
       }
}, {
header : "周五",
dataIndex : "pfri",
width : 40,
hideable : false,
sortable : true,
resizable : true,
editor:new Ext.grid.GridEditor(new Ext.form.Checkbox({
            allowBlank: false
        })),
        renderer:function(value) {
if(value==1){
return  "<input checked type='checkbox' disabled='disabled'/>";
}
else{
return  "<input type='checkbox' disabled='disabled'/>";
}
       }
}, {
header : "周六",
dataIndex : "psat",
width : 40,
hideable : false,
sortable : true,
resizable : true,
editor:new Ext.grid.GridEditor(new Ext.form.Checkbox({
            allowBlank: false
        })),
        renderer:function(value) {
if(value==1){
return  "<input checked type='checkbox' disabled='disabled'/>";
}
else{
return  "<input type='checkbox' disabled='disabled'/>";
}
       }
},{
header : "周日",
dataIndex : "psun",
width : 40,
hideable : false,
sortable : true,
resizable : true,
editor:new Ext.grid.GridEditor(new Ext.form.Checkbox({
            allowBlank: false
        })),
        renderer:function(value) {
if(value==1){
return  "<input checked type='checkbox' disabled='disabled'/>";
}
else{
return  "<input type='checkbox' disabled='disabled'/>";
}
       }
}, {
header : "会员",
dataIndex : "pmem",
width : 40,
hideable : false,
sortable : true,
resizable : true,
editor:new Ext.grid.GridEditor(new Ext.form.Checkbox({
            allowBlank: false
        })),
        renderer:function(value) {
           if(value==1){
return  "<input checked type='checkbox' disabled='disabled'/>";
}
else{
return  "<input type='checkbox' disabled='disabled'/>";
}
       }
}, {
header : "状态",
dataIndex : "status",
width : 40,
hideable : false,
sortable : true,
resizable : true
}, {
header : "促销单号",
dataIndex : "promopackid",
width : 70,
hideable : false,
sortable : true,
resizable : true
},{
header : "录入人",
dataIndex : "optrid",
width : 70,
hideable : false,
sortable : true,
resizable : true
}, {
header : "录入时间",
dataIndex : "ortrtime",
width : 70,
hideable : false,
sortable : true,
resizable : true
}, {
header : "审核人",
dataIndex : "checkid",
width : 70,
hideable : false,
sortable : true,
resizable : true
}, {
header : "审核时间",
dataIndex : "checktime",
width : 70,
hideable : false,
sortable : true,
resizable : true
},{
header : "ROWNUMCNT",
dataIndex : "ROWNUMCNT",
width : 100,
hideable : false,
sortable : true,
resizable : true,
hidden:true
},{
header : "ROW1",
dataIndex : "ROW1",
width : 100,
hideable : false,
sortable : true,
resizable : true,
hidden:true
}]);

var _form;
this.setpromopackMWin = function() {
return new Ext.Window({
title : '组合促销方案',
id : _this.genId('winm'),
name : _this.genId('winm'),
width : 700,
height :200,
border : false,
// resizable: true,
layout : 'fit',
modal : true,
closable : true,
// labelAlign: "right",
// buttonAlign: 'center',
resizable : false,
items : [ _form.init() ],
listeners : {
beforeshow : function() {
_wthis = this;
}
},
reload : function() {
promopackMStore.load({
params : {
start : 0,
limit : gLimit
}
});
}
})
}
/***
* 回调函数,用于查询返回查询参数
*/
this.callbackFn=function(_promopacktypeC,_querytypeC,
_begindateC,_enddateC,_statusC,_promopacknameC,
_promopackidC,_corpcodeC,_corpnameC,_articlasscodeC,
_articlassnameC,_brandcodeC,_brandnameC,
_articodeC,_artinameC){
_promopacktype=_promopacktypeC;//促销类型
_querytype=_querytypeC;//查询日期类型
_begindate=_begindateC;//起始日期
_enddate=_enddateC;//结束日期
_status=_statusC;//促销方案状态
_promopackname=_promopacknameC;//促销方案名称
_promopackid=_promopackidC;//促销单号
_corpcode=_corpcodeC;//门店编号
_corpname=_corpnameC;//门店名称
_articlasscode=_articlasscodeC;//分类编号
_articlassname=_articlassnameC;//分类名称
_brandcode=_brandcodeC;//品牌编号
_brandname=_brandnameC;//品牌名称
_articode=_articodeC;//商品编号
_artiname=_artinameC;//商品名称
promopackMStore.load({
params : {
start : 0,
limit : gLimit
}
});
}
/*
* 传递参数到propopackQuery页面
* @param {Object} conf
*/
var _openWin=function(){
_form = new ff.bx.promopackQuery({_callFn:_this.callbackFn,
_promopacktypeC:_promopacktype,
_querytypeC:_querytype,
_begindateC:_begindate,
_enddateC:_enddate,
_statusC:_status,
_promopacknameC:_promopackname,
_promopackidC:_promopackid,
_corpcodeC:_corpcode,
_corpnameC:_corpname,
_articlasscodeC:_articlasscode,
_articlassnameC:_articlassname,
_brandcodeC:_brandcode,
_brandnameC:_brandname,
_articodeC:_articode,
_artinameC:_artiname
});
var _w = new _this.setpromopackMWin('');
_w.show();
_w.setTitle(_w.title + "——[查询条件]");
}

// 组合促销查询事件
this.btn_query = function() {
_openWin();
/*promopackMStore.load({
params : {
start : 0,
limit : gLimit
}
});*/
}
//组合促销添加
this.btn_add=function(){
_form = new ff.bx.promopackAdd();
var _w = new _this.setpromopackMWin();
_w.show();
_w.setTitle(_w.title + "——[新增]");
}
// 删除
this.btn_delete=function(){
var _recordM = promopackMgrid.getSelectionModel().getSelected();
if(_recordM){
var _statusM = _recordM.get('status');
var _promopackidM = _recordM.get('promopackid');
if(_statusM!='1'){
Ext.Msg.alert('提示', '不是申请状态不能删除');
return false;
}
//删除
Ext.Msg.confirm("提示", "是否删除选中的组合促销方案的记录信息?", function(btn){
if(btn == 'yes'){
Ext.Ajax.request({
url : 'promo_delpack.do',
method:'post',
success : function(res, opt) {
var ret = Ext.decode(res.responseText);
if (ret.data[0].status == "0") {
promopackMStore.reload();
Ext.Msg.alert("提示", "您选中的组合促销方案的记录信息已删除成功");
} else {
Ext.Msg.alert("提示",ret.data[0].note);
}
},
failure : function() {
Ext.Msg.alert("提示","连接已断开,请检查您的网络连接是否正常 !");
},
params : {
promopackid:_promopackidM
}
})
}
});
}else{
Ext.Msg.alert('提示', '请选择一条组合促销方案的记录!');
return false;
}
}

//修改
this.btn_update=function(){
var _recordM = promopackMgrid.getSelectionModel().getSelected();
if(_recordM){
var _statusM = _recordM.get('status');
var _promopackidM = _recordM.get('promopackid');
if(_statusM!='1'){
Ext.Msg.alert('提示', '不是申请状态不能修改');
return false;
}
_form = new ff.bx.promopackAdd();
var _w = new _this.setpromopackMWin('add');
_w.show();
_w.setTitle(_w.title + "——[修改]");
_form.setRecord(_recordM);
}else{
Ext.Msg.alert('提示', '请选择一条组合促销方案的记录!');
return false;
}
}

// 审核
this.btnd_check=function(){
var _recordM = promopackMgrid.getSelectionModel().getSelected();
if(_recordM){
var _statusM = _recordM.get('status');
var _promopackidM = _recordM.get('promopackid');
if(_statusM!='1'){
Ext.Msg.alert('提示', '不是申请状态不能进行审核');
return false;
}
Ext.Msg.confirm("提示", "您确认审核选中的组合促销方案的记录信息?", function(btn){
if(btn == 'yes'){
Ext.Ajax.request({
url : 'promo_checkpack.do',
method:'post',
success : function(res, opt) {
var ret = Ext.decode(res.responseText);
if (ret.data[0].status == "0") {
promopackMStore.reload();
Ext.Msg.alert("提示", "您选中的组合促销方案的记录信息已审核成功");
} else {
Ext.Msg.alert("提示",ret.data[0].note);
}
},
failure : function() {
Ext.Msg.alert("提示","连接已断开,请检查您的网络连接是否正常 !");
},
params : {
promopackid:_promopackidM,
status:_statusM
}
})
}
});
}else{
Ext.Msg.alert('提示', '请选择一条组合促销方案的记录!');
return false;
}
}
// 撤销
this.btnd_back=function(){
var _recordM = promopackMgrid.getSelectionModel().getSelected();
if(_recordM){
var _statusM = _recordM.get('status');
var _promopackidM = _recordM.get('promopackid');
if(_statusM!='1'){
Ext.Msg.alert('提示', '不是申请状态不能进行撤销');
return false;
}
Ext.Msg.confirm("提示", "您确认撤销选中的组合促销方案的记录信息?", function(btn){
if(btn == 'yes'){
Ext.Ajax.request({
url : 'promo_undopack.do',
method:'post',
success : function(res, opt) {
var ret = Ext.decode(res.responseText);
if (ret.data[0].status == "0") {
promopackMStore.reload();
Ext.Msg.alert("提示", "您选中的组合促销方案的记录信息已撤销成功");
} else {
Ext.Msg.alert("提示",ret.data[0].note);
}
},
failure : function() {
Ext.Msg.alert("提示","连接已断开,请检查您的网络连接是否正常 !");
},
params : {
promopackid:_promopackidM,
status:_statusM
}
})
}
});
}else{
Ext.Msg.alert('提示', '请选择一条组合促销方案的记录!');
return false;
}
}
// 组合促销主表grid
var promopackMgrid = new Ext.grid.EditorGridPanel({
title : "组合促销方案总表显示区",
id : this.genId("promopackMgrid"),
store : promopackMStore,
cm : promopackMCM,
autoScroll : true,
loadMask : true,
frame : true,
// autoHeight : true,
// autoWidth : true,
sm : promopackMCheckbox,
listeners : {
"beforedestroy" : function(obj) {
obj.getStore().removeAll();
obj = null;
}
},
tbar : [ {
xtype : 'buttongroup',
id:this.genId('sumbutton'),
defaults : {
scale : 'small'
},
layoutConfig : {
columns :20
},
items : [{
xtype:'button',
text:'查询',
icon : "image/chaxun.png",
handler:this.btn_query
},{
xtype:'button',
text:'添加',
icon : "image/change.png",
handler:_this.btn_add
},{
xtype:'button',
text:'删除',
icon : "image/add.png",
handler:this.btn_delete
},{
xtype:'button',
text:'修改',
icon : "image/change.png",
handler:_this.btn_update
},{
xtype:'button',
text:'审核',
icon : "image/change.png",
handler:_this.btn_check
},{
xtype:'button',
text:'撤销',
icon : "image/change.png",
handler:_this.btn_back
}]
}],
bbar : [ {
xtype : "paging",
pageSize : gLimit,
store : promopackMStore,
displayInfo : true,
displayMsg : '数据第 {0}条 - 第{1}条,共 {2}条',
emptyMsg : "没有数据 "
} ]

});
-------------------------------------------------------------------------------------



本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
EXT combobox 分页 其实很简单
ExtJs4.1用store装载本地的数据以及装载服务端的数据
C# 反射 表达式树 模糊搜索
Ext 鼠标悬停grid的一行显示该行信息
ext下拉框
EXT 前台分页,切换Store
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服