Commit fa9f9b69 authored by ccc2wdd's avatar ccc2wdd

结算管理,统计页面有初始年份和季度

parent e173f956
......@@ -8,244 +8,267 @@
</template>
</BasicForm>
<Table
:pagination="false"
:dataSource="dataSource"
:columns="columns"
bordered
:loading="loadingRef"
:rowClassName="setRowClassName"
:scroll="{ x: 1300,y: 350 }"
>
</Table>
:pagination="false"
:dataSource="dataSource"
:columns="columns"
bordered
:loading="loadingRef"
:rowClassName="setRowClassName"
:scroll="{ x: 1300, y: 350 }"
/>
</PageCard>
<StatisticWindow @register="register" />
</div>
</template>
<script lang="ts" setup>
import { onMounted, ref } from 'vue';
import { Table } from 'ant-design-vue';
import { getListAll,exportStatisticList } from '@/api/project/settlementManage';
import {BasicForm, FormActionType, FormSchema, useForm} from '@/components/Form';
import StatisticWindow from '@/views/monthlyPlan/statisticWindow/statisticWindow.vue';
import { useModal } from '@/components/Modal';
import { useRouter } from 'vue-router';
import PageCard from '@/components/Page/src/PageCard.vue';
import { downloadByData } from '@/utils/file/download';
import { useUserStore } from '@/store/modules/user';
import { onMounted, ref } from 'vue';
import { Table } from 'ant-design-vue';
import { getListAll, exportStatisticList } from '@/api/project/settlementManage';
import { BasicForm, FormActionType, FormSchema, useForm } from '@/components/Form';
import StatisticWindow from '@/views/monthlyPlan/statisticWindow/statisticWindow.vue';
import { useModal } from '@/components/Modal';
import { useRouter } from 'vue-router';
import PageCard from '@/components/Page/src/PageCard.vue';
import { downloadByData } from '@/utils/file/download';
import { useUserStore } from '@/store/modules/user';
import moment from 'moment';
const seach = ref([
{
field: 'givenYear',
label: '',
component: 'DatePicker',
componentProps: {
placeholder: '年份',
picker: 'year',
valueFormat: 'YYYY',
format: 'YYYY',
style: {
width: '100%',
const currentMonth = moment().format('MM');
const currentquarter = getQuarter();
function getQuarter() {
if (currentMonth <= 3) {
return '第一季度';
} else if (currentMonth <= 6) {
return '第二季度';
} else if (currentMonth <= 9) {
return '第三季度';
} else {
return '第四季度';
}
}
const params = ref({ givenYear: '', quarter: '', deptId: '' });
const seach = ref([
{
field: 'givenYear',
label: '',
component: 'DatePicker',
componentProps: {
defaultValue: moment().format('YYYY'),
placeholder: '年份',
picker: 'year',
valueFormat: 'YYYY',
format: 'YYYY',
style: {
width: '100%',
},
},
colProps: { span: 4 },
},
colProps: { span: 4 },
},
{
field: 'quarter',
label: '',
component: 'Select',
componentProps: {
placeholder: '季度',
options: [
{
label: '第一季度',
value: '第一季度',
},
{
label: '第二季度',
value: '第二季度',
},
{
label: '第三季度',
value: '第三季度',
},
{
label: '第四季度',
value: '第四季度',
},
],
{
field: 'quarter',
label: '',
component: 'Select',
componentProps: {
placeholder: '季度',
defaultValue: currentquarter,
options: [
{
label: '第一季度',
value: '第一季度',
},
{
label: '第二季度',
value: '第二季度',
},
{
label: '第三季度',
value: '第三季度',
},
{
label: '第四季度',
value: '第四季度',
},
],
},
colProps: { span: 4 },
},
colProps: { span: 4 },
},
])
const deptId = ref('');
onMounted(async () => {
deptId.value = useUserStore().userInfo.deptId;
getStatisticList();
});
]);
const deptId = ref('');
onMounted(async () => {
deptId.value = useUserStore().userInfo.deptId;
// 设置当前年份
params.value.givenYear = moment().format('YYYY');
// 设置当前季度
params.value.quarter = currentquarter;
getStatisticList();
});
// defineOptions({ name: 'MonthlyPlan' });
const [register, { openModal: openModal }] = useModal();
const formElRef = ref<Nullable<FormActionType>>(null);
const [registerForm, { getFieldsValue }] = useForm({
labelWidth: 90,
baseColProps: { span: 24 },
schemas: seach,
showActionButtonGroup: false,
});
// defineOptions({ name: 'MonthlyPlan' });
const [register, { openModal: openModal }] = useModal();
const formElRef = ref<Nullable<FormActionType>>(null);
const [registerForm, { getFieldsValue }] = useForm({
labelWidth: 90,
baseColProps: { span: 24 },
schemas: seach,
showActionButtonGroup: false,
});
async function exportCount() {
const params = getFieldsValue();
const data = await exportStatisticList(params);
downloadByData(data, '结算管理统计报表' + '.xls');
}
const loadingRef = ref(false);
function handleSubmit() {
getStatisticList();
}
function setRowClassName(record) {
if (record.projectName === '总计(万元)') {
return 'rowcolor';
async function exportCount() {
const data = await exportStatisticList(params.value);
downloadByData(data, '结算管理统计报表' + '.xls');
}
if (record.companyName === '合计(万元)'){
return 'rowcolor';
} else {
return;
const loadingRef = ref(false);
function handleSubmit() {
let data = getFieldsValue();
params.value = data;
getStatisticList();
}
}
function getCurrentDateFormatted() {
const now = new Date();
const year = now.getFullYear();
const month = (now.getMonth() + 1).toString().padStart(2, '0'); // 月份从0开始,所以要加1,并且格式化为两位数
return `${year}-${month}`;
}
async function getStatisticList() {
const params = getFieldsValue();
loadingRef.value = true;
let data = await getListAll(params);
// dataSource.value = data;
let propsList = ['companyName','projectName'];
propsList.map((item) => {
changeData(data, item);
});
loadingRef.value = false;
}
function changeData(data, field) {
if (field == 'companyName'){
let count = 0; //重复项的第一项
let indexCount = 1; //下一项
while (indexCount < data.length) {
var item = data.slice(count, count + 1)[0]; //获取没有比较的第一个对象
if (!item[`${field}rowSpan`]) {
item[`${field}rowSpan`] = 1; //初始化为1
}
if (item[field] === data[indexCount][field]) {
//第一个对象与后面的对象相比,有相同项就累加,并且后面相同项设置为0
item[`${field}rowSpan`]++;
data[indexCount][`${field}rowSpan`] = 0;
} else {
count = indexCount;
}
indexCount++;
function setRowClassName(record) {
if (record.projectName === '总计(万元)') {
return 'rowcolor';
}
if (record.companyName === '合计(万元)') {
return 'rowcolor';
} else {
return;
}
}
if (field == 'projectName'){
let count = 0; //重复项的第一项
let indexCount = 1; //下一项
while (indexCount < data.length) {
var item = data.slice(count, count + 1)[0]; //获取没有比较的第一个对象
if (!item[`${field}rowSpan`]) {
item[`${field}rowSpan`] = 1; //初始化为1
}
if (item[field] === data[indexCount][field] && item['companyName'] === data[indexCount]['companyName']) {
//第一个对象与后面的对象相比,有相同项就累加,并且后面相同项设置为0
item[`${field}rowSpan`]++;
data[indexCount][`${field}rowSpan`] = 0;
} else {
count = indexCount;
function getCurrentDateFormatted() {
const now = new Date();
const year = now.getFullYear();
const month = (now.getMonth() + 1).toString().padStart(2, '0'); // 月份从0开始,所以要加1,并且格式化为两位数
return `${year}-${month}`;
}
async function getStatisticList() {
loadingRef.value = true;
let data = await getListAll(params.value);
// dataSource.value = data;
let propsList = ['companyName', 'projectName'];
propsList.map((item) => {
changeData(data, item);
});
loadingRef.value = false;
}
function changeData(data, field) {
if (field == 'companyName') {
let count = 0; //重复项的第一项
let indexCount = 1; //下一项
while (indexCount < data.length) {
var item = data.slice(count, count + 1)[0]; //获取没有比较的第一个对象
if (!item[`${field}rowSpan`]) {
item[`${field}rowSpan`] = 1; //初始化为1
}
if (item[field] === data[indexCount][field]) {
//第一个对象与后面的对象相比,有相同项就累加,并且后面相同项设置为0
item[`${field}rowSpan`]++;
data[indexCount][`${field}rowSpan`] = 0;
} else {
count = indexCount;
}
indexCount++;
}
}
if (field == 'projectName') {
let count = 0; //重复项的第一项
let indexCount = 1; //下一项
while (indexCount < data.length) {
var item = data.slice(count, count + 1)[0]; //获取没有比较的第一个对象
if (!item[`${field}rowSpan`]) {
item[`${field}rowSpan`] = 1; //初始化为1
}
if (
item[field] === data[indexCount][field] &&
item['companyName'] === data[indexCount]['companyName']
) {
//第一个对象与后面的对象相比,有相同项就累加,并且后面相同项设置为0
item[`${field}rowSpan`]++;
data[indexCount][`${field}rowSpan`] = 0;
} else {
count = indexCount;
}
indexCount++;
indexCount++;
}
}
dataSource.value = data;
}
dataSource.value = data;
}
// 列表
const dataSource = ref([]);
// 表头
const columns = [
{
title: '公司名称',
dataIndex: 'companyName',
fixed: 'left',
width: 180,
customCell: (_, any) => ({
rowSpan: _.companyNamerowSpan,
}),
},
{
title: '项目名称',
dataIndex: 'projectName',
width: 180,
},
{
title: '立项投资额(万元)',
dataIndex: 'projectInvestment',
width: 180,
},
{
title: '资金来源',
dataIndex: 'fundingSource',
width: 180,
},
{
title: '招标方式',
dataIndex: 'biddingMethod',
width: 180,
},
{
title: '合同类型',
dataIndex: 'contracYpe',
width: 180,
},
{
title: '合同名称',
dataIndex: 'contractName',
width: 180,
},
{
title: '合同形式',
dataIndex: 'formOfContract',
width: 180,
},
{
title: '合同金额(万元)',
dataIndex: 'contractAmount',
width: 180,
},
{
title: '签证变更金额(万元)',
dataIndex: 'submittedForSettlement',
width: 180,
},
{
title: '结算报送金额(万元)',
dataIndex: 'superContractScale',
width: 180,
},
{
title: '结算审定金额(万元)',
// 列表
const dataSource = ref([]);
// 表头
const columns = [
{
title: '公司名称',
dataIndex: 'companyName',
fixed: 'left',
width: 180,
customCell: (_, any) => ({
rowSpan: _.companyNamerowSpan,
}),
},
{
title: '项目名称',
dataIndex: 'projectName',
width: 180,
},
{
title: '立项投资额(万元)',
dataIndex: 'projectInvestment',
width: 180,
},
{
title: '资金来源',
dataIndex: 'fundingSource',
width: 180,
},
{
title: '招标方式',
dataIndex: 'biddingMethod',
width: 180,
},
{
title: '合同类型',
dataIndex: 'contracYpe',
width: 180,
},
{
title: '合同名称',
dataIndex: 'contractName',
width: 180,
},
{
title: '合同形式',
dataIndex: 'formOfContract',
width: 180,
},
{
title: '合同金额(万元)',
dataIndex: 'contractAmount',
width: 180,
},
{
title: '签证变更金额(万元)',
dataIndex: 'submittedForSettlement',
width: 180,
},
{
title: '结算报送金额(万元)',
dataIndex: 'superContractScale',
width: 180,
},
{
title: '结算审定金额(万元)',
dataIndex: 'sumOfMoney',
width: 180,
},
];
const { push } = useRouter();
width: 180,
},
];
const { push } = useRouter();
</script>
<style lang="less" scoped>
::v-deep .ant-table-tbody .ant-table-row {
&.rowcolor .ant-table-cell-fix-left {
background-color: #f5f5f5;
::v-deep .ant-table-tbody .ant-table-row {
&.rowcolor .ant-table-cell-fix-left {
background-color: #f5f5f5;
}
}
}
</style>
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