修改变更关系
This commit is contained in:
parent
223f815b15
commit
7896f303b4
@ -160,6 +160,21 @@ const props = defineProps({
|
||||
type: Object,
|
||||
default: {}
|
||||
},
|
||||
formula: {
|
||||
required: false,
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
formulaData: {
|
||||
required: false,
|
||||
type: Array,
|
||||
default: []
|
||||
},
|
||||
deviceMaterialData: {
|
||||
required: false,
|
||||
type: Array,
|
||||
default: []
|
||||
},
|
||||
})
|
||||
const isAcitve = ref(-1);
|
||||
|
||||
@ -185,10 +200,10 @@ function handleClick(item:any, index:any){
|
||||
for(let key in item){
|
||||
if(getName(key).name != '' && item[key] != '' && item[key] != null){
|
||||
attributeList.value.push({
|
||||
name: '('+getName(key).name +')',
|
||||
name: getName(key).name ,
|
||||
key: getName(key).key,
|
||||
type: getName(key).type,
|
||||
parentName : getName(key).type == 'device' ? '('+item.deviceName +')' : '('+item.materialName +')',
|
||||
parentName : getName(key).type == 'device' ? item.deviceName : item.materialName ,
|
||||
parentId : getName(key).type == 'device' ? item.deviceId : item.materialId
|
||||
})
|
||||
}
|
||||
@ -213,7 +228,7 @@ function selectedClick(item:any, index:any){
|
||||
let tempData:any = []
|
||||
formulaData.value.forEach((element:any) => {
|
||||
if(element.parentName != null){
|
||||
tempData.push(element.parentName)
|
||||
tempData.push("(" + element.parentName +'.'+ element.name+")" )
|
||||
}else{
|
||||
tempData.push(element)
|
||||
}
|
||||
@ -225,15 +240,18 @@ function selectedClick(item:any, index:any){
|
||||
onMounted(() => {
|
||||
|
||||
gettableData();
|
||||
|
||||
formula.value = props.formula
|
||||
formulaData.value = props.formulaData
|
||||
});
|
||||
;
|
||||
|
||||
function selectedSymbolClick(name:any){
|
||||
formulaData.value.push(name)
|
||||
|
||||
let tempData:any = []
|
||||
formulaData.value.forEach((element:any) => {
|
||||
if(element.parentName != null){
|
||||
tempData.push(element.parentName)
|
||||
tempData.push("(" + element.parentName +'.'+ element.name+")" )
|
||||
}else{
|
||||
tempData.push(element)
|
||||
}
|
||||
@ -246,7 +264,7 @@ function delClick(index:any){
|
||||
let tempData:any = []
|
||||
formulaData.value.forEach((element:any) => {
|
||||
if(element.parentName != null){
|
||||
tempData.push(element.parentName)
|
||||
tempData.push("(" + element.parentName +'.'+ element.name+")" )
|
||||
}else{
|
||||
tempData.push(element)
|
||||
}
|
||||
@ -254,6 +272,7 @@ function delClick(index:any){
|
||||
});
|
||||
formula.value = tempData.join('')
|
||||
}
|
||||
// const deviceMaterialData:any = ref([])
|
||||
function confirmClick(){
|
||||
let deviceMaterialData:any = []
|
||||
formulaData.value.forEach((element:any) => {
|
||||
@ -307,7 +326,7 @@ function confirmClick(){
|
||||
<div @click="selectedSymbolClick(1)">1</div>
|
||||
<div @click="selectedSymbolClick(2)">2</div>
|
||||
<div @click="selectedSymbolClick(3)">3</div>
|
||||
<div @click="selectedSymbolClick(3)">-</div>
|
||||
<div @click="selectedSymbolClick(' - ')">-</div>
|
||||
</div>
|
||||
<div class="calculator-box">
|
||||
<div style="width: 220px;" @click="selectedSymbolClick(0)">0</div>
|
||||
|
||||
@ -206,9 +206,20 @@ function confirmTableClick(){ // 确认变动公式设置
|
||||
tableData.value[tableIndex.value].deviceMaterialData = formulaInfo.value.deviceMaterialData
|
||||
isDialogFormula.value = false
|
||||
}
|
||||
const formula:any = ref('')
|
||||
const formulaData:any = ref([])
|
||||
|
||||
const isChangeDialogsettings:any = ref(false) // 变动公式设置弹窗
|
||||
|
||||
function openChangeDialogsettings(){ // 打开变动公式值设置弹窗
|
||||
formula.value = ''
|
||||
formulaData.value = []
|
||||
if(tableData.value[tableIndex.value].formula !=null && tableData.value[tableIndex.value].formula != ""){
|
||||
formula.value = tableData.value[tableIndex.value].formula
|
||||
}
|
||||
if(tableData.value[tableIndex.value].formulaData !=null && tableData.value[tableIndex.value].formulaData != ""){
|
||||
formulaData.value = tableData.value[tableIndex.value].formulaData
|
||||
}
|
||||
isChangeDialogsettings.value = true
|
||||
}
|
||||
|
||||
@ -328,6 +339,7 @@ function closeChangeDialogsettings(e:any){ // 变动公式值设置关闭
|
||||
<el-dialog v-model="isChangeDialogsettings" :close-on-click-modal="false" :modal="false" draggable
|
||||
:before-close="dialogChangeDialogsettings" title="变动公式值设置" append-to-body width="1280px" class="materialmodel-dialog-box">
|
||||
<ChangeDialogsettings v-if="isChangeDialogsettings" :projectInfo="projectInfo"
|
||||
:formula = "formula" :formulaData= "formulaData"
|
||||
@closeChangeDialogsettings="closeChangeDialogsettings" />
|
||||
</el-dialog>
|
||||
|
||||
|
||||
@ -100,6 +100,9 @@ onMounted(() => {
|
||||
graph = new Graph({
|
||||
container: document.getElementById('graph-container') as HTMLElement,
|
||||
grid: true,
|
||||
background: {
|
||||
color: '#ffffff' // Set a solid color background instead of an image
|
||||
},
|
||||
mousewheel: {
|
||||
enabled: true,
|
||||
zoomAtMousePosition: true,
|
||||
@ -789,9 +792,9 @@ function preWork() {
|
||||
.x6-widget-stencil-title{
|
||||
display: none;
|
||||
}
|
||||
#graph-container {
|
||||
.x6-container-editbox #graph-container {
|
||||
width: calc(100% - 180px);
|
||||
height: 100%;
|
||||
height: 100% !important;
|
||||
background-color: #f1f3fe;
|
||||
}
|
||||
.x6-widget-stencil {
|
||||
@ -860,10 +863,14 @@ function closeAntvx6() {
|
||||
}
|
||||
|
||||
function revokeClick(){
|
||||
if (graph.canUndo()) {
|
||||
graph.undo()
|
||||
}
|
||||
}
|
||||
function removeClick(){
|
||||
graph.clearCells();
|
||||
if (graph.canRedo()) {
|
||||
graph.redo()
|
||||
}
|
||||
}
|
||||
function bigClick(){
|
||||
graph.zoom(0.1)
|
||||
@ -919,6 +926,7 @@ function closeEditdevice(e:any){ // 关闭编辑设备弹窗
|
||||
let retrievedNode:any = graph.getCellById(nodeId.value)
|
||||
retrievedNode.store.data.deviceInfo = e
|
||||
isEditdevice.value = false;
|
||||
saveDesign()
|
||||
}
|
||||
|
||||
function dialogEditdevice(){ // 关闭设备弹窗
|
||||
@ -1006,13 +1014,18 @@ function closeChangesettingsModel(e:any){ // 关闭变动设置弹窗
|
||||
function setFormulaInit(formula:any) {
|
||||
// const formula = "【(圆柱槽B)*0.2+(环形槽A)*1.0+0.5】";
|
||||
// 匹配*号后、+或)前的数字(支持整数和小数)
|
||||
const regex = /\*(\d+\.?\d*)/g;
|
||||
const regex = /([\*\/])(\d+\.?\d*)/g;
|
||||
const coefficients = [];
|
||||
let match;
|
||||
|
||||
// 循环提取所有匹配项
|
||||
while ((match = regex.exec(formula)) !== null) {
|
||||
if(!isNaN(parseFloat(match[1]))){
|
||||
coefficients.push(parseFloat(match[1])); // 转为数字类型
|
||||
}else if(!isNaN(parseFloat(match[2]))){
|
||||
coefficients.push(parseFloat(match[2])); // 转为数字类型
|
||||
}
|
||||
|
||||
}
|
||||
console.log(coefficients); // 输出: [0.2, 1.0]
|
||||
return coefficients
|
||||
@ -1022,10 +1035,20 @@ function setFormulaInit(formula:any) {
|
||||
function getBias(formula:any){
|
||||
// 从后往前找最后一个+的位置
|
||||
// 匹配最后一个+号后面的数字(支持整数、小数)
|
||||
const regex = /\+(\d+\.?\d*)$/;
|
||||
const match = formula.match(regex);
|
||||
const constant = parseFloat(match[1]);
|
||||
return constant
|
||||
if (formula.includes(' - ')){
|
||||
const parts = formula.split(' - ');
|
||||
// 处理以点开头的文件(如.gitignore)
|
||||
return parseFloat('-' + parts.pop().toLowerCase()) ;
|
||||
};
|
||||
if (formula.includes(' + ')){
|
||||
const parts = formula.split(' + ');
|
||||
// 处理以点开头的文件(如.gitignore)
|
||||
return parseFloat('+' + parts.pop().toLowerCase()) ;
|
||||
};
|
||||
return 0
|
||||
// 从最后一个点分割,取后面的部分
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1051,10 +1074,20 @@ function saveDesign() { // 保存设计
|
||||
let tempSources = []
|
||||
|
||||
for(let k=0;k<setFormulaInit(cells[i].changesettings[j].formula).length;k++){
|
||||
|
||||
// name: '('+getName(key).name +')',
|
||||
// key: getName(key).key,
|
||||
// type: getName(key).type,
|
||||
// parentName : getName(key).type == 'device' ? '('+item.deviceName +')' : '('+item.materialName +')',
|
||||
// parentId : getName(key).type == 'device' ? item.deviceId : item.materialId
|
||||
if(cells[i].changesettings[j].deviceMaterialData[k] == null){
|
||||
return
|
||||
}
|
||||
|
||||
tempSources.push({
|
||||
entityType: 'material', //圆柱槽B
|
||||
entityId: cells[i].materialInfo.materialId , //materialId : cdeeca2e-1e0c-4bdd-b946-f347c104752c
|
||||
property: name, // 铀浓度(g/L)
|
||||
entityType: cells[i].changesettings[j].deviceMaterialData[k].type, //圆柱槽B
|
||||
entityId: cells[i].changesettings[j].deviceMaterialData[k].parentId , //materialId : cdeeca2e-1e0c-4bdd-b946-f347c104752c
|
||||
property: cells[i].changesettings[j].deviceMaterialData[k].key, // 铀浓度(g/L)
|
||||
coefficient: setFormulaInit(cells[i].changesettings[j].formula)[k], //0.2
|
||||
delay: { enabled: true, time: delay, unit: 's' } // 5
|
||||
})
|
||||
@ -1086,7 +1119,7 @@ function saveDesign() { // 保存设计
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
console.log(devices)
|
||||
const topology = {
|
||||
projectId: projectInfo.value.projectId,
|
||||
name: projectInfo.value.name,
|
||||
@ -1127,7 +1160,7 @@ function saveDesign() { // 保存设计
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="app-layout" @click="isMenuShow = false">
|
||||
<div class="app-layout x6-container-editbox" @click="isMenuShow = false">
|
||||
<!-- <div class="toolbar">
|
||||
<div class="style-group">
|
||||
<h4>实线</h4>
|
||||
@ -1540,4 +1573,8 @@ function saveDesign() { // 保存设计
|
||||
box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.1);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.x6-graph-grid {
|
||||
background-image: none !important;
|
||||
}
|
||||
</style>
|
||||
Loading…
Reference in New Issue
Block a user