Commit c9e60f8f authored by frank.xa.zhang's avatar frank.xa.zhang

fixed report display issue

parent ed7a17d0
...@@ -7,6 +7,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -7,6 +7,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import pwc.taxtech.atms.dto.CellTemplateConfigDto; import pwc.taxtech.atms.dto.CellTemplateConfigDto;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.service.CellTemplateService; import pwc.taxtech.atms.service.CellTemplateService;
import java.util.Collections; import java.util.Collections;
...@@ -21,17 +22,35 @@ public class CellTemplateController { ...@@ -21,17 +22,35 @@ public class CellTemplateController {
@RequestMapping(value = "configList/{templateID}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "configList/{templateID}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public @ResponseBody public @ResponseBody
List<CellTemplateConfigDto> GetConfigList(@PathVariable String templateID) { OperationResultDto<List<CellTemplateConfigDto>> GetConfigList(@PathVariable String templateID) {
if(StringUtils.isEmpty(templateID)){ OperationResultDto<List<CellTemplateConfigDto>> result = new OperationResultDto<>();
return Collections.emptyList();
if (StringUtils.isEmpty(templateID)) {
result.setData(Collections.emptyList());
}
try {
return cellTemplateService.getCellConfigList(templateID);
} catch (Exception e) {
logger.error("CellTemplateController.GetCellConfigList", e);
}
return result;
}
@RequestMapping(value = "config/{cellTemplateID}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public @ResponseBody
OperationResultDto<CellTemplateConfigDto> GetConfig(@PathVariable String cellTemplateID) {
if (StringUtils.isEmpty(cellTemplateID)) {
return new OperationResultDto<>();
} }
try { try {
return cellTemplateService.GetCellConfigList(templateID); return cellTemplateService.getCellConfig(cellTemplateID);
} catch (Exception e) { } catch (Exception e) {
logger.error("GetCellConfigList",e); logger.error("CellTemplateController.GetConfig", e);
} }
return Collections.emptyList(); return new OperationResultDto<>();
} }
} }
package pwc.taxtech.atms.service; package pwc.taxtech.atms.service;
import pwc.taxtech.atms.dto.CellTemplateConfigDto; import pwc.taxtech.atms.dto.CellTemplateConfigDto;
import pwc.taxtech.atms.dto.OperationResultDto;
import java.util.List; import java.util.List;
public interface CellTemplateService { public interface CellTemplateService {
List<CellTemplateConfigDto> GetCellConfigList(String templateID); OperationResultDto<List<CellTemplateConfigDto>> getCellConfigList(String templateID);
OperationResultDto<CellTemplateConfigDto> getCellConfig(String cellTemplateID);
} }
...@@ -43,7 +43,7 @@ public final class CellConfigTranslater { ...@@ -43,7 +43,7 @@ public final class CellConfigTranslater {
cellTemplateConfigDto.setFormulaDescription(description); cellTemplateConfigDto.setFormulaDescription(description);
Optional<CellTemplateConfig> formulaItem = configList.stream().filter(a -> a.getDataSourceType().equals(CellDataSourceType.valueOf("Formula"))).findFirst(); Optional<CellTemplateConfig> formulaItem = configList.stream().filter(a -> a.getDataSourceType().equals(CellDataSourceType.valueOf("Formula"))).findFirst();
if (formulaItem != null) { if (formulaItem.isPresent()) {
cellTemplateConfigDto.setHasFormula(true); cellTemplateConfigDto.setHasFormula(true);
cellTemplateConfigDto.setFormula(formulaItem.get().getFormula()); cellTemplateConfigDto.setFormula(formulaItem.get().getFormula());
if (StringUtils.isEmpty(cellTemplateConfigDto.getFormulaDescription()) if (StringUtils.isEmpty(cellTemplateConfigDto.getFormulaDescription())
...@@ -55,7 +55,7 @@ public final class CellConfigTranslater { ...@@ -55,7 +55,7 @@ public final class CellConfigTranslater {
} }
Optional<CellTemplateConfig> voucherItem = configList.stream().filter(x -> x.getDataSourceType().equals(CellDataSourceType.valueOf("Voucher"))).findFirst(); Optional<CellTemplateConfig> voucherItem = configList.stream().filter(x -> x.getDataSourceType().equals(CellDataSourceType.valueOf("Voucher"))).findFirst();
if (voucherItem != null) { if (voucherItem.isPresent()) {
cellTemplateConfigDto.setHasVoucher(true); cellTemplateConfigDto.setHasVoucher(true);
cellTemplateConfigDto.setVoucherKeyword(voucherItem.get().getVoucherKeyword() == null ? "" : voucherItem.get().getVoucherKeyword()); cellTemplateConfigDto.setVoucherKeyword(voucherItem.get().getVoucherKeyword() == null ? "" : voucherItem.get().getVoucherKeyword());
if (!StringUtils.isEmpty(voucherItem.get().getAccountCodes())) { if (!StringUtils.isEmpty(voucherItem.get().getAccountCodes())) {
...@@ -64,7 +64,7 @@ public final class CellConfigTranslater { ...@@ -64,7 +64,7 @@ public final class CellConfigTranslater {
} }
Optional<CellTemplateConfig> invoiceItem = configList.stream().filter(x -> x.getDataSourceType().equals(CellDataSourceType.valueOf("OutputInvoice")) || x.getDataSourceType().equals(CellDataSourceType.valueOf("InputInvoice")) || x.getDataSourceType().equals(CellDataSourceType.valueOf("CustomInvoice"))).findFirst(); Optional<CellTemplateConfig> invoiceItem = configList.stream().filter(x -> x.getDataSourceType().equals(CellDataSourceType.valueOf("OutputInvoice")) || x.getDataSourceType().equals(CellDataSourceType.valueOf("InputInvoice")) || x.getDataSourceType().equals(CellDataSourceType.valueOf("CustomInvoice"))).findFirst();
if (invoiceItem != null) { if (invoiceItem.isPresent()) {
cellTemplateConfigDto.setHasInvoice(true); cellTemplateConfigDto.setHasInvoice(true);
cellTemplateConfigDto.setInvoiceType(invoiceItem.get().getInvoiceType()); cellTemplateConfigDto.setInvoiceType(invoiceItem.get().getInvoiceType());
cellTemplateConfigDto.setInvoiceAmountType(invoiceItem.get().getInvoiceAmountType()); cellTemplateConfigDto.setInvoiceAmountType(invoiceItem.get().getInvoiceAmountType());
...@@ -85,18 +85,18 @@ public final class CellConfigTranslater { ...@@ -85,18 +85,18 @@ public final class CellConfigTranslater {
} }
Optional<CellTemplateConfig> keyInItem = configList.stream().filter(x -> x.getDataSourceType().equals(CellDataSourceType.valueOf("KeyIn"))).findFirst(); Optional<CellTemplateConfig> keyInItem = configList.stream().filter(x -> x.getDataSourceType().equals(CellDataSourceType.valueOf("KeyIn"))).findFirst();
if (keyInItem != null) { if (keyInItem.isPresent()) {
cellTemplateConfigDto.setHasKeyIn(true); cellTemplateConfigDto.setHasKeyIn(true);
} }
Optional<CellTemplateConfig> modelItem = configList.stream().filter(x -> x.getDataSourceType().equals(CellDataSourceType.valueOf("RelatedModel"))).findFirst(); Optional<CellTemplateConfig> modelItem = configList.stream().filter(x -> x.getDataSourceType().equals(CellDataSourceType.valueOf("RelatedModel"))).findFirst();
if (modelItem != null) { if (modelItem.isPresent()) {
cellTemplateConfigDto.setHasModel(true); cellTemplateConfigDto.setHasModel(true);
cellTemplateConfigDto.setModelIDs(GetList(modelItem.get().getModelIDs())); cellTemplateConfigDto.setModelIDs(GetList(modelItem.get().getModelIDs()));
} }
Optional<CellTemplateConfig> validationItem = configList.stream().filter(x -> x.getDataSourceType().equals(CellDataSourceType.valueOf("Validation"))).findFirst(); Optional<CellTemplateConfig> validationItem = configList.stream().filter(x -> x.getDataSourceType().equals(CellDataSourceType.valueOf("Validation"))).findFirst();
if (validationItem != null) { if (validationItem.isPresent()) {
cellTemplateConfigDto.setHasValidation(true); cellTemplateConfigDto.setHasValidation(true);
cellTemplateConfigDto.setValidation(validationItem.get().getValidation()); cellTemplateConfigDto.setValidation(validationItem.get().getValidation());
cellTemplateConfigDto.setValidationDescription(validationItem.get().getValidationDescription()); cellTemplateConfigDto.setValidationDescription(validationItem.get().getValidationDescription());
......
package pwc.taxtech.atms.service.impl; package pwc.taxtech.atms.service.impl;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import pwc.taxtech.atms.dao.CellTemplateMapper;
import pwc.taxtech.atms.dto.CellTemplateConfigDto; import pwc.taxtech.atms.dto.CellTemplateConfigDto;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.entitiy.CellTemplate; import pwc.taxtech.atms.entitiy.CellTemplate;
import pwc.taxtech.atms.entitiy.CellTemplateConfig; import pwc.taxtech.atms.entitiy.CellTemplateConfig;
import pwc.taxtech.atms.entitiy.CellTemplateConfigExample;
import pwc.taxtech.atms.entitiy.CellTemplateExample; import pwc.taxtech.atms.entitiy.CellTemplateExample;
import pwc.taxtech.atms.service.CellTemplateService; import pwc.taxtech.atms.service.CellTemplateService;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -15,19 +19,56 @@ import java.util.stream.Collectors; ...@@ -15,19 +19,56 @@ import java.util.stream.Collectors;
public class CellTemplateServiceImpl extends AbstractService implements CellTemplateService { public class CellTemplateServiceImpl extends AbstractService implements CellTemplateService {
@Override @Override
public List<CellTemplateConfigDto> GetCellConfigList(String templateID) { public OperationResultDto<List<CellTemplateConfigDto>> getCellConfigList(String templateID) {
List<CellTemplateConfigDto> result = new ArrayList<>(); OperationResultDto<List<CellTemplateConfigDto>> result = new OperationResultDto<>();
CellTemplateExample example = new CellTemplateExample(); CellTemplateExample example = new CellTemplateExample();
example.createCriteria().andReportTemplateIDEqualTo(templateID); example.createCriteria().andReportTemplateIDEqualTo(templateID);
List<CellTemplate> cellTemplateList = cellTemplateMapper.selectByExample(example); List<CellTemplate> cellTemplateList = cellTemplateMapper.selectByExample(example);
List<CellTemplateConfig> configList = cellTemplateConfigMapper.getCellTemplateConfigByTemplateID(templateID); List<CellTemplateConfig> configList = cellTemplateConfigMapper.getCellTemplateConfigByTemplateID(templateID);
if (cellTemplateList.isEmpty()) { if (cellTemplateList.isEmpty()) {
result.setData(Collections.emptyList());
return result; return result;
} }
List<CellTemplateConfigDto> rData = new ArrayList<>();
for (CellTemplate x : cellTemplateList) { for (CellTemplate x : cellTemplateList) {
result.add(GetConfigDto(x, configList.stream().filter(a -> a.getCellTemplateID().equalsIgnoreCase(x.getID())).collect(Collectors.toList()))); rData.add(GetConfigDto(x, configList.stream().filter(a -> a.getCellTemplateID().equalsIgnoreCase(x.getID())).collect(Collectors.toList())));
} }
if (rData.size() > 0) {
result.setResult(true);
result.setData(rData);
} else {
result.setData(Collections.emptyList());
}
return result;
}
@Override
public OperationResultDto<CellTemplateConfigDto> getCellConfig(String cellTemplateID) {
OperationResultDto<CellTemplateConfigDto> result = new OperationResultDto<>();
CellTemplate config = cellTemplateMapper.selectByPrimaryKey(cellTemplateID);
if (config.equals(null)) {
result.setResultMsg("NoData");
return result;
}
CellTemplateConfigExample example = new CellTemplateConfigExample();
example.createCriteria().andCellTemplateIDEqualTo(cellTemplateID);
List<CellTemplateConfig> configList = cellTemplateConfigMapper.selectByExample(example);
result.setData(GetConfigDto(config, configList));
if (result.getData().equals(null)) {
result.setResultMsg("NoData");
return result;
}
result.setResult(true);
return result; return result;
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
'templateService', 'templateFormulaService', 'stdAccountService', 'spreadJsTipService', 'enums', 'KeyValueConfigService', 'modelConfigurationService', 'industryService', 'templateService', 'templateFormulaService', 'stdAccountService', 'spreadJsTipService', 'enums', 'KeyValueConfigService', 'modelConfigurationService', 'industryService',
'formulaService', 'serviceTypeService', 'mentioUtil', 'region', 'formulaService', 'serviceTypeService', 'mentioUtil', 'region',
function ($scope, $log, $timeout, $translate, $rootScope, $interval, $compile, $uibModal, $q, SweetAlert, templateGroupService, templateService, templateFormulaService, function ($scope, $log, $timeout, $translate, $rootScope, $interval, $compile, $uibModal, $q, SweetAlert, templateGroupService, templateService, templateFormulaService,
stdAccountService, spreadJsTipService, enums, KeyValueConfigService, modelConfigurationService, industryService, formulaService, serviceTypeService, mentioUtil, region) { stdAccountService, spreadJsTipService, enums, KeyValueConfigService, modelConfigurationService, industryService, formulaService, serviceTypeService, mentioUtil, region) {
'use strict'; 'use strict';
var keyValueExp = /@\S*/g; var keyValueExp = /@\S*/g;
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
}; };
var serviceTypeMapping = { var serviceTypeMapping = {
VAT: $translate.instant('VAT'), VAT: $translate.instant('VAT'),
RPT: $translate.instant('RPT'), RPT: $translate.instant('RPT'),
...@@ -425,56 +424,56 @@ ...@@ -425,56 +424,56 @@
categoryOptions: [], categoryOptions: [],
rateOptions: [], rateOptions: [],
amountTypeOptions: [ amountTypeOptions: [
{ name: 'PleaseSelect', value: 0 }, {name: 'PleaseSelect', value: 0},
{ name: 'TotalAmount', value: 1 }, {name: 'TotalAmount', value: 1},
{ name: 'TaxAmount', value: 2 }, {name: 'TaxAmount', value: 2},
{ name: 'CopyNumber', value: 3 } {name: 'CopyNumber', value: 3}
] ]
}, },
{ {
type: 'Income', type: 'Income',
value: 1, value: 1,
categoryOptions: _.chain(enums.invoiceType).pairs().map(function (it) { categoryOptions: _.chain(enums.invoiceType).pairs().map(function (it) {
return { key: $translate.instant(it[0]), value: it[1], ticked: false }; return {key: $translate.instant(it[0]), value: it[1], ticked: false};
}).value(), }).value(),
rateOptions: [ rateOptions: [
{ key: '17%', value: '17%', ticked: false }, {key: '17%', value: '17%', ticked: false},
{ key: '13%', value: '13%', ticked: false }, {key: '13%', value: '13%', ticked: false},
{ key: '11%', value: '11%', ticked: false }, {key: '11%', value: '11%', ticked: false},
{ key: '6%', value: '6%', ticked: false }, {key: '6%', value: '6%', ticked: false},
{ key: '5%', value: '5%', ticked: false }, {key: '5%', value: '5%', ticked: false},
{ key: '4%', value: '4%', ticked: false }, {key: '4%', value: '4%', ticked: false},
{ key: '3%', value: '3%', ticked: false }, {key: '3%', value: '3%', ticked: false},
{ key: '1.5%', value: '1.5%', ticked: false } {key: '1.5%', value: '1.5%', ticked: false}
], ],
amountTypeOptions: [ amountTypeOptions: [
{ name: 'PleaseSelect', value: 0 }, {name: 'PleaseSelect', value: 0},
{ name: 'TotalAmount', value: 1 }, {name: 'TotalAmount', value: 1},
{ name: 'TaxAmount', value: 2 }, {name: 'TaxAmount', value: 2},
{ name: 'CopyNumber', value: 3 } {name: 'CopyNumber', value: 3}
] ]
}, },
{ {
type: 'Output', type: 'Output',
value: 2, value: 2,
categoryOptions: _.chain(enums.outputInvoiceType).pairs().map(function (it) { categoryOptions: _.chain(enums.outputInvoiceType).pairs().map(function (it) {
return { key: $translate.instant(it[0]), value: it[1], ticked: false }; return {key: $translate.instant(it[0]), value: it[1], ticked: false};
}).value(), }).value(),
rateOptions: [ rateOptions: [
{ key: '17%', value: '17%', ticked: false }, {key: '17%', value: '17%', ticked: false},
{ key: '13%', value: '13%', ticked: false }, {key: '13%', value: '13%', ticked: false},
{ key: '11%', value: '11%', ticked: false }, {key: '11%', value: '11%', ticked: false},
{ key: '6%', value: '6%', ticked: false }, {key: '6%', value: '6%', ticked: false},
{ key: '5%', value: '5%', ticked: false }, {key: '5%', value: '5%', ticked: false},
{ key: '4%', value: '4%', ticked: false }, {key: '4%', value: '4%', ticked: false},
{ key: '3%', value: '3%', ticked: false }, {key: '3%', value: '3%', ticked: false},
{ key: '1.5%', value: '1.5%', ticked: false } {key: '1.5%', value: '1.5%', ticked: false}
], ],
amountTypeOptions: [ amountTypeOptions: [
{ name: 'PleaseSelect', value: 0 }, {name: 'PleaseSelect', value: 0},
{ name: 'TotalAmount', value: 1 }, {name: 'TotalAmount', value: 1},
{ name: 'TaxAmount', value: 2 }, {name: 'TaxAmount', value: 2},
{ name: 'CopyNumber', value: 3 } {name: 'CopyNumber', value: 3}
] ]
}, },
{ {
...@@ -483,10 +482,10 @@ ...@@ -483,10 +482,10 @@
categoryOptions: [], categoryOptions: [],
rateOptions: [], rateOptions: [],
amountTypeOptions: [ amountTypeOptions: [
{ name: 'PleaseSelect', value: 0 }, {name: 'PleaseSelect', value: 0},
{ name: 'TotalAmount', value: 1 }, {name: 'TotalAmount', value: 1},
{ name: 'TaxAmount', value: 2 }, {name: 'TaxAmount', value: 2},
{ name: 'CopyNumber', value: 3 } {name: 'CopyNumber', value: 3}
] ]
} }
]; ];
...@@ -496,7 +495,7 @@ ...@@ -496,7 +495,7 @@
// 选中某一发票类型级联更新税率与金额类型列表 // 选中某一发票类型级联更新税率与金额类型列表
var selectInvoiceOption = function (editModel, invoiceType, isInit) { var selectInvoiceOption = function (editModel, invoiceType, isInit) {
var selectedInvoice = _.where($scope.invoiceOptions, { value: invoiceType }); var selectedInvoice = _.where($scope.invoiceOptions, {value: invoiceType});
var op = selectedInvoice.length === 0 ? $scope.invoiceOptions[0] : selectedInvoice[0]; var op = selectedInvoice.length === 0 ? $scope.invoiceOptions[0] : selectedInvoice[0];
// 如果获取到的editModel.invoiceCategory为[ 99 ],代表发票类型全选; // 如果获取到的editModel.invoiceCategory为[ 99 ],代表发票类型全选;
...@@ -528,7 +527,7 @@ ...@@ -528,7 +527,7 @@
}); });
var choseAmoutType = isInit && editModel.invoiceAmountType && editModel.invoiceAmountType > 0 ? var choseAmoutType = isInit && editModel.invoiceAmountType && editModel.invoiceAmountType > 0 ?
_.where(op.amountTypeOptions, { value: editModel.invoiceAmountType })[0] : op.amountTypeOptions[0]; _.where(op.amountTypeOptions, {value: editModel.invoiceAmountType})[0] : op.amountTypeOptions[0];
editModel.chosenInvoiceOption = { editModel.chosenInvoiceOption = {
type: op.type, type: op.type,
...@@ -564,12 +563,12 @@ ...@@ -564,12 +563,12 @@
}); });
_spread = spread; _spread = spread;
var activeSheet = _spread.getActiveSheet(); var activeSheet = _spread.getSheet(1);
//设置整个sheet不可编辑 //设置整个sheet不可编辑
activeSheet.setIsProtected(true); activeSheet.isProtected = true;
activeSheet.protectionOption({ activeSheet.options.protectionOption = {
allowEditObjects: false allowEditObjects: false
}); };
$scope.activeSheet = activeSheet; $scope.activeSheet = activeSheet;
...@@ -644,7 +643,7 @@ ...@@ -644,7 +643,7 @@
if (isHideContextMenu) { if (isHideContextMenu) {
hideSpreadContextMenu(); hideSpreadContextMenu();
} else { } else {
$contextMenu.css({ left: e.pageX, top: e.pageY }); $contextMenu.css({left: e.pageX, top: e.pageY});
$contextMenu.show(); $contextMenu.show();
$(document).on("click.contextmenu", function () { $(document).on("click.contextmenu", function () {
...@@ -728,7 +727,7 @@ ...@@ -728,7 +727,7 @@
for (var i = 0; i < spans[k].rowCount; i++) { for (var i = 0; i < spans[k].rowCount; i++) {
for (var j = 0; j < spans[k].colCount; j++) { for (var j = 0; j < spans[k].colCount; j++) {
if (i > 0 || j > 0) { if (i > 0 || j > 0) {
exceptedCells.push({ rowIndex: spans[k].row + i, columnIndex: spans[k].col + j }); exceptedCells.push({rowIndex: spans[k].row + i, columnIndex: spans[k].col + j});
} }
} }
} }
...@@ -747,8 +746,8 @@ ...@@ -747,8 +746,8 @@
var col = startCol + j; var col = startCol + j;
if (_.every(exceptedCells, function (c) { if (_.every(exceptedCells, function (c) {
return c.rowIndex !== row || c.columnIndex !== col; return c.rowIndex !== row || c.columnIndex !== col;
})) { })) {
validPosition.push({ rowIndex: row, columnIndex: col }); validPosition.push({rowIndex: row, columnIndex: col});
} }
} }
} }
...@@ -761,20 +760,20 @@ ...@@ -761,20 +760,20 @@
var confirmWarningWindow = function (title, text) { var confirmWarningWindow = function (title, text) {
var deferred = $q.defer(); var deferred = $q.defer();
SweetAlert.swal({ SweetAlert.swal({
title: title, title: title,
text: text, text: text,
type: "warning", type: "warning",
showCancelButton: true, showCancelButton: true,
confirmButtonColor: "#DD6B55", confirmButtonColor: "#DD6B55",
allowOutsideClick: false, allowOutsideClick: false,
confirmButtonText: $translate.instant('Confirm'), confirmButtonText: $translate.instant('Confirm'),
cancelButtonText: $translate.instant('Cancel'), cancelButtonText: $translate.instant('Cancel'),
closeOnConfirm: true, closeOnConfirm: true,
closeOnCancel: true closeOnCancel: true
}, },
function (isConfirm) { function (isConfirm) {
deferred.resolve(isConfirm); deferred.resolve(isConfirm);
}); });
return deferred.promise; return deferred.promise;
}; };
...@@ -803,7 +802,7 @@ ...@@ -803,7 +802,7 @@
selectInvoiceOption($scope.editModel, $scope.editModel.invoiceType, true); selectInvoiceOption($scope.editModel, $scope.editModel.invoiceType, true);
// invoiceOption: Used to save invoice tax rate and amount type options temporarily // invoiceOption: Used to save invoice tax rate and amount type options temporarily
$scope.invoiceOption = _.findWhere($scope.invoiceOptions, { type: $scope.editModel.chosenInvoiceOption.type }); $scope.invoiceOption = _.findWhere($scope.invoiceOptions, {type: $scope.editModel.chosenInvoiceOption.type});
$scope.mentionApi.triggerValidator($scope.editModel.formula, $scope.editReportFormulaForm.formula); $scope.mentionApi.triggerValidator($scope.editModel.formula, $scope.editReportFormulaForm.formula);
$scope.mentionApiForValidation.triggerValidator($scope.editModel.validation, $scope.editReportFormulaForm.validation); $scope.mentionApiForValidation.triggerValidator($scope.editModel.validation, $scope.editReportFormulaForm.validation);
...@@ -865,10 +864,10 @@ ...@@ -865,10 +864,10 @@
} }
}, },
columns: [ columns: [
{ caption: $translate.instant('SubjectCodeCol'), dataField: 'code' }, {caption: $translate.instant('SubjectCodeCol'), dataField: 'code'},
{ caption: $translate.instant('SubjectNameCol'), dataField: 'name' }, {caption: $translate.instant('SubjectNameCol'), dataField: 'name'},
{ caption: $translate.instant('SubjectDirectionCol'), dataField: 'directionName' }, {caption: $translate.instant('SubjectDirectionCol'), dataField: 'directionName'},
{ caption: $translate.instant('SubjectTypeCol'), dataField: 'AcctPropName' }, {caption: $translate.instant('SubjectTypeCol'), dataField: 'AcctPropName'},
{ {
alignment: 'center', alignment: 'center',
width: '40px', width: '40px',
...@@ -921,12 +920,12 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasVoucher"/>'); ...@@ -921,12 +920,12 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasVoucher"/>');
} }
}, },
columns: [ columns: [
{ caption: $translate.instant('ModelCode'), dataField: 'code', visible: false }, {caption: $translate.instant('ModelCode'), dataField: 'code', visible: false},
{ caption: $translate.instant('ModelName'), dataField: 'name' }, {caption: $translate.instant('ModelName'), dataField: 'name'},
{ caption: $translate.instant('ModelDescription'), dataField: 'description' }, {caption: $translate.instant('ModelDescription'), dataField: 'description'},
{ caption: $translate.instant('ModelFeature'), dataField: 'featureName' }, {caption: $translate.instant('ModelFeature'), dataField: 'featureName'},
{ caption: $translate.instant('ModelType'), dataField: 'modelTypeName' }, {caption: $translate.instant('ModelType'), dataField: 'modelTypeName'},
{ caption: $translate.instant('ModelOrganization'), dataField: 'organizationName' }, {caption: $translate.instant('ModelOrganization'), dataField: 'organizationName'},
{ {
alignment: 'center', alignment: 'center',
width: '40px', width: '40px',
...@@ -1081,7 +1080,7 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>'); ...@@ -1081,7 +1080,7 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
var operatorMatches = ngModelValue.match(notDuplicateOperatorExp); var operatorMatches = ngModelValue.match(notDuplicateOperatorExp);
if (_.any(operatorMatches, function (m) { if (_.any(operatorMatches, function (m) {
return m.length > 1; return m.length > 1;
})) { })) {
ngModel.$setValidity('operatorDuplicateValidator', false); ngModel.$setValidity('operatorDuplicateValidator', false);
return false; return false;
} }
...@@ -1151,7 +1150,7 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>'); ...@@ -1151,7 +1150,7 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
$scope.editModel.formula = $.trim($scope.editModel.formula) + e.formula + '(' + e.param; $scope.editModel.formula = $.trim($scope.editModel.formula) + e.formula + '(' + e.param;
} }
} }
}, }
}; };
/*********************** End Formula Editor ***********************************/ /*********************** End Formula Editor ***********************************/
...@@ -1262,7 +1261,7 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>'); ...@@ -1262,7 +1261,7 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
var operatorMatches = ngModelValue.match(notDuplicateOperatorExp); var operatorMatches = ngModelValue.match(notDuplicateOperatorExp);
if (_.any(operatorMatches, function (m) { if (_.any(operatorMatches, function (m) {
return m.length > 1; return m.length > 1;
})) { })) {
ngModel.$setValidity('operatorDuplicateValidator', false); ngModel.$setValidity('operatorDuplicateValidator', false);
return false; return false;
} }
...@@ -1337,33 +1336,33 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>'); ...@@ -1337,33 +1336,33 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
/*********************** End Formula Editor ***********************************/ /*********************** End Formula Editor ***********************************/
//模板另存为 //模板另存为
var saveTemplateGroup = function () { var saveTemplateGroup = function () {
var groupName = $scope.groupName; var groupName = $scope.groupName;
if (groupName === '' || groupName === undefined) { if (groupName === '' || groupName === undefined) {
SweetAlert.warning($translate.instant('InputTemplateGroupNameWarning')); SweetAlert.warning($translate.instant('InputTemplateGroupNameWarning'));
return; return;
}
$scope.newTemplateGroup.Name = groupName;
$scope.newTemplateGroup.ServiceTypeID = $scope.curServiceTypeId;
$scope.newTemplateGroup.CopyFrom = $scope.curTemplateGroup.id;
$scope.newTemplateGroup.groupType = $scope.curTemplateGroup.groupType;
$scope.newTemplateGroup.payTaxType = $scope.curTemplateGroup.payTaxType;
$scope.newTemplateGroup.industryIDs = $scope.curTemplateGroup.industryIDs;
$scope.newTemplateGroup.ChangedFormulas = $scope.formulasArrayTemp;
templateGroupService.addTemplateGroup($scope.newTemplateGroup).success(function (or) {
if (or && or.result) {
SweetAlert.success($translate.instant('TemplateGroupSaveAsSuccess'));
loadTemplateGroup();
$('#templateName').val('');
$('.templates-save-form').css('display', 'none');
} else {
SweetAlert.warning($translate.instant(or.resultMsg));
} }
});
}; $scope.newTemplateGroup.Name = groupName;
$scope.newTemplateGroup.ServiceTypeID = $scope.curServiceTypeId;
$scope.newTemplateGroup.CopyFrom = $scope.curTemplateGroup.id;
$scope.newTemplateGroup.groupType = $scope.curTemplateGroup.groupType;
$scope.newTemplateGroup.payTaxType = $scope.curTemplateGroup.payTaxType;
$scope.newTemplateGroup.industryIDs = $scope.curTemplateGroup.industryIDs;
$scope.newTemplateGroup.ChangedFormulas = $scope.formulasArrayTemp;
templateGroupService.addTemplateGroup($scope.newTemplateGroup).success(function (or) {
if (or && or.result) {
SweetAlert.success($translate.instant('TemplateGroupSaveAsSuccess'));
loadTemplateGroup();
$('#templateName').val('');
$('.templates-save-form').css('display', 'none');
} else {
SweetAlert.warning($translate.instant(or.resultMsg));
}
});
};
var loadTemplateMenu = function () { var loadTemplateMenu = function () {
...@@ -1411,21 +1410,21 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>'); ...@@ -1411,21 +1410,21 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
// 如果发票类型全选,则将editModel.invoiceCategory设置为[ 99 ]; // 如果发票类型全选,则将editModel.invoiceCategory设置为[ 99 ];
// 否则将选中的发票类型存入editModel.invoiceCategory数组,如[1, 2, 3] // 否则将选中的发票类型存入editModel.invoiceCategory数组,如[1, 2, 3]
if ($scope.editModel.chosenInvoiceOption.categoryOptions.length > 0 && if ($scope.editModel.chosenInvoiceOption.categoryOptions.length > 0 &&
_.every($scope.editModel.chosenInvoiceOption.categoryOptions, { ticked: true })) { _.every($scope.editModel.chosenInvoiceOption.categoryOptions, {ticked: true})) {
$scope.editModel.invoiceCategory = [Number(constant.selectAllValue)]; $scope.editModel.invoiceCategory = [Number(constant.selectAllValue)];
} else { } else {
$scope.editModel.invoiceCategory = _.chain($scope.editModel.chosenInvoiceOption.categoryOptions) $scope.editModel.invoiceCategory = _.chain($scope.editModel.chosenInvoiceOption.categoryOptions)
.where({ ticked: true }).pluck('value').value(); .where({ticked: true}).pluck('value').value();
} }
// 如果税率全选,则将editModel.taxRate设置为[ '99' ]; // 如果税率全选,则将editModel.taxRate设置为[ '99' ];
// 否则将选中的税率存入editModel.taxRate数组,如['17%', '11%', '6%'] // 否则将选中的税率存入editModel.taxRate数组,如['17%', '11%', '6%']
if ($scope.editModel.chosenInvoiceOption.rateOptions.length > 0 && if ($scope.editModel.chosenInvoiceOption.rateOptions.length > 0 &&
_.every($scope.editModel.chosenInvoiceOption.rateOptions, { ticked: true })) { _.every($scope.editModel.chosenInvoiceOption.rateOptions, {ticked: true})) {
$scope.editModel.taxRate = [constant.selectAllValue]; $scope.editModel.taxRate = [constant.selectAllValue];
} else { } else {
$scope.editModel.taxRate = _.chain($scope.editModel.chosenInvoiceOption.rateOptions) $scope.editModel.taxRate = _.chain($scope.editModel.chosenInvoiceOption.rateOptions)
.where({ ticked: true }).pluck('value').value(); .where({ticked: true}).pluck('value').value();
} }
$scope.editModel.invoiceType = $scope.editModel.chosenInvoiceOption.value; $scope.editModel.invoiceType = $scope.editModel.chosenInvoiceOption.value;
...@@ -1549,17 +1548,17 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>'); ...@@ -1549,17 +1548,17 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
var groupedParamList = _.groupBy(result[2].data.data, 'formulaID'); var groupedParamList = _.groupBy(result[2].data.data, 'formulaID');
var paramList = result[1].data.data; var paramList = result[1].data.data;
_.each(groupedParamList, function (val, key) { _.each(groupedParamList, function (val, key) {
var formula = _.findWhere(formulaList, { id: key }); var formula = _.findWhere(formulaList, {id: key});
if (formula) { if (formula) {
formula.params = _.chain(val) formula.params = _.chain(val)
.map(function (p) { .map(function (p) {
return { id: p.formulaParamID, index: p.paramIndex }; return {id: p.formulaParamID, index: p.paramIndex};
}) })
.sortBy(function (p) { .sortBy(function (p) {
return p.index; return p.index;
}).value(); }).value();
_.each(formula.params, function (p, idx) { _.each(formula.params, function (p, idx) {
var param = _.findWhere(paramList, { id: p.id }); var param = _.findWhere(paramList, {id: p.id});
_.extend(p, param); _.extend(p, param);
}); });
} }
...@@ -1578,14 +1577,14 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>'); ...@@ -1578,14 +1577,14 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
var modelTypes = _.invert(enums.modelType); var modelTypes = _.invert(enums.modelType);
_.each(data, function (m) { _.each(data, function (m) {
if (m.type.toString() === modelTypes.SystemCommonModel) { if (m.type.toString() === modelTypes.SystemCommonModel) {
if (!_.some(rtn, { id: m.id })) { if (!_.some(rtn, {id: m.id})) {
m.orgID = null; m.orgID = null;
m.organizationName = $translate.instant('All'); m.organizationName = $translate.instant('All');
m.featureName = $translate.instant(enums.modelFeature[m.feature]); m.featureName = $translate.instant(enums.modelFeature[m.feature]);
rtn.push(m); rtn.push(m);
} }
} else { } else {
var existsModel = _.findWhere(rtn, { id: m.id }); var existsModel = _.findWhere(rtn, {id: m.id});
if (!existsModel) { if (!existsModel) {
m.featureName = $translate.instant(enums.modelFeature[m.feature]); m.featureName = $translate.instant(enums.modelFeature[m.feature]);
rtn.push(m); rtn.push(m);
...@@ -1691,8 +1690,8 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>'); ...@@ -1691,8 +1690,8 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
newValue.value <= 0 || newValue.value <= 0 ||
newValue.invoiceAmountType.value <= 0 || newValue.invoiceAmountType.value <= 0 ||
newValue.value !== 3 && newValue.value !== 3 &&
(_.every(newValue.categoryOptions, { ticked: false }) || (_.every(newValue.categoryOptions, {ticked: false}) ||
_.every(newValue.rateOptions, { ticked: false })))) { _.every(newValue.rateOptions, {ticked: false})))) {
$scope.editReportFormulaForm.invoice.$setValidity('invoiceNotSelectValidator', false); $scope.editReportFormulaForm.invoice.$setValidity('invoiceNotSelectValidator', false);
} else { } else {
$scope.editReportFormulaForm.invoice.$setValidity('invoiceNotSelectValidator', true); $scope.editReportFormulaForm.invoice.$setValidity('invoiceNotSelectValidator', true);
...@@ -1706,8 +1705,8 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>'); ...@@ -1706,8 +1705,8 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
$scope.editModel.chosenInvoiceOption.value <= 0 || $scope.editModel.chosenInvoiceOption.value <= 0 ||
$scope.editModel.chosenInvoiceOption.invoiceAmountType.value <= 0 || $scope.editModel.chosenInvoiceOption.invoiceAmountType.value <= 0 ||
$scope.editModel.chosenInvoiceOption.value !== 3 && $scope.editModel.chosenInvoiceOption.value !== 3 &&
(_.every($scope.editModel.chosenInvoiceOption.rateOptions, { ticked: false }) || (_.every($scope.editModel.chosenInvoiceOption.rateOptions, {ticked: false}) ||
_.every($scope.editModel.chosenInvoiceOption.categoryOptions, { ticked: false }))) { _.every($scope.editModel.chosenInvoiceOption.categoryOptions, {ticked: false}))) {
$scope.editReportFormulaForm.invoice.$setValidity('invoiceNotSelectValidator', false); $scope.editReportFormulaForm.invoice.$setValidity('invoiceNotSelectValidator', false);
} }
}); });
...@@ -2064,7 +2063,8 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>'); ...@@ -2064,7 +2063,8 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
$('#' + dxControl.templateDropDownId).dxDropDownBox({ $('#' + dxControl.templateDropDownId).dxDropDownBox({
value: selectName, value: selectName,
showClearButton: false, showClearButton: false,
onContentReady: function (args) { }, onContentReady: function (args) {
},
contentTemplate: function (e) { contentTemplate: function (e) {
// thisData.DropDownEvent = e; // thisData.DropDownEvent = e;
var value = e.component.option("value"); var value = e.component.option("value");
...@@ -2104,7 +2104,7 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>'); ...@@ -2104,7 +2104,7 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
$scope.selectFormula = null; $scope.selectFormula = null;
$scope.cancelHide = false; $scope.cancelHide = false;
$scope.firedName = ''; $scope.firedName = '';
$scope.firedType === '0'; $scope.firedType = '0';
$scope.firedParams = ''; $scope.firedParams = '';
$scope.editFormula = ''; $scope.editFormula = '';
$scope.editParams = ''; $scope.editParams = '';
...@@ -2113,7 +2113,7 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>'); ...@@ -2113,7 +2113,7 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
$scope.selectFormulaForValidation = null; $scope.selectFormulaForValidation = null;
$scope.cancelHideForValidation = false; $scope.cancelHideForValidation = false;
$scope.firedValidationName = ''; $scope.firedValidationName = '';
$scope.firedValidationType === '0'; $scope.firedValidationType = '0';
$scope.firedValidationParams = ''; $scope.firedValidationParams = '';
$scope.editFormulaForValidation = ''; $scope.editFormulaForValidation = '';
$scope.editParamsForValidation = ''; $scope.editParamsForValidation = '';
...@@ -2165,10 +2165,10 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>'); ...@@ -2165,10 +2165,10 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
}); });
var tabs = [ var tabs = [
{ id: 0, text: $translate.instant('AutoCalculateTab') }, {id: 0, text: $translate.instant('AutoCalculateTab')},
{ id: 1, text: $translate.instant('ManualInputTab') }, {id: 1, text: $translate.instant('ManualInputTab')},
{ id: 2, text: $translate.instant('ModelTab') }, {id: 2, text: $translate.instant('ModelTab')},
{ id: 3, text: $translate.instant('ValidationTab') } {id: 3, text: $translate.instant('ValidationTab')}
]; ];
$scope.tabOptions = { $scope.tabOptions = {
dataSource: tabs, dataSource: tabs,
......
...@@ -5,32 +5,38 @@ ...@@ -5,32 +5,38 @@
</div> </div>
<div class="menu-dropdown"> <div class="menu-dropdown">
<div class="dropdown"> <div class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true"> <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true"
aria-expanded="true">
{{curServiceTypeName}} {{curServiceTypeName}}
<span class="caret"></span> <span class="caret"></span>
</button> </button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1"> <ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
<li ng-repeat="s in getServiceTypeList()"><a href="#" ng-click="toggleServiceType(s)">{{s.name}}</a></li> <li ng-repeat="s in getServiceTypeList()">
<a href="#" ng-click="toggleServiceType(s)">{{s.name}}</a>
</li>
</ul> </ul>
</div> </div>
</div> </div>
<div class="menu-log"> <div class="menu-log">
<button class="btn btn-not-important log-btn" ng-click="showOperateLogPop()"><i class="material-icons">description</i><span translate="log"></span></button> <button class="btn btn-not-important log-btn" ng-click="showOperateLogPop()">
<i class="material-icons">description</i>
<span translate="log"></span>
</button>
</div> </div>
</div> </div>
<div class="tab-content-container"> <div class="tab-content-container">
<div class="templates-top"> <div class="templates-top">
<div class="form-group"> <div class="form-group">
<span class="tab-content-select-lable" ng-show="curServiceTypeId !=='12'">{{'IndustryColon' | translate}}</span> <span class="tab-content-select-lable" ng-show="curServiceTypeId !=='12'">{{'IndustryColon' | translate}}</span>
<div id="dx-select-industry" class="tab-content-select industry col-md-2" ng-show="curServiceTypeId !=='12'" <div id="dx-select-industry" class="tab-content-select industry col-md-2" ng-show="curServiceTypeId !=='12'" dx-select-box="dataSourceIndustryList"
dx-select-box="dataSourceIndustryList" dx-item-alias="itemObj"> dx-item-alias="itemObj">
<div data-options="dxTemplate: { name: 'industryItem' }" class="dx-item-content dx-list-item-content" title="{{itemObj.name}}"> <div data-options="dxTemplate: { name: 'industryItem' }" class="dx-item-content dx-list-item-content" title="{{itemObj.name}}">
{{itemObj.name}} {{itemObj.name}}
</div> </div>
</div> </div>
<span class="tab-content-select-lable" translate="ReportType" ng-show="curServiceTypeId === '2'"></span> <span class="tab-content-select-lable" translate="ReportType" ng-show="curServiceTypeId === '2'"></span>
<div class="tab-content-select reportType col-md-2" id="dx-select-pay-tax-type" ng-show="curServiceTypeId === '2'" <div class="tab-content-select reportType col-md-2" id="dx-select-pay-tax-type" ng-show="curServiceTypeId === '2'" dx-select-box="dataSourcePayTaxTypeList"
dx-select-box="dataSourcePayTaxTypeList" dx-item-alias="itemObj"> dx-item-alias="itemObj">
<div data-options="dxTemplate: { name: 'filingTypeItem' }" class="dx-item-content dx-list-item-content" title="{{itemObj.name}}"> <div data-options="dxTemplate: { name: 'filingTypeItem' }" class="dx-item-content dx-list-item-content" title="{{itemObj.name}}">
{{itemObj.name}} {{itemObj.name}}
</div> </div>
...@@ -40,14 +46,15 @@ ...@@ -40,14 +46,15 @@
</div> </div>
<span class="tab-content-select-lable" translate="ReportType" ng-show="curServiceTypeId === '6' || curServiceTypeId === '11' || curServiceTypeId === '99'"></span> <span class="tab-content-select-lable" translate="ReportType" ng-show="curServiceTypeId === '6' || curServiceTypeId === '11' || curServiceTypeId === '99'"></span>
<div class="tab-content-select reportType col-md-2" id="dx-select-report-type" ng-show="curServiceTypeId === '6' || curServiceTypeId === '11' || curServiceTypeId === '99'" <div class="tab-content-select reportType col-md-2" id="dx-select-report-type" ng-show="curServiceTypeId === '6' || curServiceTypeId === '11' || curServiceTypeId === '99'"
dx-select-box="detailReportTypeList" dx-item-alias="itemObj"> dx-select-box="detailReportTypeList" dx-item-alias="itemObj">
<div data-options="dxTemplate: { name: 'reportTypeItem' }" class="dx-item-content dx-list-item-content" title="{{itemObj.name}}"> <div data-options="dxTemplate: { name: 'reportTypeItem' }" class="dx-item-content dx-list-item-content" title="{{itemObj.name}}">
{{itemObj.name}} {{itemObj.name}}
</div> </div>
</div> </div>
<span class="tab-content-select-lable" translate="SelectReport"></span> <span class="tab-content-select-lable" translate="SelectReport"></span>
<div class="tab-content-select selectReport col-md-2" id="dx-select-template"></div> <div class="tab-content-select selectReport col-md-2" id="dx-select-template"></div>
<button id="btnSaveAs" class="btn btn-third" atms-permission permission-control-type="ngIf" permission-code="{{$root.adminPermission.systemConfiguration.declarationFormConfiguration.addCode}}" translate="TemplateGroupSaveAs" ng-click="toggleSaveAs();"></button>&nbsp;&nbsp;&nbsp;&nbsp; <button id="btnSaveAs" class="btn btn-third" atms-permission permission-control-type="ngIf" permission-code="{{$root.adminPermission.systemConfiguration.declarationFormConfiguration.addCode}}"
translate="TemplateGroupSaveAs" ng-click="toggleSaveAs();"></button>&nbsp;&nbsp;&nbsp;&nbsp;
<span export-button="" style="float: right; margin-right: 0px; margin-top: 7px"></span> <span export-button="" style="float: right; margin-right: 0px; margin-top: 7px"></span>
</div> </div>
<!--<select ng-model="curTemplate" ng-options="(t.name+ '_' + t.code) for t in templates" ng-change="loadSheet(curTemplate)"></select>--> <!--<select ng-model="curTemplate" ng-options="(t.name+ '_' + t.code) for t in templates" ng-change="loadSheet(curTemplate)"></select>-->
...@@ -69,7 +76,9 @@ ...@@ -69,7 +76,9 @@
</div>--> </div>-->
<div id="report-view" class="right spread-div"></div> <div id="report-view" class="right spread-div"></div>
<ul id="spreadContextMenu" class="dropdown-menu" role="menu" style="display: none"> <ul id="spreadContextMenu" class="dropdown-menu" role="menu" style="display: none">
<li><a class="localize" data-action="applyRowColName">{{'ApplyRowColName' | translate}}</a></li> <li>
<a class="localize" data-action="applyRowColName">{{'ApplyRowColName' | translate}}</a>
</li>
</ul> </ul>
</div> </div>
...@@ -87,185 +96,183 @@ ...@@ -87,185 +96,183 @@
</span> </span>
</div> </div>
<div id="editReportFormulaContent"> <div id="editReportFormulaContent">
<div class="modal-header editReportFormulaPop-modal-header"> <div class="modal-header editReportFormulaPop-modal-header">
<div class="modal-title" id="editReportFormulaTitle"> <div class="modal-title" id="editReportFormulaTitle">
<span>{{'ReportConfigurationEdit' | translate }}-</span> <span>{{'ReportConfigurationEdit' | translate }}-</span>
<span class="title-info">{{'Cell' | translate}}:{{editModel.cell}}</span> <span class="title-info">{{'Cell' | translate}}:{{editModel.cell}}</span>
<span class="title-separator">|</span> <span class="title-separator">|</span>
<span class="title-info"> <span class="title-info">
{{'CellRowName' | translate}}: {{'CellRowName' | translate}}:
<input type="text" class="edit-input form-control" ng-if="!editModel.isSystemType" ng-model="editModel.rowName"> <input type="text" class="edit-input form-control" ng-if="!editModel.isSystemType" ng-model="editModel.rowName">
<span ng-if="editModel.isSystemType">{{editModel.rowName}}</span> <span ng-if="editModel.isSystemType">{{editModel.rowName}}</span>
</span> </span>
<span class="title-separator">|</span> <span class="title-separator">|</span>
<span class="title-info"> <span class="title-info">
{{'CellColumnName' | translate}}: {{'CellColumnName' | translate}}:
<input type="text" ng-if="!editModel.isSystemType" class="edit-input form-control" ng-model="editModel.columnName" /> <input type="text" ng-if="!editModel.isSystemType" class="edit-input form-control" ng-model="editModel.columnName" />
<span ng-if="editModel.isSystemType">{{editModel.columnName}}</span> <span ng-if="editModel.isSystemType">{{editModel.columnName}}</span>
</span> </span>
</div>
</div> </div>
<div class="modal-body editReportFormulaPop-modal-body"> </div>
<form class="form-horizontal" id="editReportFormulaForm" name="editReportFormulaForm" novalidate="novalidate" style="padding-left:35px;"> <div class="modal-body editReportFormulaPop-modal-body">
<div dx-tabs="tabOptions"></div> <form class="form-horizontal" id="editReportFormulaForm" name="editReportFormulaForm" novalidate="novalidate" style="padding-left:35px;">
<div class="form-group formula-group" ng-show="selectedTab === 0"> <div dx-tabs="tabOptions"></div>
<label class="checkbox-inline bold" ng-class="{ 'disabled': !hasEditPermission || !ToggleSaveAs }"> <div class="form-group formula-group" ng-show="selectedTab === 0">
<input type="checkbox" ng-model="editModel.hasFormula" ng-disabled="!hasEditPermission || !ToggleSaveAs">{{'FormulaConfig' | translate}} <label class="checkbox-inline bold" ng-class="{ 'disabled': !hasEditPermission || !ToggleSaveAs }">
</label> <input type="checkbox" ng-model="editModel.hasFormula" ng-disabled="!hasEditPermission || !ToggleSaveAs">{{'FormulaConfig' | translate}}
<div ng-messages="editReportFormulaForm.formula.$error" class="has-error label bold"> </label>
<span ng-message="requiredValidator">{{'RequiredValidator' | translate}}</span> <div ng-messages="editReportFormulaForm.formula.$error" class="has-error label bold">
<span ng-message="keyValueNotEmptyValidator">{{'KeyValueNotEmptyValidator' | translate}}</span> <span ng-message="requiredValidator">{{'RequiredValidator' | translate}}</span>
<span ng-message="keyValueSeparatorValidator">{{'KeyValueSeparatorValidator' | translate}}</span> <span ng-message="keyValueNotEmptyValidator">{{'KeyValueNotEmptyValidator' | translate}}</span>
<span ng-message="operatorDuplicateValidator">{{'OperatorDuplicateValidator' | translate}}</span> <span ng-message="keyValueSeparatorValidator">{{'KeyValueSeparatorValidator' | translate}}</span>
<span ng-message="missingExpressionValidator">{{'MissingExpressionValidator' | translate}}</span> <span ng-message="operatorDuplicateValidator">{{'OperatorDuplicateValidator' | translate}}</span>
<span ng-message="missingOperatorValidator">{{'MissingOperatorValidator' | translate}}</span> <span ng-message="missingExpressionValidator">{{'MissingExpressionValidator' | translate}}</span>
<span ng-message="formulaFormatValidator">{{'FormulaFormatValidator' | translate}}</span> <span ng-message="missingOperatorValidator">{{'MissingOperatorValidator' | translate}}</span>
</div> <span ng-message="formulaFormatValidator">{{'FormulaFormatValidator' | translate}}</span>
<mention-input class="inputer" input-class="form-control" input-id="formula" mention-list="mentionList" display-mode="'textarea'"
formula-list="formulaList" show-name="true" mention-api="mentionApi" input-readonly="!hasEditPermission || !ToggleSaveAs || !editModel.hasFormula"
ng-model="editModel.formula" fired-name="firedName" fired-tag-type="firedType" fired-formula-params="firedParams" double-click="editFormulaParamOrKeyValue($event)"
include-btn="true" btn-click="showSelectKeyValuePop()" btn2-click="showSelectFormulaPop()" custom-validator="mentionMenuValidator(value, ngModel)"
input-focus="cancelHideTranslator($event)" input-blur="timerHideTranslator();asyncFormulaValidate();"></mention-input>
<formula-translator formula-list="formulaList" account-data-source="accountDataSource" formula-name="firedName" formula-params="firedParams" hide-mode="'notVisible'"
translator-focus="cancelHideTranslator()" translator-blur="timerHideTranslator();"></formula-translator>
</div> </div>
<div class="form-group row-instructions" ng-show="selectedTab === 0"> <mention-input class="inputer" input-class="form-control" input-id="formula" mention-list="mentionList" display-mode="'textarea'"
<label class="bold">{{'FillingInstructions' | translate}}:</label> formula-list="formulaList" show-name="true" mention-api="mentionApi" input-readonly="!hasEditPermission || !ToggleSaveAs || !editModel.hasFormula"
<textarea class="form-control" ng-model="editModel.formulaDescription" ng-readonly="!hasEditPermission || !ToggleSaveAs"></textarea> ng-model="editModel.formula" fired-name="firedName" fired-tag-type="firedType" fired-formula-params="firedParams"
double-click="editFormulaParamOrKeyValue($event)" include-btn="true" btn-click="showSelectKeyValuePop()"
btn2-click="showSelectFormulaPop()" custom-validator="mentionMenuValidator(value, ngModel)" input-focus="cancelHideTranslator($event)"
input-blur="timerHideTranslator();asyncFormulaValidate();"></mention-input>
<formula-translator formula-list="formulaList" account-data-source="accountDataSource" formula-name="firedName" formula-params="firedParams"
hide-mode="'notVisible'" translator-focus="cancelHideTranslator()" translator-blur="timerHideTranslator();"></formula-translator>
</div>
<div class="form-group row-instructions" ng-show="selectedTab === 0">
<label class="bold">{{'FillingInstructions' | translate}}:</label>
<textarea class="form-control" ng-model="editModel.formulaDescription" ng-readonly="!hasEditPermission || !ToggleSaveAs"></textarea>
</div>
<div class="form-group voucher-group" ng-show="selectedTab === 1">
<label class="checkbox-inline bold" ng-class="{ 'disabled': !hasEditPermission || !ToggleSaveAs }">
<input type="checkbox" name="voucher" ng-model="editModel.hasVoucher" ng-disabled="!hasEditPermission || !ToggleSaveAs">{{'VoucherFilter' | translate}}
</label>
<div ng-messages="editReportFormulaForm.voucher.$error" class="has-error label bold">
<span ng-message="voucherNotSelectValidator">{{'VoucherNotSelectValidator' | translate}}</span>
</div> </div>
<div class="form-group voucher-group" ng-show="selectedTab === 1"> <div>
<label class="checkbox-inline bold" ng-class="{ 'disabled': !hasEditPermission || !ToggleSaveAs }"> <label class="radio-inline" ng-disabled="!hasEditPermission || !ToggleSaveAs || !editModel.hasVoucher">
<input type="checkbox" name="voucher" ng-model="editModel.hasVoucher" <input type="radio" name="voucherFilterTypes" ng-value="0" ng-model="voucherFilterType" ng-disabled="!hasEditPermission || !ToggleSaveAs || !editModel.hasVoucher"> {{'Account' | translate}}
ng-disabled="!hasEditPermission || !ToggleSaveAs">{{'VoucherFilter' | translate}}
</label> </label>
<div ng-messages="editReportFormulaForm.voucher.$error" class="has-error label bold"> <label class="radio-inline" ng-disabled="!hasEditPermission || !ToggleSaveAs || !editModel.hasVoucher">
<span ng-message="voucherNotSelectValidator">{{'VoucherNotSelectValidator' | translate}}</span> <input type="radio" name="voucherFilterTypes" ng-value="1" ng-model="voucherFilterType" ng-disabled="!hasEditPermission || !ToggleSaveAs || !editModel.hasVoucher"> {{'SummaryKeyword' | translate}}
</div>
<div>
<label class="radio-inline" ng-disabled="!hasEditPermission || !ToggleSaveAs || !editModel.hasVoucher">
<input type="radio" name="voucherFilterTypes" ng-value="0" ng-model="voucherFilterType"
ng-disabled="!hasEditPermission || !ToggleSaveAs || !editModel.hasVoucher"> {{'Account' | translate}}
</label>
<label class="radio-inline" ng-disabled="!hasEditPermission || !ToggleSaveAs || !editModel.hasVoucher">
<input type="radio" name="voucherFilterTypes" ng-value="1" ng-model="voucherFilterType"
ng-disabled="!hasEditPermission || !ToggleSaveAs || !editModel.hasVoucher"> {{'SummaryKeyword' | translate}}
</label>
</div>
<div class="options-row">
<button type="button" class="btn btn-edit" ng-show="voucherFilterType === 0"
ng-disabled="!hasEditPermission || !ToggleSaveAs || !editModel.hasVoucher"
data-toggle="modal" ng-click="showSelectAccountPop()">
<i class="material-icons" aria-hidden="true">add_circle_outline</i>{{'Add' | translate}}
</button>
<input type="text" class="form-control input-summary" ng-show="voucherFilterType === 1"
ng-readonly="!hasEditPermission || !ToggleSaveAs || !editModel.hasVoucher"
ng-model="editModel.voucherKeyword"
placeholder="{{'InputSummaryKeyword' | translate}}">
</div>
</div>
<div class="dx-viewport grid-container" ng-show="selectedTab === 1 && voucherFilterType === 0"
ng-class="{ 'row1': selectedAccount.length <= 1, 'row2': selectedAccount.length === 2, 'row3': selectedAccount.length >= 3 }">
<div id="voucherGrid" dx-data-grid="voucherGridOptions"></div>
</div>
<div class="checkbox" ng-show="selectedTab === 1"
ng-class="{ 'disabled': !hasEditPermission || !ToggleSaveAs }">
<label class="bold">
<input type="checkbox" name="invoice" ng-model="editModel.hasInvoice"
ng-disabled="!hasEditPermission || !ToggleSaveAs">{{'InvoiceFilter' | translate}}
</label> </label>
<span ng-messages="editReportFormulaForm.invoice.$error" class="has-error label bold">
<span ng-message="invoiceNotSelectValidator">{{'InvoiceNotSelectValidator' | translate}}</span>
</span>
</div> </div>
<div class="form-group invoice-group" ng-show="selectedTab === 1"> <div class="options-row">
<div class="select-invoice-amount-type" id="dx-invoice-type-select" data-ng-model="invoiceOption" dx-select-box="dataSourceInvoice"></div> <button type="button" class="btn btn-edit" ng-show="voucherFilterType === 0" ng-disabled="!hasEditPermission || !ToggleSaveAs || !editModel.hasVoucher"
<span isteven-multi-select ng-if="!(!editModel.chosenInvoiceOption.categoryOptions || editModel.chosenInvoiceOption.categoryOptions.length === 0)" data-toggle="modal" ng-click="showSelectAccountPop()">
input-model="editModel.chosenInvoiceOption.categoryOptions" output-model="selectedCategoryOptions" tick-property="ticked" button-label="key" <i class="material-icons" aria-hidden="true">add_circle_outline</i>{{'Add' | translate}}
item-label="key" max-labels="1" helper-elements="all none" translation="langSetting" is-disabled="!hasEditPermission || !ToggleSaveAs || !editModel.hasInvoice" </button>
on-item-click="refreshCategorySelect(data)" class="invoice-category-select"></span> <input type="text" class="form-control input-summary" ng-show="voucherFilterType === 1" ng-readonly="!hasEditPermission || !ToggleSaveAs || !editModel.hasVoucher"
<span isteven-multi-select ng-hide="!(!editModel.chosenInvoiceOption.rateOptions || editModel.chosenInvoiceOption.rateOptions.length === 0)" ng-model="editModel.voucherKeyword" placeholder="{{'InputSummaryKeyword' | translate}}">
input-model="editModel.chosenInvoiceOption.rateOptions" output-model="selectedRateOptions" tick-property="ticked" button-label="key"
item-label="key" max-labels="2" helper-elements="all none" translation="langSetting" is-disabled="!hasEditPermission || !ToggleSaveAs || !editModel.hasInvoice"
on-item-click="refreshTaxRateSelect(data)" class="tax-rate-select"></span>
<div class="select-invoice-amount-type" data-ng-model="editModel.chosenInvoiceOption.invoiceAmountType" dx-select-box="dataSourceInvoiceAmount"></div>
</div> </div>
<div class="checkbox" ng-show="selectedTab === 1" </div>
ng-class="{ 'disabled': !hasEditPermission || !ToggleSaveAs }"> <div class="dx-viewport grid-container" ng-show="selectedTab === 1 && voucherFilterType === 0" ng-class="{ 'row1': selectedAccount.length <= 1, 'row2': selectedAccount.length === 2, 'row3': selectedAccount.length >= 3 }">
<label class="bold"> <div id="voucherGrid" dx-data-grid="voucherGridOptions"></div>
<input type="checkbox" ng-model="editModel.hasKeyIn" ng-disabled="!hasEditPermission || !ToggleSaveAs">{{'ManualInput' | translate}} </div>
</label> <div class="checkbox" ng-show="selectedTab === 1" ng-class="{ 'disabled': !hasEditPermission || !ToggleSaveAs }">
<label class="bold">
<input type="checkbox" name="invoice" ng-model="editModel.hasInvoice" ng-disabled="!hasEditPermission || !ToggleSaveAs">{{'InvoiceFilter' | translate}}
</label>
<span ng-messages="editReportFormulaForm.invoice.$error" class="has-error label bold">
<span ng-message="invoiceNotSelectValidator">{{'InvoiceNotSelectValidator' | translate}}</span>
</span>
</div>
<div class="form-group invoice-group" ng-show="selectedTab === 1">
<div class="select-invoice-amount-type" id="dx-invoice-type-select" data-ng-model="invoiceOption" dx-select-box="dataSourceInvoice"></div>
<span isteven-multi-select ng-if="!(!editModel.chosenInvoiceOption.categoryOptions || editModel.chosenInvoiceOption.categoryOptions.length === 0)"
input-model="editModel.chosenInvoiceOption.categoryOptions" output-model="selectedCategoryOptions"
tick-property="ticked" button-label="key" item-label="key" max-labels="1" helper-elements="all none"
translation="langSetting" is-disabled="!hasEditPermission || !ToggleSaveAs || !editModel.hasInvoice"
on-item-click="refreshCategorySelect(data)" class="invoice-category-select"></span>
<span isteven-multi-select ng-hide="!(!editModel.chosenInvoiceOption.rateOptions || editModel.chosenInvoiceOption.rateOptions.length === 0)"
input-model="editModel.chosenInvoiceOption.rateOptions" output-model="selectedRateOptions" tick-property="ticked"
button-label="key" item-label="key" max-labels="2" helper-elements="all none" translation="langSetting"
is-disabled="!hasEditPermission || !ToggleSaveAs || !editModel.hasInvoice" on-item-click="refreshTaxRateSelect(data)"
class="tax-rate-select"></span>
<div class="select-invoice-amount-type" data-ng-model="editModel.chosenInvoiceOption.invoiceAmountType" dx-select-box="dataSourceInvoiceAmount"></div>
</div>
<div class="checkbox" ng-show="selectedTab === 1" ng-class="{ 'disabled': !hasEditPermission || !ToggleSaveAs }">
<label class="bold">
<input type="checkbox" ng-model="editModel.hasKeyIn" ng-disabled="!hasEditPermission || !ToggleSaveAs">{{'ManualInput' | translate}}
</label>
</div>
<div class="form-group model-group" ng-show="selectedTab === 2">
<label class="checkbox-inline bold" ng-class="{ 'disabled': !hasEditPermission || !ToggleSaveAs }">
<input type="checkbox" name="model" ng-model="editModel.hasModel" ng-disabled="!hasEditPermission || !ToggleSaveAs">{{'LinkModel' | translate}}
</label>
<div ng-messages="editReportFormulaForm.model.$error" class="has-error label bold">
<span ng-message="modelNotSelectValidator">{{'ModelNotSelectValidator' | translate}}</span>
</div> </div>
<div class="form-group model-group" ng-show="selectedTab === 2"> <div class="options-row">
<label class="checkbox-inline bold" ng-class="{ 'disabled': !hasEditPermission || !ToggleSaveAs }"> <button type="button" class="btn btn-edit" ng-disabled="!hasEditPermission || !ToggleSaveAs || !editModel.hasModel" data-toggle="modal"
<input type="checkbox" name="model" ng-model="editModel.hasModel" ng-disabled="!hasEditPermission || !ToggleSaveAs">{{'LinkModel' | translate}} ng-click="showSelectModelPop()">
</label> <i class="material-icons" aria-hidden="true">add_circle_outline</i>{{'Add' | translate}}
<div ng-messages="editReportFormulaForm.model.$error" class="has-error label bold"> </button>
<span ng-message="modelNotSelectValidator">{{'ModelNotSelectValidator' | translate}}</span>
</div>
<div class="options-row">
<button type="button" class="btn btn-edit" ng-disabled="!hasEditPermission || !ToggleSaveAs || !editModel.hasModel" data-toggle="modal" ng-click="showSelectModelPop()">
<i class="material-icons" aria-hidden="true">add_circle_outline</i>{{'Add' | translate}}
</button>
</div>
</div> </div>
<div class="dx-viewport grid-container last-grid" ng-show="selectedTab === 2" </div>
ng-class="{ 'row1': selectedModel.length <= 1, 'row2': selectedModel.length === 2, <div class="dx-viewport grid-container last-grid" ng-show="selectedTab === 2" ng-class="{ 'row1': selectedModel.length <= 1, 'row2': selectedModel.length === 2,
'row3': selectedModel.length === 3, 'row3': selectedModel.length === 3,
'row4': selectedModel.length === 4, 'row4': selectedModel.length === 4,
'row5': selectedModel.length === 5, 'row5': selectedModel.length === 5,
'row6': selectedModel.length >= 6, 'row6': selectedModel.length >= 6,
}"> }">
<div id="modelGrid" dx-data-grid="modelGridOptions"></div> <div id="modelGrid" dx-data-grid="modelGridOptions"></div>
</div>
<div class="form-group validation-group" ng-show="selectedTab === 3">
<label class="checkbox-inline bold" ng-class="{ 'disabled': !hasEditPermission || !ToggleSaveAs }">
<input type="checkbox" ng-model="editModel.hasValidation" ng-disabled="!hasEditPermission || !ToggleSaveAs">{{'ValidationConfig' | translate}}
</label>
<div ng-messages="editReportFormulaForm.validation.$error" class="has-error label bold">
<span ng-message="requiredValidator">{{'RequiredValidator' | translate}}</span>
<span ng-message="keyValueNotEmptyValidator">{{'KeyValueNotEmptyValidator' | translate}}</span>
<span ng-message="keyValueSeparatorValidator">{{'KeyValueSeparatorValidator' | translate}}</span>
<span ng-message="operatorDuplicateValidator">{{'OperatorDuplicateValidator' | translate}}</span>
<span ng-message="missingExpressionValidator">{{'MissingExpressionValidator' | translate}}</span>
<span ng-message="missingOperatorValidator">{{'MissingOperatorValidator' | translate}}</span>
<span ng-message="formulaFormatValidator">{{'FormulaFormatValidator' | translate}}</span>
</div> </div>
<div class="form-group validation-group" ng-show="selectedTab === 3"> <mention-input class="inputer" input-class="form-control" input-id="validation" mention-list="mentionList" display-mode="'textarea'"
<label class="checkbox-inline bold" ng-class="{ 'disabled': !hasEditPermission || !ToggleSaveAs }"> formula-list="formulaList" show-name="true" mention-api="mentionApiForValidation" input-readonly="!hasEditPermission || !ToggleSaveAs || !editModel.hasValidation"
<input type="checkbox" ng-model="editModel.hasValidation" ng-disabled="!hasEditPermission || !ToggleSaveAs">{{'ValidationConfig' | translate}} ng-model="editModel.validation" fired-name="firedValidationName" fired-tag-type="firedValidationType"
</label> fired-formula-params="firedValidationParams" double-click="editFormulaParamOrKeyValueForValidation($event)"
<div ng-messages="editReportFormulaForm.validation.$error" class="has-error label bold"> include-btn="true" btn-click="showSelectKeyValuePopForValidation()" btn2-click="showSelectFormulaPopForValidation()"
<span ng-message="requiredValidator">{{'RequiredValidator' | translate}}</span> custom-validator="mentionMenuValidatorForValidation(value, ngModel)" input-focus="cancelHideTranslatorForValidation($event)"
<span ng-message="keyValueNotEmptyValidator">{{'KeyValueNotEmptyValidator' | translate}}</span> input-blur="timerHideTranslatorForValidation();asyncFormulaValidateForValidation();"></mention-input>
<span ng-message="keyValueSeparatorValidator">{{'KeyValueSeparatorValidator' | translate}}</span> <formula-translator formula-list="formulaList" account-data-source="accountDataSource" formula-name="firedValidationName"
<span ng-message="operatorDuplicateValidator">{{'OperatorDuplicateValidator' | translate}}</span> formula-params="firedValidationParams" hide-mode="'notVisible'" translator-focus="cancelHideTranslatorForValidation()"
<span ng-message="missingExpressionValidator">{{'MissingExpressionValidator' | translate}}</span> translator-blur="timerHideTranslatorForValidation();"></formula-translator>
<span ng-message="missingOperatorValidator">{{'MissingOperatorValidator' | translate}}</span>
<span ng-message="formulaFormatValidator">{{'FormulaFormatValidator' | translate}}</span>
</div>
<mention-input class="inputer" input-class="form-control" input-id="validation" mention-list="mentionList" display-mode="'textarea'"
formula-list="formulaList" show-name="true" mention-api="mentionApiForValidation" input-readonly="!hasEditPermission || !ToggleSaveAs || !editModel.hasValidation"
ng-model="editModel.validation" fired-name="firedValidationName" fired-tag-type="firedValidationType" fired-formula-params="firedValidationParams" double-click="editFormulaParamOrKeyValueForValidation($event)"
include-btn="true" btn-click="showSelectKeyValuePopForValidation()" btn2-click="showSelectFormulaPopForValidation()" custom-validator="mentionMenuValidatorForValidation(value, ngModel)"
input-focus="cancelHideTranslatorForValidation($event)" input-blur="timerHideTranslatorForValidation();asyncFormulaValidateForValidation();"></mention-input>
<formula-translator formula-list="formulaList" account-data-source="accountDataSource" formula-name="firedValidationName" formula-params="firedValidationParams" hide-mode="'notVisible'"
translator-focus="cancelHideTranslatorForValidation()" translator-blur="timerHideTranslatorForValidation();"></formula-translator>
</div>
<div class="form-group validation-instructions" ng-show="selectedTab === 3">
<label class="bold">{{'ValidationInstructions' | translate}}:</label>
<textarea class="form-control" ng-model="editModel.validationDescription" ng-readonly="!hasEditPermission || !ToggleSaveAs"></textarea>
</div>
<div ng-show="selectedTab === 3 && hasEditPermission && ToggleSaveAs" class="flex-row-start-center" style="margin: 15px 0 15px -15px;">
<span>{{'IsInputNecessary' | translate}}:</span>
<div class="btn-group switch-group" data-toggle="buttons">
<label class="btn btn-primary" ng-class="{'active':editModel.hasFormula}" ng-click="editModel.hasFormula=true;">
<input type="radio" autocomplete="off" />{{'on'|translate}}
</label>
<label class="btn btn-primary" ng-class="{'active':!editModel.hasFormula}" ng-click="editModel.hasFormula=false;">
<input type="radio" autocomplete="off" />{{'off'|translate}}
</label>
</div> </div>
<div class="form-group validation-instructions" ng-show="selectedTab === 3"> </div>
<label class="bold">{{'ValidationInstructions' | translate}}:</label> </form>
<textarea class="form-control" ng-model="editModel.validationDescription" ng-readonly="!hasEditPermission || !ToggleSaveAs"></textarea> </div>
</div> <div class="modal-footer">
<div ng-show="selectedTab === 3 && hasEditPermission && ToggleSaveAs" class="flex-row-start-center" style="margin: 15px 0 15px -15px;"> <button type="button" class="btn btn-primary" ng-disabled="hasError()" ng-show="hasEditPermission && ToggleSaveAs" ng-click="saveFormulaToTemp()">
<span>{{'IsInputNecessary' | translate}}:</span> {{'Confirm' | translate }}
<div class="btn-group switch-group" data-toggle="buttons"> </button>
<label class="btn btn-primary" ng-class="{'active':editModel.hasFormula}" ng-click="editModel.hasFormula=true;"> <button type="button" class="btn btn-third" ng-show="hasEditPermission && ToggleSaveAs" ng-click="hidePanel();">{{'Cancel' | translate }}
<input type="radio" autocomplete="off" />{{'on'|translate}} </button>
</label> </div>
<label class="btn btn-primary" ng-class="{'active':!editModel.hasFormula}" ng-click="editModel.hasFormula=false;">
<input type="radio" autocomplete="off" />{{'off'|translate}}
</label>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" ng-disabled="hasError()" ng-show="hasEditPermission && ToggleSaveAs" ng-click="saveFormulaToTemp()">
{{'Confirm' | translate }}
</button>
<button type="button" class="btn btn-third" ng-show="hasEditPermission && ToggleSaveAs" ng-click="hidePanel();">{{'Cancel' | translate }}</button>
</div>
</div> </div>
</div> </div>
<div class="modal fade" id="selectFormulaPop" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" data-backdrop="static" data-keyboard="false"> <div class="modal fade" id="selectFormulaPop" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" data-backdrop="static"
data-keyboard="false">
<div class="modal-dialog" style="width:570px;" role="grid"> <div class="modal-dialog" style="width:570px;" role="grid">
<div class="modal-content"> <div class="modal-content">
<div class="modal-body"> <div class="modal-body">
...@@ -275,22 +282,28 @@ ...@@ -275,22 +282,28 @@
</div> </div>
</div> </div>
</div> </div>
<account-multi-selector is-show="isShowAccounts" account-data-source="accountDataSource" selector-api="accountSelectorApi" data-title="accountTitle" selected-account-codes="editModel.accountCodes" selector-options="accountSelectorOptions"></account-multi-selector> <account-multi-selector is-show="isShowAccounts" account-data-source="accountDataSource" selector-api="accountSelectorApi"
<model-multi-selector is-show="isShowModels" model-data-source="modelDataSource" selector-api="modelSelectorApi" data-title="modelTitle" selected-model-ids="editModel.modelIDs" selector-options="modelSelectorOptions"></model-multi-selector> data-title="accountTitle" selected-account-codes="editModel.accountCodes" selector-options="accountSelectorOptions"></account-multi-selector>
<model-multi-selector is-show="isShowModels" model-data-source="modelDataSource" selector-api="modelSelectorApi" data-title="modelTitle"
selected-model-ids="editModel.modelIDs" selector-options="modelSelectorOptions"></model-multi-selector>
<operate-log is-show="isShowLog"></operate-log> <operate-log is-show="isShowLog"></operate-log>
<!-- 编辑报表 --> <!-- 编辑报表 -->
<edit-template-modal template-model="templateModel" on-closed="selectTemplate(model)" is-update="isUpdateTemplate" operate-type="operateTemplateType"></edit-template-modal> <edit-template-modal template-model="templateModel" on-closed="selectTemplate(model)" is-update="isUpdateTemplate" operate-type="operateTemplateType"></edit-template-modal>
<!--编辑报表模板--> <!--编辑报表模板-->
<edit-templategroup-modal object-model="templateGroupModel" on-closed="selectTemplateGroup(model)" is-update="isUpdateTemplateGroup" operate-type="operateTemplateGroupType"></edit-templategroup-modal> <edit-templategroup-modal object-model="templateGroupModel" on-closed="selectTemplateGroup(model)" is-update="isUpdateTemplateGroup"
operate-type="operateTemplateGroupType"></edit-templategroup-modal>
<key-value-selector is-show="isShowKeyValue" selector-api="keyValueSelectorApi" data-title="keyValueTitle" selector-options="keyValueSelectorOptions" selected-key-code="defaultKeyCode"></key-value-selector>
<edit-formula-modal operate-type="operateType" account-data-source="accountDataSource" select-formula="selectFormula" formula-list="formulaList" on-closed="selectParam(formula)"></edit-formula-modal> <key-value-selector is-show="isShowKeyValue" selector-api="keyValueSelectorApi" data-title="keyValueTitle" selector-options="keyValueSelectorOptions"
<formula-param-selector is-show="isShowParam" account-data-source="accountDataSource" formula-list="formulaList" selected-key-code="defaultKeyCode"></key-value-selector>
formula-name="editFormula" formula-params="editParams" selector-api="paramSelectorApi" <edit-formula-modal operate-type="operateType" account-data-source="accountDataSource" select-formula="selectFormula" formula-list="formulaList"
selector-options="{ height: 430 }" container-selector="body"></formula-param-selector> on-closed="selectParam(formula)"></edit-formula-modal>
<key-value-selector is-show="isShowKeyValueForValidation" selector-api="keyValueSelectorApiForValidation" data-title="keyValueTitleForValidation" selector-options="keyValueSelectorOptionsForValidation" selected-key-code="defaultKeyCodeForValidation"></key-value-selector> <formula-param-selector is-show="isShowParam" account-data-source="accountDataSource" formula-list="formulaList" formula-name="editFormula"
<edit-formula-modal operate-type="operateTypeForValidation" account-data-source="accountDataSource" select-formula="selectFormulaForValidation" formula-list="formulaList" on-closed="selectParamForValidation(formula)"></edit-formula-modal> formula-params="editParams" selector-api="paramSelectorApi" selector-options="{ height: 430 }" container-selector="body"></formula-param-selector>
<key-value-selector is-show="isShowKeyValueForValidation" selector-api="keyValueSelectorApiForValidation" data-title="keyValueTitleForValidation"
selector-options="keyValueSelectorOptionsForValidation" selected-key-code="defaultKeyCodeForValidation"></key-value-selector>
<edit-formula-modal operate-type="operateTypeForValidation" account-data-source="accountDataSource" select-formula="selectFormulaForValidation"
formula-list="formulaList" on-closed="selectParamForValidation(formula)"></edit-formula-modal>
<formula-param-selector is-show="isShowParamForValidation" account-data-source="accountDataSource" formula-list="formulaList" <formula-param-selector is-show="isShowParamForValidation" account-data-source="accountDataSource" formula-list="formulaList"
formula-name="editFormulaForValidation" formula-params="editParamsForValidation" formula-name="editFormulaForValidation" formula-params="editParamsForValidation" selector-api="paramSelectorApiForValidation"
selector-api="paramSelectorApiForValidation" selector-options="{ height: 430 }" container-selector="body"></formula-param-selector> selector-options="{ height: 430 }" container-selector="body"></formula-param-selector>
</div> </div>
\ No newline at end of file
...@@ -14,54 +14,54 @@ function ($rootScope, $log, $uibModal, $translate) { ...@@ -14,54 +14,54 @@ function ($rootScope, $log, $uibModal, $translate) {
var initialize = function (sheet) { var initialize = function (sheet) {
sheet.isPaintSuspended(true); sheet.suspendPaint();
hasVoucherImg = new Image(); hasVoucherImg = new Image();
hasVoucherImg.src = '/app-resources/images/vat/hasVoucher.png'; hasVoucherImg.src = '/app-resources/images/vat/hasVoucher.png';
hasVoucherImg.onload = function () { hasVoucherImg.onload = function () {
sheet.repaint(); sheet.repaint();
} };
hasInvoiceImg = new Image(); hasInvoiceImg = new Image();
hasInvoiceImg.src = '/app-resources/images/vat/hasInvoice.png'; hasInvoiceImg.src = '/app-resources/images/vat/hasInvoice.png';
hasInvoiceImg.onload = function () { hasInvoiceImg.onload = function () {
sheet.repaint(); sheet.repaint();
} };
hasKeyInImg = new Image(); hasKeyInImg = new Image();
hasKeyInImg.src = '/app-resources/images/vat/hasKeyIn.png'; hasKeyInImg.src = '/app-resources/images/vat/hasKeyIn.png';
hasKeyInImg.onload = function () { hasKeyInImg.onload = function () {
sheet.repaint(); sheet.repaint();
} };
hasModelImg = new Image(); hasModelImg = new Image();
hasModelImg.src = '/app-resources/images/vat/hasModel.png'; hasModelImg.src = '/app-resources/images/vat/hasModel.png';
hasModelImg.onload = function () { hasModelImg.onload = function () {
sheet.repaint(); sheet.repaint();
} };
hasExceptionImg = new Image(); hasExceptionImg = new Image();
hasExceptionImg.src = '/app-resources/images/vat/hasException.png'; hasExceptionImg.src = '/app-resources/images/vat/hasException.png';
hasExceptionImg.onload = function () { hasExceptionImg.onload = function () {
sheet.repaint(); sheet.repaint();
} };
hasValidationImg = new Image(); hasValidationImg = new Image();
hasValidationImg.src = '/app-resources/images/vat/hasValidation.png'; hasValidationImg.src = '/app-resources/images/vat/hasValidation.png';
hasValidationImg.onload = function () { hasValidationImg.onload = function () {
sheet.repaint(); sheet.repaint();
} };
}; };
var paintSheet = function (sheet) { var paintSheet = function (sheet) {
sheet.isPaintSuspended(false); sheet.resumePaint();
}; };
var setCellTipString = function (cell, tip) { var setCellTipString = function (cell, tip) {
//cell.cellType(new IconCellType(null, null, 0, null, tip)); //cell.cellType(new IconCellType(null, null, 0, null, tip));
cell.cellType(new IconsCellType([], [], tip)); cell.cellType(new IconsCellType([], [], tip));
} };
var setCellTipByCellData = function (cell, cellData) { var setCellTipByCellData = function (cell, cellData) {
var tips = null; var tips = null;
...@@ -100,7 +100,7 @@ function ($rootScope, $log, $uibModal, $translate) { ...@@ -100,7 +100,7 @@ function ($rootScope, $log, $uibModal, $translate) {
} }
cell.cellType(new IconsCellType(icons, infos, tips)); cell.cellType(new IconsCellType(icons, infos, tips));
} };
var setCellTip = function (cell, config) { var setCellTip = function (cell, config) {
var tips = null; var tips = null;
...@@ -201,7 +201,7 @@ function ($rootScope, $log, $uibModal, $translate) { ...@@ -201,7 +201,7 @@ function ($rootScope, $log, $uibModal, $translate) {
this.count = 0; this.count = 0;
this.Formula = formula; this.Formula = formula;
} }
} };
//var IconCellType = function (icon1, icon2, count, infos, formula) { //var IconCellType = function (icon1, icon2, count, infos, formula) {
...@@ -217,7 +217,7 @@ function ($rootScope, $log, $uibModal, $translate) { ...@@ -217,7 +217,7 @@ function ($rootScope, $log, $uibModal, $translate) {
IconsCellType.prototype = new GC.Spread.Sheets.CellTypes.Base(); IconsCellType.prototype = new GC.Spread.Sheets.CellTypes.Base();
IconsCellType.prototype.paint = function (ctx, value, x, y, w, h, style, context) { IconsCellType.prototype.paint = function (ctx, value, x, y, w, h, style, context) {
GC.Spread.Sheets.CellTypes.Base.prototype.paint.call(this, ctx, value, x, y, w, h, style, context); GC.Spread.Sheets.CellTypes.Base.paint.call(this, ctx, value, x, y, w, h, style, context);
for (var i = 1; i <= this.count; i++) { for (var i = 1; i <= this.count; i++) {
//距离当前单元格左侧距离,距离顶部距离 , ICON宽度,ICON高度 //距离当前单元格左侧距离,距离顶部距离 , ICON宽度,ICON高度
ctx.drawImage(this.Icons[i-1], x + w - (h - 3) * i + (h - 6 - 18) * i, y + 3 + (h / 2 - 3 - 9), 18, 18); ctx.drawImage(this.Icons[i-1], x + w - (h - 3) * i + (h - 6 - 18) * i, y + 3 + (h / 2 - 3 - 9), 18, 18);
...@@ -232,7 +232,7 @@ function ($rootScope, $log, $uibModal, $translate) { ...@@ -232,7 +232,7 @@ function ($rootScope, $log, $uibModal, $translate) {
// ctx.drawImage(this.icon2, x + w - (h - 3) * i + (h - 6 - 18) * i, y + 3 + (h / 2 - 3 - 9), 18, 18); // ctx.drawImage(this.icon2, x + w - (h - 3) * i + (h - 6 - 18) * i, y + 3 + (h / 2 - 3 - 9), 18, 18);
//} //}
} }
} };
IconsCellType.prototype.getHitInfo = function (x, y, cellStyle, cellRect, context) { IconsCellType.prototype.getHitInfo = function (x, y, cellStyle, cellRect, context) {
var index = x - (cellRect.x + cellRect.width - (cellRect.height - 3) * this.count) > 0 ? var index = x - (cellRect.x + cellRect.width - (cellRect.height - 3) * this.count) > 0 ?
Math.floor(this.count - (x - (cellRect.x + cellRect.width - (cellRect.height - 3) * this.count)) / (cellRect.height - 3)) : Math.floor(this.count - (x - (cellRect.x + cellRect.width - (cellRect.height - 3) * this.count)) / (cellRect.height - 3)) :
...@@ -248,7 +248,7 @@ function ($rootScope, $log, $uibModal, $translate) { ...@@ -248,7 +248,7 @@ function ($rootScope, $log, $uibModal, $translate) {
sheetArea: context.sheetArea, sheetArea: context.sheetArea,
reservedLocationIndex: index reservedLocationIndex: index
}; };
} };
IconsCellType.prototype.processMouseMove = function (hitinfo) { IconsCellType.prototype.processMouseMove = function (hitinfo) {
//console.log(hitinfo); //console.log(hitinfo);
......
...@@ -93,7 +93,7 @@ webservices.factory('spreadJsService', ['$log', '$q', '$http', 'apiConfig', 'doc ...@@ -93,7 +93,7 @@ webservices.factory('spreadJsService', ['$log', '$q', '$http', 'apiConfig', 'doc
this.minArgs = minArgs; this.minArgs = minArgs;
}; };
customFunction.prototype = new GC.Spread.Sheets.Calc.Functions.Function(); customFunction.prototype = new GcSpread.Sheets.Calc.Functions.Function();
customFunction.prototype.evaluate = function (args) { customFunction.prototype.evaluate = function (args) {
var formulaName = this.name + "("; var formulaName = this.name + "(";
...@@ -128,7 +128,7 @@ webservices.factory('spreadJsService', ['$log', '$q', '$http', 'apiConfig', 'doc ...@@ -128,7 +128,7 @@ webservices.factory('spreadJsService', ['$log', '$q', '$http', 'apiConfig', 'doc
var deferred = $q.defer(); var deferred = $q.defer();
var promise = deferred.promise; var promise = deferred.promise;
var spread = new GC.Spread.Sheets.Spread(document.getElementById(id)); var spread = new GcSpread.Sheets.Spread(document.getElementById(id));
var sheet = spread.getActiveSheet(); var sheet = spread.getActiveSheet();
spread.showVerticalScrollbar(true); spread.showVerticalScrollbar(true);
...@@ -149,16 +149,16 @@ webservices.factory('spreadJsService', ['$log', '$q', '$http', 'apiConfig', 'doc ...@@ -149,16 +149,16 @@ webservices.factory('spreadJsService', ['$log', '$q', '$http', 'apiConfig', 'doc
sheet.setIsProtected(false); sheet.setIsProtected(false);
} }
spread.bind(GC.Spread.Sheets.Events.CellClick, function (sender, args) { spread.bind(GcSpread.Sheets.Events.CellClick, function (sender, args) {
if (args.sheetArea === GC.Spread.Sheets.SheetArea.colHeader) { if (args.sheetArea === GcSpread.Sheets.SheetArea.colHeader) {
$log.debug("The column header was clicked."); $log.debug("The column header was clicked.");
} }
if (args.sheetArea === GC.Spread.Sheets.SheetArea.rowHeader) { if (args.sheetArea === GcSpread.Sheets.SheetArea.rowHeader) {
$log.debug("The row header was clicked."); $log.debug("The row header was clicked.");
} }
if (args.sheetArea === GC.Spread.Sheets.SheetArea.corner) { if (args.sheetArea === GcSpread.Sheets.SheetArea.corner) {
$log.debug("The corner header was clicked."); $log.debug("The corner header was clicked.");
} }
...@@ -167,7 +167,7 @@ webservices.factory('spreadJsService', ['$log', '$q', '$http', 'apiConfig', 'doc ...@@ -167,7 +167,7 @@ webservices.factory('spreadJsService', ['$log', '$q', '$http', 'apiConfig', 'doc
$log.debug(sheet.getTag(args.row, args.col)); $log.debug(sheet.getTag(args.row, args.col));
}); });
spread.bind(GC.Spread.Sheets.Events.EditEnding, function (sender, args) { spread.bind(GcSpread.Sheets.Events.EditEnding, function (sender, args) {
var sheet = spread.getActiveSheet(); var sheet = spread.getActiveSheet();
...@@ -212,7 +212,7 @@ webservices.factory('spreadJsService', ['$log', '$q', '$http', 'apiConfig', 'doc ...@@ -212,7 +212,7 @@ webservices.factory('spreadJsService', ['$log', '$q', '$http', 'apiConfig', 'doc
var customfunctions; var customfunctions;
//1. 获取自定义函数名及对应的计算值 //1. 获取自定义函数名及对应的计算值
getFormulaValueByDocumentCode(code).then(function (formuladata) { getFormulaValueByDocumentCode(code).then(function (formuladata) {
formulaValues = JSON.parse(formuladata); formulaValues = JSON.parse(formuladata);
$log.debug(formulaValues); $log.debug(formulaValues);
...@@ -234,7 +234,7 @@ webservices.factory('spreadJsService', ['$log', '$q', '$http', 'apiConfig', 'doc ...@@ -234,7 +234,7 @@ webservices.factory('spreadJsService', ['$log', '$q', '$http', 'apiConfig', 'doc
initSpreadCustomFunction(sheet, func.name, 0, func.parameterCount); initSpreadCustomFunction(sheet, func.name, 0, func.parameterCount);
} }
//5. Get Document Cell //5. Get Document Cell
getDocumentCellByDocumentId(documentObj.documentID).then(function (celldata) { getDocumentCellByDocumentId(documentObj.documentID).then(function (celldata) {
renderFormulaCell(sheet, celldata.data); renderFormulaCell(sheet, celldata.data);
}); });
...@@ -281,14 +281,14 @@ webservices.factory('spreadJsService', ['$log', '$q', '$http', 'apiConfig', 'doc ...@@ -281,14 +281,14 @@ webservices.factory('spreadJsService', ['$log', '$q', '$http', 'apiConfig', 'doc
}; };
var initSpreadCustomFunctionAsync = function (sheet, name) { var initSpreadCustomFunctionAsync = function (sheet, name) {
var asum = function () { } var asum = function () { }
//Define a class "ASUM" that extends AsyncFunction //Define a class "ASUM" that extends AsyncFunction
asum.prototype = new GC.Spread.Sheets.Calc.Functions.AsyncFunction(name, 1, 255); asum.prototype = new GcSpread.Sheets.Calc.Functions.AsyncFunction(name, 1, 255);
//Set default value to "Loading..." //Set default value to "Loading..."
asum.prototype.defaultValue = function () { return "Loading..."; }; asum.prototype.defaultValue = function () { return "Loading..."; };
//Override the evaluateAsync function //Override the evaluateAsync function
......
...@@ -13,78 +13,37 @@ webservices.factory('templateService', ['$log', '$http', '$q', 'apiConfig', 'htt ...@@ -13,78 +13,37 @@ webservices.factory('templateService', ['$log', '$http', '$q', 'apiConfig', 'htt
return ""; return "";
}; };
var getTemplateJson = function (templateID) {
//return $http.get('/template/getTemplateJson?templateID=' + templateID, apiConfig.create());
// var result = httpCacheService.get('/template/getTemplateJson?templateID=' + templateID);
// if (result.finishedCache) {
// return result;
// } else {
// var thisConfig = apiConfig.create();
// thisConfig.responseType = "blob";
// return $http.post('/template/getTemplateJson?templateID=' + templateID, {}, apiConfig.create());
// }
var deferred = $q.defer();
var promise = deferred.promise;
// var ajaxUrl = loginContext.apiHost + constant.webapi.prefix + '/template/getTemplateJson?templateID=' + templateID;
// var apiTokenObj = JSON.parse(getCookie('AtmsApiToken'));
// var apiToken = apiTokenObj.access_token;
// var tokenType = apiTokenObj.token_type;
// var ajaxSource = $.ajax({
// url: ajaxUrl,
// type: "POST",
// dataType:"blob",
// beforeSend: function (xhr) {
// xhr.setRequestHeader('Authorization', tokenType + ' ' + apiToken);
// //xhr.setRequestHeader('from', 'aabb@cn.pwc.com');
// //xhr.responseType = "blob";
// },
// success: function(data){
// deferred.resolve(data);
// },
// complete: function(data){
// deferred.resolve(data.responseText);
// }
// });
// ajaxSource.done(function (data) {
// deferred.resolve(data);
// });
return promise;
};
var initSpreadExcel = function (id, ssjsondata) { var initSpreadExcel = function (id, ssjsondata) {
var deferred = $q.defer(); var deferred = $q.defer();
var promise = deferred.promise; var promise = deferred.promise;
var spread = new GC.Spread.Sheets.Workbook(document.getElementById(id)); var spread = new GC.Spread.Sheets.Workbook(document.getElementById(id));
spread.showVerticalScrollbar(true); spread.options.showVerticalScrollbar = true;
spread.showHorizontalScrollbar(true); spread.options.showHorizontalScrollbar = true;
spread.scrollbarMaxAlign(true); spread.options.scrollbarMaxAlign = true;
spread.scrollbarShowMax(true); spread.options.scrollbarShowMax = true;
spread.tabNavigationVisible(true); spread.options.tabNavigationVisible = true;
spread.newTabVisible(false); spread.options.newTabVisible = false;
spread.tabEditable(false); spread.options.tabEditable = false;
spread.tabStripVisible(false); spread.options.tabStripVisible = false;
spread.newTabVisible(false); spread.options.newTabVisible = false;
// spread.allowUndo(false); spread.options.allowUndo = false;
// spread.allowUserResize(false); spread.options.allowUserResize = false;
// spread.canUserDragDrop(false); spread.options.allowUserDragDrop = false;
// spread.canUserDragFill(false); spread.options.allowUserDragFill = false;
// spread.canUserEditFormula(false); spread.options.allowUserEditFormula = false;
//
// spread.isPaintSuspended(true); spread.suspendPaint();
// spread.fromJSON(JSON.parse(ssjsondata)); spread.fromJSON(ssjsondata);
// spread.isPaintSuspended(false); spread.resumePaint();
var sheet = spread.getActiveSheet(); var sheet = spread.getActiveSheet();
if (sheet != null) { if (sheet != null) {
// sheet.setRowHeaderVisible(true); sheet.options.rowHeaderVisible = true;
// sheet.setColumnHeaderVisible(true); sheet.options.colHeaderVisible = true;
// sheet.setGridlineOptions({ sheet.options.gridline.showVerticalGridline = false;
// showVerticalGridline: false, showHorizontalGridline: false sheet.options.gridline.showHorizontalGridline = false;
// });
} }
deferred.resolve(spread); deferred.resolve(spread);
...@@ -96,7 +55,7 @@ webservices.factory('templateService', ['$log', '$http', '$q', 'apiConfig', 'htt ...@@ -96,7 +55,7 @@ webservices.factory('templateService', ['$log', '$http', '$q', 'apiConfig', 'htt
var promise = deferred.promise; var promise = deferred.promise;
var spreadSheet; var spreadSheet;
var url = loginContext.apiHost + constant.webapi.prefix+'/template/getTemplateJson?templateID=' + templateID; var url = loginContext.apiHost + constant.webapi.prefix + '/template/getTemplateJson?templateID=' + templateID;
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
xhr.open('POST', url, true); // 也可以使用POST方式,根据接口 xhr.open('POST', url, true); // 也可以使用POST方式,根据接口
xhr.responseType = "blob"; // 返回类型blob xhr.responseType = "blob"; // 返回类型blob
...@@ -104,7 +63,6 @@ webservices.factory('templateService', ['$log', '$http', '$q', 'apiConfig', 'htt ...@@ -104,7 +63,6 @@ webservices.factory('templateService', ['$log', '$http', '$q', 'apiConfig', 'htt
var apiToken = apiTokenObj.access_token; var apiToken = apiTokenObj.access_token;
var tokenType = apiTokenObj.token_type; var tokenType = apiTokenObj.token_type;
xhr.setRequestHeader('Authorization', tokenType + ' ' + apiToken); xhr.setRequestHeader('Authorization', tokenType + ' ' + apiToken);
// xhr.setRequestHeader("Authorization","bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsImV4cCI6MTUyNzMxNDA4NCwiaWF0IjoxNTI3MTQxMjg0LCJuYmYiOjE1MjcxNDA2ODQsImp0aSI6IjVGM0FGMTBDLTdFMEEtNDVDQy04RDVGLUREMTBFMDRCOUY4NCIsInVzZXJuYW1lIjoiYWRtaW4iLCJkYXRhYmFzZVVzZXJuYW1lIjoiQWRtaW4iLCJ1c2VyaWQiOiI2NjkzM0U3Qi1EQTc1LTRCMkUtQjdENi1BQjY1RENBMjBENTAifQ.M-dyU6W51LAPVQ66HIJZ-KAg6WjPSIt1GqpOc6etQ6XJfXp8KkUPA6A8qPZ8bhydWsKKMqpPlx-KRVhK2o5q0Q")
// 定义请求完成的处理函数,请求前也可以增加加载框/禁用下载按钮逻辑 // 定义请求完成的处理函数,请求前也可以增加加载框/禁用下载按钮逻辑
xhr.onload = function () { xhr.onload = function () {
// 请求完成 // 请求完成
...@@ -121,39 +79,10 @@ webservices.factory('templateService', ['$log', '$http', '$q', 'apiConfig', 'htt ...@@ -121,39 +79,10 @@ webservices.factory('templateService', ['$log', '$http', '$q', 'apiConfig', 'htt
// process error // process error
alert(e.errorMessage); alert(e.errorMessage);
}, {}); }, {});
// var reader = new FileReader();
// reader.readAsDataURL(blob); // 转换为base64,可以直接放入a表情href
// reader.onload = function (e) {
// // 转换完成,创建一个a标签用于下载
// var a = document.createElement('a');
// a.download = 'data.xlsx';
// a.href = e.target.result;
// $("body").append(a); // 修复firefox中无法触发click
// a.click();
// $(a).remove();
// }
} }
}; };
// 发送ajax请求 // 发送ajax请求
xhr.send(); xhr.send();
// getTemplateJson(templateID).then(function (result) {
// //var data = new Blob(result, {type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8"});
// var excelIo = new GC.Spread.Excel.IO();
// excelIo.open(result, function (json) {
// //var workbookObj = json;
// //spread.fromJSON(workbookObj);
// spreadSheet = initSpreadExcel(id, json);
// deferred.resolve(spreadSheet);
// }, function (e) {
// // process error
// alert(e.errorMessage);
// }, {});
// spreadSheet = initSpreadExcel(id, result.data === undefined ? result : result.data);
//
// deferred.resolve(spreadSheet);
// });
return promise; return promise;
}; };
...@@ -162,7 +91,6 @@ webservices.factory('templateService', ['$log', '$http', '$q', 'apiConfig', 'htt ...@@ -162,7 +91,6 @@ webservices.factory('templateService', ['$log', '$http', '$q', 'apiConfig', 'htt
}; };
return { return {
getTemplateJson: getTemplateJson,
renderSpreadExcelSimple: renderSpreadExcelSimple, renderSpreadExcelSimple: renderSpreadExcelSimple,
initSpreadExcel: initSpreadExcel, initSpreadExcel: initSpreadExcel,
setRowColName: setRowColName setRowColName: setRowColName
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -3,7 +3,7 @@ systemConfigurationModule ...@@ -3,7 +3,7 @@ systemConfigurationModule
'templateService', 'templateFormulaService', 'stdAccountService', 'spreadJsTipService', 'enums', 'KeyValueConfigService', 'modelConfigurationService', 'industryService', 'templateService', 'templateFormulaService', 'stdAccountService', 'spreadJsTipService', 'enums', 'KeyValueConfigService', 'modelConfigurationService', 'industryService',
'formulaService', 'serviceTypeService', 'mentioUtil', 'region', 'formulaService', 'serviceTypeService', 'mentioUtil', 'region',
function ($scope, $log, $timeout, $translate, $rootScope, $interval, $compile, $uibModal, $q, SweetAlert, templateGroupService, templateService, templateFormulaService, function ($scope, $log, $timeout, $translate, $rootScope, $interval, $compile, $uibModal, $q, SweetAlert, templateGroupService, templateService, templateFormulaService,
stdAccountService, spreadJsTipService, enums, KeyValueConfigService, modelConfigurationService, industryService, formulaService, serviceTypeService, mentioUtil, region) { stdAccountService, spreadJsTipService, enums, KeyValueConfigService, modelConfigurationService, industryService, formulaService, serviceTypeService, mentioUtil, region) {
'use strict'; 'use strict';
var keyValueExp = /@\S*/g; var keyValueExp = /@\S*/g;
...@@ -23,7 +23,6 @@ systemConfigurationModule ...@@ -23,7 +23,6 @@ systemConfigurationModule
}; };
var serviceTypeMapping = { var serviceTypeMapping = {
VAT: $translate.instant('VAT'), VAT: $translate.instant('VAT'),
RPT: $translate.instant('RPT'), RPT: $translate.instant('RPT'),
...@@ -425,56 +424,56 @@ systemConfigurationModule ...@@ -425,56 +424,56 @@ systemConfigurationModule
categoryOptions: [], categoryOptions: [],
rateOptions: [], rateOptions: [],
amountTypeOptions: [ amountTypeOptions: [
{ name: 'PleaseSelect', value: 0 }, {name: 'PleaseSelect', value: 0},
{ name: 'TotalAmount', value: 1 }, {name: 'TotalAmount', value: 1},
{ name: 'TaxAmount', value: 2 }, {name: 'TaxAmount', value: 2},
{ name: 'CopyNumber', value: 3 } {name: 'CopyNumber', value: 3}
] ]
}, },
{ {
type: 'Income', type: 'Income',
value: 1, value: 1,
categoryOptions: _.chain(enums.invoiceType).pairs().map(function (it) { categoryOptions: _.chain(enums.invoiceType).pairs().map(function (it) {
return { key: $translate.instant(it[0]), value: it[1], ticked: false }; return {key: $translate.instant(it[0]), value: it[1], ticked: false};
}).value(), }).value(),
rateOptions: [ rateOptions: [
{ key: '17%', value: '17%', ticked: false }, {key: '17%', value: '17%', ticked: false},
{ key: '13%', value: '13%', ticked: false }, {key: '13%', value: '13%', ticked: false},
{ key: '11%', value: '11%', ticked: false }, {key: '11%', value: '11%', ticked: false},
{ key: '6%', value: '6%', ticked: false }, {key: '6%', value: '6%', ticked: false},
{ key: '5%', value: '5%', ticked: false }, {key: '5%', value: '5%', ticked: false},
{ key: '4%', value: '4%', ticked: false }, {key: '4%', value: '4%', ticked: false},
{ key: '3%', value: '3%', ticked: false }, {key: '3%', value: '3%', ticked: false},
{ key: '1.5%', value: '1.5%', ticked: false } {key: '1.5%', value: '1.5%', ticked: false}
], ],
amountTypeOptions: [ amountTypeOptions: [
{ name: 'PleaseSelect', value: 0 }, {name: 'PleaseSelect', value: 0},
{ name: 'TotalAmount', value: 1 }, {name: 'TotalAmount', value: 1},
{ name: 'TaxAmount', value: 2 }, {name: 'TaxAmount', value: 2},
{ name: 'CopyNumber', value: 3 } {name: 'CopyNumber', value: 3}
] ]
}, },
{ {
type: 'Output', type: 'Output',
value: 2, value: 2,
categoryOptions: _.chain(enums.outputInvoiceType).pairs().map(function (it) { categoryOptions: _.chain(enums.outputInvoiceType).pairs().map(function (it) {
return { key: $translate.instant(it[0]), value: it[1], ticked: false }; return {key: $translate.instant(it[0]), value: it[1], ticked: false};
}).value(), }).value(),
rateOptions: [ rateOptions: [
{ key: '17%', value: '17%', ticked: false }, {key: '17%', value: '17%', ticked: false},
{ key: '13%', value: '13%', ticked: false }, {key: '13%', value: '13%', ticked: false},
{ key: '11%', value: '11%', ticked: false }, {key: '11%', value: '11%', ticked: false},
{ key: '6%', value: '6%', ticked: false }, {key: '6%', value: '6%', ticked: false},
{ key: '5%', value: '5%', ticked: false }, {key: '5%', value: '5%', ticked: false},
{ key: '4%', value: '4%', ticked: false }, {key: '4%', value: '4%', ticked: false},
{ key: '3%', value: '3%', ticked: false }, {key: '3%', value: '3%', ticked: false},
{ key: '1.5%', value: '1.5%', ticked: false } {key: '1.5%', value: '1.5%', ticked: false}
], ],
amountTypeOptions: [ amountTypeOptions: [
{ name: 'PleaseSelect', value: 0 }, {name: 'PleaseSelect', value: 0},
{ name: 'TotalAmount', value: 1 }, {name: 'TotalAmount', value: 1},
{ name: 'TaxAmount', value: 2 }, {name: 'TaxAmount', value: 2},
{ name: 'CopyNumber', value: 3 } {name: 'CopyNumber', value: 3}
] ]
}, },
{ {
...@@ -483,10 +482,10 @@ systemConfigurationModule ...@@ -483,10 +482,10 @@ systemConfigurationModule
categoryOptions: [], categoryOptions: [],
rateOptions: [], rateOptions: [],
amountTypeOptions: [ amountTypeOptions: [
{ name: 'PleaseSelect', value: 0 }, {name: 'PleaseSelect', value: 0},
{ name: 'TotalAmount', value: 1 }, {name: 'TotalAmount', value: 1},
{ name: 'TaxAmount', value: 2 }, {name: 'TaxAmount', value: 2},
{ name: 'CopyNumber', value: 3 } {name: 'CopyNumber', value: 3}
] ]
} }
]; ];
...@@ -496,7 +495,7 @@ systemConfigurationModule ...@@ -496,7 +495,7 @@ systemConfigurationModule
// 选中某一发票类型级联更新税率与金额类型列表 // 选中某一发票类型级联更新税率与金额类型列表
var selectInvoiceOption = function (editModel, invoiceType, isInit) { var selectInvoiceOption = function (editModel, invoiceType, isInit) {
var selectedInvoice = _.where($scope.invoiceOptions, { value: invoiceType }); var selectedInvoice = _.where($scope.invoiceOptions, {value: invoiceType});
var op = selectedInvoice.length === 0 ? $scope.invoiceOptions[0] : selectedInvoice[0]; var op = selectedInvoice.length === 0 ? $scope.invoiceOptions[0] : selectedInvoice[0];
// 如果获取到的editModel.invoiceCategory为[ 99 ],代表发票类型全选; // 如果获取到的editModel.invoiceCategory为[ 99 ],代表发票类型全选;
...@@ -528,7 +527,7 @@ systemConfigurationModule ...@@ -528,7 +527,7 @@ systemConfigurationModule
}); });
var choseAmoutType = isInit && editModel.invoiceAmountType && editModel.invoiceAmountType > 0 ? var choseAmoutType = isInit && editModel.invoiceAmountType && editModel.invoiceAmountType > 0 ?
_.where(op.amountTypeOptions, { value: editModel.invoiceAmountType })[0] : op.amountTypeOptions[0]; _.where(op.amountTypeOptions, {value: editModel.invoiceAmountType})[0] : op.amountTypeOptions[0];
editModel.chosenInvoiceOption = { editModel.chosenInvoiceOption = {
type: op.type, type: op.type,
...@@ -564,12 +563,12 @@ systemConfigurationModule ...@@ -564,12 +563,12 @@ systemConfigurationModule
}); });
_spread = spread; _spread = spread;
var activeSheet = _spread.getActiveSheet(); var activeSheet = _spread.getSheet(1);
//设置整个sheet不可编辑 //设置整个sheet不可编辑
activeSheet.setIsProtected(true); activeSheet.isProtected = true;
activeSheet.protectionOption({ activeSheet.options.protectionOption = {
allowEditObjects: false allowEditObjects: false
}); };
$scope.activeSheet = activeSheet; $scope.activeSheet = activeSheet;
...@@ -644,7 +643,7 @@ systemConfigurationModule ...@@ -644,7 +643,7 @@ systemConfigurationModule
if (isHideContextMenu) { if (isHideContextMenu) {
hideSpreadContextMenu(); hideSpreadContextMenu();
} else { } else {
$contextMenu.css({ left: e.pageX, top: e.pageY }); $contextMenu.css({left: e.pageX, top: e.pageY});
$contextMenu.show(); $contextMenu.show();
$(document).on("click.contextmenu", function () { $(document).on("click.contextmenu", function () {
...@@ -728,7 +727,7 @@ systemConfigurationModule ...@@ -728,7 +727,7 @@ systemConfigurationModule
for (var i = 0; i < spans[k].rowCount; i++) { for (var i = 0; i < spans[k].rowCount; i++) {
for (var j = 0; j < spans[k].colCount; j++) { for (var j = 0; j < spans[k].colCount; j++) {
if (i > 0 || j > 0) { if (i > 0 || j > 0) {
exceptedCells.push({ rowIndex: spans[k].row + i, columnIndex: spans[k].col + j }); exceptedCells.push({rowIndex: spans[k].row + i, columnIndex: spans[k].col + j});
} }
} }
} }
...@@ -747,8 +746,8 @@ systemConfigurationModule ...@@ -747,8 +746,8 @@ systemConfigurationModule
var col = startCol + j; var col = startCol + j;
if (_.every(exceptedCells, function (c) { if (_.every(exceptedCells, function (c) {
return c.rowIndex !== row || c.columnIndex !== col; return c.rowIndex !== row || c.columnIndex !== col;
})) { })) {
validPosition.push({ rowIndex: row, columnIndex: col }); validPosition.push({rowIndex: row, columnIndex: col});
} }
} }
} }
...@@ -761,20 +760,20 @@ systemConfigurationModule ...@@ -761,20 +760,20 @@ systemConfigurationModule
var confirmWarningWindow = function (title, text) { var confirmWarningWindow = function (title, text) {
var deferred = $q.defer(); var deferred = $q.defer();
SweetAlert.swal({ SweetAlert.swal({
title: title, title: title,
text: text, text: text,
type: "warning", type: "warning",
showCancelButton: true, showCancelButton: true,
confirmButtonColor: "#DD6B55", confirmButtonColor: "#DD6B55",
allowOutsideClick: false, allowOutsideClick: false,
confirmButtonText: $translate.instant('Confirm'), confirmButtonText: $translate.instant('Confirm'),
cancelButtonText: $translate.instant('Cancel'), cancelButtonText: $translate.instant('Cancel'),
closeOnConfirm: true, closeOnConfirm: true,
closeOnCancel: true closeOnCancel: true
}, },
function (isConfirm) { function (isConfirm) {
deferred.resolve(isConfirm); deferred.resolve(isConfirm);
}); });
return deferred.promise; return deferred.promise;
}; };
...@@ -803,7 +802,7 @@ systemConfigurationModule ...@@ -803,7 +802,7 @@ systemConfigurationModule
selectInvoiceOption($scope.editModel, $scope.editModel.invoiceType, true); selectInvoiceOption($scope.editModel, $scope.editModel.invoiceType, true);
// invoiceOption: Used to save invoice tax rate and amount type options temporarily // invoiceOption: Used to save invoice tax rate and amount type options temporarily
$scope.invoiceOption = _.findWhere($scope.invoiceOptions, { type: $scope.editModel.chosenInvoiceOption.type }); $scope.invoiceOption = _.findWhere($scope.invoiceOptions, {type: $scope.editModel.chosenInvoiceOption.type});
$scope.mentionApi.triggerValidator($scope.editModel.formula, $scope.editReportFormulaForm.formula); $scope.mentionApi.triggerValidator($scope.editModel.formula, $scope.editReportFormulaForm.formula);
$scope.mentionApiForValidation.triggerValidator($scope.editModel.validation, $scope.editReportFormulaForm.validation); $scope.mentionApiForValidation.triggerValidator($scope.editModel.validation, $scope.editReportFormulaForm.validation);
...@@ -865,10 +864,10 @@ systemConfigurationModule ...@@ -865,10 +864,10 @@ systemConfigurationModule
} }
}, },
columns: [ columns: [
{ caption: $translate.instant('SubjectCodeCol'), dataField: 'code' }, {caption: $translate.instant('SubjectCodeCol'), dataField: 'code'},
{ caption: $translate.instant('SubjectNameCol'), dataField: 'name' }, {caption: $translate.instant('SubjectNameCol'), dataField: 'name'},
{ caption: $translate.instant('SubjectDirectionCol'), dataField: 'directionName' }, {caption: $translate.instant('SubjectDirectionCol'), dataField: 'directionName'},
{ caption: $translate.instant('SubjectTypeCol'), dataField: 'AcctPropName' }, {caption: $translate.instant('SubjectTypeCol'), dataField: 'AcctPropName'},
{ {
alignment: 'center', alignment: 'center',
width: '40px', width: '40px',
...@@ -921,12 +920,12 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasVoucher"/>'); ...@@ -921,12 +920,12 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasVoucher"/>');
} }
}, },
columns: [ columns: [
{ caption: $translate.instant('ModelCode'), dataField: 'code', visible: false }, {caption: $translate.instant('ModelCode'), dataField: 'code', visible: false},
{ caption: $translate.instant('ModelName'), dataField: 'name' }, {caption: $translate.instant('ModelName'), dataField: 'name'},
{ caption: $translate.instant('ModelDescription'), dataField: 'description' }, {caption: $translate.instant('ModelDescription'), dataField: 'description'},
{ caption: $translate.instant('ModelFeature'), dataField: 'featureName' }, {caption: $translate.instant('ModelFeature'), dataField: 'featureName'},
{ caption: $translate.instant('ModelType'), dataField: 'modelTypeName' }, {caption: $translate.instant('ModelType'), dataField: 'modelTypeName'},
{ caption: $translate.instant('ModelOrganization'), dataField: 'organizationName' }, {caption: $translate.instant('ModelOrganization'), dataField: 'organizationName'},
{ {
alignment: 'center', alignment: 'center',
width: '40px', width: '40px',
...@@ -1081,7 +1080,7 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>'); ...@@ -1081,7 +1080,7 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
var operatorMatches = ngModelValue.match(notDuplicateOperatorExp); var operatorMatches = ngModelValue.match(notDuplicateOperatorExp);
if (_.any(operatorMatches, function (m) { if (_.any(operatorMatches, function (m) {
return m.length > 1; return m.length > 1;
})) { })) {
ngModel.$setValidity('operatorDuplicateValidator', false); ngModel.$setValidity('operatorDuplicateValidator', false);
return false; return false;
} }
...@@ -1262,7 +1261,7 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>'); ...@@ -1262,7 +1261,7 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
var operatorMatches = ngModelValue.match(notDuplicateOperatorExp); var operatorMatches = ngModelValue.match(notDuplicateOperatorExp);
if (_.any(operatorMatches, function (m) { if (_.any(operatorMatches, function (m) {
return m.length > 1; return m.length > 1;
})) { })) {
ngModel.$setValidity('operatorDuplicateValidator', false); ngModel.$setValidity('operatorDuplicateValidator', false);
return false; return false;
} }
...@@ -1337,33 +1336,33 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>'); ...@@ -1337,33 +1336,33 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
/*********************** End Formula Editor ***********************************/ /*********************** End Formula Editor ***********************************/
//模板另存为 //模板另存为
var saveTemplateGroup = function () { var saveTemplateGroup = function () {
var groupName = $scope.groupName; var groupName = $scope.groupName;
if (groupName === '' || groupName === undefined) { if (groupName === '' || groupName === undefined) {
SweetAlert.warning($translate.instant('InputTemplateGroupNameWarning')); SweetAlert.warning($translate.instant('InputTemplateGroupNameWarning'));
return; return;
}
$scope.newTemplateGroup.Name = groupName;
$scope.newTemplateGroup.ServiceTypeID = $scope.curServiceTypeId;
$scope.newTemplateGroup.CopyFrom = $scope.curTemplateGroup.id;
$scope.newTemplateGroup.groupType = $scope.curTemplateGroup.groupType;
$scope.newTemplateGroup.payTaxType = $scope.curTemplateGroup.payTaxType;
$scope.newTemplateGroup.industryIDs = $scope.curTemplateGroup.industryIDs;
$scope.newTemplateGroup.ChangedFormulas = $scope.formulasArrayTemp;
templateGroupService.addTemplateGroup($scope.newTemplateGroup).success(function (or) {
if (or && or.result) {
SweetAlert.success($translate.instant('TemplateGroupSaveAsSuccess'));
loadTemplateGroup();
$('#templateName').val('');
$('.templates-save-form').css('display', 'none');
} else {
SweetAlert.warning($translate.instant(or.resultMsg));
} }
});
}; $scope.newTemplateGroup.Name = groupName;
$scope.newTemplateGroup.ServiceTypeID = $scope.curServiceTypeId;
$scope.newTemplateGroup.CopyFrom = $scope.curTemplateGroup.id;
$scope.newTemplateGroup.groupType = $scope.curTemplateGroup.groupType;
$scope.newTemplateGroup.payTaxType = $scope.curTemplateGroup.payTaxType;
$scope.newTemplateGroup.industryIDs = $scope.curTemplateGroup.industryIDs;
$scope.newTemplateGroup.ChangedFormulas = $scope.formulasArrayTemp;
templateGroupService.addTemplateGroup($scope.newTemplateGroup).success(function (or) {
if (or && or.result) {
SweetAlert.success($translate.instant('TemplateGroupSaveAsSuccess'));
loadTemplateGroup();
$('#templateName').val('');
$('.templates-save-form').css('display', 'none');
} else {
SweetAlert.warning($translate.instant(or.resultMsg));
}
});
};
var loadTemplateMenu = function () { var loadTemplateMenu = function () {
...@@ -1411,21 +1410,21 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>'); ...@@ -1411,21 +1410,21 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
// 如果发票类型全选,则将editModel.invoiceCategory设置为[ 99 ]; // 如果发票类型全选,则将editModel.invoiceCategory设置为[ 99 ];
// 否则将选中的发票类型存入editModel.invoiceCategory数组,如[1, 2, 3] // 否则将选中的发票类型存入editModel.invoiceCategory数组,如[1, 2, 3]
if ($scope.editModel.chosenInvoiceOption.categoryOptions.length > 0 && if ($scope.editModel.chosenInvoiceOption.categoryOptions.length > 0 &&
_.every($scope.editModel.chosenInvoiceOption.categoryOptions, { ticked: true })) { _.every($scope.editModel.chosenInvoiceOption.categoryOptions, {ticked: true})) {
$scope.editModel.invoiceCategory = [Number(constant.selectAllValue)]; $scope.editModel.invoiceCategory = [Number(constant.selectAllValue)];
} else { } else {
$scope.editModel.invoiceCategory = _.chain($scope.editModel.chosenInvoiceOption.categoryOptions) $scope.editModel.invoiceCategory = _.chain($scope.editModel.chosenInvoiceOption.categoryOptions)
.where({ ticked: true }).pluck('value').value(); .where({ticked: true}).pluck('value').value();
} }
// 如果税率全选,则将editModel.taxRate设置为[ '99' ]; // 如果税率全选,则将editModel.taxRate设置为[ '99' ];
// 否则将选中的税率存入editModel.taxRate数组,如['17%', '11%', '6%'] // 否则将选中的税率存入editModel.taxRate数组,如['17%', '11%', '6%']
if ($scope.editModel.chosenInvoiceOption.rateOptions.length > 0 && if ($scope.editModel.chosenInvoiceOption.rateOptions.length > 0 &&
_.every($scope.editModel.chosenInvoiceOption.rateOptions, { ticked: true })) { _.every($scope.editModel.chosenInvoiceOption.rateOptions, {ticked: true})) {
$scope.editModel.taxRate = [constant.selectAllValue]; $scope.editModel.taxRate = [constant.selectAllValue];
} else { } else {
$scope.editModel.taxRate = _.chain($scope.editModel.chosenInvoiceOption.rateOptions) $scope.editModel.taxRate = _.chain($scope.editModel.chosenInvoiceOption.rateOptions)
.where({ ticked: true }).pluck('value').value(); .where({ticked: true}).pluck('value').value();
} }
$scope.editModel.invoiceType = $scope.editModel.chosenInvoiceOption.value; $scope.editModel.invoiceType = $scope.editModel.chosenInvoiceOption.value;
...@@ -1549,17 +1548,17 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>'); ...@@ -1549,17 +1548,17 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
var groupedParamList = _.groupBy(result[2].data.data, 'formulaID'); var groupedParamList = _.groupBy(result[2].data.data, 'formulaID');
var paramList = result[1].data.data; var paramList = result[1].data.data;
_.each(groupedParamList, function (val, key) { _.each(groupedParamList, function (val, key) {
var formula = _.findWhere(formulaList, { id: key }); var formula = _.findWhere(formulaList, {id: key});
if (formula) { if (formula) {
formula.params = _.chain(val) formula.params = _.chain(val)
.map(function (p) { .map(function (p) {
return { id: p.formulaParamID, index: p.paramIndex }; return {id: p.formulaParamID, index: p.paramIndex};
}) })
.sortBy(function (p) { .sortBy(function (p) {
return p.index; return p.index;
}).value(); }).value();
_.each(formula.params, function (p, idx) { _.each(formula.params, function (p, idx) {
var param = _.findWhere(paramList, { id: p.id }); var param = _.findWhere(paramList, {id: p.id});
_.extend(p, param); _.extend(p, param);
}); });
} }
...@@ -1578,14 +1577,14 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>'); ...@@ -1578,14 +1577,14 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
var modelTypes = _.invert(enums.modelType); var modelTypes = _.invert(enums.modelType);
_.each(data, function (m) { _.each(data, function (m) {
if (m.type.toString() === modelTypes.SystemCommonModel) { if (m.type.toString() === modelTypes.SystemCommonModel) {
if (!_.some(rtn, { id: m.id })) { if (!_.some(rtn, {id: m.id})) {
m.orgID = null; m.orgID = null;
m.organizationName = $translate.instant('All'); m.organizationName = $translate.instant('All');
m.featureName = $translate.instant(enums.modelFeature[m.feature]); m.featureName = $translate.instant(enums.modelFeature[m.feature]);
rtn.push(m); rtn.push(m);
} }
} else { } else {
var existsModel = _.findWhere(rtn, { id: m.id }); var existsModel = _.findWhere(rtn, {id: m.id});
if (!existsModel) { if (!existsModel) {
m.featureName = $translate.instant(enums.modelFeature[m.feature]); m.featureName = $translate.instant(enums.modelFeature[m.feature]);
rtn.push(m); rtn.push(m);
...@@ -1691,8 +1690,8 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>'); ...@@ -1691,8 +1690,8 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
newValue.value <= 0 || newValue.value <= 0 ||
newValue.invoiceAmountType.value <= 0 || newValue.invoiceAmountType.value <= 0 ||
newValue.value !== 3 && newValue.value !== 3 &&
(_.every(newValue.categoryOptions, { ticked: false }) || (_.every(newValue.categoryOptions, {ticked: false}) ||
_.every(newValue.rateOptions, { ticked: false })))) { _.every(newValue.rateOptions, {ticked: false})))) {
$scope.editReportFormulaForm.invoice.$setValidity('invoiceNotSelectValidator', false); $scope.editReportFormulaForm.invoice.$setValidity('invoiceNotSelectValidator', false);
} else { } else {
$scope.editReportFormulaForm.invoice.$setValidity('invoiceNotSelectValidator', true); $scope.editReportFormulaForm.invoice.$setValidity('invoiceNotSelectValidator', true);
...@@ -1706,8 +1705,8 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>'); ...@@ -1706,8 +1705,8 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
$scope.editModel.chosenInvoiceOption.value <= 0 || $scope.editModel.chosenInvoiceOption.value <= 0 ||
$scope.editModel.chosenInvoiceOption.invoiceAmountType.value <= 0 || $scope.editModel.chosenInvoiceOption.invoiceAmountType.value <= 0 ||
$scope.editModel.chosenInvoiceOption.value !== 3 && $scope.editModel.chosenInvoiceOption.value !== 3 &&
(_.every($scope.editModel.chosenInvoiceOption.rateOptions, { ticked: false }) || (_.every($scope.editModel.chosenInvoiceOption.rateOptions, {ticked: false}) ||
_.every($scope.editModel.chosenInvoiceOption.categoryOptions, { ticked: false }))) { _.every($scope.editModel.chosenInvoiceOption.categoryOptions, {ticked: false}))) {
$scope.editReportFormulaForm.invoice.$setValidity('invoiceNotSelectValidator', false); $scope.editReportFormulaForm.invoice.$setValidity('invoiceNotSelectValidator', false);
} }
}); });
...@@ -2064,7 +2063,8 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>'); ...@@ -2064,7 +2063,8 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
$('#' + dxControl.templateDropDownId).dxDropDownBox({ $('#' + dxControl.templateDropDownId).dxDropDownBox({
value: selectName, value: selectName,
showClearButton: false, showClearButton: false,
onContentReady: function (args) { }, onContentReady: function (args) {
},
contentTemplate: function (e) { contentTemplate: function (e) {
// thisData.DropDownEvent = e; // thisData.DropDownEvent = e;
var value = e.component.option("value"); var value = e.component.option("value");
...@@ -2165,10 +2165,10 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>'); ...@@ -2165,10 +2165,10 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
}); });
var tabs = [ var tabs = [
{ id: 0, text: $translate.instant('AutoCalculateTab') }, {id: 0, text: $translate.instant('AutoCalculateTab')},
{ id: 1, text: $translate.instant('ManualInputTab') }, {id: 1, text: $translate.instant('ManualInputTab')},
{ id: 2, text: $translate.instant('ModelTab') }, {id: 2, text: $translate.instant('ModelTab')},
{ id: 3, text: $translate.instant('ValidationTab') } {id: 3, text: $translate.instant('ValidationTab')}
]; ];
$scope.tabOptions = { $scope.tabOptions = {
dataSource: tabs, dataSource: tabs,
......
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