价格销售

This commit is contained in:
‘huanghaiixia’
2026-03-09 15:10:53 +08:00
parent 1405bfebdf
commit d22e178551
5 changed files with 144 additions and 67 deletions

View File

@ -2,7 +2,7 @@
<div>
<BasicModal v-bind="$attrs" @register="registerModal" width="60%" :title="getTitle" @ok="handleSubmit"
@visible-change="handleVisibleChange" >
<BasicTable @register="registerTable" class="ContractPurIntListModal"></BasicTable>
<BasicTable @register="registerTable" class="ContractPurIntListModal" v-if="showTable"></BasicTable>
</BasicModal>
</div>
</template>
@ -14,7 +14,7 @@
import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n';
import { getLngPriceContractPurPng} from '/@/api/price/PricePurPngApp';
import {getLngPriceContractSalesPng} from '/@/api/price/PriceSalesPngApp';
const { t } = useI18n();
const comId = ref('')
const codeFormSchema: FormSchema[] = [
@ -30,39 +30,49 @@
},
];
const columns: BasicColumn[] = [
{ title: t('合同号'), dataIndex: 'kNo', },
{ title: t('合同名称'), dataIndex: 'kName', },
{ title: t('供应商'), dataIndex: 'suName' ,},
{ title: '有效期开始',dataIndex: 'dateFrom', width: 120,},
{ title: '有效期结束',dataIndex: 'dateTo', width: 120},
{ title: t('合同主体'), dataIndex: 'comName', },
{ title: t('上载点'), dataIndex: 'pointUpName'},
];
const emit = defineEmits(['success', 'register']);
const { notification } = useMessage();
const isUpdate = ref(true);
const rowId = ref('');
const showTable = ref(false)
const selectedKeys = ref<string[]>([]);
const selectedValues = ref([]);
const props = defineProps({
selectType: { type: String, default: 'checkbox' },
pageType: String
});
let columns: BasicColumn[] = [
{ title: t('合同号'), dataIndex: 'kNo', },
{ title: t('合同名称'), dataIndex: 'kName', },
{ title: props.pageType == 'pur' ?'供应商' : '客户', dataIndex: props.pageType == 'pur'?'suName': 'cuName' ,},
{ title: '有效期开始',dataIndex: 'dateFrom', width: 120,},
{ title: '有效期结束',dataIndex: 'dateTo', width: 120},
{ title: t('合同主体'), dataIndex: 'comName', },
{ title: t('交割点'), dataIndex: 'pointDelyName'},
{ title: t('上载点'), dataIndex: 'pointUpName'},
{ title: t('计量单位'), dataIndex: 'uomName'},
];
if (props.pageType == 'sales') {
columns.splice(7, 1)
}
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
showTable.value = true
comId.value = data.comId
setModalProps({ confirmLoading: false });
setPagination({'limit': 1,'size': 10,'page': 1});
isUpdate.value = !!data?.isUpdate;
comId.value = data.comId
});
const [registerTable, { getDataSource, setTableData, updateTableDataRecord, reload }] = useTable({
const [registerTable, { getDataSource, setTableData, updateTableDataRecord, reload,setPagination }] = useTable({
title: t('管道气采购合同列表'),
api: getLngPriceContractPurPng,
api: props.pageType == 'pur' ? getLngPriceContractPurPng : getLngPriceContractSalesPng,
rowKey: 'id',
columns,
bordered: true,
@ -83,10 +93,15 @@
onChange: onSelectChange
},
});
const handleVisibleChange = (visible: boolean) => {
const handleVisibleChange = async (visible: boolean) => {
if (visible) {
showTable.value = false
await nextTick();
await nextTick();
await nextTick();
nextTick(() => {
reload();
reload({searchInfo:{'limit':1,'size':10,'page':1}});
});
}
};
@ -94,7 +109,7 @@
selectedKeys.value = rowKeys;
selectedValues.value = e
}
const getTitle = computed(() => (!unref(isUpdate) ? t('管道气采购合同列表') : t('')));
const getTitle = computed(() => (!unref(isUpdate) ? t(props.pageType == 'pur'?'管道气采购合同列表': '管道气销售合同列表') : t('')));
async function handleSubmit() {
if (!selectedValues.value.length) {

View File

@ -2,14 +2,14 @@
<Card :bordered="false" >
<template #title>
<div style="display: flex; align-items: center;">
<span style="margin-left: 8px;">供应价格信息</span>
<span style="margin-left: 8px;">{{pageType == 'pur' ? '供应价格信息' : '客户价格信息'}}</span>
<a-button type="primary" style="margin: 0 10px" @click="handleAdd" v-if="!isDisable">新增价格</a-button>
</div>
</template>
<div v-for="(item, idx) in dataListPrice" class="tbStyle">
<a-button type="primary" style="margin-bottom: 10px;" @click="handleDelete(idx)" v-if="!isDisable">删除</a-button>
<a-row>
<a-col :span="8">
<a-col :span="pageType=='pur'?8:16">
<a-form-item name="kName">
<template #label>
<span><span style="color:red">*</span>合同</span>
@ -22,19 +22,24 @@
<template #label>
<span><span style="color:red">*</span>价格生效年月</span>
</template>
<a-date-picker v-model:value="item.dateFrom" style="width: 100%" :disabled="isDisable" placeholder="请选择日期" />
<a-date-picker v-model:value="item.dateFrom" format="YYYY-MM-DD" :value-format="'YYYY-MM-DD'" style="width: 100%" :disabled="isDisable" placeholder="请选择日期" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-col :span="8" v-if="pageType=='pur'">
<a-form-item label="供应商" name="suName">
<a-input v-model:value="item.suName" style="width: 100%" disabled/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-col :span="8" v-if="pageType=='pur'">
<a-form-item label="上载点" name="pointUpName">
<a-input v-model:value="item.pointUpName" style="width: 100%" disabled />
</a-form-item>
</a-col>
<a-col :span="8" v-if="pageType=='sales'">
<a-form-item label="客户" name="cuName">
<a-input v-model:value="item.cuName" style="width: 100%" disabled/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="交割点" name="pointDelyName">
<a-input v-model:value="item.pointDelyName" style="width: 100%" disabled />
@ -66,7 +71,7 @@
</template>
<template #bodyCell="{ column, record, index }">
<template v-if="column.dataIndex === 'priceCode'">
<a-select v-model:value="record.priceCode" :disabled="isDisable" style="width: 100%" allow-clear @change="numCount(record, idx, 'rateQtyGj')">
<a-select v-model:value="record.priceCode" :disabled="isDisable" style="width: 100%" allow-clear @change="numCount(record, idx, 'priceCode')">
<a-select-option v-for="item in optionSelect.baseIncList" :key="item.code" :value="item.code">
{{ item.name }}
</a-select-option>
@ -97,7 +102,7 @@
</a-table>
</div>
</div>
<contractPurPngtListModal @register="registerPur" @success="handleSuccessPur" selectType="radio"/>
<contractPurPngtListModal @register="registerPur" @success="handleSuccessPur" selectType="radio" :pageType="pageType"/>
</Card>
</template>
<script lang="ts" setup>
@ -109,7 +114,14 @@
import { useModal } from '/@/components/Modal';
import { message } from 'ant-design-vue';
import contractPurPngtListModal from '/@/components/common/contractPurPngtListModal.vue';
const props = defineProps({
isDisable: Boolean,
list: Array,
formState: Object,
pageType: String,
rateCode: Number || String,
optionSelect: Object
});
const router = useRouter();
const { t } = useI18n();
const dataListPrice = ref([])
@ -120,33 +132,26 @@
{ title: t('优先级'), dataIndex: 'sort', width: 150},
{ title: t('数量(吉焦)'), dataIndex: 'rateQtyGj', width: 150},
{ title: t('数量(方)'), dataIndex: 'rateQtyM3', width: 150},
{ title: t('采购价格(元/方)'), dataIndex: 'priceGj', width: 150},
{ title: t('采购价格(元/吉焦)'), dataIndex: 'priceM3', width: 150},
{ title: props.pageType == 'pur' ? t('采购价格(元/吉焦)') : t('销售价格(元/吉焦)'), dataIndex: 'priceGj', width: 150},
{ title: props.pageType == 'pur' ? t('采购价格(元/方)') : t('销售价格(元/方)'), dataIndex: 'priceM3', width: 150},
{ title: t('备注'), dataIndex: 'note'},
{ title: t('操作'), dataIndex: 'operation', width: 80, fixed: 'right',align: 'center'},
]);
const [registerPur, { openModal:openModalPur}] = useModal();
const props = defineProps({
isDisable: Boolean,
list: Array,
formState: Object,
pageType: String,
rateCode: Number || String,
optionSelect: Object
});
const emit = defineEmits(['change']);
const numCount = (record, idx, k)=> {
let uomCode = dataListPrice.value[idx].uomCode
if (uomCode == 'GJ' && k == 'rateQtyGj') {
if (uomCode == 'GJ' && k == 'rateQtyGj' && record[k]) {
record.rateQtyM3 = record.rateM3Gj ? (Number(record.rateQtyGj || 0)/ Number(record.rateM3Gj)).toFixed(4) : ''
}
if (uomCode == 'GJ' && k == 'priceGj') {
if (uomCode == 'GJ' && k == 'priceGj' && record[k]) {
record.priceM3 = record.rateM3Gj ? (Number(record.priceGj || 0) / Number(record.rateM3Gj)).toFixed(4) : ''
}
if (uomCode == 'M3' && k == 'rateQtyM3') {
if (uomCode == 'M3' && k == 'rateQtyM3' && record[k]) {
record.rateQtyGj = (Number(record.rateQtyM3 || 0)*Number(record.rateM3Gj || 0)).toFixed(3)
}
if (uomCode == 'M3' && k == 'priceM3') {
if (uomCode == 'M3' && k == 'priceM3' && record[k]) {
record.priceGj = (Number(record.priceM3 || 0)*Number(record.rateM3Gj || 0)).toFixed(3)
}
updatePriceDesc(idx)
@ -202,8 +207,15 @@
const handleSuccessPur = (val) => {
dataListPrice.value[curIdx.value].kId = val[0].kId
dataListPrice.value[curIdx.value].kName = val[0].kName
dataListPrice.value[curIdx.value].suCode = val[0].suCode
dataListPrice.value[curIdx.value].suName = val[0].suName
if (props.pageType == 'pur') {
dataListPrice.value[curIdx.value].suCode = val[0].suCode
dataListPrice.value[curIdx.value].suName = val[0].suName
dataListPrice.value[curIdx.value].kpppsId = val[0].id
} else {
dataListPrice.value[curIdx.value].cuCode = val[0].cuCode
dataListPrice.value[curIdx.value].cuName = val[0].cuName
dataListPrice.value[curIdx.value].ksppId = val[0].id
}
dataListPrice.value[curIdx.value].kpppId = val[0].kpppId
dataListPrice.value[curIdx.value].pointUpCode = val[0].pointUpCode
@ -212,7 +224,7 @@
dataListPrice.value[curIdx.value].pointDelyName = val[0].pointDelyName
dataListPrice.value[curIdx.value].uomCode = val[0].uomCode
dataListPrice.value[curIdx.value].uomName = val[0].uomName
dataListPrice.value[curIdx.value].kpppsId = val[0].id
dataListPrice.value[curIdx.value].transSign = val[0].transSign
dataListPrice.value[curIdx.value].lngPricePurPngAppSuDtlList = []
dataListPrice.value[curIdx.value].priceDesc = ''
@ -234,7 +246,7 @@
}
);
watch(
() => props.disabled,
() => props.isDisable,
(val) => {
if (val) {
let idx2 = columnsPrice.value.findIndex(v =>v.dataIndex == 'operation')