“出国申请工作流修改10.29版”
This commit is contained in:
1 parent
f907b9cd40
commit
32b9822146
7 files changed
+593
-169
No files matched your search
@@ -132,7 +132,7 @@
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNum"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
@pagination="applyFilterAndPagination"
|
||||
/>
|
||||
</el-card>
|
||||
</el-card>
|
||||
@@ -344,10 +344,10 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="OverseasApproval">
|
||||
import { ref, reactive, toRefs, onMounted, getCurrentInstance } from 'vue';
|
||||
import { ref, reactive, toRefs, onMounted, getCurrentInstance, computed } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import {
|
||||
listOverseasApplication,
|
||||
listPendingOverseasApplication,
|
||||
getOverseasApplication,
|
||||
approveOverseasApplication,
|
||||
listOverseasAttachments,
|
||||
@@ -372,7 +372,8 @@ const viewAttachmentList = ref<OverseasAttachmentVO[]>([]);
|
||||
const state = reactive({
|
||||
// 列表相关
|
||||
loading: false,
|
||||
applicationList: [] as OverseasApplicationVO[],
|
||||
allApplicationList: [] as OverseasApplicationVO[], // 🔴 新增:存储所有待审批数据
|
||||
applicationList: [] as OverseasApplicationVO[], // 过滤和分页后的数据
|
||||
total: 0,
|
||||
showSearch: true,
|
||||
queryParams: {
|
||||
@@ -428,12 +429,20 @@ onMounted(() => {
|
||||
const getList = async () => {
|
||||
state.loading = true;
|
||||
try {
|
||||
const response = await listOverseasApplication(state.queryParams);
|
||||
state.applicationList = response.rows || [];
|
||||
state.total = response.total || 0;
|
||||
// 🔴 修复:使用待审批接口,只返回当前用户审批级别的待审批数据
|
||||
const response = await listPendingOverseasApplication();
|
||||
|
||||
// 存储所有待审批数据
|
||||
state.allApplicationList = response.data || [];
|
||||
|
||||
// 应用本地过滤和分页
|
||||
applyFilterAndPagination();
|
||||
|
||||
console.log('✅ 成功加载待审批申请列表:', state.allApplicationList.length, '条');
|
||||
} catch (error: any) {
|
||||
console.error('获取申请列表失败:', error);
|
||||
console.error('❌ 获取申请列表失败:', error);
|
||||
ElMessage.error('获取申请列表失败');
|
||||
state.allApplicationList = [];
|
||||
state.applicationList = [];
|
||||
state.total = 0;
|
||||
} finally {
|
||||
@@ -441,10 +450,52 @@ const getList = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
// 应用本地过滤和分页
|
||||
const applyFilterAndPagination = () => {
|
||||
let filteredList = [...state.allApplicationList];
|
||||
|
||||
// 🔴 应用搜索过滤
|
||||
if (state.queryParams.applicantName) {
|
||||
filteredList = filteredList.filter(item =>
|
||||
item.applicantName?.includes(state.queryParams.applicantName || '')
|
||||
);
|
||||
}
|
||||
|
||||
if (state.queryParams.department) {
|
||||
filteredList = filteredList.filter(item =>
|
||||
item.department?.includes(state.queryParams.department || '')
|
||||
);
|
||||
}
|
||||
|
||||
if (state.queryParams.destination) {
|
||||
filteredList = filteredList.filter(item =>
|
||||
item.destination?.includes(state.queryParams.destination || '')
|
||||
);
|
||||
}
|
||||
|
||||
if (state.queryParams.status) {
|
||||
filteredList = filteredList.filter(item =>
|
||||
item.status === state.queryParams.status
|
||||
);
|
||||
}
|
||||
|
||||
// 更新总数
|
||||
state.total = filteredList.length;
|
||||
|
||||
// 🔴 应用分页
|
||||
const { pageNum, pageSize } = state.queryParams;
|
||||
const start = (pageNum - 1) * pageSize;
|
||||
const end = start + pageSize;
|
||||
state.applicationList = filteredList.slice(start, end);
|
||||
|
||||
console.log(`📄 分页结果: 总计 ${state.total} 条,当前显示第 ${pageNum} 页,共 ${state.applicationList.length} 条`);
|
||||
};
|
||||
|
||||
// 搜索查询
|
||||
const handleQuery = () => {
|
||||
state.queryParams.pageNum = 1;
|
||||
getList();
|
||||
// 🔴 修复:本地过滤,无需重新请求数据
|
||||
applyFilterAndPagination();
|
||||
};
|
||||
|
||||
// 重置搜索
|
||||
|
||||
Reference in new issue
Block a user