1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
systemConfigurationModule.directive('ruleEngineeTable', ['$log','ruleEngineOp','$rootScope','$timeout',
function ($log, ruleEngineOp,$rootScope,$timeout) {
return {
restrict: 'E',
templateUrl: '/app/admin/systemConfiguration/ruleEngineeConfiguration/vatRuleEnginee/rule-enginee-custome-table.html' + '?_=' + Math.random(),
replace: true,
scope: {
taxBasisId: '@',//公式显示组件的id
isEdit: '=',//是否是可编辑
defaultEdit:'=',//默认税基是否可编辑
orgs:'=',//机构下拉列表
keyCodes:'=',//all key code
editModel: '=', //所有改组件需要显示的数据来源,
selectedOrgs: '=',
operation:'=',
// editModel={ defaultTaxBase:'xxx',defulatTaxRate:'yyyy',id:'zzzz',
// exceptions:[{companies:'aaa',taxBase:'bbbb',taxRate:'ccc'}]}
},
controller: 'ruleEngineeTableController',
link: function (scope, element, attr) {
scope.keyCodesC = angular.copy(scope.keyCodes);
var currentException;
$rootScope.$on('orgsChanged', function (event, orgs) {
if (currentException !== undefined) {
currentException.orgs = orgs;
}
});
scope.addException = function () {
var newException = { id: 0, GroupName: scope.editModel.groupName, name: scope.editModel.name, isNotPersistent: true, taxBase: '', editKey: +new Date() };
scope.editModel.taxRuleSettingsExceptions.push(newException);
};
scope.delete = function (exception) {
var index = scope.editModel.taxRuleSettingsExceptions.indexOf(exception);
if (index !== -1) {
if (exception.editKey == null) {
exception.editKey = +new Date();
}
scope.editModel.taxRuleSettingsExceptions.splice(index, 1);
}
};
scope.openRuleEngineSelectorModel = function (exception) {
if (scope.isEdit === true) {
scope.operation = { type: 'open' };
currentException = exception;
scope.selectedOrgs = exception.orgs;
}
};
}
}
}]);