修改前端bug

This commit is contained in:
limengnan 2026-01-20 18:04:10 +08:00
parent ffd02cbddc
commit 93062e9f8c
4 changed files with 82 additions and 92 deletions

View File

Before

Width:  |  Height:  |  Size: 510 B

After

Width:  |  Height:  |  Size: 510 B

View File

@ -72,46 +72,49 @@ function getScenarioResults(){
})
}
function addAttrText(item:any){
// item.attrs.text = item.deviceInfo.name
graph.addNode({
shape: 'rect-text',
x: item.position.x ,
y: item.position.y + 150,
width: 100,
height: 40,
label: item.deviceInfo.name,
attrs: {
body: {
stroke: 'transparent',
fill: 'transparent',
strokeWidth: 1,
},
text: {
text: '',
label: {
textAnchor: 'left',
refX: 0,
text: item.deviceInfo.name,
fill: '#363636',
fontSize: 16,
},
}
},
})
graph.addNode({
shape: 'rect-text',
x: item.position.x ,
y: item.position.y + 180,
width: 100,
height: 30,
label: 'keff' + item.scenarioResults[item.scenarioResults.length - 1].keffValue,
attrs: {
body: {
stroke: 'transparent',
fill: 'transparent',
strokeWidth: 1,
},
text: {
text: '',
label: {
textAnchor: 'left',
refX: 0,
text: 'keff' + item.scenarioResults[item.scenarioResults.length - 1].keffValue,
fill: item.scenarioResults[item.scenarioResults.length - 1].keffValue > 0.98 ? '#ff4d4f' : '#363636',
fontSize: 14,
},
}
},
})
graph.addNode({
shape: 'image-node',
x: item.position.x + 135 ,
@ -230,6 +233,7 @@ function appendAttrText(item:any,data:any){
for(let i = 0;i<data.length;i++){
graph.addNode({
shape: 'rect-text',
x: item.position.x,
y: item.position.y + 203 + i * 25,
width: 260,
@ -528,54 +532,56 @@ onMounted(() => {
},
true,
)
// Graph.registerNode(
// 'image-echarts',
// {
// 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,
// },
// img: {
// 'xlink:href': 'https://gw.alipayobjects.com/zos/antfincdn/FLrTNDvlna/antv.png',
// width: 24,
// height: 24,
// x: 0,
// y: 0,
// },
// label: {
// text: 'Image Node',
// fill: '#333',
// fontSize: 12,
// refX: 0.5,
// refY: 0.5,
// textAnchor: 'middle',
// dy: 10,
// },
// },
// },
// 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,
)
projectsById({projectId:route.query.projectId}).then((res:any) => {
if(res.topology != null && res.topology != ''){
projectInfo.value = res
@ -590,6 +596,7 @@ onMounted(() => {
customImageData.value.push(topology.designData[i])
}
}
console.log(topology.designData)
graph.fromJSON(topology.designData);
getScenarioResults()
}
@ -647,7 +654,8 @@ function isDisplayClick(){
isDisplay.value = false
let tempGraph:any = graph.toJSON().cells
for(let i = 0;i<tempGraph.length;i++){
if(tempGraph[i].shape == 'rect' || tempGraph[i].shape == 'image-node'){
console.log(tempGraph[i])
if(tempGraph[i].shape == 'rect-text' || tempGraph[i].shape == 'image-node'){
graph.removeCell(tempGraph[i].id)
}
}

View File

@ -109,8 +109,13 @@ function addSegmentation() { // 添加分段
end:null,
timeline:[]
})
}
}
function removeSegmentation(index:any){ //
menuList.value[menuIndex.value].segments.splice(index, 1);
segmentationIndex.value = 0
getTimelineList()
}
function removeAttr(index:any){ //
menuList.value[menuIndex.value].segments[segmentationIndex.value].timeline.splice(index, 1);
@ -129,7 +134,7 @@ function menuClick(index:any){ // 点击菜单切换
getTimelineList()
}
function addMenu(){ //
menuList.value.push({
menuList.value.unshift({
label: '条件' + (menuList.value.length + 1),
target:{
entityType: '',
@ -144,6 +149,7 @@ function addMenu(){ //添加导菜单
timeline:[]
}]
})
menuIndex.value = 0
}
@ -212,26 +218,6 @@ function changeMaterial(e:any){ // 设备属性改变时,清空变化物料
getDeviceInfo(e)
}
//
// async function DicInit() {
// let params = {
// dictId: 'dc7419e5f8a655966e6bb90b0cb5c0c2',
// size:99,
// current:1
// }
// const attributeResult = await getDictItemById(params)
// attributeData.value = attributeResult.data.records;
// let paramss = {
// dictId: '9d87f873bc80e79c6d399131cbe01016',
// size:99,
// current:1
// }
// const materialResult = await getDictItemById(paramss)
// materialData.value = materialResult.data.records;
// initConditionData()
// }
const devicename = ref('') //
const deviceMaterial = ref('') //
@ -239,14 +225,6 @@ const timelineList:any = ref([]) // 时间线数据
function getTimelineList(){
timelineList.value = []
// menuList.value.forEach((item:any) => {
// item.segments.forEach((segment:any) => {
// segment.timeline.forEach((timeline:any) => {
// console.log(timeline)
// timelineList.value.push(timeline)
// })
// })
// })
let item = menuList.value[menuIndex.value]
item.segments.forEach((segment:any) => {
segment.timeline.forEach((timeline:any) => {
@ -293,7 +271,7 @@ function getDeviceInfo(e:any){ // 获取设备信息
:class="{'condition-item-active': index == menuIndex}" @click="menuClick(index)">
{{ item.label }}
</div>
<img src="@/assets/add.png" v-if="isEdit == true" alt="" class="condition-img" @click="addMenu">
<img src="@/assets/add.png" v-if="isEdit == true" alt="" class="condition-img" style="cursor: pointer;" @click="addMenu">
</div>
<el-form ref="infoForm" label-width="120px">
@ -321,7 +299,9 @@ function getDeviceInfo(e:any){ // 获取设备信息
<div v-for="(item, index) in menuList[menuIndex].segments" :key="index" class="segmentation-item"
:class="{'segmentation-item-active': index == segmentationIndex}" @click="segmentationIndex = index">
<span>{{ item.segmentId }}</span>
<svg v-if="isEdit == true" t="1766969938271" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4998" width="14" height="14"><path d="M571.01312 523.776l311.3472-311.35232c15.7184-15.71328 15.7184-41.6256 0-57.344l-1.69472-1.69984c-15.7184-15.71328-41.6256-15.71328-57.34912 0l-311.3472 311.77728-311.35232-311.77728c-15.7184-15.71328-41.63072-15.71328-57.344 0l-1.69984 1.69984a40.0128 40.0128 0 0 0 0 57.344L452.92544 523.776l-311.35232 311.35744c-15.71328 15.71328-15.71328 41.63072 0 57.33888l1.69984 1.69984c15.71328 15.7184 41.6256 15.7184 57.344 0l311.35232-311.35232 311.3472 311.35232c15.72352 15.7184 41.63072 15.7184 57.34912 0l1.69472-1.69984c15.7184-15.70816 15.7184-41.6256 0-57.33888l-311.3472-311.35744z" p-id="4999" fill="currentColor"></path></svg>
<svg v-if="isEdit == true && menuList[menuIndex].segments.length > 1"
@click.top="removeSegmentation(index)"
t="1766969938271" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4998" width="14" height="14"><path d="M571.01312 523.776l311.3472-311.35232c15.7184-15.71328 15.7184-41.6256 0-57.344l-1.69472-1.69984c-15.7184-15.71328-41.6256-15.71328-57.34912 0l-311.3472 311.77728-311.35232-311.77728c-15.7184-15.71328-41.63072-15.71328-57.344 0l-1.69984 1.69984a40.0128 40.0128 0 0 0 0 57.344L452.92544 523.776l-311.35232 311.35744c-15.71328 15.71328-15.71328 41.63072 0 57.33888l1.69984 1.69984c15.71328 15.7184 41.6256 15.7184 57.344 0l311.35232-311.35232 311.3472 311.35232c15.72352 15.7184 41.63072 15.7184 57.34912 0l1.69472-1.69984c15.7184-15.70816 15.7184-41.6256 0-57.33888l-311.3472-311.35744z" p-id="4999" fill="currentColor"></path></svg>
</div>
<div class="segmentation-item-add" @click="addSegmentation" v-if="isEdit == true">
+ 新增分段

View File

@ -406,8 +406,10 @@ function changeShowResult(isShow:boolean){ // 切换显示结果模型
@click="resultClick(scope.row)" style="cursor: pointer; ">
<img src="@/assets/table/result_disabled.png" alt="" title="计算结果" v-if="scope.row.status != 2">
<img src="@/assets/table/del.png" alt="" title="删除"
<img src="@/assets/table/del.png" alt="" title="删除" v-if="scope.row.status == 0"
@click="delAloneClick(scope.row)" style="cursor: pointer; ">
<img v-else src="@/assets/table/del_disabled.png" alt="" title="删除"
>
</span>
</template>
</el-table-column>