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){
|
// })
|
// }
|
}]);
|