增加下载xml,禁止一键排版以及修改型号节点上级节点
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @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-button type="primary" @click="saveDiagram()">暂存</el-button> | 
|---|
|  |  |  | <el-button type="primary" @click="analyzeDiagram()">提交</el-button> | 
|---|
|  |  |  | <el-button type="primary" @click="clearDiagram()">清空图形</el-button> | 
|---|
|  |  |  | <el-checkbox style="margin: 0 10px 0 10px" v-model="dataForm.autoLayout">是否开启一键排版</el-checkbox> | 
|---|
|  |  |  | <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> | 
|---|
|  |  |  | 
|---|
|  |  |  | hasPublish: 0, | 
|---|
|  |  |  | urlPref: '', | 
|---|
|  |  |  | nodeArr: [], | 
|---|
|  |  |  | autoLayout:true, | 
|---|
|  |  |  | 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) == 1 | 
|---|
|  |  |  | 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() { | 
|---|
|  |  |  | if(this.dataForm.autoLayout){ | 
|---|
|  |  |  | 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'] | 
|---|
|  |  |  | 
|---|
|  |  |  | inEdges[0].target = {cell: result.newStartNode.id} | 
|---|
|  |  |  | outEdges[0].source = {cell: result.newEndNode.id} | 
|---|
|  |  |  | graphNode.remove() | 
|---|
|  |  |  | if(this.dataForm.autoLayout){ | 
|---|
|  |  |  | if (this.dataForm.autoLayout == 1) { | 
|---|
|  |  |  | if (!result.canPlace) { | 
|---|
|  |  |  | //调用自动排版 | 
|---|
|  |  |  | this.layoutDiagram() | 
|---|
|  |  |  | 
|---|
|  |  |  | connector: {name: 'rounded'}, | 
|---|
|  |  |  | zIndex: -1 | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | if(this.dataForm.autoLayout){ | 
|---|
|  |  |  | if (this.dataForm.autoLayout == 1) { | 
|---|
|  |  |  | if (!result.canPlace) { | 
|---|
|  |  |  | //调用自动排版 | 
|---|
|  |  |  | this.layoutDiagram() | 
|---|
|  |  |  | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | graphEdge.source = {cell: result.newEndNode.id} | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(this.dataForm.autoLayout){ | 
|---|
|  |  |  | if (this.dataForm.autoLayout == 1) { | 
|---|
|  |  |  | if (!result.canPlace) { | 
|---|
|  |  |  | //调用自动排版 | 
|---|
|  |  |  | this.layoutDiagram() | 
|---|
|  |  |  | 
|---|
|  |  |  | <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> | 
|---|
|  |  |  | 
|---|
|  |  |  | <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-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-form-item> | 
|---|
|  |  |  | <zt-form-item> | 
|---|
|  |  |  | <zt-button @click="getDiagram(null)">查看时序图</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 { | 
|---|
|  |  |  | 
|---|
|  |  |  | getPoint(x,smallWidth){ | 
|---|
|  |  |  | let pointX = Number((x * (this.bigWidth / smallWidth )).toFixed(0)) | 
|---|
|  |  |  | this.graph.setScrollbarPosition(pointX, null) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | 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> | 
|---|