加工合同保存

This commit is contained in:
‘huanghaiixia’
2026-02-25 17:34:01 +08:00
parent 5b0f159484
commit f7d9075c75
2 changed files with 217 additions and 91 deletions

View File

@ -50,7 +50,12 @@
</a-col>
<a-col :span="8">
<a-form-item label="业务部门" name="bDeptName">
<a-input-search v-model:value="formState.bDeptName" :disabled="isDisable" placeholder="请选择业务部门" readonly @search="onSearch"/>
<a-input-search v-model:value="formState.bDeptName" disabled placeholder="请选择业务部门" readonly @search="onSearch"/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="电话" name="tel">
<a-input v-model:value="formState.tel" :disabled="isDisable" />
</a-form-item>
</a-col>
<a-col :span="8">
@ -103,44 +108,90 @@
</a-row>
</Card>
<Card title="加工费率" :bordered="false" >
<div style="width: 100%">
<a-button type="primary" style="margin-bottom: 10px" @click="handleAdd" v-if="!isDisable">新增</a-button>
<a-table style="width: 100%" :columns="columnsPrice" :data-source="dataListPrice" :pagination="false">
<template #headerCell="{ column }">
<template v-if="column.dataIndex == 'qtyGj'">
<span><span class="redStyle">*</span>阶梯内气量(吉焦)</span>
</template>
<template v-if="column.dataIndex == 'pricePngGj'">
<span><span class="redStyle">*</span>气态加工费率(/吉焦)</span>
</template>
<template v-if="column.dataIndex == 'priceLngGj'">
<span><span class="redStyle">*</span>液态加工费率(/吉焦)</span>
</template>
</template>
<template #bodyCell="{ column, record, index }">
<template v-if="column.dataIndex === 'sortDesc'">
<a-input v-model:value="record.sortDesc" :disabled="isDisable" />
</template>
<template v-if="column.dataIndex === 'rateTonGj'">
<a-input-number v-model:value="record.rateTonGj" :disabled="isDisable" :min="0" :precision="3" style="width: 100%"/>
</template>
<template v-if="column.dataIndex === 'qtyGj'">
<a-input-number v-model:value="record.qtyGj" :disabled="isDisable" :min="0" :precision="3" style="width: 100%"/>
</template>
<template v-if="column.dataIndex === 'pricePngGj'">
<a-input-number v-model:value="record.pricePngGj" :disabled="isDisable" :min="0" :precision="3" style="width: 100%"/>
</template>
<template v-if="column.dataIndex === 'priceLngGj'">
<a-input-number v-model:value="record.priceLngGj" :disabled="isDisable" :min="0" :precision="3" style="width: 100%"/>
</template>
<template v-if="column.dataIndex === 'note'">
<a-input v-model:value="record.note" :disabled="isDisable" />
</template>
<template v-if="column.dataIndex === 'operation'">
<a v-if="!isDisable" @click="handleDelete(index)">删除</a>
</template>
</template>
</a-table>
<div v-for="(item, idx) in dataListPrice" class="tbStyle">
<a-button type="primary" style="margin-bottom: 10px;margin-right: 10px;" @click="addProc" v-if="!isDisable">新增</a-button>
<a-button type="primary" @click="deleteProc(idx)" v-if="!isDisable">删除</a-button>
<a-row>
<a-col :span="8">
<a-form-item name="dateFromNew">
<template #label>
<span><span style="color:red">*</span>有效期开始</span>
</template>
<a-date-picker v-model:value="item.dateFromNew" format="YYYY-MM-DD" :value-format="'YYYY-MM-DD'" @openChange="dateToYCheck(idx)" @change="dateFromNewChange" style="width: 100%" :disabled="isDisable" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item name="dateToCode">
<template #label>
<span><span style="color:red">*</span>结束日类型</span>
</template>
<a-select v-model:value="item.dateToCode" @change="dateToCodeChange(idx, item.dateToCode)" :disabled="isDisable" style="width: 100%" allow-clear>
<a-select-option v-for="item in optionSelect.dateToCodeList" :key="item.code" :value="item.code">
{{ item.name }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="8" v-if="item.dateToCode=='F'">
<a-form-item name="dateToF">
<template #label>
<span><span style="color:red">*</span>固定结束日</span>
</template>
<a-date-picker v-model:value="item.dateToF" format="YYYY-MM-DD" :value-format="'YYYY-MM-DD'" style="width: 100%" :disabled="isDisable" />
</a-form-item>
</a-col>
<a-col :span="8" v-if="item.dateToCode=='Y'">
<a-form-item name="dateToY">
<template #label>
<span><span style="color:red">*</span>每年结束日</span>
</template>
<a-date-picker v-model:value="item.dateToY" format="MM-DD" :value-format="'MM-DD'" style="width: 100%" :disabled="isDisable" @openChange="dateToYCheck(idx)" :disabledDate="disabledCurrentYear"/>
</a-form-item>
</a-col>
<div style="width: 100%">
<a-button type="primary" style="margin-bottom: 10px" @click="handleAdd(idx)" v-if="!isDisable">新增行</a-button>
<a-table style="width: 100%" :columns="columnsPrice" :data-source="item.lngPriceProcDtlList" :pagination="false">
<template #headerCell="{ column }">
<template v-if="column.dataIndex == 'sortDesc'">
<span><span class="redStyle">*</span>约定</span>
</template>
<template v-if="column.dataIndex == 'qtyGj'">
<span><span class="redStyle">*</span>阶梯内气量(吉焦)</span>
</template>
<template v-if="column.dataIndex == 'pricePngGj'">
<span><span class="redStyle">*</span>气态加工费率(/吉焦)</span>
</template>
<template v-if="column.dataIndex == 'priceLngGj'">
<span><span class="redStyle">*</span>液态加工费率(/吉焦)</span>
</template>
</template>
<template #bodyCell="{ column, record, index }">
<template v-if="column.dataIndex === 'sortDesc'">
<a-input v-model:value="record.sortDesc" :disabled="isDisable" />
</template>
<template v-if="column.dataIndex === 'rateTonGj'">
<a-input-number v-model:value="record.rateTonGj" :disabled="isDisable" :min="0" :precision="3" style="width: 100%"/>
</template>
<template v-if="column.dataIndex === 'qtyGj'">
<a-input-number v-model:value="record.qtyGj" :disabled="isDisable" :min="0" :precision="3" style="width: 100%"/>
</template>
<template v-if="column.dataIndex === 'pricePngGj'">
<a-input-number v-model:value="record.pricePngGj" :disabled="isDisable" :min="0" :precision="3" style="width: 100%"/>
</template>
<template v-if="column.dataIndex === 'priceLngGj'">
<a-input-number v-model:value="record.priceLngGj" :disabled="isDisable" :min="0" :precision="3" style="width: 100%"/>
</template>
<template v-if="column.dataIndex === 'note'">
<a-input v-model:value="record.note" :disabled="isDisable" />
</template>
<template v-if="column.dataIndex === 'operation'">
<a v-if="!isDisable" @click="handleDelete(idx, index)">删除</a>
</template>
</template>
</a-table>
</div>
</a-row>
</div>
</Card>
<Card title="附件信息" :bordered="false" >
@ -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<arr.length; i++) {
let isFlag = arr[i].qtyGj == null || arr[i].qtyGj === ''|| arr[i].pricePngGj == null || arr[i].pricePngGj === '' || arr[i].priceLngGj == null || arr[i].priceLngGj === ''
if (isFlag) {
for(let k=0; k<dataListPrice.value.length; k++) {
let flag = !dataListPrice.value[k].dateFrom || !dataListPrice.value[k].dateToCode || (dataListPrice.value[k].dateToCode=='F'&&!dataListPrice.value[k].dateToF) || (dataListPrice.value[k].dateToCode=='Y'&&!dataListPrice.value[k].dateToY)
if (flag) {
message.warn('请完善加工费率必选项')
return
}
dataListPrice.value[k].dateFrom = dataListPrice.value[k].dateFrom ? dayjs(dataListPrice.value[k].dateFrom).format('YYYY-MM-DD HH:mm:ss'):null
dataListPrice.value[k].dateFromNew = dataListPrice.value[k].dateFromNew ? dayjs(dataListPrice.value[k].dateFromNew).format('YYYY-MM-DD HH:mm:ss') : null
dataListPrice.value[k].dateToF = dataListPrice.value[k].dateToF ? dayjs(dataListPrice.value[k].dateToF).format('YYYY-MM-DD HH:mm:ss') : null
dataListPrice.value[k].dateToY = dataListPrice.value[k].dateToY ? dayjs(dataListPrice.value[k].dateToY).format('MM-DD') : null
dataListPrice.value[k].comCode = formState.comId
dataListPrice.value[k].suCode = formState.cpCode
dataListPrice.value[k].staCode = formState.lngContractProcList[0].staCode
let arr = dataListPrice.value[k].lngPriceProcDtlList || []
for(let i=0; i<arr.length; i++) {
let isFlag = arr[i].qtyGj == null || arr[i].qtyGj === ''|| arr[i].pricePngGj == null || arr[i].pricePngGj === '' || arr[i].priceLngGj == null || arr[i].priceLngGj === ''
let isFlagNew = false
if (arr[i].sort <arr.length && (arr[i].sortDesc == '' || arr[i].sortDesc == null)) {
isFlagNew = true
}
if (isFlag || isFlagNew) {
message.warn('请完善加工费率必选项')
return
}
}
}
let obj = {
@ -477,6 +598,7 @@
lngFileUploadList: dataFile.value,
lngContractFactRelList: dataListContractFact.value,
lngContractApproRelList: dataListAppro.value,
lngPriceProcList: dataListPrice.value,
approCode: pageType.value=='update' ? 'WTJ' : formState.approCode
}
@ -535,5 +657,9 @@
.redStyle {
color: red;
}
.tbStyle {
border: 1px dashed #d9d9d9;
padding: 10px;
margin-bottom: 10px;
}
</style>

View File

@ -68,7 +68,7 @@
</a-col>
<a-col :span="8">
<a-form-item label="业务部门" name="bDeptName">
<a-input-search v-model:value="formState.bDeptName" :disabled="isDisable" placeholder="请选择业务部门" readonly @search="onSearch"/>
<a-input v-model:value="formState.bDeptName" disabled/>
</a-form-item>
</a-col>
<a-col :span="8">
@ -76,6 +76,11 @@
<a-input v-model:value="formState.comName" disabled />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="电话" name="tel">
<a-input v-model:value="formState.tel" :disabled="isDisable" />
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="备注" name="note" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
<a-textarea v-model:value="formState.note" :disabled="isDisable" placeholder="请输入备注" :auto-size="{ minRows: 2, maxRows: 5 }"/>
@ -156,7 +161,6 @@
</a-form>
</div>
<deptUserModal @register="register" @success="handleSuccess"/>
<deptListModal @register="registerDept" @success="handleSuccessDept" />
<contractFactListModal @register="registerContractFact" @success="handleSuccessContractFact" />
<downloadPointModal @register="registerDownLoad" @success="handleSuccessDownLoad"/>
<supplierListModal @register="registerSupplier" @success="handleSuccessSupplier" selectType="radio" />
@ -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
}