Files
td_official/src/views/out/outDesignTable/index.vue

144 lines
4.7 KiB
Vue
Raw Normal View History

2025-08-02 19:09:35 +08:00
<template>
<div class="p-2">
2025-08-23 03:30:54 +08:00
<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">
2025-08-26 21:00:46 +08:00
<el-card shadow="never">
<template #header>
<el-row :gutter="10" class="mb8"
><el-form ref="queryFormRef" :model="queryParams" :inline="true">
2025-08-23 03:30:54 +08:00
<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 label="产值类型" prop="valueType">
<el-select v-model="queryParams.valueType" placeholder="请选择产值类型">
<el-option label="设计" value="1" />
<el-option label="采购" value="2" />
</el-select>
</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>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
</template>
2025-08-02 19:09:35 +08:00
2025-08-23 03:30:54 +08:00
<el-table v-loading="loading" :data="valueAllocationList">
<el-table-column label="项目" align="center" prop="projectName" />
<el-table-column label="月预计产值" align="center" prop="monthEstimatedValue" />
<el-table-column label="完成产值月合计" align="center" prop="monthCompletionValue" />
<el-table-column label="产值差额" align="center" prop="valueDifference" />
<el-table-column label="项目总产值" align="center" prop="totalValue" />
<el-table-column label="累计完成产值" align="center" prop="accumulatedCompletionValue" />
<el-table-column label="项目完成率" align="center" prop="projectCompletionRate" />
</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>
2025-08-02 19:09:35 +08:00
</div>
</template>
<script setup name="ValueAllocation" lang="ts">
import { listOutTable } from '@/api/out/outDesignTable';
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);
2025-08-09 18:02:32 +08:00
var { out_value_type } = toRefs<any>(proxy?.useDict('out_value_type'));
2025-08-02 19:09:35 +08:00
const queryFormRef = ref<ElFormInstance>();
const data = reactive({
queryParams: {
pageNum: 1,
pageSize: 10,
2025-08-09 18:02:32 +08:00
valueType: '1',
2025-08-14 01:58:00 +08:00
projectId: currentProject.value?.id,
2025-08-02 19:09:35 +08:00
month: undefined
}
});
2025-08-23 03:30:54 +08:00
const activeTab = ref('1');
2025-08-02 19:09:35 +08:00
const { queryParams } = toRefs(data);
2025-08-23 03:30:54 +08:00
const tabList = [
{
value: '1',
label: '对甲采购设计报表'
},
{
value: '2',
label: '对乙采购设计报表'
}
];
const handleTabChange = (tab) => {
activeTab.value = tab;
data.queryParams.valueType = '1';
2025-08-23 06:28:18 +08:00
// data.queryParams.month = '';
2025-08-23 03:30:54 +08:00
};
2025-08-02 19:09:35 +08:00
/** 查询项目总产值分配列表 */
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 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(
2025-08-14 01:58:00 +08:00
() => currentProject.value?.id,
2025-08-02 19:09:35 +08:00
(nid, oid) => {
queryParams.value.projectId = nid;
getList();
}
);
onUnmounted(() => {
listeningProject();
});
</script>