Merge remote-tracking branch 'origin/master'
| | |
| | | |
| | | @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); |
| | | } |
| | | |
| | |
| | | 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; |
| | | |
| | |
| | | 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("新增") |
| | |
| | | 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; |
| | |
| | | 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("修改") |
| | |
| | | List<ReliabilityAssess> getProductList(Long productId, Long itemId); |
| | | |
| | | Long getAssessId(Long itemId, Long productId, Long taskId); |
| | | |
| | | String getxml(Long assessId); |
| | | } |
| | |
| | | @ApiModelProperty(value = "") |
| | | private Long productId; |
| | | |
| | | @ApiModelProperty(value = "是否自动排版") |
| | | private Integer autoLayout; |
| | | |
| | | @TableField(exist = false) |
| | | @ApiModelProperty(value = "") |
| | | private Long[] nodeArr; |
| | |
| | | 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; |
| | |
| | | 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]); |
| | | } |
| | |
| | | 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); |
| | |
| | | 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 { |
| | |
| | | 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()); |
| | |
| | | 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) { |
| | | // 二项分布 |
| | |
| | | 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 { |
| | |
| | | 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, "评定"); |
| | | } |
| | | } |
| | |
| | | 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; |
| | |
| | | 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.*; |
| | |
| | | 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(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | 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> |
| | |
| | | <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;"> |
| | |
| | | return{ |
| | | left_p:document.documentElement.clientHeight*0.9, |
| | | activeName: 'first', |
| | | // globalGridAttr:{}, |
| | | globalGridAttr:{ |
| | | nodeStrokeWidth:1, |
| | | stroke:'', |
| | | connector:'', |
| | | label:'', |
| | | distance:'' |
| | | }, |
| | | curCell:Edge, |
| | | options: [{ |
| | | value: 'rounded', |
| | |
| | | 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) |
| | | }, |
| | | |
| | |
| | | } |
| | | ]) |
| | | }, |
| | | // 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> |
| | |
| | | <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> |
| | |
| | | <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> |
| | |
| | | content:'', |
| | | dialogVisible:false, |
| | | activeName: 'first', |
| | | // globalGridAttr:{}, |
| | | tempNodeAttr:{ |
| | | nodeFontSize:'', |
| | | nodeColor:'', |
| | | inspectName:'', |
| | | nodeText:'', |
| | | nodeDate:'', |
| | | nodeStroke:'', |
| | | nodeStrokeWidth:'', |
| | | nodeFill:'', |
| | | }, |
| | | curCel:Cell, |
| | | left_p:document.documentElement.clientHeight*0.9, |
| | | } |
| | |
| | | refY2:{ |
| | | type: Number |
| | | }, |
| | | globalGridAttr:{ |
| | | type: Object, |
| | | }, |
| | | graph:{ |
| | | type: String, |
| | | }, |
| | |
| | | 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() { |
| | |
| | | // 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 |
| | |
| | | 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, |
| | | } |
| | |
| | | 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 |
| | | } |
| | | } |
| | | } |
| | |
| | | <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> |
| | |
| | | publishContent: null, |
| | | hasPublish: 0, |
| | | urlPref: '', |
| | | nodeArr: [] |
| | | nodeArr: [], |
| | | autoLayout: 1, |
| | | }, |
| | | type: '', |
| | | id: '', |
| | |
| | | } |
| | | 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') |
| | |
| | | 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) |
| | | } |
| | |
| | | //'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: { |
| | |
| | | // 监听节点添加事件 |
| | | this.graph.on('node:added', ({node}) => { |
| | | node.setAttrs({ |
| | | title: { text: '' }, |
| | | title: {text: ''}, |
| | | }) |
| | | if (this.isFirstLoad) { |
| | | return |
| | |
| | | }) |
| | | }, |
| | | 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('解析成功', '提示', { |
| | | // 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('解析成功', '提示', { |
| | | // 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() |
| | |
| | | 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 { //并行结构 |
| | |
| | | connector: {name: 'rounded'}, |
| | | zIndex: -1 |
| | | }) |
| | | if (!result.canPlace) { |
| | | //调用自动排版 |
| | | this.layoutDiagram() |
| | | if (this.dataForm.autoLayout == 1) { |
| | | if (!result.canPlace) { |
| | | //调用自动排版 |
| | | this.layoutDiagram() |
| | | } |
| | | } |
| | | } |
| | | }, |
| | |
| | | }) |
| | | graphEdge.source = {cell: result.newEndNode.id} |
| | | } |
| | | if (!result.canPlace) { |
| | | this.layoutDiagram() |
| | | if (this.dataForm.autoLayout == 1) { |
| | | if (!result.canPlace) { |
| | | //调用自动排版 |
| | | this.layoutDiagram() |
| | | } |
| | | } |
| | | // graphEdge.remove() |
| | | } |
| | |
| | | <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" |
| | |
| | | </template> |
| | | <script> |
| | | import AddOrUpdate from './RelisbilityAssess-AddOrUpdate' |
| | | import qs from "qs"; |
| | | import Cookies from "js-cookie"; |
| | | |
| | | export default { |
| | | data() { |
| | |
| | | } |
| | | }) |
| | | }, |
| | | } |
| | | 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> |
| | |
| | | @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> |
| | |
| | | <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'}"> |
| | |
| | | import SimulatCurve from "./SimulatCurve"; |
| | | import ProductModelTree from "../basicInfo/ProductModelTree"; |
| | | import Process from "./Process"; |
| | | import qs from "qs"; |
| | | import Cookies from "js-cookie"; |
| | | |
| | | |
| | | export default { |
| | |
| | | |
| | | 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); |
| | |
| | | } |
| | | } |
| | | }, |
| | | 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() |
| | | } |
| | |
| | | <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> |
| | |
| | | <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"> |
| | |
| | | import ModelView from "./ModelView"; |
| | | import textDiagram from "./textDiagram"; |
| | | import timeDiagramThumbnail from "./timeDiagramThumbnail" |
| | | import qs from "qs"; |
| | | import Cookies from "js-cookie"; |
| | | |
| | | |
| | | export default { |
| | |
| | | window.removeEventListener('scroll', this.handleScroll,true); |
| | | }, |
| | | mounted() { |
| | | // alert(`mounted执行了`) |
| | | this.getProductList() |
| | | this.init() |
| | | this.$refs.textDiagram.init() |
| | |
| | | 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) |
| | |
| | | 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: { |
| | |
| | | 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, |
| | |
| | | }) |
| | | |
| | | 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}) => { |
| | |
| | | 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) |
| | |
| | | }, |
| | | 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> |
| | |
| | | <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"> |
| | |
| | | <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> |
| | |
| | | opacity: 0.1, |
| | | |
| | | stroke: '#5F95FF', |
| | | strokeWidth: 1, |
| | | connector: 'normal', |
| | | label: '', |
| | | nodeStroke: '#5F95FF', |
| | |
| | | line: { |
| | | stroke: '#A2B1C3', |
| | | strokeWidth: 2, |
| | | targetMarker: 'classic' |
| | | targetMarker: null, |
| | | } |
| | | }, |
| | | tools: { |
| | |
| | | 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) |
| | | }) |
| | | //单击边节点 |
| | |
| | | }) |
| | | }) |
| | | |
| | | 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()') |
| | |
| | | } |
| | | |
| | | .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; |
| | | } |