From cd7b35b1acc7467deac78ba843b5870a22c9c7f6 Mon Sep 17 00:00:00 2001
From: jinlin <jinlin>
Date: 星期二, 06 八月 2024 08:59:12 +0800
Subject: [PATCH] 修改

---
 web/src/views/modules/taskReliability/TimeDiagram.vue                                                               |  452 +++++++------------------------
 modules/mainPart/src/main/java/com/zt/life/modules/mainPart/utils/GetStringSpace.java                               |   23 +
 web/src/views/modules/taskReliability/TaskPhase-AddOrUpdate.vue                                                     |    8 
 web/src/views/modules/taskReliability/Task.vue                                                                      |    2 
 web/src/views/modules/taskReliability/TaskRepairParam.vue                                                           |    1 
 modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/SimulatAssessService.java       |   74 +++-
 modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/service/XhProductModelService.java            |   45 ---
 web/src/views/modules/taskReliability/TaskPhaseModel.vue                                                            |    9 
 modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/controller/SimulatAssessController.java |    1 
 web/src/views/modules/taskReliability/ModelView.vue                                                                 |    2 
 modules/mainPart/src/main/java/com/zt/life/modules/mainPart/baseReliability/service/ParamDataBasicService.java      |   15 
 modules/mainPart/src/main/resources/mapper/baseReliability/ParamDataBasicDao.xml                                    |  131 ++++----
 modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/controller/XhProductModelController.java      |   18 +
 web/src/views/modules/basicInfo/XhProductModel-AddOrUpdate.vue                                                      |    1 
 14 files changed, 285 insertions(+), 497 deletions(-)

diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/baseReliability/service/ParamDataBasicService.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/baseReliability/service/ParamDataBasicService.java
index 76647fb..6868f9d 100644
--- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/baseReliability/service/ParamDataBasicService.java
+++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/baseReliability/service/ParamDataBasicService.java
@@ -14,11 +14,11 @@
 /**
  * param_data_basic
  *
- * @author zt generator 
+ * @author zt generator
  * @since 1.0.0 2024-07-11
  */
 @Service
-public class ParamDataBasicService  extends BaseService<ParamDataBasicDao, ParamData> {
+public class ParamDataBasicService extends BaseService<ParamDataBasicDao, ParamData> {
 
     /**
      * 鍒嗛〉鏌ヨ
@@ -28,6 +28,11 @@
      */
     public List<ParamData> page(QueryFilter queryFilter) {
         List<ParamData> list = baseDao.getAI(queryFilter.getQueryParams());
+        for (ParamData data : list) {
+            if (data.getBasicMtbfOperatingRatio() == null || data.getBasicMtbfOperatingRatio() == 0.0) {
+                data.setBasicMtbfOperatingRatio(1.0);
+            }
+        }
         return TreeUtils.build(list);
     }
 
@@ -41,9 +46,9 @@
     }
 
     public void compute(Long shipId) {
-        baseDao.compute(shipId,4);
-        baseDao.compute(shipId,3);
-        baseDao.compute(shipId,2);
+        baseDao.compute(shipId, 4);
+        baseDao.compute(shipId, 3);
+        baseDao.compute(shipId, 2);
         baseDao.compute2(shipId);
     }
 }
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 ffc5e7a..0391dd7 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.UUIDUtil;
 import com.zt.common.validator.AssertUtils;
 import com.zt.common.validator.ValidatorUtils;
 import com.zt.common.validator.group.AddGroup;
@@ -13,8 +14,10 @@
 import com.zt.common.validator.group.UpdateGroup;
 import com.zt.life.core.service.ZtProductService;
 import com.zt.life.dto.ImportErrDto;
+import com.zt.life.modules.mainPart.basicInfo.model.ParamData;
 import com.zt.life.modules.mainPart.basicInfo.model.ProductImg;
 import com.zt.life.modules.mainPart.basicInfo.model.XhProductModel;
+import com.zt.life.modules.mainPart.basicInfo.service.ParamDataService;
 import com.zt.life.modules.mainPart.basicInfo.service.XhProductModelService;
 import com.zt.life.modules.mainPart.sysPictureBase.service.SysPictureBaseService;
 import com.zt.life.util.ImportUtil;
@@ -48,6 +51,9 @@
 
     @Autowired
     private SysPictureBaseService sysPictureBaseService;
+
+    @Autowired
+    private ParamDataService paramDataService;
 
     @GetMapping("page")
     @ApiOperation("鍒嗛〉")
@@ -126,6 +132,18 @@
         if (xhProductModel.getSort() == null || xhProductModel.getSort() < no) {
             xhProductModel.setSort(no + 1);
         }
+        if (xhProductModel.getProductType().equals("2")){
+            Long id = UUIDUtil.generateId();
+            xhProductModel.setId(id);
+            xhProductModel.setShipId(id);
+
+            ParamData data =new ParamData();
+            data.setShipId(id);
+            data.setProductId(id);
+            data.setPageCode("expect");
+            paramDataService.insert(data);
+        }
+
         xhProductModelService.insert(xhProductModel);
 
         return Result.ok();
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 b764725..7aa9a65 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
@@ -125,7 +125,6 @@
     }
 
     public List<Map<String, Object>> importProductExcel(MultipartFile mutFile, String progressId, Long shipId) {
-        int count = 0;
         Date beginDate = new Date();
         List<Map<String, Object>> list = new ArrayList<>();//瀛樺偍鎵�鏈夌殑瀵煎叆鐘舵��
         Map<String, Object> map;//瀛樺偍姣忎竴琛岀殑鐘舵��
@@ -145,16 +144,6 @@
         isOrNot.put("鏄�", 1);
         isOrNot.put("鍚�", 0);
 
-        //鑾峰彇鏄惁鏈夋暟鎹紝濡傛灉鏈夊垯鍒犻櫎鏁版嵁
-     /*   List<XhProductModel> productList = this.getByShipId(shipId);
-        List<ParamData> dataList = paramDataService.getByShipId(shipId);
-        if (productList.size() > 0) {
-            this.deleteByShipId(shipId);
-        }
-        if (dataList.size() > 0) {
-            paramDataService.deleteByShipId(shipId);
-        }*/
-
         try {
             // 鑾峰彇瀵煎叆鏂囦欢鐨勫悗缂�鍚�
             String fileName = mutFile.getOriginalFilename();
@@ -168,7 +157,6 @@
             assert workbook != null; //鏂█濡傛灉[boolean琛ㄨ揪寮廬涓簍rue锛屽垯绋嬪簭缁х画鎵ц銆� 濡傛灉涓篺alse锛屽垯绋嬪簭鎶涘嚭AssertionError锛屽苟缁堟鎵ц銆�
             int sheets = workbook.getNumberOfSheets();
 
-            //List<LifeManagement> lifeManagementList = new ArrayList<LifeManagement>();
             Long curXtId = null;
             Long curFxtId = null;
             Long curSbId = null;
@@ -197,34 +185,11 @@
                     insertSb = false;
                     CacheUtils.put(progressId, "speed", CommonUtils.getPercent(j, num));
                     CacheUtils.put(progressId, "msg", "鍏�" + num + "琛岋紝宸插畬鎴愮" + j + "琛�");
-                  /*  boolean isToggleXt = false;
-                    boolean isToggleFxt = false;*/
+
                     row1 = j + 1;
                     String pattern = "yyyy-MM-dd";
                     Row row = sheet.getRow(row1);
                     String sort = com.zt.core.shiro.ImportUtil.getCellValue(row, 0, pattern); //搴忓彿
-/*                    if (StringUtils.isNotBlank(com.zt.core.shiro.ImportUtil.getCellValue(row, 1, pattern))) {
-                        if (!com.zt.core.shiro.ImportUtil.getCellValue(row, 1, pattern).equals(xt)) {
-                            isToggleXt = true;
-                            xtId = UUIDUtil.generateId();
-                        }
-                        xt = com.zt.core.shiro.ImportUtil.getCellValue(row, 1, pattern); //绯荤粺
-                    }
-
-                    if (StringUtils.isNotBlank(com.zt.core.shiro.ImportUtil.getCellValue(row, 2, pattern)) && !isToggleXt) {
-                        fxt = com.zt.core.shiro.ImportUtil.getCellValue(row, 2, pattern); //鍒嗙郴缁�
-                        fxtId = UUIDUtil.generateId();
-                        isToggleFxt = true;
-                    } else if (isToggleXt) {
-                        if (StringUtils.isNotBlank(com.zt.core.shiro.ImportUtil.getCellValue(row, 2, pattern))) {
-                            fxt = com.zt.core.shiro.ImportUtil.getCellValue(row, 2, pattern); //鍒嗙郴缁�
-                            fxtId = UUIDUtil.generateId();
-                            isToggleFxt = true;
-                        } else {
-                            fxt = null;
-                            isToggleFxt = true;
-                        }
-                    }*/
 
                     String xt = com.zt.core.shiro.ImportUtil.getCellValue(row, 1, pattern); //绯荤粺
                     String fxt = com.zt.core.shiro.ImportUtil.getCellValue(row, 2, pattern);
@@ -414,13 +379,7 @@
             ImportUtil.updateErrMap(errMap, "瀵煎叆寮傚父" + e.getMessage(), "", row1);
             //err++;
         }
-      /*  if (batchList.size() > 0 && err == 0) {
-            super.insertBatch(batchList, 100);
-            baseDao.updateOldId();
-        }
-        if (batchUpdateList.size() > 0) {
-            super.updateBatch(batchUpdateList, 100);
-        }*/
+
         Date nowDate = new Date();
         String msg = "浜у搧妯″瀷瀵煎叆鏃堕棿锛�" + CommonUtils.getDatePoor(nowDate, beginDate) + "\r\n";
         System.out.println(msg);
diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/controller/SimulatAssessController.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/controller/SimulatAssessController.java
index 50c1cdf..99aff53 100644
--- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/controller/SimulatAssessController.java
+++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/controller/SimulatAssessController.java
@@ -174,6 +174,7 @@
                             availability = (String) jsonArray2.getJSONObject(j).get("availability");
                         }
                     }
+
                     String[] arr = availability.split(" ");
                     // 閬嶅巻瀛愬瓧绗︿覆鏁扮粍锛屽皢姣忎釜鍏冪礌杞崲涓篸ouble骞跺瓨鍌ㄥ埌double鏁扮粍涓�
                     for (int a = 0; a < arr.length; a++) {
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 880ecaf..5050520 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
@@ -19,6 +19,7 @@
 import com.zt.life.modules.mainPart.taskReliability.dto.ProductStatusDto;
 import com.zt.life.modules.mainPart.taskReliability.dto.TaskModelCheckResult;
 import com.zt.life.modules.mainPart.taskReliability.model.*;
+import com.zt.life.modules.mainPart.utils.GetStringSpace;
 import org.dom4j.Document;
 import org.dom4j.DocumentHelper;
 import org.dom4j.Element;
@@ -37,6 +38,7 @@
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.awt.*;
 import java.io.BufferedReader;
 import java.io.InputStream;
 import java.io.InputStreamReader;
@@ -58,7 +60,7 @@
  * @since 1.0.0 2024-03-20
  */
 @Service
-public class SimulatAssessService  extends BaseService<SimulatAssessDao, SimulatAssess> {
+public class SimulatAssessService extends BaseService<SimulatAssessDao, SimulatAssess> {
     private static final Logger logger = LoggerFactory.getLogger(SimulatAssessService.class);
     private static final String RELIA_SIM_TASK_TYPE_SIMULATION = "calcreq";
 
@@ -206,7 +208,9 @@
                 x2 = x1 + status.getTimes() * pointNumPerHour + 5;
                 JSONObject lineJson = new JSONObject(templetsStrMap.get(status.getStatus()));
                 setlineXy(lineJson, x1, y, x2, y, "");
-
+                JsonUtils2.setJsonValueByPath(lineJson,"data/status".split("/"),status.getStatus());
+                JsonUtils2.setJsonValueByPath(lineJson,"data/startTimes".split("/"),String.format("%.4f", x1));
+                JsonUtils2.setJsonValueByPath(lineJson,"data/endTimes".split("/"),String.format("%.4f", x1 + status.getTimes()));
                 JsonUtils2.setJsonValueByPath(lineJson, "id".split("/"), UUIDUtil.generateId().toString());
                 x1 = x2 - 5;
                 jsonArray.add(lineJson);
@@ -224,7 +228,7 @@
         int spaceWitdth = 80;
         x1 = -spaceWitdth;
         x2 = -11;
-        y = -100;
+        y = -130;
         String[] tlArr = "O,F,I,S,M".split(",");
         for (String s : tlArr) {
             JSONObject f = templetsMap.get(s);
@@ -237,19 +241,20 @@
         //闃舵妯″瀷鍙婂埢搴�
         x1 = 0;
         x2 = 0;
-        double y1 = -60;
-        y = -30;
-        double y2 = -10;
-        JSONObject modelJson = new JSONObject(templetsStrMap.get("model"));
+        double y1 = -100;
+        y = -70;
+        double y2 = -50;
 
-        setlineXy(modelJson, x1, y1, x1, y2, null);
+        JSONObject modelJson = new JSONObject(templetsStrMap.get("model"));
+        setlineXy(modelJson, 2, y1, 2, y2, null);
         jsonArray.add(modelJson);
         double totalHours = 0;
         for (int i = 0; i < modelDtoList.size(); i++) {
             JSONObject modelJson2 = new JSONObject(templetsStrMap.get("model"));
             SimulatAssessTaskPhaseModel modelDto = modelDtoList.get(i);
             totalHours = totalHours + modelDto.getGkDuration();
-            x2 = x2 + modelDto.getGkDuration() * pointNumPerHour;
+            double gkPoint = modelDto.getGkDuration() * pointNumPerHour;
+            x2 = x2 + gkPoint;
             if (i < modelDtoList.size() - 1) {
                 setlineXy(modelJson2, x2, y1, x2, y, null);
             } else {
@@ -265,12 +270,16 @@
                 modelName = modelRbd.getModelName();
                 modelId = modelRbd.getId().toString();
             }
-
+            Map<String, Integer> mapSpace = GetStringSpace.getStringSpaceSize(modelName, null, 18);
             JSONObject textJson = new JSONObject(templetsStrMap.get("text"));
             JsonUtils2.setJsonValueByPath(textJson, "data/dataId".split("/"), modelId);
             JsonUtils2.setJsonValueByPath(textJson, "id".split("/"), UUIDUtil.generateId().toString());
             JsonUtils2.setJsonValueByPath(textJson, "attrs/label/textWrap/text".split("/"), modelName);
-            JsonUtils2.setJsonValueByPath(textJson, "position/x".split("/"), x1 + 30);
+
+            JsonUtils2.setJsonValueByPath(textJson, "size/width".split("/"), mapSpace.get("width") + 20);
+
+            double x11 = x1 + ((gkPoint - mapSpace.get("width") - 20) / 2);
+            JsonUtils2.setJsonValueByPath(textJson, "position/x".split("/"), x11);
             JsonUtils2.setJsonValueByPath(textJson, "position/y".split("/"), y1);
             jsonArray.add(textJson);
             x1 = x2;
@@ -279,14 +288,28 @@
         setlineXy(modelJson3, 0, y, x2, y, null);
         jsonArray.add(modelJson3);
 
-        double curPointHour = 10, periodHour = 50;
+        Integer curPointHour = 50, periodHour = 50;
         while (curPointHour < totalHours) {
             JSONObject modelJson4 = new JSONObject(templetsStrMap.get("model"));
             double x = curPointHour * pointNumPerHour;
-            setlineXy(modelJson4, x, y, x, y, null);
+            setlineXy(modelJson4, x, y, x, y2, null);
             jsonArray.add(modelJson4);
-            curPointHour += 10.0;
+
+            Map<String, Integer> mapSpace = GetStringSpace.getStringSpaceSize(curPointHour.toString(), null, 20);
+            JSONObject textJson = new JSONObject(templetsStrMap.get("text"));
+            JsonUtils2.setJsonValueByPath(textJson, "id".split("/"), UUIDUtil.generateId().toString());
+            JsonUtils2.setJsonValueByPath(textJson, "attrs/label/textWrap/text".split("/"), curPointHour.toString());
+
+            JsonUtils2.setJsonValueByPath(textJson, "size/width".split("/"), mapSpace.get("width") + 20);
+
+            double x11 = x - mapSpace.get("width") / 2 - 5;
+            JsonUtils2.setJsonValueByPath(textJson, "position/x".split("/"), x11);
+            JsonUtils2.setJsonValueByPath(textJson, "position/y".split("/"), y2);
+            jsonArray.add(textJson);
+
+            curPointHour += periodHour;
         }
+
 
         return jsonObject.toString();
     }
@@ -296,6 +319,7 @@
         JsonUtils2.setJsonValueByPath(lineJson, "source/y".split("/"), y1);
         JsonUtils2.setJsonValueByPath(lineJson, "target/x".split("/"), x2);
         JsonUtils2.setJsonValueByPath(lineJson, "target/y".split("/"), y2);
+        JsonUtils2.setJsonValueByPath(lineJson, "id".split("/"), UUIDUtil.generateId().toString());
         if (text != null) {
             JsonUtils2.setArrJsonValueByPath(lineJson, "labels".split("/"), null, "0", "attrs/text/text", "");
         }
@@ -681,16 +705,16 @@
             command += " -ip " + redisHost + " -port " + redisPort;
             command += " -taskType " + RELIA_SIM_TASK_TYPE_SIMULATION + " -taskId " + simulatAssess.getId().toString();
             logger.info("cmd鍛戒护涓猴細" + command);
-            if(System.getProperty("os.name").toLowerCase().indexOf("windows") > -1){
+            if (System.getProperty("os.name").toLowerCase().indexOf("windows") > -1) {
                 process = Runtime.getRuntime().exec(new String[]{"cmd", "/c", command});
-            }else if(System.getProperty("os.name").toLowerCase().indexOf("linux") > -1){
+            } else if (System.getProperty("os.name").toLowerCase().indexOf("linux") > -1) {
                 process = Runtime.getRuntime().exec(new String[]{"/bin/sh", "-c", command});
-            }else{
+            } else {
                 throw new Exception("鏆備笉鏀寔璇ユ搷浣滅郴缁燂紝杩涜鍚姩绠楁硶搴撹绠楋紒");
             }
             is = process.getInputStream();
             // 浠ュ懡浠よ鏂瑰紡璋冪敤绠楁硶搴撴椂锛屾帴鍙g害瀹氳繑鍥炵殑缁撴灉鏄痷tf-8缂栫爜
-            br = new BufferedReader(new InputStreamReader(is,"utf-8"));
+            br = new BufferedReader(new InputStreamReader(is, "utf-8"));
             String line = br.readLine();
             logger.info("绠楁硶搴撹繑鍥炵粨鏋滐細" + line);
 //            int exitCode = process.waitFor(); // 寮傛鏂瑰紡锛屼笉绛夊緟绠楁硶搴撹绠楀畬姣曪紝鎵�浠ヨ娉ㄩ噴鎺夎琛�
@@ -736,7 +760,7 @@
         // 浠跨湡娆℃暟
         jsonObject.put("simulate_times", simulatAssess.getSimulatFrequency());
         // 閲囨牱鍛ㄦ湡
-        jsonObject.put("timeslice", simulatAssess.getSamplPeriod()/60.0);   // 鍗曚綅缁熶竴鎹㈢畻涓哄皬鏃�
+        jsonObject.put("timeslice", simulatAssess.getSamplPeriod() / 60.0);   // 鍗曚綅缁熶竴鎹㈢畻涓哄皬鏃�
         jsonObject.put("result_home", resultHome);
         jsonObject.put("seed", 1000);
         redisTemplate.opsForValue().set(key, jsonObject.toJSONString());
@@ -877,7 +901,7 @@
     }
 
     private void addRepairModelsTag(List<RepairModel> repairModels,
-                                     Element root) {
+                                    Element root) {
         Element ele = null;
         Element repairModelsTag = root.addElement("repair_models");
         for (RepairModel repairModel : repairModels) {
@@ -902,7 +926,7 @@
     }
 
     private void calcTaskPhaseModelDuration(TaskPhase taskPhase,
-                                                            List<TaskPhaseModel> taskPhaseModelAll) {
+                                            List<TaskPhaseModel> taskPhaseModelAll) {
         List<TaskPhaseModel> taskPhaseModels = taskPhaseModelDao.getListByPhaseId(taskPhase.getId());
         double totalRate = taskPhaseModels.stream().mapToDouble(TaskPhaseModel::getOperatConditDurationRate).sum();
         double sum = 0.0;
@@ -913,8 +937,8 @@
             taskPhaseModelAll.add(taskPhaseModel);
         }
         // 鎶婇浂澶磋ˉ鍒版渶鍚庝竴涓伐鍐垫ā鍨�
-        double duration = taskPhaseModels.get(taskPhaseModels.size()-1).getOperatConditDuration();
-        taskPhaseModels.get(taskPhaseModels.size()-1).setOperatConditDuration(duration + taskPhase.getPhaseDuration() - sum);
+        double duration = taskPhaseModels.get(taskPhaseModels.size() - 1).getOperatConditDuration();
+        taskPhaseModels.get(taskPhaseModels.size() - 1).setOperatConditDuration(duration + taskPhase.getPhaseDuration() - sum);
     }
 
     private List<TaskPhase> calcTaskPhaseDuration(Task task) {
@@ -927,8 +951,8 @@
             sum += duration;
         }
         // 鎶婇浂澶磋ˉ鍒版渶鍚庝竴涓樁娈�
-        double duration = taskPhases.get(taskPhases.size()-1).getPhaseDuration();
-        taskPhases.get(taskPhases.size()-1).setPhaseDuration(duration + task.getTaskDuration() - sum);
+        double duration = taskPhases.get(taskPhases.size() - 1).getPhaseDuration();
+        taskPhases.get(taskPhases.size() - 1).setPhaseDuration(duration + task.getTaskDuration() - sum);
 
         return taskPhases;
     }
diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/utils/GetStringSpace.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/utils/GetStringSpace.java
new file mode 100644
index 0000000..47674dc
--- /dev/null
+++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/utils/GetStringSpace.java
@@ -0,0 +1,23 @@
+package com.zt.life.modules.mainPart.utils;
+
+import java.awt.*;
+import java.awt.font.FontRenderContext;
+import java.awt.geom.AffineTransform;
+import java.util.HashMap;
+import java.util.Map;
+
+public class GetStringSpace {
+    public static Map<String, Integer> getStringSpaceSize(String text, String fontFamily, int fontSize) {
+        fontFamily = fontFamily == null ? "" : fontFamily;
+        fontSize = fontSize == 0 ? 10 : fontSize;
+        AffineTransform affinetransform = new AffineTransform();
+        FontRenderContext frc = new FontRenderContext(affinetransform, true, true);
+        Font font = new Font(fontFamily, Font.PLAIN, fontSize);
+/*        int textwidth = (int)(font.getStringBounds(text, frc).getWidth());
+        int textheight = (int)(font.getStringBounds(text, frc).getHeight());*/
+        Map<String, Integer> result = new HashMap<>();
+        result.put("width", (int) font.getStringBounds(text, frc).getWidth());
+        result.put("height", (int) font.getStringBounds(text, frc).getHeight());
+        return result;
+    }
+}
diff --git a/modules/mainPart/src/main/resources/mapper/baseReliability/ParamDataBasicDao.xml b/modules/mainPart/src/main/resources/mapper/baseReliability/ParamDataBasicDao.xml
index 286fedf..d35bb9e 100644
--- a/modules/mainPart/src/main/resources/mapper/baseReliability/ParamDataBasicDao.xml
+++ b/modules/mainPart/src/main/resources/mapper/baseReliability/ParamDataBasicDao.xml
@@ -4,72 +4,78 @@
 <mapper namespace="com.zt.life.modules.mainPart.baseReliability.dao.ParamDataBasicDao">
     <update id="compute">
         update param_data f,
-        (
-        SELECT
-        c.*,
-        CASE
-        WHEN WeightedFailure IS NOT NULL
-        AND WeightedFailure > 0 THEN
-        1 / WeightedFailure ELSE 0
-        END AS basic_mtbf_regulate,
-        CASE
-        WHEN WeightedFailure IS NOT NULL
-        AND WeightedFailure > 0 THEN
-        WeightedMTTR / WeightedFailure ELSE 0
-        END AS repair_mttcr
-        FROM
-        (
-        SELECT
-        c.id,
-        c.name,
-        sum(
-        CASE
-        WHEN b.product_type &lt; 5 THEN
-        1 * 1 / basic_mtbf_regulate
-        WHEN a.reliab_distrib_type = 1 THEN
-        1 * a.basic_mtbf_operating_ratio / a.basic_mtbf_regulate
-        WHEN a.reliab_distrib_type = 2 THEN
-        1 * a.basic_mtbf_operating_ratio / a.basic_mtbf_regul_succ_rate
-        ELSE 0 END
-        ) AS WeightedFailure,
-        sum(
-        CASE
-        WHEN b.product_type &lt; 5 THEN
-        1 * 1 * a.repair_mttcr / a.basic_mtbf_regulate
-        WHEN a.repairable = 1 and a.reliab_distrib_type = 1 THEN
-        1 * a.basic_mtbf_operating_ratio * a.repair_mttcr / a.basic_mtbf_regulate
-        WHEN a.repairable = 1 and a.reliab_distrib_type = 2 THEN
-        1 * a.basic_mtbf_operating_ratio * a.repair_mttcr / a.basic_mtbf_regul_succ_rate
-        ELSE 0
-        END
-        ) AS WeightedMttr
-        FROM
-        param_data a,
-        product_model b,
-        product_model c
-        WHERE 1 = 1
-        and c.ship_id = ${shipId} and c.product_type = ${productType} and c.is_delete = 0
-        and b.ship_id = ${shipId} and b.pid = c.id and b.is_delete = 0
-        and a.IS_DELETE = 0 and a.product_id = b.id
-        AND ( (b.product_type = 5 AND a.basic_join_compute = 1
-        and ((
-        a.reliab_distrib_type = 1
-        AND a.basic_mtbf_regulate > 0
-        )
-        OR ( a.reliab_distrib_type = 2 AND a.basic_mtbf_regul_succ_rate > 0 ))
-        )
-        || (b.product_type &lt; 5 AND a.basic_mtbf_regulate > 0 ) )
-        GROUP BY c.id,c.name
-        ) c
-        )d set f.basic_mtbf_regulate = d.basic_mtbf_regulate,
-        f.repair_mttcr = d.repair_mttcr
+            (
+                SELECT c.*,
+                       CASE
+                           WHEN WeightedFailure IS NOT NULL
+                               AND WeightedFailure > 0 THEN
+                               1 / WeightedFailure
+                           ELSE 0
+                           END AS basic_mtbf_regulate,
+                       CASE
+                           WHEN WeightedFailure IS NOT NULL
+                               AND WeightedFailure > 0 THEN
+                               WeightedMTTR / WeightedFailure
+                           ELSE 0
+                           END AS repair_mttcr
+                FROM (
+                         SELECT c.id,
+                                c.name,
+                                sum(
+                                        CASE
+                                            WHEN b.product_type &lt; 5 THEN
+                                                1 * 1 / basic_mtbf_regulate
+                                            WHEN a.reliab_distrib_type = 1 THEN
+                                                1 * a.basic_mtbf_operating_ratio / a.basic_mtbf_regulate
+                                            WHEN a.reliab_distrib_type = 2 THEN
+                                                1 * a.basic_mtbf_operating_ratio / a.basic_mtbf_regul_succ_rate
+                                            ELSE 0 END
+                                    ) AS WeightedFailure,
+                                sum(
+                                        CASE
+                                            WHEN b.product_type &lt; 5 THEN
+                                                1 * 1 * a.repair_mttcr / a.basic_mtbf_regulate
+                                            WHEN a.repairable = 1 and a.reliab_distrib_type = 1 THEN
+                                                    1 * a.basic_mtbf_operating_ratio * a.repair_mttcr /
+                                                    a.basic_mtbf_regulate
+                                            WHEN a.repairable = 1 and a.reliab_distrib_type = 2 THEN
+                                                    1 * a.basic_mtbf_operating_ratio * a.repair_mttcr /
+                                                    a.basic_mtbf_regul_succ_rate
+                                            ELSE 0
+                                            END
+                                    ) AS WeightedMttr
+                         FROM param_data a,
+                              product_model b,
+                              product_model c
+                         WHERE 1 = 1
+                           and c.ship_id = ${shipId}
+                           and c.product_type = ${productType}
+                           and c.is_delete = 0
+                           and b.ship_id = ${shipId}
+                           and b.pid = c.id
+                           and b.is_delete = 0
+                           and a.IS_DELETE = 0
+                           and a.product_id = b.id
+                           AND ((b.product_type = 5 AND a.basic_join_compute = 1
+                             and ((
+                                          a.reliab_distrib_type = 1
+                                          AND a.basic_mtbf_regulate > 0
+                                      )
+                                 OR (a.reliab_distrib_type = 2 AND a.basic_mtbf_regul_succ_rate > 0))
+                                    )
+                             || (b.product_type &lt; 5 AND a.basic_mtbf_regulate > 0))
+                         GROUP BY c.id, c.name
+                     ) c
+            ) d
+        set f.basic_mtbf_regulate = d.basic_mtbf_regulate,
+            f.repair_mttcr        = d.repair_mttcr
         where f.product_id = d.id;
     </update>
 
     <update id="compute2">
         UPDATE param_data a, product_model b
         SET ai = basic_mtbf_regulate / (basic_mtbf_regulate + repair_mttcr)
-        where  b.ship_id = ${shipId}
+        where b.ship_id = ${shipId}
     </update>
 
     <select id="getAI" resultType="com.zt.life.modules.mainPart.basicInfo.model.ParamData">
@@ -83,8 +89,9 @@
         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.ship_id = ${shipId}
-           or a.id =${shipId}
+            and a.product_type &lt;&gt; 10
+            and a.ship_id = ${shipId}
+           or a.id = ${shipId}
         ORDER BY a.product_type, a.sort
     </select>
 
diff --git a/web/src/views/modules/basicInfo/XhProductModel-AddOrUpdate.vue b/web/src/views/modules/basicInfo/XhProductModel-AddOrUpdate.vue
index ecf5a7b..976797f 100644
--- a/web/src/views/modules/basicInfo/XhProductModel-AddOrUpdate.vue
+++ b/web/src/views/modules/basicInfo/XhProductModel-AddOrUpdate.vue
@@ -130,7 +130,6 @@
           await this.$tip.success()
           this.$refs.dialog.close()
           this.$emit('refreshDataList')
-          this.map.clear()
         }
       }
     }
diff --git a/web/src/views/modules/taskReliability/ModelView.vue b/web/src/views/modules/taskReliability/ModelView.vue
index 9307dba..08fab2a 100644
--- a/web/src/views/modules/taskReliability/ModelView.vue
+++ b/web/src/views/modules/taskReliability/ModelView.vue
@@ -20,7 +20,7 @@
   import {getUUID} from '../../../../packages/utils'
 
   export default {
-    name: 'RBD-edit-img',
+    name: 'model-view',
     props: {
       projectId: {
         type: String
diff --git a/web/src/views/modules/taskReliability/Task.vue b/web/src/views/modules/taskReliability/Task.vue
index 05c34d9..ad62c12 100644
--- a/web/src/views/modules/taskReliability/Task.vue
+++ b/web/src/views/modules/taskReliability/Task.vue
@@ -97,11 +97,13 @@
         let res = await this.$http.get('/basicInfo/XhProductModel/getTaskProductList')
         this.productList = res.data
         console.log(this.productList, ' async getTaskProductList()')
+        this.onProductSelected(this.productList[0])
       },
       onProductSelected(data) {
         console.log(data, ' onProductSelected(data)')
         this.dataForm.productId = data.id
         this.$refs.tableObj.query()
+        this.selectTask(data)
       },
       tableRowClassName(
         {
diff --git a/web/src/views/modules/taskReliability/TaskPhase-AddOrUpdate.vue b/web/src/views/modules/taskReliability/TaskPhase-AddOrUpdate.vue
index ddcdc72..243e337 100644
--- a/web/src/views/modules/taskReliability/TaskPhase-AddOrUpdate.vue
+++ b/web/src/views/modules/taskReliability/TaskPhase-AddOrUpdate.vue
@@ -62,14 +62,6 @@
       },
       // 琛ㄥ崟鎻愪氦
       async formSubmit() {
-      /*  let flag = true
-        if (this.time + Number(this.dataForm.phaseDurationRate)-Number(this.oldTime) > 1) {
-          this.$alert("璇烽噸鏂拌缃綋鍓嶆椂闀挎瘮鍒嗛厤")
-          flag = false
-        }
-        if (!flag) {
-          return
-        }*/
         let res = await this.$http[!this.dataForm.id ? 'post' : 'put']('/taskReliability/TaskPhase/', this.dataForm)
         if (res.success) {
           await this.$tip.success()
diff --git a/web/src/views/modules/taskReliability/TaskPhaseModel.vue b/web/src/views/modules/taskReliability/TaskPhaseModel.vue
index 19dfd04..19f0b72 100644
--- a/web/src/views/modules/taskReliability/TaskPhaseModel.vue
+++ b/web/src/views/modules/taskReliability/TaskPhaseModel.vue
@@ -146,15 +146,6 @@
           this.isChange = true
           return
         }
-          /* for (let i = 0; i < this.$refs.tableObj.dataList.length; i++) {
-             if (this.$refs.tableObj.dataList[i] != this.lastSaveData[i]) {
-               console.log(i,'no')
-               console.log(this.$refs.tableObj.dataList[i],'this.$refs.tableObj.dataList[i]')
-               console.log(this.lastSaveData[i],'this.lastSaveData[i]')
-               this.isChange = true
-               return
-             }
-           }*/
           this.isChange = false
       },
 
diff --git a/web/src/views/modules/taskReliability/TaskRepairParam.vue b/web/src/views/modules/taskReliability/TaskRepairParam.vue
index 7211107..f2ceb19 100644
--- a/web/src/views/modules/taskReliability/TaskRepairParam.vue
+++ b/web/src/views/modules/taskReliability/TaskRepairParam.vue
@@ -9,7 +9,6 @@
                 height="600px"
                 border @selection-change="table.selectionChangeHandle"
                 :header-cell-style="{'text-align':'center'}">
-        <!--        <el-table-column type="selection" width="40"/>-->
         <el-table-column prop="phaseName" label="闃舵" align="left"/>
         <el-table-column prop="equipType" label="璁惧绫诲瀷" align="center"/>
         <el-table-column prop="status" label="寮哄埗涓嶅彲淇�" width="160" align="center">
diff --git a/web/src/views/modules/taskReliability/TimeDiagram.vue b/web/src/views/modules/taskReliability/TimeDiagram.vue
index 5275e55..c127388 100644
--- a/web/src/views/modules/taskReliability/TimeDiagram.vue
+++ b/web/src/views/modules/taskReliability/TimeDiagram.vue
@@ -33,7 +33,7 @@
           </el-col>
           <el-col :span="20">
             <div style="margin-top: 20px">
-              <div id="container" style="border: 1px solid #EAEBEE;border-radius: 6px;
+              <div id="timeDiagram" style="border: 1px solid #EAEBEE;border-radius: 6px;
         box-shadow: 0 2px 12px 0 rgb(0 0 0 / 10%);">
               </div>
             </div>
@@ -42,7 +42,7 @@
       </div>
     </el-row>
     <el-dialog v-dialogDrag title="妯″瀷璁捐" top="1vh" width='95%' :visible.sync="dialogVisible2" v-if="dialogVisible2">
-      <RBDEditImg ref="rbdEditImg"></RBDEditImg>
+      <model-view ref="modelView"></model-view>
     </el-dialog>
   </div>
 </template>
@@ -51,12 +51,13 @@
   import SimulatCurve from "./SimulatCurve";
   import ProductModelTree from "../basicInfo/ProductModelTree";
   import {Graph, Shape, Addon, Cell} from '@antv/x6'
-  import RBDEditImg from './RBD-edit-img'
+  import ModelView from "./ModelView";
 
 
   export default {
     data() {
       return {
+        knob:HTMLDivElement,
         dialogVisible2: false,
         timers: '',
         shape: '',
@@ -118,9 +119,9 @@
     },
     mounted() {
       this.getProductList()
-
     },
     components: {
+      ModelView,
       ProductModelTree,
       SimulatCurve,
     },
@@ -129,7 +130,7 @@
         console.log(document.documentElement.clientWidth, 'document.documentElement.clientWidth')
         console.log(document.documentElement.clientHeight, 'document.documentElement.clientHeight')
         this.graph = new Graph({
-          container: document.getElementById('container'),
+          container: document.getElementById('timeDiagram'),
           width: document.documentElement.clientWidth,
           height: document.documentElement.clientHeight - 220,
           // async: true,
@@ -151,18 +152,7 @@
               })
             }
           },
-          onToolItemCreated({tool}) {
-            const handle = tool
-            const options = handle.options
-            if (options && options.index % 2 === 1) {
-              tool.setAttrs({fill: 'red'})
-            }
-          },
           autoResize: true,
-          history: true,
-          // panning: {
-          //   enabled: true,
-          // },
           scroller: {
             enabled: true,
             pageVisible: true,
@@ -176,100 +166,35 @@
             minScale: 0.1,
             maxScale: 10,
           },
-          connecting: {
-            router: {
-              name: 'normal',
-              // args: {
-              //   padding: 1,
-              // },
-            },
-            connector: {
-              name: 'rounded',
-              args: {
-                radius: 8,
+          createEdge() {
+            return new Shape.Edge({
+              data: {
+                id: '',
+                status: '',
+                startTime:'',
+                endTime: '',
               },
-            },
-            // anchor: 'center',
-            connectionPoint: 'anchor',
-            snap: {
-              radius: 20,
-            },
-            createEdge() {
-              return new Shape.Edge({
-                attrs: {
-                  line: {
-                    stroke: '#A2B1C3',
-                    strokeWidth: 2,
-                    targetMarker: 'classic'
-                  }
-                },
-                tools: {
-                  name: 'vertices',
-                },
-                labels: [{
-                  attrs: {
-                    body: {
-                      stroke: '#5F95FF',
-                    },
-                    text: {
-                      // fontFamily: '浠垮畫',
-                      text: ''
-                    }
-                  },
-                }],
-                zIndex: 0,
-              })
-            },
-            // validateConnection({targetMagnet}) {
-            //   return !!targetMagnet
-            // },
-          },
-          highlighting: {
-            magnetAdsorbed: {
-              name: 'stroke',
-              args: {
-                attrs: {
-                  fill: '#5F95FF',
-                  stroke: '#5F95FF',
-                },
+              attrs: {
+                line: {
+                  stroke: '#A2B1C3',
+                  strokeWidth: 2,
+                  sourceMarker: 'none',
+                  targetMarker: 'none'
+                }
               },
-            },
+              tools: {
+                name: 'vertices',
+              },
+              zIndex: 0,
+            })
           },
-          resizing: {
-            enabled: true,
-            restricted: true
-          },
-          rotating: true,
-          selecting: {
-            enabled: true,
-            rubberband: true,
-            rubberEdge: true,
-            showNodeSelectionBox: true,
-          },
-          snapline: true,
           keyboard: true,
-          clipboard: true,
         })
+        this.knob = document.createElement('div',false)
+        this.knob.style.position = 'absolute'
+        document.getElementById('timeDiagram').appendChild(this.knob)
         this.graph.centerContent()
-        const stencil = new Addon.Stencil({
-          title: '',
-          target: this.graph,
-          stencilGraphWidth: 260,
-          stencilGraphHeight: 700,
-          collapsable: false,
-          groups: [
-            {
-              title: '鍥惧厓',
-              name: 'group1',
-              collapsable: false
-            }
-          ],
-          layoutOptions: {
-            columns: 2,
-            columnWidth: 130,
-            rowHeight: 100,
-          },
-        })
+
         Graph.registerNode(
           'custom-rect',
           {
@@ -467,162 +392,6 @@
           },
           true,
         )
-        // 涓�绾х綉缁滃浘鐨勬棩鏈熸枃瀛楄妭鐐�
-        const r5 = this.graph.createNode({
-          shape: 'custom-circle',
-          data: {
-            dataId: '',
-            finishDate: '',
-            inspectName: ''
-          },
-          label: '闃舵',
-        })
-        // 浜岀骇缃戠粶鍥炬棩鏈熻妭鐐�
-        const r6 = this.graph.createNode({
-          shape: 'custom-circle1',
-          data: {
-            dataId: '',
-            finishDate: '',
-            inspectName: ''
-          },
-        })
-        // 浜岀骇缃戠粶鍥炬枃瀛楄妭鐐�
-        const r9 = this.graph.createNode({
-          shape: 'custom-rect'
-        })
-
-        const scaleImgCenter = this.graph.createNode({
-          shape: 'image',
-          imageUrl: require('@/assets/img/scale/center.jpg'),
-          width: 36,
-          height: 20,
-          data: {
-            imagePost: 'center'
-          }
-        })
-
-        const scaleImgTop = this.graph.createNode({
-          shape: 'image',
-          imageUrl: require('@/assets/img/scale/top.jpg'),
-          width: 36,
-          height: 20,
-          data: {
-            imagePost: 'top'
-          }
-        })
-
-        const scaleImgRight = this.graph.createNode({
-          shape: 'image',
-          imageUrl: require('@/assets/img/scale/right.jpg'),
-          width: 36,
-          height: 20,
-          data: {
-            imagePost: 'right'
-          }
-        })
-        const scaleImgBottom = this.graph.createNode({
-          shape: 'image',
-          imageUrl: require('@/assets/img/scale/bottom.jpg'),
-          width: 36,
-          height: 20,
-          data: {
-            imagePost: 'bottom'
-          }
-        })
-        const scaleImgLeft = this.graph.createNode({
-          shape: 'image',
-          imageUrl: require('@/assets/img/scale/left.jpg'),
-          width: 36,
-          height: 20,
-          data: {
-            imagePost: 'left'
-          }
-        })
-
-        // scaleImgTop.setAttribute('crossOrigin', 'Anonymous')
-        stencil.load([r5, r6, r9, scaleImgTop, scaleImgCenter, scaleImgRight, scaleImgBottom, scaleImgLeft], 'group1')
-        this.graph.bindKey(['meta+c', 'ctrl+c'], () => {
-          const cells = this.graph.getSelectedCells()
-          if (cells.length) {
-            this.graph.copy(cells)
-          }
-          return false
-        })
-
-        this.graph.bindKey(['meta+x', 'ctrl+x'], () => {
-          const cells = this.graph.getSelectedCells()
-          if (cells.length) {
-            this.graph.cut(cells)
-          }
-          return false
-        })
-        // 鐩戝惉 stencil 鐨勬嫋鎷藉紑濮嬩簨浠�
-        this.graph.on('node:embed', ({node, e}) => {
-          // 闃绘浜嬩欢鍐掓场
-          e.stopPropagation()
-          console.log(node.shape, 'node node')
-          let parent
-          let child
-          if (node.shape === 'custom-rect') {
-            child = node
-          } else {
-            parent = node
-          }
-          console.log('parent:' + parent, 'child:' + child)
-          // parent.addChild(child);
-        })
-        this.graph.bindKey(['meta+v', 'ctrl+v'], () => {
-          if (!this.graph.isClipboardEmpty()) {
-            const cells = this.graph.paste({offset: 32})
-            this.graph.cleanSelection()
-            this.graph.select(cells)
-          }
-          return false
-        })
-//undo redo
-        this.graph.bindKey(['meta+z', 'ctrl+z'], () => {
-          if (this.graph.history.canUndo()) {
-            this.graph.history.undo()
-          }
-          return false
-        })
-
-        this.graph.bindKey(['meta+shift+z', 'ctrl+shift+z'], () => {
-          if (this.graph.history.canRedo()) {
-            this.graph.history.redo()
-          }
-          return false
-        })
-
-// select all
-        this.graph.bindKey(['meta+a', 'ctrl+a'], () => {
-          const nodes = this.graph.getNodes()
-          if (nodes) {
-            this.graph.select(nodes)
-          }
-        })
-//delete
-        this.graph.bindKey('delete', () => {
-          const cells = this.graph.getSelectedCells()
-          if (cells.length) {
-            this.$confirm('鏄惁鍒犻櫎璇ヨ妭鐐�?', '鎻愮ず', {
-              confirmButtonText: '纭畾',
-              cancelButtonText: '鍙栨秷',
-              type: 'warning'
-            }).then(() => {
-              this.$message({
-                type: 'success',
-                message: '鍒犻櫎鎴愬姛!'
-              })
-              this.graph.removeCells(cells)
-            }).catch(() => {
-              this.$message({
-                type: 'info',
-                message: '宸插彇娑堝垹闄�'
-              })
-            })
-          }
-        })
 // zoom
         this.graph.bindKey(['ctrl+1', 'meta+1'], () => {
           const zoom = this.graph.zoom()
@@ -669,19 +438,16 @@
         // 鍗曞嚮node鑺傜偣
         this.graph.on('node:click', ({node}) => {
           // this.reset()
-          node.attr('line/stroke', '#5F95FF')
-          node.prop('labels/0', {
-            attrs: {
-              body: {
-                stroke: '#5F95FF',
-              },
-            },
-          })
-        })
-        // 鎺у埗杩炴帴妗╂樉绀�/闅愯棌
-        this.graph.on('node:delete', ({view, e}) => {
-          e.stopPropagation()
-          view.cell.remove()
+          if (node.getData().dataId) {
+            this.dialogVisible2 = true
+            let param = {
+              id: node.getData().dataId,
+              modelName: node.attr('label/textWrap/text'),
+            }
+            this.$nextTick(() => {
+              this.$refs.modelView.init(param)
+            })
+          }
         })
 
         this.graph.on('node:customevent', ({name, view, e}) => {
@@ -690,72 +456,42 @@
             view.cell.remove()
           }
         })
-        // 鍙屽嚮缂栬緫
-        this.graph.on('cell:dblclick', ({cell, e}) => {
-          const isNode = cell.isNode()
-          const name = cell.isNode() ? 'node-editor' : 'edge-editor'
-          cell.removeTool(name)
-          cell.addTools({
-            name,
-            args: {
-              event: e,
-              attrs: {
-                backgroundColor: isNode ? '#EFF4FF' : '#FFF',
-                text: {
-                  fontSize: 16,
-                  fill: '#262626',
-                },
-              },
-            },
-          })
-        })
 
-        this.graph.on('node:mouseenter', ({node}) => {
-          const container = document.getElementById('container')
-          const ports = container.querySelectorAll(
-            '.x6-port-body',
-          )
-          this.showPorts(ports, true)
+        // 榧犳爣绉诲叆edge鑺傜偣
+        this.graph.on('edge:mouseenter', ({edge,e}) => {
+          const style = this.knob.style
+          // e.stopPropagation()
+          console.log('edge:mouseenter')
+          if (e && edge.data) {
+            if (edge.getData().status==='F') {
+              //console.log(edge.getData(),"eee edge.getData()")
+              let startTimes = edge.getData().startTimes
+              let endTimes = edge.getData().endTimes
+              //console.log(e,'eee')
+              const p = this.graph.clientToGraph(e.clientX, e.clientY)
+              setTimeout(()=>{
+                style.display = 'block'
+                style.left = `${p.x}px`
+                style.top = `${p.y}px`
+                style.width = 200+ 'px'
+                style.height = 80 + 'px'
+                style.textAlign = 'center'
+                style.background = '#000'
+                style.color = '#fff'
+                style.lineHeight = (40 + 'px')
+                style.zIndex = 100
+                this.knob.innerText = `寮�濮嬫椂闂达細${startTimes}\n缁撴潫鏃堕棿锛�${endTimes}`
+              },0)
+              console.log(p,'p p p')
+              console.log(style,this.knob,'style style')
+            }
+          }
         })
-
-        this.graph.on('node:mouseleave', ({node}) => {
-          // if (node.hasTool('button-remove')) {
-          //   node.removeTool('button-remove')
-          // }
-          const container = document.getElementById('container')
-          const ports = container.querySelectorAll(
-            '.x6-port-body',
-          )
-          this.showPorts(ports, false)
-        })
-
-        this.graph.on('edge:mouseenter', ({cell, view}) => {
-          // alert(123)
-          cell.addTools([
-            {
-              name: 'source-arrowhead',
-            },
-            {
-              name: 'target-arrowhead',
-              args: {
-                attrs: {
-                  fill: 'red',
-                },
-              },
-            },
-          ])
-          cell.addTools(
-            [
-              {
-                name: 'segments',
-                args: {snapRadius: 20, attrs: {fill: '#444'}}
-              }
-            ]
-          )
-        })
-
-        this.graph.on('edge:mouseleave', ({cell}) => {
-          cell.removeTools()
+// 榧犳爣绉诲嚭edge鑺傜偣
+        this.graph.on('edge:mouseleave', ({edge}) => {
+          console.log('edge:mouseleave')
+          const style = this.knob.style
+          style.display = 'none'
         })
       },
       async getProductList() {
@@ -780,8 +516,7 @@
         this.simulatList = res.data
       },
       async onTreeSelected(data) {
-        this.dataForm.productId = data.id
-        console.log(this.dataForm.productId)
+        this.graph.unfreeze()
         if (!this.dataForm.taskModelId) {
           this.$alert("璇峰厛閫夋嫨鍏蜂綋浠诲姟")
           return
@@ -791,11 +526,24 @@
           return
         }
         let params = {
-          productId: this.dataForm.productId,
+          productId: data.id,
           taskId: this.dataForm.taskModelId,
           fzId: this.dataForm.id
         }
         let res = await this.$http.get('/taskReliability/SimulatAssess/getStatus', {params: params})
+        if (res.data !== null) {
+          this.diagramJson = JSON.parse(res.data)
+          console.log(this.diagramJson, 'this.Diagram json')
+          this.graph.fromJSON(this.diagramJson)
+          this.graph.centerContent()
+          this.graph.zoomToFit()
+          this.graph.freeze()
+        } else {
+          this.graph.fromJSON(this.emptyJson)
+          this.graph.centerContent()
+          this.graph.zoomToFit()
+          this.graph.freeze()
+        }
         console.log(res.data)
       },
       // 鑾峰彇淇℃伅
@@ -808,6 +556,7 @@
         this.$nextTick(() => {
           this.$refs.ProductModelTree.getProductList()
         })
+        this.init()
       },
       onTaskSelected(data) {
         console.log(data, ' onProductSelected(data)')
@@ -827,7 +576,7 @@
         this.dataForm.simulatFrequency = result.data.simulatFrequency
       },
       async getDiagram() {
-        this.init()
+        this.graph.unfreeze()
         let params = {
           productId: this.dataForm.productId,
           taskId: this.dataForm.taskModelId,
@@ -836,7 +585,6 @@
         let res = await this.$http.get('/taskReliability/SimulatAssess/getStatus', {params: params})
         if (res.data !== null) {
           this.diagramJson = JSON.parse(res.data)
-          // console.log(this.dataForm.content,'this.Diagram content')
           console.log(this.diagramJson, 'this.Diagram json')
           this.graph.fromJSON(this.diagramJson)
           this.graph.centerContent()
@@ -854,5 +602,25 @@
   }
 </script>
 <style>
+  #timeDiagram {
+    display: flex;
+    border: 1px solid #dfe3e8;
+    width: 100% !important;
+  }
+  #timeDiagram .x6-cell.x6-node {
+    cursor: inherit;
+  }
+  .x6-graph-scroller.x6-graph-scroller-pannable {
+    width: 100% !important;
+  }
 
+  .x6-widget-stencil {
+    position: relative;
+    height: 100%;
+  }
+
+  .x6-widget-stencil-content {
+    position: relative;
+    height: 100%;
+  }
 </style>

--
Gitblit v1.9.1