Commit 50c111d7 authored by jiaxu.yan's avatar jiaxu.yan

feat: 完成月度

parent 0cf9d504
import { BasicPageParams, BasicFetchResult } from '@/api/model/baseModel';
export type ProjectParams = {
projectName?: string;
};
export type ProjectPageParams = BasicPageParams & ProjectParams;
export interface ProjectListItem {
id: string;
projectName: string;
isReserveProject: string;
constructionSite: string;
constructionMode: string;
projectType: string;
projectOverview: string;
constructionPurpose: string;
delFlag: string;
constructionScale: string;
fundingSource: string;
implementingEntity: string;
logo: string;
createTime: null;
createBy: string;
updateTime: null;
updateBy: string;
}
export interface ProjectModel {
id?: string | number;
constructionMode: string;
isReserveProject: string;
projectType: string;
projectOverview: string;
constructionPurpose: string;
}
export interface ProjectCountModel {
counttotal: number;
countbuildbyoneself: number;
countbuildbyentrust: number;
countbuildbyreplace: number;
countbuildbyhold: number;
countreserve: number;
}
export type ProjectListGetResultModel = BasicFetchResult<ProjectListItem>;
......@@ -33,5 +33,12 @@ export interface ProjectModel {
projectOverview: string;
constructionPurpose: string;
}
export interface ProjectCountModel {
counttotal: number;
countbuildbyoneself: number;
countbuildbyentrust: number;
countbuildbyreplace: number;
countbuildbyhold: number;
countreserve: number;
}
export type ProjectListGetResultModel = BasicFetchResult<ProjectListItem>;
import { ProjectParams, ProjectListGetResultModel, ProjectModel } from './model/projectModel';
import {
ProjectParams,
ProjectListGetResultModel,
ProjectModel,
} from './model/projectModel';
import { defHttp } from '@/utils/http/axios';
enum Api {
GetList = '/pro/monthEngineer/page',
GetMonthlyPlanProjectList = '/pro/fundPlanYear/selectplan',
AddProject = '/pro/monthEngineer/add',
UpdateProject = '/pro/monthEngineer/update',
DeleteProject = '/pro/monthEngineer/delInTable',
ProjectDetail = '/pro/monthEngineer/details',
Itemdelete = '/pro/monthEngineer/delByDetail',
audit = '/pro/monthEngineer/audit',
}
export const getMonthlyPlanList = (params?: ProjectParams) =>
defHttp.post<ProjectModel>({ url: Api.GetList, data: params });
export const getMonthlyPlanProjectList = (params?: ProjectParams) =>
defHttp.post<ProjectModel>({ url: Api.GetMonthlyPlanProjectList, data: params });
export const addItem = (params?: any) =>
defHttp.post<ProjectModel>({
url: Api.AddProject,
data: params,
headers: {
'Content-Type': 'application/json;charset=UTF-8',
},
});
export const updateItem = (params?: any) =>
defHttp.post<ProjectModel>({
url: Api.UpdateProject,
data: params,
headers: {
'Content-Type': 'application/json;charset=UTF-8',
},
});
export const auditItem = (params?: any) =>
defHttp.get<ProjectModel>({
url: Api.audit,
params,
});
export const deleteItem = (params?: any) =>
defHttp.delete<ProjectModel>({ url: Api.DeleteProject, params });
export const Itemdelete = (params?: any) =>
defHttp.delete<ProjectModel>({ url: Api.Itemdelete, params });
export const getItem = (params?: any) => defHttp.get<ProjectModel>({ url: Api.ProjectDetail, params });
......@@ -3,6 +3,7 @@ import {
ProjectListGetResultModel,
ProjectModel,
ProjectListItem,
ProjectCountModel
} from './model/projectModel';
import { defHttp } from '@/utils/http/axios';
......@@ -12,6 +13,7 @@ enum Api {
UpdateProject = '/pro/project/update',
DeleteProject = '/pro/project/del',
ProjectDetail = '/pro/project/details',
ProjectCount = '/pro/project/count',
}
export const getListByPage = (params?: ProjectParams) =>
defHttp.post<ProjectListGetResultModel>({ url: Api.GetList, data: params });
......@@ -27,3 +29,6 @@ export const deleteItem = (params?: any) =>
export const getItem = (params?: any) =>
defHttp.get<ProjectListItem>({ url: Api.ProjectDetail, params });
export const getProjectCount = (params?: any) =>
defHttp.post<ProjectCountModel>({ url: Api.ProjectCount, params });
......@@ -3,7 +3,7 @@
width="70%"
v-bind="$attrs"
@register="register"
title="选择项目导入"
title="选择合同导入"
:minHeight="30"
okText="导入"
@ok="handleSubmit"
......
......@@ -64,6 +64,24 @@
colProps: { span: 11, offset: 1 },
});
}
if (i == 'month') {
schemas.push({
field: 'month',
label: '',
component: 'DatePicker',
required: true,
componentProps: {
placeholder: '月份',
picker: 'month',
valueFormat: 'YYYY-MM',
format: 'YYYY-MM',
style: {
width: '100%',
},
},
colProps: { span: 11, offset: 1 },
});
}
if (i == 'quarter') {
schemas.push({
field: 'quarter',
......
......@@ -42,7 +42,7 @@ const monthlyPlan: {
component: () => import('@/views/monthlyPlan/monthlyPlanEdit/monthlyPlanEdit.vue'),
meta: {
// affix: true,
title: '新建计划(工程)',
title: '月度工程资金计划',
orderNo: 8,
},
},
......
......@@ -2,31 +2,56 @@
<div>
<BasicTable @register="registerTable" :title="'月度工程资金计划'">
<template #toolbar>
<a-button class="btn" type="primary" @click="addMonthlyPlan"> 新建月度工程资金计划 </a-button>
<a-button class="btn" type="primary" @click="addMonthlyPlan">
新建月度工程资金计划
</a-button>
</template>
<template #bodyCell="{ column, text, record, index }">
<!-- 当前列是序号列时,显示序号 -->
<span v-if="column.dataIndex === 'serialNumber'">{{ index + 1 }}</span>
<!-- 其他列正常显示 -->
<span v-else>{{ text }}</span>
<template v-if="column.key === 'action'">
<TableAction
:actions="[
:actions="[
{
label: '详情',
onClick: handleEdit.bind(null, record, 1),
ifShow: (_action) => {
return record.reviewStatus == '1';
},
},
{
icon: 'clarity:note-edit-line',
onClick: handleEdit.bind(null, record),
label: '修改',
onClick: handleEdit.bind(null, record, 0),
ifShow: (_action) => {
return record.reviewStatus == 0;
},
},
{
icon: 'ant-design:delete-outlined',
label: '删除',
color: 'error',
popConfirm: {
title: '是否确认删除',
placement: 'left',
confirm: handleDelete.bind(null, record),
},
ifShow: (_action) => {
return record.reviewStatus == 0;
},
},
{
label: '审核',
color: 'success',
popConfirm: {
title: '是否确认审核',
placement: 'left',
confirm: examine.bind(null, record, true),
},
ifShow: (_action) => {
return record.reviewStatus == 0;
},
},
]"
/>
......@@ -37,82 +62,85 @@
</div>
</template>
<script lang="ts" setup>
import { BasicTable, useTable, TableAction } from '@/components/Table';
import { getMonthlyPlanList } from '@/api/project/monthlyPlan';
import { getListByPage } from '@/api/project/biddingPlan';
import { useDrawer } from '@/components/Drawer';
import { columns, searchFormSchema } from './data';
defineOptions({ name: 'MonthlyPlan' });
import yearModal from '@/components/yearModal.vue';
import { useModal } from '@/components/Modal';
import {router} from "@/router";
const [register, { openModal: openModal }] = useModal();
const [registerTable, { reload }] = useTable({
api: getMonthlyPlanList,
title: '123',
columns,
formConfig: {
labelWidth: 120,
schemas: searchFormSchema,
},
useSearchForm: true,
showTableSetting: false,
bordered: true,
showIndexColumn: false,
actionColumn: {
width: 80,
title: '操作',
dataIndex: 'action',
// slots: { customRender: 'action' },
fixed: undefined,
},
});
function handleEdit(record: Recordable) {
openDrawer(true, {
record,
isUpdate: true,
import { BasicTable, useTable, TableAction } from '@/components/Table';
import { getMonthlyPlanList, deleteItem, auditItem } from '@/api/project/monthlyPlan';
import { useDrawer } from '@/components/Drawer';
import { columns, searchFormSchema } from './data';
defineOptions({ name: 'MonthlyPlan' });
import yearModal from '@/components/yearModal.vue';
import { useModal } from '@/components/Modal';
import { useRouter } from 'vue-router';
const { push } = useRouter();
const [register, { openModal: openModal }] = useModal();
const [registerTable, { reload }] = useTable({
api: getMonthlyPlanList,
title: '123',
columns,
formConfig: {
labelWidth: 120,
schemas: searchFormSchema,
},
useSearchForm: true,
showTableSetting: false,
bordered: true,
showIndexColumn: false,
actionColumn: {
width: 220,
title: '操作',
dataIndex: 'action',
// slots: { customRender: 'action' },
fixed: undefined,
},
});
}
function handleDelete(record: Recordable) {
console.log(record);
}
function handleSuccess() {
reload();
}
const change = (key: string) => {
reload();
};
const addMonthlyPlan = () => {
openModal(true, {
data: ['year'],
});
};
const handleNew = (e) => {
console.log('eeee', e);
router.push({
path: '/monthlyPlan/monthlyPlanEdit',
query: e,
});
};
function handleEdit(record: Recordable, disabled: number) {
push({
path: '/monthlyPlan/monthlyPlanEdit',
query: {
id: record.id,
disabled: String(disabled),
},
});
}
function handleDelete(record: Recordable) {
deleteItem({ id: record.id });
reload();
}
function handleSuccess() {
reload();
}
async function examine(record: Recordable, disabled: boolean) {
const id = record.id;
const res = await auditItem({ id });
console.log(res);
reload();
}
const addMonthlyPlan = () => {
openModal(true, {
data: ['month'],
});
};
const handleNew = (e) => {
push({
path: '/monthlyPlan/monthlyPlanEdit',
query: e,
});
};
</script>
<style scoped>
.btn {
margin-right: 10px;
}
.btn {
margin-right: 10px;
}
</style>
<template>
<PageWrapper :title="getTitle" :contentBackground="false" headerSticky>
<PageWrapper
:title="getTitle"
v-loading="loadingRef"
loading-tip="加载中..."
:contentBackground="false"
headerSticky
>
<template #extra>
<a-button type="primary" v-if="!disabled" danger> 删除 </a-button>
<a-button type="primary" danger> 删除 </a-button>
<a-button type="primary" v-if="!disabled" @click="handleSubmit"> 提交 </a-button>
<a-button type="default" @click="router.back()"> 返回 </a-button>
</template>
<PageCard v-for="(item, index) in tabsFormSchema" :key="index" :title="item.name">
<template #right>
<a-button
v-if="!disabled"
type="text"
preIcon="ant-design:delete-outlined"
danger
v-if="!disabled"
@click="deleteItem(index)"
/>
>
</a-button>
</template>
<BasicForm :loading="loading" @register="item.Form[0]" />
<div style="width: 500px">
<BasicTable
:ref="(el) => setSwipeCellRef(item, index)"
@register="item.table"
:beforeEditSubmit="beforeEditSubmit(item, index)"
/>
</div>
<BasicForm :loading="loading" @register="item.Form[0]"> </BasicForm>
<PageCard
v-for="(content, key) in item.list"
:key="key"
class="subCard"
:title="content.name"
>
<BasicForm :loading="loading" @register="content.form" />
</PageCard>
</PageCard>
<a-button v-if="!disabled" type="dashed" @click="add" preIcon="ei:plus">
从项目库导入
<a-button type="dashed" @click="add" preIcon="ei:plus" v-if="!disabled">
从合同中导入
</a-button>
<a-button v-if="!disabled" type="dashed" @click="handleAdd" class="ml-2" preIcon="ei:plus">
新建项目
<a-button type="dashed" @click="handleAdd" class="ml-2" preIcon="ei:plus" v-if="!disabled">
新建合同
</a-button>
<projectDrawer @register="registerDrawer" @success="handleSuccess" />
<!-- <engineeringprojectModel @register="register" @close="handleNewData" />-->
<contractDrawer @register="registerDrawer" @success="handleSuccess" />
<projectlibraryModel @register="register" @close="handleNewData" />
</PageWrapper>
</template>
<script lang="ts" setup>
import { BasicTable, useTable } from '@/components/Table';
import { getBasicColumns } from './tableData';
import { ref, nextTick, onMounted, unref, computed, reactive } from 'vue';
import { demoListApi } from '@/api/demo/table';
// import engineeringprojectModel from '../engineeringProjectModel/engineeringprojectModel.vue';
import { useRoute } from 'vue-router';
import { unref, computed, onMounted, ref, reactive, nextTick } from 'vue';
import projectlibraryModel from '@/components/ContractModel/Contract.vue';
import { useDrawer } from '@/components/Drawer';
import { PageWrapper } from '@/components/Page';
import PageCard from '@/components/Page/src/PageCard.vue';
import projectDrawer from '@/views/project/projectDrawer.vue';
import contractDrawer from '@/views/contract/contractDrawer.vue';
import { BasicForm, useForm, FormProps, UseFormReturnType } from '@/components/Form';
import { formSchema } from '../monthlyPlanEdit/tableData';
import { formSchema, subFormSchema } from './tableData';
import { deepMerge } from '@/utils';
import { useMessage } from '@/hooks/web/useMessage';
import { useDrawer } from '@/components/Drawer';
// import { addItem, updateItem, getItem } from '@/api/project/biddingPlan';
import { addItem, updateItem, getItem } from '@/api/project/engineeringProject';
// import { editModel } from '@/api/project/model/engineeringprojectModel';
import { addItem, updateItem, getItem, Itemdelete } from '@/api/project/monthlyPlan';
import { editModel } from '@/api/project/model/monthlyPlanModel';
import { useModal } from '@/components/Modal';
const getTitle = ref('');
const engineerId = ref('');
let show = ref<Recordable[]>([]);
// function handleSummary(tableData: Recordable[]) {
// const totalNo = tableData.reduce((prev, next) => {
// prev += next.no;
// return prev;
// }, 0);
// return [
// {
// _row: '合计',
// _index: '平均值',
// no: totalNo,
// },
// {
// _row: '合计',
// _index: '平均值',
// no: totalNo,
// },
// ];
// }
// ref数组
const swipeCellRefList = ref<HTMLElement[]>([]);
// 动态设置ref
function setSwipeCellRef(item, index) {
if (item) {
swipeCellRefList.value[index] = item;
}
}
function beforeEditSubmit(item, index) {
// setSwipeCellRef(item, index);
// console.log('swipeCellRefList', swipeCellRefList.value[index]);
swipeCellRefList.value?.forEach((data: any) => {
// console.log('data.table' + index, data.table);
let { getDataSource } = data.table[1];
const res = getDataSource();
// console.log('res', res);
const totalNo = res.reduce((prev, next) => {
prev += Number(next.amount);
return prev;
}, 0);
// console.log('totalNo', totalNo);
show.value = [
{
year: '合计',
// _row: '合计',
// _index: '合计',
amount: totalNo,
},
];
return true;
});
}
// const [registerTable, { getDataSource, setTableData }] = useTable({
// title: '表尾行合计示例',
// // api: demoListApi,
// // rowSelection: { type: 'checkbox' },
// columns: getBasicColumns(),
// showSummary: true,
// summaryData: show,
// maxHeight: 180,
// maxWidth: 200,
// showIndexColumn: false,
// pagination: false,
// // scroll: { x: 2000 },
// // canResize: false,
// // showSelectionBar: true, // 显示多选状态栏
// });
onMounted(async () => {
show.value = [
{
year: '合计',
// _row: '合计',
// _index: '合计',
amount: '-',
},
];
// setTableData([
// {
// year: '2022',
// no: '',
// },
// {
// year: '2023',
// no: '',
// },
// {
// year: '2024',
// no: '',
// },
// ]);
});
import { router } from '@/router';
import { useRoute } from 'vue-router';
const [registerDrawer, { openDrawer }] = useDrawer();
const loadingRef = ref(false);
const [register, { openModal: openModal }] = useModal();
const { createMessage } = useMessage();
// const getTitle = computed(() =>
// !unref(isUpdate) ? '新增工程项目投资计划(工程)' : '编辑工程项目投资计划(工程)',
// );
getTitle.value = '新增月度工程资金计划';
const isUpdate = ref(false);
const loading = ref(false);
const formData = ref<editModel>({});
const tenderId = ref<any>('');
const disabled = ref(false);
const getTitle = ref('');
onMounted(async () => {
loadingRef.value = true;
const route = useRoute();
const id = route.query.id; // 获取名为id的参数
if (!id) {
formData.value.biddingQuarter = route.query.quarter;
formData.value.tenderYear = route.query.year;
formData.value.investmentPlan = [];
// formData.value.data = [];
formData.value.moth = route.query.month;
formData.value.engineerConList = [];
isUpdate.value = false;
getTitle.value = '创建月度资金计划';
console.log(formData);
} else {
isUpdate.value = true;
tenderId.value = id;
disabled.value = route.query.disabled == '0' ? false : true;
if (disabled.value) {
getTitle.value = '查看月度工程资金计划';
getTitle.value = '查看月度资金计划';
} else {
getTitle.value = '编辑月度工程资金计划';
getTitle.value = '编辑月度资金计划';
}
engineerId.value = id;
isUpdate.value = true;
let res = await getItem({ id });
console.log('getItem', res);
let res = await getItem({ fundId: id });
formData.value.engineerConList = [];
for (let i = 0; i < res.length; i++) {
const source = res[i];
const item = {
name: '序号' + (i + 1),
name: '项目:' + source.projectName,
projectId: source.projectId,
forceRender: true,
Form: useForm(
Object.assign({ schemas: formSchema, disabled }, baseFormConfig) as FormProps,
),
table: useTable({
title: '表尾行合计示例',
// api: demoListApi,
// rowSelection: { type: 'checkbox' },
columns: getBasicColumns(),
showSummary: true,
summaryData: show,
maxHeight: 180,
maxWidth: 200,
showIndexColumn: false,
pagination: false,
// scroll: { x: 2000 },
// canResize: false,
// showSelectionBar: true, // 显示多选状态栏
}),
Form: useForm(Object.assign({ schemas: formSchema }, baseFormConfig) as FormProps),
list: [],
};
const { setFieldsValue } = item.Form[1];
tabsFormSchema.push(item);
const info = res[i];
info.time = [info.beginTime, info.endTime];
const data = {
id: info.id,
investmentId: info.investmentId,
};
formData.value.investmentPlan = [];
formData.value.investmentPlan.push(data);
console.log('info', info);
const { setTableData } = item.table[1];
nextTick(() => {
setTableData(info.planYear);
setFieldsValue(
info,
// projectName: info.projectName,
// constructionSite: info.constructionSite,
// constructionMode: info.constructionMode,
// projectType: info.projectType,
// constructionScale: info.constructionScale,
// projectOverview: info.projectOverview,
// fundingSource: info.fundingSource,
// implementingEntity: info.implementingEntity,
// filingCycle: info.filingCycle,
// competentDepartment: info.competentDepartment,
// matchingFunds: info.matchingFunds,
// specialBondFunds: info.specialBondFunds,
// planFunds: info.planFunds,
// attribute: info.attribute,
// beginTime: info.time[0],
// endTime: info.time[1],
// schedule: info.schedule,
// completionRemarks: info.completionRemarks,
setFormData(item.Form[1], source);
for (let t = 0; t < source.engineerConList.length; t++) {
const content = source.engineerConList[t];
let from = useForm(
Object.assign({ schemas: subFormSchema }, baseFormConfig) as FormProps,
);
item.list.push({
name: '合同:' + content.contrcatName,
form: from,
});
console.log(content);
// console.log(from);
setFormData(from[1], content);
let res = formData.value.engineerConList.filter(
(item) => item.projectId == source.projectId,
);
});
if (res.length) {
let index = formData.value.engineerConList.findIndex(
(item) => item.projectId == source.projectId,
);
formData.value.engineerConList[index].conList.push({
id: content.id,
proId: source.proId,
contractId: content.contractId,
});
} else {
formData.value.engineerConList.push({
proId: source.proId,
conList: [
{
id: content.id,
proId: source.proId,
contractId: content.contractId,
},
],
});
}
console.log(formData.value.engineerConList, 'engineerConList');
}
}
console.log(res);
}
loadingRef.value = false;
});
type TabsFormType = {
name: string;
forceRender?: boolean;
Form: UseFormReturnType;
table: any;
list: UseFormReturnType[];
};
const baseFormConfig: Partial<FormProps> = {
showActionButtonGroup: false,
labelWidth: 100,
labelWidth: 260,
layout: 'vertical',
};
......@@ -264,6 +162,9 @@
async function add() {
openModal();
}
async function handleSuccess(params: any) {
handleNew(params);
}
async function handleNewData(info: any) {
if (info) {
......@@ -276,127 +177,125 @@
*
*/
async function handleNew(info: any) {
const item = {
name: '序号' + (tabsFormSchema.length + 1),
forceRender: true,
Form: useForm(Object.assign({ schemas: formSchema }, baseFormConfig) as FormProps),
table: useTable({
title: '表尾行合计示例',
// api: demoListApi,
// rowSelection: { type: 'checkbox' },
columns: getBasicColumns(),
showSummary: true,
summaryData: show,
maxHeight: 180,
maxWidth: 200,
showIndexColumn: false,
pagination: false,
// scroll: { x: 2000 },
// canResize: false,
// showSelectionBar: true, // 显示多选状态栏
}),
};
const { setTableData } = item.table[1];
// console.log('item.table',setTableData)
let item = {};
let res = tabsFormSchema.filter((item) => item.projectId == info.projectId);
if (res.length) {
item = res[0];
let from = useForm(Object.assign({ schemas: subFormSchema }, baseFormConfig) as FormProps);
item.list.push({
name: '合同:' + info.contrcatName,
form: from,
});
let index = tabsFormSchema.findIndex((item) => item.projectId == info.projectId);
formData.value.engineerConList[index].conList.push({
contractId: info.id,
});
setFormData(from[1], {
contrcatName: info.contrcatName,
collectingUnit: info.collectingUnit,
contractAmount: info.contractAmount,
});
console.log(formData.value.engineerConList);
} else {
item = {
name: '项目:' + info.projectName,
projectId: info.projectId,
forceRender: true,
Form: useForm(Object.assign({ schemas: formSchema }, baseFormConfig) as FormProps),
list: [],
};
item.list.push({
name: '合同:' + info.contrcatName,
form: useForm(Object.assign({ schemas: subFormSchema }, baseFormConfig) as FormProps),
});
tabsFormSchema.push(item);
const { setFieldsValue } = item.Form[1];
tabsFormSchema.push(item);
formData.value.investmentPlan.push({
proId: info.id,
});
nextTick(() => {
setTableData([
{
year: '2022',
amount: '',
},
{
year: '2023',
amount: '',
},
{
year: '2024',
amount: '',
},
]);
setFieldsValue({
formData.value.engineerConList.push({
proId: info.projectId,
conList: [
{
contractId: info.id,
},
],
});
setFormData(item.Form[1], {
projectName: info.projectName,
constructionSite: info.constructionSite,
constructionMode: info.constructionMode,
projectType: info.projectType,
constructionScale: info.constructionScale,
projectOverview: info.projectOverview,
fundingSource: info.fundingSource,
implementingEntity: info.implementingEntity,
// filingCycle: info.filingCycle,
// competentDepartment: info.competentDepartment,
// matchingFunds: info.matchingFunds,
// specialBondFunds: info.specialBondFunds,
// planFunds: info.planFunds,
// attribute: info.attribute,
// beginTime: info.time[0],
// endTime: info.time[1],
// schedule: info.schedule,
// completionRemarks: info.completionRemarks,
});
});
setFormData(item.list[0].form[1], {
contrcatName: info.contrcatName,
collectingUnit: info.collectingUnit,
contractAmount: info.contractAmount,
});
}
}
async function deleteItem(index: any) {
tabsFormSchema.splice(index, 1);
formData.value.investmentPlan.splice(index, 1);
function setFormData(form: any, record: any) {
const { setFieldsValue } = form;
nextTick(() => {
setFieldsValue(record);
});
}
async function handleAdd() {
openDrawer(true, {
isUpdate: false,
});
}
async function handleSuccess(params: any) {
console.log(params);
handleNew(params);
async function deleteItem(index: any) {
loadingRef.value = true;
const id = formData.value.engineerConList[index].id;
if (id) {
await Itemdelete({
id,
});
formData.value.engineerConList.splice(index, 1);
tabsFormSchema.splice(index, 1);
loadingRef.value = false;
} else {
formData.value.engineerConList.splice(index, 1);
tabsFormSchema.splice(index, 1);
loadingRef.value = false;
}
}
async function getFormData(form: any) {
const { validate, getFieldsValue } = form;
await validate();
let res = getFieldsValue();
return res;
}
async function handleSubmit() {
console.log('tabsFormSchema', tabsFormSchema);
loading.value = true;
loadingRef.value = true;
try {
for (let i = 0; i < tabsFormSchema.length; i++) {
let item = tabsFormSchema[i];
const { validate, getFieldsValue } = item.Form[1];
const { getDataSource } = item.table[1];
await validate();
let res = getFieldsValue();
let data = getDataSource();
console.log(' getFieldsValue()', getFieldsValue());
console.log(' getDataSource()', getDataSource());
console.log(' data111', data);
data[0].amount = Number(data[0].amount);
data[1].amount = Number(data[1].amount);
data[2].amount = Number(data[2].amount);
// res.biddingPeriod = res.biddingPeriod.join(',');
// res.plannedPeriod = res.plannedPeriod.join(',');
formData.value.investmentPlan[i] = deepMerge(formData.value.investmentPlan[i], res);
formData.value.investmentPlan[i].planYear = data;
formData.value.investmentPlan[i].beginTime = res.time[0];
formData.value.investmentPlan[i].endTime = res.time[1];
formData.value.planType = '工程';
formData.value.filingCycle = '2024';
formData.value.investmentPlan[i].totalInvestment = Number(
formData.value.investmentPlan[i].totalInvestment,
);
formData.value.id = engineerId.value;
let res = await getFormData(item.Form[1]);
formData.value.engineerConList[i] = deepMerge(formData.value.engineerConList[i], res);
for (let t = 0; t < item.list.length; t++) {
let content = tabsFormSchema[i].list[t];
let contentRes = await getFormData(content.form[1]);
formData.value.engineerConList[i].conList[t] = deepMerge(
formData.value.engineerConList[i].conList[t],
contentRes,
);
}
}
formData.value.proNumber = formData.value.investmentPlan.Length;
console.log(' formData()', unref(formData));
// console.log(' setTableData()', setTableData);
formData.value.proNumber = formData.value.engineerConList.length;
formData.value.fundId = tenderId.value;
let res = isUpdate.value ? await updateItem(unref(formData)) : await addItem(unref(formData));
loading.value = false;
loadingRef.value = true;
console.log(formData.value);
console.log(res);
createMessage.success('提交成功!');
router.back();
} catch (e) {
// 验证失败或出错,切换到对应标签页
console.log(e);
} finally {
loading.value = false;
loadingRef.value = false;
}
}
</script>
<style scoped>
.subCard {
border: 1px solid #e8eaec;
}
</style>
......@@ -21,7 +21,7 @@ export function getBasicColumns(): BasicColumn[] {
},
];
}
export const formSchema: ({ colProps: { offset: number; span: number }; component: string; field: string; componentProps: { readonly: boolean; style: { border: string } }; label: string; required: boolean } | { colProps: { offset: number; span: number }; component: string; field: string; componentProps: { readonly: boolean; style: { border: string } }; label: string; required: boolean } | { colProps: { offset: number; span: number }; component: string; field: string; componentProps: { readonly: boolean; style: { border: string } }; label: string; required: boolean } | { colProps: { offset: number; span: number }; component: string; field: string; componentProps: { readonly: boolean; style: { border: string } }; label: string; required: boolean } | { colProps: { offset: number; span: number }; component: string; field: string; componentProps: { readonly: boolean; style: { border: string } }; label: string; required: boolean } | { colProps: { offset: number; span: number }; component: string; field: string; componentProps: { readonly: boolean; style: { border: string } }; label: string; required: boolean } | { colProps: { offset: number; span: number }; component: string; field: string; componentProps: { readonly: boolean; style: { border: string } }; label: string; required: boolean } | { colProps: { offset: number; span: number }; component: string; field: string; componentProps: { readonly: boolean; style: { border: string } }; label: string; required: boolean } | { colProps: { offset: number; span: number }; component: string; field: string; componentProps: { readonly: boolean; style: { border: string } }; label: string; required: boolean } | { colProps: { offset: number; span: number }; component: string; field: string; componentProps: { valueFormat: string; format: string; style: { width: string }; placeholder: string }; label: string; required: boolean } | { colProps: { offset: number; span: number }; component: string; field: string; componentProps: { addonAfter: string }; label: string; required: boolean } | { colProps: { offset: number; span: number }; component: string; field: string; label: string; required: boolean } | { colProps: { offset: number; span: number }; component: string; field: string; componentProps: { addonAfter: string }; label: string; required: boolean } | { colProps: { offset: number; span: number }; component: string; field: string; componentProps: { addonAfter: string }; label: string; required: boolean } | { colProps: { offset: number; span: number }; component: string; field: string; componentProps: { addonAfter: string }; label: string; required: boolean } | { colProps: { offset: number; span: number }; component: string; field: string; componentProps: { options: ({ label: string; value: string } | { label: string; value: string } | { label: string; value: string })[] }; label: string; required: boolean } | { colProps: { offset: number; span: number }; component: string; field: string; icon: string; componentProps: { style: { width: string }; placeholder: string[] }; label: string; required: boolean } | { colProps: { offset: number; span: number }; component: string; field: string; componentProps: { options: ({ label: string; value: string } | { label: string; value: string } | { label: string; value: string })[] }; label: string; required: boolean })[] = [
export const formSchema: FormSchema[] = [
{
field: 'projectName',
label: '项目名称',
......@@ -34,41 +34,47 @@ export const formSchema: ({ colProps: { offset: number; span: number }; componen
colProps: { span: 7, offset: 1 },
},
{
field: 'constructionSite',
label: '建设地点',
field: 'sourceType',
label: '资金来源类型',
required: true,
component: 'Input',
component: 'Select',
componentProps: {
readonly: true,
style: { border: 'none' },
options: [
{ label: '政府投资项目(不含专项债)', value: '政府投资项目(不含专项债)' },
{ label: '公司投资项目(不含专项债)', value: '公司投资项目(不含专项债)' },
{ label: '专项债项目', value: '专项债项目' },
],
},
colProps: { span: 7, offset: 1 },
},
{
field: 'constructionMode',
label: '建设模式',
field: 'fundGap',
label: '资金缺口',
required: true,
component: 'Input',
componentProps: {
readonly: true,
style: { border: 'none' },
addonAfter: '万元',
},
colProps: { span: 7, offset: 1 },
},
{
field: 'projectType',
label: '项目类型',
field: 'remark',
label: '备注',
required: true,
component: 'Input',
component: 'InputTextArea',
componentProps: {
readonly: true,
style: { border: 'none' },
maxlength: 100,
showCount: true,
},
colProps: { span: 7, offset: 1 },
},
];
export const subFormSchema: FormSchema[] = [
{
field: 'constructionScale',
label: '建设规模',
field: 'contrcatName',
label: '合同名称',
required: true,
component: 'Input',
componentProps: {
......@@ -78,8 +84,8 @@ export const formSchema: ({ colProps: { offset: number; span: number }; componen
colProps: { span: 7, offset: 1 },
},
{
field: 'projectOverview',
label: '项目概况:',
field: 'collectingUnit',
label: '收款单位',
required: true,
component: 'Input',
componentProps: {
......@@ -89,8 +95,8 @@ export const formSchema: ({ colProps: { offset: number; span: number }; componen
colProps: { span: 7, offset: 1 },
},
{
field: 'fundingSource',
label: '资金来源:',
field: 'contractAmount',
label: '合同金额',
required: true,
component: 'Input',
componentProps: {
......@@ -100,44 +106,42 @@ export const formSchema: ({ colProps: { offset: number; span: number }; componen
colProps: { span: 7, offset: 1 },
},
{
field: 'implementingEntity',
label: '实施主体:',
field: 'paymentLevel',
label: '支付等级',
required: true,
component: 'Input',
component: 'Select',
componentProps: {
readonly: true,
style: { border: 'none' },
options: [
{ label: 'A(必须支付)', value: 'A(必须支付)' },
{ label: 'B(可暂缓支付但有维稳风险)', value: 'B(可暂缓支付但有维稳风险)' },
{ label: 'C(随财政拨款支付,无维稳风险)', value: 'C(随财政拨款支付,无维稳风险)' },
],
},
colProps: { span: 7, offset: 1 },
},
{
field: 'projectOverview',
label: '项目概况:',
field: 'completionValueActual',
label: '上月实际完成值',
required: true,
component: 'Input',
componentProps: {
readonly: true,
style: { border: 'none' },
addonAfter: '万元',
},
colProps: { span: 7, offset: 1 },
},
{
field: 'filingCycle',
label: '填报年度:',
field: 'accumulateCompletionValue',
label: '累计完成值',
required: true,
component: 'DatePicker',
component: 'Input',
componentProps: {
placeholder: '选择填报周期',
picker: 'year',
style: { width: '100%' },
valueFormat: 'YYYY',
format: 'YYYY',
addonAfter: '万元',
},
colProps: { span: 7, offset: 1 },
},
{
field: 'totalInvestment',
label: '总投资',
field: 'planCompletionValue',
label: '本月计划完成值',
required: true,
component: 'Input',
componentProps: {
......@@ -146,16 +150,18 @@ export const formSchema: ({ colProps: { offset: number; span: number }; componen
colProps: { span: 7, offset: 1 },
},
{
field: 'competentDepartment',
label: '项目主管部门',
field: 'lastMonthPlan',
label: '上月计划数',
required: true,
component: 'Input',
componentProps: {
addonAfter: '万元',
},
colProps: { span: 7, offset: 1 },
},
{
field: 'matchingFunds',
label: '2024年财政预算匹配资金',
field: 'lastMonthActual',
label: '上月实付数',
required: true,
component: 'Input',
componentProps: {
......@@ -164,8 +170,8 @@ export const formSchema: ({ colProps: { offset: number; span: number }; componen
colProps: { span: 7, offset: 1 },
},
{
field: 'specialBondFunds',
label: '其中专项债项目2024年预计使用专项债资金',
field: 'accumulatePayment',
label: '累计支付数',
required: true,
component: 'Input',
componentProps: {
......@@ -174,8 +180,8 @@ export const formSchema: ({ colProps: { offset: number; span: number }; componen
colProps: { span: 7, offset: 1 },
},
{
field: 'planFunds',
label: '2024年计划资金',
field: 'thisPlanNumber',
label: '本月计划数',
required: true,
component: 'Input',
componentProps: {
......@@ -183,81 +189,45 @@ export const formSchema: ({ colProps: { offset: number; span: number }; componen
},
colProps: { span: 7, offset: 1 },
},
{
field: 'attribute',
label: '建设性质',
field: 'specialFund',
label: '专项债拨款',
required: true,
component: 'Select',
component: 'Input',
componentProps: {
options: [
{ label: '新建', value: '0' },
{ label: '结转', value: '1' },
{ label: '缓建', value: '2' },
],
addonAfter: '万元',
},
colProps: { span: 7, offset: 1 },
},
{
field: 'time',
component: 'RangePicker',
label: '开竣工时间',
field: 'governmentFund',
label: '政府拨款',
required: true,
icon: 'healthicons:i-schedule-school-date-time-outline',
colProps: { span: 7, offset: 1 },
component: 'Input',
componentProps: {
placeholder: ['开始日期', '结束日期'],
style: { width: '100%' },
valueFormat: 'YYYY-MM-DD',
format: 'YYYY-MM-DD',
addonAfter: '万元',
},
colProps: { span: 7, offset: 1 },
},
{
field: 'schedule',
label: '2024年底预计形象进度',
field: 'banFinancing',
label: '银行融资',
required: true,
component: 'Select',
component: 'Input',
componentProps: {
options: [
{ label: 'A(已经立项实施的跨年工程)', value: '0' },
{ label: 'B(该年度必须建设的项目)', value: '1' },
{ label: 'C(该年度必须建设的项目)', value: '2' },
],
addonAfter: '万元',
},
colProps: { span: 7, offset: 1 },
},
{
label: '备注',
field: 'remarks',
field: 'ownFund',
label: '自有资金',
required: true,
component: 'InputTextArea',
component: 'Input',
componentProps: {
maxlength: 100,
showCount: true,
addonAfter: '万元',
},
colProps: { span: 7, offset: 1 },
},
// {
// field: 'isReserveProject',
// label: '是否为储备项目',
// component: 'RadioButtonGroup',
// defaultValue: '0',
// componentProps: {
// options: [
// { label: '是', value: '1' },
// { label: '否', value: '0' },
// ],
// },
// },
// {
// field: 'status',
// label: '状态',
// component: 'RadioButtonGroup',
// defaultValue: '0',
// componentProps: {
// options: [
// { label: '启用', value: '1' },
// { label: '停用', value: '0' },
// ],
// },
// },
];
......@@ -7,28 +7,46 @@
<div class="title">项目总数</div>
<div class="content">
<img :class="`${prefixCls}__top-img`" src="../../assets/images/group.png" />
<span><p>100</p></span>
<span
><p>{{ countData.counttotal }}</p
></span
>
</div>
</Col>
<Col :span="4" :class="`${prefixCls}__top-col`">
<div class="title">自建</div>
<span><p>100</p></span>
<span
><p>{{ countData.countbuildbyoneself }}</p
></span
>
</Col>
<Col :span="4" :class="`${prefixCls}__top-col`">
<div class="title">委托建设</div>
<span><p>100</p></span>
<span
><p>{{ countData.countbuildbyentrust }}</p
></span
>
</Col>
<Col :span="4" :class="`${prefixCls}__top-col`">
<div class="title">代建</div>
<span><p>100</p></span>
<span
><p>{{ countData.countbuildbyreplace }}</p
></span
>
</Col>
<Col :span="4" :class="`${prefixCls}__top-col`">
<div class="title">承建</div>
<span><p>100</p></span>
<span
><p>{{ countData.countbuildbyhold }}</p
></span
>
</Col>
<Col :span="4" :class="`${prefixCls}__top-col`">
<div class="title">储备</div>
<span><p>100</p></span>
<span
><p>{{ countData.countreserve }}</p
></span
>
</Col>
</Row>
</div>
......@@ -78,12 +96,14 @@
<script lang="ts" setup>
import { Tag } from 'ant-design-vue';
import { BasicTable, useTable, TableAction } from '@/components/Table';
import { getListByPage, deleteItem, getItem } from '@/api/project/project';
import { getListByPage, deleteItem, getProjectCount } from '@/api/project/project';
import { columns, searchFormSchema } from './project.data';
import { Row, Col } from 'ant-design-vue';
import projectDrawer from './projectDrawer.vue';
import { useDrawer } from '@/components/Drawer';
import { useRouter } from 'vue-router';
import { onMounted, ref } from 'vue';
const countData = ref({});
const { push } = useRouter();
const [registerDrawer, { openDrawer }] = useDrawer();
const prefixCls = 'list-basic';
......@@ -139,6 +159,11 @@
function handleSuccess() {
reload();
}
onMounted(async () => {
let res = await getProjectCount();
console.log(res);
countData.value = res;
});
</script>
<style lang="less" scoped>
.list-basic {
......
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