Commit 0df7ec6b authored by 高滢's avatar 高滢

feat(月度): 累计支付数精度

parent d5a554ea
......@@ -233,7 +233,7 @@
let formSchema = tabsFormSchema[i].Form[1];
const { updateSchema } = formSchema;
await nextTick(() => {
if (isSubmit == '0') {
if (isSubmit == '0' || tabsFormSchema[i].show == false) {
updateSchema([
{ field: 'projectName', required: false },
{ field: 'fundingSource', required: false },
......
......@@ -378,7 +378,7 @@ const params = ref({ tenderYear: '', biddingQuarter: '', companyName: '' });
width: 180,
},
{
title: '中标金额(元)',
title: '中标金额(元)',
dataIndex: 'winningAmount',
width: 180,
},
......
......@@ -251,7 +251,7 @@
let formSchema = tabsFormSchema[i].Form[1];
const { updateSchema } = formSchema;
await nextTick(() => {
if (isSubmit == '0') {
if (isSubmit == '0' || tabsFormSchema[i].show == false) {
updateSchema([
{ field: 'projectName', required: false },
{ field: 'projectInitiator', required: false },
......
......@@ -174,7 +174,7 @@ export const subFormSchema: FormSchema[] = [
componentProps: ({ formModel }) => ({
addonAfter: '万元',
onChange: (value) => {
formModel.accumulatePayment = (formModel.accumulatePaymentReserve || 0) + value;
formModel.accumulatePayment = numberAdd(formModel.accumulatePaymentReserve || 0, value);
},
}),
colProps: { span: 5, offset: 1 },
......@@ -343,3 +343,19 @@ export const subFormSchema: FormSchema[] = [
colProps: { span: 7, offset: 1 },
},
];
function numberAdd(arg1, arg2) {
let r1, r2, m, n;
try {
r1 = arg1.toString().split('.')[1].length;
} catch (e) {
r1 = 0;
}
try {
r2 = arg2.toString().split('.')[1].length;
} catch (e) {
r2 = 0;
}
m = Math.pow(10, Math.max(r1, r2));
n = r1 >= r2 ? r1 : r2;
return ((arg1 * m + arg2 * m) / m).toFixed(n);
}
import { BasicColumn, FormSchema } from '@/components/Table';
import { h } from 'vue';
import { Switch } from 'ant-design-vue';
import { setRoleStatus } from '@/api/demo/system';
import { useMessage } from '@/hooks/web/useMessage';
import { getDepartmentList } from '@/api/project/settlementManage';
import { useUserStore } from '@/store/modules/user';
import { FormActionType } from '@/components/Form';
const deptId = '' + useUserStore().userInfo.deptParentId;
type CheckedType = boolean | string | number;
const deptId = useUserStore().userInfo.deptParentId;
//主模块-结算管理列表页
export const columns: BasicColumn[] = [
{
......
<template>
<PageWrapper :title="getTitle" :contentBackground="false" headerSticky>
<PageWrapper
v-loading="loadingRef"
loading-tip="加载中..."
:title="getTitle"
:contentBackground="false"
headerSticky
>
<template #extra>
<a-button type="primary" v-if="!disabled" @click="handleSubmit('0')">
暂存
</a-button>
<a-button type="primary" v-if="!disabled" @click="handleSubmit('0')"> 暂存 </a-button>
<a-button type="primary" @click="handleSubmit('1')" v-if="isUpdate">提交 </a-button>
<a-button type="primary" @click="history" v-if="historyData">历史记录 </a-button>
<a-button type="default" @click="router.back()"> 返回 </a-button>
<!-- <a-button type="success" @click="examine" v-if="isUpdate==false && statusResult !='0'"> 审核 </a-button>-->
</template>
<!-- page页 -->
<CollapseContainer v-for="(item, index) in tabsFormSchema" :key="index" v-show="item.show" >
<CollapseContainer v-for="(item, index) in tabsFormSchema" :key="index" v-show="item.show">
<template #title>
<span class="projectName">{{ item.name }}</span>
</template>
<template #action>
<a-button
v-if="!disabled"
type="text"
preIcon="ant-design:delete-outlined"
danger
@click="deleteItem(index)"
>删除项目</a-button>
<!-- @click="deleteItemPro(index)"-->
v-if="!disabled"
type="text"
preIcon="ant-design:delete-outlined"
danger
@click="deleteItem(index)"
>删除项目</a-button
>
</template>
<BasicForm :loading="loading" @register="item.Form[0]" />
<!-- 左上角为项目名 -->
<CollapseContainer
v-for="(content, key) in item.list"
:key="key"
class="subCard"
:title="content.name"
v-show="content.show"
>
<template #title>
<span class="contractName">{{ content.name }}</span>
</template>
<!-- 右上角的删除按钮 -->
<template #action>
<a-button
v-if="!disabled"
type="text"
preIcon="ant-design:delete-outlined"
danger
@click="deleteItemCon(index, key)"
>删除合同</a-button
>
</template>
<BasicForm :loading="loading" @register="content.form" />
</CollapseContainer>
</CollapseContainer>
<a-button type="dashed" @click="add" preIcon="ei:plus" v-if="isUpdate"> 从合同中导入 </a-button>
<a-button type="dashed" @click="handleAdd" class="ml-2" preIcon="ei:plus" v-if="isUpdate">
新建合同
</a-button>
<Upload
:action="uploadAction"
name="file"
:multiple="false"
methods="post"
:file-list="fileList"
accept=".xlsx,.xls"
:on-success="uploadFile"
:onChange="onChangeUpload"
>
<a-button v-if="!disabled" type="dashed" class="ml-2" preIcon="ei:plus"> Excel导入 </a-button>
</Upload>
<contractDrawer @register="registerDrawer" @success="handleSuccess" />
<projectlibraryModel @register="register" @close="handleNewData" />
<Operations @register="registerDrawerOperations" />
<Operations @register="registerDrawerOperations" />
</PageWrapper>
</template>
<script lang="ts" setup>
//历史记录相关
import {operateType,addItemApi,addItemData} from "@/api/operations/operations"
//历史记录
import Operations from "@/components/Operations/Operations.vue"
//标题
import { router } from '@/router';
import { unref, computed, onMounted, ref, reactive , nextTick } from 'vue';
import Operations from '@/components/Operations/Operations.vue';
//标题
import { router } from '@/router';
import { unref,onMounted, ref, reactive, nextTick } from 'vue';
import projectlibraryModel from '@/components/ContractModel/Contract.vue';
import { useRoute } from 'vue-router';
import { PageWrapper } from '@/components/Page';
import PageCard from '@/components/Page/src/PageCard.vue';
import contractDrawer from '@/views/contract/contractDrawer.vue';
import CollapseContainer from '@/components/Container/src/collapse/CollapseContainer.vue';
import { BasicForm, useForm, FormProps, UseFormReturnType } from '@/components/Form';
......@@ -80,12 +64,19 @@ import { router } from '@/router';
import { deepMerge } from '@/utils';
import { useMessage } from '@/hooks/web/useMessage';
import { useDrawer } from '@/components/Drawer';
import { addItems, getItem, updateItem, auditItem } from '@/api/project/settlementManage';
import { addItems, getItem, updateItem} from '@/api/project/settlementManage';
import { EditModel } from '@/api/project/model/settlementManageModel';
import { useModal } from '@/components/Modal';
import { c } from 'vite/dist/node/types.d-aGj9QkWt';
//历史记录是否可查
const historyData= ref(true)
import { Upload } from 'ant-design-vue';
const loadingRef = ref(false);
const fileList = ref([]);
const uploadAction =
import.meta.env.MODE === 'development'
? 'http://localhost:5173/api/pro/settlement/import'
: 'http://172.72.253.84/pro/settlement/import';
//历史记录是否可查
const historyData = ref(true);
const getTitle = ref('');
const [registerDrawer, { openDrawer }] = useDrawer();
......@@ -95,8 +86,7 @@ const historyData= ref(true)
const { createMessage } = useMessage();
const isUpdate = ref(false);
const loading = ref(false);
const formData = ref<EditModel>({ management: [], proClosingQuarter: undefined });
const addItem = ref(false);
const formData = ref<EditModel>({ management: [], proClosingQuarter: {} });
const disabled = ref(false);
//审核状态
const statusResult = ref(null);
......@@ -107,7 +97,6 @@ const historyData= ref(true)
onMounted(async () => {
const route = useRoute();
const id = route.query.id; // 获取名为id的参数
console.log('id111111111', route.query.id);
routeId.value = id;
statusResult.value = route.query.statusResult;
if (!id) {
......@@ -116,7 +105,6 @@ const historyData= ref(true)
console.log(isUpdate.value);
formData.value.management = [];
formData.value.proClosingQuarter = {};
// formData.value.proClosingQuarter.companyName = 'sdfh';
formData.value.proClosingQuarter.status = '0';
formData.value.proClosingQuarter.quarter = route.query.quarter;
formData.value.proClosingQuarter.givenYear = route.query.year;
......@@ -143,16 +131,12 @@ const historyData= ref(true)
}
//根据id查询详情
let res = await getItem({ id });
console.log('000000', res);
console.log('id', id);
//构建数据
formData.value.management = [];
formData.value.proClosingQuarter = [];
for (let i = 0; i < res.length; i++) {
const source = res[i];
const item = {
// name: '序号' + (i + 1),
name: '项目:' + source.projectName,
show: true,
forceRender: true,
......@@ -163,20 +147,12 @@ const historyData= ref(true)
};
const { setFieldsValue } = item.Form[1];
tabsFormSchema.push(item);
formData.value.management.push({
//合同id
id: source.id,
contractId: source.contractId,
projectId: source.projectId,
});
console.log(formData.value.management, 'eeee');
nextTick(() => {
setFieldsValue({
...source,
});
});
}
// console.log(res);
}
});
type TabsFormType = {
......@@ -210,11 +186,8 @@ const historyData= ref(true)
*
*/
async function handleNew(info: any) {
console.log('info', info);
console.log('routeId.value', routeId.value);
const item = {
name: '项目:' + info.projectName,
// name: '序号' + (tabsFormSchema.length + 1),
projectId: info.projectId,
contractId: info.id,
proClosingQuarterId: routeId.value,
......@@ -224,13 +197,6 @@ const historyData= ref(true)
};
const { setFieldsValue } = item.Form[1];
tabsFormSchema.push(item);
formData.value.management.push({
//合同id
contractId: info.id,
//项目id
projectId: info.projectId,
proClosingQuarterId: routeId.value,
});
nextTick(() => {
setFieldsValue({
projectName: info.projectName,
......@@ -242,11 +208,6 @@ const historyData= ref(true)
});
}
function deleteItem(index: any) {
// console.log('formData.value.management[index]',formData.value.management[index])
// deleteId.value.push(formData.value.management[index].contractId)
// formData.value.management.splice(index, 1);
// formData.value.management.splice(index, 1);
// tabsFormSchema.splice(index, 1);
tabsFormSchema[index].show = false;
loading.value = false;
}
......@@ -256,22 +217,6 @@ const historyData= ref(true)
});
}
/*删除项目表单*/
async function deleteItemPro(index: any) {
console.log('1', formData.value);
// formData.value.management.splice(index, 1);
// tabsFormSchema.splice(index, 1);
tabsFormSchema[index].show = false;
loading.value = false;
console.log('2', formData.value);
// }
}
async function deleteItemCon(index: any, key: any) {
formData.value.management[index].conList.splice(key, 1);
tabsFormSchema[index].list.splice(key, 1);
loading.value = false;
// }
}
async function handleSuccess(params: any) {
handleNew(params);
}
......@@ -280,7 +225,7 @@ const historyData= ref(true)
let formSchema = tabsFormSchema[i].Form[1];
const { updateSchema } = formSchema;
await nextTick(() => {
if (isSubmit == '0') {
if (isSubmit == '0' || tabsFormSchema[i].show == false) {
updateSchema([
{ field: 'projectName', required: false },
{ field: 'fundingSource', required: false },
......@@ -337,28 +282,18 @@ const historyData= ref(true)
console.log('item', item);
console.log('item', item.show);
const { validate, getFieldsValue } = item.Form[1];
const data = await validate();
await validate();
let res = getFieldsValue();
// formData.value.management[i] = deepMerge(formData.value.management[i], res);
let obj = {
// proId: item.proId
//合同id
contractId: item.contractId,
//项目id
projectId: item.projectId,
proClosingQuarterId: routeId.value,
};
// if(res.proportionContractAmount == ""){
// // 将proportionContractAmount设置成 null
// res.proportionContractAmount = null;
// }
obj = deepMerge(obj, res);
console.log('obj', obj);
formData.value.management.push(obj);
engineerConListIndex = engineerConListIndex + 1;
}
}
console.log('formData.value.management', formData.value.management);
formData.value.isSubmit = isSubmit;
formData.value.id = routeId.value;
const requestDate = {
......@@ -368,41 +303,48 @@ const historyData= ref(true)
management: unref(formData).management,
};
console.log('requestDate-------------', requestDate);
let res = routeId.value
? await updateItem(unref(requestDate))
: await addItems(unref(formData));
// let res = isUpdate.value ? await updateItem(unref(requestDate)) : await addItems(unref(formData)) ;
routeId.value ? await updateItem(unref(requestDate)) : await addItems(unref(formData));
loading.value = true;
addItemData.operateType = operateType.update;
addItemData.businessId = routeId.value;
addItemData.businessType = '结算管理';
const showDatem = await addItemApi(addItemData);
if (isSubmit === '0') {
createMessage.success('暂存成功!');
} else {
createMessage.success('提交成功!');
}
} catch (e) {
// createMessage.error('e');
createMessage.error('请将项目' + e.values.projectName + '信息填写完整!');
} finally {
loading.value = false;
}
}
//审核
async function examine() {
console.log(routeId.value);
const id = routeId.value;
await auditItem({ id });
statusResult.value = '1';
}
function history() {
openDrawer2(true, {
businessId: routeId.value,
businessType: '结算管理',
});
console.log('历史记录');
function onChangeUpload(info) {
loadingRef.value = true;
}
async function uploadFile(response) {
if (response.code == 1) {
response.data.map((info) => {
const item = {
name: '项目:' + info.projectName,
projectId: null,
contractId: null,
proClosingQuarterId: routeId.value,
show: true,
forceRender: true,
Form: useForm(Object.assign({ schemas: formSchema, disabled }, baseFormConfig) as FormProps),
};
const { setFieldsValue } = item.Form[1];
tabsFormSchema.push(item);
nextTick(() => {
setFieldsValue({ ...info });
});
});
createMessage.success('导入成功');
loadingRef.value = false;
} else {
createMessage.error('导入失败,请稍后重试');
loadingRef.value = false;
return;
}
}
</script>
<style scoped>
......
......@@ -181,7 +181,7 @@
width: 180,
},
{
title: '中标金额(元)',
title: '中标金额(元)',
dataIndex: 'winningAmount',
width: 180,
},
......
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