From 43d00eec5989caa78c44c736853230a13d8e9f6c Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期四, 08 十月 2026 14:51:53 +0800
Subject: [PATCH] 财务管理系统模块优化
---
src/views/financialManagement/financialReconciliation/index.vue | 311 +++++----------------------------------------------
1 files changed, 33 insertions(+), 278 deletions(-)
diff --git a/src/views/financialManagement/financialReconciliation/index.vue b/src/views/financialManagement/financialReconciliation/index.vue
index fa4db0a..87355a1 100644
--- a/src/views/financialManagement/financialReconciliation/index.vue
+++ b/src/views/financialManagement/financialReconciliation/index.vue
@@ -1,291 +1,46 @@
<template>
- <div class="app-container">
- <!-- 鎼滅储鍖� -->
- <div class="search_form">
- <el-form :inline="true" :model="searchForm">
- <el-form-item label="寰�鏉ュ崟浣嶏細">
- <el-input v-model="searchForm.counterparty" placeholder="璇疯緭鍏ュ線鏉ュ崟浣�" clearable style="width: 180px" />
- </el-form-item>
- <el-form-item label="瀵硅处鐘舵�侊細">
- <el-select v-model="searchForm.status" placeholder="璇烽�夋嫨" clearable style="width: 150px">
- <el-option label="鏈璐�" value="pending" />
- <el-option label="瀵硅处涓�" value="processing" />
- <el-option label="宸插畬鎴�" value="done" />
- </el-select>
- </el-form-item>
- <!-- <el-form-item label="鏃ユ湡锛�">
- <el-date-picker
- v-model="searchForm.dateRange"
- type="daterange"
- range-separator="鑷�"
- start-placeholder="寮�濮嬫棩鏈�"
- end-placeholder="缁撴潫鏃ユ湡"
- value-format="YYYY-MM-DD"
- format="YYYY-MM-DD"
- clearable
- />
- </el-form-item> -->
- <el-form-item>
- <el-button type="primary" @click="handleQuery">鎼滅储</el-button>
- <el-button @click="resetQuery">閲嶇疆</el-button>
- </el-form-item>
- </el-form>
- </div>
-
- <!-- 鎿嶄綔鍖� -->
- <div class="actions">
- <el-button type="primary" @click="openDialog('add')">鏂板</el-button>
- <el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button>
- </div>
-
- <!-- 琛ㄦ牸 -->
- <el-table
- :data="tableData"
- border
- v-loading="tableLoading"
- @selection-change="handleSelectionChange"
- style="width: 100%"
- height="calc(100vh - 280px)"
- :row-key="row => row.id"
- >
- <el-table-column type="selection" width="55" align="center" />
- <el-table-column type="index" label="搴忓彿" width="60" align="center" />
- <el-table-column prop="accountDate" label="瀵硅处鏃ユ湡" width="130" show-overflow-tooltip />
- <el-table-column prop="counterparty" label="寰�鏉ュ崟浣�" width="180" show-overflow-tooltip />
- <el-table-column prop="amount" label="瀵硅处閲戦(鍏�)" width="140" show-overflow-tooltip />
- <el-table-column prop="statusText" label="鐘舵��" width="120" show-overflow-tooltip />
- <el-table-column prop="remark" label="澶囨敞" show-overflow-tooltip />
- <el-table-column fixed="right" label="鎿嶄綔" width="150" align="center">
- <template #default="scope">
- <el-button link type="primary" size="small" @click="openDialog('edit', scope.row)">缂栬緫</el-button>
- </template>
- </el-table-column>
- </el-table>
-
- <pagination
- v-show="total > 0"
- :total="total"
- layout="total, sizes, prev, pager, next, jumper"
- :page="page.current"
- :limit="page.size"
- @pagination="paginationChange"
+ <div class="app-container financial-reconciliation-page">
+ <el-alert
+ v-if="runtimeError"
+ title="璐㈠姟瀵硅处椤甸潰鍔犺浇澶辫触"
+ type="error"
+ :description="runtimeError"
+ show-icon
+ :closable="false"
/>
-
- <!-- 寮圭獥 -->
- <el-dialog v-model="dialogVisible" :title="dialogTitle" width="520px" @close="resetForm">
- <el-form :model="form" :rules="rules" ref="formRef" label-width="120px">
- <el-form-item label="瀵硅处鏃ユ湡锛�" prop="accountDate">
- <el-date-picker v-model="form.accountDate" type="date" value-format="YYYY-MM-DD" format="YYYY-MM-DD" style="width: 100%" />
- </el-form-item>
- <el-form-item label="寰�鏉ュ崟浣嶏細" prop="counterparty">
- <el-input v-model="form.counterparty" placeholder="璇疯緭鍏ュ線鏉ュ崟浣�" />
- </el-form-item>
- <el-form-item label="瀵硅处閲戦(鍏�)锛�" prop="amount">
- <el-input-number v-model="form.amount" :min="0" :precision="2" :step="100" style="width: 100%" />
- </el-form-item>
- <el-form-item label="鐘舵�侊細" prop="status">
- <el-select v-model="form.status" placeholder="璇烽�夋嫨" style="width: 100%">
- <el-option label="鏈璐�" value="pending" />
- <el-option label="瀵硅处涓�" value="processing" />
- <el-option label="宸插畬鎴�" value="done" />
- </el-select>
- </el-form-item>
- <el-form-item label="澶囨敞锛�">
- <el-input v-model="form.remark" type="textarea" :rows="3" placeholder="璇疯緭鍏ュ娉�" />
- </el-form-item>
- </el-form>
- <template #footer>
- <div class="dialog-footer">
- <el-button @click="dialogVisible = false">鍙栨秷</el-button>
- <el-button type="primary" @click="submitForm">纭</el-button>
- </div>
- </template>
- </el-dialog>
+ <ReconciliationWorkspace v-else :key="workspaceKey" />
+ <el-button v-if="runtimeError" type="primary" class="retry-button" @click="retry">
+ 閲嶆柊鍔犺浇
+ </el-button>
</div>
</template>
<script setup>
-import { ref, reactive, onMounted } from 'vue'
-import { ElMessage, ElMessageBox } from 'element-plus'
-import pagination from '@/components/PIMTable/Pagination.vue'
-import {
- getReconciliationPage,
- addReconciliation,
- updateReconciliation,
- deleteReconciliation
-} from '@/api/financialManagement/financialReconciliation.js'
+import { nextTick, onErrorCaptured, ref } from "vue";
+import ReconciliationWorkspace from "./ReconciliationWorkspace.vue";
-const tableData = ref([])
-const tableLoading = ref(false)
-const selectedRows = ref([])
-const dialogVisible = ref(false)
-const dialogTitle = ref('鏂板')
-const formRef = ref(null)
+const runtimeError = ref("");
+const workspaceKey = ref(0);
-const page = reactive({
- current: 1,
- size: 100
-})
-const total = ref(0)
+onErrorCaptured((error) => {
+ console.error("璐㈠姟瀵硅处椤甸潰杩愯寮傚父锛�", error);
+ runtimeError.value = error?.stack || error?.message || String(error);
+ return false;
+});
-const searchForm = reactive({
- counterparty: '',
- status: '',
- dateRange: []
-})
-
-const form = reactive({
- id: null,
- accountDate: '',
- counterparty: '',
- amount: null,
- status: '',
- remark: ''
-})
-
-const rules = {
- accountDate: [{ required: true, message: '璇烽�夋嫨瀵硅处鏃ユ湡', trigger: 'change' }],
- counterparty: [{ required: true, message: '璇疯緭鍏ュ線鏉ュ崟浣�', trigger: 'blur' }],
- amount: [{ required: true, message: '璇疯緭鍏ュ璐﹂噾棰�', trigger: 'blur' }],
- status: [{ required: true, message: '璇烽�夋嫨鐘舵��', trigger: 'change' }]
-}
-
-const statusTextMap = {
- pending: '鏈璐�',
- processing: '瀵硅处涓�',
- done: '宸插畬鎴�'
-}
-
-// 鑾峰彇鍒楄〃
-const getList = () => {
- tableLoading.value = true
- const params = {
- ...searchForm,
- current: page.current,
- size: page.size
- }
- if (params.dateRange && params.dateRange.length === 2) {
- params.beginDate = params.dateRange[0]
- params.endDate = params.dateRange[1]
- }
- delete params.dateRange
-
- getReconciliationPage(params)
- .then(res => {
- if (res.code === 200) {
- tableData.value = (res.data?.records || []).map(item => ({
- ...item,
- statusText: statusTextMap[item.status] || item.status
- }))
- total.value = res.data?.total || 0
- }
- })
- .finally(() => {
- tableLoading.value = false
- })
-}
-
-const handleQuery = () => {
- page.current = 1
- getList()
-}
-const resetQuery = () => {
- searchForm.counterparty = ''
- searchForm.status = ''
- searchForm.dateRange = []
- handleQuery()
-}
-const paginationChange = (obj) => {
- page.current = obj.page
- page.size = obj.limit
- getList()
-}
-
-const handleSelectionChange = (rows) => {
- selectedRows.value = rows
-}
-
-const openDialog = (type, row) => {
- dialogTitle.value = type === 'add' ? '鏂板瀵硅处璁板綍' : '缂栬緫瀵硅处璁板綍'
- if (type === 'edit' && row) {
- Object.assign(form, row)
- } else {
- resetForm()
- }
- dialogVisible.value = true
-}
-
-const resetForm = () => {
- Object.assign(form, {
- id: null,
- date: '',
- counterparty: '',
- amount: null,
- status: '',
- remark: ''
- })
-}
-
-const submitForm = () => {
- formRef.value?.validate(valid => {
- if (!valid) return
- const payload = { ...form }
- const request = payload.id ? updateReconciliation(payload) : addReconciliation(payload)
- request
- .then(res => {
- if (res.code === 200) {
- ElMessage.success('鎻愪氦鎴愬姛')
- dialogVisible.value = false
- getList()
- }
- })
- .catch(err => {
- ElMessage.error(err.msg || '鎻愪氦澶辫触')
- })
- })
-}
-
-const handleDelete = () => {
- if (!selectedRows.value.length) {
- ElMessage.warning('璇烽�夋嫨瑕佸垹闄ょ殑璁板綍')
- return
- }
- ElMessageBox.confirm('纭鍒犻櫎閫変腑璁板綍鍚楋紵', '鎻愮ず', {
- confirmButtonText: '纭',
- cancelButtonText: '鍙栨秷',
- type: 'warning'
- }).then(() => {
- const ids = selectedRows.value.map(r => r.id)
- deleteReconciliation(ids).then(res => {
- if (res.code === 200) {
- ElMessage.success('鍒犻櫎鎴愬姛')
- getList()
- selectedRows.value = []
- }
- }).catch(err => {
- ElMessage.error(err.msg || '鍒犻櫎澶辫触')
- })
- }).catch(() => {})
-}
-
-onMounted(() => {
- getList()
-})
+const retry = async () => {
+ runtimeError.value = "";
+ await nextTick();
+ workspaceKey.value += 1;
+};
</script>
-<style scoped lang="scss">
-.app-container {
- padding: 20px;
-
- .search_form {
- background: #fff;
- padding: 16px;
- border-radius: 6px;
- margin-bottom: 16px;
- }
-
- .actions {
- margin-bottom: 12px;
- }
+<style scoped>
+.financial-reconciliation-page {
+ min-height: calc(100vh - 84px);
+ background: #fff;
+}
+.retry-button {
+ margin-top: 16px;
}
</style>
--
Gitblit v1.9.3