修改计算结果逻辑,动态匹配设备物料信息
This commit is contained in:
parent
b2e250ac05
commit
d979b5523a
@ -208,81 +208,21 @@ function addAttrText(item:any,index:any,useData:any){
|
|||||||
let tempData:any = []
|
let tempData:any = []
|
||||||
if(item.scenarioResults[index].attrState){
|
if(item.scenarioResults[index].attrState){
|
||||||
let attrState = JSON.parse(item.scenarioResults[index].attrState)
|
let attrState = JSON.parse(item.scenarioResults[index].attrState)
|
||||||
debugger
|
|
||||||
for (const key in attrState) {
|
for (const key in attrState) {
|
||||||
if (!Object.hasOwn(attrState, key)) continue;
|
if (!Object.hasOwn(attrState, key)) continue;
|
||||||
const element = attrState[key];
|
const element = attrState[key];
|
||||||
tempData.push({
|
tempData.push({
|
||||||
name: key,
|
name: key,
|
||||||
value: element
|
value: element,
|
||||||
|
deviceType: item.scenarioResults[index].deviceType,
|
||||||
|
deviceTypeResultant: item.scenarioResults[index].deviceType + key,
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
appendAttrText(item,tempData,useData)
|
appendAttrText(item,tempData,useData)
|
||||||
}
|
}
|
||||||
|
|
||||||
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 'pulse_velocity':
|
|
||||||
return name = "脉冲速度(单位:Hz)";
|
|
||||||
break;
|
|
||||||
case 'u_concentration':
|
|
||||||
return name = "铀浓度(g/L)";
|
|
||||||
break;
|
|
||||||
case 'uo2_density':
|
|
||||||
return name = "氧化铀密度(g/cm3)";
|
|
||||||
break;
|
|
||||||
case 'u_enrichment':
|
|
||||||
return name = "铀富集度";
|
|
||||||
break;
|
|
||||||
case 'pu_concentration':
|
|
||||||
return name = "钚浓度(g/L)";
|
|
||||||
break;
|
|
||||||
case 'puo2_density':
|
|
||||||
return name = "氧化钚密度(g/cm3)";
|
|
||||||
break;
|
|
||||||
case 'pu_isotope':
|
|
||||||
return name = "钚同位素比例(PU-240占比)";
|
|
||||||
break;
|
|
||||||
case 'hno3_acidity':
|
|
||||||
return name = "硝酸酸度(mol/L)";
|
|
||||||
break;
|
|
||||||
case 'h2c2o4_concentration':
|
|
||||||
return name = "草酸浓度(mol/L)";
|
|
||||||
break;
|
|
||||||
case 'organic_ratio':
|
|
||||||
return name = "有机相比例";
|
|
||||||
break;
|
|
||||||
case 'moisture_content':
|
|
||||||
return name = "含水率";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return name = "";
|
|
||||||
}
|
|
||||||
return name
|
|
||||||
}
|
|
||||||
function appendAttrText(item:any,data:any,useData:any){
|
function appendAttrText(item:any,data:any,useData:any){
|
||||||
if(useData.length == 0){
|
if(useData.length == 0){
|
||||||
return
|
return
|
||||||
@ -290,7 +230,9 @@ function appendAttrText(item:any,data:any,useData:any){
|
|||||||
if(isDisplay.value == false){
|
if(isDisplay.value == false){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const result = data.filter((item:any) => useData.includes(item.name));
|
const materialResult = data.filter((item:any) => useData.includes(item.name));
|
||||||
|
const deviceResult = data.filter((item:any) => useData.includes(item.deviceTypeResultant));
|
||||||
|
const result = [...deviceResult,...materialResult]
|
||||||
for(let i = 0;i<result.length;i++){
|
for(let i = 0;i<result.length;i++){
|
||||||
graph.addNode({
|
graph.addNode({
|
||||||
shape: 'rect-text',
|
shape: 'rect-text',
|
||||||
@ -308,7 +250,7 @@ function appendAttrText(item:any,data:any,useData:any){
|
|||||||
label: {
|
label: {
|
||||||
textAnchor: 'left',
|
textAnchor: 'left',
|
||||||
refX: 0,
|
refX: 0,
|
||||||
text: getName(result[i].name) + ':' + result[i].value,
|
text: getName(result[i].deviceType,result[i].name) + ':' + result[i].value,
|
||||||
textWrap: {
|
textWrap: {
|
||||||
width: 250,
|
width: 250,
|
||||||
height: 30,
|
height: 30,
|
||||||
@ -325,7 +267,28 @@ function appendAttrText(item:any,data:any,useData:any){
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
function getName(deviceType:any,name:any){
|
||||||
|
let tempName = ""
|
||||||
|
for (const key in sizeSchemaInfo.value) {
|
||||||
|
if (!Object.hasOwn(sizeSchemaInfo.value, key)) continue;
|
||||||
|
const element = sizeSchemaInfo.value[key];
|
||||||
|
if(key == deviceType){
|
||||||
|
element.fields.forEach((item:any) => {
|
||||||
|
if(item.key == name){
|
||||||
|
tempName = item.name
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return tempName
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
function groupByDeviceId(data:any) { // 按设备id分组
|
function groupByDeviceId(data:any) { // 按设备id分组
|
||||||
// 边界检查:确保输入是数组
|
// 边界检查:确保输入是数组
|
||||||
if (!Array.isArray(data)) {
|
if (!Array.isArray(data)) {
|
||||||
@ -859,20 +822,6 @@ function dialogAttributeDialog(){ // 关闭变动设置弹窗
|
|||||||
|
|
||||||
function confirmClick(){
|
function confirmClick(){
|
||||||
let tempData:any = []
|
let tempData:any = []
|
||||||
// for(let i = 0;i<deviceList.value.length;i++){
|
|
||||||
// if(deviceList.value[i].checked){
|
|
||||||
// tempData.push(deviceList.value[i].code)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// items.name = items.label
|
|
||||||
// items.code = items.key
|
|
||||||
// items.checked = false
|
|
||||||
// items.deviceType = result[item].deviceType,
|
|
||||||
// items.deviceTypeName = getDeviceTypeName(result[item].deviceType)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for(let item in sizeSchemaInfo.value){
|
for(let item in sizeSchemaInfo.value){
|
||||||
sizeSchemaInfo.value[item].fields.forEach((items:any) => {
|
sizeSchemaInfo.value[item].fields.forEach((items:any) => {
|
||||||
if(items.checked == true){
|
if(items.checked == true){
|
||||||
|
|||||||
@ -311,7 +311,6 @@ onMounted(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const handleInput = (val: string) => {
|
const handleInput = (val: string) => {
|
||||||
debugger
|
|
||||||
// 正则规则:匹配非负整数或小数(支持最多两位小数,可根据需求调整)
|
// 正则规则:匹配非负整数或小数(支持最多两位小数,可根据需求调整)
|
||||||
const reg = /^\d+(\.\d{0,2})?$/;
|
const reg = /^\d+(\.\d{0,2})?$/;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user