Commit 218a7fba authored by 高滢's avatar 高滢

feat(年度投资计划): 添加四种分类

parent 90b486fe
......@@ -12,6 +12,7 @@ VITE_BUILD_COMPRESS = 'gzip'
# Basic interface address SPA
# VITE_GLOB_API_URL = https://dev.unitj.cn
VITE_GLOB_API_URL = ''
# File upload address, optional
# It can be forwarded by nginx or write the actual address directly
......
......@@ -12,8 +12,11 @@ enum Api {
DeleteProject = '/pro/investmentPlan/delete',
selectCount = '/pro/investmentPlan/selectCount',
statisticEngineProject = '/pro/investmentPlan/statisticEngineering',
statisticEngineeringOther = '/pro/investmentPlan/statisticEngineeringOther',
statisticEngineProjectDetails = '/pro/investmentPlan/statisticEngineeringDetails',
statisticEngineeringDetailsOther = '/pro/investmentPlan/statisticEngineeringDetailsOther',
exportStatisticEngine = '/pro/investmentPlan/exportStatisticEngineer',
ExportStatisticEngineerOther = '/pro/investmentPlan/exportStatisticEngineerOther',
}
export const selectCount = (params?: any) =>
......@@ -62,7 +65,16 @@ export const getStatisticEngineProject = (params?: any) =>
url: Api.statisticEngineProject,
params,
});
export const statisticEngineeringOther = (params?: any) =>
defHttp.post<any>({
url: Api.statisticEngineeringOther,
params,
});
export const statisticEngineeringDetailsOther = (params?: any) =>
defHttp.post<any>({
url: Api.statisticEngineeringDetailsOther,
params,
});
export const getStatisticEngineProjectDetails = (params?: any) =>
defHttp.post<any>({
url: Api.statisticEngineProjectDetails,
......@@ -78,3 +90,13 @@ export const exportStatisticEngine = (params?: any) =>
},
{ errorMessageMode: 'none', isTransformResponse: false },
);
export const exportStatisticEngineerOther = (params?: any) =>
defHttp.post<any>(
{
url: Api.ExportStatisticEngineerOther,
data: params,
responseType: 'blob',
},
{ errorMessageMode: 'none', isTransformResponse: false },
);
......@@ -11,7 +11,7 @@
:scroll="{ x: 4000, y: 300 }"
>
<template #index="{ text, record, index }">
{{index+1}}
{{ index + 1 }}
</template>
</Table>
</div>
......@@ -23,13 +23,23 @@
import { ref } from 'vue';
import { Table } from 'ant-design-vue';
import { getDtailsBasicColumns } from '@/views/engineeringProject/statisticEngineering/statisticData';
import { getStatisticEngineProjectDetails } from '@/api/project/engineeringProject';
import {
getStatisticEngineProjectDetails,
statisticEngineeringDetailsOther,
} from '@/api/project/engineeringProject';
const loadingRef = ref(false);
// 列表
const dataSource = ref([]);
const getTitle = ref('');
const params = ref({ companyId: '', projectType: '', filingCycle: '', planType: '' });
const params = ref({
companyId: '',
projectType: '',
filingCycle: '',
planType: '',
groupByField: '',
params: '',
});
const [register, { closeModal }] = useModalInner(async (data) => {
getTitle.value = data.record.company;
......@@ -37,7 +47,13 @@
params.value.projectType = data.record.projectType;
params.value.filingCycle = data.filingCycle;
params.value.planType = data.planType;
dataSource.value = await getStatisticEngineProjectDetails(params.value);
params.value.groupByField = data.groupByField;
params.value.params = data.record.groupByField;
if (data.groupByField === 'company') {
dataSource.value = await getStatisticEngineProjectDetails(params.value);
} else {
dataSource.value = await statisticEngineeringDetailsOther(params.value);
}
// console.log('212', list);
});
</script>
......
......@@ -12,13 +12,23 @@
<BasicForm ref="formElRef" @register="registerForm">
<template #formFooter>
<a-button type="primary" @click="handleSubmit"> 查询</a-button>
<a-button type="primary" @click="exportCount" style="margin-left: 10px"> 导出</a-button>
<a-button type="primary" @click="exportCount" style="margin-left: 10px">{{
'导出' + groupByFieldReturn()
}}</a-button>
</template>
</BasicForm>
<div>
<Tabs v-model:activeKey="groupByField" size="large" @change="clickGroupByFieldTab">
<a-tab-pane key="company" tab="公司" />
<a-tab-pane key="projectType" tab="项目类型" />
<a-tab-pane key="attribute" tab="建设性质" />
<a-tab-pane key="schedule" tab="年底形象进度" />
</Tabs>
</div>
<Table
:pagination="false"
:dataSource="dataSource"
:columns="getBasicColumns(params.filingCycle, params.planType)"
:columns="getBasicColumns(params.filingCycle, params.planType, params.groupByField)"
bordered
:loading="loadingRef"
:rowClassName="setRowClassName"
......@@ -43,12 +53,15 @@
import { getSelectDeptById } from '@/api/project/monthlyPlan';
import {
exportStatisticEngine,
exportStatisticEngineerOther,
getStatisticEngineProject,
statisticEngineeringOther,
} from '@/api/project/engineeringProject';
import EngineeringStatisticWindow from '@/views/engineeringProject/statisticEngineering/engineeringStatisticWindow.vue';
import { useModal } from '@/components/Modal';
import { downloadByData } from '@/utils/file/download';
const groupByField = ref('company');
const planType = ref('自投');
const [register, { openModal: openModal }] = useModal();
onMounted(async () => {
......@@ -64,7 +77,12 @@
});
const dataSource = ref([]);
const loadingRef = ref(false);
const params = ref({ filingCycle: new Date().getFullYear(), planType: '自投', company: '' });
const params = ref({
filingCycle: new Date().getFullYear(),
planType: '自投',
company: '',
groupByField: 'company',
});
const [registerForm, { getFieldsValue, setFieldsValue, updateSchema }] = useForm({
labelWidth: 90,
baseColProps: { span: 24 },
......@@ -72,6 +90,28 @@
showActionButtonGroup: false,
});
const groupByFieldReturn = () => {
if (groupByField.value === 'schedule') {
return '(按年底形象进度分类)';
} else if (groupByField.value === 'attribute') {
return '(按建设性质分类)';
} else if (groupByField.value === 'projectType') {
return '(按项目类型分类)';
} else {
return '(按公司分类)';
}
};
async function clickGroupByFieldTab(value) {
params.value.groupByField = value;
setFieldsValue({
groupByField: value,
}).then(() => {
let data = getFieldsValue();
params.value = data;
getStatisticList();
});
}
async function clickTab(value) {
setFieldsValue({
planType: value,
......@@ -88,21 +128,25 @@
getStatisticList();
}
function setRowClassName(record) {
if (record.projectType === '总计') {
if (record.projectType === '总计' || record.groupByField === '合计'||record.company === '合计') {
return 'rowcolor';
} else {
return;
}
}
async function getStatisticList() {
loadingRef.value = true;
let data = await getStatisticEngineProject(params.value);
// dataSource.value = data;
let propsList = ['company'];
propsList.map((item) => {
changeData(data, item);
});
let data = [];
if (groupByField.value === 'company') {
data = await getStatisticEngineProject(params.value);
let propsList = ['company'];
propsList.map((item) => {
changeData(data, item);
});
} else {
data = await statisticEngineeringOther(params.value);
dataSource.value = data;
}
loadingRef.value = false;
return data;
}
......@@ -130,11 +174,23 @@
record,
filingCycle: params.value.filingCycle,
planType: params.value.planType,
groupByField: groupByField.value,
});
}
async function exportCount() {
const data = await exportStatisticEngine(params.value);
downloadByData(data, '投资计划' + '.xls');
if (groupByField.value === 'company') {
const data = await exportStatisticEngine(params.value);
downloadByData(data, '投资计划按公司分类' + '.xls');
} else {
let fileName =
groupByField.value === 'attribute'
? '按建设性质分类'
: groupByField.value === 'schedule'
? '按年底形象进度分类'
: '按项目类型分类';
const data = await exportStatisticEngineerOther(params.value);
downloadByData(data, '投资计划' + fileName + '.xls');
}
}
</script>
<style scoped lang="less">
......
......@@ -36,6 +36,23 @@ export const searchForm: FormSchema[] = [
},
colProps: { span: 4 },
},
{
field: 'groupByField',
ifShow: false,
label: '',
defaultValue: 'company',
component: 'Select',
componentProps: {
options: [
{ label: 'company', value: 'company' },
{ label: 'schedule', value: 'schedule' },
{ label: 'attribute', value: 'attribute' },
{ label: 'projectType', value: 'projectType' },
],
placeholder: '分类',
},
colProps: { span: 4 },
},
{
field: 'company',
label: '',
......@@ -48,13 +65,21 @@ export const searchForm: FormSchema[] = [
colProps: { span: 4 },
},
];
export function getBasicColumns(year: string, planType: string): BasicColumn[] {
export function getBasicColumns(year: string, planType: string,groupByField:string): BasicColumn[] {
return [
{
title: year + '年' + planType + '工程项目投资计划',
colSpan: 6,
children: [
{
className: groupByField !== 'company' ? 'tableShow' : 'tableHiddle',
title: '类别',
dataIndex: 'groupByField',
width: 300,
fixed: 'left',
},
{
className: groupByField === 'company' ? 'tableShow' : 'tableHiddle',
title: '公司名称',
dataIndex: 'company',
fixed: 'left',
......@@ -64,6 +89,7 @@ export function getBasicColumns(year: string, planType: string): BasicColumn[] {
}),
},
{
className: groupByField === 'company' ? 'tableShow' : 'tableHiddle',
title: '项目类型',
dataIndex: 'projectType',
fixed: 'left',
......
......@@ -18,9 +18,8 @@ export default defineApplicationConfig({
server: {
proxy: {
'/api': {
// target: 'http://172.72.253.25:8088',
target: 'https://dev.unitj.cn',
// target: 'http://58.223.177.48:8088',
// target: 'https://dev.unitj.cn',
target: 'http://172.72.253.84',
changeOrigin: true,
// ws: false,
rewrite: (path) => path.replace(new RegExp(`^/api`), ''),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment