This commit is contained in:
2026-08-11 19:59:15 +08:00
parent c690a30422
commit 41618847b7
19 changed files with 117 additions and 142 deletions
@@ -44,7 +44,7 @@ const page = ref(1)
const pageSize = ref(20)
const total = ref(0)
const serverPaged = ref(false)
const filters = reactive<QueryModel>({ keyword: '', customerId: '', status: '' })
const filters = ref<QueryModel>({ keyword: '', customerId: '', status: '' })
const drawerOpen = ref(false)
const drawerMode = ref<DrawerMode>('create')
const drawerLoading = ref(false)
@@ -324,7 +324,7 @@ async function load() {
if (!canView.value) return
loading.value = true; loadError.value = null
try {
const customerId = String(filters.customerId || '').trim()
const customerId = String(filters.value.customerId || '').trim()
if (!customerId) { allRows.value = []; total.value = 0; return }
let source: TableRow[]
let responseTotal = 0
@@ -337,14 +337,14 @@ async function load() {
} else {
const result = await listFinancePayableSettlements(customerId); source = result.map(mapPayable); responseTotal = result.length; serverPaged.value = false
}
const keyword = String(filters.keyword || '').trim().toLowerCase()
const status = String(filters.status || '')
const keyword = String(filters.value.keyword || '').trim().toLowerCase()
const status = String(filters.value.status || '')
allRows.value = source.filter((row) => (!keyword || Object.values(row).some((value) => String(value ?? '').toLowerCase().includes(keyword))) && (!status || row.status === status))
total.value = keyword || status ? allRows.value.length : responseTotal
} catch (error) { allRows.value = []; total.value = 0; loadError.value = getApiErrorDetails(error, `${title.value}加载失败,请检查 Finance 接口后重试`) }
finally { loading.value = false }
}
function applyFilters(model: QueryModel) { Object.assign(filters, model); page.value = 1; void load() }
function applyFilters(model: QueryModel) { Object.assign(filters.value, model); page.value = 1; void load() }
function changePageSize() { page.value = 1; void load() }
function openCreate() {
billingOrdersRequest += 1; receiptBillsRequest += 1; costOptionsRequest += 1
@@ -570,7 +570,7 @@ onMounted(() => { void load(); void loadCustomerOptions() })
<el-form-item label="备注"><el-input v-model="form.remark" type="textarea" :rows="3" maxlength="500" placeholder="请输入备注(可选)" /></el-form-item>
</template>
</FormSection>
<FormSection v-if="props.mode !== 'bills'" title="凭证图片" description="先上传真实凭证取得 fileId,再创建人工财务台账。">
<FormSection v-if="props.mode !== 'bills'" title="凭证图片" description="上传真实收付款凭证后再保存财务记录。">
<label class="file-picker" :class="{ 'is-disabled': saving }"><FileUp :size="16" />{{ uploadedVoucher ? `已上传:${uploadedVoucher.fileName}` : file?.name || '选择凭证图片' }}<input type="file" accept="image/*" :disabled="saving" @change="selectFile" /></label>
<p v-if="voucherError" class="voucher-error" role="alert">{{ voucherError }}</p>
<p v-else-if="uploadedVoucher" class="voucher-success">凭证已上传,创建失败时可直接重试。</p>