feat: 同步调整导线参数数组操作

This commit is contained in:
dmy
2026-03-02 22:03:01 +08:00
parent 12565e971d
commit d7ed999da6

View File

@@ -350,29 +350,40 @@ const voltageOptions = [
] ]
// 数组操作函数最多3条导线即数组最多4个元素1地线+3导线 // 数组操作函数最多3条导线即数组最多4个元素1地线+3导线
// 两个数组同步增减
const addHArm = () => { const addHArm = () => {
if (params.parameter.h_arm.length < 4) { if (params.parameter.h_arm.length < 4) {
const last = params.parameter.h_arm[params.parameter.h_arm.length - 1] || 100 const last = params.parameter.h_arm[params.parameter.h_arm.length - 1] || 100
params.parameter.h_arm.push(last - 20) params.parameter.h_arm.push(last - 20)
// 同步增加 gc_x
const lastX = params.parameter.gc_x[params.parameter.gc_x.length - 1] || 10
params.parameter.gc_x.push(lastX)
} }
} }
const removeHArm = () => { const removeHArm = () => {
if (params.parameter.h_arm.length > 2) { if (params.parameter.h_arm.length > 2) {
params.parameter.h_arm.pop() params.parameter.h_arm.pop()
// 同步删除 gc_x
params.parameter.gc_x.pop()
} }
} }
const addGcX = () => { const addGcX = () => {
if (params.parameter.gc_x.length < 4) { if (params.parameter.gc_x.length < 4) {
const last = params.parameter.gc_x[params.parameter.gc_x.length - 1] || 10 const lastX = params.parameter.gc_x[params.parameter.gc_x.length - 1] || 10
params.parameter.gc_x.push(last) params.parameter.gc_x.push(lastX)
// 同步增加 h_arm
const last = params.parameter.h_arm[params.parameter.h_arm.length - 1] || 100
params.parameter.h_arm.push(last - 20)
} }
} }
const removeGcX = () => { const removeGcX = () => {
if (params.parameter.gc_x.length > 2) { if (params.parameter.gc_x.length > 2) {
params.parameter.gc_x.pop() params.parameter.gc_x.pop()
// 同步删除 h_arm
params.parameter.h_arm.pop()
} }
} }