今天遇到的一个问题
功能描述:导入订单,上传文件,先校验系文件中要导入的订单系统中是否已经存在,如果有,就弹框提示,要不要导入,确定就继续导入,取消用户就重新修改上传。
问题描述:点击取消之后,上传附件的控件无法再次点击
HTML代码如下:
<div id="divMain" style="70%"> <div class="form-horizontal"> <table class="table table-bordered table-striped" style="100%"> <tbody> <tr> <td style="100px"> @Html.Factory().DropDownList().Enum("AgreementTypeEnum").NgModel("c.vm.IsAgreement") </td> <td> <e2-file-uploader ng-model="c.vm.files" type=".xls,.xlsx,XLS,.XLSX" multiple="false" show-badge="false" upload-finished="c.Event.FileUploaded(file, response, status)"> <i class="fa fa-upload"></i> <font translate="Attachment"></font> </e2-file-uploader> </td> </tr> </tbody> </table> </div> <div class="clearfix"></div> <div ng-if="(c.vm.SucceedCount>0 ||c.vm.FailedCount>0) && !c.vm.ErrorMessage"> 成功导入{{c.vm.SucceedCount}}条数据,失败{{c.vm.FailedCount}}条,<a href="{{ c.vm.FailedExcel}}" target="_parent">失败下载</a> </div> <div ng-if="(c.vm.SucceedCount ==0 && c.vm.FailedCount==0) && c.vm.ErrorMessage==undefined"> 没有可导入数据 </div> <div>{{c.vm.ErrorMessage}}</div> </div>
js代码如下:
def.ContentState('Import', "id").Controller(['pb', 'pbui', 'serverVm', '$scope', '$timeout', '$stateParams', function (pb, pbui, serverVm, $scope, $timeout, $stateParams) { var c = pb.Super(this, serverVm, $scope, false); c.vm = { files: [], template: '../Template/ImportFormat/MyPo.xlsx', IsAgreement:"协议" }; c.Event = { FileUploaded: function (file, response, status) { pbui.PutProcessing("divMain"); c.vm.Items = []; var flag = false; if (c.vm.IsAgreement == "协议") { flag = true; } pb.CallAction('/PO/MyPO/IsExistPONo', 'fileName=' + response.SavedFileName + "&IsAgreementOrder=" + flag, function (result) { if (result.data != "") { pbui.Confirm('ConfirmImportExistSamePONo', result.data).then(function () { c.Event.Import(response, flag); }, function () { c.vm.files.splice(0, c.vm.files.length); pbui.PutProcessing(""); }) } else { c.Event.Import(response, flag); } }); }, Import: function ( response, flag) { pb.CallAction('/PO/MyPO/Import', 'fileName=' + response.SavedFileName + "&IsAgreementOrder=" + flag, function (result) { c.vm.files.splice(0, c.vm.files.length); result.data = JSON.parse(result.data); if (result.isRcResult) { c.vm.FailedCount = result.data.FailedCount; c.vm.SucceedCount = result.data.SucceedCount; c.vm.FailedExcel = "../Download/DownloadAttachment?psSaveTo=&psOriginalFileName=POItem.xlsx&psSavedFileName=" + result.data.FailedExcel; c.vm.ErrorMessage = result.data.ErrorMessage; } pbui.PutProcessing(""); }); } } }]);
因为选择文件上传后会有一个正在加载对的遮罩层,点击取消后还一直在转圈
pbui.PutProcessing("divMain");
先是加了这个取消遮罩
pbui.PutProcessing("");