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.

352 lines
10 KiB
JavaScript

11 months ago
Ext.namespace('Shipping');
Shipping.MsSysReportRangeSetIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsSysReportRangeSetIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsSysReportRangeSetIndex, Ext.Panel, {
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
initUIComponents: function () {
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
model: 'MsSysReport',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsSysReportRangeSet/GetUseReportList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefList' }
});
this.storeOpCode.load();
this.gridListUser = new Ext.grid.GridPanel({
store: this.storeOpCode,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selType: 'cellmodel',
columns: [{
sortable: true,
dataIndex: 'GID',
header: 'GID',
hidden: true,
width: 120
}, {
sortable: true,
dataIndex: 'UserName',
header: '用户名',
width: 100
}, {
sortable: true,
dataIndex: 'DEPTNAME',
header: '所属部门',
width: 160
}
]
});
this.gridListUser.getSelectionModel().on('select', function (model, record, index) {
var userid = record.data.GID;
var sql = this.getCondition();
this.storeList.load({ params: { condition: sql, userid: userid} });
// this.onSelectFee(button, event);
}, this);
this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
//定义Grid
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.GridCheckBoxModel,
selType: 'cellmodel',
columns: [{
sortable: true,
dataIndex: 'GID',
header: 'GID',
hidden: true,
width: 120
}, {
sortable: true,
dataIndex: 'RPTNAME',
header: '报表名称',
width: 100
}, {
sortable: true,
dataIndex: 'ISUSE',
header: '是否可用',
width: 160
}
]
});
//#region formSearch
//#region formSearch枚举参照相关
//#endregion
this.storeRptType = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeRptType.load({ params: { enumTypeId: 97040} });
this.comboxRptType = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '报表类别',
name: 'RPTPROP',
store: this.storeRptType,
valueField: 'EnumValueId',
displayField: 'EnumValueName',
value: 'MSOPSEAE',
forceSelection: true
});
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',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxRptType
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
//#endregion formSearch
//查询工具条
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
text: "设为可用",
iconCls: "btnsave",
handler: function (button, event) {
this.onSetRptUseClick(2);
},
scope: this
},
'-', {
text: "设为不可用",
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onSetRptUseClick(1);
},
scope: this
}, '-',
{
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
},
{
text: "重置条件",
iconCls: "btnreset",
handler: function (button, event) {
},
scope: this
}
]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 80,
items: [this.formSearch, this.panelBtn]
});
this.panelUser = new Ext.Panel({
layout: "border",
title: '用户列表',
region: "west",
width: 300,
items: [this.gridListUser]
});
this.panelList = new Ext.Panel({
layout: "border",
title: '报表信息',
region: "center",
items: [this.gridList]
});
this.panelDetail = new Ext.Panel({
layout: "border",
region: "center",
items: [this.panelUser, this.panelList]
});
Ext.apply(this, {
items: [this.panelTop, this.panelDetail]
});
this.storeList.on('beforeload', function (store) {
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
}, //end initUIComponents
onRefreshClick: function (button, event) {
var userelections = this.gridListUser.getSelectionModel().getSelection();
if (userelections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择用户!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var userid = userelections[0].data.GID;
var sql = this.getCondition();
this.storeList.load({
params: { start: 0, limit: 500, sort: '', condition: sql,userid:userid },
waitMsg: "正在查询数据...",
scope: this
});
},
onSetRptUseClick: function (type) {
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 userelections = this.gridListUser.getSelectionModel().getSelection();
if (userelections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择用户!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var userid = userelections[0].data.GID;
var bodyDrChFeeDatas = [];
var i;
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
bodyDrChFeeDatas.push(rec);
}
var jsonChFeeBody = ConvertRecordsToJsonAll(bodyDrChFeeDatas);
_thisfee = this;
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsSysReportRangeSet/SetRptUseClick',
scope: this,
params: {
body: jsonChFeeBody,
type: type,
userid: userid
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.onRefreshClick();
} else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
}, //end save
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = '';
var RPTPROP = form.findField('RPTPROP').getValue();
sql = sql + getAndConSql(sql, RPTPROP, "RPTPROP='" + RPTPROP + "'");
return sql;
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
return ret;
}
});