Browse Source

优化流程222

master
zhouhaibin 7 months ago
parent
commit
f7f6a34a48
  1. 7
      src/views/ProcessApprovalSubPage/component/ApprovalPageModel.vue
  2. 141
      src/views/ProcessApprovalSubPage/component/contractDetailTable.vue
  3. 151
      src/views/ProcessApprovalSubPage/contractApproval.vue
  4. 55
      src/views/projectLib/projectContract/index.vue
  5. 2
      src/views/projectLib/projectContract/projectContract.api.ts
  6. 133
      src/views/projectLib/projectContract/projectContract.data.ts
  7. 95
      src/views/projectLib/projectContract/projectContract.vue

7
src/views/ProcessApprovalSubPage/component/ApprovalPageModel.vue

@ -3,8 +3,10 @@
<initiatesProjectsApproval :record="record" @close="exit" v-if="record.stage=='creatProjectinfo'"/>
<uploadfileApproval :record="record" @close="exit" v-if="record.stage=='supervisionFile'"/>
<projectPlanApproval :record="record" @close="exit" v-if="record.stage=='createPlaninfo'"/>
<planFileApproval :record="record" @close="exit" v-if="record.stage=='createPlaninfoFile'||record.stage=='createPlaninfoFile2'"/>
<planFileApproval :record="record" @close="exit" v-if="planfileNames.includes(record.stage)"/>
<fieldChangeApproval :record="record" @close="exit" v-if="record.stage=='fieldChange'"/>
<contractApproval :record="record" @close="exit" v-if="record.stage=='createContract'"/>
</BasicModal>
</template>
<script lang="ts" name="ApprovalPageModel" setup>
@ -16,7 +18,8 @@ import planFileApproval from '@/views/ProcessApprovalSubPage/planFileApproval.vu
import uploadfileApproval from '../uploadfileApproval.vue'
import projectPlanApproval from '../projectPlanApproval.vue'
import fieldChangeApproval from '../fieldChangeApproval.vue'
import contractApproval from '../contractApproval.vue'
const planfileNames = ["feasibilityReportPreparation","jointTechnicalReview","centralizedCheck","createPlaninfoFile"]
const [registerModal, { closeModal }] = useModalInner();
defineProps(["record"])
let emit = defineEmits(["close"])

141
src/views/ProcessApprovalSubPage/component/contractDetailTable.vue

@ -0,0 +1,141 @@
<template>
<!-- 自定义表单 -->
<el-divider content-position="left">项目信息</el-divider>
<BasicForm @register="registerMoneyForm" />
<el-divider content-position="left">合同信息</el-divider>
<BasicForm @register="registerContractForm" />
<el-divider content-position="left">合同文件</el-divider>
<UploadfileDetail :projectid="projectid" :stage="4" />
</template>
<script lang="ts" name="addAndModify" setup>
import { ref, reactive, onMounted } from 'vue'
import { useForm, BasicForm } from '@/components/Form';
import { contractformSchemas, MoneyFormSchemas } from '@/views/projectLib/projectContract/projectContract.data';
import { getContractinfoByProjectId } from '@/views/projectLib/projectContract/projectContract.api';
import { queryProjectInfoById } from '@/views/projectLib/projectInfo/projectInfo.api'
import { FormSchema } from '@/components/Form';
import UploadfileDetail from "@/views/ProcessApprovalSubPage/component/UploadfileDetail.vue"
import { cloneDeep } from 'lodash-es';
import { getTaskNameTypeDict } from "@/views/projectLib/projectContract/projectContract.api"
let data = defineProps(["projectid", "isEdit"])
let fileList = reactive<Array<any>>([]);
let projectid = ref()
let payNum = ref(1)
let resMoney = ref()
let taskNameTypeDict = ref()
let tempSchemas = cloneDeep(contractformSchemas) as Array<FormSchema>
const emit = defineEmits(['close']);
onMounted(async () => {
payNum.value = 1
projectid.value = data.projectid
tempSchemas = cloneDeep(contractformSchemas) as Array<FormSchema>
taskNameTypeDict.value = await getTaskNameTypeDict({ projectid: projectid.value })
console.log("datadatadata", data, tempSchemas)
let parammoney: any = {
projectid: data.projectid
}
resMoney.value = await queryProjectInfoById(parammoney)
setFieldsValueMoneyForm(resMoney.value)
fileList.pop()
let param: any = {
projectid: data.projectid
}
let res = await getContractinfoByProjectId(param) as Array<any>
let obj = new Object()
//
let num = res.length
//
for (let i = 1; i <= num; i++) {
if (i == 1) {
obj = res[i - 1]
} else {
Object.keys(res[i - 1]).forEach(key => {
obj[key + i] = res[i - 1][key]
})
}
}
tempSchemas.forEach(item => {
if (item.field == "taskName") {
item.componentProps.options = taskNameTypeDict.value
}
})
if (num > 1) {
payNum.value = num
for (let i = 2; i <= num; i++) {
contractformSchemas.forEach(item => {
let tempitem = cloneDeep(item)
if (tempitem.field == "payDate") {
tempitem.label = "第" + i + "次支付"
}
if (tempitem.field == "totalMoney") {
tempitem.label = "第" + i + "支付总金额"
}
if (tempitem.field == "taskName") {
tempitem.componentProps.options = taskNameTypeDict.value
}
tempitem.field = tempitem.field + i
tempSchemas.push(tempitem)
})
}
resetSchema(tempSchemas)
}
console.log("结果是", res, obj)
obj["id"] = data.projectid
setFieldsValue(obj)
setProps({ disabled: !data.isEdit })
})
//
const [registerMoneyForm, { setFieldsValue: setFieldsValueMoneyForm }] = useForm({
//
schemas: MoneyFormSchemas,
showActionButtonGroup: false,
//
// autoSubmitOnEnter: true,
// //
// showResetButton: false,
//
// submitButtonOptions: { text: '', preIcon: '' },
// 24 0-24
// actionColOptions: { span: 17 },
disabled: true,
size: "small",
// labelCol: { style: { width: '120px' } },
wrapperCol: { style: { width: 'auto' } },
});
//
const [registerContractForm, { setFieldsValue: setFieldsValue, resetSchema, setProps }] = useForm({
//
schemas: contractformSchemas,
showActionButtonGroup: false,
//
// autoSubmitOnEnter: true,
// //
// showResetButton: false,
//
// submitButtonOptions: { text: '', preIcon: '' },
// 24 0-24
// actionColOptions: { span: 17 },
size: 'small',
disabled: true,
// labelCol: { style: { width: '120px' } },
wrapperCol: { style: { width: 'auto' } },
});
function dialogVisible() {
closeModal()
emit("close")
}
</script>
<style scoped></style>

151
src/views/ProcessApprovalSubPage/contractApproval.vue

@ -0,0 +1,151 @@
<template>
<!-- 自定义表单 -->
<projectContract :projectid="projectId" :isModify="resButton.isEdit" :isEdit="resButton.isEdit" ref="projectContractRef"/>
<el-divider content-position="left">合同文件</el-divider>
<UploadfileDetail :projectid="projectId" :stage="4" />
<ApprovalDetails :processInstanceId="processInstanceId" />
<ApprovalFromPage :showApprovalForm="showApprovalForm" :buttons="resButton.buttons" ref="ApprovalFromPageRef"
@submit="handleSubmit" @exit="exit">
<div>
<el-divider content-position="left" v-if="resButton.isEdit">重新上传合同文件</el-divider>
<div v-if="resButton.isEdit" style="display: flex; justify-content: center; align-items: center; height: 100px;">
<el-upload class="upload-demo" ref="upload" action :http-request="httpRequest" :before-upload="beforeUpload"
:on-exceed="handleExceed" :limit="1" :on-remove="removeFile">
<el-button slot="trigger" size="small" type="primary">选取文件</el-button>
<div slot="tip" class="el-upload__tip">文件大小且不超过5M</div>
</el-upload>
</div>
</div>
</ApprovalFromPage>
</template>
<script lang="ts" name="contractApproval" setup>
import { ref, onMounted, reactive } from 'vue'
import { useModal } from '@/components/Modal';
import { getActionParam } from '../myWork/inComplete/inComplete.api';
import { approvalContractinfo } from '@/views/projectLib/projectContract/projectContract.api'
import { ElMessage } from 'element-plus'
import ApprovalDetails from "../ProcessApprovalSubPage/component/ApprovalDetails.vue";
import ApprovalFromPage from "../ProcessApprovalSubPage/component/ApprovalFromPage.vue"
import projectContract from '@/views/projectLib/projectContract/projectContract.vue';
import UploadfileDetail from "@/views/ProcessApprovalSubPage/component/UploadfileDetail.vue"
let dataTo = defineProps(["record"])
const emit = defineEmits(['close']);
let processInstanceId = dataTo.record.processInstanceId
let projectId = dataTo.record.projectId as string
let taskid = dataTo.record.taskId as string
let showApprovalForm = ref()
let ApprovalFromPageRef = ref()
let projectContractRef= ref()
let resButton = reactive({
showApprovalForm: false,
isEdit: false,
buttons: []
})
let fileList = reactive<Array<any>>([]);
onMounted(async () => {
resButton = await getActionParam({ processInstanceId: processInstanceId, taskId: taskid, procesType: dataTo.record.procesType })
showApprovalForm.value = resButton.showApprovalForm
})
async function handleSubmit() {
let approvalform = await ApprovalFromPageRef.value.getFieldsValueApprovalForm();
// &&await projectContractRef.value.checkForm()
if (await ApprovalFromPageRef.value.validateApprovalForm()) {
let fromdate = await projectContractRef.value.getFieldsValuetoRef()
const params = new FormData()
params.append("flag", approvalform.flag)
params.append("projectid", projectId)
params.append("comment", approvalform.comment)
params.append("taskId", taskid)
params.append("isEdit", resButton.isEdit)
params.append("contractinfoList", JSON.stringify(fromdate))
if (fileList.length > 0) {
params.append("file", fileList[0].file)
}
await approvalContractinfo(params)
console.log("提交成功!", params)
emit("close")
}
}
async function exit() {
emit("close")
}
function removeFile(option) {
for (let i = 0; i < fileList.length; i++) {
if (fileList[i].file.name == option.name) {
fileList.splice(i, 1)
}
}
}
function httpRequest(option) {
fileList.push(option)
}
//
function beforeUpload(file) {
let fileSize = file.size
const FIVE_M = 5 * 1024 * 1024;
const fileSuffix = file.name.substring(file.name.lastIndexOf(".") + 1);
let whiteList = ["xls", "xlsx"];
if (whiteList.indexOf(fileSuffix) === -1) {
ElMessage.error('上传文件只能是xls、xlsx格式');
return false;
}
//5M
if (fileSize > FIVE_M) {
ElMessage.error("最大上传5M")
return false
}
return true
}
//
function handleExceed() {
ElMessage.warning("最多只能上传一个文件")
}
</script>
<style scoped>
.timeline {
display: flex;
width: 100%;
margin-bottom: 100px;
.lineitem {
transform: translateX(50%);
width: 25%;
}
}
:deep(.el-timeline-item__tail) {
border-left: none;
border-top: 2px solid #e4e7ed;
width: 100%;
position: absolute;
top: 9px;
}
:deep(.el-timeline-item__wrapper) {
padding-left: 0;
position: absolute;
top: 20px;
transform: translateX(-50%);
text-align: center;
}
:deep(.el-timeline-item__timestamp) {
font-size: 14px;
}
</style>

55
src/views/projectLib/projectContract/index.vue

@ -11,13 +11,18 @@
新增项目合同</el-button>
</template>
</BasicTable>
<ProjectinfoComponent @register="registerProjectinfo"
@openChildModal="openModalProjectr">
<ProjectinfoComponent @register="registerProjectinfo" @openChildModal="openModalProjectr">
<template #default>
<projectContract @register="registerSubmitprojectContract" @close="closeModel" />
<BasicModal @register="registerSubmitprojectContract" title="项目合同信息详情" width="1200px"
:showOkBtn="false">
<projectContract :projectid="projectid" :isModify="isModify" @close="closeModel" />
</BasicModal>
</template>
</ProjectinfoComponent>
<projectContract @register="registerSubmitprojectContract" @close="closeModel" />
<!-- <projectContract @register="registerSubmitprojectContract" @close="closeModel" /> -->
<BasicModal @register="registerSubmitprojectContract" title="项目合同信息详情" width="1200px" :showOkBtn="false">
<projectContract :projectid="projectid" :isModify="isModify" @close="closeModel" />
</BasicModal>
<DetailTable @register="registerDetailTable" @close="closeModel" />
</PageWrapper>
@ -29,13 +34,14 @@ import { ref } from "vue"
import { ActionItem, BasicTable, TableAction, useTable } from '@/components/Table';
import { useModal } from '@/components/Modal';
import { PageWrapper } from '@/components/Page';
import { BasicModal } from '@/components/Modal';
import projectContract from "./projectContract.vue"
import DetailTable from './DetailTable.vue'
import DetailTable from '@/views/projectLib/projectContract/DetailTable.vue'
import { huzhouContractinfoPageList, deleteContractinfo, getContractProjectPageList } from './projectContract.api';
import { isShowByRoles } from '@/views/projectLib/projectInfo/projectInfo.api';
import { columns, searchFormSchema } from '../projectInfo/projectInfo.data';
import { searchFormSchema } from '../projectInfo/projectInfo.data';
import { contractTablecolumns } from './projectContract.data';
import ProjectinfoComponent from '@/views/ProcessApprovalSubPage/component/ProjectinfoComponent.vue'
const [registerSubmitprojectContract, { openModal: openModalprojectContract, closeModal: closeModalprojectContract }] = useModal();
@ -43,10 +49,11 @@ const [registerProjectinfo, { openModal: openModalProjectinfo, closeModal: close
const [registerDetailTable, { openModal: openModalDetailTable }] = useModal();
let projectid = ref()
let isModify = ref(false)
const [registerTable, { reload }] = useTable({
title: '合同信息',
api: huzhouContractinfoPageList,
columns: columns,
columns: contractTablecolumns,
useSearchForm: true,
rowKey: "id",
showIndexColumn: false,
@ -69,28 +76,28 @@ function getTableAction(record): ActionItem[] {
{
label: '详情',
ifShow: () => {
return isShowByRoles("projectContact") && (record.children == null || record.projectId != null)
return record.children == null || record.projectId != null
},
onClick: handledetail.bind(null, record),
},
{
label: '修改',
ifShow: () => {
return isShowByRoles("projectContact") && (record.children == null || record.projectId != null)
return isShowByRoles("projectContact") && (record.children == null || record.projectId != null) && record.contractStatus == "2"
},
onClick: handleModify.bind(null, record),
},
{
label: '删除',
ifShow: () => {
return isShowByRoles("projectContact") && (record.children == null || record.projectId != null)
},
popConfirm: {
title: '确定删除吗?',
confirm: handleDelete.bind(null, record),
},
}
// {
// label: '',
// ifShow: () => {
// return isShowByRoles("projectContact") && (record.children == null || record.projectId != null)
// },
// popConfirm: {
// title: '?',
// confirm: handleDelete.bind(null, record),
// },
// }
];
}
@ -102,7 +109,9 @@ function handledetail(record) {
*/
function handleModify(record) {
console.log(record, projectid.value)
openModalprojectContract(true, { projectid: record.id, isModify: true })
projectid.value = record.id
isModify.value = true
openModalprojectContract()
}
/**
@ -110,7 +119,9 @@ function handleModify(record) {
*/
function openModalProjectr(value) {
console.log("proidproid", value)
openModalprojectContract(true, { projectid: value.id })
projectid.value = value.id
isModify.value = false
openModalprojectContract()
}
async function handleDelete(record) {
await deleteContractinfo({ projectId: record.id })

2
src/views/projectLib/projectContract/projectContract.api.ts

@ -11,6 +11,7 @@ export enum Api {
getContractProjectPageList="/huzhouContractinfo/getContractProjectPageList",
isExitTaskNameInPlanInfo="/huzhouContractinfo/isExitTaskNameInPlanInfo",
getTaskNameTypeDict="/huzhouPlan/getTaskNameTypeDict",
approvalContractinfo="/huzhouContractinfo/approvalContractinfo",
}
export const huzhouContractinfoPageList = (params) => defHttp.get({ url: Api.huzhouContractinfoPageList, params })
@ -23,6 +24,7 @@ export const isExistContractinfo = (params) => defHttp.get({ url: Api.isExistCon
export const getContractinfoListById = (params) => defHttp.get({ url: Api.getContractinfoListById, params })
export const addContractinfo = (params?) =>defHttp.post({ url: Api.addContractinfo,headers:{ "Content-Type": "multipart/form-data" }, params })
export const approvalContractinfo = (params?) =>defHttp.post({ url: Api.approvalContractinfo,headers:{ "Content-Type": "multipart/form-data" }, params })
export const modifyContractinfo = (params?) =>defHttp.post({ url: Api.modifyContractinfo,headers:{ "Content-Type": "multipart/form-data" }, params })

133
src/views/projectLib/projectContract/projectContract.data.ts

@ -1,10 +1,60 @@
import { FormSchema } from '@/components/Form';
import { BasicColumn } from '@/components/Table';
import { getTaskNameTypeDict } from "./projectContract.api"
import { isExitTaskNameInPlanInfo } from "./projectContract.api"
import { message } from "ant-design-vue"
import dayjs from 'dayjs';
import { currentUser } from '@/api/auth/sysUserPersonal';
export const contractTablecolumns: BasicColumn[] = [
{
title: '项目编号',
width: 150,
dataIndex: 'id',
ifShow: false,
},
{
title: '项目名称',
dataIndex: 'projectName',
width: 300,
resizable: true,
align:'left',
slots: { customRender: 'projectName' },
},
{
title: '行政区划',
dataIndex: 'adminDivision',
resizable: true
},
{
title: '责任单位',
dataIndex: 'dutyWorkplace',
resizable: true
},
{
title: '单位属性',
dataIndex: 'workplaceProperties',
resizable: true
},
{
title: '改革所属项目',
dataIndex: 'reformName',
format: 'dict|reformTasks',
resizable: true
},
{
title: '上级指导处室',
dataIndex: 'superLeader',
format: 'dict|superLeader',
resizable: true
},
{
title: '合同状态',
dataIndex: 'contractStatus',
format: 'dict|taskStatus',
filters: 'dict|taskStatus',
resizable: true
},
];
export const contractShowcolumns: BasicColumn[] = [
{
@ -249,49 +299,44 @@ export const contractformSchemas: FormSchema[] = [
componentProps: {
options: [{label:"首付支付",value:"首付支付"}],
},
// componentProps: ({ formModel, formActionType }) => {
// console.log("formModel111122323:", formModel);
// return {
// api:() => getTaskNameTypeDict({ projectid:formModel.id}),
// };
// },
// dynamicRules: ({ values }) => {
// console.log('values:', values);//表单所有值
// //需要return
// return [
// {
// //默认开启表单检验
// required: true,
// // value 当前手机号输入的值
// validator: (formSchemas, value) => {
// console.log("______", formSchemas, value);
// //需要return 一个Promise对象
// return new Promise((resolve, reject) => {
// isExitTaskNameInPlanInfo({ projectid: values.id, taskName: value }).then
// (res => {
// if (!res) {
// console.log("当前项目的计划中没有这个阶段");
// reject("当前项目的计划中没有这个阶段");
// }
// Object.keys(values).forEach(key => {
// //判断是否taskName字段的名称是否重复
// if (key != formSchemas.field && key.includes("taskName")) {
// if (values[key] == value) {
// reject("属性值重复");
// }
// }
// })
// if (!value) {
// reject(`此项不能未空`);
// } else {
// resolve();
// }
// })
// });
// },
// },
// ];
// },
dynamicRules: ({ values }) => {
console.log('values:', values);//表单所有值
//需要return
return [
{
//默认开启表单检验
required: true,
// value 当前手机号输入的值
validator: (formSchemas, value) => {
console.log("______", formSchemas, value);
//需要return 一个Promise对象
return new Promise((resolve, reject) => {
isExitTaskNameInPlanInfo({ projectid: values.id, taskName: value }).then
(res => {
if (!res) {
console.log("当前项目的计划中没有这个阶段");
reject("当前项目的计划中没有这个阶段");
}
Object.keys(values).forEach(key => {
//判断是否taskName字段的名称是否重复
if (key != formSchemas.field && key.includes("taskName")) {
if (values[key] == value) {
reject("属性值重复");
}
}
})
if (!value) {
reject(`此项不能未空`);
} else {
resolve();
}
})
});
},
},
];
},
required: true,
colProps: { span: 6,},
helpMessage: '需与项目计划的阶段名称所匹配',

95
src/views/projectLib/projectContract/projectContract.vue

@ -1,7 +1,7 @@
<template>
<!-- 自定义表单 -->
<BasicModal v-bind="$attrs" @register="registerModal" title="项目合同信息详情" width="1500px" :showOkBtn="false"
:showCancelBtn="false">
<!-- <BasicModal v-bind="$attrs" @register="registerModal" title="项目合同信息详情" width="1500px" :showOkBtn="false"
:showCancelBtn="false"> -->
<el-divider content-position="left">项目信息</el-divider>
<BasicForm @register="registerMoneyForm" />
<el-divider content-position="left">合同信息</el-divider>
@ -16,6 +16,7 @@
<MinusCircleOutlined />
</template>
</el-button>
<div v-if="isEdit == undefined">
<el-divider content-position="left">上传合同文件</el-divider>
<el-form ref="importFormRef">
@ -32,7 +33,9 @@
<el-button type="info" @click="dialogVisible">关闭窗口</el-button>
</el-form-item>
</el-form>
</BasicModal>
</div>
<!-- </BasicModal> -->
</template>
<script lang="ts" name="addAndModify" setup>
import { ref, reactive, onMounted } from 'vue'
@ -49,7 +52,7 @@ import { cloneDeep } from 'lodash-es';
import { getTaskNameTypeDict } from "./projectContract.api"
const aaa = ({ values }) => {
// console.log('values:', values);//
console.log('values:', values);//
//return
return [
{
@ -112,6 +115,10 @@ const aaa = ({ values }) => {
resolve("1")
})
}
if (value == null) {
let name = contractformSchemas.filter(item => formSchemas.field.indexOf(item.field) != -1)[0].label
reject(name + "不能为空")
}
resolve("1")
});
},
@ -148,9 +155,9 @@ const bbb = ({ schema, formModel, formActionType }) => {
},
};
}
const [registerModal, { closeModal }] = useModalInner(init);
// const [registerModal, { closeModal }] = useModalInner(init);
let data = defineProps(["projectid", "isModify", "isEdit"])
let fileList = reactive<Array<any>>([]);
let isModify = ref()
let projectid = ref()
@ -158,17 +165,20 @@ let payNum = ref(1)
let resMoney = ref()
let taskNameTypeDict = ref()
let tempSchemas = cloneDeep(contractformSchemas) as Array<FormSchema>
tempSchemas.forEach(item => {
if (item.field.indexOf("Money") != -1) {
item.dynamicRules = aaa
item.componentProps = bbb
}
if (item.field == "taskName") {
item.componentProps.options = taskNameTypeDict.value
}
})
// tempSchemas.forEach(item => {
// if (item.field.indexOf("Money") != -1) {
// item.dynamicRules = aaa()
// item.componentProps = bbb
// }
// if (item.field == "taskName") {
// item.componentProps.options = taskNameTypeDict.value
// }
// })
const emit = defineEmits(['close']);
async function init(data) {
// async function init(data) {
// }
onMounted(async () => {
projectid.value = data.projectid
taskNameTypeDict.value = await getTaskNameTypeDict({ projectid: projectid.value })
payNum.value = 1
@ -192,7 +202,7 @@ async function init(data) {
resMoney.value = await queryProjectInfoById(parammoney)
setFieldsValueMoneyForm(resMoney.value)
fileList.pop()
if (data.isModify != null) {
if (data.isModify == true ||(data.isEdit !=null && data.isEdit != undefined)) {
isModify.value = data.isModify
let param: any = {
projectid: data.projectid
@ -219,13 +229,13 @@ async function init(data) {
let tempitem = cloneDeep(item)
if (tempitem.field.indexOf("Money") != -1) {
tempitem.dynamicRules = aaa
item.componentProps = bbb
tempitem.componentProps = bbb
}
if (tempitem.field == "payDate") {
tempitem.label = "第" + i + "次支付"
}
if (item.field == "taskName") {
item.componentProps.options = taskNameTypeDict.value
if (tempitem.field == "taskName") {
tempitem.componentProps.options = taskNameTypeDict.value
}
// if (tempitem.field == "totalMoney") {
@ -247,9 +257,12 @@ async function init(data) {
resetSchema(tempSchemas)
setFieldsValue({ id: data.projectid })
}
//isEdit
if (data.isEdit == false) {
setProps({
disabled: true
})
}
onMounted(async () => {
})
//
@ -274,7 +287,7 @@ const [registerMoneyForm, { setFieldsValue: setFieldsValueMoneyForm }] = useForm
//
const [registerContractForm, { setFieldsValue: setFieldsValue, getFieldsValue, validate, resetSchema, removeSchemaByField }] = useForm({
const [registerContractForm, { setFieldsValue: setFieldsValue, getFieldsValue, validate, resetSchema, removeSchemaByField, setProps }] = useForm({
//
schemas: contractformSchemas,
showActionButtonGroup: false,
@ -292,6 +305,7 @@ const [registerContractForm, { setFieldsValue: setFieldsValue, getFieldsValue, v
});
async function addFrom() {
console.log("addFrom", await getFieldsValue())
let a = await validate()
if (a) {
payNum.value += 1
@ -299,14 +313,14 @@ async function addFrom() {
let tempitem = cloneDeep(item)
if (tempitem.field.indexOf("Money") != -1) {
tempitem.dynamicRules = aaa
item.componentProps = bbb
tempitem.componentProps = bbb
}
if (tempitem.field == "payDate") {
tempitem.label = "第" + payNum.value + "次支付"
}
if (item.field == "taskName") {
item.componentProps.options = taskNameTypeDict.value
if (tempitem.field == "taskName") {
tempitem.componentProps.options = taskNameTypeDict.value
}
// if (tempitem.field == "totalMoney") {
@ -383,11 +397,11 @@ async function submitImportForm() {
// if(checkForm()){
// ElMessage.success("")
// }
if (await validate() && checkForm()) {
// if ( checkForm()) {
const params = new FormData()
console.log("data", data)
// 使form
if (isModify.value != null) {
if (isModify.value == true) {
if (fileList.length > 0) {
params.append("file", fileList[0].file)
}
@ -404,15 +418,15 @@ async function submitImportForm() {
await addContractinfo(params)
}
dialogVisible()
}
// }
}
function dialogVisible() {
closeModal()
emit("close")
}
function checkForm() { //
async function checkForm() { //
await validate()
let data = getFieldsValue()
let totalCentralMoney = 0
let totalCountyMoney = 0
@ -539,6 +553,25 @@ function checkForm() { //校验表单
console.log("data", data)
return true
}
async function getFieldsValuetoRef() {
let res = []
let data = await getFieldsValue()
for (let i = 1; i <= payNum.value; i++) {
let obj = new Object()
contractformSchemas.forEach(item => {
if (i == 1) {
obj[item.field] = data[item.field]
} else {
obj[item.field] = data[item.field + i]
}
obj["projectId"] = projectid.value
delete obj.id;
})
res.push(obj)
}
return res
}
defineExpose({ getFieldsValuetoRef, checkForm })
</script>

Loading…
Cancel
Save