采购合同优化

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

@ -0,0 +1,211 @@
<template>
<div style="width: 100%">
<a-button type="primary" style="margin-bottom: 10px" @click="addContractAgree" v-if="!disabled">新增行</a-button>
<a-table :columns="columns" :data-source="dataListContractAgree" :pagination="false" :scroll="{x: 1300}">
<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="disabled" @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="disabled" @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="disabled" :min="0" style="width: 100%" />
</template>
<template v-if="column.dataIndex === 'baseInc'">
<a-select v-model:value="record.baseInc" :disabled="disabled" 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="disabled" :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="disabled" :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="disabled" :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="disabled" 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="disabled" :min="0" style="width: 100%" />
</template>
<template v-if="column.dataIndex === 'note'">
<a-input v-model:value="record.note" :disabled="disabled" style="width: 100%" />
</template>
<template v-if="column.dataIndex === 'operation'">
<a v-if="!disabled" style="margin-right: 10px" @click="btnCheck(record, index)">删除</a>
</template>
</template>
</a-table>
</div>
</template>
<script lang="ts" setup>
import { Card } from 'ant-design-vue';
import { ref, watch} from 'vue';
import { useRouter } from 'vue-router';
import { useI18n } from '/@/hooks/web/useI18n';
import { Modal } from 'ant-design-vue';
import { useModal } from '/@/components/Modal';
import { message } from 'ant-design-vue';
import dayjs from 'dayjs';
const router = useRouter();
const { t } = useI18n();
const dataListContractAgree = ref([])
const columns= ref([
{ title: t('序号'), dataIndex: 'index', key: 'index', sorter: true, customRender: (column) => `${column.index + 1}` ,width: 80},
{ title: t('开始日期'), dataIndex: 'dateFrom', sorter: true, width:160},
{ title: t('结束日期'), dataIndex: 'dateTo', sorter: true, width: 160},
{ title: t('基础量/增量'), dataIndex: 'baseInc', sorter: true, width: 130},
{ title: t('优先级'), dataIndex: 'sort', sorter: true, width: 100},
{ title: t('比值(方/吉焦)'), dataIndex: 'rateM3Gj', sorter: true, width: 150},
{ title: t('月气量(吉焦)'), dataIndex: 'qtyGjMonth', sorter: true, width: 150},
{ title: t('月气量(万方)'), dataIndex: 'qtyM3Month', sorter: true, width: 150},
{ title: t('日气量(吉焦)'), dataIndex: 'qtyGjDay', sorter: true, width: 120},
{ title: t('日气量(万方)'), dataIndex: 'qtyM3Day', sorter: true, width: 120},
{ title: t('照付不议类型'), dataIndex: 'zfbyTypeCode', sorter: true, width: 120},
{ title: t('照付不议比例%/量数值'), dataIndex: 'zfbyValue', sorter: true, width: 120},
{ title: t('备注'), dataIndex: 'note', sorter: true, width: 200},
{ title: t('操作'), dataIndex: 'operation', width: 80, fixed: 'right',align: 'center'},
]);
const [register, { openModal:openModal}] = useModal();
const props = defineProps({
disabled: Boolean,
list: Array,
optionSelect: Object
});
const emit = defineEmits(['change']);
const addContractAgree = () => {
dataListContractAgree.value.push({
dateFrom: null, dateTo: null, rateM3Gj: null, qtyGjMonth: null, qtyM3Month: null, qtyGjDay: null, qtyM3Day: null
})
}
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 btnCheck = (record, index) => {
dataListContractAgree.value.splice(index, 1)
}
const getQtyList = () => {
return dataListContractAgree.value
}
watch(
() => props.disabled,
(val) => {
if (val) {
let idx2 = columns.value.findIndex(v =>v.dataIndex == 'operation')
idx2>-1 && columns.value.splice(idx2, 1)
}
},
{
immediate: true,
deep: true,
}
);
watch(
() => props.list,
async (val) => {
dataListContractAgree.value = val || []
},
{
immediate: true,
deep: true,
}
);
defineExpose({
getQtyList,
});
</script>
<style lang="less" scoped>
.redStyle {
color: red;
}
</style>

View File

@ -1,6 +1,5 @@
<template>
<div>
<Card title="签报列表" :bordered="false" >
<a-button type="primary" style="margin-bottom: 10px" v-if="!disabled" @click="onAppro">关联签报</a-button>
<a-table :columns="columns" :data-source="dataList" :pagination="false">
<template #bodyCell="{ column, record, index }">
@ -15,7 +14,6 @@
</template>
</template>
</a-table>
</Card>
<approListModal @register="register" @success="handleSuccess" />
</div>
</template>

View File

@ -1,7 +1,6 @@
<template>
<div>
<Card title="关联合同信息" :bordered="false" >
<a-button type="primary" style="margin-bottom: 10px" v-if="!disabled" @click="onAppro">关联合同</a-button>
<a-button type="primary" style="margin-bottom: 10px" v-if="!disabled" @click="onContractFactList">关联合同</a-button>
<a-table :columns="columns" :data-source="dataList" :pagination="false" :scroll="{x: 1000}">
<template #bodyCell="{ column, record, index }">
<template v-if="column.dataIndex === 'file'">
@ -15,7 +14,6 @@
</template>
</template>
</a-table>
</Card>
<contractFactListModal @register="register" @success="handleSuccess" />
</div>
</template>
@ -58,7 +56,7 @@
const fileName = info.response ? info.response.data.fileOrg : info.fileOrg;
downloadByUrl({ url, fileName: fileName});
};
const onAppro = (val)=> {
const onContractFactList = (val)=> {
openModal(true,{isUpdate: false})
}
const handleSuccess = (val) =>{

View File

@ -214,7 +214,9 @@
<Card title="附件信息" :bordered="false" >
<UploadList :disabled="isDisable" :list="dataFile" :value="formState.filePath" :tableName="tableName" :columnName="columnName" @change="uploadListChange"/>
</Card>
<Card title="签报列表" :bordered="false" >
<correlationApproList :list="dataListAppro" :disabled="isDisable" @change="getApproList"></correlationApproList>
</Card>
</a-form>
</div>
<deptUserModal @register="register" @success="handleSuccess"/>

View File

@ -125,7 +125,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>
@ -153,80 +153,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>
<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,8 @@
import contractFactListModal from '/@/components/common/contractFactListModal.vue';
import downloadPointModal from '/@/components/common/downloadPointModal.vue';
import supplierListModal from '/@/components/common/supplierListModal.vue';
import contractQtyList from '/@/components/common/contractQtyList.vue';
import { useUserStore } from '/@/store/modules/user';
const userStore = useUserStore();
@ -293,10 +232,12 @@
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();
const { t } = useI18n();
const hasDel = ref(false)
const formState = reactive({
approCode: 'WTJ',
typeCode: 'PP',
@ -325,22 +266,6 @@
labelCol: { span: 8 },
wrapperCol: { span: 16 },
}
const columns= ref([
{ title: t('序号'), dataIndex: 'index', key: 'index', sorter: true, customRender: (column) => `${column.index + 1}` ,width: 80},
{ title: t('开始日期'), dataIndex: 'dateFrom', sorter: true, width:150},
{ title: t('结束日期'), dataIndex: 'dateTo', sorter: true, width: 150},
{ title: t('基础量/增量'), dataIndex: 'baseInc', sorter: true, width: 130},
{ title: t('优先级'), dataIndex: 'sort', sorter: true, width: 100},
{ title: t('比值(方/吉焦)'), dataIndex: 'rateM3Gj', sorter: true, width: 150},
{ title: t('月气量(吉焦)'), dataIndex: 'qtyGjMonth', sorter: true, width: 150},
{ title: t('月气量(万方)'), dataIndex: 'qtyM3Month', sorter: true, width: 150},
{ title: t('日气量(吉焦)'), dataIndex: 'qtyGjDay', sorter: true, width: 120},
{ title: t('日气量(万方)'), dataIndex: 'qtyM3Day', sorter: true, width: 120},
{ title: t('照付不议类型'), dataIndex: 'zfbyTypeCode', sorter: true, width: 120},
{ title: t('照付不议比例%/量数值'), dataIndex: 'zfbyValue', sorter: true, width: 120},
{ title: t('备注'), dataIndex: 'note', sorter: true, width: 200},
{ title: t('操作'), dataIndex: 'operation', width: 80, fixed: 'right',align: 'center'},
]);
const selectType = ref()
const isShow = ref(false)
const dataListContractAgree = ref([])
@ -428,6 +353,11 @@
v.dateTo = v.dateTo ? dayjs(v.dateTo) : null
});
dataListPoint.value.forEach(v => {
let a = (v.lngContractPurPngPointSalesList || []).map(i =>i.pointDelyName)
v.pointDelyName = a.join(',')
})
} catch (error) {
spinning.value = false
}
@ -488,67 +418,7 @@
}
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})
}
@ -569,11 +439,7 @@
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({
"pointUpCode": "",
@ -583,6 +449,9 @@
})
}
const deleteUpLoad = () => {
if (dataListPoint.value[dataListPoint.value.length -1].id) {
hasDel.value = true
}
if (dataListPoint.value.length == 1) return
dataListPoint.value.pop()
}
@ -635,11 +504,12 @@
let nameList = val.map(v=>v.fullName)
dataListPoint.value[curIdx.value].pointDelyName = nameList.join(',')
dataListPoint.value[curIdx.value].lngContractPurPngPointSalesList = val || []
dataListPoint.value[curIdx.value].lngContractPurPngPointSalesList.forEach(v => {
v.pointDelyCode = v.code
})
}
}
const btnCheck = (record, index) => {
dataListContractAgree.value.splice(index, 1)
}
function unique(arr, u_key) {
const map = new Map()
arr.forEach((item, index) => {
@ -658,7 +528,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) {
@ -671,10 +541,16 @@
arr[i].qtyM3Day = Number(arr[i].qtyM3Day)*10000
}
for(let i=0; i<dataListPoint.value.length; i++) {
dataListPoint.value[i].hasDel = hasDel.value
if (!dataListPoint.value[i].pointUpCode || !dataListPoint.value[i].transSign || !dataListPoint.value[i].lngContractPurPngPointSalesList.length) {
message.warn('请完善交割点必选项')
return
}
dataListPoint.value[i].lngContractPurPngPointSalesList.forEach(v => {
v.hasDel = hasDel.value
v.pointUpCode = dataListPoint.value[i].pointUpCode
v.transSign = dataListPoint.value[i].transSign
})
}
let arr1 = []
dataListAppro.value.forEach(v=>{

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>
<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();
@ -293,6 +231,7 @@
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) {