()
| 852 | } |
| 853 | |
| 854 | function applySelectedTemplate() { |
| 855 | const selectEl = document.getElementById("billing-template-select"); |
| 856 | if (!selectEl || !selectEl.value) { |
| 857 | toast.warning("请先选择模板"); |
| 858 | return; |
| 859 | } |
| 860 | const templates = getBillingTemplates(); |
| 861 | const selected = templates.find((tpl) => tpl.id === selectEl.value); |
| 862 | if (!selected) { |
| 863 | toast.warning("模板不存在或已删除"); |
| 864 | refreshBillingTemplateSelect(); |
| 865 | return; |
| 866 | } |
| 867 | fillBillingForm(selected.data || {}); |
| 868 | setInputValue("billing-template-name", selected.name || ""); |
| 869 | toast.success(`已应用模板: ${selected.name}`); |
| 870 | } |
| 871 | |
| 872 | async function deleteSelectedTemplate() { |
| 873 | const selectEl = document.getElementById("billing-template-select"); |
nothing calls this directly
no test coverage detected