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.
400 lines
18 KiB
Plaintext
400 lines
18 KiB
Plaintext
<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/Import/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" ValidateRequest="false" %>
|
|
|
|
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
|
|
<script type="text/javascript">
|
|
Ext.define('FinanceRmModel',
|
|
{
|
|
extend: 'Ext.data.Model',
|
|
idProperty: 'GId',
|
|
fields: [
|
|
{ name: 'GId', type: 'string' },
|
|
{ name: 'Customer', type: 'string' },
|
|
{ name: 'Rate', type: 'number' },
|
|
{ name: 'ExtendedDays', type: 'number'},
|
|
{ name: 'ExpiredDate', type: 'date',convert:function (v, record){
|
|
return Ext.Date.format(typeof(v) === "string" ? new Date(parseInt(v.replace("/Date(", "").replace(")/", ""), 10)):v,'Y-m-d');
|
|
} }
|
|
]
|
|
});
|
|
|
|
Ext.define('Tradermb', {
|
|
extend: 'Ext.data.Model',
|
|
idProperty: 'gid',
|
|
fields: [
|
|
{ name: 'gid', type: 'string' },
|
|
{ name: 'name', type: 'string' },
|
|
{ name: 'codename', type: 'string' },
|
|
{ name: 'description', type: 'string' }
|
|
]
|
|
});
|
|
Ext.namespace('DsImport');
|
|
DsImport.FinanceIndex = function (config) {
|
|
Ext.applyIf(this, config);
|
|
this.initUIComponents();
|
|
window.DsImport.FinanceIndex.superclass.constructor.call(this);
|
|
};
|
|
var _this = null;
|
|
Ext.extend(DsImport.FinanceIndex,
|
|
Ext.Panel,
|
|
{
|
|
PageSize: 50,
|
|
initUIComponents: function () {
|
|
this.panelBtn = new Ext.Panel({
|
|
region: "north",
|
|
tbar: [
|
|
{
|
|
text: "刷新",
|
|
iconCls: "btnrefresh",
|
|
handler: function(button, event) {
|
|
this.onRefreshClick(button, event);
|
|
},
|
|
scope: this
|
|
},
|
|
{
|
|
text: "重置",
|
|
iconCls: "btnreset",
|
|
handler: function(button, event) {
|
|
this.onResetClick(button, event);
|
|
},
|
|
scope: this
|
|
},
|
|
{
|
|
text: "保存",
|
|
iconCls: "btnsave",
|
|
handler: function(button, event) {
|
|
this.onSaveClick(button, event);
|
|
},
|
|
scope: this
|
|
},
|
|
{
|
|
text: "新增",
|
|
iconCls: "btnadddetail",
|
|
handler: function(button, event) {
|
|
this.onAddDetailClick(button, event);
|
|
},
|
|
scope: this
|
|
}, {
|
|
text: "删除",
|
|
iconCls: "btndelete",
|
|
handler: function(button, event) {
|
|
this.onDeleteClick(button, event);
|
|
},
|
|
scope: this
|
|
}
|
|
]
|
|
});
|
|
this.formSearch = Ext.widget('form',
|
|
{
|
|
frame: true,
|
|
region: 'center',
|
|
bodyPadding: 5,
|
|
fieldDefaults: {
|
|
margins: '2 2 2 2',
|
|
labelAlign: 'right',
|
|
flex: 1,
|
|
labelWidth: 96,
|
|
msgTarget: 'qtip'
|
|
},
|
|
items: [
|
|
{
|
|
xtype: 'container',
|
|
defaultType: 'textfield',
|
|
layout: 'anchor',
|
|
defaults: {
|
|
anchor: '50%'
|
|
},
|
|
items: [
|
|
{
|
|
xtype: 'container',
|
|
layout: 'hbox',
|
|
defaultType: 'textfield',
|
|
items: [
|
|
{
|
|
fieldLabel: '客户',
|
|
name: 'Customer',
|
|
listeners: {
|
|
specialkey: function(field, e) {
|
|
if (e.getKey() === e.ENTER) {
|
|
_this.onRefreshClick();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
});
|
|
this.storeBuyer = Ext.create('DsExt.ux.RefTableStore', {
|
|
model: 'Tradermb',
|
|
proxy: { url: '/CommMng/BasicDataRef/GetTrader' }
|
|
});
|
|
this.storeBuyer.load({ params: { condition: " isagentcn=1"} });
|
|
this.comboxBuyer = Ext.create('DsExt.ux.RefTableCombox', {
|
|
forceSelection: true,
|
|
store: this.storeBuyer,
|
|
name: 'CUSTOMER',
|
|
valueField: 'name',
|
|
displayField: 'codename'
|
|
});
|
|
this.storeList = Ext.create('Ext.data.Store',
|
|
{
|
|
model: 'FinanceRmModel',
|
|
remoteSort: false,
|
|
pageSize: this.PageSize,
|
|
proxy: {
|
|
type: 'ajax',
|
|
url: '/Import/Finance/GetRmList',
|
|
reader: {
|
|
idProperty: 'GId',
|
|
root: 'data',
|
|
totalProperty: 'totalCount'
|
|
}
|
|
}
|
|
|
|
});
|
|
this.Pagenum = Ext.create('Ext.form.field.Number',
|
|
{
|
|
name: 'bottles',
|
|
fieldLabel: '每页记录数',
|
|
labelAlign: 'right',
|
|
value: this.PageSize,
|
|
maxValue: 100000,
|
|
width: 180,
|
|
minValue: 0,
|
|
listeners: {
|
|
specialkey: function(field, e) {
|
|
if (e.getKey() == e.ENTER) {
|
|
_this.onRefreshClick();
|
|
}
|
|
}
|
|
}
|
|
});
|
|
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
|
|
this.cellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
|
|
clicksToEdit: 1
|
|
});
|
|
this.gridList = new Ext.grid.GridPanel({
|
|
id: 'gridList',
|
|
store: this.storeList,
|
|
enableHdMenu: false,
|
|
region: 'center',
|
|
loadMask: {
|
|
msg: "数据加载中,请稍等..."
|
|
},
|
|
trackMouseOver: true,
|
|
disableSelection: false,
|
|
plugins: [this.cellEditing],
|
|
selModel: this.GridCheckBoxModel,
|
|
stripeRows: true,
|
|
viewConfig: {
|
|
autoFill: true,
|
|
enableTextSelection: true
|
|
},
|
|
selType: 'cellmodel',
|
|
columns: [
|
|
{
|
|
dataIndex: 'GId',
|
|
hidden:true
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'Customer',
|
|
header: '客户',
|
|
width: 120,
|
|
editor: this.comboxBuyer
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'Rate',
|
|
header: '利率',
|
|
width: 120,
|
|
editor: {
|
|
xtype: 'numberfield',
|
|
selectOnFocus: true,
|
|
allowDecimals: true,
|
|
decimalPrecision: 3
|
|
}
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'ExtendedDays',
|
|
header: '超期天数',
|
|
width: 120,
|
|
editor: {
|
|
xtype: 'numberfield',
|
|
selectOnFocus: true,
|
|
allowDecimals: true,
|
|
decimalPrecision: 0
|
|
}
|
|
}, {
|
|
sortable: true,
|
|
hidden:true,
|
|
dataIndex: 'ExpiredDate',
|
|
header: '过期时间',
|
|
width: 120,
|
|
editor: {
|
|
xtype: 'datefield',
|
|
selectOnFocus: true
|
|
}
|
|
}
|
|
],
|
|
bbar: [
|
|
Ext.create('Ext.PagingToolbar',
|
|
{
|
|
store: this.storeList,
|
|
pageSize: this.PageSize,
|
|
displayInfo: true,
|
|
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
|
|
emptyMsg: "没有数据"
|
|
}), this.Pagenum
|
|
]
|
|
});
|
|
|
|
this.panelContract = new Ext.Panel({
|
|
layout: "border",
|
|
region: "center",
|
|
title: "客户利率维护",
|
|
items: [this.gridList]
|
|
});
|
|
this.panelTop = new Ext.Panel({
|
|
layout: "border",
|
|
region: "north",
|
|
height: 80,
|
|
items: [this.formSearch, this.panelBtn]
|
|
});
|
|
this.MainTab = new Ext.tab.Panel({
|
|
layout: "border",
|
|
region: "center",
|
|
items: [this.panelContract]
|
|
});
|
|
Ext.apply(this, {
|
|
items: [this.panelTop,this.MainTab]
|
|
});
|
|
this.onRefreshClick();
|
|
_this = this;
|
|
},
|
|
//刷新
|
|
onRefreshClick: function(button, event) {
|
|
this.PageSize = this.Pagenum.getValue();
|
|
this.storeList.pageSize = this.PageSize;
|
|
var form = this.formSearch.getForm();
|
|
var custoMer = form.findField('Customer').getValue();
|
|
this.storeList.load({
|
|
params: { start: 0, limit: this.PageSize, sort: 'Customer', customer: custoMer},
|
|
waitMsg: "正在查询数据...",
|
|
scope: this
|
|
});
|
|
|
|
},
|
|
//保存
|
|
onSaveClick: function(button, event) {
|
|
var data = [];
|
|
for (var i = 0; i < this.storeList.getCount(); i++) {
|
|
var memberyf = this.storeList.getAt(i);
|
|
if (memberyf.phantom || memberyf.dirty) data.push(memberyf.data);
|
|
};
|
|
if (data.length > 0) {
|
|
var waitMsg = Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
Ext.Ajax.request({
|
|
waitMsg: '正在保存数据...',
|
|
url: '/Import/Finance/AddRmModelList',
|
|
scope: this,
|
|
params: {
|
|
data: JSON.stringify(data)
|
|
},
|
|
callback: function (options, success, response) {
|
|
waitMsg.close();
|
|
if (success)
|
|
_this.onRefreshClick(button, event);
|
|
else
|
|
Ext.Msg.show({ title: '错误', msg: '保存失败', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
},
|
|
failure: function (response, options) {
|
|
waitMsg.close();
|
|
Ext.Msg.show({ title: '警告', msg: '网络异常或登陆过期', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
}
|
|
});
|
|
} else {
|
|
Ext.Msg.show({ title: '提示', msg: '没有需要保存的数据', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
}
|
|
},
|
|
//重置
|
|
onResetClick: function(button, event) {
|
|
var form = this.formSearch.getForm();
|
|
form.findField('Customer').setValue("");
|
|
form.findField('sExpiredDate').setValue("");
|
|
form.findField('eExpiredDate').setValue("");
|
|
},
|
|
//新增
|
|
onAddDetailClick: function(button, event) {
|
|
var record = Ext.create('FinanceRmModel', {
|
|
'GId': '',
|
|
'Customer': '',
|
|
'Rate': '0',
|
|
'ExtendedDays': '0',
|
|
'ExpiredDate': new Date()
|
|
});
|
|
this.storeList.add(record);
|
|
var n = this.storeList.getCount();
|
|
this.cellEditing.startEditByPosition({ row: n - 1, column: 2 });
|
|
},
|
|
//删除
|
|
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 record = [];
|
|
for (var item in selections) if (selections.hasOwnProperty(item)) record.push("'"+selections[item].data.GId+"'");
|
|
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
|
|
if (btn === 'yes') {
|
|
Ext.Ajax.request({
|
|
waitMsg: '正在删除数据...',
|
|
url: '/Import/Finance/DelRmModelList',
|
|
params: {
|
|
data: record.join()
|
|
},
|
|
callback: function (options, success, response) {
|
|
if (success)
|
|
_this.onRefreshClick(button, event);
|
|
else
|
|
Ext.Msg.show({ title: '提示', msg: '删除失败', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
},
|
|
failure: function (response, options) {
|
|
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
},
|
|
scope: this
|
|
});
|
|
}
|
|
}, this);
|
|
}
|
|
});
|
|
|
|
var panelIndex = null;
|
|
Ext.onReady(function () {
|
|
Ext.QuickTips.init();
|
|
Ext.form.Field.prototype.msgTarget = 'side';
|
|
panelIndex = new window.DsImport.FinanceIndex({
|
|
layout: 'border'
|
|
});
|
|
var view = new Ext.Viewport({
|
|
layout: 'border',
|
|
renderTo: 'viewport',
|
|
border: false,
|
|
items: [{
|
|
region: 'center',
|
|
layout: 'fit',
|
|
items: [panelIndex]
|
|
}]
|
|
});
|
|
});
|
|
function OprationSwap() {
|
|
return panelIndex.OprationSwap();
|
|
}
|
|
|
|
</script>
|
|
</asp:Content>
|
|
<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server">
|
|
<div id="viewport"></div>
|
|
</asp:Content>
|