Merge branch 'develop'

master
taylor.dang 6 years ago
commit d11df5467d

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>au.com.royalpay.payment</groupId> <groupId>au.com.royalpay.payment</groupId>
<artifactId>payment-parent</artifactId> <artifactId>payment-parent</artifactId>
<version>0.2.0</version> <version>0.2.0-dev</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

@ -109,21 +109,24 @@ public class PermissionPartnerManagerImpl implements PermissionPartnerManager {
mod.put("funcs", funcList); mod.put("funcs", funcList);
modules.add(mod); modules.add(mod);
} }
report.put("modules", modules); report.put("modules", modules);
return report; return report;
} }
@Override @Override
@Transactional
public void permissionClientModuleSave(int clientId, String clientMoniker) { public void permissionClientModuleSave(int clientId, String clientMoniker) {
permissionClientModulesService.removeByClientMoniker(clientMoniker);
List<JSONObject> moduleId = permissionPartnerModuleMapper.list(); List<JSONObject> moduleId = permissionPartnerModuleMapper.list();
for (JSONObject moduleClientAdd : moduleId) { for (JSONObject moduleClientAdd : moduleId) {
moduleClientAdd.put("client_id", clientId); moduleClientAdd.put("client_id", clientId);
moduleClientAdd.put("client_moniker", clientMoniker); moduleClientAdd.put("client_moniker", clientMoniker);
moduleClientAdd.put("module_id", moduleClientAdd.getString("id")); moduleClientAdd.put("module_id", moduleClientAdd.getString("id"));
moduleClientAdd.put("is_valid", true); moduleClientAdd.put("is_valid", moduleClientAdd.getBoolean("initialize"));
permissionClientModulesService.save(moduleClientAdd); permissionClientModulesService.save(moduleClientAdd);
} }
systemPackageCacheSupport.clearClientPermission(clientMoniker);
systemPackageCacheSupport.clearClientPermission(clientId);
} }
@ -152,13 +155,10 @@ public class PermissionPartnerManagerImpl implements PermissionPartnerManager {
permissionClientModulesService.save(clientMod); permissionClientModulesService.save(clientMod);
} }
} }
module.initObject(mod); module.initObject(mod);
permissionPartnerModuleMapper.update(mod); permissionPartnerModuleMapper.update(mod);
sysPermissionClientModulesMapper.updateFunctionValid(mod.getString("id"),mod.getBooleanValue("initialize")); // sysPermissionClientModulesMapper.updateFunctionValid(mod.getString("id"), mod.getBooleanValue("initialize"));
systemPackageCacheSupport.clearClientPermissionAll(); // systemPackageCacheSupport.clearClientPermissionAll();
} }
@Override @Override
@ -214,7 +214,6 @@ public class PermissionPartnerManagerImpl implements PermissionPartnerManager {
@Transactional @Transactional
@CacheEvict(value = ":login:partners:", allEntries = true) @CacheEvict(value = ":login:partners:", allEntries = true)
public void authorizeRole(PartnerRole role, List<String> functions) { public void authorizeRole(PartnerRole role, List<String> functions) {
permissionPartnerFunctionMapper.clearRolePermission(role.getCode()); permissionPartnerFunctionMapper.clearRolePermission(role.getCode());
permissionPartnerFunctionMapper.authorizeRole(role.getCode(), functions); permissionPartnerFunctionMapper.authorizeRole(role.getCode(), functions);
} }

@ -1,6 +1,8 @@
package au.com.royalpay.payment.manage.management.sysconfig.web; package au.com.royalpay.payment.manage.management.sysconfig.web;
import au.com.royalpay.payment.manage.management.sysconfig.beans.PermissionClientVO; import au.com.royalpay.payment.manage.management.sysconfig.beans.PermissionClientVO;
import au.com.royalpay.payment.manage.management.sysconfig.core.PermissionPartnerManager;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.system.core.PermissionClientModulesService; import au.com.royalpay.payment.manage.system.core.PermissionClientModulesService;
import au.com.royalpay.payment.tools.CommonConsts; import au.com.royalpay.payment.tools.CommonConsts;
@ -26,6 +28,10 @@ import javax.annotation.Resource;
public class SysPermissionClientController { public class SysPermissionClientController {
@Resource @Resource
private PermissionClientModulesService permissionClientModulesService; private PermissionClientModulesService permissionClientModulesService;
@Resource
private PermissionPartnerManager permissionPartnerManager;
@Resource
private ClientManager clientManager;
@RequestMapping(value = "/list", method = RequestMethod.GET) @RequestMapping(value = "/list", method = RequestMethod.GET)
@ -38,4 +44,11 @@ public class SysPermissionClientController {
permissionClientModulesService.switchValid(id,permissionClientVO.getIsValid(),loginManager); permissionClientModulesService.switchValid(id,permissionClientVO.getIsValid(),loginManager);
} }
@RequestMapping(value = "/init", method = RequestMethod.POST)
public void init(@RequestBody JSONObject param) {
JSONObject client = clientManager.getClientInfoByMoniker(param.getString("client_moniker"));
permissionPartnerManager.permissionClientModuleSave(client.getIntValue("client_id"),client.getString("client_moniker"));
}
} }

@ -24,6 +24,8 @@ public interface SysPermissionClientModulesMapper {
void delete(@Param("module_name") String moduleName); void delete(@Param("module_name") String moduleName);
void deleteByClientMoniker(@Param("client_moniker") String client_moniker);
@AutoSql(type = SqlType.SELECT) @AutoSql(type = SqlType.SELECT)
List<JSONObject> listByClientId(@Param("client_id") int client_id); List<JSONObject> listByClientId(@Param("client_id") int client_id);

@ -111,6 +111,8 @@ public class ManagerUserInterceptor extends HandlerInterceptorAdapter implements
if(func!=null && StringUtils.isNotEmpty(func.getString("module_id"))){ if(func!=null && StringUtils.isNotEmpty(func.getString("module_id"))){
JSONArray arr = loginUser.getJSONArray("available_module_ids"); JSONArray arr = loginUser.getJSONArray("available_module_ids");
if (arr == null || !arr.contains(func.getString("module_id"))) { if (arr == null || !arr.contains(func.getString("module_id"))) {
logger.info(partner.toString());
logger.info(partnerStatusKey);
logger.info(funcId); logger.info(funcId);
throw new ForbiddenException("error.permission.nopermission"); throw new ForbiddenException("error.permission.nopermission");
} }

@ -19,4 +19,5 @@ public interface PermissionClientModulesService {
void switchValid(Long id,boolean isValid,JSONObject account); void switchValid(Long id,boolean isValid,JSONObject account);
void removeByClientMoniker(String clientMoniker);
} }

@ -72,6 +72,11 @@ public class PermissionClientModulesServiceImpl implements PermissionClientModul
} }
@Override
public void removeByClientMoniker(String clientMoniker) {
permissionClientModulesMapper.deleteByClientMoniker(clientMoniker);
}
private void saveMongoLog(JSONObject account, JSONObject oldRecord, JSONObject modifyData, String business) { private void saveMongoLog(JSONObject account, JSONObject oldRecord, JSONObject modifyData, String business) {
try { try {
modifyData.remove("id"); modifyData.remove("id");

@ -28,4 +28,9 @@
delete from sys_permission_partner_modules_clients delete from sys_permission_partner_modules_clients
where module_id = (SELECT id from sys_permission_partner_modules where module_name=#{module_name}) where module_id = (SELECT id from sys_permission_partner_modules where module_name=#{module_name})
</delete> </delete>
<delete id="deleteByClientMoniker">
delete from sys_permission_partner_modules_clients
where client_moniker= #{client_moniker}
</delete>
</mapper> </mapper>

@ -90,38 +90,46 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS
$scope.uploadLogo = function (file) { $scope.uploadLogo = function (file) {
if (file != null) { if (file != null) {
$scope.logoProgress = {value: 0}; if (file.size > 1 * 1024 * 1024) {
Upload.upload({ commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB请压缩后重试', type: 'error'});
url: '/attachment/files', } else {
data: {file: file} $scope.logoProgress = {value: 0};
}).then(function (resp) { Upload.upload({
delete $scope.logoProgress; url: '/attachment/files',
$scope.partner.logo_id = resp.data.fileid; data: {file: file}
$scope.partner.logo_url = resp.data.url; }).then(function (resp) {
}, function (resp) { delete $scope.logoProgress;
delete $scope.logoProgress; $scope.partner.logo_id = resp.data.fileid;
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) $scope.partner.logo_url = resp.data.url;
}, function (evt) { }, function (resp) {
$scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total); delete $scope.logoProgress;
}) commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
}, function (evt) {
$scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total);
})
}
} }
}; };
$scope.uploadShopPhoto = function (file) { $scope.uploadShopPhoto = function (file) {
if (file != null) { if (file != null) {
$scope.photoProgress = {value: 0}; if (file.size > 2 * 1024 * 1024) {
Upload.upload({ commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB请压缩后重试', type: 'error'});
url: '/attachment/files', } else {
data: {file: file} $scope.photoProgress = {value: 0};
}).then(function (resp) { Upload.upload({
delete $scope.photoProgress; url: '/attachment/files',
$scope.partner.company_photo = resp.data.url; data: {file: file}
}, function (resp) { }).then(function (resp) {
delete $scope.photoProgress; delete $scope.photoProgress;
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) $scope.partner.company_photo = resp.data.url;
}, function (evt) { }, function (resp) {
$scope.photoProgress.value = parseInt(100 * evt.loaded / evt.total); delete $scope.photoProgress;
}) commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
}, function (evt) {
$scope.photoProgress.value = parseInt(100 * evt.loaded / evt.total);
})
}
} }
}; };

@ -90,38 +90,46 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS
}; };
$scope.uploadLogo = function (file) { $scope.uploadLogo = function (file) {
if (file != null) { if (file != null) {
$scope.logoProgress = {value: 0}; if (file.size > 1 * 1024 * 1024) {
Upload.upload({ commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB请压缩后重试', type: 'error'});
url: '/attachment/files', } else {
data: {file: file} $scope.logoProgress = {value: 0};
}).then(function (resp) { Upload.upload({
delete $scope.logoProgress; url: '/attachment/files',
$scope.partner.logo_id = resp.data.fileid; data: {file: file}
$scope.partner.logo_url = resp.data.url; }).then(function (resp) {
}, function (resp) { delete $scope.logoProgress;
delete $scope.logoProgress; $scope.partner.logo_id = resp.data.fileid;
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) $scope.partner.logo_url = resp.data.url;
}, function (evt) { }, function (resp) {
$scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total); delete $scope.logoProgress;
}) commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
}, function (evt) {
$scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total);
})
}
} }
}; };
$scope.uploadShopPhoto = function (file) { $scope.uploadShopPhoto = function (file) {
if (file != null) { if (file != null) {
$scope.photoProgress = {value: 0}; if (file.size > 2 * 1024 * 1024) {
Upload.upload({ commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB请压缩后重试', type: 'error'});
url: '/attachment/files', } else {
data: {file: file} $scope.photoProgress = {value: 0};
}).then(function (resp) { Upload.upload({
delete $scope.photoProgress; url: '/attachment/files',
$scope.partner.company_photo = resp.data.url; data: {file: file}
}, function (resp) { }).then(function (resp) {
delete $scope.photoProgress; delete $scope.photoProgress;
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) $scope.partner.company_photo = resp.data.url;
}, function (evt) { }, function (resp) {
$scope.photoProgress.value = parseInt(100 * evt.loaded / evt.total); delete $scope.photoProgress;
}) commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
}, function (evt) {
$scope.photoProgress.value = parseInt(100 * evt.loaded / evt.total);
})
}
} }
}; };
@ -176,37 +184,45 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS
//audit files //audit files
$scope.uploadBankFile = function (file) { $scope.uploadBankFile = function (file) {
if (file != null) { if (file != null) {
$scope.bankFileProgress = {value: 0}; if (file.size > 1 * 1024 * 1024) {
Upload.upload({ commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB请压缩后重试', type: 'error'});
url: '/attachment/files', } else {
data: {file: file} $scope.bankFileProgress = {value: 0};
}).then(function (resp) { Upload.upload({
delete $scope.bankFileProgress; url: '/attachment/files',
$scope.partner.file.file_bank_info = resp.data.url; data: {file: file}
}, function (resp) { }).then(function (resp) {
delete $scope.bankFileProgress; delete $scope.bankFileProgress;
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) $scope.partner.file.file_bank_info = resp.data.url;
}, function (evt) { }, function (resp) {
$scope.bankFileProgress.value = parseInt(100 * evt.loaded / evt.total); delete $scope.bankFileProgress;
}) commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
}, function (evt) {
$scope.bankFileProgress.value = parseInt(100 * evt.loaded / evt.total);
})
}
} }
}; };
$scope.uploadCompanyFile = function (file) { $scope.uploadCompanyFile = function (file) {
if (file != null) { if (file != null) {
$scope.companyFileProgress = {value: 0}; if (file.size > 2 * 1024 * 1024) {
Upload.upload({ commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB请压缩后重试', type: 'error'});
url: '/attachment/files', } else {
data: {file: file} $scope.companyFileProgress = {value: 0};
}).then(function (resp) { Upload.upload({
delete $scope.companyFileProgress; url: '/attachment/files',
$scope.partner.file.file_company_info = resp.data.url; data: {file: file}
}, function (resp) { }).then(function (resp) {
delete $scope.companyFileProgress; delete $scope.companyFileProgress;
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) $scope.partner.file.file_company_info = resp.data.url;
}, function (evt) { }, function (resp) {
$scope.companyFileProgress.value = parseInt(100 * evt.loaded / evt.total); delete $scope.companyFileProgress;
}) commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
}, function (evt) {
$scope.companyFileProgress.value = parseInt(100 * evt.loaded / evt.total);
})
}
} }
}; };

@ -63,7 +63,7 @@
<div class="col-sm-8"> <div class="col-sm-8">
<div class="form-control-static"> <div class="form-control-static">
<button class="btn btn-success" type="button" ngf-select="uploadLogo($file)" <button class="btn btn-success" type="button" ngf-select="uploadLogo($file)"
accept="image/*" ngf-max-size="1MB"> accept="image/*">
<i class="fa fa-upload"></i> Upload Logo <i class="fa fa-upload"></i> Upload Logo
</button> </button>
</div> </div>
@ -110,7 +110,7 @@
<div class="col-sm-8"> <div class="col-sm-8">
<div class="form-control-static"> <div class="form-control-static">
<button class="btn btn-primary" type="button" <button class="btn btn-primary" type="button"
ngf-select="uploadShopPhoto($file)" accept="image/*" ngf-max-size="2MB"> ngf-select="uploadShopPhoto($file)" accept="image/*">
<i class="fa fa-upload"></i> Upload Shop Photo <i class="fa fa-upload"></i> Upload Shop Photo
</button> </button>
</div> </div>

@ -84,7 +84,7 @@
<div class="col-sm-8"> <div class="col-sm-8">
<div class="form-control-static"> <div class="form-control-static">
<button class="btn btn-success" type="button" ngf-select="uploadLogo($file)" <button class="btn btn-success" type="button" ngf-select="uploadLogo($file)"
accept="image/*" ngf-max-size="1MB"> accept="image/*">
<i class="fa fa-upload"></i> Upload Logo <i class="fa fa-upload"></i> Upload Logo
</button> </button>
</div> </div>
@ -186,7 +186,7 @@
<div class="col-sm-8"> <div class="col-sm-8">
<div class="form-control-static"> <div class="form-control-static">
<button class="btn btn-primary" type="button" <button class="btn btn-primary" type="button"
ngf-select="uploadShopPhoto($file)" accept="image/*" ngf-max-size="2MB"> ngf-select="uploadShopPhoto($file)" accept="image/*">
<i class="fa fa-upload"></i> Upload Shop Photo <i class="fa fa-upload"></i> Upload Shop Photo
</button> </button>
</div> </div>
@ -492,7 +492,7 @@
<div class="col-sm-4"> <div class="col-sm-4">
<div class="form-control-static"> <div class="form-control-static">
<button class="btn btn-primary" type="button" <button class="btn btn-primary" type="button"
ngf-select="uploadBankFile($file)" accept="image/*" ngf-max-size="2MB"> ngf-select="uploadBankFile($file)" accept="image/*">
<i class="fa fa-upload"></i> Upload <i class="fa fa-upload"></i> Upload
</button> </button>
</div> </div>
@ -512,7 +512,7 @@
<div class="col-sm-4"> <div class="col-sm-4">
<div class="form-control-static"> <div class="form-control-static">
<button class="btn btn-primary" type="button" <button class="btn btn-primary" type="button"
ngf-select="uploadCompanyFile($file)" accept="image/*" ngf-max-size="2MB"> ngf-select="uploadCompanyFile($file)" accept="image/*">
<i class="fa fa-upload"></i> Upload <i class="fa fa-upload"></i> Upload
</button> </button>
</div> </div>

@ -200,7 +200,7 @@ define(['angular'], function (angular) {
}; };
}]); }]);
app.controller('merchantConfigDialogCtrl', ['$scope', '$http', 'Upload', 'merchant', function ($scope, $http, Upload, merchant) { app.controller('merchantConfigDialogCtrl', ['$scope', '$http', 'Upload', 'merchant', 'commonDialog', function ($scope, $http, Upload, merchant, commonDialog) {
$scope.merchant = angular.copy(merchant); $scope.merchant = angular.copy(merchant);
$scope.save = function () { $scope.save = function () {
$scope.errmsg = null; $scope.errmsg = null;
@ -219,6 +219,10 @@ define(['angular'], function (angular) {
if(!file){ if(!file){
return; return;
} }
if (file.size > 1 * 1024 * 1024) {
commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB请压缩后重试', type: 'error'});
return;
}
$scope.photoProgress = {value: 0}; $scope.photoProgress = {value: 0};
Upload.upload({ Upload.upload({
url: '/attachment/files', url: '/attachment/files',

@ -10,7 +10,7 @@
<div class="form-group col-xs-12"> <div class="form-group col-xs-12">
<button class="btn btn-success" type="button" ngf-select="uploadShopImg($file)" <button class="btn btn-success" type="button" ngf-select="uploadShopImg($file)"
accept="image/*" ngf-max-size="1MB"> accept="image/*">
<i class="fa fa-upload"></i> Upload Shop Img <i class="fa fa-upload"></i> Upload Shop Img
</button> </button>
<uib-progressbar value="photoProgress.value" ng-if="photoProgress"></uib-progressbar> <uib-progressbar value="photoProgress.value" ng-if="photoProgress"></uib-progressbar>

@ -108,6 +108,10 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
if (file == null) { if (file == null) {
return; return;
} }
if (file.size > 1 * 1024 * 1024) {
commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB请压缩后重试', type: 'error'});
return;
}
$scope.logoProgress = {value: 0}; $scope.logoProgress = {value: 0};
Upload.upload({ Upload.upload({
url: '/attachment/files', url: '/attachment/files',
@ -215,6 +219,10 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
if (file == null) { if (file == null) {
return; return;
} }
if (file.size > 1 * 1024 * 1024) {
commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB请压缩后重试', type: 'error'});
return;
}
$scope.logoProgress = {value: 0}; $scope.logoProgress = {value: 0};
Upload.upload({ Upload.upload({
url: '/attachment/files', url: '/attachment/files',
@ -321,6 +329,10 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
if (file == null) { if (file == null) {
return; return;
} }
if (file.size > 1 * 1024 * 1024) {
commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB请压缩后重试', type: 'error'});
return;
}
$scope.logoProgress = {value: 0}; $scope.logoProgress = {value: 0};
Upload.upload({ Upload.upload({
url: '/attachment/files', url: '/attachment/files',

@ -24,7 +24,7 @@
<div class="col-sm-8"> <div class="col-sm-8">
<p class="form-control-static"> <p class="form-control-static">
<button class="btn btn-primary" type="button" ngf-select="uploadLogo($file)" <button class="btn btn-primary" type="button" ngf-select="uploadLogo($file)"
accept="image/*" ngf-max-size="1MB"> accept="image/*">
<i class="fa fa-upload"></i> Upload <i class="fa fa-upload"></i> Upload
</button> </button>
<uib-progressbar value="logoProgress.value" ng-if="logoProgress"></uib-progressbar> <uib-progressbar value="logoProgress.value" ng-if="logoProgress"></uib-progressbar>

@ -36,7 +36,7 @@
<div class="col-sm-8"> <div class="col-sm-8">
<p class="form-control-static"> <p class="form-control-static">
<button class="btn btn-primary" type="button" ngf-select="uploadLogo($file)" <button class="btn btn-primary" type="button" ngf-select="uploadLogo($file)"
accept="image/*" ngf-max-size="1MB"> accept="image/*">
<i class="fa fa-upload"></i> Upload <i class="fa fa-upload"></i> Upload
</button> </button>
<uib-progressbar value="logoProgress.value" ng-if="logoProgress"></uib-progressbar> <uib-progressbar value="logoProgress.value" ng-if="logoProgress"></uib-progressbar>

@ -173,7 +173,7 @@
<div class="col-sm-8"> <div class="col-sm-8">
<p class="form-control-static"> <p class="form-control-static">
<button class="btn btn-primary" type="button" ngf-select="uploadLogo($file)" <button class="btn btn-primary" type="button" ngf-select="uploadLogo($file)"
accept="image/*" ngf-max-size="1MB"> accept="image/*">
<i class="fa fa-upload"></i> Upload <i class="fa fa-upload"></i> Upload
</button> </button>
<uib-progressbar value="logoProgress.value" ng-if="logoProgress"></uib-progressbar> <uib-progressbar value="logoProgress.value" ng-if="logoProgress"></uib-progressbar>

@ -51,19 +51,23 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS
$scope.cashier = {}; $scope.cashier = {};
$scope.uploadPhoto = function (file) { $scope.uploadPhoto = function (file) {
if (file != null) { if (file != null) {
$scope.photoProgress = {value: 0}; if (file.size > 2 * 1024 * 1024) {
Upload.upload({ commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB请压缩后重试', type: 'error'})
url: '/attachment/files', } else {
data: {file: file} $scope.photoProgress = {value: 0};
}).then(function (resp) { Upload.upload({
delete $scope.photoProgress; url: '/attachment/files',
$scope.cashier.photo = resp.data.url; data: {file: file}
}, function (resp) { }).then(function (resp) {
delete $scope.photoProgress; delete $scope.photoProgress;
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) $scope.cashier.photo = resp.data.url;
}, function (evt) { }, function (resp) {
$scope.photoProgress.value = parseInt(100 * evt.loaded / evt.total); delete $scope.photoProgress;
}) commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
}, function (evt) {
$scope.photoProgress.value = parseInt(100 * evt.loaded / evt.total);
})
}
} }
}; };
$scope.save = function (form) { $scope.save = function (form) {
@ -178,19 +182,23 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS
$scope.cashier = angular.copy(cashier.data); $scope.cashier = angular.copy(cashier.data);
$scope.uploadPhoto = function (file) { $scope.uploadPhoto = function (file) {
if (file != null) { if (file != null) {
$scope.photoProgress = {value: 0}; if (file.size > 2 * 1024 * 1024) {
Upload.upload({ commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB请压缩后重试', type: 'error'})
url: '/attachment/files', } else {
data: {file: file} $scope.photoProgress = {value: 0};
}).then(function (resp) { Upload.upload({
delete $scope.photoProgress; url: '/attachment/files',
$scope.cashier.photo = resp.data.url; data: {file: file}
}, function (resp) { }).then(function (resp) {
delete $scope.photoProgress; delete $scope.photoProgress;
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) $scope.cashier.photo = resp.data.url;
}, function (evt) { }, function (resp) {
$scope.photoProgress.value = parseInt(100 * evt.loaded / evt.total); delete $scope.photoProgress;
}) commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
}, function (evt) {
$scope.photoProgress.value = parseInt(100 * evt.loaded / evt.total);
})
}
} }
}; };
$scope.updateCashier = function (form) { $scope.updateCashier = function (form) {

@ -71,7 +71,7 @@
<div class="col-sm-8"> <div class="col-sm-8">
<div class="form-control-static"> <div class="form-control-static">
<button class="btn btn-primary" type="button" <button class="btn btn-primary" type="button"
ngf-select="uploadPhoto($file)" accept="image/*" ngf-max-size="2MB"> ngf-select="uploadPhoto($file)" accept="image/*">
<i class="fa fa-upload"></i> Upload Courier Photo <i class="fa fa-upload"></i> Upload Courier Photo
</button> </button>
</div> </div>

@ -59,7 +59,7 @@
<div class="col-sm-8"> <div class="col-sm-8">
<div class="form-control-static"> <div class="form-control-static">
<button class="btn btn-primary" type="button" <button class="btn btn-primary" type="button"
ngf-select="uploadPhoto($file)" accept="image/*" ngf-max-size="2MB"> ngf-select="uploadPhoto($file)" accept="image/*">
<i class="fa fa-upload"></i> Upload Cashier Photo <i class="fa fa-upload"></i> Upload Cashier Photo
</button> </button>
</div> </div>

@ -93,22 +93,26 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS
$scope.good.images = []; $scope.good.images = [];
$scope.uploadImage = function (file) { $scope.uploadImage = function (file) {
if (file != null) { if (file != null) {
$scope.imageProgress = {value: 0}; if (file.size > 1 * 1024 * 1024) {
Upload.upload({ commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB请压缩后重试', type: 'error'})
url: '/attachment/files', } else {
data: {file: file} $scope.imageProgress = {value: 0};
}).then(function (resp) { Upload.upload({
delete $scope.imageProgress; url: '/attachment/files',
var image = {}; data: {file: file}
image.fileId = resp.data.fileid; }).then(function (resp) {
image.url = resp.data.url; delete $scope.imageProgress;
$scope.good.images.push(image); var image = {};
}, function (resp) { image.fileId = resp.data.fileid;
delete $scope.imageProgress; image.url = resp.data.url;
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) $scope.good.images.push(image);
}, function (evt) { }, function (resp) {
$scope.imageProgress.value = parseInt(100 * evt.loaded / evt.total); delete $scope.imageProgress;
}) commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
}, function (evt) {
$scope.imageProgress.value = parseInt(100 * evt.loaded / evt.total);
})
}
} }
}; };
}]); }]);
@ -172,22 +176,26 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS
}; };
$scope.uploadImage = function (file) { $scope.uploadImage = function (file) {
if (file != null) { if (file != null) {
$scope.imageProgress = {value: 0}; if (file.size > 1 * 1024 * 1024) {
Upload.upload({ commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB请压缩后重试', type: 'error'})
url: '/attachment/files', } else {
data: {file: file} $scope.imageProgress = {value: 0};
}).then(function (resp) { Upload.upload({
delete $scope.imageProgress; url: '/attachment/files',
var image = {}; data: {file: file}
image.fileId = resp.data.fileid; }).then(function (resp) {
image.url = resp.data.url; delete $scope.imageProgress;
$scope.good.images.push(image); var image = {};
}, function (resp) { image.fileId = resp.data.fileid;
delete $scope.imageProgress; image.url = resp.data.url;
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) $scope.good.images.push(image);
}, function (evt) { }, function (resp) {
$scope.imageProgress.value = parseInt(100 * evt.loaded / evt.total); delete $scope.imageProgress;
}) commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
}, function (evt) {
$scope.imageProgress.value = parseInt(100 * evt.loaded / evt.total);
})
}
} }
}; };
}]); }]);

@ -136,7 +136,7 @@
<div class="col-sm-8"> <div class="col-sm-8">
<div class="form-control-static"> <div class="form-control-static">
<button class="btn btn-success" type="button" ngf-select="uploadImage($file)" <button class="btn btn-success" type="button" ngf-select="uploadImage($file)"
accept="image/*" ngf-max-size="1MB"> accept="image/*">
<i class="fa fa-upload"></i> Upload Image <i class="fa fa-upload"></i> Upload Image
</button> </button>
</div> </div>

@ -147,7 +147,7 @@
<div class="col-sm-8"> <div class="col-sm-8">
<div class="form-control-static"> <div class="form-control-static">
<button class="btn btn-success" type="button" ngf-select="uploadImage($file)" <button class="btn btn-success" type="button" ngf-select="uploadImage($file)"
accept="image/*" ngf-max-size="1MB"> accept="image/*">
<i class="fa fa-upload"></i> Upload Image <i class="fa fa-upload"></i> Upload Image
</button> </button>
</div> </div>

@ -439,56 +439,68 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
}; };
$scope.uploadLogo = function (file) { $scope.uploadLogo = function (file) {
if (file != null) { if (file != null) {
$scope.logoProgress = {value: 0}; if (file.size > 1 * 1024 * 1024) {
Upload.upload({ commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB请压缩后重试', type: 'error'})
url: '/attachment/files', } else {
data: {file: file} $scope.logoProgress = {value: 0};
}).then(function (resp) { Upload.upload({
delete $scope.logoProgress; url: '/attachment/files',
$scope.partner.logo_id = resp.data.fileid; data: {file: file}
$scope.partner.logo_url = resp.data.url; }).then(function (resp) {
}, function (resp) { delete $scope.logoProgress;
delete $scope.logoProgress; $scope.partner.logo_id = resp.data.fileid;
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) $scope.partner.logo_url = resp.data.url;
}, function (evt) { }, function (resp) {
$scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total); delete $scope.logoProgress;
}) commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
}, function (evt) {
$scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total);
})
}
} }
}; };
$scope.uploadShopPhoto = function (file) { $scope.uploadShopPhoto = function (file) {
if (file != null) { if (file != null) {
$scope.shopPhotoProgress = {value: 0}; if (file.size > 2 * 1024 * 1024) {
Upload.upload({ commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB请压缩后重试', type: 'error'})
url: '/attachment/files', } else {
data: {file: file} $scope.shopPhotoProgress = {value: 0};
}).then(function (resp) { Upload.upload({
delete $scope.shopPhotoProgress; url: '/attachment/files',
$scope.partner.company_photo = resp.data.url; data: {file: file}
}, function (resp) { }).then(function (resp) {
delete $scope.shopPhotoProgress; delete $scope.shopPhotoProgress;
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) $scope.partner.company_photo = resp.data.url;
}, function (evt) { }, function (resp) {
$scope.shopPhotoProgress.value = parseInt(100 * evt.loaded / evt.total); delete $scope.shopPhotoProgress;
}) commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
}, function (evt) {
$scope.shopPhotoProgress.value = parseInt(100 * evt.loaded / evt.total);
})
}
} }
}; };
$scope.uploadStorePhoto = function (file) { $scope.uploadStorePhoto = function (file) {
if (file != null) { if (file != null) {
$scope.storePhotoProgress = {value: 0}; if (file.size > 2 * 1024 * 1024) {
Upload.upload({ commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB请压缩后重试', type: 'error'})
url: '/attachment/files', } else {
data: {file: file} $scope.storePhotoProgress = {value: 0};
}).then(function (resp) { Upload.upload({
delete $scope.storePhotoProgress; url: '/attachment/files',
$scope.partner.store_photo = resp.data.url; data: {file: file}
}, function (resp) { }).then(function (resp) {
delete $scope.storePhotoProgress; delete $scope.storePhotoProgress;
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) $scope.partner.store_photo = resp.data.url;
}, function (evt) { }, function (resp) {
$scope.storePhotoProgress.value = parseInt(100 * evt.loaded / evt.total); delete $scope.storePhotoProgress;
}) commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
}, function (evt) {
$scope.storePhotoProgress.value = parseInt(100 * evt.loaded / evt.total);
})
}
} }
}; };
@ -677,24 +689,28 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
}; };
$scope.uploadAgreeFile = function (file) { $scope.uploadAgreeFile = function (file) {
if (file != null) { if (file != null) {
Upload.upload({ if (file.size > 2 * 1024 * 1024) {
url: '/attachment/files', commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB请压缩后重试', type: 'error'})
data: {file: file} } else {
}).then(function (resp) { Upload.upload({
$scope.agree_file_import = resp.data.url; url: '/attachment/files',
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/import/agreepdf', {source_agree_file: $scope.agree_file_import}).then(function () { data: {file: file}
commonDialog.alert({ }).then(function (resp) {
title: 'Success', $scope.agree_file_import = resp.data.url;
content: 'Succeed Imported! Please notify BD', $http.put('/sys/partners/' + $scope.partner.client_moniker + '/import/agreepdf', {source_agree_file: $scope.agree_file_import}).then(function () {
type: 'success' commonDialog.alert({
}); title: 'Success',
$state.reload(); content: 'Succeed Imported! Please notify BD',
type: 'success'
});
$state.reload();
}, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
})
}, function (resp) { }, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
}) })
}, function (resp) { }
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
})
} }
}; };
$scope.notifyBD = function () { $scope.notifyBD = function () {
@ -1093,56 +1109,68 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
}; };
$scope.uploadLogo = function (file) { $scope.uploadLogo = function (file) {
if (file != null) { if (file != null) {
$scope.logoProgress = {value: 0}; if (file.size > 1 * 1024 * 1024) {
Upload.upload({ commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB请压缩后重试', type: 'error'})
url: '/attachment/files', } else {
data: {file: file} $scope.logoProgress = {value: 0};
}).then(function (resp) { Upload.upload({
delete $scope.logoProgress; url: '/attachment/files',
$scope.partner.logo_id = resp.data.fileid; data: {file: file}
$scope.partner.logo_url = resp.data.url; }).then(function (resp) {
}, function (resp) { delete $scope.logoProgress;
delete $scope.logoProgress; $scope.partner.logo_id = resp.data.fileid;
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) $scope.partner.logo_url = resp.data.url;
}, function (evt) { }, function (resp) {
$scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total); delete $scope.logoProgress;
}) commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
}, function (evt) {
$scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total);
})
}
} }
}; };
$scope.uploadShopPhoto = function (file) { $scope.uploadShopPhoto = function (file) {
if (file != null) { if (file != null) {
$scope.shopPhotoProgress = {value: 0}; if (file.size > 2 * 1024 * 1024) {
Upload.upload({ commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB请压缩后重试', type: 'error'})
url: '/attachment/files', } else {
data: {file: file} $scope.shopPhotoProgress = {value: 0};
}).then(function (resp) { Upload.upload({
delete $scope.shopPhotoProgress; url: '/attachment/files',
$scope.partner.company_photo = resp.data.url; data: {file: file}
}, function (resp) { }).then(function (resp) {
delete $scope.shopPhotoProgress; delete $scope.shopPhotoProgress;
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) $scope.partner.company_photo = resp.data.url;
}, function (evt) { }, function (resp) {
$scope.shopPhotoProgress.value = parseInt(100 * evt.loaded / evt.total); delete $scope.shopPhotoProgress;
}) commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
}, function (evt) {
$scope.shopPhotoProgress.value = parseInt(100 * evt.loaded / evt.total);
})
}
} }
}; };
$scope.uploadStorePhoto = function (file) { $scope.uploadStorePhoto = function (file) {
if (file != null) { if (file != null) {
$scope.storePhotoProgress = {value: 0}; if (file.size > 2 * 1024 * 1024) {
Upload.upload({ commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB请压缩后重试', type: 'error'})
url: '/attachment/files', } else {
data: {file: file} $scope.storePhotoProgress = {value: 0};
}).then(function (resp) { Upload.upload({
delete $scope.storePhotoProgress; url: '/attachment/files',
$scope.partner.store_photo = resp.data.url; data: {file: file}
}, function (resp) { }).then(function (resp) {
delete $scope.storePhotoProgress; delete $scope.storePhotoProgress;
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) $scope.partner.store_photo = resp.data.url;
}, function (evt) { }, function (resp) {
$scope.storePhotoProgress.value = parseInt(100 * evt.loaded / evt.total); delete $scope.storePhotoProgress;
}) commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
}, function (evt) {
$scope.storePhotoProgress.value = parseInt(100 * evt.loaded / evt.total);
})
}
} }
}; };
@ -2108,56 +2136,68 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
} }
$scope.uploadLogo = function (file) { $scope.uploadLogo = function (file) {
if (file != null) { if (file != null) {
$scope.logoProgress = {value: 0}; if (file.size > 1 * 1024 * 1024) {
Upload.upload({ commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB请压缩后重试', type: 'error'})
url: '/attachment/files', } else {
data: {file: file} $scope.logoProgress = {value: 0};
}).then(function (resp) { Upload.upload({
delete $scope.logoProgress; url: '/attachment/files',
$scope.partner.logo_id = resp.data.fileid; data: {file: file}
$scope.partner.logo_url = resp.data.url; }).then(function (resp) {
}, function (resp) { delete $scope.logoProgress;
delete $scope.logoProgress; $scope.partner.logo_id = resp.data.fileid;
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) $scope.partner.logo_url = resp.data.url;
}, function (evt) { }, function (resp) {
$scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total); delete $scope.logoProgress;
}) commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
}, function (evt) {
$scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total);
})
}
} }
}; };
$scope.uploadShopPhoto = function (file) { $scope.uploadShopPhoto = function (file) {
if (file != null) { if (file != null) {
$scope.shopPhotoProgress = {value: 0}; if (file.size > 2 * 1024 * 1024) {
Upload.upload({ commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB请压缩后重试', type: 'error'})
url: '/attachment/files', } else {
data: {file: file} $scope.shopPhotoProgress = {value: 0};
}).then(function (resp) { Upload.upload({
delete $scope.shopPhotoProgress; url: '/attachment/files',
$scope.partner.company_photo = resp.data.url; data: {file: file}
}, function (resp) { }).then(function (resp) {
delete $scope.shopPhotoProgress; delete $scope.shopPhotoProgress;
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) $scope.partner.company_photo = resp.data.url;
}, function (evt) { }, function (resp) {
$scope.shopPhotoProgress.value = parseInt(100 * evt.loaded / evt.total); delete $scope.shopPhotoProgress;
}) commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
}, function (evt) {
$scope.shopPhotoProgress.value = parseInt(100 * evt.loaded / evt.total);
})
}
} }
}; };
$scope.uploadStorePhoto = function (file) { $scope.uploadStorePhoto = function (file) {
if (file != null) { if (file != null) {
$scope.storePhotoProgress = {value: 0}; if (file.size > 2 * 1024 * 1024) {
Upload.upload({ commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB请压缩后重试', type: 'error'})
url: '/attachment/files', } else {
data: {file: file} $scope.storePhotoProgress = {value: 0};
}).then(function (resp) { Upload.upload({
delete $scope.storePhotoProgress; url: '/attachment/files',
$scope.partner.store_photo = resp.data.url; data: {file: file}
}, function (resp) { }).then(function (resp) {
delete $scope.storePhotoProgress; delete $scope.storePhotoProgress;
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) $scope.partner.store_photo = resp.data.url;
}, function (evt) { }, function (resp) {
$scope.storePhotoProgress.value = parseInt(100 * evt.loaded / evt.total); delete $scope.storePhotoProgress;
}) commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
}, function (evt) {
$scope.storePhotoProgress.value = parseInt(100 * evt.loaded / evt.total);
})
}
} }
}; };
$scope.updateMerchantLocation = function () { $scope.updateMerchantLocation = function () {
@ -3107,6 +3147,14 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
}) })
}; };
$scope.init = function () {
var params = {client_moniker:$scope.partner.client_moniker};
$http.post('/sys/permission/init',params).then(function (resp) {
},function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
})
};
}]); }]);

@ -72,56 +72,68 @@ define(['angular', 'decimal', 'uiRouter', 'ngBootSwitch', 'ngFileUpload'], funct
$scope.uploadLogo = function (file) { $scope.uploadLogo = function (file) {
if (file != null) { if (file != null) {
$scope.logoProgress = {value: 0}; if (file.size > 1 * 1024 * 1024) {
Upload.upload({ commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB请压缩后重试', type: 'error'})
url: '/attachment/files', } else {
data: {file: file} $scope.logoProgress = {value: 0};
}).then(function (resp) { Upload.upload({
delete $scope.logoProgress; url: '/attachment/files',
$scope.partner.logo_id = resp.data.fileid; data: {file: file}
$scope.partner.logo_url = resp.data.url; }).then(function (resp) {
}, function (resp) { delete $scope.logoProgress;
delete $scope.logoProgress; $scope.partner.logo_id = resp.data.fileid;
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) $scope.partner.logo_url = resp.data.url;
}, function (evt) { }, function (resp) {
$scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total); delete $scope.logoProgress;
}) commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
}, function (evt) {
$scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total);
})
}
} }
}; };
$scope.uploadShopPhoto = function (file) { $scope.uploadShopPhoto = function (file) {
if (file != null) { if (file != null) {
$scope.shopPhotoProgress = {value: 0}; if (file.size > 2 * 1024 * 1024) {
Upload.upload({ commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB请压缩后重试', type: 'error'})
url: '/attachment/files', } else {
data: {file: file} $scope.shopPhotoProgress = {value: 0};
}).then(function (resp) { Upload.upload({
delete $scope.shopPhotoProgress; url: '/attachment/files',
$scope.partner.company_photo = resp.data.url; data: {file: file}
}, function (resp) { }).then(function (resp) {
delete $scope.shopPhotoProgress; delete $scope.shopPhotoProgress;
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) $scope.partner.company_photo = resp.data.url;
}, function (evt) { }, function (resp) {
$scope.shopPhotoProgress.value = parseInt(100 * evt.loaded / evt.total); delete $scope.shopPhotoProgress;
}) commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
}, function (evt) {
$scope.shopPhotoProgress.value = parseInt(100 * evt.loaded / evt.total);
})
}
} }
}; };
$scope.uploadStorePhoto = function (file) { $scope.uploadStorePhoto = function (file) {
if (file != null) { if (file != null) {
$scope.storePhotoProgress = {value: 0}; if (file.size > 2 * 1024 * 1024) {
Upload.upload({ commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB请压缩后重试', type: 'error'})
url: '/attachment/files', } else {
data: {file: file} $scope.storePhotoProgress = {value: 0};
}).then(function (resp) { Upload.upload({
delete $scope.storePhotoProgress; url: '/attachment/files',
$scope.partner.store_photo = resp.data.url; data: {file: file}
}, function (resp) { }).then(function (resp) {
delete $scope.storePhotoProgress; delete $scope.storePhotoProgress;
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) $scope.partner.store_photo = resp.data.url;
}, function (evt) { }, function (resp) {
$scope.storePhotoProgress.value = parseInt(100 * evt.loaded / evt.total); delete $scope.storePhotoProgress;
}) commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
}, function (evt) {
$scope.storePhotoProgress.value = parseInt(100 * evt.loaded / evt.total);
})
}
} }
}; };
@ -223,56 +235,68 @@ define(['angular', 'decimal', 'uiRouter', 'ngBootSwitch', 'ngFileUpload'], funct
$scope.uploadLogo = function (file) { $scope.uploadLogo = function (file) {
if (file != null) { if (file != null) {
$scope.logoProgress = {value: 0}; if (file.size > 1 * 1024 * 1024) {
Upload.upload({ commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB请压缩后重试', type: 'error'})
url: '/attachment/files', } else {
data: {file: file} $scope.logoProgress = {value: 0};
}).then(function (resp) { Upload.upload({
delete $scope.logoProgress; url: '/attachment/files',
$scope.partner.logo_id = resp.data.fileid; data: {file: file}
$scope.partner.logo_url = resp.data.url; }).then(function (resp) {
}, function (resp) { delete $scope.logoProgress;
delete $scope.logoProgress; $scope.partner.logo_id = resp.data.fileid;
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) $scope.partner.logo_url = resp.data.url;
}, function (evt) { }, function (resp) {
$scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total); delete $scope.logoProgress;
}) commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
}, function (evt) {
$scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total);
})
}
} }
}; };
$scope.uploadShopPhoto = function (file) { $scope.uploadShopPhoto = function (file) {
if (file != null) { if (file != null) {
$scope.shopPhotoProgress = {value: 0}; if (file.size > 2 * 1024 * 1024) {
Upload.upload({ commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB请压缩后重试', type: 'error'})
url: '/attachment/files', } else {
data: {file: file} $scope.shopPhotoProgress = {value: 0};
}).then(function (resp) { Upload.upload({
delete $scope.shopPhotoProgress; url: '/attachment/files',
$scope.partner.company_photo = resp.data.url; data: {file: file}
}, function (resp) { }).then(function (resp) {
delete $scope.shopPhotoProgress; delete $scope.shopPhotoProgress;
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) $scope.partner.company_photo = resp.data.url;
}, function (evt) { }, function (resp) {
$scope.shopPhotoProgress.value = parseInt(100 * evt.loaded / evt.total); delete $scope.shopPhotoProgress;
}) commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
}, function (evt) {
$scope.shopPhotoProgress.value = parseInt(100 * evt.loaded / evt.total);
})
}
} }
}; };
$scope.uploadStorePhoto = function (file) { $scope.uploadStorePhoto = function (file) {
if (file != null) { if (file != null) {
$scope.storePhotoProgress = {value: 0}; if (file.size > 2 * 1024 * 1024) {
Upload.upload({ commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB请压缩后重试', type: 'error'})
url: '/attachment/files', } else {
data: {file: file} $scope.storePhotoProgress = {value: 0};
}).then(function (resp) { Upload.upload({
delete $scope.storePhotoProgress; url: '/attachment/files',
$scope.partner.store_photo = resp.data.url; data: {file: file}
}, function (resp) { }).then(function (resp) {
delete $scope.storePhotoProgress; delete $scope.storePhotoProgress;
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) $scope.partner.store_photo = resp.data.url;
}, function (evt) { }, function (resp) {
$scope.storePhotoProgress.value = parseInt(100 * evt.loaded / evt.total); delete $scope.storePhotoProgress;
}) commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
}, function (evt) {
$scope.storePhotoProgress.value = parseInt(100 * evt.loaded / evt.total);
})
}
} }
}; };

@ -127,7 +127,7 @@
<div class="form-control-static"> <div class="form-control-static">
<button class="btn btn-success" type="button" <button class="btn btn-success" type="button"
ngf-select="uploadLogo($file)" ngf-select="uploadLogo($file)"
accept="image/*" ngf-max-size="1MB"> accept="image/*">
<i class="fa fa-upload"></i> Upload Logo <i class="fa fa-upload"></i> Upload Logo
</button> </button>
</div> </div>
@ -230,8 +230,7 @@
<div class="col-sm-4"> <div class="col-sm-4">
<div class="form-control-static"><em>1:</em>&nbsp; <div class="form-control-static"><em>1:</em>&nbsp;
<button class="btn btn-primary" type="button" <button class="btn btn-primary" type="button"
ngf-select="uploadShopPhoto($file)" accept="image/*" ngf-select="uploadShopPhoto($file)" accept="image/*">
ngf-max-size="2MB">
<i class="fa fa-upload"></i> Upload Shop Photo1 <i class="fa fa-upload"></i> Upload Shop Photo1
</button> </button>
</div> </div>
@ -242,8 +241,7 @@
<div class="col-sm-4"> <div class="col-sm-4">
<div class="form-control-static"><em>2:</em>&nbsp; <div class="form-control-static"><em>2:</em>&nbsp;
<button class="btn btn-primary" type="button" <button class="btn btn-primary" type="button"
ngf-select="uploadStorePhoto($file)" accept="image/*" ngf-select="uploadStorePhoto($file)" accept="image/*">
ngf-max-size="2MB">
<i class="fa fa-upload"></i> Upload Shop Photo2 <i class="fa fa-upload"></i> Upload Shop Photo2
</button> </button>
</div> </div>

@ -98,7 +98,7 @@
<div class="col-sm-8"> <div class="col-sm-8">
<div class="form-control-static"> <div class="form-control-static">
<button class="btn btn-success" type="button" ngf-select="uploadLogo($file)" <button class="btn btn-success" type="button" ngf-select="uploadLogo($file)"
accept="image/*" ngf-max-size="1MB"> accept="image/*">
<i class="fa fa-upload"></i> Upload Logo <i class="fa fa-upload"></i> Upload Logo
</button> </button>
</div> </div>
@ -188,8 +188,7 @@
<div class="col-sm-4"> <div class="col-sm-4">
<div class="form-control-static"><em>1:</em>&nbsp; <div class="form-control-static"><em>1:</em>&nbsp;
<button class="btn btn-primary" type="button" <button class="btn btn-primary" type="button"
ngf-select="uploadShopPhoto($file)" accept="image/*" ngf-select="uploadShopPhoto($file)" accept="image/*">
ngf-max-size="2MB">
<i class="fa fa-upload"></i> Upload Shop Photo1 <i class="fa fa-upload"></i> Upload Shop Photo1
</button> </button>
</div> </div>
@ -200,8 +199,7 @@
<div class="col-sm-4"> <div class="col-sm-4">
<div class="form-control-static"><em>2:</em>&nbsp; <div class="form-control-static"><em>2:</em>&nbsp;
<button class="btn btn-primary" type="button" <button class="btn btn-primary" type="button"
ngf-select="uploadStorePhoto($file)" accept="image/*" ngf-select="uploadStorePhoto($file)" accept="image/*">
ngf-max-size="2MB">
<i class="fa fa-upload"></i> Upload Shop Photo2 <i class="fa fa-upload"></i> Upload Shop Photo2
</button> </button>
</div> </div>

@ -363,7 +363,7 @@
<div class="form-control-static"> <div class="form-control-static">
<button class="btn btn-success" type="button" <button class="btn btn-success" type="button"
ngf-select="uploadLogo($file)" ngf-select="uploadLogo($file)"
accept="image/*" ngf-max-size="1MB"> accept="image/*">
<i class="fa fa-upload"></i> Upload Logo <i class="fa fa-upload"></i> Upload Logo
</button> </button>
</div> </div>
@ -430,8 +430,7 @@
<div class="col-sm-5"> <div class="col-sm-5">
<div class="form-control-static"><em>1:</em>&nbsp; <div class="form-control-static"><em>1:</em>&nbsp;
<button class="btn btn-primary" type="button" <button class="btn btn-primary" type="button"
ngf-select="uploadShopPhoto($file)" accept="image/*" ngf-select="uploadShopPhoto($file)" accept="image/*">
ngf-max-size="2MB">
<i class="fa fa-upload"></i> Upload Shop Photo1 <i class="fa fa-upload"></i> Upload Shop Photo1
</button> </button>
</div> </div>
@ -443,8 +442,7 @@
<div class="col-sm-5"> <div class="col-sm-5">
<div class="form-control-static"><em>2:</em>&nbsp; <div class="form-control-static"><em>2:</em>&nbsp;
<button class="btn btn-primary" type="button" <button class="btn btn-primary" type="button"
ngf-select="uploadStorePhoto($file)" accept="image/*" ngf-select="uploadStorePhoto($file)" accept="image/*">
ngf-max-size="2MB">
<i class="fa fa-upload"></i> Upload Shop Photo2 <i class="fa fa-upload"></i> Upload Shop Photo2
</button> </button>
</div> </div>

@ -58,7 +58,7 @@
<div class="col-sm-8"> <div class="col-sm-8">
<div class="form-control-static"> <div class="form-control-static">
<button class="btn btn-success" type="button" ngf-select="uploadLogo($file)" <button class="btn btn-success" type="button" ngf-select="uploadLogo($file)"
accept="image/*" ngf-max-size="1MB"> accept="image/*">
<i class="fa fa-upload"></i> Upload Logo <i class="fa fa-upload"></i> Upload Logo
</button> </button>
</div> </div>
@ -105,7 +105,7 @@
<div class="col-sm-5"> <div class="col-sm-5">
<div class="form-control-static"><em>1:</em>&nbsp; <div class="form-control-static"><em>1:</em>&nbsp;
<button class="btn btn-primary" type="button" <button class="btn btn-primary" type="button"
ngf-select="uploadShopPhoto($file)" accept="image/*" ngf-max-size="2MB"> ngf-select="uploadShopPhoto($file)" accept="image/*">
<i class="fa fa-upload"></i> Upload Shop Photo1 <i class="fa fa-upload"></i> Upload Shop Photo1
</button> </button>
</div> </div>
@ -116,8 +116,7 @@
<div class="col-sm-5"> <div class="col-sm-5">
<div class="form-control-static"><em>2:</em>&nbsp; <div class="form-control-static"><em>2:</em>&nbsp;
<button class="btn btn-primary" type="button" <button class="btn btn-primary" type="button"
ngf-select="uploadStorePhoto($file)" accept="image/*" ngf-select="uploadStorePhoto($file)" accept="image/*">
ngf-max-size="2MB">
<i class="fa fa-upload"></i> Upload Shop Photo2 <i class="fa fa-upload"></i> Upload Shop Photo2
</button> </button>
</div> </div>

@ -85,7 +85,7 @@
<a role="button" type="button" class="btn btn-success" ng-click="exportAgreegatePDF()"> <a role="button" type="button" class="btn btn-success" ng-click="exportAgreegatePDF()">
制作全支付合同</a> 制作全支付合同</a>
<a role="button" type="button" class="btn btn-warning" ngf-select="uploadAgreeFile($file)" <a role="button" type="button" class="btn btn-warning" ngf-select="uploadAgreeFile($file)"
accept="pdf/*" ngf-max-size="2MB"> accept="pdf/*">
上传合同</a> (通用合同请选择制作合同,非通用合同模板请人工制作合同后上传) 上传合同</a> (通用合同请选择制作合同,非通用合同模板请人工制作合同后上传)
</div> </div>
<div class="btn-group pull-right" role="group" aria-label="..."> <div class="btn-group pull-right" role="group" aria-label="...">

@ -166,7 +166,7 @@
<div class="col-sm-8"> <div class="col-sm-8">
<div class="form-control-static"> <div class="form-control-static">
<button class="btn btn-success" type="button" ngf-select="uploadLogo($file)" <button class="btn btn-success" type="button" ngf-select="uploadLogo($file)"
accept="image/*" ngf-max-size="1MB"> accept="image/*">
<i class="fa fa-upload"></i> Upload Logo <i class="fa fa-upload"></i> Upload Logo
</button> </button>
</div> </div>
@ -255,7 +255,7 @@
<div class="col-sm-5"> <div class="col-sm-5">
<div class="form-control-static"><em>1:</em>&nbsp; <div class="form-control-static"><em>1:</em>&nbsp;
<button class="btn btn-primary" type="button" <button class="btn btn-primary" type="button"
ngf-select="uploadShopPhoto($file)" accept="image/*" ngf-max-size="2MB"> ngf-select="uploadShopPhoto($file)" accept="image/*">
<i class="fa fa-upload"></i> Upload Shop Photo1 <i class="fa fa-upload"></i> Upload Shop Photo1
</button> </button>
</div> </div>
@ -266,8 +266,7 @@
<div class="col-sm-5"> <div class="col-sm-5">
<div class="form-control-static"><em>2:</em>&nbsp; <div class="form-control-static"><em>2:</em>&nbsp;
<button class="btn btn-primary" type="button" <button class="btn btn-primary" type="button"
ngf-select="uploadStorePhoto($file)" accept="image/*" ngf-select="uploadStorePhoto($file)" accept="image/*">
ngf-max-size="2MB">
<i class="fa fa-upload"></i> Upload Shop Photo2 <i class="fa fa-upload"></i> Upload Shop Photo2
</button> </button>
</div> </div>

@ -1,6 +1,8 @@
<div class="row"> <div class="row">
<div class="col-sm-12"> <div class="col-sm-12">
<h3 class="box-title" style="display: inherit">Permissions</h3> <h3 class="box-title" style="display: inherit">Permissions</h3>
<a role="button" type="button" class="btn btn-success" ng-click="init()">
初始化权限</a>
<div class="table-responsive col-sm-12"> <div class="table-responsive col-sm-12">
<table class="table table-bordered table-hover table-striped"> <table class="table table-bordered table-hover table-striped">
<thead> <thead>

@ -30,26 +30,30 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
}; };
$scope.importExcel = function (file) { $scope.importExcel = function (file) {
if (file != null) { if (file != null) {
Upload.upload({ if (file.size > 2 * 1024 * 1024) {
url: '/attachment/files', commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB请压缩后重试', type: 'error'})
data: {file: file} } else {
}).then(function (resp) { Upload.upload({
$scope.agree_file_import = resp.data.url; url: '/attachment/files',
$http.put('/sys/product/importExcel', {source_agree_file: $scope.agree_file_import}).then(function () { data: {file: file}
commonDialog.alert({ }).then(function (resp) {
title: 'Success', $scope.agree_file_import = resp.data.url;
content: 'Succeed Imported', $http.put('/sys/product/importExcel', {source_agree_file: $scope.agree_file_import}).then(function () {
type: 'success' commonDialog.alert({
}); title: 'Success',
$state.reload(); content: 'Succeed Imported',
type: 'success'
});
$state.reload();
}, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
})
}, function (resp) { }, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
}) })
}, function (resp) { }
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
})
} }
} };
$scope.deleteProduct = function (product) { $scope.deleteProduct = function (product) {
commonDialog.confirm({ commonDialog.confirm({
title: 'Confirm', title: 'Confirm',

@ -31,7 +31,7 @@
<div class="form-group col-sm-5"> <div class="form-group col-sm-5">
<div class="pull-right"> <div class="pull-right">
<button class="btn btn-success" type="button" ngf-select="importExcel($file)" <button class="btn btn-success" type="button" ngf-select="importExcel($file)"
ngf-max-size="2MB" ng-if="importShow==1"> ng-if="importShow==1">
<i class="fa fa-upload"></i> 导入Excel <i class="fa fa-upload"></i> 导入Excel
</button> </button>
<button role="button" class="btn btn-info" title="Add Product" <button role="button" class="btn btn-info" title="Add Product"

Loading…
Cancel
Save