管道气销售
This commit is contained in:
@ -15,9 +15,9 @@
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="合同期限" name="kPriod">
|
||||
<a-select v-model:value="formState.kPriod" :disabled="isDisable" placeholder="请选择合同期限" style="width: 100%" allow-clear>
|
||||
<a-select-option v-for="item in optionSelect.kPriodList" :key="item.code" :value="item.code">
|
||||
<a-form-item label="合同期限" name="kPeriod">
|
||||
<a-select v-model:value="formState.kPeriod" :disabled="isDisable" placeholder="请选择合同期限" style="width: 100%" allow-clear>
|
||||
<a-select-option v-for="item in optionSelect.kPeriodList" :key="item.code" :value="item.code">
|
||||
{{ item.name }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
@ -70,7 +70,7 @@
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="定价机制" name="prcTypeCode">
|
||||
<a-select v-model:value="formState.prcTypeCode" style="width: 100%" allow-clear>
|
||||
<a-select v-model:value="formState.prcTypeCode" :disabled="isDisable" style="width: 100%" allow-clear>
|
||||
<a-select-option v-for="item in optionSelect.prcTypeCodeList" :key="item.code" :value="item.code">
|
||||
{{ item.name }}
|
||||
</a-select-option>
|
||||
@ -79,7 +79,7 @@
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="量价周期" name="periodTypeCode">
|
||||
<a-select v-model:value="formState.periodTypeCode" style="width: 100%" allow-clear>
|
||||
<a-select v-model:value="formState.periodTypeCode" :disabled="isDisable" style="width: 100%" allow-clear>
|
||||
<a-select-option v-for="item in optionSelect.periodTypeCodeList" :key="item.code" :value="item.code">
|
||||
{{ item.name }}
|
||||
</a-select-option>
|
||||
@ -88,7 +88,7 @@
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="主计量单位" name="uomCode">
|
||||
<a-select v-model:value="formState.uomCode" style="width: 100%" allow-clear>
|
||||
<a-select v-model:value="formState.uomCode" :disabled="isDisable" style="width: 100%" allow-clear>
|
||||
<a-select-option v-for="item in optionSelect.uomCodeList" :key="item.code" :value="item.code">
|
||||
{{ item.name }}
|
||||
</a-select-option>
|
||||
@ -115,10 +115,13 @@
|
||||
<h4>交割点</h4>
|
||||
<a-button type="primary" style="margin-bottom: 10px;margin-right: 10px;" @click="addUpLoad" v-if="!isDisable">新增</a-button>
|
||||
<a-button type="primary" @click="deleteUpLoad" v-if="!isDisable">删除</a-button>
|
||||
<div v-for="(item, idx) in dataListPoint">
|
||||
<div v-for="(item, idx) in dataListPoint" class="tbStyle">
|
||||
<a-row>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="计量交割点" name="pointDelyName">
|
||||
<a-form-item name="pointDelyName">
|
||||
<template #label>
|
||||
<span><span style="color:red">*</span>计量交割点</span>
|
||||
</template>
|
||||
<a-input-search v-model:value="item.pointDelyName" :disabled="isDisable" placeholder="请选择计量交割点" readonly @search="onSearchDownLoad('dely', idx)"/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
@ -128,7 +131,10 @@
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="是否托运" name="transSign">
|
||||
<a-form-item name="transSign">
|
||||
<template #label>
|
||||
<span><span style="color:red">*</span>是否托运</span>
|
||||
</template>
|
||||
<a-select v-model:value="item.transSign" style="width: 100%" allow-clear>
|
||||
<a-select-option v-for="item in optionSelect.transSignList" :key="item.code" :value="item.code">
|
||||
{{ item.name }}
|
||||
@ -141,10 +147,10 @@
|
||||
<a-textarea v-model:value="item.note" :disabled="isDisable" placeholder="请输入备注" :auto-size="{ minRows: 2, maxRows: 5 }"/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<h4>上载信息</h4>
|
||||
<a-table style="width: 100%" :columns="columnsUp" :data-source="dataListContractAgree" :pagination="false" :scroll="{x: 300}"></a-table>
|
||||
<h4>管输(是否托运)</h4>
|
||||
<a-table style="width: 100%" :columns="columnsTrans" :data-source="dataListContractAgree" :pagination="false" :scroll="{x: 300}"></a-table>
|
||||
<h4 style="margin: 5px 0">上载信息</h4>
|
||||
<a-table style="width: 100%" :columns="columnsUp" :data-source="item.purList || []" :pagination="false" :scroll="{x: 300}"></a-table>
|
||||
<h4 style="margin: 5px 0">管输(是否托运)</h4>
|
||||
<a-table style="width: 100%" :columns="columnsTrans" :data-source="item.transList || []" :pagination="false" :scroll="{x: 300}"></a-table>
|
||||
</a-row>
|
||||
</div>
|
||||
</Card>
|
||||
@ -174,42 +180,42 @@
|
||||
</template>
|
||||
<template #bodyCell="{ column, record, index }">
|
||||
<template v-if="column.dataIndex === 'dateFrom'">
|
||||
<a-date-picker v-model:value="record.dateFrom" @change="dateFromTb(record.dateFrom, index, record)" style="width: 100%" />
|
||||
<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" @change="dateToTb(record.dateTo, index, record)" style="width: 100%" />
|
||||
<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" :min="0" style="width: 100%" />
|
||||
<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" style="width: 100%" allow-clear>
|
||||
<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" :min="0" @change="numChange('rateM3Gj', record, index)" style="width: 100%" />
|
||||
<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" :min="0" @change="numChange('qtyGjMonth', record, index)" style="width: 100%" />
|
||||
<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" :min="0" @change="numChange('qtyM3Month', record, index)" style="width: 100%" />
|
||||
<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" style="width: 100%" allow-clear>
|
||||
<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" :min="0" style="width: 100%" />
|
||||
<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" style="width: 100%" />
|
||||
<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>
|
||||
@ -229,7 +235,7 @@
|
||||
<deptListModal @register="registerDept" @success="handleSuccessDept" />
|
||||
<contractFactListModal @register="registerContractFact" @success="handleSuccessContractFact" />
|
||||
<downloadPointModal @register="registerDownLoad" @success="handleSuccessDownLoad" />
|
||||
<customerListModal @register="registerCustomer" @success="handleSuccessSupplier" selectType="radio" />
|
||||
<customerListModal @register="registerCustomer" @success="handleSuccessCustomer" selectType="radio" />
|
||||
</a-spin>
|
||||
</template>
|
||||
|
||||
@ -245,7 +251,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, getTransList, getPurList } from '/@/api/contract/ContractSales';
|
||||
import { getLngAppro,getCompDept } from '/@/api/approve/Appro';
|
||||
import dayjs from 'dayjs';
|
||||
import { getAppEnvConfig } from '/@/utils/env';
|
||||
@ -263,8 +269,8 @@
|
||||
const userStore = useUserStore();
|
||||
const userInfo = userStore.getUserInfo;
|
||||
|
||||
const tableName = 'ContractPurPng';
|
||||
const columnName = 'ContractPurPng'
|
||||
const tableName = 'ContractSales';
|
||||
const columnName = 'ContractSales'
|
||||
|
||||
const formType = ref('2'); // 0 新建 1 修改 2 查看
|
||||
const formRef = ref();
|
||||
@ -291,12 +297,14 @@
|
||||
const curIdx = ref(null)
|
||||
const { notification } = useMessage();
|
||||
const { t } = useI18n();
|
||||
const hasDel = ref(false)
|
||||
const formState = reactive({
|
||||
approCode: 'WTJ',
|
||||
typeCode: 'SP',
|
||||
onlineSign: 'N',
|
||||
cpTableName: 'lng_customer',
|
||||
curCode: 'CNY'
|
||||
curCode: 'CNY',
|
||||
lngContractSalesPngList: [{}]
|
||||
});
|
||||
const [register, { openModal:openModal}] = useModal();
|
||||
const [registerDept, { openModal:openModalDept}] = useModal();
|
||||
@ -362,14 +370,14 @@
|
||||
const dataListAppro = ref([])
|
||||
const dataListContractFact = ref([])
|
||||
const dataListPoint = ref([{
|
||||
"pointUpCode": "",
|
||||
"pointTransCode": "",
|
||||
"transSign": "",
|
||||
"note": null,
|
||||
"lngContractPurPngPointSalesList": []
|
||||
'pointDelyCode':'',
|
||||
}])
|
||||
let optionSelect= reactive({
|
||||
approCodeList: [],
|
||||
kPriodList: [],
|
||||
kPeriodList: [],
|
||||
prcTypeCodeList: [],
|
||||
uomCodeList: [],
|
||||
periodTypeCodeList: [],
|
||||
@ -421,31 +429,47 @@
|
||||
let data = await getLngContract(id)
|
||||
spinning.value = false
|
||||
Object.assign(formState, {...data})
|
||||
Object.assign(dataListPoint.value, formState.lngContractPurPngPointList || [{}])
|
||||
Object.assign(dataListContractAgree.value, formState.lngContractPurPngQtyList || [])
|
||||
Object.assign(dataListPoint.value, formState.lngContractSalesPngPointList || [{}])
|
||||
Object.assign(dataListContractAgree.value, formState.lngContractSalesPngQtyList || [])
|
||||
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 || [])
|
||||
formState.dateCfmFrom = formState.dateCfmFrom ? dayjs(formState.dateCfmFrom) : null
|
||||
formState.dateCfmTo = formState.dateCfmTo ? dayjs(formState.dateCfmTo) : null
|
||||
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.prcTypeCode = (formState?.lngContractPurPngList[0] || {}).uomCode
|
||||
formState.periodTypeCode = (formState?.lngContractPurPngList[0] || {}).periodTypeCode
|
||||
formState.uomCode = (formState?.lngContractPurPngList[0] || {}).uomCode
|
||||
|
||||
dataListContractAgree.forEach(v => {
|
||||
formState.prcTypeCode = (formState?.lngContractSalesPngList[0] || {}).prcTypeCode
|
||||
formState.periodTypeCode = (formState?.lngContractSalesPngList[0] || {}).periodTypeCode
|
||||
formState.uomCode = (formState?.lngContractSalesPngList[0] || {}).uomCode
|
||||
|
||||
dataListAppro.value.forEach(v => {
|
||||
v.approId = v.id
|
||||
})
|
||||
dataListContractFact.value.forEach(v => {
|
||||
v.kFactId = v.id
|
||||
})
|
||||
dataListContractAgree.value.forEach(v => {
|
||||
v.qtyM3Month = Number(v.qtyM3Month)/10000
|
||||
v.qtyM3Day = Number(v.qtyM3Day)/10000
|
||||
v.dateFrom = v.dateFrom ? dayjs(v.dateFrom) : null
|
||||
v.dateTo = v.dateTo ? dayjs(v.dateTo) : null
|
||||
});
|
||||
getList()
|
||||
|
||||
} catch (error) {
|
||||
console.log(error, 'error')
|
||||
spinning.value = false
|
||||
}
|
||||
}
|
||||
async function getList () {
|
||||
for (let i = 0; i < dataListPoint.value.length; i++) {
|
||||
dataListPoint.value[i].transList = await getTransList(dataListPoint.value[i].pointDelyCode)
|
||||
dataListPoint.value[i].purList = await getPurList(dataListPoint.value[i].pointDelyCode)
|
||||
}
|
||||
}
|
||||
async function getOption() {
|
||||
optionSelect.kPriodList = await getDictionary('LNG_K_PER')
|
||||
optionSelect.kPeriodList = await getDictionary('LNG_K_PER')
|
||||
optionSelect.prcTypeCodeList = await getDictionary('LNG_PRC')
|
||||
optionSelect.periodTypeCodeList = await getDictionary('LNG_PRC_P')
|
||||
optionSelect.uomCodeList = await getDictionary('LNG_UOM')
|
||||
@ -470,6 +494,7 @@
|
||||
dataListAppro.value = val
|
||||
}
|
||||
const getApproContractFactList = (val) => {
|
||||
console.log(val, 'dataListContractFact')
|
||||
dataListContractFact.value = val
|
||||
}
|
||||
const disabledDateStart = (startValue) => {
|
||||
@ -584,13 +609,18 @@
|
||||
}
|
||||
const addUpLoad = ()=> {
|
||||
dataListPoint.value.push({
|
||||
"pointUpCode": "",
|
||||
"pointTransCode": "",
|
||||
"transSign": "",
|
||||
"note": null,
|
||||
"lngContractPurPngPointSalesList": []
|
||||
'pointDelyCode':'',
|
||||
transList: [],
|
||||
purList: []
|
||||
})
|
||||
}
|
||||
const deleteUpLoad = () => {
|
||||
if (dataListPoint.value[dataListPoint.value.length -1].id) {
|
||||
hasDel.value = true
|
||||
}
|
||||
if (dataListPoint.value.length == 1) return
|
||||
dataListPoint.value.pop()
|
||||
}
|
||||
@ -607,13 +637,14 @@
|
||||
formState.comName = info.name
|
||||
formState.comId = info.id
|
||||
}
|
||||
const handleSuccessSupplier = (val) => {
|
||||
formState.cpCode = val[0].suCode
|
||||
formState.cpName = val[0].suName
|
||||
const handleSuccessCustomer = (val) => {
|
||||
formState.cpCode = val[0].cuCode
|
||||
formState.cpName = val[0].cuName
|
||||
}
|
||||
const handleSuccessContractFact = (val) => {
|
||||
val.forEach(v => {
|
||||
v.id = null
|
||||
v.kFactId = v.id
|
||||
v.id = null
|
||||
})
|
||||
if (!dataListContractFact.value.length) {
|
||||
dataListContractFact.value = val
|
||||
@ -631,13 +662,15 @@
|
||||
})
|
||||
dataListContractFact.value = unique([...dataListContractFact.value, ...arr], 'kNo')
|
||||
}
|
||||
const handleSuccessDownLoad = (val, type) => {
|
||||
const handleSuccessDownLoad = async (val, type) => {
|
||||
if (type == 'trans') {
|
||||
dataListPoint.value[curIdx.value].pointTransCode = val[0].code
|
||||
dataListPoint.value[curIdx.value].pointTransName = val[0].fullName
|
||||
} else {
|
||||
dataListPoint.value[curIdx.value].pointDelyCode = val[0].code
|
||||
dataListPoint.value[curIdx.value].pointDelyName = val[0].fullName
|
||||
dataListPoint.value[curIdx.value].transList = await getTransList(dataListPoint.value[curIdx.value].pointDelyCode)
|
||||
dataListPoint.value[curIdx.value].purList = await getPurList(dataListPoint.value[curIdx.value].pointDelyCode)
|
||||
}
|
||||
}
|
||||
const btnCheck = (record, index) => {
|
||||
@ -673,33 +706,42 @@
|
||||
arr[i].qtyM3Month = Number(arr[i].qtyM3Month)*10000
|
||||
arr[i].qtyM3Day = Number(arr[i].qtyM3Day)*10000
|
||||
}
|
||||
let arr1 = []
|
||||
dataListAppro.value.forEach(v=>{
|
||||
v.approId = ''
|
||||
arr1.concat(v.lngContractPurPngPointSalesList || [])
|
||||
dataListAppro.value.forEach((v,idx)=>{
|
||||
v.tableName = 'Ing_contract'
|
||||
v.sort = idx
|
||||
})
|
||||
let newArr = arr1.map(v=>v.pointDelyCode)
|
||||
let codeList = dataListPoint.value.map(v =>v.pointUpCode)
|
||||
dataListContractFact.value.forEach((v,idx)=> {
|
||||
v.sort = idx
|
||||
})
|
||||
for(let i=0; i<dataListPoint.value.length; i++) {
|
||||
dataListPoint.value[i].hasDel = hasDel.value
|
||||
if (!dataListPoint.value[i].pointDelyCode || !dataListPoint.value[i].transSign) {
|
||||
message.warn('请完善交割点必选项')
|
||||
return
|
||||
}
|
||||
}
|
||||
let newArr = dataListPoint.value.map(v=>v.pointTransCode)
|
||||
let codeList = dataListPoint.value.map(v =>v.pointDelyCode)
|
||||
const isRepeat=codeList.some((item,index,arr)=>arr.indexOf(item)!=index);
|
||||
const isRepeatNew=newArr.some((item,index,arr)=>arr.indexOf(item)!=index);
|
||||
if(isRepeat){
|
||||
message.warn('上载点不可重复');
|
||||
message.warn('交割点不可重复');
|
||||
return
|
||||
}
|
||||
if(isRepeatNew){
|
||||
message.warn('交割点不可重复');
|
||||
message.warn('交气点不可重复');
|
||||
return
|
||||
}
|
||||
let obj = {
|
||||
...formState,
|
||||
lngContractPurPngPointList: dataListPoint.value,
|
||||
lngContractPurPngQtyList: arr,
|
||||
lngContractSalesPngPointList: dataListPoint.value,
|
||||
lngContractSalesPngQtyList: arr,
|
||||
lngFileUploadList: dataFile.value,
|
||||
lngContractFactRelList: dataListContractFact.value,
|
||||
lngContractApproRelList: dataListAppro.value,
|
||||
lngContractPurPngList: [
|
||||
lngContractSalesPngList: [
|
||||
{
|
||||
...formState.lngContractPurPngList[0],
|
||||
...formState.lngContractSalesPngList[0],
|
||||
"kId": formState.id,
|
||||
"prcTypeCode": formState.prcTypeCode,
|
||||
"periodTypeCode": formState.periodTypeCode,
|
||||
@ -732,6 +774,7 @@
|
||||
}
|
||||
|
||||
} catch (errorInfo) {
|
||||
console.log(errorInfo, 'errorInfo')
|
||||
spinning.value = false;
|
||||
errorInfo?.errorFields?.length && notification.warning({
|
||||
message: 'Tip',
|
||||
@ -769,5 +812,10 @@
|
||||
color: rgba(0, 0, 0, 0.45);
|
||||
// top: 0;
|
||||
}
|
||||
.tbStyle {
|
||||
border: 1px dashed #d9d9d9;
|
||||
padding: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user