sunxia
2022-04-18 85b18058da15575cbf98fc0227d231eb205bc30d
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
<apex:component >
<script>
;
'use strict';
angular.module('alSfdcService', [])
// 名刺の処理クラス
.factory('sfdcService', ['$log', function($log) {
 
  return {
    // 土地レコードへファイルの添付
    createAttachment : createAttachment
  };
 
    // 土地レコードに添付ファイル 写真 を追加
    function createAttachment(id, photoInfo, photoType, dt, longitude, latitude, callbackSuccess, callbackFailure) {
      var req = {'apexType' : 'AL_MobileApp_Controller.CreateAttachmentRequest',
        'id'  : id,
        'photo' : photoInfo.data.split(',')[1],
        'fname' : photoInfo.name,
        'contentType' : photoInfo.type,
        'photoType' : photoType,
        'ms' : dt.getTime(),
        'latitude' : latitude,
        'longitude' : longitude
      };
      $log.info(req.photo.length);
      Visualforce.remoting.Manager.invokeAction(
        'AL_MobileApp_Controller.createAttachment',
        req,
        function(result, event) {
          if (event.status && result.success==true) {
            callbackSuccess(result);
          } else {
            callbackFailure(event);
          }
        },
        { buffer: false, escape: false, timeout: 120000 }
      );
    }
 
}])
;
</script>
</apex:component>