From 79eab76ac1b4b77696c92d72cfbde1e122c4c28f Mon Sep 17 00:00:00 2001
From: jinlin <jinlin>
Date: 星期一, 28 十月 2024 17:58:44 +0800
Subject: [PATCH] 关于修改可靠性产品重复

---
 starter/src/main/java/com/zt/life/StartupHandler.java                                                               |    7 +
 starter/src/main/resources/application.yml                                                                          |   15 +-
 starter/src/main/java/com/zt/task/UpdateDataTask.java                                                               |    5 
 web/src/views/modules/basicInfo/XhProductModel.vue                                                                  |    7 
 modules/mainPart/src/main/java/com/zt/life/modules/mainPart/sysPictureBase/service/SysPictureBaseService.java       |   16 +++
 modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/dao/XhProductModelDao.java                    |    4 
 web/src/views/modules/baseReliability/ParamDataBasic.vue                                                            |    1 
 web/public/index.html                                                                                               |    6 
 modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/SimulatAssessService.java       |    1 
 web/src/views/modules/taskReliability/RBD-edit-img.vue                                                              |   20 ++--
 modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/service/XhProductModelService.java            |   19 +++
 modules/mainPart/src/main/resources/mapper/baseReliability/ParamDataBasicDao.xml                                    |   25 ++++
 web/src/views/modules/home.vue                                                                                      |   28 +++--
 modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/controller/XhProductModelController.java      |   41 +++++---
 web/src/views/modules/basicInfo/XhProductModel-AddOrUpdate.vue                                                      |   23 +++-
 modules/mainPart/src/main/resources/mapper/basicInfo/XhProductModelDao.xml                                          |   15 ++
 modules/mainPart/src/main/java/com/zt/life/modules/mainPart/sysPictureBase/controller/SysPictureBaseController.java |   12 --
 17 files changed, 170 insertions(+), 75 deletions(-)

diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/controller/XhProductModelController.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/controller/XhProductModelController.java
index b71e115..f515f52 100644
--- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/controller/XhProductModelController.java
+++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/controller/XhProductModelController.java
@@ -6,6 +6,7 @@
 import com.zt.common.annotation.QueryParam;
 import com.zt.common.db.query.QueryFilter;
 import com.zt.common.servlet.Result;
+import com.zt.common.utils.CacheUtils;
 import com.zt.common.utils.UUIDUtil;
 import com.zt.common.validator.AssertUtils;
 import com.zt.common.validator.ValidatorUtils;
@@ -34,6 +35,7 @@
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -74,6 +76,7 @@
     public Result<List<XhProductModel>> getTreeList(Boolean showXdy, Integer ztShow, Long productId) {
         List<XhProductModel> list = xhProductModelService.getAllTree(showXdy, ztShow, productId);
 
+
         return Result.ok(list);
     }
 
@@ -93,9 +96,16 @@
         return Result.ok(data);
     }
 
+    @GetMapping("getImg")
+    @ApiOperation("淇℃伅")
+    public void getImg(HttpServletResponse response, Long id) {
+        xhProductModelService.getImg(response, id);
+    }
+
+
     @GetMapping("getProductList")
-    public Result<List<XhProductModel>> getProductList() {
-        List<XhProductModel> list = xhProductModelService.getProductList();
+    public Result<List<XhProductModel>> getProductList(Long shipId, Integer productType) {
+        List<XhProductModel> list = xhProductModelService.getProductList(shipId, productType - 1);
         return Result.ok(list);
     }
 
@@ -125,8 +135,8 @@
     @GetMapping("exportData")
     @ApiOperation("瀵煎嚭浜у搧妯″瀷")
     @LogOperation("瀵煎嚭浜у搧妯″瀷")
-    public Result exportDataExcel(HttpServletRequest request, HttpServletResponse response, Long shipId,String fileName) {
-        xhProductModelService.exportDataExcel(request,response,shipId,fileName);
+    public Result exportDataExcel(HttpServletRequest request, HttpServletResponse response, Long shipId, String fileName) {
+        xhProductModelService.exportDataExcel(request, response, shipId, fileName);
 
         return null;
     }
@@ -156,7 +166,9 @@
         }
 
         xhProductModelService.insert(xhProductModel);
-
+        Map<Long, XhProductModel> imgMap = new HashMap<>();
+        imgMap = (Map<Long, XhProductModel>) CacheUtils.get("sysImgCache", "sysImgCache");
+        imgMap.put(xhProductModel.getId(), xhProductModel);
         return Result.ok();
     }
 
@@ -184,6 +196,9 @@
         //鏁堥獙鏁版嵁
         ValidatorUtils.validateEntity(xhProductModel, UpdateGroup.class, DefaultGroup.class);
         xhProductModelService.update(xhProductModel);
+        Map<Long, XhProductModel> imgMap = new HashMap<>();
+        imgMap = (Map<Long, XhProductModel>) CacheUtils.get("sysImgCache", "sysImgCache");
+        imgMap.put(xhProductModel.getId(), xhProductModel);
 
         return Result.ok();
     }
@@ -200,19 +215,15 @@
     }
 
     private void deleteByProduct(Long[] ids) {
+        Map<Long, XhProductModel> imgMap = new HashMap<>();
+        imgMap = (Map<Long, XhProductModel>) CacheUtils.get("sysImgCache", "sysImgCache");
         for (Long id : ids) {
-            XhProductModel data = xhProductModelService.get(id);
-            if (data.getProductType().equals("1") || data.getProductType().equals("3") || data.getProductType().equals("4")) {
-                xhProductModelService.deleteLogic(id);
-              /*  List<Long> list =xhProductModelService.getByPid(id);
-                Long[] L = list.stream().toArray(Long[]::new);*/
-                Long[] list = xhProductModelService.getByPid(id);
+            Long[] list = xhProductModelService.getByPid(id);
+            if (list.length > 0){
                 this.deleteByProduct(list);
-            } else if (data.getProductType().equals("2")) {
-                xhProductModelService.deleteByShipId(data.getShipId());
-            } else if (data.getProductType().equals("5")) {
-                xhProductModelService.deleteLogic(id);
             }
+            imgMap.remove(id);
+            xhProductModelService.deleteLogic(id);
         }
     }
 }
diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/dao/XhProductModelDao.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/dao/XhProductModelDao.java
index 1df0062..226ca83 100644
--- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/dao/XhProductModelDao.java
+++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/dao/XhProductModelDao.java
@@ -25,7 +25,7 @@
 
     Integer getNo(Long pid, String productType);
 
-    List<XhProductModel> getProductList();
+    List<XhProductModel> getProductList(Long shipId, Integer type);
 
     List<ProductImg> getProduct(Long productId, Long parentId);
 
@@ -47,4 +47,6 @@
     List<ProductDto> getProductByShip(Long shipId);
 
     List<XhProductModel> getProductListByShip(Long productId, int level1, int level2);
+
+    List<XhProductModel> getProductListAll();
 }
diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/service/XhProductModelService.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/service/XhProductModelService.java
index bf0b6f3..75a409d 100644
--- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/service/XhProductModelService.java
+++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/service/XhProductModelService.java
@@ -137,8 +137,8 @@
         return baseDao.getNo(pid, productType);
     }
 
-    public List<XhProductModel> getProductList() {
-        List<XhProductModel> ProductList = baseDao.getProductList();
+    public List<XhProductModel> getProductList(Long shipId, Integer type) {
+        List<XhProductModel> ProductList = baseDao.getProductList(shipId,type);
         return TreeUtils.build(ProductList);
     }
 
@@ -582,4 +582,19 @@
             writeList(dto.getChildren(), List);
         }
     }
+    public void refreshCache() {
+        List<XhProductModel> productList = baseDao.getProductListAll();
+        Map<Long, XhProductModel> imgMap = new HashMap<>();
+        for (XhProductModel product : productList) {
+            imgMap.put(product.getId(), product);
+        }
+        CacheUtils.put("sysImgCache", "sysImgCache", imgMap);
+    }
+
+    public void getImg(HttpServletResponse response, Long id) {
+        Map<Long, XhProductModel> imgMap = new HashMap<>();
+        imgMap = (Map<Long, XhProductModel>) CacheUtils.get("sysImgCache","sysImgCache");
+        XhProductModel product = imgMap.get(id);
+        sysPictureBaseService.getSvgImage(response,product.getOperatImg());
+    }
 }
diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/sysPictureBase/controller/SysPictureBaseController.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/sysPictureBase/controller/SysPictureBaseController.java
index 34a8351..29e7de6 100644
--- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/sysPictureBase/controller/SysPictureBaseController.java
+++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/sysPictureBase/controller/SysPictureBaseController.java
@@ -111,17 +111,7 @@
 
     @RequestMapping("/getSvgImage")
     public void getSvgImage(HttpServletResponse response, Long id) {
-        try {
-            SysPictureBase data = sysPictureBaseService.get(id);
-            String svgContent = data.getSvgContent();
-            response.setContentType("image/svg+xml");
-            response.getWriter().write(svgContent);
-            response.getWriter().flush();
-            response.getWriter().close();
-
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
+        sysPictureBaseService.getSvgImage(response,id);
     }
 
     @GetMapping("/getDefaultImg")
diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/sysPictureBase/service/SysPictureBaseService.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/sysPictureBase/service/SysPictureBaseService.java
index 0dfc771..7df7574 100644
--- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/sysPictureBase/service/SysPictureBaseService.java
+++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/sysPictureBase/service/SysPictureBaseService.java
@@ -8,8 +8,10 @@
 import org.springframework.stereotype.Service;
 import com.zt.common.db.query.QueryFilter;
 
+import javax.servlet.http.HttpServletResponse;
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Null;
+import java.io.IOException;
 import java.util.List;
 
 
@@ -52,4 +54,18 @@
     public SysPictureBase getDefaultImg(Integer productType) {
         return baseDao.getDefaultImg(productType);
     }
+    public void getSvgImage(HttpServletResponse response, Long id) {
+        try {
+            SysPictureBase data = this.get(id);
+            String svgContent = data.getSvgContent();
+            response.setContentType("image/svg+xml");
+            response.getWriter().write(svgContent);
+            response.getWriter().flush();
+            response.getWriter().close();
+
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
 }
diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/SimulatAssessService.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/SimulatAssessService.java
index 8f6baca..ae1baa0 100644
--- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/SimulatAssessService.java
+++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/SimulatAssessService.java
@@ -582,6 +582,7 @@
                 this.processJSONArray(jsonArray, item, taskId);
             }
         }
+        childList.removeIf(item -> item.getStatusList().size() == 0);
         return childList;
     }
 
diff --git a/modules/mainPart/src/main/resources/mapper/baseReliability/ParamDataBasicDao.xml b/modules/mainPart/src/main/resources/mapper/baseReliability/ParamDataBasicDao.xml
index 572c271..12b4d14 100644
--- a/modules/mainPart/src/main/resources/mapper/baseReliability/ParamDataBasicDao.xml
+++ b/modules/mainPart/src/main/resources/mapper/baseReliability/ParamDataBasicDao.xml
@@ -79,9 +79,11 @@
         SET repair_mttcr = 0
         where b.ship_id = ${shipId}
           and repair_mttcr is null;
+
         UPDATE param_data a, product_model b
         SET basic_mtbf_regulate_tmp = basic_mtbf_regulate
         where b.ship_id = ${shipId};
+
         UPDATE param_data a, product_model b
         SET basic_mtbf_regulate_tmp = basic_runs_num / basic_mtbf_regul_succ_rate
         where b.ship_id = ${shipId}
@@ -92,12 +94,29 @@
         UPDATE param_data a, product_model b
         SET basic_mtbf_regulate = basic_mtbf_regulate_tmp
         where b.ship_id = ${shipId}
-          and (reliab_distrib_type = 1 or reliab_distrib_type is null);
+          and (reliab_distrib_type = 1 or reliab_distrib_type is null)
+          and a.product_id = b.id
+          and a.IS_DELETE = 0
+          and b.IS_DELETE = 0;
 
         UPDATE param_data a, product_model b
         SET ai = basic_mtbf_regulate_tmp / (basic_mtbf_regulate_tmp + repair_mttcr)
         where b.ship_id = ${shipId}
+          and a.product_id = b.id
+          and a.IS_DELETE = 0
+          and b.IS_DELETE = 0;
 
+        UPDATE param_data a,(
+            select pid, case when count(1) > 0 then 1 else 0 end as basic_join_compute
+            from param_data a,
+                 product_model b
+            where b.ship_id = ${shipId}
+              and a.product_id = b.id
+              and a.basic_join_compute = 1
+            group by b.pid
+        ) b
+        set a.basic_join_compute = b.basic_join_compute
+        where a.product_id = b.pid;
     </update>
 
     <select id="getAI" resultType="com.zt.life.modules.mainPart.basicInfo.model.ParamData">
@@ -109,11 +128,13 @@
                b.repair_mttcr,
                b.basic_mtbf_operating_ratio,
                b.basic_mtbf_regul_succ_rate,
-               b.basic_runs_num
+               b.basic_runs_num,
+               b.basic_unit_num
         FROM product_model a
                  LEFT JOIN param_data b ON b.product_id = a.id and b.is_delete = 0
         where a.is_delete = 0
             and a.product_type &lt;&gt; 10
+            and b.basic_join_compute = 1
             and a.ship_id = ${shipId}
            or a.id = ${shipId}
         ORDER BY a.product_type, a.sort
diff --git a/modules/mainPart/src/main/resources/mapper/basicInfo/XhProductModelDao.xml b/modules/mainPart/src/main/resources/mapper/basicInfo/XhProductModelDao.xml
index e1d3552..5e22afc 100644
--- a/modules/mainPart/src/main/resources/mapper/basicInfo/XhProductModelDao.xml
+++ b/modules/mainPart/src/main/resources/mapper/basicInfo/XhProductModelDao.xml
@@ -50,6 +50,12 @@
         select a.name, a.id
         from product_model a
         where a.is_delete = 0
+        <if test="type!=null and type!=''">
+            and a.product_type = ${type}
+        </if>
+        <if test="shipId!=null">
+            and a.ship_id = ${shipId}
+        </if>
     </select>
     <select id="getProduct" resultType="com.zt.life.modules.mainPart.basicInfo.model.ProductImg">
         SELECT a.operat_img                 as imgPath,
@@ -189,9 +195,9 @@
     <select id="getProductListByShip" resultType="com.zt.life.modules.mainPart.basicInfo.model.XhProductModel">
         select a.*, b.basic_unit_num as sameSbNum
         from product_model a,
-             param_data b
+        param_data b
         where a.IS_DELETE = 0 and b.IS_DELETE = 0
-          and a.id = b.product_id
+        and a.id = b.product_id
         <if test="productId !=null">
             and a.ship_id = #{productId}
         </if>
@@ -202,4 +208,9 @@
             and a.product_type &lt;= #{level2}
         </if>
     </select>
+    <select id="getProductListAll" resultType="com.zt.life.modules.mainPart.basicInfo.model.XhProductModel">
+        select id, operat_img
+        from product_model
+        where IS_DELETE = 0
+    </select>
 </mapper>
diff --git a/starter/src/main/java/com/zt/life/StartupHandler.java b/starter/src/main/java/com/zt/life/StartupHandler.java
index 7d62798..12fd58c 100644
--- a/starter/src/main/java/com/zt/life/StartupHandler.java
+++ b/starter/src/main/java/com/zt/life/StartupHandler.java
@@ -1,14 +1,19 @@
 package com.zt.life;
 
+import com.zt.life.modules.mainPart.basicInfo.service.ParamDataService;
+import com.zt.life.modules.mainPart.basicInfo.service.XhProductModelService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.ApplicationArguments;
 import org.springframework.boot.ApplicationRunner;
 import org.springframework.stereotype.Component;
 
 @Component
 public class StartupHandler implements ApplicationRunner {
-
+    @Autowired
+    XhProductModelService xhProductModelService;
     @Override
     public void run(ApplicationArguments args) throws Exception {
         // 鍒锋柊缂撳瓨
+        xhProductModelService.refreshCache();
     }
 }
diff --git a/starter/src/main/java/com/zt/task/UpdateDataTask.java b/starter/src/main/java/com/zt/task/UpdateDataTask.java
index b2f3c4c..7acecc2 100644
--- a/starter/src/main/java/com/zt/task/UpdateDataTask.java
+++ b/starter/src/main/java/com/zt/task/UpdateDataTask.java
@@ -1,6 +1,7 @@
 package com.zt.task;
 
 import com.zt.common.utils.CommonUtils;
+import com.zt.life.modules.mainPart.basicInfo.service.XhProductModelService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -21,13 +22,15 @@
 
     @Autowired
     private RedisTemplate redisTemplate;
+    @Autowired
+    XhProductModelService xhProductModelService;
 
 
     @Scheduled(cron = "0 0 3 * * ?") //姣忓ぉ3鐐规墽琛�
     public void task() {
         logger.info("鏇存柊鏁版嵁task寮�濮�");
         Date beginDate = new Date();
-
+        xhProductModelService.refreshCache();
         purgeRedis();
 
         logger.info("鏇存柊鏁版嵁task鑰楁椂:" + CommonUtils.getDatePoor(new Date(), beginDate));
diff --git a/starter/src/main/resources/application.yml b/starter/src/main/resources/application.yml
index 8ffda70..ed5eb82 100644
--- a/starter/src/main/resources/application.yml
+++ b/starter/src/main/resources/application.yml
@@ -6,7 +6,7 @@
     min-spare-threads: 30
   port: 8066
   servlet:
-    context-path: /test-project
+    context-path: /reliability_simulat
     session:
       cookie:
         http-only: true
@@ -18,7 +18,7 @@
     druid:
       driver-class-name: com.mysql.cj.jdbc.Driver
       url: jdbc:mysql://192.168.31.26:3366/reliability_simulat?allowMultiQueries=true&hive.exec.orc.split.strategy=ETL&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8
-#      url: jdbc:mysql://127.0.0.1:3305/reliability_simulat?allowMultiQueries=true&hive.exec.orc.split.strategy=ETL&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8
+      #url: jdbc:mysql://127.0.0.1:3306/reliability_simulat?allowMultiQueries=true&hive.exec.orc.split.strategy=ETL&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8
       username: root
       password: root
       #password: 123456
@@ -110,15 +110,15 @@
   #    secure: false
   #  serviceRegistry:
   #    initFromJson: true
-  server-url-prefix: http://localhost:8100/cas
-  server-login-url: http://localhost:8100/cas/login
-  client-host-url: http://localhost:8050
-  validation-type: cas
+  #CAS鏈嶅姟鍦板潃
+  server-url: http://192.168.31.13:8080/cas/
+  #鏈湴瀹㈡埛绔痠p绔彛锛屼笉鏄椤靛湴鍧�
+  client-host: http://192.168.31.148:8066/reliability_simulat
 
 zt:
   oss:
     type: local
-    local-domain: http://127.0.0.1:8050/test-project/
+    local-domain: http://127.0.0.1:8066/reliability_simulat/
     local-path: D:/ReliabilitySimulation/ #闄勪欢瀛樺偍鐩綍
     local-qd-path: D:/TestProjectFiles/ #闄勪欢瀛樺偍鐩綍
     local-prefix: accessories #闄勪欢瀛樺偍瀛愮洰褰�
@@ -159,3 +159,4 @@
     mainPy: D:/relia_sim/assess.py
     # 绠楁硶搴撲豢鐪熺粨鏋滃瓨鏀炬牴鐩綍
     resultHome: d:/relia_sim/sim_result
+
diff --git a/web/public/index.html b/web/public/index.html
index 8930306..8e98837 100644
--- a/web/public/index.html
+++ b/web/public/index.html
@@ -219,8 +219,8 @@
     window.SITE_CONFIG['dynamicMenuRoutesHasAdded'] = false; // 鍔ㄦ��(鑿滃崟)璺敱鏄惁宸茬粡娣诲姞鐨勭姸鎬佹爣绀猴紙鐢ㄤ簬鍒ゆ柇鏄惁闇�瑕侀噸鏂版媺鍙栨暟鎹苟杩涜鍔ㄦ�佹坊鍔犳搷浣滐級
 
     // 鏈嶅姟鍦板潃
-    window.SITE_CONFIG['apiURL'] = 'http://' + location.hostname + ':8066/test-project';
-    window.SITE_CONFIG['apiURL2'] = 'http://' + location.hostname + ':8066/test-project';
+    window.SITE_CONFIG['apiURL'] = 'http://' + location.hostname + ':8066/reliability_simulat';
+    window.SITE_CONFIG['apiURL2'] = 'http://' + location.hostname + ':8066/reliability_simulat';
     //window.SITE_CONFIG['apiURL2'] = 'http://'+location.hostname+':8066';
 
     //window.SITE_CONFIG['apiURL'] = '<%= process.env.VUE_APP_API_URL %>';
@@ -228,7 +228,7 @@
 
 
     // WebSocket鍦板潃
-    window.SITE_CONFIG['socketURL'] = 'http://' + location.hostname + ':8066/test-project';
+    window.SITE_CONFIG['socketURL'] = 'http://' + location.hostname + ':8066/reliability_simulat';
     //window.SITE_CONFIG['socketURL'] ='<%= process.env.VUE_APP_SOCKET_URL %>';
 
   </script>
diff --git a/web/src/views/modules/baseReliability/ParamDataBasic.vue b/web/src/views/modules/baseReliability/ParamDataBasic.vue
index 81726fd..5b497be 100644
--- a/web/src/views/modules/baseReliability/ParamDataBasic.vue
+++ b/web/src/views/modules/baseReliability/ParamDataBasic.vue
@@ -29,6 +29,7 @@
                       border @selection-change="table.selectionChangeHandle">
               <!--<el-table-column type="selection" width="40"/>-->
               <el-table-column prop="name" label="鍚嶇О"/>
+              <el-table-column prop="basicUnitNum" label="鍗曞厓鏁伴噺"/>
               <el-table-column prop="basicMtbfRegulate" label="MTBF" align="right">
                 <template slot-scope="scope">
                   <span>{{  keepNumber(scope.row.basicMtbfRegulate) }}</span>
diff --git a/web/src/views/modules/basicInfo/XhProductModel-AddOrUpdate.vue b/web/src/views/modules/basicInfo/XhProductModel-AddOrUpdate.vue
index ccdfae3..b78c5c2 100644
--- a/web/src/views/modules/basicInfo/XhProductModel-AddOrUpdate.vue
+++ b/web/src/views/modules/basicInfo/XhProductModel-AddOrUpdate.vue
@@ -11,10 +11,10 @@
         <el-input v-model="dataForm.equipType"></el-input>
       </zt-form-item>
       <zt-form-item label="鑺傜偣绫诲瀷" prop="productType" rules="required">
-        <zt-dict v-model="dataForm.productType" dict="product" @input="getDefaultImg"
+        <zt-dict v-model="dataForm.productType" dict="product" @input="changeType"
                  :disabled="disabled"></zt-dict>
       </zt-form-item>
-      <zt-form-item  v-if="dataForm.productType!=='1'" label="杩愯鐘舵�佸浘" prop="operatImg">
+      <zt-form-item v-if="dataForm.productType!=='1'" label="杩愯鐘舵�佸浘" prop="operatImg">
         <el-input v-model="dataForm.operatImgName" @focus="selectPicture()"></el-input>
         <el-image v-if="dataForm.operatImg" :src="url+dataForm.operatImg" style="height: 50px;width: 50px"></el-image>
       </zt-form-item>
@@ -58,7 +58,7 @@
     },
     methods: {
       init(id, params) {
-        this.getProductList()
+        console.log(params)
         if (params.shipId) {
           this.dataForm.shipId = params.shipId
         }
@@ -73,19 +73,32 @@
           this.getDefaultImg(this.dataForm.productType)
         } else {
           this.dataForm.pid = params.pid
-          this.dataForm.productType = params.type
+          console.log(params.productType,'type')
+          console.log(parseInt(params.productType),'parseInttype')
+          this.dataForm.productType = parseInt(params.productType)
+          this.getDefaultImg(this.dataForm.productType)
         }
         if (this.dataForm.productType === '10' && id == null) {
           this.isShow = false
           this.getDefaultImg(this.dataForm.productType)
         }
+        this.getProductList()
       },
       // 鑾峰彇绯荤粺鍒楄〃
       async getProductList() {
-        let res = await this.$http.get('/basicInfo/XhProductModel/getProductList')
+        let params = {
+          productType: this.dataForm.productType,
+          shipId: this.dataForm.shipId
+        }
+        let res = await this.$http.get('/basicInfo/XhProductModel/getProductList', {params: params})
         this.productList = res.data
         console.log(this.productList, 'getProductList')
       },
+      changeType(selected) {
+        this.dataForm.productType = selected
+        this.getDefaultImg(selected)
+        this.getProductList()
+      },
       async getDefaultImg(selected) {
         console.log(selected, 'async getDefaultImg')
         let params = {
diff --git a/web/src/views/modules/basicInfo/XhProductModel.vue b/web/src/views/modules/basicInfo/XhProductModel.vue
index e564467..7aa5a65 100644
--- a/web/src/views/modules/basicInfo/XhProductModel.vue
+++ b/web/src/views/modules/basicInfo/XhProductModel.vue
@@ -101,14 +101,15 @@
         this.dataForm.type = this.productType
 
         if (this.dataForm.type !== '1') {
-          this.$refs.SelectTyModel.$refs.dialog.init(null, {
+          /*this.$refs.SelectTyModel.$refs.dialog.init(null, {
             type: this.dataForm.type,
             id: this.dataForm.pid,
             shipId: this.shipId,
             namePath: this.namePath
-          })
+          })*/
+          this.$refs.AddOrUpdate.$refs.dialog.init(null, {id: null, productType: parseInt(this.dataForm.type)+1 , pid: this.dataForm.pid,shipId: this.shipId})
         } else {
-          this.$refs.AddOrUpdate.$refs.dialog.init(null, {id: null, type: 'zt', pid: this.dataForm.pid})
+          this.$refs.AddOrUpdate.$refs.dialog.init(null, {id: null, type: 'zt', pid: this.dataForm.pid,shipId: this.shipId})
         }
       },
       addCell() {
diff --git a/web/src/views/modules/home.vue b/web/src/views/modules/home.vue
index 1c0f252..d80e736 100644
--- a/web/src/views/modules/home.vue
+++ b/web/src/views/modules/home.vue
@@ -1,11 +1,11 @@
 <template>
-  <div class="fa-card-b">
-    <div style="margin: 0 0 10px 0">
-      <span class="size">绯荤粺鐧诲綍娆℃暟:</span>
-      <span class="font">{{dataForm.loginNum}}</span>
-      <span class="size">璇曢獙鏂规鍒跺畾娆℃暟:</span>
-      <span class="font">{{dataForm.planMakeNum}}</span>
-    </div>
+    <div class="fa-card-b">
+      <div style="margin: 0 0 10px 0">
+        <span class="size">绯荤粺鐧诲綍娆℃暟:</span>
+        <span class="font">{{dataForm.loginNum}}</span>
+        <span class="size">璇曢獙鏂规鍒跺畾娆℃暟:</span>
+        <span class="font">{{dataForm.planMakeNum}}</span>
+      </div>
       <el-table ref="taskTable" class="DataTable" :data="dataForm.taskReliabList" height="330px" border>
         <el-table-column label="浠诲姟鍙潬鎬ф暟鎹�" align="center">
           <el-table-column align="center" prop="name" label="鍚嶇О">
@@ -64,12 +64,15 @@
           baseReliabList: [],
           loginNum: '',
           planMakeNum: ''
-        }
+        },
+        userId: ''
       }
     },
     components: {},
+    created() {
+    },
     mounted() {
-      this.init()
+      this.init2()
     },
     computed: {
       keepNumber() { //杩囨护鍣ㄤ繚鐣�4涓哄皬鏁�
@@ -80,7 +83,7 @@
       },
     },
     methods: {
-      init() {
+      init2() {
         this.getInfo2()
       },
       async getInfo2() {
@@ -102,12 +105,13 @@
     background: #edf6ff;
   }
 
-  .size{
+  .size {
     font-size: 20px;
     margin: 10px;
     color: #000000;
   }
-  .font{
+
+  .font {
     font-size: 20px;
     margin: 10px;
     color: #0aa0bf;
diff --git a/web/src/views/modules/taskReliability/RBD-edit-img.vue b/web/src/views/modules/taskReliability/RBD-edit-img.vue
index b818414..74bf82b 100644
--- a/web/src/views/modules/taskReliability/RBD-edit-img.vue
+++ b/web/src/views/modules/taskReliability/RBD-edit-img.vue
@@ -1026,7 +1026,7 @@
           this.graph.createNode({
             shape: 'image',
             //imageUrl: `${window.SITE_CONFIG['apiURL']}/sysPictureBase/getProductImg?token=${Cookies.get('token')}&id=${item.imgPath}`,
-            width: 100,
+            width: 60,
             height: 70,
             //id: item.dataId, // 鎵嬪姩璁剧疆鑺傜偣鐨� ID
             data: {
@@ -1057,11 +1057,11 @@
             },
             attrs: {
               image: {
-                'xlink:href': `${window.SITE_CONFIG['apiURL']}/sysPictureBase/getSvgImage?token=${Cookies.get('token')}&id=${item.imgPath}`,
+                'xlink:href': `${window.SITE_CONFIG['apiURL']}/basicInfo/XhProductModel/getImg?token=${Cookies.get('token')}&id=${item.dataId}&t=${new Date().getTime()}`,
                 //'xlink:href': urlObject.createObjectURL(new Blob([item.svgContent])),
               },
               title: {
-                text: item.basicUnitNum>=1?item.basicUnitNum:'',
+                text: item.basicUnitNum>1?item.basicUnitNum:'',
                 refX: 15,
                 refY: 10,
                 fill: '#748be7',
@@ -1739,7 +1739,7 @@
         let dragNodeType = dragNode.getData().nodeType
         let offHeight = 50
         if (dragNodeType === 'node') {
-          offHeight = 60
+          offHeight = 70
         } else if (dragNodeType === 'bridgeConnection') {
           offHeight = 175
         } else {
@@ -1797,13 +1797,13 @@
           this.getYRange(inEdges, graphNodeStartNode, pointXY)
           console.log(pointXY, 'new')
 
-          let minX = graphNodeStartNode.position().x + graphNode.getBBox().width + 15
-          let maxX = graphNode.position().x
+          let minX = graphNodeStartNode.position().x + graphNode.getBBox().width
+          let maxX = graphNode.position().x - dragNode.getBBox().width / 2
           let centerX = minX + (maxX - minX) / 2
           let centerY = graphNodeY + graphNode.getBBox().height / 2 - pointXY.minY > pointXY.maxY - (graphNodeY + graphNode.getBBox().height / 2) ?
             pointXY.maxY + offHeight / 2 + 30 : pointXY.minY - offHeight / 2 - 30
 
-          let result = this.addNodeAndConnect(null, dragNode, minX, centerY)
+          let result = this.addNodeAndConnect(null, dragNode, centerX, centerY)
           console.log(result, 'result111')
           this.graph.addEdge({
             source: {cell: graphNodeStartNode},
@@ -1844,8 +1844,8 @@
           leftTopY = centerY
         let dragNodeType = dragNode.getData().nodeType
         if (dragNodeType === 'node') {
-          width = 60
-          height = 60
+          width = 100
+          height = 70
         } else if (dragNodeType === 'dashedBox') {
           width = 60
           height = 40
@@ -1854,7 +1854,7 @@
           height = 175
         } else {
           width = 270
-          height = 60
+          height = 70
         }
         leftTopX = centerX - width / 2
         leftTopY = centerY - height / 2

--
Gitblit v1.9.1