diff --git a/src/main/ui/static/analysis/risk_business.js b/src/main/ui/static/analysis/risk_business.js index c5fb64042..113e07cc1 100644 --- a/src/main/ui/static/analysis/risk_business.js +++ b/src/main/ui/static/analysis/risk_business.js @@ -542,6 +542,36 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], $scope.orderTypes = orderTypesMap; $scope.royapayOrderTypes = royalpayOrderTypesMap; $scope.warningOrderTypes = warningOrderTypesMap; + $scope.materials = [{key: 0, value: ""}]; + $scope.canMinus = false; + + $scope.increase = function($index) { + $scope.materials.splice($index + 1, 0, + {key: new Date().getTime(), value: ""}); // 用时间戳作为每个item的key + // 增加新的input后允许删除 + $scope.canMinus = true; + } + + $scope.decrease = function($index) { + // 如果input大于1,删除 + if ($scope.materials.length > 1) { + $scope.materials.splice($index, 1); + } + // 如果回复数为1,不允许删除 + if ($scope.materials.length == 1) { + $scope.canMinus = false; + } + } + var array=new Array(); + $scope.combineMaterials = function() { + for (var i = 0; i < $scope.materials.length; i++) { + var cr = {}; + cr['question'+(i+1)] = $scope.materials[i].value; + array[i] = cr; + } + console.log(JSON.stringify(array)); + return JSON.stringify(array); + } $scope.save = function(form) { if (form.$invalid) { @@ -565,6 +595,8 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], $scope.riskEvent.receive_email_date = $filter('date')($scope.riskEvent.receive_email_date, 'yyyy-MM-dd'); + $scope.riskEvent.alipay_materials = $scope.combineMaterials(); + $http.post('/risk/business/events', $scope.riskEvent).then(function (resp) { commonDialog.alert({ title: 'Success', diff --git a/src/main/ui/static/analysis/templates/new_riskEvent.html b/src/main/ui/static/analysis/templates/new_riskEvent.html index c48e47f96..d1308f634 100644 --- a/src/main/ui/static/analysis/templates/new_riskEvent.html +++ b/src/main/ui/static/analysis/templates/new_riskEvent.html @@ -209,6 +209,30 @@ + +
+