This commit is contained in:
tcy
2025-08-23 01:41:19 +08:00
18 changed files with 866 additions and 248 deletions

View File

@ -83,7 +83,7 @@
<!-- 添加或修改月度产值计划对话框 -->
<el-dialog draggable :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
<el-form ref="monthPlanFormRef" :model="form" :rules="rules" label-width="80px">
<el-form-item label="计划产值" prop="planValue">
<el-form-item label="类型" prop="planValue">
<el-select v-model="form.type" placeholder="请选择类型">
<el-option label="对甲" value="1" />
<el-option label="对乙" value="2" />

View File

@ -1,7 +1,7 @@
<template>
<div class="p-2">
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
<el-tabs type="border-card" @tab-change="handleTabChange" v-model="activeTab">
<el-tab-pane v-for="(item, index) in tabList" :key="index" :label="item.label" :name="item.value">
<el-card shadow="hover">
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
<el-form-item label="计划月份" prop="month">
@ -13,70 +13,66 @@
</el-form-item>
</el-form>
</el-card>
</div>
</transition>
<el-card shadow="never">
<template #header>
<el-row :gutter="10" class="mb8">
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
</template>
<el-table v-loading="loading" :data="valueAllocationList">
<el-table-column label="项目" align="center" prop="projectName" />
<el-table-column label="项目总产值" align="center" prop="totalValue" />
<el-table-column label="预计产值" align="center" prop="monthlyEstimatedValue" />
<el-table-column label="完成产值(第一周)" align="center" prop="firstWeekCompletionValue" />
<el-table-column label="完成产值(第二周)" align="center" prop="secondWeekCompletionValue" />
<el-table-column label="完成产值(第三周)" align="center" prop="thirdWeekCompletionValue" />
<el-table-column label="完成产值(第四周)" align="center" prop="fourthWeekCompletionValue" />
<el-table-column label="完成产值(第五周)" align="center" prop="fifthWeekCompletionValue" />
<el-table-column label="完成产值月合计" align="center" prop="totalCompletionValue" />
<el-table-column label="产值差额" align="center" prop="valueDifference" />
<el-table-column label="预计累计产值" align="center" prop="estimatedAccumulatedValue" />
<el-table-column label="累计完成产值" align="center" prop="accumulatedCompletionValue" />
<el-table-column label="产值差额" align="center" prop="valueDifferenceAccumulation" />
<el-table-column label="项目完成总进度" align="center" prop="totalCompletionProgress" />
</el-table>
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
</el-card>
<el-card shadow="never">
<el-table v-loading="loading" :data="tableData">
<el-table-column label="项目" align="center" prop="projectName" />
<el-table-column label="项目总产值" align="center" prop="totalValue" />
<el-table-column label="月预计产值" align="center" prop="monthlyEstimatedValue" />
<el-table-column label="完成产值(第一周)" align="center" prop="firstWeekCompletionValue" />
<el-table-column label="完成产值(第二周)" align="center" prop="secondWeekCompletionValue" />
<el-table-column label="完成产值(第三周)" align="center" prop="thirdWeekCompletionValue" />
<el-table-column label="完成产值(第四周)" align="center" prop="fourthWeekCompletionValue" />
<el-table-column label="完成产值(第五周)" align="center" prop="fifthWeekCompletionValue" />
<el-table-column label="完成产值月合计" align="center" prop="totalCompletionValue" />
<el-table-column label="产值差额" align="center" prop="valueDifference" />
<el-table-column label="预计累计产值" align="center" prop="estimatedAccumulatedValue" />
<el-table-column label="累计完成产值" align="center" prop="accumulatedCompletionValue" />
<el-table-column label="产值差额" align="center" prop="valueDifferenceAccumulation" />
<el-table-column label="项目完成总进度" align="center" prop="totalCompletionProgress" />
</el-table>
<pagination
v-show="total > 0"
:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
</el-card>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script setup name="ValueAllocation" lang="ts">
import { listOutTable } from '@/api/out/outTable';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
<script setup lang="ts">
import { useUserStoreHook } from '@/store/modules/user';
import { dayjs } from 'element-plus';
// 获取用户 store
const userStore = useUserStoreHook();
// 从 store 中获取项目列表和当前选中的项目
const currentProject = computed(() => userStore.selectedProject);
const valueAllocationList = ref([]);
const loading = ref(true);
const showSearch = ref(true);
const total = ref(0);
const queryFormRef = ref<ElFormInstance>();
const data = reactive({
queryParams: {
pageNum: 1,
pageSize: 10,
projectId: currentProject.value?.id,
month: undefined
}
const activeTab = ref('1');
const queryParams = ref({
month: '',
pageNum: 1,
pageSize: 10
});
const total = ref(0);
const tableData = ref([]);
const loading = ref(false);
const { queryParams } = toRefs(data);
const tabList = [
{
value: '1',
label: '对甲施工报表'
},
{
value: '2',
label: '对乙施工报表'
}
];
/** 查询项目总产值分配列表 */
const getList = async () => {
loading.value = true;
const res = await listOutTable(queryParams.value);
valueAllocationList.value = res.rows;
total.value = res.total;
loading.value = false;
//切换表单
const handleTabChange = (tab) => {
activeTab.value = tab;
queryParams.value.month = '';
handleQuery();
};
/** 搜索按钮操作 */
@ -87,38 +83,18 @@ const handleQuery = () => {
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value?.resetFields();
queryParams.value.month = '';
handleQuery();
};
/** 导出按钮操作 */
const handleExport = () => {
proxy?.download(
'out/valueAllocation/export',
{
...queryParams.value
},
`valueAllocation_${new Date().getTime()}.xlsx`
);
// 获取列表
const getList = async () => {
const params = {
...queryParams.value,
projectId: currentProject.value?.id,
activeTab: activeTab.value
};
console.log(params);
};
onMounted(() => {
// 也可以使用字符串格式(例如 YYYY-MM
const currentMonthString = ref(dayjs().format('YYYY-MM'));
queryParams.value.month = currentMonthString.value;
getList();
});
//监听项目id刷新数据
const listeningProject = watch(
() => currentProject.value?.id,
(nid, oid) => {
queryParams.value.projectId = nid;
getList();
}
);
onUnmounted(() => {
listeningProject();
});
</script>
<style scoped lang="scss"></style>