| | |
| | | private String tjlx; |
| | | private Double specifiedValue; |
| | | private Double minAccepValue; |
| | | private BigDecimal productionRisk; |
| | | private BigDecimal userRisk; |
| | | private Double productionRisk; |
| | | private Double userRisk; |
| | | private Integer showFailureTime; |
| | | } |
| | |
| | | @Data |
| | | public class ResultDto { |
| | | |
| | | @ApiModelProperty(value = "") |
| | | @ApiModelProperty(value = "接受值") |
| | | private int acceptNumber; |
| | | |
| | | @ApiModelProperty(value = "") |
| | | @ApiModelProperty(value = "总实验时间") |
| | | private String totalTestTime; |
| | | |
| | | @ApiModelProperty(value = "") |
| | | private String number; |
| | | @ApiModelProperty(value = "检验上限") |
| | | private String specifiedValue; |
| | | |
| | | @ApiModelProperty(value = "") |
| | | @ApiModelProperty(value = "生成方风险实际值") |
| | | private String productionRiskReal; |
| | | |
| | | @ApiModelProperty(value = "") |
| | | @ApiModelProperty(value = "使用方风险实际值") |
| | | private String userRiskReal; |
| | | |
| | | } |
| | |
| | | package com.zt.life.modules.mainPart.TestScheme.service; |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | import com.zt.common.service.BaseService; |
| | | import com.zt.life.modules.mainPart.TestScheme.dao.TestSchemeDao; |
| | | import com.zt.life.modules.mainPart.TestScheme.dto.ConditionDto; |
| | | import com.zt.life.modules.mainPart.TestScheme.dto.ResultDto; |
| | | import com.zt.life.modules.mainPart.TestScheme.model.TestScheme; |
| | | import org.apache.commons.math3.distribution.ChiSquaredDistribution; |
| | | import org.springframework.stereotype.Service; |
| | | import com.zt.common.db.query.QueryFilter; |
| | | |
| | |
| | | |
| | | public List<ResultDto> getResult(ConditionDto dto) { |
| | | List<ResultDto> result = new ArrayList<>(); |
| | | List<TestScheme> list = baseDao.getList(); |
| | | if (dto.getTjlx().equals("按风险名义值查询")) { |
| | | result = this.getCondition1(dto, list); |
| | | } else if (dto.getTjlx().equals("不限定生产方风险查询")) { |
| | | result = this.getCondition2(dto, list); |
| | | } else if (dto.getTjlx().equals("不限定规定值查询")) { |
| | | result = this.getCondition3(dto, list); |
| | | switch (dto.getTjlx()) { |
| | | case "按风险名义值查询": |
| | | result = this.getCondition1(dto); |
| | | break; |
| | | case "不限定生产方风险查询": |
| | | result = this.getCondition2(dto); |
| | | break; |
| | | case "不限定规定值查询": |
| | | result = this.getCondition3(dto); |
| | | break; |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | private List<ResultDto> getCondition1(ConditionDto dto, List<TestScheme> list) { |
| | | private List<ResultDto> getCondition1(ConditionDto dto) { |
| | | List<ResultDto> result = new ArrayList<>(); |
| | | int C = 0; |
| | | int C = 1; |
| | | double oldvalue = 0; |
| | | for (int i = 1; i <= 10; i++) { |
| | | Integer finalI = i; |
| | | TestScheme data1 = list.stream().filter(k -> k.getPa().equals(dto.getUserRisk()) && k.getPc() == (2 * finalI + 2)).findFirst().get();// |
| | | TestScheme data2 = list.stream().filter(k -> k.getPa().equals(BigDecimal.ONE.subtract(dto.getUserRisk())) && k.getPc() == (2 * finalI + 2)).findFirst().get();// |
| | | double strate = dto.getMinAccepValue() / dto.getSpecifiedValue(); |
| | | for (int i = 1; i <= 10000; i++) { |
| | | Double data1 = getUpperQuantile(1 - dto.getProductionRisk(), 2 * i + 2); |
| | | Double data2 = getUpperQuantile(dto.getUserRisk(), 2 * i + 2);//算法计算 |
| | | if (data1 != null && data2 != null) { |
| | | Double value = data2.getValue() / data1.getValue(); |
| | | double strate = dto.getMinAccepValue() / dto.getSpecifiedValue(); |
| | | |
| | | if (value >= strate) { |
| | | C = i; |
| | | if (strate - oldvalue < value - strate) |
| | | C = i - 1; |
| | | break; |
| | | double value = data1 / data2; |
| | | System.out.println(value); |
| | | if (dto.getUserRisk() < 1 - dto.getProductionRisk()) { |
| | | if (oldvalue != 0) { |
| | | if (value > strate) { |
| | | C = i; |
| | | if (strate - oldvalue < value - strate) { |
| | | C = i - 1; |
| | | } |
| | | break; |
| | | } |
| | | } else { |
| | | if (value > strate) { |
| | | C = i; |
| | | break; |
| | | } |
| | | } |
| | | } else { |
| | | if (oldvalue != 0) { |
| | | if (value < strate) { |
| | | C = i; |
| | | if (oldvalue - strate < strate - value) { |
| | | C = i - 1; |
| | | } |
| | | break; |
| | | } |
| | | } else { |
| | | if (value < strate) { |
| | | C = i; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | oldvalue = value; |
| | | } |
| | |
| | | double T = 0; //总试验时间 |
| | | double TST1 = 0; //T/θ1 |
| | | double TST0 = 0; //T/θ0 |
| | | Integer finalC = C; |
| | | Stream<TestScheme> testSchemeStream = list.stream().filter(k -> k.getPa().equals(dto.getUserRisk()) && k.getPc() == (2 * finalC + 2)); |
| | | TestScheme data3 = testSchemeStream.findFirst().get(); |
| | | Double data3 = getUpperQuantile(dto.getUserRisk(), 2 * C + 2); |
| | | if (data3 != null) { |
| | | TST1 = data3.getValue() / 2; //T/θ1 |
| | | TST1 = data3 / 2; //T/θ1 |
| | | //TST1 = Convert.ToDouble(TST1.ToString("G2")); //取两位有效数字 |
| | | if (TST1 < 10) { |
| | | TST1 = TST1 + 0.1; |
| | |
| | | double e = 2.71828182845904523536; //自然数e |
| | | |
| | | for (int r = 0; r <= C; r++) { |
| | | productionRisk = productionRisk + Math.pow(TST0, r) * Math.pow(e, -TST0) / getjc(r); |
| | | double a = Math.pow(TST0, r) * Math.pow(e, -TST0) / getjc(r); |
| | | /* if (r>35){ |
| | | System.out.println(111); |
| | | }*/ |
| | | productionRisk = productionRisk + a; |
| | | userRisk = userRisk + Math.pow(TST1, r) * Math.pow(e, -TST1) / getjc(r); |
| | | } |
| | | ResultDto resultDto = new ResultDto(); |
| | | productionRisk = 1 - productionRisk; |
| | | |
| | | ResultDto resultDto = new ResultDto(); |
| | | resultDto.setAcceptNumber(C); |
| | | resultDto.setTotalTestTime(String.valueOf(Math.round(T))); |
| | | resultDto.setProductionRiskReal(new Formatter().format("%.2f", productionRisk * 100).toString()); |
| | |
| | | return result; |
| | | } |
| | | |
| | | public List<ResultDto> getCondition2(ConditionDto dto, List<TestScheme> list) { |
| | | public List<ResultDto> getCondition2(ConditionDto dto) { |
| | | List<ResultDto> result = new ArrayList<>(); |
| | | for (Integer i = 0; i < dto.getShowFailureTime(); i++) { |
| | | Integer finalI = i; |
| | | List<TestScheme> data = list.stream().filter(k -> k.getPa().equals(dto.getUserRisk()) && k.getPc() == (2 * finalI + 2)).collect(Collectors.toList());// |
| | | ResultDto resultDto = new ResultDto(); |
| | | double T = 0; |
| | | double TST1 = 0; // T/θ1 |
| | | double TST0 = 0;// T/θ0 |
| | | for (TestScheme item : data) { |
| | | TST1 = item.getValue() / 2; |
| | | T = TST1 * dto.getMinAccepValue(); |
| | | TST0 = T / dto.getSpecifiedValue(); // T/θ0 |
| | | } |
| | | for (int i = 0; i < dto.getShowFailureTime(); i++) { |
| | | double T; |
| | | double TST1; // T/θ1 |
| | | double TST0;// T/θ0 |
| | | |
| | | Double data2 = getUpperQuantile(dto.getUserRisk(), 2 * i + 2); |
| | | TST1 = data2 / 2; |
| | | T = TST1 * dto.getMinAccepValue(); |
| | | TST0 = T / dto.getSpecifiedValue(); // T/θ0 |
| | | |
| | | |
| | | double productionRisk = 0; |
| | | double userRisk = 0; |
| | | double e = 2.71828182845904523536; |
| | |
| | | } |
| | | productionRisk = 1 - productionRisk; |
| | | |
| | | ResultDto resultDto = new ResultDto(); |
| | | resultDto.setAcceptNumber(i + 1); |
| | | resultDto.setTotalTestTime(String.valueOf(Math.round(T))); |
| | | resultDto.setProductionRiskReal(new Formatter().format("%.2f", productionRisk * 100).toString()); |
| | |
| | | return result; |
| | | } |
| | | |
| | | private List<ResultDto> getCondition3(ConditionDto dto, List<TestScheme> list) { |
| | | private List<ResultDto> getCondition3(ConditionDto dto) { |
| | | List<ResultDto> result = new ArrayList<>(); |
| | | for (int i = 0; i < dto.getShowFailureTime(); i++) { |
| | | Integer finalI = i; |
| | | List<TestScheme> data = list.stream().filter(k -> k.getPa().equals(dto.getUserRisk()) && k.getPc() == (2 * finalI + 2)).collect(Collectors.toList());// |
| | | List<TestScheme> data2 = list.stream().filter(k -> k.getPa().equals(BigDecimal.ONE.subtract(dto.getProductionRisk())) && k.getPc() == (2 * finalI + 2)).collect(Collectors.toList());// |
| | | double T = 0; |
| | | double TST1 = 0; // T/θ1 |
| | | double TST0 = 0;// T/θ0 |
| | | double ST0 = 0; // θ0 |
| | | for (TestScheme item : data) { |
| | | TST1 = item.getValue() / 2; |
| | | T = TST1 * dto.getMinAccepValue(); |
| | | for (TestScheme item2 : data2) { |
| | | ST0 = item.getValue() * dto.getMinAccepValue() / item2.getValue(); |
| | | } |
| | | TST0 = T / ST0; |
| | | } |
| | | double T; |
| | | double TST1; // T/θ1 |
| | | double TST0;// T/θ0 |
| | | double ST0; // θ0 |
| | | |
| | | Double data1 = getUpperQuantile(dto.getUserRisk(), 2 * i + 2); |
| | | Double data2 = getUpperQuantile(1 - dto.getProductionRisk(), 2 * i + 2); |
| | | TST1 = data1 / 2; |
| | | T = TST1 * dto.getMinAccepValue(); |
| | | ST0 = data1 * dto.getMinAccepValue() / data2; |
| | | TST0 = T / ST0; |
| | | |
| | | |
| | | double productionRisk = 0; |
| | | double userRisk = 0; |
| | |
| | | productionRisk = productionRisk + Math.pow(TST0, r) * Math.pow(e, -TST0) / getjc(r); |
| | | userRisk = userRisk + Math.pow(TST1, r) * Math.pow(e, -TST1) / getjc(r); |
| | | } |
| | | productionRisk = 1 - productionRisk; |
| | | |
| | | ResultDto resultDto = new ResultDto(); |
| | | resultDto.setAcceptNumber(i + 1); |
| | | resultDto.setTotalTestTime(String.valueOf(Math.round(T))); |
| | | resultDto.setNumber(String.valueOf(Math.round(ST0))); |
| | | resultDto.setSpecifiedValue(String.valueOf(Math.round(ST0)));//检验上限 |
| | | resultDto.setProductionRiskReal(new Formatter().format("%.2f", productionRisk * 100).toString()); |
| | | resultDto.setUserRiskReal(new Formatter().format("%.2f", userRisk * 100).toString()); |
| | | result.add(resultDto); |
| | |
| | | } |
| | | |
| | | //计算阶乘 |
| | | int getjc(int a) { |
| | | int result = 1; |
| | | Double getjc(int a) { |
| | | double result = 1.0; |
| | | for (int i = a; i > 0; i--) |
| | | result = result * i; |
| | | return result; |
| | | } |
| | | |
| | | //卡方分布的上侧α分位数算法 |
| | | public Double getUpperQuantile(Double alpha, Integer degreesOfFreedom) { |
| | | ChiSquaredDistribution chiSquaredDistribution = new ChiSquaredDistribution(degreesOfFreedom); |
| | | Double upperQuantile = chiSquaredDistribution.inverseCumulativeProbability(1 - alpha); |
| | | String str = String.format("%.4f", upperQuantile); |
| | | upperQuantile = Convert.toDouble(str); |
| | | return upperQuantile; |
| | | } |
| | | } |
New file |
| | |
| | | package com.zt.life.modules.mainPart.taskReliability.controller; |
| | | |
| | | |
| | | import com.zt.common.annotation.LogOperation; |
| | | import com.zt.common.annotation.QueryParam; |
| | | import com.zt.common.constant.Constant; |
| | | import com.zt.common.db.query.QueryFilter; |
| | | import com.zt.common.servlet.Result; |
| | | import com.zt.common.validator.AssertUtils; |
| | | import com.zt.common.validator.ValidatorUtils; |
| | | 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.dto.ImportErrDto; |
| | | import com.zt.life.modules.mainPart.baseReliability.service.ParamDataBasicService; |
| | | import com.zt.life.modules.mainPart.basicInfo.model.ParamData; |
| | | import com.zt.life.modules.mainPart.taskReliability.dao.AssessItemDao; |
| | | import com.zt.life.modules.mainPart.taskReliability.model.AssessItem; |
| | | import com.zt.life.modules.mainPart.taskReliability.model.OperatCondit; |
| | | import com.zt.life.modules.mainPart.taskReliability.model.ReliabilityAssess; |
| | | import com.zt.life.modules.mainPart.taskReliability.service.ReliabilityAssessService; |
| | | import com.zt.life.util.ImportUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import springfox.documentation.annotations.ApiIgnore; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | |
| | | @RestController |
| | | @RequestMapping("/taskReliability/ReliabilityAssess/") |
| | | public class ReliabilityAssessController { |
| | | @Autowired |
| | | ReliabilityAssessService reliabilityAssessService; |
| | | |
| | | @Autowired |
| | | AssessItemDao assessItemDao; |
| | | |
| | | @GetMapping("page") |
| | | @ApiOperation("分页") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = Constant.Q.ORDER_FIELD, value = Constant.QV.ORDER_FIELD, dataType = Constant.QT.STRING), |
| | | @ApiImplicitParam(name = Constant.Q.ORDER, value = Constant.QV.ORDER, dataType = Constant.QT.STRING), |
| | | }) |
| | | public Result<List<ReliabilityAssess>> page(@ApiIgnore @QueryParam QueryFilter queryFilter) { |
| | | |
| | | return Result.ok(null); |
| | | } |
| | | |
| | | @PostMapping("importProductExcel") |
| | | public Result importProductExcel(MultipartFile file, String progressId, Long pid, Long itemId) { |
| | | Result<List<ImportErrDto>> result = Result.ok(); |
| | | try { |
| | | List<Map<String, Object>> importResults = reliabilityAssessService.importProductExcel(file, progressId, pid, itemId); |
| | | StringBuilder str = new StringBuilder(); |
| | | ImportUtil.importResult(result, importResults, str); |
| | | ImportUtil.ImportErrResult(result, importResults, str); |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | @PostMapping("add") |
| | | @ApiOperation("新增") |
| | | @LogOperation("新增") |
| | | public Result insert(@RequestBody AssessItem assessItem){ |
| | | //效验数据 |
| | | ValidatorUtils.validateEntity(assessItem, AddGroup.class, DefaultGroup.class); |
| | | assessItemDao.insert(assessItem); |
| | | |
| | | return Result.ok(); |
| | | } |
| | | |
| | | @GetMapping("getAssessDataList") |
| | | public Result<List<AssessItem>> getAssessDataList(Long productId){ |
| | | List<AssessItem> dataList = reliabilityAssessService.getAssessDataList(productId); |
| | | |
| | | return Result.ok(dataList); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.zt.life.modules.mainPart.taskReliability.dao; |
| | | |
| | | import com.zt.common.dao.BaseDao; |
| | | import com.zt.life.modules.mainPart.basicInfo.model.XhProductModel; |
| | | import com.zt.life.modules.mainPart.taskReliability.model.AssessItem; |
| | | import com.zt.life.modules.mainPart.taskReliability.model.ReliabilityAssess; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | | * task |
| | | * |
| | | * @author zt generator |
| | | * @since 1.0.0 2024-03-15 |
| | | */ |
| | | @Mapper |
| | | public interface AssessItemDao extends BaseDao<AssessItem> { |
| | | |
| | | } |
New file |
| | |
| | | package com.zt.life.modules.mainPart.taskReliability.dao; |
| | | |
| | | import com.zt.common.dao.BaseDao; |
| | | import com.zt.life.modules.mainPart.basicInfo.model.XhProductModel; |
| | | import com.zt.life.modules.mainPart.taskReliability.model.AssessItem; |
| | | import com.zt.life.modules.mainPart.taskReliability.model.ReliabilityAssess; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | | * task |
| | | * |
| | | * @author zt generator |
| | | * @since 1.0.0 2024-03-15 |
| | | */ |
| | | @Mapper |
| | | public interface ReliabilityAssessDao extends BaseDao<ReliabilityAssess> { |
| | | |
| | | List<XhProductModel> getProductPath(Long shipId); |
| | | |
| | | List<AssessItem> getAssessDataList(Long productId); |
| | | } |
New file |
| | |
| | | package com.zt.life.modules.mainPart.taskReliability.model; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.zt.common.entity.BusiEntity; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @Data |
| | | @TableName("assess_item") |
| | | public class AssessItem extends BusiEntity { |
| | | private String name; |
| | | private Long id; |
| | | private Long productId; |
| | | } |
New file |
| | |
| | | package com.zt.life.modules.mainPart.taskReliability.model; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.zt.common.entity.BusiEntity; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.File; |
| | | |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @Data |
| | | @TableName("assess_data") |
| | | public class ReliabilityAssess extends BusiEntity { |
| | | private Double runTimes; |
| | | private Integer runNum; |
| | | private Integer failNum; |
| | | private String assessResult; |
| | | private Long itemId; |
| | | private Long productId; |
| | | } |
New file |
| | |
| | | package com.zt.life.modules.mainPart.taskReliability.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.zt.common.constant.Constant; |
| | | import com.zt.common.db.query.QueryFilter; |
| | | import com.zt.common.service.BaseService; |
| | | import com.zt.common.utils.CacheUtils; |
| | | import com.zt.common.utils.CommonUtils; |
| | | import com.zt.common.utils.TreeUtils; |
| | | import com.zt.common.utils.UUIDUtil; |
| | | import com.zt.core.shiro.ImportUtil; |
| | | 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.basicInfo.service.ParamDataService; |
| | | import com.zt.life.modules.mainPart.sysPictureBase.service.SysPictureBaseService; |
| | | import com.zt.life.modules.mainPart.taskReliability.dao.ReliabilityAssessDao; |
| | | import com.zt.life.modules.mainPart.taskReliability.model.AssessItem; |
| | | import com.zt.life.modules.mainPart.taskReliability.model.ReliabilityAssess; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
| | | import org.apache.poi.ss.usermodel.Row; |
| | | import org.apache.poi.ss.usermodel.Sheet; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.*; |
| | | |
| | | |
| | | /** |
| | | * product_model |
| | | * |
| | | * @author zt generator |
| | | * @since 1.0.0 2024-02-29 |
| | | */ |
| | | @Service |
| | | public class ReliabilityAssessService extends BaseService<ReliabilityAssessDao, ReliabilityAssess> { |
| | | public List<Map<String, Object>> importProductExcel(MultipartFile mutFile, String progressId, Long shipId, Long itemId) { |
| | | Date beginDate = new Date(); |
| | | List<Map<String, Object>> list = new ArrayList<>();//存储所有的导入状态 |
| | | Map<String, Object> map;//存储每一行的状态 |
| | | Integer sum = 0; // 总共的条数 |
| | | Integer suc = 0; // 成功的条数 |
| | | Integer err = 0; // 失败的条数 |
| | | int row1 = 0; |
| | | Map<String, Object> errMap = new HashMap<>(); |
| | | |
| | | try { |
| | | // 获取导入文件的后缀名 |
| | | String fileName = mutFile.getOriginalFilename(); |
| | | Workbook workbook = null; |
| | | //解决excel版本问题 |
| | | if (fileName != null && fileName.endsWith(".xls")) { |
| | | workbook = new HSSFWorkbook(mutFile.getInputStream()); |
| | | } else if (fileName != null && fileName.endsWith(".xlsx")) { |
| | | workbook = new XSSFWorkbook(mutFile.getInputStream()); |
| | | } |
| | | assert workbook != null; //断言如果[boolean表达式]为true,则程序继续执行。 如果为false,则程序抛出AssertionError,并终止执行。 |
| | | int sheets = workbook.getNumberOfSheets(); |
| | | |
| | | Map<String, XhProductModel> modelMap = new HashMap<>(); |
| | | List<XhProductModel> prductList = baseDao.getProductPath(shipId); |
| | | |
| | | for (XhProductModel product : prductList) { |
| | | if (StringUtils.isNotBlank(product.getNamePath())) { |
| | | modelMap.put(product.getNamePath(), product); |
| | | } |
| | | } |
| | | |
| | | String shipPath = ""; |
| | | String xtPath = ""; |
| | | String fxtPath = ""; |
| | | String sbPath = ""; |
| | | String path = ""; |
| | | for (int i = 0; i < sheets; i++) { |
| | | Sheet sheet = workbook.getSheetAt(i); |
| | | int num = sheet.getLastRowNum(); // 一共有多少行 |
| | | String sheetName = sheet.getSheetName(); //获取当前sheet名称 |
| | | for (int j = 1; j <= num; j++) { |
| | | CacheUtils.put(progressId, "speed", CommonUtils.getPercent(j, num)); |
| | | CacheUtils.put(progressId, "msg", "共" + num + "行,已完成第" + j + "行"); |
| | | |
| | | row1 = j; |
| | | String pattern = "yyyy-MM-dd"; |
| | | Row row = sheet.getRow(row1); |
| | | // String sort = ImportUtil.getCellValue(row, 0, pattern); //序号 |
| | | |
| | | String name = ImportUtil.getCellValue(row, 1, pattern); //节点名称 |
| | | String type = ImportUtil.getCellValue(row, 2, pattern);//节点类型 |
| | | String runTime = ImportUtil.getCellValue(row, 3, pattern); //运行时长 |
| | | String runNum = ImportUtil.getCellValue(row, 4, pattern); //运行次数 |
| | | String failNum = ImportUtil.getCellValue(row, 5, pattern); //失败次数 |
| | | |
| | | if (StringUtils.isBlank(name) || StringUtils.isBlank(type)) |
| | | continue; |
| | | |
| | | Long productId = null; |
| | | if (type.equals("总体")) { |
| | | path = shipPath = name; |
| | | xtPath = ""; |
| | | fxtPath = ""; |
| | | sbPath = ""; |
| | | productId = shipId; |
| | | }else { |
| | | if (type.equals("系统")) { |
| | | if (StringUtils.isNotBlank(shipPath)) { |
| | | path = xtPath = name; |
| | | fxtPath = ""; |
| | | sbPath = ""; |
| | | } else { |
| | | continue; |
| | | } |
| | | } |
| | | if (type.equals("分系统")) { |
| | | if (StringUtils.isNotBlank(xtPath)) { |
| | | path = fxtPath = xtPath + "," + name; |
| | | sbPath = ""; |
| | | } else { |
| | | continue; |
| | | } |
| | | } |
| | | if (type.equals("设备")) { |
| | | if ((StringUtils.isNotBlank(xtPath) || StringUtils.isNotBlank(fxtPath))) { |
| | | path = sbPath = StringUtils.isNotBlank(fxtPath) ? fxtPath + "," + name : xtPath + "," + name; |
| | | } else { |
| | | continue; |
| | | } |
| | | } |
| | | if (modelMap.get(path) != null) { |
| | | productId = modelMap.get(path).getId(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | ReliabilityAssess assess = new ReliabilityAssess(); |
| | | assess.setFailNum(Integer.valueOf(failNum)); |
| | | if (StringUtils.isNotBlank(runNum)){ |
| | | assess.setRunNum(Integer.valueOf(runNum)); |
| | | } |
| | | if (StringUtils.isNotBlank(runTime)){ |
| | | assess.setRunTimes(Double.valueOf(runTime)); |
| | | } |
| | | assess.setItemId(itemId); |
| | | assess.setProductId(productId); |
| | | this.insert(assess); |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | ImportUtil.updateErrMap(errMap, "导入异常" + e.getMessage(), "", row1); |
| | | //err++; |
| | | } |
| | | |
| | | Date nowDate = new Date(); |
| | | String msg = "产品模型导入时间:" + CommonUtils.getDatePoor(nowDate, beginDate) + "\r\n"; |
| | | System.out.println(msg); |
| | | suc = sum - err; |
| | | map = new HashMap<>(); |
| | | map.put("sum", sum + ""); // 所有导入的条数 |
| | | map.put("suc", suc + ""); // 成功的条数 |
| | | map.put("err", err + ""); // 失败的条数 |
| | | list.add(map); |
| | | list.add(errMap); |
| | | return list; |
| | | } |
| | | |
| | | public List<AssessItem> getAssessDataList(Long productId) { |
| | | return baseDao.getAssessDataList(productId); |
| | | } |
| | | } |
| | |
| | | String filePath = path + "/" + fzId + "/" + "result.xml"; |
| | | List<WeakDto> list = new ArrayList<>(); |
| | | Map<Long, WeakDto> map = new HashMap<>(); |
| | | String xml = null; |
| | | String xml; |
| | | InputStream in = null; |
| | | try { |
| | | in = new FileInputStream(filePath); |
| | |
| | | JSONArray jsonArray = xmlJSONObj.getJSONObject("ResultNodes").getJSONArray("ResultNode"); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | WeakDto data = new WeakDto(); |
| | | Long productId1 = null; |
| | | Long productId1; |
| | | Object nameValue = jsonArray.getJSONObject(i).get("name"); |
| | | if (nameValue instanceof Long) { |
| | | productId1 = (Long) nameValue; |
| | |
| | | this.update(simulatAssess); |
| | | } |
| | | String filePath = path + "/" + simulatAssess.getId() + "/" + "result.xml"; |
| | | String xml = null; |
| | | String xml; |
| | | InputStream in = null; |
| | | |
| | | try { |
| | |
| | | <mapper namespace="com.zt.life.modules.mainPart.basicInfo.dao.TyProductModelDao"> |
| | | |
| | | <select id="getList" resultType="com.zt.life.modules.mainPart.basicInfo.model.TyProductModel"> |
| | | SELECT PMC.* |
| | | FROM product_model_common PMC |
| | | SELECT a.* |
| | | FROM product_model_common a |
| | | JOIN (SELECT product_type, src_id |
| | | FROM product_model |
| | | WHERE id = ${pid} AND is_delete = 0) AS PM ON TRUE |
| | | WHERE PMC.is_delete = 0 |
| | | WHERE id = ${pid} AND is_delete = 0) AS b |
| | | WHERE a.is_delete = 0 |
| | | AND ( |
| | | PM.product_type = 3 |
| | | AND (CASE WHEN pm.src_id IS NULL THEN node_type > 3 ELSE pid IN (src_id) END) |
| | | b.product_type = 3 |
| | | AND a.node_type <> 3 |
| | | OR ( |
| | | PM.product_type != 3 |
| | | AND (CASE WHEN pm.src_id IS NULL THEN pid IS NULL ELSE pid IN (src_id) END) |
| | | b.product_type = 4 |
| | | AND a.node_type = 5 |
| | | ) |
| | | OR ( |
| | | b.product_type = 2 |
| | | AND a.node_type <> 4 |
| | | ) |
| | | ) |
| | | ORDER BY PMC.node_type, |
| | | PMC.sort; |
| | | ORDER BY a.node_type, |
| | | a.sort; |
| | | |
| | | |
| | | </select> |
| | | <select id="getProductList" resultType="com.zt.life.modules.mainPart.basicInfo.model.TyProductModel"> |
| | | select a.name, a.id |
| | |
| | | select a.name, a.id |
| | | from product_model a |
| | | where a.is_delete = 0 |
| | | and a.product_type = 1 |
| | | </select> |
| | | <select id="getProduct" resultType="com.zt.life.modules.mainPart.basicInfo.model.ProductImg"> |
| | | SELECT a.operat_img as imgPath, |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!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.AssessItemDao"> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!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.ReliabilityAssessDao"> |
| | | <select id="getProductPath" resultType="com.zt.life.modules.mainPart.basicInfo.model.XhProductModel"> |
| | | select a.* |
| | | from product_model a |
| | | where a.IS_DELETE = 0 |
| | | and a.ship_id = ${shipId} |
| | | </select> |
| | | <select id="getAssessDataList" resultType="com.zt.life.modules.mainPart.taskReliability.model.AssessItem"> |
| | | select a.name,a.id |
| | | from assess_item a |
| | | where a.IS_DELETE = 0 |
| | | and a.product_id = ${productId} |
| | | order by CREATE_DATE desc |
| | | </select> |
| | | </mapper> |
| | |
| | | computed: { |
| | | _title() { |
| | | if (this.title) { |
| | | console.log(this.title,'this.title') |
| | | return this.title |
| | | } else if (!this.editAble) { |
| | | } else if (this.isView) { |
| | | console.log(this.editAble,'this.editAble') |
| | | return this.$t('view') |
| | | } else if (this.$parent.dataForm !== undefined) { |
| | | console.log(this.$parent.dataForm,'this.$parent.dataForm') |
| | | return !this.$parent.dataForm.id ? this.$t('add') : this.$t('update') |
| | | } |
| | | } |
| | |
| | | <template> |
| | | <zt-dialog ref="dialog" title="导入产品模型" :hasConfirm="false" :editAble="false" append-to-body> |
| | | <zt-dialog ref="dialog" title="导入产品结构树" :hasConfirm="false" :editAble="false" append-to-body> |
| | | <el-form> |
| | | <zt-form-item style="width:100%;" label="" prop="remark"> |
| | | <el-upload |
| | |
| | | <template> |
| | | <zt-dialog ref="dialog" column="2" title="选择通用模型" append-to-body :editAble="false" :hasConfirm="true" |
| | | <zt-dialog ref="dialog" column="2" title="选择通用产品节点" append-to-body :editAble="false" :hasConfirm="true" |
| | | @confirm="formSubmit"> |
| | | <el-card shadow="never" class="aui-card--fill"> |
| | | <div class="mod-tyProductModel-tyProductModel}"> |
| | |
| | | <template> |
| | | <zt-dialog ref="dialog" @confirm="formSubmit" append-to-body> |
| | | <zt-dialog ref="dialog" append-to-body @confirm="formSubmit" :hasConfirm="true"> |
| | | <el-form :model="dataForm" ref="dataForm" :disabled="dataForm.disabled" label-width="120px"> |
| | | <zt-form-item label="上级系统" prop="pid"> |
| | | <zt-form-item label="上级节点" prop="pid"> |
| | | <zt-select v-model="dataForm.pid" placeholder=" " :datas="productList" @input="selectDefaultProduct"/> |
| | | </zt-form-item> |
| | | <zt-form-item label="名称" prop="name" rules="required"> |
| | |
| | | this.getProductList() |
| | | }, |
| | | selectDefaultProduct() { |
| | | this.dataForm.nodeType = 1 |
| | | this.dataForm.nodeType = 5 |
| | | this.getDefaultImg(this.dataForm.nodeType) |
| | | }, |
| | | // 获取系统列表 |
| | |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="sort" label="排序" align="center"/> |
| | | <zt-table-column-handle :table="table" width="150" /> |
| | | <zt-table-column-handle :table="table" width="150"/> |
| | | </el-table> |
| | | <!-- 弹窗, 新增 / 修改 --> |
| | | <add-or-update @refreshDataList="table.query"/> |
| | |
| | | <template> |
| | | <zt-dialog ref="dialog" @confirm="formSubmit"> |
| | | <zt-dialog ref="dialog" @confirm="formSubmit" :hasConfirm="true"> |
| | | <el-form :model="dataForm" ref="dataForm" :disabled="dataForm.disabled" label-width="120px"> |
| | | <zt-form-item label="上级系统" prop="pid" v-if="isShow"> |
| | | <zt-form-item label="上级节点" prop="pid" v-if="isShow"> |
| | | <zt-combo-tree v-model="dataForm.pid" :datas="productList"/> |
| | | </zt-form-item> |
| | | <zt-form-item label="名称" prop="name" rules="required"> |
| | |
| | | }, |
| | | methods: { |
| | | init(id, params) { |
| | | this.getProductList() |
| | | if (params.shipId) { |
| | | this.dataForm.shipId = params.shipId |
| | | } |
| | |
| | | } else if (params.type === 'zt') { |
| | | this.dataForm.pid = params.pid |
| | | this.dataForm.productType = 2 |
| | | this.getProductList() |
| | | this.getDefaultImg(this.dataForm.productType) |
| | | } else { |
| | | this.dataForm.pid = params.pid |
| | |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="sort" label="排序" width="100px" align="center"/> |
| | | <zt-table-column-handle :table="table" width="180px"> |
| | | <zt-table-column-handle :table="table" width="180px" > |
| | | <template v-slot="{ row }"> |
| | | <zt-table-button v-if="productType==='1'" size="small" type="primary" |
| | | @click="importData(row)">导入 |
| | |
| | | <template> |
| | | <zt-dialog ref="dialog" @confirm="formSubmit"> |
| | | <zt-dialog ref="dialog" @confirm="formSubmit" :hasConfirm="true"> |
| | | <el-form :model="dataForm" ref="dataForm" :disabled="dataForm.disabled" label-width="120px"> |
| | | <zt-form-item label="模型名称" prop="modelName" rules="required"> |
| | | <el-input v-model="dataForm.modelName"></el-input> |
| | |
| | | <template> |
| | | <zt-dialog ref="dialog" @confirm="formSubmit"> |
| | | <zt-dialog ref="dialog" @confirm="formSubmit" :hasConfirm="true"> |
| | | <el-form :model="dataForm" ref="dataForm" :disabled="dataForm.disabled" label-width="120px"> |
| | | <zt-form-item label="工况名称" prop="name" rules="required"> |
| | | <el-input v-model="dataForm.name"></el-input> |
| | |
| | | v-slot="{ table }" :paging='false'> |
| | | <el-form :inline="true" :model="dataForm" @keyup.enter.native="table.query()"> |
| | | <el-form-item> |
| | | <zt-button v-if="dataForm.productId" type="query" @click="table.query()"/> |
| | | <!--<zt-button v-if="dataForm.productId" type="query" @click="table.query()"/>--> |
| | | <zt-button v-if="dataForm.productId" type="add" @click="add()"/> |
| | | <zt-button v-if="dataForm.productId" type="delete" @click="table.deleteHandle()"/> |
| | | </el-form-item> |
| | |
| | | <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 |
| | | <el-option |
| | | v-for="item in scope.row.modelList" |
| | | :key="item.id" |
| | | :label="item.modelName" |
| | |
| | | </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 v-dialogDrag :title="title" top="1vh" width='95%' :visible.sync="dialogVisible2" v-if="dialogVisible2"> |
| | | <model-view ref="modelView"></model-view> |
| | | </el-dialog> |
| | | </zt-table-wraper> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import RBDEditImg from './RBD-edit-img' |
| | | import ModelView from "./ModelView"; |
| | | import cloneDeep from 'lodash/cloneDeep' |
| | | |
| | | export default { |
| | |
| | | modelList: [], |
| | | dialogVisible2: false, |
| | | isChange: false, |
| | | title: '' |
| | | } |
| | | }, |
| | | components: { |
| | | RBDEditImg |
| | | ModelView |
| | | }, |
| | | mounted() { |
| | | this.getModelNodes() |
| | |
| | | console.log(row.children, 'row.children') |
| | | |
| | | for (let subRow of row.children) { |
| | | console.log(subRow,'subRow') |
| | | console.log(subRow.productId,'subRow.productId') |
| | | console.log(subRow, 'subRow') |
| | | console.log(subRow.productId, 'subRow.productId') |
| | | if (modelNodes.indexOf(subRow.productId) != -1) { |
| | | subRow.isDisabled = 0 |
| | | if (subRow.modelList.length == 1) { |
| | |
| | | }, |
| | | drawRBD(row) { |
| | | this.dialogVisible2 = true |
| | | this.title=row.modelName + '模型设计' |
| | | let param = { |
| | | id: row.modelId, |
| | | modelName: row.modelName, |
| | | productId: row.productId |
| | | } |
| | | this.$nextTick(() => { |
| | | this.$refs.rbdEditImg.init(param) |
| | | this.$refs.modelView.init(param) |
| | | }) |
| | | } |
| | | } |
| | |
| | | <el-table ref="table" :data="tjDataList" height="230px" border> |
| | | <el-table-column align="center" prop="tjlx" label="查询类型"> |
| | | </el-table-column> |
| | | <el-table-column align="center" prop="specifiedValue" label="已知规定值"> |
| | | <el-table-column align="center" prop="specifiedValue" label="检验上限"> |
| | | <template v-slot="{ row }"> |
| | | <el-input v-model="row.specifiedValue" style="width:100%" :disabled="row.tjlx==='不限定规定值查询'"></el-input> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column align="center" prop="minAccepValue" label="最低可接受值"> |
| | | <el-table-column align="center" prop="minAccepValue" label="检验下限"> |
| | | <template v-slot="{ row }"> |
| | | <el-input v-model="row.minAccepValue" style="width:100%"></el-input> |
| | | </template> |
| | |
| | | </el-table-column> |
| | | <el-table-column align="center" width="100" label="操作"> |
| | | <template v-slot="{ row }"> |
| | | <el-button type="primary" @click="check(row)">查询</el-button> |
| | | <el-button type="primary" @click="check(row)">{{row.btnName}}</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | </el-table-column> |
| | | <el-table-column align="center" prop="totalTestTime" label="总试验时间(h)"> |
| | | </el-table-column> |
| | | <el-table-column v-if="isShow" align="center" prop="number" label="规定值"> |
| | | <el-table-column v-if="isShow" align="center" prop="specifiedValue" label="检验上限"> |
| | | </el-table-column> |
| | | <el-table-column align="center" prop="productionRiskReal" label="生产方风险实际值(%)"> |
| | | </el-table-column> |
| | |
| | | isShow: false, |
| | | tjDataList: [{ |
| | | tjlx: '按风险名义值查询', |
| | | btnName: '查询一', |
| | | specifiedValue: null, |
| | | minAccepValue: null, |
| | | productionRisk: null, |
| | |
| | | }, |
| | | { |
| | | tjlx: '不限定生产方风险查询', |
| | | btnName: '查询二', |
| | | specifiedValue: null, |
| | | minAccepValue: null, |
| | | productionRisk: null, |
| | | userRisk: null, |
| | | showFailureTime: null |
| | | showFailureTime: 10 |
| | | }, |
| | | { |
| | | tjlx: '不限定规定值查询', |
| | | btnName: '查询三', |
| | | specifiedValue: null, |
| | | minAccepValue: null, |
| | | productionRisk: null, |
| | | userRisk: null, |
| | | showFailureTime: null |
| | | showFailureTime: 10 |
| | | } |
| | | ], |
| | | riskList: [ |
| | |
| | | this.dataList = res.data |
| | | if (row.tjlx === "不限定规定值查询") { |
| | | this.isShow = true |
| | | }else{ |
| | | this.isShow = false |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | <template> |
| | | <div> |
| | | <div class="mod-baseReliability-paramDataBasic fa-card-a" style="margin-left: 5px;"> |
| | | <zt-table-wraper :defaultNotQuery='true' ref="tableObj" query-url="/taskReliability/ReliabilityAssess/page" |
| | | v-slot="{ table }" :paging='false'> |
| | | <el-form :inline="true" :model="dataForm" ref="dataForm" :disabled="dataForm.disabled" label-width="80px"> |
| | | <zt-form-item label="产品节点" prop="productId"> |
| | | <zt-select v-model="dataForm.productId" :datas="productList" @change="onProductSelected"/> |
| | | </zt-form-item> |
| | | <zt-form-item label="总体任务" prop="taskModelId"> |
| | | <zt-select v-model="dataForm.taskModelId" :datas="taskList" @change="onTaskSelected"/> |
| | | </zt-form-item> |
| | | <zt-form-item label="评定数据" prop="taskModelId"> |
| | | <zt-select v-model="dataForm.itemId" :datas="assessDataList" @change="onAssessDataSelected"/> |
| | | </zt-form-item> |
| | | <zt-form-item label="置信度" prop="confidence"> |
| | | <el-input v-model="dataForm.confidence" placeholder="置信度" clearable></el-input> |
| | | </zt-form-item> |
| | | <el-button type="primary">评定</el-button> |
| | | <el-button type="primary" @click="add()">新增评定数据</el-button> |
| | | </el-form> |
| | | <el-table v-loading="table.dataLoading" :data="table.dataList" height="100px" v-adaptive="{bottomOffset:70}" |
| | | row-key="id" |
| | | :tree-props="{children: 'children', hasChildren: 'hasChildren'}" |
| | | :header-cell-style="{'text-align':'center'}" |
| | | border @selection-change="table.selectionChangeHandle"> |
| | | <el-table-column prop="name" label="名称"/> |
| | | <el-table-column prop="runTimes" label="运行时长" align="right"> |
| | | </el-table-column> |
| | | <el-table-column prop="runNum" label="运行次数" align="right"> |
| | | </el-table-column> |
| | | <el-table-column prop="failNum" label="失败次数" align="right"> |
| | | </el-table-column> |
| | | <el-table-column prop="assessResult" label="评定结果" align="right"> |
| | | </el-table-column> |
| | | </el-table> |
| | | <add-or-update @refreshDataList="refreshData" ref="AddOrUpdate"/> |
| | | </zt-table-wraper> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | <script> |
| | | import AddOrUpdate from './RelisbilityAssess-AddOrUpdate' |
| | | |
| | | export default { |
| | | data() { |
| | | return { |
| | | dataForm: { |
| | | productId:'', |
| | | shipName:'', |
| | | taskModelId:'', |
| | | itemId:'', |
| | | name:'', |
| | | runTimes:'', |
| | | failNum:'', |
| | | runNum:'', |
| | | assessResult:'', |
| | | confidence:'', |
| | | }, |
| | | productList: [], |
| | | taskList: [], |
| | | assessDataList: [], |
| | | } |
| | | }, |
| | | components: { |
| | | AddOrUpdate |
| | | }, |
| | | mounted() { |
| | | this.getProductList() |
| | | }, |
| | | methods: { |
| | | // 获取信息 |
| | | onProductSelected(data) { |
| | | console.log(data, ' onProductSelected(data)') |
| | | this.dataForm.productId = data.id |
| | | this.dataForm.shipName = data.name |
| | | this.getTaskList() |
| | | this.getAssessDataList(); |
| | | }, |
| | | onTaskSelected(data) { |
| | | console.log(data, ' onProductSelected(data)') |
| | | this.dataForm.taskModelId = data.id |
| | | }, |
| | | onAssessDataSelected(data){ |
| | | this.dataForm.itemId = data.id |
| | | }, |
| | | refreshData(){ |
| | | this.getAssessDataList(); |
| | | }, |
| | | async getAssessDataList() { |
| | | let params={ |
| | | productId:this.dataForm.productId |
| | | } |
| | | let res = await this.$http.get('/taskReliability/ReliabilityAssess/getAssessDataList',{params: params}) |
| | | this.assessDataList = res.data |
| | | this.dataForm.itemId = this.assessDataList[0].id |
| | | }, |
| | | add(){ |
| | | this.$refs.AddOrUpdate.$refs.dialog.init(null, {productId: this.dataForm.productId,shipName: this.dataForm.shipName}) |
| | | }, |
| | | async getProductList() { |
| | | let res = await this.$http.get('/basicInfo/XhProductModel/getTaskProductList') |
| | | this.productList = res.data |
| | | this.onProductSelected(this.productList[0]) |
| | | }, |
| | | async getTaskList() { |
| | | let params = { |
| | | productId: this.dataForm.productId |
| | | } |
| | | let res = await this.$http.get('/taskReliability/Task/getTaskList', {params: params}) |
| | | console.log(res.data) |
| | | this.taskList = res.data |
| | | }, |
| | | } |
| | | } |
| | | </script> |
New file |
| | |
| | | <template> |
| | | <zt-dialog ref="dialog" @confirm="formSubmit" :hasConfirm="true"> |
| | | <el-form :model="dataForm" ref="dataForm" :disabled="dataForm.disabled" label-width="120px"> |
| | | <zt-form-item label="总体" prop="shipName"> |
| | | <el-input v-model="dataForm.shipName"></el-input> |
| | | </zt-form-item> |
| | | <zt-form-item label="名称" prop="name" rules="required"> |
| | | <el-input v-model="dataForm.name"></el-input> |
| | | </zt-form-item> |
| | | <zt-form-item style="width:100%;" label=""> |
| | | <el-upload |
| | | style="width: 600px" |
| | | class="upload-demo" |
| | | ref="upload" |
| | | :action="apiURL" |
| | | :on-success="succ" |
| | | :on-exceed="uploadExceed" |
| | | :on-error="err" |
| | | :limit="1" |
| | | :file-list="fileList" |
| | | :auto-upload="false"> |
| | | <div style="display:inline-block;font-size: 14px;" class="el-upload__tip"> 只能上传.xlsx或.xls的文件,且不超过2G</div> |
| | | <el-button slot="trigger" size="small" type="primary" style="font-size: 15px">选取文件</el-button> |
| | | <el-button type="primary" size="small" style="margin-left:20px;font-size: 15px" @click="submitUpload()">提 交</el-button> |
| | | </el-upload> |
| | | </zt-form-item> |
| | | <el-progress :text-inside="true" :stroke-width="30" :percentage="progress.speed"></el-progress> |
| | | </el-form> |
| | | </zt-dialog> |
| | | </template> |
| | | |
| | | <script> |
| | | import {guid} from "../../../commonJS/common"; |
| | | import qs from "qs"; |
| | | import Cookies from "js-cookie"; |
| | | |
| | | export default { |
| | | data() { |
| | | return { |
| | | dataForm: { |
| | | name:'', |
| | | productId:'' |
| | | }, |
| | | progress: { |
| | | id: null, |
| | | speed: 0, |
| | | text: '', |
| | | start: false, |
| | | timer: null |
| | | }, |
| | | start: 0, |
| | | fileType: ['xlsx', 'xls'], |
| | | fileList:[], |
| | | apiURL:'', |
| | | itemId:'' |
| | | } |
| | | }, |
| | | methods: { |
| | | async init(id, param) { |
| | | let result = await this.$http.get(`/basicInfo/TyProductModel/getUuid`) |
| | | this.dataForm.itemId = result.data |
| | | this.dataForm.productId = param.productId |
| | | this.dataForm.shipName = param.shipName |
| | | this.fileList = [] |
| | | this.resultData = [] |
| | | this.progress.id = guid() |
| | | let params = qs.stringify({ |
| | | token: Cookies.get('token'), |
| | | progressId: this.progress.id, |
| | | pid: this.dataForm.productId, |
| | | itemId: this.dataForm.itemId, |
| | | }) |
| | | this.apiURL = `${window.SITE_CONFIG['apiURL']}/taskReliability/ReliabilityAssess/importProductExcel?${params}` |
| | | }, |
| | | uploadExceed(files, fileList) { |
| | | this.$set(fileList[0], 'raw', files[0]) |
| | | this.$set(fileList[0], 'name', files[0].name) |
| | | this.$refs.upload.clearFiles() |
| | | this.$refs.upload.handleStart(files[0]) |
| | | }, |
| | | succ(res, file, fileList) { |
| | | clearInterval(this.timer) |
| | | this.dataForm.speed = 100 |
| | | this.$refs.upload.clearFiles() |
| | | this.fileList = [] |
| | | this.$emit('refreshDataList') |
| | | }, |
| | | err(res, file, fileList) { |
| | | clearInterval(this.timer) |
| | | this.dataForm.speed = 0 |
| | | this.$tip.error(res.msg) |
| | | }, |
| | | submitUpload() { |
| | | this.dataForm.speed = 0 |
| | | this.progress.speed = 0 |
| | | this.progress.start = true |
| | | this.progress.timer = window.setInterval(this.getStroke, 1000) |
| | | this.uploadQuery() |
| | | }, |
| | | uploadQuery() { |
| | | if (this.$refs.upload.uploadFiles.length === 1) { |
| | | this.start = 1 |
| | | this.$refs.upload.submit() |
| | | } else { |
| | | this.$tip.error('请选择需要上传的.xlsx或.xls的文件') |
| | | } |
| | | }, |
| | | getStroke() { |
| | | //console.log('getStroke:',this.progress.start,",",this.progress.speed) |
| | | if (this.progress.start && this.progress.speed < 100) { |
| | | //console.log('getStroke2') |
| | | this.$http.get(`sys/common/stroke?progressId=${this.progress.id}`).then( |
| | | res => { |
| | | if (res.success) { |
| | | this.progress.speed = parseFloat(res.data.speed) |
| | | this.progress.text = res.data.text |
| | | } |
| | | } |
| | | ) |
| | | } else { |
| | | clearInterval(this.timer) |
| | | } |
| | | }, |
| | | // 表单提交 |
| | | async formSubmit() { |
| | | let param={ |
| | | id:this.dataForm.itemId, |
| | | name:this.dataForm.name, |
| | | productId:this.dataForm.productId |
| | | } |
| | | let res = await this.$http.post('/taskReliability/ReliabilityAssess/add', param) |
| | | if (res.success) { |
| | | await this.$tip.success() |
| | | this.$refs.dialog.close() |
| | | this.$emit('refreshDataList') |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | </script> |
| | |
| | | </div> |
| | | </div> |
| | | <div :disabled="isShow"> |
| | | <div class="echart" id="myChart" :style="myChartStyle"></div> |
| | | <div class="echart" id="SchemeCompar" :style="myChartStyle"></div> |
| | | </div> |
| | | </div> |
| | | </el-col> |
| | |
| | | }, |
| | | series: this.seriesList |
| | | }; |
| | | this.myChart = echart.init(document.getElementById("myChart")); |
| | | this.myChart = echart.init(document.getElementById("SchemeCompar")); |
| | | console.log(this.option, ' this.option ') |
| | | this.myChart.setOption(this.option); |
| | | //随着屏幕大小调节图表 |
| | |
| | | this.taskList = res.data |
| | | }, |
| | | getStroke() { |
| | | //console.log('getStroke:',this.progress.start,",",this.progress.speed) |
| | | if (this.percentage < 100) { |
| | | //console.log('getStroke2') |
| | | this.$http.get(`/taskReliability/SimulatAssess/getCalcProgress?taskId=${this.dataForm.id}`).then( |
| | | res => { |
| | | // console.log(res.data, 'res.data') |
| | | if (res.data) { |
| | | this.percentage = parseFloat(res.data) |
| | | } |
| | |
| | | <template> |
| | | <zt-dialog ref="dialog" @confirm="formSubmit"> |
| | | <zt-dialog ref="dialog" @confirm="formSubmit" :hasConfirm="true"> |
| | | <el-form :model="dataForm" ref="dataForm" :disabled="dataForm.disabled" label-width="120px"> |
| | | <zt-form-item label="任务名称" prop="taskName" rules="required"> |
| | | <el-input v-model="dataForm.taskName"></el-input> |
| | |
| | | <template> |
| | | <zt-dialog ref="dialog" @confirm="formSubmit"> |
| | | <zt-dialog ref="dialog" @confirm="formSubmit" :hasConfirm="true"> |
| | | <el-form :model="dataForm" ref="dataForm" :disabled="dataForm.disabled" label-width="120px"> |
| | | <zt-form-item label="任务阶段名称" prop="phaseName" rules="required"> |
| | | <el-input v-model="dataForm.phaseName"></el-input> |
| | |
| | | console.log(this.time) |
| | | }, |
| | | add() { |
| | | console.log(this.time) |
| | | this.$refs.AddOrUpdate.$refs.dialog.init(null, { |
| | | taskId: this.dataForm.taskId, |
| | | productId: this.dataForm.productId, |