From 2eeb320dc384fbbd25cee256ffb41450d171a546 Mon Sep 17 00:00:00 2001 From: kira <164851225@qq.com> Date: Thu, 23 Aug 2018 10:17:37 +0800 Subject: [PATCH 01/10] init client permission --- .../core/impls/PermissionPartnerManagerImpl.java | 2 ++ .../web/SysPermissionClientController.java | 13 +++++++++++++ .../ui/static/payment/partner/partner-manage.js | 8 ++++++++ .../partner/templates/partner_permission.html | 2 ++ 4 files changed, 25 insertions(+) diff --git a/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/impls/PermissionPartnerManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/impls/PermissionPartnerManagerImpl.java index dce09e4de..da9c7f111 100644 --- a/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/impls/PermissionPartnerManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/impls/PermissionPartnerManagerImpl.java @@ -124,6 +124,8 @@ public class PermissionPartnerManagerImpl implements PermissionPartnerManager { moduleClientAdd.put("is_valid", true); permissionClientModulesService.save(moduleClientAdd); } + systemPackageCacheSupport.clearClientPermission(clientMoniker); + systemPackageCacheSupport.clearClientPermission(clientId); } diff --git a/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/web/SysPermissionClientController.java b/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/web/SysPermissionClientController.java index dd311283e..9710db8df 100644 --- a/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/web/SysPermissionClientController.java +++ b/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/web/SysPermissionClientController.java @@ -1,6 +1,8 @@ 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.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.tools.CommonConsts; @@ -26,6 +28,10 @@ import javax.annotation.Resource; public class SysPermissionClientController { @Resource private PermissionClientModulesService permissionClientModulesService; + @Resource + private PermissionPartnerManager permissionPartnerManager; + @Resource + private ClientManager clientManager; @RequestMapping(value = "/list", method = RequestMethod.GET) @@ -38,4 +44,11 @@ public class SysPermissionClientController { 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")); + } + + } diff --git a/src/main/ui/static/payment/partner/partner-manage.js b/src/main/ui/static/payment/partner/partner-manage.js index 9571def61..af8add9af 100644 --- a/src/main/ui/static/payment/partner/partner-manage.js +++ b/src/main/ui/static/payment/partner/partner-manage.js @@ -3107,6 +3107,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'}) + }) + }; + }]); diff --git a/src/main/ui/static/payment/partner/templates/partner_permission.html b/src/main/ui/static/payment/partner/templates/partner_permission.html index 08ae6de79..8efc66ba3 100644 --- a/src/main/ui/static/payment/partner/templates/partner_permission.html +++ b/src/main/ui/static/payment/partner/templates/partner_permission.html @@ -1,6 +1,8 @@

Permissions

+ + 初始化权限
From 3482de66c7b44d36de64e1d815ae0a626dba81f6 Mon Sep 17 00:00:00 2001 From: kira <164851225@qq.com> Date: Thu, 23 Aug 2018 10:21:11 +0800 Subject: [PATCH 02/10] init client permission --- .../sysconfig/core/impls/PermissionPartnerManagerImpl.java | 2 ++ .../mappers/system/SysPermissionClientModulesMapper.java | 2 ++ .../manage/system/core/PermissionClientModulesService.java | 1 + .../system/core/impl/PermissionClientModulesServiceImpl.java | 5 +++++ .../mappers/system/SysPermissionClientModulesMapper.xml | 5 +++++ 5 files changed, 15 insertions(+) diff --git a/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/impls/PermissionPartnerManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/impls/PermissionPartnerManagerImpl.java index da9c7f111..089fe8c13 100644 --- a/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/impls/PermissionPartnerManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/impls/PermissionPartnerManagerImpl.java @@ -115,7 +115,9 @@ public class PermissionPartnerManagerImpl implements PermissionPartnerManager { } @Override + @Transactional public void permissionClientModuleSave(int clientId, String clientMoniker) { + permissionClientModulesService.removeByClientMoniker(clientMoniker); List moduleId = permissionPartnerModuleMapper.list(); for (JSONObject moduleClientAdd : moduleId) { moduleClientAdd.put("client_id", clientId); diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/SysPermissionClientModulesMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/SysPermissionClientModulesMapper.java index b9ce4eba3..11d41797b 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/system/SysPermissionClientModulesMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/SysPermissionClientModulesMapper.java @@ -24,6 +24,8 @@ public interface SysPermissionClientModulesMapper { void delete(@Param("module_name") String moduleName); + void deleteByClientMoniker(@Param("client_moniker") String client_moniker); + @AutoSql(type = SqlType.SELECT) List listByClientId(@Param("client_id") int client_id); diff --git a/src/main/java/au/com/royalpay/payment/manage/system/core/PermissionClientModulesService.java b/src/main/java/au/com/royalpay/payment/manage/system/core/PermissionClientModulesService.java index 7e9d97220..984eb440a 100644 --- a/src/main/java/au/com/royalpay/payment/manage/system/core/PermissionClientModulesService.java +++ b/src/main/java/au/com/royalpay/payment/manage/system/core/PermissionClientModulesService.java @@ -19,4 +19,5 @@ public interface PermissionClientModulesService { void switchValid(Long id,boolean isValid,JSONObject account); + void removeByClientMoniker(String clientMoniker); } \ No newline at end of file diff --git a/src/main/java/au/com/royalpay/payment/manage/system/core/impl/PermissionClientModulesServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/system/core/impl/PermissionClientModulesServiceImpl.java index 05a99e1f0..20c8dbdce 100644 --- a/src/main/java/au/com/royalpay/payment/manage/system/core/impl/PermissionClientModulesServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/system/core/impl/PermissionClientModulesServiceImpl.java @@ -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) { try { modifyData.remove("id"); diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/SysPermissionClientModulesMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/SysPermissionClientModulesMapper.xml index b396def8c..4a329d96e 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/SysPermissionClientModulesMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/SysPermissionClientModulesMapper.xml @@ -28,4 +28,9 @@ delete from sys_permission_partner_modules_clients where module_id = (SELECT id from sys_permission_partner_modules where module_name=#{module_name}) + + + delete from sys_permission_partner_modules_clients + where client_moniker= #{client_moniker} + \ No newline at end of file From a91fac2c21e118fd958b4993e2f79866173269aa Mon Sep 17 00:00:00 2001 From: kira <164851225@qq.com> Date: Thu, 23 Aug 2018 10:37:24 +0800 Subject: [PATCH 03/10] update --- .../core/impls/PermissionPartnerManagerImpl.java | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/impls/PermissionPartnerManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/impls/PermissionPartnerManagerImpl.java index 089fe8c13..e063a67fe 100644 --- a/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/impls/PermissionPartnerManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/impls/PermissionPartnerManagerImpl.java @@ -109,7 +109,6 @@ public class PermissionPartnerManagerImpl implements PermissionPartnerManager { mod.put("funcs", funcList); modules.add(mod); } - report.put("modules", modules); return report; } @@ -123,7 +122,7 @@ public class PermissionPartnerManagerImpl implements PermissionPartnerManager { moduleClientAdd.put("client_id", clientId); moduleClientAdd.put("client_moniker", clientMoniker); moduleClientAdd.put("module_id", moduleClientAdd.getString("id")); - moduleClientAdd.put("is_valid", true); + moduleClientAdd.put("is_valid", moduleClientAdd.getBoolean("initialize")); permissionClientModulesService.save(moduleClientAdd); } systemPackageCacheSupport.clearClientPermission(clientMoniker); @@ -156,13 +155,10 @@ public class PermissionPartnerManagerImpl implements PermissionPartnerManager { permissionClientModulesService.save(clientMod); } } - module.initObject(mod); permissionPartnerModuleMapper.update(mod); - sysPermissionClientModulesMapper.updateFunctionValid(mod.getString("id"),mod.getBooleanValue("initialize")); - systemPackageCacheSupport.clearClientPermissionAll(); - - +// sysPermissionClientModulesMapper.updateFunctionValid(mod.getString("id"), mod.getBooleanValue("initialize")); +// systemPackageCacheSupport.clearClientPermissionAll(); } @Override @@ -218,7 +214,6 @@ public class PermissionPartnerManagerImpl implements PermissionPartnerManager { @Transactional @CacheEvict(value = ":login:partners:", allEntries = true) public void authorizeRole(PartnerRole role, List functions) { - permissionPartnerFunctionMapper.clearRolePermission(role.getCode()); permissionPartnerFunctionMapper.authorizeRole(role.getCode(), functions); } From 85629936703308116d93964557ace39b59195c72 Mon Sep 17 00:00:00 2001 From: kira <164851225@qq.com> Date: Thu, 23 Aug 2018 12:57:57 +0800 Subject: [PATCH 04/10] add log --- .../manage/permission/manager/ManagerUserInterceptor.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/au/com/royalpay/payment/manage/permission/manager/ManagerUserInterceptor.java b/src/main/java/au/com/royalpay/payment/manage/permission/manager/ManagerUserInterceptor.java index 967ef6324..389dc7631 100644 --- a/src/main/java/au/com/royalpay/payment/manage/permission/manager/ManagerUserInterceptor.java +++ b/src/main/java/au/com/royalpay/payment/manage/permission/manager/ManagerUserInterceptor.java @@ -111,6 +111,8 @@ public class ManagerUserInterceptor extends HandlerInterceptorAdapter implements if(func!=null && StringUtils.isNotEmpty(func.getString("module_id"))){ JSONArray arr = loginUser.getJSONArray("available_module_ids"); if (arr == null || !arr.contains(func.getString("module_id"))) { + logger.info(partner.toString()); + logger.info(partnerStatusKey); logger.info(funcId); throw new ForbiddenException("error.permission.nopermission"); } From 439c8ce7cfd2653894877feea09495364dfb11c5 Mon Sep 17 00:00:00 2001 From: kira <164851225@qq.com> Date: Thu, 23 Aug 2018 13:00:10 +0800 Subject: [PATCH 05/10] add log --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 351b5ceee..fcc8224a2 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ au.com.royalpay.payment payment-parent - 0.2.0 + 0.2.0-dev 4.0.0 From 1ee911e4c2edaa8365f0fca612cf6a322f644f87 Mon Sep 17 00:00:00 2001 From: "taylor.dang" Date: Thu, 23 Aug 2018 16:45:22 +0800 Subject: [PATCH 06/10] Settle Hour Config --- src/main/ui/static/payment/partner/partner-manage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/ui/static/payment/partner/partner-manage.js b/src/main/ui/static/payment/partner/partner-manage.js index af8add9af..dc1e11dfd 100644 --- a/src/main/ui/static/payment/partner/partner-manage.js +++ b/src/main/ui/static/payment/partner/partner-manage.js @@ -1700,7 +1700,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter $scope.getBankAccount(); }) }; - $scope.settleHours = [{value: undefined, label: 'Default(24:00, GMT+10)'}]; + $scope.settleHours = [{value: 24, label: 'Default(24:00, GMT+10)'}]; for (var h = 24; h > 0; h--) { $scope.settleHours.push({value: h, label: ('00' + h).substr(-2) + ':00, ' + $scope.partner.timezone}); } From 51402da2189434e3ee0b085fcbd30b469fb0f0a3 Mon Sep 17 00:00:00 2001 From: hellolujian <1370256381@qq.com> Date: Thu, 23 Aug 2018 18:46:40 +0800 Subject: [PATCH 07/10] =?UTF-8?q?[fix]=E5=95=86=E6=88=B7=E5=8F=B7=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E9=A1=B5=E9=9D=A2=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/MerchantIdManageServiceImpl.java | 9 ++- .../payment/merchantid/merchant_id_manager.js | 47 ++++++++++-- .../templates/merchant_id_manage.html | 76 ++++++++++++------- 3 files changed, 95 insertions(+), 37 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/merchantid/core/impl/MerchantIdManageServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchantid/core/impl/MerchantIdManageServiceImpl.java index 6a77ac270..0af53f8db 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchantid/core/impl/MerchantIdManageServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchantid/core/impl/MerchantIdManageServiceImpl.java @@ -62,8 +62,8 @@ public class MerchantIdManageServiceImpl implements MerchantIdManageService { @Override public Map> listSubMerchantId(JSONObject manager) { - List clients = clientMapper.listSubMerchantId(); - return getClientMap(clients); + List clients = clientMapper.listSubMerchantId(); + return getClientMap(clients); } @Override public JSONObject listNotTradeSubMerchantId(JSONObject manager) { @@ -139,7 +139,10 @@ public class MerchantIdManageServiceImpl implements MerchantIdManageService { client.put("temp_sub_merchant", true); } } - Map> clientsMap = clients.stream().filter(t->t.containsKey("merchant_id")).filter(t->t.containsKey("sub_merchant_id")).collect(Collectors.groupingBy(t->t.getString("merchant_id"))); + Map> clientsMap = clients.stream() + .filter(t->t.containsKey("merchant_id")) + .filter(t->t.containsKey("sub_merchant_id")) + .collect(Collectors.groupingBy(t->t.getString("merchant_id"))); return clientsMap; } diff --git a/src/main/ui/static/payment/merchantid/merchant_id_manager.js b/src/main/ui/static/payment/merchantid/merchant_id_manager.js index b184544da..6e9e8699e 100644 --- a/src/main/ui/static/payment/merchantid/merchant_id_manager.js +++ b/src/main/ui/static/payment/merchantid/merchant_id_manager.js @@ -17,19 +17,49 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS }) }]); app.controller('merchantIdManageCtrl', ['$scope', '$state', '$http', function ($scope, $state, $http) { - $scope.isCollapsed = true; - $scope.toShow = false; - $scope.client_loading = true; + $scope.isCollapsed = true; + $scope.toShow = false; + $scope.client_loading = true; - $scope.loadClient = function () { + $scope.endIndexMap = {}; + const initEndIndex = 60; + $scope.loadClient = function () { $http.get('/sys/merchant_id').then(function (resp) { - $scope.clientsMap = resp.data; - $scope.client_loading = false; + $scope.clientsMap = resp.data; + $scope.client_loading = false; + + // 加入对应项的end索引值 + for (var k in $scope.clientsMap) { + if ($scope.clientsMap[k].length <= initEndIndex) { + $scope.endIndexMap[k] = length; + } + + else + $scope.endIndexMap[k] = initEndIndex; + } }); }; - $scope.loadClient(); + $scope.loadClient(); + + $scope.more = function(key) { + + var endIndex = $scope.endIndexMap[key] + initEndIndex; + // 判断加60后的索引是否超出数组长度 + if (endIndex > $scope.clientsMap[key].length) { + $scope.endIndexMap[key] = $scope.clientsMap[key].length; + //alert("$scope.clientsMap[k].length:" + $scope.clientsMap[key].length + "$scope.endIndexMap[k]:" + $scope.endIndexMap[key]) + + } - $scope.showClient = function (sub_merchant_id) { + else + $scope.endIndexMap[key] = endIndex; + }; + + $scope.packup = function(key) { + $scope.endIndexMap[key] = initEndIndex; + }; + + $scope.showClient = function (sub_merchant_id) { if($scope.sub_merchant_id == sub_merchant_id){ return; } @@ -38,6 +68,7 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS $scope.sub_merchant_id = sub_merchant_id; }); }; + }]); app.controller('noTradeSubMerchantIdCtrl', ['$scope', '$state', '$http','$uibModal', function ($scope, $state, $http,$uibModal) { $scope.pagination = {}; diff --git a/src/main/ui/static/payment/merchantid/templates/merchant_id_manage.html b/src/main/ui/static/payment/merchantid/templates/merchant_id_manage.html index ab9bff83b..608e5bc56 100644 --- a/src/main/ui/static/payment/merchantid/templates/merchant_id_manage.html +++ b/src/main/ui/static/payment/merchantid/templates/merchant_id_manage.html @@ -78,44 +78,53 @@
From e26849f36b3283bb54b11eb37700a5f2ba3d1edf Mon Sep 17 00:00:00 2001 From: hellolujian <1370256381@qq.com> Date: Thu, 23 Aug 2018 18:52:09 +0800 Subject: [PATCH 08/10] =?UTF-8?q?[fix]=E5=95=86=E6=88=B7=E5=8F=B7=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E9=A1=B5=E9=9D=A2=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/static/payment/merchantid/merchant_id_manager.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/main/ui/static/payment/merchantid/merchant_id_manager.js b/src/main/ui/static/payment/merchantid/merchant_id_manager.js index 6e9e8699e..7d79b3c64 100644 --- a/src/main/ui/static/payment/merchantid/merchant_id_manager.js +++ b/src/main/ui/static/payment/merchantid/merchant_id_manager.js @@ -30,10 +30,10 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS // 加入对应项的end索引值 for (var k in $scope.clientsMap) { - if ($scope.clientsMap[k].length <= initEndIndex) { + var length = $scope.clientsMap[k].length; + if (length <= initEndIndex) { $scope.endIndexMap[k] = length; } - else $scope.endIndexMap[k] = initEndIndex; } @@ -47,10 +47,7 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS // 判断加60后的索引是否超出数组长度 if (endIndex > $scope.clientsMap[key].length) { $scope.endIndexMap[key] = $scope.clientsMap[key].length; - //alert("$scope.clientsMap[k].length:" + $scope.clientsMap[key].length + "$scope.endIndexMap[k]:" + $scope.endIndexMap[key]) - } - else $scope.endIndexMap[key] = endIndex; }; From 16d881bca179993bee7f55ddae067aa056cb66fa Mon Sep 17 00:00:00 2001 From: hellolujian <1370256381@qq.com> Date: Fri, 24 Aug 2018 10:13:32 +0800 Subject: [PATCH 09/10] =?UTF-8?q?[fix]=E5=95=86=E6=88=B7=E5=8F=B7=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E9=A1=B5=E9=9D=A2=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../payment/merchantid/merchant_id_manager.js | 35 +++++++++++++------ 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/src/main/ui/static/payment/merchantid/merchant_id_manager.js b/src/main/ui/static/payment/merchantid/merchant_id_manager.js index 7d79b3c64..fea7a0443 100644 --- a/src/main/ui/static/payment/merchantid/merchant_id_manager.js +++ b/src/main/ui/static/payment/merchantid/merchant_id_manager.js @@ -21,7 +21,9 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS $scope.toShow = false; $scope.client_loading = true; + // 前端渲染的end索引 $scope.endIndexMap = {}; + // 初始化索引是60 const initEndIndex = 60; $scope.loadClient = function () { $http.get('/sys/merchant_id').then(function (resp) { @@ -29,31 +31,44 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS $scope.client_loading = false; // 加入对应项的end索引值 - for (var k in $scope.clientsMap) { - var length = $scope.clientsMap[k].length; - if (length <= initEndIndex) { - $scope.endIndexMap[k] = length; - } - else - $scope.endIndexMap[k] = initEndIndex; + // 如果数据小于60,索引值为数据长度 + // 否则设置为60 + for (var key in $scope.clientsMap) { + $scope.endIndexMap[key] = initEndIndex; + var length = $scope.clientsMap[key].length; + if (length <= initEndIndex) + $scope.endIndexMap[key] = length; + } }); }; $scope.loadClient(); + /** + * 点击更多加载 + * 判断加60后的索引是否超出数组长度 + * @param key + */ $scope.more = function(key) { var endIndex = $scope.endIndexMap[key] + initEndIndex; - // 判断加60后的索引是否超出数组长度 + $scope.endIndexMap[key] = endIndex; + if (endIndex > $scope.clientsMap[key].length) { $scope.endIndexMap[key] = $scope.clientsMap[key].length; } - else - $scope.endIndexMap[key] = endIndex; + }; + /** + * 收起 + * @param key + */ $scope.packup = function(key) { $scope.endIndexMap[key] = initEndIndex; + var length = $scope.clientsMap[key].length; + if (length <= initEndIndex) + $scope.endIndexMap[key] = length; }; $scope.showClient = function (sub_merchant_id) { From 944e89f3e92b37de53cc74d071f0400aa74181a0 Mon Sep 17 00:00:00 2001 From: yangkai Date: Fri, 24 Aug 2018 11:07:50 +0800 Subject: [PATCH 10/10] =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E8=B6=85=E8=BF=87=E8=A7=84=E5=AE=9A=E5=A4=A7=E5=B0=8F=EF=BC=8C?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E6=8A=A5=E9=94=99=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../static/application/apply_open_quickly.js | 62 ++-- .../application/clientAuthentication.js | 122 ++++--- .../templates/apply_basicinfo.html | 4 +- .../templates/clientAuthentication.html | 8 +- .../config/onedollarday/onedollarday.js | 6 +- .../templates/merchant_config.html | 2 +- .../config/organizations/organizations.js | 12 + .../organizations/templates/new_org.html | 2 +- .../organizations/templates/org_detail.html | 2 +- .../templates/org_detail_parent.html | 2 +- .../static/payment/cashiers/cashier-manage.js | 60 ++-- .../cashiers/templates/cashier_add.html | 2 +- .../cashiers/templates/cashier_edit.html | 2 +- .../ui/static/payment/good/good-manage.js | 72 ++-- .../payment/good/templates/add_good.html | 2 +- .../payment/good/templates/good_edit.html | 2 +- .../static/payment/partner/partner-manage.js | 312 ++++++++++-------- src/main/ui/static/payment/partner/partner.js | 184 ++++++----- .../partner/templates/add_partner.html | 8 +- .../templates/add_sub_partner_dialog.html | 8 +- .../templates/client_partner_detail.html | 8 +- .../templates/client_partner_edit.html | 7 +- .../partner/templates/partner_detail.html | 2 +- .../partner/templates/partner_edit.html | 7 +- .../static/payment/product/product_manager.js | 38 ++- .../payment/product/templates/product.html | 2 +- 26 files changed, 527 insertions(+), 411 deletions(-) diff --git a/src/main/ui/static/application/apply_open_quickly.js b/src/main/ui/static/application/apply_open_quickly.js index 8c2693b82..8dda0f28b 100644 --- a/src/main/ui/static/application/apply_open_quickly.js +++ b/src/main/ui/static/application/apply_open_quickly.js @@ -90,38 +90,46 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS $scope.uploadLogo = function (file) { if (file != null) { - $scope.logoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.logoProgress; - $scope.partner.logo_id = resp.data.fileid; - $scope.partner.logo_url = resp.data.url; - }, function (resp) { - 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); - }) + if (file.size > 1 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}); + } else { + $scope.logoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.logoProgress; + $scope.partner.logo_id = resp.data.fileid; + $scope.partner.logo_url = resp.data.url; + }, function (resp) { + 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) { if (file != null) { - $scope.photoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.photoProgress; - $scope.partner.company_photo = resp.data.url; - }, function (resp) { - 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); - }) + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}); + } else { + $scope.photoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.photoProgress; + $scope.partner.company_photo = resp.data.url; + }, function (resp) { + 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); + }) + } } }; diff --git a/src/main/ui/static/application/clientAuthentication.js b/src/main/ui/static/application/clientAuthentication.js index 913f48b09..b6150c976 100644 --- a/src/main/ui/static/application/clientAuthentication.js +++ b/src/main/ui/static/application/clientAuthentication.js @@ -90,38 +90,46 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS }; $scope.uploadLogo = function (file) { if (file != null) { - $scope.logoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.logoProgress; - $scope.partner.logo_id = resp.data.fileid; - $scope.partner.logo_url = resp.data.url; - }, function (resp) { - 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); - }) + if (file.size > 1 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}); + } else { + $scope.logoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.logoProgress; + $scope.partner.logo_id = resp.data.fileid; + $scope.partner.logo_url = resp.data.url; + }, function (resp) { + 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) { if (file != null) { - $scope.photoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.photoProgress; - $scope.partner.company_photo = resp.data.url; - }, function (resp) { - 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); - }) + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}); + } else { + $scope.photoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.photoProgress; + $scope.partner.company_photo = resp.data.url; + }, function (resp) { + 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 $scope.uploadBankFile = function (file) { if (file != null) { - $scope.bankFileProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.bankFileProgress; - $scope.partner.file.file_bank_info = resp.data.url; - }, function (resp) { - 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); - }) + if (file.size > 1 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}); + } else { + $scope.bankFileProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.bankFileProgress; + $scope.partner.file.file_bank_info = resp.data.url; + }, function (resp) { + 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) { if (file != null) { - $scope.companyFileProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.companyFileProgress; - $scope.partner.file.file_company_info = resp.data.url; - }, function (resp) { - 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); - }) + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}); + } else { + $scope.companyFileProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.companyFileProgress; + $scope.partner.file.file_company_info = resp.data.url; + }, function (resp) { + 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); + }) + } } }; diff --git a/src/main/ui/static/application/templates/apply_basicinfo.html b/src/main/ui/static/application/templates/apply_basicinfo.html index 1305c0914..d7d89784a 100644 --- a/src/main/ui/static/application/templates/apply_basicinfo.html +++ b/src/main/ui/static/application/templates/apply_basicinfo.html @@ -63,7 +63,7 @@
@@ -110,7 +110,7 @@
diff --git a/src/main/ui/static/application/templates/clientAuthentication.html b/src/main/ui/static/application/templates/clientAuthentication.html index 9e39e569e..641f22bea 100644 --- a/src/main/ui/static/application/templates/clientAuthentication.html +++ b/src/main/ui/static/application/templates/clientAuthentication.html @@ -84,7 +84,7 @@
@@ -186,7 +186,7 @@
@@ -492,7 +492,7 @@
@@ -512,7 +512,7 @@
diff --git a/src/main/ui/static/config/onedollarday/onedollarday.js b/src/main/ui/static/config/onedollarday/onedollarday.js index dd3800bd0..ba4258ced 100644 --- a/src/main/ui/static/config/onedollarday/onedollarday.js +++ b/src/main/ui/static/config/onedollarday/onedollarday.js @@ -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.save = function () { $scope.errmsg = null; @@ -219,6 +219,10 @@ define(['angular'], function (angular) { if(!file){ return; } + if (file.size > 1 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}); + return; + } $scope.photoProgress = {value: 0}; Upload.upload({ url: '/attachment/files', diff --git a/src/main/ui/static/config/onedollarday/templates/merchant_config.html b/src/main/ui/static/config/onedollarday/templates/merchant_config.html index 56f79185f..e39e62ab0 100644 --- a/src/main/ui/static/config/onedollarday/templates/merchant_config.html +++ b/src/main/ui/static/config/onedollarday/templates/merchant_config.html @@ -10,7 +10,7 @@
diff --git a/src/main/ui/static/config/organizations/organizations.js b/src/main/ui/static/config/organizations/organizations.js index 750a5e4ca..be688acaa 100644 --- a/src/main/ui/static/config/organizations/organizations.js +++ b/src/main/ui/static/config/organizations/organizations.js @@ -108,6 +108,10 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) { if (file == null) { return; } + if (file.size > 1 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}); + return; + } $scope.logoProgress = {value: 0}; Upload.upload({ url: '/attachment/files', @@ -215,6 +219,10 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) { if (file == null) { return; } + if (file.size > 1 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}); + return; + } $scope.logoProgress = {value: 0}; Upload.upload({ url: '/attachment/files', @@ -321,6 +329,10 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) { if (file == null) { return; } + if (file.size > 1 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}); + return; + } $scope.logoProgress = {value: 0}; Upload.upload({ url: '/attachment/files', diff --git a/src/main/ui/static/config/organizations/templates/new_org.html b/src/main/ui/static/config/organizations/templates/new_org.html index f8296afb5..13eaf2fed 100644 --- a/src/main/ui/static/config/organizations/templates/new_org.html +++ b/src/main/ui/static/config/organizations/templates/new_org.html @@ -24,7 +24,7 @@

diff --git a/src/main/ui/static/config/organizations/templates/org_detail.html b/src/main/ui/static/config/organizations/templates/org_detail.html index 2140946c9..9fa311101 100644 --- a/src/main/ui/static/config/organizations/templates/org_detail.html +++ b/src/main/ui/static/config/organizations/templates/org_detail.html @@ -36,7 +36,7 @@

diff --git a/src/main/ui/static/config/organizations/templates/org_detail_parent.html b/src/main/ui/static/config/organizations/templates/org_detail_parent.html index 464290749..3464f49de 100644 --- a/src/main/ui/static/config/organizations/templates/org_detail_parent.html +++ b/src/main/ui/static/config/organizations/templates/org_detail_parent.html @@ -173,7 +173,7 @@

diff --git a/src/main/ui/static/payment/cashiers/cashier-manage.js b/src/main/ui/static/payment/cashiers/cashier-manage.js index 721f8f3fa..5982e122c 100644 --- a/src/main/ui/static/payment/cashiers/cashier-manage.js +++ b/src/main/ui/static/payment/cashiers/cashier-manage.js @@ -51,19 +51,23 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS $scope.cashier = {}; $scope.uploadPhoto = function (file) { if (file != null) { - $scope.photoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.photoProgress; - $scope.cashier.photo = resp.data.url; - }, function (resp) { - 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); - }) + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + $scope.photoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.photoProgress; + $scope.cashier.photo = resp.data.url; + }, function (resp) { + 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) { @@ -178,19 +182,23 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS $scope.cashier = angular.copy(cashier.data); $scope.uploadPhoto = function (file) { if (file != null) { - $scope.photoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.photoProgress; - $scope.cashier.photo = resp.data.url; - }, function (resp) { - 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); - }) + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + $scope.photoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.photoProgress; + $scope.cashier.photo = resp.data.url; + }, function (resp) { + 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) { diff --git a/src/main/ui/static/payment/cashiers/templates/cashier_add.html b/src/main/ui/static/payment/cashiers/templates/cashier_add.html index 070a596de..fdf0b33ee 100644 --- a/src/main/ui/static/payment/cashiers/templates/cashier_add.html +++ b/src/main/ui/static/payment/cashiers/templates/cashier_add.html @@ -71,7 +71,7 @@

diff --git a/src/main/ui/static/payment/cashiers/templates/cashier_edit.html b/src/main/ui/static/payment/cashiers/templates/cashier_edit.html index 2fae846ce..6e20bba43 100644 --- a/src/main/ui/static/payment/cashiers/templates/cashier_edit.html +++ b/src/main/ui/static/payment/cashiers/templates/cashier_edit.html @@ -59,7 +59,7 @@
diff --git a/src/main/ui/static/payment/good/good-manage.js b/src/main/ui/static/payment/good/good-manage.js index cf2324d83..d89378dca 100644 --- a/src/main/ui/static/payment/good/good-manage.js +++ b/src/main/ui/static/payment/good/good-manage.js @@ -93,22 +93,26 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS $scope.good.images = []; $scope.uploadImage = function (file) { if (file != null) { - $scope.imageProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.imageProgress; - var image = {}; - image.fileId = resp.data.fileid; - image.url = resp.data.url; - $scope.good.images.push(image); - }, function (resp) { - 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); - }) + if (file.size > 1 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}) + } else { + $scope.imageProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.imageProgress; + var image = {}; + image.fileId = resp.data.fileid; + image.url = resp.data.url; + $scope.good.images.push(image); + }, function (resp) { + 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) { if (file != null) { - $scope.imageProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.imageProgress; - var image = {}; - image.fileId = resp.data.fileid; - image.url = resp.data.url; - $scope.good.images.push(image); - }, function (resp) { - 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); - }) + if (file.size > 1 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}) + } else { + $scope.imageProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.imageProgress; + var image = {}; + image.fileId = resp.data.fileid; + image.url = resp.data.url; + $scope.good.images.push(image); + }, function (resp) { + 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); + }) + } } }; }]); diff --git a/src/main/ui/static/payment/good/templates/add_good.html b/src/main/ui/static/payment/good/templates/add_good.html index 53c0c97a5..82d0a5f07 100644 --- a/src/main/ui/static/payment/good/templates/add_good.html +++ b/src/main/ui/static/payment/good/templates/add_good.html @@ -136,7 +136,7 @@
diff --git a/src/main/ui/static/payment/good/templates/good_edit.html b/src/main/ui/static/payment/good/templates/good_edit.html index 7623a4ed0..d280e96e8 100644 --- a/src/main/ui/static/payment/good/templates/good_edit.html +++ b/src/main/ui/static/payment/good/templates/good_edit.html @@ -147,7 +147,7 @@
diff --git a/src/main/ui/static/payment/partner/partner-manage.js b/src/main/ui/static/payment/partner/partner-manage.js index dc1e11dfd..0084d5263 100644 --- a/src/main/ui/static/payment/partner/partner-manage.js +++ b/src/main/ui/static/payment/partner/partner-manage.js @@ -439,56 +439,68 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }; $scope.uploadLogo = function (file) { if (file != null) { - $scope.logoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.logoProgress; - $scope.partner.logo_id = resp.data.fileid; - $scope.partner.logo_url = resp.data.url; - }, function (resp) { - 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); - }) + if (file.size > 1 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}) + } else { + $scope.logoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.logoProgress; + $scope.partner.logo_id = resp.data.fileid; + $scope.partner.logo_url = resp.data.url; + }, function (resp) { + 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) { if (file != null) { - $scope.shopPhotoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.shopPhotoProgress; - $scope.partner.company_photo = resp.data.url; - }, function (resp) { - 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); - }) + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + $scope.shopPhotoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.shopPhotoProgress; + $scope.partner.company_photo = resp.data.url; + }, function (resp) { + 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) { if (file != null) { - $scope.storePhotoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.storePhotoProgress; - $scope.partner.store_photo = resp.data.url; - }, function (resp) { - 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); - }) + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + $scope.storePhotoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.storePhotoProgress; + $scope.partner.store_photo = resp.data.url; + }, function (resp) { + 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) { if (file != null) { - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - $scope.agree_file_import = resp.data.url; - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/import/agreepdf', {source_agree_file: $scope.agree_file_import}).then(function () { - commonDialog.alert({ - title: 'Success', - content: 'Succeed Imported! Please notify BD', - type: 'success' - }); - $state.reload(); + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + $scope.agree_file_import = resp.data.url; + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/import/agreepdf', {source_agree_file: $scope.agree_file_import}).then(function () { + commonDialog.alert({ + title: 'Success', + content: 'Succeed Imported! Please notify BD', + type: 'success' + }); + $state.reload(); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }) }, 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 () { @@ -1093,56 +1109,68 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }; $scope.uploadLogo = function (file) { if (file != null) { - $scope.logoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.logoProgress; - $scope.partner.logo_id = resp.data.fileid; - $scope.partner.logo_url = resp.data.url; - }, function (resp) { - 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); - }) + if (file.size > 1 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}) + } else { + $scope.logoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.logoProgress; + $scope.partner.logo_id = resp.data.fileid; + $scope.partner.logo_url = resp.data.url; + }, function (resp) { + 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) { if (file != null) { - $scope.shopPhotoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.shopPhotoProgress; - $scope.partner.company_photo = resp.data.url; - }, function (resp) { - 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); - }) + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + $scope.shopPhotoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.shopPhotoProgress; + $scope.partner.company_photo = resp.data.url; + }, function (resp) { + 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) { if (file != null) { - $scope.storePhotoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.storePhotoProgress; - $scope.partner.store_photo = resp.data.url; - }, function (resp) { - 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); - }) + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + $scope.storePhotoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.storePhotoProgress; + $scope.partner.store_photo = resp.data.url; + }, function (resp) { + 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) { if (file != null) { - $scope.logoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.logoProgress; - $scope.partner.logo_id = resp.data.fileid; - $scope.partner.logo_url = resp.data.url; - }, function (resp) { - 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); - }) + if (file.size > 1 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}) + } else { + $scope.logoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.logoProgress; + $scope.partner.logo_id = resp.data.fileid; + $scope.partner.logo_url = resp.data.url; + }, function (resp) { + 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) { if (file != null) { - $scope.shopPhotoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.shopPhotoProgress; - $scope.partner.company_photo = resp.data.url; - }, function (resp) { - 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); - }) + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + $scope.shopPhotoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.shopPhotoProgress; + $scope.partner.company_photo = resp.data.url; + }, function (resp) { + 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) { if (file != null) { - $scope.storePhotoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.storePhotoProgress; - $scope.partner.store_photo = resp.data.url; - }, function (resp) { - 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); - }) + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + $scope.storePhotoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.storePhotoProgress; + $scope.partner.store_photo = resp.data.url; + }, function (resp) { + 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 () { diff --git a/src/main/ui/static/payment/partner/partner.js b/src/main/ui/static/payment/partner/partner.js index 989273068..9e5a7e7d8 100644 --- a/src/main/ui/static/payment/partner/partner.js +++ b/src/main/ui/static/payment/partner/partner.js @@ -72,56 +72,68 @@ define(['angular', 'decimal', 'uiRouter', 'ngBootSwitch', 'ngFileUpload'], funct $scope.uploadLogo = function (file) { if (file != null) { - $scope.logoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.logoProgress; - $scope.partner.logo_id = resp.data.fileid; - $scope.partner.logo_url = resp.data.url; - }, function (resp) { - 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); - }) + if (file.size > 1 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}) + } else { + $scope.logoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.logoProgress; + $scope.partner.logo_id = resp.data.fileid; + $scope.partner.logo_url = resp.data.url; + }, function (resp) { + 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) { if (file != null) { - $scope.shopPhotoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.shopPhotoProgress; - $scope.partner.company_photo = resp.data.url; - }, function (resp) { - 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); - }) + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + $scope.shopPhotoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.shopPhotoProgress; + $scope.partner.company_photo = resp.data.url; + }, function (resp) { + 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) { if (file != null) { - $scope.storePhotoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.storePhotoProgress; - $scope.partner.store_photo = resp.data.url; - }, function (resp) { - 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); - }) + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + $scope.storePhotoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.storePhotoProgress; + $scope.partner.store_photo = resp.data.url; + }, function (resp) { + 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) { if (file != null) { - $scope.logoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.logoProgress; - $scope.partner.logo_id = resp.data.fileid; - $scope.partner.logo_url = resp.data.url; - }, function (resp) { - 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); - }) + if (file.size > 1 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}) + } else { + $scope.logoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.logoProgress; + $scope.partner.logo_id = resp.data.fileid; + $scope.partner.logo_url = resp.data.url; + }, function (resp) { + 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) { if (file != null) { - $scope.shopPhotoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.shopPhotoProgress; - $scope.partner.company_photo = resp.data.url; - }, function (resp) { - 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); - }) + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + $scope.shopPhotoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.shopPhotoProgress; + $scope.partner.company_photo = resp.data.url; + }, function (resp) { + 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) { if (file != null) { - $scope.storePhotoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.storePhotoProgress; - $scope.partner.store_photo = resp.data.url; - }, function (resp) { - 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); - }) + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + $scope.storePhotoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.storePhotoProgress; + $scope.partner.store_photo = resp.data.url; + }, function (resp) { + 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); + }) + } } }; diff --git a/src/main/ui/static/payment/partner/templates/add_partner.html b/src/main/ui/static/payment/partner/templates/add_partner.html index 70595e710..5aa55efa2 100644 --- a/src/main/ui/static/payment/partner/templates/add_partner.html +++ b/src/main/ui/static/payment/partner/templates/add_partner.html @@ -127,7 +127,7 @@
@@ -230,8 +230,7 @@
1: 
@@ -242,8 +241,7 @@
2: 
diff --git a/src/main/ui/static/payment/partner/templates/add_sub_partner_dialog.html b/src/main/ui/static/payment/partner/templates/add_sub_partner_dialog.html index 07814fd95..52463ae66 100644 --- a/src/main/ui/static/payment/partner/templates/add_sub_partner_dialog.html +++ b/src/main/ui/static/payment/partner/templates/add_sub_partner_dialog.html @@ -98,7 +98,7 @@
@@ -188,8 +188,7 @@
1: 
@@ -200,8 +199,7 @@
2: 
diff --git a/src/main/ui/static/payment/partner/templates/client_partner_detail.html b/src/main/ui/static/payment/partner/templates/client_partner_detail.html index 5725d8577..9c8ebcfa4 100644 --- a/src/main/ui/static/payment/partner/templates/client_partner_detail.html +++ b/src/main/ui/static/payment/partner/templates/client_partner_detail.html @@ -363,7 +363,7 @@
@@ -430,8 +430,7 @@
1: 
@@ -443,8 +442,7 @@
2: 
diff --git a/src/main/ui/static/payment/partner/templates/client_partner_edit.html b/src/main/ui/static/payment/partner/templates/client_partner_edit.html index 9dd641196..2ab021514 100644 --- a/src/main/ui/static/payment/partner/templates/client_partner_edit.html +++ b/src/main/ui/static/payment/partner/templates/client_partner_edit.html @@ -58,7 +58,7 @@
@@ -105,7 +105,7 @@
1: 
@@ -116,8 +116,7 @@
2: 
diff --git a/src/main/ui/static/payment/partner/templates/partner_detail.html b/src/main/ui/static/payment/partner/templates/partner_detail.html index 35cde22f8..0c1b85386 100644 --- a/src/main/ui/static/payment/partner/templates/partner_detail.html +++ b/src/main/ui/static/payment/partner/templates/partner_detail.html @@ -85,7 +85,7 @@ 制作全支付合同 + accept="pdf/*"> 上传合同 (通用合同请选择制作合同,非通用合同模板请人工制作合同后上传)
diff --git a/src/main/ui/static/payment/partner/templates/partner_edit.html b/src/main/ui/static/payment/partner/templates/partner_edit.html index c351e7a31..7380f340f 100644 --- a/src/main/ui/static/payment/partner/templates/partner_edit.html +++ b/src/main/ui/static/payment/partner/templates/partner_edit.html @@ -166,7 +166,7 @@
@@ -255,7 +255,7 @@
1: 
@@ -266,8 +266,7 @@
2: 
diff --git a/src/main/ui/static/payment/product/product_manager.js b/src/main/ui/static/payment/product/product_manager.js index 41050759a..87bd1421e 100644 --- a/src/main/ui/static/payment/product/product_manager.js +++ b/src/main/ui/static/payment/product/product_manager.js @@ -30,26 +30,30 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }; $scope.importExcel = function (file) { if (file != null) { - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - $scope.agree_file_import = resp.data.url; - $http.put('/sys/product/importExcel', {source_agree_file: $scope.agree_file_import}).then(function () { - commonDialog.alert({ - title: 'Success', - content: 'Succeed Imported', - type: 'success' - }); - $state.reload(); + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + $scope.agree_file_import = resp.data.url; + $http.put('/sys/product/importExcel', {source_agree_file: $scope.agree_file_import}).then(function () { + commonDialog.alert({ + title: 'Success', + content: 'Succeed Imported', + type: 'success' + }); + $state.reload(); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }) }, 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) { commonDialog.confirm({ title: 'Confirm', diff --git a/src/main/ui/static/payment/product/templates/product.html b/src/main/ui/static/payment/product/templates/product.html index 9e66b1834..08a1a31bf 100644 --- a/src/main/ui/static/payment/product/templates/product.html +++ b/src/main/ui/static/payment/product/templates/product.html @@ -31,7 +31,7 @@