Commit 207adb55 authored by chase's avatar chase

merge 档案管理代码

parent 0a09390b
......@@ -9,10 +9,10 @@ public class ReportFileUploadEnum {
* 报表类型
*/
public enum ReportType {
NORMAL_DECLARATION("NORMAL_DECLARATION", "增值税纳税申报表"),
CORR_DECLARATION("CORR_DECLARATION", "增值税更正申报表"),
NORMAL_TAX_RECEIPT("NORMAL_TAX_RECEIPT", "增值税纳税税票"),
CORR_TAX_RECEIPT("CORR_TAX_RECEIPT", "增值税更正税票");
NORMAL_DECLARATION("增值税纳税申报表", "增值税纳税申报表"),
CORR_DECLARATION("增值税更正申报表", "增值税更正申报表"),
NORMAL_TAX_RECEIPT("增值税纳税税票", "增值税纳税税票"),
CORR_TAX_RECEIPT("增值税更正税票", "增值税更正税票");
private String code;
private String name;
public static final Map<String, String> MAPPING = new HashMap<>();
......
package pwc.taxtech.atms.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import net.sf.json.JSONNull;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.DateUtil;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
......@@ -17,7 +26,10 @@ import pwc.taxtech.atms.thirdparty.ExcelUtil;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -71,6 +83,7 @@ public class TaxDocumentController {
return taxDocumentService.editFilesType(taxDocument);
}
@RequestMapping("exportExcel")
@ResponseBody
public void exportExcelFile(HttpServletResponse response, @RequestBody TaxDocumentDto taxDocumentDto) {
......@@ -147,4 +160,142 @@ public class TaxDocumentController {
}
/**
* 读取Excel转换成 Json
* @param path 文件的路径
*/
@PostMapping("/previewExcelToJson")
@ResponseBody
public String previewExcel(String path) {
try {
JSONArray dataArray = new JSONArray();
XSSFWorkbook xssfWorkbook = new XSSFWorkbook(new FileInputStream(path));
// 循环工作表Sheet
for (int numSheet = 0; numSheet < xssfWorkbook.getNumberOfSheets(); numSheet++) {
XSSFSheet xssfSheet = xssfWorkbook.getSheetAt(numSheet);
String sheetName = xssfSheet.getSheetName();
if (xssfSheet == null) {
continue;
}
//当前sheet的json文件
JSONObject sheetJson = new JSONObject();
//当前sheet的array,作为sheetJson 的value值
JSONArray sheetArr = new JSONArray();
//sheet的第一行,获取作为json的key值
JSONArray key = new JSONArray();
int xssfLastRowNum = xssfSheet.getLastRowNum();
// 循环行Row
for (int rowNum = 0; rowNum <= xssfLastRowNum; rowNum++) {
XSSFRow xssfRow = xssfSheet.getRow(rowNum);
if (xssfRow == null) {
continue;
}
// 循环列Cell,在这里组合json文件
int firstCellNum = xssfRow.getFirstCellNum();
int lastCellNum = xssfRow.getLastCellNum();
JSONObject rowJson = new JSONObject();
for (int cellNum = firstCellNum; cellNum < lastCellNum; cellNum++) {
XSSFCell cell = null;
try {
cell = xssfRow.getCell(cellNum);
if (cell == null) {
rowJson.put(key.getString(cellNum), "");
continue;
}
if (rowNum == 0)
key.add(toString(cell));
else {
//若是列号超过了key的大小,则跳过
if (cellNum >= key.size()) continue;
rowJson.put(key.getString(cellNum), toString(cell));
}
} catch (Exception e) {
e.printStackTrace();
}
}
if (rowJson.keySet().size() > 0)
sheetArr.add(rowJson);
}
sheetJson.put(sheetName, shuffleData(sheetArr));
dataArray.add(sheetJson);
}
return dataArray.toString();
} catch (IOException e) {
e.printStackTrace();
return JSONNull.getInstance().toString();
}
}
/**
* 解析json
* @param cell
* @return
*/
private static Object toString(XSSFCell cell) {
switch (cell.getCellTypeEnum()) {
case _NONE:
cell.setCellType(CellType.STRING);
return "";
case NUMERIC:
if (DateUtil.isCellDateFormatted(cell)) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
return sdf.format(cell.getDateCellValue());
}
cell.setCellType(CellType.STRING);
return cell.getStringCellValue();
case STRING:
String val = cell.getStringCellValue();
if ("无".equalsIgnoreCase(val)) return "";
//将其中的map格式和数组格式的字符串,转化为相应的数据类型
if (val.indexOf("{") > -1) {
// JSONObject jsonObject = JSONObject.parseObject(val);
Map<String, Integer> mapJson = JSONObject.parseObject(val,HashMap.class);
return mapJson;
}
if (val.indexOf("[") > -1) {
val = val.substring(1, val.length() - 1);
String[] array = val.split(",");
return array;
}
return val;
case FORMULA:
return cell.getCellFormula();
case BLANK:
return "";
case BOOLEAN:
return cell.getBooleanCellValue() + "";
case ERROR:
return "非法字符";
default:
return "未知字符";
}
}
/**
* 输出数据
*/
private static JSONArray shuffleData(JSONArray sheetArr) {
JSONArray array = new JSONArray();
for (int i = 0; i < sheetArr.size(); i++) {
JSONObject object = sheetArr.getJSONObject(i);
int count = 0;
int length = 0;
for (Object key : object.keySet()) {
Object o = object.get((String) key);
length++;
boolean b = StringUtils.isEmpty(o.toString());
if (b) {
count++;
}
}
if (count != length) {
array.add(object);
}
}
return array;
}
}
......@@ -23,7 +23,7 @@ public class TaxDocumentDto {
private String businessLine;//业务线
private Integer companyId;//公司代码Id
private String companyId;//公司代码Id
private String companyName;//公司名称
......@@ -53,9 +53,7 @@ public class TaxDocumentDto {
private String physicalIndexNumber;//实物索引号
private Date ownBeginTime;//所属期间_开始
private Date ownEndTime;//所属期间_结束
private Integer ownTime;//所属期间
private Integer auditStatus;//审核状态
......@@ -111,22 +109,6 @@ public class TaxDocumentDto {
this.effectiveEndTime = effectiveEndTime;
}
public Date getOwnBeginTime() {
return ownBeginTime;
}
public void setOwnBeginTime(Date ownBeginTime) {
this.ownBeginTime = ownBeginTime;
}
public Date getOwnEndTime() {
return ownEndTime;
}
public void setOwnEndTime(Date ownEndTime) {
this.ownEndTime = ownEndTime;
}
public String getPhysicalIndexNumber() {
return physicalIndexNumber;
}
......@@ -215,14 +197,22 @@ public class TaxDocumentDto {
this.businessLine = businessLine;
}
public Integer getCompanyId() {
public String getCompanyId() {
return companyId;
}
public void setCompanyId(Integer companyId) {
public void setCompanyId(String companyId) {
this.companyId = companyId;
}
public Integer getOwnTime() {
return ownTime;
}
public void setOwnTime(Integer ownTime) {
this.ownTime = ownTime;
}
public String getCompanyName() {
return companyName;
}
......
......@@ -2,6 +2,7 @@ package pwc.taxtech.atms.service.impl;
import com.github.pagehelper.PageInfo;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
......@@ -17,6 +18,8 @@ import pwc.taxtech.atms.dto.didiFileUpload.DidiFileUploadDetailResult;
import pwc.taxtech.atms.dto.reportFileUpload.ReportFileUploadParam;
import pwc.taxtech.atms.dto.reportFileUpload.ReportFileUploadResult;
import pwc.taxtech.atms.entity.Project;
import pwc.taxtech.atms.entity.ProjectExample;
import pwc.taxtech.atms.entity.TaxDocument;
import pwc.taxtech.atms.entity.User;
import pwc.taxtech.atms.exception.ServiceException;
import pwc.taxtech.atms.vat.dao.ReportFileUploadMapper;
......@@ -47,6 +50,8 @@ public class ReportFileUploadService extends BaseService {
@Autowired
DidiFileUploadService didiFileUploadService;
@Autowired
TaxDocumentServiceImpl taxDocumentService;
public List<ReportFileUploadResult> queryData(ReportFileUploadParam param) {
ReportFileUploadExample example = new ReportFileUploadExample();
example.createCriteria().andProjectIdEqualTo(param.getProjectId()).andPeriodEqualTo(param.getPeriod());
......@@ -103,12 +108,31 @@ public class ReportFileUploadService extends BaseService {
String uid = authUserHelper.getCurrentUserId();
User user = userMapper.selectByPrimaryKey(uid);
data.setCreator(user.getUserName());
Project project = projectMapper.selectByPrimaryKey(data.getProjectId());
data.setOrgId(project.getOrganizationId());
ReportFileUploadExample example = new ReportFileUploadExample();
example.createCriteria().andProjectIdEqualTo(data.getProjectId()).andPeriodEqualTo(data.getPeriod()).andReportTypeEqualTo(data.getReportType());
FileUpload fileUpload = didiFileUploadService.uploadFile(file, file.getOriginalFilename(), FileUploadEnum.BizSource.REPORT_UPLOAD.name());
data.setFileUploadId(fileUpload.getUid());
if (StringUtils.isBlank(data.getFileUploadId())) {
FileUpload fileUpload = didiFileUploadService.uploadFile(file, file.getOriginalFilename(), FileUploadEnum.BizSource.REPORT_UPLOAD.name());
data.setFileUploadId(fileUpload.getUid());
}
if (StringUtils.isBlank(data.getProjectId()) && StringUtils.isNotBlank(data.getOrgId()) && data.getPeriod() != null) {
ProjectExample projectExample = new ProjectExample();
projectExample.createCriteria().andOrganizationIdEqualTo(data.getOrgId()).andYearEqualTo(data.getPeriod()/100);
List<Project> projects = projectMapper.selectByExample(projectExample);
if(CollectionUtils.isNotEmpty(projects)){
data.setProjectId(projects.get(0).getId());
TaxDocument taxDocument = new TaxDocument();
taxDocument.setCompanyId(projects.get(0).getOrganizationId());
taxDocument.setFileUploadId(data.getFileUploadId());
taxDocument.setEnable("T");
taxDocument.setOwnTime(data.getPeriod());
taxDocument.setFileType(data.getReportType());
taxDocumentService.addTaxDocumentList(file,taxDocument);
}
}else {
Project project = projectMapper.selectByPrimaryKey(data.getProjectId());
data.setOrgId(project.getOrganizationId());
}
data.setUid(CommonUtils.getUUID());
data.setCreateTime(new Date());
data.setReportFileName(file.getOriginalFilename());
......
......@@ -10,6 +10,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import pwc.taxtech.atms.common.AuthUserHelper;
import pwc.taxtech.atms.constant.enums.FileUploadEnum;
import pwc.taxtech.atms.constant.enums.ReportFileUploadEnum;
import pwc.taxtech.atms.dao.TaxDocumentMapper;
import pwc.taxtech.atms.dto.TaxDocumentDto;
import pwc.taxtech.atms.dto.didiFileUpload.DidiFileIUploadParam;
......@@ -18,6 +19,7 @@ import pwc.taxtech.atms.entity.OperationLogTaxDocument;
import pwc.taxtech.atms.entity.TaxDocument;
import pwc.taxtech.atms.entity.TaxDocumentExample;
import pwc.taxtech.atms.vat.entity.FileUpload;
import pwc.taxtech.atms.vat.entity.ReportFileUpload;
import javax.annotation.Resource;
import java.util.*;
......@@ -39,6 +41,8 @@ public class TaxDocumentServiceImpl {
@Autowired
private OperationLogTaxDocServiceImpl operationLogTaxDocService;
@Autowired
ReportFileUploadService reportFileUploadService;
@Autowired
DidiFileUploadService didiFileUploadService;
......@@ -86,8 +90,8 @@ public class TaxDocumentServiceImpl {
criteria.andFileTimeBetween(taxDocumentDto.getFileBeginTime(), taxDocumentDto.getFileEndTTime());
}
//所属时间 ownTime
if (null != taxDocumentDto.getOwnBeginTime() && null != taxDocumentDto.getOwnEndTime()) {
criteria.andOwnTimeBetween(taxDocumentDto.getOwnBeginTime(), taxDocumentDto.getOwnEndTime());
if (null != taxDocumentDto.getOwnTime()) {
criteria.andOwnTimeEqualTo(taxDocumentDto.getOwnTime());
}
//档案名称 fileName
if (StringUtils.isNotBlank(taxDocumentDto.getFileName())) {
......@@ -140,9 +144,20 @@ public class TaxDocumentServiceImpl {
public synchronized boolean addTaxDocumentList(MultipartFile file, TaxDocument taxDocument) {
try {
//上传文件
FileUpload fileUpload = didiFileUploadService.uploadFile(file,file.getOriginalFilename(), FileUploadEnum.BizSource.RECORD_UPLOAD.name());
taxDocument.setFileUploadId(fileUpload.getUid());
taxDocument.setFilePositionUrl(fileUpload.getViewHttpUrl());
if(StringUtils.isBlank(taxDocument.getFileUploadId())){
FileUpload fileUpload = didiFileUploadService.uploadFile(file,file.getOriginalFilename(), FileUploadEnum.BizSource.RECORD_UPLOAD.name());
taxDocument.setFileUploadId(fileUpload.getUid());
taxDocument.setFilePositionUrl(fileUpload.getViewHttpUrl());
if(ReportFileUploadEnum.ReportType.MAPPING.containsKey(taxDocument.getFileType())){
ReportFileUpload reportFileUpload = new ReportFileUpload();
reportFileUpload.setOrgId(taxDocument.getCompanyId());
reportFileUpload.setSourceType(ReportFileUploadEnum.SuorceType.RECORD.name());
reportFileUpload.setPeriod(taxDocument.getOwnTime());
reportFileUpload.setFileUploadId(fileUpload.getUid());
reportFileUpload.setReportType(taxDocument.getFileType());
reportFileUploadService.saveData(file,reportFileUpload);
}
}
//设置创建人 创建时间信息 设置年份区分
taxDocument.setCreateTime(new Date());
taxDocument.setCreator(authUserHelper.getCurrentAuditor().get());
......
......@@ -62,5 +62,28 @@
<artifactId>fastjson</artifactId>
<version>1.2.40</version>
</dependency>
<!--Excel to Json-->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.17</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.17</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.2</version>
</dependency>
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<classifier>jdk15</classifier>
</dependency>
<!--Excel to Json End-->
</dependencies>
</project>
......@@ -86,7 +86,7 @@ public class TaxDocument implements Serializable {
*
* @mbg.generated
*/
private Integer companyId;
private String companyId;
/**
* Database Column Remarks:
......@@ -141,7 +141,7 @@ public class TaxDocument implements Serializable {
*
* @mbg.generated
*/
private Date ownTime;
private int ownTime;
/**
*
......@@ -344,11 +344,11 @@ public class TaxDocument implements Serializable {
this.auditStatus = auditStatus;
}
public Date getOwnTime() {
public int getOwnTime() {
return ownTime;
}
public void setOwnTime(Date ownTime) {
public void setOwnTime(int ownTime) {
this.ownTime = ownTime;
}
......@@ -520,7 +520,7 @@ public class TaxDocument implements Serializable {
*
* @mbg.generated
*/
public Integer getCompanyId() {
public String getCompanyId() {
return companyId;
}
......@@ -532,7 +532,7 @@ public class TaxDocument implements Serializable {
*
* @mbg.generated
*/
public void setCompanyId(Integer companyId) {
public void setCompanyId(String companyId) {
this.companyId = companyId;
}
......
......@@ -865,6 +865,11 @@ public class TaxDocumentExample {
return (Criteria) this;
}
public Criteria andOwnTimeEqualTo(Integer value) {
addCriterion("own_time =", value, "ownTime");
return (Criteria) this;
}
public Criteria andFileTimeNotBetween(Date value1, Date value2) {
addCriterion("file_time not between", value1, value2, "fileTime");
return (Criteria) this;
......
......@@ -12,7 +12,7 @@
<result column="file_type" jdbcType="VARCHAR" property="fileType"/>
<result column="file_name" jdbcType="VARCHAR" property="fileName"/>
<result column="business_line" jdbcType="VARCHAR" property="businessLine"/>
<result column="company_id" jdbcType="INTEGER" property="companyId"/>
<result column="company_id" jdbcType="VARCHAR" property="companyId"/>
<result column="company_name" jdbcType="VARCHAR" property="companyName"/>
<result column="tax_type" jdbcType="VARCHAR" property="taxType"/>
<result column="file_time" jdbcType="TIMESTAMP" property="fileTime"/>
......@@ -32,7 +32,7 @@
<result column="year_redundancy" jdbcType="INTEGER" property="yearRedundancy"/>
<result column="audit_status" jdbcType="INTEGER" property="auditStatus"/>
<result column="physical_index_number" jdbcType="VARCHAR" property="physicalIndexNumber"/>
<result column="own_time" jdbcType="TIMESTAMP" property="ownTime"/>
<result column="own_time" jdbcType="INTEGER" property="ownTime"/>
<result column="enable" jdbcType="VARCHAR" property="enable"/>
</resultMap>
<sql id="Example_Where_Clause">
......@@ -175,14 +175,14 @@
year_redundancy,audit_status,physical_index_number,own_time)
values (#{id,jdbcType=BIGINT}, #{fileAttr,jdbcType=VARCHAR}, #{fileTypeId,jdbcType=INTEGER},
#{fileType,jdbcType=VARCHAR}, #{fileName,jdbcType=VARCHAR}, #{businessLine,jdbcType=VARCHAR},
#{companyId,jdbcType=INTEGER}, #{companyName,jdbcType=VARCHAR}, #{taxType,jdbcType=VARCHAR},
#{companyId,jdbcType=VARCHAR}, #{companyName,jdbcType=VARCHAR}, #{taxType,jdbcType=VARCHAR},
#{fileTime,jdbcType=TIMESTAMP}, #{effectiveTime,jdbcType=TIMESTAMP}, #{creatorId,jdbcType=INTEGER},
#{creator,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
#{uploadTime,jdbcType=TIMESTAMP}, #{storageArea,jdbcType=VARCHAR}, #{keeperId,jdbcType=INTEGER},
#{keeper,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{fileOriginalName,jdbcType=VARCHAR},
#{fileUploadId,jdbcType=VARCHAR}, #{filePositionUrl,jdbcType=VARCHAR},
#{yearRedundancy,jdbcType=INTEGER},#{auditStatus,jdbcType=INTEGER},#{physicalIndexNumber,jdbcType=VARCHAR},
#{ownTime,jdbcType=TIMESTAMP})
#{ownTime,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="pwc.taxtech.atms.entity.TaxDocument">
<!--
......@@ -277,8 +277,8 @@
<if test="businessLine != null">
#{businessLine,jdbcType=VARCHAR},
</if>
<if test="companyId != null">
#{companyId,jdbcType=INTEGER},
<if test="companyId != null and companyId != ''">
#{companyId,jdbcType=VARCHAR},
</if>
<if test="companyName != null">
#{companyName,jdbcType=VARCHAR},
......@@ -363,7 +363,7 @@
business_line = #{record.businessLine,jdbcType=VARCHAR},
</if>
<if test="record.companyId != null">
company_id = #{record.companyId,jdbcType=INTEGER},
company_id = #{record.companyId,jdbcType=VARCHAR},
</if>
<if test="record.companyName != null">
company_name = #{record.companyName,jdbcType=VARCHAR},
......@@ -427,7 +427,7 @@
file_type = #{record.fileType,jdbcType=VARCHAR},
file_name = #{record.fileName,jdbcType=VARCHAR},
business_line = #{record.businessLine,jdbcType=VARCHAR},
company_id = #{record.companyId,jdbcType=INTEGER},
company_id = #{record.companyId,jdbcType=VARCHAR},
company_name = #{record.companyName,jdbcType=VARCHAR},
tax_type = #{record.taxType,jdbcType=VARCHAR},
file_time = #{record.fileTime,jdbcType=TIMESTAMP},
......@@ -445,7 +445,7 @@
year_redundancy = #{record.yearRedundancy,jdbcType=INTEGER},
audit_status = #{record.auditStatus,jdbcType=INTEGER},
physical_index_number = #{record.physicalIndexNumber,jdbcType=VARCHAR},
own_time = #{record.ownTime,jdbcType=TIMESTAMP}
own_time = #{record.ownTime,jdbcType=INTEGER}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
......@@ -473,7 +473,7 @@
business_line = #{businessLine,jdbcType=VARCHAR},
</if>
<if test="companyId != null">
company_id = #{companyId,jdbcType=INTEGER},
company_id = #{companyId,jdbcType=VARCHAR},
</if>
<if test="companyName != null">
company_name = #{companyName,jdbcType=VARCHAR},
......@@ -545,8 +545,8 @@
<if test="null != businessLine and '' != businessLine">
business_line = #{businessLine,jdbcType=VARCHAR},
</if>
<if test="null != companyId">
company_id = #{companyId,jdbcType=INTEGER},
<if test="null != companyId and '' != companyId">
company_id = #{companyId,jdbcType=VARCHAR},
</if>
<if test="null != companyName and '' != companyName">
company_name = #{companyName,jdbcType=VARCHAR},
......@@ -597,7 +597,7 @@
physical_index_number = #{physicalIndexNumber,jdbcType=VARCHAR},
</if>
<if test="null != ownTime">
own_time = #{ownTime,jdbcType=TIMESTAMP},
own_time = #{ownTime,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
......
......@@ -408,6 +408,7 @@
"MappingInvoice": "关联管理",
"MenuAMVAT": "资管增值税申报",
"MenuCIT": "企业所得税申报",
"MenuRecordManage": "档案管理",
"MenuCashFlow": "税务现金流",
"MenuDeferredTax": "递延所得税",
"MenuIndexAnalytics": "税务指标分析",
......
......@@ -199,7 +199,7 @@
if (rowId) {
$scope.confirmDocFileType = editDocFileType;
$scope.localData.forEach(function(item){
if(item.id === rowId){
if(item.id == rowId){
$scope.editModel = angular.copy(item);
}
});
......@@ -228,7 +228,7 @@
var uploadModel = angular.copy($scope.editModel);
delete uploadModel.id; //新增文档不需要上传ID
docManageService.addFileType(uploadModel).then(function (data) {
if(data === true){
if(data == true){
SweetAlert.success($translate.instant('SaveSuccess'));
$scope.loadMainData();
}else{
......@@ -241,7 +241,7 @@
var editDocFileType = function () {
var uploadModel = angular.copy($scope.editModel);
docManageService.editFileType(uploadModel).then(function (data) {
if(data === true){
if(data == true){
SweetAlert.success($translate.instant('SaveSuccess'));
$scope.loadMainData();
}else{
......
......@@ -115,12 +115,14 @@
allowHeaderFiltering: true,
cellTemplate: function (container, options) {
try {
if (!options.data.sourceType || "VAT" == options.data.sourceType) {
$("<a href='javascript:void(0)'>上传</a>").on('click', function () {
$('#uploadBut' + options.data.reportType).click();
}).appendTo(container);
$('<input type="file" style="display:none;" id="uploadBut' + options.data.reportType + '" />').on('change', function () {
uploadFile($('#uploadBut' + options.data.reportType)[0].files[0], options.data.reportType);
}).appendTo(container);
}
} catch (e) {
$log.error(e);
}
......@@ -210,12 +212,14 @@
allowHeaderFiltering: true,
cellTemplate: function (container, options) {
try {
$("<a href='javascript:void(0)'>上传</a>").on('click', function () {
$('#uploadBut' + options.data.reportType).click();
}).appendTo(container);
$('<input type="file" style="display:none;" id="uploadBut' + options.data.reportType + '" />').on('change', function () {
uploadFile($('#uploadBut' + options.data.reportType)[0].files[0], options.data.reportType);
}).appendTo(container);
if (!options.data.sourceType || "VAT" == options.data.sourceType) {
$("<a href='javascript:void(0)'>上传</a>").on('click', function () {
$('#uploadBut' + options.data.reportType).click();
}).appendTo(container);
$('<input type="file" style="display:none;" id="uploadBut' + options.data.reportType + '" />').on('change', function () {
uploadFile($('#uploadBut' + options.data.reportType)[0].files[0], options.data.reportType);
}).appendTo(container);
}
} catch (e) {
$log.error(e);
}
......
......@@ -32,7 +32,7 @@
</div>
<div class="nav-element-left">
<a ui-sref="taxDocumentManage">
<span class="nav-icon-color">档案管理</span>
<span class="nav-icon-color">{{'MenuRecordManage' | translate}}</span>
</a>
</div>
<!--<div class="nav-element-left">-->
......
......@@ -2,8 +2,10 @@
* Created by Administrator on 2019/3/1 0001.
*/
taxDocumentManageModule.controller('taxDocumentListController',
['$log', '$http', '$q', '$scope', '$translate', '$timeout', 'SweetAlert', '$compile', 'taxDocumentListService', '$filter','apiInterceptor',
function ($log, $http, $q, $scope, $translate, $timeout, SweetAlert, $compile, taxDocumentListService, $filter,apiInterceptor) {
['$log', '$http', '$q', '$scope', '$translate', '$timeout',
'SweetAlert', '$compile', 'taxDocumentListService', '$filter','apiInterceptor',
function ($log, $http, $q, $scope, $translate, $timeout,
SweetAlert, $compile, taxDocumentListService, $filter,apiInterceptor) {
$scope.queryFieldModel = {};
$scope.editFieldModel = {
......@@ -18,18 +20,18 @@ taxDocumentManageModule.controller('taxDocumentListController',
};
$scope.pagingOptions = {
pageIndex: 1, //当前页码
totalItems: 0, //总数据
pageSize: 10, //每页多少条数据
pageSizeString: '10',
};
$scope.localData = null;
$scope.loadMainData = function () {
$scope.queryFieldModel.currentPage = $scope.pagingOptions.pageIndex;
$scope.queryFieldModel.pageSize = $scope.pagingOptions.pageSize;
taxDocumentListService.fetchMainList($scope.queryFieldModel).then(function (data, status, headers) {
if (status === 204) {
var params = angular.copy($scope.queryFieldModel);
params.ownTime = params.ownTime ? params.ownTime : "";
params.ownTime = parseInt(params.ownTime.split("-").join(""));
taxDocumentListService.fetchMainList(params).then(function (data, status, headers) {
if (status == 204) {
SweetAlert.warning($translate.instant("NoData"));
return;
}
......@@ -112,7 +114,7 @@ taxDocumentManageModule.controller('taxDocumentListController',
cellTemplate: function (container, options) {
try {
if (options.data.fileTime) {
$('<span>').text($filter('date')(options.data.createTime, 'yyyy-MM-dd')).appendTo(container);
$('<span>').text($filter('date')(options.data.fileTime, 'yyyy-MM-dd')).appendTo(container);
} else {
$('<span>').text('').appendTo(container);
}
......@@ -127,7 +129,7 @@ taxDocumentManageModule.controller('taxDocumentListController',
cellTemplate: function (container, options) {
try {
if (options.data.ownTime) {
$('<span>').text($filter('date')(options.data.createTime, 'yyyy-MM-dd')).appendTo(container);
$('<span>').text($filter('date')(options.data.ownTime, 'yyyy-MM-dd')).appendTo(container);
} else {
$('<span>').text('').appendTo(container);
}
......@@ -143,7 +145,7 @@ taxDocumentManageModule.controller('taxDocumentListController',
cellTemplate: function (container, options) {
try {
if (options.data.effectiveTime) {
$('<span>').text($filter('date')(options.data.createTime, 'yyyy-MM-dd')).appendTo(container);
$('<span>').text($filter('date')(options.data.effectiveTime, 'yyyy-MM-dd')).appendTo(container);
} else {
$('<span>').text('').appendTo(container);
}
......@@ -178,7 +180,7 @@ taxDocumentManageModule.controller('taxDocumentListController',
cellTemplate: function (container, options) {
try {
if (options.data.uploadTime) {
$('<span>').text($filter('date')(options.data.createTime, 'yyyy-MM-dd')).appendTo(container);
$('<span>').text($filter('date')(options.data.uploadTime, 'yyyy-MM-dd')).appendTo(container);
} else {
$('<span>').text('').appendTo(container);
}
......@@ -236,13 +238,14 @@ taxDocumentManageModule.controller('taxDocumentListController',
$scope.editFieldModel.ownTime = dateFormat(item.ownTime);
$scope.editFieldModel.fileTime = dateFormat(item.fileTime);
$scope.editFieldModel.effectiveTime = dateFormat(item.effectiveTime);
function dateFormat(date){
if(!date)return "";
var _date = new Date(date);
var yy = _date.getFullYear();
var mm = _date.getMonth() + 1;
var dd = _date.getDate();
var mm = (_date.getMonth() + 1) + "";
var dd = _date.getDate() + "";
mm = mm.length < 2 ? "0" + mm : mm;
dd = dd.length < 2 ? "0" + dd : dd;
return yy + "-" + mm + "-" + dd;
}
}
......@@ -261,7 +264,10 @@ taxDocumentManageModule.controller('taxDocumentListController',
//新建档案
var simpleUploadSubmit = function () {
taxDocumentListService.verifyDuplicate($scope.editFieldModel).then(function(data){
var params = angular.copy($scope.editFieldModel);
params.ownTime = params.ownTime ? params.ownTime : "";
params.ownTime = parseInt(params.ownTime.split("-").join(""));
taxDocumentListService.verifyDuplicate(params).then(function(data){
// 先设置上传参数
var uploadItem = $scope.uploader.queue[0];
......@@ -271,7 +277,10 @@ taxDocumentManageModule.controller('taxDocumentListController',
];
Object.keys($scope.editFieldModel).forEach(function(key){
var fields = {};
if(/(ownTime|fileTime|effectiveTime)/.test(key)){
if(/ownTime/.test(key)){
fields[key] = parseInt($scope.editFieldModel[key].split("-").join(""));
}
else if(/(fileTime|effectiveTime)/.test(key)){
fields[key] = $scope.editFieldModel[key].split("-").join("/");
}else{
fields[key] = $scope.editFieldModel[key];
......@@ -280,7 +289,7 @@ taxDocumentManageModule.controller('taxDocumentListController',
});
// data == true,代表可以直接上传,否则属于覆盖行为
if (data === true) {
if (data == true) {
$scope.uploader.url = apiInterceptor.webApiHostUrl + "/taxDoc/add";
$scope.uploader.uploadItem(0);
$scope.isCoverOperation = false;
......@@ -315,9 +324,12 @@ taxDocumentManageModule.controller('taxDocumentListController',
var addLogicAfterUploadFile = function(editFieldModel,type){
taxDocumentListService.addNewRecord(editFieldModel).then(function (data) {
if (data === true) {
if(type === 'simp'){
var params = angular.copy(editFieldModel);
params.ownTime = params.ownTime ? params.ownTime : "";
params.ownTime = parseInt(params.ownTime.split("-").join(""));
taxDocumentListService.addNewRecord(params).then(function (data) {
if (data == true) {
if(type == 'simp'){
SweetAlert.swal({
title:$translate.instant("Created"),
type: "success",
......@@ -328,7 +340,7 @@ taxDocumentManageModule.controller('taxDocumentListController',
if(isConfirm) $scope.loadMainData();
});
}else{
if($scope.multiUploadSuccessItems.length === 0){
if($scope.multiUploadSuccessItems.length == 0){
SweetAlert.swal({
title:$translate.instant("Uploaded"),
type: "success",
......@@ -350,9 +362,12 @@ taxDocumentManageModule.controller('taxDocumentListController',
var editDocFileRecord = function (fieldModel,type) {
taxDocumentListService.editRecord(fieldModel).then(function (data) {
if (data === true) {
if(type === 'simple'){
var params = angular.copy(fieldModel);
params.ownTime = params.ownTime ? params.ownTime : "";
params.ownTime = parseInt(params.ownTime.split("-").join(""));
taxDocumentListService.editRecord(params).then(function (data) {
if (data == true) {
if(type == 'simple'){
SweetAlert.swal({
title:$translate.instant("Edited"),
type: "success",
......@@ -363,7 +378,7 @@ taxDocumentManageModule.controller('taxDocumentListController',
if(isConfirm) $scope.loadMainData();
});
}else{
if($scope.multiUploadSuccessItems.length === 0){
if($scope.multiUploadSuccessItems.length == 0){
SweetAlert.swal({
title:$translate.instant("Uploaded"),
type: "success",
......@@ -397,7 +412,11 @@ taxDocumentManageModule.controller('taxDocumentListController',
delItems.ids.push($scope.localData[index].id);
}
});
taxDocumentListService.delFileRecordItems(delItems).then(function(data){
var params = angular.copy(delItems);
params.ownTime = params.ownTime ? params.ownTime : "";
params.ownTime = parseInt(params.ownTime.split("-").join(""));
taxDocumentListService.delFileRecordItems(params).then(function(data){
if(data){
SweetAlert.swal({
title:$translate.instant("Deleted"),
......@@ -446,6 +465,7 @@ taxDocumentManageModule.controller('taxDocumentListController',
taxDocumentListService.getFileInfoOptions().then(function(data){
// console.log(data);
if(data){
$scope.typeAndAttrMap = data;
Object.keys(data).forEach(function (item) {
$scope.fileTypeOptions[item] = item;
});
......@@ -468,10 +488,19 @@ taxDocumentManageModule.controller('taxDocumentListController',
};
//----------------------taxation----basic-end-------------------------------
$scope.syncFileType = function(curAttr){
$scope.curFileTypeOptions.length = 0;
Object.keys($scope.typeAndAttrMap).forEach(function(key){
if(curAttr === $scope.typeAndAttrMap[key]){
$scope.curFileTypeOptions.push(key);
}
});
};
(function initialize() {
$scope.typeAndAttrMap = {};
$scope.fileTypeOptions = {};
$scope.fileAttrOptions = {};
$scope.curFileTypeOptions = [];
$scope.companyNameOptionsMap = {};
$scope.editFieldModel = {};
$scope.editFieldModel_multi = [];
......@@ -490,6 +519,7 @@ taxDocumentManageModule.controller('taxDocumentListController',
})();
}]);
taxDocumentManageModule.directive("multiDatePicker", function () {
return {
restrict: "EA",
......@@ -523,6 +553,7 @@ taxDocumentManageModule.directive("multiDatePicker", function () {
// setDate: setDate,
months: monthList,
RTL: "bottom left",
minView:2,
ConfirmBtnText: $translate.instant('Confirm'),
CancelBtnText: $translate.instant('ButtonCancel')
};
......@@ -551,6 +582,7 @@ taxDocumentManageModule.directive("multiDatePicker", function () {
$scope.queryFieldModel.uploadBeginTime = dateFormat(result[0].reverse());
$scope.queryFieldModel.uploadEndTime = dateFormat(result[1].reverse());
});
function dateFormat(dateArr){
var result = [];
dateArr.forEach(function(dateItem){
......@@ -578,10 +610,11 @@ taxDocumentManageModule.directive('dateTimePicker', function () {
$element.datepicker({
startDate:new Date(year - 20, 1, 1),
endDate:new Date(year + 20, 1, 1),
minViewMode: 1,
minViewMode: $attrs["minView"],
autoclose: true,
language: region,
format: "yyyy-mm-dd",
todayBtn:true,
clearBtn: true //清除按钮
}).off("changeDate").on('changeDate', function(ev){
runCallback(ev);
......@@ -651,11 +684,7 @@ taxDocumentManageModule.directive('fileUploader',function () {
$scope.uploader = new FileUploader({
url: apiInterceptor.webApiHostUrl + "/taxDoc/add",
// autoUpload: true,//添加后,自动上传
headers:{
'Access-Control-Allow-Origin': '*',
Authorization: apiInterceptor.tokenType + ' ' + apiInterceptor.apiToken(),
withCredentials: true
},
headers:{"Authorization":apiInterceptor.tokenType + ' ' + apiInterceptor.apiToken()},
removeAfterUpload:true,
});
$scope.uploader.filters.push({//xls限制
......@@ -763,7 +792,7 @@ taxDocumentManageModule.directive('multiFileUploader',function () {
$scope.editFieldModel_multi.push({
fileNativePath:fileNativePath,
fileName:item.name,
iShow:$scope.editFieldModel_multi.length === 0
iShow:$scope.editFieldModel_multi.length == 0
});
// 根据需求,改为不做类型限制
return true;
......@@ -810,7 +839,10 @@ taxDocumentManageModule.directive('multiFileUploader',function () {
var editFieldModel = $scope.editFieldModel_multi[i];
Object.keys(editFieldModel).forEach(function(key){
var fields = {};
if(/(ownTime|fileTime|effectiveTime)/.test(key)){
if(/ownTime/.test(key)){
fields[key] = parseInt(editFieldModel[key].split("-").join(""));
}
else if(/(fileTime|effectiveTime)/.test(key)){
fields[key] = editFieldModel[key].split("-").join("/");
}else{
fields[key] = editFieldModel[key];
......@@ -820,8 +852,12 @@ taxDocumentManageModule.directive('multiFileUploader',function () {
(function(_i,_fileItem,_editFieldModel,_taxDocumentListService,_multiUploader){
_taxDocumentListService.verifyDuplicate(_editFieldModel).then(function(data){
if (data === true) {
var params = angular.copy(_editFieldModel);
params.ownTime = params.ownTime ? params.ownTime : "";
params.ownTime = parseInt(_editFieldModel.ownTime.split("-").join(""));
_taxDocumentListService.verifyDuplicate(params).then(function(data){
if (data == true) {
_fileItem.url = apiInterceptor.webApiHostUrl + "/taxDoc/add";
} else {
_fileItem.url = apiInterceptor.webApiHostUrl + "/taxDoc/edit";
......@@ -843,185 +879,192 @@ taxDocumentManageModule.directive('multiFileUploader',function () {
taxDocumentManageModule.directive('filePreview',function(){
return{
restrict:'EA',
controller:['$scope','$translate','SweetAlert','$compile','taxDocumentListService',function($scope,$translate,SweetAlert,$compile,taxDocumentListService){
$scope.previewData = [];
/**上传时预览的功能取消 2019/3/8*/
/* $scope.viewNativeFile = function(fileItem){
if(!fileItem) return SweetAlert.warning($translate.instant('NeedLoadUp'));
var fileType = fileItem.filePositionUrl.split(".").pop();
if(/xlsx|xls/i.test(fileType)){
var reader = new FileReader();
reader.onload = function (e) {
/!* read workbook *!/
var wb = window.XLSX.read(e.target.result, {type:"binary"});
var data = window.XLSX.utils.sheet_to_json(wb.Sheets[wb.SheetNames[0]]);
if(data.length){
$scope.filePreview_dataGridUpdate(data);
$("#filePreviewPop").modal("show");
}
else{
SweetAlert.warning($translate.instant('UnReadFile'));
}
/!* DO SOMETHING WITH workbook HERE *!/
};
reader.readAsBinaryString(fileItem._file);
}else if(/pdf/i.test(fileType)){
$scope.openPdfPreviewPop(fileItem.filePositionUrl);
}else{
SweetAlert.warning($translate.instant('UnFile'));
}
};*/
$scope.currentSheetName = '';
var sheetCurPageIndex = 0;
var sheetSumPages = 1;
var sheetPromise = null;
var cacheUrl = null;
$scope.prevPaging_xls = function(){
if(sheetCurPageIndex <= 0) return sheetCurPageIndex = 0;
sheetCurPageIndex --;
sheetPromise.then(function(resData){renderXLS(resData)})
};
$scope.nextPaging_xls = function(){
if(sheetCurPageIndex >= (sheetSumPages - 1)) return sheetCurPageIndex = sheetSumPages - 1;
sheetCurPageIndex ++;
sheetPromise.then(function(resData){renderXLS(resData)})
};
function getXLS(url){
// return taxDocumentListService.getBinaryData('./bundles/MS Function list - Phase 1.xlsx');
return taxDocumentListService.getBinaryData(url);
}
function renderXLS(resData){
try{
controller:['$scope','$translate','SweetAlert','$compile','taxDocumentListService',
function($scope,$translate,SweetAlert,$compile,taxDocumentListService){
$scope.previewData = [];
/**上传时预览的功能取消 2019/3/8*/
/* $scope.viewNativeFile = function(fileItem){
if(!fileItem) return SweetAlert.warning($translate.instant('NeedLoadUp'));
var fileType = fileItem.filePositionUrl.split(".").pop();
if(/xlsx|xls/i.test(fileType)){
var reader = new FileReader();
reader.onload = function (e) {
/!* read workbook *!/
var wb = window.XLSX.read(e.target.result, {type:"binary"});
var data = window.XLSX.utils.sheet_to_json(wb.Sheets[wb.SheetNames[0]]);
if(data.length){
$scope.filePreview_dataGridUpdate(data);
$("#filePreviewPop").modal("show");
}
else{
SweetAlert.warning($translate.instant('UnReadFile'));
}
/!* DO SOMETHING WITH workbook HERE *!/
};
reader.readAsBinaryString(fileItem._file);
}else if(/pdf/i.test(fileType)){
$scope.openPdfPreviewPop(fileItem.filePositionUrl);
}else{
SweetAlert.warning($translate.instant('UnFile'));
}
};*/
$scope.currentSheetName = '';
var sheetCurPageIndex = 0;
var sheetSumPages = 1;
var sheetPromise = null;
var cacheUrl = null;
$scope.prevPaging_xls = function(){
if(sheetCurPageIndex <= 0) return sheetCurPageIndex = 0;
sheetCurPageIndex --;
sheetPromise.then(function(resData){renderXLS(resData)})
};
$scope.nextPaging_xls = function(){
if(sheetCurPageIndex >= (sheetSumPages - 1)) return sheetCurPageIndex = sheetSumPages - 1;
sheetCurPageIndex ++;
sheetPromise.then(function(resData){renderXLS(resData)})
};
var wb = window.XLSX.read(resData, {type:"array"});
function getXLS(url){
// return taxDocumentListService.getBinaryData('./bundles/MS Function list - Phase 1.xlsx');
return taxDocumentListService.readXLSX({
// path:url
path:'http://47.94.233.173:11007/static/erp_tax_system/FE9A6FCC-019E-4B93-A9B2-1DD04CDD7431?expire=1552463739&signiture=H15ovgMR4zXwiYlPe4nZMoeLMSZFhimiHFUZ4-SVVaE='
});
}
sheetSumPages = wb.SheetNames.length;
$scope.currentSheetName = wb.SheetNames[sheetCurPageIndex];
var data = window.XLSX.utils.sheet_to_json(wb.Sheets[$scope.currentSheetName]);
// console.log(data);
if(data && data.length){
$scope.filePreview_dataGridUpdate(data);
$("#filePreviewPop").modal("show");
function renderXLS(resData){
try{
// var wb = window.XLSX.read(resData, {type:"array"});
//
// sheetSumPages = wb.SheetNames.length;
// $scope.currentSheetName = wb.SheetNames[sheetCurPageIndex];
// var data = window.XLSX.utils.sheet_to_json(wb.Sheets[$scope.currentSheetName]);
// console.log(data);
sheetSumPages = resData.length;
var curSheet = resData[sheetCurPageIndex];
$scope.currentSheetName = Object.keys(curSheet)[0];
if(resData && resData.length){
$scope.filePreview_dataGridUpdate(curSheet[$scope.currentSheetName]);
$("#filePreviewPop").modal("show");
}
}catch(e){
SweetAlert.warning(e.message);
}
}catch(e){
SweetAlert.warning(e.message);
}
}
$scope.viewRemoteFile = function (fileName, filePositionUrl) {
if(typeof filePositionUrl !== 'string'
|| filePositionUrl === 'null'
|| filePositionUrl === 'undefined')
return SweetAlert.warning($translate.instant('UnRecord'));
//区分文件类型
var fileType = fileName.split(".").pop();
if(/xlsx|xls/i.test(fileType)){
if(cacheUrl !== filePositionUrl){
cacheUrl = filePositionUrl;
sheetPromise = getXLS(filePositionUrl);
$scope.viewRemoteFile = function (fileName, filePositionUrl) {
if(typeof filePositionUrl !== 'string'
|| filePositionUrl == 'null'
|| filePositionUrl == 'undefined')
return SweetAlert.warning($translate.instant('UnRecord'));
//区分文件类型
var fileType = fileName.split(".").pop();
if(/xlsx|xls/i.test(fileType)){
if(cacheUrl !== filePositionUrl){
cacheUrl = filePositionUrl;
sheetPromise = getXLS(filePositionUrl);
}
sheetPromise.then(function(resData){renderXLS(resData)})
}
else if(/pdf/i.test(fileType)){
// return SweetAlert.warning('暂时不支持PDF预览');
$scope.openPdfPreviewPop(filePositionUrl);
}else{
SweetAlert.warning($translate.instant('UnFile'));
}
sheetPromise.then(function(resData){renderXLS(resData)})
}
else if(/pdf/i.test(fileType)){
// return SweetAlert.warning('暂时不支持PDF预览');
$scope.openPdfPreviewPop(filePositionUrl);
}else{
SweetAlert.warning($translate.instant('UnFile'));
}
};
};
$scope.filePreview_dataGridUpdate = function (_data) {
// console.info("excel:",_data);
$scope.previewData = _data || [{}];
var field_keys = Object.keys(_data[0]);
var field_values = Object.values(_data[0]);
_data.forEach(function(item){
var curRow_keys = Object.keys(item);
var curRow_values = Object.values(item);
if(curRow_keys && curRow_keys.length > field_keys.length){
field_keys = curRow_keys;
field_values = curRow_values;
}
});
$scope.filePreview_dataGridUpdate = function (_data) {
// console.info("excel:",_data);
$scope.previewData = _data || [{}];
var field_keys = Object.keys(_data[0]);
var field_values = Object.values(_data[0]);
_data.forEach(function(item){
var curRow_keys = Object.keys(item);
var curRow_values = Object.values(item);
if(curRow_keys && curRow_keys.length > field_keys.length){
field_keys = curRow_keys;
field_values = curRow_values;
}
});
$scope.filePreview_dataGridOptions = {
bindingOptions:{
dataSource: 'previewData',
},
showBorders: true,
paging: {
enable: true,
pageIndex: 1,
pageSize: 10
},
pager: {
allowedPageSizes: 5,
infoText: "当前 {0} / {1} ({2} )",
showInfo: true,
showNavigationButtons: true,
showPageSizeSelector: true,
visible: true
},
searchPanel: {//查询
highlightCaseSensitive: true,
highlightSearchText: true,
searchVisibleColumnsOnly: false,
text: "",
width: 518,
visible: true,
placeholder: $translate.instant('Search'),
},
sorting: {//排序
ascendingText: "Sort Ascending",
clearText: "Clear Sorting",
descendingText: "Sort Descending",
mode: "single"
},
showRowLines: true,
columnAutoWidth: true,
allowColumnReordering: true,
columns: (function(){
var cols = [];
field_keys.forEach(function(field,index){
cols.push({
dataField: field,
caption: (Object.keys(_data[0]).length === field_values.length) ? field_values[index]:index
$scope.filePreview_dataGridOptions = {
bindingOptions:{
dataSource: 'previewData',
},
showBorders: true,
paging: {
enable: true,
pageIndex: 1,
pageSize: 10
},
pager: {
allowedPageSizes: 5,
infoText: "当前 {0} / {1} ({2} )",
showInfo: true,
showNavigationButtons: true,
showPageSizeSelector: true,
visible: true
},
searchPanel: {//查询
highlightCaseSensitive: true,
highlightSearchText: true,
searchVisibleColumnsOnly: false,
text: "",
width: 518,
visible: true,
placeholder: $translate.instant('Search'),
},
sorting: {//排序
ascendingText: "Sort Ascending",
clearText: "Clear Sorting",
descendingText: "Sort Descending",
mode: "single"
},
showRowLines: true,
columnAutoWidth: true,
allowColumnReordering: true,
columns: (function(){
var cols = [];
field_keys.forEach(function(field,index){
cols.push({
dataField: field,
caption: (Object.keys(_data[0]).length == field_values.length) ? field_values[index]:index
});
});
});
return cols;
})(),
rowAlternationEnabled: true, //单双行颜色
};
var dataGrid = $('<div dx-data-grid="filePreview_dataGridOptions">');
$("#preview_dataGrid").html("").append(dataGrid);
$compile(dataGrid)($scope);
return cols;
})(),
rowAlternationEnabled: true, //单双行颜色
};
var dataGrid = $('<div dx-data-grid="filePreview_dataGridOptions">');
$("#preview_dataGrid").html("").append(dataGrid);
$compile(dataGrid)($scope);
};
};
$scope.hideFilePreviewPop = function(){
$("#preview_dataGrid").html("");
$("#filePreviewPop").modal("hide");
};
$scope.hideFilePreviewPop = function(){
$("#preview_dataGrid").html("");
$("#filePreviewPop").modal("hide");
};
$scope.resetDataForm = function(){
$scope.previewData.length = 0;
if($scope.filePreview_dataGridOptions)
$scope.filePreview_dataGridOptions.columns.length = 0;
};
$scope.resetDataForm = function(){
$scope.previewData.length = 0;
if($scope.filePreview_dataGridOptions)
$scope.filePreview_dataGridOptions.columns.length = 0;
};
}]
}]
}
});
taxDocumentManageModule.directive('pdfPreview',function(){
......@@ -1088,7 +1131,6 @@ taxDocumentManageModule.directive('pdfPreview',function(){
}]
}
});
taxDocumentManageModule.directive('helpPop',function(){
return{
......
......@@ -289,8 +289,8 @@
<select ng-model="queryFieldModel.fileAttr"
class="form-control radius3"
required placeholder="{{'PleaseSelected' | translate}}">
<option selected></option>
<option ng-repeat="fileAttr in fileAttrOptions track by $index" value="{{fileAttr}}">{{fileAttr}}</option>
<option ng-repeat="fileAttr in fileAttrOptions track by $index"
value="{{fileAttr}}">{{fileAttr}}</option>
</select>
<!--<input type="text" class="form-control radius3"-->
<!--ng-model="queryFieldModel.fileAttr"/>-->
......@@ -360,9 +360,10 @@
<div class="TDL-query-val">
<select ng-model="queryFieldModel.companyName" class="form-control radius3"
title="{{queryFieldModel.companyName}}" required placeholder="{{'PleaseSelected' | translate}}">
<option selected></option>
<option ng-repeat="(key,companyName) in companyNameOptionsMap"
ng-click="queryFieldModel.companyId = key"
ng-slected="queryFieldModel.companyName == companyName"
value="{{companyName}}">{{companyName}}</option>
</select>
</div>
......@@ -553,7 +554,9 @@
<!--placeholder="{{'PleaseSelected' | translate}}"-->
<!--ng-model="editFieldModel.fileAttr"-->
<!--required style="width:320px;" />-->
<select ng-model="editFieldModel.fileAttr" ng-init="editFieldModel.fileAttr = ''" class="form-control"
<select ng-model="editFieldModel.fileAttr"
ng-change="syncFileType(editFieldModel.fileAttr)"
class="form-control"
style="width:320px;" required placeholder="{{'PleaseSelected' | translate}}">
<option ng-repeat="fileAttr in fileAttrOptions track by $index"
ng-selected="(editFieldModel.fileAttr == fileAttr)"
......@@ -577,12 +580,13 @@
<!--placeholder="{{'PleaseSelected' | translate}}"-->
<!--ng-model="editFieldModel.companyName"-->
<!--required style="width:320px;" />-->
<select ng-model="editFieldModel.companyName" class="form-control" ng-init="editFieldModel.companyName = ''"
<select ng-model="editFieldModel.companyName" class="form-control"
title="{{editFieldModel.companyName}}" style="width:320px;" required placeholder="{{'PleaseSelected' | translate}}">
<option ng-repeat="(key,companyName) in companyNameOptionsMap"
ng-click="editFieldModel.companyId = key"
ng-selected="(editFieldModel.companyName == companyName)"
value="{{key}}">{{companyName}}</option>
value="{{companyName}}">{{companyName}}</option>
</select>
</div>
</div>
......@@ -591,15 +595,17 @@
<span style="color:red"> * </span>
{{'DocumentType' | translate}}
</label>
<div class="col-sm-11" style="width:61.67%" id="fileTypeOptions">
<div class="col-sm-11" style="width:61.67%">
<!--<input class="form-control"-->
<!--placeholder="{{'PleaseSelected' | translate}}"-->
<!--ng-model="editFieldModel.fileType"-->
<!--required style="width:320px;" />-->
<select ng-model="editFieldModel.fileType" class="form-control" ng-init="editFieldModel.fileType = ''"
<select ng-model="editFieldModel.fileType"
ng-disabled="curFileTypeOptions.length === 0"
class="form-control"
style="width:320px;" required placeholder="{{'PleaseSelected' | translate}}">
<option ng-repeat="fileType in fileTypeOptions track by $index"
<option ng-repeat="fileType in curFileTypeOptions track by $index"
ng-selected="(editFieldModel.fileType == fileType)"
value="{{fileType}}">{{fileType}}</option>
</select>
......@@ -761,8 +767,11 @@
<!--placeholder="{{'PleaseSelected' | translate}}"-->
<!--ng-model="editFieldModel.fileAttr"-->
<!--required style="width:280px;" />-->
<select ng-model="editFieldItem.fileAttr" ng-init="editFieldItem.fileAttr = ''" class="form-control"
style="width:280px;" required placeholder="{{'PleaseSelected' | translate}}">
<select ng-model="editFieldItem.fileAttr"
ng-change="syncFileType(editFieldItem.fileAttr)"
class="form-control"
style="width:280px;"
required placeholder="{{'PleaseSelected' | translate}}">
<option ng-repeat="fileAttr in fileAttrOptions track by $index"
ng-selected="(editFieldItem.fileAttr == fileAttr)"
value="{{fileAttr}}">{{fileAttr}}</option>
......@@ -804,9 +813,12 @@
<!--ng-model="editFieldModel.fileType"-->
<!--required style="width:280px;" />-->
<select ng-model="editFieldItem.fileType" class="form-control" ng-init="editFieldItem.fileType = ''"
style="width:280px;" required placeholder="{{'PleaseSelected' | translate}}">
<option ng-repeat="fileType in fileTypeOptions track by $index"
<select ng-model="editFieldItem.fileType"
ng-disabled="curFileTypeOptions.length === 0"
class="form-control"
style="width:280px;" required
placeholder="{{'PleaseSelected' | translate}}">
<option ng-repeat="fileType in curFileTypeOptions track by $index"
ng-selected="(editFieldItem.fileType == fileType)"
value="{{fileType}}">{{fileType}}</option>
</select>
......@@ -829,17 +841,18 @@
{{'Duration' | translate}}
</label>
<div class="col-sm-11" style="width:61.67%">
<input type='text' placeholder="{{'PleaseSelected' | translate}}" date-time-picker data-date-format="yyyy/mm/dd" style="width:280px;"
<input type='text' placeholder="{{'PleaseSelected' | translate}}"
date-time-picker data-date-format="yyyy/mm/dd" style="width:280px;"
class="form-control" ng-model="editFieldItem.ownTime" required
data-min-view="2"/>
</div>
</div>
<div class="col-sm-6 form-group">
<label class="col-sm-3 control-label">
{{'AvailabilityDate' | translate}}
<label class="col-sm-3 control-label" translate="AvailabilityDate">
</label>
<div class="col-sm-11" style="width:61.67%">
<input type='text' placeholder="{{'PleaseSelected' | translate}}" date-time-picker data-date-format="yyyy/mm/dd" style="width:280px;"
<input type='text' placeholder="{{'PleaseSelected' | translate}}"
date-time-picker data-date-format="yyyy/mm/dd" style="width:280px;"
class="form-control" ng-model="editFieldItem.fileTime"
data-min-view="2"/>
</div>
......@@ -847,7 +860,8 @@
<div class="col-sm-6 form-group">
<label class="col-sm-3 control-label" translate="DueDate"></label>
<div class="col-sm-11" style="width:61.67%">
<input type='text' placeholder="{{'PleaseSelected' | translate}}" date-time-picker data-date-format="yyyy/mm/dd" style="width:280px;"
<input type='text' placeholder="{{'PleaseSelected' | translate}}"
date-time-picker data-date-format="yyyy/mm/dd" style="width:280px;"
class="form-control" ng-model="editFieldItem.effectiveTime"
data-min-view="2"/>
</div>
......
......@@ -30,6 +30,9 @@ taxDocumentManageModule.factory('taxDocumentListService',
getDocumentsAttrAndType:function(params){
return jqFetch.post(apiInterceptor.webApiHostUrl + '/fileTypes/selectList', params);
},
readXLSX:function(params){
return jqFetch.post(apiInterceptor.webApiHostUrl + '/taxDoc/previewExcelToJson', params);
},
getBinaryData: function (url) {
var defer = $q.defer();
var oReq = new XMLHttpRequest();
......
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