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

modify

parent ac2da005
......@@ -4,7 +4,9 @@ import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.constant.enums.RevenueConfEnum;
import pwc.taxtech.atms.dpo.OrgSelectDto;
import pwc.taxtech.atms.dto.revenuconf.RevConfAddDto;
import pwc.taxtech.atms.dto.revenuconf.RevenueConfParam;
......@@ -53,7 +55,7 @@ public class RevenueConfService extends BaseService {
public void addConfig(RevenueConfig config) {
//todo 重复校验
config.setId(idService.nextId());
revenueConfigMapper.insertSelective(config);
revenueConfigMapper.insertSelective(parseEntity(config));
}
/**
......@@ -66,7 +68,7 @@ public class RevenueConfService extends BaseService {
addDto.getOrgList().forEach(id -> {
addDto.setId(idService.nextId());
addDto.setOrgId(id);
revenueConfigMapper.insertSelective(addDto);
revenueConfigMapper.insertSelective(parseEntity(addDto));
});
}
}
......@@ -78,7 +80,22 @@ public class RevenueConfService extends BaseService {
*/
public void updateConfig(RevenueConfig config) {
//todo 重复校验
revenueConfigMapper.updateByPrimaryKeySelective(config);
revenueConfigMapper.updateByPrimaryKeySelective(parseEntity(config));
}
private RevenueConfig parseEntity(RevenueConfig config) {
if (config.getAccountType() != RevenueConfEnum.AccountType.Account.getCode().intValue()) {
config.setTbSegment3(StringUtils.EMPTY);
config.setTbSegment5(StringUtils.EMPTY);
config.setTbSegment6(StringUtils.EMPTY);
}
if (config.getTaxBase() != RevenueConfEnum.TaxBase.Period_Cr.getCode().intValue()) {
config.setBaseCrCode(StringUtils.EMPTY);
}
if (config.getTaxBase() != RevenueConfEnum.TaxBase.Period_Dr.getCode().intValue()) {
config.setBaseDrCode(StringUtils.EMPTY);
}
return config;
}
}
......@@ -26,7 +26,22 @@
{dataField: 'statusStr', caption: $translate.instant('RevenueColStatus'), fixed: true, allowHeaderFiltering: true},
{dataField: 'startDate', caption: $translate.instant('RevenueColEnable'), fixed: true, allowHeaderFiltering: true},
{dataField: 'endDate', caption: $translate.instant('RevenueColDisable'), fixed: true, allowHeaderFiltering: true},
{dataField: 'statusString', caption: $translate.instant('RevenueColEdit'), fixed: true, allowHeaderFiltering: true},
{dataField: '', caption: $translate.instant('RevenueColEdit'), fixed: true,
cellTemplate: function (container, options) {
try {
$('<i class="fa fa-pencil-square-o" style="cursor: pointer"></i>&nbsp;&nbsp;')
.on('click', function () {
$scope.editConfig(options.data);
}).appendTo(container);
$('<i class="fa fa-trash" style="cursor: pointer;margin-left: 5px;"></i>')
.on('click', function () {
$scope.editConfig(options.data);
}).appendTo(container);
}
catch (e) {
$log.error(e);
}
}},
],
bindingOptions: {
dataSource: 'pageConfDataSource',
......@@ -53,6 +68,8 @@
//添加配置
$scope.addConfig = function () {
$scope.isEdit = false;
$scope.isOrgReadOnly = false;
$($scope.revenueConfAddDiv).modal('show');
};
......@@ -63,16 +80,30 @@
//添加配置
$scope.saveConfig = function () {
$http.post('/revenueConf/add',$scope.formParam, apiConfig.createVat())
.success(function (res) {
if (res && 0 === res.code) {
SweetAlert.success($translate.instant('RevenueAddSuccess'));
$scope.refreshConfigGrid();
$($scope.revenueConfAddDiv).modal('hide');
}else {
SweetAlert.error($translate.instant('SystemError'));
}
})
parseTaxBase();
if ($scope.isEdit) {
$http.post('/revenueConf/update',$scope.formParam, apiConfig.createVat())
.success(function (res) {
if (res && 0 === res.code) {
SweetAlert.success($translate.instant('RevenueAddSuccess'));
$scope.refreshConfigGrid();
$($scope.revenueConfAddDiv).modal('hide');
}else {
SweetAlert.error($translate.instant('SystemError'));
}
})
}else {
$http.post('/revenueConf/add',$scope.formParam, apiConfig.createVat())
.success(function (res) {
if (res && 0 === res.code) {
SweetAlert.success($translate.instant('RevenueAddSuccess'));
$scope.refreshConfigGrid();
$($scope.revenueConfAddDiv).modal('hide');
}else {
SweetAlert.error($translate.instant('SystemError'));
}
})
}
};
//关闭配置框
......@@ -81,6 +112,18 @@
$scope.formParam = {}
};
//编辑
$scope.editConfig = function (data) {
$scope.isEdit = true;
$scope.isOrgReadOnly = true;
$scope.formParam = data;
$scope.formParam.orgList = [data.orgId];
if (4 === $scope.formParam.taxBase) {
$scope.formParam.baseCrCode = $scope.formParam.baseDrCode;
}
$($scope.revenueConfAddDiv).modal('show');
};
//获取机构列表
function getMyOrgList() {
$http.get('/org/getMyOrgList',apiConfig.createVat())
......@@ -93,6 +136,18 @@
})
}
function parseTaxBase() {
if ($scope.formParam.taxBase) {
if (4 === $scope.formParam.taxBase) {
$scope.formParam.baseDrCode = $scope.formParam.baseCrCode;
$scope.formParam.baseCrCode = '';
}else if (4 !== $scope.formParam.taxBase && 5 !== $scope.formParam.taxBase) {
$scope.formParam.baseCrCode = '';
$scope.formParam.baseDrCode = '';
}
}
}
(function initialize() {
......@@ -108,6 +163,8 @@
};
$scope.isAccount = false;
$scope.isShowBaseCrCode = false;
$scope.isOrgReadOnly = false;
//机构下拉设置
$scope.selectOrgOptions = {
......@@ -116,7 +173,8 @@
width: '95%',
bindingOptions: {
value: 'formParam.orgList',
dataSource: 'selectOrgList'
dataSource: 'selectOrgList',
readOnly: 'isOrgReadOnly'
},
height: '30px',
placeholder: '',
......@@ -157,7 +215,14 @@
{'key': '手工录入', 'val': 3},
{'key': '借方发生额', 'val': 4},
{'key': '贷方发生额', 'val': 5},
]
],
onSelectionChanged: function (e) {
if (4 === e.selectedItem.val || 5 === e.selectedItem.val) {
$scope.isShowBaseCrCode = true;
}else {
$scope.isShowBaseCrCode = false;
}
}
};
//账载收入下拉
......@@ -171,7 +236,14 @@
{'key': '0值', 'val': 0},
{'key': '科目', 'val': 1},
{'key': '手工录入', 'val': 2},
]
],
onSelectionChanged: function (e) {
if (1 === e.selectedItem.val) {
$scope.isAccount = true;
}else {
$scope.isAccount = false;
}
}
};
$scope.selectRevenueTypeOptions = {
......@@ -213,6 +285,7 @@
};
$scope.dateBoxStart = {
width: '100%',
acceptCustomValue: false,
openOnFieldClick: true,
displayFormat: 'yyyy-MM',
......@@ -223,6 +296,7 @@
};
$scope.dateBoxEnd = {
width: '100%',
acceptCustomValue: false,
openOnFieldClick: true,
displayFormat: 'yyyy-MM',
......
......@@ -15,6 +15,9 @@
<div class="dx-viewport grid-container">
<div id="revenueGridContainer" dx-data-grid="revenueGridOptions"
style="margin-top: 0px;">
<div data-options="dxTemplate:{ name:'editCellTemplate' }">
</div>
</div>
</div>
<div class="page-footer">
......@@ -63,7 +66,7 @@
<div dx-select-box="selectTaxBaseOptions"></div>
</div>
<div class="col-sm-2">
<input class="form-control" name="name" ng-model="formParam.baseCrCode" maxlength="255" placeholder="科目">
<input class="form-control" name="name" ng-model="formParam.baseCrCode" maxlength="255" placeholder="科目" ng-disabled="!isShowBaseCrCode">
</div>
<label class="col-sm-2 control-label"><span style="color: red">*</span>{{'RevenueColType' | translate}}:</label>
<div class="col-sm-4">
......
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