采购合同优化

This commit is contained in:
‘huanghaiixia’
2026-01-08 11:39:56 +08:00
parent 5184bc2ddc
commit 3c72582db5
6 changed files with 287 additions and 332 deletions

View File

@ -135,7 +135,7 @@
<template #label>
<span><span style="color:red">*</span>是否托运</span>
</template>
<a-select v-model:value="item.transSign" style="width: 100%" allow-clear>
<a-select v-model:value="item.transSign" :disabled="isDisable" style="width: 100%" allow-clear>
<a-select-option v-for="item in optionSelect.transSignList" :key="item.code" :value="item.code">
{{ item.name }}
</a-select-option>
@ -155,80 +155,17 @@
</div>
</Card>
<Card title="合同约定" :bordered="false" >
<div style="width: 100%">
<a-button type="primary" style="margin-bottom: 10px" @click="addContractAgree" v-if="!isDisable">新增行</a-button>
<a-table style="width: 100%" :columns="columns" :data-source="dataListContractAgree" :pagination="false" :scroll="{x: 300}">
<template #headerCell="{ column }">
<template v-if="column.dataIndex == 'dateFrom'">
<span><span class="redStyle">*</span>开始日期</span>
</template>
<template v-if="column.dataIndex == 'dateTo'">
<span><span class="redStyle">*</span>结束日期</span>
</template>
<template v-if="column.dataIndex == 'baseInc'">
<span><span class="redStyle">*</span>基础量/增量</span>
</template>
<template v-if="column.dataIndex == 'sort'">
<span><span class="redStyle">*</span>优先级</span>
</template>
<template v-if="column.dataIndex == 'qtyGjMonth'">
<span><span class="redStyle">*</span>月气量(吉焦)</span>
</template>
<template v-if="column.dataIndex == 'qtyM3Month'">
<span><span class="redStyle">*</span>月气量(万方)</span>
</template>
</template>
<template #bodyCell="{ column, record, index }">
<template v-if="column.dataIndex === 'dateFrom'">
<a-date-picker v-model:value="record.dateFrom" :disabled="isDisable" @change="dateFromTb(record.dateFrom, index, record)" style="width: 100%" />
</template>
<template v-if="column.dataIndex === 'dateTo'">
<a-date-picker v-model:value="record.dateTo" :disabled="isDisable" @change="dateToTb(record.dateTo, index, record)" style="width: 100%" />
</template>
<template v-if="column.dataIndex === 'sort'">
<a-input-number v-model:value="record.sort" :disabled="isDisable" :min="0" style="width: 100%" />
</template>
<template v-if="column.dataIndex === 'baseInc'">
<a-select v-model:value="record.baseInc" :disabled="isDisable" style="width: 100%" allow-clear>
<a-select-option v-for="item in optionSelect.baseIncList" :key="item.code" :value="item.code">
{{ item.name }}
</a-select-option>
</a-select>
</template>
<template v-if="column.dataIndex === 'rateM3Gj'">
<a-input-number v-model:value="record.rateM3Gj" :disabled="isDisable" :min="0" @change="numChange('rateM3Gj', record, index)" style="width: 100%" />
</template>
<template v-if="column.dataIndex === 'qtyGjMonth'">
<a-input-number v-model:value="record.qtyGjMonth" :disabled="isDisable" :min="0" @change="numChange('qtyGjMonth', record, index)" style="width: 100%" />
</template>
<template v-if="column.dataIndex === 'qtyM3Month'">
<a-input-number v-model:value="record.qtyM3Month" :disabled="isDisable" :min="0" @change="numChange('qtyM3Month', record, index)" style="width: 100%" />
</template>
<template v-if="column.dataIndex === 'zfbyTypeCode'">
<a-select v-model:value="record.zfbyTypeCode" :disabled="isDisable" style="width: 100%" allow-clear>
<a-select-option v-for="item in optionSelect.zfbyTypeCodeList" :key="item.code" :value="item.code">
{{ item.name }}
</a-select-option>
</a-select>
</template>
<template v-if="column.dataIndex === 'zfbyValue'">
<a-input-number v-model:value="record.zfbyValue" :disabled="isDisable" :min="0" style="width: 100%" />
</template>
<template v-if="column.dataIndex === 'note'">
<a-input v-model:value="record.note" :disabled="isDisable" style="width: 100%" />
</template>
<template v-if="column.dataIndex === 'operation'">
<a v-if="!isDisable" style="margin-right: 10px" @click="btnCheck(record, index)">删除</a>
</template>
</template>
</a-table>
</div>
<contractQtyList :list="dataListContractAgree" :disabled="isDisable" :optionSelect="optionSelect" ref="contractQty"></contractQtyList>
</Card>
<Card title="附件信息" :bordered="false" >
<UploadList :disabled="isDisable" :list="dataFile" :value="formState.filePath" :tableName="tableName" :columnName="columnName" @change="uploadListChange"/>
</Card>
<correlationContractFactList :list="dataListContractFact" :disabled="isDisable" @change="getApproContractFactList"></correlationContractFactList>
<correlationApproList :list="dataListAppro" :disabled="isDisable" @change="getApproList"></correlationApproList>
<Card title="关联合同信息" :bordered="false" >
<correlationContractFactList :list="dataListContractFact" :disabled="isDisable" @change="getApproContractFactList"></correlationContractFactList>
</Card>
<Card title="签报列表" :bordered="false" >
<correlationApproList :list="dataListAppro" :disabled="isDisable" @change="getApproList"></correlationApproList>
</Card>
</a-form>
</div>
<deptUserModal @register="register" @success="handleSuccess"/>
@ -264,6 +201,7 @@
import contractFactListModal from '/@/components/common/contractFactListModal.vue';
import downloadPointModal from '/@/components/common/downloadPointModal.vue';
import customerListModal from '/@/components/common/customerListModal.vue';
import contractQtyList from '/@/components/common/contractQtyList.vue';
import { useUserStore } from '/@/store/modules/user';
const userStore = useUserStore();
@ -292,7 +230,8 @@
const formId = ref(currentRoute.value?.params?.id);
const pageType = ref(currentRoute.value.query?.type);
const pageId = ref(currentRoute.value.query?.id)
const contractQty = ref()
const spinning = ref(false);
const curIdx = ref(null)
const { notification } = useMessage();
@ -524,67 +463,6 @@
return false
}
return endValue.valueOf() <= startValue.valueOf();
}
const dateFromTb = (startValue, index, record) => {
if (!startValue) return
const endValue = dataListContractAgree.value[index]?.dateTo;
if (!startValue || !endValue) {
return false
}
if (startValue.valueOf() > endValue.valueOf()) {
message.warning('结束日期须大于等于开始日期')
dataListContractAgree.value[index].dateFrom = ''
return
}
dayCount(record)
}
const dateToTb = (endValue, index, record) => {
if (!endValue) return
const startValue = dataListContractAgree.value[index]?.dateFrom;
if (!endValue || !startValue) {
return false
}
if (startValue.valueOf() > endValue.valueOf()) {
message.warning('结束日期须大于等于开始日期')
dataListContractAgree.value.splice(index, 1, { ...dataListContractAgree.value[index], dateTo: '' });
return
}
dayCount(record)
}
const numChange = (key, record) => {
if (key == 'qtyGjMonth') {
numCount2(record)
dayCount(record)
}
if (key == 'qtyM3Month') {
numCount1(record)
dayCount(record)
}
if (key == 'rateM3Gj') {
numCount1(record)
numCount2(record)
dayCount(record)
}
}
const numCount1 = (record) => {
// 月气量(吉焦) =月气量(方)qty_m3_month*rate_m3_gj (比值(方/吉焦)
record.qtyGjMonth = (Number(record.qtyM3Month) || 0) * (Number(record.rateM3Gj) || 0)
record.qtyGjMonth = record.qtyGjMonth ? record.qtyGjMonth.toFixed(4) : '0'
}
const numCount2 = (record) => {
// 月气量(方) = 月气量(吉焦) qty_gj_month/rate_m3_gj/10000 显示时字段值/10000保存时页面值*10000
record.qtyM3Month = Number(record.rateM3Gj) ? (Number(record.qtyGjMonth) || 0) /Number(record.rateM3Gj) : 0
record.qtyM3Month = record.qtyM3Month ? record.qtyM3Month.toFixed(4) : '0'
}
const dayCount = (record) => {
// 日气量(吉焦) = 月气量(吉焦)qty_gj_month/开始日期到结束日期的天数;计算结果保留整数
const days = dayjs(record.dateTo).diff(dayjs(record.dateFrom), 'day');
record.qtyGjDay = days ? (Number(record.qtyGjMonth) || 0) /days : 0
record.qtyGjDay = parseInt(record.qtyGjDay)
// 日气量(方) = 月气量(万方)/开始日期到结束日期的天数计算结果保留4位小数显示时字段值/10000保存时页面值*10000
record.qtyM3Day = days ? (Number(record.qtyM3Month) || 0) /days : 0
record.qtyM3Day = record.qtyM3Day ? record.qtyM3Day.toFixed(4) : '0'
}
const onSearch = (val)=> {
openModalDept(true,{isUpdate: false})
@ -602,11 +480,6 @@
curIdx.value = index
openModalDownLoad(true,{isUpdate: false, type: val})
}
const addContractAgree = () => {
dataListContractAgree.value.push({
dateFrom: null, dateTo: null, rateM3Gj: null, qtyGjMonth: null, qtyM3Month: null, qtyGjDay: null, qtyM3Day: null
})
}
const addUpLoad = ()=> {
dataListPoint.value.push({
"pointTransCode": "",
@ -673,9 +546,6 @@
dataListPoint.value[curIdx.value].purList = await getPurList(dataListPoint.value[curIdx.value].pointDelyCode)
}
}
const btnCheck = (record, index) => {
dataListContractAgree.value.splice(index, 1)
}
function unique(arr, u_key) {
const map = new Map()
arr.forEach((item, index) => {
@ -694,7 +564,7 @@
async function handleSubmit(type) {
try {
await formRef.value.validateFields();
let arr = JSON.parse(JSON.stringify(dataListContractAgree.value))
let arr = contractQty.value.getQtyList()
for(let i=0; i<arr.length; i++) {
let isFlag = !arr[i].dateFrom || !arr[i].dateTo || !arr[i].baseInc || arr[i].rateM3Gj == null || arr[i].rateM3Gj == '' || arr[i].qtyGjMonth == null || arr[i].qtyGjMonth == ''|| arr[i].qtyM3Month == null || arr[i].qtyM3Month == ''
if (isFlag) {