Commit f5b59f75 authored by jiaxu.yan's avatar jiaxu.yan

feat : 完成计划修改

parent 51d8aaef
......@@ -18,12 +18,13 @@ enum Api {
audit = '/pro/completion/audit',
Itemdelete = '/pro/completion/delProject',
GetPerformanceDetail = '/pro/reportCenter/details/completionSituation',
getProject = '/pro/completion/getProject',
}
export const getListByPage = (params?: ProjectParams) =>
defHttp.post<ProjectModel>({ url: Api.GetList, data: params });
export const getPerformanceList = (params?: ProjectParams) =>
defHttp.post<ProjectModel>({ url: Api.GetPerformanceList, data: params });
defHttp.post<ProjectModel>({ url: Api.GetPerformanceList, data: params });
export const addItem = (params?: any) =>
defHttp.post<ProjectModel>({
......@@ -69,3 +70,6 @@ export const Itemdelete = (params?: any) =>
// 查看投资计划完成情况详情
export const getPerformanceDetail = (params?: any) =>
defHttp.post<ProjectModel>({ url: Api.GetPerformanceDetail, data: params });
export const getProject = (params?: any) =>
defHttp.post<ProjectModel>({ url: Api.getProject, params });
......@@ -689,3 +689,71 @@ export const formSchema2: FormSchema[] = [
colProps: { span: 7, offset: 1 },
},
];
export const modelColumns2: BasicColumn[] = [
{
title: '序号',
dataIndex: 'serialNumber', // 这个dataIndex仅作为标识,不对应实际数据字段
width: 50, // 可以自定义宽度
},
{
title: '项目名称',
dataIndex: 'projectName',
width: 200,
},
{
dataIndex: 'constructionSite',
title: '立项主体',
width: 180,
},
{
dataIndex: 'fundingSource',
title: '资金来源',
width: 180,
},
{
dataIndex: 'constructionScale',
title: '建设规模',
width: 180,
},
{
dataIndex: 'projectOverview',
title: '项目概况',
width: 180,
},
{
dataIndex: 'constructionMode',
title: '建设模式',
width: 180,
},
{
dataIndex: 'implementingEntity',
title: '实施主体',
width: 180,
},
{
dataIndex: 'filingCycle',
title: '填报年度',
width: 180,
},
{
dataIndex: 'totalInvestment',
title: '总投资',
width: 180,
},
{
dataIndex: 'competentDepartment',
title: '项目主管部门',
width: 180,
},
{
dataIndex: 'attribute',
title: '建设性质',
width: 180,
},
{
dataIndex: 'time',
title: '开竣工时间',
width: 180,
},
];
......@@ -11,21 +11,25 @@
<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
@click="deleteItem(index)"
>
</a-button>
</template>
<BasicForm :loading="loading" @register="item.Form[0]" />
</PageCard>
<template v-for="(item, index) in tabsFormSchema">
<PageCard v-if="item.show" :key="index" :title="item.name">
<template #right>
<a-button
v-if="!disabled"
type="text"
preIcon="ant-design:delete-outlined"
danger
@click="deleteItem(index)"
>
</a-button>
</template>
<BasicForm :loading="loading" @register="item.Form[0]" />
</PageCard>
</template>
<a-button v-if="!disabled" type="dashed" @click="add" preIcon="ei:plus">
从计划中添加
</a-button>
<addPlanModel v-if="!disabled" @register="register" @close="handleNewData" />
<!-- <a-button type="dashed" @click="add" preIcon="ei:plus"> 从项目库导入 </a-button>
<a-button type="dashed" @click="handleAdd" class="ml-2" preIcon="ei:plus"> 新建项目 </a-button> -->
<!-- <projectDrawer v-if="!disabled" @register="registerDrawer" @success="handleSuccess" />
......@@ -33,7 +37,10 @@
</PageWrapper>
</template>
<script lang="ts" setup>
import { unref, computed, onMounted, ref, reactive, nextTick } from 'vue';
import addPlanModel from './addPlanModel.vue';
import { useModal } from '@/components/Modal';
const [register, { openModal: openModal }] = useModal();
import { unref, computed, onMounted, ref, reactive, nextTick, provide } from 'vue';
import { PageWrapper } from '@/components/Page';
import PageCard from '@/components/Page/src/PageCard.vue';
import { BasicForm, useForm, FormProps, UseFormReturnType } from '@/components/Form';
......@@ -57,10 +64,11 @@
const formData = ref<editModel>({});
const disabled = ref(false);
const getTitle = ref('');
const route = useRoute();
const id = route.query.id; // 获取名为id的参数
provide('detailId', id);
onMounted(async () => {
loadingRef.value = true;
const route = useRoute();
const id = route.query.id; // 获取名为id的参数
if (!id) {
formData.value.planCompletion = [];
isUpdate.value = false;
......@@ -91,6 +99,7 @@
const item = {
name: '序号' + (i + 1),
forceRender: true,
show: true,
Form: useForm(
Object.assign(
{ schemas: source.planType == '承建' ? formSchema1 : formSchema2, disabled },
......@@ -118,6 +127,7 @@
type TabsFormType = {
name: string;
forceRender?: boolean;
show: boolean;
Form: UseFormReturnType;
};
const baseFormConfig: Partial<FormProps> = {
......@@ -136,6 +146,7 @@
const item = {
name: '序号' + (tabsFormSchema.length + 1),
forceRender: true,
show: true,
Form: useForm(
Object.assign(
{ schemas: info.planType == '承建' ? formSchema1 : formSchema2, disabled },
......@@ -154,40 +165,39 @@
clearValidate();
});
}
async function add() {
openModal();
}
async function deleteItem(index: any) {
loadingRef.value = true;
const id = formData.value.planCompletion[index].id;
if (id) {
await Itemdelete({
id,
});
formData.value.planCompletion.splice(index, 1);
tabsFormSchema.splice(index, 1);
loadingRef.value = false;
} else {
formData.value.planCompletion.splice(index, 1);
tabsFormSchema.splice(index, 1);
loadingRef.value = false;
}
tabsFormSchema[index].show = false;
}
function handleNewData(data: any) {
data.map((res) => {
let item = res;
item.time = item.beginTime + '/' + item.endTime;
handleNew(item);
});
}
async function handleSubmit() {
loadingRef.value = true;
try {
for (let i = 0; i < tabsFormSchema.length; i++) {
let item = tabsFormSchema[i];
const { validate, getFieldsValue } = item.Form[1];
await validate();
let res = getFieldsValue();
formData.value.planCompletion[i] = deepMerge(formData.value.planCompletion[i], res);
formData.value.planCompletion[i].actualOutputValue = Number(
formData.value.planCompletion[i].actualOutputValue,
);
formData.value.planCompletion[i].actualPay = Number(
formData.value.planCompletion[i].actualPay,
);
console.log(formData.value.planCompletion);
if (item.show) {
const { validate, getFieldsValue } = item.Form[1];
await validate();
let res = getFieldsValue();
formData.value.planCompletion[i] = deepMerge(formData.value.planCompletion[i], res);
formData.value.planCompletion[i].actualOutputValue = Number(
formData.value.planCompletion[i].actualOutputValue,
);
formData.value.planCompletion[i].actualPay = Number(
formData.value.planCompletion[i].actualPay,
);
console.log(formData.value.planCompletion);
}
}
formData.value.proNumber = formData.value.planCompletion.Length;
let res = isUpdate.value ? await updateItem(unref(formData)) : await addItem(unref(formData));
......
......@@ -25,6 +25,7 @@
<!-- <button @click="getSelectRowList">获取数据</button>-->
</BasicModal>
</template>
<script lang="ts" setup>
import { getEngineeringList } from '@/api/project/performance';
import { BasicModal, useModalInner } from '@/components/Modal';
......@@ -40,6 +41,7 @@
labelWidth: 120,
schemas: searchModelFormSchema,
},
useSearchForm: true,
showTableSetting: false,
bordered: true,
......
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