You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

337 lines
11 KiB
JavaScript

Ext.namespace('Shipping');
Shipping.JinKouSuYuanIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.JinKouSuYuanIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.JinKouSuYuanIndex, Ext.Panel, {
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
initUIComponents: function () {
this.formname = 'JinKouSuYuanShiBieMaIndex';
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
model: 'OP_GOOD_ID',
pageSize: 1000,
// autoLoad: { start: 0, limit: 30 },
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/JinKouSuYuan_ShiBieMa/GetDataList_Code',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//定义Grid
this.WMSCB = Ext.create('Ext.selection.CheckboxModel', { checkOnly: true });
this.columns = [{
sortable: true,
dataIndex: 'GID',
hidden: true,
header: 'GID',
width: 100
}, {
sortable: true,
dataIndex: 'GOODS_GID',
hidden: true,
header: 'GOODS_GID',
width: 100
}, {
sortable: false,
dataIndex: 'BSNO',
header: 'BSNO',
hidden:true,
width: 200
}, {
sortable: true,
dataIndex: 'GOODS_IDCODE',
header: '识别码',
width: 120
}, {
sortable: true,
dataIndex: 'MBLNO',
header: '主提单号',
width: 120
}, {
sortable: true,
dataIndex: 'CODENAME',
header: '商品代码及名称',
width: 120
}, {
sortable: true,
dataIndex: 'QUERYCOUNT',
header: '使用次数',
width: 120
}, {
sortable: true,
dataIndex: 'CREATETIME',
header: '生成时间',
width: 120
}, {
sortable: true,
dataIndex: 'DelFlag',
header: '是否有效',
width: 120,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
if (value == '1') {
return '否';
} else {
return '是';
}
}
}
];
this.girdcolums = this.columns;
this.girdcolums = DsTruck.GetGridPanel(GID, this.formname, this.girdcolums, 0); //使用者id表名中间column数组跳过一开始的几列
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
selModel: this.WMSCB,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
features: [{
ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性
}],
columns: this.girdcolums,
bbar: [{
xtype: 'pagingtoolbar',
store: this.storeList,
displayInfo: true
}]
});
//#region formSearch
//#region 是否有效
this.storeShiFouYouXiao = Ext.create('Ext.data.Store', {
fields: ['DC', 'NAME']
});
this.storeShiFouYouXiao.add({ "DC": "0", "NAME": "有效" });
this.storeShiFouYouXiao.add({ "DC": "1", "NAME": "无效" });
this.storeShiFouYouXiao.add({ "DC": "2", "NAME": "全部" });
this.comboxShiFouYouXiao = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: "是否有效",
store: this.storeShiFouYouXiao,
valueField: 'DC',
displayField: 'NAME',
flex: 0.6,
forceSelection: true,
name: 'ShiFouYouXiao'
});
//#endregion
//#endregion
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
flex: 1,
defaults: {
anchor: '50%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '识别码',
name: 'KeyWords'
}, {
fieldLabel: '提单号',
name: 'BLNO'
}, this.comboxShiFouYouXiao
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
//#endregion formSearch
//查询工具条
_this = this;
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
text: "作废",
iconCls: "btndelete",
handler: function (button, event) {
this.onDeleteClick(button, event);
},
scope: this
}, '-',
{
text: "恢复",
iconCls: "btnadd",
handler: function (button, event) {
this.onRecoveryClick(button, event);
},
scope: this
},
'-',
{
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick();
},
scope: this
}, '-', {
text: "保存列表样式",
menu: [{ text: "保存",
handler: function (button, event) {
_this.girdcolums = DsTruck.SaveGridPanel(GID, _this.formname, _this.gridList.columns, _this.girdcolums, 0, true); //使用者id表名中间column数组跳过一开始的几列
}
}, { text: "初始化",
handler: function (menu, event) {
_this.formWMSINBody.reconfigure(_this.storeList, _this.columns);
_this.girdcolums = DsTruck.SaveGridPanel(GID, _this.formname, _this.gridList.columns, _this.columns, 0, true); //使用者id表名中间column数组跳过一开始的几列
}
}],
scope: this
}
]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 100,
items: [this.formSearch, this.panelBtn]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList]
});
this.storeList.on('beforeload', function (store) {
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
this.onRefreshClick();
}, //end initUIComponents
onRefreshClick: function () {
var sql = this.getCondition();
this.storeList.load({
params: { start: 0, limit: 1000, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
onDeleteClick: function (button, event) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择数据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var selectedRecords = [];
selectedRecords = this.gridList.selModel.getSelection();
var selectStores = [];
for (var i = 0; i < selectedRecords.length; i++) {
selectStores.push(selectedRecords[i].data);
}
Ext.MessageBox.confirm('提示', '确定作废改识别码吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在操作...');
Ext.Ajax.request({
waitMsg: '正在操作...',
url: '/MvcShipping/JInKouSuYuan_ShiBieMa/Delete',
params: {
data: Ext.JSON.encode(selectStores),
USERID: USERID
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
this.onRefreshClick();
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
}, //onDeleteClick
getCondition: function () {
var form = this.formSearch.getForm();
var sql = '';
var Name = form.findField('KeyWords').getValue();
if (Name!=""&&Name!=null) {
sql = sql + getAndConSql(sql, Name, " t1.GOODS_IDCODE like '%" + Name + "%' ");
}
var BLNO = form.findField('BLNO').getValue();
if (BLNO != "" && BLNO != null) {
sql = sql + getAndConSql(sql, BLNO, " (t2.MBLNO like '%" + BLNO + "%' or t2.HBLNO like '%" + BLNO + "%') ");
}
var YouXiao = form.findField('ShiFouYouXiao').getValue();
if (YouXiao != "2" && YouXiao != null) {
sql = sql + getAndConSql(sql, YouXiao, "t1.DelFlag = " + YouXiao + "");
}
return sql;
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
return ret;
}
});