From f7d9075c75b7f888a3e43d58774df3d7941fc35a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=98huanghaiixia=E2=80=99?= <980486410@.com> Date: Wed, 25 Feb 2026 17:34:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=B7=A5=E5=90=88=E5=90=8C=E4=BF=9D?= =?UTF-8?q?=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ContractProc/components/createForm.vue | 250 +++++++++++++----- .../components/createForm.vue | 58 ++-- 2 files changed, 217 insertions(+), 91 deletions(-) diff --git a/src/views/contract/ContractProc/components/createForm.vue b/src/views/contract/ContractProc/components/createForm.vue index 25d87d2..a898a4e 100644 --- a/src/views/contract/ContractProc/components/createForm.vue +++ b/src/views/contract/ContractProc/components/createForm.vue @@ -50,7 +50,12 @@ - + + + + + + @@ -103,44 +108,90 @@ -
- 新增行 - - - - +
+ 新增 + 删除 + + + + + + + + + + + + + {{ item.name }} + + + + + + + + + + + + + + + + + +
+ 新增行 + + + + +
+
@@ -174,7 +225,7 @@ import type { Rule } from 'ant-design-vue/es/form'; import { getDictionary } from '/@/api/sales/Customer'; import { useModal } from '/@/components/Modal'; - import { addLngContract,updateLngContract, getLngContract } from '/@/api/contract/ContractPurPng'; + import { addLngContract,updateLngContract, getLngContract } from '/@/api/contract/ContractProc'; import { getLngAppro,getCompDept } from '/@/api/approve/Appro'; import dayjs from 'dayjs'; import { h } from 'vue'; @@ -195,8 +246,8 @@ const userStore = useUserStore(); const userInfo = userStore.getUserInfo; - const tableName = 'ContractTransPng'; - const columnName = 'ContractTransPng' + const tableName = 'ContractProc'; + const columnName = 'ContractProc' const formType = ref('2'); // 0 新建 1 修改 2 查看 const formRef = ref(); @@ -240,7 +291,7 @@ cpName: [{ required: true, message: "该项为必填项", trigger: 'change' }], uomCode: [{ required: true, message: "该项为必填项", trigger: 'change' }], empName: [{ required: true, message: "该项为必填项", trigger: 'change' }], - bDeptName: [{ required: true, message: "该项为必填项", trigger: 'change' }], + bDeptName: [{ required: false, message: "该项为必填项", trigger: 'change' }], dateTo:[{ required: true, message: "该项为必填项", trigger: 'change' }], dateFrom:[{ required: true, message: "该项为必填项", trigger: 'change' }] }); @@ -248,6 +299,7 @@ labelCol: { span: 8 }, wrapperCol: { span: 16 }, } + const curIdx = ref(null) const dataFile = ref([]); const dataListAppro = ref([]) const dataListContractFact = ref([]) @@ -255,8 +307,13 @@ approCodeList: [], kPeriodList: [], curCodeList: [], + dateToCodeList: [] }); - const dataListPrice = ref([]) + const dataListPrice = ref([ + { + lngPriceProcDtlList: [] + } + ]) const columnsPrice= ref([ { title: t('序号'), dataIndex: 'index', key: 'index', customRender: (column) => `${column.index + 1}` ,width: 80}, { title: t('约定'), dataIndex: 'sortDesc'}, @@ -282,7 +339,10 @@ () => props.disabled, (val) => { isDisable.value = val - + if (val) { + let idx = columnsPrice.value.findIndex(v=>v.dataIndex == 'operation') + idx>-1&&columnsPrice.value.splice(idx, 1) + } }, { immediate: true @@ -299,6 +359,29 @@ } }); + const dateToCodeChange = (idx, val) => { + if (val == 'F') { + dataListPrice.value[idx].dateToY = null + } else { + dataListPrice.value[idx].dateToF = null + } + } + const dateFromNewChange = (val) => { + if (val) { + dataListPrice.value[curIdx.value].dateFrom = dayjs(val).format('YYYY-MM-DD') + dataListPrice.value[curIdx.value].dateToY = null + } + } + const dateToYCheck = (idx) => { + curIdx.value = idx + } + const disabledCurrentYear = (current) => { + let date = new Date().getFullYear() + if (dataListPrice.value[curIdx.value].dateFromNew) { + date = new Date(dataListPrice.value[curIdx.value].dateFromNew,).getFullYear() + } + return current && new Date(current).getFullYear() !== date; + }; const kPeriodChange = (val) => { if (val !== 'Y') { formState.dateFrom = dayjs('2000-01-01') @@ -315,11 +398,16 @@ spinning.value = false Object.assign(formState, {...data}) Object.assign(dataFile.value, formState.lngFileUploadList || []) - Object.assign(dataListContractFact.value, formState.lngContractFactRelList || []) - Object.assign(dataListAppro.value, formState.lngContractApproRelList || []) + Object.assign(dataListContractFact.value, formState.lngContractFactList || []) + Object.assign(dataListAppro.value, formState.lngApproVoList || []) + Object.assign(dataListPrice.value, formState.lngPriceProcList || []) formState.dateFrom = formState.dateFrom ? dayjs(formState.dateFrom) : null formState.dateTo = formState.dateTo ? dayjs(formState.dateTo) : null - + dataListPrice.value.forEach(v =>{ + v.dateFromNew = v.dateFrom ? dayjs(v.dateFrom) : null + v.dateToF = v.dateToF ? dayjs(v.dateToF) : null + v.dateToY = v.dateToY ? dayjs(v.dateToY) : null + }) dataListAppro.value.forEach(v => { // v.approId = v.id }) @@ -331,18 +419,22 @@ async function getOption() { optionSelect.kPeriodList = await getDictionary('LNG_K_PER') optionSelect.approCodeList = await getDictionary('LNG_APPRO') + optionSelect.dateToCodeList = await getDictionary('LNG_D_TO') optionSelect.curCodeList = await getAllCurrency() if (!pageId.value) { - const res = await getCompDept(userInfo.id) - formState.bDeptName = res?.dept?.name - formState.bDeptId = res?.dept?.id - - formState.comName = res?.comp?.name - formState.comId = res?.comp?.id + getCompDeptInfo(userInfo.id) } } + const getCompDeptInfo = async (id)=> { + const res = await getCompDept(id) + formState.bDeptName = res?.dept?.name + formState.bDeptId = res?.dept?.id + + formState.comName = res?.comp?.name + formState.comId = res?.comp?.id + } const getApproList = (val) => { dataListAppro.value = val @@ -397,17 +489,26 @@ openModalDownLoad(true,{isUpdate: false, type: val}) } - const handleAdd = ()=> { - dataListPrice.value.push({sortDesc: '',rateTonGj:'',qtyGj:'',pricePngGj:'',priceLngGj:''}) + const addProc = () => { + dataListPrice.value.push({ + lngPriceProcDtlList:[] + }) } - const handleDelete= (index) => { + const deleteProc= (index) => { dataListPrice.value.splice(index, 1) } + const handleAdd = (idx)=> { + dataListPrice.value[idx].lngPriceProcDtlList.push({sortDesc: '',rateTonGj:'',qtyGj:'',pricePngGj:'',priceLngGj:'',sort:dataListPrice.value[idx].lngPriceProcDtlList.length+1}) + } + const handleDelete= (idx,index) => { + dataListPrice.value[idx].lngPriceProcDtlList.splice(index, 1) + } const handleSuccess = (val) => { formState.empName = val[0].name formState.empId = val[0].id formState.tel = val[0].mobile + getCompDeptInfo(formState.empId) } const handleSuccessDept = (val, info) => { formState.bDeptName = val[0].name @@ -463,13 +564,33 @@ async function handleSubmit(type) { try { await formRef.value.validateFields(); - let arr = dataListPrice.value - for(let i=0; i diff --git a/src/views/contract/ContractTransPng/components/createForm.vue b/src/views/contract/ContractTransPng/components/createForm.vue index 11bfe05..3f77b1c 100644 --- a/src/views/contract/ContractTransPng/components/createForm.vue +++ b/src/views/contract/ContractTransPng/components/createForm.vue @@ -68,7 +68,7 @@ - + @@ -76,6 +76,11 @@ + + + + + @@ -156,7 +161,6 @@
- @@ -175,7 +179,7 @@ import type { Rule } from 'ant-design-vue/es/form'; import { getDictionary } from '/@/api/sales/Customer'; import { useModal } from '/@/components/Modal'; - import { addLngContract,updateLngContract, getLngContract } from '/@/api/contract/ContractPurPng'; + import { addLngContract,updateLngContract, getLngContract } from '/@/api/contract/ContractTransPng'; import { getLngAppro,getCompDept } from '/@/api/approve/Appro'; import dayjs from 'dayjs'; import { h } from 'vue'; @@ -225,14 +229,12 @@ const { t } = useI18n(); const formState = reactive({ approCode: 'WTJ', - typeCode: 'PP', + typeCode: 'TP', onlineSign: 'N', cpTableName: 'lng_supplier', curCode: 'CNY', - lngContractPurPngList: [{}], }); const [register, { openModal:openModal}] = useModal(); - const [registerDept, { openModal:openModalDept}] = useModal(); const [registerContractFact, { openModal:openModalContractFact}] = useModal(); const [registerDownLoad, { openModal:openModalDownLoad}] = useModal(); const [registerSupplier, { openModal:openModalSupplier}] = useModal(); @@ -290,6 +292,12 @@ () => props.disabled, (val) => { isDisable.value = val + if (val) { + let idx = columnsPoint.value.findIndex(v=>v.dataIndex == 'operation') + idx>-1&&columnsPoint.value.splice(idx, 1) + let idx1 = columnsPrice.value.findIndex(v=>v.dataIndex == 'operation') + idx1>-1&&columnsPrice.value.splice(idx1, 1) + } }, { @@ -323,15 +331,13 @@ spinning.value = false Object.assign(formState, {...data}) Object.assign(dataFile.value, formState.lngFileUploadList || []) - Object.assign(dataListContractFact.value, formState.lngContractFactRelList || []) - Object.assign(dataListAppro.value, formState.lngContractApproRelList || []) - formState.dateCfmFrom = formState.dateCfmFrom ? dayjs(formState.dateCfmFrom) : null - formState.dateCfmTo = formState.dateCfmTo ? dayjs(formState.dateCfmTo) : null + Object.assign(dataListContractFact.value, formState.lngContractFactList || []) + Object.assign(dataListAppro.value, formState.lngApproVoList || []) + Object.assign(dataListPoint.value, formState.lngContractTransPngList || []) + Object.assign(dataListPrice.value, formState.lngPriceTransPngDtlList || []) formState.dateSign = formState.dateSign ? dayjs(formState.dateSign) : null formState.dateFrom = formState.dateFrom ? dayjs(formState.dateFrom) : null formState.dateTo = formState.dateTo ? dayjs(formState.dateTo) : null - formState.periodTypeCode = (formState?.lngContractPurPngList[0] || {}).periodTypeCode - formState.uomCode = (formState?.lngContractPurPngList[0] || {}).uomCode dataListAppro.value.forEach(v => { // v.approId = v.id @@ -347,16 +353,18 @@ optionSelect.curCodeList = await getAllCurrency() if (!pageId.value) { - const res = await getCompDept(userInfo.id) - formState.bDeptName = res?.dept?.name - formState.bDeptId = res?.dept?.id - - formState.comName = res?.comp?.name - formState.comId = res?.comp?.id + getCompDeptInfo(userInfo.id) } } + const getCompDeptInfo = async (id)=> { + const res = await getCompDept(id) + formState.bDeptName = res?.dept?.name + formState.bDeptId = res?.dept?.id + formState.comName = res?.comp?.name + formState.comId = res?.comp?.id + } const getApproList = (val) => { dataListAppro.value = val } @@ -394,9 +402,6 @@ return endValue.valueOf() <= startValue.valueOf(); } - const onSearch = (val)=> { - openModalDept(true,{isUpdate: false}) - } const onSearchSupplier = () => { openModalSupplier(true,{isUpdate: false}) } @@ -432,13 +437,7 @@ formState.empName = val[0].name formState.empId = val[0].id formState.tel = val[0].mobile - } - const handleSuccessDept = (val, info) => { - formState.bDeptName = val[0].name - formState.bDeptId = val[0].id - - formState.comName = info.name - formState.comId = info.id + getCompDeptInfo(formState.empId) } const handleSuccessSupplier = (val) => { formState.cpCode = val[0].suCode @@ -510,10 +509,11 @@ let obj = { ...formState, - lngContractPurPngPointList: dataListPoint.value, + lngContractTransPngList: dataListPoint.value, lngFileUploadList: dataFile.value, lngContractFactRelList: dataListContractFact.value, lngContractApproRelList: dataListAppro.value, + lngPriceTransPngDtlList: dataListPrice.value, approCode: pageType.value=='update' ? 'WTJ' : formState.approCode }