|  | @@ -3,6 +3,7 @@
 | 
	
		
			
				|  |  |   */
 | 
	
		
			
				|  |  |  var region = '重庆';
 | 
	
		
			
				|  |  |  var feeRateFileID = 5;
 | 
	
		
			
				|  |  | +var datas = [];
 | 
	
		
			
				|  |  |  var spreadView;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  $(document).ready(function () {
 | 
	
	
		
			
				|  | @@ -23,7 +24,8 @@ function loadProjectFeeRates(fileID) {
 | 
	
		
			
				|  |  |          data: {"fileID": fileID},
 | 
	
		
			
				|  |  |          success: function (result) {
 | 
	
		
			
				|  |  |              if (result.data) {
 | 
	
		
			
				|  |  | -                createSpreadView(result.data[0].rates, true);
 | 
	
		
			
				|  |  | +                datas = result.data[0].rates;
 | 
	
		
			
				|  |  | +                createSpreadView(true);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          },
 | 
	
		
			
				|  |  |          error: function (result) {
 | 
	
	
		
			
				|  | @@ -61,7 +63,8 @@ function loadLibFeeRates(libID) {
 | 
	
		
			
				|  |  |          data: {"libID": libID},
 | 
	
		
			
				|  |  |          success: function (result) {
 | 
	
		
			
				|  |  |              if (result.data) {
 | 
	
		
			
				|  |  | -                createSpreadView(result.data[0].rates, false);
 | 
	
		
			
				|  |  | +                datas = result.data[0].rates;
 | 
	
		
			
				|  |  | +                createSpreadView(false);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          },
 | 
	
		
			
				|  |  |          error: function (result) {
 | 
	
	
		
			
				|  | @@ -70,7 +73,7 @@ function loadLibFeeRates(libID) {
 | 
	
		
			
				|  |  |      });
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -function createSpreadView(datas, canEdit) {
 | 
	
		
			
				|  |  | +function createSpreadView(canEdit) {
 | 
	
		
			
				|  |  |      // 创建前先销毁旧树表。
 | 
	
		
			
				|  |  |      //$('#divFee').empty();  // 清空不行,浏览器跟踪显示错误数狂飚:TypeError: G is null
 | 
	
		
			
				|  |  |      //$('#divFee').remove(); // 删除可以,但是太山寨。
 | 
	
	
		
			
				|  | @@ -142,8 +145,36 @@ function createSpreadView(datas, canEdit) {
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      };
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    var dataSource = {
 | 
	
		
			
				|  |  | +        loadRange: function(params) {
 | 
	
		
			
				|  |  | +            params.success(datas);
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        update: function(params) {
 | 
	
		
			
				|  |  | +            $.ajax({
 | 
	
		
			
				|  |  | +                type: 'POST',
 | 
	
		
			
				|  |  | +                url: '/fees/updateProjectFeeRate',
 | 
	
		
			
				|  |  | +                data: {"fileID": feeRateFileID, "rateID": params.dataItem.ID, "rateValue": params.dataItem.rate},
 | 
	
		
			
				|  |  | +                success: function(data) {
 | 
	
		
			
				|  |  | +                    var iCode = data.data;
 | 
	
		
			
				|  |  | +                    if (iCode == 1){
 | 
	
		
			
				|  |  | +                        params.success();
 | 
	
		
			
				|  |  | +                    }else{
 | 
	
		
			
				|  |  | +                        alert('(' + iCode + ') 修改失败!');
 | 
	
		
			
				|  |  | +                        spreadView.cancelEditing();
 | 
	
		
			
				|  |  | +                        params.failed();
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                },
 | 
	
		
			
				|  |  | +                error: function(xhr, status) {
 | 
	
		
			
				|  |  | +                    alert('内部程序错误!');
 | 
	
		
			
				|  |  | +                    params.failed();
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            });
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    };
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      spreadView = new GC.Spread.Views.DataView($('#divFee')[0],
 | 
	
		
			
				|  |  | -        datas, columns, new GC.Spread.Views.Plugins.GridLayout(options));
 | 
	
		
			
				|  |  | +        dataSource, columns, new GC.Spread.Views.Plugins.GridLayout(options));
 | 
	
		
			
				|  |  |      spreadView.invalidate();
 | 
	
		
			
				|  |  |      document.querySelector('#divFee').focus();
 | 
	
		
			
				|  |  |  }
 |