前端修改idbug

This commit is contained in:
limengnan 2025-12-24 17:14:19 +08:00
parent 0c64c11b58
commit 88dcd945e6
3 changed files with 38 additions and 27 deletions

View File

@ -87,7 +87,6 @@ const info: any = ref({
height: null, height: null,
fissileConcentration: null, fissileConcentration: null,
isotopicAbundance: null, isotopicAbundance: null,
extraFeatures: null,
keffValue: null, keffValue: null,
}); });
@ -100,7 +99,6 @@ function addClick() {
height: null, height: null,
fissileConcentration: null, fissileConcentration: null,
isotopicAbundance: null, isotopicAbundance: null,
extraFeatures: null,
keffValue: null, keffValue: null,
}; };
@ -112,26 +110,43 @@ function confirmClick(formEl: any) {
formEl.validate((valid: any) => { formEl.validate((valid: any) => {
if (valid) { if (valid) {
if (!info.value.projectId) { if (!info.value.criticalId) {
const params = { const params = {
projectId: -1,
...info.value, ...info.value,
customAttrs: JSON.stringify( customAttrsData.value)
} }
addCriticalData(params).then((res) => { addCriticalData(params).then((res:any) => {
gettableData(); if(res === true){
dialogVisible.value = false; gettableData();
}); dialogVisible.value = false;
} else if (info.value.projectId) { }else{
const params = { ElMessage({
projectId: -1, type: "error",
...info.value, message: '新增失败',
customAttrs: JSON.stringify( customAttrsData.value) });
}
});
} else if (info.value.criticalId) {
const params = {
criticalId: info.value.criticalId,
deviceType: info.value.deviceType,
diameter: info.value.diameter,
height: info.value.height,
fissileConcentration: info.value.fissileConcentration,
isotopicAbundance: info.value.isotopicAbundance,
keffValue: info.value.keffValue,
}
updateCriticalData(params).then((res:any) => {
if(res === true){
gettableData();
dialogVisible.value = false;
}else{
ElMessage({
type: "error",
message: '修改失败',
});
} }
updateCriticalData(params).then((res) => {
gettableData();
dialogVisible.value = false;
}); });
} else { } else {
return false; return false;
@ -154,10 +169,6 @@ const rules = ref({
function editClick(row: any) { function editClick(row: any) {
title.value = "修改设备"; title.value = "修改设备";
info.value = JSON.parse(JSON.stringify(row)); info.value = JSON.parse(JSON.stringify(row));
if(row.customAttrs != null){
customAttrsData.value = JSON.parse(row.customAttrs);
}
dialogVisible.value = true; dialogVisible.value = true;
} }
@ -170,7 +181,7 @@ function delAloneClick(row: any) {
}) })
.then(() => { .then(() => {
let params = { let params = {
id: row.deviceId, id: row.criticalId,
}; };
deleteCriticalData(params).then(() => { deleteCriticalData(params).then(() => {
gettableData(); gettableData();
@ -192,7 +203,7 @@ function delClick() {
}).then(() => { }).then(() => {
let id = [] as any[]; let id = [] as any[];
multipleSelection.value.forEach((item: any) => { multipleSelection.value.forEach((item: any) => {
id.push(item.deviceId) id.push(item.criticalId)
}) })
let params = { let params = {
ids: id, ids: id,

View File

@ -127,7 +127,7 @@ function confirmClick(formEl: any) {
formEl.validate((valid: any) => { formEl.validate((valid: any) => {
if (valid) { if (valid) {
if (!info.value.projectId) { if (!info.value.deviceId) {
const params = { const params = {
projectId: -1, projectId: -1,
@ -138,7 +138,7 @@ function confirmClick(formEl: any) {
gettableData(); gettableData();
dialogVisible.value = false; dialogVisible.value = false;
}); });
} else if (info.value.projectId) { } else if (info.value.deviceId) {
const params = { const params = {
projectId: -1, projectId: -1,
...info.value, ...info.value,

View File

@ -117,7 +117,7 @@ function confirmClick(formEl: any) {
formEl.validate((valid: any) => { formEl.validate((valid: any) => {
if (valid) { if (valid) {
if (!info.value.projectId) { if (!info.value.materialId) {
const params = { const params = {
projectId: -1, projectId: -1,
@ -128,7 +128,7 @@ function confirmClick(formEl: any) {
gettableData(); gettableData();
dialogVisible.value = false; dialogVisible.value = false;
}); });
} else if (info.value.projectId) { } else if (info.value.materialId) {
const params = { const params = {
projectId: -1, projectId: -1,
...info.value, ...info.value,