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