From 4bff52e938ae2c260fe54d32ef680908868bb27e Mon Sep 17 00:00:00 2001 From: wente <329538422@qq.com> Date: 星期五, 07 六月 2024 09:57:10 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- web/packages/components/zt-dict/src/zt-dict.vue | 15 web/src/views/modules/taskReliability/SimulatData.vue | 135 +++- modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/controller/OperatConditModelController.java | 15 web/src/views/modules/taskReliability/OperatConditModel.vue | 154 ++++- web/src/views/modules/taskReliability/RBD-edit-img.vue | 535 ++++++++++++++++-- modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/dao/OperatConditModelDao.java | 8 modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/OperatConditModelService.java | 36 + modules/mainPart/src/main/resources/mapper/taskReliability/ModelRbdDao.xml | 2 web/packages/components/zt-dict-tag/src/zt-dict-tag.vue | 27 modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/controller/XhProductModelController.java | 2 modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/model/ModelRbdNode.java | 37 + web/packages/components/zt-table-column-dict/src/zt-table-column-dict.vue | 8 modules/mainPart/src/main/java/com/zt/life/modules/mainPart/sysPictureBase/controller/SysPictureBaseController.java | 18 modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/ModelRbdNodeService.java | 52 + modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/dao/ModelRbdNodeDao.java | 16 modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/model/ModelNodes.java | 22 web/src/views/modules/taskReliability/ConfigNode/configNode.vue | 359 ++++++++++++ modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/model/OperatConditModel.java | 7 modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/model/ProductImg.java | 4 modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/controller/ModelLineController.java | 7 modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/model/ModelRbd.java | 4 web/src/views/modules/taskReliability/TaskPhase-AddOrUpdate.vue | 4 web/src/views/modules/taskReliability/TaskPhase.vue | 4 modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/dao/XhProductModelDao.java | 2 modules/mainPart/src/main/resources/mapper/taskReliability/OperatConditModelDao.xml | 26 modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/service/XhProductModelService.java | 4 web/src/views/modules/sysPictureBase/SysPictureBase.vue | 18 modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/ModelLineService.java | 1 web/src/views/modules/taskReliability/ConfigEdge/configEdge.vue | 2 modules/mainPart/src/main/resources/mapper/sysPictureBase/SysPictureBaseDao.xml | 6 web/src/views/modules/sysPictureBase/SysPictureBase-AddOrUpdate.vue | 40 modules/mainPart/src/main/resources/mapper/basicInfo/XhProductModelDao.xml | 28 web/src/views/modules/taskReliability/SimulatAssess.vue | 29 web/src/views/modules/taskReliability/SimulatCurve.vue | 14 34 files changed, 1,415 insertions(+), 226 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 5f5a1ca..989116c 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 @@ -68,9 +68,7 @@ @GetMapping("getProduct") public Result<List<ProductImg>> getProduct(Long productId) { - List<ProductImg> list = xhProductModelService.getProduct(productId); - return Result.ok(list); } diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/dao/XhProductModelDao.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/dao/XhProductModelDao.java index 44c197e..7fa7505 100644 --- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/dao/XhProductModelDao.java +++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/dao/XhProductModelDao.java @@ -26,7 +26,7 @@ List<XhProductModel> getProductList(); - List<ProductImg> getProduct(Long productId); + List<ProductImg> getProduct(Long productId, Long parentId); List<XhProductModel> getTaskProductList(); XhProductModel getById(Long id); diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/model/ProductImg.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/model/ProductImg.java index 5214b23..29b8691 100644 --- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/model/ProductImg.java +++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/model/ProductImg.java @@ -43,7 +43,7 @@ private String productType; @TableField(exist = false) - private Integer reliabDistribType; + private int reliabDistribType; @TableField(exist = false) private String taskMtbcf; @TableField(exist = false) @@ -55,7 +55,7 @@ @TableField(exist = false) private Integer isRepair; @TableField(exist = false) - private Integer repairDistribType; + private int repairDistribType; @TableField(exist = false) private String RepairMttcr; @TableField(exist = false) diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/service/XhProductModelService.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/service/XhProductModelService.java index 96dd7ce..5bb44b6 100644 --- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/service/XhProductModelService.java +++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/service/XhProductModelService.java @@ -68,7 +68,9 @@ } public List<ProductImg> getProduct(Long productId) { - return baseDao.getProduct(productId); + XhProductModel model =this.get(productId); + Long parentId = model.getPid(); + return baseDao.getProduct(productId,parentId); } public List<XhProductModel> getTaskProductList() { diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/sysPictureBase/controller/SysPictureBaseController.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/sysPictureBase/controller/SysPictureBaseController.java index 6bc2ac5..29551dc 100644 --- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/sysPictureBase/controller/SysPictureBaseController.java +++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/sysPictureBase/controller/SysPictureBaseController.java @@ -73,16 +73,9 @@ } else { sysPictureBaseService.insert(sysPictureBase); } - if (sysPictureBase.getIsDefault()==1){ - if (sysPictureBase.getId()==null){ - sysPictureBaseService.updateByDefault(sysPictureBase.getId(),sysPictureBase.getProductType()); - sysPictureBaseService.updateProdeuctImg(sysPictureBase.getId(),sysPictureBase.getProductType(),null); - }else{ - if (!sysPictureBase.getId().equals(sysPictureBase.getId())){ - sysPictureBaseService.updateByDefault(sysPictureBase.getId(),sysPictureBase.getProductType()); - sysPictureBaseService.updateProdeuctImg(sysPictureBase.getId(),sysPictureBase.getProductType(),sysPictureBase.getId()); - } - } + if (sysPictureBase.getIsDefault() == 1) { + sysPictureBaseService.updateByDefault(sysPictureBase.getId(), sysPictureBase.getProductType()); + sysPictureBaseService.updateProdeuctImg(sysPictureBase.getId(), sysPictureBase.getProductType(), null); } return Result.ok(); } @@ -111,7 +104,7 @@ //鍏虫祦 outputStream.close(); in.close(); - } catch (IOException e) { + } catch (IOException e) { e.printStackTrace(); } } @@ -126,7 +119,7 @@ response.getWriter().flush(); response.getWriter().close(); - } catch (IOException e) { + } catch (IOException e) { e.printStackTrace(); } } @@ -136,6 +129,7 @@ SysPictureBase data = sysPictureBaseService.getDefaultImg(productType); return Result.ok(data); } + @DeleteMapping @ApiOperation("鍒犻櫎") @LogOperation("鍒犻櫎") diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/controller/ModelLineController.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/controller/ModelLineController.java index f305c0a..9c43647 100644 --- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/controller/ModelLineController.java +++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/controller/ModelLineController.java @@ -16,6 +16,7 @@ import com.zt.life.modules.mainPart.taskReliability.model.ModelLine; import com.zt.life.modules.mainPart.taskReliability.model.ModelRbd; import com.zt.life.modules.mainPart.taskReliability.service.ModelLineService; +import com.zt.life.modules.mainPart.taskReliability.service.ModelRbdNodeService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; @@ -42,6 +43,9 @@ @Autowired private ModelLineService modelLineService; + + @Autowired + private ModelRbdNodeService modelRbdNodeService; @Autowired private PythonLib pythonLib; @@ -102,8 +106,8 @@ ValidatorUtils.validateEntity(modelRbd, AddGroup.class, DefaultGroup.class); modelRbd.setContent(modelRbd.getContent().replace(modelRbd.getUrlPref(), URL_REPLACE_STR)); modelRbd.setContent(modelRbd.getContent().replaceAll(TOKEN_REPLACE_REGEX, TOKEN_REPLACE_STR)); + modelRbdNodeService.saveNodeArr(modelRbd); modelLineService.insert(modelRbd); - return Result.ok(); } @@ -115,6 +119,7 @@ ValidatorUtils.validateEntity(modelRbd, UpdateGroup.class, DefaultGroup.class); modelRbd.setContent(modelRbd.getContent().replace(modelRbd.getUrlPref(), URL_REPLACE_STR)); modelRbd.setContent(modelRbd.getContent().replaceAll(TOKEN_REPLACE_REGEX, TOKEN_REPLACE_STR)); + modelRbdNodeService.saveNodeArr(modelRbd); modelLineService.update(modelRbd); return Result.ok(); diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/controller/OperatConditModelController.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/controller/OperatConditModelController.java index 8db79eb..506f016 100644 --- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/controller/OperatConditModelController.java +++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/controller/OperatConditModelController.java @@ -12,6 +12,7 @@ import com.zt.common.validator.group.AddGroup; import com.zt.common.validator.group.DefaultGroup; import com.zt.common.validator.group.UpdateGroup; +import com.zt.life.modules.mainPart.taskReliability.model.ModelNodes; import com.zt.life.modules.mainPart.taskReliability.model.OperatConditModel; import com.zt.life.modules.mainPart.taskReliability.service.OperatConditModelService; import io.swagger.annotations.Api; @@ -24,6 +25,7 @@ import javax.servlet.http.HttpServletResponse; import java.util.List; +import java.util.Map; /** @@ -52,11 +54,17 @@ return Result.ok(operatConditModelService.page(queryFilter)); } + @GetMapping("getModelNodes") + @ApiOperation("妯″瀷") + public Result<Map> getModelNodes(Long shipId) { + Map data = operatConditModelService.getModelNodes(shipId); + return Result.ok(data); + } + @GetMapping("{id}") @ApiOperation("淇℃伅") public Result<OperatConditModel> get(@PathVariable("id") Long id){ OperatConditModel data = operatConditModelService.get(id); - return Result.ok(data); } @@ -65,9 +73,8 @@ @LogOperation("鏂板") public Result insert(@RequestBody OperatConditModel operatConditModel){ //鏁堥獙鏁版嵁 - ValidatorUtils.validateEntity(operatConditModel, AddGroup.class, DefaultGroup.class); - operatConditModelService.insert(operatConditModel); - + //ValidatorUtils.validateEntity(operatConditModel, AddGroup.class, DefaultGroup.class); + operatConditModelService.save(operatConditModel); return Result.ok(); } diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/dao/ModelRbdNodeDao.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/dao/ModelRbdNodeDao.java new file mode 100644 index 0000000..d7f6811 --- /dev/null +++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/dao/ModelRbdNodeDao.java @@ -0,0 +1,16 @@ +package com.zt.life.modules.mainPart.taskReliability.dao; + +import com.zt.common.dao.BaseDao; +import com.zt.life.modules.mainPart.taskReliability.model.ModelRbdNode; +import org.apache.ibatis.annotations.Mapper; + +/** + * model_line + * + * @author zt generator + * @since 1.0.0 2024-02-28 + */ +@Mapper +public interface ModelRbdNodeDao extends BaseDao<ModelRbdNode> { + +} diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/dao/OperatConditModelDao.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/dao/OperatConditModelDao.java index b335a79..0ccc3be 100644 --- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/dao/OperatConditModelDao.java +++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/dao/OperatConditModelDao.java @@ -1,7 +1,10 @@ package com.zt.life.modules.mainPart.taskReliability.dao; import com.zt.common.dao.BaseDao; +import com.zt.life.modules.mainPart.taskReliability.model.ModelNodes; +import com.zt.life.modules.mainPart.taskReliability.model.ModelRbd; import com.zt.life.modules.mainPart.taskReliability.model.OperatConditModel; +import org.apache.ibatis.annotations.MapKey; import org.apache.ibatis.annotations.Mapper; @@ -20,4 +23,9 @@ List<OperatConditModel> getList(Map<String, Object> params); + List<ModelRbd> getModelList(Long productId); + + List<ModelNodes> getModelNodes(Long shipId); + + void deleteByOperatConditId(Long operatConditId); } diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/model/ModelNodes.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/model/ModelNodes.java new file mode 100644 index 0000000..abaa620 --- /dev/null +++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/model/ModelNodes.java @@ -0,0 +1,22 @@ +package com.zt.life.modules.mainPart.taskReliability.model; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.zt.common.entity.BusiEntity; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * model_rbd + * + * @author zt generator + * @since 1.0.0 2024-03-10 + */ +@Data +public class ModelNodes extends BusiEntity { + @ApiModelProperty(value = "") + private Long modelId; + + private String nodeIds; +} 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 65c489d..0d68d40 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,10 @@ @ApiModelProperty(value = "") private Long productId; + @TableField(exist = false) + @ApiModelProperty(value = "") + private Long[] nodeArr; + @ApiModelProperty(value = "") private String content; diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/model/ModelRbdNode.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/model/ModelRbdNode.java new file mode 100644 index 0000000..65d22ff --- /dev/null +++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/model/ModelRbdNode.java @@ -0,0 +1,37 @@ +package com.zt.life.modules.mainPart.taskReliability.model; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.zt.common.entity.BusiEntity; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * model_rbd + * + * @author zt generator + * @since 1.0.0 2024-03-10 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("model_rbd_node") +public class ModelRbdNode extends BusiEntity { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "") + private Long pid; + + @ApiModelProperty(value = "") + private Long productId; + + @ApiModelProperty(value = "") + private Long modelId; + + @ApiModelProperty(value = "") + private Long nodeId; + + @ApiModelProperty(value = "澶囨敞") + private String remark; + +} diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/model/OperatConditModel.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/model/OperatConditModel.java index 9cf3d4e..1ff22cb 100644 --- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/model/OperatConditModel.java +++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/model/OperatConditModel.java @@ -2,6 +2,7 @@ import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; +import com.zt.common.constant.Constant; import com.zt.common.entity.BusiEntity; import com.zt.common.entity.TreeNode; import io.swagger.annotations.ApiModel; @@ -50,6 +51,12 @@ @TableField(exist = false) private List<OperatConditModel> children = new ArrayList<>(); + @ApiModelProperty(value = "瀵瑰簲妯″瀷鍒楄〃") + @TableField(exist = false) + private List<ModelRbd> modelList = new ArrayList<>(); + + private Integer isDisabled; + @TableField(exist = false) private Long pid; diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/ModelLineService.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/ModelLineService.java index 24ca30a..65cdecd 100644 --- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/ModelLineService.java +++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/ModelLineService.java @@ -89,6 +89,7 @@ modelRbdDao.insert(modelRbd); } + @Transactional(rollbackFor = Exception.class) public void update(ModelRbd modelRbd) { if (modelRbd==null) return; diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/ModelRbdNodeService.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/ModelRbdNodeService.java new file mode 100644 index 0000000..52f4b0e --- /dev/null +++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/ModelRbdNodeService.java @@ -0,0 +1,52 @@ +package com.zt.life.modules.mainPart.taskReliability.service; + +import cn.hutool.json.JSONArray; +import cn.hutool.json.JSONObject; +import com.zt.common.db.query.QueryFilter; +import com.zt.common.service.BaseService; +import com.zt.common.utils.JsonUtils2; +import com.zt.common.utils.UUIDUtil; +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 com.zt.life.modules.mainPart.basicInfo.model.ProductImg; +import com.zt.life.modules.mainPart.basicInfo.model.XhProductModel; +import com.zt.life.modules.mainPart.taskReliability.dao.*; +import com.zt.life.modules.mainPart.taskReliability.dto.ModelLinePair; +import com.zt.life.modules.mainPart.taskReliability.model.*; +import org.apache.commons.lang3.StringUtils; +import org.dom4j.Document; +import org.dom4j.DocumentHelper; +import org.dom4j.Element; +import org.dom4j.io.OutputFormat; +import org.dom4j.io.XMLWriter; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.io.StringWriter; +import java.util.*; +import java.util.stream.Collectors; + + +/** + * model_line + * + * @author zt generator + * @since 1.0.0 2024-02-28 + */ +@Service +public class ModelRbdNodeService extends BaseService<ModelRbdNodeDao, ModelRbdNode> { + public void saveNodeArr(ModelRbd modelRbd) { +// + ModelRbdNode node = new ModelRbdNode(); + node.setProductId(modelRbd.getProductId()); + node.setModelId(modelRbd.getId()); + Long[] nodeArr = modelRbd.getNodeArr(); + for(Long nodeId :nodeArr){ + node.setId(UUIDUtil.generateId()); + node.setNodeId(nodeId); + baseDao.insert(node); + } + } +} diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/OperatConditModelService.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/OperatConditModelService.java index 4c96615..06eda77 100644 --- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/OperatConditModelService.java +++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/OperatConditModelService.java @@ -1,23 +1,29 @@ package com.zt.life.modules.mainPart.taskReliability.service; +import com.alibaba.fastjson.JSON; import com.zt.common.service.BaseService; import com.zt.common.utils.TreeUtils; import com.zt.life.modules.mainPart.taskReliability.dao.OperatConditModelDao; +import com.zt.life.modules.mainPart.taskReliability.model.ModelNodes; +import com.zt.life.modules.mainPart.taskReliability.model.ModelRbd; import com.zt.life.modules.mainPart.taskReliability.model.OperatConditModel; import org.springframework.stereotype.Service; import com.zt.common.db.query.QueryFilter; + import javax.annotation.Resource; +import java.util.HashMap; import java.util.List; +import java.util.Map; /** * operat_condit_model * - * @author zt generator + * @author zt generator * @since 1.0.0 2024-03-29 */ @Service -public class OperatConditModelService extends BaseService<OperatConditModelDao, OperatConditModel> { +public class OperatConditModelService extends BaseService<OperatConditModelDao, OperatConditModel> { /** * 鍒嗛〉鏌ヨ @@ -27,7 +33,22 @@ */ public List<OperatConditModel> page(QueryFilter queryFilter) { List<OperatConditModel> list = baseDao.getList(queryFilter.getQueryParams()); + for (OperatConditModel conditModel : list) { + List<ModelRbd> modelList = baseDao.getModelList(conditModel.getId()); + conditModel.setModelList(modelList); + } return TreeUtils.build(list); + } + + + public Map getModelNodes(Long shipId) { + List<ModelNodes> list = baseDao.getModelNodes(shipId); + Map<String, String> map = new HashMap<>(); + for (ModelNodes node : list) { + map.put(node.getModelId().toString(), node.getNodeIds()); + } + //String json= JSON.toJSONString(map); + return map; } /** @@ -39,4 +60,15 @@ super.deleteLogic(ids); } + public void save(OperatConditModel parent) { + Long operatConditId = parent.getOperatConditId(); + baseDao.deleteByOperatConditId(operatConditId); + this.saveIteration(parent); + } + public void saveIteration(OperatConditModel parent) { + baseDao.insert(parent); + for (OperatConditModel sub : parent.getChildren()) { + this.saveIteration(sub); + } + } } diff --git a/modules/mainPart/src/main/resources/mapper/basicInfo/XhProductModelDao.xml b/modules/mainPart/src/main/resources/mapper/basicInfo/XhProductModelDao.xml index 9dbaf1e..17a7338 100644 --- a/modules/mainPart/src/main/resources/mapper/basicInfo/XhProductModelDao.xml +++ b/modules/mainPart/src/main/resources/mapper/basicInfo/XhProductModelDao.xml @@ -32,7 +32,7 @@ <if test="pid==null"> and pid is null </if> - and product_type =${productType} + and product_type =${productType} </where> Group by product_type </select> @@ -68,6 +68,32 @@ AND ((a.PID = ${productId}) or (a.PID in (select pid from product_model where id = ${productId} and product_type = 10) and a.product_type <> 10)) + and a.id not in ( + select node_id + from model_rbd_node + where product_id in ( + select pid + from product_model + where id = ${productId} + and is_delete = 0 + union + select id + from product_model + where is_delete = 0 + and pid = ${parentId} + and id <> ${productId} + ) + union + select node_id + from model_rbd_node + where product_id in ( + select id + from product_model + where is_delete = 0 and pid = ${productId} + ) + ) + + </select> <select id="getTaskProductList" resultType="com.zt.life.modules.mainPart.basicInfo.model.XhProductModel"> diff --git a/modules/mainPart/src/main/resources/mapper/sysPictureBase/SysPictureBaseDao.xml b/modules/mainPart/src/main/resources/mapper/sysPictureBase/SysPictureBaseDao.xml index 84fa2fc..674c05e 100644 --- a/modules/mainPart/src/main/resources/mapper/sysPictureBase/SysPictureBaseDao.xml +++ b/modules/mainPart/src/main/resources/mapper/sysPictureBase/SysPictureBaseDao.xml @@ -5,7 +5,7 @@ <update id="updateByDefault"> update sys_picture_base set is_default=2 - where id != ${id} + where id <> ${id} and product_type = ${productType} and is_delete = 0 </update> @@ -39,9 +39,7 @@ and ${whereSql} </if> </where> - <if test="orderBySql!=null"> - ORDER BY ${orderBySql} - </if> + ORDER BY is_default,product_type,id </select> <select id="getDefaultImg" resultType="com.zt.life.modules.mainPart.sysPictureBase.model.SysPictureBase"> select a.name, a.id diff --git a/modules/mainPart/src/main/resources/mapper/taskReliability/ModelRbdDao.xml b/modules/mainPart/src/main/resources/mapper/taskReliability/ModelRbdDao.xml index b8917aa..63fc4fa 100644 --- a/modules/mainPart/src/main/resources/mapper/taskReliability/ModelRbdDao.xml +++ b/modules/mainPart/src/main/resources/mapper/taskReliability/ModelRbdDao.xml @@ -13,7 +13,7 @@ from model_rbd a left join (select model_id,1 as end from algorithm where model_type = 'end' and is_delete=0 ) b on b.model_id = a.id - left join (select model_id, count(1) as num from algorithm where is_delete=0 group by model_id ) c on c.model_id + left join (select id, count(1) as num from model_rbd where is_delete=0 group by id ) c on c.id = a.id left join (select model_id,count(1) as num from operat_condit_model where is_delete=0 group by model_id ) d on d.model_id = a.id diff --git a/modules/mainPart/src/main/resources/mapper/taskReliability/OperatConditModelDao.xml b/modules/mainPart/src/main/resources/mapper/taskReliability/OperatConditModelDao.xml index 670531e..e6bc4e2 100644 --- a/modules/mainPart/src/main/resources/mapper/taskReliability/OperatConditModelDao.xml +++ b/modules/mainPart/src/main/resources/mapper/taskReliability/OperatConditModelDao.xml @@ -2,14 +2,21 @@ <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.zt.life.modules.mainPart.taskReliability.dao.OperatConditModelDao"> + <delete id="deleteByOperatConditId"> + delete + from operat_condit_model + where operat_condit_id = ${operatConditId} + </delete> <select id="getList" resultType="com.zt.life.modules.mainPart.taskReliability.model.OperatConditModel"> - SELECT a.id , - a.pid , - a.`NAME` as product, + SELECT a.id, + a.pid, + a.`NAME` as product, c.model_name, + a.id as product_id, b.model_id, - b.id as operatConditModelId + case when b.is_disabled is null or b.is_disabled = 1 then 1 else 0 end as is_disabled, + ${operatConditId} as operatConditId FROM product_model a LEFT JOIN operat_condit_model b ON b.product_id = a.id @@ -32,5 +39,16 @@ and a.product_type in (4, 3, 2, 10) AND a.is_delete = 0 </select> + <select id="getModelList" resultType="com.zt.life.modules.mainPart.taskReliability.model.ModelRbd"> + select * + from model_rbd + where product_id = ${productId} + and is_delete = 0 + </select> + <select id="getModelNodes" resultType="com.zt.life.modules.mainPart.taskReliability.model.ModelNodes"> + SELECT model_id, GROUP_CONCAT(node_id) as nodeIds + FROM `model_rbd_node` + group by model_id + </select> </mapper> diff --git a/web/packages/components/zt-dict-tag/src/zt-dict-tag.vue b/web/packages/components/zt-dict-tag/src/zt-dict-tag.vue index a294a2c..2515d69 100644 --- a/web/packages/components/zt-dict-tag/src/zt-dict-tag.vue +++ b/web/packages/components/zt-dict-tag/src/zt-dict-tag.vue @@ -1,5 +1,5 @@ <template> - <el-tag :color="tagColor" v-if="$store.getters.getDictLabel(dict, value)!=null" :type="tagType" :size="size" :effect="effect" :hit="hit">{{$store.getters.getDictLabel(dict, value)}} + <el-tag :color="tagColor" :type="tagType" :size="size" :effect="effect" :hit="hit">{{dictLabel}} </el-tag> </template> <script> @@ -9,6 +9,12 @@ dict: { // 瀛楀吀绫诲瀷 type: String, required: true + }, + additional: {// 娣诲姞鐨� + type: Array, + default: function () { + return [] + } }, value: [String, Number, Boolean], typeS: String, @@ -33,11 +39,24 @@ return { tagType: 'primary', tagColor: '', - colorArr:['primary','success','info','warning','danger'] + colorArr: ['primary', 'success', 'info', 'warning', 'danger'] } }, mounted() { this.init() + }, + computed: { + dictLabel() { + let result = this.$store.getters.getDictLabel(this.dict, this.value) + if ("" + result == "" + this.value) { + for (let item of this.additional) { + if (item.dictValue == "" + this.value) { + result = item.dictLabel + } + } + } + return result + } }, methods: { async init() { @@ -61,8 +80,8 @@ if (!this.typeS && !this.typeI && !this.typeW && !this.typeD && !this.typeColor) { // 娌℃湁鎸囧畾棰滆壊 if (this.value === false || this.value === 0 || this.value === '0' || this.value === 'false') { this.tagType = 'primary' - }else{ - this.tagType = this.colorArr[this.value%5] + } else { + this.tagType = this.colorArr[this.value % 5] } } } diff --git a/web/packages/components/zt-dict/src/zt-dict.vue b/web/packages/components/zt-dict/src/zt-dict.vue index e943ef1..a9946bb 100644 --- a/web/packages/components/zt-dict/src/zt-dict.vue +++ b/web/packages/components/zt-dict/src/zt-dict.vue @@ -1,6 +1,6 @@ <template> <div> - <el-select :value="dictValue" @change="changeProjectMajor" @input="$emit('input', $event)" :placeholder="placeholder" clearable style="width: 100%;" v-if="showType === 'select'" :disabled="disabled"> + <el-select v-if="showType === 'select'" :value="dictValue" @change="changeProjectMajor" @input="$emit('input', $event)" :placeholder="placeholder" clearable style="width: 100%;" :disabled="disabled"> <el-option :label="data.dictLabel" v-for="data in dicts" :key="data.dictValue" :value ="data.dictValue">{{data.dictLabel}}</el-option> </el-select> <div v-if="showType === 'radio'"> @@ -9,7 +9,7 @@ <el-input class="radio-input" v-if="isOtherOptionSelected" v-model="inputName"></el-input> </el-radio-group> </div> - <zt-combo-tree v-model="dictValue" :datas="dictTrees" :disabled-filter="disabledFilter" @input="$emit('input', $event)" v-if="showType === 'tree'" :placeholder="placeholder"/> + <zt-combo-tree v-if="showType === 'tree'" v-model="dictValue" :datas="dictTrees" :disabled-filter="disabledFilter" @input="$emit('input', $event)" :placeholder="placeholder"/> </div> </template> <script> @@ -26,6 +26,12 @@ required: true }, excluded: {// 鎺掗櫎鐨� + type: Array, + default: function () { + return [] + } + }, + additional: {// 娣诲姞鐨� type: Array, default: function () { return [] @@ -73,10 +79,9 @@ if (this.excluded.length > 0) { let excludedArray = [] this.excluded.forEach(value => excludedArray.push(value + '')) - return dicts.filter(option => excludedArray.indexOf(option.dictValue + '') < 0) - } else { - return dicts + dicts = dicts.filter(option => excludedArray.indexOf(option.dictValue + '') < 0) } + return dicts.concat(this.additional); } }, watch: { diff --git a/web/packages/components/zt-table-column-dict/src/zt-table-column-dict.vue b/web/packages/components/zt-table-column-dict/src/zt-table-column-dict.vue index a2f0baf..44ef798 100644 --- a/web/packages/components/zt-table-column-dict/src/zt-table-column-dict.vue +++ b/web/packages/components/zt-table-column-dict/src/zt-table-column-dict.vue @@ -1,6 +1,6 @@ <template> <el-table-column :label="label" :key="keys" header-align="center" align="center" :width="width" v-slot="{ row }"> - <zt-dict-tag :dict="dict" :value="row[prop]" :typeS="typeS" :typeI="typeI" :typeW="typeW" :typeD="typeD" :typeColor="typeColor" :size="size" :effect="effect" :hit="hit"/> + <zt-dict-tag :dict="dict" :additional=additional :value="row[prop]" :typeS="typeS" :typeI="typeI" :typeW="typeW" :typeD="typeD" :typeColor="typeColor" :size="size" :effect="effect" :hit="hit"/> </el-table-column> </template> <script> @@ -10,6 +10,12 @@ keys:{ type:String }, + additional: {// 娣诲姞鐨� + type: Array, + default: function () { + return [] + } + }, label: String, width: { type: String, diff --git a/web/src/views/modules/sysPictureBase/SysPictureBase-AddOrUpdate.vue b/web/src/views/modules/sysPictureBase/SysPictureBase-AddOrUpdate.vue index 671bf72..dbaf9aa 100644 --- a/web/src/views/modules/sysPictureBase/SysPictureBase-AddOrUpdate.vue +++ b/web/src/views/modules/sysPictureBase/SysPictureBase-AddOrUpdate.vue @@ -5,7 +5,7 @@ <el-input v-model="dataForm.name"></el-input> </zt-form-item> <zt-form-item label="浜у搧绫诲瀷" prop="productType" rules="required"> - <zt-dict v-model="dataForm.productType" dict="product"></zt-dict> + <zt-dict v-model="dataForm.productType" dict="product" :additional=additional></zt-dict> </zt-form-item> <zt-form-item label="鏄惁榛樿" prop="isDefault" rules="required"> <zt-dict v-model="dataForm.isDefault" dict="is_or_not"></zt-dict> @@ -17,14 +17,14 @@ <el-input v-model="dataForm.remark"></el-input> </zt-form-item> <input type="hidden" id="svgContentId" :value="dataForm.svgContent"/> - <zt-form-item> -<!-- <el-upload action="*" :on-change="uploadSvgContent">--> -<!-- <el-button slot="trigger" size="small" type="primary">閫夊彇鏂囦欢</el-button>--> -<!-- </el-upload>--> - <label class="custom-file-upload"> - <input type="file" @change="uploadSvgContent" /> - </label> - </zt-form-item> + <zt-form-item> + <!-- <el-upload action="*" :on-change="uploadSvgContent">--> + <!-- <el-button slot="trigger" size="small" type="primary">閫夊彇鏂囦欢</el-button>--> + <!-- </el-upload>--> + <label class="custom-file-upload"> + <input type="file" @change="uploadSvgContent"/> + </label> + </zt-form-item> </el-form> <iframe :src='SVGEditorUrl' ref="myIframe" width="100%" id="iframe" style="height:calc(100vh - 300px)"> @@ -39,6 +39,7 @@ export default { data() { return { + additional: [{dictValue: '20', dictLabel: '杩愮畻鍥惧厓', remark: ''}], SVGEditorUrl: `/SVGOrigin/Method-Draw-master/editor/index.html`, url: `${window.SITE_CONFIG['apiURL']}/sysPictureBase/getProductImg?token=${Cookies.get('token')}&id=`, fileList: [], @@ -58,14 +59,14 @@ } }, methods: { - async init() { - if (this.dataForm.id) { - let res = await this.$http.get(`/sysPictureBase/${this.dataForm.id}`) + async init(id,row) { + if (id) { + //let res = await this.$http.get(`/sysPictureBase/${this.dataForm.id}`) this.dataForm = { ...this.dataForm, - ...res.data + ...row } - console.log(this.dataForm,'this.dataForm this.dataForm') + console.log(this.dataForm, 'this.dataForm this.dataForm') } }, httpRequest(option) { @@ -103,10 +104,10 @@ async formSubmit() { const iframeWindow = this.$refs.myIframe.contentWindow; this.dataForm.svgContent = iframeWindow.getSVGContentTest() - console.log(this.dataForm.svgContent+'this.dataForm.svgContent') + console.log(this.dataForm.svgContent + 'this.dataForm.svgContent') this.$http.post('/sysPictureBase/save', this.dataForm).then(res => { if (res.success) { - console.log(this.dataForm,'this.dataForm') + console.log(this.dataForm, 'this.dataForm') this.$tip.success() this.$refs.dialog.close() this.$emit('refreshDataList') @@ -117,9 +118,9 @@ async uploadSvgContent(event) { const iframeWindow = this.$refs.myIframe.contentWindow const file = event.target.files[0]; - console.log(file,'file file') + console.log(file, 'file file') // 鍙互鍦ㄨ繖閲岃繘琛岃繘涓�姝ョ殑鏂囦欢澶勭悊锛屾瘮濡傝鍙栨枃浠跺唴瀹圭瓑鎿嶄綔 - if (file && file.type==='image/svg+xml') { + if (file && file.type === 'image/svg+xml') { const reader = new FileReader(); reader.onload = (e) => { const fileContent = e.target.result; @@ -127,7 +128,7 @@ iframeWindow.setSvgContent(fileContent) } reader.readAsText(file); // 浠ユ枃鏈舰寮忚鍙栨枃浠跺唴瀹� - }else { + } else { this.$message({message: '璇烽�夋嫨SVG鍥剧墖', type: 'warning'}) return false; // 鍙栨秷鎿嶄綔 } @@ -151,6 +152,7 @@ cursor: pointer; background-color: #f9f9f9; } + .img-sc > .el-form-item > .el-form-item__content { width: 100%; } diff --git a/web/src/views/modules/sysPictureBase/SysPictureBase.vue b/web/src/views/modules/sysPictureBase/SysPictureBase.vue index b40228d..7914db7 100644 --- a/web/src/views/modules/sysPictureBase/SysPictureBase.vue +++ b/web/src/views/modules/sysPictureBase/SysPictureBase.vue @@ -9,7 +9,7 @@ </el-form-item> <el-form-item> - <zt-dict v-model="dataForm.productType" dict="product" placeholder="璇烽�夋嫨浜у搧绫诲瀷" clearable></zt-dict> + <zt-dict v-model="dataForm.productType" dict="product" :additional=additional placeholder="璇烽�夋嫨浜у搧绫诲瀷" clearable></zt-dict> </el-form-item> <el-form-item> <zt-button type="query" @click="table.query()"/> @@ -29,10 +29,14 @@ </template> </el-table-column> <el-table-column prop="contentType" label="妫�绱㈠叧閿瓧"/> - <el-table-column prop="remark" label="澶囨敞"/> - <zt-table-column-dict prop="productType" label="浜у搧绫诲瀷" dict="product"/> - <zt-table-column-handle :table="table" - delete-perm="sysPictureBase::delete"/> + <zt-table-column-dict prop="productType" label="浜у搧绫诲瀷" dict="product" :additional=additional /> + <zt-table-column-handle :table="table" edit-perm="sysPictureBase::delete" + delete-perm="sysPictureBase::delete"> + <template slot-scope="scope"> + <zt-table-button size="small" type="primary" @click="edit(scope.row)">淇敼 + </zt-table-button> + </template> + </zt-table-column-handle> </el-table> <!-- 寮圭獥, 鏂板 / 淇敼 --> <add-or-update ref="addOrUpdate" @refreshDataList="table.query"/> @@ -47,6 +51,7 @@ export default { data() { return { + additional: [{dictValue: '20', dictLabel: '杩愮畻鍥惧厓', remark: ''}], url: `${window.SITE_CONFIG['apiURL']}/sysPictureBase/getProductImg?token=${Cookies.get('token')}&id=`, dataForm: { contentType: '', @@ -72,6 +77,9 @@ await this.$tip.success() this.$refs.tableObj.query() } + }, + edit(row){ + this.$refs.addOrUpdate.$refs.dialog.init(row.id,row) } } } diff --git a/web/src/views/modules/taskReliability/ConfigEdge/index.vue b/web/src/views/modules/taskReliability/ConfigEdge/configEdge.vue similarity index 99% rename from web/src/views/modules/taskReliability/ConfigEdge/index.vue rename to web/src/views/modules/taskReliability/ConfigEdge/configEdge.vue index 4c43ef7..12d7c46 100644 --- a/web/src/views/modules/taskReliability/ConfigEdge/index.vue +++ b/web/src/views/modules/taskReliability/ConfigEdge/configEdge.vue @@ -60,7 +60,7 @@ <script> import { Edge} from '@antv/x6'; export default { - name: "index", + name: "configEdit", data(){ return{ left_p:document.documentElement.clientHeight*0.9, diff --git a/web/src/views/modules/taskReliability/ConfigNode/configNode.vue b/web/src/views/modules/taskReliability/ConfigNode/configNode.vue new file mode 100644 index 0000000..cbd1bcc --- /dev/null +++ b/web/src/views/modules/taskReliability/ConfigNode/configNode.vue @@ -0,0 +1,359 @@ +<template> + <div ref="" style="position: absolute;top:0;right:0;background:#cccccc;width: 400px;" + :style="'height:'+ left_p + 'px'"> + <el-card style="height: 100%"> + <el-tabs v-model="activeName" id="tabPane"> + <el-tab-pane label="灞炴��" name="first"> + <el-form :model="globalGridAttr"> + <el-form-item v-show="shape!=='custom-circle1'" label="鑺傜偣鍚嶇О" prop="nodeText" label-width="80px"> + <el-input v-model="globalGridAttr.nodeText" style="width:100%" @change="onTextChange"></el-input> + </el-form-item> + <el-form-item v-show="nodeType=='vote' || (nodeType=='node' && showNumberInput)" label="琛ㄥ喅鏁伴噺" prop="voteNum" + label-width="80px"> + <el-input type="number" v-model="globalGridAttr.voteNum" @change="onNumberInputValue" + placeholder="璇疯緭鍏ユ暟瀛�"></el-input> + </el-form-item> + <div v-show="globalGridAttr.productType!=='product_xdy'"> + <el-form-item v-show="nodeType=='node'" label="鍙潬鎬у垎甯冪被鍨�" prop="reliabDistribType" label-width="125px"> + <zt-dict style="width: 100%" v-model="globalGridAttr.reliabDistribType" @input="onReliabDistribType" + dict="ReliabDistribType" placeholder="鍙潬鎬у垎甯冪被鍨�" clearable/> + </el-form-item> + <el-form-item v-show="nodeType=='node'" label="MTBCF" prop="taskMtbcf" label-width="80px"> + <el-input v-model="globalGridAttr.taskMtbcf" @change="onTaskMtbcfChange"></el-input> + </el-form-item> + <el-form-item v-show="nodeType=='node'" label="鍙傛暟2" prop="taskMtbcfOther" label-width="80px"> + <el-input v-model="globalGridAttr.taskMtbcfOther" @change="onTaskMtbcfOtherChange"></el-input> + </el-form-item> + <el-form-item v-show="nodeType=='node'" label="鏄惁鍙淮淇�" prop="isRepair" label-width="100px"> + <el-select style="width: 100%" v-model="globalGridAttr.isRepair" @change="onIsRepairChange"> + <el-option + v-for="item in isRepair" + :key="item.value" + :label="item.label" + :value="item.value"> + </el-option> + </el-select> + </el-form-item> + <div v-show="nodeType=='node' && showRepairInput"> + <el-form-item label="鍙淮淇�у垎甯冪被鍨�" prop="repairDistribType" label-width="140px"> + <zt-dict v-model="globalGridAttr.repairDistribType" dict="RepairDistribType" + @input="onRepairDistribTypeChange" placeholder="缁翠慨鎬у垎甯冪被鍨�" clearable/> + </el-form-item> + <el-form-item label="MTTCR" prop="repairMttcr" label-width="80px"> + <el-input v-model="globalGridAttr.repairMttcr" @change="onRepairMttcrChange"></el-input> + </el-form-item> + <el-form-item label="鍙傛暟2" prop="repairMttcrOther" label-width="80px"> + <el-input v-model="globalGridAttr.repairMttcrOther" @change="onRepairMttcrOtherChange"></el-input> + </el-form-item> + </div> + </div> + </el-form> + </el-tab-pane> + <el-tab-pane label="鏍峰紡" name="second"> + <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-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-col> + </el-row> + </el-tab-pane> + </el-tabs> + </el-card> + </div> +</template> + +<script> + export default { + name: "configNode", + data() { + return { + globalGridAttr: { + nodeText: '', + nodeStroke: '', + nodeStrokeWidth: '', + nodeFill: '', + nodeFontSize: '', + nodeColor: '', + nodeUsers: '', + nodeDate: '', + dataId: '', + inspectName: '', + nodeTypeExt: '', + statusImg: '', + reliabDistribType: '', + repairDistribType: '', + repairMttcr: '', + repairMttcrOther: '', + taskMtbcf: '', + taskMtbcfOther: '', + isRepair: '', + voteNum: 0, + productType: '' + }, + data: { + dataId: '', + finishDate: '', + inspectName: '' + }, + showNumberInput: false, + showRepairInput: false, + isRepair: [ + { + value: 0, + label: '鍚�' + }, { + value: 1, + label: '鏄�' + } + ], + text: '', + dialogVisible: false, + activeName: 'first', + curCel: null, + left_p: document.documentElement.clientHeight * 0.75, + } + }, + components: {}, + props: { + }, + watch: { + }, + mounted() { + }, + methods: { + // 鏀瑰彉瀛椾綋澶у皬 + onFontSizeChange(e) { + let val = e + this.globalGridAttr.nodeFontSize = val + this.curCel.attr('text/fontSize', val) + this.curCel.attr('title/fontSize', val) + }, + // 鏀瑰彉瀛椾綋棰滆壊 + onColorChange(e) { + let val = e + this.globalGridAttr.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) + }, + // 鏀瑰彉鏂囨湰 + onTextChange(e) { + this.text = e + this.curCel.attr('text/text', this.text) + }, + onNodeTypeExtChange(e) { + if (this.globalGridAttr.nodeTypeExt === 'vote') { + this.showNumberInput = true; + } else { + this.showNumberInput = false; + this.globalGridAttr.numberInputValue = ''; + } + this.globalGridAttr.nodeTypeExt = e + let nodeTypeExt = { + nodeTypeExt: this.globalGridAttr.nodeTypeExt + } + this.curCel.setData(nodeTypeExt) + }, + // 琛ㄥ喅鏁伴噺 + onNumberInputValue(e) { + this.globalGridAttr.voteNum = e + let voteNum = { + voteNum: this.globalGridAttr.voteNum + } + this.curCel.setData(voteNum) + }, + // 鍙潬鎬у垎甯冪被鍨� + onReliabDistribType(e) { + this.globalGridAttr.reliabDistribType = e + let reliabDistribType = { + reliabDistribType: this.globalGridAttr.reliabDistribType + } + this.curCel.setData(reliabDistribType) + }, + // mtbf + onTaskMtbcfChange(e) { + const numberRegex = /^-?\d+(\.\d+)?$/ + if (numberRegex.test(e)) { + this.globalGridAttr.taskMtbcf = e + let taskMtbcf = { + taskMtbcf: this.globalGridAttr.taskMtbcf + } + this.curCel.setData(taskMtbcf) + } else { + this.$message.error('杈撳叆鏍煎紡鏈夎锛岃杈撳叆瀹炴暟') + } + }, + // 鍙傛暟2 + onTaskMtbcfOtherChange(e) { + const numberRegex = /^-?\d+(\.\d+)?$/ + console.log(e, 'eeeee') + if (numberRegex.test(e)) { + this.globalGridAttr.taskMtbcfOther = e + let taskMtbcfOther = { + taskMtbcfOther: this.globalGridAttr.taskMtbcfOther + } + this.curCel.setData(taskMtbcfOther) + } else { + this.$message.error('杈撳叆鏍煎紡鏈夎锛岃杈撳叆瀹炴暟') + } + + }, + // 鏄惁鍙淮淇� + onIsRepairChange(e) { + this.showRepairInput = this.globalGridAttr.isRepair === 1; + this.globalGridAttr.isRepair = e + let isRepair = { + isRepair: this.globalGridAttr.isRepair + } + this.curCel.setData(isRepair) + }, + // 鍙淮淇�у垎甯冪被鍨� + onRepairDistribTypeChange(e) { + this.globalGridAttr.repairDistribType = e + let repairDistribType = { + repairDistribType: this.globalGridAttr.repairDistribType + } + this.curCel.setData(repairDistribType) + }, + // Mttcr + onRepairMttcrChange(e) { + const numberRegex = /^-?\d+(\.\d+)?$/ + if (numberRegex.test(e)) { + this.globalGridAttr.repairMttcr = e + let repairMttcr = { + repairMttcr: this.globalGridAttr.repairMttcr + } + this.curCel.setData(repairMttcr) + } else { + this.$message.error('杈撳叆鏍煎紡鏈夎锛岃杈撳叆瀹炴暟') + } + + }, + // 鍙淮淇�у垎甯冪被鍨� 鍙傛暟2 + onRepairMttcrOtherChange(e) { + const numberRegex = /^-?\d+(\.\d+)?$/ + if (numberRegex.test(e)) { + this.globalGridAttr.repairMttcrOther = e + let repairMttcrOther = { + repairMttcrOther: this.globalGridAttr.repairMttcrOther + } + this.curCel.setData(repairMttcrOther) + } else { + this.$message.error('杈撳叆鏍煎紡鏈夎锛岃杈撳叆瀹炴暟') + } + }, + onStatusImgChange(e) { + this.globalGridAttr.statusImg = e + let statusImg = { + statusImg: this.globalGridAttr.statusImg + } + this.curCel.setData(statusImg) + console.log(this.globalGridAttr.statusImg, 'this.globalGridAttr.statusImg') + console.log(this.curCel, 'this.curCel') + console.log(this.curCel.attr, 'this.curCel.attr') + this.curCel.removeTools() + this.curCel.addTools([ + { + name: 'button', + args: { + markup: [ + { + tagName: 'image', + selector: 'icon', + attrs: { + // 'xlink:href': 'https://gw.alipayobjects.com/mdn/rms_43231b/afts/img/A*evDjT5vjkX0AAAAAAAAAAAAAARQnAQ', + 'xlink:href': statusImg.statusImg, + width: 30, + height: 30, + x: 0, + y: 0 + } + } + ] + } + } + ]) + }, + loadData(cell) { + this.curCel = cell + if (cell.id) { + this.nodeType = cell.getData().nodeType + this.showNumberInput = false + this.globalGridAttr.nodeStroke = cell.attr('body/stroke') + this.globalGridAttr.nodeStrokeWidth = cell.attr('body/strokeWidth') + this.globalGridAttr.nodeFill = cell.attr('body/fill') + // globalGridAttr.nodeFontSize = cell.attr('text/fontSize') + // globalGridAttr.nodeFontSize = cell.attr('title/fontSize') + this.globalGridAttr.nodeFontSize = cell.attr('text/fontSize') ? cell.attr('text/fontSize') : cell.attr('title/fontSize') + this.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') + this.globalGridAttr.nodeUsers = cell.attr('approve/users') + this.globalGridAttr.nodeText = cell.attr('text/text') + this.globalGridAttr.nodeDate = cell.attr('title/text') + this.globalGridAttr.dataId = cell.getData().dataId + this.globalGridAttr.inspectName = cell.getData().inspectName + this.globalGridAttr.nodeTypeExt = cell.getData().nodeTypeExt + this.globalGridAttr.statusImg = cell.getData().statusImg + this.globalGridAttr.reliabDistribType = cell.getData().reliabDistribType + this.globalGridAttr.repairDistribType = cell.getData().repairDistribType + this.globalGridAttr.repairMttcr = cell.getData().repairMttcr + this.globalGridAttr.repairMttcrOther = cell.getData().repairMttcrOther + this.globalGridAttr.taskMtbcf = cell.getData().taskMtbcf + this.globalGridAttr.taskMtbcfOther = cell.getData().taskMtbcfOther + this.globalGridAttr.isRepair = cell.getData().isRepair + this.globalGridAttr.voteNum = cell.getData().voteNum + this.globalGridAttr.productType = cell.getData().productType + if (this.nodeType === 'vote' || this.globalGridAttr.nodeTypeExt === 'vote' || (cell.getData().voteNum !== undefined && cell.getData().voteNum !== '')) { + console.log(cell.getData().voteNum, 'cell.getData().voteNum') + this.showNumberInput = true + } + this.showRepairInput = cell.getData().isRepair + cell.removeTools() + cell.addTools([ + { + name: 'button', + args: { + markup: [ + { + tagName: 'image', + selector: 'icon', + attrs: { + // 'xlink:href': 'https://gw.alipayobjects.com/mdn/rms_43231b/afts/img/A*evDjT5vjkX0AAAAAAAAAAAAAARQnAQ', + 'xlink:href': this.globalGridAttr.statusImg, + width: 30, + height: 30, + x: 0, + y: 0 + } + } + ] + } + } + ]) + } + } + } + } +</script> + +<style> + #tabPane .el-tabs__header.is-top .el-tabs__nav-scroll { + width: 100% !important; + } + + #tabPane .el-color-picker__trigger { + width: 100%; + } +</style> diff --git a/web/src/views/modules/taskReliability/OperatConditModel.vue b/web/src/views/modules/taskReliability/OperatConditModel.vue index a974bad..ef311e4 100644 --- a/web/src/views/modules/taskReliability/OperatConditModel.vue +++ b/web/src/views/modules/taskReliability/OperatConditModel.vue @@ -1,56 +1,142 @@ <template> - <div class="mod-taskReliability-operatConditModel}"> - <zt-table-wraper ref="tableObj" :paging='false' defaultNotQuery="true" query-url="/taskReliability/OperatConditModel/page" delete-url="/taskReliability/OperatConditModel/" v-slot="{ table }"> - <el-form :inline="true" :model="dataForm" @keyup.enter.native="table.query()"> - <el-form-item> - </el-form-item> - </el-form> - <el-table v-loading="table.dataLoading" :data="table.dataList" height="100px" - v-adaptive="{bottomOffset:70}" border @selection-change="table.selectionChangeHandle" - row-key="id" - :tree-props="{children: 'children', hasChildren: 'hasChildren'}" - :default-expand-all="true"> - <el-table-column prop="product" label="浜у搧鑺傜偣" width="160"/> - <el-table-column prop="modelName" label="浜у搧妯″瀷"/> - <zt-table-column-handle :table="table" edit-perm="taskReliability:update" - delete-perm="taskReliability::delete" :has-view="false"> - <template v-slot="{ row }"> - <zt-table-button @click="openSelectModel(row)">閫夋嫨妯″瀷</zt-table-button> - </template> - </zt-table-column-handle> - </el-table> - <select-model-rbd ref="SelectModelRbd" ></select-model-rbd> - </zt-table-wraper> - </div> + <div class="mod-taskReliability-operatConditModel}"> + <zt-table-wraper @dataLoaded="dataLoaded" ref="tableObj" :paging='false' defaultNotQuery="true" + query-url="/taskReliability/OperatConditModel/page" + delete-url="/taskReliability/OperatConditModel/" v-slot="{ table }"> + <el-form :inline="true" :model="dataForm" @keyup.enter.native="table.query()"> + <el-form-item> + <el-button v-if="dataForm.productId" type="primary" @click="save()">淇濆瓨</el-button> + </el-form-item> + </el-form> + <el-table v-loading="table.dataLoading" :data="table.dataList" height="100px" + v-adaptive="{bottomOffset:70}" border @selection-change="table.selectionChangeHandle" + row-key="id" + :tree-props="{children: 'children', hasChildren: 'hasChildren'}" + :default-expand-all="true"> + <el-table-column prop="product" label="浜у搧鑺傜偣"/> + <el-table-column prop="modelId" label="浜у搧妯″瀷"> + <template slot-scope="scope"> + <el-select v-model="scope.row.modelId" :disabled="scope.row.isDisabled == 1" placeholder="璇烽�夋嫨" + style="width:100%" @change="modelChanged(scope.row)"> + <el-option on + v-for="item in scope.row.modelList" + :key="item.id" + :label="item.modelName" + :value="item.id" + /> + </el-select> + </template> + </el-table-column> + <el-table-column label="鎿嶄綔" width="100px"> + <template v-slot="{ row }"> + <el-button v-if="row.modelId" type="primary" size="small" @click="drawRBD(row)">鏌ョ湅妯″瀷</el-button> + </template> + </el-table-column> + </el-table> + <el-dialog v-dialogDrag title="妯″瀷璁捐" top="1vh" width='95%' :visible.sync="dialogVisible2" v-if="dialogVisible2"> + <RBDEditImg ref="rbdEditImg"></RBDEditImg> + </el-dialog> + </zt-table-wraper> + </div> </template> <script> - import SelectModelRbd from "./SelectModelRbd"; + import RBDEditImg from './RBD-edit-img' + export default { name: 'OperaConditModel', data() { return { dataForm: { - operatConditId:'', - productId:'', - } + operatConditId: '', + productId: '', + }, + mapModelNodes: {}, + dialogVisible2: false, } }, components: { - SelectModelRbd + RBDEditImg }, - methods:{ + mounted() { + this.getModelNodes() + }, + methods: { init(param) { console.log(param, '') this.dataForm.operatConditId = param.row.id this.dataForm.productId = param.productId this.$refs.tableObj.query() }, - openSelectModel(row) { - console.log(row, 'selectModel'); - if (!row.operatConditId) - row.operatConditId = this.dataForm.operatConditId - this.$refs.SelectModelRbd.$refs.dialog.init(row) + dataLoaded(dataList) { + dataList[0].isDisabled = 0 + if (!dataList[0].modelId && dataList[0].modelList.length == 1) { + console.log(dataList[0].modelList[0].id, ' dataList[0].modelList[0].modelId') + dataList[0].modelId = dataList[0].modelList[0].id + console.log(dataList[0], 'dataLoaded(dataList)') + this.modelChanged(dataList[0]) + } + }, + async save() { + let res = await this.$http.post('/taskReliability/OperatConditModel/', this.$refs.tableObj.dataList[0]) + if (res.success) { + this.$refs.tableObj.query() + } + }, + async getModelNodes() { + let res = await this.$http.get(`/taskReliability/OperatConditModel/getModelNodes?shipId=0`) + console.log(res, 'res taskReliability') + console.log(res.data, 'res.data taskReliability') + if (res.data) { + this.mapModelNodes = res.data + + } + }, + modelChanged(row) { + let modelId = row.modelId + let modelNodes = this.mapModelNodes[modelId] + console.log(modelId, 'modelChanged modelId') + console.log(modelNodes, 'modelChanged modelNodes') + + for (let subRow of row.children) { + if (modelNodes.indexOf(subRow.productId)) { + subRow.isDisabled = 0 + if (subRow.modelList.length == 1) { + subRow.modelId = subRow.modelList[0].id + } else { + //subRow.modelId = null + } + } else { + subRow.isDisabled = 1 + subRow.modelId = null + } + this.nodeIteration(subRow) + } + }, + nodeIteration(parentRow) { + for (let subRow of parentRow.children) { + if (parentRow.modelId) { + subRow.isDisabled = 0 + if (subRow.modelList.length == 1) { + subRow.modelId = subRow.modelList[0].id + } + } else { + subRow.isDisabled = 1 + subRow.modelId = null + } + this.nodeIteration(subRow) + } + }, + drawRBD(row) { + this.dialogVisible2 = true + let param = { + id: row.modelId, + model: row.modelName, + productId: row.productId + } + this.$nextTick(() => { + this.$refs.rbdEditImg.init(param) + }) } } } diff --git a/web/src/views/modules/taskReliability/RBD-edit-img.vue b/web/src/views/modules/taskReliability/RBD-edit-img.vue index a236bc2..bc9afcc 100644 --- a/web/src/views/modules/taskReliability/RBD-edit-img.vue +++ b/web/src/views/modules/taskReliability/RBD-edit-img.vue @@ -48,12 +48,8 @@ <div id="containerImg" style="border: 1px solid #EAEBEE;border-radius: 6px; box-shadow: 0 2px 12px 0 rgb(0 0 0 / 10%);height: 100%"> </div> - <config-node v-show="type === 'node'" :id="id" :diagramId="diagramId" :globalGridAttr="globalGridAttr" - :graph="graph" - :nodeType="nodeType" - :projectId="projectId" - :shape="shape"/> - <config-edge v-show="type === 'edge'" :id="id" :globalGridAttr="globalGridAttr" :graph="graph"/> + <config-node ref="configNode" v-show="type === 'node'"/> + <config-edge ref="configEdge" v-show="type === 'edge'"/> </div> </el-col> </el-row> @@ -62,19 +58,15 @@ <script> import {Graph, Shape, Addon, Cell} from '@antv/x6' - import ConfigNode from './ConfigNode/index.vue' - import ConfigEdge from './ConfigEdge/index.vue' - import {removeCurrentTabHandle} from '@/commonJS/common' + import ConfigNode from './ConfigNode/configNode.vue' + import ConfigEdge from './ConfigEdge/configEdge.vue' import {setHartBeat} from '@/commonJS/common'; import Cookies from 'js-cookie' import {getUUID} from '../../../../packages/utils' - import RBDDefault from './RBD-default.json' + // import RBDDefault from './RBD-default.json' export default { name: 'RBD-edit-img', - /*props: { - - },*/ props: { projectId: { type: String @@ -94,6 +86,425 @@ ConfigNode, ConfigEdge }, + computed: { + RBDDefault() { + let url = `${window.SITE_CONFIG['apiURL']}/sysPictureBase/getSvgImage?token=${Cookies.get('token')}&id=` + let result = ` + { + "cells": + [ + { + "position": { + "x": -600, + "y": 0 + }, + "size": { + "width": 60, + "height": 60 + }, + "attrs": { + "text": { + "refY": "100%", + "textVerticalAnchor": "top", + "text": "start", + "refY2": 4 + }, + "image": { + "xlink:href": "${url}10011" + } + }, + "visible": true, + "shape": "image", + "id": "10000", + "data": { + "type": "imageNodes", + "endNodeId": "20000", + "dataId": "", + "nodeType": "start", + "nodeTypeExt": "", + "voteNum": "" + }, + "ports": { + "groups": { + "top": { + "position": { + "name": "top" + }, + "attrs": { + "circle": { + "r": 4, + "magnet": true, + "stroke": "#5F95FF", + "strokeWidth": 1, + "fill": "#fff", + "style": { + "visibility": "hidden" + } + } + } + }, + "right": { + "position": { + "name": "right" + }, + "attrs": { + "circle": { + "r": 4, + "magnet": true, + "stroke": "#5F95FF", + "strokeWidth": 1, + "fill": "#fff", + "style": { + "visibility": "hidden" + } + } + } + }, + "bottom": { + "position": { + "name": "bottom" + }, + "attrs": { + "circle": { + "r": 4, + "magnet": true, + "stroke": "#5F95FF", + "strokeWidth": 1, + "fill": "#fff", + "style": { + "visibility": "hidden" + } + } + } + }, + "left": { + "position": { + "name": "left" + }, + "attrs": { + "circle": { + "r": 4, + "magnet": true, + "stroke": "#5F95FF", + "strokeWidth": 1, + "fill": "#fff", + "style": { + "visibility": "hidden" + } + } + } + } + }, + "items": [ + { + "id": "top1", + "group": "top" + }, + { + "id": "right1", + "group": "right" + }, + { + "id": "bottom1", + "group": "bottom" + }, + { + "id": "left1", + "group": "left" + } + ] + }, + "zIndex": 1 + }, + { + "position": { + "x": 0, + "y": 0 + }, + "size": { + "width": 100, + "height": 60 + }, + "attrs": { + "text": { + "refY": "100%", + "textVerticalAnchor": "top", + "text": "dashedBox", + "refY2": 4 + }, + "image": { + "xlink:href": "${url}10015" + } + }, + "visible": true, + "shape": "image", + "id": 15000, + "data": { + "type": "imageNodes", + "dataId": "", + "nodeType": "dashedBox", + "nodeTypeExt": "", + "voteNum": "" + }, + "ports": { + "groups": { + "top": { + "position": { + "name": "top" + }, + "attrs": { + "circle": { + "r": 4, + "magnet": true, + "stroke": "#5F95FF", + "strokeWidth": 1, + "fill": "#fff", + "style": { + "visibility": "hidden" + } + } + } + }, + "right": { + "position": { + "name": "right" + }, + "attrs": { + "circle": { + "r": 4, + "magnet": true, + "stroke": "#5F95FF", + "strokeWidth": 1, + "fill": "#fff", + "style": { + "visibility": "hidden" + } + } + } + }, + "bottom": { + "position": { + "name": "bottom" + }, + "attrs": { + "circle": { + "r": 4, + "magnet": true, + "stroke": "#5F95FF", + "strokeWidth": 1, + "fill": "#fff", + "style": { + "visibility": "hidden" + } + } + } + }, + "left": { + "position": { + "name": "left" + }, + "attrs": { + "circle": { + "r": 4, + "magnet": true, + "stroke": "#5F95FF", + "strokeWidth": 1, + "fill": "#fff", + "style": { + "visibility": "hidden" + } + } + } + } + }, + "items": [ + { + "id": "top1", + "group": "top" + }, + { + "id": "right1", + "group": "right" + }, + { + "id": "bottom1", + "group": "bottom" + }, + { + "id": "left1", + "group": "left" + } + ] + }, + "zIndex": 2 + }, + { + "position": { + "x": 600, + "y": 0 + }, + "size": { + "width": 60, + "height": 60 + }, + "attrs": { + "text": { + "refY": "100%", + "textVerticalAnchor": "top", + "text": "end", + "refY2": 4 + }, + "image": { + "xlink:href": "${url}10012" + } + }, + "visible": true, + "shape": "image", + "id": "20000", + "data": { + "type": "imageNodes", + "startNodeId": "10000", + "dataId": "", + "nodeType": "end", + "nodeTypeExt": "", + "voteNum": "" + }, + "ports": { + "groups": { + "top": { + "position": { + "name": "top" + }, + "attrs": { + "circle": { + "r": 4, + "magnet": true, + "stroke": "#5F95FF", + "strokeWidth": 1, + "fill": "#fff", + "style": { + "visibility": "hidden" + } + } + } + }, + "right": { + "position": { + "name": "right" + }, + "attrs": { + "circle": { + "r": 4, + "magnet": true, + "stroke": "#5F95FF", + "strokeWidth": 1, + "fill": "#fff", + "style": { + "visibility": "hidden" + } + } + } + }, + "bottom": { + "position": { + "name": "bottom" + }, + "attrs": { + "circle": { + "r": 4, + "magnet": true, + "stroke": "#5F95FF", + "strokeWidth": 1, + "fill": "#fff", + "style": { + "visibility": "hidden" + } + } + } + }, + "left": { + "position": { + "name": "left" + }, + "attrs": { + "circle": { + "r": 4, + "magnet": true, + "stroke": "#5F95FF", + "strokeWidth": 1, + "fill": "#fff", + "style": { + "visibility": "hidden" + } + } + } + } + }, + "items": [ + { + "id": "top1", + "group": "top" + }, + { + "id": "right1", + "group": "right" + }, + { + "id": "bottom1", + "group": "bottom" + }, + { + "id": "left1", + "group": "left" + } + ] + }, + "zIndex": 3 + }, + { + "shape": "edge", + "id": "66c81c68-0827-4a3c-8343-e2c453d3e9e7", + "router": { + "name": "manhattan" + }, + "connector": { + "name": "rounded" + }, + "source": { + "cell": "10000", + "port": "right1" + }, + "target": { + "cell": 15000, + "port": "left1" + }, + "zIndex": 4 + }, + { + "shape": "edge", + "id": "a0f3cf90-6d37-4ee0-a254-90b4ec2b6a7f", + "router": { + "name": "manhattan" + }, + "connector": { + "name": "rounded" + }, + "source": { + "cell": 15000, + "port": "right1" + }, + "target": { + "cell": "20000", + "port": "left1" + }, + "zIndex": 5 + } + ] + } + ` + return JSON.parse(result) + } + }, data() { return { isFirstLoad: true, @@ -106,26 +517,6 @@ modelType: '', timer: null, imagesList: [ - // {imgPath: 'start', imgName: 'start', nodeType: 'start', imgWidth: 60, imgHeight: 60, imgId: '1', data: {}}, - // {imgPath: 'end', imgName: 'end', nodeType: 'end', imgWidth: 60, imgHeight: 60, imgId: '2', data: {}}, - // { - // imgPath: 'connect', - // imgName: 'connect', - // nodeType: 'connect', - // imgWidth: 30, - // imgHeight: 30, - // imgId: '3', - // data: {} - // }, - // { - // imgPath: 'connect', - // imgName: 'bridge', - // nodeType: 'bridge', - // imgWidth: 50, - // imgHeight: 50, - // imgId: '12', - // data: {} - // }, { imgPath: 'parallel', imgName: 'parallel', @@ -176,10 +567,15 @@ diagramIdDisabled: false, dataForm: { id: null, + pid: null, + model_tag: '', + model_name: '', + product_id: null, content: null, publishContent: null, hasPublish: 0, urlPref: '', + nodeArr: [] }, type: '', id: '', @@ -758,8 +1154,10 @@ token: Cookies.get('token'), } let res = await this.$http.get(`/taskReliability/ModelLine/getDiagram`, {params: params}) - if (res.data !== null && (res.data.content != null)) { - this.dataForm = res.data + this.dataForm = res.data + if (res.data.content != null) { + console.log(this.dataForm, 'getDiagram datafrom') + console.log(res.data, 'getDiagram res.data') this.diagramJson = JSON.parse(this.dataForm.content) this.graph.fromJSON(this.diagramJson) this.isFirstLoad = false; @@ -769,14 +1167,14 @@ // this.graph.centerContent() // this.graph.zoomToFit() } else { - this.graph.fromJSON(RBDDefault) + this.graph.fromJSON(this.RBDDefault) this.isFirstLoad = false } }, async clearDiagram() { - this.dataForm.id = null // this.graph.fromJSON(this.emptyJson) - this.graph.fromJSON(RBDDefault) + console.log(this.RBDDefault, 'clearDiagram') + this.graph.fromJSON(this.RBDDefault) this.graph.positionContent('left') this.isFirstLoad = false; // this.graph.centerContent() @@ -805,9 +1203,6 @@ } }, }, - // panning: { - // enabled: true, - // }, scroller: { enabled: true, pageVisible: true, @@ -828,9 +1223,6 @@ connecting: { router: { name: 'manhattan', - // args: { - // padding: 1, - // }, }, connector: { name: 'rounded', @@ -997,9 +1389,10 @@ } let res = await this.$http.get(`/basicInfo/XhProductModel/getProduct`, {params: params}) this.imagesList2 = res.data - console.log(this.imagesList2, 'getProduct(productId)234567890') - let urlObject = window.URL || window.webkitURL || window; + /*for(let i =0;i<this.imagesList2.length;i++){ + }*/ + console.log(this.imagesList2, 'getProduct(productId)234567890') const imageNodes2 = this.imagesList2.map((item) => this.graph.createNode({ shape: 'image', @@ -1009,18 +1402,21 @@ id: item.dataId, // 鎵嬪姩璁剧疆鑺傜偣鐨� ID data: { type: 'imageNodes2', - isRepair: item.isRepair, dataId: item.dataId, nodeType: item.nodeType, nodeTypeExt: item.nodeTypeExt, productType: item.productType, statusImg: item.statusImg, - reliabDistribType: item.reliabDistribType, - repairDistribType: item.repairDistribType, - repairMttcr: item.repairMttcr, - repairMttcrOther: item.repairMttcrOther, + + reliabDistribType: item.reliabDistribType ? item.reliabDistribType : 1, taskMtbcf: item.taskMtbcf, taskMtbcfOther: item.taskMtbcfOther, + + isRepair: item.isRepair, + repairDistribType: item.repairDistribType ? item.repairDistribType : 1, + repairMttcr: item.repairMttcr, + repairMttcrOther: item.repairMttcrOther, + imgHeight: item.imgHeight, imgWidth: item.imgWidth, voteNum: '', @@ -1157,24 +1553,18 @@ } } node.remove() - - /*//濡傛灉鑺傜偣涓庤妭鐐圭浉浜� - console.log(node.position().x, node.position().x, 'node.position().x') - if (nodeType === 'bridgeConnection') { - this.getBridgeConnection() - }*/ }); this.graph.on('cell:contextmenu', ({cell}) => { // this.type.value = cell.isNode() ? "node" : "edge" this.type = cell.isNode() ? 'node' : 'edge' - this.shape = cell.shape - this.id = cell.id + /* this.shape = cell.shape + this.id = cell.id*/ if (this.type === 'node') { - this.nodeType = cell.getData().nodeType - // console.log(this.nodeType, cell.id, 'this.nodeType') + //this.nodeType = cell.getData().nodeType + this.$refs.configNode.loadData(cell) + } else { + this.$refs.configNode.loadData(cell) } - // console.log(this.shape, 'this.shape') - // this.nodeOpt(this.id, this.globalGridAttr) }) //鍗曞嚮杈硅妭鐐� this.graph.on('edge:click', ({edge}) => { @@ -1422,6 +1812,16 @@ }, async saveDiagram() { console.log(JSON.stringify(this.graph.toJSON()), 'graph.toJSON()') + const nodes = this.graph.getNodes() + let nodeArr2 = [] + // 妫�鏌ラ櫎褰撳墠鑺傜偣涔嬪鐨勬墍鏈夎妭鐐圭殑鍖呭洿妗嗘槸鍚︾浉浜� + for (const node of nodes) { + console.log(node, 'saveDiagram node') + if (node.getData().nodeType == 'node' && node.getData().productType != 'product_xdy' && node.getData().dataId) { + nodeArr2.push(node.getData().dataId) + } + } + this.dataForm.nodeArr = nodeArr2 this.dataForm.content = JSON.stringify(this.graph.toJSON()) this.dataForm.urlPref = window.SITE_CONFIG['apiURL'] console.log(this.dataForm, 'dataFrom') @@ -1435,6 +1835,15 @@ }, async analyzeDiagram() { console.log(JSON.stringify(this.graph.toJSON()), 'graph.toJSON()') + const nodes = this.graph.getNodes() + let nodeArr2 = [] + // 妫�鏌ラ櫎褰撳墠鑺傜偣涔嬪鐨勬墍鏈夎妭鐐圭殑鍖呭洿妗嗘槸鍚︾浉浜� + for (const node of nodes) { + if (node.getData().nodeType === 'node' && node.getData().productType !== 'product_xdy' && node.getData().dataId) { + nodeArr2.push(node.getData().dataId) + } + } + this.dataForm.nodeArr = nodeArr2 this.dataForm.content = JSON.stringify(this.graph.toJSON()) this.dataForm.urlPref = window.SITE_CONFIG['apiURL'] await this.$http['post'](`/taskReliability/ModelLine/analyze`, this.dataForm).then(async res => { diff --git a/web/src/views/modules/taskReliability/SimulatAssess.vue b/web/src/views/modules/taskReliability/SimulatAssess.vue index d87c221..071c3f7 100644 --- a/web/src/views/modules/taskReliability/SimulatAssess.vue +++ b/web/src/views/modules/taskReliability/SimulatAssess.vue @@ -11,6 +11,11 @@ <zt-form-item label="鎬讳綋浠诲姟" prop="task"> <zt-select v-model="dataForm.task" :datas="taskList" @change="onTaskSelected"/> </zt-form-item> + <zt-form-item label="浠诲姟鏃堕暱" prop="simulatTime"> + <el-input type="number" :min="1" v-model="dataForm.simulatTime"> + <template slot="append">灏忔椂</template> + </el-input> + </zt-form-item> <zt-form-item label="鏁版嵁绫诲瀷" prop="dataType"> <zt-dict v-model="dataForm.dataType" dict="dataType"></zt-dict> </zt-form-item> @@ -22,11 +27,6 @@ <template slot="append">鍒嗛挓</template> </el-input> </zt-form-item> - <zt-form-item label="浠跨湡鏃堕暱" prop="simulatTime"> - <el-input type="number" :min="1" v-model="dataForm.simulatTime"> - <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"> <template slot="append">娆℃暟</template> @@ -34,7 +34,7 @@ </zt-form-item> <zt-form-item> <zt-button @click="analyze()">浠跨湡鍒嗘瀽</zt-button> - <zt-button>鍒嗘瀽缁撴灉</zt-button> + <zt-button @click="getresult()">鍒嗘瀽缁撴灉</zt-button> </zt-form-item> </el-form> </div> @@ -43,7 +43,7 @@ <el-col :span="18"> <div class="fa-card-a"> <SimulatCurve ref="SimulatCurve"></SimulatCurve> - <SimulatData></SimulatData> + <SimulatData ref="SimulatData"></SimulatData> </div> </el-col> </el-row> @@ -104,24 +104,25 @@ console.log(res.data) this.taskList = res.data }, + getresult(){ + this.$refs.SimulatData.init(); + }, async analyze() { - let res = await this.$http.post('/taskReliability/SimulatAssess/analyze', this.dataForm) + /* let res = await this.$http.post('/taskReliability/SimulatAssess/analyze', this.dataForm) if (res.success) { - console.log(res.data, 'analyze') let stopPolling = false if (!stopPolling) { let timer = setInterval(async () => { let res2 = await this.$http.get(`/taskReliability/SimulatAssess/${res.data}`) - console.log(res2.data, 'setInterval') if (res2.data) { if (res2.data.code === '0' || res2.data.errorMsg === '0') { stopPolling = true // 涓杞 clearInterval(timer) - alert('宸茶幏鍙�') - this.$refs.SimulatCurve.initEcharts(res2.data.curveData); + alert('宸茶幏鍙�')*/ + this.$refs.SimulatCurve.initEcharts(); // 娓呴櫎瀹氭椂鍣� - } else { + /* } else { stopPolling = true // 涓杞 clearInterval(timer) @@ -131,7 +132,7 @@ }, 400) } - } + }*/ } } } diff --git a/web/src/views/modules/taskReliability/SimulatCurve.vue b/web/src/views/modules/taskReliability/SimulatCurve.vue index dbe4b67..75ea122 100644 --- a/web/src/views/modules/taskReliability/SimulatCurve.vue +++ b/web/src/views/modules/taskReliability/SimulatCurve.vue @@ -20,13 +20,23 @@ initEcharts(CurveData) { console.log(eval(CurveData), 'initEcharts(CurveData)') const option = { + title:{ + text:'浠跨湡鍙潬搴︽敹鏁涙洸绾垮浘', + textStyle: { // 涓绘爣棰樻枃鏈牱寮弡"fontSize": 18,"fontWeight": "bolder","color": "#333"} + fontFamily: 'Arial', + fontSize: 20, + fontStyle: 'normal', + fontWeight: 'normal', + } + }, xAxis: { - data: eval(CurveData)[0] + data: [10, 30, 50, 70, 90, 110, 130,150,170], + name:'浠跨湡娆℃暟' }, yAxis: {}, series: [ { - data: eval(CurveData)[1], + data: [15, 85, 75, 25, 65,35,55,45,50], type: 'line', smooth: true } diff --git a/web/src/views/modules/taskReliability/SimulatData.vue b/web/src/views/modules/taskReliability/SimulatData.vue index 9c22f5e..f7bb6f3 100644 --- a/web/src/views/modules/taskReliability/SimulatData.vue +++ b/web/src/views/modules/taskReliability/SimulatData.vue @@ -1,21 +1,21 @@ <template> - <zt-table-wraper ref="tableObj" defaultNotQuery="true" query-url="" - :paging='false' - delete-url="" v-slot="{ table }"> - <el-form :inline="true" :model="dataForm" @keyup.enter.native="table.query()"> - </el-form> - <el-table v-loading="table.dataLoading" :data="table.dataList" - @selection-change="table.selectionChangeHandle" - height="100px" v-adaptive="{bottomOffset:30}"> - <el-table-column prop="name" label="鍚嶇О" /> - <el-table-column prop="totalTime" label="鎬绘椂闂�"/> - <el-table-column prop="faultNum" label="鏁呴殰娆℃暟"/> - <el-table-column prop="repairTime" label="淇悊鏃堕棿"/> - <el-table-column prop="availability" label="鍙敤搴�"/> - <el-table-column prop="mtbcf" label="MTBCF"/> - <el-table-column prop="mttcr" label="MTTCR"/> - </el-table> - </zt-table-wraper> + <zt-table-wraper ref="tableObj" defaultNotQuery="true" query-url="" + :paging='false' + delete-url="" v-slot="{ table }"> + <el-form :inline="true" :model="dataForm" @keyup.enter.native="table.query()"> + </el-form> + <el-table v-loading="table.dataLoading" :data="dataList" + @selection-change="table.selectionChangeHandle" + height="100px" v-adaptive="{bottomOffset:30}"> + <el-table-column prop="name" label="鍚嶇О"/> + <el-table-column prop="totalTime" label="鎬绘椂闂�(灏忔椂)" align="center"/> + <el-table-column prop="faultNum" label="鏁呴殰娆℃暟" align="center"/> + <el-table-column prop="repairTime" label="淇悊鏃堕棿(鍒嗛挓)" align="center"/> + <el-table-column prop="availability" label="鍙敤搴�(鐧惧垎姣�)" align="center"/> + <el-table-column prop="mtbcf" label="MTBCF" align="center"/> + <el-table-column prop="mttcr" label="MTTCR" align="center"/> + </el-table> + </zt-table-wraper> </template> <script> @@ -28,35 +28,92 @@ productList: [], dataForm: { productId: '' - } + }, + dataList:[], + fzdataList: [ + { + name: '鎬讳綋', + totalTime:'15000', + faultNum:'2', + repairTime:'20', + availability:'99.96', + mtbcf:'5000', + mttcr:'20' + },{ + name: '銆�绯荤粺1', + totalTime:'15000', + faultNum:'0', + repairTime:'0', + availability:'100', + mtbcf:'15000', + mttcr:'0' + },{ + name: '銆�銆�璁惧1-1', + totalTime:'9000', + faultNum:'2', + repairTime:'30', + availability:'99.98', + mtbcf:'3000', + mttcr:'15' + },{ + name: '銆�銆�璁惧1-2', + totalTime:'15000', + faultNum:'4', + repairTime:'120', + availability:'98.79', + mtbcf:'5000', + mttcr:'30' + },{ + name: '銆�銆�璁惧1-3', + totalTime:'12000', + faultNum:'3', + repairTime:'100', + availability:'98.88', + mtbcf:'3000', + mttcr:'33' + }, + { + name: '銆�绯荤粺2', + totalTime:'10000', + faultNum:'2', + repairTime:'30', + availability:'99.75', + mtbcf:'5000', + mttcr:'15' + },{ + name: '銆�銆�璁惧2-1', + totalTime:'7000', + faultNum:'5', + repairTime:'200', + availability:'88.84', + mtbcf:'1167', + mttcr:'40' + },{ + name: '銆�銆�璁惧2-2', + totalTime:'5000', + faultNum:'3', + repairTime:'60', + availability:'98.78', + mtbcf:'1250', + mttcr:'30' + },{ + name: '銆�銆�璁惧2-3', + totalTime:'10000', + faultNum:'1', + repairTime:'20', + availability:'99.97', + mtbcf:'5000', + mttcr:'20' + },] } }, - components: { - - }, + components: {}, mounted() { - this.getTaskProductList() }, methods: { init() { - + this.dataList =this.fzdataList }, - add() { - this.$refs.AddOrUpdate.$refs.dialog.init(null,{productId: this.dataForm.productId}) - }, - selectTask(row){ - this.$emit('onTaskSelected',row) - }, - async getTaskProductList() { - let res = await this.$http.get('/basicInfo/XhProductModel/getTaskProductList') - this.productList = res.data - console.log(this.productList, ' async getTaskProductList()') - }, - onProductSelected(data){ - console.log(data, ' onProductSelected(data)') - this.dataForm.productId = data.id - this.$refs.tableObj.query() - } } } </script> diff --git a/web/src/views/modules/taskReliability/TaskPhase-AddOrUpdate.vue b/web/src/views/modules/taskReliability/TaskPhase-AddOrUpdate.vue index 3916e5b..ddcdc72 100644 --- a/web/src/views/modules/taskReliability/TaskPhase-AddOrUpdate.vue +++ b/web/src/views/modules/taskReliability/TaskPhase-AddOrUpdate.vue @@ -7,9 +7,9 @@ <zt-form-item label="闃舵鏃堕暱姣�" prop="phaseDuration"> <el-input v-model="dataForm.phaseDurationRate" @change="check"></el-input> </zt-form-item> - <zt-form-item label="闃舵鏃堕��" prop="phaseSpeed"> +<!-- <zt-form-item label="闃舵鏃堕��" prop="phaseSpeed"> <el-input v-model="dataForm.phaseSpeed"></el-input> - </zt-form-item> + </zt-form-item>--> <!-- <zt-form-item label="闃舵椤哄簭" prop="phaseSort"> <el-input v-model="dataForm.phaseSort"></el-input> </zt-form-item>--> diff --git a/web/src/views/modules/taskReliability/TaskPhase.vue b/web/src/views/modules/taskReliability/TaskPhase.vue index 9abdaaf..2b5692f 100644 --- a/web/src/views/modules/taskReliability/TaskPhase.vue +++ b/web/src/views/modules/taskReliability/TaskPhase.vue @@ -24,9 +24,9 @@ <el-table-column type="selection" width="40" align="center"/> <el-table-column prop="phaseName" label="闃舵鍚嶇О" align="center"/> <el-table-column prop="phaseDurationRate" label="闃舵鏃堕暱姣�" align="right"/> - <el-table-column prop="phaseSpeed" label="闃舵鏃堕��" align="right"/> + <!-- <el-table-column prop="phaseSpeed" label="闃舵鏃堕��" align="right"/>--> <!--<el-table-column prop="phaseSort" label="闃舵椤哄簭" align="center"/>--> - <el-table-column prop="operatConditDuration" label="宸ュ喌鏃堕暱鍒嗛厤" align="center"/> + <!--<el-table-column prop="operatConditDuration" label="宸ュ喌鏃堕暱鍒嗛厤" align="center"/>--> <zt-table-column-handle :table="table" edit-perm="testReviewComment:update" delete-perm="taskReliability::delete"> <template v-slot="{row}"> -- Gitblit v1.9.1