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

View File

@ -109,8 +109,13 @@ function addSegmentation() { // 添加分段
end:null, end:null,
timeline:[] timeline:[]
}) })
}
}
function removeSegmentation(index:any){ //
menuList.value[menuIndex.value].segments.splice(index, 1);
segmentationIndex.value = 0
getTimelineList()
}
function removeAttr(index:any){ // function removeAttr(index:any){ //
menuList.value[menuIndex.value].segments[segmentationIndex.value].timeline.splice(index, 1); menuList.value[menuIndex.value].segments[segmentationIndex.value].timeline.splice(index, 1);
@ -129,7 +134,7 @@ function menuClick(index:any){ // 点击菜单切换
getTimelineList() getTimelineList()
} }
function addMenu(){ // function addMenu(){ //
menuList.value.push({ menuList.value.unshift({
label: '条件' + (menuList.value.length + 1), label: '条件' + (menuList.value.length + 1),
target:{ target:{
entityType: '', entityType: '',
@ -144,6 +149,7 @@ function addMenu(){ //添加导菜单
timeline:[] timeline:[]
}] }]
}) })
menuIndex.value = 0
} }
@ -212,26 +218,6 @@ function changeMaterial(e:any){ // 设备属性改变时,清空变化物料
getDeviceInfo(e) 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 devicename = ref('') //
const deviceMaterial = ref('') // const deviceMaterial = ref('') //
@ -239,14 +225,6 @@ const timelineList:any = ref([]) // 时间线数据
function getTimelineList(){ function getTimelineList(){
timelineList.value = [] 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] let item = menuList.value[menuIndex.value]
item.segments.forEach((segment:any) => { item.segments.forEach((segment:any) => {
segment.timeline.forEach((timeline:any) => { segment.timeline.forEach((timeline:any) => {
@ -293,7 +271,7 @@ function getDeviceInfo(e:any){ // 获取设备信息
:class="{'condition-item-active': index == menuIndex}" @click="menuClick(index)"> :class="{'condition-item-active': index == menuIndex}" @click="menuClick(index)">
{{ item.label }} {{ item.label }}
</div> </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> </div>
<el-form ref="infoForm" label-width="120px"> <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" <div v-for="(item, index) in menuList[menuIndex].segments" :key="index" class="segmentation-item"
:class="{'segmentation-item-active': index == segmentationIndex}" @click="segmentationIndex = index"> :class="{'segmentation-item-active': index == segmentationIndex}" @click="segmentationIndex = index">
<span>{{ item.segmentId }}</span> <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>
<div class="segmentation-item-add" @click="addSegmentation" v-if="isEdit == true"> <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; "> @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/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; "> @click="delAloneClick(scope.row)" style="cursor: pointer; ">
<img v-else src="@/assets/table/del_disabled.png" alt="" title="删除"
>
</span> </span>
</template> </template>
</el-table-column> </el-table-column>