From 91c67198a84e9c0a76cc0154fbebf62813c1de26 Mon Sep 17 00:00:00 2001
From: jinlin <jinlin>
Date: 星期三, 13 三月 2024 18:06:09 +0800
Subject: [PATCH] 修改
---
starter/src/main/resources/application.yml | 2
/dev/null | 0
web/src/views/modules/taskReliability/RBD-edit-img.vue | 395 +++++++++++++++++---------------
modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/service/XhProductModelService.java | 25 +
modules/mainPart/src/main/java/com/zt/life/modules/sysPictureBase/model/SysPictureBase.java | 10
web/src/views/modules/basicInfo/XhProductModel.vue | 2
web/src/views/modules/sysPictureBase/SysPictureBase.vue | 29 -
modules/mainPart/src/main/java/com/zt/life/modules/sysPictureBase/controller/SysPictureBaseController.java | 122 ++++++++--
web/src/views/modules/sysPictureBase/SysPictureBase-AddOrUpdate.vue | 63 ++++
modules/mainPart/src/main/java/com/zt/life/modules/sysPictureBase/service/SysPictureBaseService.java | 3
modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/dao/XhProductModelDao.java | 2
modules/mainPart/src/main/resources/mapper/basicInfo/XhProductModelDao.xml | 9
12 files changed, 407 insertions(+), 255 deletions(-)
diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/dao/XhProductModelDao.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/dao/XhProductModelDao.java
index 44c3490..1338d4f 100644
--- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/dao/XhProductModelDao.java
+++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/dao/XhProductModelDao.java
@@ -28,4 +28,6 @@
List<XhProductModel> getProductList();
List<ProductImg> getProduct(Long productId);
+
+ String getDefaultImg();
}
diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/service/XhProductModelService.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/service/XhProductModelService.java
index c35142f..cee7108 100644
--- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/service/XhProductModelService.java
+++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/service/XhProductModelService.java
@@ -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);
diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/sysPictureBase/controller/SysPictureBaseController.java b/modules/mainPart/src/main/java/com/zt/life/modules/sysPictureBase/controller/SysPictureBaseController.java
index 36701f5..11cc5a0 100644
--- a/modules/mainPart/src/main/java/com/zt/life/modules/sysPictureBase/controller/SysPictureBaseController.java
+++ b/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];
+ //鎵�璇诲彇鐨勫唴瀹逛娇鐢╪鏉ユ帴鏀�
+ 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
diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/sysPictureBase/model/SysPictureBase.java b/modules/mainPart/src/main/java/com/zt/life/modules/sysPictureBase/model/SysPictureBase.java
index b546c03..a8e8f1c 100644
--- a/modules/mainPart/src/main/java/com/zt/life/modules/sysPictureBase/model/SysPictureBase.java
+++ b/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;
}
diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/sysPictureBase/service/SysPictureBaseService.java b/modules/mainPart/src/main/java/com/zt/life/modules/sysPictureBase/service/SysPictureBaseService.java
index aa249bb..b8aeb12 100644
--- a/modules/mainPart/src/main/java/com/zt/life/modules/sysPictureBase/service/SysPictureBaseService.java
+++ b/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;
}
diff --git a/modules/mainPart/src/main/resources/mapper/basicInfo/XhProductModelDao.xml b/modules/mainPart/src/main/resources/mapper/basicInfo/XhProductModelDao.xml
index eb31c85..94f638d 100644
--- a/modules/mainPart/src/main/resources/mapper/basicInfo/XhProductModelDao.xml
+++ b/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>
diff --git a/starter/src/main/resources/application.yml b/starter/src/main/resources/application.yml
index 63dcfee..c7c08a4 100644
--- a/starter/src/main/resources/application.yml
+++ b/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
diff --git a/web/public/scale/bottom.jpg b/web/public/scale/bottom.jpg
deleted file mode 100644
index 2571d23..0000000
--- a/web/public/scale/bottom.jpg
+++ /dev/null
Binary files differ
diff --git a/web/public/scale/center.jpg b/web/public/scale/center.jpg
deleted file mode 100644
index 3d137ea..0000000
--- a/web/public/scale/center.jpg
+++ /dev/null
Binary files differ
diff --git a/web/public/scale/left.jpg b/web/public/scale/left.jpg
deleted file mode 100644
index 2c63ec0..0000000
--- a/web/public/scale/left.jpg
+++ /dev/null
Binary files differ
diff --git a/web/public/scale/right.jpg b/web/public/scale/right.jpg
deleted file mode 100644
index 2228226..0000000
--- a/web/public/scale/right.jpg
+++ /dev/null
Binary files differ
diff --git a/web/public/scale/top.jpg b/web/public/scale/top.jpg
deleted file mode 100644
index f26f42d..0000000
--- a/web/public/scale/top.jpg
+++ /dev/null
Binary files differ
diff --git a/web/src/views/modules/basicInfo/XhProductModel.vue b/web/src/views/modules/basicInfo/XhProductModel.vue
index df952b4..298433d 100644
--- a/web/src/views/modules/basicInfo/XhProductModel.vue
+++ b/web/src/views/modules/basicInfo/XhProductModel.vue
@@ -71,7 +71,7 @@
productType: '',
type:'',
pid: '',
- srcId:''
+ srcId:'',
}
}
},
diff --git a/web/src/views/modules/sysPictureBase/SysPictureBase-AddOrUpdate.vue b/web/src/views/modules/sysPictureBase/SysPictureBase-AddOrUpdate.vue
index 09ca888..49b5bed 100644
--- a/web/src/views/modules/sysPictureBase/SysPictureBase-AddOrUpdate.vue
+++ b/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;
}
diff --git a/web/src/views/modules/sysPictureBase/SysPictureBase.vue b/web/src/views/modules/sysPictureBase/SysPictureBase.vue
index 7c8195e..5dfca12 100644
--- a/web/src/views/modules/sysPictureBase/SysPictureBase.vue
+++ b/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>
diff --git a/web/src/views/modules/taskReliability/RBD-edit-img.vue b/web/src/views/modules/taskReliability/RBD-edit-img.vue
index e0698fb..b3fe5d6 100644
--- a/web/src/views/modules/taskReliability/RBD-edit-img.vue
+++ b/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>
--
Gitblit v1.9.1