Commit b47bd295 authored by eddie.woo's avatar eddie.woo

Merge branch 'dev_mysql' of http://code.tech.tax.asia.pwcinternal.com/root/atms into dev_mysql

parents ce7c2d92 603145f1
......@@ -65,6 +65,18 @@ public class FileTypesController {
return result;
}
/**
* 查询档案属性和档案类型给前端下拉选择框(可用)
* @return
*/
@PostMapping("/query4SelectionBoxEnable")
@ResponseBody
public Map<String,String> query4SelectionBoxEnable(){
List<FileTypes> fileTypes = fileTypesService.query4SelectionBoxEnable();
Map<String,String> result = fileTypes.stream().collect(Collectors.toMap(FileTypes::getFileType,FileTypes::getFileAttr));
return result;
}
/**
* 添加档案文件类型
* @param fileTypes
......
......@@ -19,10 +19,13 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import pwc.taxtech.atms.common.PageResultVo;
import pwc.taxtech.atms.common.util.DateUtils;
import pwc.taxtech.atms.constant.enums.FileUploadEnum;
import pwc.taxtech.atms.dto.TaxDocumentDto;
import pwc.taxtech.atms.entity.TaxDocument;
import pwc.taxtech.atms.service.impl.DidiFileUploadService;
import pwc.taxtech.atms.service.impl.TaxDocumentServiceImpl;
import pwc.taxtech.atms.thirdparty.ExcelUtil;
import pwc.taxtech.atms.vat.entity.FileUpload;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
......@@ -39,6 +42,8 @@ public class TaxDocumentController {
@Autowired
private TaxDocumentServiceImpl taxDocumentService;
@Autowired
private DidiFileUploadService didiFileUploadService;
@PostMapping("selectList")
@ResponseBody
public PageResultVo<TaxDocument> selectTaxDocumentList(@RequestBody TaxDocumentDto taxDocumentDto) {
......@@ -51,14 +56,15 @@ public class TaxDocumentController {
@PostMapping("/queryWhetherData")
@ResponseBody
public boolean queryWhetherData(@RequestBody TaxDocument taxDocument) {
public TaxDocument queryWhetherData(@RequestBody TaxDocument taxDocument) {
return taxDocumentService.queryWhetherData(taxDocument);
}
@PostMapping("add")
@ResponseBody
public boolean addTaxDocument(TaxDocument taxDocument,
@RequestParam("file") MultipartFile file) {
public boolean addTaxDocument(@RequestParam(value = "file") MultipartFile file,
@RequestParam(required = false) String modual,
TaxDocument taxDocument) {
return taxDocumentService.addTaxDocumentList(file,taxDocument);
}
......@@ -76,11 +82,17 @@ public class TaxDocumentController {
@PostMapping("edit")
@ResponseBody
public boolean editTaxDocument( TaxDocument taxDocument) {
public boolean editTaxDocument(TaxDocument taxDocument,
@RequestParam(value = "file",required = false) 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);
}
@RequestMapping("exportExcel")
@ResponseBody
public void exportExcelFile(HttpServletResponse response, @RequestBody TaxDocumentDto taxDocumentDto) {
......
......@@ -160,4 +160,7 @@ public class FileTypesServiceImpl {
fileTypes.setRequiredFieldJson(requiredFieldJson);
}
}
public List<FileTypes> query4SelectionBoxEnable() {
return fileTypesMapper.query4SelectionBoxEnable();
}
}
......@@ -12,6 +12,7 @@ import org.apache.poi.ss.usermodel.WorkbookFactory;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import pwc.taxtech.atms.common.CommonUtils;
import pwc.taxtech.atms.common.POIUtil;
import pwc.taxtech.atms.dpo.OrgCodeIdDto;
import pwc.taxtech.atms.dpo.OrgSelectDto;
import pwc.taxtech.atms.dto.revenuconf.RevTypeAddDto;
......@@ -108,9 +109,10 @@ public class RevenueTypeMappingService extends BaseService {
Sheet sheet = workbook.getSheetAt(0);
List<RevenueTypeMapping> list = new ArrayList<>();
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);
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();
if (!optional.isPresent()) {
continue;
......@@ -118,16 +120,24 @@ public class RevenueTypeMappingService extends BaseService {
RevenueTypeMapping mapping = new RevenueTypeMapping();
mapping.setId(idService.nextId());
mapping.setOrgId(optional.get().getId());
mapping.setOuName(StringUtils.defaultString(row.getCell(1).getStringCellValue()));
mapping.setContent(StringUtils.defaultString(row.getCell(2).getStringCellValue()));
mapping.setTaxRate(new BigDecimal(row.getCell(3).getNumericCellValue()));
mapping.setRevenueTypeName(StringUtils.defaultString(row.getCell(4).getStringCellValue()));
mapping.setStartDate(StringUtils.defaultString(row.getCell(5).getStringCellValue()));
mapping.setEndDate(StringUtils.defaultString(row.getCell(6).getStringCellValue(), DEFAULT_END_DATE));
orgIds.add(optional.get().getId());
mapping.setOuName(POIUtil.getCellFormulaString(row.getCell(1)));
mapping.setContent(POIUtil.getCellFormulaString(row.getCell(2)));
mapping.setTaxRate(new BigDecimal(POIUtil.getCellFormulaString(row.getCell(3))));
mapping.setRevenueTypeName(POIUtil.getCellFormulaString(row.getCell(4)));
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);
}
if (1 == type) {
//todo 覆盖导入 具体覆盖哪些
if(CollectionUtils.isNotEmpty(orgIds)){
RevenueTypeMappingExample delExample = new RevenueTypeMappingExample();
delExample.createCriteria().andOrgIdIn(orgIds);
typeMappingMapper.deleteByExample(delExample);
}
}
if (!CollectionUtils.isEmpty(list)) {
List<List<RevenueTypeMapping>> batchList = CommonUtils.subListWithLen(list, CommonUtils.BATCH_NUM_2000);
......
......@@ -161,6 +161,7 @@ public class TaxDocumentServiceImpl {
if (StringUtils.isNotBlank(taxDocumentDto.getCreator())) {
criteria.andCreatorLike("%" + taxDocumentDto.getCreator() + "%");
}
example.setOrderByClause("create_time DESC");
return example;
}
......@@ -331,7 +332,7 @@ public class TaxDocumentServiceImpl {
* @param taxDocument
* @return
*/
public boolean queryWhetherData(TaxDocument taxDocument) {
public TaxDocument queryWhetherData(TaxDocument taxDocument) {
try {
//简单参数校验
/* if (StringUtils.isAnyBlank(taxDocumentDto.getFileAttr(), taxDocumentDto.getFileName(),
......@@ -347,12 +348,12 @@ public class TaxDocumentServiceImpl {
criteria.andOwnTimeEqualTo(taxDocument.getOwnTime());
List<TaxDocument> taxDocuments = taxDocumentMapper.selectByExample(taxDocumentExample);
if (null != taxDocuments && taxDocuments.size() > 0) {
return false;
return taxDocuments.get(0);
}
return true;
return new TaxDocument();
} catch (Exception e) {
// log.error("TaxDocumentServiceImpl queryWhetherData error :" + e.getMessage());
return false;
return new TaxDocument();
}
}
public void downloadAllFile(HttpServletResponse response, List<Long> ids) {
......
......@@ -144,7 +144,7 @@ public class TBM extends FunctionBase implements FreeRefFunction {
dto.setAmount(balance.getEndBalBeq().multiply(new BigDecimal(-1)));
}
}
amount.add(dto.getAmount());
amount = amount.add(dto.getAmount());
dto.setPeriod(period);
dto.setIsOnlyManualInput(Boolean.FALSE);
dto.setName(Constant.DataSourceName.ReportDataSource);
......@@ -182,7 +182,7 @@ public class TBM extends FunctionBase implements FreeRefFunction {
dto.setAmount(balance.getEndBalBeq().multiply(new BigDecimal(-1)));
}
}
amount.add(dto.getAmount());
amount = amount.add(dto.getAmount());
dto.setPeriod(period);
dto.setIsOnlyManualInput(Boolean.FALSE);
dto.setName(Constant.DataSourceName.ReportDataSource);
......
......@@ -108,4 +108,6 @@ public interface FileTypesMapper extends MyMapper {
int updateByPrimaryKey(FileTypes record);
List<FileTypes> query4SelectionBox();
List<FileTypes> query4SelectionBoxEnable();
}
\ No newline at end of file
package pwc.taxtech.atms.vat.entity;
import pwc.taxtech.atms.entity.BaseEntity;
import java.io.Serializable;
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 {
*/
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.
......@@ -370,101 +335,6 @@ public class RevenueTypeMapping extends BaseEntity implements Serializable {
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.
......@@ -487,10 +357,6 @@ public class RevenueTypeMapping extends BaseEntity implements Serializable {
sb.append(", startDate=").append(startDate);
sb.append(", endDate=").append(endDate);
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("]");
return sb.toString();
}
......
......@@ -400,6 +400,13 @@
</select>
<select id="query4SelectionBox" resultMap="BaseResultMap">
SELECT
id,file_attr, file_type
FROM file_types
ORDER BY file_attr
</select>
<select id="query4SelectionBoxEnable" resultMap="BaseResultMap">
SELECT
id,file_attr, file_type
FROM file_types
......
......@@ -414,38 +414,23 @@
</if>
</select>
<insert id="batchInsert" parameterType="pwc.taxtech.atms.vat.entity.RevenueTypeMapping">
insert into revenue_type_mapping (id, org_id, ou_name,
content, tax_rate, revenue_type_name,
start_date, end_date, `status`
<if test="createBy != null">
,create_by
</if>
<if test="updateBy != null">
,update_by
</if>
<if test="createTime != null">
,create_time
</if>
<if test="updateTime != null">
,update_time
</if>) values
<foreach collection="list" item="item" index="index" separator=",">
(#{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>)
<insert id="batchInsert">
insert into revenue_type_mapping
(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
<foreach collection="list" item="item" index="index" separator=",">
(#{item.id},
#{item.orgId},
#{item.ouName},
#{item.content},
#{item.taxRate},
#{item.revenueTypeName},
#{item.startDate},
#{item.endDate},
#{item.status,jdbcType=TINYINT},
#{item.createBy},
#{item.updateBy},
#{item.createTime},
#{item.updateTime})
</foreach>
</insert>
......
......@@ -71,6 +71,7 @@
"AssignRoleCol" : "分配角色",
"SequenceNoCol":"序号",
"DocumentID":"Doc ID",
"Document":"Document",
"TaxGroup":"税种",
"ReportTemplate":"Report Template",
......@@ -78,6 +79,7 @@
"NoOrganizationData":"The current system does not have any organization",
"TaxpayerIdentificationNumber":"TaxpayerIdentificationNumber",
"AddOrganization":"Add Organization",
"IsRequired": "Is Required",
"EditOrganization":"Edit Organization",
"OrganizationName":"Entity Name",
"OrganizationNameRequired":"Entity Name Required",
......
......@@ -2,6 +2,8 @@
"DocumentAttr":"DocumentAttr",
"DocumentType":"DocumentType",
"DocumentName":"DocumentName",
"IsRequired":"Is Required",
"PleaseChecksRequired":"Please Checks Required",
"BusinessLine":"BusinessLine",
"CorporationName":"CorporationName",
"AvailabilityDate":"AvailabilityDate",
......@@ -45,6 +47,7 @@
"NoData":"NoData",
"PleaseSelected":"PleaseSelected",
"PleaseType":"PleaseType",
"Tips":"Tips",
"EntityStorageDescription":"EntityStorageDescription",
"multiUpload":"multiUpload",
"UploadAttach":"UploadAttach",
......
{
"DocumentAttr":"档案属性",
"Document":"档案",
"IsRequired":"为必填字段,不能为空,请检查",
"PleaseChecksRequired":"请检查必填字段",
"DocumentType":"档案类型",
"DocumentName":"档案名称",
"BusinessLine":"业务线",
......@@ -45,6 +48,7 @@
"NoData":"当前无数据可下载",
"PleaseSelected":"请选择",
"PleaseType":"请输入",
"Tips":"提示讯息",
"EntityStorageDescription":"请将实物档案存放地址精确到某个档案柜",
"multiUpload":"批量上传",
"UploadAttach":"上传附件",
......
......@@ -250,7 +250,14 @@
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(){
$(".dx-datagrid-export-button").click();
};
......
......@@ -41,7 +41,7 @@
</div>
<div style="padding:0 1rem;background:#fff">
<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 class="form-group page-form-group">-->
......@@ -110,7 +110,7 @@
</div>
<!--描述-->
<div class="form-group">
<label for="Description" class="col-sm-3 control-label">
<label for="Description" class="col-sm-3 control-label edit-panel-left-part">
<span translate="DescriptionWithOutColon"></span>
</label>
<div class="col-sm-11" style="width:61.67%">
......@@ -140,7 +140,7 @@
</div>
<!--备注-->
<div class="form-group">
<label for="Remarks" class="col-sm-3 control-label" translate="Remarks"></label>
<label for="Remarks" class="col-sm-3 control-label edit-panel-left-part" translate="Remarks"></label>
<div class="col-sm-11" style="width:61.67%">
<input class="form-control" id="Remarks"
ng-model="editModel.remarks"
......@@ -151,7 +151,7 @@
<!--状态-->
<div class="form-group">
<label class="col-sm-3 control-label">
<label class="col-sm-3 control-label edit-panel-left-part">
<span translate="State"></span>
</label>
<div class="col-sm-11" style="width:61.67%" >
......@@ -182,10 +182,19 @@
</div>
<div class="modal-footer">
<!--<div class="modal-footer">
<button type="submit" class="btn btn-primary" translate="Confirm"
></button><!--ng-disabled="newDocFileTypeForm.roleName.$invalid || newDocFileTypeForm.service_id.$invalid"-->
></button>&lt;!&ndash;ng-disabled="newDocFileTypeForm.roleName.$invalid || newDocFileTypeForm.service_id.$invalid"&ndash;&gt;
<button type="button" class="btn btn-third" data-dismiss="modal" ng-click="cancelDocFileType()" translate="Cancel"></button>
</div>-->
<div>
<center>
<button type="submit" class="btn btn-primary" translate="Confirm"
></button>
<!--ng-disabled="newDocFileTypeForm.roleName.$invalid || newDocFileTypeForm.service_id.$invalid"-->
<button type="button" class="btn btn-third" data-dismiss="modal"
ng-click="cancelDocFileType()" translate="Cancel"></button>
</center>
</div>
</form>
</div>
......
......@@ -157,47 +157,45 @@
})
}
$scope.upload = function() {
$scope.upload = function(uploadType) {
if (!$scope.uploadFile || !$scope.uploadFile.file.name) {
SweetAlert.warning($translate.instant('SelectUploadFileRequired'));
return;
}
$('#busy-indicator-container').show();
var deferred = $q.defer();
Upload.upload({
url: '/revenueConfMapping/upload',
url: apiInterceptor.webApiHostUrl + '/revenueConfMapping/upload',
data: {
type: $scope.uploadType,
type: uploadType,
},
file: $scope.uploadFile.file,
// resumeChunkSize: resumable ? $scope.chunkSize : null,
headers: {
'Access-Control-Allow-Origin': '*',
Authorization: apiInterceptor.tokenType + ' ' + apiInterceptor.apiToken(),
__RequestVerificationToken: token,
withCredentials: true
},
__RequestVerificationToken: token,
withCredentials: true
}).then(function(res) {
$('#busy-indicator-container').hide();
deferred.resolve();
if (res && 0 === res.code) {
if (res && res.data && 0 === res.data.code) {
SweetAlert.success($translate.instant('ImportSuccess'));
$scope.refreshConfigGrid();
} else {
SweetAlert.error($translate.instant('SystemError'));
}
}, function(resp) {
deferred.resolve();
if (resp.statusText === 'HttpRequestValidationException') {
SweetAlert.warning($translate.instant('HttpRequestValidationException'));
} else {
SweetAlert.warning($translate.instant('SaveFail'));
}
console.log('Error status: ' + resp.status);
$('#busy-indicator-container').hide();
}, function(evt) {
deferred.resolve();
var progressPercentage = parseInt(100.0 * evt.loaded / evt.total);
......
......@@ -11,9 +11,9 @@
<label class="control-label">文件:</label>
<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" 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
class="fa fa-download" aria-hidden="true"></i>下载模板
</button>
......
......@@ -573,6 +573,11 @@
showBorders: true,
paging: {
pageSize: 10
},
pager: {
//showPageSizeSelector: true,
// allowedPageSizes: [5, 10, 20],
showInfo: true
},
columns: [
{
......
......@@ -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',
});
// 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.uploadItem(0);
$scope.isCoverOperation = false;
......@@ -348,6 +362,20 @@ taxDocumentManageModule.controller('taxDocumentListController',
// $('#busy-indicator-container').show();
// addLogicAfterUploadFile($scope.editFieldModel,'simple');
} 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({
title: '提示',
text: $translate.instant("CoverConfirm"),
......@@ -467,7 +495,6 @@ taxDocumentManageModule.controller('taxDocumentListController',
$scope.uploader.clearQueue();
$scope.multiUploadErrorItems.length = 0;
$scope.editFieldModel = {};
$scope.editFieldModel_multi = [];
};
var delRecord = 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 () {
return {
restrict: "EA",
controller: ['$scope', 'FileUploader', 'apiInterceptor', 'taxDocumentListService', '$translate', 'SweetAlert', '$compile',
function ($scope, FileUploader, apiInterceptor, taxDocumentListService, $translate, SweetAlert, $compile) {
$scope.editFieldModel_multi = [];
$scope.multiUploadErrorItems = [];
$scope.multiUploadSuccessItems = [];
$scope.multiUploader = {};
$scope.abandonFileCache = [];
$scope.uploadResultSuccessList = [];
$scope.activeTab = function (activeIndex) {
$scope.multiUploadErrorItems.forEach(function (item) {
item.iShow = false;
......@@ -894,37 +725,43 @@ taxDocumentManageModule.directive('multiFileUploader', function () {
};
$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,
removeAfterUpload: true,
});
// $scope.multiUploader.filters.push({//xls限制
// name: 'fileTypeFilter',
// fn: function (item, options) {
// var result = true;
// return result;
// fn: function (fileItem, options) {
// var result = true;
// 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 || "";
fileNativePath = fileNativePath.replace(/fakepath/img, "******");
fileNativePath = fileNativePath.replace(item.file.name, "");
fileNativePath = fileNativePath.replace(fileItem.file.name, "");
var thisModel = {
fileNativePath: fileNativePath,
fileName: item.file.name,
fileName: fileItem.file.name,
iShow: false,
abandon:false
abandon:false,
};
$scope.autoMatchAttrAndType(item.file.name, thisModel);
$scope.autoMatchAttrAndType(fileItem.file.name, thisModel);
$scope.isAbandonFileItem(thisModel);
// if(thisModel.abandon){
// $scope.multiUploadErrorItems.push(thisModel)
// }else{
$scope.editFieldModel_multi.push(thisModel);
// }
};
if(thisModel.abandon){
$scope.multiUploadErrorItems.push(thisModel);
}else{
$scope.multiUploadSuccessItems.push(thisModel);
}
}
//验证输入值是否都正确填充
//逻辑为:判断当前表单的必填值是否都已填充
......@@ -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) {
//todo 重新构造一个editModel
var fieldModel = {};
fileItem.formData.forEach(function (formItem) {
Object.keys(formItem).forEach(function(key){
fieldModel[key] = formItem[key];
})
});
$scope.multiUploadErrorItems.push(fieldModel);
console.info('onErrorItem', fileItem);
// fieldModel.file = 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) {
// console.info('onCancelItem', fileItem, response, status, headers);
// };
$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++) {
// 先设置uploader队列里每个文件的请求参数:fileOriginalName
......@@ -970,30 +862,12 @@ taxDocumentManageModule.directive('multiFileUploader', function () {
fileOriginName: fileItem.name ? fileItem.name : fileItem._file.name
}];
// 过滤参数格式,并把参数推进上传队列
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;
}
var editFieldModel = $scope.multiUploadSuccessItems[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);
fileItem.formData.push($scope.queryFileUploadData(key,curItemValue));
});
(function (_i, _fileItem, _editFieldModel, _taxDocumentListService, _multiUploader) {
var params = angular.copy(_editFieldModel);
......@@ -1003,9 +877,24 @@ taxDocumentManageModule.directive('multiFileUploader', function () {
params.fileTime = $scope.getQueryDate(params.fileTime, "-");
params.effectiveTime = $scope.getQueryDate(params.effectiveTime, "-");
_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";
} 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";
}
_multiUploader.uploadItem(_i);
......@@ -1017,30 +906,28 @@ taxDocumentManageModule.directive('multiFileUploader', 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();
$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.multiUploadSuccessItems.length = 0;
// 默认显示第一个
if($scope.multiUploadErrorItems.length){
$scope.multiUploadErrorItems.forEach(function (errorItem) {
errorItem.iShow = false;
});
$scope.multiUploadErrorItems[0].iShow = true;
}
$('#uploadResultPop').modal('hide');
$("#multiUploadPopDialog").modal("show");
};
......@@ -1051,13 +938,146 @@ taxDocumentManageModule.directive('multiFileUploader', function () {
};
function clearCache(){
$scope.uploadResultSuccessList.length = 0;
$scope.multiUploadErrorItems.length = 0;
$scope.multiUploadSuccessItems.length = 0;
$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) {
//data.id===null|| data.id===undefined,代表可以直接上传,否则属于覆盖行为
if (data.id===null|| data.id===undefined) {
_fileItem.url = apiInterceptor.webApiHostUrl + "/taxDoc/add";
} 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";
}
_multiUploader.uploadItem(_i);
});
})(i, fileItem, editFieldModel, taxDocumentListService, $scope.multiUploader);
}
}
}]
}
});
......@@ -1357,7 +1377,9 @@ taxDocumentManageModule.directive('helpPop', function () {
restrict: 'EA',
controller: ['$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_cacheData = {};
......@@ -1374,13 +1396,13 @@ taxDocumentManageModule.directive('helpPop', function () {
$scope.sniffHelpPopRadio = function(){
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) {
$scope.FileAttrAndTypeCache = data.items;
//根据文件属性来匹配出 文件类型下拉列表
$scope.syncFileType($scope.editFieldModel.fileAttr);
$scope.editFieldModel.fileType = checkedItem.getAttribute("data-fileType");
$scope.syncRequiredFields($scope.editFieldModel);
$scope.syncFileType($scope.curEditModel.fileAttr);
$scope.curEditModel.fileType = checkedItem.getAttribute("data-fileType");
$scope.syncRequiredFields($scope.curEditModel);
});
$("#helpPopDialog").modal("hide");
......@@ -1594,6 +1616,8 @@ taxDocumentManageModule.directive('tempModule', function () {
$scope.typeAndAttrMap = {};
$scope.fileTypeOptions = [];
$scope.fileAttrOptions = [];
$scope.fileTypeEnableOptions = [];
$scope.fileAttrEnableOptions = [];
$scope.curFileTypeOptions = [];
$scope.companyNameOptionsMap = {};
$scope.loadSelectMap = function () {
......@@ -1645,7 +1669,58 @@ taxDocumentManageModule.directive('tempModule', function () {
});
};
//加载可用的档案属性
$scope.loadSelectEnableMap = function () {
taxDocumentListService.getFileInfoEnableOptions().then(function (data) {
// console.log(data);
if (data) {
$scope.typeAndAttrMap = data;
// 抽取每个元素的头一个字串,用于排序;
// $scope.fileTypeEnableOptions = $scope.sortByFirstCode(Object.keys(data));
// $scope.fileAttrEnableOptions = $scope.sortByFirstCode(Object.values(data));
$scope.fileTypeEnableOptions = Object.keys(data);
$scope.fileAttrEnableOptions = Object.values(data);
// 过滤去重
var temp = $scope.fileTypeEnableOptions;
$scope.fileTypeEnableOptions = (function(){
var result = [];
temp.forEach(function(typeItem){
if(result.indexOf(typeItem) === -1){
result.push(typeItem);
}
});
return result;
})();
$scope.fileTypeEnableOptions.sort();
temp = $scope.fileAttrEnableOptions;
$scope.fileAttrEnableOptions = (function(){
var result = [];
temp.forEach(function(attrItem){
if(result.indexOf(attrItem) === -1){
result.push(attrItem);
}
});
return result;
})();
$scope.fileAttrEnableOptions.sort();
}
});
taxDocumentListService.getCompanyNameOptions().then(function(res){
if (res && 0 === res.code) {
angular.forEach(res.data, function (item) {
$scope.companyNameOptionsMap[item.id]=item.name;
});
} else {
SweetAlert.error($translate.instant('RevenueGetOrgError'));
}
});
};
$scope.loadSelectMap();
$scope.loadSelectEnableMap();
$scope.businessLineOptions = [];
$scope.loadBusinessList = function(){
taxDocumentListService.getBusinessList().then(function(resData){
......@@ -1793,6 +1868,18 @@ taxDocumentManageModule.directive('tempModule', function () {
}
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 @@
</div>
<div style="padding:0 1rem;background:#fff">
<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 class="form-group page-form-group">
<div class="page-footer">
......@@ -704,7 +704,7 @@
ng-change="syncFileType(editFieldModel.fileAttr)"
class="form-control"
required placeholder="{{'PleaseSelected' | translate}}">
<option ng-repeat="fileAttr in fileAttrOptions track by $index"
<option ng-repeat="fileAttr in fileAttrEnableOptions track by $index"
ng-selected="(editFieldModel.fileAttr == fileAttr)"
value="{{fileAttr}}">{{fileAttr}}
</option>
......@@ -712,7 +712,7 @@
</div>
<div class="DTL-special-external-btn" title="查看类型列表">
<a href="javascript:void(0)" ng-click="openHelpPop()">
<a href="javascript:void(0)" ng-click="openHelpPop(editFieldModel)">
<i class="fa fake-question-circle" aria-hidden="true"></i>
</a>
</div>
......@@ -913,7 +913,6 @@
<input class="form-control" title="{{editFieldItem.fileNativePath}}"
placeholder="{{'PleaseSelected' | translate}}"
ng-class="{'upload-fail-mark':!editFieldItem.fileNativePath && editFieldItem.fileNativePath != 0}"
readonly disabled
ng-model="editFieldItem.fileNativePath"/>
<!--<input id="{{multiUploadFilePlugin}}" type="file" style="display:none" nv-file-select uploader="uploader" filters="fileTypeFilter">-->
</div>
......@@ -930,8 +929,8 @@
<input class="form-control"
ng-class="{'upload-fail-mark':!editFieldItem.fileName && editFieldItem.fileName != 0}"
title="{{editFieldItem.fileName}}"
placeholder="{{'PleaseType' | translate}}" disabled
ng-model="editFieldItem.fileName" readonly/>
placeholder="{{'PleaseType' | translate}}"
ng-model="editFieldItem.fileName"/>
</div>
</div>
<div class="col-sm-6 form-group">
......@@ -942,8 +941,8 @@
<div class="col-sm-11" style="width:61.67%">
<select ng-model="editFieldItem.fileAttr"
ng-class="{'upload-fail-mark':!editFieldItem.fileAttr}"
ng-change="syncFileType(editFieldItem.fileAttr)" disabled
class="form-control" readonly placeholder="{{'PleaseSelected' | translate}}">
ng-change="syncFileType(editFieldItem.fileAttr)"
class="form-control" placeholder="{{'PleaseSelected' | translate}}">
<option ng-repeat="fileAttr in fileAttrOptions track by $index"
ng-selected="(editFieldItem.fileAttr == fileAttr)"
value="{{fileAttr}}">{{fileAttr}}
......@@ -951,10 +950,10 @@
</select>
</div>
<!--<div class="DTL-special-external-btn" title="查看类型列表">
<a href="javascript:void(0)" ng-click="openHelpPop()"><i
<div class="DTL-special-external-btn" title="查看类型列表">
<a href="javascript:void(0)" ng-click="openHelpPop(editFieldItem)"><i
class="fa fake-question-circle" aria-hidden="true"></i></a>
</div>-->
</div>
</div>
<div class="col-sm-6 form-group">
<label class="col-sm-3 control-label edit-panel-left-part">
......@@ -963,7 +962,7 @@
</label>
<div class="col-sm-11" style="width:61.67%">
<select ng-model="editFieldItem.companyName" class="form-control"
title="{{editFieldItem.companyName}}" readonly disabled
title="{{editFieldItem.companyName}}"
ng-class="{'upload-fail-mark':!editFieldItem.companyName}"
ng-change="matchCompanyId(editFieldItem,companyNameOptionsMap)"
placeholder="{{'PleaseSelected' | translate}}">
......@@ -982,8 +981,9 @@
</label>
<div class="col-sm-11" style="width:61.67%">
<select ng-model="editFieldItem.fileType"
ng-disabled="curFileTypeOptions.length === 0"
ng-change="syncRequiredFields(editFieldItem)"
class="form-control" readonly disabled
class="form-control"
ng-class="{'upload-fail-mark':!editFieldItem.fileType}"
placeholder="{{'PleaseSelected' | translate}}">
<option ng-repeat="fileType in curFileTypeOptions track by $index"
......@@ -1000,7 +1000,7 @@
</label>
<div class="col-sm-11" style="width:61.67%">
<select ng-model="editFieldItem.taxType"
class="form-control" readonly disabled
class="form-control"
ng-required="isRequired('TaxType')"
ng-class="{'upload-fail-mark':isRequired('TaxType') && !editFieldItem.taxType}"
placeholder="{{'PleaseSelected' | translate}}">
......@@ -1020,7 +1020,7 @@
<input type='text' placeholder="{{'PleaseSelected' | translate}}"
date-time-picker data-date-format="yyyy/mm"
ng-class="{'upload-fail-mark':!editFieldItem.ownTime}"
class="form-control" ng-model="editFieldItem.ownTime" readonly disabled
class="form-control" ng-model="editFieldItem.ownTime"
data-min-view-mode="1"/>
</div>
</div>
......@@ -1032,7 +1032,7 @@
<div class="col-sm-11" style="width:61.67%">
<input type='text' placeholder="{{'PleaseSelected' | translate}}"
ng-class="{'upload-fail-mark':isRequired('AvailabilityDate') && !editFieldItem.fileTime}"
date-time-picker data-date-format="yyyy/mm/dd" readonly disabled
date-time-picker data-date-format="yyyy/mm/dd"
class="form-control" ng-model="editFieldItem.fileTime"/>
</div>
</div>
......@@ -1044,7 +1044,7 @@
<div class="col-sm-11" style="width:61.67%">
<input type='text' placeholder="{{'PleaseSelected' | translate}}"
ng-class="{'upload-fail-mark':isRequired('DueDate') && !editFieldItem.effectiveTime}"
date-time-picker data-date-format="yyyy/mm/dd" readonly disabled
date-time-picker data-date-format="yyyy/mm/dd"
class="form-control" ng-model="editFieldItem.effectiveTime"/>
</div>
</div>
......@@ -1057,7 +1057,7 @@
<input class="form-control"
ng-class="{'upload-fail-mark':isRequired('EntityStorageLocation') && !editFieldItem.storageArea}"
placeholder="{{'PleaseSelected'|translate}}"
ng-model="editFieldItem.storageArea" readonly disabled
ng-model="editFieldItem.storageArea"
/>
</div>
<div class="DTL-special-external-btn"
......@@ -1075,7 +1075,7 @@
{{'EntityCustodian' | translate}}
</label>
<div class="col-sm-11" style="width:61.67%">
<input class="form-control" readonly disabled
<input class="form-control"
ng-class="{'upload-fail-mark':isRequired('EntityCustodian') && !editFieldItem.keeper}"
placeholder="{{'PleaseType' | translate}}"
ng-model="editFieldItem.keeper"
......@@ -1093,7 +1093,7 @@
placeholder="{{'PleaseType' | translate}}"
ng-class="{'upload-fail-mark':isRequired('EntityIndex') && !editFieldItem.physicalIndexNumber && editFieldItem.physicalIndexNumber != 0}"
ng-model="editFieldItem.physicalIndexNumber"
readonly disabled
readonly
/>
</div>
</div>
......@@ -1106,7 +1106,6 @@
<textarea class="form-control"
ng-class="{'upload-fail-mark':isRequired('Remarks') && !editFieldItem.remark && editFieldItem.remark != 0}"
placeholder="{{'PleaseType' | translate}}"
readonly disabled
ng-model="editFieldItem.remark">
</textarea>
</div>
......@@ -1118,9 +1117,9 @@
<div style="clear:both"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" translate="Confirm" ng-click="closeUploadReview()"></button>
<!--<button type="button" class="btn btn-third" data-dismiss="modal" ng-click="cancelDocFileType()"-->
<!--translate="Cancel"></button>-->
<button type="button" class="btn btn-primary" translate="Confirm" ng-click="multiUploadSubmit_handmade()"></button>
<button type="button" class="btn btn-third" data-dismiss="modal" ng-click="closeUploadReview()"
translate="Cancel"></button>
</div>
</form>
</div>
......@@ -1399,12 +1398,12 @@
<div class="modal-dialog" style="width:60%;max-width:960px" role="document">
<div class="modal-content">
<div class="modal-header">
<div class="modal-title">提示讯息</div>
<div class="modal-title" translate="Tips"></div>
</div>
<div class="modal-body">
<p ng-if="multiUploadSuccessItems.length">{{multiUploadSuccessItems.length}}{{'UploadSuccessCount'|translate}}</p>
<p ng-if="uploadResultSuccessList.length">{{uploadResultSuccessList.length}}{{'UploadSuccessCount'|translate}}</p>
<ul>
<li ng-repeat="item in multiUploadSuccessItems">
<li ng-repeat="item in uploadResultSuccessList">
<span>{{item.fileName}}</span>
</li>
</ul>
......
......@@ -66,6 +66,9 @@ taxDocumentManageModule.factory('taxDocumentListService',
getFileInfoOptions:function(params){
return jqFetch.post(apiInterceptor.webApiHostUrl + '/fileTypes/query4SelectionBox', params);
},
getFileInfoEnableOptions:function(params){
return jqFetch.post(apiInterceptor.webApiHostUrl + '/fileTypes/query4SelectionBoxEnable', params);
},
getCompanyNameOptions:function(params){
return jqFetch.get(apiInterceptor.webApiHostUrl + '/org/getMyOrgList', params);
},
......
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