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

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

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