jinlin
2024-03-13 91c67198a84e9c0a76cc0154fbebf62813c1de26
修改
11个文件已修改
5个文件已删除
662 ■■■■■ 已修改文件
modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/dao/XhProductModelDao.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/service/XhProductModelService.java 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
modules/mainPart/src/main/java/com/zt/life/modules/sysPictureBase/controller/SysPictureBaseController.java 122 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
modules/mainPart/src/main/java/com/zt/life/modules/sysPictureBase/model/SysPictureBase.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
modules/mainPart/src/main/java/com/zt/life/modules/sysPictureBase/service/SysPictureBaseService.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
modules/mainPart/src/main/resources/mapper/basicInfo/XhProductModelDao.xml 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
starter/src/main/resources/application.yml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/public/scale/bottom.jpg 补丁 | 查看 | 原始文档 | blame | 历史
web/public/scale/center.jpg 补丁 | 查看 | 原始文档 | blame | 历史
web/public/scale/left.jpg 补丁 | 查看 | 原始文档 | blame | 历史
web/public/scale/right.jpg 补丁 | 查看 | 原始文档 | blame | 历史
web/public/scale/top.jpg 补丁 | 查看 | 原始文档 | blame | 历史
web/src/views/modules/basicInfo/XhProductModel.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/views/modules/sysPictureBase/SysPictureBase-AddOrUpdate.vue 63 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/views/modules/sysPictureBase/SysPictureBase.vue 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/views/modules/taskReliability/RBD-edit-img.vue 395 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/dao/XhProductModelDao.java
@@ -28,4 +28,6 @@
    List<XhProductModel> getProductList();
    List<ProductImg> getProduct(Long productId);
    String getDefaultImg();
}
modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/service/XhProductModelService.java
@@ -12,6 +12,7 @@
import com.zt.modules.sys.model.SysMenu;
import org.springframework.stereotype.Service;
import com.zt.common.db.query.QueryFilter;
import javax.annotation.Resource;
import java.util.List;
@@ -19,11 +20,11 @@
/**
 * product_model
 *
 * @author zt generator
 * @author zt generator
 * @since 1.0.0 2024-02-29
 */
@Service
public class XhProductModelService  extends BaseService<XhProductModelDao, XhProductModel> {
public class XhProductModelService extends BaseService<XhProductModelDao, XhProductModel> {
    /**
     * 分页查询
@@ -32,7 +33,16 @@
     * @return
     */
    public List<XhProductModel> page(QueryFilter queryFilter) {
        return baseDao.getList(queryFilter.getQueryParams());
        List<XhProductModel> list = baseDao.getList(queryFilter.getQueryParams());
        for (XhProductModel productModel : list) {
            if (productModel.getProductType().equals("1")) {
                productModel.setDefaultImg(baseDao.getDefaultImg());
                if (productModel.getId() != null) {
                    this.update(productModel);
                }
            }
        }
        return list;
    }
    /**
@@ -45,17 +55,18 @@
    }
    public List<XhProductModel> getAllTree() {
            List<XhProductModel> productList = baseDao.selectList(new QueryWrapper<XhProductModel>().eq(Constant.TableColumn.IS_DELETE,
                    Constant.Bool.NO) .gt("product_type", 1).orderByAsc(Constant.TableColumn.SORT));
            return TreeUtils.build(productList);
        List<XhProductModel> productList = baseDao.selectList(new QueryWrapper<XhProductModel>().eq(Constant.TableColumn.IS_DELETE,
                Constant.Bool.NO).gt("product_type", 1).orderByAsc(Constant.TableColumn.SORT));
        return TreeUtils.build(productList);
    }
    public Integer getNo(Long pid) {
        if (baseDao.getNo(pid) == null){
        if (baseDao.getNo(pid) == null) {
            return 0;
        }
        return baseDao.getNo(pid);
    }
    public List<XhProductModel> getProductList() {
        List<XhProductModel> ProductList = baseDao.getProductList();
        return TreeUtils.build(ProductList);
modules/mainPart/src/main/java/com/zt/life/modules/sysPictureBase/controller/SysPictureBaseController.java
@@ -1,6 +1,7 @@
package com.zt.life.modules.sysPictureBase.controller;
import com.spire.xls.Workbook;
import com.zt.common.annotation.LogOperation;
import com.zt.common.constant.Constant;
import com.zt.common.annotation.QueryParam;
@@ -16,13 +17,26 @@
import com.zt.life.modules.sysPictureBase.service.SysPictureBaseService;
import com.zt.life.sys.dto.OssDto;
import com.zt.life.sys.service.SysOssConfigService;
import com.zt.modules.oss.enums.CloudChannel;
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.beans.factory.annotation.Value;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.util.FileCopyUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import springfox.documentation.annotations.ApiIgnore;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletResponse;
import java.awt.image.BufferedImage;
import java.io.*;
/**
@@ -32,7 +46,7 @@
 * @since 1.0.0 2024-02-27
 */
@RestController
@RequestMapping("/sysPictureBase/SysPictureBase/")
@RequestMapping("/sysPictureBase/")
@Api(tags = "sys_picture_base")
public class SysPictureBaseController {
    @Autowired
@@ -40,6 +54,8 @@
    @Autowired
    private SysOssConfigService sysOssConfigService;
    @Value("${zt.oss.local-path}")
    private String localPath;
    @GetMapping("page")
    @ApiOperation("分页")
@@ -58,38 +74,92 @@
    @ApiOperation("信息")
    public Result<SysPictureBase> get(@PathVariable("id") Long id) {
        SysPictureBase data = sysPictureBaseService.get(id);
        if (id != null) {
            OssDto ossDto = sysOssConfigService.getOssByBusiType(id, "sys_picture");
            if (ossDto != null) {
                data.setFiles(ossDto);
            }
        }
        return Result.ok(data);
    }
    @PostMapping
    @ApiOperation("新增")
    @LogOperation("新增")
    public Result insert(@RequestBody SysPictureBase sysPictureBase) {
        //效验数据
        ValidatorUtils.validateEntity(sysPictureBase, AddGroup.class, DefaultGroup.class);
        Integer no = sysPictureBaseService.getNo();
        sysPictureBase.setSortNo(no + 1);
        sysPictureBaseService.insert(sysPictureBase);
        sysOssConfigService.updateOss(sysPictureBase.getId(), sysPictureBase.getFiles());// 保存附件
    @PostMapping("save")
    @ApiOperation("保存")
    @LogOperation("保存")
    public Result save(@RequestBody MultipartFile file, Long id, String type, String subType,
                       String name, String contentType, String systemMark, Integer sortNo, String remark) {
        SysPictureBase sysPictureBase;
        if (id != null) {
            sysPictureBase = sysPictureBaseService.get(id);
            sysPictureBase.setType(type);
            sysPictureBase.setSubType(subType);
            sysPictureBase.setName(name);
            sysPictureBase.setContentType(contentType);
            sysPictureBase.setSystemMark(systemMark);
            sysPictureBase.setSortNo(sortNo);
            sysPictureBase.setRemark(remark);
            sysPictureBaseService.update(sysPictureBase);
        } else {
            sysPictureBase = new SysPictureBase();
            sysPictureBase.setType(type);
            sysPictureBase.setSubType(subType);
            sysPictureBase.setName(name);
            sysPictureBase.setContentType(contentType);
            sysPictureBase.setSystemMark(systemMark);
            Integer no = sysPictureBaseService.getNo();
            sysPictureBase.setSortNo(no + 1);
            sysPictureBase.setRemark(remark);
            sysPictureBaseService.insert(sysPictureBase);
        }
        if (file != null) {
            BufferedImage bufferedImage = null;
            try {
                String fileName = file.getOriginalFilename();
                String[] arr = fileName.split("\\.");
                String suffixName = arr[arr.length - 1].toLowerCase();
                bufferedImage = ImageIO.read(file.getInputStream());
                // 宽度
                int width = bufferedImage.getWidth();
                sysPictureBase.setWidth(width);
                // 高度
                int height = bufferedImage.getHeight();
                sysPictureBase.setHeight(height);
                sysPictureBaseService.update(sysPictureBase);
                String tempUploadDir = localPath + "/product_img/";
                File dir = new File(tempUploadDir);
                if (!dir.exists()) {
                    dir.mkdirs();
                }
                ImageIO.write(bufferedImage, suffixName, new File(tempUploadDir + sysPictureBase.getId().toString()));
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return Result.ok();
    }
    @PutMapping
    @ApiOperation("修改")
    @LogOperation("修改")
    public Result update(@RequestBody SysPictureBase sysPictureBase) {
        //效验数据
        ValidatorUtils.validateEntity(sysPictureBase, UpdateGroup.class, DefaultGroup.class);
        sysPictureBaseService.update(sysPictureBase);
        sysOssConfigService.updateOss(sysPictureBase.getId(), sysPictureBase.getFiles());// 保存附件
    @RequestMapping("/getProductImg")
    public void getProductImg(HttpServletResponse response, Long id) {
        try {
            String tempUploadDir = localPath + "/product_img/" + id;
            File file = new File(tempUploadDir);
            //读取指定路径下面的文件
            InputStream in = new FileInputStream(file);
        return Result.ok();
            OutputStream outputStream = new BufferedOutputStream(response.getOutputStream());
            //创建存放文件内容的数组
            byte[] buff = new byte[1024];
            //所读取的内容使用n来接收
            int n;
            //当没有读取完时,继续读取,循环
            while ((n = in.read(buff)) != -1) {
                //将字节数组的数据全部写入到输出流中
                outputStream.write(buff, 0, n);
            }
            //强制将缓存区的数据进行输出
            outputStream.flush();
            //关流
            outputStream.close();
            in.close();
        }  catch (IOException e) {
            e.printStackTrace();
        }
    }
    @DeleteMapping
modules/mainPart/src/main/java/com/zt/life/modules/sysPictureBase/model/SysPictureBase.java
@@ -8,6 +8,7 @@
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.web.multipart.MultipartFile;
import java.util.Date;
@@ -32,6 +33,12 @@
    @ApiModelProperty(value = "图片名称")
    private String name;
    @ApiModelProperty(value = "图片宽度")
    private Integer width;
    @ApiModelProperty(value = "图片高度")
    private Integer height;
    @ApiModelProperty(value = "检索关键字")
    private String contentType;
@@ -45,7 +52,6 @@
    private String remark;
    @TableField(exist = false)
    @ApiModelProperty(value = "附件")
    private OssDto files;
    private MultipartFile file;
}
modules/mainPart/src/main/java/com/zt/life/modules/sysPictureBase/service/SysPictureBaseService.java
@@ -30,9 +30,6 @@
     */
    public List<SysPictureBase> page(QueryFilter queryFilter) {
        List<SysPictureBase> list = baseDao.getList(queryFilter.getQueryParams());
        if (list != null && list.size() > 0) {
            sysOssService.setListOsses(list, "sys_picture");
        }
        return list;
    }
modules/mainPart/src/main/resources/mapper/basicInfo/XhProductModelDao.xml
@@ -47,8 +47,8 @@
               a.`NAME`                    as imgName,
               'node'                      as nodeType,
               ''                          as nodeTypeExt,
               60                          as imgWidth,
               60                          as imgHeight,
               s.width                          as imgWidth,
               s.height                          as imgHeight,
               a.id                        as dataId,
               ''                          as statusImg,
               d.dict_code                 as productType,
@@ -61,16 +61,15 @@
        FROM product_model a
                 left join sys_dict_data d on d.DICT_VALUE = a.product_type and dict_type_id = '1728965873022050306'
                 left join param_data p on p.product_id = a.id and p.page_code = 'expect'
                 left join sys_picture_base s on s.id = a.default_img
        WHERE a.is_delete = 0
          AND a.PID = ${productId}
    </select>
    <select id="getDefaultImg" resultType="java.lang.String">
        SELECT b.id
        SELECT a.id
        FROM sys_picture_base a
                 LEFT JOIN sys_oss b ON a.id = b.BUSI_ID
        WHERE a.IS_DELETE = 0
          AND b.IS_DELETE = 0
          AND a.CONTENT_TYPE = '默认设备'
    </select>
</mapper>
starter/src/main/resources/application.yml
@@ -121,7 +121,7 @@
  oss:
    type: local
    local-domain: http://127.0.0.1:8050/test-project/
    local-path: D:/TestProjectFiles/ #附件存储目录
    local-path: D:/ReliabilitySimulation/ #附件存储目录
    local-qd-path: D:/TestProjectFiles/ #附件存储目录
    local-prefix: accessories #附件存储子目录
    local-area: sy
web/public/scale/bottom.jpg
Binary files differ
web/public/scale/center.jpg
Binary files differ
web/public/scale/left.jpg
Binary files differ
web/public/scale/right.jpg
Binary files differ
web/public/scale/top.jpg
Binary files differ
web/src/views/modules/basicInfo/XhProductModel.vue
@@ -71,7 +71,7 @@
          productType: '',
          type:'',
          pid: '',
          srcId:''
          srcId:'',
        }
      }
    },
web/src/views/modules/sysPictureBase/SysPictureBase-AddOrUpdate.vue
@@ -10,19 +10,24 @@
      <zt-form-item label="图片名称" prop="name" rules="required">
        <el-input v-model="dataForm.name"></el-input>
      </zt-form-item>
      <zt-form-item label="检索关键字" prop="contentType" >
      <zt-form-item label="检索关键字" prop="contentType">
        <el-input v-model="dataForm.contentType"></el-input>
      </zt-form-item>
      <zt-form-item label="系统标识" prop="systemMark" rules="required">
      <zt-form-item label="系统标识" prop="systemMark">
        <zt-dict v-model="dataForm.systemMark" dict="product"></zt-dict>
      </zt-form-item>
      <zt-form-item label="排序" prop="sortNo">
        <el-input v-model="dataForm.sortNo"  :readonly="readonly" @input=""></el-input>
        <el-input v-model="dataForm.sortNo" :readonly="readonly" @input=""></el-input>
      </zt-form-item>
      <div class="el-flex img-src" style="height: 20px">
        <el-form-item class="marginTopAndMarginBottom" style="width: 100%">
          <config-uploader :lineHeight="true" busi-type="sys_picture" model-name="dataForm" :dataForm="dataForm"
                           v-model="dataForm.files"/>
          <!--<config-uploader :lineHeight="true" busi-type="sys_picture" model-name="dataForm" :dataForm="dataForm"
                           v-model="dataForm.files"/>-->
          <el-upload :limit="1" :http-request="httpRequest" :before-upload="beforeUpload" :on-exceed="handleExceed">
            <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
          </el-upload>
          <el-image v-if="dataForm.id" :src="url+dataForm.id" style="height: 50px;width: 50px"></el-image>
        </el-form-item>
      </div>
    </el-form>
@@ -30,9 +35,13 @@
</template>
<script>
  import Cookies from "js-cookie";
  export default {
    data() {
      return {
        url: `${window.SITE_CONFIG['apiURL']}/sysPictureBase/getProductImg?token=${Cookies.get('token')}&id=`,
        fileList: [],
        dataForm: {
          id: '',
          type: '',
@@ -43,24 +52,59 @@
          sortNo: '',
          remark: ''
        },
        readonly:{
        readonly: {
          type: Boolean,
          default: false
        },
      }
    },
    methods: {
      httpRequest(option) {
        this.fileList.length = 0
        this.fileList.push(option)
      },
      // 上传前处理
      beforeUpload(file) {
        let fileSize = file.size
        const FIVE_M = 5 * 1024 * 1024;
        //大于5M,不允许上传
        if (fileSize > FIVE_M) {
          this.$message.error("最大上传5M")
          return false
        }
      },
      // 文件数量过多时提醒
      handleExceed() {
        this.$message({type: 'error', message: '最多支持1个附件上传'})
      },
      // 获取信息
      async getInfo() {
        let res = await this.$http.get(`/sysPictureBase/SysPictureBase/${this.dataForm.id}`)
        let res = await this.$http.get(`/sysPictureBase/${this.dataForm.id}`)
        this.dataForm = {
          ...this.dataForm,
          ...res.data
        }
        console.log(this.dataForm, 'async getInfo()')
      },
      // 表单提交
      async formSubmit() {
        let res = await this.$http[!this.dataForm.id ? 'post' : 'put']('/sysPictureBase/SysPictureBase/', this.dataForm)
        console.log(this.dataForm, 'async formSubmit()')
        // 使用form表单的数据格式
        const params = new FormData()
        // 将上传文件数组依次添加到参数paramsData中
        this.fileList.forEach((x) => {
          params.append('file', x.file)
        });
        // 将输入表单数据添加到params表单中
        params.append('id', this.dataForm.id)
        params.append('type', this.dataForm.type)
        params.append('subType', this.dataForm.subType)
        params.append('name', this.dataForm.name)
        params.append('contentType', this.dataForm.contentType)
        params.append('systemMark', this.dataForm.systemMark)
        params.append('sortNo', this.dataForm.sortNo)
        console.log(params, 'async formSubmit()')
        let res = await this.$http.post('/sysPictureBase/save', params)
        if (res.success) {
          await this.$tip.success()
          this.$refs.dialog.close()
@@ -74,7 +118,8 @@
  .img-sc > .el-form-item > .el-form-item__content {
    width: 100%;
  }
   .marginTopAndMarginBottom {
  .marginTopAndMarginBottom {
    margin-top: 10px !important;
    margin-bottom: 0 !important;
  }
web/src/views/modules/sysPictureBase/SysPictureBase.vue
@@ -1,7 +1,7 @@
<template>
  <el-card shadow="never" class="aui-card--fill">
    <div class="mod-sysPictureBase-sysPictureBase}">
      <zt-table-wraper query-url="/sysPictureBase/SysPictureBase/page" delete-url="/sysPictureBase/SysPictureBase/"
      <zt-table-wraper query-url="/sysPictureBase/page" delete-url="/sysPictureBase/"
                       v-slot="{ table }">
        <el-form :inline="true" :model="dataForm" @keyup.enter.native="table.query()">
          <el-form-item>
@@ -13,8 +13,8 @@
          </el-form-item>
          <el-form-item>
            <zt-button type="query" @click="table.query()"/>
            <zt-button type="add"  @click="table.editHandle()"/>
            <zt-button type="delete"  @click="table.deleteHandle()"/>
            <zt-button type="add" @click="table.editHandle()"/>
            <zt-button type="delete" @click="table.deleteHandle()"/>
          </el-form-item>
        </el-form>
        <el-table v-loading="table.dataLoading" :data="table.dataList" height="100px" v-adaptive="{bottomOffset:70}"
@@ -24,8 +24,8 @@
          <el-table-column prop="name" label="图片名称"/>
          <el-table-column label="图片" align="center">
            <template v-slot="{ row }">
              <el-image v-if="row.accessoryMap" :src="getPath(row)" style="height: 50px;width: 50px"></el-image>
            </template >
              <el-image v-if="row.id" :src="url+row.id" style="height: 50px;width: 50px"></el-image>
            </template>
          </el-table-column>
          <el-table-column prop="contentType" label="检索关键字"/>
          <zt-table-column-dict prop="systemMark" label="系统标识" dict="product"/>
@@ -41,31 +41,24 @@
<script>
  import AddOrUpdate from './SysPictureBase-AddOrUpdate'
  import Cookies from 'js-cookie'
  export default {
    data() {
      return {
        url: `${window.SITE_CONFIG['apiURL']}/sysPictureBase/getProductImg?token=${Cookies.get('token')}&id=`,
        dataForm: {
          contentType: '',
          systemMark: '',
          sortNo:''
          sortNo: ''
        },
      }
    },
    components: {
      AddOrUpdate
    },
    methods: {
      getPath(row) {
          if (row.accessoryMap){
            for (let key in row.accessoryMap) {
              return key
            }
          }
      },
      indexFormat(index) {
        return index += 1
      },
    }
    mounted() {
    },
    methods: {}
  }
</script>
web/src/views/modules/taskReliability/RBD-edit-img.vue
@@ -14,52 +14,52 @@
            <el-form-item>
              模型名称:{{modelName}}
            </el-form-item>
              <el-form-item>
                  <el-button type="primary" @click="saveDiagram()">暂存</el-button>
                  <el-button type="primary" @click="analyzeDiagram()">保存</el-button>
                <el-button type="primary" @click="clearDiagram()">清空图形</el-button>
              </el-form-item>
            <el-form-item>
                <el-tooltip class="item" effect="dark" content="左对齐" placement="left">
                  <el-button class="" style="margin-left: 0;padding: 2px;border: 1px solid #5F95FF;"
                             @click="leftAlign()"><i style="font-size: 2rem;"
                                                     class="wt-iconfont icon-zuoduiqi"></i></el-button>
                </el-tooltip>
              <el-button type="primary" @click="saveDiagram()">暂存</el-button>
              <el-button type="primary" @click="analyzeDiagram()">保存</el-button>
              <el-button type="primary" @click="clearDiagram()">清空图形</el-button>
            </el-form-item>
            <el-form-item>
                <el-tooltip class="item" effect="dark" content="居中对齐" placement="left">
                  <el-button style="margin-left: 0;padding: 2px;border: 1px solid #5F95FF"
                             @click="centerAlign()"><i style="font-size: 2rem;"
                                                       class="wt-iconfont icon-chuizhiduiqi"></i></el-button>
                </el-tooltip>
              <el-tooltip class="item" effect="dark" content="左对齐" placement="left">
                <el-button class="" style="margin-left: 0;padding: 2px;border: 1px solid #5F95FF;"
                           @click="leftAlign()"><i style="font-size: 2rem;"
                                                   class="wt-iconfont icon-zuoduiqi"></i></el-button>
              </el-tooltip>
            </el-form-item>
            <el-form-item>
                <el-tooltip class="item" effect="dark" content="右对齐" placement="left">
                  <el-button style="margin-left: 0;padding: 2px;border: 1px solid #5F95FF"
                             @click="rightAlign()"><i style="font-size: 2rem;"
                                                      class="wt-iconfont icon-youduiqi"></i></el-button>
                </el-tooltip>
              <el-tooltip class="item" effect="dark" content="居中对齐" placement="left">
                <el-button style="margin-left: 0;padding: 2px;border: 1px solid #5F95FF"
                           @click="centerAlign()"><i style="font-size: 2rem;"
                                                     class="wt-iconfont icon-chuizhiduiqi"></i></el-button>
              </el-tooltip>
            </el-form-item>
            <el-form-item>
                <el-tooltip class="item" effect="dark" content="顶部对齐" placement="left">
                  <el-button style="margin-left: 0;padding: 2px;border: 1px solid #5F95FF"
                             @click="topAlign()"><i style="font-size: 2rem;"
                                                    class="wt-iconfont icon-dingduiqi"></i></el-button>
                </el-tooltip>
              <el-tooltip class="item" effect="dark" content="右对齐" placement="left">
                <el-button style="margin-left: 0;padding: 2px;border: 1px solid #5F95FF"
                           @click="rightAlign()"><i style="font-size: 2rem;"
                                                    class="wt-iconfont icon-youduiqi"></i></el-button>
              </el-tooltip>
            </el-form-item>
            <el-form-item>
                <el-tooltip class="item" effect="dark" content="水平对齐" placement="left">
                  <el-button style="margin-left: 0;padding: 2px;border: 1px solid #5F95FF"
                             @click="shuipingAlign()"><i style="font-size: 2rem;"
                                                         class="wt-iconfont icon-shuipingduiqi"></i></el-button>
                </el-tooltip>
              <el-tooltip class="item" effect="dark" content="顶部对齐" placement="left">
                <el-button style="margin-left: 0;padding: 2px;border: 1px solid #5F95FF"
                           @click="topAlign()"><i style="font-size: 2rem;"
                                                  class="wt-iconfont icon-dingduiqi"></i></el-button>
              </el-tooltip>
            </el-form-item>
            <el-form-item>
                <el-tooltip class="item" effect="dark" content="底部对齐" placement="left">
                  <el-button style="margin-left: 0;padding: 2px;border: 1px solid #5F95FF"
                             @click="bottomAlign()"><i style="font-size: 2rem;"
                                                       class="wt-iconfont icon-diduiqi"></i></el-button>
                </el-tooltip>
              <el-tooltip class="item" effect="dark" content="水平对齐" placement="left">
                <el-button style="margin-left: 0;padding: 2px;border: 1px solid #5F95FF"
                           @click="shuipingAlign()"><i style="font-size: 2rem;"
                                                       class="wt-iconfont icon-shuipingduiqi"></i></el-button>
              </el-tooltip>
            </el-form-item>
            <el-form-item>
              <el-tooltip class="item" effect="dark" content="底部对齐" placement="left">
                <el-button style="margin-left: 0;padding: 2px;border: 1px solid #5F95FF"
                           @click="bottomAlign()"><i style="font-size: 2rem;"
                                                     class="wt-iconfont icon-diduiqi"></i></el-button>
              </el-tooltip>
            </el-form-item>
          </el-form>
          <div id="containerImg" style="border: 1px solid #EAEBEE;border-radius: 6px;
@@ -83,6 +83,7 @@
  import ConfigEdge from './ConfigEdge/index.vue'
  import {removeCurrentTabHandle} from '@/commonJS/common'
  import {setHartBeat} from '@/commonJS/common';
  import Cookies from 'js-cookie'
  export default {
    name: 'RBD-edit-img',
@@ -112,21 +113,37 @@
      return {
        modelId: '',
        modelName: '',
        modelType:'',
        modelType: '',
        timer: null,
        imgsList:[
          {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:20,imgHeight:20,imgId:'3',data:{}},
        imgsList: [
          {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: 20,
            imgHeight: 20,
            imgId: '3',
            data: {}
          },
          // {imgPath:'parallelLeft',imgName:'parallelLeft',nodeType:'parallelLeft',imgWidth:60,imgHeight:60,imgId:'3',data:{}},
          // {imgPath:'parallelRight',imgName:'parallel',nodeType:'parallel',imgWidth:60,imgHeight:60,imgId:'4',data:{}},
          {imgPath:'switchRight',imgName:'switch',nodeType:'switch',imgWidth:60,imgHeight:60,imgId:'5',data:{}},
          {imgPath:'voteRight',imgName:'vote',nodeType:'vote',imgWidth:60,imgHeight:60,imgId:'6',data:{}},
          {
            imgPath: 'switchRight',
            imgName: 'switch',
            nodeType: 'switch',
            imgWidth: 60,
            imgHeight: 60,
            imgId: '5',
            data: {}
          },
          {imgPath: 'voteRight', imgName: 'vote', nodeType: 'vote', imgWidth: 60, imgHeight: 60, imgId: '6', data: {}},
        ],
        imgsList2:[
         // {imgPath:'logo',imgName:'logo',nodeType:'node',,nodeTypeExt:'',productType:'',statusImg:'',imgWidth:60,imgHeight:60,imgId:'100',dataId:'123456'},
        imgsList2: [
          // {imgPath:'logo',imgName:'logo',nodeType:'node',,nodeTypeExt:'',productType:'',statusImg:'',imgWidth:60,imgHeight:60,imgId:'100',dataId:'123456'},
        ],
        nodeType:'',
        nodeType: '',
        first: true,
        shape: '',
        projectList: [],
@@ -167,17 +184,17 @@
        id: '',
        graph: null,
        globalGridAttr: {
          voteSum:'',
          repairMttcr:'',
          repairMttcrOther:'',
          repairDistribType:'',
          reliabDistribType:'',
          taskMtbcfOther:'',
          isRepair:0,
          taskMtbcf:'',
          numberInputValue:'',
          statusImg:'',
          nodeTypeExt:'',
          voteSum: '',
          repairMttcr: '',
          repairMttcrOther: '',
          repairDistribType: '',
          reliabDistribType: '',
          taskMtbcfOther: '',
          isRepair: 0,
          taskMtbcf: '',
          numberInputValue: '',
          statusImg: '',
          nodeTypeExt: '',
          type: 'mesh',
          size: 10,
          color: '#e5e5e5',
@@ -213,7 +230,7 @@
        },
        isReady: false,
        curCel: Cell,
        left_p: document.documentElement.clientHeight-100,
        left_p: document.documentElement.clientHeight - 100,
        ports: {
          groups: {
            top: {
@@ -308,32 +325,32 @@
      this.type = 'grid'
    },
    methods: {
      init(row){
      init(row) {
        this.modelName = row.modelName
        this.dataForm.id = row.id
        // this.productId = row.productId
        // this.getProduct(row.productId)
        this.initDigram(row.productId)
        console.log(this.dataForm,'init(row){')
        console.log(this.dataForm, 'init(row){')
      },
      async getDiagram(modelId) {
        let params = {
          modelId : modelId
          modelId: modelId
        }
          let res = await this.$http.get(`/taskReliability/ModelLine/getDiagram`, {params: params})
        console.log(res,'async getDiagram( res')
        let res = await this.$http.get(`/taskReliability/ModelLine/getDiagram`, {params: params})
        console.log(res, 'async getDiagram( res')
        if (res.data !== null && res.data.content != null) {
            this.dataForm = res.data
            console.log(this.dataForm, 'this.dataForm in getDiagram')
            this.diagramJson = JSON.parse(this.dataForm.content)
            // console.log(this.dataForm.content,'this.Diagram content')
            console.log(this.diagramJson, 'this.Diagram json')
            this.graph.fromJSON(this.diagramJson)
            this.graph.centerContent()
            this.graph.zoomToFit()
          } else {
            await this.clearDiagram()
          }
          this.dataForm = res.data
          console.log(this.dataForm, 'this.dataForm in getDiagram')
          this.diagramJson = JSON.parse(this.dataForm.content)
          // console.log(this.dataForm.content,'this.Diagram content')
          console.log(this.diagramJson, 'this.Diagram json')
          this.graph.fromJSON(this.diagramJson)
          this.graph.centerContent()
          this.graph.zoomToFit()
        } else {
          await this.clearDiagram()
        }
      },
      async clearDiagram() {
        this.dataForm.id = null
@@ -372,8 +389,8 @@
            pageVisible: true,
            pageBreak: true,
            pannable: true,
            minVisibleWidth:200,
            minVisibleHeight:200,
            minVisibleWidth: 200,
            minVisibleHeight: 200,
            modifiers: 'shift',
          },
          // panning: {
@@ -468,6 +485,18 @@
        })
        this.graph.centerContent()
        const stencil = new Addon.Stencil({
          getDropNode(node) {
            let {width, height} = node.size()
            if (node.getData().imgWidth) {
              width = node.getData().imgWidth
            }
            if (node.getData().imgHeight) {
              height = node.getData().imgHeight
            }
            console.log(node.getData().imgWidth, node.getData().imgHeight, 'node.size()')
            return node.clone().size(width, height)
          },
        // 返回一个新的节点作为实际放置到画布上的节点
          title: '',
          target: this.graph,
          stencilGraphWidth: 230,
@@ -493,101 +522,101 @@
        })
        document.getElementById('stencilImg').appendChild(stencil.container)
        const imageNodes = this.imgsList.map((item) =>
            this.graph.createNode({
              shape: 'image',
              imageUrl: require('/public/modelImg/'+item.imgPath+'.png'),
              width: item.imgWidth,
              height: item.imgHeight,
              x: item.imgWidth,
              y: item.imgHeight,
              data: {
                dataId: '',
                nodeType: item.nodeType,
                nodeTypeExt: ''
              },
              attrs: {
                text:{
                  text: item.imgName,
                  fontSize: 14,
                  style: {
                    color: this.globalGridAttr.nodeColor
                  },
                  refX: 0.5,
                  refY: '100%',
                  refY2: 4,
                  textAnchor: 'middle',
                  textVerticalAnchor: 'top',
          this.graph.createNode({
            shape: 'image',
            imageUrl: require('/public/modelImg/' + item.imgPath + '.png'),
            width: item.imgWidth,
            height: item.imgHeight,
            x: item.imgWidth,
            y: item.imgHeight,
            data: {
              dataId: '',
              nodeType: item.nodeType,
              nodeTypeExt: ''
            },
            attrs: {
              text: {
                text: item.imgName,
                fontSize: 14,
                style: {
                  color: this.globalGridAttr.nodeColor
                },
                refX: 0.5,
                refY: '100%',
                refY2: 4,
                textAnchor: 'middle',
                textVerticalAnchor: 'top',
              },
              ports: {...this.ports},
            }),
            },
            ports: {...this.ports},
          }),
        )
        let params = {
          productId : productId
          productId: productId
        }
        let res = await this.$http.get(`/basicInfo/XhProductModel/getProduct`, {params: params})
        this.imgsList2 = res.data
        console.log(this.imgsList2 ,'getProduct(productId)234567890')
        console.log(this.imgsList2, 'getProduct(productId)234567890')
        const imageNodes2 = this.imgsList2.map((item) =>
            this.graph.createNode({
              shape: 'image',
              imageUrl: `${window.SITE_CONFIG['apiURL']}/sys/oss/content2?fileId=${item.imgPath}`,
              width:item.imgWidth,
              height:item.imgHeight,
              x:item.imgWidth,
              y:item.imgHeight,
              data: {
                isRepair:false,
                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,
                taskMtbcf:item.taskMtbcf,
                taskMtbcfOther:item.taskMtbcfOther,
                voteSum:'',
              },
              attrs: {
                text:{
                  text: item.imgName,
                  fontSize: 14,
                  style: {
                    color: this.globalGridAttr.nodeColor
                  },
                  refX: 0.5,
                  refY: '100%',
                  refY2: 4,
                  textAnchor: 'middle',
                  textVerticalAnchor: 'top',
          this.graph.createNode({
            shape: 'image',
            imageUrl: `${window.SITE_CONFIG['apiURL']}/sysPictureBase/getProductImg?token=${Cookies.get('token')}&id=${item.imgPath}`,
            width: 60,
            height: 60,
            data: {
              isRepair: false,
              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,
              taskMtbcf: item.taskMtbcf,
              taskMtbcfOther: item.taskMtbcfOther,
              voteSum: '',
              imgHeight: item.imgHeight,
              imgWidth: item.imgWidth
            },
            attrs: {
              text: {
                text: item.imgName,
                fontSize: 14,
                style: {
                  color: this.globalGridAttr.nodeColor
                },
                refX: 0.5,
                refY: '100%',
                refY2: 4,
                textAnchor: 'middle',
                textVerticalAnchor: 'top',
              },
              tools: [
                {
                  name: 'button',
                  args: {
                    markup: [
                      {
                        tagName: 'image',
                        selector: 'icon',
                        attrs: {
                          // 'xlink:href': 'https://gw.alipayobjects.com/mdn/rms_43231b/afts/img/A*evDjT5vjkX0AAAAAAAAAAAAAARQnAQ',
                          'xlink:href':item.statusImg,
                          width: 30,
                          height: 30,
                          x: 0,
                          y: 0
                        }
            },
            tools: [
              {
                name: 'button',
                args: {
                  markup: [
                    {
                      tagName: 'image',
                      selector: 'icon',
                      attrs: {
                        // 'xlink:href': 'https://gw.alipayobjects.com/mdn/rms_43231b/afts/img/A*evDjT5vjkX0AAAAAAAAAAAAAARQnAQ',
                        'xlink:href': item.statusImg,
                        width: 30,
                        height: 30,
                        x: 0,
                        y: 0
                      }
                    ]
                  }
                    }
                  ]
                }
              ],
              ports: {...this.ports},
            }),
              }
            ],
            ports: {...this.ports},
          }),
        )
        stencil.load(imageNodes, 'group1')
        stencil.load(imageNodes2, 'group2')
@@ -687,7 +716,7 @@
          this.type = cell.isNode() ? 'node' : 'edge'
          this.shape = cell.shape
          this.id = cell.id
          if(this.type==='node'){
          if (this.type === 'node') {
            this.nodeType = cell.getData().nodeType
            console.log(this.nodeType, 'this.nodeType')
          }
@@ -994,7 +1023,7 @@
        }
      },
      close() {
        if (this.timer){
        if (this.timer) {
          window.clearInterval(this.timer)
        }
      },
@@ -1004,32 +1033,32 @@
</script>
<style>
#containerImg {
  display: flex;
  border: 1px solid #dfe3e8;
  height:400px ;
  width: 100% !important;
}
  #containerImg {
    display: flex;
    border: 1px solid #dfe3e8;
    height: 400px;
    width: 100% !important;
  }
.x6-graph-scroller.x6-graph-scroller-pannable {
  width: 100% !important;
}
  .x6-graph-scroller.x6-graph-scroller-pannable {
    width: 100% !important;
  }
#stencilImg {
  width: 100%;
  height: 100%;
  position: relative;
  border-right: 1px solid #dfe3e8;
}
  #stencilImg {
    width: 100%;
    height: 100%;
    position: relative;
    border-right: 1px solid #dfe3e8;
  }
.x6-widget-stencil {
  position: relative;
  height: 100%;
}
  .x6-widget-stencil {
    position: relative;
    height: 100%;
  }
.x6-widget-stencil-content {
  position: relative;
  height: 100%;
}
  .x6-widget-stencil-content {
    position: relative;
    height: 100%;
  }
</style>