Browse Source

合并代码

will.chen 7 years ago
parent
commit
6bd0297a57
100 changed files with 2524 additions and 579 deletions
  1. 4 1
      README.md
  2. 8 2
      applications/commons/pom.xml
  3. 2 1
      applications/commons/src/main/java/com/usoftchina/saas/common/dto/BatchDealBaseDTO.java
  4. 0 0
      applications/commons/src/main/java/com/usoftchina/saas/common/dto/ComboDTO.java
  5. 0 0
      applications/commons/src/main/java/com/usoftchina/saas/common/dto/DocBaseDTO.java
  6. 0 0
      applications/commons/src/main/java/com/usoftchina/saas/common/dto/DocReqDTO.java
  7. 0 0
      applications/commons/src/main/java/com/usoftchina/saas/common/dto/DocSavedDTO.java
  8. 0 0
      applications/commons/src/main/java/com/usoftchina/saas/common/dto/ProductBaseDTO.java
  9. 4 0
      applications/document/document-dto/pom.xml
  10. 6 6
      applications/document/document-dto/src/main/java/com.usoftchina.saas.document.dto/ProductDTO.java
  11. 1 10
      applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/Product.java
  12. 1 13
      applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/Vendor.java
  13. 1 10
      applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/Warehouse.java
  14. 3 12
      applications/document/document-server/pom.xml
  15. 6 0
      applications/document/document-server/src/main/docker/Dockerfile
  16. 8 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/controller/ProductController.java
  17. 0 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/controller/VendorController.java
  18. 1 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/ProductMapper.java
  19. 2 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/VendorMapper.java
  20. 1 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/WarehouseMapper.java
  21. 10 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/Impl/ProductServiceImpl.java
  22. 2 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/Impl/VendorServiceImpl.java
  23. 2 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/Impl/WarehouseServiceImpl.java
  24. 5 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/ProductService.java
  25. 3 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/VendorService.java
  26. 2 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/WarehouseService.java
  27. 14 0
      applications/document/document-server/src/main/resources/application.yml
  28. 6 2
      applications/document/document-server/src/main/resources/mapper/ProductMapper.xml
  29. 2 2
      applications/document/document-server/src/main/resources/mapper/VendorMapper.xml
  30. 2 2
      applications/document/document-server/src/main/resources/mapper/WarehouseMapper.xml
  31. 0 2
      applications/document/document-server/src/test/java/com/usoftchina/saas/document/service/VendorTest.java
  32. 1 1
      applications/pom.xml
  33. 5 1
      applications/purchase/purchase-dto/pom.xml
  34. 0 2
      applications/purchase/purchase-dto/src/main/java/com/usoftchina/saas/purchase/dto/PurchaseDTO.java
  35. 3 2
      applications/purchase/purchase-dto/src/main/java/com/usoftchina/saas/purchase/dto/PurchaseItemDTO.java
  36. 0 1
      applications/purchase/purchase-dto/src/main/java/com/usoftchina/saas/purchase/dto/PurchaseListDTO.java
  37. 4 2
      applications/purchase/purchase-server/pom.xml
  38. 3 3
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/controller/PurchaseController.java
  39. 4 1
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/po/PurchaseItem.java
  40. 2 3
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/PurchaseService.java
  41. 16 17
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/PurchaseServiceImpl.java
  42. 14 0
      applications/purchase/purchase-server/src/main/resources/application.yml
  43. 1 1
      applications/purchase/purchase-server/src/main/resources/mapper/PurchaseMapper.xml
  44. 32 1
      applications/purchase/purchase-server/src/main/resources/mapper/PurchasedetailMapper.xml
  45. 18 3
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/mapper/RoleResourceMapper.java
  46. 1 3
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/po/RoleResource.java
  47. 6 0
      base-servers/account/account-server/src/main/resources/mapper/RoleResourceMapper.xml
  48. 16 12
      base-servers/gateway-server/pom.xml
  49. 24 0
      base-servers/gateway-server/src/main/java/com/usoftchina/saas/gateway/error/MyExceptionAdvice.java
  50. 6 3
      base-servers/gateway-server/src/main/java/com/usoftchina/saas/gateway/error/MyExceptionHandler.java
  51. 5 8
      base-servers/gateway-server/src/main/resources/application.yml
  52. 0 0
      base-servers/gateway-server/src/main/resources/banner.txt
  53. 3 3
      base-servers/ui-server/pom.xml
  54. 1 4
      base-servers/ui-server/src/main/java/com/usoftchina/saas/ui/controller/co/CoViewController.java
  55. 5 4
      base-servers/ui-server/src/main/resources/application.yml
  56. 1 1
      base-servers/ui-server/src/test/java/com/usoftchina/saas/ui/test/ViewServiceTest.java
  57. 5 0
      base-servers/zipkin-server/pom.xml
  58. 2 2
      base-servers/zipkin-server/src/main/java/com/usoftchina/saas/zipkin/ZipkinApplication.java
  59. 2 0
      base-servers/zipkin-server/src/main/resources/application.yml
  60. 0 3
      base-servers/zipkin-server/src/main/resources/config/application-docker.yml
  61. 4 0
      framework/core/src/main/java/com/usoftchina/saas/base/Result.java
  62. 0 10
      framework/core/src/main/java/com/usoftchina/saas/utils/StringUtils.java
  63. 19 1
      framework/server-starter/src/main/java/com/usoftchina/saas/server/ServerAutoConfiguration.java
  64. 25 0
      framework/server-starter/src/main/java/com/usoftchina/saas/server/error/ErrorConfig.java
  65. 53 0
      framework/server-starter/src/main/java/com/usoftchina/saas/server/error/GlobalExceptionHandler.java
  66. 0 41
      framework/server-starter/src/main/java/com/usoftchina/saas/server/error/MyErrorController.java
  67. 52 0
      framework/server-starter/src/main/java/com/usoftchina/saas/server/error/ServletErrorUtils.java
  68. 36 0
      framework/server-starter/src/main/java/com/usoftchina/saas/server/error/UnCaughtErrorFilter.java
  69. 60 11
      frontend/saas-web/app/util/FormUtil.js
  70. 122 88
      frontend/saas-web/app/util/QueryUtil.js
  71. 17 2
      frontend/saas-web/app/view/core/form/ConDateField.js
  72. 0 32
      frontend/saas-web/app/view/core/form/DateField.js
  73. 122 27
      frontend/saas-web/app/view/core/form/FormPanel.js
  74. 72 76
      frontend/saas-web/app/view/core/form/FormPanelController.js
  75. 6 1
      frontend/saas-web/app/view/core/form/FormPanelModel.js
  76. 126 0
      frontend/saas-web/app/view/core/form/MultiCombo.js
  77. 7 6
      frontend/saas-web/app/view/core/form/field/DetailGridField.js
  78. 1 9
      frontend/saas-web/app/view/core/query/QueryFormPanel.js
  79. 47 63
      frontend/saas-web/app/view/core/query/QueryGridPanel.js
  80. 2 3
      frontend/saas-web/app/view/core/query/QueryPanel.js
  81. 3 4
      frontend/saas-web/app/view/core/query/QueryPanelController.js
  82. 2 6
      frontend/saas-web/app/view/main/MainController.js
  83. 21 5
      frontend/saas-web/app/view/main/MainModel.js
  84. 137 0
      frontend/saas-web/app/view/purchase/purchase/FormController.js
  85. 5 0
      frontend/saas-web/app/view/purchase/purchase/FormModel.js
  86. 241 0
      frontend/saas-web/app/view/purchase/purchase/FormPanel.js
  87. 249 0
      frontend/saas-web/app/view/purchase/purchase/QueryPanel.js
  88. 5 0
      frontend/saas-web/app/view/purchase/purchase/QueryPanelController.js
  89. 9 0
      frontend/saas-web/app/view/purchase/purchase/QueryPanelModel.js
  90. 137 0
      frontend/saas-web/app/view/purchase/purchaseIn/FormController.js
  91. 7 0
      frontend/saas-web/app/view/purchase/purchaseIn/FormModel.js
  92. 275 0
      frontend/saas-web/app/view/purchase/purchaseIn/FormPanel.js
  93. 256 0
      frontend/saas-web/app/view/purchase/purchaseIn/QueryPanel.js
  94. 5 0
      frontend/saas-web/app/view/purchase/purchaseIn/QueryPanelController.js
  95. 9 0
      frontend/saas-web/app/view/purchase/purchaseIn/QueryPanelModel.js
  96. 1 0
      frontend/saas-web/app/view/test/order/FormModel.js
  97. 32 28
      frontend/saas-web/app/view/test/order/FormPanel.js
  98. 65 10
      frontend/saas-web/app/view/test/query/QueryPanel.js
  99. 12 2
      frontend/saas-web/app/view/test/query/QueryPanelModel.js
  100. 6 0
      frontend/saas-web/ext/build/ext-all-rtl-debug.js

+ 4 - 1
README.md

@@ -4,8 +4,11 @@
 ├─saas-platform
 │  │  
 │  ├─applications-----------------------------业务应用
-│  |  ├─common-dto----------------------------基础传输对象
+│  |  ├─commons-------------------------------业务通用
 │  |  ├─document------------------------------基础资料
+│  |  |  |─document-api-----------------------基础资料api
+│  |  |  |─document-dto-----------------------基础资料数据传输对象
+│  |  |  |─document-server--------------------基础资料服务
 │  |  ├─money---------------------------------资金
 │  |  ├─purchase------------------------------采购
 │  |  |  |─purchase-api-----------------------采购服务api

+ 8 - 2
applications/common-dto/pom.xml → applications/commons/pom.xml

@@ -9,7 +9,13 @@
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
-    <artifactId>common-dto</artifactId>
-    <description>common data transfer object</description>
+    <artifactId>commons</artifactId>
+    <dependencies>
+        <dependency>
+            <groupId>com.usoftchina.saas</groupId>
+            <artifactId>core</artifactId>
+        </dependency>
+    </dependencies>
+
 
 </project>

+ 2 - 1
applications/common-dto/src/main/java/com/usoftchina/saas/common/dto/BatchDealBaseDTO.java → applications/commons/src/main/java/com/usoftchina/saas/common/dto/BatchDealBaseDTO.java

@@ -1,5 +1,6 @@
 package com.usoftchina.saas.common.dto;
 
+import java.io.Serializable;
 import java.util.List;
 
 /**
@@ -7,7 +8,7 @@ import java.util.List;
  * @author: guq
  * @create: 2018-10-15 13:46
  **/
-public class BatchDealBaseDTO {
+public class BatchDealBaseDTO implements Serializable{
     private List<DocBaseDTO> baseDTOs;
 
     public List<DocBaseDTO> getBaseDTOs() {

+ 0 - 0
applications/common-dto/src/main/java/com/usoftchina/saas/common/dto/ComboDTO.java → applications/commons/src/main/java/com/usoftchina/saas/common/dto/ComboDTO.java


+ 0 - 0
applications/common-dto/src/main/java/com/usoftchina/saas/common/dto/DocBaseDTO.java → applications/commons/src/main/java/com/usoftchina/saas/common/dto/DocBaseDTO.java


+ 0 - 0
applications/common-dto/src/main/java/com/usoftchina/saas/common/dto/DocReqDTO.java → applications/commons/src/main/java/com/usoftchina/saas/common/dto/DocReqDTO.java


+ 0 - 0
applications/common-dto/src/main/java/com/usoftchina/saas/common/dto/DocSavedDTO.java → applications/commons/src/main/java/com/usoftchina/saas/common/dto/DocSavedDTO.java


+ 0 - 0
applications/common-dto/src/main/java/com/usoftchina/saas/common/dto/ProductBaseDTO.java → applications/commons/src/main/java/com/usoftchina/saas/common/dto/ProductBaseDTO.java


+ 4 - 0
applications/document/document-dto/pom.xml

@@ -18,6 +18,10 @@
             <artifactId>springfox-swagger2</artifactId>
             <scope>compile</scope>
         </dependency>
+        <dependency>
+            <groupId>com.usoftchina.saas</groupId>
+            <artifactId>core</artifactId>
+        </dependency>
     </dependencies>
 
 </project>

+ 6 - 6
applications/document/document-dto/src/main/java/com.usoftchina.saas.document.dto/ProductDTO.java

@@ -4,7 +4,7 @@ import java.io.Serializable;
 
 public class ProductDTO implements Serializable {
 
-    private long pr_id;
+    private long id;
     private String pr_code;
     private String pr_detail;
     private String pr_spec;
@@ -20,12 +20,12 @@ public class ProductDTO implements Serializable {
         this.pr_unit = pr_unit;
     }
 
-    public long getPr_id() {
-        return pr_id;
+    public long getId() {
+        return id;
     }
 
-    public void setPr_id(long pr_id) {
-        this.pr_id = pr_id;
+    public void setId(long id) {
+        this.id = id;
     }
 
     public String getPr_code() {
@@ -71,7 +71,7 @@ public class ProductDTO implements Serializable {
     @Override
     public String toString() {
         return "ProductDTO{" +
-                "pr_id='" + pr_id + '\'' +
+                "pr_id='" + id + '\'' +
                 ", pr_code='" + pr_code + '\'' +
                 ", pr_detail='" + pr_detail + '\'' +
                 ", pr_spec='" + pr_spec + '\'' +

+ 1 - 10
applications/document/document-server/src/main/java/com/usoftchina/saas/document/po/Product.java → applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/Product.java

@@ -1,4 +1,4 @@
-package com.usoftchina.saas.document.po;
+package com.usoftchina.saas.document.entities;
 
 
 import com.usoftchina.saas.base.entity.CommonBaseEntity;
@@ -8,7 +8,6 @@ import java.util.Date;
 
 public class Product extends CommonBaseEntity implements Serializable {
 
-    private long pr_id;
     private String pr_code;
     private String pr_detail;
     private String pr_spec;
@@ -37,14 +36,6 @@ public class Product extends CommonBaseEntity implements Serializable {
     private String pr_text3;
     private String pr_text4;
 
-    public long getPr_id() {
-        return pr_id;
-    }
-
-    public void setPr_id(long pr_id) {
-        this.pr_id = pr_id;
-    }
-
     public String getPr_code() {
         return pr_code;
     }

+ 1 - 13
applications/document/document-server/src/main/java/com/usoftchina/saas/document/po/Vendor.java → applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/Vendor.java

@@ -1,4 +1,4 @@
-package com.usoftchina.saas.document.po;
+package com.usoftchina.saas.document.entities;
 
 import com.usoftchina.saas.base.entity.CommonBaseEntity;
 
@@ -12,10 +12,6 @@ import java.util.Date;
  */
 public class Vendor extends CommonBaseEntity implements Serializable{
 
-    /**
-     * 供应商ID
-     */
-    private long ve_id;
     /**
      * 供应商编号
      */
@@ -105,14 +101,6 @@ public class Vendor extends CommonBaseEntity implements Serializable{
      */
     private String ve_text5;
 
-    public long getVe_id() {
-        return ve_id;
-    }
-
-    public void setVe_id(long ve_id) {
-        this.ve_id = ve_id;
-    }
-
     public String getVe_code() {
         return ve_code;
     }

+ 1 - 10
applications/document/document-server/src/main/java/com/usoftchina/saas/document/po/Warehouse.java → applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/Warehouse.java

@@ -1,4 +1,4 @@
-package com.usoftchina.saas.document.po;
+package com.usoftchina.saas.document.entities;
 
 import com.usoftchina.saas.base.entity.CommonBaseEntity;
 
@@ -12,7 +12,6 @@ import java.util.Date;
  */
 public class Warehouse extends CommonBaseEntity implements Serializable {
 
-    private long wh_id;
     private String wh_code;
     private String wh_type;
     private String wh_description;
@@ -30,14 +29,6 @@ public class Warehouse extends CommonBaseEntity implements Serializable {
     private String wh_text4;
     private String wh_text5;
 
-    public long getWh_id() {
-        return wh_id;
-    }
-
-    public void setWh_id(long wh_id) {
-        this.wh_id = wh_id;
-    }
-
     public String getWh_code() {
         return wh_code;
     }

+ 3 - 12
applications/document/document-server/pom.xml

@@ -13,21 +13,13 @@
     <description>document server</description>
 
     <dependencies>
-        <dependency>
-            <groupId>com.usoftchina.saas</groupId>
-            <artifactId>core</artifactId>
-        </dependency>
         <dependency>
             <groupId>com.usoftchina.saas</groupId>
             <artifactId>auth-client</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.springframework.cloud</groupId>
-            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-actuator</artifactId>
+            <groupId>com.usoftchina.saas</groupId>
+            <artifactId>server-starter</artifactId>
         </dependency>
         <!-- db -->
         <dependency>
@@ -64,11 +56,10 @@
         <dependency>
             <groupId>com.usoftchina.saas</groupId>
             <artifactId>document-dto</artifactId>
-            <version>1.0.0-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>com.usoftchina.saas</groupId>
-            <artifactId>common-dto</artifactId>
+            <artifactId>commons</artifactId>
         </dependency>
     </dependencies>
 

+ 6 - 0
applications/document/document-server/src/main/docker/Dockerfile

@@ -0,0 +1,6 @@
+FROM frolvlad/alpine-oraclejdk8:slim
+VOLUME /tmp
+ADD document-server-1.0.0-SNAPSHOT.jar app.jar
+RUN sh -c 'touch /app.jar'
+ENV JAVA_OPTS=""
+ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /app.jar" ]

+ 8 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/controller/ProductController.java

@@ -1,9 +1,11 @@
 package com.usoftchina.saas.document.controller;
 
 import com.usoftchina.saas.base.Result;
+
 import com.usoftchina.saas.common.dto.ComboDTO;
 import com.usoftchina.saas.common.dto.DocReqDTO;
 import com.usoftchina.saas.document.dto.ProductDTO;
+import com.usoftchina.saas.document.entities.Product;
 import com.usoftchina.saas.document.service.ProductService;
 import com.usoftchina.saas.page.PageRequest;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -35,4 +37,10 @@ public class ProductController {
         productService.updateLatestPurchasePrice(pu_id);
     }
 
+
+    @RequestMapping("/getProductsByPK")
+    public Product getProductsByPK(@RequestParam(value = "pr_id") Long id) {
+        return productService.getProductsByPK(id);
+    }
+
 }

+ 0 - 1
applications/document/document-server/src/main/java/com/usoftchina/saas/document/controller/VendorController.java

@@ -8,7 +8,6 @@ import com.usoftchina.saas.page.PageRequest;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.CrossOrigin;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.List;

+ 1 - 1
applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/ProductMapper.java

@@ -3,7 +3,7 @@ package com.usoftchina.saas.document.mapper;
 import com.usoftchina.saas.base.mapper.CommonBaseMapper;
 import com.usoftchina.saas.common.dto.ComboDTO;
 import com.usoftchina.saas.common.dto.DocReqDTO;
-import com.usoftchina.saas.document.po.Product;
+import com.usoftchina.saas.document.entities.Product;
 
 import java.util.List;
 

+ 2 - 1
applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/VendorMapper.java

@@ -1,8 +1,9 @@
 package com.usoftchina.saas.document.mapper;
 
 import com.usoftchina.saas.base.mapper.CommonBaseMapper;
+
 import com.usoftchina.saas.common.dto.DocReqDTO;
-import com.usoftchina.saas.document.po.Vendor;
+import com.usoftchina.saas.document.entities.Vendor;
 
 import java.util.List;
 

+ 1 - 1
applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/WarehouseMapper.java

@@ -1,7 +1,7 @@
 package com.usoftchina.saas.document.mapper;
 
 import com.usoftchina.saas.base.mapper.CommonBaseMapper;
-import com.usoftchina.saas.document.po.Warehouse;
+import com.usoftchina.saas.document.entities.Warehouse;
 
 import java.util.Map;
 

+ 10 - 1
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/Impl/ProductServiceImpl.java

@@ -3,11 +3,12 @@ package com.usoftchina.saas.document.service.Impl;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
+
 import com.usoftchina.saas.common.dto.ComboDTO;
 import com.usoftchina.saas.common.dto.DocReqDTO;
 import com.usoftchina.saas.document.dto.ProductDTO;
+import com.usoftchina.saas.document.entities.Product;
 import com.usoftchina.saas.document.mapper.ProductMapper;
-import com.usoftchina.saas.document.po.Product;
 import com.usoftchina.saas.document.service.ProductService;
 import com.usoftchina.saas.page.PageRequest;
 import com.usoftchina.saas.utils.BeanMapper;
@@ -48,4 +49,12 @@ public class ProductServiceImpl extends CommonBaseServiceImpl<ProductMapper, Pro
     public void updateLatestPurchasePrice(Long pu_id) {
         productMapper.updateLatestPurchasePrice(pu_id);
     }
+
+    @Override
+    public Product getProductsByPK(Long id) {
+        if (null == id) {
+            return productMapper.selectByPrimaryKey(id);
+        }
+        return null;
+    }
 }

+ 2 - 1
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/Impl/VendorServiceImpl.java

@@ -5,8 +5,9 @@ import com.github.pagehelper.PageInfo;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
 import com.usoftchina.saas.common.dto.DocReqDTO;
 import com.usoftchina.saas.document.dto.VendorDTO;
+import com.usoftchina.saas.document.entities.Vendor;
 import com.usoftchina.saas.document.mapper.VendorMapper;
-import com.usoftchina.saas.document.po.Vendor;
+
 import com.usoftchina.saas.document.service.VendorService;
 import com.usoftchina.saas.page.PageRequest;
 import com.usoftchina.saas.utils.BeanMapper;

+ 2 - 1
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/Impl/WarehouseServiceImpl.java

@@ -1,8 +1,9 @@
 package com.usoftchina.saas.document.service.Impl;
 
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
+import com.usoftchina.saas.document.entities.Warehouse;
 import com.usoftchina.saas.document.mapper.WarehouseMapper;
-import com.usoftchina.saas.document.po.Warehouse;
+
 import com.usoftchina.saas.document.service.WarehouseService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;

+ 5 - 1
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/ProductService.java

@@ -1,11 +1,13 @@
 package com.usoftchina.saas.document.service;
 
 import com.usoftchina.saas.base.service.CommonBaseService;
+
 import com.usoftchina.saas.common.dto.ComboDTO;
 import com.usoftchina.saas.common.dto.DocReqDTO;
 import com.usoftchina.saas.document.dto.ProductDTO;
+import com.usoftchina.saas.document.entities.Product;
 import com.usoftchina.saas.document.mapper.ProductMapper;
-import com.usoftchina.saas.document.po.Product;
+
 import com.usoftchina.saas.page.PageRequest;
 
 import java.util.List;
@@ -18,4 +20,6 @@ public interface ProductService extends CommonBaseService<ProductMapper, Product
     List<ComboDTO> getProdUnit();
 
     void updateLatestPurchasePrice(Long pu_id);
+
+    Product getProductsByPK(Long id);
 }

+ 3 - 1
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/VendorService.java

@@ -1,10 +1,12 @@
 package com.usoftchina.saas.document.service;
 
 import com.usoftchina.saas.base.service.CommonBaseService;
+
 import com.usoftchina.saas.common.dto.DocReqDTO;
 import com.usoftchina.saas.document.dto.VendorDTO;
+import com.usoftchina.saas.document.entities.Vendor;
 import com.usoftchina.saas.document.mapper.VendorMapper;
-import com.usoftchina.saas.document.po.Vendor;
+
 import com.usoftchina.saas.page.PageRequest;
 
 import java.util.List;

+ 2 - 1
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/WarehouseService.java

@@ -1,8 +1,9 @@
 package com.usoftchina.saas.document.service;
 
 import com.usoftchina.saas.base.service.CommonBaseService;
+import com.usoftchina.saas.document.entities.Warehouse;
 import com.usoftchina.saas.document.mapper.WarehouseMapper;
-import com.usoftchina.saas.document.po.Warehouse;
+
 
 import java.util.Map;
 

+ 14 - 0
applications/document/document-server/src/main/resources/application.yml

@@ -18,6 +18,20 @@ spring:
       connection-timeout: 30000
   messages:
     basename: i18n/messages
+  rabbitmq:
+    host: 192.168.0.176
+    port: 5672
+    password: guest
+    username: guest
+  zipkin:
+    sender:
+      type: rabbit
+    locator:
+      discovery:
+        enabled: true
+  sleuth:
+    sampler:
+      probability: 1.0
 eureka:
   instance:
     leaseRenewalIntervalInSeconds: 10

+ 6 - 2
applications/document/document-server/src/main/resources/mapper/ProductMapper.xml

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
 <mapper namespace="com.usoftchina.saas.document.mapper.ProductMapper">
-    <resultMap id="ProductResultMapper" type="com.usoftchina.saas.document.po.Product">
-        <id column="pr_id" property="pr_id" jdbcType="INTEGER" />
+    <resultMap id="ProductResultMapper" type="com.usoftchina.saas.document.entities.Product">
+        <id column="pr_id" property="id" jdbcType="INTEGER" />
         <result column="pr_code" property="pr_code" jdbcType="VARCHAR" />
         <result column="pr_detail" property="pr_detail" jdbcType="VARCHAR" />
         <result column="pr_spec" property="pr_spec" jdbcType="VARCHAR" />
@@ -45,6 +45,10 @@
         </where>
     </select>
 
+    <select id="selectByPrimaryKey" resultMap="ProductResultMapper" parameterType="long">
+        SELECT * FROM PRODUCT where pr_id = #{pr_id}
+    </select>
+
     <select id="getProdUnit" resultType="com.usoftchina.saas.common.dto.ComboDTO">
         SELECT PR_UNIT as display, pr_unit as value FROM PRODUCT
     </select>

+ 2 - 2
applications/document/document-server/src/main/resources/mapper/VendorMapper.xml

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
 <mapper namespace="com.usoftchina.saas.document.mapper.VendorMapper">
-    <resultMap id="VendorResultMapper" type="com.usoftchina.saas.document.po.Vendor">
-        <id column="ve_id" property="ve_id" jdbcType="INTEGER" />
+    <resultMap id="VendorResultMapper" type="com.usoftchina.saas.document.entities.Vendor">
+        <id column="ve_id" property="id" jdbcType="INTEGER" />
         <result column="ve_code" property="ve_code" jdbcType="VARCHAR" />
         <result column="ve_uu" property="ve_uu" jdbcType="VARCHAR" />
         <result column="ve_name" property="ve_name" jdbcType="VARCHAR" />

+ 2 - 2
applications/document/document-server/src/main/resources/mapper/WarehouseMapper.xml

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
 <mapper namespace="com.usoftchina.saas.document.mapper.WarehouseMapper">
-    <resultMap id="WarehouseResultMapper" type="com.usoftchina.saas.document.po.Warehouse">
-        <id column="wh_id" property="wh_id" jdbcType="INTEGER" />
+    <resultMap id="WarehouseResultMapper" type="com.usoftchina.saas.document.entities.Warehouse">
+        <id column="wh_id" property="id" jdbcType="INTEGER" />
         <result column="wh_code" property="wh_code" jdbcType="VARCHAR" />
         <result column="wh_type" property="wh_type" jdbcType="VARCHAR" />
         <result column="wh_description" property="wh_description" jdbcType="VARCHAR" />

+ 0 - 2
applications/document/document-server/src/test/java/com/usoftchina/saas/document/service/VendorTest.java

@@ -3,8 +3,6 @@ package com.usoftchina.saas.document.service;
 
 import com.usoftchina.saas.document.DocumentApplication;
 import com.usoftchina.saas.document.dto.VendorDTO;
-import com.usoftchina.saas.document.po.Vendor;
-import com.usoftchina.saas.page.PageRequest;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Autowired;

+ 1 - 1
applications/pom.xml

@@ -18,7 +18,7 @@
         <module>storage</module>
         <module>money</module>
         <module>document</module>
-        <module>common-dto</module>
+        <module>commons</module>
     </modules>
 
 

+ 5 - 1
applications/purchase/purchase-dto/pom.xml

@@ -15,7 +15,7 @@
     <dependencies>
         <dependency>
             <groupId>com.usoftchina.saas</groupId>
-            <artifactId>common-dto</artifactId>
+            <artifactId>commons</artifactId>
         </dependency>
         <dependency>
             <groupId>io.springfox</groupId>
@@ -26,5 +26,9 @@
             <groupId>org.projectlombok</groupId>
             <artifactId>lombok</artifactId>
         </dependency>
+        <dependency>
+            <groupId>com.usoftchina.saas</groupId>
+            <artifactId>document-dto</artifactId>
+        </dependency>
     </dependencies>
 </project>

+ 0 - 2
applications/purchase/purchase-dto/src/main/java/com/usoftchina/saas/purchase/dto/PurchaseDTO.java

@@ -1,8 +1,6 @@
 package com.usoftchina.saas.purchase.dto;
 
-import com.usoftchina.saas.common.dto.DocBaseDTO;
 import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.io.Serializable;

+ 3 - 2
applications/purchase/purchase-dto/src/main/java/com/usoftchina/saas/purchase/dto/PurchaseItemDTO.java

@@ -1,7 +1,6 @@
 package com.usoftchina.saas.purchase.dto;
 
-import com.usoftchina.saas.common.dto.DocBaseDTO;
-import com.usoftchina.saas.common.dto.ProductBaseDTO;
+import com.usoftchina.saas.document.entities.Product;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -71,4 +70,6 @@ public class PurchaseItemDTO implements Serializable{
 
     private Double pd_yqty;
 
+    private Product product;
+
 }

+ 0 - 1
applications/purchase/purchase-dto/src/main/java/com/usoftchina/saas/purchase/dto/PurchaseListDTO.java

@@ -3,7 +3,6 @@ package com.usoftchina.saas.purchase.dto;
 import lombok.Data;
 
 import java.io.Serializable;
-import java.math.BigDecimal;
 import java.util.Date;
 
 /**

+ 4 - 2
applications/purchase/purchase-server/pom.xml

@@ -20,7 +20,6 @@
         <dependency>
             <groupId>com.usoftchina.saas</groupId>
             <artifactId>document-api</artifactId>
-            <version>1.0.0-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>com.usoftchina.saas</groupId>
@@ -51,7 +50,6 @@
         <dependency>
             <groupId>org.projectlombok</groupId>
             <artifactId>lombok</artifactId>
-            <version>1.16.10</version>
         </dependency>
         <dependency>
             <groupId>com.github.pagehelper</groupId>
@@ -62,6 +60,10 @@
             <groupId>org.springframework.cloud</groupId>
             <artifactId>spring-cloud-starter-openfeign</artifactId>
         </dependency>
+        <dependency>
+            <groupId>com.usoftchina.saas</groupId>
+            <artifactId>commons</artifactId>
+        </dependency>
     </dependencies>
 
     <build>

+ 3 - 3
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/controller/PurchaseController.java

@@ -56,7 +56,7 @@ public class PurchaseController {
      * @return
      */
     @PostMapping("/save")
-    public Result<Long> saveFormData(@RequestBody PurchaseFormDTO data) {
+    public Result<DocSavedDTO> saveFormData(@RequestBody PurchaseFormDTO data) {
         DocSavedDTO savedDTO = purchaseService.saveFormData(data);
         return Result.success(savedDTO);
 
@@ -94,8 +94,8 @@ public class PurchaseController {
      */
     @PostMapping("/audit")
     public Result audit(@RequestBody PurchaseFormDTO formData) {
-        Long id = purchaseService.audit(formData);
-        return Result.success(id);
+        DocSavedDTO audit = purchaseService.audit(formData);
+        return Result.success(audit);
     }
 
     /**

+ 4 - 1
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/po/PurchaseItem.java

@@ -1,6 +1,8 @@
 package com.usoftchina.saas.purchase.po;
 
 import com.usoftchina.saas.base.entity.CommonBaseEntity;
+
+import com.usoftchina.saas.document.entities.Product;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -14,7 +16,7 @@ public class PurchaseItem extends CommonBaseEntity implements Serializable {
 
     private Integer pd_detno;
 
-    private Integer pd_prodid;
+    private Long pd_prodid;
 
     private String pd_prodcode;
 
@@ -50,4 +52,5 @@ public class PurchaseItem extends CommonBaseEntity implements Serializable {
 
     private Double pd_yqty;
 
+    private Product product;
 }

+ 2 - 3
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/PurchaseService.java

@@ -2,6 +2,7 @@ package com.usoftchina.saas.purchase.service;
 
 import com.github.pagehelper.PageInfo;
 import com.usoftchina.saas.base.service.CommonBaseService;
+
 import com.usoftchina.saas.common.dto.BatchDealBaseDTO;
 import com.usoftchina.saas.common.dto.DocSavedDTO;
 import com.usoftchina.saas.page.PageRequest;
@@ -11,8 +12,6 @@ import com.usoftchina.saas.purchase.mapper.PurchaseMapper;
 import com.usoftchina.saas.purchase.po.Purchase;
 import com.usoftchina.saas.purchase.po.PurchaseList;
 
-import java.util.List;
-
 /**
  * @author yingp
  * @date 2018/10/9
@@ -72,7 +71,7 @@ public interface PurchaseService extends CommonBaseService<PurchaseMapper, Purch
      * @param formData
      * @return
      */
-    Long audit(PurchaseFormDTO formData);
+    DocSavedDTO audit(PurchaseFormDTO formData);
 
     /**
     * @Description 批量审核

+ 16 - 17
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/PurchaseServiceImpl.java

@@ -18,9 +18,10 @@ import com.usoftchina.saas.purchase.po.*;
 import com.usoftchina.saas.purchase.service.PurchaseService;
 import com.usoftchina.saas.utils.BeanMapper;
 
-import com.usoftchina.saas.utils.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
 import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
 
 import java.util.ArrayList;
 import java.util.Date;
@@ -64,15 +65,11 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
         PurchaseFormDTO purchaseFormDTO = new PurchaseFormDTO();
         //查询主表信息
         Purchase purchase = getMapper().selectByPrimaryKey(id);
-        //查询从表
-        List<PurchaseItem> purchaseItems = purchasedetailMapper.selectByFK(id);
         //将purchase实体对象转化成传输对象
         PurchaseDTO main = BeanMapper.map(purchase, PurchaseDTO.class);
-        List<PurchaseItemDTO> items = new ArrayList<>();
-        //添加从表传输对象
-        for (PurchaseItem detail : purchaseItems) {
-            items.add(BeanMapper.map(detail, PurchaseItemDTO.class));
-        }
+        //查询从表
+        List<PurchaseItem> purchaseItems = purchasedetailMapper.selectByFK(id);
+        List<PurchaseItemDTO> items = BeanMapper.mapList(purchaseItems, PurchaseItemDTO.class);
         purchaseFormDTO.setMain(main);
         purchaseFormDTO.setItems(items);
         return  purchaseFormDTO;
@@ -97,21 +94,21 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
         Purchase purchase = BeanMapper.map(main, Purchase.class);
 
         //编号获取
-        if (!StringUtils.hasText(pu_code)) {
+        if (StringUtils.isEmpty(pu_code)) {
             pu_code = "PU" + Math.random() * 1000;
             purchase.setPu_code(pu_code);
         }
         saveDTO.setCode(pu_code);
         //判断更新与保存动作
-        if (StringUtils.hasText(pu_id)) {
+        if (!StringUtils.isEmpty(pu_id)) {
             //更新主表
-            purchaseMapper.updateByPrimaryKey(purchase);
+            purchaseMapper.updateByPrimaryKeySelective(purchase);
             //添加从表传输对象
             for (PurchaseItemDTO item : items) {
                 PurchaseItem detail = BeanMapper.map(item, PurchaseItem.class);
                 detail.setPd_puid(pu_id);
                 detail.setPd_code(pu_code);
-                if (StringUtils.hasText(detail.getId())) {
+                if (!StringUtils.isEmpty(detail.getId())) {
                     updateDetails.add(detail);
                 } else {
                     insertDetails.add(detail);
@@ -158,17 +155,19 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
     }
 
     @Override
-    public Long audit(PurchaseFormDTO formData) {
+    public DocSavedDTO audit(PurchaseFormDTO formData) {
         Long id = null;
+        DocSavedDTO savedDTO = new DocSavedDTO();
         if (null != formData) {
             id = formData.getMain().getId();
-            if (!StringUtils.hasText(id)) {
+            if (StringUtils.isEmpty(id)) {
                 DocSavedDTO saveDTO = saveFormData(formData);
                 id = saveDTO.getId();
             }
             singleAudit(id);
         }
-        return id;
+        savedDTO.setId(id);
+        return savedDTO;
     }
 
     @Override
@@ -177,7 +176,7 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
                 baseDTOs.getBaseDTOs().size() == 0)
             return;
         String validate = purchaseMapper.validateAudit(baseDTOs.getBaseDTOs());
-        if (StringUtils.hasText(validate)) {
+        if (!StringUtils.isEmpty(validate)) {
             throw new BizException(500, "存在已审核单据,单据编号:" + validate);
         }
         for (DocBaseDTO base : baseDTOs.getBaseDTOs()) {
@@ -219,7 +218,7 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
 
     private List<PurchaseList> getListByMode(PurchaseReqDTO req) {
         List<PurchaseList> list = null;
-        if (null == req || !StringUtils.hasText(req.getMode()) || "Main".equals(req.getMode())) {
+        if (null == req || StringUtils.isEmpty(req.getMode()) || "Main".equals(req.getMode())) {
             list = purchaseListMapper.selectPurchaseBycondition(req);
         } else {
             list = purchaseListMapper.selectPurchaseListByCondition(req);

+ 14 - 0
applications/purchase/purchase-server/src/main/resources/application.yml

@@ -18,6 +18,20 @@ spring:
       connection-timeout: 30000
   messages:
     basename: i18n/messages
+  rabbitmq:
+    host: 192.168.0.176
+    port: 5672
+    password: guest
+    username: guest
+  zipkin:
+    sender:
+      type: rabbit
+    locator:
+      discovery:
+        enabled: true
+  sleuth:
+    sampler:
+      probability: 1.0
 eureka:
   instance:
     leaseRenewalIntervalInSeconds: 10

+ 1 - 1
applications/purchase/purchase-server/src/main/resources/mapper/PurchaseMapper.xml

@@ -392,7 +392,7 @@
     where pu_id = #{id,jdbcType=INTEGER}
   </update>
   <select id="validateAudit" parameterType="com.usoftchina.saas.common.dto.DocBaseDTO" resultType="java.lang.String">
-    select wm_concat(pu_code) from purchase where pu_statuscode='AUDITED' and pu_id in
+    select GROUP_CONCAT(pu_code) from purchase where pu_statuscode='AUDITED' and pu_id in
     <foreach collection="list" item="item" open="(" close=")" separator=",">
       #{item.id}
     </foreach>

+ 32 - 1
applications/purchase/purchase-server/src/main/resources/mapper/PurchasedetailMapper.xml

@@ -27,6 +27,36 @@
     <result column="pd_text4" property="pd_text4" jdbcType="VARCHAR" />
     <result column="pd_text5" property="pd_text5" jdbcType="VARCHAR" />
     <result column="pd_yqty" property="pd_yqty" jdbcType="DOUBLE" />
+    <association property="product" javaType="com.usoftchina.saas.document.entities.Product">
+      <id column="pr_id" property="id"/>
+      <result column="pr_code" property="pr_code"/>
+      <result column="pr_detail" property="pr_detail"/>
+      <result column="pr_spec" property="pr_spec"/>
+      <result column="pr_unit" property="pr_unit"/>
+      <result column="pr_kind" property="pr_kind"/>
+      <result column="pr_orispeccode" property="pr_orispeccode"/>
+      <result column="pr_whid" property="pr_whid"/>
+      <result column="pr_whcode" property="pr_whcode"/>
+      <result column="pr_whname" property="pr_whname"/>
+      <result column="pr_zxbzs" property="pr_zxbzs"/>
+      <result column="pr_leadtime" property="pr_leadtime"/>
+      <result column="pr_brand" property="pr_brand"/>
+      <result column="pr_standardprice" property="pr_standardprice"/>
+      <result column="pr_purcprice" property="pr_purcprice"/>
+      <result column="pr_saleprice" property="pr_saleprice"/>
+      <result column="pr_vendid" property="pr_vendid"/>
+      <result column="pr_vendname" property="pr_vendname"/>
+      <result column="pr_vendcode" property="pr_vendcode"/>
+      <result column="pr_docdate" property="pr_docdate"/>
+      <result column="pr_recordmanid" property="pr_recordmanid"/>
+      <result column="pr_recordman" property="pr_recordman"/>
+      <result column="pr_status" property="pr_status"/>
+      <result column="pr_statuscode" property="pr_statuscode"/>
+      <result column="pr_text1" property="pr_text1"/>
+      <result column="pr_text2" property="pr_text2"/>
+      <result column="pr_text3" property="pr_text3"/>
+      <result column="pr_text4" property="pr_text4"/>
+    </association>
   </resultMap>
   <sql id="Base_Column_List" >
     PD_ID, PD_PUID, PD_CODE, PD_DETNO, PD_PRODID, PD_PRODCODE, PD_UNIT, PD_QTY, PD_PRICE,
@@ -381,6 +411,7 @@
     delete from purchasedetail where pd_puid=#{id}
   </delete>
   <select id="selectByFK" parameterType="long" resultMap="BaseResultMap">
-    select * from purchasedetail where pd_puid=#{pu_id}
+    select * from purchasedetail a left join product b on pr_id=pd_prodid and a.companyid = b.companyid
+      where pd_puid=#{pu_id}
   </select>
 </mapper>

+ 18 - 3
base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/mapper/RoleResourceMapper.java

@@ -1,11 +1,26 @@
 package com.usoftchina.saas.account.mapper;
 
-import com.usoftchina.saas.account.po.RoleResource;
-import com.usoftchina.saas.base.mapper.CommonBaseMapper;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * @author yingp
  * @date 2018/10/2
  */
-public interface RoleResourceMapper extends CommonBaseMapper<RoleResource> {
+public interface RoleResourceMapper {
+    /**
+     * 新增
+     *
+     * @param roleId
+     * @param resourceId
+     * @return
+     */
+    int insert(@Param("roleId") Long roleId, @Param("resourceId") Long resourceId);
+
+    /**
+     * 删除
+     *
+     * @param roleId
+     * @param resourceId
+     */
+    void delete(@Param("roleId") Long roleId, @Param("resourceId") Long resourceId);
 }

+ 1 - 3
base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/po/RoleResource.java

@@ -1,7 +1,5 @@
 package com.usoftchina.saas.account.po;
 
-import com.usoftchina.saas.base.entity.CommonBaseEntity;
-
 import java.io.Serializable;
 
 /**
@@ -10,7 +8,7 @@ import java.io.Serializable;
  * @author yingp
  * @date 2018/10/2
  */
-public class RoleResource extends CommonBaseEntity implements Serializable {
+public class RoleResource implements Serializable {
     private long roleId;
     private long resourceId;
 

+ 6 - 0
base-servers/account/account-server/src/main/resources/mapper/RoleResourceMapper.xml

@@ -1,4 +1,10 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
 <mapper namespace="com.usoftchina.saas.account.mapper.RoleResourceMapper">
+    <insert id="insert">
+        insert into ac_role_resource(role_id,resource_id) values (#{roleId}, #{resourceId})
+    </insert>
+    <delete id="delete">
+        delete from ac_role_resource where role_id=#{roleId} and resource_id=#{resourceId}
+    </delete>
 </mapper>

+ 16 - 12
base-servers/gateway-server/pom.xml

@@ -11,14 +11,23 @@
 
     <artifactId>gateway-server</artifactId>
     <description>gateway server</description>
-    <properties>
-        <ratelimit.version>2.1.0.RELEASE</ratelimit.version>
-    </properties>
 
     <dependencies>
         <dependency>
-            <groupId>com.usoftchina.saas</groupId>
-            <artifactId>server-starter</artifactId>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-actuator</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-webflux</artifactId>
         </dependency>
         <!--<dependency>
             <groupId>org.springframework.boot</groupId>
@@ -33,24 +42,19 @@
             <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
         </dependency>
         <!-- rate limit -->
-        <!--<dependency>
-            <groupId>com.marcosbarbero.cloud</groupId>
-            <artifactId>spring-cloud-zuul-ratelimit</artifactId>
-            <version>${ratelimit.version}</version>
-        </dependency>-->
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-data-redis</artifactId>
         </dependency>
         <!-- sleuth -->
-        <!--<dependency>
+        <dependency>
             <groupId>org.springframework.cloud</groupId>
             <artifactId>spring-cloud-starter-zipkin</artifactId>
         </dependency>
         <dependency>
             <groupId>org.springframework.amqp</groupId>
             <artifactId>spring-rabbit</artifactId>
-        </dependency>-->
+        </dependency>
         <!-- auth -->
         <dependency>
             <groupId>com.usoftchina.saas</groupId>

+ 24 - 0
base-servers/gateway-server/src/main/java/com/usoftchina/saas/gateway/error/MyExceptionAdvice.java

@@ -0,0 +1,24 @@
+package com.usoftchina.saas.gateway.error;
+
+import com.usoftchina.saas.base.Result;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.ResponseStatus;
+import org.springframework.web.bind.annotation.RestControllerAdvice;
+
+/**
+ * @author yingp
+ * @date 2018/10/15
+ */
+@RestControllerAdvice
+public class MyExceptionAdvice {
+
+    @ExceptionHandler(Exception.class)
+    @ResponseStatus(HttpStatus.OK)
+    @ResponseBody
+    public Result serverExceptionHandler(Exception ex) {
+        return Result.throwable(ex);
+    }
+
+}

+ 6 - 3
base-servers/gateway-server/src/main/java/com/usoftchina/saas/gateway/error/MyExceptionHandler.java

@@ -76,14 +76,17 @@ public class MyExceptionHandler extends DefaultErrorWebExceptionHandler {
     }
 
     /**
-     * 根据code获取对应的HttpStatus
+     * 获取HttpStatus
      *
      * @param errorAttributes
      */
     @Override
     protected HttpStatus getHttpStatus(Map<String, Object> errorAttributes) {
-        int statusCode = (int) errorAttributes.get("code");
-        return HttpStatus.valueOf(statusCode);
+//        // 根据code获取对应的HttpStatus
+//        int statusCode = (int) errorAttributes.get("code");
+//        return HttpStatus.valueOf(statusCode);
+        // 统一返回http status: 200
+        return HttpStatus.OK;
     }
 
     /**

+ 5 - 8
base-servers/gateway-server/src/main/resources/application.yml

@@ -17,15 +17,12 @@ spring:
   zipkin:
     sender:
       type: rabbit
-    service:
-      name: ${spring.application.name}
+    locator:
+      discovery:
+        enabled: true
   sleuth:
     sampler:
-      percentage: 1
-    integration:
-      enabled: false
-    scheduled:
-      skip-pattern: "^org.*HystrixStreamTask$"
+      probability: 1.0
   cloud:
     gateway:
       discovery:
@@ -114,7 +111,7 @@ eureka:
   client:
     registryFetchIntervalSeconds: 5
     serviceUrl:
-      defaultZone: http://${spring.security.user.name}:${spring.security.user.password}@192.168.0.181:8500/eureka/
+      defaultZone: http://${spring.security.user.name}:${spring.security.user.password}@127.0.0.1:8500/eureka/
 feign:
   hystrix:
     enabled: true

+ 0 - 0
applications/document/document-server/src/main/resources/banner.txt → base-servers/gateway-server/src/main/resources/banner.txt


+ 3 - 3
base-servers/ui-server/pom.xml

@@ -27,15 +27,15 @@
             <artifactId>spring-boot-starter-data-mongodb</artifactId>
         </dependency>
         <!-- sleuth -->
-        <!--<dependency>
+        <dependency>
             <groupId>org.springframework.cloud</groupId>
             <artifactId>spring-cloud-starter-zipkin</artifactId>
         </dependency>
         <dependency>
             <groupId>org.springframework.amqp</groupId>
             <artifactId>spring-rabbit</artifactId>
-        </dependency>-->
-
+        </dependency>
+        <!-- test -->
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-test</artifactId>

+ 1 - 4
base-servers/ui-server/src/main/java/com/usoftchina/saas/ui/controller/co/CoViewController.java

@@ -5,10 +5,7 @@ import com.usoftchina.saas.context.BaseContextHolder;
 import com.usoftchina.saas.ui.service.ViewService;
 import com.usoftchina.saas.ui.service.co.CoViewService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 /**
  * @author yingp

+ 5 - 4
base-servers/ui-server/src/main/resources/application.yml

@@ -13,11 +13,12 @@ spring:
   zipkin:
     sender:
       type: rabbit
-    service:
-      name: ${spring.application.name}
+    locator:
+      discovery:
+        enabled: true
   sleuth:
     sampler:
-      percentage: 1.0
+      probability: 1.0
   data:
     mongodb:
       uri: mongodb://192.168.253.12:27017/saas_ui
@@ -37,7 +38,7 @@ eureka:
   client:
     registryFetchIntervalSeconds: 5
     serviceUrl:
-      defaultZone: http://${spring.security.user.name}:${spring.security.user.password}@192.168.0.181:8500/eureka/
+      defaultZone: http://${spring.security.user.name}:${spring.security.user.password}@127.0.0.1:8500/eureka/
 info:
   name: '@project.artifactId@'
   description: '@project.description@'

+ 1 - 1
base-servers/ui-server/src/test/java/com/usoftchina/saas/ui/test/ViewServiceTest.java

@@ -30,7 +30,7 @@ public class ViewServiceTest {
     @Autowired
     private ComponentService componentService;
 
-    private String viewName = "test.form";
+    private String viewName = "junit.test.form";
 
     @Before
     public void generateData() {

+ 5 - 0
base-servers/zipkin-server/pom.xml

@@ -46,6 +46,11 @@
             <groupId>io.zipkin.java</groupId>
             <artifactId>zipkin-autoconfigure-storage-mysql</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.jooq</groupId>
+            <artifactId>jooq</artifactId>
+            <version>3.11.4</version>
+        </dependency>
     </dependencies>
     <build>
         <plugins>

+ 2 - 2
base-servers/zipkin-server/src/main/java/com/usoftchina/saas/zipkin/ZipkinApplication.java

@@ -2,7 +2,7 @@ package com.usoftchina.saas.zipkin;
 
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
+//import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
 import zipkin2.server.internal.EnableZipkinServer;
 
 /**
@@ -11,7 +11,7 @@ import zipkin2.server.internal.EnableZipkinServer;
  */
 @EnableZipkinServer
 @SpringBootApplication
-@EnableEurekaClient
+//@EnableEurekaClient
 public class ZipkinApplication {
     public static void main(String[] args) {
         SpringApplication.run(ZipkinApplication.class, args);

+ 2 - 0
base-servers/zipkin-server/src/main/resources/application.yml

@@ -14,6 +14,7 @@ eureka:
     leaseRenewalIntervalInSeconds: 10
     health-check-url-path: /actuator/health
     status-page-url-path: /actuator/info
+    prefer-ip-address: true
     metadata-map:
       user.name: ${spring.security.user.name}
       user.password: ${spring.security.user.password}
@@ -35,6 +36,7 @@ zipkin:
       password: guest
       queue: zipkin
   storage:
+    type: mysql
     mysql:
       host: 192.168.253.12
       username: root

+ 0 - 3
base-servers/zipkin-server/src/main/resources/config/application-docker.yml

@@ -1,7 +1,4 @@
 eureka:
-  instance:
-    hostname: saas-zipkin-server
-    prefer-ip-address: false
   client:
     serviceUrl:
       defaultZone: http://${spring.security.user.name}:${spring.security.user.password}@saas-eureka-server:8500/eureka/

+ 4 - 0
framework/core/src/main/java/com/usoftchina/saas/base/Result.java

@@ -101,6 +101,10 @@ public class Result<T> implements Serializable {
 
     public static Result throwable(Throwable e) {
         Result result = error();
+        if (e instanceof BaseException) {
+            return error((BaseException) e);
+        }
+        result.setCode(500);
         result.setMessage(e.getMessage());
         return result;
     }

+ 0 - 10
framework/core/src/main/java/com/usoftchina/saas/utils/StringUtils.java

@@ -15,14 +15,4 @@ public class StringUtils {
     public static String nullIf(String target, String nullValue) {
         return (null == target || target.isEmpty()) ? nullValue : target;
     }
-
-    /**
-     * 判断参数是否为空、空字符串、空白格
-     *
-     * @param object
-     * @return
-     */
-    public static boolean hasText(Object object) {
-        return object == null ? false : org.springframework.util.StringUtils.hasText(object.toString());
-    }
 }

+ 19 - 1
framework/server-starter/src/main/java/com/usoftchina/saas/server/ServerAutoConfiguration.java

@@ -1,7 +1,14 @@
 package com.usoftchina.saas.server;
 
+import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ComponentScan;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.lang.Nullable;
+import org.springframework.web.servlet.HandlerExceptionResolver;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 
 /**
  * @author yingp
@@ -10,5 +17,16 @@ import org.springframework.context.annotation.Configuration;
 @Configuration
 @ComponentScan(basePackages = {"com.usoftchina.saas.server"})
 public class ServerAutoConfiguration {
-    
+
+    @Bean
+    public HandlerExceptionResolver handlerExceptionResolver() {
+        return new HandlerExceptionResolver(){
+            @Nullable
+            @Override
+            public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, @Nullable Object o, Exception e) {
+                System.err.println("############" + request.getRequestURI() + "#" + response.getStatus());
+                return null;
+            }
+        };
+    }
 }

+ 25 - 0
framework/server-starter/src/main/java/com/usoftchina/saas/server/error/ErrorConfig.java

@@ -0,0 +1,25 @@
+package com.usoftchina.saas.server.error;
+
+import org.springframework.boot.web.servlet.FilterRegistrationBean;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.Ordered;
+
+import javax.servlet.DispatcherType;
+
+/**
+ * @author yingp
+ * @date 2018/10/16
+ */
+@Configuration
+public class ErrorConfig {
+
+    @Bean
+    public FilterRegistrationBean<UnCaughtErrorFilter> unCaughtErrorFilter() {
+        UnCaughtErrorFilter filter = new UnCaughtErrorFilter();
+        FilterRegistrationBean<UnCaughtErrorFilter> registration = new FilterRegistrationBean<>(filter);
+        registration.setOrder(Ordered.HIGHEST_PRECEDENCE + 1);
+        registration.setDispatcherTypes(DispatcherType.REQUEST, DispatcherType.ASYNC);
+        return registration;
+    }
+}

+ 53 - 0
framework/server-starter/src/main/java/com/usoftchina/saas/server/error/GlobalExceptionHandler.java

@@ -0,0 +1,53 @@
+package com.usoftchina.saas.server.error;
+
+import com.usoftchina.saas.base.Result;
+import com.usoftchina.saas.exception.BizException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.bind.annotation.ControllerAdvice;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * @author yingp
+ * @date 2018/10/16
+ */
+@ControllerAdvice
+public class GlobalExceptionHandler {
+
+    private Logger logger = LoggerFactory.getLogger(GlobalExceptionHandler.class);
+
+    /**
+     * 默认异常处理
+     *
+     * @param request
+     * @param e
+     * @return
+     * @throws Exception
+     */
+    @ExceptionHandler(value = Exception.class)
+    @ResponseBody
+    public Result defaultHandler(HttpServletRequest request, Exception e) throws Exception{
+        String error = ServletErrorUtils.buildMessage(request, e);
+        logger.error(error, e);
+        return Result.throwable(e);
+    }
+
+    /**
+     * 业务异常
+     *
+     * @param request
+     * @param e
+     * @return
+     * @throws Exception
+     */
+    @ExceptionHandler(value = BizException.class)
+    @ResponseBody
+    public Result bizHandler(HttpServletRequest request, BizException e) throws Exception{
+        String error = ServletErrorUtils.buildMessage(request, e);
+        logger.error(error, e);
+        return Result.error(e);
+    }
+}

+ 0 - 41
framework/server-starter/src/main/java/com/usoftchina/saas/server/error/MyErrorController.java

@@ -1,41 +0,0 @@
-package com.usoftchina.saas.server.error;
-
-import org.springframework.boot.autoconfigure.web.ServerProperties;
-import org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController;
-import org.springframework.boot.web.servlet.error.DefaultErrorAttributes;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
-import org.springframework.stereotype.Controller;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author yingp
- * @date 2018/10/13
- */
-@Controller
-public class MyErrorController extends BasicErrorController {
-
-    public MyErrorController(ServerProperties serverProperties) {
-        super(new DefaultErrorAttributes(), serverProperties.getError());
-    }
-
-    /**
-     * 覆盖默认的错误响应
-     */
-    @Override
-    public ResponseEntity<Map<String, Object>> error(HttpServletRequest request) {
-        Map<String, Object> body = getErrorAttributes(request, isIncludeStackTrace(request, MediaType.ALL));
-        HttpStatus status = getStatus(request);
-        // 输出自定义格式
-        Map<String, Object> map = new HashMap<>(4);
-        map.put("success", false);
-        map.put("code", body.get("status"));
-        map.put("message", body.get("message"));
-        map.put("data", null);
-        return new ResponseEntity<>(map, status);
-    }
-}

+ 52 - 0
framework/server-starter/src/main/java/com/usoftchina/saas/server/error/ServletErrorUtils.java

@@ -0,0 +1,52 @@
+package com.usoftchina.saas.server.error;
+
+import com.usoftchina.saas.base.Result;
+import com.usoftchina.saas.utils.JsonUtils;
+import org.springframework.http.MediaType;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+/**
+ * @author yingp
+ * @date 2018/10/16
+ */
+public class ServletErrorUtils {
+    /**
+     * 构建异常信息
+     *
+     * @param request
+     * @param ex
+     * @return
+     */
+    public static String buildMessage(HttpServletRequest request, Throwable ex) {
+        StringBuilder message = new StringBuilder("Failed to handle request [");
+        message.append(request.getMethod());
+        message.append(" ");
+        message.append(request.getRequestURI());
+        message.append("]");
+        if (ex != null) {
+            message.append(": ");
+            message.append(ex.getMessage());
+        }
+        return message.toString();
+    }
+
+    /**
+     * 标准Result格式输出
+     *
+     * @param response
+     * @param e
+     * @throws IOException
+     * @throws ServletException
+     */
+    public static void writerErrorResult(HttpServletResponse response, Throwable e) throws IOException {
+        response.setContentType(MediaType.APPLICATION_JSON_UTF8_VALUE);
+        PrintWriter writer = response.getWriter();
+        writer.print(JsonUtils.toJsonString(Result.throwable(e)));
+        writer.flush();
+    }
+}

+ 36 - 0
framework/server-starter/src/main/java/com/usoftchina/saas/server/error/UnCaughtErrorFilter.java

@@ -0,0 +1,36 @@
+package com.usoftchina.saas.server.error;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.filter.OncePerRequestFilter;
+import org.springframework.web.util.NestedServletException;
+
+import javax.servlet.*;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+/**
+ * 处理过滤器里面的异常(无法通过ControllerAdvice处理的)
+ *
+ * @author yingp
+ * @date 2018/10/16
+ */
+public class UnCaughtErrorFilter extends OncePerRequestFilter {
+
+    private Logger logger = LoggerFactory.getLogger(UnCaughtErrorFilter.class);
+
+    @Override
+    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws ServletException, IOException {
+        try {
+            chain.doFilter(request, response);
+        } catch (Throwable ex) {
+            Throwable cause = ex;
+            if (ex instanceof NestedServletException) {
+                cause = ((NestedServletException) ex).getRootCause();
+            }
+            logger.error(ServletErrorUtils.buildMessage(request, cause), cause);
+            ServletErrorUtils.writerErrorResult(response, cause);
+        }
+    }
+}

+ 60 - 11
frontend/saas-web/app/util/FormUtil.js

@@ -16,9 +16,12 @@ Ext.define('saas.util.FormUtil', {
         var me = this,
         viewName = form.viewName,
         defaultItems = form.defaultItems,
+        brr = [],
         formModel = form.getViewModel(),
         url = me.baseUrl.replace(me.urlRe, '$1' + viewName);
         
+        brr = brr.concat(form.defaultItems);
+
         this.BaseUtil.request({url, async: false})
         .then(function(response) {
             var res = Ext.decode(response.responseText);
@@ -33,34 +36,60 @@ Ext.define('saas.util.FormUtil', {
                         Ext.apply(item, cusItem);
                     });
                     Ext.Array.each(items, function(item) {
+                        var bind = item.bind,
+                        bindName = bind,
+                        defaultValue = item.defaultValue;
+                        
+                        if(bindName && !Ext.isString(bindName)) {
+                            bindName = bindName.value;
+                        }
+                        if(bindName) {
+                            bindName = bindName.replace(/[{|}]/g, '');
+                        }
+
+                        // 设置初始值
+                        if(defaultValue) {
+                            formModel.set(bindName, defaultValue);
+                        }
+
+                        // 设置必填
+                        if(item.allowBlank==false){
+                            //item.fieldLabel = "<font color=\"red\" style=\"position:relative; top:2px;right:2px; font-weight: bolder;\">*</font>"+item.fieldLabel;
+                        }
+                        
+                        // 如果是从表为其绑定store
                         if(item.xtype == 'detailGridField') {
-                            var storeName = item.name || item.xtype + Ext.id();
                             item.bind = {
-                                store: {
-                                    data : '{' + storeName + '}'
-                                }
+                                store: '{_detailStore}'
                             };           
-
-                            item.store = {
+                            formModel.set('_detailStore', Ext.create('Ext.data.Store', {
                                 fields: item.columns ? item.columns.filter(function(c) {
                                     return !!c.dataIndex;
                                 }).map(function(c) {
-                                    return c.dataIndex;
+                                    var type = "string";
+                                    if(c.xtype!=""){
+                                        if(c.xtype=="numbercolumn"){
+                                            type = "float"
+                                        }
+                                    }
+                                    return {name: c.dataIndex,type:type};
                                 }) : [],
                                 data: []
-                            };
+                            }));
                         }
                     });
                 }
-                form.addItems(items);
+                return form.addItems(items);
             }else {
                 return []
             }
         })
         .then(function(items) {
-            form.addItems(items);
             form.fireEvent('afterSetItems', form, items);
         })
+        .then(function() {
+            me.loadData(form);
+        })
         .catch(function(response) {
             console.error(response);
         });
@@ -68,6 +97,26 @@ Ext.define('saas.util.FormUtil', {
     },
 
     loadData: function(form) {
-
+        var me = this;
+        if(form.initId && form.initId!=0) {
+            var url = form._readUrl + form.initId,async=false;
+            me.BaseUtil.request({url,async })
+            .then(function(response) {
+                var res = Ext.decode(response.responseText);
+                if(res.success) {
+                    form.setFormData({
+                        main: res.data.main,
+                        detail: res.data.items
+                    });
+                }
+            })
+            .catch(function(response) {
+                console.error(response);
+            });
+        }else{
+            var viewModel = form.getViewModel();
+            var detailStore = viewModel.get('_detailStore');
+            detailStore.loadData([{},{},{},{},{},{},{},{},{},{}]);
+        }
     }
 });

+ 122 - 88
frontend/saas-web/app/util/QueryUtil.js

@@ -2,61 +2,41 @@ Ext.define('saas.util.QueryUtil', {
 
     BaseUtil: Ext.create('saas.util.BaseUtil'),
 
-    // 请求页面组件接口模板
-    baseUrl: 'http://192.168.0.181:8560/api/ui/co_view/config?name={xtype}',
-    // 模板替换正则
-    urlRe: /(.*){xtype}(.*)/g,
-    
-    /**
-     * 获得form的字段配置
-     * @param form: form组件
-     */
-    setItems: function(form) {
-        var me = this;
-        debuggre;
-        Ext.each(form.items.items, function(f){
-            if(f.xtype=='core-query-queryformpanel'){
-
-            }else if(f.xtype=='core-query-gridpanel'){
-                
-            }
-
-        });
-        // xtype = form.xtype,
-        //     url = me.baseUrl.replace(me.urlRe, '$1' + xtype);
-        //     me.BaseUtil.request({url})
-        // .then(function(response) {
-        //     var res = Ext.decode(response.responseText);
-        //     if(res.success) {
-        //         var config = res.data, items = [];
-        //         if(config) {
-        //             items = config.items;
-        //             //_baseItems
-        //             // _BaseColumn: '',
-        //             // _RelativeColumn: '',
-        //             form.add(items);
-        //         }
-        //         form.fireEvent('afterSetItems', form, items);               
-        //     }
-        // })
-        // .catch(function(response) {
-        //     console.error(response);
-        // });
-    },
      /**
      * 获得form的字段查询条件
      * @param form: form组件
      * @returns Mode: 字段模式,默认MAIN 当f.fieldMode = "DETAIL",Mode->"DETAIL"
      */
-    getStoreMode: function(form){
+    getStoreMode: function(form,Mode){
         var Mode = "MAIN";
-        Ext.each(form.items.items, function(f){
-            if(!Ext.isEmpty(f.value)&&f.fieldMode == "DETAIL") {
-                Mode = "DETAIL";
-                break;
-            }
-        });
+        if(form.items.items.find(function(item) {
+            return !Ext.isEmpty(item.value)&&item.fieldMode == "DETAIL";
+        })) {
+            Mode = "DETAIL";
+        }
         return Mode;
+    },
+    turnRelativeGrid:function(grid,queryForm,queryMoreForm){
+        var me = this,
+            Mode = me.getStoreMode(queryForm);
+        if(queryMoreForm){//更多查询
+            if(Mode=="MAIN"){
+                me.getStoreMode(queryMoreForm);
+            }
+        }
+        console.log("Mode:"+Mode);
+        if(Mode=="MAIN"){
+            grid._Mode = Mode;
+            grid.reconfigure(grid.store, grid._baseColumn);
+            grid.store.loadPage(1);
+        }else{
+            //若明细字段含明细字段注意切换数据源 grid.reconfigure(store, columns);
+            //关联viewName = 关联viewName+"-RelativeGrid" selModel
+            //grid.selModel = '';
+            grid._Mode = Mode;
+            grid.reconfigure(grid.store, grid._relativeColumn);
+            grid.store.loadPage(1);
+        }
     },
       /**
      * 获得form的字段查询条件
@@ -74,19 +54,29 @@ Ext.define('saas.util.QueryUtil', {
 							condition += ' AND (' + f.logic+')';
 						}
 					}
-				} else if(f.xtype == 'datefield' && f.value != null && f.value != '' ){
+				} else if (f.xtype == 'condatefield' && f.value != null ){
+                    if(f.value.from != null){
+                        if(condition == ''){
+                            condition += " date("+f.name+") between '"+f.value.from+"' and '"+f.value.to+"' ";
+                        } else {
+                            condition += " AND date("+f.name+") between '"+f.value.from+"' and '"+f.value.to+"' ";
+                        }
+                    }
+                }else if(f.xtype == 'datefield' && f.value != null && f.value != '' ){
+                    debugger;
 					var v = Ext.Date.format(new Date(f.value), 'Y-m-d');
 					if(condition == ''){
-						condition += "to_char("+f.name+",'yyyy-MM-dd')='"+v+"'";
+						condition += "date("+f.name+")='"+v+"'";
 					} else {
-						condition += " AND to_char("+f.name+",'yyyy-MM-dd')='"+v+"'";
+						condition += " AND date("+f.name+")='"+v+"'";
 					}
 				} else if(f.xtype == 'datetimefield' && f.value != null){
-					var v = Ext.Date.format(new Date(f.value), 'Y-m-d H:i:s');
+                    var v = Ext.Date.format(new Date(f.value), 'Y-m-d H:i:s');
+                    debugger;
 					if(condition == ''){
-						condition += f.name + "=to_date('" + v + "', 'yyyy-MM-dd HH24:mi:ss')";
+						condition += 'date('+f.name + ")= '" + v + "'";
 					} else {
-						condition += ' AND ' + f.name + "=to_date('" + v + "', 'yyyy-MM-dd HH24:mi:ss')";
+						condition += ' AND date('+f.name + ")= '" + v + "'";
 					}
 				} else if(f.xtype == 'numberfield' && f.value != null && f.value != ''){
 					var endChar = '=';
@@ -106,15 +96,24 @@ Ext.define('saas.util.QueryUtil', {
 						f.store.each(function(d, idx){
 							if(d.data.value != '$ALL') {
 								if(_a == ''){
-									_a += f.name +' '+  d.data.value+' ' ;
+									_a += f.logic + "='" + d.data.value + "'";
 								} else {
-									_a += ' OR ' + f.name +' '+ d.data.value +' ';
+									_a += ' OR ' + f.logic + "='" + d.data.value + "'";
 								}
 							}
 						});
 						condition += _a + ')';
 					}
-				}  else {
+				} else if(f.xtype == 'multicombo' ){
+				    if(f.value){
+                        if(condition == ''){
+                            condition += f.name + " in (" + f.value+")";
+                        } else {
+                            condition += ' AND ' +  f.name + " in (" + f.value+")";
+                        }
+                    }
+
+                } else {
                     if(!Ext.isEmpty(f.value)){
                         if(me.contains(f.value.toString(), 'BETWEEN', true) && me.contains(f.value.toString(), 'AND', true)){
                             if(condition == ''){
@@ -152,10 +151,41 @@ Ext.define('saas.util.QueryUtil', {
                                     condition += ' AND (' + f.name + " like '" + f.value + "')";
                                 }
                             } else {
-                                if(condition == ''){
-                                    condition += '('+f.name + "='" + f.value + "')";
-                                } else {
-                                    condition += ' AND (' + f.name + "='" + f.value + "')";
+                                if(f.queryType=='VAG'){
+                                    if(condition == ''){
+                                        if(me.contains(f.name.toString(), '#', true)){
+                                            var nameArr = f.name.split("#");
+                                            Ext.each(nameArr, function(nameItem,index) {
+                                                if(index==0){
+                                                    condition = (nameItem+ " like '%" +f.value + "%'");
+                                                }else{
+                                                    condition += " or "+nameItem+ " like '%" +f.value + "%' ";
+                                                }
+                                            });
+                                        }else{
+                                            condition += '('+ f.name + " like '%" + f.value + "%')";
+                                        }
+                                    } else {
+                                        if(me.contains(f.name.toString(), '#', true)){
+                                            var nameArr = f.name.split("#");
+                                            Ext.each(nameArr, function(nameItem,index) {
+                                                if(index==0){
+                                                    condition = ' AND ('+(nameItem+ " like '%" +f.value + "%'");
+                                                }else{
+                                                    condition += " or "+nameItem+ " like '%" +f.value + "%' ";
+                                                }
+                                            });
+                                            condition+=')';
+                                        }else{
+                                            condition += ' AND (' + f.name + " like '%" + f.value + "%')";
+                                        }
+                                    }
+                                }else{
+                                    if(condition == ''){
+                                        condition += '('+f.name + "='" + f.value + "')";
+                                    } else {
+                                        condition += ' AND (' + f.name + "='" + f.value + "')";
+                                    }
                                 }
                             }
                         }
@@ -182,30 +212,30 @@ Ext.define('saas.util.QueryUtil', {
      * 
      */
     queryData: function(grid,condition){
-        var me = this;
-            if(Ext.isEmpty(condition)){
-                condition =" 1=1 ";
-            }
-            var params = { keyword: condition,number:1,size:15 };
-            var dataRes = {
-                url :grid.listUrl,
-                async:false,
-                params:params
-            };
-            me.BaseUtil.request(dataRes)
-            .then(function(response) {
-                var res = Ext.decode(response.responseText);
-                if(res.success) {
-                    var data = res.data;
-                    console.log(data);
-                     grid.getStore().loadData(data.list);
-                     grid.fireEvent('afterLoadData', grid, data.list);
-                }
-            })
-            .catch(function(response) {
-                console.log(response);
-                // something...
-            });
+        // var me = this;
+        //     if(Ext.isEmpty(condition)){
+        //         condition =" 1=1 ";
+        //     }
+        //     var params = { keyword: condition,number:1,size:15 };
+        //     var dataRes = {
+        //         url :grid.listUrl,
+        //         async:false,
+        //         params:params
+        //     };
+        //     me.BaseUtil.request(dataRes)
+        //     .then(function(response) {
+        //         var res = Ext.decode(response.responseText);
+        //         if(res.success) {
+        //             var data = res.data;
+        //             console.log(data);
+        //              grid.getStore().loadData(data.list);
+        //              grid.fireEvent('afterLoadData', grid, data.list);
+        //         }
+        //     })
+        //     .catch(function(response) {
+        //         console.log(response);
+        //         // something...
+        //     });
     },
     onQuery: function(parentForm,queryMoreForm){
         var me = this,
@@ -260,7 +290,8 @@ Ext.define('saas.util.QueryUtil', {
                 }
                 if(grid._codeField){
 					o['code'] = item.data[grid._codeField];
-				}
+                }
+                o['name'] = '';
 				data.push(o);
             }
 		});
@@ -271,10 +302,13 @@ Ext.define('saas.util.QueryUtil', {
 	 * grid:原始字符串
 	 */
     vastRes:function(url,params){
-        var me = this;
+        console.log("params",params);
+        var me = this,
+        pp ={baseDTOs:params} ;
+        console.log("pp",pp);
         me.BaseUtil.request({
                 url: url,
-                params: JSON.stringify(params),
+                params: JSON.stringify(pp),
                 method: 'POST',
             })
             .then(function() {

+ 17 - 2
frontend/saas-web/app/view/core/form/ConDateField.js

@@ -12,6 +12,7 @@ Ext.define('saas.view.core.form.ConDateField', {
     defaults: {
         margin: '0 0 0 0'
     },
+    defaultBindProperty: 'value',
     initComponent : function(){
         this.cls = (this.cls || '') + ' x-form-field-multi';
         this.callParent(arguments);
@@ -76,6 +77,7 @@ Ext.define('saas.view.core.form.ConDateField', {
                     }else {
                         me.value=null;
                     }
+                    me.setBindValue(v, from, to);
                 }
             }
         });
@@ -105,6 +107,7 @@ Ext.define('saas.view.core.form.ConDateField', {
                     }else {
                         me.value=null;
                     }
+                    me.setBindValue(v, from, to);
                 }
             }
         });
@@ -113,7 +116,7 @@ Ext.define('saas.view.core.form.ConDateField', {
             t = 3;
         }
         this.value = null;
-        this.setValue(t);
+        this.setInitValue(t);
     },
     setDateFieldValue: function(v){
         v = Number(v);
@@ -186,13 +189,25 @@ Ext.define('saas.view.core.form.ConDateField', {
             from.setEditable(false);
             to.setEditable(false);
         }
+        me.setBindValue(v, minDate, maxDate);
     },
-    setValue: function(v){
+    setInitValue: function(v) {
         if (v) {
             this.combo.setValue(v);
             this.setDateFieldValue(v);
         }
     },
+    setBindValue: function(v, from, to){
+        this.value = {
+            type: v,
+            from: from,
+            to: to
+        };
+        this.publishState('value', this.value);
+    },
+    setValue: function(v) {
+        this.value = v;
+    },
     getValue: function(){
         return this.value;
     },

+ 0 - 32
frontend/saas-web/app/view/core/form/DateField.js

@@ -1,32 +0,0 @@
-Ext.define('saas.view.core.form.DateField', {
-    extend: 'Ext.form.field.Date',
-    alias: 'widget.datetimefield',
-
-    setValue: function(v) {
-        var me = this,
-            utilDate = Ext.Date,
-            rawDate;
-        me.lastValue = me.rawDateText;
-        me.lastDate = me.rawDate;
-        if (Ext.isDate(v)) {
-            rawDate = me.rawDate = v;
-            me.rawDateText = me.formatDate(v);
-        } else {
-            rawDate = me.rawDate = me.rawToValue(v);
-            me.rawDateText = me.formatDate(v);
-            if (rawDate === v) {
-                if(v&&v.indexOf('.')>-1&&v.indexOf('T')>-1){
-                     v = v.substring(0,v.indexOf('T'));
-                    rawDate = null;
-                }else{
-                    rawDate = me.rawDate = null;
-                    me.rawDateText = '';
-                }     
-            }
-        }
-        if (rawDate && !utilDate.formatContainsHourInfo(me.format)) {
-            me.rawDate = utilDate.clearTime(rawDate, true);
-        }
-        me.callParent(arguments);
-    }
-});

+ 122 - 27
frontend/saas-web/app/view/core/form/FormPanel.js

@@ -36,31 +36,10 @@ Ext.define('saas.view.core.form.FormPanel', {
     initComponent: function() {
 
         var me = this;
-        //me.FormUtil.setItems(me);
-
-        //判断是否加载数据
-
-        if(me.initId&&me.initId!=0){
-            var url = me._dataModelUrl + me.initId,async=false;
-            me.BaseUtil.request({url,async })
-            .then(function(response) {
-                var res = Ext.decode(response.responseText);
-                if(res.success) {
-                    viewModel = me.getViewModel();
-                    viewModel.setData(res.data.main);
-                    viewModel.setData({'detailGridField':res.data.items});                   
-                }
-            })
-            .catch(function(response) {
-                console.error(response);
-            });
-        }else{
-            viewModel = me.getViewModel();
-            viewModel.setData({'detailGridField':[{},{}]});     
-        }
+        me.initViewModel();
+        me.FormUtil.setItems(me);
 
         Ext.apply(me, {
-            items:me.defaultItems,
             dockedItems: [{
                 xtype: 'toolbar',
                 dock: 'top',
@@ -78,23 +57,139 @@ Ext.define('saas.view.core.form.FormPanel', {
                 }, {
                     xtype: 'button',
                     text: '保存',
-                    handler: 'save'
+                    handler: 'save',
+                    formBind: true
                 }, {
                     xtype: 'button',
                     text: '删除',
                     handler: 'delete'
                 }, {
                     xtype: 'button',
-                    text: '审核',
-                    handler: "audit"
+                    bind: {
+                        text: '{auditBtnText}'
+                    },
+                    handler: "auditBtnClick",
+                    
                 }]))
             }]
         });
         me.callParent(arguments);
     },
 
+    /**
+     * 一些初始化viewModel的方法
+     */
+    initViewModel: function() {
+        var me = this,
+        statusField = me._statusField,
+        statusCodeField = me._statusCodeField,
+        viewModel = me.getViewModel();
+        
+        var o = {};
+        o[statusField] = {
+            bind: '{' + statusCodeField + '}',
+            get: function(value) {
+                return value == 'AUDITED' ? '已审核' : '未审核'
+            }
+        };
+        o['auditBtnText'] = {
+            bind: '{' + statusCodeField + '}',
+            get: function(value) {
+                return value == 'AUDITED' ? '反审核' : '审核'
+            }
+        };
+        viewModel.setFormulas(o);
+
+        viewModel.set('createTime', new Date());
+        viewModel.set('updateTime', new Date());
+        statusCodeField ? viewModel.set(statusCodeField, "UNAUDITED") : viewModel.set('auditBtnText', "审核");
+    },
+
     addItems: function(items) {
-        this.add(items);
+        var me = this;
+        me.setBindFields(items);
+        return this.add(items);
+    },
+
+    /**
+     * 获取form数据
+     */
+    getFormData: function(ignore) {
+        var me = this,
+        viewModel = me.getViewModel(),
+        allData = viewModel.getData(),
+        bindFields = allData.bindFields,
+        formData = {
+            main: {},
+            detail: []
+        };
+
+        for(k in allData) {
+            var d = allData[k];
+            // 主表数据
+            if(ignore) {
+                formData.main[k] = d;
+            }else {
+                if(bindFields.indexOf(k) != -1) {
+                    formData.main[k] = d;
+                }
+            }
+
+            // 从表数据
+            if(k == '_detailStore') {
+                storeData = d.getData().items;
+                formData.detail = storeData;
+            }
+        }
+        
+        return formData;
+    },
+
+    setFormData: function(formData) {
+        var me = this,
+        main = formData.main,
+        detail = formData.detail,
+        viewModel = me.getViewModel(),
+        detailStore = viewModel.get('_detailStore');
+
+        viewModel.setData(main);
+        detailStore.loadData(detail);
+    },
+
+    /**
+     * 设置需要绑定的字段
+     */
+    setBindFields: function(items) {
+        var me = this,
+        viewModel = me.getViewModel(),
+        bindFields = [];
+
+        Ext.Array.each(items, function(item) {
+            var ignore = item.ignore,
+            bind = item.bind;
+
+            if(!ignore && bind) {
+                if(!Ext.isString(bind)) {
+                    // 这里默认所有的fields都绑定的value,如果是其他属性则需要在加载成组件之后去获取他的defaultBind
+                    bind = bind.value;
+                }
+                if(bind) {
+                    bind = bind.replace(/[{|}]/g, '');
+                    bindFields.push(bind);
+                }
+            }
+        });
+        viewModel.set('bindFields', bindFields);
+    },
+
+    initFormData: function(formData) {
+        var me = this,
+        main = formData.main,
+        detail = formData.detail,
+        viewModel = me.getViewModel();
+
+        viewModel.setData(main);
+        // viewModel.set('detailGridField');
     }
     
 });

+ 72 - 76
frontend/saas-web/app/view/core/form/FormPanelController.js

@@ -5,17 +5,26 @@ Ext.define('saas.view.core.form.FormPanelController', {
     BaseUtil: Ext.create('saas.util.BaseUtil'),
     FormUtil: Ext.create('saas.util.FormUtil'),
 
+    auditBtnClick: function() {
+        var me = this,
+        form = me.getView(),
+        statusField = form._statusField,
+        viewModel = me.getViewModel(),
+        status = viewModel.get(statusField);
+
+        status == 'AUDIT' ? me.unAudit() : me.audit();
+    },
+
     add: function(btn){
         var form = btn.ownerCt.ownerCt;
         var mainTab = Ext.getCmp('main-tab-panel');
         var title = '新增' + btn.ownerCt.ownerCt._title;
         var id = form.xtype + '_add';
         existingItem = mainTab.down('[id=' + id + ']');
-
         lastView = mainTab.getActiveTab();
-
         if (!existingItem) {
             var form = {
+                initId:0,
                 id,
                 title,
                 xtype:form.xtype
@@ -27,26 +36,25 @@ Ext.define('saas.view.core.form.FormPanelController', {
     },
     
     delete: function(btn){
+        var me = this;
         var form = btn.ownerCt.ownerCt;
         var id = form.getForm().findField(form._idField);
         if(id&&id.value!=0){
-            Ext.Ajax.request({
+            me.BaseUtil.request({
                 url: form._deleteUrl+id.value,
-                params: '',
-                headers: {
-                    'Access-Control-Allow-Origin': '*',
-                    "Content-Type": 'application/json;charset=UTF-8' 
-                },
-                success: function (response, opts) {
+                method: 'GET',
+            })
+            .then(function(res) {
+                var localJson = new Ext.decode(res.responseText);
+                if(localJson.success){
                     var mainTab = Ext.getCmp('main-tab-panel');
                     mainTab.getActiveTab().close();
                     //解析参数
                     Ext.Msg.alert('提示','删除成功');
-                },
-                failure: function (response, opts) {
-                    //失败
-                    Ext.Msg.alert('提示','删除失败');
                 }
+            })
+            .catch(function() {
+                Ext.Msg.alert('提示','删除失败');
             });
         }
     },
@@ -63,102 +71,90 @@ Ext.define('saas.view.core.form.FormPanelController', {
             return false;
         }
         //form里面数据
-        var formData = form.viewModel.data;
-        var gridData = [];
-        var newGridData = [];
-        if(formData.detailGridField){
-            gridData = formData.detailGridField;
-        }
-
-        var grid = form.query('detailGridField')[0];
-        var items = grid.store.data.items;
-        if(items.length>0){
-            Ext.each(items, function(rec){
-                if(rec.dirty==true){
-                    Ext.each(gridData, function(data,index){
-                        data[form._detnoColumn] = index + 1;
-                        if(rec.id == data.id){
-                            newGridData.push(data);
-                            return false;
-                        }else if ((typeof data.id) != 'number'&&data.id.indexOf('extMode')>-1){
-                            data.id = '';
-                            newGridData.push(data);
-                            return false;
-                        }
-                    });
+        var formData = form.getFormData();
+        var gridData = formData.detail?formData.detail:[];
+        var dirtyGridData = [];
+        if(gridData.length>0){
+            Ext.each(gridData, function(item,index){
+                if(item.dirty){
+                    if((typeof item.data.id) != "number" && item.data.id.indexOf('extMode')>-1){
+                        item.data.id = '';
+                    }
+                    item.data[form._detnoColumn] = index + 1;
+                    dirtyGridData.push(item.data)
                 }
             });
         }   
         var params = {
-            main:formData,
-            items:newGridData
+            main:formData.main,
+            items:dirtyGridData
         }
         me.BaseUtil.request({
             url: form._saveUrl,
             params: JSON.stringify(params),
             method: 'POST',
         })
-        .then(function() {
-            Ext.Msg.alert('提示','保存成功');
+        .then(function(res) {
+            var localJson = new Ext.decode(res.responseText);
+            if(localJson.success){
+                Ext.Msg.alert('提示','保存成功');
+                form.initId = localJson.data.id;
+                form.FormUtil.loadData(form);
+            }
         })
         .catch(function() {
             Ext.Msg.alert('提示','保存失败');
         });
     },
+
     audit: function(btn){
+        var me = this;
         var form = btn.ownerCt.ownerCt;
+        if(form.getForm().wasDirty==false){
+            Ext.Msg.alert('提示','未修改数据,请修改后保存');
+            return false;
+        }
         if(form.getForm().wasValid==false){
             Ext.Msg.alert('提示','表单校验有误,请检查');
             return false;
         }
         //form里面数据
-        var formData = form.viewModel.data;
-        var gridData = [];
-        var newGridData = [];
-        if(formData.detailGridField){
-            gridData = formData.detailGridField;
-        }
-        var grid = form.query('detailGridField')[0];
-        var updRecords = grid.store.getUpdatedRecords();
-        if(updRecords.length>0){
-            Ext.each(updRecords, function(rec){
-                Ext.each(gridData, function(data,index){
-                    if(data.id==rec.id){
-                        if(data.id.indexOf('extMode')>-1){
-                            data.id = '';
-                            data[form._detnoColumn] = index + 1;
-                        }
-                        newGridData.push(data);
+        var formData = form.getFormData();
+        var gridData = formData.detail?formData.detail:[];
+        var dirtyGridData = [];
+        if(gridData.length>0){
+            Ext.each(gridData, function(item,index){
+                if(item.dirty){
+                    if((typeof item.data.id) != "number" && item.data.id.indexOf('extMode')>-1){
+                        item.data.id = '';
                     }
-                });
+                    item.data[form._detnoColumn] = index + 1;
+                    dirtyGridData.push(item.data)
+                }
             });
         }   
         var params = {
-            main:formData,
-            items:newGridData
+            main:formData.main,
+            items:dirtyGridData
         }
-        Ext.Ajax.request({
+        me.BaseUtil.request({
             url: form._auditUrl,
             params: JSON.stringify(params),
             method: 'POST',
-            headers: {
-                'Access-Control-Allow-Origin': '*',
-                "Content-Type": 'application/json;charset=UTF-8' 
-            },
-            success: function (response, opts) {
-                //解析参数
+        })
+        .then(function(res) {
+            var localJson = new Ext.decode(res.responseText);
+            if(localJson.success){
                 Ext.Msg.alert('提示','审核成功');
-            },
-            failure: function (response, opts) {
-                //失败
-                Ext.Msg.alert('提示','审核失败');
+                form.FormUtil.loadData(form);
             }
+        })
+        .catch(function() {
+            Ext.Msg.alert('提示','审核失败');
         });
     },
-    /**
-     * 获取form数据
-     */
-    getFormData: function() {
-        
+    unAudit: function() {
+        console.log('反审核');
+        return;
     }
 });

+ 6 - 1
frontend/saas-web/app/view/core/form/FormPanelModel.js

@@ -1,4 +1,9 @@
 Ext.define('saas.view.core.form.FormPanelModel', {
     extend: 'Ext.app.ViewModel',
-    alias: 'viewmodel.core-form-formpanel'
+    alias: 'viewmodel.core-form-formpanel',
+
+    data: {
+        bindFields: [], // 请求绑定字段,绑定到formfield并且未设置ignore为true
+        _detailStore: null, // 从表store
+    },
 });

+ 126 - 0
frontend/saas-web/app/view/core/form/MultiCombo.js

@@ -0,0 +1,126 @@
+/**
+ * Created by zhouy on 2018/10/17.
+ */
+Ext.define('saas.view.core.form.MultiCombo', {
+    extend: 'Ext.form.field.Trigger',
+    alias: 'widget.multicombo',
+    editable : false,
+    matchFieldWidth: true,
+    cachedConfig: {
+        menuAlign: 'tl-bl?',
+        destroyMenu: true
+    },
+    initComponent: function() {
+        var me = this;
+        me.callParent(arguments);
+    },
+    listeners:{
+        afterrender:function(f){
+            this.mon(f.el,{
+                mouseover: this.onMouseOver,
+                mouseleave:this.onMouseLeave,
+                scope:this
+            });
+        }
+
+    },
+    onMouseOver:function(){
+       this.showMenu();
+    },
+    onMouseLeave:function(a,b,c){
+        console.log(a);
+        console.log(b);
+        console.log(c);
+        this.hideMenu(a.parentEvent?a:b);//el光标离开第二个参数为Event对象
+    },
+    onTriggerClick:function(){
+        this.showMenu();
+    },
+    getMenu: function() {
+        var me = this;
+
+        if (!me.menu) {
+
+            me.menu = Ext.create('Ext.menu.Menu',{
+                hideOnParentHide: false,
+                items: me.getMenuItems(),
+                listeners:{
+                    mouseleave:me.onMouseLeave,
+                    scope:me
+                }
+            });
+        }
+        return me.menu;
+    },
+    getMenuItems:function(){
+        var me = this,
+            i = 0,
+            item,
+            items = me.datas,
+            itemsLn = me.datas.length,
+            menuItems = [];
+        for (; i < itemsLn; i++) {
+            item = items[i];
+            menuItem = new Ext.menu.CheckItem({
+                text: item[1],
+                checked: item.checked,
+                checkValue:item[0],
+                hideOnClick: false,
+                checkHandler: this.onCheckChange,
+                scope: this
+            });
+            menuItems.push(menuItem);
+        }
+        return menuItems.length ? menuItems : null;
+    },
+    onCheckChange:function(checkItem, checked){
+        var items=this.menu.items.items,
+            rawV,v;
+        Ext.Array.each(items,function(item){
+            if(item.checked){
+                rawV=rawV?rawV+','+item.text:item.text;
+                v=v?v+","+"'"+item.checkValue+"'":"'"+item.checkValue+"'";
+            }
+        });
+        this.setRawValue(rawV);
+        this.value=v;
+    },
+
+    showMenu: function (e, menu) {
+        menu = menu || this.getMenu();
+        /**
+         * menu上边框样式待处理
+         * */
+        if (menu) {
+            if (menu.isVisible()) {
+                    menu.focus();
+            } else {
+                menu.autoFocus = true;
+                if(this.matchFieldWidth){
+                    menu.setWidth(this.bodyEl.getWidth());
+                }
+                if (menu.isMenu) {
+                    menu.showBy(this.inputEl, this.getMenuAlign(),[-1, 0]);
+                } else if (menu.isViewportMenu) {
+                    menu.setDisplayed(!menu.getDisplayed());
+                } else {
+                    menu.show();
+                }
+            }
+        }
+    },
+    hideMenu: function(b) {
+        console.log(b);
+        if (this.hasVisibleMenu()) {
+            var target=b.parentEvent.relatedTarget;
+            if(!((target.className && target.className.indexOf('x-menu')!=-1) || (target.name && target.name.indexOf(this.name)!=-1))){
+                this.menu.hide();
+            }
+        }
+        return this;
+    },
+    hasVisibleMenu: function() {
+        var menu = this.menu;
+        return menu && menu.rendered && menu.isVisible();
+    }
+});

+ 7 - 6
frontend/saas-web/app/view/core/form/field/DetailGridField.js

@@ -55,6 +55,7 @@ Ext.define('saas.view.core.form.field.DetailGridField', {
                     text: 'Debugger',
                     handler: function() {
                         var detailGrid = me;
+                        var form = detailGrid.up('form');
                         debugger;
                     }
                 }]
@@ -64,12 +65,12 @@ Ext.define('saas.view.core.form.field.DetailGridField', {
     },
 
     listeners: {
-        // afterrender:function(grid){
-        //     var count = grid.store.getCount();
-        //     if(count==0){
-        //         grid.add10EmptyRow();
-        //     }
-        // },
+        afterrender:function(grid){
+            var count = grid.store.getCount();
+            if(count==0){
+                //grid.add10EmptyRow();
+            }
+        },
         itemClick: function(tableView, record, item, index, e, eOpts) {
             var grid = tableView.up('grid'),
                 store = grid.store,

+ 1 - 9
frontend/saas-web/app/view/core/query/QueryFormPanel.js

@@ -33,15 +33,7 @@ Ext.define('saas.view.core.query.QueryFormPanel', {
             xtype: 'button',
             text: '查询',
             handler: 'onQuery'
-        }, '->', {
-            xtype: 'button',
-            text: 'Debugger',
-            handler: function(btn) {
-                var queryFormPanel = btn.up('form'),
-                queryPanel = queryFormPanel.up('panel');
-                debugger;
-            }
-        }]
+        },'->']
     }]
 
 });

+ 47 - 63
frontend/saas-web/app/view/core/query/QueryGridPanel.js

@@ -7,12 +7,13 @@ Ext.define('saas.view.core.query.QueryGridPanel', {
     GridUtil: Ext.create('saas.util.GridUtil'),
 
     //字段属性
-    _BaseColumn: '',
-    _RelativeColumn: '',
+    _baseColumn: [],
+    _relativeColumn: [],
     _idField:'',
     _codeField:'',
-    //数据属性
-    listUrl:'http://192.168.253.58:8800/purchase/list',
+    _title:'',
+    _addXtype:'',
+    _baseVastUrl:'',
 
     //基础属性
     border: 1,
@@ -31,11 +32,12 @@ Ext.define('saas.view.core.query.QueryGridPanel', {
             store: Ext.create('Ext.data.Store', {
                 fields: me.getFields(),
                 autoLoad: true,
-                pageSize: 5,
+                pageSize: 15,
                 data: [],
                 proxy: {
                     type: 'ajax',
-                    url: me.listUrl,
+                    url: me._baseVastUrl+'list',
+                    //url: 'http://192.168.253.58:8800/purchase/list',
                     actionMethods: {
                         read: 'GET'
                     },
@@ -47,50 +49,24 @@ Ext.define('saas.view.core.query.QueryGridPanel', {
                 },
                 listeners: {
                     beforeload: function (store, op) {
-                        var condition = '';
+                        var condition = '',
+                        queryForm = me.ownerCt.down('form'),
+                        condition = me.QueryUtil.getFormCondition(queryForm),
+                        mode = me._Mode;
                         if (Ext.isEmpty(condition)) {
                             condition = " 1=1 ";
                         }
+                        if(mode){
+                            mode='MAIN';
+                        }
                         console.log("condition:" + condition);
                         Ext.apply(store.proxy.extraParams, {
-                            number: op._start + 1,
+                            number: op._page,
                             size: store.pageSize,
+                            mode:mode,
                             keyword: condition
                         });
-
-                    }
-                }
-            }),
-            store:Ext.create('Ext.data.Store',{
-                fields:me.fields,
-                autoLoad: true,
-                pageSize:5,
-                data:[],
-                proxy:{
-                    type:'ajax',
-                    url:me.listUrl ,
-                    actionMethods: {
-                        read   : 'GET'
-                    },
-                    reader:{
-                        type:'json',
-                        rootProperty:'data.list'
-                        ,totalProperty:'data.total',
-                        }
-                },
-                listeners : {
-                    beforeload : function(store,op) {
-                        var condition = '';
-                        if(Ext.isEmpty(condition)){
-                            condition = " 1=1 ";
-                        }
-                        console.log("condition:"+condition);
-                        Ext.apply(store.proxy.extraParams, {
-                            number:op._page,
-                            size:store.pageSize,
-                            keyword: condition
-                        });
-                        
+    
                     }
                 }
             }),
@@ -116,7 +92,6 @@ Ext.define('saas.view.core.query.QueryGridPanel', {
             }, {
                 xtype: 'pagingtoolbar',
                 dock: 'bottom',
-                id: 'query-bbar',
                 displayInfo: true,
                 emptyMsg: "暂无数据",
                 store: me.store,
@@ -129,13 +104,22 @@ Ext.define('saas.view.core.query.QueryGridPanel', {
     },
 
     listeners: {
-        itemClick: function (tableView, record, item, index, e, eOpts) {
+        itemdblClick: function (tableView, record, item, index, e, eOpts) {
             var grid = tableView.up('grid'),
-                _idField = grid._idField,
-                store = grid.store,
-                count = store.getCount();
-            console.log("store");
-            console.log(store);
+                mainTab = Ext.getCmp('main-tab-panel'),
+                idValue = record.get(grid._idField),
+                codeValue = record.get(grid._codeField),
+                id = grid.xtype + idValue;
+                existingItem = mainTab.down('[id=' + id + ']');
+            if (!existingItem) {
+                var form = {
+                    xtype:grid._addXtype,
+                    id,
+                    title:grid._title+"("+codeValue+")",
+                    initId:idValue
+                };
+                mainTab.setActiveTab(mainTab.add(form));
+            }
         }
     },
 
@@ -148,26 +132,26 @@ Ext.define('saas.view.core.query.QueryGridPanel', {
         });
     },
     onAddMore: function (btn) {
-        console.log("跳转到主从表");
-        var form = btn.ownerCt.ownerCt,
+        var grid = btn.ownerCt.ownerCt,
             mainTab = Ext.getCmp('main-tab-panel'),
-            id = form.xtype + '_add';
+            id = grid.xtype + '_add';
             existingItem = mainTab.down('[id=' + id + ']');
-
         if (!existingItem) {
-            var form = Ext.create('saas.view.purchase.panel.FormPanel', {
+            var form = {
+                xtype:grid._addXtype,
                 id,
-                title:'新增采购单'
-            });
+                title:'新增'+grid._title
+            };
             mainTab.setActiveTab(mainTab.add(form));
         }
     },
     onAudit: function(btn){
         var grid = btn.ownerCt.ownerCt,
-        vastUrl = grid.ownerCt._baseVastUrl+"batchAudit";
-        var selectsd = grid.QueryUtil.getGridSelected(grid);
-        console.log("审核","vastUrl:"+vastUrl,grid,"selectsd:"+selectsd);
+        vastUrl = grid._baseVastUrl+"batchAudit",
+        selectsd = grid.QueryUtil.getGridSelected(grid),
+        currentPage = grid.getStore().currentPage;
         grid.QueryUtil.vastRes(vastUrl,selectsd);
+        grid.getStore().loadPage(currentPage);
     },
     onPrint: function () {
         console.log("打印");
@@ -176,11 +160,11 @@ Ext.define('saas.view.core.query.QueryGridPanel', {
         console.log("导出");
     },
     onDelete: function (btn) {
-        console.log("删除该行");
         var grid = btn.ownerCt.ownerCt,
-        vastUrl = grid.ownerCt._baseVastUrl+"batchDelete";
-        var selectsd = grid.QueryUtil.getGridSelected(grid);
-        console.log("删除该行","vastUrl:"+vastUrl,grid,"selectsd:"+selectsd);
+        vastUrl = grid._baseVastUrl+"batchDelete",
+        selectsd = grid.QueryUtil.getGridSelected(grid),
+        currentPage = grid.getStore().currentPage;;
         grid.QueryUtil.vastRes(vastUrl,selectsd);
+        grid.getStore().loadPage(currentPage);
     }
 });

+ 2 - 3
frontend/saas-web/app/view/core/query/QueryPanel.js

@@ -8,7 +8,6 @@ Ext.define('saas.view.core.query.QueryPanel', {
     layout: 'anchor',
     autoScroll: true,
     margin: '0',
-    _baseVastUrl:'',
     items: [{
         anchor: '100% 30%',
         reference: 'queryform',
@@ -43,14 +42,14 @@ Ext.define('saas.view.core.query.QueryPanel', {
     setQueryItems: function (items) {
         var me = this,
         queryForm = me.items[0];
-
         queryForm.items = items;
     },
 
     setQuertGridConfigs: function() {
         var me = this,
         queryGrid = me.items[1];
-        Ext.apply(queryGrid, me.queryGridConfig);
+        me.queryGridConfig['columns']=me.queryGridConfig._baseColumn || [];
+        Ext.apply(queryGrid,me.queryGridConfig);
     }
 
 });

+ 3 - 4
frontend/saas-web/app/view/core/query/QueryPanelController.js

@@ -8,7 +8,6 @@ Ext.define('saas.view.core.query.QueryPanelController', {
         var win = Ext.getCmp('queryMoreWin');
         if (!win) {
             win = Ext.create('Ext.window.Window', {
-                id: 'queryMoreWin',
                 modal: true,
                 height: '50%',
                 width: '50%',
@@ -29,8 +28,8 @@ Ext.define('saas.view.core.query.QueryPanelController', {
     },
     onQuery: function (btn) {
         var me = this,
-        panel = me.getView(),
-        model = me.getViewModel();
-        console.log("查询: ", model.getData());
+        queryForm = btn.ownerCt.ownerCt,
+        grid = queryForm.ownerCt.down('grid');
+        grid.QueryUtil.turnRelativeGrid(grid,queryForm);
     }
 });

+ 2 - 6
frontend/saas-web/app/view/main/MainController.js

@@ -21,9 +21,7 @@ Ext.define('saas.view.main.MainController', {
             mainTab = refs.mainTabPanel,
             // existingItem = mainTab.child(type),
             newView,
-            id = 'maintab-' + nodeData.id 
-
-,
+            id = 'maintab-' + nodeData.id,
             title = nodeData.text;
             existingItem = mainTab.down('[id=' + id + ']'),
             lastView = mainTab.getActiveTab();
@@ -68,9 +66,7 @@ Ext.define('saas.view.main.MainController', {
             collapsing = !navigationList.getMicro(),
             new_width = collapsing ? 64 : 250;
 
-        if (Ext.isIE9m || !Ext.os.is 
-
-.Desktop) {
+        if (Ext.isIE9m || !Ext.os.is.Desktop) {
             Ext.suspendLayouts();
 
             refs.mainLogo.setWidth(new_width);

+ 21 - 5
frontend/saas-web/app/view/main/MainModel.js

@@ -26,11 +26,27 @@ Ext.define('saas.view.main.MainModel', {
                                 text: '采购单据',
                                 children: [
                                     {
-                                        id: 'purchaseList',
-                                        text: '采购单',
-                                        viewType: 'purchase-list-gridpanel',
-                                        leaf: true
-                                    }, {
+                                        id: 'purchaseOrder',
+                                        text: '采购单(维护界面)',
+                                        //viewType: 'purchase-list-gridpanel',
+                                        viewType:'purchase-purchase-formpanel',
+                                        leaf: true
+                                    },{
+                                        id: 'purchaseQuery',
+                                        text: '采购单查询',
+                                        viewType:'purchase-purchase-querypanel',
+                                        leaf: true
+                                    },{
+                                        id: 'purchaseInOrder',
+                                        text: '采购验收单(维护界面)',
+                                        viewType:'purchase-purchaseIn-formpanel',
+                                        leaf: true
+                                    },{
+                                        id: 'purchaseInQuery',
+                                        text: '采购验收单查询',
+                                        viewType:'purchase-purchaseIn-querypanel',
+                                        leaf: true
+                                    },{
                                         id: 'list1',
                                         text: '列表界面1',
                                         viewType: 'purchase-list-gridpanel1',

+ 137 - 0
frontend/saas-web/app/view/purchase/purchase/FormController.js

@@ -0,0 +1,137 @@
+Ext.define('saas.view.purchase.purchase.FormController', {
+    extend: 'saas.view.core.form.FormPanelController',
+    alias: 'controller.purchase-purchase-formcontroller',
+    init: function (form) {
+        var me = this;
+        this.control({
+            /**放大镜新增demo*/
+            "field[name=combo]":{
+                beforerender:function(f){
+                    f.addHandler=me.addCombo;
+                }
+            },
+            //放大镜赋值关系 以及 tpl模板
+            'dbfindtrigger[name=pu_vendcode]':{
+                beforerender:function(f){
+                    Ext.apply(f,{
+                        dataUrl:'http://192.168.253.41:9480/api/document/vendor/getVendorsByCondition',
+                        dbfinds:[{
+                            from:'ve_code',to:'pu_vendcode'
+                        },{
+                            from:'ve_name',to:'pu_vendname'
+                        }],
+                        dbtpls:[{
+                            field:'ve_code',width:100
+                        },{
+                            field:'ve_name',width:100
+                        }],
+                        dbColumns:[{
+                            conditionCode:'ve_id',
+                            "text": "供应商ID",
+                            "flex": 0,
+                            "dataIndex": "ve_id",
+                            "width": 0,
+                            "xtype": "",
+                            "items": null
+                        },{
+                            conditionCode:'ve_code',
+                            "text": "供应商编号",
+                            "flex": 1,
+                            "dataIndex": "ve_code",
+                            "width": 100,
+                            "xtype": "",
+                            "items": null
+                        }, {
+                            conditionCode:'ve_name',
+                            "text": "供应商名称",
+                            "flex": 1,
+                            "dataIndex": "ve_name",
+                            "xtype": "",
+                            "items": null
+                        }, {
+                            conditionCode:'ve_type',
+                            "text": "供应商类型",
+                            "flex": 0,
+                            "dataIndex": "ve_type",
+                            "width": 200,
+                            "xtype": "",
+                            "items": null
+                        }]
+                    }) ;   
+
+                }
+            },
+            //放大镜赋值关系 以及 tpl模板
+            'dbfindtrigger[name=pd_prodcode]':{
+                beforerender:function(f){
+                    Ext.apply(f,{
+                        conditionCode:'pr_code',
+                        dataUrl:'http://192.168.253.41:9480/api/document/product/getProductsByCondition',
+                        dbfinds:[{
+                            from:'pr_code',to:'pd_prodcode'
+                        }],
+                        dbtpls:[{
+                            field:'pr_code',width:100
+                        },{
+                            field:'pr_detail',width:100
+                        }],
+                        dbColumns:[{
+                            "text": "物料ID",
+                            "flex": 0,
+                            "dataIndex": "pr_id",
+                            "width": 0,
+                            "xtype": "",
+                            "items": null
+                        },{
+                            "text": "物料编号",
+                            "flex": 1,
+                            "dataIndex": "pr_code",
+                            "width": 100,
+                            "xtype": "",
+                            "items": null
+                        }, {
+                            "text": "物料名称",
+                            "flex": 1,
+                            "dataIndex": "pr_detail",
+                            "xtype": "",
+                            "items": null
+                        }, {
+                            "text": "物料规格",
+                            "flex": 0,
+                            "dataIndex": "pr_spec",
+                            "width": 200,
+                            "xtype": "",
+                            "items": null
+                        }]
+                    }) ;   
+
+                }
+            }
+        });
+
+    },
+    addCombo:function(){
+        var combo=this.ownerCmp;
+        Ext.create('Ext.window.Window',{
+            layout:'vbox',
+            bodyPadding: 15,
+            width:500,
+            items:[{
+                fieldLabel:'实际值',
+                xtype:'textfield'
+            },{
+                fieldLabel:'显示值',
+                xtype:'textfield'
+            }],
+            buttons:[{
+                text:'确认',
+                handler:function(b){
+                    combo.setValue('ok');
+                    b.up('window').close();
+                }
+            }],
+            renderTo:this.ownerCmp.ownerCt.getEl()
+        }).show();
+
+    }
+});

+ 5 - 0
frontend/saas-web/app/view/purchase/purchase/FormModel.js

@@ -0,0 +1,5 @@
+Ext.define('saas.view.purchase.purchase.FormModel', {
+    extend: 'saas.view.core.form.FormPanelModel',
+    alias: 'viewmodel.purchase-purchase-formmodel',
+
+});

+ 241 - 0
frontend/saas-web/app/view/purchase/purchase/FormPanel.js

@@ -0,0 +1,241 @@
+Ext.define('saas.view.purchase.purchase.FormPanel', {
+    extend: 'saas.view.core.form.FormPanel',
+    xtype: 'purchase-purchase-formpanel',
+
+    controller: 'purchase-purchase-formcontroller',
+    viewModel: 'purchase-purchase-formmodel',
+    
+    _title:'采购单',
+    _codeField: 'pu_ode',
+    _statusField: 'pu_statuscode',
+    _idField: 'id',
+    _detnoColumn:  'pd_detno',
+    _dataModelUrl:'http://192.168.253.58:8800/purchase/read/',
+    _saveUrl:'http://192.168.253.58:8800/purchase/save',
+    _auditUrl:'http://192.168.253.58:8800/purchase/audit',
+    _deleteUrl:'http://192.168.253.58:8800/purchase/delete/',
+    _deleteDetailUrl:'http://192.168.253.58:8800/purchase/deleteItem/',
+    initId:0,
+
+    toolBtns: [{
+        xtype: 'button',
+        text: '转单按钮',
+        handler: function() {
+            console.log('11');
+        }
+    }],
+
+    defaultItems: [{
+        xtype: 'hidden',
+        name: 'id',
+        bind: '{id}',
+        fieldLabel: 'id',
+        allowBlank: true,
+        columnWidth: 0
+    }, {
+        xtype : "textfield", 
+        name : "pu_code", 
+        bind : "{pu_code}", 
+        fieldLabel : "采购单号", 
+        allowBlank : true, 
+        columnWidth : 0.25
+    }, {
+        xtype : "hidden", 
+        name : "pu_vendid", 
+        bind : "{pu_vendid}", 
+        fieldLabel : "供应商ID", 
+        allowBlank : true, 
+        columnWidth : 0.0
+    }, {
+        xtype : "textfield", 
+        name : "pu_vendcode", 
+        bind : "{pu_vendcode}", 
+        fieldLabel : "供应商编号", 
+        hidden:true,
+        allowBlank : true, 
+        columnWidth : 0, 
+    }, {
+        xtype : "dbfindtrigger", 
+        name : "pu_vendname", 
+        bind : "{pu_vendname}", 
+        fieldLabel : "供应商名称", 
+        allowBlank : true, 
+        columnWidth : 0.25
+    },{
+        xtype : "datefield", 
+        name : "pu_date", 
+        bind : "{pu_date}", 
+        fieldLabel : "采购日期", 
+        allowBlank : false, 
+        columnWidth : 0.25
+    }, {
+        xtype : "hidden", 
+        name : "pu_buyerid", 
+        bind : "{pu_buyerid}", 
+        fieldLabel : "采购员ID", 
+        allowBlank : true, 
+        columnWidth : 0.0
+    }, {
+        xtype : "textfield", 
+        name : "pu_buyercode", 
+        bind : "{pu_buyercode}", 
+        fieldLabel : "采购员编号", 
+        allowBlank : true, 
+        hidden:true,
+        columnWidth : 0
+    }, {
+        xtype : "dbfindtrigger", 
+        name : "pu_buyername", 
+        bind : "{pu_buyername}", 
+        fieldLabel : "采购员名称", 
+        allowBlank : true, 
+        columnWidth : 0.25
+    }, {
+        xtype : "textfield", 
+        name : "pu_shipaddresscode", 
+        bind : "{pu_shipaddresscode}", 
+        fieldLabel : "交货地址", 
+        allowBlank : true, 
+        columnWidth : 0.25
+    }, {
+        xtype : "textfield", 
+        name : "pu_total", 
+        bind : "{pu_total}", 
+        fieldLabel : "单据金额", 
+        allowBlank : true, 
+        columnWidth : 0.25
+    }, {
+        name : "detailGridField", 
+        xtype : "detailGridField", 
+        bind: {
+            store:{
+                data:'{detailGridField}'
+            }
+        },
+        columns : [
+            {
+                text : "序号", 
+                dataIndex : "pdDetno", 
+                width : 80.0, 
+                xtype : "rownumberer"
+            }, {
+                text : "id", 
+                dataIndex : "id", 
+                xtype : "numbercolumn"
+            },
+            {
+                editor : {
+                    displayField : "display", 
+                    editable : true, 
+                    format : "", 
+                    hideTrigger : false, 
+                    maxLength : 100.0, 
+                    minValue : null, 
+                    positiveNum : false, 
+                    queryMode : "local", 
+                    store : null, 
+                    valueField : "value", 
+                    xtype : "dbfindtrigger"
+                }, 
+                text : "物料编号", 
+                width : 200.0, 
+                dataIndex : "pd_prodcode", 
+                xtype : "", 
+                items : null
+            },
+            {
+                text : "单位", 
+                editor : {
+                    xtype : "textfield"
+                }, 
+                dataIndex : "pd_unit", 
+                width : 120.0, 
+                xtype : "", 
+                items : null
+            }, 
+            {
+                text : "数量", 
+                dataIndex : "pd_yqty", 
+                width : 120.0, 
+                xtype : "numbercolumn", 
+                items : null
+            }, 
+            {
+                text : "单价", 
+                dataIndex : "pd_price", 
+                width : 120.0, 
+                xtype : "numbercolumn", 
+                items : null
+            }, 
+            {
+                text : "税率", 
+                dataIndex : "pd_taxrate", 
+                width : 120.0, 
+                xtype : "numbercolumn", 
+                items : null
+            },
+            {
+                text : "含税金额", 
+                dataIndex : "pd_total", 
+                width : 120.0, 
+                xtype : "numbercolumn"
+            }, 
+            {
+                text : "未税金额", 
+                dataIndex : "pd_taxtotal", 
+                xtype : "numbercolumn"
+            },{
+                text : "需求日期", 
+                dataIndex : "pd_delivery", 
+                flex : 1.0, 
+                xtype:'datecolumn',
+                format : "Y-m-d H:i:s", 
+                editor : {
+                    xtype : "datetimefield",
+                    editable : true, 
+                    format : "Y-m-d H:i:s", 
+                    hideTrigger : false
+                }
+            },
+            {
+                text : "关联销售单号", 
+                dataIndex : "pd_salecode", 
+                width : 120.0,
+                flex : 1.0
+            }
+        ]
+    }, {
+        format : "Y-m-d", 
+        xtype : "datetimefield", 
+        name : "createTime", 
+        bind : "{createTime}", 
+        fieldLabel : "创建时间", 
+        allowBlank : true, 
+        columnWidth : 0.25
+    }, {
+        xtype : "datefield", 
+        name : "updateTime", 
+        bind : "{updateTime}", 
+        fieldLabel : "更新时间", 
+        allowBlank : true, 
+        columnWidth : 0.25
+    }, {
+        xtype : "textfield", 
+        readOnly : true, 
+        editable : false, 
+        name : "puStatus", 
+        bind : "{puStatus}", 
+        fieldLabel : "单据状态", 
+        allowBlank : true, 
+        columnWidth : 0.25
+    }, {
+        xtype : "hidden", 
+        readOnly : true, 
+        editable : false, 
+        name : "pu_statuscode", 
+        bind : "{pu_statuscode}", 
+        fieldLabel : "单据状态码", 
+        allowBlank : true, 
+        columnWidth : 0.0
+    }]
+});

+ 249 - 0
frontend/saas-web/app/view/purchase/purchase/QueryPanel.js

@@ -0,0 +1,249 @@
+Ext.define('saas.view.purchase.purchase.QueryPanel', {
+    extend: 'saas.view.core.query.QueryPanel',
+    xtype: 'purchase-purchase-querypanel',
+
+    viewModel: 'purchase-purchase-querypanel',
+    viewName: 'purchase-purchase-formpanel',
+    _baseVastUrl:'http://192.168.253.58:8800/purchase/',
+    _idField:'pu_id',
+    _codeField:'pu_code',
+    queryFormItems: [{
+        xtype: 'hidden',
+        name: 'pu_id',
+        bind: '{pu_id}',
+        fieldLabel: 'ID',
+        allowBlank: true,
+        columnWidth: 0
+    }, {
+        xtype: 'dbfindtrigger',
+        name: 'pu_code',
+        bind: '{pu_code}',
+        fieldLabel: '单据编号',
+        allowBlank: true,
+        columnWidth: 0.25,
+        dataUrl:'http://192.168.253.41:9480/api/document/vendor/getVendorsByCondition',
+        dbfinds:[{
+            from:'ve_code',to:'pu_code'
+        }],
+        dbColumns:[{
+            conditionCode:'ve_id',
+            "text": "供应商ID",
+            "flex": 0,
+            "dataIndex": "ve_id",
+            "width": 0,
+            "xtype": "",
+            "items": null
+        },{
+            conditionCode:'ve_code',
+            "text": "供应商编号",
+            "flex": 1,
+            "dataIndex": "ve_code",
+            "width": 100,
+            "xtype": "",
+            "items": null
+        }, {
+            conditionCode:'ve_name',
+            "text": "供应商名称",
+            "flex": 1,
+            "dataIndex": "ve_name",
+            "xtype": "",
+            "items": null
+        }, {
+            conditionCode:'ve_type',
+            "text": "供应商类型",
+            "flex": 0,
+            "dataIndex": "ve_type",
+            "width": 200,
+            "xtype": "",
+            "items": null
+        }]
+    }, {
+        xtype: 'condatefield',
+        name: 'pu_date',
+        bind: '{pu_date}',
+        fieldLabel: '采购日期',
+        allowBlank: true,
+        columnWidth: 0.5
+    }, {
+        xtype: 'dbfindtrigger',
+        name: 'pu_vendcode',
+        bind: '{pu_vendcode}',
+        fieldLabel: '供应商编号',
+        allowBlank: true,
+        columnWidth: 0.25,
+        configUrl: 'resources/json/purchase/vendorColumnsDbfind.json',
+        dataUrl: 'resources/json/purchase/vendorDataDbfind.json'
+    }, {
+        xtype: 'textfield',
+        name: 'pu_vendname',
+        bind: '{pu_vendname}',
+        fieldLabel: '供应商名称',
+        allowBlank: true,
+        columnWidth: 0.25
+    }, {
+        xtype: 'dbfindtrigger',
+        name: 'pd_prodcode#pd_prodcode',
+        bind: '{pd_prodcode}',
+        fieldLabel: '物料编号',
+        fieldMode: 'DETAIL',
+        queryType:'VAG',
+        allowBlank: true,
+        columnWidth: 0.25,
+        configUrl: 'resources/json/purchase/vendorColumnsDbfind.json',
+        dataUrl: 'resources/json/purchase/vendorDataDbfind.json'
+    }, {
+        xtype: 'textfield',
+        name: 'pr_detail',
+        bind: '{pr_detail}',
+        fieldLabel: '物料名称',
+        allowBlank: true,
+        columnWidth: 0.25
+    }, {
+        xtype: 'combobox',
+        name: 'pr_statuscode',
+       // bind: '{pr_statuscode}',
+        fieldLabel: '审核状态',
+        allowBlank: true,
+        columnWidth: 0.25,
+        queryMode: 'local',
+            displayField: 'pr_status',
+            valueField: 'pr_statuscode',
+            store: Ext.create('Ext.data.ArrayStore', {
+            fields: ['pr_statuscode', 'pr_status'],
+            data: [
+                ["$ALL", "全部"],
+                ["AUDITED", "已审核"],
+                ["UNAUDITED", "未审核"]
+            ]
+        })
+    }, {
+        xtype: 'multicombo',
+        name: 'pu_acceptstatuscode',
+       // bind: '{pu_acceptstatuscode}',
+        fieldLabel: '入库状态',
+        allowBlank: true,
+        columnWidth: 0.25,
+        datas: [
+                ["TURNOUT", "已入库"],
+                ["NOOUT", "未入库"],
+                ["PARTOUT", "部分入库"]
+            ]
+    }],
+    moreQueryFormItems: [{
+        xtype: 'textfield',
+        name: 'pu_buyername',
+        bind: '{pu_buyername}',
+        fieldLabel: '采购员',
+        allowBlank: true
+    }, {
+        xtype: 'textfield',
+        name: 'pu_total',
+        bind: '{pu_total}',
+        fieldLabel: '金额',
+        allowBlank: true
+    }, {
+        xtype: 'condatefield',
+        name: 'pu_delivery',
+        bind: '{pu_delivery}',
+        fieldLabel: '交货日期',
+        allowBlank: true,
+        columnWidth: 1
+    }],
+    queryGridConfig: {
+        _idField:'pu_id',
+        _codeField:'pu_code',
+        _title:'采购单',
+        _addXtype:'test-order-formpanel',
+        _baseVastUrl:'http://192.168.253.58:8800/purchase/',
+        _baseColumn: [{
+            text: '序号',
+            width: 80,
+            xtype: 'rownumberer'
+        }, {
+            text: 'id',
+            dataIndex: 'pu_id',
+            width: 100,
+            xtype: 'numbercolumn'
+        }, {
+            text: '单据编号',
+            dataIndex: 'pu_code',
+            width: 120
+        }, {
+            text: '单据状态',
+            dataIndex: 'pu_status',
+            width: 120
+        }, {
+            text: '下单日期',
+            dataIndex: 'pu_indate',
+            xtype:'datecolumn',
+            width: 200
+        },{
+            text: '供应商名称',
+            dataIndex: 'pu_vendname',
+            width: 120
+        },{
+            text: '含税金额',
+            dataIndex: 'pu_taxtotal',
+            xtype:'numbercolumn',
+            width: 120
+        },{
+            text: '金额',
+            dataIndex: 'pu_total',
+            xtype:'numbercolumn',
+            width: 120,
+            flex: 1
+        }],
+        _relativeColumn: [{
+            text: '序号',
+            width: 80,
+            xtype: 'rownumberer'
+        }, {
+            text: 'id',
+            dataIndex: 'pu_id',
+            width: 100,
+            xtype: 'numbercolumn'
+        }, {
+            text: '单据编号',
+            dataIndex: 'pu_code',
+            width: 120
+        }, {
+            text: '单据状态',
+            dataIndex: 'pu_status',
+            width: 120
+        }, {
+            text: '下单日期',
+            dataIndex: 'pu_indate',
+            xtype:'datecolumn',
+            width: 200
+        },{
+            text: '供应商名称',
+            dataIndex: 'pu_vendname',
+            width: 120
+        },{
+            text: '采购序号',
+            dataIndex: 'pd_detno',
+            xtype:'numbercolumn',
+            width: 120
+        },{
+            text: '物料编号',
+            dataIndex: 'pd_prodcode',
+            width: 120
+        },{
+            text: '数量',
+            dataIndex: 'pd_qty',
+            xtype:'numbercolumn',
+            width: 120
+        },{
+            text: '单价',
+            dataIndex: 'pd_price',
+            xtype:'numbercolumn',
+            width: 120
+        },{
+            text: '已转数',
+            dataIndex: 'pd_ytqy',
+            xtype:'numbercolumn',
+            width: 120,
+            flex: 1
+        }]
+    }
+});

+ 5 - 0
frontend/saas-web/app/view/purchase/purchase/QueryPanelController.js

@@ -0,0 +1,5 @@
+Ext.define('saas.view.purchase.purchase.QueryPanelController', {
+    extend: 'saas.view.core.query.QueryPanelController',
+    alias: 'controller.purchase-purchase-querypanel',
+
+});

+ 9 - 0
frontend/saas-web/app/view/purchase/purchase/QueryPanelModel.js

@@ -0,0 +1,9 @@
+Ext.define('saas.view.purchase.purchase.QueryPanelModel', {
+    extend: 'saas.view.core.query.QueryPanelModel',
+    alias: 'viewmodel.purchase-purchase-querypanel',
+
+    data: {
+       // pu_total: '3333',
+        //pu_code: '4'
+    }
+});

+ 137 - 0
frontend/saas-web/app/view/purchase/purchaseIn/FormController.js

@@ -0,0 +1,137 @@
+Ext.define('saas.view.purchase.purchaseIn.FormController', {
+    extend: 'saas.view.core.form.FormPanelController',
+    alias: 'controller.purchase-purchaseIn-formcontroller',
+    init: function (form) {
+        var me = this;
+        this.control({
+            /**放大镜新增demo*/
+            "field[name=combo]":{
+                beforerender:function(f){
+                    f.addHandler=me.addCombo;
+                }
+            },
+            //放大镜赋值关系 以及 tpl模板
+            'dbfindtrigger[name=pu_vendcode]':{
+                beforerender:function(f){
+                    Ext.apply(f,{
+                        dataUrl:'http://192.168.253.41:9480/api/document/vendor/getVendorsByCondition',
+                        dbfinds:[{
+                            from:'ve_code',to:'pu_vendcode'
+                        },{
+                            from:'ve_name',to:'pu_vendname'
+                        }],
+                        dbtpls:[{
+                            field:'ve_code',width:100
+                        },{
+                            field:'ve_name',width:100
+                        }],
+                        dbColumns:[{
+                            conditionCode:'ve_id',
+                            "text": "供应商ID",
+                            "flex": 0,
+                            "dataIndex": "ve_id",
+                            "width": 0,
+                            "xtype": "",
+                            "items": null
+                        },{
+                            conditionCode:'ve_code',
+                            "text": "供应商编号",
+                            "flex": 1,
+                            "dataIndex": "ve_code",
+                            "width": 100,
+                            "xtype": "",
+                            "items": null
+                        }, {
+                            conditionCode:'ve_name',
+                            "text": "供应商名称",
+                            "flex": 1,
+                            "dataIndex": "ve_name",
+                            "xtype": "",
+                            "items": null
+                        }, {
+                            conditionCode:'ve_type',
+                            "text": "供应商类型",
+                            "flex": 0,
+                            "dataIndex": "ve_type",
+                            "width": 200,
+                            "xtype": "",
+                            "items": null
+                        }]
+                    }) ;   
+
+                }
+            },
+            //放大镜赋值关系 以及 tpl模板
+            'dbfindtrigger[name=pd_prodcode]':{
+                beforerender:function(f){
+                    Ext.apply(f,{
+                        conditionCode:'pr_code',
+                        dataUrl:'http://192.168.253.41:9480/api/document/product/getProductsByCondition',
+                        dbfinds:[{
+                            from:'pr_code',to:'pd_prodcode'
+                        }],
+                        dbtpls:[{
+                            field:'pr_code',width:100
+                        },{
+                            field:'pr_detail',width:100
+                        }],
+                        dbColumns:[{
+                            "text": "物料ID",
+                            "flex": 0,
+                            "dataIndex": "pr_id",
+                            "width": 0,
+                            "xtype": "",
+                            "items": null
+                        },{
+                            "text": "物料编号",
+                            "flex": 1,
+                            "dataIndex": "pr_code",
+                            "width": 100,
+                            "xtype": "",
+                            "items": null
+                        }, {
+                            "text": "物料名称",
+                            "flex": 1,
+                            "dataIndex": "pr_detail",
+                            "xtype": "",
+                            "items": null
+                        }, {
+                            "text": "物料规格",
+                            "flex": 0,
+                            "dataIndex": "pr_spec",
+                            "width": 200,
+                            "xtype": "",
+                            "items": null
+                        }]
+                    }) ;   
+
+                }
+            }
+        });
+
+    },
+    addCombo:function(){
+        var combo=this.ownerCmp;
+        Ext.create('Ext.window.Window',{
+            layout:'vbox',
+            bodyPadding: 15,
+            width:500,
+            items:[{
+                fieldLabel:'实际值',
+                xtype:'textfield'
+            },{
+                fieldLabel:'显示值',
+                xtype:'textfield'
+            }],
+            buttons:[{
+                text:'确认',
+                handler:function(b){
+                    combo.setValue('ok');
+                    b.up('window').close();
+                }
+            }],
+            renderTo:this.ownerCmp.ownerCt.getEl()
+        }).show();
+
+    }
+});

+ 7 - 0
frontend/saas-web/app/view/purchase/purchaseIn/FormModel.js

@@ -0,0 +1,7 @@
+Ext.define('saas.view.purchase.purchaseIn.FormModel', {
+    extend: 'saas.view.core.form.FormPanelModel',
+    alias: 'viewmodel.purchase-purchaseIn-formmodel',
+    data: {
+        pi_class: '采购验收单'
+     }
+});

+ 275 - 0
frontend/saas-web/app/view/purchase/purchaseIn/FormPanel.js

@@ -0,0 +1,275 @@
+Ext.define('saas.view.purchase.purchaseIn.FormPanel', {
+    extend: 'saas.view.core.form.FormPanel',
+    xtype: 'purchase-purchaseIn-formpanel',
+
+    controller: 'purchase-purchaseIn-formcontroller',
+    viewModel: 'purchase-purchaseIn-formmodel',
+    
+    _title:'采购验收单',
+    _codeField: 'pi_inoutno',
+    _statusField: 'pu_status',
+    _statusCodeField: 'pu_statuscode',
+    _idField: 'id',
+    _detnoColumn:  'pd_pdno',
+    _dataModelUrl:'http://192.168.253.58:8800/purchase/read/',
+    _saveUrl:'http://192.168.253.58:8800/purchase/save',
+    _auditUrl:'http://192.168.253.58:8800/purchase/audit',
+    _deleteUrl:'http://192.168.253.58:8800/purchase/delete/',
+    _deleteDetailUrl:'http://192.168.253.58:8800/purchase/deleteItem/',
+    initId:0,
+
+    toolBtns: [{
+        xtype: 'button',
+        text: '转单按钮',
+        handler: function() {
+            console.log('11');
+        }
+    }],
+
+    defaultItems: [{
+        xtype: 'hidden',
+        name: 'id',
+        bind: '{id}',
+        fieldLabel: 'id',
+        allowBlank: true,
+        columnWidth: 0
+    }, {
+        xtype : "textfield", 
+        name : "pi_inoutno", 
+        bind : "{pi_inoutno}", 
+        fieldLabel : "验收单号", 
+        allowBlank : true, 
+        columnWidth : 0.25
+    },{
+        xtype : "textfield", 
+        name : "pi_class", 
+        bind : "{pi_class}", 
+        fieldLabel : "类型", 
+        readOnly:true,
+        allowBlank : true, 
+        columnWidth : 0.25
+    }, {
+        xtype : "hidden", 
+        name : "pu_vendid", 
+        bind : "{pu_vendid}", 
+        fieldLabel : "供应商ID", 
+        allowBlank : true, 
+        columnWidth : 0.0
+    }, {
+        xtype : "textfield", 
+        name : "pu_vendcode", 
+        bind : "{pu_vendcode}", 
+        fieldLabel : "供应商编号", 
+        hidden:true,
+        allowBlank : true, 
+        columnWidth : 0, 
+    }, {
+        xtype : "dbfindtrigger", 
+        name : "pu_vendname", 
+        bind : "{pu_vendname}", 
+        fieldLabel : "供应商名称", 
+        allowBlank : true, 
+        columnWidth : 0.25
+    },{
+        xtype : "datefield", 
+        name : "pu_date", 
+        bind : "{pu_date}", 
+        fieldLabel : "采购日期", 
+        allowBlank : false, 
+        columnWidth : 0.25
+    }, {
+        xtype : "hidden", 
+        name : "pu_buyerid", 
+        bind : "{pu_buyerid}", 
+        fieldLabel : "采购员ID", 
+        allowBlank : true, 
+        columnWidth : 0.0
+    }, {
+        xtype : "textfield", 
+        name : "pu_buyercode", 
+        bind : "{pu_buyercode}", 
+        fieldLabel : "采购员编号", 
+        allowBlank : true, 
+        hidden:true,
+        columnWidth : 0
+    }, {
+        xtype : "dbfindtrigger", 
+        name : "pu_buyername", 
+        bind : "{pu_buyername}", 
+        fieldLabel : "采购员名称", 
+        allowBlank : true, 
+        columnWidth : 0.25
+    }, {
+        xtype : "textfield", 
+        name : "pu_shipaddresscode", 
+        bind : "{pu_shipaddresscode}", 
+        fieldLabel : "交货地址", 
+        allowBlank : true, 
+        columnWidth : 0.25
+    }, {
+        xtype : "textfield", 
+        name : "pu_total", 
+        bind : "{pu_total}", 
+        fieldLabel : "单据金额", 
+        allowBlank : true, 
+        columnWidth : 0.25
+    }, {
+        name : "detailGridField", 
+        xtype : "detailGridField", 
+        bind: {
+            store:{
+                data:'{detailGridField}'
+            }
+        },
+        columns : [
+            {
+                text : "序号", 
+                dataIndex : "pd_pdno", 
+                width : 80.0, 
+                xtype : "rownumberer"
+            }, {
+                text : "id", 
+                dataIndex : "id", 
+                xtype : "numbercolumn"
+            },
+            {
+                editor : {
+                    displayField : "display", 
+                    editable : true, 
+                    format : "", 
+                    hideTrigger : false, 
+                    maxLength : 100.0, 
+                    minValue : null, 
+                    positiveNum : false, 
+                    queryMode : "local", 
+                    store : null, 
+                    valueField : "value", 
+                    xtype : "dbfindtrigger"
+                }, 
+                text : "物料编号", 
+                width : 200.0, 
+                dataIndex : "pd_prodcode", 
+                xtype : "", 
+                items : null
+            },
+            {
+                text : "单位", 
+                editor : {
+                    xtype : "textfield"
+                }, 
+                dataIndex : "pd_unit", 
+                width : 120.0, 
+                xtype : "", 
+                items : null
+            }, 
+            {
+                text : "数量", 
+                dataIndex : "pd_inqty", 
+                width : 120.0, 
+                xtype : "numbercolumn", 
+                items : null
+            }, 
+            {
+                text : "仓库", 
+                dataIndex : "pd_whname", 
+                width : 120.0, 
+                xtype : "numbercolumn", 
+                items : null,
+                editor : {
+                    displayField : "display", 
+                    editable : true, 
+                    format : "", 
+                    hideTrigger : false, 
+                    maxLength : 100.0, 
+                    minValue : null, 
+                    positiveNum : false, 
+                    queryMode : "local", 
+                    store : null, 
+                    valueField : "value", 
+                    xtype : "dbfindtrigger"
+                }
+            },
+            {
+                text : "单价", 
+                dataIndex : "pd_orderprice", 
+                width : 120.0, 
+                xtype : "numbercolumn", 
+                items : null
+            }, 
+           {
+                text : "含税金额", 
+                dataIndex : "pd_total", 
+                width : 120.0, 
+                xtype : "numbercolumn"
+            }, {
+                text : "税率", 
+                dataIndex : "pd_taxrate", 
+                width : 120.0, 
+                xtype : "numbercolumn", 
+                items : null
+            },
+            {
+                text : "未税金额", 
+                dataIndex : "pd_nettotal", 
+                xtype : "numbercolumn"
+            },
+            {
+                text : "采购单号", 
+                dataIndex : "pd_ordercode", 
+                width : 120.0,
+                flex : 1.0,
+                editor : {
+                    displayField : "display", 
+                    editable : true, 
+                    format : "", 
+                    hideTrigger : false, 
+                    maxLength : 100.0, 
+                    minValue : null, 
+                    positiveNum : false, 
+                    queryMode : "local", 
+                    store : null, 
+                    valueField : "value", 
+                    xtype : "dbfindtrigger"
+                }
+            },{
+                text : "采购序号", 
+                dataIndex : "pd_orderdetno", 
+                xtype : "numbercolumn",
+                flex:1
+            }
+        ]
+    }, {
+        format : "Y-m-d", 
+        xtype : "datefield", 
+        name : "createTime", 
+        bind : "{createTime}", 
+        fieldLabel : "创建时间", 
+        allowBlank : true, 
+        columnWidth : 0.25
+    }, {
+        xtype : "datefield", 
+        name : "updateTime", 
+        bind : "{updateTime}", 
+        fieldLabel : "更新时间", 
+        allowBlank : true, 
+        columnWidth : 0.25
+    }, {
+        xtype : "textfield", 
+        readOnly : true, 
+        editable : false, 
+        name : "pu_status", 
+        bind : "{pu_status}", 
+        fieldLabel : "单据状态", 
+        allowBlank : true, 
+        columnWidth : 0.25
+    }, {
+        xtype : "hidden", 
+        readOnly : true, 
+        editable : false, 
+        name : "pu_statuscode", 
+        bind : "{pu_statuscode}", 
+        fieldLabel : "单据状态码", 
+        allowBlank : true, 
+        columnWidth : 0.0
+    }]
+});

+ 256 - 0
frontend/saas-web/app/view/purchase/purchaseIn/QueryPanel.js

@@ -0,0 +1,256 @@
+Ext.define('saas.view.purchase.purchaseIn.QueryPanel', {
+    extend: 'saas.view.core.query.QueryPanel',
+    xtype: 'purchase-purchaseIn-querypanel',
+
+    controller: 'purchase-purchaseIn-queryformcontroller',
+    viewModel: 'purchase-purchaseIn-queryformmodel',
+    _baseVastUrl:'http://192.168.253.58:8800/purchase/',
+    _idField:'pi_id',
+    _codeField:'pi_inoutno',
+    queryFormItems: [{
+        xtype: 'hidden',
+        name: 'pi_id',
+        bind: '{pi_id}',
+        fieldLabel: 'ID',
+        allowBlank: true,
+        columnWidth: 0
+    }, {
+        xtype: 'dbfindtrigger',
+        name: 'pi_inoutno',
+        bind: '{pi_inoutno}',
+        fieldLabel: '单据编号',
+        allowBlank: true,
+        columnWidth: 0.25,
+        dataUrl:'http://192.168.253.41:9480/api/document/vendor/getVendorsByCondition',
+        dbfinds:[{
+            from:'ve_code',to:'pu_code'
+        }],
+        dbColumns:[{
+            conditionCode:'ve_id',
+            "text": "供应商ID",
+            "flex": 0,
+            "dataIndex": "ve_id",
+            "width": 0,
+            "xtype": "",
+            "items": null
+        },{
+            conditionCode:'ve_code',
+            "text": "供应商编号",
+            "flex": 1,
+            "dataIndex": "ve_code",
+            "width": 100,
+            "xtype": "",
+            "items": null
+        }, {
+            conditionCode:'ve_name',
+            "text": "供应商名称",
+            "flex": 1,
+            "dataIndex": "ve_name",
+            "xtype": "",
+            "items": null
+        }, {
+            conditionCode:'ve_type',
+            "text": "供应商类型",
+            "flex": 0,
+            "dataIndex": "ve_type",
+            "width": 200,
+            "xtype": "",
+            "items": null
+        }]
+    }, {
+        xtype: 'condatefield',
+        name: 'pu_date',
+        bind: '{pu_date}',
+        fieldLabel: '采购日期',
+        allowBlank: true,
+        columnWidth: 0.5
+    }, {
+        xtype: 'dbfindtrigger',
+        name: 'pu_vendcode',
+        bind: '{pu_vendcode}',
+        fieldLabel: '供应商编号',
+        allowBlank: true,
+        columnWidth: 0.25,
+        configUrl: 'resources/json/purchase/vendorColumnsDbfind.json',
+        dataUrl: 'resources/json/purchase/vendorDataDbfind.json'
+    }, {
+        xtype: 'textfield',
+        name: 'pu_vendname',
+        bind: '{pu_vendname}',
+        fieldLabel: '供应商名称',
+        allowBlank: true,
+        columnWidth: 0.25
+    }, {
+        xtype: 'dbfindtrigger',
+        name: 'pd_prodcode#pd_prodcode',
+        bind: '{pd_prodcode}',
+        fieldLabel: '物料编号',
+        fieldMode: 'DETAIL',
+        queryType:'VAG',
+        allowBlank: true,
+        columnWidth: 0.25,
+        configUrl: 'resources/json/purchase/vendorColumnsDbfind.json',
+        dataUrl: 'resources/json/purchase/vendorDataDbfind.json'
+    }, {
+        xtype: 'textfield',
+        name: 'pr_detail',
+        bind: '{pr_detail}',
+        fieldLabel: '物料名称',
+        allowBlank: true,
+        columnWidth: 0.25
+    }, {
+        xtype: 'combobox',
+        name: 'pr_statuscode',
+       // bind: '{pr_statuscode}',
+        fieldLabel: '审核状态',
+        allowBlank: true,
+        columnWidth: 0.25,
+        queryMode: 'local',
+            displayField: 'pr_status',
+            valueField: 'pr_statuscode',
+        store: Ext.create('Ext.data.ArrayStore', {
+            fields: ['pr_statuscode', 'pr_status'],
+            data: [
+                ["$ALL", "全部"],
+                ["AUDITED", "已审核"],
+                ["UNAUDITED", "未审核"]
+            ]
+        })
+    }, {
+        xtype: 'combobox',
+        name: 'pu_acceptstatuscode',
+        bind: '{pu_acceptstatuscode}',
+        fieldLabel: '入库状态',
+        allowBlank: true,
+        columnWidth: 0.25,
+        queryMode: 'local',
+        displayField: 'pu_acceptstatus',
+        valueField: 'pu_acceptstatuscode',
+        store: Ext.create('Ext.data.ArrayStore', {
+            fields: ['pu_acceptstatuscode', 'pu_acceptstatus'],
+            data: [
+                ["$ALL", "全部"],
+                ["TURNOUT", "已入库"],
+                ["NOOUT", "未入库"],
+                ["PARTOUT", "部分入库"]
+            ]
+        })
+    }],
+    moreQueryFormItems: [{
+        xtype: 'textfield',
+        name: 'pu_buyername',
+        bind: '{pu_buyername}',
+        fieldLabel: '采购员',
+        allowBlank: true
+    }, {
+        xtype: 'textfield',
+        name: 'pu_total',
+        bind: '{pu_total}',
+        fieldLabel: '金额',
+        allowBlank: true
+    }, {
+        xtype: 'condatefield',
+        name: 'pu_delivery',
+        bind: '{pu_delivery}',
+        fieldLabel: '交货日期',
+        allowBlank: true,
+        columnWidth: 1
+    }],
+    queryGridConfig: {
+        _idField:'pu_id',
+        _codeField:'pu_code',
+        _title:'采购单',
+        _addXtype:'test-order-formpanel',
+        _baseVastUrl:'http://192.168.253.58:8800/purchase/',
+        _baseColumn: [{
+            text: '序号',
+            width: 80,
+            xtype: 'rownumberer'
+        }, {
+            text: 'id',
+            dataIndex: 'pu_id',
+            width: 100,
+            xtype: 'numbercolumn'
+        }, {
+            text: '单据编号',
+            dataIndex: 'pu_code',
+            width: 120
+        }, {
+            text: '单据状态',
+            dataIndex: 'pu_status',
+            width: 120
+        }, {
+            text: '下单日期',
+            dataIndex: 'pu_indate',
+            xtype:'datecolumn',
+            width: 200
+        },{
+            text: '供应商名称',
+            dataIndex: 'pu_vendname',
+            width: 120
+        },{
+            text: '含税金额',
+            dataIndex: 'pu_taxtotal',
+            xtype:'numbercolumn',
+            width: 120
+        },{
+            text: '金额',
+            dataIndex: 'pu_total',
+            xtype:'numbercolumn',
+            width: 120,
+            flex: 1
+        }],
+        _relativeColumn: [{
+            text: '序号',
+            width: 80,
+            xtype: 'rownumberer'
+        }, {
+            text: 'id',
+            dataIndex: 'pu_id',
+            width: 100,
+            xtype: 'numbercolumn'
+        }, {
+            text: '单据编号',
+            dataIndex: 'pu_code',
+            width: 120
+        }, {
+            text: '单据状态',
+            dataIndex: 'pu_status',
+            width: 120
+        }, {
+            text: '下单日期',
+            dataIndex: 'pu_indate',
+            xtype:'datecolumn',
+            width: 200
+        },{
+            text: '供应商名称',
+            dataIndex: 'pu_vendname',
+            width: 120
+        },{
+            text: '采购序号',
+            dataIndex: 'pd_detno',
+            xtype:'numbercolumn',
+            width: 120
+        },{
+            text: '物料编号',
+            dataIndex: 'pd_prodcode',
+            width: 120
+        },{
+            text: '数量',
+            dataIndex: 'pd_qty',
+            xtype:'numbercolumn',
+            width: 120
+        },{
+            text: '单价',
+            dataIndex: 'pd_price',
+            xtype:'numbercolumn',
+            width: 120
+        },{
+            text: '已转数',
+            dataIndex: 'pd_ytqy',
+            xtype:'numbercolumn',
+            width: 120,
+            flex: 1
+        }]
+    }
+});

+ 5 - 0
frontend/saas-web/app/view/purchase/purchaseIn/QueryPanelController.js

@@ -0,0 +1,5 @@
+Ext.define('saas.view.purchase.purchaseIn.QueryPanelController', {
+    extend: 'saas.view.core.query.QueryPanelController',
+    alias: 'controller.purchase-purchaseIn-queryformcontroller',
+
+});

+ 9 - 0
frontend/saas-web/app/view/purchase/purchaseIn/QueryPanelModel.js

@@ -0,0 +1,9 @@
+Ext.define('saas.view.purchase.purchaseIn.QueryPanelModel', {
+    extend: 'saas.view.core.query.QueryPanelModel',
+    alias: 'viewmodel.purchase-purchaseIn-queryformmodel',
+
+    data: {
+       // pu_total: '3333',
+        //pu_code: '4'
+    }
+});

+ 1 - 0
frontend/saas-web/app/view/test/order/FormModel.js

@@ -2,4 +2,5 @@ Ext.define('saas.view.test.order.FormModel', {
     extend: 'saas.view.core.form.FormPanelModel',
     alias: 'viewmodel.test-order-formmodel',
 
+    
 });

+ 32 - 28
frontend/saas-web/app/view/test/order/FormPanel.js

@@ -5,17 +5,20 @@ Ext.define('saas.view.test.order.FormPanel', {
     controller: 'test-order-formcontroller',
     viewModel: 'test-order-formmodel',
     
+    //字段属性
     _title:'采购单',
-    _codeField: 'pu_ode',
-    _statusField: 'pu_statuscode',
     _idField: 'id',
+    _codeField: 'pu_code',
+    _statusField: 'pu_status',
+    _statusCodeField: 'pu_statuscode',
     _detnoColumn:  'pd_detno',
-    _dataModelUrl:'http://192.168.253.58:8800/purchase/read/',
+    _relationColumn: 'pd_puid',
+    _readUrl:'http://192.168.253.58:8800/purchase/read/',
     _saveUrl:'http://192.168.253.58:8800/purchase/save',
     _auditUrl:'http://192.168.253.58:8800/purchase/audit',
     _deleteUrl:'http://192.168.253.58:8800/purchase/delete/',
     _deleteDetailUrl:'http://192.168.253.58:8800/purchase/deleteItem/',
-    initId:0,
+    initId:11,
 
     toolBtns: [{
         xtype: 'button',
@@ -36,7 +39,7 @@ Ext.define('saas.view.test.order.FormPanel', {
         xtype : "textfield", 
         name : "pu_code", 
         bind : "{pu_code}", 
-        fieldLabel : "采购单号", 
+        fieldLabel : "采购单号",
         allowBlank : true, 
         columnWidth : 0.25
     }, {
@@ -44,8 +47,9 @@ Ext.define('saas.view.test.order.FormPanel', {
         name : "pu_date", 
         bind : "{pu_date}", 
         fieldLabel : "采购日期", 
-        allowBlank : true, 
-        columnWidth : 0.25
+        allowBlank : false, 
+        columnWidth : 0.25,
+        format:'Y-m-d'
     }, {
         xtype : "hidden", 
         name : "pu_vendid", 
@@ -120,15 +124,10 @@ Ext.define('saas.view.test.order.FormPanel', {
     }, {
         name : "detailGridField", 
         xtype : "detailGridField", 
-        bind: {
-            store:{
-                data:'{detailGridField}'
-            }
-        },
         columns : [
             {
                 text : "序号", 
-                dataIndex : "pdDetno", 
+                dataIndex : "pd_detno", 
                 width : 80.0, 
                 xtype : "rownumberer"
             }, 
@@ -187,23 +186,18 @@ Ext.define('saas.view.test.order.FormPanel', {
                 dataIndex : "pd_taxtotal", 
                 flex : 1.0, 
                 xtype : "numbercolumn"
-            }, 
-            {
-                text : "id", 
-                dataIndex : "id", 
-                flex : 1.0, 
-                xtype : "numbercolumn"
             }
         ]
     }, {
         format : "Y-m-d", 
-        xtype : "datetimefield", 
+        xtype : "datefield", 
         name : "createTime", 
         bind : "{createTime}", 
         fieldLabel : "创建时间", 
         allowBlank : true, 
         columnWidth : 0.25
     }, {
+        format : "Y-m-d",
         xtype : "datefield", 
         name : "updateTime", 
         bind : "{updateTime}", 
@@ -214,19 +208,29 @@ Ext.define('saas.view.test.order.FormPanel', {
         xtype : "textfield", 
         readOnly : true, 
         editable : false, 
-        name : "puStatus", 
-        bind : "{puStatus}", 
+        name : "pu_status", 
+        bind : "{pu_status}", 
         fieldLabel : "单据状态", 
         allowBlank : true, 
         columnWidth : 0.25
-    }, {
-        xtype : "hidden", 
-        readOnly : true, 
-        editable : false, 
+    }, 
+    // {
+    //     xtype : "hidden", 
+    //     readOnly : true, 
+    //     editable : false, 
+    //     name : "pu_statuscode", 
+    //     bind : "{pu_statuscode}", 
+    //     fieldLabel : "单据状态码", 
+    //     allowBlank : true, 
+    //     columnWidth : 0.0
+    // },
+    {
+        xtype : "textfield", 
         name : "pu_statuscode", 
         bind : "{pu_statuscode}", 
-        fieldLabel : "单据状态码", 
+        fieldLabel : "忽略字段", 
+        ignore:true,
         allowBlank : true, 
-        columnWidth : 0.0
+        columnWidth : 0.25
     }]
 });

+ 65 - 10
frontend/saas-web/app/view/test/query/QueryPanel.js

@@ -83,10 +83,11 @@ Ext.define('saas.view.test.query.QueryPanel', {
         columnWidth: 0.25
     }, {
         xtype: 'dbfindtrigger',
-        name: 'pd_prodcode',
+        name: 'pd_prodcode#pd_prodcode',
         bind: '{pd_prodcode}',
         fieldLabel: '物料编号',
         fieldMode: 'DETAIL',
+        queryType:'VAG',
         allowBlank: true,
         columnWidth: 0.25,
         configUrl: 'resources/json/purchase/vendorColumnsDbfind.json',
@@ -99,17 +100,17 @@ Ext.define('saas.view.test.query.QueryPanel', {
         allowBlank: true,
         columnWidth: 0.25
     }, {
-        xtype: 'remotecombo',
+        xtype: 'combobox',
         name: 'pr_statuscode',
         bind: '{pr_statuscode}',
         fieldLabel: '审核状态',
         allowBlank: true,
         columnWidth: 0.25,
+        queryMode: 'local',
+        displayField: 'pr_status',
+        valueField: 'pr_statuscode',
         store: Ext.create('Ext.data.Store', {
             fields: ['pr_statuscode', 'pr_status'],
-            queryMode: 'local',
-            displayField: 'pr_status',
-            valueField: 'pr_statuscode',
             data: [
                 ["$ALL", "全部"],
                 ["=AUDITED", "已审核"],
@@ -117,17 +118,17 @@ Ext.define('saas.view.test.query.QueryPanel', {
             ]
         })
     }, {
-        xtype: 'remotecombo',
+        xtype: 'combobox',
         name: 'pu_acceptstatuscode',
         bind: '{pu_acceptstatuscode}',
         fieldLabel: '入库状态',
         allowBlank: true,
         columnWidth: 0.25,
+        queryMode: 'local',
+        displayField: 'pu_acceptstatus',
+        valueField: 'pu_acceptstatuscode',
         store: Ext.create('Ext.data.Store', {
             fields: ['pu_acceptstatuscode', 'pu_acceptstatus'],
-            queryMode: 'local',
-            displayField: 'pu_acceptstatus',
-            valueField: 'pu_acceptstatuscode',
             data: [
                 ["$ALL", "全部"],
                 ["=TURNOUT", "已入库"],
@@ -159,7 +160,10 @@ Ext.define('saas.view.test.query.QueryPanel', {
     queryGridConfig: {
         _idField:'pu_id',
         _codeField:'pu_code',
-        columns: [{
+        _title:'采购单',
+        _addXtype:'test-order-formpanel',
+        _baseVastUrl:'http://192.168.253.58:8800/purchase/',
+        _baseColumn: [{
             text: '序号',
             width: 80,
             xtype: 'rownumberer'
@@ -195,6 +199,57 @@ Ext.define('saas.view.test.query.QueryPanel', {
             dataIndex: 'pu_total',
             xtype:'numbercolumn',
             width: 120
+        }],
+        _relativeColumn: [{
+            text: '序号',
+            width: 80,
+            xtype: 'rownumberer'
+        }, {
+            text: 'id',
+            dataIndex: 'pu_id',
+            width: 100,
+            xtype: 'numbercolumn'
+        }, {
+            text: '单据编号',
+            dataIndex: 'pu_code',
+            width: 120
+        }, {
+            text: '单据状态',
+            dataIndex: 'pu_status',
+            width: 120
+        }, {
+            text: '下单日期',
+            dataIndex: 'pu_indate',
+            xtype:'datecolumn',
+            width: 200
+        },{
+            text: '供应商名称',
+            dataIndex: 'pu_vendname',
+            width: 120
+        },{
+            text: '采购序号',
+            dataIndex: 'pd_detno',
+            xtype:'numbercolumn',
+            width: 120
+        },{
+            text: '物料编号',
+            dataIndex: 'pd_prodcode',
+            width: 120
+        },{
+            text: '数量',
+            dataIndex: 'pd_qty',
+            xtype:'numbercolumn',
+            width: 120
+        },{
+            text: '单价',
+            dataIndex: 'pd_price',
+            xtype:'numbercolumn',
+            width: 120
+        },{
+            text: '已转数',
+            dataIndex: 'pd_ytqy',
+            xtype:'numbercolumn',
+            width: 120
         }]
     }
 });

+ 12 - 2
frontend/saas-web/app/view/test/query/QueryPanelModel.js

@@ -3,7 +3,17 @@ Ext.define('saas.view.test.query.QueryPanelModel', {
     alias: 'viewmodel.test-query-querypanel',
 
     data: {
-        pu_total: '3333',
-        pu_code: '4'
+       // pu_total: '3333',
+        //pu_code: '4'
+    },
+    formulas: {
+        queryItems1: {
+            get: function(get) {
+                var pu_code = get('pu_code'),
+                pu_date = get('pu_date');
+
+                return '单据编号:' + pu_code + ',采购日期:从' + Ext.Date.format(pu_date.from, 'Y-m-d') + '到' + Ext.Date.format(pu_date.to, 'Y-m-d');
+            }
+        }
     }
 });

+ 6 - 0
frontend/saas-web/ext/build/ext-all-rtl-debug.js

@@ -206312,6 +206312,12 @@ Ext.define('Ext.form.field.Date', {
             rawDate;
         me.lastValue = me.rawDateText;
         me.lastDate = me.rawDate;
+        //解析后台日期格式为 Y-m-d
+        if(v&&(typeof v) == "string"&&v.indexOf('.')==19&&v.indexOf('T')==10){
+            var d = new Date(v);
+            var times=d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate(); //+ ' ' + d.getHours() + ':' + d.getMinutes() + ':' + d.getSeconds(); 
+            v = times;
+        }
         if (Ext.isDate(v)) {
             rawDate = me.rawDate = v;
             me.rawDateText = me.formatDate(v);

Some files were not shown because too many files changed in this diff