"use strict"; angular.module('app.storage') .controller("qualitycheckCtrl", function($scope,$state,$rootScope,$uibModal, $http,$filter,StorehouseService,warehouseService, $stateParams,qualitycheckService, archiveService) { $scope.dicDataList = $rootScope.dicDataList; // 获取列表数据 $scope.pageInfo = {pageNum : 1, pageSize : 10}; $scope.search = {storehouseId:"", warehouseId:"",checkResult:null}; if($stateParams.checkResult != null){ $scope.search.checkResult = $stateParams.checkResult; } $scope.isArchive = false; $scope.isArchiveHouse = 0; // 仓房列表 $scope.loadStore = function() { StorehouseService.getStorehouseList($rootScope.orgInfo.orgId).then(function(data){ $scope.storelist = data.houseList; },function(data){ console.log(data); }); } $scope.loadData = function() { //归档用 if($stateParams.dataState == "archive"){ $scope.isArchive = true; //查询归档仓房下拉 archiveService.getArchiveDataList().then(function (data) { if($scope.isArchiveHouse == 0){ $scope.store_tank_list = data; } $scope.isArchiveHouse++; //如果不是下拉的则可能是点查看则按照这种方式跳转 if($scope.search.storehouseId == undefined || $scope.search.storehouseId == ""){ $scope.search.storehouseId = $rootScope.archiveState.storehouseId; $scope.search.createTime = $rootScope.archiveState.createTime; $scope.loadWare(); }else{ $scope.search.createTime = $scope.store_tank_list[$scope.search.storehouseId].createTime; } if($scope.search.createTime == "" || $scope.search.createTime == undefined){ $scope.pageInfo.pageNum = 0; $scope.pageInfo.pageSize = 0; $scope.search.storehouseId = '000'; } $scope.search.createTime = $filter('date')($scope.search.createTime, "yyyy-MM-dd HH:mm:ss"); //原来代码 qualitycheckService.getPageInfo($scope.pageInfo.pageNum, $scope.pageInfo.pageSize, $stateParams.type, $scope.search.checkResult, $scope.search.storehouseId, $scope.search.warehouseId, $stateParams.depotType,$scope.search.createTime).then(function (data) { $scope.pageInfo = data; }, function (data) { console.log(data); }); }, function (data) { console.log(data); }); }else{ qualitycheckService.getPageInfo($scope.pageInfo.pageNum, $scope.pageInfo.pageSize, $stateParams.type, $scope.search.checkResult, $scope.search.storehouseId, $scope.search.warehouseId, $stateParams.depotType).then(function (data) { $scope.pageInfo = data; }, function (data) { console.log(data); }); $scope.loadStore(); } } $scope.loadData(); // 货位列表 $scope.loadWare = function() { warehouseService.getStorehouse($rootScope.orgInfo.orgId, $scope.search.storehouseId).then(function(data){ $scope.warelist = data.wareList; },function(data){ console.log(data); }); } $scope.loadWare(); // 翻页 $scope.goPage = function (pageNum) { if ($scope.pageInfo.pageNum != pageNum && pageNum > 0) { $scope.pageInfo.pageNum = pageNum; $scope.loadData(); } }; // 接收广播,切换仓房 $scope.$on("storeChangeed", function(event, storehouseId) { $scope.search.storehouseId = storehouseId; $scope.loadData(); $scope.loadWare(); }) //------------------粮食初检信息开始--------------------// // 显示增加页面,checkType:0代表初检 $scope.showAddFck = function () { if($stateParams.depotType == '1'){ $state.go('app.business.agent.qualitycheck.fckadd', {id:0,checkType:0,isNotEdit:false}); }else{ $state.go('app.storage.qualitycheck.fckadd', {id:0,checkType:0,isNotEdit:false}); } } //修改编辑页面 $scope.showEditFck = function (id) { if($stateParams.depotType == '1'){ $state.go('app.business.agent.qualitycheck.fckedit',{id:id,isNotEdit:false}); }else{ $state.go('app.storage.qualitycheck.fckedit',{id:id,isNotEdit:false}); } } // 查看页面 $scope.showViewFck = function(id) { if($stateParams.depotType == '1'){ $state.go('app.business.agent.qualitycheck.fckedit',{id:id,isNotEdit:true}); }else{ $state.go('app.storage.qualitycheck.fckedit',{id:id,isNotEdit:true}); } } //------------------粮食初检信息结束--------------------// //------------------粮食验收信息开始--------------------// // 显示增加页面 $scope.showAddAck = function (id,houseId,warehouseId) { if($stateParams.depotType == '1'){ $state.go('app.business.agent.qualitycheck.ackadd', {id:0,houseId:houseId,warehouseId:warehouseId,isNotEdit:false}); }else{ $state.go('app.storage.qualitycheck.ackadd', {id:0,houseId:houseId,warehouseId:warehouseId,isNotEdit:false}); } } //修改编辑页面 $scope.showEditAck = function (id) { if($stateParams.depotType == '1'){ $state.go('app.business.agent.qualitycheck.ackedit',{id:id,isNotEdit:false}); }else{ $state.go('app.storage.qualitycheck.ackedit',{id:id,isNotEdit:false}); } } // 查看页面 $scope.showViewAck = function(id) { if($stateParams.depotType == '1'){ $state.go('app.business.agent.qualitycheck.ackedit',{id:id,isNotEdit:true}); }else{ $state.go('app.storage.qualitycheck.ackedit',{id:id,isNotEdit:true}); } } //从验收页面点击新增按钮弹出初检的列表 让选择验收那条记录 $scope.showFirstCheckPage = function () { /* var isActFlag = false; $state.go('app.storage.qualitycheck.fck.fcklist',{type:0,isActFlag:false});*/ var params = []; params.type = 0;//查询初检的列表 var uibModalInstance = $uibModal.open({ size:'lg', templateUrl: 'app/storage/views/qualitycheck/accept-first-list.html', controller: 'actSprModalCtrl', resolve: { // items是一个回调函数 items: function () { // 这个值会被模态框的控制器获取到 return params; } } }); uibModalInstance.result.then(function (result) { if (result != null) { // $scope.loadData_check(foodbasicinfoId);//用于刷新列表页面 } // 关闭模态框时刷新页面数据 }, function (reason) { console.log(reason); }); } //------------------粮食验收信息结束--------------------// //------------------春秋普查信息开始--------------------// //修改编辑页面 $scope.showEditSpr = function (id) { if($stateParams.depotType == '1'){ $state.go('app.business.agent.qualitycheck.spredit',{id:id,isNotEdit:false}); }else{ $state.go('app.storage.qualitycheck.spredit',{id:id,isNotEdit:false}); } } // 查看页面 $scope.showViewSpr = function(id) { if($stateParams.depotType == '1'){ $state.go('app.business.agent.qualitycheck.spredit',{id:id,isNotEdit:true}); }else{ $state.go('app.storage.qualitycheck.spredit',{id:id,isNotEdit:true}); } } $scope.showAcctCheckPage = function () { if($stateParams.depotType == '1'){ $state.go('app.business.agent.qualitycheck.spradd', {id:0,isNotEdit:false}); }else{ $state.go('app.storage.qualitycheck.spradd', {id:0,isNotEdit:false}); } } //------------------春秋普查信息结束--------------------// //------------------第三方检查开始--------------------// $scope.showAddTrk = function () { if($stateParams.depotType == '1'){ $state.go('app.business.agent.qualitycheck.trkadd', {id:0,isNotEdit:false}); }else{ $state.go('app.storage.qualitycheck.trkadd', {id:0,isNotEdit:false}); } } //修改编辑页面 $scope.showEditTrk = function (id) { if($stateParams.depotType == '1'){ $state.go('app.business.agent.qualitycheck.trkedit',{id:id,isNotEdit:false}); }else{ $state.go('app.storage.qualitycheck.trkedit',{id:id,isNotEdit:false}); } } // 查看页面 $scope.showViewTrk = function(id) { if($stateParams.depotType == '1'){ $state.go('app.business.agent.qualitycheck.trkedit',{id:id,isNotEdit:true}); }else{ $state.go('app.storage.qualitycheck.trkedit',{id:id,isNotEdit:true}); } } //------------------第三方检查结束--------------------// //------------------粮食出库信息开始--------------------// $scope.showAddOut = function () { if($stateParams.depotType == '1'){ $state.go('app.business.agent.qualitycheck.outadd', {id:0,checkType:3,isNotEdit:false}); }else{ $state.go('app.storage.qualitycheck.outadd', {id:0,checkType:3,isNotEdit:false}); } } //修改编辑页面 $scope.showEditOut = function (id) { if($stateParams.depotType == '1'){ $state.go('app.business.agent.qualitycheck.outedit',{id:id,isNotEdit:false}); }else{ $state.go('app.storage.qualitycheck.outedit',{id:id,isNotEdit:false}); } } // 查看页面 $scope.showViewOut = function(id) { if($stateParams.depotType == '1'){ $state.go('app.business.agent.qualitycheck.outedit',{id:id,isNotEdit:true}); }else{ $state.go('app.storage.qualitycheck.outedit',{id:id,isNotEdit:true}); } } //------------------粮食出库信息结束--------------------// // 根据id删除信息 $scope.remove = function(id) { qualitycheckService.removeById(id).then(function (data) { if(data.msg == "success"){ alert("删除成功"); $scope.loadData(); }else{ alert("删除失败"); } }); } }) .controller("qualitycheckSaveCtrl", function($scope,$state, $http, $stateParams, FileUploader, StorehouseService, warehouseService, keeperService, businessFileService, agentStorehouseService, $rootScope, $filter, enumService, qualitycheckService,keepAccountService, kcswService , productService,APP_CONFIG,agentDepotService) { $scope.isShow = true; $scope.isDepotShow = false; $scope.loadDataById = function(id) { qualitycheckService.loadDataById(id).then(function(data){ if(data.qualitycheckInspection!=null) { $scope.qualitycheckInspection = data.qualitycheckInspection; } $scope.qualitycheck = data.qualitycheck; $scope.qualitycheck.houseId = data.qualitycheck.houseId.toString(); $scope.qualitycheck.wareHouseName = data.wareHouseName;//用于验收,春秋的回显 $scope.qualitycheck.inspectionStandardBasis = parseInt($scope.qualitycheck.inspectionStandardBasis); $scope.qualitycheck.inputTime = $scope.qualitycheck.inputTime.substr(0,10); $scope.qualitycheck.zhycsj = $scope.qualitycheck.zhycsj.substr(0,10); $scope.qualitycheck.chooseTime = $filter('date')($scope.qualitycheck.chooseTime, "yyyy-MM-dd HH:mm:ss"); $scope.qualitycheck.checkTime = $filter('date')($scope.qualitycheck.checkTime, "yyyy-MM-dd HH:mm:ss"); $scope.qualitycheck.applyCheckTime = $filter('date')($scope.qualitycheck.applyCheckTime, "yyyy-MM-dd"); $scope.qualitycheck.keeperAdvicesTime = $filter('date')($scope.qualitycheck.keeperAdvicesTime, "yyyy-MM-dd"); $scope.qualitycheck.chiefAdvicesTime = $filter('date')($scope.qualitycheck.chiefAdvicesTime, "yyyy-MM-dd"); $scope.qualitycheck.viceManagerAdvicesTime = $filter('date')($scope.qualitycheck.viceManagerAdvicesTime, "yyyy-MM-dd"); $scope.qualitycheck.managerAdvicesTime = $filter('date')($scope.qualitycheck.managerAdvicesTime, "yyyy-MM-dd"); $scope.qualitycheck.improveTime = $filter('date')($scope.qualitycheck.improveTime, "yyyy-MM-dd"); $scope.qualitycheck.checkResultTime = $filter('date')($scope.qualitycheck.checkResultTime, "yyyy-MM-dd HH:mm:ss"); $scope.qualitycheck.qfrq = $filter('date')($scope.qualitycheck.qfrq, "yyyy-MM-dd");//签发日期 $scope.change(0);//点击仓房切换货位 if ($scope.qualitycheck.id == null) { $scope.qualitycheck.checker = $rootScope.userInfo.realName; //检验人,只有在新增和修改的时候才展示为当前登录人 } if($stateParams.depotType == "1"){ $scope.isDepotShow = true; $scope.getAgentDepotData(); $scope.getBasicData($scope.qualitycheck.depotId); $scope.qualitycheck.houseId = parseInt(data.qualitycheck.houseId); if ($stateParams.isNotEdit == "false") { //加载明细品种 $scope.getGrainDetailKind(); } } $scope.getzblbData1(data); $scope.getstoreQualityData1(data); //获取对应的文件信息 $scope.getFileList(id); },function(data){ }); }; //获取对应的文件信息 $scope.getFileList = function (id){ businessFileService.getList(id, "qualityCj", $rootScope.orgInfo.orgId, "id asc").then(function(data) { $scope.fileList = data; },function(data) { console.log(data); }); } //代储点的粮库名称 $scope.getAgentDepotData = function(agentId) { agentDepotService.getPageInfo("1", "100", "", "").then(function (data) { $scope.depotList = data.list.map(function (item) { return { depotId: item.id, depotName: item.agentDepotName } }); }, function (data) { console.log(data); }); }; // 树形下拉框(明细品种) $scope.getGrainDetailKind = function() { enumService.getTreeListByTypeId($scope.qualitycheck.subTypeDetailed, $scope.qualitycheck.subType).then(function(data) { $scope.grainDetailKindTreeData = data; },function(data) { console.log(data); }); }; $scope.selectOnlyzbl = function(item, selectedItems) { $scope.getzblbData(item.id); if (selectedItems !== undefined && selectedItems.length >= 4) { return false; } else { return true; } }; $scope.selectOnly1Or2zbl = function(item, selectedItems) { if (selectedItems !== undefined && selectedItems.length >= 4) { return false; } else { return true; } }; //树形下拉框(指标类别) $scope.datazbl3 = []; $scope.getzblbData=function(type) { $scope.zblblist = [{name: '质量指标检验',id: 1},{name: '储存品质检验',id: 2},{name: '食品安全检验',id: 3}];//质量指标检验,储存品质检验,食品安全检验 //console.log($scope.zblblist); for (var i = 0; i < $scope.zblblist.length; i++) { // 当前为根. var obj = { id: $scope.zblblist[i].id, name: $scope.zblblist[i].name }; if($scope.qualitycheck!=undefined){ } else { for (var s = 0; s < $scope.zblblist.length; s++) { // obj.selected=true; } } $scope.datazbl3.push(obj); //console.log($scope.datazbl3); } $scope.data4 = angular.copy($scope.datazbl3); } $scope.getzblbData1=function(type) { $scope.zblblist = [{name: '质量指标检验',id: 1},{name: '储存品质检验',id: 2},{name: '食品安全检验',id: 3}];//质量指标检验,储存品质检验,食品安全检验 //console.log($scope.zblblist); for (var i = 0; i < $scope.zblblist.length; i++) { // 当前为根. var obj = { id: $scope.zblblist[i].id, name: $scope.zblblist[i].name }; if($scope.qualitycheck.zblb!=null){ for (var s = 0; s < $scope.qualitycheck.zblb.length; s++) { var strsv = $scope.qualitycheck.zblb; var strsa = strsv.substring(0, strsv.length - 1); var strs = strsa.split("#") for (var w=0;w= 8) { return false; } else { return true; } }; $scope.selectOnly1Or2storeQuality = function(item, selectedItems) { if (selectedItems !== undefined && selectedItems.length >= 8) { return false; } else { return true; } }; //树形下拉框(指标结果判定) $scope.datastoreQuality3 = []; $scope.getstoreQualityData=function(type) { $scope.storeQualitylist = [{name: '宜存',id: 0},{name: '轻度不宜存',id: 1},{name: '重度不宜存',id: 2} ,{name: '达标',id: 3},{name: '不达标',id: 4},{name: '合格',id: 5},{name: '不合格',id: 6}]; //console.log($scope.storeQualitylist); for (var i = 0; i < $scope.storeQualitylist.length; i++) { // 当前为根. var obj = { id: $scope.storeQualitylist[i].id, name: $scope.storeQualitylist[i].name }; if($scope.qualitycheck!=undefined){ }else { for (var s = 0; s < $scope.storeQualitylist.length; s++) { // obj.selected=true; } } $scope.datastoreQuality3.push(obj); //console.log($scope.datastoreQuality3); } $scope.data4storeQuality = angular.copy($scope.datastoreQuality3); } $scope.getstoreQualityData1=function(type) { $scope.storeQualitylist = [{name: '宜存',id: 0},{name: '轻度不宜存',id: 1},{name: '重度不宜存',id: 2} ,{name: '达标',id: 3},{name: '不达标',id: 4},{name: '合格',id: 5},{name: '不合格',id: 6}]; //console.log($scope.storeQualitylist); for (var i = 0; i < $scope.storeQualitylist.length; i++) { // 当前为根. var obj = { id: $scope.storeQualitylist[i].id, name: $scope.storeQualitylist[i].name }; for (var s = 0; s < $scope.qualitycheck.storeQuality.length; s++) { var strsv = $scope.qualitycheck.storeQuality; var strsa = strsv.substring(0, strsv.length - 1); var strs = strsa.split("#") for (var w = 0; w < strs.length; w++) { if ($scope.storeQualitylist[i].id == strs[w]) { obj.selected = true; } } } $scope.datastoreQuality3.push(obj); //console.log($scope.datastoreQuality3); } $scope.data4storeQuality = angular.copy($scope.datastoreQuality3); } /** * 级联仓房和货位号 */ $scope.getBasicData = function(depotId) { if($stateParams.depotType == "1"){//如果是1的话则是代储点点过来的 if(depotId == undefined)return; StorehouseService.getAgentList(depotId,$rootScope.orgInfo.orgId,$stateParams.depotType).then(function(data){ $scope.storehouseList = data.map(function(item) { return { ch: item.storehouseId, storehouseName: item.storehouseName } }); },function(data){ console.log(data); }); }else{ } } //通过仓房号,获取货位号. $scope.change = function (type) { if ($scope.qualitycheck.houseId != null && $scope.qualitycheck.houseId != undefined && $scope.qualitycheck.houseId != '') { if($stateParams.depotType == "1"){ //按照单位获取单位下的仓房信息 agentStorehouseService.getStorehouse($rootScope.orgInfo.orgId, $scope.qualitycheck.houseId).then(function(data){ if(data.wareList.length > 0){ $scope.warehouseList = data.wareList; //下拉列表数据 $("#wareNameDis").attr("disabled",false); }else{ $scope.warehouseList = ''; $scope.changeGetInfo(0); $("#wareNameDis").attr("disabled",true); } },function (data) { console.log(data); }); }else{ warehouseService.getStorehouse($rootScope.orgInfo.orgId, $scope.qualitycheck.houseId, "0").then(function(data){ if(data.wareList.length > 0){ $scope.warehouseList = data.wareList; //下拉列表数据 $scope.warehouseObj = data.wares; //查询数据列表货位信息转换 $("#wareNameDis").attr("disabled",false); }else{ $scope.warehouseList = ''; $scope.changeGetInfo(0); $("#wareNameDis").attr("disabled",true); } },function(data){ console.log(data); }); if (type != 0) { $scope.findKeeperNames(); } } } else { // 设置货位号为空. $scope.qualitycheck.warehouseId = null; } } //用于初检,验收,春秋普查,日常检查和第三方检查带出的保管员 $scope.findKeeperNames = function () { //通过仓房号获取保管员,用于在第三方检查和日常检查中显示保管员的名字 keeperService.getKeeperNamesByHouseId($scope.qualitycheck.houseId).then(function (data) { $scope.keeper = data; $scope.qualitycheck.keeper = $scope.keeper.keeperNames; }, function (data) { console.log(data); }); } //校验是否已经有初检了 $scope.isChuJian = function (stype) { if (stype==="0") { var datatype = $rootScope.storehouseObj[$scope.qualitycheck.houseId].datatype; //先判断表中是否已经存在初检,验收 qualitycheckService.findByStoreWarehouse($scope.qualitycheck.houseId,$scope.qualitycheck.warehouseId,stype).then(function(data) { //$scope.qualitycheck = data; if (data) { //if ($stateParams.checkType == 0) { alert("该仓已经初检,不能再次初检,您可以从列表中选择进行修改!"); if($stateParams.depotType == "1"){ $state.go('app.business.agent.qualitycheck.fcklist', {type: 0}); }else{ $state.go('app.storage.qualitycheck.fcklist', {type: 0}); } //} return true; } },function(data){ console.log(data); }); } } //得到分仓保管账中的信息 $scope.changeGetInfo = function (type) { $scope.getzblbData(); $scope.getstoreQualityData(); if(type != 0 && ($scope.qualitycheck.warehouseId == null || typeof $scope.qualitycheck.warehouseId == undefined || $scope.qualitycheck.warehouseId == ''))return; if ($scope.qualitycheck.houseId != null && $scope.qualitycheck.houseId != undefined && $scope.qualitycheck.houseId != '') { if($stateParams.depotType == "1") return; var datatype = $rootScope.storehouseObj[$scope.qualitycheck.houseId].datatype; var lylx; if (datatype == "0") {//粮仓 lylx = $rootScope.wares[$scope.qualitycheck.warehouseId].lylx; } else if (datatype == "1") {//油罐 lylx = $rootScope.tankObj[$scope.qualitycheck.houseId].lylx; } if (lylx != null && lylx == 0) { //出入库--原粮(小麦、玉米、大豆、稻谷、大豆原油即压榨成品油) $scope.kcswStr = {ch : $scope.qualitycheck.houseId, hwh : $scope.qualitycheck.warehouseId, unitid : $rootScope.orgInfo.orgId}; kcswService.getPageInfoOrRcsj($scope.kcswStr).then(function(data){ //如果从分仓保管账查找到数据就取出赋值到对应的数据 否则清空上次的数据 if (typeof(data[0]) != "undefined" && data.length > 0 ) { $scope.keepaccount = data[0];//根据仓房和货位获取分仓保管账的降序的第一条记录 $scope.qualitycheck.subType = parseInt($scope.keepaccount.pz);//品种 $scope.qualitycheck.subTypeDetailed = parseInt($scope.keepaccount.mxpz);//明细品种 $scope.qualitycheck.numberUpdate = $scope.keepaccount.kcsl;//数量 $scope.qualitycheck.harvestTime = parseInt($scope.keepaccount.scnf);//收货年度 $scope.qualitycheck.inputTime = $scope.keepaccount.cjsj.substr(0,10);//入仓时间 $scope.qualitycheck.zhycsj = $scope.keepaccount.rq.substr(0,10);//入仓时间 // $scope.qualitycheck.checkTime = getNowFormatDate(); //检验日期 $scope.qualitycheck.quality = $scope.keepaccount.hwxz; //货位性质 (储粮性质)主要用于封仓管理中验证某个性质 $scope.qualitycheck.location = parseInt($scope.keepaccount.gb); //产地 $scope.qualitycheck.subMold = 1; //类型1为粮油 2:成品粮油 //用于判断品种的检验标准依据的值 该值从词典枚举中取出的() if ($scope.qualitycheck.subType == 3164) { // 小麦 $scope.qualitycheck.inspectionStandardBasis = 5523; } else if($scope.qualitycheck.subType == 3165) { // 玉米 $scope.qualitycheck.inspectionStandardBasis = 5524; }else if($scope.qualitycheck.subType == 3166) { // 稻谷 $scope.qualitycheck.inspectionStandardBasis = 5526; }else if($scope.qualitycheck.subType == 2777) { // 大豆 $scope.qualitycheck.inspectionStandardBasis = 5525; }else if($scope.qualitycheck.subType == 6905) { // 粮油 $scope.qualitycheck.inspectionStandardBasis = 6908; } }else{ $scope.qualitycheck.subType="";//品种 $scope.qualitycheck.subTypeDetailed="";//明细品种 $scope.qualitycheck.numberUpdate="";//数量 $scope.qualitycheck.harvestTime="";//收货年度 $scope.qualitycheck.inputTime="";//入仓日期 } },function(data){ console.log(data); }); } else if (lylx != null && lylx == 1) { $scope.search = {houseId:$scope.qualitycheck.houseId, wareId:$scope.qualitycheck.warehouseId}; productService.getNumberList(null, null, $scope.search).then(function(data){ //如果从分仓保管账查找到数据就取出赋值到对应的数据 否则清空上次的数据 if (typeof(data.list[0]) != "undefined" && data.list.length > 0 ) { $scope.qualityFinishedCard = data.list[0];//根据仓房和货位获取成品粮油卡 $scope.qualitycheck.subType = parseInt($scope.qualityFinishedCard.lypz);//品种 $scope.qualitycheck.subTypeDetailed = parseInt($scope.qualityFinishedCard.mxpz);//明细品种 $scope.qualitycheck.numberUpdate = $scope.qualityFinishedCard.kcsl*1000;//数量 var scny = $scope.qualityFinishedCard.scny; if (scny != "" && scny != null) { var scnd = scny.substr(0,4);//收货年度 for (var i = 0;i < $rootScope.dicDataList[1004].length;i++) { if ($rootScope.dicDataList[1004][i].enumname==scnd) { $scope.qualitycheck.harvestTime = $rootScope.dicDataList[1004][i].enumid; } } } $scope.qualitycheck.inputTime = $scope.qualityFinishedCard.rksj.substr(0,10);//入仓时间 $scope.qualitycheck.zhycsj = $scope.qualityFinishedCard.zhycsj.substr(0,10);//入库时间 // $scope.qualitycheck.checkTime = getNowFormatDate(); //检验日期 $scope.qualitycheck.quality = $scope.qualityFinishedCard.lyxz; //货位性质 (储粮性质)主要用于封仓管理中验证某个性质 $scope.qualitycheck.location = parseInt($scope.qualityFinishedCard.lycd); //产地 $scope.qualitycheck.subMold = 2; //类型1为粮油 2:成品粮油 //用于判断品种的检验标准依据的值 该值从词典枚举中取出的() if ($scope.qualitycheck.subType == 7107) { // 大米 $scope.qualitycheck.inspectionStandardBasis = 7573; } else if($scope.qualitycheck.subType == 7038) { // 小麦粉 $scope.qualitycheck.inspectionStandardBasis = 7575; }else if($scope.qualitycheck.subType == 7050 || $scope.qualitycheck.subType == 7052) { // 压榨和浸出成品油 $scope.qualitycheck.inspectionStandardBasis = 7574; } }else{ $scope.qualitycheck.subType="";//品种 $scope.qualitycheck.subTypeDetailed="";//明细品种 $scope.qualitycheck.numberUpdate="";//数量 $scope.qualitycheck.harvestTime="";//收货年度 $scope.qualitycheck.inputTime="";//入仓日期 } },function(data){ console.log(data); }); } } } $scope.qualitycheck = {}; $scope.qualitycheckInspection = {}; //化验项 if ($stateParams.id != 0) {//说明是的查看和修改 $scope.loadDataById($stateParams.id); //这些新增可以变动,修改不可以 $("#houseNameDis").attr("disabled",true); $("#wareNameDis").attr("disabled",true); $("#keeps").attr("disabled",true); }else{//新增 //默认检验结论 储存品质 为合格和宜存 $scope.qualitycheck.checkResult = "0"; $scope.qualitycheck.storeQuality = "0"; $scope.getBasicData(); $scope.getAgentDepotData(); } //打印 $scope.print = function() { $("#printing").printArea(); } $scope.getMath = function(v) { if (isNaN(v) || v == "") { v = 0.00; } else { v = Math.round(v*100)/100; v = v.toString(); var rs = v.indexOf('.'); if(rs < 0){ v = v + ".00"; }else{ while(v.length <= rs + 2){v += '0';} } } return v; } $scope.getMath1 = function(v) { if (isNaN(v) || v == "") { v = 0.0; } else { v = Math.round(v*10)/10; v = v.toString(); var rs = v.indexOf('.'); if(rs < 0){ v = v + ".0"; }else{ while(v.length <= rs + 1){v += '0';} } } return v; } // 计算总量 $scope.zjzl = function() { var pz = $scope.qualitycheck.subType; if (pz=="3164") { var sf = parseFloat($scope.qualitycheck.water);//水分 $scope.qualitycheck.water = $scope.getMath1(sf); var rz = parseFloat($scope.qualitycheckInspection.unitWeight);//容重 $scope.qualitycheckInspection.unitWeight = $scope.getMath1(rz); var xmydzs = parseFloat($scope.qualitycheck.hardIndex);//小麦硬度指数 $scope.qualitycheck.hardIndex = $scope.getMath1(xmydzs); var mineral = parseFloat($scope.qualitycheck.mineral);//矿物质 //mineral = isNaN(mineral) ? 0.00 : mineral; $scope.qualitycheck.mineral = $scope.getMath(mineral); var black = parseFloat($scope.qualitycheckInspection.imperfectgrainsScabBlackembryo);//黒胚粒 //black = isNaN(black) ? 0 : black; $scope.qualitycheckInspection.imperfectgrainsScabBlackembryo = $scope.getMath(black); var inorganic = parseFloat($scope.qualitycheckInspection.impurityInorganic);//无机杂质 //inorganic = isNaN(inorganic) ? 0 : inorganic; $scope.qualitycheckInspection.impurityInorganic = $scope.getMath(inorganic); var gibberella = parseFloat($scope.qualitycheckInspection.imperfectgrainsScabGibberella);//赤霉病粒 //gibberella = isNaN(gibberella) ? 0 : gibberella; $scope.qualitycheckInspection.imperfectgrainsScabGibberella = $scope.getMath(gibberella); var qtbl = parseFloat($scope.qualitycheckInspection.imperfectgrainsScabQtbl);//其它病粒 //qtbl = isNaN(qtbl) ? 0 : qtbl; $scope.qualitycheckInspection.imperfectgrainsScabQtbl = $scope.getMath(qtbl); var organic = parseFloat($scope.qualitycheckInspection.impurityOrganic);//有机杂质 //organic = isNaN(organic) ? 0 : organic; $scope.qualitycheckInspection.impurityOrganic = $scope.getMath(organic); var sieveResidue = parseFloat($scope.qualitycheckInspection.sieveResidue);//筛下物% //sieveResidue = isNaN(sieveResidue) ? 0 : sieveResidue; $scope.qualitycheckInspection.sieveResidue = $scope.getMath(sieveResidue); var csl = parseFloat($scope.qualitycheckInspection.imperfectgrainsInjuredkernel);//虫蚀粒% //csl = isNaN(csl) ? 0 : csl; $scope.qualitycheckInspection.imperfectgrainsInjuredkernel = $scope.getMath(csl); var psl = parseFloat($scope.qualitycheckInspection.imperfectgrainsDamage);//破损粒% //psl = isNaN(psl) ? 0 : psl; $scope.qualitycheckInspection.imperfectgrainsDamage = $scope.getMath(psl); var sml = parseFloat($scope.qualitycheck.mildewCount);//生霉粒% //sml = isNaN(sml) ? 0 : sml; $scope.qualitycheck.mildewCount = $scope.getMath(sml); var syl = parseFloat($scope.qualitycheckInspection.imperfectgrainsSproutedkernel);//生芽粒% //syl = isNaN(syl) ? 0 : syl; $scope.qualitycheckInspection.imperfectgrainsSproutedkernel = $scope.getMath(syl); var bblzl = ((parseFloat(black)*100) + (parseFloat(gibberella)*100) + (parseFloat(qtbl)*100))/100;//病斑粒总量% //bblzl = isNaN(bblzl) ? 0 : bblzl; //$scope.qualitycheckInspection.imperfectgrainsSproutedkernel = $scope.getMath(syl); var zdy = parseFloat($scope.qualitycheckInspection.inputTwo);//自定义属性 $scope.qualitycheckInspection.inputTwo = $scope.getMath1(zdy); if($scope.qualitycheck !== undefined && $scope.qualitycheck !== ""){ //杂质总量 var zzzl = ((parseFloat(mineral)*100) + (parseFloat(inorganic)*100)+ (parseFloat(organic)*100)+ (parseFloat(sieveResidue)*100))/100; //$scope.qualitycheckInspection.impurityTotal = $scope.getMath($scope.qualitycheckInspection.impurityTotal); $scope.qualitycheckInspection.impurityTotal = isNaN(zzzl) ? '0.0' : $scope.getMath1(zzzl); //病斑粒总量 var bblzl = ((parseFloat(black)*100) + (parseFloat(gibberella)*100) + (parseFloat(qtbl)*100))/100; //$scope.qualitycheckInspection.imperfectgrainsScabTotal = $scope.getMath($scope.qualitycheckInspection.imperfectgrainsScabTotal); $scope.qualitycheckInspection.imperfectgrainsScabTotal = isNaN(bblzl) ? '0.0' : $scope.getMath1(bblzl); //不完善粒总量 var bwslzl = ((parseFloat(csl)*100) + (parseFloat(psl)*100)+(parseFloat(sml)*100) + (parseFloat(bblzl)*100) + (parseFloat(syl)*100))/100; //$scope.qualitycheckInspection.imperfectgrainsTotal = $scope.getMath($scope.qualitycheckInspection.imperfectgrainsTotal); $scope.qualitycheckInspection.imperfectgrainsTotal = isNaN(bwslzl) ? '0.0' : $scope.getMath1(bwslzl); } } else if (pz=="3166") { var sf = parseFloat($scope.qualitycheck.water);//水分 $scope.qualitycheck.water = $scope.getMath1(sf); var ccl = parseFloat($scope.qualitycheck.huskedRation);//出糙率 $scope.qualitycheck.huskedRation = $scope.getMath1(ccl); var wsl = parseFloat($scope.qualitycheckInspection.imperfectgrainsImmaturegrain);//未熟粒 $scope.qualitycheckInspection.imperfectgrainsImmaturegrain = $scope.getMath(wsl); var zjml = parseFloat($scope.qualitycheck.fullGoodRation);//整精米率 $scope.qualitycheck.fullGoodRation = $scope.getMath1(zjml); var csl = parseFloat($scope.qualitycheckInspection.imperfectgrainsInjuredkernel);//虫蚀粒 $scope.qualitycheckInspection.imperfectgrainsInjuredkernel = $scope.getMath(csl); var bbl = parseFloat($scope.qualitycheckInspection.imperfectgrainsScab);//病斑粒 $scope.qualitycheckInspection.imperfectgrainsScab = $scope.getMath(bbl); var sieveResidue = parseFloat($scope.qualitycheckInspection.sieveResidue);//筛下物% $scope.qualitycheckInspection.sieveResidue = $scope.getMath(sieveResidue); var syl = parseFloat($scope.qualitycheckInspection.imperfectgrainsSproutedkernel);//生芽粒 $scope.qualitycheckInspection.imperfectgrainsSproutedkernel = $scope.getMath(syl); var yjzz = parseFloat($scope.qualitycheckInspection.impurityOrganic);//有机杂质 $scope.qualitycheckInspection.impurityOrganic = $scope.getMath(yjzz); var sml = parseFloat($scope.qualitycheck.mildewCount);//生霉粒 $scope.qualitycheck.mildewCount = $scope.getMath(sml); var wjzz = parseFloat($scope.qualitycheckInspection.impurityInorganic);//无机杂质 $scope.qualitycheckInspection.impurityInorganic = $scope.getMath(wjzz); var gwcm = parseFloat($scope.qualitycheck.outHuskedRation);//谷外糙米 $scope.qualitycheck.outHuskedRation = $scope.getMath1(gwcm); var cml = parseFloat($scope.qualitycheckInspection.riceYield);//出米率 $scope.qualitycheckInspection.riceYield = $scope.getMath1(cml); var hlm = parseFloat($scope.qualitycheckInspection.yellowRice);//黄粒米 $scope.qualitycheckInspection.yellowRice = $scope.getMath1(hlm); var hhl = parseFloat($scope.qualitycheck.intermixingRate);//互混率 $scope.qualitycheck.intermixingRate = $scope.getMath1(hhl); var zdy = parseFloat($scope.qualitycheckInspection.inputTwo);//自定义属性 $scope.qualitycheckInspection.inputTwo = $scope.getMath1(zdy); if($scope.qualitycheck !== undefined && $scope.qualitycheck !== ""){ //杂质总量=筛下物+有机杂质+无机杂质,四舍五入,保留一位小数 var zzzl = ((parseFloat(sieveResidue)*100) + (parseFloat(yjzz)*100)+ (parseFloat(wjzz)*100))/100; $scope.qualitycheckInspection.impurityTotal = isNaN(zzzl) ? '0.0' : $scope.getMath1(zzzl); //zzzl.toFixed(1); //$scope.qualitycheckInspection.impurityTotal = $scope.getMath1($scope.qualitycheckInspection.impurityTotal); //不完善粒总量=未熟粒+虫蚀粒+病斑粒+生芽粒+生霉粒 var bwslzl = ((parseFloat(wsl)*100) + (parseFloat(csl)*100) + (parseFloat(bbl)*100) + (parseFloat(syl)*100) + (parseFloat(sml)*100))/100; $scope.qualitycheckInspection.imperfectgrainsTotal = isNaN(bwslzl) ? '0.0' : $scope.getMath1(bwslzl); } } }; if($stateParams.isNotEdit != null){ //新增或修改 if ($stateParams.isNotEdit == "false") { $("#printId").hide(); $scope.isNotEdit = false; //如果是代储点则需要另外判断 if($stateParams.depotType == "1"){ $scope.isShow = false; } //查看 } else if ($stateParams.isNotEdit == "true") { $scope.isNotEdit = true; } }else{ $scope.isNotEdit = false; } // 提交表单 var validator = $("#qualitycheck-form").validate(); $scope.saveData = function (checktype) { var zblbId =""; var storeQualityId =""; if($scope.qualitycheck.zblb == null || $scope.qualitycheck.zblb == ""){ alert("请选择指标类别!"); return false; } if($scope.qualitycheck.storeQuality == null || $scope.qualitycheck.storeQuality == ""){ alert("请选择指标结果判定!"); return false; } //质量检查类型checktype:0:初检 1:验收 2:春秋普查 3:出库检验 4:日常检验 5:第三方检查 if (validator.form()) { if(checktype == 3){ $scope.qualitycheck.typeUpdate = checktype; $scope.qualitycheck.jylb = '02'; }else if(checktype == 0){ $scope.qualitycheck.chooserOrgan = $rootScope.orgInfo.orgName; if($scope.qualitycheck.typeUpdate==0){ $scope.qualitycheck.jylb = '05'; }else if($scope.qualitycheck.typeUpdate==4){ $scope.qualitycheck.jylb = '06'; } }else if(checktype == 4){ $scope.qualitycheck.jylb = '06'; } $scope.qualitycheck.orgId = $rootScope.userInfo.orgId; /**************时间插件无法通过$scope获取数据,重新赋值一下****************/ //入仓日期 $("input[name='inputTime']").each(function(j,item){ if(item.value != '' && item.value != null && typeof item.value != 'undefined'){ $scope.qualitycheck.inputTime = $filter('date')(item.value, "yyyy-MM-dd"); } }); //入库日期 $("input[name='zhycsj']").each(function(j,item){ if(item.value != '' && item.value != null && typeof item.value != 'undefined'){ $scope.qualitycheck.zhycsj = $filter('date')(item.value, "yyyy-MM-dd HH:mm:ss"); } }); //扦样日期 $("input[name='chooseTime']").each(function(j,item){ if(item.value != '' && item.value != null && typeof item.value != 'undefined'){ $scope.qualitycheck.chooseTime = $filter('date')(item.value, "yyyy-MM-dd HH:mm:ss"); } }); //检验日期 $("input[name='checkTime']").each(function(j,item){ if(item.value != '' && item.value != null && typeof item.value != 'undefined'){ $scope.qualitycheck.checkTime = $filter('date')(item.value, "yyyy-MM-dd HH:mm:ss"); } }); //入库日期早于检验日期的判断 var rksj = new Date($scope.qualitycheck.inputTime.replace( /\-/g, "\/")); var qysj = new Date($scope.qualitycheck.chooseTime.replace( /\-/g, "\/")); var jysj = new Date($scope.qualitycheck.checkTime.replace( /\-/g, "\/")); if (rksj!= "" && qysj!= "" && rksj > qysj) { alert( "入库日期应该早于扦样时间!"); return false; } if (qysj!= "" && jysj!= "" && qysj > jysj) { alert( "扦样时间应该早于检验时间!"); return false; } //签发日期qualitycheck.qfrq $("input[name='qfrq']").each(function(j,item){ if(item.value != '' && item.value != null && typeof item.value != 'undefined'){ $scope.qualitycheck.qfrq = $filter('date')(item.value, "yyyy-MM-dd"); } }); var qfrq = new Date($scope.qualitycheck.qfrq.replace( /\-/g, "\/")); var n_jysj = $scope.qualitycheck.checkTime.substr(0,10); var new_jysj = new Date(n_jysj.replace( /\-/g, "\/")); if (qfrq!= "" && new_jysj!= "" && qfrq < new_jysj) { alert( "签发日期不得早于检验时间!"); return false; } //报告出具日期checkResultTime $("input[name='checkResultTime']").each(function(j,item){ if(item.value != '' && item.value != null && typeof item.value != 'undefined'){ $scope.qualitycheck.checkResultTime = $filter('date')(item.value, "yyyy-MM-dd HH:mm:ss"); } }); /**************时间插件无法通过$scope获取数据,重新赋值一下****************/ //移除subMold属性 delete $scope.qualitycheck.subMold; if($stateParams.depotType == "1"){ $scope.qualitycheck.subTypeDetailed = parseInt($scope.qualitycheck.subTypeDetailed[0].id); } $scope.zblb=angular.fromJson($scope.qualitycheck.zblb); for (var s = 0; s < $scope.zblb.length; s++) { zblbId=zblbId+$scope.zblb[s].id+"#"; // $scope.zblb = zblbId.join("#"); //$scope.qualitycheck.zblb = $scope.zblb[s].join("#"); } $scope.storeQuality=angular.fromJson($scope.qualitycheck.storeQuality); for (var s = 0; s < $scope.storeQuality.length; s++) { storeQualityId=storeQualityId+$scope.storeQuality[s].id+"#"; // $scope.zblb = zblbId.join("#"); //$scope.qualitycheck.zblb = $scope.zblb[s].join("#"); } $scope.qualitycheck.zblb = angular.copy(zblbId); $scope.qualitycheck.storeQuality = angular.copy(storeQualityId); $scope.qualitycheck.harvestTime = parseInt($scope.qualitycheck.harvestTime); qualitycheckService.save($scope.qualitycheck, $scope.qualitycheckInspection).then(function(datas){ if (datas.status == "success") { var dataid = datas.dataid; businessFileService.getUpdateFile($scope.fileIds, dataid, "qualityCj").then(function(data){ /*if (data.status == 'success') { alert("删除成功!"); } else { alert("删除失败!"); }*/ },function(data){ console.log(data); }); alert("保存成功!"); //0:自检 1:验收 2:质量普查 3:出库 if (checktype == 0) { if($stateParams.depotType == "1"){ $state.go('app.business.agent.qualitycheck.fcklist', {type: '0,4'}); }else { $state.go('app.storage.qualitycheck.fcklist', {type: '0,4'}); } }else if(checktype == 3){ if($stateParams.depotType == "1"){ $state.go('app.business.agent.qualitycheck.outlist', {type: 3}); }else { $state.go('app.storage.qualitycheck.outlist', {type: 3}); } } } else { alert("保存失败!"); } },function(datas){ console.log(datas); }); } } //获取当前的日期时间 格式“yyyy-MM-dd HH:mm:ss” function getNowFormatDate() { var date = new Date(); var seperator1 = "-"; var seperator2 = ":"; var month = date.getMonth() + 1; var strDate = date.getDate(); if (month >= 1 && month <= 9) { month = "0" + month; } if (strDate >= 0 && strDate <= 9) { strDate = "0" + strDate; } var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate; return currentdate; } // 自定义验证,验证检验时间不得早于入库日期 $.validator.addMethod("validDrugTime",function(value,element, params) { var beginTime = $scope.qualitycheck.inputTime; var endTime = $scope.qualitycheck.checkTime; if(endTime <= beginTime){ return this.optional(element)|| false; }else{ return this.optional(element)|| true; } },"检验时间不得早于入库日期!"); // 自定义验证,验证散气时间不得早于熏蒸开始时间和熏蒸结束时间 $.validator.addMethod("validTime",function(value,element, params) { var beginTime = $scope.fumigationProcess.firstUseDrugTime; var endTime = $scope.fumigationProcess.taskEndTime; if(value <= beginTime || value <= endTime){ return this.optional(element)|| false; }else{ return this.optional(element)|| true; } },"散气时间不得早于熏蒸开始时间和结束时间!"); // 自定义验证 $.validator.addMethod("setState",function(value,element, params) { if(value == "无" || value == "暂无" || value == "空"){ return this.optional(element)|| false; }else{ return this.optional(element)|| true; } },"不能填写无,暂无,空等选项!"); // 自定义验证,验证数字 $.validator.addMethod("validNumber",function(value,element, params) { var checkNumber = /^(?!0+(?:\.0+)?$)(?:[1-9]\d*|0)(?:\.\d{1,2})?$/; return this.optional(element)||(checkNumber.test(value)); },"请输入大于0的数字,最多两位小数!"); // 新增一行 $scope.addTR = function(qualitycheckId) { $scope.addCheckSon.push({qualitycheckId:qualitycheckId}); } // 删除一行 $scope.deleteTR = function(obj) { var index; // 如果有ID,说明当前数据已经是存在于数据库的,那么要郑重删除 if (obj.id != undefined) { $scope.deleteSon(obj.id); } index = $scope.addCheckSon.indexOf(obj); $scope.addCheckSon.splice(index, 1); } $scope.deleteSon = function(id) { if (!confirm("当前数据已近存在于系统中,确定要删除吗?")) { return; } // 提交 qualitycheckService.removeSon(id).then(function(data){ if (data.status == 'success') { alert("删除成功!"); } else { alert("删除失败!"); } },function(data){ console.log(data); }); } // ----------------------------------------------- 文件上传下载相关 开始------------------------------------------------ var bid = null; // 添加一行,取最大值加1放入数组 $scope.linenumber = 0; $scope.linenumbers = []; if ($stateParams.id == '') { $scope.linenumbers = [0]; } // 新增一行 $scope.addFile = function() { if ($scope.linenumbers.length == 0 ) { $scope.linenumbers.push(0); } else { var maxlinenumber = Math.max.apply(null, $scope.linenumbers); $scope.linenumbers.push(maxlinenumber + 1); } } // 文件上传实例 $scope.fileIds = []; // 以linenumber为key,以新增的附件对应为value. $scope.fileMap = new Map(); // 上传. $scope.uploader = new FileUploader({ //url : APP_CONFIG.basicUrl + '/fileUpload/updateFileBusiness', url : APP_CONFIG.businessUrl + '/depot/business/file/uploadFile', autoUpload : true, // 将文件添加到队列后自动上传. formData : [{type : 'qualityCj', userId:$rootScope.userInfo.userId,orgId:$rootScope.orgInfo.orgId}], // 与文件一起发送的数据 removeAfterUpload : true, // 从队列上传后删除文件 // 上传进度 onProgressItem : function(fileItem, progress) { // console.info("正在上传:" + progress + "%"); }, // 回调函数,在一个文件上传成功后触发 onSuccessItem : function(fileItem, response, status, headers) { // 将新fileId加入到fileIds,用于最后在保存的时候会写附件表的主表ID. $scope.fileIds.push(response.id); // 如果已经存在对应的fileId,先从$scope.fileIds中移除,再添加. if ($scope.fileMap.has($scope.linenumber)) { // 原fileId. var fileId = $scope.fileMap.get($scope.linenumber).id; // 从$scope.fileIds中移除原fileId. var index = $scope.fileIds.indexOf(fileId); if (index != -1) { // 后台删除. $scope.deleteFileByFileIds(fileId); } } $scope.fileMap.set($scope.linenumber, response); } }); // 下载文件 $scope.download = function(filePath, originalFileName) { $("#filePath").val(filePath); $("#type").val("business"); $("#originalFileName").val(originalFileName); $("#download-form").attr("action", APP_CONFIG.basicUrl + '/download'); $("#download-form").submit(); } // 新增预览. $scope.showFileByLinenumber = function(linenumber) { if ($scope.fileMap.has($scope.linenumber)) { // 以linenumber为key从$scope.fileMap获取filePath. var filePath = $scope.fileMap.get($scope.linenumber).filePath; window.open(APP_CONFIG.basicUrl+filePath); } } // 回显预览. $scope.showFile = function(filePath, originalFileName) { window.open(APP_CONFIG.basicUrl+filePath); } // 点击浏览按钮. $scope.clickFileInput = function(index) { $scope.linenumber = index; } // 文件上传实例 $scope.deleteFileIds = []; // 回显删除. $scope.deleteFile = function(file) { // 回显删除,先不真正删除,把要删除的附件id保存在数组中,再最后保存的时候传递给后台,进行删除. $scope.deleteFileIds.push(file.id); // 从$scope.fileList 移除. var index = $scope.fileList.indexOf(file); if (index != -1) { $scope.fileList.splice(index, 1); } $scope.deleteFileByFileIds(file.id); } // 正常删除. $scope.deleteFileByLinenumber = function(linenumber) { var index = $scope.linenumbers.indexOf(linenumber); if (index != -1) { // 从linenumbers移除. $scope.linenumbers.splice(index, 1); if ($scope.fileMap.has($scope.linenumber)) { // 以linenumber为key从$scope.fileMap获取fileId. var fileId = $scope.fileMap.get($scope.linenumber).id; // 后台删除数据和文件. $scope.deleteFileByFileIds(fileId, index); // 从$scope.fileMap移除. $scope.fileMap.delete(linenumber); } } } $scope.deleteFileByFileIds = function(fileId) { businessFileService.remove(fileId).then(function(data){ if (data.status == "success") { // 删除成功. var index = $scope.fileIds.indexOf(fileId); if (index != -1) { // 从$scope.fileIds中移除. $scope.fileIds.splice(index, 1); } } },function (data) { console.log(data); }); } // ----------------------------------------------- 上传下载相关 结束 ------------------------------------------------ })