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.
DS7/DSWeb/Areas/MvcShipping/Viewsjs/MsCwDesignStartusingUser/MsCwDesignStartusingUserInd...

167 lines
5.7 KiB
JavaScript

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

Ext.namespace('Shipping');
String.prototype.trim = function () { return this.replace(/(^\s*)|(\s*$)/g, ""); }
Shipping.MsCwDesignStartusingUserIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsCwDesignStartusingUserIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsCwDesignStartusingUserIndex, Ext.Panel, {
initUIComponents: function () {
this.formname = "formMsCwDesignStartusingUserIndex"; //总账账套启用页面
//#region 定义数据集
this.storeList = Ext.create('Ext.data.Store', {
model: 'MsCwDesignStartusingUserModel',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsCwDesignStartusing/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#endregion
//#region 列定义
this.girdcolums = [{
sortable: false,
dataIndex: 'GID',
text: '唯一编码',
hidden: true,
width: 0
}, {
sortable: false,
dataIndex: 'ISLOGIN',
header: '是否登录',
align: 'center',
width: 60
}, {
sortable: false,
dataIndex: 'ISENABLE',
header: '是否启用',
xtype: "booleancolumn",
align: 'center',
width: 60,
trueText: "是",
falseText: " "
}, {
sortable: false,
dataIndex: 'STARTNAME',
header: '账套名称',
width: 200
}, {
sortable: false,
id: 'STARTMONTH',
dataIndex: 'STARTMONTH',
format: 'Y-m',
header: '启用年月',
renderer: Ext.util.Format.dateRenderer('Y-m'),
width: 80
}, {
sortable: false,
id: 'MODIFIEDUSERNAME',
dataIndex: 'MODIFIEDUSERNAME',
format: 'Y-m',
header: '最后更改人',
width: 80
}];
//#endregion
//#region gridList列表显示信息
this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1 //1单击2双击
});
this.gridList = new Ext.grid.GridPanel({
region: 'center',
store: this.storeList,
enableHdMenu: false, //是否显示表格列的菜单
hideHeaders: false, //是否隐藏表头
rowLines: true,
columnLines: true,
loadMask: { msg: "数据加载中,请稍等..." },
plugins: [this.gridListCellEditing],
selType: 'cellmodel',
columns: this.girdcolums
});
this.storeList.on('beforeload', function (store) { Ext.apply(store.proxy.extraParams, { condition: "" }); }, this);
//#endregion
//#region 按钮工具条/页面布局
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
text: '登录',
tooltip: '登录',
id: "btnISLOGIN",
handler: function (button, event) {
this.onISLOGIN(button, event);
},
scope: this
}, '-', {
text: "刷新",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick();
},
scope: this
}]
}); //end 按钮Toolbar
Ext.apply(this, {
items: [this.panelBtn, this.gridList]
});
//#endregion
this.onRefreshClick();
}, //end initUIComponents
//#region 刷新
onRefreshClick: function () {
this.storeList.load({ params: { condition: "" }, waitMsg: "正在查询数据...", scope: this });
},
//#endregion
//#region 登录
onISLOGIN: function () {
var selectedRecords = this.gridList.selModel.getSelection();
var rec = selectedRecords[0];
Ext.MessageBox.confirm('提示', '确定登录此账期吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在操作数据...');
Ext.Ajax.request({
waitMsg: '正在操作数据...',
url: '/MvcShipping/MsCwDesignStartusing/onISLOGIN',
params: {
data: Ext.JSON.encode(rec.data)
},
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 });
Ext.Msg.hide();
}
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 });
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
}
//#endregion
});