添加分析设计bug
This commit is contained in:
parent
3843a7adb0
commit
50fc25abbc
@ -22,22 +22,7 @@ import ScenarioModel from '@/views/component/scenario/index.vue'
|
||||
import { addDevices } from "@/api/business/database/device";
|
||||
import { saveOrUpdate} from "@/api/business/database/material";
|
||||
|
||||
import img1 from '@/assets/x6/1.png'
|
||||
import img2 from '@/assets/x6/2.png'
|
||||
import img3 from '@/assets/x6/3.png'
|
||||
import img4 from '@/assets/x6/4.png'
|
||||
import img5 from '@/assets/x6/5.png'
|
||||
import img6 from '@/assets/x6/6.png'
|
||||
import img7 from '@/assets/x6/7.png'
|
||||
|
||||
import img11 from '@/assets/x6/11.png'
|
||||
import img22 from '@/assets/x6/22.png'
|
||||
import img33 from '@/assets/x6/33.png'
|
||||
import img44 from '@/assets/x6/44.png'
|
||||
import img55 from '@/assets/x6/55.png'
|
||||
import img66 from '@/assets/x6/66.png'
|
||||
import img77 from '@/assets/x6/77.png'
|
||||
|
||||
import { projectsById} from "@/api/business/project";
|
||||
import line1 from '@/assets/x6/line1.png'
|
||||
import line2 from '@/assets/x6/line2.png'
|
||||
import line3 from '@/assets/x6/line3.png'
|
||||
@ -50,6 +35,7 @@ import MaterialModels from './materialmodel.vue';
|
||||
import ChangesettingsModels from './changesettings.vue';
|
||||
|
||||
import ConnectingwireModel from './connectingwire.vue';
|
||||
import { TurnOff } from '@element-plus/icons-vue/dist/types';
|
||||
const emit = defineEmits([ 'closeAntvx6']);
|
||||
const props = defineProps({
|
||||
projectInfo: {
|
||||
@ -71,6 +57,8 @@ const isExpansionandcontraction = ref(false) // 是否显示展开收起按钮
|
||||
let graph: Graph
|
||||
onMounted(() => {
|
||||
preWork()
|
||||
|
||||
|
||||
// #region 初始化画布
|
||||
graph = new Graph({
|
||||
container: document.getElementById('graph-container') as HTMLElement,
|
||||
@ -745,7 +733,50 @@ graph.on('blank:mouseup', (e) => {
|
||||
},
|
||||
true,
|
||||
)
|
||||
|
||||
Graph.registerNode(
|
||||
'rect-text',
|
||||
{
|
||||
inherit: 'rect',
|
||||
width: 120,
|
||||
height: 60,
|
||||
markup: [
|
||||
{
|
||||
tagName: 'rect',
|
||||
selector: 'body',
|
||||
},
|
||||
{
|
||||
tagName: 'image',
|
||||
selector: 'img',
|
||||
},
|
||||
{
|
||||
tagName: 'text',
|
||||
selector: 'label',
|
||||
},
|
||||
],
|
||||
attrs: {
|
||||
body: {
|
||||
stroke: 'transparent',
|
||||
strokeWidth: 1,
|
||||
fill: 'transparent',
|
||||
rx: 6,
|
||||
ry: 6,
|
||||
},
|
||||
label: {
|
||||
text: '',
|
||||
fill: '#333',
|
||||
fontSize: 12,
|
||||
refX: 0.5,
|
||||
refY: 0.5,
|
||||
textAnchor: 'middle',
|
||||
dy: 10,
|
||||
},
|
||||
'.': {
|
||||
class: 'custom-image-node',
|
||||
},
|
||||
},
|
||||
},
|
||||
true,
|
||||
)
|
||||
const imageShapes = [
|
||||
{
|
||||
label: '圆柱槽',
|
||||
@ -899,11 +930,19 @@ graph.on('blank:mouseup', (e) => {
|
||||
})
|
||||
|
||||
stencil.load(lineNodes, 'group3')
|
||||
if (!graph || !projectInfo.value || !projectInfo.value.topology) return;
|
||||
graph.clearCells();
|
||||
projectsById({projectId:props.projectInfo.projectId}).then((res:any) => {
|
||||
if(res.topology != null && res.topology != ''){
|
||||
projectInfo.value = res
|
||||
if (!graph || !projectInfo.value || !projectInfo.value.topology) return;
|
||||
graph.clearCells();
|
||||
const topology:any = JSON.parse(projectInfo.value.topology)
|
||||
if(!topology.designData)return
|
||||
graph.fromJSON(topology.designData);
|
||||
}
|
||||
|
||||
})
|
||||
// #endregion
|
||||
})
|
||||
|
||||
@ -1015,7 +1054,21 @@ function copyNode() { // 复制节点
|
||||
|
||||
|
||||
function closeAntvx6() {
|
||||
let isSaveDesign = false
|
||||
const designData:any = graph.toJSON()
|
||||
for(let i = 0;i<designData.cells.length;i++){
|
||||
if(designData.cells[i].shape == 'rect-text' || designData.cells[i].shape == 'image-node'){
|
||||
isSaveDesign = true
|
||||
}
|
||||
}
|
||||
if(isSaveDesign == true){
|
||||
saveDesign(true)
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
emit('closeAntvx6')
|
||||
}, 100);
|
||||
|
||||
}
|
||||
|
||||
function revokeClick(){
|
||||
@ -1145,7 +1198,7 @@ function closeAdddevice(e:any){ // 关闭新增设备弹窗
|
||||
retrievedNode.attr('text/text', e.name)
|
||||
retrievedNode.attr('label/text', e.name)
|
||||
retrievedNode.store.data.deviceInfo = e
|
||||
saveDesign()
|
||||
saveDesign(false)
|
||||
isAdddevice.value = false;
|
||||
}
|
||||
|
||||
@ -1166,7 +1219,7 @@ function closeEditdevice(e:any){ // 关闭编辑设备弹窗
|
||||
retrievedNode.attr('text/text', e.name)
|
||||
retrievedNode.attr('label/text', e.name)
|
||||
isEditdevice.value = false;
|
||||
saveDesign()
|
||||
saveDesign(false)
|
||||
}
|
||||
|
||||
function dialogEditdevice(){ // 关闭设备弹窗
|
||||
@ -1201,7 +1254,7 @@ function closeMaterialModel(e:any){ // 关闭物料信息弹窗
|
||||
selectedMaterial.value = e
|
||||
let retrievedNode:any = graph.getCellById(nodeId.value)
|
||||
retrievedNode.store.data.materialInfo = e
|
||||
saveDesign()
|
||||
saveDesign(false)
|
||||
isMaterialModel.value = false;
|
||||
}
|
||||
|
||||
@ -1332,10 +1385,20 @@ function remarkChange(e:any){
|
||||
|
||||
|
||||
|
||||
function saveDesign() { // 保存设计
|
||||
function saveDesign(is:any) { // 保存设计
|
||||
try {
|
||||
// 获取画布内容并转换为JSON
|
||||
const designData:any = graph.toJSON()
|
||||
if(is == true){
|
||||
isDisplay.value = true
|
||||
for(let i = 0;i<designData.cells.length;i++){
|
||||
if(designData.cells[i].shape == 'rect-text' || designData.cells[i].shape == 'image-node'){
|
||||
graph.removeCell(designData.cells[i].id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
let cells:any = []
|
||||
if(designData !=null && designData.cells.length>0){
|
||||
cells = designData.cells
|
||||
@ -1539,10 +1602,184 @@ copyNodeInfo.value.store.data.attrs.label.text = copyDeviceInfo.value.name
|
||||
graph.addNode(copyNodeInfo.value)
|
||||
isLock.value = false
|
||||
loading.value = false
|
||||
saveDesign()
|
||||
saveDesign(false)
|
||||
isCopy.value = false
|
||||
}
|
||||
|
||||
|
||||
|
||||
function isDisplayClick(){
|
||||
let tempGraph:any = graph.toJSON().cells
|
||||
if(isDisplay.value == false){
|
||||
isDisplay.value = true
|
||||
for(let i = 0;i<tempGraph.length;i++){
|
||||
if(tempGraph[i].shape == 'rect-text' || tempGraph[i].shape == 'image-node'){
|
||||
graph.removeCell(tempGraph[i].id)
|
||||
}
|
||||
}
|
||||
}else{
|
||||
isDisplay.value = false
|
||||
isLock.value = true
|
||||
tempGraph.forEach((item:any,index:any) => {
|
||||
let num = -1
|
||||
let tempInfo = {...item.deviceInfo}
|
||||
if(tempInfo.size != null && tempInfo.size != ''){
|
||||
tempInfo = {...tempInfo, ...JSON.parse(tempInfo.size)}
|
||||
}
|
||||
if(item.materialInfo != null && item.materialInfo.materialId != null){
|
||||
tempInfo = {...tempInfo,...item.materialInfo}
|
||||
|
||||
|
||||
}
|
||||
for (const key in tempInfo) {
|
||||
if (!Object.hasOwn(tempInfo, key)) continue;
|
||||
|
||||
const element = tempInfo[key];
|
||||
if(getName(key) != '' && tempInfo[key] != null){
|
||||
if(isDisplay.value == true){
|
||||
return
|
||||
}
|
||||
num = num + 1
|
||||
graph.addNode({
|
||||
shape: 'rect-text',
|
||||
x: item.position.x,
|
||||
y: item.position.y + 153 + num * 25,
|
||||
width: 260,
|
||||
height: 30,
|
||||
// label: data[i].name + ':' + data[i].value,
|
||||
attrs: {
|
||||
body: {
|
||||
stroke: 'transparent',
|
||||
fill: 'transparent',
|
||||
strokeWidth: 1,
|
||||
},
|
||||
label: {
|
||||
textAnchor: 'left',
|
||||
refX: 0,
|
||||
text: getName(key) + ':' + element,
|
||||
textWrap: {
|
||||
width: 250,
|
||||
height: 30,
|
||||
ellipsis: true,
|
||||
},
|
||||
},
|
||||
text: {
|
||||
text: '',
|
||||
fill: '#363636', // 蓝色文字
|
||||
fontSize: 12,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
isLock.value = false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function appendAttrText(key:any,element:any){
|
||||
|
||||
|
||||
}
|
||||
function getName(code:any) {
|
||||
let name = ''
|
||||
switch (code) {
|
||||
case 'width':
|
||||
return name = "宽度cm";
|
||||
break;
|
||||
case 'outer_diameter':
|
||||
return name = "外径cm";
|
||||
break;
|
||||
case 'height':
|
||||
return name = "高度cm";
|
||||
break;
|
||||
case 'length':
|
||||
return name = "长度cm";
|
||||
break;
|
||||
case 'diameter':
|
||||
return name = "外径cm";
|
||||
break;
|
||||
case 'volume':
|
||||
return name = "体积(单位:L)";
|
||||
break;
|
||||
case 'flow_rate':
|
||||
return name = "流量(单位:m3/h)";
|
||||
break;
|
||||
case 'flowRate':
|
||||
return name = "流量(单位:m3/h)";
|
||||
break;
|
||||
case 'pulse_velocity':
|
||||
return name = "脉冲速度(单位:Hz)";
|
||||
break;
|
||||
case 'pulseVelocity':
|
||||
return name = "脉冲速度(单位:Hz)";
|
||||
break;
|
||||
case 'u_concentration':
|
||||
return name = "铀浓度(g/L)";
|
||||
break;
|
||||
case 'uConcentration':
|
||||
return name = "铀浓度(g/L)";
|
||||
break;
|
||||
case 'uo2_density':
|
||||
return name = "氧化铀密度(g/cm3)";
|
||||
break;
|
||||
case 'uo2Density':
|
||||
return name = "氧化铀密度(g/cm3)";
|
||||
break;
|
||||
case 'u_enrichment':
|
||||
return name = "铀富集度(%)";
|
||||
break;
|
||||
case 'uEnrichment':
|
||||
return name = "铀富集度(%)";
|
||||
break;
|
||||
case 'pu_concentration':
|
||||
return name = "钚浓度(g/L)";
|
||||
break;
|
||||
case 'puConcentration':
|
||||
return name = "钚浓度(g/L)";
|
||||
break;
|
||||
case 'puo2_density':
|
||||
return name = "氧化钚密度(g/cm3)";
|
||||
break;
|
||||
case 'puo2Density':
|
||||
return name = "氧化钚密度(g/cm3)";
|
||||
break;
|
||||
case 'pu_isotope':
|
||||
return name = "钚同位素比例(PU-240占比)%";
|
||||
break;
|
||||
case 'puIsotope':
|
||||
return name = "钚同位素比例(PU-240占比)%";
|
||||
break;
|
||||
case 'hno3_acidity':
|
||||
return name = "硝酸酸度(mol/L)";
|
||||
break;
|
||||
case 'hno3Acidity':
|
||||
return name = "硝酸酸度(mol/L)";
|
||||
break;
|
||||
case 'h2c2o4_concentration':
|
||||
return name = "草酸浓度(mol/L)";
|
||||
break;
|
||||
case 'h2c2o4Concentration':
|
||||
return name = "草酸浓度(mol/L)";
|
||||
break;
|
||||
case 'organic_ratio':
|
||||
return name = "有机相比例%";
|
||||
break;
|
||||
case 'organicRatio':
|
||||
return name = "有机相比例%";
|
||||
break;
|
||||
case 'moisture_content':
|
||||
return name = "含水率%";
|
||||
break;
|
||||
case 'moistureContent':
|
||||
return name = "含水率%";
|
||||
break;
|
||||
default:
|
||||
return name = "";
|
||||
}
|
||||
return name
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@ -1583,6 +1820,12 @@ copyNodeInfo.value.store.data.attrs.label.text = copyDeviceInfo.value.name
|
||||
<div class="operation-icon-text">显示</div>
|
||||
</div> -->
|
||||
|
||||
<div class="operation-icon-box" @click="isDisplayClick">
|
||||
<img v-if="isDisplay" src="@/assets/x6/display.png">
|
||||
<img v-else src="@/assets/x6/hide.png">
|
||||
<div class="operation-icon-text">显示</div>
|
||||
</div>
|
||||
|
||||
<div class="operation-icon-box" style="width: 60px;" @click="boundaryClick">
|
||||
<img v-if="!isBoundary" src="@/assets/x6/display.png">
|
||||
<img v-else src="@/assets/x6/hide.png">
|
||||
@ -1595,7 +1838,7 @@ copyNodeInfo.value.store.data.attrs.label.text = copyDeviceInfo.value.name
|
||||
<div class="operation-icon-text">连接线</div>
|
||||
</div>
|
||||
|
||||
<div class="operation-icon-box" @click="saveDesign">
|
||||
<div class="operation-icon-box" @click="saveDesign(true)">
|
||||
<img src="@/assets/x6/save.png">
|
||||
<div class="operation-icon-text">保存</div>
|
||||
</div>
|
||||
@ -1722,11 +1965,6 @@ copyNodeInfo.value.store.data.attrs.label.text = copyDeviceInfo.value.name
|
||||
</span>
|
||||
</el-form>
|
||||
</el-dialog>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
@ -263,7 +263,7 @@ onMounted(() => {
|
||||
},
|
||||
},
|
||||
true,
|
||||
)
|
||||
)
|
||||
Graph.registerNode(
|
||||
'rect-text',
|
||||
{
|
||||
@ -307,7 +307,7 @@ onMounted(() => {
|
||||
},
|
||||
},
|
||||
true,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
@ -86,7 +86,6 @@ function downloadFile(obj :any, name :any, suffix :any) {
|
||||
|
||||
function exportExportsClick(){
|
||||
exportAllExports(props.scenarioId,props.deviceId).then((response:any) => {
|
||||
debugger
|
||||
downloadFile(response, '结果数据' , 'xlsx')
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user