Files
td_official/src/views/out/ownerSettlement/index.vue
2025-08-02 19:09:35 +08:00

131 lines
4.3 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!-- 结算产值 VS 业主结算报表z -->
<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-card shadow="hover">
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
<el-form-item label="计划月份" prop="month">
<el-date-picker v-model="queryParams.month" type="month" value-format="YYYY-MM" placeholder="请选择计划月份" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</transition>
<el-card shadow="never">
<template #header>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['out:valueAllocation:export']">导出</el-button>
</el-col>
<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="totalCompletionOutputValue" />
<el-table-column label="分包结算金额" align="center" prop="subTotalSettlementOutputValue" />
<el-table-column label="业主结算金额" align="center" prop="ownerTotalSettlementOutputValue" />
<el-table-column label="业主结算-分包结算" align="center" prop="differenceValue" />
<el-table-column label="操作" align="center">
<template #default="scope">
<el-button type="primary" @click="handleEdit(scope.row)" link icon="Position">联查分包结算</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
</el-card>
</div>
</template>
<script setup name="ValueAllocation" lang="ts">
import { listOutTable } from '@/api/out/ownerSettlement';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
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,
valueType: undefined,
projectId: currentProject.value.id,
month: undefined
}
});
const { queryParams } = toRefs(data);
/** 查询项目总产值分配列表 */
const getList = async () => {
loading.value = true;
const res = await listOutTable(queryParams.value);
valueAllocationList.value = res.rows;
total.value = res.total;
loading.value = false;
};
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
/** 联查分包结算 */
const handleEdit = (row: any) => {
proxy?.$tab.openPage('/out/settlementValueSubcontract');
};
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value?.resetFields();
handleQuery();
};
/** 导出按钮操作 */
const handleExport = () => {
proxy?.download(
'out/valueAllocation/export',
{
...queryParams.value
},
`valueAllocation_${new Date().getTime()}.xlsx`
);
};
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>