Commit 69d2626e authored by chase's avatar chase

fix bug

parent ee24fd66
...@@ -19,10 +19,13 @@ import org.springframework.web.bind.annotation.*; ...@@ -19,10 +19,13 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import pwc.taxtech.atms.common.PageResultVo; import pwc.taxtech.atms.common.PageResultVo;
import pwc.taxtech.atms.common.util.DateUtils; import pwc.taxtech.atms.common.util.DateUtils;
import pwc.taxtech.atms.constant.enums.FileUploadEnum;
import pwc.taxtech.atms.dto.TaxDocumentDto; import pwc.taxtech.atms.dto.TaxDocumentDto;
import pwc.taxtech.atms.entity.TaxDocument; import pwc.taxtech.atms.entity.TaxDocument;
import pwc.taxtech.atms.service.impl.DidiFileUploadService;
import pwc.taxtech.atms.service.impl.TaxDocumentServiceImpl; import pwc.taxtech.atms.service.impl.TaxDocumentServiceImpl;
import pwc.taxtech.atms.thirdparty.ExcelUtil; import pwc.taxtech.atms.thirdparty.ExcelUtil;
import pwc.taxtech.atms.vat.entity.FileUpload;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.*; import java.io.*;
...@@ -39,6 +42,8 @@ public class TaxDocumentController { ...@@ -39,6 +42,8 @@ public class TaxDocumentController {
@Autowired @Autowired
private TaxDocumentServiceImpl taxDocumentService; private TaxDocumentServiceImpl taxDocumentService;
@Autowired
private DidiFileUploadService didiFileUploadService;
@PostMapping("selectList") @PostMapping("selectList")
@ResponseBody @ResponseBody
public PageResultVo<TaxDocument> selectTaxDocumentList(@RequestBody TaxDocumentDto taxDocumentDto) { public PageResultVo<TaxDocument> selectTaxDocumentList(@RequestBody TaxDocumentDto taxDocumentDto) {
...@@ -51,7 +56,7 @@ public class TaxDocumentController { ...@@ -51,7 +56,7 @@ public class TaxDocumentController {
@PostMapping("/queryWhetherData") @PostMapping("/queryWhetherData")
@ResponseBody @ResponseBody
public boolean queryWhetherData(@RequestBody TaxDocument taxDocument) { public TaxDocument queryWhetherData(@RequestBody TaxDocument taxDocument) {
return taxDocumentService.queryWhetherData(taxDocument); return taxDocumentService.queryWhetherData(taxDocument);
} }
...@@ -76,11 +81,17 @@ public class TaxDocumentController { ...@@ -76,11 +81,17 @@ public class TaxDocumentController {
@PostMapping("edit") @PostMapping("edit")
@ResponseBody @ResponseBody
public boolean editTaxDocument( TaxDocument taxDocument) { public boolean editTaxDocument(TaxDocument taxDocument,
@RequestParam("file") MultipartFile file,
@RequestParam(required = false) String modual) {
//TODO 判断file是否为null 为null则不做上传和设置新url地址值 若不为null 则上传文件并设置文件url地址值
if(file!=null&&!file.isEmpty()){
FileUpload fileUpload = didiFileUploadService.uploadFile(file,file.getOriginalFilename(), FileUploadEnum.BizSource.RECORD_UPLOAD.name());
taxDocument.setFileUploadId(fileUpload.getUid());
taxDocument.setFilePositionUrl(fileUpload.getViewHttpUrl());
}
return taxDocumentService.editFilesType(taxDocument); return taxDocumentService.editFilesType(taxDocument);
} }
@RequestMapping("exportExcel") @RequestMapping("exportExcel")
@ResponseBody @ResponseBody
public void exportExcelFile(HttpServletResponse response, @RequestBody TaxDocumentDto taxDocumentDto) { public void exportExcelFile(HttpServletResponse response, @RequestBody TaxDocumentDto taxDocumentDto) {
......
...@@ -12,6 +12,7 @@ import org.apache.poi.ss.usermodel.WorkbookFactory; ...@@ -12,6 +12,7 @@ import org.apache.poi.ss.usermodel.WorkbookFactory;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import pwc.taxtech.atms.common.CommonUtils; import pwc.taxtech.atms.common.CommonUtils;
import pwc.taxtech.atms.common.POIUtil;
import pwc.taxtech.atms.dpo.OrgCodeIdDto; import pwc.taxtech.atms.dpo.OrgCodeIdDto;
import pwc.taxtech.atms.dpo.OrgSelectDto; import pwc.taxtech.atms.dpo.OrgSelectDto;
import pwc.taxtech.atms.dto.revenuconf.RevTypeAddDto; import pwc.taxtech.atms.dto.revenuconf.RevTypeAddDto;
...@@ -108,9 +109,10 @@ public class RevenueTypeMappingService extends BaseService { ...@@ -108,9 +109,10 @@ public class RevenueTypeMappingService extends BaseService {
Sheet sheet = workbook.getSheetAt(0); Sheet sheet = workbook.getSheetAt(0);
List<RevenueTypeMapping> list = new ArrayList<>(); List<RevenueTypeMapping> list = new ArrayList<>();
List<OrgCodeIdDto> orgDtoList = organizationService.getMyOrgCodeList(); List<OrgCodeIdDto> orgDtoList = organizationService.getMyOrgCodeList();
for (int r = sheet.getFirstRowNum(); r <= sheet.getLastRowNum(); r++) { List<String> orgIds = new ArrayList<>();
for (int r = sheet.getFirstRowNum()+1; r <= sheet.getLastRowNum(); r++) {
Row row = sheet.getRow(r); Row row = sheet.getRow(r);
String orgCode = row.getCell(0).getStringCellValue(); String orgCode = String.valueOf(new BigDecimal(POIUtil.getCellFormulaString(row.getCell(0))).intValue());
Optional<OrgCodeIdDto> optional = orgDtoList.stream().filter(o -> StringUtils.equals(o.getCode(), orgCode)).findFirst(); Optional<OrgCodeIdDto> optional = orgDtoList.stream().filter(o -> StringUtils.equals(o.getCode(), orgCode)).findFirst();
if (!optional.isPresent()) { if (!optional.isPresent()) {
continue; continue;
...@@ -118,16 +120,24 @@ public class RevenueTypeMappingService extends BaseService { ...@@ -118,16 +120,24 @@ public class RevenueTypeMappingService extends BaseService {
RevenueTypeMapping mapping = new RevenueTypeMapping(); RevenueTypeMapping mapping = new RevenueTypeMapping();
mapping.setId(idService.nextId()); mapping.setId(idService.nextId());
mapping.setOrgId(optional.get().getId()); mapping.setOrgId(optional.get().getId());
mapping.setOuName(StringUtils.defaultString(row.getCell(1).getStringCellValue())); orgIds.add(optional.get().getId());
mapping.setContent(StringUtils.defaultString(row.getCell(2).getStringCellValue())); mapping.setOuName(POIUtil.getCellFormulaString(row.getCell(1)));
mapping.setTaxRate(new BigDecimal(row.getCell(3).getNumericCellValue())); mapping.setContent(POIUtil.getCellFormulaString(row.getCell(2)));
mapping.setRevenueTypeName(StringUtils.defaultString(row.getCell(4).getStringCellValue())); mapping.setTaxRate(new BigDecimal(POIUtil.getCellFormulaString(row.getCell(3))));
mapping.setStartDate(StringUtils.defaultString(row.getCell(5).getStringCellValue())); mapping.setRevenueTypeName(POIUtil.getCellFormulaString(row.getCell(4)));
mapping.setEndDate(StringUtils.defaultString(row.getCell(6).getStringCellValue(), DEFAULT_END_DATE)); mapping.setStartDate(POIUtil.getCellFormulaString(row.getCell(5)));
mapping.setEndDate(StringUtils.defaultString(POIUtil.getCellFormulaString(row.getCell(6)), DEFAULT_END_DATE));
mapping.setStatus(0);
mapping.setCreateBy("Admin");
mapping.setUpdateBy("Admin");
list.add(mapping); list.add(mapping);
} }
if (1 == type) { if (1 == type) {
//todo 覆盖导入 具体覆盖哪些 if(CollectionUtils.isNotEmpty(orgIds)){
RevenueTypeMappingExample delExample = new RevenueTypeMappingExample();
delExample.createCriteria().andOrgIdIn(orgIds);
typeMappingMapper.deleteByExample(delExample);
}
} }
if (!CollectionUtils.isEmpty(list)) { if (!CollectionUtils.isEmpty(list)) {
List<List<RevenueTypeMapping>> batchList = CommonUtils.subListWithLen(list, CommonUtils.BATCH_NUM_2000); List<List<RevenueTypeMapping>> batchList = CommonUtils.subListWithLen(list, CommonUtils.BATCH_NUM_2000);
......
...@@ -161,6 +161,7 @@ public class TaxDocumentServiceImpl { ...@@ -161,6 +161,7 @@ public class TaxDocumentServiceImpl {
if (StringUtils.isNotBlank(taxDocumentDto.getCreator())) { if (StringUtils.isNotBlank(taxDocumentDto.getCreator())) {
criteria.andCreatorLike("%" + taxDocumentDto.getCreator() + "%"); criteria.andCreatorLike("%" + taxDocumentDto.getCreator() + "%");
} }
example.setOrderByClause("create_time DESC");
return example; return example;
} }
...@@ -331,7 +332,7 @@ public class TaxDocumentServiceImpl { ...@@ -331,7 +332,7 @@ public class TaxDocumentServiceImpl {
* @param taxDocument * @param taxDocument
* @return * @return
*/ */
public boolean queryWhetherData(TaxDocument taxDocument) { public TaxDocument queryWhetherData(TaxDocument taxDocument) {
try { try {
//简单参数校验 //简单参数校验
/* if (StringUtils.isAnyBlank(taxDocumentDto.getFileAttr(), taxDocumentDto.getFileName(), /* if (StringUtils.isAnyBlank(taxDocumentDto.getFileAttr(), taxDocumentDto.getFileName(),
...@@ -347,12 +348,12 @@ public class TaxDocumentServiceImpl { ...@@ -347,12 +348,12 @@ public class TaxDocumentServiceImpl {
criteria.andOwnTimeEqualTo(taxDocument.getOwnTime()); criteria.andOwnTimeEqualTo(taxDocument.getOwnTime());
List<TaxDocument> taxDocuments = taxDocumentMapper.selectByExample(taxDocumentExample); List<TaxDocument> taxDocuments = taxDocumentMapper.selectByExample(taxDocumentExample);
if (null != taxDocuments && taxDocuments.size() > 0) { if (null != taxDocuments && taxDocuments.size() > 0) {
return false; return taxDocuments.get(0);
} }
return true; return new TaxDocument();
} catch (Exception e) { } catch (Exception e) {
// log.error("TaxDocumentServiceImpl queryWhetherData error :" + e.getMessage()); // log.error("TaxDocumentServiceImpl queryWhetherData error :" + e.getMessage());
return false; return new TaxDocument();
} }
} }
public void downloadAllFile(HttpServletResponse response, List<Long> ids) { public void downloadAllFile(HttpServletResponse response, List<Long> ids) {
......
package pwc.taxtech.atms.vat.entity; package pwc.taxtech.atms.vat.entity;
import pwc.taxtech.atms.entity.BaseEntity;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date;
import pwc.taxtech.atms.entity.BaseEntity;
/** /**
* *
...@@ -110,41 +110,6 @@ public class RevenueTypeMapping extends BaseEntity implements Serializable { ...@@ -110,41 +110,6 @@ public class RevenueTypeMapping extends BaseEntity implements Serializable {
*/ */
private Integer status; private Integer status;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column revenue_type_mapping.create_by
*
* @mbg.generated
*/
private String createBy;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column revenue_type_mapping.update_by
*
* @mbg.generated
*/
private String updateBy;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column revenue_type_mapping.create_time
*
* @mbg.generated
*/
private Date createTime;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column revenue_type_mapping.update_time
*
* @mbg.generated
*/
private Date updateTime;
/** /**
* This field was generated by MyBatis Generator. * This field was generated by MyBatis Generator.
...@@ -370,101 +335,6 @@ public class RevenueTypeMapping extends BaseEntity implements Serializable { ...@@ -370,101 +335,6 @@ public class RevenueTypeMapping extends BaseEntity implements Serializable {
this.status = status; this.status = status;
} }
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column revenue_type_mapping.create_by
*
* @return the value of revenue_type_mapping.create_by
*
* @mbg.generated
*/
public String getCreateBy() {
return createBy;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column revenue_type_mapping.create_by
*
* @param createBy the value for revenue_type_mapping.create_by
*
* @mbg.generated
*/
public void setCreateBy(String createBy) {
this.createBy = createBy == null ? null : createBy.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column revenue_type_mapping.update_by
*
* @return the value of revenue_type_mapping.update_by
*
* @mbg.generated
*/
public String getUpdateBy() {
return updateBy;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column revenue_type_mapping.update_by
*
* @param updateBy the value for revenue_type_mapping.update_by
*
* @mbg.generated
*/
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy == null ? null : updateBy.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column revenue_type_mapping.create_time
*
* @return the value of revenue_type_mapping.create_time
*
* @mbg.generated
*/
public Date getCreateTime() {
return createTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column revenue_type_mapping.create_time
*
* @param createTime the value for revenue_type_mapping.create_time
*
* @mbg.generated
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column revenue_type_mapping.update_time
*
* @return the value of revenue_type_mapping.update_time
*
* @mbg.generated
*/
public Date getUpdateTime() {
return updateTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column revenue_type_mapping.update_time
*
* @param updateTime the value for revenue_type_mapping.update_time
*
* @mbg.generated
*/
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
/** /**
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
...@@ -487,10 +357,6 @@ public class RevenueTypeMapping extends BaseEntity implements Serializable { ...@@ -487,10 +357,6 @@ public class RevenueTypeMapping extends BaseEntity implements Serializable {
sb.append(", startDate=").append(startDate); sb.append(", startDate=").append(startDate);
sb.append(", endDate=").append(endDate); sb.append(", endDate=").append(endDate);
sb.append(", status=").append(status); sb.append(", status=").append(status);
sb.append(", createBy=").append(createBy);
sb.append(", updateBy=").append(updateBy);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append("]"); sb.append("]");
return sb.toString(); return sb.toString();
} }
......
...@@ -403,7 +403,6 @@ ...@@ -403,7 +403,6 @@
SELECT SELECT
id,file_attr, file_type id,file_attr, file_type
FROM file_types FROM file_types
WHERE status = 1
ORDER BY file_attr ORDER BY file_attr
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -414,38 +414,23 @@ ...@@ -414,38 +414,23 @@
</if> </if>
</select> </select>
<insert id="batchInsert" parameterType="pwc.taxtech.atms.vat.entity.RevenueTypeMapping"> <insert id="batchInsert">
insert into revenue_type_mapping (id, org_id, ou_name, insert into revenue_type_mapping
content, tax_rate, revenue_type_name, (id, org_id, ou_name, content, tax_rate, revenue_type_name, start_date, end_date, status, create_by, update_by, create_time, update_time) values
start_date, end_date, `status` <foreach collection="list" item="item" index="index" separator=",">
<if test="createBy != null"> (#{item.id},
,create_by #{item.orgId},
</if> #{item.ouName},
<if test="updateBy != null"> #{item.content},
,update_by #{item.taxRate},
</if> #{item.revenueTypeName},
<if test="createTime != null"> #{item.startDate},
,create_time #{item.endDate},
</if> #{item.status,jdbcType=TINYINT},
<if test="updateTime != null"> #{item.createBy},
,update_time #{item.updateBy},
</if>) values #{item.createTime},
<foreach collection="list" item="item" index="index" separator=","> #{item.updateTime})
(#{id,jdbcType=BIGINT}, #{orgId,jdbcType=VARCHAR}, #{ouName,jdbcType=VARCHAR},
#{content,jdbcType=VARCHAR}, #{taxRate,jdbcType=DECIMAL}, #{revenueTypeName,jdbcType=VARCHAR},
#{startDate,jdbcType=VARCHAR}, #{endDate,jdbcType=VARCHAR}, #{status,jdbcType=TINYINT}
<if test="createBy != null">
,create_by = #{createBy,jdbcType=VARCHAR}
</if>
<if test="updateBy != null">
,update_by = #{updateBy,jdbcType=VARCHAR}
</if>
<if test="createTime != null">
,create_time = #{createTime,jdbcType=TIMESTAMP}
</if>
<if test="updateTime != null">
,update_time = #{updateTime,jdbcType=TIMESTAMP}
</if>)
</foreach> </foreach>
</insert> </insert>
......
...@@ -71,6 +71,7 @@ ...@@ -71,6 +71,7 @@
"AssignRoleCol" : "分配角色", "AssignRoleCol" : "分配角色",
"SequenceNoCol":"序号", "SequenceNoCol":"序号",
"DocumentID":"Doc ID", "DocumentID":"Doc ID",
"Document":"Document",
"TaxGroup":"税种", "TaxGroup":"税种",
"ReportTemplate":"Report Template", "ReportTemplate":"Report Template",
...@@ -78,6 +79,7 @@ ...@@ -78,6 +79,7 @@
"NoOrganizationData":"The current system does not have any organization", "NoOrganizationData":"The current system does not have any organization",
"TaxpayerIdentificationNumber":"TaxpayerIdentificationNumber", "TaxpayerIdentificationNumber":"TaxpayerIdentificationNumber",
"AddOrganization":"Add Organization", "AddOrganization":"Add Organization",
"IsRequired": "Is Required",
"EditOrganization":"Edit Organization", "EditOrganization":"Edit Organization",
"OrganizationName":"Entity Name", "OrganizationName":"Entity Name",
"OrganizationNameRequired":"Entity Name Required", "OrganizationNameRequired":"Entity Name Required",
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
"DocumentAttr":"DocumentAttr", "DocumentAttr":"DocumentAttr",
"DocumentType":"DocumentType", "DocumentType":"DocumentType",
"DocumentName":"DocumentName", "DocumentName":"DocumentName",
"IsRequired":"Is Required",
"PleaseChecksRequired":"Please Checks Required",
"BusinessLine":"BusinessLine", "BusinessLine":"BusinessLine",
"CorporationName":"CorporationName", "CorporationName":"CorporationName",
"AvailabilityDate":"AvailabilityDate", "AvailabilityDate":"AvailabilityDate",
...@@ -45,6 +47,7 @@ ...@@ -45,6 +47,7 @@
"NoData":"NoData", "NoData":"NoData",
"PleaseSelected":"PleaseSelected", "PleaseSelected":"PleaseSelected",
"PleaseType":"PleaseType", "PleaseType":"PleaseType",
"Tips":"Tips",
"EntityStorageDescription":"EntityStorageDescription", "EntityStorageDescription":"EntityStorageDescription",
"multiUpload":"multiUpload", "multiUpload":"multiUpload",
"UploadAttach":"UploadAttach", "UploadAttach":"UploadAttach",
......
{ {
"DocumentAttr":"档案属性", "DocumentAttr":"档案属性",
"Document":"档案",
"IsRequired":"为必填字段,不能为空,请检查",
"PleaseChecksRequired":"请检查必填字段",
"DocumentType":"档案类型", "DocumentType":"档案类型",
"DocumentName":"档案名称", "DocumentName":"档案名称",
"BusinessLine":"业务线", "BusinessLine":"业务线",
...@@ -45,6 +48,7 @@ ...@@ -45,6 +48,7 @@
"NoData":"当前无数据可下载", "NoData":"当前无数据可下载",
"PleaseSelected":"请选择", "PleaseSelected":"请选择",
"PleaseType":"请输入", "PleaseType":"请输入",
"Tips":"提示讯息",
"EntityStorageDescription":"请将实物档案存放地址精确到某个档案柜", "EntityStorageDescription":"请将实物档案存放地址精确到某个档案柜",
"multiUpload":"批量上传", "multiUpload":"批量上传",
"UploadAttach":"上传附件", "UploadAttach":"上传附件",
......
...@@ -250,7 +250,14 @@ ...@@ -250,7 +250,14 @@
rowAlternationEnabled: true, //单双行颜色 rowAlternationEnabled: true, //单双行颜色
}; };
}; };
$scope.getTableHeight=function(){
var row_height=$("table").find("tr").height();
if(row_height){
return {
height:(row_height*12+100)+"px"
}
}
};
$scope.exportEventTrigger = function(){ $scope.exportEventTrigger = function(){
$(".dx-datagrid-export-button").click(); $(".dx-datagrid-export-button").click();
}; };
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
</div> </div>
<div style="padding:0 1rem;background:#fff"> <div style="padding:0 1rem;background:#fff">
<div class="dx-viewport demo-container"> <div class="dx-viewport demo-container">
<div id="gridContainer" dx-data-grid="dataGridOptions"></div> <div id="gridContainer" dx-data-grid="dataGridOptions" ng-style="getTableHeight()"></div>
</div> </div>
<!--<div class="form-group page-form-group">--> <!--<div class="form-group page-form-group">-->
......
...@@ -157,47 +157,45 @@ ...@@ -157,47 +157,45 @@
}) })
} }
$scope.upload = function() { $scope.upload = function(uploadType) {
if (!$scope.uploadFile || !$scope.uploadFile.file.name) { if (!$scope.uploadFile || !$scope.uploadFile.file.name) {
SweetAlert.warning($translate.instant('SelectUploadFileRequired')); SweetAlert.warning($translate.instant('SelectUploadFileRequired'));
return; return;
} }
$('#busy-indicator-container').show();
var deferred = $q.defer(); var deferred = $q.defer();
Upload.upload({ Upload.upload({
url: '/revenueConfMapping/upload', url: apiInterceptor.webApiHostUrl + '/revenueConfMapping/upload',
data: { data: {
type: $scope.uploadType, type: uploadType,
}, },
file: $scope.uploadFile.file, file: $scope.uploadFile.file,
// resumeChunkSize: resumable ? $scope.chunkSize : null, // resumeChunkSize: resumable ? $scope.chunkSize : null,
headers: { headers: {
'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Origin': '*',
Authorization: apiInterceptor.tokenType + ' ' + apiInterceptor.apiToken(), Authorization: apiInterceptor.tokenType + ' ' + apiInterceptor.apiToken(),
__RequestVerificationToken: token,
withCredentials: true withCredentials: true
}, },
__RequestVerificationToken: token,
withCredentials: true withCredentials: true
}).then(function(res) { }).then(function(res) {
$('#busy-indicator-container').hide(); $('#busy-indicator-container').hide();
deferred.resolve(); deferred.resolve();
if (res && 0 === res.code) { if (res && res.data && 0 === res.data.code) {
SweetAlert.success($translate.instant('ImportSuccess'));
$scope.refreshConfigGrid();
} else { } else {
SweetAlert.error($translate.instant('SystemError')); SweetAlert.error($translate.instant('SystemError'));
} }
}, function(resp) { }, function(resp) {
deferred.resolve(); deferred.resolve();
if (resp.statusText === 'HttpRequestValidationException') { if (resp.statusText === 'HttpRequestValidationException') {
SweetAlert.warning($translate.instant('HttpRequestValidationException')); SweetAlert.warning($translate.instant('HttpRequestValidationException'));
} else { } else {
SweetAlert.warning($translate.instant('SaveFail')); SweetAlert.warning($translate.instant('SaveFail'));
} }
$('#busy-indicator-container').hide();
console.log('Error status: ' + resp.status);
}, function(evt) { }, function(evt) {
deferred.resolve(); deferred.resolve();
var progressPercentage = parseInt(100.0 * evt.loaded / evt.total); var progressPercentage = parseInt(100.0 * evt.loaded / evt.total);
......
...@@ -11,9 +11,9 @@ ...@@ -11,9 +11,9 @@
<label class="control-label">文件:</label> <label class="control-label">文件:</label>
<input class="form-control" type="text" name="fileName" ng-model="uploadFile.file.name" readonly placeholder=""/> <input class="form-control" type="text" name="fileName" ng-model="uploadFile.file.name" readonly placeholder=""/>
<button type="button" type="file" ngf-select ng-model="uploadFile.file" accept=".xls,.xlsx" class="btn btn-secondary browse">{{'SelectFile' | translate }}</button> <button type="button" type="file" ngf-select ng-model="uploadFile.file" accept=".xls,.xlsx" class="btn btn-secondary browse">{{'SelectFile' | translate }}</button>
<button type="button" class="btn btn-secondary" translate="CoverImportBtn" ng-click="upload()"></button> <button type="button" class="btn btn-secondary" translate="CoverImportBtn" ng-click="upload(1)"></button>
<button type="button" class="btn btn-secondary" translate="AddImportBtn" ng-click="upload()"></button> <button type="button" class="btn btn-secondary" translate="AddImportBtn" ng-click="upload(2)"></button>
<button type="button" class="btn btn-in-grid inline-div" ng-click="downloadTemplate()"><i <button type="button" class="btn btn-in-grid inline-div" ng-click="downloadTemplate()"><i
class="fa fa-download" aria-hidden="true"></i>下载模板 class="fa fa-download" aria-hidden="true"></i>下载模板
</button> </button>
......
...@@ -265,6 +265,19 @@ taxDocumentManageModule.controller('taxDocumentListController', ...@@ -265,6 +265,19 @@ taxDocumentManageModule.controller('taxDocumentListController',
}, },
], ],
}; };
$scope.getTableHeight=function(){
var row_height=$("table").find("tr").height();
if(row_height && $scope.pagingOptions.pageSize==20){
return {
height:(row_height*12)+"px"
}
}else if(row_height && ($scope.pagingOptions.pageSize==50||$scope.pagingOptions.pageSize==100)){
return {
height:(row_height*12+55)+"px"
}
}else{
}
};
}; };
//弹出框 //弹出框
...@@ -340,7 +353,8 @@ taxDocumentManageModule.controller('taxDocumentListController', ...@@ -340,7 +353,8 @@ taxDocumentManageModule.controller('taxDocumentListController',
}); });
// data == true,代表可以直接上传,否则属于覆盖行为 // data == true,代表可以直接上传,否则属于覆盖行为
if (data == true) { //data.id===null|| data.id===undefined,代表可以直接上传,否则属于覆盖行为
if (data.id===null|| data.id===undefined) {
$scope.uploader.queue[0].url = apiInterceptor.webApiHostUrl + "/taxDoc/add"; $scope.uploader.queue[0].url = apiInterceptor.webApiHostUrl + "/taxDoc/add";
$scope.uploader.uploadItem(0); $scope.uploader.uploadItem(0);
$scope.isCoverOperation = false; $scope.isCoverOperation = false;
...@@ -348,6 +362,20 @@ taxDocumentManageModule.controller('taxDocumentListController', ...@@ -348,6 +362,20 @@ taxDocumentManageModule.controller('taxDocumentListController',
// $('#busy-indicator-container').show(); // $('#busy-indicator-container').show();
// addLogicAfterUploadFile($scope.editFieldModel,'simple'); // addLogicAfterUploadFile($scope.editFieldModel,'simple');
} else { } else {
//覆盖行为-需上传参数
for (var name in data) {
if((data[name]==null) || (name=='createTime'|| name=='updateTime' || name=='fileName'
|| name=='fileAttr' || name=='fileType'|| name=='fileTypeId' || name=='companyName'|| name=='companyId'
|| name=='taxType' || name=='ownTime' || name=='effectiveTime'|| name=='fileTime')){
continue;
}
if(name=='uploadTime'|| name=='fileTime'|| name=='effectiveTime'){
data[name] = $scope.getQueryDate(data[name], "/")
}
var cover_fields={};
cover_fields[name] = data[name];
uploadItem.formData.push(cover_fields);
}
SweetAlert.swal({ SweetAlert.swal({
title: '提示', title: '提示',
text: $translate.instant("CoverConfirm"), text: $translate.instant("CoverConfirm"),
...@@ -467,7 +495,6 @@ taxDocumentManageModule.controller('taxDocumentListController', ...@@ -467,7 +495,6 @@ taxDocumentManageModule.controller('taxDocumentListController',
$scope.uploader.clearQueue(); $scope.uploader.clearQueue();
$scope.multiUploadErrorItems.length = 0; $scope.multiUploadErrorItems.length = 0;
$scope.editFieldModel = {}; $scope.editFieldModel = {};
$scope.editFieldModel_multi = [];
}; };
var delRecord = function () { var delRecord = function () {
...@@ -672,214 +699,18 @@ taxDocumentManageModule.directive('fileUploader', function () { ...@@ -672,214 +699,18 @@ taxDocumentManageModule.directive('fileUploader', function () {
}] }]
} }
}); });
// taxDocumentManageModule.directive('multiFileUploader_bak', function () {
// restrict: "EA",
// controller: ['$scope', 'FileUploader', 'apiInterceptor', 'taxDocumentListService', '$translate', 'SweetAlert', '$compile',
// function ($scope, FileUploader, apiInterceptor, taxDocumentListService, $translate, SweetAlert, $compile) {
// var timer = null;
// $scope.activeTab = function (activeIndex) {
// $scope.editFieldModel_multi.forEach(function (item) {
// item.iShow = false;
// });
// $scope.editFieldModel_multi[activeIndex].iShow = true;
// };
//
// $scope.openMultiUploadPop = function () {
// timer = null;
// $("#multiUploadFilePlugin").click();
// $scope.multiUploader.clearQueue();
// $("#multiUploadFilePlugin").val(null);
// $scope.editFieldModel_multi.length = 0;
// // timer = setInterval(function () {
// // if ($scope.multiUploader.queue && $scope.multiUploader.queue.length > 0) {
// // $("#multiUploadPopDialog").modal("show");
// // console.log("is run times");
// // }
// // }, 500);
// };
//
// // 由于$watch无法监听$scope.multiUploader,暂时用循环来做
// // setInterval(function () {
// // if ($("#multiUploadPopDialog").is(":visible")) {
// // clearInterval(timer);
// // }
// // }, 500);
//
// $scope.multiUploader = new FileUploader({
// // url: "http://etms.longi-silicon.com:8180/api/v1/taxDoc/upload",
// // autoUpload: true,//添加后,自动上传
// headers: {"Authorization": apiInterceptor.tokenType + ' ' + apiInterceptor.apiToken()},
// // removeAfterUpload: true,
// });
// $scope.multiUploader.filters.push({//xls限制
// name: 'fileTypeFilter',
// fn: function (item, options) {
// if (item.name.indexOf("_") === -1) {
// SweetAlert.warning("文件名格式不符合规则,请重新选择(正确格式必须包含'公司名称'和'档案类型',并用下划线'_'分隔)");
// return false;
// }
// var fileNativePath = $("#multiUploadFilePlugin")[0].value || "";
// fileNativePath = fileNativePath.replace(/fakepath/img, "******");
// fileNativePath = fileNativePath.replace(item.name, "");
// // var splitMark = /\//.test(fileNativePath) ? "/" : "\\";
// // var prevPath = fileNativePath.split(splitMark);
// // prevPath.pop();
// // fileNativePath = prevPath.join(splitMark) + splitMark;
// var thisModel = {
// fileNativePath: fileNativePath,
// fileName: item.name,
// iShow: $scope.editFieldModel_multi.length === 0
// };
// $scope.autoMatchAttrAndType(item.name, thisModel);
// $scope.editFieldModel_multi.push(thisModel);
// // 根据需求,改为不做类型限制
// return true;
// }
// });
//
// $scope.multiUploader.onAfterAddingFile = function (item) {
// console.info("is added!", item);
// if($scope.editFieldModel_multi.length > 0){
// $("#multiUploadPopDialog").modal("show");
// }
// };
//
// $scope.multiUploadErrorItems = [];
// $scope.multiUploader.onErrorItem = function (fileItem) {
// $scope.multiUploadErrorItems.push(fileItem);
// console.info('onErrorItem', fileItem);
// };
// // $scope.multiUploader.onCancelItem = function(fileItem, response, status, headers) {
// // console.info('onCancelItem', fileItem, response, status, headers);
// // };
//
// $scope.multiUploadSuccessItems = [];
// $scope.multiUploader.onCompleteAll = function () {
//
// $("#uploadResultPop").modal("show");
//
// $('#multiUploadPopDialog').modal('hide');
//
// $('#busy-indicator-container').hide();
//
//
// };
//
// $scope.multiUploader.onSuccessItem = function (fileItem, response) {
// // fileItem.filePositionUrl = response;
// $scope.multiUploadSuccessItems.push(fileItem);
//
// $('#busy-indicator-container').show();
// };
//
// $scope.multiUploadSubmit = function () {
// $scope.multiUploadErrorItems = [];
// $scope.multiUploadSuccessItems = [];
//
// var alertContent = verifyRequiredFields($scope.editFieldModel_multi);
//
// if(!alertContent){
// multiUpload();
// }else{
// swal(alertContent);
// }
//
// function verifyRequiredFields(editFieldModel_multi){
//
// var alertText = "";
//
// for(var i = 0; i < editFieldModel_multi.length; i++){
// var modelItem = editFieldModel_multi[i];
// if(!modelItem.companyName){
// alertText += "【"+$translate.instant("CompanyName")+"】"
// }
// if(!modelItem.fileType){
// alertText += "【"+$translate.instant("DocumentType")+"】"
// }
// if(!modelItem.fileAttr){
// alertText += "【"+$translate.instant("DocumentAttr")+"】"
// }
// if(!modelItem.taxType){
// alertText += "【"+$translate.instant("DocumentType")+"】"
// }
// if(!modelItem.ownTime){
// alertText += "【"+$translate.instant("Duration")+"】"
// }
// if(!modelItem.fileTime){
// alertText += "【"+$translate.instant("AvailabilityDate")+"】"
// }
//
// if(alertText.length > 0){
// alertText = "档案" + (i + 1) + "," + alertText + "为必填字段,不能为空,请检查";
// break;
// }
// }
//
// return alertText;
// }
//
// function multiUpload(){
// for (var i = 0; i < $scope.multiUploader.queue.length; i++) {
//
// // 先设置uploader队列里每个文件的请求参数:fileOriginalName
// var fileItem = $scope.multiUploader.queue[i];
// fileItem.formData = [{
// fileOriginName: fileItem.name ? fileItem.name : fileItem._file.name
// }];
//
// // 过滤参数格式,并把参数推进上传队列
// var editFieldModel = $scope.editFieldModel_multi[i];
// Object.keys(editFieldModel).forEach(function (key) {
// var fields = {};
// var curItemValue = editFieldModel[key] ? editFieldModel[key] : "";
// if (/ownTime/.test(key)) {
// fields[key] = $scope.queryOwnTime(curItemValue, "int");
// } else {
// if (/(createTime|updateTime|uploadTime)/.test(key)) {
// fields[key] = $scope.getQueryDate(curItemValue, "/");
// } else fields[key] = curItemValue;
// }
// fileItem.formData.push(fields);
// });
//
//
// (function (_i, _fileItem, _editFieldModel, _taxDocumentListService, _multiUploader) {
//
// var params = angular.copy(_editFieldModel);
// // params.ownTime = params.ownTime ? params.ownTime : "";
// // params.ownTime = parseInt(_editFieldModel.ownTime.split("-").join(""));
// params.ownTime = $scope.queryOwnTime(params.ownTime, "int");
// params.fileTime = $scope.getQueryDate(params.fileTime, "-");
// params.effectiveTime = $scope.getQueryDate(params.effectiveTime, "-");
// _taxDocumentListService.verifyDuplicate(params).then(function (data) {
// if (data == true) {
// _fileItem.url = "http://etms.longi-silicon.com:8180//api/v1/taxDoc/add";
// } else {
// _fileItem.url = "http://etms.longi-silicon.com:8180//api/v1/taxDoc/edit";
// }
// _multiUploader.uploadItem(_i);
// });
// })(i, fileItem, editFieldModel, taxDocumentListService, $scope.multiUploader);
//
// }
// }
// };
//
// $scope.confirmUploadResult = function () {
// $('#uploadResultPop').modal('hide');
// $scope.loadMainData();
// };
// }]
// });
taxDocumentManageModule.directive('multiFileUploader', function () { taxDocumentManageModule.directive('multiFileUploader', function () {
return { return {
restrict: "EA", restrict: "EA",
controller: ['$scope', 'FileUploader', 'apiInterceptor', 'taxDocumentListService', '$translate', 'SweetAlert', '$compile', controller: ['$scope', 'FileUploader', 'apiInterceptor', 'taxDocumentListService', '$translate', 'SweetAlert', '$compile',
function ($scope, FileUploader, apiInterceptor, taxDocumentListService, $translate, SweetAlert, $compile) { function ($scope, FileUploader, apiInterceptor, taxDocumentListService, $translate, SweetAlert, $compile) {
$scope.editFieldModel_multi = [];
$scope.multiUploadErrorItems = []; $scope.multiUploadErrorItems = [];
$scope.multiUploadSuccessItems = []; $scope.multiUploadSuccessItems = [];
$scope.multiUploader = {}; $scope.multiUploader = {};
$scope.abandonFileCache = [];
$scope.uploadResultSuccessList = [];
$scope.activeTab = function (activeIndex) { $scope.activeTab = function (activeIndex) {
$scope.multiUploadErrorItems.forEach(function (item) { $scope.multiUploadErrorItems.forEach(function (item) {
item.iShow = false; item.iShow = false;
...@@ -894,37 +725,43 @@ taxDocumentManageModule.directive('multiFileUploader', function () { ...@@ -894,37 +725,43 @@ taxDocumentManageModule.directive('multiFileUploader', function () {
}; };
$scope.multiUploader = new FileUploader({ $scope.multiUploader = new FileUploader({
// url: "http://etms.longi-silicon.com:8180/api/v1/taxDoc/upload",
// autoUpload: true,//添加后,自动上传 // autoUpload: true,//添加后,自动上传
headers: {"Authorization": apiInterceptor.tokenType + ' ' + apiInterceptor.apiToken()}, headers: {"Authorization": apiInterceptor.tokenType + ' ' + apiInterceptor.apiToken()},
// removeAfterUpload: true, removeAfterUpload: true,
}); });
// $scope.multiUploader.filters.push({//xls限制 // $scope.multiUploader.filters.push({//xls限制
// name: 'fileTypeFilter', // name: 'fileTypeFilter',
// fn: function (item, options) { // fn: function (fileItem, options) {
// var result = true; // var result = true;
// return result;
// if(!result)$scope.unVerifyFileCache.push(fileItem);
// return result;
// } // }
// }); // });
$scope.multiUploader.onAfterAddingFile = function (item) {
console.info("is added!", item); $scope.multiUploader.onAfterAddingFile = function (fileItem) {
createFieldModel(fileItem);
};
function createFieldModel(fileItem){
var fileNativePath = $("#multiUploadFilePlugin")[0].value || ""; var fileNativePath = $("#multiUploadFilePlugin")[0].value || "";
fileNativePath = fileNativePath.replace(/fakepath/img, "******"); fileNativePath = fileNativePath.replace(/fakepath/img, "******");
fileNativePath = fileNativePath.replace(item.file.name, ""); fileNativePath = fileNativePath.replace(fileItem.file.name, "");
var thisModel = { var thisModel = {
fileNativePath: fileNativePath, fileNativePath: fileNativePath,
fileName: item.file.name, fileName: fileItem.file.name,
iShow: false, iShow: false,
abandon:false abandon:false,
}; };
$scope.autoMatchAttrAndType(item.file.name, thisModel); $scope.autoMatchAttrAndType(fileItem.file.name, thisModel);
$scope.isAbandonFileItem(thisModel); $scope.isAbandonFileItem(thisModel);
// if(thisModel.abandon){ if(thisModel.abandon){
// $scope.multiUploadErrorItems.push(thisModel) $scope.multiUploadErrorItems.push(thisModel);
// }else{ }else{
$scope.editFieldModel_multi.push(thisModel); $scope.multiUploadSuccessItems.push(thisModel);
// } }
}; }
//验证输入值是否都正确填充 //验证输入值是否都正确填充
//逻辑为:判断当前表单的必填值是否都已填充 //逻辑为:判断当前表单的必填值是否都已填充
...@@ -941,27 +778,82 @@ taxDocumentManageModule.directive('multiFileUploader', function () { ...@@ -941,27 +778,82 @@ taxDocumentManageModule.directive('multiFileUploader', function () {
} }
}; };
$scope.multiUploader.onSuccessItem = function (fileItem, response) {
var fieldModel = {};
fileItem.formData.forEach(function (formItem) {
Object.keys(formItem).forEach(function(key){
fieldModel[key] = formItem[key];
})
});
// $scope.multiUploadSuccessItems.push(fieldModel);
$scope.uploadResultSuccessList.push(fieldModel);
$('#busy-indicator-container').show();
};
$scope.multiUploader.onErrorItem = function (fileItem) { $scope.multiUploader.onErrorItem = function (fileItem) {
//todo 重新构造一个editModel //todo 重新构造一个editModel
var fieldModel = {}; var fieldModel = {};
fileItem.formData.forEach(function (formItem) { fileItem.formData.forEach(function (formItem) {
Object.keys(formItem).forEach(function(key){ Object.keys(formItem).forEach(function(key){
fieldModel[key] = formItem[key]; fieldModel[key] = formItem[key];
}) })
}); });
$scope.multiUploadErrorItems.push(fieldModel); // fieldModel.file = fileItem;
console.info('onErrorItem', fileItem); if(verifyFieldModelDup(fieldModel,$scope.multiUploadErrorItems) === -1){
$scope.multiUploadErrorItems.push(fieldModel);
}
var successDupIndex = verifyFieldModelDup(fieldModel,$scope.multiUploadSuccessItems);
if(successDupIndex > -1){
$scope.multiUploadSuccessItems.splice(successDupIndex,1);
}
$scope.abandonFileCache.push(fileItem);
}; };
function verifyFieldModelDup(fieldModel,uploadModelItems){
var dupIndex = -1;
uploadModelItems.forEach(function (modelItem,modelIndex) {
if(fieldModel.companyName === modelItem.companyName
&& fieldModel.fileType === modelItem.fileType
&& fieldModel.taxType === modelItem.taxType
&& fieldModel.ownTime === modelItem.ownTime
&& fieldModel.fileTime === modelItem.fileTime){
dupIndex = modelIndex;
}
});
return dupIndex;
}
// $scope.multiUploader.onCancelItem = function(fileItem, response, status, headers) { // $scope.multiUploader.onCancelItem = function(fileItem, response, status, headers) {
// console.info('onCancelItem', fileItem, response, status, headers); // console.info('onCancelItem', fileItem, response, status, headers);
// }; // };
$scope.multiUploader.onAfterAddingAll = function(){ $scope.multiUploader.onAfterAddingAll = function(){
$scope.multiUploadSubmit();
if($scope.multiUploadErrorItems.length){
$scope.abandonFileCache.length = 0;
$scope.multiUploadErrorItems.forEach(function (errItem) {
var queueLen = $scope.multiUploader.queue.length;
while(queueLen--){
var queueItem = $scope.multiUploader.queue[queueLen];
if(errItem.fileName === queueItem._file.name){
$scope.abandonFileCache.push(queueItem);
$scope.multiUploader.removeFromQueue(queueLen);
break;
}
}
});
}
if($scope.multiUploader.queue.length){
$scope.multiUploadSubmit_auto();
}else{
$("#uploadResultPop").modal("show");
}
}; };
$scope.multiUploadSubmit = function () { $scope.multiUploadSubmit_auto = function () {
for (var i = 0; i < $scope.multiUploader.queue.length; i++) { for (var i = 0; i < $scope.multiUploader.queue.length; i++) {
// 先设置uploader队列里每个文件的请求参数:fileOriginalName // 先设置uploader队列里每个文件的请求参数:fileOriginalName
...@@ -970,30 +862,12 @@ taxDocumentManageModule.directive('multiFileUploader', function () { ...@@ -970,30 +862,12 @@ taxDocumentManageModule.directive('multiFileUploader', function () {
fileOriginName: fileItem.name ? fileItem.name : fileItem._file.name fileOriginName: fileItem.name ? fileItem.name : fileItem._file.name
}]; }];
// 过滤参数格式,并把参数推进上传队列 var editFieldModel = $scope.multiUploadSuccessItems[i];
var editFieldModel = $scope.editFieldModel_multi[i];
if(editFieldModel.abandon){
$scope.multiUploadErrorItems.push(editFieldModel);
if($scope.multiUploadErrorItems.length === $scope.editFieldModel_multi.length){
$scope.multiUploadErrorItems[0].iShow = true;
$("#uploadResultPop").modal("show");
}
continue;
}
Object.keys(editFieldModel).forEach(function (key) { Object.keys(editFieldModel).forEach(function (key) {
var fields = {};
var curItemValue = editFieldModel[key] ? editFieldModel[key] : ""; var curItemValue = editFieldModel[key] ? editFieldModel[key] : "";
if (/ownTime/.test(key)) { fileItem.formData.push($scope.queryFileUploadData(key,curItemValue));
fields[key] = $scope.queryOwnTime(curItemValue, "int");
} else {
if (/(createTime|updateTime|uploadTime)/.test(key)) {
fields[key] = $scope.getQueryDate(curItemValue, "/");
} else fields[key] = curItemValue;
}
fileItem.formData.push(fields);
}); });
(function (_i, _fileItem, _editFieldModel, _taxDocumentListService, _multiUploader) { (function (_i, _fileItem, _editFieldModel, _taxDocumentListService, _multiUploader) {
var params = angular.copy(_editFieldModel); var params = angular.copy(_editFieldModel);
...@@ -1003,9 +877,24 @@ taxDocumentManageModule.directive('multiFileUploader', function () { ...@@ -1003,9 +877,24 @@ taxDocumentManageModule.directive('multiFileUploader', function () {
params.fileTime = $scope.getQueryDate(params.fileTime, "-"); params.fileTime = $scope.getQueryDate(params.fileTime, "-");
params.effectiveTime = $scope.getQueryDate(params.effectiveTime, "-"); params.effectiveTime = $scope.getQueryDate(params.effectiveTime, "-");
_taxDocumentListService.verifyDuplicate(params).then(function (data) { _taxDocumentListService.verifyDuplicate(params).then(function (data) {
if (data == true) { //data.id===null|| data.id===undefined,代表可以直接上传,否则属于覆盖行为
if (data.id===null|| data.id===undefined) {
_fileItem.url = apiInterceptor.webApiHostUrl + "/taxDoc/add"; _fileItem.url = apiInterceptor.webApiHostUrl + "/taxDoc/add";
} else { } else {
//覆盖行为-需上传参数
for (var name in data) {
if((data[name]==null) || (name=='createTime'|| name=='updateTime' || name=='fileName'
|| name=='fileAttr' || name=='fileType'|| name=='fileTypeId' || name=='companyName'|| name=='companyId'
|| name=='taxType' || name=='ownTime' || name=='effectiveTime'|| name=='fileTime')){
continue;
}
if(name=='uploadTime'|| name=='fileTime'|| name=='effectiveTime'){
data[name] = $scope.getQueryDate(data[name], "/")
}
var cover_fields={};
cover_fields[name] = data[name];
fileItem.formData.push(cover_fields);
}
_fileItem.url = apiInterceptor.webApiHostUrl + "/taxDoc/edit"; _fileItem.url = apiInterceptor.webApiHostUrl + "/taxDoc/edit";
} }
_multiUploader.uploadItem(_i); _multiUploader.uploadItem(_i);
...@@ -1017,30 +906,28 @@ taxDocumentManageModule.directive('multiFileUploader', function () { ...@@ -1017,30 +906,28 @@ taxDocumentManageModule.directive('multiFileUploader', function () {
$scope.multiUploader.onCompleteAll = function () { $scope.multiUploader.onCompleteAll = function () {
if($scope.multiUploadErrorItems.length) $scope.multiUploadErrorItems[0].iShow = true; if($scope.multiUploadErrorItems.length)
$scope.multiUploadErrorItems[0].iShow = true;
$("#uploadResultPop").modal("show"); if($scope.multiUploadErrorItems.length
|| $scope.uploadResultSuccessList.length)
$("#uploadResultPop").modal("show");
$('#busy-indicator-container').hide(); $('#busy-indicator-container').hide();
$scope.loadMainData(); $scope.loadMainData();
}; };
$scope.multiUploader.onSuccessItem = function (fileItem, response) {
// fileItem.filePositionUrl = response;
// fileItem.fileName = fileItem._file.name;
var fieldModel = {};
fileItem.formData.forEach(function (formItem) {
Object.keys(formItem).forEach(function(key){
fieldModel[key] = formItem[key];
})
});
$scope.multiUploadSuccessItems.push(fieldModel);
$('#busy-indicator-container').show();
};
$scope.confirmUploadResult = function () { $scope.confirmUploadResult = function () {
$scope.multiUploadSuccessItems.length = 0;
// 默认显示第一个
if($scope.multiUploadErrorItems.length){
$scope.multiUploadErrorItems.forEach(function (errorItem) {
errorItem.iShow = false;
});
$scope.multiUploadErrorItems[0].iShow = true;
}
$('#uploadResultPop').modal('hide'); $('#uploadResultPop').modal('hide');
$("#multiUploadPopDialog").modal("show"); $("#multiUploadPopDialog").modal("show");
}; };
...@@ -1051,13 +938,131 @@ taxDocumentManageModule.directive('multiFileUploader', function () { ...@@ -1051,13 +938,131 @@ taxDocumentManageModule.directive('multiFileUploader', function () {
}; };
function clearCache(){ function clearCache(){
$scope.uploadResultSuccessList.length = 0;
$scope.multiUploadErrorItems.length = 0; $scope.multiUploadErrorItems.length = 0;
$scope.multiUploadSuccessItems.length = 0; $scope.multiUploadSuccessItems.length = 0;
$scope.multiUploader.clearQueue(); $scope.multiUploader.clearQueue();
$scope.editFieldModel_multi.length = 0;
} }
$scope.multiUploadSubmit_handmade = function () {
var alertContent = verifyRequiredFields($scope.multiUploadErrorItems);
if(!alertContent){
exchangedFieldModel();
addFileItemToQueueFromCache();
$("#multiUploadPopDialog").modal("hide");
multiUpload_handmade();
}else{
swal(alertContent);
}
};
function addFileItemToQueueFromCache(){
$scope.abandonFileCache.forEach(function (fileItem) {
$scope.multiUploader.queue.push(fileItem);
});
$scope.abandonFileCache.length = 0;
}
function exchangedFieldModel(){
$scope.multiUploadErrorItems.forEach(function (errItem) {
$scope.multiUploadSuccessItems.push(errItem);
});
$scope.multiUploadErrorItems.length = 0;
}
function verifyRequiredFields(multiUploadErrorItems){
var alertText = "";
if(!$scope.requiredField.length){
return $translate.instant("PleaseChecksRequired");
}
//todo 先获取必填字段
for(var i = 0; i < multiUploadErrorItems.length; i++){
var modelItem = multiUploadErrorItems[i];
// $scope.isRequired = function (IT8nField) {
// return $scope.requiredField.indexOf($translate.instant(IT8nField)) > -1;
// };
if(!modelItem.companyName && $scope.isRequired($translate.instant("CompanyName"))){
alertText += "【"+$translate.instant("CompanyName")+"】"
}
if(!modelItem.fileType && $scope.isRequired($translate.instant("DocumentType"))){
alertText += "【"+$translate.instant("DocumentType")+"】"
}
if(!modelItem.fileAttr && $scope.isRequired($translate.instant("DocumentAttr"))){
alertText += "【"+$translate.instant("DocumentAttr")+"】"
}
if(!modelItem.taxType && $scope.isRequired($translate.instant("TaxType"))){
alertText += "【"+$translate.instant("TaxType")+"】"
}
if(!modelItem.ownTime && $scope.isRequired($translate.instant("Duration"))){
alertText += "【"+$translate.instant("Duration")+"】"
}
if(!modelItem.fileTime && $scope.isRequired($translate.instant("AvailabilityDate"))){
alertText += "【"+$translate.instant("AvailabilityDate")+"】"
}
if(!modelItem.effectiveTime && $scope.isRequired($translate.instant("DueDate"))){
alertText += "【"+$translate.instant("DueDate")+"】"
}
if(!modelItem.keeper && $scope.isRequired($translate.instant("EntityCustodian"))){
alertText += "【"+$translate.instant("EntityCustodian")+"】"
}
if(!modelItem.storageArea && $scope.isRequired($translate.instant("EntityStorageLocation"))){
alertText += "【"+$translate.instant("EntityStorageLocation")+"】"
}
if(!modelItem.physicalIndexNumber && $scope.isRequired($translate.instant("EntityIndex"))){
alertText += "【"+$translate.instant("EntityIndex")+"】"
}
if(!modelItem.remark && $scope.isRequired($translate.instant("Remarks"))){
alertText += "【"+$translate.instant("Remarks")+"】"
}
if(alertText.length > 0){
alertText = $translate.instant("Document") + (i + 1) + "," + alertText + $translate.instant("IsRequired");
break;
}
}
return alertText;
}
function multiUpload_handmade(){
for (var i = 0; i < $scope.multiUploader.queue.length; i++) {
// 过滤参数格式,并把参数推进上传队列
var fileItem = $scope.multiUploader.queue[i];
// 先设置uploader队列里每个文件的请求参数:fileOriginalName
fileItem.formData = [{
fileOriginName: fileItem.name ? fileItem.name : fileItem._file.name
}];
var editFieldModel = $scope.multiUploadSuccessItems[i];
Object.keys(editFieldModel).forEach(function (key) {
var curItemValue = editFieldModel[key] ? editFieldModel[key] : "";
fileItem.formData.push($scope.queryFileUploadData(key,curItemValue));
});
(function (_i, _fileItem, _editFieldModel, _taxDocumentListService, _multiUploader) {
var params = angular.copy(_editFieldModel);
params.ownTime = $scope.queryOwnTime(params.ownTime, "int");
params.fileTime = $scope.getQueryDate(params.fileTime, "-");
params.effectiveTime = $scope.getQueryDate(params.effectiveTime, "-");
_taxDocumentListService.verifyDuplicate(params).then(function (data) {
if (data == true) {
_fileItem.url = apiInterceptor.webApiHostUrl + "/taxDoc/add";
} else {
_fileItem.url = apiInterceptor.webApiHostUrl + "/taxDoc/edit";
}
_multiUploader.uploadItem(_i);
});
})(i, fileItem, editFieldModel, taxDocumentListService, $scope.multiUploader);
}
}
}] }]
} }
}); });
...@@ -1357,7 +1362,9 @@ taxDocumentManageModule.directive('helpPop', function () { ...@@ -1357,7 +1362,9 @@ taxDocumentManageModule.directive('helpPop', function () {
restrict: 'EA', restrict: 'EA',
controller: ['$scope', 'taxDocumentListService', '$translate', '$compile','SweetAlert', controller: ['$scope', 'taxDocumentListService', '$translate', '$compile','SweetAlert',
function ($scope, taxDocumentListService, $translate, $compile,SweetAlert) { function ($scope, taxDocumentListService, $translate, $compile,SweetAlert) {
$scope.openHelpPop = function () { $scope.curEditModel = null;
$scope.openHelpPop = function (curEditModel) {
$scope.curEditModel = curEditModel;
$scope.help_loadData(); $scope.help_loadData();
}; };
$scope.help_cacheData = {}; $scope.help_cacheData = {};
...@@ -1374,13 +1381,13 @@ taxDocumentManageModule.directive('helpPop', function () { ...@@ -1374,13 +1381,13 @@ taxDocumentManageModule.directive('helpPop', function () {
$scope.sniffHelpPopRadio = function(){ $scope.sniffHelpPopRadio = function(){
var checkedItem = $(".TDL-has-checked").children()[0].childNodes[0]; var checkedItem = $(".TDL-has-checked").children()[0].childNodes[0];
$scope.editFieldModel.fileAttr = checkedItem.getAttribute("data-fileAttr"); $scope.curEditModel.fileAttr = checkedItem.getAttribute("data-fileAttr");
taxDocumentListService.getDocumentsAttrAndType({params: {}}).then(function (data) { taxDocumentListService.getDocumentsAttrAndType({params: {}}).then(function (data) {
$scope.FileAttrAndTypeCache = data.items; $scope.FileAttrAndTypeCache = data.items;
//根据文件属性来匹配出 文件类型下拉列表 //根据文件属性来匹配出 文件类型下拉列表
$scope.syncFileType($scope.editFieldModel.fileAttr); $scope.syncFileType($scope.curEditModel.fileAttr);
$scope.editFieldModel.fileType = checkedItem.getAttribute("data-fileType"); $scope.curEditModel.fileType = checkedItem.getAttribute("data-fileType");
$scope.syncRequiredFields($scope.editFieldModel); $scope.syncRequiredFields($scope.curEditModel);
}); });
$("#helpPopDialog").modal("hide"); $("#helpPopDialog").modal("hide");
...@@ -1793,6 +1800,17 @@ taxDocumentManageModule.directive('tempModule', function () { ...@@ -1793,6 +1800,17 @@ taxDocumentManageModule.directive('tempModule', function () {
} }
return result; return result;
}; };
$scope.queryFileUploadData = function(key,curItemValue){
var fields = {};
if (/ownTime/.test(key)) {
fields[key] = $scope.queryOwnTime(curItemValue, "int");
} else {
if (/(createTime|updateTime|uploadTime)/.test(key)) {
fields[key] = $scope.getQueryDate(curItemValue, "/");
} else fields[key] = curItemValue;
}
return fields;
}
}] }]
} }
}); });
......
...@@ -633,7 +633,7 @@ ...@@ -633,7 +633,7 @@
</div> </div>
<div style="padding:0 1rem;background:#fff"> <div style="padding:0 1rem;background:#fff">
<div class="TDL-data-grid-container dx-viewport demo-container"> <div class="TDL-data-grid-container dx-viewport demo-container">
<div id="gridContainer" dx-data-grid="dataGridOptions"></div> <div id="gridContainer" dx-data-grid="dataGridOptions" ng-style="getTableHeight()"></div>
</div> </div>
<div class="form-group page-form-group"> <div class="form-group page-form-group">
<div class="page-footer"> <div class="page-footer">
......
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