jinlin
2024-11-07 d0e1a3fb24d0ee76aa4ef1b0e042392b4d3ac794
预计参数多层次分级,新增型号增加namePath
7个文件已修改
86 ■■■■■ 已修改文件
modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/controller/XhProductModelController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/service/XhProductModelService.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
modules/mainPart/src/main/resources/mapper/baseReliability/ParamDataBasicDao.xml 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
modules/mainPart/src/main/resources/mapper/basicInfo/XhProductModelDao.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/views/modules/baseReliability/ParamDataBasic.vue 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/views/modules/basicInfo/XhProductModel-AddOrUpdate.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/views/modules/basicInfo/XhProductModel.vue 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/controller/XhProductModelController.java
@@ -171,7 +171,7 @@
            paramDataService.insert(data);
        }
        xhProductModel.setNamePath(xhProductModel.getNamePath() + "," + xhProductModel.getName());
        xhProductModelService.insert(xhProductModel);
        Map<Long, XhProductModel> imgMap = new HashMap<>();
        imgMap = (Map<Long, XhProductModel>) CacheUtils.get("sysImgCache", "sysImgCache");
modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/service/XhProductModelService.java
@@ -451,23 +451,37 @@
            Workbook workbook = new XSSFWorkbook(inputStream);
            // 获取第一个工作表
            Sheet sheet = workbook.getSheetAt(0);
            List.sort((o1, o2) -> {
                String[] parentList1 = o1.getNamePath().split(",");
                String[] parentList2 = o2.getNamePath().split(",");
                String xt1 = parentList1.length > 0 ? parentList1[0] : "";
                String xt2 = parentList2.length > 0 ? parentList2[0] : "";
                // 首先比较xt值
                int xtCompare = xt1.compareTo(xt2);
                if (xtCompare != 0) {
                    return xtCompare;
                }
                // 如果xt相同,比较parentList的长度,确保parentList.length = 2的数据排在前面
                return Integer.compare(parentList1.length, parentList2.length);
            });
            int num = 0;
            String xt = "";
            String fxt = "";
            String sb = "";
            for (int i = 0; i < List.size(); i++) {
                if (List.get(i).getProductType() == 5) {
                    num = num + 1;
                    String[] parentList = List.get(i).getNamePath().split(",");
                    Row row = sheet.createRow(sheet.getLastRowNum() + 1); // 创建新行
                    Cell cell = row.createCell(0);
                    cell.setCellValue(num);
                if (!xt.equals(parentList[0])) {
                    xt = parentList[0];
                    cell = row.createCell(1);
                    cell.setCellValue(xt);
                }
                    if (parentList.length > 2) {
                        if (!xt.equals(parentList[0])) {
                            xt = parentList[0];
                            cell = row.createCell(1);
                            cell.setCellValue(xt);
                        }
                        if (!fxt.equals(parentList[1])) {
                            fxt = parentList[1];
                            cell = row.createCell(2);
@@ -479,12 +493,6 @@
                            cell.setCellValue(sb);
                        }
                    } else {
                        if (!xt.equals(parentList[0])) {
                            xt = parentList[0];
                            cell = row.createCell(1);
                            cell.setCellValue(xt);
                        }
                        if (!sb.equals(parentList[1])) {
                            sb = parentList[1];
                            cell = row.createCell(3);
@@ -563,7 +571,6 @@
                        cell.setCellValue(List.get(i).getRepairMttcrOtherParams3());
                    }
                }
            }
            response.setContentType("application/octet-stream;charset=UTF-8");
            String encodedFilename = DownloadService.getNameEncoder(request, name + "_产品结构树.xlsx");
            response.addHeader("Content-Disposition", "attachment;filename=" + encodedFilename);
modules/mainPart/src/main/resources/mapper/baseReliability/ParamDataBasicDao.xml
@@ -113,6 +113,33 @@
            where b.ship_id = ${shipId}
              and a.product_id = b.id
              and a.basic_join_compute = 1
              and b.product_type = 5
            group by b.pid
        ) b
        set a.basic_join_compute = b.basic_join_compute
        where a.product_id = b.pid;
        UPDATE param_data a,(
            select pid, case when count(1) > 0 then 1 else 0 end as basic_join_compute
            from param_data a,
                 product_model b
            where b.ship_id = ${shipId}
              and a.product_id = b.id
              and a.basic_join_compute = 1
              and b.product_type = 4
            group by b.pid
        ) b
        set a.basic_join_compute = b.basic_join_compute
        where a.product_id = b.pid;
        UPDATE param_data a,(
            select pid, case when count(1) > 0 then 1 else 0 end as basic_join_compute
            from param_data a,
                 product_model b
            where b.ship_id = ${shipId}
              and a.product_id = b.id
              and a.basic_join_compute = 1
              and b.product_type = 3
            group by b.pid
        ) b
        set a.basic_join_compute = b.basic_join_compute
modules/mainPart/src/main/resources/mapper/basicInfo/XhProductModelDao.xml
@@ -191,6 +191,7 @@
          and a.ship_id = ${shipId}
          AND a.id &lt;&gt; a.ship_id
          and a.id = b.product_id
          and a.product_type = 5
    </select>
    <select id="getProductListByShip" resultType="com.zt.life.modules.mainPart.basicInfo.model.XhProductModel">
        select a.*, b.basic_unit_num as sameSbNum
web/src/views/modules/baseReliability/ParamDataBasic.vue
@@ -29,33 +29,33 @@
                      border @selection-change="table.selectionChangeHandle">
              <!--<el-table-column type="selection" width="40"/>-->
              <el-table-column prop="name" label="名称"/>
              <el-table-column prop="basicUnitNum" label="单元数量"/>
              <el-table-column prop="basicMtbfRegulate" label="MTBF" align="right">
              <el-table-column prop="basicUnitNum" label="单元数量" align="center" width="100"/>
              <el-table-column prop="basicMtbfRegulate" label="MTBF" align="right" width="120">
                <template slot-scope="scope">
                  <span>{{  keepNumber(scope.row.basicMtbfRegulate) }}</span>
                </template>
              </el-table-column>
              <el-table-column prop="repairMttcr" label="MTTR" align="right">
              <el-table-column prop="repairMttcr" label="MTTR" align="right" width="120">
                <template slot-scope="scope">
                  <span>{{  keepNumber(scope.row.repairMttcr) }}</span>
                </template>
              </el-table-column>
              <el-table-column prop="basicMtbfRegulSuccRate" label="成功率" align="right">
              <el-table-column prop="basicMtbfRegulSuccRate" label="成功率" align="right" width="100">
                <template slot-scope="scope">
                  <span>{{keepNumber(scope.row.basicMtbfRegulSuccRate) }}</span>
                </template>
              </el-table-column>
              <el-table-column prop="basicRunsNum" label="运行次数" align="right">
              <el-table-column prop="basicRunsNum" label="运行次数" align="right" width="100">
                <template slot-scope="scope">
                  <span>{{scope.row.basicRunsNum}}</span>
                </template>
              </el-table-column>
              <el-table-column prop="basicMtbfOperatingRatio" label="运行比" align="right">
              <el-table-column prop="basicMtbfOperatingRatio" label="运行比" align="right" width="100">
                <template slot-scope="scope">
                  <span>{{keepNumber(scope.row.basicMtbfOperatingRatio) }}</span>
                </template>
              </el-table-column>
              <el-table-column prop="ai" label="可用度" align="right">
              <el-table-column prop="ai" label="可用度" align="right" width="100">
                <template slot-scope="scope">
                  <span>{{keepNumber(scope.row.ai)}}</span>
                </template>
web/src/views/modules/basicInfo/XhProductModel-AddOrUpdate.vue
@@ -49,6 +49,7 @@
          operatImgName: '',
          sort: '',
          equipType: '',
          namePath:'',
          status: ''
        }
      }
@@ -73,9 +74,8 @@
          this.getDefaultImg(this.dataForm.productType)
        } else {
          this.dataForm.pid = params.pid
          console.log(params.productType,'type')
          console.log(parseInt(params.productType),'parseInttype')
          this.dataForm.productType = parseInt(params.productType)
          this.dataForm.namePath= params.namePath
          this.getDefaultImg(this.dataForm.productType)
        }
        if (this.dataForm.productType === '10' && id == null) {
web/src/views/modules/basicInfo/XhProductModel.vue
@@ -107,7 +107,7 @@
            shipId: this.shipId,
            namePath: this.namePath
          })*/
          this.$refs.AddOrUpdate.$refs.dialog.init(null, {id: null, productType: parseInt(this.dataForm.type)+1 , pid: this.dataForm.pid,shipId: this.shipId})
          this.$refs.AddOrUpdate.$refs.dialog.init(null, {id: null, productType: parseInt(this.dataForm.type)+1 , pid: this.dataForm.pid,shipId: this.shipId,namePath: this.namePath})
        } else {
          this.$refs.AddOrUpdate.$refs.dialog.init(null, {id: null, type: 'zt', pid: this.dataForm.pid,shipId: this.shipId})
        }
@@ -157,9 +157,6 @@
        })
        let apiURL = `/basicInfo/XhProductModel/exportData`
        window.location.href = `${window.SITE_CONFIG['apiURL']}${apiURL}?${params}`
      },
      exportProduct() {
        window.location.href = './产品结构树导入模板.xlsx'