Переглянути джерело

物料工具类个人物料新增方法修改

dongbw 8 роки тому
батько
коміт
4b46f1ea4f

+ 3 - 9
src/main/java/com/uas/platform/b2b/ps/ProductUtils.java

@@ -94,15 +94,9 @@ public class ProductUtils {
     public static Long updateProductUsersOne(ProductUsers productUser) throws Exception {
         List<ProductUsers> productUsers = new ArrayList<>();
         productUsers.add(productUser);
-        HashMap<String, Object> params = new HashMap<>();
-        params.put("data", FlexJsonUtils.toJsonDeep(productUsers));
-        Response res = HttpUtil.sendPostRequest(PRODUCT_PUBLIC_SERVICE_URL + "/productuser/save", params);
-        if (HttpStatus.OK.value() == res.getStatusCode()) {
-            if (null != res.getResponseText()) {
-                return Long.valueOf(res.getResponseText());
-            }
-        } else {
-            throw new RuntimeException("保存单个个人物料失败");
+        String res = HttpUtil.doPost(PRODUCT_PUBLIC_SERVICE_URL + "/productuser/save", FlexJsonUtils.toJsonDeep(productUsers));
+        if (null == res) {
+            throw new RuntimeException("保存个人物料失败");
         }
         return null;
     }

+ 6 - 0
src/main/webapp/resources/js/index/app.js

@@ -13620,9 +13620,12 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
             if (newvalue == '' || newvalue == null) {
                 toaster.pop('error', '提示', '修改的值不能为空');
             } else {
+                $scope.loading = true;
                 Products.alterByBatch({parameter: $scope.parameter}, {}, function (data) {
+                    $scope.loading = false;
                     $modalInstance.close(data);
                 }, function (response) {
+                    $scope.loading = false;
                     toaster.pop('error', '提示', response.data);
                 });
             }
@@ -21422,9 +21425,12 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 
         // 转入我的产品库
         $scope.addtoUser = function(id) {
+            $scope.loading = true;
             prodUser.coverToUser({id: id}, {}, function(data) {
+                $scope.loading = false;
                 toaster.pop('success', '提示', '转入成功');
             }, function(res) {
+                $scope.loading = false;
                 toaster.pop('error', '提示', '转入失败');
             });
         }