Browse Source

Merge branch 'dev' of ssh://10.10.100.21/source/saas-platform into dev

huangx 7 years ago
parent
commit
0546cfc2f0
63 changed files with 1260 additions and 190 deletions
  1. 31 0
      applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/Bom.java
  2. 12 0
      applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/BomDetail.java
  3. 2 2
      applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/Vendor.java
  4. 3 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/BomServiceImpl.java
  5. 6 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/ProductServiceImpl.java
  6. 32 1
      applications/document/document-server/src/main/resources/mapper/BomDetailMapper.xml
  7. 5 2
      applications/document/document-server/src/main/resources/mapper/BomMapper.xml
  8. 1 1
      applications/document/document-server/src/main/resources/mapper/VendorMapper.xml
  9. 9 3
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/PurchaseServiceImpl.java
  10. 1 1
      applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/service/impl/MakeServiceImpl.java
  11. 34 0
      base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/dto/OtherPowerDTO.java
  12. 123 0
      base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/dto/PowerDTO.java
  13. 5 0
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/controller/RoleController.java
  14. 7 0
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/mapper/ResourceMapper.java
  15. 15 0
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/mapper/RoleResourceMapper.java
  16. 43 0
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/po/OtherPower.java
  17. 1 0
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/service/ResourceService.java
  18. 8 0
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/service/RoleService.java
  19. 97 5
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/service/impl/RoleServiceImpl.java
  20. 3 0
      base-servers/account/account-server/src/main/resources/mapper/ResourceMapper.xml
  21. 18 0
      base-servers/account/account-server/src/main/resources/mapper/RoleResourceMapper.xml
  22. 1 0
      base-servers/auth/auth-client/src/main/java/com/usoftchina/saas/auth/client/interceptor/AuthRestInterceptor.java
  23. 1 0
      base-servers/gateway-server/src/main/java/com/usoftchina/saas/gateway/config/AuthFilter.java
  24. 5 1
      framework/core/src/main/java/com/usoftchina/saas/constant/CommonConstants.java
  25. 9 0
      framework/core/src/main/java/com/usoftchina/saas/context/BaseContextHolder.java
  26. 15 4
      frontend/saas-web/app/util/FormUtil.js
  27. 40 8
      frontend/saas-web/app/view/core/form/FormPanel.js
  28. 4 2
      frontend/saas-web/app/view/core/form/FormPanelController.js
  29. 19 7
      frontend/saas-web/app/view/core/form/field/DetailGridField.js
  30. 1 1
      frontend/saas-web/app/view/core/query/QueryGridPanel.js
  31. 12 2
      frontend/saas-web/app/view/document/bom/FormPanel.js
  32. 25 0
      frontend/saas-web/app/view/document/kind/ChildForm.js
  33. 23 0
      frontend/saas-web/app/view/document/kind/Kind.js
  34. 3 3
      frontend/saas-web/app/view/money/othreceipts/FormPanel.js
  35. 3 3
      frontend/saas-web/app/view/money/othspendings/FormPanel.js
  36. 17 3
      frontend/saas-web/app/view/purchase/purchase/FormPanel.js
  37. 12 2
      frontend/saas-web/app/view/purchase/purchaseIn/FormPanel.js
  38. 12 2
      frontend/saas-web/app/view/purchase/purchaseOut/FormPanel.js
  39. 16 4
      frontend/saas-web/app/view/purchase/report/Purchase.js
  40. 1 1
      frontend/saas-web/app/view/purchase/report/PurchasePay.js
  41. 17 5
      frontend/saas-web/app/view/sale/report/Sale.js
  42. 3 3
      frontend/saas-web/app/view/sale/report/SaleController.js
  43. 0 4
      frontend/saas-web/app/view/sale/report/SaleInController.js
  44. 0 4
      frontend/saas-web/app/view/sale/report/SaleInModel.js
  45. 2 2
      frontend/saas-web/app/view/sale/report/SaleProfit.js
  46. 2 2
      frontend/saas-web/app/view/sale/report/SaleProfitController.js
  47. 6 6
      frontend/saas-web/app/view/sale/report/SaleRec.js
  48. 107 0
      frontend/saas-web/app/view/sale/report/SaleRecController.js
  49. 4 0
      frontend/saas-web/app/view/sale/report/SaleRecModel.js
  50. 14 4
      frontend/saas-web/app/view/sale/sale/FormPanel.js
  51. 13 3
      frontend/saas-web/app/view/sale/saleIn/FormPanel.js
  52. 14 4
      frontend/saas-web/app/view/sale/saleOut/FormPanel.js
  53. 16 2
      frontend/saas-web/app/view/stock/appropriationInOut/FormPanel.js
  54. 12 2
      frontend/saas-web/app/view/stock/make/FormPanel.js
  55. 14 2
      frontend/saas-web/app/view/stock/make/FormPanelController.js
  56. 12 2
      frontend/saas-web/app/view/stock/otherIn/FormPanel.js
  57. 4 0
      frontend/saas-web/app/view/stock/otherOut/FormPanel.js
  58. 3 15
      frontend/saas-web/app/view/sys/power/FormPanel.js
  59. 123 48
      frontend/saas-web/app/view/sys/power/GroupGrid.js
  60. 2 2
      frontend/saas-web/app/view/sys/power/OtherField.js
  61. 205 19
      frontend/saas-web/app/view/sys/power/TreePanel.js
  62. 10 0
      frontend/saas-web/overrides/form/Basic.js
  63. 2 2
      frontend/saas-web/resources/json/navigation.json

+ 31 - 0
applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/Bom.java

@@ -1,6 +1,7 @@
 package com.usoftchina.saas.document.entities;
 
 import com.usoftchina.saas.base.entity.CommonBaseEntity;
+import com.usoftchina.saas.document.dto.ProductDTO;
 
 import java.io.Serializable;
 import java.util.Date;
@@ -34,6 +35,36 @@ public class Bom extends CommonBaseEntity implements Serializable {
 
     private String bo_text5;
 
+    private String pr_spec;
+
+    private String pr_brand;
+
+    private String pr_orispeccode;
+
+    public String getPr_spec() {
+        return pr_spec;
+    }
+
+    public void setPr_spec(String pr_spec) {
+        this.pr_spec = pr_spec;
+    }
+
+    public String getPr_brand() {
+        return pr_brand;
+    }
+
+    public void setPr_brand(String pr_brand) {
+        this.pr_brand = pr_brand;
+    }
+
+    public String getPr_orispeccode() {
+        return pr_orispeccode;
+    }
+
+    public void setPr_orispeccode(String pr_orispeccode) {
+        this.pr_orispeccode = pr_orispeccode;
+    }
+
     public Integer getBo_motherid() {
         return bo_motherid;
     }

+ 12 - 0
applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/BomDetail.java

@@ -1,6 +1,8 @@
 package com.usoftchina.saas.document.entities;
 
 import com.usoftchina.saas.base.entity.CommonBaseEntity;
+import com.usoftchina.saas.document.dto.ProductDTO;
+
 import java.io.Serializable;
 
 public class BomDetail extends CommonBaseEntity implements Serializable {
@@ -30,6 +32,16 @@ public class BomDetail extends CommonBaseEntity implements Serializable {
 
     private String bd_text5;
 
+    private ProductDTO productDTO;
+
+    public ProductDTO getProductDTO() {
+        return productDTO;
+    }
+
+    public void setProductDTO(ProductDTO productDTO) {
+        this.productDTO = productDTO;
+    }
+
     public Long getBd_bomid() {
         return bd_bomid;
     }

+ 2 - 2
applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/Vendor.java

@@ -197,11 +197,11 @@ public class Vendor extends CommonBaseEntity implements Serializable{
         this.ve_promisedays = ve_promisedays;
     }
 
-    public double getVe_taxrate() {
+    public Double getVe_taxrate() {
         return ve_taxrate;
     }
 
-    public void setVe_taxrate(double ve_taxrate) {
+    public void setVe_taxrate(Double ve_taxrate) {
         this.ve_taxrate = ve_taxrate;
     }
 

+ 3 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/BomServiceImpl.java

@@ -112,8 +112,11 @@ public class BomServiceImpl extends CommonBaseServiceImpl<BomMapper, Bom> implem
         if(id == null || id <= 0){
             throw new BizException(BizExceptionCode.ILLEGAL_ID);
         }
+        String code = getMapper().selectByPrimaryKey(id).getBo_mothercode();
         getMapper().deleteByPrimaryKey(id);
         bomDetailMapper.deleteByFK(id);
+        //记录LOG
+        messageLogService.delete(generateMsgObj(id, code));
     }
 
     @Override

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

@@ -170,7 +170,12 @@ public class ProductServiceImpl extends CommonBaseServiceImpl<ProductMapper, Pro
     public boolean deleteByPrimaryKey(Long id) {
         //校验物料是否已经在使用状态(采购单、销售单、BOM、出入库单)
         validEnableDel(id);
-        return false;
+        String code = getMapper().getCodeById(id);
+        getMapper().deleteByPrimaryKey(id);
+        DocBaseDTO docBaseDTO = generateMsgObj(id, code);
+        //记录LOG
+        messageLogService.delete(docBaseDTO);
+        return true;
     }
 
     private void validEnableDel(Long id) {

+ 32 - 1
applications/document/document-server/src/main/resources/mapper/BomDetailMapper.xml

@@ -19,6 +19,37 @@
     <result column="bd_text3" property="bd_text3" jdbcType="VARCHAR" />
     <result column="bd_text4" property="bd_text4" jdbcType="VARCHAR" />
     <result column="bd_text5" property="bd_text5" jdbcType="VARCHAR" />
+    <association property="productDTO" javaType="com.usoftchina.saas.document.dto.ProductDTO">
+        <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" />
+        <result column="pr_unit" property="pr_unit" jdbcType="VARCHAR" />
+        <result column="pr_kind" property="pr_kind" jdbcType="VARCHAR" />
+        <result column="pr_orispeccode" property="pr_orispeccode" jdbcType="VARCHAR" />
+        <result column="pr_whid" property="pr_whid" jdbcType="INTEGER" />
+        <result column="pr_whcode" property="pr_whcode" jdbcType="VARCHAR" />
+        <result column="pr_whname" property="pr_whname" jdbcType="VARCHAR" />
+        <result column="pr_zxbzs" property="pr_zxbzs" jdbcType="INTEGER" />
+        <result column="pr_leadtime" property="pr_leadtime" jdbcType="INTEGER" />
+        <result column="pr_brand" property="pr_brand" jdbcType="VARCHAR" />
+        <result column="pr_standardprice" property="pr_standardprice" jdbcType="DOUBLE" />
+        <result column="pr_purcprice" property="pr_purcprice" jdbcType="DOUBLE" />
+        <result column="pr_saleprice" property="pr_saleprice" jdbcType="DOUBLE" />
+        <result column="pr_vendid" property="pr_vendid" jdbcType="INTEGER" />
+        <result column="pr_vendcode" property="pr_vendcode" jdbcType="VARCHAR" />
+        <result column="pr_vendname" property="pr_vendname" jdbcType="VARCHAR" />
+        <result column="pr_docdate" property="pr_docdate" jdbcType="TIMESTAMP" />
+        <result column="pr_recordmanid" property="pr_recordmanid" jdbcType="INTEGER" />
+        <result column="pr_recordman" property="pr_recordman" jdbcType="VARCHAR" />
+        <result column="pr_status" property="pr_status" jdbcType="VARCHAR" />
+        <result column="pr_statuscode" property="pr_statuscode" jdbcType="VARCHAR" />
+        <result column="updateTime" property="updateTime" jdbcType="TIMESTAMP" />
+        <result column="pr_text1" property="pr_text1" jdbcType="VARCHAR" />
+        <result column="pr_text2" property="pr_text2" jdbcType="VARCHAR" />
+        <result column="pr_text3" property="pr_text3" jdbcType="VARCHAR" />
+        <result column="pr_text4" property="pr_text4" jdbcType="VARCHAR" />
+    </association>
   </resultMap>
   <sql id="Base_Column_List" >
     bd_id, bd_bomid, bd_detno, bd_sonid, bd_soncode, bd_unit, bd_baseqty, bd_replace, 
@@ -308,6 +339,6 @@
     WHERE BD_BOMID=#{id}
   </delete>
   <select id="selectByFK" resultMap="BaseResultMap">
-    SELECT * FROM BOMDETAIL WHERE BD_BOMID = #{id}
+    SELECT * FROM BOMDETAIL LEFT JOIN PRODUCT ON PR_ID=BD_SONID AND BOMDETAIL.COMPANYID=PRODUCT.COMPANYID WHERE BD_BOMID = #{id}
   </select>
 </mapper>

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

@@ -20,6 +20,9 @@
     <result column="bo_text3" property="bo_text3" jdbcType="VARCHAR" />
     <result column="bo_text4" property="bo_text4" jdbcType="VARCHAR" />
     <result column="bo_text5" property="bo_text5" jdbcType="VARCHAR" />
+    <result column="pr_brand" property="pr_brand" jdbcType="VARCHAR" />
+    <result column="pr_spec" property="pr_spec" jdbcType="VARCHAR" />
+    <result column="pr_orispeccode" property="pr_orispeccode" jdbcType="VARCHAR" />
   </resultMap>
   <sql id="Base_Column_List" >
     bo_id, bo_motherid, bo_mothercode, bo_mothername, bo_version, bo_status, bo_statuscode, 
@@ -258,13 +261,13 @@
       SELECT BO_MOTHERCODE FROM BOM WHERE BO_ID = #{id} and COMPANYID = #{companyId}
   </select>
   <select id="getListData" resultMap="BaseResultMap">
-    SELECT * FROM BOM
+    SELECT * FROM BOM LEFT JOIN PRODUCT ON PR_ID=BO_MOTHERID
     <where>
       <if test="condition!=null">
         ${condition}
       </if>
       <if test="companyId!=null">
-        AND companyId = #{companyId}
+        AND BOM.companyId = #{companyId}
       </if>
     </where>
     ORDER BY BO_ID DESC

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

@@ -101,7 +101,7 @@
             </if>
             AND VENDOR.COMPANYID = #{companyId}
         </where>
-        order by VE_ID,VC_DETNO
+        order by VE_ID,VC_DETNO DESC
     </select>
 
     <sql id="Base_Column_List" >

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

@@ -323,6 +323,8 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
     private DocBaseDTO singleOpen(Long id) {
         Purchase purchase = purchaseMapper.selectByPrimaryKey(id);
         DocBaseDTO docBaseDTO = null;
+        Double acceptqty=new Double(0),qty=new Double(0);
+
         if(!Status.CLOSE.name().equals(purchase.getPu_acceptstatuscode())){
             throw new BizException(BizExceptionCode.BIZ_OPEN);
         }
@@ -331,10 +333,12 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
         int partTurnCount = 0,turnCount = 0;
         if(purchaseDetailList != null && purchaseDetailList.size() > 0){
             for(PurchaseDetail purchaseDetail : purchaseDetailList){
+                acceptqty = purchaseDetail.getPd_acceptqty()==null?0:purchaseDetail.getPd_acceptqty();
+                qty = purchaseDetail.getPd_qty()==null?0:purchaseDetail.getPd_qty();
                 //入库数大于等于采购数
-                if(purchaseDetail.getPd_acceptqty() >= purchaseDetail.getPd_qty()){
+                if(acceptqty >= qty){
                     turnCount++;
-                }else if(purchaseDetail.getPd_acceptqty() > 0 && purchaseDetail.getPd_acceptqty() < purchaseDetail.getPd_qty()){
+                }else if(acceptqty > 0 && acceptqty < qty){
                     //     0 < 入库数 < 采购数
                     partTurnCount++;
                 }
@@ -478,12 +482,14 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
         purchase.setId(id);
         purchase.setPu_status(Status.AUDITED.getDisplay());
         purchase.setPu_statuscode(Status.AUDITED.name());
+        purchase.setPu_acceptstatus(Status.UNTURNIN.getDisplay());
+        purchase.setPu_acceptstatuscode(Status.UNAUDITED.name());
         purchase.setUpdateTime(new Date());
         purchase.setUpdaterId(BaseContextHolder.getUserId());
         //更新存在字段
         purchaseMapper.updateByPrimaryKeySelective(purchase);
         //更新最新采购单价
-        productApi.updateLatestPurchasePrice(id);
+//        productApi.updateLatestPurchasePrice(id);
         //日志
         messageLogService.audit(docBaseDTO);
         return result;

+ 1 - 1
applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/service/impl/MakeServiceImpl.java

@@ -158,7 +158,7 @@ public class MakeServiceImpl extends CommonBaseServiceImpl<MakeMapper, Make> imp
             int i = 0;
             for(MakeMaterial makeMaterial : makeMaterialList){
                 i++;
-                double qty = makeMaterial.getMm_qty() * makeMaterial.getMm_oneuseqty();
+                double qty = makeMaterial.getMm_qty();
                 double onHand = getMapper().getOnHand(makeMaterial.getMm_prodcode(),makeMaterial.getMm_whcode(), BaseContextHolder.getCompanyId());
                 if(onHand < qty){
                     throw new BizException(79402, "行" + i + "库存不足");

+ 34 - 0
base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/dto/OtherPowerDTO.java

@@ -0,0 +1,34 @@
+package com.usoftchina.saas.account.dto;
+
+import java.io.Serializable;
+
+public class OtherPowerDTO implements Serializable {
+
+    private Long resourceId;
+    private String name;
+    private boolean checked;
+
+    public boolean isChecked() {
+        return checked;
+    }
+
+    public void setChecked(boolean checked) {
+        this.checked = checked;
+    }
+
+    public Long getResourceId() {
+        return resourceId;
+    }
+
+    public void setResourceId(Long resourceId) {
+        this.resourceId = resourceId;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+}

+ 123 - 0
base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/dto/PowerDTO.java

@@ -0,0 +1,123 @@
+package com.usoftchina.saas.account.dto;
+
+import java.util.List;
+
+public class PowerDTO {
+    private Long groupId;
+    private String moduleName;
+    private String groupName;
+    private boolean query;
+    private boolean add;
+    private boolean update;
+    private boolean delete;
+    private boolean audit;
+    private boolean unAudit;
+    private boolean print;
+    private boolean fileExport;
+    private boolean fileImport;
+    private List<OtherPowerDTO> other;
+
+    public Long getGroupId() {
+        return groupId;
+    }
+
+    public void setGroupId(Long groupId) {
+        this.groupId = groupId;
+    }
+
+    public String getGroupName() {
+        return groupName;
+    }
+
+    public void setGroupName(String groupName) {
+        this.groupName = groupName;
+    }
+
+    public String getModuleName() {
+        return moduleName;
+    }
+
+    public void setModuleName(String moduleName) {
+        this.moduleName = moduleName;
+    }
+
+    public boolean getQuery() {
+        return query;
+    }
+
+    public void setQuery(boolean query) {
+        this.query = query;
+    }
+
+    public boolean getAdd() {
+        return add;
+    }
+
+    public void setAdd(boolean add) {
+        this.add = add;
+    }
+
+    public boolean getUpdate() {
+        return update;
+    }
+
+    public void setUpdate(boolean update) {
+        this.update = update;
+    }
+
+    public boolean getDelete() {
+        return delete;
+    }
+
+    public void setDelete(boolean delete) {
+        this.delete = delete;
+    }
+
+    public boolean getAudit() {
+        return audit;
+    }
+
+    public void setAudit(boolean audit) {
+        this.audit = audit;
+    }
+
+    public boolean getUnAudit() {
+        return unAudit;
+    }
+
+    public void setUnAudit(boolean unAudit) {
+        this.unAudit = unAudit;
+    }
+
+    public boolean getPrint() {
+        return print;
+    }
+
+    public void setPrint(boolean print) {
+        this.print = print;
+    }
+
+    public boolean getFileExport() {
+        return fileExport;
+    }
+
+    public void setFileExport(boolean fileExport) {
+        this.fileExport = fileExport;
+    }
+
+    public boolean getFileImport() {
+        return fileImport;
+    }
+
+    public void setFileImport(boolean fileImport) {
+        this.fileImport = fileImport;
+    }
+
+    public List<OtherPowerDTO> getOther() {
+        return other;
+    }
+
+    public void setOther(List<OtherPowerDTO> other) {
+        this.other = other;
+    }
+}

+ 5 - 0
base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/controller/RoleController.java

@@ -130,6 +130,11 @@ public class RoleController {
         return Result.success();
     }
 
+    @GetMapping("/power/resource")
+    public Result getResourcePower(Long id){
+        return Result.success(roleService.getResourcePowerById(id));
+    }
+
     /**
      * 清除角色相关所有账户的缓存
      *

+ 7 - 0
base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/mapper/ResourceMapper.java

@@ -42,4 +42,11 @@ public interface ResourceMapper {
      * @return
      */
     Resource selectByPrimaryKey(@Param("id") Long id);
+
+    /**
+     * 按资源组查找Classify
+     * @param id
+     * @return
+     */
+    List<String> selectClassifyByGroupId(@Param("id") Long id);
 }

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

@@ -1,9 +1,11 @@
 package com.usoftchina.saas.account.mapper;
 
+import com.usoftchina.saas.account.po.OtherPower;
 import com.usoftchina.saas.account.po.RoleResource;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * @author yingp
@@ -53,4 +55,17 @@ public interface RoleResourceMapper {
      * @return
      */
     List<RoleResource> selectByAccountId(@Param("accountId") Long accountId);
+
+    /**
+     * 按角色ID查找角色绑定的资源Classify
+     * @param id
+     */
+    List<Map<String, Object>> selectClassifyByRoleId(@Param("id") Long id);
+
+    /**
+     * 通过资源groupId和角色ID查询 角色是否具有改资源的权限
+     * @param roleId
+     * @return
+     */
+    List<OtherPower> selectOthersPower(@Param("roleId") Long roleId);
 }

+ 43 - 0
base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/po/OtherPower.java

@@ -0,0 +1,43 @@
+package com.usoftchina.saas.account.po;
+
+import java.io.Serializable;
+
+public class OtherPower implements Serializable {
+
+    private Long resourceId;
+    private String name;
+    private boolean checked;
+    private Long groupId;
+
+    public Long getResourceId() {
+        return resourceId;
+    }
+
+    public void setResourceId(Long resourceId) {
+        this.resourceId = resourceId;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public boolean isChecked() {
+        return checked;
+    }
+
+    public void setChecked(boolean checked) {
+        this.checked = checked;
+    }
+
+    public Long getGroupId() {
+        return groupId;
+    }
+
+    public void setGroupId(Long groupId) {
+        this.groupId = groupId;
+    }
+}

+ 1 - 0
base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/service/ResourceService.java

@@ -1,5 +1,6 @@
 package com.usoftchina.saas.account.service;
 
+import com.usoftchina.saas.account.dto.ResourceGroupDTO;
 import com.usoftchina.saas.account.dto.ResourceModuleDTO;
 import com.usoftchina.saas.account.dto.UrlResourceDTO;
 import com.usoftchina.saas.account.po.Resource;

+ 8 - 0
base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/service/RoleService.java

@@ -1,5 +1,6 @@
 package com.usoftchina.saas.account.service;
 
+import com.usoftchina.saas.account.dto.PowerDTO;
 import com.usoftchina.saas.account.dto.RoleBaseDTO;
 import com.usoftchina.saas.account.mapper.RoleMapper;
 import com.usoftchina.saas.account.po.Role;
@@ -36,4 +37,11 @@ public interface RoleService extends CommonBaseService<RoleMapper, Role> {
      * @return
      */
     List<RoleBaseDTO> findByAccountId(Long accountId);
+
+    /**
+     * 查找用户权限
+     * @param id
+     * @return
+     */
+    List<PowerDTO> getResourcePowerById(Long id);
 }

+ 97 - 5
base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/service/impl/RoleServiceImpl.java

@@ -1,15 +1,15 @@
 package com.usoftchina.saas.account.service.impl;
 
 import com.usoftchina.saas.account.constant.RoleType;
+import com.usoftchina.saas.account.dto.OtherPowerDTO;
+import com.usoftchina.saas.account.dto.PowerDTO;
 import com.usoftchina.saas.account.dto.RoleBaseDTO;
-import com.usoftchina.saas.account.mapper.AccountRoleMapper;
-import com.usoftchina.saas.account.mapper.RoleMapper;
-import com.usoftchina.saas.account.mapper.RoleResourceMapper;
-import com.usoftchina.saas.account.po.Resource;
-import com.usoftchina.saas.account.po.Role;
+import com.usoftchina.saas.account.mapper.*;
+import com.usoftchina.saas.account.po.*;
 import com.usoftchina.saas.account.service.ResourceService;
 import com.usoftchina.saas.account.service.RoleService;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
+import com.usoftchina.saas.context.BaseContextHolder;
 import com.usoftchina.saas.utils.BeanMapper;
 import com.usoftchina.saas.utils.CollectionUtils;
 import com.usoftchina.saas.utils.StringUtils;
@@ -18,7 +18,9 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 
 /**
  * @author yingp
@@ -38,6 +40,15 @@ public class RoleServiceImpl extends CommonBaseServiceImpl<RoleMapper, Role> imp
     @Autowired
     private ResourceService resourceService;
 
+    @Autowired
+    private ResourceModuleMapper resourceModuleMapper;
+
+    @Autowired
+    private ResourceGroupMapper resourceGroupMapper;
+
+    @Autowired
+    private ResourceMapper resourceMapper;
+
     @Override
     public boolean save(Role role) {
         if (StringUtils.isEmpty(role.getCode())) {
@@ -78,4 +89,85 @@ public class RoleServiceImpl extends CommonBaseServiceImpl<RoleMapper, Role> imp
         }
         return null;
     }
+
+    @Override
+    public List<PowerDTO> getResourcePowerById(Long id) {
+        List<PowerDTO> powerDTOList = new ArrayList<PowerDTO>();
+        List<Map<String, Object>> classifyList = roleResourceMapper.selectClassifyByRoleId(id);
+        List<OtherPower> otherPowerList = roleResourceMapper.selectOthersPower(id);
+        //查询所有模块
+        List<ResourceModule> modules = resourceModuleMapper.selectByAppId(BaseContextHolder.getAppId());
+        for (ResourceModule module : modules){
+            //查询所有分组
+            List<ResourceGroup> groups = resourceGroupMapper.selectByModuleId(module.getId());
+            for (ResourceGroup group : groups) {
+                PowerDTO powerDTO = new PowerDTO();
+                powerDTO.setGroupId(group.getId());
+                powerDTO.setModuleName(module.getName());
+                powerDTO.setGroupName(group.getName());
+                //赋值权限
+                for (Map<String, Object> map : classifyList){
+                    if (group.getId().equals(map.get("group_id"))){
+                        String classify = String.valueOf(map.get("classify"));
+                        setPowerValue(powerDTO, classify);
+                        if (classify.contains("OTHER")){
+                            setOtherPower(powerDTO, group.getId(), otherPowerList);
+                        }
+                    }
+                }
+                powerDTOList.add(powerDTO);
+            }
+        }
+        return powerDTOList;
+    }
+
+    private void setOtherPower(PowerDTO powerDTO, Long groupId, List<OtherPower> otherPowerList) {
+        List<OtherPower> otherPowers = new ArrayList<OtherPower>();
+        for (OtherPower otherPower : otherPowerList){
+            if (otherPower.getGroupId().equals(groupId)){
+                otherPowers.add(otherPower);
+            }
+        }
+        List<OtherPowerDTO> otherPowerDTOList = BeanMapper.mapList(otherPowers, OtherPowerDTO.class);
+        powerDTO.setOther(otherPowerDTOList);
+    }
+
+    private void setPowerValue(PowerDTO powerDTO, String classify) {
+        String[] array = classify.split(",");
+        for(int i = 0; i < array.length; i++){
+            switch (array[i]){
+                case "QUERY":
+                    powerDTO.setQuery(true);
+                    break;
+                case "ADD":
+                    powerDTO.setAdd(true);
+                    break;
+                case "UPDATE":
+                    powerDTO.setUpdate(true);
+                    break;
+                case "AUDIT":
+                    powerDTO.setAudit(true);
+                    break;
+                case "UNAUDIT":
+                    powerDTO.setUnAudit(true);
+                    break;
+                case "DELETE":
+                    powerDTO.setDelete(true);
+                    break;
+                case "PRINT":
+                    powerDTO.setPrint(true);
+                    break;
+                case "EXPORT":
+                    powerDTO.setFileExport(true);
+                    break;
+                case "IMPORT":
+                    powerDTO.setFileImport(true);
+                    break;
+                default:
+                    break;
+            }
+        }
+    }
+
+
 }

+ 3 - 0
base-servers/account/account-server/src/main/resources/mapper/ResourceMapper.xml

@@ -29,4 +29,7 @@
     <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
         select <include refid="baseColumns"/> from ac_resource where id=#{id,jdbcType=BIGINT}
     </select>
+    <select id="selectClassifyByGroupId" parameterType="java.lang.Long" resultType="string">
+        SELECT DISTINCT CLASSIFY FROM AC_RESOURCE WHERE ID=#{id,jdbcType=BIGINT}
+    </select>
 </mapper>

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

@@ -24,4 +24,22 @@
         where ac_account_role.role_id=ac_role_resource.role_id
         and ac_account_role.account_id=#{accountId,jdbcType=BIGINT}
     </select>
+    <select id="selectClassifyByRoleId" parameterType="java.lang.Long" resultType="java.util.HashMap">
+        SELECT GROUP_CONCAT(classify) classify,group_id FROM (
+          SELECT classify,group_id FROM AC_RESOURCE
+          WHERE ID IN (SELECT RESOURCE_ID FROM AC_ROLE_RESOURCE WHERE ROLE_ID=#{id})
+          GROUP BY GROUP_ID,CLASSIFY) A
+        GROUP BY GROUP_ID
+    </select>
+    <resultMap id="OtherPowerResultMap" type="com.usoftchina.saas.account.po.OtherPower">
+        <result column="name" property="name" jdbcType="VARCHAR" />
+        <result column="id" property="resourceId" jdbcType="BIGINT" />
+        <result column="group_id" property="groupId" jdbcType="BIGINT" />
+        <result column="checked" property="checked" jdbcType="BOOLEAN" />
+    </resultMap>
+    <select id="selectOthersPower" resultMap="OtherPowerResultMap">
+      SELECT name,id,group_id,CASE WHEN ROLE_ID IS NULL THEN false ELSE true end checked FROM AC_RESOURCE
+      LEFT JOIN ac_role_resource ON ID = RESOURCE_ID
+      WHERE CLASSIFY='OTHER' AND ROLE_ID=#{roleId}
+    </select>
 </mapper>

+ 1 - 0
base-servers/auth/auth-client/src/main/java/com/usoftchina/saas/auth/client/interceptor/AuthRestInterceptor.java

@@ -42,6 +42,7 @@ public class AuthRestInterceptor extends HandlerInterceptorAdapter {
                 JwtInfo infoFromToken = JwtHelper.getInfoFromToken(token, authConfig.getPublicKey());
                 BaseContextHolder.setAppId(infoFromToken.getAppId());
                 BaseContextHolder.setUserId(infoFromToken.getUserId());
+                BaseContextHolder.setUserName(infoFromToken.getUserName());
                 BaseContextHolder.setCompanyId(infoFromToken.getCompanyId());
                 BaseContextHolder.setToken(token);
                 log.info("request={} token={} \\r\\n userName={}", request.getRequestURI(),

+ 1 - 0
base-servers/gateway-server/src/main/java/com/usoftchina/saas/gateway/config/AuthFilter.java

@@ -49,6 +49,7 @@ public class AuthFilter implements GlobalFilter, Ordered {
                 BaseContextHolder.setAppId(jwt.getAppId());
                 BaseContextHolder.setUserId(jwt.getUserId());
                 BaseContextHolder.setCompanyId(jwt.getCompanyId());
+                BaseContextHolder.setUserName(jwt.getUserName());
                 BaseContextHolder.setToken(token);
                 AccountDTO accountDTO = AccountCache.current().getAccount();
                 if (null == accountDTO) {

+ 5 - 1
framework/core/src/main/java/com/usoftchina/saas/constant/CommonConstants.java

@@ -20,7 +20,11 @@ public class CommonConstants {
      */
     public static final String CONTEXT_KEY_APP_ID = "currentAppId";
     /***
-     * ThreadLocal中的登录用户Id key
+     * ThreadLocal中的登录用户token key
      */
     public static final String CONTEXT_KEY_TOKEN = "currentToken";
+    /**
+     * threadLocal中的登录用户name key
+     */
+    public static final String CONTEXT_KEY_USER_NAME = "currentUserName";
 }

+ 9 - 0
framework/core/src/main/java/com/usoftchina/saas/context/BaseContextHolder.java

@@ -67,6 +67,15 @@ public class BaseContextHolder {
         set(CommonConstants.CONTEXT_KEY_TOKEN, token);
     }
 
+    public static String getUserName(){
+        Object value = get(CommonConstants.CONTEXT_KEY_USER_NAME);
+        return ObjectUtils.getStringValue(value);
+    }
+
+    public static void setUserName(String userName){
+        set(CommonConstants.CONTEXT_KEY_USER_NAME, userName);
+    }
+
     public static void remove() {
         threadLocal.remove();
     }

+ 15 - 4
frontend/saas-web/app/util/FormUtil.js

@@ -227,9 +227,9 @@ Ext.define('saas.util.FormUtil', {
                         var o = {};
                         o[form._codeField] = code;
 
-                        var formData = form.initData || {main: {}};
+                        var formData = {main: {}};
                         Ext.apply(formData.main, o);
-                        form.initData || Ext.Array.each(detailGrids, function(grid, index) {
+                        Ext.Array.each(detailGrids, function(grid, index) {
                             var detno = 0;
                             var detnoColumn = grid.detnoColumn;
                             var datas = [];
@@ -243,10 +243,21 @@ Ext.define('saas.util.FormUtil', {
                             formData['detail' + index] = datas;
                         });
 
-                        form.initFormData(formData);
+                        return formData;
+                    }else {
+                        throw new Error('请求单据编号错误');
                     }
                 }
-            }).catch(function() {
+            }).then(function(formData) {
+                var initData = form.initData;
+                if(initData) {
+                    Ext.apply(initData.main, formData.main);
+                    form.setFormData(initData);
+                }else {
+                    form.initFormData(formData);
+                }
+            }).catch(function(res) {
+                showToast(res.message);
                 form.setLoading(false);
             })
         }

+ 40 - 8
frontend/saas-web/app/view/core/form/FormPanel.js

@@ -287,27 +287,41 @@ Ext.define('saas.view.core.form.FormPanel', {
 
         viewModel.setData(main);
 
+        viewModel.notify();
+
+        var detailGrids = me.query('detailGridField');
+
         for (var i = 0; i < detailCount; i++) {
             var detailData = formData['detail' + i] || [],
                 detail = viewData['detail' + i],
+                grid = detailGrids[i],
+                detnoColumn = grid.detnoColumn,
                 store = detail.detailStore;
 
-            if (detailData) {
-                store.removeAll();
-                store.add(detailData);
+            if (detailData.length > 0) {
+
+                for(var j = 0; j < detailData.length; j++) {
+                    var d = detailData[j];
+                    var o = {};
+                    o[detnoColumn] = j + 1;
+                    var r = store.getAt(j) || store.add(o)[0];
+                    for(var k in d) {
+                        r.set(k, d[k]);
+                    }
+                }
+
+            }else {
+                // store.
             }
         }
-
+        
         me.isValid();
     },
 
     initFormData: function(data) {
         var me = this;
         me.setFormData(data);
-        var fields = me.getForm().getFields().items;
-        Ext.Array.each(fields, function(f) {
-            f.resetOriginalValue ? f.resetOriginalValue() : '';
-        });
+        me.clearDirty();
     },
 
     /**
@@ -360,6 +374,20 @@ Ext.define('saas.view.core.form.FormPanel', {
         });
         viewModel.set('base.bindFields', bindFields);
     },
+
+    clearDirty: function() {
+        var me = this;
+        var detailGrids = me.query('detailGridField');
+        var fields = me.getForm().getFields().items;
+        
+        Ext.Array.each(fields, function(f) {
+            f.resetOriginalValue ? f.resetOriginalValue() : '';
+        });
+        Ext.Array.each(detailGrids, function(g) {
+            g.clearDirty();
+        });
+    },
+
     setEditable: function(able) {
         var me = this,
         viewModel = me.getViewModel(),
@@ -399,4 +427,8 @@ Ext.define('saas.view.core.form.FormPanel', {
 
         return dirty;
     },
+
+    getDirtyData: function() {
+        return this.getForm().getDirtyData();
+    }
 });

+ 4 - 2
frontend/saas-web/app/view/core/form/FormPanelController.js

@@ -57,9 +57,11 @@ Ext.define('saas.view.core.form.FormPanelController', {
                 var d = detail[x];
 
                 for(var k in d) {
+                    // 从表id清空
+                    delete d['id'];
                     // 从表日期清空
-                    if(isDateString(main[k])) {
-                        main[k] = '';
+                    if(isDateString(d[k])) {
+                        d[k] = '';
                     }
                 }
             }

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

@@ -192,8 +192,8 @@ Ext.define('saas.view.core.form.field.DetailGridField', {
         store.insert(store.indexOf(selectedRecord) + 1, datas);
     },
 
-    addDetail: function(v) {
-        var me = this;
+    addDetail: function(v, d) {
+        d = d || {};
         var me = this;
         if(!me.editable) {
             return;
@@ -211,16 +211,17 @@ Ext.define('saas.view.core.form.field.DetailGridField', {
             detno = selectedRecord.data[detnoColumn];
             var store = me.store;
             store.each(function(item){
-                d = item.data[detnoColumn];
-                if(Number(d) > detno) {
-                    item.set(detnoColumn, Number(d) + 1);
+                var t = item.data[detnoColumn];
+                if(Number(t) > detno) {
+                    item.set(detnoColumn, Number(t) + 1);
                 }
             });
         }
-        var data = {};
+        var data = d || {};
         data[detnoColumn] = detno + 1;
-        store.insert(store.indexOf(selectedRecord) + 1, data);
+        var r = store.insert(store.indexOf(selectedRecord) + 1, data);
         me.fireEvent('validChange');
+        return r;
     },
 
     deleteDetail: function(v) {
@@ -320,6 +321,17 @@ Ext.define('saas.view.core.form.field.DetailGridField', {
         }
         me.fireEvent('validChange');
     },
+
+    clearDirty: function() {
+        var me = this,
+        store = me.store,
+        count = store.getCount();
+
+        for(var x = 0; x < count; x++) {
+            store.getAt(x).commit();
+        }
+    },
+
     setGridDisabled: function(able) {
         var me = this,
         columns = me.columns;

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

@@ -64,7 +64,7 @@ Ext.define('saas.view.core.query.QueryGridPanel', {
                                 }
                             }else {
                                 console.error('exception: ', response.responseJson);
-                                showToast('请求错误:' + response.responseJson);
+                                showToast('请求错误:' + response.responseJson.message);
                             }
                         }
                     }

+ 12 - 2
frontend/saas-web/app/view/document/bom/FormPanel.js

@@ -123,19 +123,29 @@ Ext.define('saas.view.document.bom.FormPanel', {
                 text : "物料ID", 
                 hidden : true, 
                 dataIndex : "bd_sonid", 
+            },{
+                text: 'model映射需要',
+                dataIndex: 'productDTO',
+                hidden: true,
             }, {
                 text : "物料名称", 
                 dataIndex : "pr_detail",
                 ignore:true,
                 renderer: function (v, m, r) {
-                    return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:v;
+                    if(!v){
+                        return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null;
+                    }
+                    return v;
                 }
             }, {
                 text : "物料规格", 
                 dataIndex : "pr_spec",
                 ignore:true,
                 renderer: function (v, m, r) {
-                    return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:v;
+                    if(!v){
+                        return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null;
+                    }
+                    return v;
                 }
             }, {
                 allowBlank:false,

+ 25 - 0
frontend/saas-web/app/view/document/kind/ChildForm.js

@@ -63,6 +63,31 @@ Ext.define('KitchenSink.view.binding.ChildForm', {
                 maxLength: 20
             }]
         },
+        personpower:{
+            items:[{
+                xtype:'hidden',
+                name:'id'
+            },{
+                xtype:'textfield',
+                name:'name',
+                allowBlank:false,
+                fieldLabel:'角色名称',
+                maxLength: 20
+            },{
+                xtype:'textfield',
+                name:'description',
+                allowBlank:false,
+                fieldLabel:'角色描述',
+                maxLength: 20
+            },{
+                xtype:'textfield',
+                hidden:true,
+                name:'code',
+                allowBlank:true,
+                fieldLabel:'角色编号',
+                maxLength: 20
+            }]
+        },
         bankinformation:{
             items:[{
                 xtype:'hidden',

+ 23 - 0
frontend/saas-web/app/view/document/kind/Kind.js

@@ -212,6 +212,29 @@ Ext.define('saas.view.document.kind.Kind', {
             keyField:'id',
             reqUrl:'/api/commons/number/save'
         },
+        personpower:{
+            columns: [{
+                text : "角色名称", 
+                width : 200.0, 
+                dataIndex : "name", 
+                xtype : "", 
+            }, 
+            {
+                text : "角色描述", 
+                dataIndex : "description", 
+                width : 120.0, 
+                xtype : "", 
+            },
+            {
+                text : "编号", 
+                dataIndex : "code", 
+                width : 120.0, 
+                xtype : "", 
+            }],
+            keyField:'id',
+            reqUrl:'/api/account/role/save',
+            updateUrl:'/api/account/role/update',
+        },
         warehouse:{
             columns: [{
                 text: '仓库编号',

+ 3 - 3
frontend/saas-web/app/view/money/othreceipts/FormPanel.js

@@ -90,10 +90,10 @@ Ext.define('saas.view.money.othreceipts.FormPanel', {
                         this.dialog = form.getController().getView().add({
                             xtype: 'document-kind-childwin',
                             bind: {
-                                title: '新增收入类别类型'
+                                title: '新增收入类别'
                             },
-                            dataKind:'fundinouttype',
-                            belong:document.etc['fundinouttype'],
+                            dataKind:'inoutkind',
+                            belong:document.etc['inoutkind'],
                             _parent:form,
                             _combo:this.ownerCmp,
                             record:null,

+ 3 - 3
frontend/saas-web/app/view/money/othspendings/FormPanel.js

@@ -94,10 +94,10 @@ Ext.define('saas.view.money.othspendings.FormPanel', {
                         this.dialog = form.getController().getView().add({
                             xtype: 'document-kind-childwin',
                             bind: {
-                                title: '新增收入类别类型'
+                                title: '新增收入类别'
                             },
-                            dataKind:'fundinouttype',
-                            belong:document.etc['fundinouttype'],
+                            dataKind:'inoutkind',
+                            belong:document.etc['inoutkind'],
                             _parent:form,
                             _combo:this.ownerCmp,
                             record:null,

+ 17 - 3
frontend/saas-web/app/view/purchase/purchase/FormPanel.js

@@ -139,15 +139,26 @@ Ext.define('saas.view.purchase.purchase.FormPanel', {
                 dataIndex : "pr_detail",
                 ignore:true,
                 renderer: function (v, m, r) {
-                    return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:v;
+                    debugger
+                    if(!v){
+                        return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null; 
+                    }                     
+                    return v;
                 }
+            },{
+                text: 'model映射需要',
+                dataIndex: 'productDTO',
+                hidden: true,
             },
             {
                 text : "规格", 
                 dataIndex : "pr_spec",
                 ignore:true,
                 renderer: function (v, m, r) {
-                    return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:v;
+                    if(!v){
+                        return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null; 
+                    }                     
+                    return v;    
                 }
             },
             {
@@ -155,7 +166,10 @@ Ext.define('saas.view.purchase.purchase.FormPanel', {
                 dataIndex : "pr_zxbzs",
                 ignore:true,
                 renderer: function (v, m, r) {
-                    return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:v;
+                    if(!v){
+                        return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null; 
+                    }                     
+                    return v; 
                 }
             },            
             {

+ 12 - 2
frontend/saas-web/app/view/purchase/purchaseIn/FormPanel.js

@@ -145,13 +145,20 @@ Ext.define('saas.view.purchase.purchaseIn.FormPanel', {
                     valueField : "value", 
                     xtype : "multidbfindtrigger"
                 }
+            },{
+                text: 'model映射需要',
+                dataIndex: 'productDTO',
+                hidden: true,
             },
             {
                 text : "名称", 
                 dataIndex : "pr_detail",
                 ignore:true,
                 renderer: function (v, m, r) {
-                    return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:v;
+                    if(!v){
+                        return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null;
+                    }
+                    return v;
                 }
             },
             {
@@ -159,7 +166,10 @@ Ext.define('saas.view.purchase.purchaseIn.FormPanel', {
                 dataIndex : "pr_spec",
                 ignore:true,
                 renderer: function (v, m, r) {
-                    return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:v;
+                    if(!v){
+                        return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null;
+                    }
+                    return v;
                 }
             },
             {

+ 12 - 2
frontend/saas-web/app/view/purchase/purchaseOut/FormPanel.js

@@ -137,13 +137,20 @@ Ext.define('saas.view.purchase.purchaseOut.FormPanel', {
                     valueField : "value", 
                     xtype : "multidbfindtrigger"
                 }
+            },{
+                text: 'model映射需要',
+                dataIndex: 'productDTO',
+                hidden: true,
             },
             {
                 text : "名称", 
                 dataIndex : "pr_detail",
                 ignore:true,
                 renderer: function (v, m, r) {
-                    return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:v;
+                    if(!v){
+                        return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null;
+                    }
+                    return v;
                 }
             },
             {
@@ -151,7 +158,10 @@ Ext.define('saas.view.purchase.purchaseOut.FormPanel', {
                 dataIndex : "pr_spec",
                 ignore:true,
                 renderer: function (v, m, r) {
-                    return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:v;
+                    if(!v){
+                        return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null;
+                    }
+                    return v;
                 }
             },
             {

+ 16 - 4
frontend/saas-web/app/view/purchase/report/Purchase.js

@@ -71,16 +71,28 @@ Ext.define('saas.view.purchase.report.Purchase', {
         dataIndex: 'pd_prodcode'
     }, {
         text: '物料名称',
-        dataIndex: 'pr_detail'
+        dataIndex: 'pr_detail', 
+        renderer: function (v, m, r) {
+            return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:v;
+        }
     }, {
         text: '物料规格',
-        dataIndex: 'pr_spec'
+        dataIndex: 'pr_spec', 
+        renderer: function (v, m, r) {
+            return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:v;
+        }
     }, {
         text: '品牌',
-        dataIndex: 'pr_brand'
+        dataIndex: 'pr_brand', 
+        renderer: function (v, m, r) {
+            return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:v;
+        }
     }, {
         text: '单位',
-        dataIndex: 'pr_unit'
+        dataIndex: 'pr_unit', 
+        renderer: function (v, m, r) {
+            return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:v;
+        }
     }, {
         text: '采购数量',
         dataIndex: 'pd_qty',

+ 1 - 1
frontend/saas-web/app/view/purchase/report/PurchasePay.js

@@ -8,7 +8,7 @@ Ext.define('saas.view.purchase.report.PurchasePay', {
     viewName: 'purchase-report-purchasepay',
 //按供应商分组 付款金额合计
     groupField: 'pu_vendname',
-    listUrl: '/api/money/paybalance/list',
+    listUrl: '/api/purchase/report/purchasePay',
     defaultCondition: null,
     reportTitle: '采购付款一览表',
     QueryWidth:0.25,

+ 17 - 5
frontend/saas-web/app/view/sale/report/Sale.js

@@ -7,7 +7,7 @@ Ext.define('saas.view.sale.report.Sale', {
 
     viewName: 'sale-report-sale',
 
-    groupField: 'sa_custcode',
+    groupField: null,
     listUrl: '/api/sale/sale/list',
     defaultCondition: null,
     reportTitle: '销售明细报表',
@@ -78,16 +78,28 @@ Ext.define('saas.view.sale.report.Sale', {
     }, {
         text: '物料名称',
         dataIndex: 'pr_detail',
-        width: 200
+        width: 200, 
+        renderer: function (v, m, r) {
+            return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:v;
+        }
     }, {
         text: '物料规格',
-        dataIndex: 'pr_spec'
+        dataIndex: 'pr_spec', 
+        renderer: function (v, m, r) {
+            return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:v;
+        }
     }, {
         text: '品牌',
-        dataIndex: 'pr_brand'
+        dataIndex: 'pr_brand', 
+        renderer: function (v, m, r) {
+            return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:v;
+        }
     }, {
         text: '单位',
-        dataIndex: 'pr_unit'
+        dataIndex: 'pr_unit', 
+        renderer: function (v, m, r) {
+            return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:v;
+        }
     }, {//∑数量
         text: '数量',
         dataIndex: 'sd_qty',

+ 3 - 3
frontend/saas-web/app/view/sale/report/SaleController.js

@@ -13,13 +13,13 @@ Ext.define('saas.view.sale.report.SaleController', {
                         defaultCondition:"cu_statuscode='OPEN'",
                         dbfinds:[
                             {
-                                from:'id',to:'sa_custid',ignore:true
+                                from:'id',to:'id',ignore:true
                             },{
-                                from:'cu_code',to:'sa_custcode'
+                                from:'cu_code',to:'cu_code'
                             },{
                                 from:'cu_name',to:'sa_custname'
                             },{
-                                from:'ca_address',to:'sa_toplace'
+                                from:'ca_address',to:'ca_address'
                         }],
                         dbtpls:[{
                             field:'cu_code',width:100

+ 0 - 4
frontend/saas-web/app/view/sale/report/SaleInController.js

@@ -1,4 +0,0 @@
-Ext.define('saas.view.sale.report.SaleInController', {
-    extend: 'saas.view.core.report.ReportPanelController',
-    alias: 'controller.sale-report-salein'
-});

+ 0 - 4
frontend/saas-web/app/view/sale/report/SaleInModel.js

@@ -1,4 +0,0 @@
-Ext.define('saas.view.sale.report.SaleInModel', {
-    extend: 'saas.view.core.report.ReportPanelModel',
-    alias: 'viewmodel.sale-report-salein'
-});

+ 2 - 2
frontend/saas-web/app/view/sale/report/SaleProfit.js

@@ -8,7 +8,7 @@ Ext.define('saas.view.sale.report.SaleProfit', {
     viewName: 'sale-report-saleprofit',
 
     groupField: null,
-    listUrl: '/api/sale/sale/list',
+    listUrl: '/api/sale/report/saleProfit',
     defaultCondition: null,
     reportTitle: '销售毛利润表',
 //筛选:客户、物料、时间	
@@ -25,7 +25,7 @@ Ext.define('saas.view.sale.report.SaleProfit', {
         columnWidth: 0.2
     }, {
         xtype: 'condatefield',
-        name: 'sa_custname',
+        name: 'sa_date',
         fieldLabel: '时间',
         columnWidth: 0.5
     }],

+ 2 - 2
frontend/saas-web/app/view/sale/report/SaleProfitController.js

@@ -13,13 +13,13 @@ Ext.define('saas.view.sale.report.SaleProfitController', {
                         defaultCondition:"cu_statuscode='OPEN'",
                         dbfinds:[
                             {
-                                from:'id',to:'sa_custid',ignore:true
+                                from:'id',to:'id',ignore:true
                             },{
                                 from:'cu_code',to:'sa_custcode'
                             },{
                                 from:'cu_name',to:'sa_custname'
                             },{
-                                from:'ca_address',to:'sa_toplace'
+                                from:'ca_address',to:'ca_address'
                         }],
                         dbtpls:[{
                             field:'cu_code',width:100

+ 6 - 6
frontend/saas-web/app/view/sale/report/SaleIn.js → frontend/saas-web/app/view/sale/report/SaleRec.js

@@ -1,14 +1,14 @@
-Ext.define('saas.view.sale.report.SaleIn', {
+Ext.define('saas.view.sale.report.SaleRec', {
     extend: 'saas.view.core.report.ReportPanel',
-    xtype: 'sale-report-salein',
+    xtype: 'sale-report-salerec',
 
-    controller: 'sale-report-salein',
-    viewModel: 'sale-report-salein',
+    controller: 'sale-report-salerec',
+    viewModel: 'sale-report-salerec',
 
-    viewName: 'sale-report-salein',
+    viewName: 'sale-report-salerec',
 
     groupField: 'rb_custname',
-    listUrl: '/api/money/recbalance/list',
+    listUrl: '/api/sale/report/saleRec',
     defaultCondition: null,
     reportTitle: '销售收款报表',
     QueryWidth:0.25,

+ 107 - 0
frontend/saas-web/app/view/sale/report/SaleRecController.js

@@ -0,0 +1,107 @@
+Ext.define('saas.view.sale.report.SaleRecController', {
+    extend: 'saas.view.core.report.ReportPanelController',
+    alias: 'controller.sale-report-salerec',
+    init: function (form) {
+        this.control({
+            //放大镜赋值关系 以及 tpl模板
+            'dbfindtrigger[name=rb_custname]':{
+                beforerender:function(f){
+                    Ext.apply(f,{
+                        dataUrl:'/api/document/customer/dbfind',
+                        addXtype: 'document-customer-formpanel',
+                        addTitle: '客户资料',
+                        defaultCondition:"cu_statuscode='OPEN'",
+                        dbfinds:[
+                            {
+                                from:'id',to:'id',ignore:true
+                            },{
+                                from:'cu_code',to:'cu_code'
+                            },{
+                                from:'cu_name',to:'rb_custname'
+                            },{
+                                from:'ca_address',to:'ca_address'
+                        }],
+                        dbtpls:[{
+                            field:'cu_code',width:100
+                        },{
+                            field:'cu_name',width:100
+                        }],
+                        dbSearchFields:[{
+                            emptyText:'输入客户编号或客户名称',
+                            xtype : "textfield", 
+                            name : "search", 
+                            getCondition: function(v) {
+                                return "(upper(cu_code) like '%"+v.toUpperCase()+"%' or upper(cu_name) like '%"+v.toUpperCase()+"%')";
+                            },
+                            allowBlank : true, 
+                            columnWidth : 0.25
+                        }],
+                        dbColumns:[
+                            {
+                                conditionCode:'id',
+                                "text": "客户ID",
+                                "flex": 0,
+                                "dataIndex": "id",
+                                "width": 0,
+                                "xtype": "",
+                                "items": null
+                            },{
+                                conditionCode:'cu_code',
+                                "text": "客户编号",
+                                "flex": 1,
+                                "dataIndex": "cu_code",
+                                "width": 100,
+                                "xtype": "",
+                                "items": null
+                            }, {
+                                conditionCode:'cu_name',
+                                "text": "客户名称",
+                                "flex": 1,
+                                "dataIndex": "cu_name",
+                                "xtype": "",
+                                "items": null
+                            }, {
+                                conditionCode:'cu_type',
+                                "text": "客户类型",
+                                "flex": 1,
+                                "dataIndex": "cu_type",
+                                "width": 200,
+                                "xtype": "",
+                                "items": null
+                            }, {
+                                "text": "业务员编号",
+                                "flex": 1,
+                                "dataIndex": "cu_sellercode",
+                                "width": 100
+                            }, {
+                                "text": "业务员",
+                                "flex": 1,
+                                "dataIndex": "cu_sellername",
+                                "width": 100
+                            }, {
+                                "text": "税率",
+                                "flex": 1,
+                                "dataIndex": "cu_taxrate",
+                                "width": 100
+                            }, {
+                                "text": "承付天数",
+                                "flex": 1,
+                                "dataIndex": "cu_promisedays",
+                                "width": 100
+                            }, {
+                                "text": "额度",
+                                "flex": 1,
+                                "dataIndex": "cu_credit",
+                                "width": 100
+                            }, {
+                                "text": "客户地址",
+                                "flex": 1,
+                                "dataIndex": "ca_address",
+                                "width": 250
+                            }]
+                    }) ;   
+                }
+            }
+         });
+        }
+});

+ 4 - 0
frontend/saas-web/app/view/sale/report/SaleRecModel.js

@@ -0,0 +1,4 @@
+Ext.define('saas.view.sale.report.SaleRecModel', {
+    extend: 'saas.view.core.report.ReportPanelModel',
+    alias: 'viewmodel.sale-report-salerec'
+});

+ 14 - 4
frontend/saas-web/app/view/sale/sale/FormPanel.js

@@ -96,22 +96,32 @@ Ext.define('saas.view.sale.sale.FormPanel', {
                     valueField : "value", 
                     xtype : "multidbfindtrigger"
                 }
+            },{
+                text: 'model映射需要',
+                dataIndex: 'productDTO',
+                hidden: true,
             }, {
                 text : "名称", 
                 dataIndex : "pr_detail",
                 ignore:true,
                 width : 150.0, 
                 renderer: function (v, m, r) {
-				    return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:v;
-				}
+                    if(!v){
+                        return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null;
+                    }
+                    return v;
+                }
             }, {
                 text : "规格", 
                 dataIndex : "pr_spec",
                 ignore:true,
                 width : 150.0, 
                 renderer: function (v, m, r) {
-				    return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:v;
-				}
+                    if(!v){
+                        return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null;
+                    }
+                    return v;
+                }
             }, {
                 text : "数量", 
                 dataIndex : "sd_qty",

+ 13 - 3
frontend/saas-web/app/view/sale/saleIn/FormPanel.js

@@ -88,21 +88,31 @@ Ext.define('saas.view.sale.saleIn.FormPanel', {
                     valueField : "value", 
                     xtype : "multidbfindtrigger"
                 }
+            },{
+                text: 'model映射需要',
+                dataIndex: 'productDTO',
+                hidden: true,
             }, {
                 text : "名称", 
                 dataIndex : "pr_detail",
                 ignore:true,
                 width : 150.0, 
                 renderer: function (v, m, r) {
-				    return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:v;
-				}
+                    if(!v){
+                        return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null;
+                    }
+                    return v;
+                }
             }, {
                 text : "规格", 
                 dataIndex : "pr_spec",
                 ignore:true,
                 width : 150.0, 
                 renderer: function (v, m, r) {
-				    return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:v;
+                    if(!v){
+                        return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null;
+                    }
+                    return v;
                 }
             }, {
                 text : "数量", 

+ 14 - 4
frontend/saas-web/app/view/sale/saleOut/FormPanel.js

@@ -98,22 +98,32 @@ Ext.define('saas.view.sale.saleout.FormPanel', {
                     valueField : "value", 
                     xtype : "multidbfindtrigger"
                 }
+            },{
+                text: 'model映射需要',
+                dataIndex: 'productDTO',
+                hidden: true,
             }, {
                 text : "名称", 
                 dataIndex : "pr_detail",
                 ignore:true,
                 width : 150.0, 
                 renderer: function (v, m, r) {
-				    return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:v;
-				}
+                    if(!v){
+                        return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null;
+                    }
+                    return v;
+                }
             }, {
                 text : "规格", 
                 dataIndex : "pr_spec",
                 ignore:true,
                 width : 150.0, 
                 renderer: function (v, m, r) {
-				    return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:v;
-				}
+                    if(!v){
+                        return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null;
+                    }
+                    return v;
+                }
             },  {
                 text : "出货数量", 
                 dataIndex : "pd_outqty", 

+ 16 - 2
frontend/saas-web/app/view/stock/appropriationInOut/FormPanel.js

@@ -129,6 +129,7 @@ Ext.define('saas.view.stock.appropriationInOut.FormPanel', {
                 dataIndex : "pd_prodcode", 
                 xtype : "", 
                 items : null,
+                allowBlank:false,
                 editor : {
                     displayField : "display", 
                     editable : true, 
@@ -142,13 +143,20 @@ Ext.define('saas.view.stock.appropriationInOut.FormPanel', {
                     valueField : "value", 
                     xtype : "multidbfindtrigger"
                 }
+            },{
+                text: 'model映射需要',
+                dataIndex: 'productDTO',
+                hidden: true,
             },
             {
                 text : "名称", 
                 dataIndex : "pr_detail",
                 ignore:true,
                 renderer: function (v, m, r) {
-                    return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:v;
+                    if(!v){
+                        return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null;
+                    }
+                    return v;
                 }
             },
             {
@@ -156,13 +164,17 @@ Ext.define('saas.view.stock.appropriationInOut.FormPanel', {
                 dataIndex : "pr_spec",
                 ignore:true,
                 renderer: function (v, m, r) {
-                    return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:v;
+                    if(!v){
+                        return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null;
+                    }
+                    return v;
                 }
             },
             {
                 text : "数量", 
                 dataIndex : "pd_inqty", 
                 width : 120.0,
+                allowBlank:false,
                 editor : {
                     xtype : "numberfield",
                     decimalPrecision: 8,
@@ -197,6 +209,7 @@ Ext.define('saas.view.stock.appropriationInOut.FormPanel', {
                 dataIndex : "pd_whname", 
                 width : 120.0, 
                 items : null,
+                allowBlank:false,
                 editor : {
                     displayField : "display", 
                     editable : true, 
@@ -225,6 +238,7 @@ Ext.define('saas.view.stock.appropriationInOut.FormPanel', {
                 text : "拨入仓库", 
                 dataIndex : "pd_inwhname", 
                 width : 120.0, 
+                allowBlank:false,
                 items : null,
                 editor : {
                     displayField : "display", 

+ 12 - 2
frontend/saas-web/app/view/stock/make/FormPanel.js

@@ -152,6 +152,10 @@ Ext.define('saas.view.stock.make.FormPanel', {
                     valueField : "value", 
                     xtype : "multidbfindtrigger"
                 }
+            },{
+                text: 'model映射需要',
+                dataIndex: 'productDTO',
+                hidden: true,
             },
             {
                 text : "名称", 
@@ -159,7 +163,10 @@ Ext.define('saas.view.stock.make.FormPanel', {
                 width : 100.0,
                 ignore:true,
                 renderer: function (v, m, r) {
-                    return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:v;
+                    if(!v){
+                        return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null;
+                    }
+                    return v;
                 }
             },
             {
@@ -168,7 +175,10 @@ Ext.define('saas.view.stock.make.FormPanel', {
                 width : 100.0,
                 ignore:true,
                 renderer: function (v, m, r) {
-                    return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:v;
+                    if(!v){
+                        return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null;
+                    }
+                    return v;
                 }
             },
             {

+ 14 - 2
frontend/saas-web/app/view/stock/make/FormPanelController.js

@@ -250,6 +250,10 @@ Ext.define('saas.view.stock.make.FormPanelController', {
                             from:'bo_mothercode',to:'ma_prodcode'
                         },{
                             from:'bo_mothername',to:'ma_proddetail'
+                        },{
+                            from:'pr_spec',to:'ma_prodspec'
+                        },{
+                            from:'bo_version',to:'ma_version'
                         }],
                         //联想设置
                         dbtpls:[{
@@ -279,13 +283,21 @@ Ext.define('saas.view.stock.make.FormPanelController', {
                             "hidden": true,
                             "dataIndex": "id",
                         }, {
-                            "text": "物料编号",       
+                            "text": "产品编号",       
                             "dataIndex": "bo_mothercode",
                             "width": 200,
                         }, {
-                            "text": "物料名称",
+                            "text": "产品名称",
                             "width": 200,
                             "dataIndex": "bo_mothername",
+                        }, {
+                            "text": "产品规格",
+                            "width": 200,
+                            "dataIndex": "pr_spec",
+                        }, {
+                            "text": "版本",
+                            "width": 200,
+                            "dataIndex": "bo_version",
                         }
                         // ,{
                         //     "text": "规格",

+ 12 - 2
frontend/saas-web/app/view/stock/otherIn/FormPanel.js

@@ -138,13 +138,20 @@ Ext.define('saas.view.stock.otherIn.FormPanel', {
                     valueField : "value", 
                     xtype : "multidbfindtrigger"
                 }
+            },{
+                text: 'model映射需要',
+                dataIndex: 'productDTO',
+                hidden: true,
             },
             {
                 text : "名称", 
                 dataIndex : "pr_detail",
                 ignore:true,
                 renderer: function (v, m, r) {
-                    return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:v;
+                    if(!v){
+                        return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null;
+                    }
+                    return v;
                 }
             },
             {
@@ -152,7 +159,10 @@ Ext.define('saas.view.stock.otherIn.FormPanel', {
                 dataIndex : "pr_spec",
                 ignore:true,
                 renderer: function (v, m, r) {
-                    return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:v;
+                    if(!v){
+                        return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null;
+                    }
+                    return v;
                 }
             },
             {

+ 4 - 0
frontend/saas-web/app/view/stock/otherOut/FormPanel.js

@@ -134,6 +134,10 @@ Ext.define('saas.view.stock.otherOut.FormPanel', {
                     valueField: "value",
                     xtype: "multidbfindtrigger"
                 }
+            },{
+                text: 'model映射需要',
+                dataIndex: 'productDTO',
+                hidden: true,
             },
             {
                 text: "名称",

+ 3 - 15
frontend/saas-web/app/view/sys/power/FormPanel.js

@@ -10,8 +10,6 @@ Ext.define('saas.view.sys.power.FormPanel', {
     
     //字段属性
     _idField: 'id',
-    _readUrl:'/api/commons/enterprise/read',
-    _saveUrl:'/api/commons/enterprise/save',
 
     //基础属性
     frame:true,
@@ -24,25 +22,15 @@ Ext.define('saas.view.sys.power.FormPanel', {
         xtype: 'sys-power-treepanel',
         layout:'fit',
         height:'100%',
-        width: '15%',
-        rootVisible: false,
-        useArrows: true,
-        store : Ext.create('Ext.data.TreeStore', {
-            fields : ['NAME', 'ID'],
-            autoLoad:false,
-            root : {
-                text : 'Root',
-                id : 0,
-                expanded : true
-            }
-        }),
+        width: '20%',
+        useArrows: true
     },{
         title:'权限列表',
         margin:'0 0 0 5',
         region:'center',
         layout:'fit',
         height:'100%',
-        width: '85%',
+        width: '80%',
         xtype:'power-grid'
     }],
 

+ 123 - 48
frontend/saas-web/app/view/sys/power/GroupGrid.js

@@ -4,7 +4,6 @@
 Ext.define('saas.view.sys.power.GroupGrid', {
     extend: 'Ext.grid.Panel',
     requires: [
-      //  'Ext.selection.CellModel',
         'saas.view.sys.power.OtherField'
     ],
     xtype: 'power-grid',
@@ -13,25 +12,16 @@ Ext.define('saas.view.sys.power.GroupGrid', {
             clicksToEdit: 1
         }
     },
-    store:Ext.create('Ext.data.Store',{
-        fields:[
-            {name: 'query',type:'bool'},
-            {name: 'add', type: 'bool'},
-            {name: 'save', type: 'bool'},
-            {name: 'delete', type: 'bool'},
-            {name: 'audit', type: 'bool'},
-            {name: 'resAudit', type: 'bool'},
-            {name: 'import', type: 'bool'},
-            {name: 'export', type: 'bool'},
-            {name: 'others', calculate: function(data) {
-                var others = data['others'];
-                return others;
-            }}
-        ],
-        data: [{"query":true,"add":false,"delete":false,"audit":true,"resAudit":true,"import":true,"export":true},{"query":true,"add":false,"delete":false,"audit":true,"resAudit":true,"import":true,"export":true,"others":[{'resouceId':1,'text':'权限1','value':'true'}]},
-            {"query":true,"add":false,"delete":false,"audit":true,"resAudit":true,"import":true,"export":true,"others":[{'resouceId':100,'text':'权限2','value':true},{'resouceId':101,'text':'权限2.1','value':true}]},
-            {"query":true,"add":false,"delete":false,"audit":true,"resAudit":true,"import":true,"export":true,"others":[{'resouceId':1000,text:'权限3','value':true},{'resouceId':1001,'text':'权限3.1','value':true},{'resouceId':1002,'text':'权限1','value':true},{'resouceId':100,'text':'权限3.2','value':true}]}]
-}),
+    bind:{
+        store: '{powergrid}'
+    },
+    features : [Ext.create('Ext.grid.feature.Grouping',{
+		showSummaryRow: true,
+        startCollapsed: false,
+        groupHeaderTpl: '{name}'+'模块'
+	})],
+    initId:0,
+    dataUrl:'http://192.168.253.31:8560/api/account/role/power/resource',
     selModel:Ext.create('Ext.selection.CheckboxModel', {
         checkOnly: true,
         listeners: {
@@ -43,83 +33,154 @@ Ext.define('saas.view.sys.power.GroupGrid', {
             }
         }
     }),
-    height: 350,
     viewConfig: {
      stripeRows: false,
      enableTextSelection: false,
      markDirty: false
     },
     trackMouseOver: false,
-    //disableSelection: true,
     columns: [{
+        header: '单据名称',
+        dataIndex: 'groupName',
+        xtype: '',
+        flex: 1.5,
+        stopSelection: false
+    },{
         header: '查询',
         dataIndex: 'query',
         xtype: 'checkcolumn',
         headerCheckbox: true,
-        width: 90,
+        menuDisabled:true,
+        flex: 1,
         stopSelection: false
     }, {
-        header: '新增',
+        header: '保存',
         dataIndex: 'add',
         xtype: 'checkcolumn',
         headerCheckbox: true,
-        width: 90,
+        menuDisabled:true,
+        flex: 1,
         stopSelection: false
     }, {
         header: '修改',
-        dataIndex: 'save',
+        dataIndex: 'update',
         xtype: 'checkcolumn',
         headerCheckbox: true,
-        width: 90,
+        menuDisabled:true,
+        flex: 1,
         stopSelection: false
     }, {
         header: '删除',
         dataIndex: 'delete',
         xtype: 'checkcolumn',
         headerCheckbox: true,
-        width: 90,
+        menuDisabled:true,
+        flex: 1,
         stopSelection: false
     }, {
         header: '审核',
         dataIndex: 'audit',
         xtype: 'checkcolumn',
         headerCheckbox: true,
-        width: 90,
+        menuDisabled:true,
+        flex: 1,
         stopSelection: false
     }, {
         header: '反审核',
-        dataIndex: 'resAudit',
+        dataIndex: 'unAudit',
         xtype: 'checkcolumn',
         headerCheckbox: true,
-        width: 90,
+        menuDisabled:true,
+        flex: 1,
         stopSelection: false
     }, {
         header: '导入',
-        dataIndex: 'import',
+        dataIndex: 'fileImport',
         xtype: 'checkcolumn',
         headerCheckbox: true,
-        width: 90,
+        menuDisabled:true,
+        flex: 1,
         stopSelection: false
     }, {
         header: '导出',
-        dataIndex: 'export',
+        dataIndex: 'fileExport',
         xtype: 'checkcolumn',
         headerCheckbox: true,
-        width: 90,
+        menuDisabled:true,
+        flex: 1,
         stopSelection: false
     }, {
+        header: '打印',
+        dataIndex: 'print',
+        xtype: 'checkcolumn',
+        headerCheckbox: true,
+        menuDisabled:true,
+        flex: 1,
+        stopSelection: false
+    },{
         text: '其它',
-        width: 160,
-        dataIndex:'others',
+        flex: 2.7,
+        dataIndex:'other',
         xtype: 'widgetcolumn',
+        menuDisabled:true,
         producesHTML: false,
         widget: {
             xtype: 'powerotherfield',
-            bind:'{record.others}'
+            bind:'{record.other}'
         }
     }],
 
-    // Dispatch named listener and handler methods to this instance
+    initComponent: function () {
+        var me = this;
+        var formModel = me.$initParent.getViewModel();
+        me.store = Ext.create('Ext.data.Store',{
+            fields:[
+                {name: 'groupId',type:'int'},
+                {name: 'groupName',type:'string'},
+                {name: 'moduleName',type:'string'},
+                {name: 'query',type:'bool'},
+                {name: 'add', type: 'bool'},
+                {name: 'delete', type: 'bool'},
+                {name: 'audit', type: 'bool'},
+                {name: 'update', type: 'bool'},
+                {name: 'unAudit', type: 'bool'},
+                {name: 'fileExport', type: 'bool'},
+                {name: 'fileImport', type: 'bool'},
+                {name: 'print', type: 'bool'},
+                {name: 'other', calculate: function(data) {
+                    var other = data['other'];
+                    return other;
+                }}
+            ],
+            groupField:'moduleName',
+            proxy: {
+                timeout:8000,
+                type: 'ajax',
+                url: me.dataUrl,
+                actionMethods: {
+                    read: 'GET'
+                },
+                reader: {
+                    type: 'json',
+                    rootProperty: 'data',
+                }
+            },
+            listeners:{
+                beforeload: function (store, op) {
+                    var id = me.initId;
+                    Ext.apply(store.proxy.extraParams, {
+                        id:id
+                    });
+                }
+            }
+            // data: [{"query":true,"add":false,"delete":false,"audit":true,"resAudit":true,"import":true,"export":true},{"query":true,"add":false,"delete":false,"audit":true,"resAudit":true,"import":true,"export":true,"others":[{'resouceId':1,'text':'权限1','value':'true'}]},
+            //     {"query":true,"add":false,"delete":false,"audit":true,"resAudit":true,"import":true,"export":true,"others":[{'resouceId':100,'text':'权限2','value':true},{'resouceId':101,'text':'权限2.1','value':true}]},
+            //     {"query":true,"add":false,"delete":false,"audit":true,"resAudit":true,"import":true,"export":true,"others":[{'resouceId':1000,text:'权限3','value':true},{'resouceId':1001,'text':'权限3.1','value':true},{'resouceId':1002,'text':'权限1','value':true},{'resouceId':100,'text':'权限3.2','value':true}]}]
+        }),
+        formModel.set('powergrid', me.store);
+        me.callParent(arguments);
+    },
+
     defaultListenerScope: true,
 
     listeners: {
@@ -127,20 +188,34 @@ Ext.define('saas.view.sys.power.GroupGrid', {
         columnhide: 'onColumnToggle'
     },
     selectAllPower: function(record){
-        var me = this;data={"query":true,"add":true,"save":true,"delete":true,"audit":true,"resAudit":true,"import":true,"export":true};
-        me.setAllOthers(record,true,data);
+        var me = this;
+        me.setAllOthers(record,true);
 
     },
     deselectAllPower:function(record){
-        var me = this;data={"query":false,"add":false,"save":false,"delete":false,"audit":false,"resAudit":false,"import":false,"export":false};
-        me.setAllOthers(record,false,data);
+        var me = this;
+        me.setAllOthers(record,false);
     },
-    setAllOthers:function(record,bool,data){
-        var others=record.get('others');
-        Ext.Array.each(others,function(o){
-            o.value=bool;
+    setAllOthers:function(record,bool){
+        var data = {};
+        data.add = bool;
+        data.query = bool;
+        data.delete = bool;
+        data.audit = bool;
+        data.update = bool;
+        data.unAudit= bool;
+        data.fileExport= bool;
+        data.fileImport= bool;
+        data.print= bool;
+        var other=record.get('other');
+        Ext.Array.each(other,function(o){
+            o.checked=bool;
         })
-        data.others = others
+        data.other = other;
+        data.id = record.get('id');
+        data.groupId = record.get('groupId');
+        data.groupName = record.get('groupName');
+        data.moduleName =  record.get('moduleName');
         record.set(data);
     }
 });

+ 2 - 2
frontend/saas-web/app/view/sys/power/OtherField.js

@@ -23,8 +23,8 @@ Ext.define('saas.view.sys.power.OtherField', {
             if(this.items.length>0)this.removeAll(true);
             for (i = 0; i < len; i++) {
                 items.push({
-                   boxLabel:v[i].text,
-                   checked:v[i].value
+                   boxLabel:v[i].name,
+                   checked:v[i].checked
                 });
             }
             this.add(items);

+ 205 - 19
frontend/saas-web/app/view/sys/power/TreePanel.js

@@ -5,31 +5,217 @@ Ext.define('saas.view.sys.power.TreePanel', {
     //工具类
     FormUtil: Ext.create('saas.util.FormUtil'),
     BaseUtil: Ext.create('saas.util.BaseUtil'),
+    dataUrl:'/api/account/role/list',
+    deleteUrl:'/api/account/role/delete/',
 
     initComponent: function () {
         var me = this;
+        me.store = Ext.create('Ext.data.TreeStore', {
+            fields : ['name', 'id', 'description','code'],
+            autoLoad:false,
+            root : {
+                text : 'Root',
+                id : 0,
+                expanded : true
+            }
+        }),
+        me.columns =[{
+            xtype: 'treecolumn',
+            dataIndex: 'text',
+            flex: 1
+        }, {
+            xtype: 'actioncolumn',
+            width: 28,
+            iconCls: 'x-hidden icon x-fa fa-plus',
+            getClass: function(v, meta, rec) {
+                if(rec.get('code')=='ROLE_ADMIN'){
+                    return 'x-hidden icon x-fa fa-key';
+                }else if(rec.get('leaf')){
+                     return 'x-hidden icon x-fa fa-pencil';
+                }else{
+                     return 'x-hidden icon x-fa fa-plus';
+                }
+            },
+            handler: function(treeview, rowIdx, colIdx, e) {
+                var record = treeview.store.data.getAt(rowIdx);
+                me.addItem(record);
+            }
+        }, {
+            xtype: 'actioncolumn',
+            width: 36,
+            iconCls: 'x-hidden icon x-fa fa-trash-o',
+            getClass: function(v, meta, rec) {
+                if(rec.get('code')=='ROLE_ADMIN'){
+                    return '';
+                }else if(rec.get('leaf')){
+                     return 'x-hidden icon x-fa fa-trash-o';
+                }else {
+                    return '';
+                }
+            },
+            handler: function(treeview, rowIdx, colIdx, e) {
+                var record = treeview.store.data.getAt(rowIdx);
+                me.deleteItem(record);
+            }
+        }];
+        me.setTree();
+        me.callParent(arguments);
+    },
+    listeners: {
+		itemmouseenter: function(th, record, item, index, e, eOpts) {
+			var imgs = item.getElementsByClassName('icon x-fa');
+			Ext.Array.each(imgs, function(img) {
+				img.classList.remove('x-hidden');
+			});
+		},
+		itemmouseleave: function(th, record, item, index, e, eOpts) {
+			var imgs = item.getElementsByClassName('icon x-fa');
+			Ext.Array.each(imgs, function(img) {
+				img.classList.add('x-hidden');
+			});
+        },
+        itemclick:function(view,record,index,d,e){
+            if(!record.get('leaf')){
+                return;
+            }
+            var classList = e.target.classList;
+            var clickIcon = false;
+            Ext.Array.each(classList, function(item) {
+				if(item.indexOf('x-action-col')>-1){
+                    clickIcon = true;
+                }
+            });
+            if(clickIcon){return;}
+            //加载右边的grid
+            var id = record.get('id');
+            if(id&&id!=0){
+                var grid = view.ownerCt.ownerCt.query('power-grid')[0];
+                grid.initId = id;
+                grid.store.load();
+                grid.store.group('moduleName', 'ASC');
+            }
+        }
+    },
+    getData:function(){
+        var me = this;
+        var data = [];
+        Ext.Ajax.request({
+            url: me.dataUrl,
+            params: '',
+            method: 'GET',
+            async:false,
+            success: function(response, opts) {
+                var _data = Ext.decode(response.responseText);
+                if(_data&&_data.data){
+                    _data = _data.data;
+                    for (let index = 0; index < _data.length; index++) {
+                        var o = {
+                            code:_data[index].code,
+                            id: _data[index].id,
+                            text: _data[index].name,
+                            name:_data[index].name,
+                            description:_data[index].description,
+                            leaf:true,
+                            iconCls: 'x-fa fa-user',
+                        }
+                        data.push(o);
+                    }
+                }
+            },
+            failure: function(response, opts) {}
+        }); 
+        return data; 
+    },
+    setTree:function(){
+        var me = this;
+        var data = me.getData();
         me.getStore().setRootNode({
-            text: 'root',
+            text: '角色列表',
             id: '0',
+            iconCls: 'x-fa fa-list',
             expanded: true,
-            children: [{
-                text: '测试',
-                iconCls: 'x-fa fa-wrench',
-                children: [{
-                    text: '叶子1',
-                    iconCls: 'x-fa fa-share-alt',
-                    leaf: true
-                },{
-                    text: '叶子2',
-                    iconCls: 'x-fa fa-flag',
-                    leaf: true
-                },{
-                    text: '叶子3',
-                    iconCls: 'x-fa fa-signal',
-                    leaf: true
-                }]
-            }]
+            children: data
+        });
+    },
+    addItem:function(rec){
+        var me=this;
+        var isleaf = rec.get('leaf');
+        var record = isleaf?rec:null;
+        var view = this.ownerCt.getController().getView();
+        var document = Ext.create('saas.view.document.kind.Kind',{});
+        this.dialog = view.add({
+            xtype: 'document-kind-childwin',
+            bind: {
+                title: (record?'修改':'新增')+'角色'
+            },
+            dataKind:'personpower',
+            belong:document.etc['personpower'],
+            _parent:this,
+            record:record,
+            session: true,
+            onSave:function(){
+                var me = this;
+                var belong = this.belong;
+                me.setLoading(true);
+                var form=this.down('form');
+                var params = {};
+                var names = belong.columns.map(column => column.dataIndex);
+                Ext.Array.each(names,function(name) {
+                    if(name){
+                        var dataField = form.down('[name='+name+']');
+                        if(dataField&&dataField.value){
+                            params[name] = dataField.value;
+                            params._value = dataField.value;
+                        }
+                    }
+                });
+                var idField = form.down('[name='+belong.keyField+']');
+                params[belong.keyField] = idField.value || 0;
+                //保存接口
+                this.BaseUtil.request({
+                    url: idField.value?belong.updateUrl:belong.reqUrl,
+                    params: JSON.stringify(params),
+                    method: 'POST'
+                })
+                .then(function(localJson) {
+                    me.setLoading(false);
+                    if(localJson.success){
+                        showToast('保存成功');
+                        me._parent.setTree();
+                        form.ownerCt.close();
+                    }
+                })
+                .catch(function(res) {
+                    me.setLoading(false);
+                    console.error(res);
+                    showToast('保存失败: ' + res.message);
+                });
+            }
+        });
+        this.dialog.show();
+    },
+    deleteItem:function(rec){
+        if(rec&&(rec.get('code')=='ROLE_ADMIN'||!rec.get('leaf'))){
+            return;
+        }
+        var me = this;
+        me.setLoading(true);
+        me.BaseUtil.request({
+            url: me.deleteUrl + rec.get('id'),
+            params: '',
+            method: 'POST'
+        })
+        .then(function(localJson) {
+            me.setLoading(false);
+            if(localJson.success){
+                showToast('删除成功');
+                me.setTree();
+            }
+        })
+        .catch(function(res) {
+            me.setLoading(false);
+            console.error(res);
+            showToast('删除失败: ' + res.message);
         });
-        me.callParent(arguments);
     }
 });

+ 10 - 0
frontend/saas-web/overrides/form/Basic.js

@@ -0,0 +1,10 @@
+Ext.define('saas.override.form.Basic', {
+    override: 'Ext.form.Basic',
+
+    getDirtyData: function () {
+        return this.getFields().items.filter(function(f) {
+            return f.isDirty();
+        });
+    }
+
+});

+ 2 - 2
frontend/saas-web/resources/json/navigation.json

@@ -69,9 +69,9 @@
             "text": "销售明细表",
             "viewType": "sale-report-sale"
         }, {
-            "id": "report-salein",
+            "id": "report-salerec",
             "text": "销售收款一览表",
-            "viewType": "sale-report-salein"
+            "viewType": "sale-report-salerec"
         }, {
             "id": "report-saleprofit",
             "text": "销售利润表",