123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- app.controller('StdFaceScoreFuheCtrl', function($rootScope, $scope, $http, $timeout, $state, toaster, $q, Upload) {
- $scope.load = function(){
- $scope.score = {};
- var p_baseInfo = $http({
- url : $rootScope.host_url + '/acquire/getFuheStdBaseInfo?session=' + $rootScope.session,
- method : 'GET'
- }).success(function(data) {
- if(data.code == 0){
- $scope.stdData = data.result;
- }
- }).error(function() {
- });
-
- var p_faceScore = $http({
- url : $rootScope.host_url + '/acquire/getFaceScore?session=' + $rootScope.session,
- method : 'GET'
- }).success(function(data) {
- if(data.code == 0){
- $scope.score = data.result;
- }
- }).error(function() {
- });
-
- $scope.fuhe = {};
- var p_fuhe = $http({
- url : $rootScope.host_url + '/acquire/getFaceScoreFuhe?session=' + $rootScope.session,
- method : 'GET'
- }).success(function(data) {
- if(data.code == 0 && data.result){
- $scope.fuhe = data.result;
- if($scope.fuhe.zhongwen){
- $scope.fuhe.zhongwen = true;
- }
- if($scope.fuhe.waiyu){
- $scope.fuhe.waiyu = true;
- }
- if($scope.fuhe.fuyu){
- $scope.fuhe.fuyu = true;
- }
- }
- }).error(function() {
- });
-
- $scope.myPromise = $q.all([p_baseInfo, p_faceScore, p_fuhe]);
- }
-
- $scope.load();
-
- // upload on file select or drop
- $scope.uploadPhoto = function (file, photoType) {
- if(!file) return;
-
- Upload.upload({
- url: $rootScope.host_url + '/upload?session=' + $rootScope.session,
- data: {file: file, dir: 'faceScoreFuhe'}
- }).then(function (resp) {
- var path = resp.data.result.path;
- $scope.fuhe[photoType] = resp.data.result.path;
- toaster.pop('success', "上传成功。");
- }, function (resp) {
- }, function (evt) {
- });
- };
-
- $scope.submitForm = function(isValid) {
- $scope.submitted = true;
-
- // check to make sure the form is completely valid
- if (isValid) {
- if(!$scope.fuhe.cert_photo_front){
- toaster.pop('error', "请上传身份证正面照");
- return;
- }
- if(!$scope.fuhe.cert_photo_back){
- toaster.pop('error', "请上传身份证反面照");
- return;
- }
-
- if(!$scope.fuhe.waiyu && !$scope.fuhe.zhongwen && !$scope.fuhe.fuyu){
- toaster.pop('error', "请选择复查科目");
- return;
- }
-
- $scope.myPromise = $http({
- url : $rootScope.host_url + '/acquire/postFaceScoreFuhe?session=' + $rootScope.session,
- method : 'POST',
- data : angular.toJson($scope.fuhe)
- }).success(function(data) {
- if(data.code == 0){
- toaster.pop('success', '保存成功');
- }else{
- toaster.pop('error', data.message);
- }
- $scope.load();
- }).error(function() {
- $scope.load();
- });
- }
- }
-
- $scope.viewFuheResult = function(){
- $state.go('faceScoreFuheResult');
- }
- }).controller('StdFaceScoreFuheResultCtrl', function($rootScope, $scope, $http, $timeout, $state, toaster, $q, Upload) {
- $scope.load = function(){
- $scope.score = {};
- var p_baseInfo = $http({
- url : $rootScope.host_url + '/acquire/getFuheStdBaseInfo?session=' + $rootScope.session,
- method : 'GET'
- }).success(function(data) {
- if(data.code == 0){
- $scope.stdData = data.result;
- }
- }).error(function() {
- });
-
- var p_faceScore = $http({
- url : $rootScope.host_url + '/acquire/getFaceScoreAll?session=' + $rootScope.session,
- method : 'GET'
- }).success(function(data) {
- if(data.code == 0){
- $scope.score = data.result;
- }
- }).error(function() {
- });
-
- $scope.fuhe = {};
- var p_fuhe = $http({
- url : $rootScope.host_url + '/acquire/getFaceScoreFuhe?session=' + $rootScope.session,
- method : 'GET'
- }).success(function(data) {
- if(data.code == 0 && data.result){
- $scope.fuhe = data.result;
- if($scope.fuhe.zhongwen){
- $scope.fuhe.zhongwen = true;
- }
- if($scope.fuhe.waiyu){
- $scope.fuhe.waiyu = true;
- }
- }
- }).error(function() {
- });
-
- $scope.myPromise = $q.all([p_baseInfo, p_faceScore, p_fuhe]);
- }
-
- $scope.load();
- });
|