// web service proxy for standard account webservices.factory('enterpriseAccountService', ['$http', 'apiConfig','FileSaver', function ($http, apiConfig, FileSaver) { 'use strict'; return { getEnterpriceAccountList: function (espID, orgID, filterType) { return $http.get('/enterpriseAccountManage/getEnterpriseAccountList?espID=' + espID + '&orgID=' + orgID + '&filterType=' + filterType, apiConfig.create()); }, add: function (model) { return $http.post('/enterpriseAccountManage/add', model, apiConfig.create()); }, update: function (model) { return $http.post('/enterpriseAccountManage/update', model, apiConfig.create()); }, isactive: function (model) { return $http.post('/enterpriseAccountManage/isactive', model, apiConfig.create()); }, get: function (id) { return $http.get('/enterpriseAccountManage/getsingle?id=' + id, apiConfig.create()); }, mapAccount: function (accountMapDto) { return $http.post('/enterpriseAccountManage/mapAccount', { 'EnterpriseAccountCodes': accountMapDto.enterpriseAccountCodes, 'orgID': accountMapDto.orgID, 'StandardAccountCode': accountMapDto.standardAccountCode, "AccountSetID": accountMapDto.accountSetID }, apiConfig.create()); }, autoMap: function (orgID, accountSetID) { return $http.get('/enterpriseAccountManage/autoMap?orgID=' + orgID + '&accountSetID=' + accountSetID, apiConfig.create()); }, clearMap: function (enterpriseAccountIDs, orgId) { return $http.post('/enterpriseAccountManage/clearMap?orgId=' + orgId, enterpriseAccountIDs, apiConfig.create()); }, copyMapping: function (mappings) { return $http.post('/enterpriseAccountManage/copyMapping', mappings, apiConfig.create()); }, checkMapped: function (orgIDs, orgSetID) { return $http.post('/enterpriseAccountManage/checkMapped?orgSetID=' + orgSetID, orgIDs, apiConfig.create()); }, upload: function (model) { $http.post('/enterpriseAccountManage/Upload', model, apiConfig.create()); }, getListByEnterpriseAccountSetID: function (enterpriseAccountSetID) { return $http.get('/enterpriseAccountManage/getListByEnterpriseAccountSetID?enterpriseAccountSetID=' + enterpriseAccountSetID, apiConfig.create()); }, getEnterpriseAccountSetList: function () { return $http.get('/enterpriseAccountManage/getEnterpriseAccountSetList', apiConfig.create()); }, getEnterpriseAccountSetListByOrgID: function (orgID) { return $http.get('/enterpriseAccountManage/getEnterpriseAccountSetListByOrgID?orgID=' + orgID, apiConfig.create()); }, getEnterpriseAccountSet: function (id) { return $http.get('/enterpriseAccountManage/getEnterpriseAccountSet?id=' + id, apiConfig.create()); }, getAccountMappingOrg: function (organizationID) { return $http.get('/enterpriseAccountManage/getAccountMappingOrg?organizationID=' + organizationID, apiConfig.create()); }, enterpriseAccountSetNameValidate: function (model) { return $http.post('/enterpriseAccountManage/enterpriseAccountSetNameValidate', model, apiConfig.create()); }, enterpriseAccountSetOrgValidate: function (model) { return $http.post('/enterpriseAccountManage/enterpriseAccountSetOrgValidate', model, apiConfig.create()); }, updateEnterpriseAccountSet: function (model) { return $http.post('/enterpriseAccountManage/updateEnterpriseAccountSet', model, apiConfig.create()); }, clearRepeatEnterpriseAccountList: function (enterpriseAccountSetID, repeatCodeList) { var model = { id: enterpriseAccountSetID, repeatCodeList: repeatCodeList }; return $http.post('/enterpriseAccountManage/clearRepeatEnterpriseAccountList', model, apiConfig.create()); }, addEnterpriseAccountSetOrg: function (model) { return $http.post('/enterpriseAccountManage/addEnterpriseAccountSetOrg', model, apiConfig.create()); }, updateEnterpriseAccountSetOrg: function (model) { return $http.post('/enterpriseAccountManage/updateEnterpriseAccountSetOrg', model, apiConfig.create()); }, deleteEnterpriseAccountSetOrg: function (model) { return $http.post('/enterpriseAccountManage/deleteEnterpriseAccountSetOrg', model, apiConfig.create()); }, downEntepriseAccountTemplate: function () { var thisConfig = apiConfig.create(); thisConfig.responseType = "arraybuffer"; return $http.post('/enterpriseAccountManage/downEntepriseAccountTemplate', {},thisConfig).then(function (response) { var data = new Blob([response.data], { type: response.headers('Content-Type') }); // var filename1 = response.headers('Content-Disposition').split(';')[1].trim().substr('filename='.length); var filename = '企业账套模板.xlsx'; FileSaver.saveAs(data, filename); }); } }; }]);