zm
2020-04-12 0d659cff38f50d83e782a9f8c5c20fb54a5c0321
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
56
57
58
59
60
61
62
63
64
65
66
angular.module('budget_froms', [])
.controller('budgetFormsCtrl', [
    '$scope',
    '$routeParams', 
    '$route', 
    '$compile', 
    'http_service', 
    'global_service', function($scope, $routeParams, $route, $compile, http_service, global_service){
    $scope.type = $routeParams.type;
    
    if($routeParams.business){
        $scope.isguide = true;
        $scope.business = $routeParams.business;
    }else{
        $scope.business = global_service.get_indus();
        $scope.isguide = false;
    }
    
    $scope.$on('$viewContentLoaded', function() {
        $('div.split_form').height($(document).height() - 52);
        $(window).resize(function(){
            $('div.split_form').height($(document).height() - 52);
        });
    });
    $scope.show_saved_form = function(business, type, action, templateid){
           $scope.business = business;
        $scope.type = type;
        $scope.action = action;
        $scope.templateid = templateid;
           var $form = $('<div saved-form  business="business" isguide="isguide" type="type" unedit="1" action="action" templateid="templateid"></div>');
        $('div.form_container').html($form);
        $compile($form)($scope);
    }
        $scope.show_saved_form($scope.business,$scope.type,1);
    
    
        $('body').on('click', function() {
            $scope.show = false;
        });
        $('ul.showul').off('click').on('click', function(event) {
            event.stopPropagation();
        });
    
    http_service.post('indusExten/search', {"indusId":$scope.business, "tempType": $scope.type}, function(res){
        if(res.data.data.length!=0)
        {
        $scope.indus_templates = res.data.data;
        }
            
 
    });
    
    http_service.post('form/list',{"guTempType":parseInt($scope.type),"cache_id":parseInt($scope.type)},function(res){
        if (res.data.data && res.data.data.child.length > 0) {
            $scope.isShow = true;
        } else {
            $scope.isShow = false;
        }
    },true);
 
    
//  $scope.searchtemplate = function(type){
//      http_service.post('template/search',{'guIndusId':$scope.business,'guTempType':type},function(res){
//      })
//  }
}]);