| | |
| | | import com.zt.common.annotation.QueryParam; |
| | | import com.zt.common.db.query.QueryFilter; |
| | | import com.zt.common.servlet.Result; |
| | | import com.zt.common.utils.CacheUtils; |
| | | import com.zt.common.utils.UUIDUtil; |
| | | import com.zt.common.validator.AssertUtils; |
| | | import com.zt.common.validator.ValidatorUtils; |
| | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | public Result<List<XhProductModel>> getTreeList(Boolean showXdy, Integer ztShow, Long productId) { |
| | | List<XhProductModel> list = xhProductModelService.getAllTree(showXdy, ztShow, productId); |
| | | |
| | | |
| | | return Result.ok(list); |
| | | } |
| | | |
| | |
| | | return Result.ok(data); |
| | | } |
| | | |
| | | @GetMapping("getImg") |
| | | @ApiOperation("信息") |
| | | public void getImg(HttpServletResponse response, Long id) { |
| | | xhProductModelService.getImg(response, id); |
| | | } |
| | | |
| | | |
| | | @GetMapping("getProductList") |
| | | public Result<List<XhProductModel>> getProductList() { |
| | | List<XhProductModel> list = xhProductModelService.getProductList(); |
| | | public Result<List<XhProductModel>> getProductList(Long shipId, Integer productType) { |
| | | List<XhProductModel> list = xhProductModelService.getProductList(shipId, productType - 1); |
| | | return Result.ok(list); |
| | | } |
| | | |
| | |
| | | @GetMapping("exportData") |
| | | @ApiOperation("导出产品模型") |
| | | @LogOperation("导出产品模型") |
| | | public Result exportDataExcel(HttpServletRequest request, HttpServletResponse response, Long shipId,String fileName) { |
| | | xhProductModelService.exportDataExcel(request,response,shipId,fileName); |
| | | public Result exportDataExcel(HttpServletRequest request, HttpServletResponse response, Long shipId, String fileName) { |
| | | xhProductModelService.exportDataExcel(request, response, shipId, fileName); |
| | | |
| | | return null; |
| | | } |
| | |
| | | } |
| | | |
| | | xhProductModelService.insert(xhProductModel); |
| | | |
| | | Map<Long, XhProductModel> imgMap = new HashMap<>(); |
| | | imgMap = (Map<Long, XhProductModel>) CacheUtils.get("sysImgCache", "sysImgCache"); |
| | | imgMap.put(xhProductModel.getId(), xhProductModel); |
| | | return Result.ok(); |
| | | } |
| | | |
| | |
| | | //效验数据 |
| | | ValidatorUtils.validateEntity(xhProductModel, UpdateGroup.class, DefaultGroup.class); |
| | | xhProductModelService.update(xhProductModel); |
| | | Map<Long, XhProductModel> imgMap = new HashMap<>(); |
| | | imgMap = (Map<Long, XhProductModel>) CacheUtils.get("sysImgCache", "sysImgCache"); |
| | | imgMap.put(xhProductModel.getId(), xhProductModel); |
| | | |
| | | return Result.ok(); |
| | | } |
| | |
| | | } |
| | | |
| | | private void deleteByProduct(Long[] ids) { |
| | | Map<Long, XhProductModel> imgMap = new HashMap<>(); |
| | | imgMap = (Map<Long, XhProductModel>) CacheUtils.get("sysImgCache", "sysImgCache"); |
| | | for (Long id : ids) { |
| | | XhProductModel data = xhProductModelService.get(id); |
| | | if (data.getProductType().equals("1") || data.getProductType().equals("3") || data.getProductType().equals("4")) { |
| | | xhProductModelService.deleteLogic(id); |
| | | /* List<Long> list =xhProductModelService.getByPid(id); |
| | | Long[] L = list.stream().toArray(Long[]::new);*/ |
| | | Long[] list = xhProductModelService.getByPid(id); |
| | | Long[] list = xhProductModelService.getByPid(id); |
| | | if (list.length > 0){ |
| | | this.deleteByProduct(list); |
| | | } else if (data.getProductType().equals("2")) { |
| | | xhProductModelService.deleteByShipId(data.getShipId()); |
| | | } else if (data.getProductType().equals("5")) { |
| | | xhProductModelService.deleteLogic(id); |
| | | } |
| | | imgMap.remove(id); |
| | | xhProductModelService.deleteLogic(id); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | Integer getNo(Long pid, String productType); |
| | | |
| | | List<XhProductModel> getProductList(); |
| | | List<XhProductModel> getProductList(Long shipId, Integer type); |
| | | |
| | | List<ProductImg> getProduct(Long productId, Long parentId); |
| | | |
| | |
| | | List<ProductDto> getProductByShip(Long shipId); |
| | | |
| | | List<XhProductModel> getProductListByShip(Long productId, int level1, int level2); |
| | | |
| | | List<XhProductModel> getProductListAll(); |
| | | } |
| | |
| | | return baseDao.getNo(pid, productType); |
| | | } |
| | | |
| | | public List<XhProductModel> getProductList() { |
| | | List<XhProductModel> ProductList = baseDao.getProductList(); |
| | | public List<XhProductModel> getProductList(Long shipId, Integer type) { |
| | | List<XhProductModel> ProductList = baseDao.getProductList(shipId,type); |
| | | return TreeUtils.build(ProductList); |
| | | } |
| | | |
| | |
| | | writeList(dto.getChildren(), List); |
| | | } |
| | | } |
| | | public void refreshCache() { |
| | | List<XhProductModel> productList = baseDao.getProductListAll(); |
| | | Map<Long, XhProductModel> imgMap = new HashMap<>(); |
| | | for (XhProductModel product : productList) { |
| | | imgMap.put(product.getId(), product); |
| | | } |
| | | CacheUtils.put("sysImgCache", "sysImgCache", imgMap); |
| | | } |
| | | |
| | | public void getImg(HttpServletResponse response, Long id) { |
| | | Map<Long, XhProductModel> imgMap = new HashMap<>(); |
| | | imgMap = (Map<Long, XhProductModel>) CacheUtils.get("sysImgCache","sysImgCache"); |
| | | XhProductModel product = imgMap.get(id); |
| | | sysPictureBaseService.getSvgImage(response,product.getOperatImg()); |
| | | } |
| | | } |
| | |
| | | |
| | | @RequestMapping("/getSvgImage") |
| | | public void getSvgImage(HttpServletResponse response, Long id) { |
| | | try { |
| | | SysPictureBase data = sysPictureBaseService.get(id); |
| | | String svgContent = data.getSvgContent(); |
| | | response.setContentType("image/svg+xml"); |
| | | response.getWriter().write(svgContent); |
| | | response.getWriter().flush(); |
| | | response.getWriter().close(); |
| | | |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | sysPictureBaseService.getSvgImage(response,id); |
| | | } |
| | | |
| | | @GetMapping("/getDefaultImg") |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import com.zt.common.db.query.QueryFilter; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.validation.constraints.NotNull; |
| | | import javax.validation.constraints.Null; |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | |
| | | |
| | |
| | | public SysPictureBase getDefaultImg(Integer productType) { |
| | | return baseDao.getDefaultImg(productType); |
| | | } |
| | | public void getSvgImage(HttpServletResponse response, Long id) { |
| | | try { |
| | | SysPictureBase data = this.get(id); |
| | | String svgContent = data.getSvgContent(); |
| | | response.setContentType("image/svg+xml"); |
| | | response.getWriter().write(svgContent); |
| | | response.getWriter().flush(); |
| | | response.getWriter().close(); |
| | | |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | this.processJSONArray(jsonArray, item, taskId); |
| | | } |
| | | } |
| | | childList.removeIf(item -> item.getStatusList().size() == 0); |
| | | return childList; |
| | | } |
| | | |
| | |
| | | SET repair_mttcr = 0 |
| | | where b.ship_id = ${shipId} |
| | | and repair_mttcr is null; |
| | | |
| | | UPDATE param_data a, product_model b |
| | | SET basic_mtbf_regulate_tmp = basic_mtbf_regulate |
| | | where b.ship_id = ${shipId}; |
| | | |
| | | UPDATE param_data a, product_model b |
| | | SET basic_mtbf_regulate_tmp = basic_runs_num / basic_mtbf_regul_succ_rate |
| | | where b.ship_id = ${shipId} |
| | |
| | | UPDATE param_data a, product_model b |
| | | SET basic_mtbf_regulate = basic_mtbf_regulate_tmp |
| | | where b.ship_id = ${shipId} |
| | | and (reliab_distrib_type = 1 or reliab_distrib_type is null); |
| | | and (reliab_distrib_type = 1 or reliab_distrib_type is null) |
| | | and a.product_id = b.id |
| | | and a.IS_DELETE = 0 |
| | | and b.IS_DELETE = 0; |
| | | |
| | | UPDATE param_data a, product_model b |
| | | SET ai = basic_mtbf_regulate_tmp / (basic_mtbf_regulate_tmp + repair_mttcr) |
| | | where b.ship_id = ${shipId} |
| | | and a.product_id = b.id |
| | | and a.IS_DELETE = 0 |
| | | and b.IS_DELETE = 0; |
| | | |
| | | 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 |
| | | group by b.pid |
| | | ) b |
| | | set a.basic_join_compute = b.basic_join_compute |
| | | where a.product_id = b.pid; |
| | | </update> |
| | | |
| | | <select id="getAI" resultType="com.zt.life.modules.mainPart.basicInfo.model.ParamData"> |
| | |
| | | b.repair_mttcr, |
| | | b.basic_mtbf_operating_ratio, |
| | | b.basic_mtbf_regul_succ_rate, |
| | | b.basic_runs_num |
| | | b.basic_runs_num, |
| | | b.basic_unit_num |
| | | FROM product_model a |
| | | LEFT JOIN param_data b ON b.product_id = a.id and b.is_delete = 0 |
| | | where a.is_delete = 0 |
| | | and a.product_type <> 10 |
| | | and b.basic_join_compute = 1 |
| | | and a.ship_id = ${shipId} |
| | | or a.id = ${shipId} |
| | | ORDER BY a.product_type, a.sort |
| | |
| | | select a.name, a.id |
| | | from product_model a |
| | | where a.is_delete = 0 |
| | | <if test="type!=null and type!=''"> |
| | | and a.product_type = ${type} |
| | | </if> |
| | | <if test="shipId!=null"> |
| | | and a.ship_id = ${shipId} |
| | | </if> |
| | | </select> |
| | | <select id="getProduct" resultType="com.zt.life.modules.mainPart.basicInfo.model.ProductImg"> |
| | | SELECT a.operat_img as imgPath, |
| | |
| | | <select id="getProductListByShip" resultType="com.zt.life.modules.mainPart.basicInfo.model.XhProductModel"> |
| | | select a.*, b.basic_unit_num as sameSbNum |
| | | from product_model a, |
| | | param_data b |
| | | param_data b |
| | | where a.IS_DELETE = 0 and b.IS_DELETE = 0 |
| | | and a.id = b.product_id |
| | | and a.id = b.product_id |
| | | <if test="productId !=null"> |
| | | and a.ship_id = #{productId} |
| | | </if> |
| | |
| | | and a.product_type <= #{level2} |
| | | </if> |
| | | </select> |
| | | <select id="getProductListAll" resultType="com.zt.life.modules.mainPart.basicInfo.model.XhProductModel"> |
| | | select id, operat_img |
| | | from product_model |
| | | where IS_DELETE = 0 |
| | | </select> |
| | | </mapper> |
| | |
| | | package com.zt.life; |
| | | |
| | | import com.zt.life.modules.mainPart.basicInfo.service.ParamDataService; |
| | | import com.zt.life.modules.mainPart.basicInfo.service.XhProductModelService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.ApplicationArguments; |
| | | import org.springframework.boot.ApplicationRunner; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Component |
| | | public class StartupHandler implements ApplicationRunner { |
| | | |
| | | @Autowired |
| | | XhProductModelService xhProductModelService; |
| | | @Override |
| | | public void run(ApplicationArguments args) throws Exception { |
| | | // 刷新缓存 |
| | | xhProductModelService.refreshCache(); |
| | | } |
| | | } |
| | |
| | | package com.zt.task; |
| | | |
| | | import com.zt.common.utils.CommonUtils; |
| | | import com.zt.life.modules.mainPart.basicInfo.service.XhProductModelService; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | @Autowired |
| | | private RedisTemplate redisTemplate; |
| | | @Autowired |
| | | XhProductModelService xhProductModelService; |
| | | |
| | | |
| | | @Scheduled(cron = "0 0 3 * * ?") //每天3点执行 |
| | | public void task() { |
| | | logger.info("更新数据task开始"); |
| | | Date beginDate = new Date(); |
| | | |
| | | xhProductModelService.refreshCache(); |
| | | purgeRedis(); |
| | | |
| | | logger.info("更新数据task耗时:" + CommonUtils.getDatePoor(new Date(), beginDate)); |
| | |
| | | min-spare-threads: 30 |
| | | port: 8066 |
| | | servlet: |
| | | context-path: /test-project |
| | | context-path: /reliability_simulat |
| | | session: |
| | | cookie: |
| | | http-only: true |
| | |
| | | druid: |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | url: jdbc:mysql://192.168.31.26:3366/reliability_simulat?allowMultiQueries=true&hive.exec.orc.split.strategy=ETL&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8 |
| | | # url: jdbc:mysql://127.0.0.1:3305/reliability_simulat?allowMultiQueries=true&hive.exec.orc.split.strategy=ETL&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8 |
| | | #url: jdbc:mysql://127.0.0.1:3306/reliability_simulat?allowMultiQueries=true&hive.exec.orc.split.strategy=ETL&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8 |
| | | username: root |
| | | password: root |
| | | #password: 123456 |
| | |
| | | # secure: false |
| | | # serviceRegistry: |
| | | # initFromJson: true |
| | | server-url-prefix: http://localhost:8100/cas |
| | | server-login-url: http://localhost:8100/cas/login |
| | | client-host-url: http://localhost:8050 |
| | | validation-type: cas |
| | | #CAS服务地址 |
| | | server-url: http://192.168.31.13:8080/cas/ |
| | | #本地客户端ip端口,不是首页地址 |
| | | client-host: http://192.168.31.148:8066/reliability_simulat |
| | | |
| | | zt: |
| | | oss: |
| | | type: local |
| | | local-domain: http://127.0.0.1:8050/test-project/ |
| | | local-domain: http://127.0.0.1:8066/reliability_simulat/ |
| | | local-path: D:/ReliabilitySimulation/ #附件存储目录 |
| | | local-qd-path: D:/TestProjectFiles/ #附件存储目录 |
| | | local-prefix: accessories #附件存储子目录 |
| | |
| | | mainPy: D:/relia_sim/assess.py |
| | | # 算法库仿真结果存放根目录 |
| | | resultHome: d:/relia_sim/sim_result |
| | | |
| | |
| | | window.SITE_CONFIG['dynamicMenuRoutesHasAdded'] = false; // 动态(菜单)路由是否已经添加的状态标示(用于判断是否需要重新拉取数据并进行动态添加操作) |
| | | |
| | | // 服务地址 |
| | | window.SITE_CONFIG['apiURL'] = 'http://' + location.hostname + ':8066/test-project'; |
| | | window.SITE_CONFIG['apiURL2'] = 'http://' + location.hostname + ':8066/test-project'; |
| | | window.SITE_CONFIG['apiURL'] = 'http://' + location.hostname + ':8066/reliability_simulat'; |
| | | window.SITE_CONFIG['apiURL2'] = 'http://' + location.hostname + ':8066/reliability_simulat'; |
| | | //window.SITE_CONFIG['apiURL2'] = 'http://'+location.hostname+':8066'; |
| | | |
| | | //window.SITE_CONFIG['apiURL'] = '<%= process.env.VUE_APP_API_URL %>'; |
| | |
| | | |
| | | |
| | | // WebSocket地址 |
| | | window.SITE_CONFIG['socketURL'] = 'http://' + location.hostname + ':8066/test-project'; |
| | | window.SITE_CONFIG['socketURL'] = 'http://' + location.hostname + ':8066/reliability_simulat'; |
| | | //window.SITE_CONFIG['socketURL'] ='<%= process.env.VUE_APP_SOCKET_URL %>'; |
| | | |
| | | </script> |
| | |
| | | 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"> |
| | | <template slot-scope="scope"> |
| | | <span>{{ keepNumber(scope.row.basicMtbfRegulate) }}</span> |
| | |
| | | <el-input v-model="dataForm.equipType"></el-input> |
| | | </zt-form-item> |
| | | <zt-form-item label="节点类型" prop="productType" rules="required"> |
| | | <zt-dict v-model="dataForm.productType" dict="product" @input="getDefaultImg" |
| | | <zt-dict v-model="dataForm.productType" dict="product" @input="changeType" |
| | | :disabled="disabled"></zt-dict> |
| | | </zt-form-item> |
| | | <zt-form-item v-if="dataForm.productType!=='1'" label="运行状态图" prop="operatImg"> |
| | | <zt-form-item v-if="dataForm.productType!=='1'" label="运行状态图" prop="operatImg"> |
| | | <el-input v-model="dataForm.operatImgName" @focus="selectPicture()"></el-input> |
| | | <el-image v-if="dataForm.operatImg" :src="url+dataForm.operatImg" style="height: 50px;width: 50px"></el-image> |
| | | </zt-form-item> |
| | |
| | | }, |
| | | methods: { |
| | | init(id, params) { |
| | | this.getProductList() |
| | | console.log(params) |
| | | if (params.shipId) { |
| | | this.dataForm.shipId = params.shipId |
| | | } |
| | |
| | | this.getDefaultImg(this.dataForm.productType) |
| | | } else { |
| | | this.dataForm.pid = params.pid |
| | | this.dataForm.productType = params.type |
| | | console.log(params.productType,'type') |
| | | console.log(parseInt(params.productType),'parseInttype') |
| | | this.dataForm.productType = parseInt(params.productType) |
| | | this.getDefaultImg(this.dataForm.productType) |
| | | } |
| | | if (this.dataForm.productType === '10' && id == null) { |
| | | this.isShow = false |
| | | this.getDefaultImg(this.dataForm.productType) |
| | | } |
| | | this.getProductList() |
| | | }, |
| | | // 获取系统列表 |
| | | async getProductList() { |
| | | let res = await this.$http.get('/basicInfo/XhProductModel/getProductList') |
| | | let params = { |
| | | productType: this.dataForm.productType, |
| | | shipId: this.dataForm.shipId |
| | | } |
| | | let res = await this.$http.get('/basicInfo/XhProductModel/getProductList', {params: params}) |
| | | this.productList = res.data |
| | | console.log(this.productList, 'getProductList') |
| | | }, |
| | | changeType(selected) { |
| | | this.dataForm.productType = selected |
| | | this.getDefaultImg(selected) |
| | | this.getProductList() |
| | | }, |
| | | async getDefaultImg(selected) { |
| | | console.log(selected, 'async getDefaultImg') |
| | | let params = { |
| | |
| | | this.dataForm.type = this.productType |
| | | |
| | | if (this.dataForm.type !== '1') { |
| | | this.$refs.SelectTyModel.$refs.dialog.init(null, { |
| | | /*this.$refs.SelectTyModel.$refs.dialog.init(null, { |
| | | type: this.dataForm.type, |
| | | id: this.dataForm.pid, |
| | | 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}) |
| | | } else { |
| | | this.$refs.AddOrUpdate.$refs.dialog.init(null, {id: null, type: 'zt', pid: this.dataForm.pid}) |
| | | this.$refs.AddOrUpdate.$refs.dialog.init(null, {id: null, type: 'zt', pid: this.dataForm.pid,shipId: this.shipId}) |
| | | } |
| | | }, |
| | | addCell() { |
| | |
| | | <template> |
| | | <div class="fa-card-b"> |
| | | <div style="margin: 0 0 10px 0"> |
| | | <span class="size">系统登录次数:</span> |
| | | <span class="font">{{dataForm.loginNum}}</span> |
| | | <span class="size">试验方案制定次数:</span> |
| | | <span class="font">{{dataForm.planMakeNum}}</span> |
| | | </div> |
| | | <div class="fa-card-b"> |
| | | <div style="margin: 0 0 10px 0"> |
| | | <span class="size">系统登录次数:</span> |
| | | <span class="font">{{dataForm.loginNum}}</span> |
| | | <span class="size">试验方案制定次数:</span> |
| | | <span class="font">{{dataForm.planMakeNum}}</span> |
| | | </div> |
| | | <el-table ref="taskTable" class="DataTable" :data="dataForm.taskReliabList" height="330px" border> |
| | | <el-table-column label="任务可靠性数据" align="center"> |
| | | <el-table-column align="center" prop="name" label="名称"> |
| | |
| | | baseReliabList: [], |
| | | loginNum: '', |
| | | planMakeNum: '' |
| | | } |
| | | }, |
| | | userId: '' |
| | | } |
| | | }, |
| | | components: {}, |
| | | created() { |
| | | }, |
| | | mounted() { |
| | | this.init() |
| | | this.init2() |
| | | }, |
| | | computed: { |
| | | keepNumber() { //过滤器保留4为小数 |
| | |
| | | }, |
| | | }, |
| | | methods: { |
| | | init() { |
| | | init2() { |
| | | this.getInfo2() |
| | | }, |
| | | async getInfo2() { |
| | |
| | | background: #edf6ff; |
| | | } |
| | | |
| | | .size{ |
| | | .size { |
| | | font-size: 20px; |
| | | margin: 10px; |
| | | color: #000000; |
| | | } |
| | | .font{ |
| | | |
| | | .font { |
| | | font-size: 20px; |
| | | margin: 10px; |
| | | color: #0aa0bf; |
| | |
| | | this.graph.createNode({ |
| | | shape: 'image', |
| | | //imageUrl: `${window.SITE_CONFIG['apiURL']}/sysPictureBase/getProductImg?token=${Cookies.get('token')}&id=${item.imgPath}`, |
| | | width: 100, |
| | | width: 60, |
| | | height: 70, |
| | | //id: item.dataId, // 手动设置节点的 ID |
| | | data: { |
| | |
| | | }, |
| | | attrs: { |
| | | image: { |
| | | 'xlink:href': `${window.SITE_CONFIG['apiURL']}/sysPictureBase/getSvgImage?token=${Cookies.get('token')}&id=${item.imgPath}`, |
| | | 'xlink:href': `${window.SITE_CONFIG['apiURL']}/basicInfo/XhProductModel/getImg?token=${Cookies.get('token')}&id=${item.dataId}&t=${new Date().getTime()}`, |
| | | //'xlink:href': urlObject.createObjectURL(new Blob([item.svgContent])), |
| | | }, |
| | | title: { |
| | | text: item.basicUnitNum>=1?item.basicUnitNum:'', |
| | | text: item.basicUnitNum>1?item.basicUnitNum:'', |
| | | refX: 15, |
| | | refY: 10, |
| | | fill: '#748be7', |
| | |
| | | let dragNodeType = dragNode.getData().nodeType |
| | | let offHeight = 50 |
| | | if (dragNodeType === 'node') { |
| | | offHeight = 60 |
| | | offHeight = 70 |
| | | } else if (dragNodeType === 'bridgeConnection') { |
| | | offHeight = 175 |
| | | } else { |
| | |
| | | this.getYRange(inEdges, graphNodeStartNode, pointXY) |
| | | console.log(pointXY, 'new') |
| | | |
| | | let minX = graphNodeStartNode.position().x + graphNode.getBBox().width + 15 |
| | | let maxX = graphNode.position().x |
| | | let minX = graphNodeStartNode.position().x + graphNode.getBBox().width |
| | | let maxX = graphNode.position().x - dragNode.getBBox().width / 2 |
| | | let centerX = minX + (maxX - minX) / 2 |
| | | let centerY = graphNodeY + graphNode.getBBox().height / 2 - pointXY.minY > pointXY.maxY - (graphNodeY + graphNode.getBBox().height / 2) ? |
| | | pointXY.maxY + offHeight / 2 + 30 : pointXY.minY - offHeight / 2 - 30 |
| | | |
| | | let result = this.addNodeAndConnect(null, dragNode, minX, centerY) |
| | | let result = this.addNodeAndConnect(null, dragNode, centerX, centerY) |
| | | console.log(result, 'result111') |
| | | this.graph.addEdge({ |
| | | source: {cell: graphNodeStartNode}, |
| | |
| | | leftTopY = centerY |
| | | let dragNodeType = dragNode.getData().nodeType |
| | | if (dragNodeType === 'node') { |
| | | width = 60 |
| | | height = 60 |
| | | width = 100 |
| | | height = 70 |
| | | } else if (dragNodeType === 'dashedBox') { |
| | | width = 60 |
| | | height = 40 |
| | |
| | | height = 175 |
| | | } else { |
| | | width = 270 |
| | | height = 60 |
| | | height = 70 |
| | | } |
| | | leftTopX = centerX - width / 2 |
| | | leftTopY = centerY - height / 2 |