|
@@ -351,7 +351,7 @@ const filteredData = computed(() => {
|
|
|
// 验证输入值
|
|
|
const validateInput = (row) => {
|
|
|
if (row.value && isNaN(row.value)) {
|
|
|
- ElMessage.warning("请输入有效数字")
|
|
|
+ ElMessage.warning(t("message.significantFigures"))
|
|
|
row.value = ""
|
|
|
}
|
|
|
}
|
|
@@ -469,8 +469,7 @@ const getcomdata = async (onpcId) => {
|
|
|
handleShapeChange(shapeRow, shapeRow.value)
|
|
|
}
|
|
|
} catch (err) {
|
|
|
- console.error("初始化失败:", err)
|
|
|
- ElMessage.error("初始化失败")
|
|
|
+ ElMessage.error(t("message.initFailed"))
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -591,7 +590,6 @@ const getbtnvalue = async (pcaId, dataType) => {
|
|
|
}
|
|
|
} catch (err) {
|
|
|
console.error("值初始化失败:", err)
|
|
|
- ElMessage.error("值初始化失败")
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -629,7 +627,6 @@ const getlistopt = async (item, gettype) => {
|
|
|
}
|
|
|
} catch (err) {
|
|
|
console.error("err", err)
|
|
|
- ElMessage.error("选项初始化失败")
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -680,11 +677,11 @@ const savecomvalue = () => {
|
|
|
}
|
|
|
request(params)
|
|
|
.then((res) => {
|
|
|
- ElMessage.success("保存成功")
|
|
|
+ ElMessage.success(t("message.saveSuccess"))
|
|
|
})
|
|
|
.catch((err) => {
|
|
|
console.error("err", err)
|
|
|
- ElMessage.error("保存失败")
|
|
|
+ ElMessage.error(t("message.saveFailed"))
|
|
|
})
|
|
|
}
|
|
|
|
|
@@ -744,7 +741,7 @@ const handleRowClick = (row) => {
|
|
|
// 删除选中行 - 如果pcadgId不为空则调用API删除
|
|
|
const handleDeleteSelected = async () => {
|
|
|
if (!currentRow.value) {
|
|
|
- ElMessage.warning("请先点击选择要删除的行")
|
|
|
+ ElMessage.warning(t("message.selectedDeleteRows"))
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -764,8 +761,7 @@ const handleDeleteSelected = async () => {
|
|
|
tableData.value.splice(index, 1)
|
|
|
updateSelectionAfterDelete(index)
|
|
|
} catch (error) {
|
|
|
- ElMessage.error("删除失败,请重试")
|
|
|
- console.error("删除过程中出错:", error)
|
|
|
+ ElMessage.error(t("message.deleteFailed"))
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -780,7 +776,7 @@ const updateSelectionAfterDelete = (deletedIndex) => {
|
|
|
} else {
|
|
|
currentRow.value = null
|
|
|
}
|
|
|
- ElMessage.success("删除成功")
|
|
|
+ ElMessage.success(t("message.deleteSuccess"))
|
|
|
}
|
|
|
|
|
|
// 后端删除API调用
|
|
@@ -800,10 +796,10 @@ const deleterow = async (pcadgId) => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// 在选中行下方插入新行 - 简化版,不再更新pcadgId
|
|
|
+// 在选中行下方插入新行
|
|
|
const handleInsertSelected = () => {
|
|
|
if (!currentRow.value && tableData.value.length > 0) {
|
|
|
- ElMessage.warning("请先点击选择要插入的位置")
|
|
|
+ ElMessage.warning(t("message.selectedInsertRows"))
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -822,40 +818,28 @@ const handleInsertSelected = () => {
|
|
|
}
|
|
|
|
|
|
const handleUnitChange = (row, newUnit, col = null) => {
|
|
|
- console.log('handleUnitChange row:', row, 'newUnit:', newUnit, 'col:', col);
|
|
|
const target = col ? row[col.code] : row;
|
|
|
- console.log('target:', target);
|
|
|
if (!target || !target.value || isNaN(parseFloat(target.value))) {
|
|
|
- // console.log('Invalid value check failed:', { target, value: target?.value, isNaN: isNaN(parseFloat(target?.value)) });
|
|
|
- ElMessage.warning('请输入有效数值');
|
|
|
+ ElMessage.warning(t("message.significantFigures"));
|
|
|
return;
|
|
|
}
|
|
|
const unitOptions = col ? col.unitoptions : row.unitoptions;
|
|
|
if (!unitOptions) {
|
|
|
- console.error('单位选项未定义', col || row);
|
|
|
- ElMessage.error(`单位选项未定义 for ${col?.name || 'unknown'}`);
|
|
|
return;
|
|
|
}
|
|
|
// 使用 row[col.code].unit 作为当前单位,而不是 col.prevUnitDef
|
|
|
const currentUnit = unitOptions.find(opt => opt.value === target.unit) || unitOptions.find(opt => opt.value === col ? col.unitDef : target.unitDef);
|
|
|
- // console.log('currentUnit:', currentUnit, 'row unit:', target.unit);
|
|
|
if (!currentUnit) {
|
|
|
- console.error('未找到当前单位信息', target.unit);
|
|
|
- ElMessage.error(`未找到当前单位信息: ${target.unit}`);
|
|
|
return;
|
|
|
}
|
|
|
const targetUnit = unitOptions.find(opt => opt.value === newUnit);
|
|
|
- // console.log('targetUnit:', targetUnit);
|
|
|
if (!targetUnit) {
|
|
|
- console.error('未找到目标单位信息', newUnit);
|
|
|
- ElMessage.error(`未找到目标单位信息: ${newUnit}`);
|
|
|
return;
|
|
|
}
|
|
|
const currentValue = parseFloat(target.value);
|
|
|
const newValue = ((currentValue - currentUnit.utOffset) / currentUnit.factor) * targetUnit.factor + targetUnit.utOffset;
|
|
|
target.value = newValue.toFixed(8);
|
|
|
target.unit = newUnit;
|
|
|
- // console.log('Updated value:', target.value, 'unit:', target.unit);
|
|
|
if (col) {
|
|
|
col.prevUnitDef = newUnit;
|
|
|
col.unitDef = newUnit; // 同步 unitDef
|
|
@@ -866,12 +850,10 @@ const handleUnitChange = (row, newUnit, col = null) => {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-// 保存
|
|
|
// 保存 - 在保存时统一更新pcadgId
|
|
|
const saveTabelDialog = () => {
|
|
|
// 检查表格数据是否为空
|
|
|
if (!tableData.value || tableData.value.length === 0) {
|
|
|
- ElMessage.warning("请设置正确的数据")
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -925,12 +907,12 @@ const saveTabelDialog = () => {
|
|
|
request(params)
|
|
|
.then((res) => {
|
|
|
paneTabledialog.value = false
|
|
|
- ElMessage.success("保存成功")
|
|
|
+ ElMessage.success(t("message.saveSuccess"))
|
|
|
})
|
|
|
.catch((err) => {
|
|
|
console.error("err", err)
|
|
|
// 保存失败,保持原始数据不变
|
|
|
- ElMessage.error("保存失败")
|
|
|
+ ElMessage.error(t("message.saveFailed"))
|
|
|
})
|
|
|
}
|
|
|
|
|
@@ -940,7 +922,6 @@ const saveTabelDialog = () => {
|
|
|
const saveKVTabelDialog = () => {
|
|
|
// 检查表格数据是否为空
|
|
|
if (!tableKVData.value || tableKVData.value.length === 0) {
|
|
|
- ElMessage.warning("请设置正确的数据")
|
|
|
return
|
|
|
}
|
|
|
const result = tableKVData.value
|
|
@@ -962,11 +943,11 @@ const saveKVTabelDialog = () => {
|
|
|
request(params)
|
|
|
.then((res) => {
|
|
|
paneKVdialog.value = false
|
|
|
- ElMessage.success("保存成功")
|
|
|
+ ElMessage.success(t("message.saveSuccess"))
|
|
|
})
|
|
|
.catch((err) => {
|
|
|
console.error("err", err)
|
|
|
- ElMessage.error("保存失败")
|
|
|
+ ElMessage.error(t("message.saveFailed"))
|
|
|
})
|
|
|
}
|
|
|
|
|
@@ -1008,7 +989,6 @@ const getresultData = (jobId) => {
|
|
|
|
|
|
const openresultline = (name, unit, coms) => {
|
|
|
if (!coms || coms.length === 0) {
|
|
|
- ElMessage.warning("没有可用的结果数据")
|
|
|
return
|
|
|
}
|
|
|
resultyLabel.value = name + "(" + unit + ")" || ""
|