up
This commit is contained in:
@@ -13,5 +13,5 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"lastUpdated": 1776158712744
|
"lastUpdated": 1776159168693
|
||||||
}
|
}
|
||||||
@@ -106,24 +106,18 @@ watch(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
// ==================== 外部初始化接口 ====================
|
// 回填费用(父组件填充 form._costs 后直接消费)
|
||||||
/**
|
watch(
|
||||||
* 由父组件调用,用于回填已有费用数据(来自 API)
|
() => props.modelValue._costs,
|
||||||
* @param {Array} list 费用数组,单位:分
|
(list) => {
|
||||||
*/
|
if (!list || list.length === 0) return;
|
||||||
function initCostEntries(list) {
|
// 先清空默认空白行,再填入 API 返回的数据
|
||||||
if (!list || list.length === 0) return;
|
costEntries.splice(0, costEntries.length);
|
||||||
costEntries.splice(0, costEntries.length);
|
list.forEach((c) => {
|
||||||
list.forEach((c) => {
|
costEntries.push({ ...c });
|
||||||
costEntries.push({
|
|
||||||
type: c.type ?? c.CostType ?? 1,
|
|
||||||
int: c.int ?? c.Quantity ?? 1,
|
|
||||||
cost: parseFloat(((c.cost ?? c.Price) / 100).toFixed(2)),
|
|
||||||
costt: parseFloat(((c.costt ?? c.Price * (c.int ?? c.Quantity)) / 100).toFixed(2)),
|
|
||||||
currencytype: c.currencytype ?? c.CurrencyType ?? 1,
|
|
||||||
});
|
});
|
||||||
});
|
},
|
||||||
}
|
);
|
||||||
|
|
||||||
// ==================== 图片上传 ====================
|
// ==================== 图片上传 ====================
|
||||||
const photosRef = ref(null);
|
const photosRef = ref(null);
|
||||||
@@ -135,7 +129,7 @@ function getPhotoHashes() {
|
|||||||
return photosRef.value?.return_files().map((f) => f.hash) ?? [];
|
return photosRef.value?.return_files().map((f) => f.hash) ?? [];
|
||||||
}
|
}
|
||||||
|
|
||||||
defineExpose({ getPhotoHashes, costEntries, initCostEntries });
|
defineExpose({ getPhotoHashes, costEntries });
|
||||||
|
|
||||||
// ==================== 表单字段双向绑定 ====================
|
// ==================== 表单字段双向绑定 ====================
|
||||||
function update(field, value) {
|
function update(field, value) {
|
||||||
|
|||||||
Reference in New Issue
Block a user