From e48a56c2171f023f1978b0b6aec9befd43e7a9dc Mon Sep 17 00:00:00 2001 From: xyc <jc_xiong@hotmail.com> Date: 星期一, 04 十一月 2024 08:45:22 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/dao/ReliabilityAssessDao.java | 2 web/src/views/modules/taskReliability/ConfigNode/tempNode.vue | 114 ++---- web/src/views/modules/taskReliability/SimulatHistory.vue | 4 web/src/views/modules/taskReliability/ReliabilityAssess.vue | 28 + web/src/views/modules/taskReliability/TimeDiagramTemp.vue | 128 ++++--- web/src/views/modules/taskReliability/TimeDiagram.vue | 241 +------------- modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/model/ModelRbd.java | 3 web/src/views/modules/taskReliability/SchemeCompar.vue | 4 modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/SimulatAssessService.java | 84 +++++ modules/mainPart/src/main/resources/mapper/taskReliability/ReliabilityAssessDao.xml | 9 web/src/views/modules/taskReliability/RBD-edit-img.vue | 80 ++-- modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/ReliabilityAssessService.java | 62 ++- web/src/views/modules/taskReliability/ConfigEdge/configEdge.vue | 73 +-- modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/controller/SimulatAssessController.java | 7 modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/controller/XhProductModelController.java | 7 web/src/views/modules/taskReliability/SimulatAssess.vue | 69 +++- modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/controller/ReliabilityAssessController.java | 7 17 files changed, 457 insertions(+), 465 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 f515f52..7f07865 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 @@ -105,7 +105,14 @@ @GetMapping("getProductList") public Result<List<XhProductModel>> getProductList(Long shipId, Integer productType) { + if(productType==2){ + shipId =null; + } List<XhProductModel> list = xhProductModelService.getProductList(shipId, productType - 1); + if(productType == 5){ + List<XhProductModel> list2 = xhProductModelService.getProductList(shipId, productType - 2); + list.addAll(list2); + } return Result.ok(list); } diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/controller/ReliabilityAssessController.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/controller/ReliabilityAssessController.java index d37f069..85be829 100644 --- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/controller/ReliabilityAssessController.java +++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/controller/ReliabilityAssessController.java @@ -30,6 +30,8 @@ import org.springframework.web.multipart.MultipartFile; import springfox.documentation.annotations.ApiIgnore; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import java.util.List; import java.util.Map; @@ -64,6 +66,11 @@ return result; } + @GetMapping("downloadXml") + public void downloadXml(HttpServletRequest request, HttpServletResponse response, Long productId, Long taskId, Long itemId,Integer xml) { + reliabilityAssessService.downloadXml(request,response,productId,taskId,itemId,xml); + } + @PostMapping("add") @ApiOperation("鏂板") @LogOperation("鏂板") 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 f0cc214..5486365 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 @@ -36,6 +36,8 @@ import org.springframework.web.bind.annotation.*; import springfox.documentation.annotations.ApiIgnore; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import java.io.File; import java.io.FileInputStream; import java.io.IOException; @@ -269,6 +271,11 @@ return Result.ok(); } + @GetMapping("downloadXml") + public void downloadXml(HttpServletRequest request, HttpServletResponse response, String type,Long id,Integer xml) { + simulatAssessService.downloadXml(request, response,type,id,xml); + } + @PutMapping @ApiOperation("淇敼") @LogOperation("淇敼") diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/dao/ReliabilityAssessDao.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/dao/ReliabilityAssessDao.java index 4d60009..278a700 100644 --- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/dao/ReliabilityAssessDao.java +++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/dao/ReliabilityAssessDao.java @@ -25,4 +25,6 @@ List<ReliabilityAssess> getProductList(Long productId, Long itemId); Long getAssessId(Long itemId, Long productId, Long taskId); + + String getxml(Long assessId); } diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/model/ModelRbd.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/model/ModelRbd.java index f5a3b36..04d1228 100644 --- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/model/ModelRbd.java +++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/model/ModelRbd.java @@ -34,6 +34,9 @@ @ApiModelProperty(value = "") private Long productId; + @ApiModelProperty(value = "鏄惁鑷姩鎺掔増") + private Integer autoLayout; + @TableField(exist = false) @ApiModelProperty(value = "") private Long[] nodeArr; diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/ReliabilityAssessService.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/ReliabilityAssessService.java index b93cfba..2212a70 100644 --- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/ReliabilityAssessService.java +++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/ReliabilityAssessService.java @@ -38,6 +38,8 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import java.io.*; import java.util.*; import java.util.stream.Collectors; @@ -157,9 +159,9 @@ String nameValue = jsonArray.getJSONObject(i).get("name").toString(); if (nameValue.contains(assess.getId().toString())) { // 鑾峰彇瀵瑰簲鐨勫�� - if (jsonArray.getJSONObject(i).get("value") instanceof Double){ - result1 = (Double) jsonArray.getJSONObject(i).get("value"); - }else{ + if (jsonArray.getJSONObject(i).get("value") instanceof Double) { + result1 = (Double) jsonArray.getJSONObject(i).get("value"); + } else { String[] values = jsonArray.getJSONObject(i).get("value").toString().split(","); result1 = Double.valueOf(values[1]); } @@ -377,16 +379,16 @@ String ToEStr = ""; String FStr = ""; // for (ModelNode node : nodeList) { - List<ReliabilityAssess> assessDatas = assessDataList.stream().filter(item -> - dataId.equals(item.getId())).collect(Collectors.toList()); - NoEStr += ","; - ToEStr += ","; - FStr += ","; - if (assessDatas.size() > 0) { - NoEStr += assessDatas.get(0).getRunNum() != null ? assessDatas.get(0).getRunNum().toString() : "0"; - ToEStr += assessDatas.get(0).getRunTimes() != null ? assessDatas.get(0).getRunTimes().toString() : "0"; - FStr += assessDatas.get(0).getFailNum() != null ? assessDatas.get(0).getFailNum().toString() : "0"; - } + List<ReliabilityAssess> assessDatas = assessDataList.stream().filter(item -> + dataId.equals(item.getId())).collect(Collectors.toList()); + NoEStr += ","; + ToEStr += ","; + FStr += ","; + if (assessDatas.size() > 0) { + NoEStr += assessDatas.get(0).getRunNum() != null ? assessDatas.get(0).getRunNum().toString() : "0"; + ToEStr += assessDatas.get(0).getRunTimes() != null ? assessDatas.get(0).getRunTimes().toString() : "0"; + FStr += assessDatas.get(0).getFailNum() != null ? assessDatas.get(0).getFailNum().toString() : "0"; + } // } NoEStr = NoEStr.substring(1); ToEStr = ToEStr.substring(1); @@ -397,7 +399,7 @@ vCounter.put("v", counter); Element sameNameGroupTag = parent.addElement("logic"); sameNameGroupTag.addAttribute("name", - "v"+counter); + "v" + counter); if ("parallel".equals(sameNameGroupAlgorithmType)) { sameNameGroupTag.addAttribute("type", "parallel"); } else { @@ -406,7 +408,7 @@ sameNameGroupTag.addAttribute("nums", String.valueOf(nodeList.size())); Element nodeTag = sameNameGroupTag.addElement("node"); nodeTag.addAttribute("name", - nodeList.stream().map(item -> item.getDataId().toString()+"-"+item.getDeviceNo().toString()). + nodeList.stream().map(item -> item.getDataId().toString() + "-" + item.getDeviceNo().toString()). collect(Collectors.joining(","))); nodeTag.addAttribute("real_name", product.getSameSbName()); nodeTag.addAttribute("name_path", product.getNamePath()); @@ -690,7 +692,7 @@ FStr = FStr.substring(1); nodeTag.addAttribute("name", - nodes.stream().map(item -> item.getDataId().toString()+"-"+item.getDeviceNo().toString()). + nodes.stream().map(item -> item.getDataId().toString() + "-" + item.getDeviceNo().toString()). collect(Collectors.joining(","))); if (distTypes.get(0) == 3) { // 浜岄」鍒嗗竷 @@ -746,7 +748,7 @@ ReliaSimLibResult rtn = com.alibaba.fastjson.JSONObject.parseObject(line, ReliaSimLibResult.class); if ("0".equals(rtn.getCode())) { logger.info("鍚姩鍙潬鎬ц瘎瀹氱畻娉曞簱鎴愬姛銆�"); - if (exitCode ==0) { + if (exitCode == 0) { deleteAssessInfoInRedis(assessResult.getId()); result = Result.ok(); } else { @@ -936,4 +938,30 @@ return baseDao.getAssessDataList(productId); } + public void downloadXml(HttpServletRequest request, HttpServletResponse response, Long productId, Long taskId, Long itemId, Integer xml) { + Long assessId = baseDao.getAssessId(itemId, productId, taskId); + String json=""; + if (xml == 1) { + json = baseDao.getxml(assessId); + } else { + String filePath = path + "/" + assessId + "/" + "result.xml"; + InputStream in = null; + File file = new File(filePath); + if (file.exists()) { + try { + in = new FileInputStream(filePath); + json = IOUtils.toString(in); + } catch (IOException e) { + throw new RenException("鏂囦欢涓嶅瓨鍦ㄦ垨鑰呮枃浠舵墦涓嶅紑"); + } finally { + try { + in.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } + simulatAssessService.writeToTxt(request, response, json, "璇勫畾"); + } } 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 ae1baa0..93e99b1 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 @@ -11,6 +11,7 @@ import com.zt.common.servlet.Result; import com.zt.common.utils.TreeUtils; import com.zt.common.utils.UUIDUtil; +import com.zt.life.export.service.DownloadService; import com.zt.life.modules.mainPart.basicInfo.dao.ParamDataDao; import com.zt.life.modules.mainPart.basicInfo.dao.XhProductModelDao; import com.zt.life.modules.mainPart.basicInfo.model.ParamData; @@ -46,6 +47,9 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import java.io.*; import java.nio.file.FileAlreadyExistsException; import java.util.*; @@ -1607,4 +1611,84 @@ dto.setCurveList(curveList); return dto; } + + public void downloadXml(HttpServletRequest request, HttpServletResponse response, String type, Long id, Integer xml) { + if (type.equals("fz")) { + if (xml == 1) { + SimulatAssess simulatAssess = this.get(id); + String xml1 = simulatAssess.getXml(); + writeToTxt(request, response, xml1, "浠跨湡杈撳叆"); + } else { + String filePath = path + "/" + id + "/" + "result.xml"; + String xml1; + InputStream in = null; + + try { + in = new FileInputStream(filePath); + xml1 = IOUtils.toString(in); + } catch (IOException e) { + e.printStackTrace(); + throw new RenException("鏂囦欢涓嶅瓨鍦ㄦ垨鑰呮枃浠舵墦涓嶅紑"); + } finally { + try { + if (in != null) { + in.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + writeToTxt(request, response, xml1, "浠跨湡杈撳嚭"); + } + } else if (type.equals("sxt")) { + if (xml == 1) { + String filePath = path + "/" + id + "/" + "status.json"; + ObjectMapper mapper = new ObjectMapper(); + String jsonStr = null; + try { + // 浣跨敤 ObjectMapper 鐨� readValue 鏂规硶锛屽皢鏂囦欢涓殑 JSON 鏁版嵁杞崲涓轰竴涓� Java 瀵硅薄 + // 杩欓噷浣跨敤 Object 绫讳綔涓烘硾鍨嬪弬鏁帮紝琛ㄧず浠绘剰绫诲瀷鐨勫璞� + Object obj = mapper.readValue(new File(filePath), Object.class); + // 浣跨敤 ObjectMapper 鐨� writeValueAsString 鏂规硶锛屽皢 Java 瀵硅薄杞崲涓� JSON 瀛楃涓� + jsonStr = mapper.writeValueAsString(obj); + + } catch (IOException e) { + // 澶勭悊寮傚父 + e.printStackTrace(); + throw new RenException("鏂囦欢涓嶅瓨鍦ㄦ垨鑰呮枃浠舵墦涓嶅紑"); + } + writeToTxt(request, response, jsonStr, "鏃跺簭鍥捐緭鍏�"); + } else { + SimulatAssess simulatAssess = this.get(id); + TimeDiagramDto timeDiagram = getTimeDiagram(simulatAssess.getProductId(), simulatAssess.getTaskModelId(), simulatAssess.getId(), 1200, 5); + String xml2 = timeDiagram.getDiagramJson(); + writeToTxt(request, response, xml2, "鏃跺簭鍥捐緭鍑�"); + } + } + } + + public void writeToTxt(HttpServletRequest request, HttpServletResponse response, String jsonString, String name) {//璁剧疆鍝嶅簲鐨勫瓧绗﹂泦 + //璁剧疆鍝嶅簲鍐呭鐨勭被鍨� + BufferedOutputStream buff = null; + ServletOutputStream outStr = null; + try { + response.setContentType("text/plain;charset=UTF-8"); + String encodedFilename = DownloadService.getNameEncoder(request, name + "xml.txt"); + response.addHeader("Content-Disposition", "attachment;filename=" + encodedFilename); + outStr = response.getOutputStream(); + buff = new BufferedOutputStream(outStr); + buff.write(jsonString.getBytes("UTF-8")); + buff.flush(); + buff.close(); + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + buff.close(); + outStr.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + } } diff --git a/modules/mainPart/src/main/resources/mapper/taskReliability/ReliabilityAssessDao.xml b/modules/mainPart/src/main/resources/mapper/taskReliability/ReliabilityAssessDao.xml index 3e2d6ac..ec76ca8 100644 --- a/modules/mainPart/src/main/resources/mapper/taskReliability/ReliabilityAssessDao.xml +++ b/modules/mainPart/src/main/resources/mapper/taskReliability/ReliabilityAssessDao.xml @@ -52,4 +52,13 @@ UPDATE_DATE DESC LIMIT 1 </select> + <select id="getxml" resultType="java.lang.String"> + SELECT + xml + FROM + assess_result + WHERE + is_delete = 0 + AND id = ${assessId} + </select> </mapper> diff --git a/web/src/views/modules/taskReliability/ConfigEdge/configEdge.vue b/web/src/views/modules/taskReliability/ConfigEdge/configEdge.vue index 680a165..821d0f4 100644 --- a/web/src/views/modules/taskReliability/ConfigEdge/configEdge.vue +++ b/web/src/views/modules/taskReliability/ConfigEdge/configEdge.vue @@ -6,7 +6,7 @@ <el-row :gutter="5" align="middle" style="margin-top:20px;"> <el-col :span=8 style="font-size: 16px;line-height: 38px">瀹藉害</el-col> <el-col :span=16> - <el-slider :min=1 :max=20 :step=1 v-model="globalGridAttr.strokeWidth" @change="onStrokeWidthChange"></el-slider> + <el-slider :min=1 :max=20 :step=1 v-model="globalGridAttr.nodeStrokeWidth" @change="onStrokeWidthChange"></el-slider> </el-col> </el-row> <el-row :gutter="5" align="middle" style="margin-top:20px;"> @@ -65,7 +65,13 @@ return{ left_p:document.documentElement.clientHeight*0.9, activeName: 'first', - // globalGridAttr:{}, + globalGridAttr:{ + nodeStrokeWidth:1, + stroke:'', + connector:'', + label:'', + distance:'' + }, curCell:Edge, options: [{ value: 'rounded', @@ -80,38 +86,14 @@ id: { type: String, }, - globalGridAttr:{ - type: Object, - }, graph:{ type: String, } }, - watch:{ - 'id'(val,oldVal){ - const cell = this.graph.getCellById(this.id) - if(!cell || !cell.isEdge()){ - return - } - this.curCell = cell - let connector = cell.getConnector() || { - name:'榛樿' - } - this.globalGridAttr.stroke = cell.attr('line/stroke') - this.globalGridAttr.strokeWidth = cell.attr('line/strokeWidth') - this.globalGridAttr.connector = connector.name - this.globalGridAttr.label = cell.getLabels()[0].attrs.text? cell.getLabels()[0].attrs.text.text:'' - this.globalGridAttr.distance =cell.getLabels()[0].position.distance - // this.globalGridAttr.angle =cell.getLabels()[0].position.angle - console.log(cell.getLabels(),'cell.getLabels()') - // console.log(cell.getLabels()[0],'cell.getLabels()[0]') - // this.globalGridAttr.label = (cell.getLabels()[0].attrs).text.text||'' - } - }, methods:{ onStrokeWidthChange(val) { - - this.globalGridAttr.strokeWidth = val + console.log(val,'val') + this.globalGridAttr.nodeStrokeWidth = val this.curCell.attr('line/strokeWidth', val) }, @@ -174,25 +156,22 @@ } ]) }, - // onLabelAngleChange(e){ - // const val = e - // // this.globalGridAttr.angle = val - // this.curCell.setLabels([ - // { - // attrs: { - // text: { - // text: this.globalGridAttr.label, - // }, - // }, - // position: { - // distance:this.globalGridAttr.distance, - // options: { - // keepGradient: true - // } - // }, - // } - // ]) - // } + loadData(cell){ + this.curCell = cell + let connector = cell.getConnector() || { + name:'榛樿' + } + this.globalGridAttr.stroke = cell.attr('line/stroke') + this.globalGridAttr.nodeStrokeWidth = cell.attr('line/strokeWidth') + this.globalGridAttr.connector = connector.name + this.globalGridAttr.label = cell.getLabels()[0].attrs.text? cell.getLabels()[0].attrs.text.text:'' + this.globalGridAttr.distance =cell.getLabels()[0].position.distance + // this.globalGridAttr.angle =cell.getLabels()[0].position.angle + console.log(this.globalGridAttr.nodeStrokeWidth,cell.attr('line/strokeWidth'),'globalGridAttr.nodeStrokeWidth') + console.log(this.globalGridAttr,'this.globalGridAttr') + // console.log(cell.getLabels()[0],'cell.getLabels()[0]') + // this.globalGridAttr.label = (cell.getLabels()[0].attrs).text.text||'' + } } } </script> diff --git a/web/src/views/modules/taskReliability/ConfigNode/tempNode.vue b/web/src/views/modules/taskReliability/ConfigNode/tempNode.vue index 10e887b..98026fa 100644 --- a/web/src/views/modules/taskReliability/ConfigNode/tempNode.vue +++ b/web/src/views/modules/taskReliability/ConfigNode/tempNode.vue @@ -6,31 +6,31 @@ <el-row :gutter="5" align="middle" style="margin-top:20px"> <el-col :span=8 style="font-size: 16px;line-height: 38px">鏂囨湰澶у皬</el-col> <el-col :span=16> - <el-slider :min=8 :max=20 :step=1 v-model="globalGridAttr.nodeFontSize" @change="onFontSizeChange"></el-slider> + <el-slider :min=8 :max=20 :step=1 v-model="tempNodeAttr.nodeFontSize" @change="onFontSizeChange"></el-slider> </el-col> </el-row> <el-row :gutter="5" align="middle" style="margin-top:20px"> <el-col :span=8 style="font-size: 16px;line-height: 40px">瀛椾綋棰滆壊</el-col> <el-col :span=16> - <el-color-picker v-model="globalGridAttr.nodeColor" style="width: 100%" @change="onColorChange"></el-color-picker> + <el-color-picker v-model="tempNodeAttr.nodeColor" style="width: 100%" @change="onColorChange"></el-color-picker> </el-col> </el-row> <el-row v-show="shape!=='custom-text' || shape!=='custom-circle1'" :gutter="5" align="middle" style="margin-top:20px"> <el-col :span=8 style="font-size: 16px;line-height: 32px">椤圭洰鍚嶇О</el-col> <el-col :span=16 > - <el-input @click.native='showDialog' v-model="globalGridAttr.inspectName" style="width:100%"></el-input> + <el-input @click.native='showDialog' v-model="tempNodeAttr.inspectName" style="width:100%"></el-input> </el-col> </el-row> <el-row :gutter="5" v-show="shape!=='custom-circle1'" align="middle" style="margin-top:20px"> <el-col :span=8 style="font-size: 16px;line-height: 32px">杩囩▼鍚嶇О</el-col> <el-col :span=16 > - <el-input v-model="globalGridAttr.nodeText" style="width:100%" @change="onTextChange"></el-input> + <el-input v-model="tempNodeAttr.nodeText" style="width:100%" @change="onTextChange"></el-input> </el-col> </el-row> <el-row v-show="shape!=='custom-text'" :gutter="5" align="middle" style="margin-top:20px"> <el-col :span=8 style="font-size: 16px;line-height: 32px">鏃ユ湡</el-col> <el-col :span=16 > - <el-date-picker v-model="globalGridAttr.nodeDate" type="date" placeholder="閫夋嫨鏃ユ湡" value-format="yyyy-MM-dd" + <el-date-picker v-model="tempNodeAttr.nodeDate" type="date" placeholder="閫夋嫨鏃ユ湡" value-format="yyyy-MM-dd" style="width: 100%" @change="onDateChange"> </el-date-picker> </el-col> @@ -40,19 +40,19 @@ <el-row align="middle" style="margin-top:20px"> <el-col :span=8 style="font-size: 16px;line-height: 40px">杈规棰滆壊</el-col> <el-col :span=16> - <el-color-picker v-model="globalGridAttr.nodeStroke" style="width: 100%" @change="onStrokeChange"></el-color-picker> + <el-color-picker v-model="tempNodeAttr.nodeStroke" style="width: 100%" @change="onStrokeChange"></el-color-picker> </el-col> </el-row> <el-row align="middle"style="margin-top:20px"> <el-col :span=8 style="font-size: 16px;line-height: 38px">杈规瀹藉害</el-col> <el-col :span=16> - <el-slider :min=1 :max=20 :step=1 v-model="globalGridAttr.nodeStrokeWidth" @change="onStrokeWidthChange"></el-slider> + <el-slider :min=1 :max=20 :step=1 v-model="tempNodeAttr.nodeStrokeWidth" @change="onStrokeWidthChange"></el-slider> </el-col> </el-row> <el-row align="middle" style="margin-top:20px"> <el-col :span=8 style="font-size: 16px;line-height: 40px">棰滆壊</el-col> <el-col :span=16> - <el-color-picker v-model="globalGridAttr.nodeFill" style="width: 100%" @change="onFillChange"></el-color-picker> + <el-color-picker v-model="tempNodeAttr.nodeFill" style="width: 100%" @change="onFillChange"></el-color-picker> </el-col> </el-row> </el-tab-pane> @@ -83,7 +83,16 @@ content:'', dialogVisible:false, activeName: 'first', - // globalGridAttr:{}, + tempNodeAttr:{ + nodeFontSize:'', + nodeColor:'', + inspectName:'', + nodeText:'', + nodeDate:'', + nodeStroke:'', + nodeStrokeWidth:'', + nodeFill:'', + }, curCel:Cell, left_p:document.documentElement.clientHeight*0.9, } @@ -101,9 +110,6 @@ refY2:{ type: Number }, - globalGridAttr:{ - type: Object, - }, graph:{ type: String, }, @@ -113,14 +119,6 @@ diagramId:{ type: String, } - }, - watch:{ - 'id'(val,oldVal){ - this.curCel = this.nodeOpt(this.id,this.globalGridAttr) - } - }, - mounted() { - // this.curCel = this.nodeOpt(this.id,this.globalGridAttr) }, methods:{ showDialog() { @@ -135,9 +133,9 @@ // console.log(node,'node') this.text =node.nodeName this.dateId = node.nodeId - this.globalGridAttr.dataId = this.dateId - this.globalGridAttr.inspectName = this.text - this.globalGridAttr.nodeText = this.text + this.tempNodeAttr.dataId = this.dateId + this.tempNodeAttr.inspectName = this.text + this.tempNodeAttr.nodeText = this.text this.data={ dataId:this.dateId, inspectName:this.text @@ -146,56 +144,56 @@ this.curCel.attr('text/text', this.text) this.curCel.attr('data/dataId', this.dateId) this.curCel.attr('data/inspectName', this.text) - this.curCel = this.nodeOpt(this.id,this.globalGridAttr) + // this.curCel = this.nodeOpt(this.id,this.tempNodeAttr) this.dialogVisible = false // console.log(node,'dialog绐楀彛杩斿洖鍊�') }, // 鏀瑰彉杈规棰滆壊 onStrokeChange(e){ let val = e - this.globalGridAttr.nodeStroke = val + this.tempNodeAttr.nodeStroke = val this.curCel.attr('body/stroke', val) }, //鏀瑰彉杈规澶у皬 onStrokeWidthChange(e){ let val =e - this.globalGridAttr.nodeStrokeWidth = val + this.tempNodeAttr.nodeStrokeWidth = val this.curCel.attr('body/strokeWidth', val) }, //鏀瑰彉鏂囨湰棰滆壊 onFillChange(e){ let val = e - this.globalGridAttr.nodeFill=val + this.tempNodeAttr.nodeFill=val this.curCel.attr('body/fill', val) // this.curCel.attr('title/fill', val) }, // 鏀瑰彉瀛椾綋澶у皬 onFontSizeChange(e){ let val =e - this.globalGridAttr.nodeFontSize = val + this.tempNodeAttr.nodeFontSize = val this.curCel.attr('text/fontSize', val) this.curCel.attr('title/fontSize', val) }, // 鏀瑰彉瀛椾綋棰滆壊 onColorChange(e){ let val =e - this.globalGridAttr.nodeColor = val + this.tempNodeAttr.nodeColor = val this.curCel.attr('text/fill', val) this.curCel.attr('title/fill', val) this.curCel.attr('text/style/color', val) this.curCel.attr('title/style/color', val) - this.curCel = this.nodeOpt(this.id,this.globalGridAttr) + // this.curCel = this.nodeOpt(this.id,this.tempNodeAttr) }, // 鏀瑰彉鏂囨湰 onTextChange(e){ this.text =e - this.globalGridAttr.nodeText = this.text + this.tempNodeAttr.nodeText = this.text this.curCel.attr('label/textWrap/text', this.text) - this.curCel = this.nodeOpt(this.id,this.globalGridAttr) + // this.curCel = this.nodeOpt(this.id,this.tempNodeAttr) }, onDateChange(e){ this.date =e - this.globalGridAttr.nodeDate = this.date + this.tempNodeAttr.nodeDate = this.date this.data={ finishDate:this.date, } @@ -204,42 +202,24 @@ this.curCel.attr('text/text', this.date) } this.curCel.attr('title/text', this.date) - this.curCel = this.nodeOpt(this.id,this.globalGridAttr) + // this.curCel = this.nodeOpt(this.id,this.tempNodeAttr) }, - nodeOpt(id, globalGridAttr){ - this.curCel=null - if(id){ - let cell = this.graph.getCellById(id) - // console.log(cell,'let cell 123456') - if (!cell || !cell.isNode()) { - return - } - this.curCel = cell - globalGridAttr.nodeStroke = cell.attr('body/stroke') - globalGridAttr.nodeStrokeWidth = cell.attr('body/strokeWidth') - globalGridAttr.nodeFill = cell.attr('body/fill') - // globalGridAttr.nodeFontSize = cell.attr('text/fontSize') - // globalGridAttr.nodeFontSize = cell.attr('title/fontSize') - globalGridAttr.nodeFontSize = cell.attr('text/fontSize')?cell.attr('text/fontSize'):cell.attr('title/fontSize') - globalGridAttr.nodeColor = cell.attr('text/fill') ? cell.attr('text/fill'):cell.attr('title/fill')?cell.attr('title/fill'):cell.attr('label/text/fill') - // globalGridAttr.nodeColor = cell.attr('text/fill') - // globalGridAttr.nodeColor = cell.attr('title/fill') - // globalGridAttr.nodeColor = cell.attr('text/style/color') - // globalGridAttr.nodeColor = cell.attr('title/style/color') - globalGridAttr.nodeUsers = cell.attr('approve/users') - globalGridAttr.nodeText = cell.attr('label/textWrap/text') - console.log(globalGridAttr.nodeText,'globalGridAttr.nodeText') - if(this.shape=='custom-circle1'){ - globalGridAttr.nodeDate = cell.attr('text/text') - } - globalGridAttr.nodeDate = cell.attr('title/text') - globalGridAttr.dataId = cell.getData().dataId - globalGridAttr.inspectName =cell.getData().inspectName - // console.log(globalGridAttr.inspectName,globalGridAttr.dataId,globalGridAttr.nodeDate,'globalGridAttr.inspectName,globalGridAttr.dataId,globalGridAttr.nodeDate 789') - cell.getData() - // console.log( cell.getData(),' cell.getData() 909') + loadData(cell){ + this.curCel=cell + this.tempNodeAttr.nodeStroke = cell.attr('body/stroke') + this.tempNodeAttr.nodeStrokeWidth = cell.attr('body/strokeWidth') + this.tempNodeAttr.nodeFill = cell.attr('body/fill') + this.tempNodeAttr.nodeFontSize = cell.attr('text/fontSize')?cell.attr('text/fontSize'):cell.attr('title/fontSize') + this.tempNodeAttr.nodeColor = cell.attr('text/fill') ? cell.attr('text/fill'):cell.attr('title/fill')?cell.attr('title/fill'):cell.attr('label/text/fill') + this.tempNodeAttr.nodeUsers = cell.attr('approve/users') + this.tempNodeAttr.nodeText = cell.attr('label/textWrap/text') + console.log(this.tempNodeAttr.nodeText,'tempNodeAttr.nodeText') + if(this.shape=='custom-circle1'){ + this.tempNodeAttr.nodeDate = cell.attr('text/text') } - return this.curCel; + this.tempNodeAttr.nodeDate = cell.attr('title/text') + this.tempNodeAttr.dataId = cell.getData().dataId + this.tempNodeAttr.inspectName =cell.getData().inspectName } } } diff --git a/web/src/views/modules/taskReliability/RBD-edit-img.vue b/web/src/views/modules/taskReliability/RBD-edit-img.vue index 74bf82b..93c984d 100644 --- a/web/src/views/modules/taskReliability/RBD-edit-img.vue +++ b/web/src/views/modules/taskReliability/RBD-edit-img.vue @@ -18,7 +18,10 @@ <el-button type="primary" @click="saveDiagram()">鏆傚瓨</el-button> <el-button type="primary" @click="analyzeDiagram()">鎻愪氦</el-button> <el-button type="primary" @click="clearDiagram()">娓呯┖鍥惧舰</el-button> - <el-button type="primary" @click="layoutDiagram()">涓�閿帓鐗�</el-button> + <el-checkbox style="margin: 0 10px 0 10px" v-model="dataForm.autoLayout" :true-label="1" :false-label="0"> + 鏄惁寮�鍚竴閿帓鐗� + </el-checkbox> + <el-button type="primary" @click="layoutDiagram()" :disabled="!dataForm.autoLayout">涓�閿帓鐗�</el-button> <el-button @click="leftAlign()"> <i style="font-size: 1rem;" class="wt-iconfont icon-zuoduiqi"></i> </el-button> @@ -576,7 +579,8 @@ publishContent: null, hasPublish: 0, urlPref: '', - nodeArr: [] + nodeArr: [], + autoLayout: 1, }, type: '', id: '', @@ -754,6 +758,7 @@ } let res = await this.$http.get(`/taskReliability/ModelLine/getDiagram`, {params: params}) this.dataForm = res.data + this.dataForm.autoLayout = parseInt(this.dataForm.autoLayout) if (res.data.content != null) { console.log(this.dataForm, 'getDiagram datafrom') console.log(res.data, 'getDiagram res.data') @@ -930,7 +935,7 @@ for (let i = 1; i <= node.getData().basicUnitNum; i++) { if (deviceNoArr.findIndex(item => item === i) === -1) { no = i - if (node.getData().basicUnitNum>1){ + if (node.getData().basicUnitNum > 1) { node.getData().deviceNo = i node.attr('text/text', node.attr('text/text') + '-' + i) } @@ -1061,12 +1066,12 @@ //'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', fontSize: 14, - fontWeight:'bold', + fontWeight: 'bold', 'text-anchor': 'start', }, text: { @@ -1219,7 +1224,7 @@ // 鐩戝惉鑺傜偣娣诲姞浜嬩欢 this.graph.on('node:added', ({node}) => { node.setAttrs({ - title: { text: '' }, + title: {text: ''}, }) if (this.isFirstLoad) { return @@ -1580,26 +1585,28 @@ }) }, async layoutDiagram() { - console.log(JSON.stringify(this.graph.toJSON()), 'graph.toJSON()') - this.dataForm.content = JSON.stringify(this.graph.toJSON()) - this.dataForm.urlPref = window.SITE_CONFIG['apiURL'] - await this.$http['post'](`/taskReliability/ModelLine/layout`, this.dataForm).then(async res => { - if (res.msg === 'success') { - // this.$emit('refreshDataList') - // this.$alert('瑙f瀽鎴愬姛', '鎻愮ず', { - // confirmButtonText: '纭畾' - // }) - console.log(res.data, 'layoutDiagram res.data') - this.dataForm.content = res.data.content - console.log(this.dataForm.content, 'layoutDiagram dataForm.content') - this.diagramJson = JSON.parse(this.dataForm.content) - this.graph.fromJSON(this.diagramJson) - this.isFirstLoad = false; - // console.log(this.diagramJson.cells.length, 'this.diagramJson.cells.length') + if (this.dataForm.autoLayout == 1) { + console.log(JSON.stringify(this.graph.toJSON()), 'graph.toJSON()') + this.dataForm.content = JSON.stringify(this.graph.toJSON()) + this.dataForm.urlPref = window.SITE_CONFIG['apiURL'] + await this.$http['post'](`/taskReliability/ModelLine/layout`, this.dataForm).then(async res => { + if (res.msg === 'success') { + // this.$emit('refreshDataList') + // this.$alert('瑙f瀽鎴愬姛', '鎻愮ず', { + // confirmButtonText: '纭畾' + // }) + console.log(res.data, 'layoutDiagram res.data') + this.dataForm.content = res.data.content + console.log(this.dataForm.content, 'layoutDiagram dataForm.content') + this.diagramJson = JSON.parse(this.dataForm.content) + this.graph.fromJSON(this.diagramJson) + this.isFirstLoad = false; + // console.log(this.diagramJson.cells.length, 'this.diagramJson.cells.length') - this.graph.positionContent('left') - } - }) + this.graph.positionContent('left') + } + }) + } }, leftAlign() { const NODE = this.graph.getSelectedCells() @@ -1776,9 +1783,11 @@ inEdges[0].target = {cell: result.newStartNode.id} outEdges[0].source = {cell: result.newEndNode.id} graphNode.remove() - if (!result.canPlace) { -//璋冪敤鑷姩鎺掔増 - this.layoutDiagram() + if (this.dataForm.autoLayout == 1) { + if (!result.canPlace) { + //璋冪敤鑷姩鎺掔増 + this.layoutDiagram() + } } } } else { //骞惰缁撴瀯 @@ -1831,9 +1840,11 @@ connector: {name: 'rounded'}, zIndex: -1 }) - if (!result.canPlace) { -//璋冪敤鑷姩鎺掔増 - this.layoutDiagram() + if (this.dataForm.autoLayout == 1) { + if (!result.canPlace) { + //璋冪敤鑷姩鎺掔増 + this.layoutDiagram() + } } } }, @@ -1963,8 +1974,11 @@ }) graphEdge.source = {cell: result.newEndNode.id} } - if (!result.canPlace) { - this.layoutDiagram() + if (this.dataForm.autoLayout == 1) { + if (!result.canPlace) { + //璋冪敤鑷姩鎺掔増 + this.layoutDiagram() + } } // graphEdge.remove() } diff --git a/web/src/views/modules/taskReliability/ReliabilityAssess.vue b/web/src/views/modules/taskReliability/ReliabilityAssess.vue index 49562fe..6516b3e 100644 --- a/web/src/views/modules/taskReliability/ReliabilityAssess.vue +++ b/web/src/views/modules/taskReliability/ReliabilityAssess.vue @@ -19,6 +19,15 @@ <el-button type="primary" @click="assess()">璇勫畾</el-button> <el-button type="primary" @click="add()">鏂板璇勫畾鏁版嵁</el-button> <el-button type="primary" @click="handleExpand()">{{expandText}}</el-button> + <el-dropdown style="margin-left: 10px" @command="download"> + <el-button type="primary"> + 涓嬭浇xml<i class="el-icon-arrow-down el-icon--right"></i> + </el-button> + <el-dropdown-menu slot="dropdown"> + <el-dropdown-item command="1">杈撳叆xml</el-dropdown-item> + <el-dropdown-item command="2">杈撳嚭xml</el-dropdown-item> + </el-dropdown-menu> + </el-dropdown> </el-form> <el-table ref="multipleTable" v-loading="table.dataLoading" :data="dataList" height="100px" v-adaptive="{bottomOffset:70}" row-key="id" @@ -43,6 +52,8 @@ </template> <script> import AddOrUpdate from './RelisbilityAssess-AddOrUpdate' + import qs from "qs"; + import Cookies from "js-cookie"; export default { data() { @@ -189,6 +200,21 @@ } }) }, - } + async download(selsect) { + if (!this.dataForm.productId || !this.dataForm.taskId || !this.dataForm.itemId ) { + this.$tip.alert("鏈夋湭濉啓鐨勬暟鎹�") + return + } + let param = qs.stringify({ + 'token': Cookies.get('token'), + productId: this.dataForm.productId, + taskId: this.dataForm.taskId, + itemId: this.dataForm.itemId, + xml:selsect + }) + let apiURL = `/taskReliability/ReliabilityAssess/downloadXml` + window.location.href = `${window.SITE_CONFIG['apiURL']}${apiURL}?${param}` + } + }, } </script> diff --git a/web/src/views/modules/taskReliability/SchemeCompar.vue b/web/src/views/modules/taskReliability/SchemeCompar.vue index 718307c..10efed1 100644 --- a/web/src/views/modules/taskReliability/SchemeCompar.vue +++ b/web/src/views/modules/taskReliability/SchemeCompar.vue @@ -10,12 +10,12 @@ @change="onTaskSelected" :multiple="true"/> </zt-form-item> <zt-form-item label="鏃堕棿鍒嗙墖" prop="samplPeriod"> - <el-input type="number" :min="1" v-model="dataForm.samplPeriod"> + <el-input type="number" :min="1" v-model="dataForm.samplPeriod" style="width: 150px;vertical-align: baseline;"> <template slot="append">鍒嗛挓</template> </el-input> </zt-form-item> <zt-form-item label="浠跨湡娆℃暟" prop="simulatFrequency"> - <el-input type="number" :min="1" v-model="dataForm.simulatFrequency"> + <el-input type="number" :min="1" v-model="dataForm.simulatFrequency" style="width: 150px;vertical-align: baseline;"> <template slot="append">娆℃暟</template> </el-input> </zt-form-item> diff --git a/web/src/views/modules/taskReliability/SimulatAssess.vue b/web/src/views/modules/taskReliability/SimulatAssess.vue index de15fbc..7b59686 100644 --- a/web/src/views/modules/taskReliability/SimulatAssess.vue +++ b/web/src/views/modules/taskReliability/SimulatAssess.vue @@ -8,40 +8,50 @@ <zt-form-item label="鎬讳綋浠诲姟" prop="taskModelId"> <zt-select v-model="dataForm.taskModelId" :datas="taskList" @change="onTaskSelected"/> </zt-form-item> - <zt-form-item label="鏃堕棿鍒嗙墖" prop="samplPeriod" > - <el-input type="number" :min="1" v-model="dataForm.samplPeriod" style="width: 150px;vertical-align: baseline;"> + <zt-form-item label="鏃堕棿鍒嗙墖" prop="samplPeriod"> + <el-input type="number" :min="1" v-model="dataForm.samplPeriod" + style="width: 150px;vertical-align: baseline;"> <template slot="append">鍒嗛挓</template> </el-input> </zt-form-item> - <zt-form-item label="浠跨湡娆℃暟" prop="simulatFrequency" > - <el-input type="number" :min="1" v-model="dataForm.simulatFrequency" style="width: 150px;vertical-align: baseline;"> + <zt-form-item label="浠跨湡娆℃暟" prop="simulatFrequency"> + <el-input type="number" :min="1" v-model="dataForm.simulatFrequency" + style="width: 150px;vertical-align: baseline;"> <template slot="append">娆℃暟</template> </el-input> </zt-form-item> <el-form-item prop="repairDiracFlag" label-width="150px" style="margin-left: 20px"> <el-checkbox v-model="dataForm.repairDiracFlag">鍙慨璁惧鍙潬搴︿负1</el-checkbox> </el-form-item> - <zt-form-item style="margin-left: 20px"> + <zt-form-item style="margin-left: 10px"> <zt-button @click="analyze()">浠跨湡鍒嗘瀽</zt-button> - </zt-form-item> - <zt-form-item style="margin-left: 20px"> - <zt-button @click="displayProcess()">鏌ョ湅绠楁硶搴撹繘绋�</zt-button> + <zt-button @click="displayProcess()">绠楁硶搴撹繘绋�</zt-button> + <el-dropdown style="margin-left: 10px" @command="download"> + <el-button type="primary"> + 涓嬭浇xml<i class="el-icon-arrow-down el-icon--right"></i> + </el-button> + <el-dropdown-menu slot="dropdown"> + <el-dropdown-item command="1">杈撳叆xml</el-dropdown-item> + <el-dropdown-item command="2">杈撳嚭xml</el-dropdown-item> + </el-dropdown-menu> + </el-dropdown> </zt-form-item> </el-form> <el-progress v-if="isShow" :percentage="percentage"></el-progress> - <el-col :span="4"> - <div style="margin-right: 5px;height: calc(100vh - 230px)" v-if="isSelect"> - <product-model-tree @on-selected="onTreeSelected" showXdy="false" - ref="ProductModelTree" :isShow="false" basic="4" :productId="dataForm.productId"/> - </div> - </el-col> - <el-col :span="20"> - <div class="fa-card-a" style="height: calc(100vh - 230px)"> - <SimulatCurve ref="SimulatCurve"></SimulatCurve> - </div> - </el-col> + <el-col :span="4"> + <div style="margin-right: 5px;height: calc(100vh - 230px)" v-if="isSelect"> + <product-model-tree @on-selected="onTreeSelected" showXdy="false" + ref="ProductModelTree" :isShow="false" basic="4" :productId="dataForm.productId"/> + </div> + </el-col> + <el-col :span="20"> + <div class="fa-card-a" style="height: calc(100vh - 230px)"> + <SimulatCurve ref="SimulatCurve"></SimulatCurve> + </div> + </el-col> </el-row> - <el-dialog v-dialogDrag :close-on-click-modal="false" top="8vh" :visible.sync="dialogVisible" title="妯″瀷妫�鏌�" width="60%" @close="dialogVisible = false"> + <el-dialog v-dialogDrag :close-on-click-modal="false" top="8vh" :visible.sync="dialogVisible" title="妯″瀷妫�鏌�" + width="60%" @close="dialogVisible = false"> <el-tag type="danger" style="margin-bottom: 10px">妯″瀷瀹氫箟/鍙傛暟閰嶇疆閲屽瓨鍦ㄤ互涓嬮棶棰橈細</el-tag> <el-table :data="modelCheckResult" height="350" :header-cell-style="{'text-align':'center'}"> @@ -66,6 +76,8 @@ import SimulatCurve from "./SimulatCurve"; import ProductModelTree from "../basicInfo/ProductModelTree"; import Process from "./Process"; + import qs from "qs"; + import Cookies from "js-cookie"; export default { @@ -113,7 +125,7 @@ methods: { onTreeSelected(data) { - if (this.dataForm.id){ + if (this.dataForm.id) { console.log(data, 'onProductSelected') this.dataForm.showProductId = data.id this.$refs.SimulatCurve.getProductEcharts(this.dataForm); @@ -184,6 +196,21 @@ } } }, + async download(selsect) { + if(this.dataForm.id){ + let param = qs.stringify({ + 'token': Cookies.get('token'), + type: 'fz', + xml:selsect, + id: this.dataForm.id + }) + let apiURL = `/taskReliability/SimulatAssess/downloadXml` + window.location.href = `${window.SITE_CONFIG['apiURL']}${apiURL}?${param}` + }else{ + this.$alert('杩樻湭杩涜浠跨湡鎿嶄綔') + } + + }, displayProcess() { this.$refs.process.$refs.dialog.init() } diff --git a/web/src/views/modules/taskReliability/SimulatHistory.vue b/web/src/views/modules/taskReliability/SimulatHistory.vue index 8a3bd42..6f9d89e 100644 --- a/web/src/views/modules/taskReliability/SimulatHistory.vue +++ b/web/src/views/modules/taskReliability/SimulatHistory.vue @@ -12,12 +12,12 @@ <zt-select v-model="dataForm.id" :datas="simulatList" @change="onSimulatSelected"/> </zt-form-item> <zt-form-item label="鏃堕棿鍒嗙墖" prop="samplPeriod"> - <el-input v-model="dataForm.samplPeriod" readonly="false"> + <el-input v-model="dataForm.samplPeriod" readonly="false" style="width: 150px;vertical-align: baseline;"> <template slot="append">鍒嗛挓</template> </el-input> </zt-form-item> <zt-form-item label="浠跨湡娆℃暟" prop="simulatFrequency"> - <el-input v-model="dataForm.simulatFrequency" readonly="false"> + <el-input v-model="dataForm.simulatFrequency" readonly="false" style="width: 150px;vertical-align: baseline;"> </el-input> </zt-form-item> </el-form> diff --git a/web/src/views/modules/taskReliability/TimeDiagram.vue b/web/src/views/modules/taskReliability/TimeDiagram.vue index 0d654f8..15c0973 100644 --- a/web/src/views/modules/taskReliability/TimeDiagram.vue +++ b/web/src/views/modules/taskReliability/TimeDiagram.vue @@ -13,18 +13,25 @@ <zt-select v-model="dataForm.id" :datas="simulatList" @change="onSimulatSelected"/> </zt-form-item> <zt-form-item label="鏃堕棿鍒嗙墖" prop="samplPeriod"> - <el-input v-model="dataForm.samplPeriod" readonly="false"> + <el-input v-model="dataForm.samplPeriod" readonly="false" style="width: 150px;vertical-align: baseline;"> <template slot="append">鍒嗛挓</template> </el-input> </zt-form-item> <zt-form-item label="浠跨湡娆℃暟" prop="simulatFrequency"> - <el-input v-model="dataForm.simulatFrequency" readonly="false"> + <el-input v-model="dataForm.simulatFrequency" readonly="false" style="width: 150px;"> </el-input> </zt-form-item> <zt-form-item> <zt-button @click="getDiagram(null)">鏌ョ湅鏃跺簭鍥�</zt-button> -<!-- <zt-button @click="graphRightTranslate()">鐢诲竷鍙崇Щ</zt-button>--> -<!-- <zt-button @click="graphLeftTranslate()">鐢诲竷宸︾Щ</zt-button>--> + <el-dropdown style="margin-left: 10px" @command="download"> + <el-button type="primary"> + 涓嬭浇xml<i class="el-icon-arrow-down el-icon--right"></i> + </el-button> + <el-dropdown-menu slot="dropdown"> + <el-dropdown-item command="1">杈撳叆xml</el-dropdown-item> + <el-dropdown-item command="2">杈撳嚭xml</el-dropdown-item> + </el-dropdown-menu> + </el-dropdown> </zt-form-item> </el-form> <div style="display: flex"> @@ -61,6 +68,8 @@ import ModelView from "./ModelView"; import textDiagram from "./textDiagram"; import timeDiagramThumbnail from "./timeDiagramThumbnail" + import qs from "qs"; + import Cookies from "js-cookie"; export default { @@ -141,7 +150,6 @@ window.removeEventListener('scroll', this.handleScroll,true); }, mounted() { - // alert(`mounted鎵ц浜哷) this.getProductList() this.init() this.$refs.textDiagram.init() @@ -158,7 +166,6 @@ handleScroll(){ this.graph.getScrollbarPosition() let left = this.graph.getScrollbarPosition().left - console.log(left,'left left') let top = this.graph.getScrollbarPosition().top this.$refs.textDiagram.setScroll(top) this.$refs.timeDiagramThumbnail.getNodePointX(left,this.bigWidth) @@ -205,20 +212,6 @@ minVisibleHeight:300, pannable: true, }, - // minimap: { - // enabled: true, - // container: document.getElementById('thumbnail'), - // scalable:false, - // width: document.documentElement.clientWidth - 400, - // height: 150, - // }, - // mousewheel: { - // enabled: true, - // zoomAtMousePosition: true, - // modifiers: 'ctrl', - // minScale: 0.1, - // maxScale: 10, - // }, createEdge() { return new Shape.Edge({ data: { @@ -277,169 +270,12 @@ textVerticalAnchor: 'middle', textWrap: { text: '鏂囧瓧妯℃澘', - width: -10, // 瀹藉害鍑忓皯 10px + width: 120, // 瀹藉害鍑忓皯 10px ellipsis: false, // 鏂囨湰瓒呭嚭鏄剧ず鑼冨洿鏃讹紝鑷姩娣诲姞鐪佺暐鍙� breakWord: true, // 鏄惁鎴柇鍗曡瘝 } }, }, - ports: {...this.ports}, - }, - true, - ) - - Graph.registerNode( - 'custom-polygon', - { - inherit: 'polygon', - width: 86, - height: 56, - attrs: { - body: { - strokeWidth: 1, - stroke: '#5F95FF', - fill: '#EFF4FF', - }, - text: { - fontSize: 20, - fill: '#262626', - }, - }, - ports: { - ...this.ports - // items: [ - // { - // group: 'top', - // }, - // { - // group: 'bottom', - // }, - // ], - }, - }, - true, - ) - // - Graph.registerNode( - 'custom-circle', - { - inherit: 'ellipse', - width: 120, - height: 120, - data: { - dataId: '', - finishDate: '' - }, - attrs: { - body: { - strokeWidth: 1, - stroke: '#5F95FF', - fill: '#EFF4FF', - }, - //鏃ユ湡 - title: { - text: '', - fontSize: 12, - fill: '#262626', - refX: 0.5, - refY: '100%', - refY2: -10, - textAnchor: 'middle', - textVerticalAnchor: 'bottom', - }, - // 鍚嶇О - text: { - // fontFamily: '浠垮畫', - fontSize: 20, - fill: '#262626', - textWrap: { - width: 80, // 瀹藉害涓� 80px鎹㈣ - ellipsis: false, // 鏂囨湰瓒呭嚭鏄剧ず鑼冨洿鏃讹紝鑷姩娣诲姞鐪佺暐鍙� - breakWord: true, // 鏄惁鎴柇鍗曡瘝 - } - }, - }, - markup: [ - { - tagName: 'ellipse', - selector: 'body', - }, - { - tagName: 'text', - selector: 'title', - }, - { - tagName: 'text', - selector: 'text', - }, - ], - ports: {...this.ports}, - }, - true, - ) - Graph.registerNode( - 'custom-circle1', - { - inherit: 'ellipse', - width: 65, - height: 65, - data: { - dataId: '', - finishDate: '' - }, - attrs: { - body: { - strokeWidth: 1, - stroke: '#5F95FF', - fill: '#EFF4FF', - }, - //鏃ユ湡 - text: { - // fontFamily: '浠垮畫', - fontSize: 12, - text: '鏃ユ湡鑺傜偣', - fill: '#262626', - }, - }, - ports: {...this.ports}, - }, - true, - ) - Graph.registerNode( - 'custom-text', - { - inherit: 'text-block', - width: 86, - height: 56, - attrs: { - body: { - strokeWidth: 1, - stroke: '#5F95FF', - fill: '#EFF4FF', - }, - text: { - text: '涓撲笟', - fontSize: 20, - style: { - color: this.globalGridAttr.nodeColor - }, - refX: '0', - refY: -0.5, - refY2: 1, - textAnchor: 'middle', - textVerticalAnchor: 'middle', - }, - }, - markup: [ - { - tagName: 'rect', - selector: 'body', - }, - { - tagName: 'text', - selector: 'text', - }, - ], ports: {...this.ports}, }, true, @@ -460,34 +296,12 @@ }) this.graph.on('blank:click', ({cell}) => { - // this.reset() - // this.type.value = "grid" this.type = 'grid' - // this.id = cell.id }) - this.graph.on('translate', ({ tx, ty }) => { - console.log(`褰撳墠鍋忕Щ閲忎綅缃�: x=${tx}, y=${ty}`); - }); this.graph.on('cell:click', ({cell}) => { - // this.type.value = cell.isNode() ? "node" : "edge" this.type = cell.isNode() ? 'node' : 'edge' this.shape = cell.shape this.id = cell.id - console.log(this.shape, 'this.shape') - // this.nodeOpt(this.id, this.globalGridAttr) - }) - //鍗曞嚮杈硅妭鐐� - this.graph.on('edge:click', ({edge}) => { - // this.reset() - edge.attr('line/stroke', '#5F95FF') - edge.prop('labels/0', { - attrs: { - body: { - stroke: '#5F95FF', - }, - }, - - }) }) // 鍗曞嚮node鑺傜偣 this.graph.on('node:click', ({node}) => { @@ -617,14 +431,9 @@ this.diagramJson = JSON.parse(res.data.diagramJson) let textDiagramJson = JSON.parse(res.data.textDiagramJson) let smallDiagramJson = JSON.parse(res.data.smallDiagramJson) - console.log(this.diagramJson, 'this.Diagram json') - console.log(smallDiagramJson, 'smallDiagramJson') this.graph.fromJSON(this.diagramJson) - // this.graph.centerContent() this.graph.positionContent('left',{ padding: { left: 0 }}) - // this.graph.zoomToFit() this.bigWidth = this.graph.getContentBBox().width - console.log(this.bigWidth,'getContentBBox') // this.graph.resize(this.graph.getContentBBox().width,this.graph.getContentBBox().height) this.graph.freeze() this.$refs.textDiagram.getTextDiagram(textDiagramJson) @@ -640,14 +449,22 @@ }, getPoint(x,smallWidth){ let pointX = Number((x * (this.bigWidth / smallWidth )).toFixed(0)) - // console.log(pointX) this.graph.setScrollbarPosition(pointX, null) - // if(pointX<600){ - // this.graph.setScrollbarPosition(pointX, null, { animation: { duration: 400 }}) - // }else { - // this.graph.scrollToPoint(pointX, null, {animation: {duration: 400}}) - // } - } + }, + async download(selsect) { + if(this.dataForm.id){ + let param = qs.stringify({ + 'token': Cookies.get('token'), + type: 'sxt', + xml:selsect, + id: this.dataForm.id + }) + let apiURL = `/taskReliability/SimulatAssess/downloadXml` + window.location.href = `${window.SITE_CONFIG['apiURL']}${apiURL}?${param}` + }else{ + this.$alert('杩樻湭閫夋嫨浠跨湡璁板綍') + } + }, } } </script> diff --git a/web/src/views/modules/taskReliability/TimeDiagramTemp.vue b/web/src/views/modules/taskReliability/TimeDiagramTemp.vue index cd5301c..98b77bc 100644 --- a/web/src/views/modules/taskReliability/TimeDiagramTemp.vue +++ b/web/src/views/modules/taskReliability/TimeDiagramTemp.vue @@ -2,11 +2,9 @@ <div> <el-row :gutter="[8,8]"> <el-col :span="5"> - <div style="height: 80vh"> - <div class="fa-card-a"> + <div class="fa-card-a" style="height: calc(100vh - 128px)"> <div id="stencil"></div> </div> - </div> </el-col> <el-col :span="19"> <div class="fa-card-a"> @@ -33,11 +31,8 @@ <div id="container" style="border: 1px solid #EAEBEE;border-radius: 6px; box-shadow: 0 2px 12px 0 rgb(0 0 0 / 10%);"> </div> - <config-edge ref="configEdge" v-show="type === 'edge'" :id="id" :globalGridAttr="globalGridAttr" - :graph="graph"/> - <config-node v-show="type === 'node'" :id="id" :globalGridAttr="globalGridAttr" - :graph="graph" - :shape="shape"/> + <config-edge ref="configEdge" v-show="type === 'edge'"/> + <config-node ref="configNode" v-show="type === 'node'" /> </div> </el-col> </el-row> @@ -143,7 +138,6 @@ opacity: 0.1, stroke: '#5F95FF', - strokeWidth: 1, connector: 'normal', label: '', nodeStroke: '#5F95FF', @@ -405,7 +399,7 @@ line: { stroke: '#A2B1C3', strokeWidth: 2, - targetMarker: 'classic' + targetMarker: null, } }, tools: { @@ -790,6 +784,16 @@ this.shape = cell.shape this.id = cell.id console.log(this.shape, 'this.shape') + // if (this.type === 'edge') { + // //this.nodeType = cell.getData().nodeType + // this.$refs.configEdge.loadData(cell) + // } + if (this.type === 'node') { + this.$refs.configNode.loadData(cell,this.globalGridAttr) + } + if (this.type === 'edge') { + this.$refs.configEdge.loadData(cell) + } // this.nodeOpt(this.id, this.globalGridAttr) }) //鍗曞嚮杈硅妭鐐� @@ -839,59 +843,57 @@ }) }) - this.graph.on('node:mouseenter', ({node}) => { - const container = document.getElementById('container') - const ports = container.querySelectorAll( - '.x6-port-body', - ) - this.showPorts(ports, true) - }) + // this.graph.on('node:mouseenter', ({node}) => { + // const container = document.getElementById('container') + // const ports = container.querySelectorAll( + // '.x6-port-body', + // ) + // }) + // + // 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.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() - }) + // 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() + // }) }, - showPorts(ports, show) { - for (let i = 0, len = ports.length; i < len; i = i + 1) { - ports[i].style.visibility = show ? 'visible' : 'hidden' - } - }, + // showPorts(ports, show) { + // for (let i = 0, len = ports.length; i < len; i = i + 1) { + // ports[i].style.visibility = show ? 'visible' : 'hidden' + // } + // }, async saveDiagram() { console.log(JSON.stringify(this.graph.toJSON()), 'graph.toJSON()') @@ -1028,12 +1030,12 @@ } .x6-graph-scroller.x6-graph-scroller-pannable { - width: 100% !important; + width: 100% ; } #stencil { width: 100%; - height: 350px; + height:100%; position: relative; border-right: 1px solid #dfe3e8; } -- Gitblit v1.9.1