Commit cd3b4349 authored by neo's avatar neo

[DEV] add verirfy for import manaul excel

parent c1f7aded
......@@ -17,6 +17,7 @@
$scope.voucherFileName = "";
$scope.voucherFileID = "";
$scope.manualSpread = {};
$scope.file = null;
//Notice: ************************************
//$scope.templateCode, $scope.reportId, $scope.initRow, $scope.initCol等都是外部传递进来的数据。
......@@ -2545,7 +2546,7 @@
$scope.commitApprove = function(){
if(vatSessionService.month)
vatSessionService.project.period=vatSessionService.month;
vatApproveService.approvalStatus(vatSessionService.project.id,vatSessionService.project.period).success(function(result){
vatApproveService.approvalStatus(vatSessionService.project.id,vatSessionService.project.period).success(function(result){
if(result&&result=='committed'){
SweetAlert.error('报表提审中或审核已通过!');
}else{
......@@ -2576,7 +2577,7 @@
$scope.doApprove = function(){
if(vatSessionService.month)
vatSessionService.project.period=vatSessionService.month;
vatSessionService.project.period=vatSessionService.month;
vatApproveService.approvalStatus(vatSessionService.project.id,vatSessionService.project.period).success(function(result){
if(result&&result=='committed'){
$("#ApprovalComment").modal('show')
......@@ -2674,20 +2675,30 @@
};
$scope.upLoadManual = function(){
var text= $(".li").find(".active").text();
$log.debug(text);
if(text == '海关专用缴款书' || text =='代扣代缴税收通用缴款书取数'){
var excelIo = new GC.Spread.Excel.IO();
$("#importExcellFile").modal('show');
}else{
SweetAlert.warning("仅支持海关专用缴款书或代扣代缴税收通用缴款书取数");
}
if(vatSessionService.month)
vatSessionService.project.period=vatSessionService.month;
vatApproveService.approvalStatus(vatSessionService.project.id,vatSessionService.project.period).success(function(result){
if(result&&result=='committed'){
SweetAlert.error('报表提审中或审核已通过!');
}else{
var text= $(".li").find(".active").text();
$log.debug(text);
if(text == '海关专用缴款书' || text =='代扣代缴税收通用缴款书取数'){
var excelIo = new GC.Spread.Excel.IO();
$("#importExcellFile").modal('show');
}else{
SweetAlert.warning("仅支持海关专用缴款书或代扣代缴税收通用缴款书取数");
}
}
});
};
$scope.loadMyExcel = function(){
$scope.manualSpread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"),{sheetCount: 1});
var excelIo = new GC.Spread.Excel.IO();
var excelFile = document.getElementById("fileDemo").files[0];
var excelFile = $scope.file;
excelIo.open(excelFile, function(json) {
var workbookObj = json;
$scope.manualSpread.fromJSON(workbookObj);
......@@ -2772,7 +2783,7 @@
$scope.cleanManual = function(){
$scope.manualSpread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"),{sheetCount: 1});
$('#ss').html('');
document.getElementById("fileDemo").value="";
$scope.file = null;
};
......
......@@ -204,14 +204,30 @@
</div>
<div class="row" style="margin-left:12px; margin-right:12px;">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="inputContainer">
<input type="file" id="fileDemo" class="btn btn-sm" name="选择文件">
<input type="button" id="loadExcel" value="加载文件" class="btn btn-sm" ng-click="loadMyExcel()">
<button class="btn btn-sm" ng-click="multiWrite()">批量录入</button>
<button class="btn btn-sm" ng-click="cleanManual()">清空</button>
<div class="col-sm-4">
<div class="form-control" type="text" name="fileName" readonly placeholder=""
ng-required="isAdd" title="{{file ? file.name : ''}}">
{{file ? file.name : '' | limitString :25}}
</div>
</div>
<div class="col-sm-2">
<button type="button" type="file" ngf-select ng-model="file" accept=".xls,.xlsx"
class="btn browse">选择文件
</button>
</div>
<div class="col-sm-2">
<button type="button" class="btn browse" ng-click="loadMyExcel()">加载文件
</button>
</div>
<div class="col-sm-2">
<button type="button" class="btn browse" ng-click="multiWrite()">批量录入
</button>
</div>
<div class="col-sm-2">
<button type="button" class="btn browse" ng-click="cleanManual()"> 清空
</button>
</div>
</div>
</div>
</div>
......
......@@ -93,7 +93,7 @@ webservices.factory('templateService', ['$log', '$http', '$q', 'apiConfig', 'htt
excelIo.open(blob, function (json) {
deferred.resolve(json);
}, function (e) {
console.error(e.errormessage);
// console.error(e.errorMessage);
//alert(e.errorMessage);
deferred.reject(e.errorMessage);
}, {});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment