入库优化
This commit is contained in:
142
src/components/common/contractPurLngListModal.vue
Normal file
142
src/components/common/contractPurLngListModal.vue
Normal file
@ -0,0 +1,142 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" width="60%" :title="getTitle" @ok="handleSubmit"
|
||||
@visible-change="handleVisibleChange" >
|
||||
<BasicTable @register="registerTable" class="contractPurLngListModal" v-if="showTable"></BasicTable>
|
||||
</BasicModal>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref, computed, unref, nextTick } from 'vue';
|
||||
import { BasicModal, useModalInner, useModal } from '/@/components/Modal';
|
||||
import { BasicForm, useForm } from '/@/components/Form/index';
|
||||
import { BasicTable, useTable, FormSchema, BasicColumn, TableAction } from '/@/components/Table';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { useI18n } from '/@/hooks/web/useI18n';
|
||||
import { getLngContractPage} from '/@/api/contract/ContractPurLng';
|
||||
import dayjs from 'dayjs';
|
||||
const { t } = useI18n();
|
||||
const codeFormSchema: FormSchema[] = [
|
||||
{
|
||||
field: 'dateFrom',
|
||||
label: '有效期',
|
||||
component: 'RangePicker',
|
||||
componentProps: {
|
||||
format: 'YYYY-MM-DD',
|
||||
style: { width: '100%' },
|
||||
getPopupContainer: () => document.body,
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'kName',
|
||||
label: '合同号/名称',
|
||||
component: 'Input',
|
||||
},
|
||||
];
|
||||
|
||||
const columns: BasicColumn[] = [
|
||||
{ title: t('合同号'), dataIndex: 'kNo', },
|
||||
{ title: t('合同名称'), dataIndex: 'kName', },
|
||||
{ title: t('供应商'), dataIndex: 'cpName', },
|
||||
{ title: t('有效期开始'), dataIndex: 'dateFrom'},
|
||||
{ title: t('有效期结束'), dataIndex: 'dateTo'},
|
||||
{ title: t('合同主体'), dataIndex: 'comName'},
|
||||
|
||||
];
|
||||
|
||||
const emit = defineEmits(['success', 'register']);
|
||||
|
||||
const { notification } = useMessage();
|
||||
const isUpdate = ref(true);
|
||||
const showTable = ref(false)
|
||||
const rowId = ref('');
|
||||
const selectedKeys = ref<string[]>([]);
|
||||
const selectedValues = ref([]);
|
||||
const props = defineProps({
|
||||
selectType: { type: String, default: 'radio' },
|
||||
|
||||
});
|
||||
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
showTable.value = true
|
||||
setModalProps({ confirmLoading: false });
|
||||
setPagination({'limit': 1,'size': 10,'page': 1});
|
||||
isUpdate.value = !!data?.isUpdate;
|
||||
});
|
||||
|
||||
const [registerTable, { getDataSource, setTableData, updateTableDataRecord, reload,setPagination }] = useTable({
|
||||
title: t('国内lng采购合同'),
|
||||
api: getLngContractPage,
|
||||
columns,
|
||||
|
||||
bordered: true,
|
||||
pagination: true,
|
||||
canResize: false,
|
||||
formConfig: {
|
||||
labelCol:{span: 9, offSet:10},
|
||||
schemas: codeFormSchema,
|
||||
fieldMapToTime: [['dateFrom', ['startDate', 'endDate'], 'YYYY-MM-DD']],
|
||||
showResetButton: true,
|
||||
},
|
||||
immediate: false, // 设置为不立即调用
|
||||
beforeFetch: (params) => {
|
||||
return { ...params,page:params.limit,approCode: 'YSP'};
|
||||
},
|
||||
rowSelection: {
|
||||
type: props.selectType,
|
||||
onChange: onSelectChange
|
||||
},
|
||||
});
|
||||
const handleVisibleChange = async (visible: boolean) => {
|
||||
if (visible) {
|
||||
showTable.value = false
|
||||
await nextTick();
|
||||
await nextTick();
|
||||
await nextTick();
|
||||
nextTick(() => {
|
||||
reload()
|
||||
});
|
||||
}
|
||||
};
|
||||
function onSelectChange(rowKeys: string[], e) {
|
||||
selectedKeys.value = rowKeys;
|
||||
selectedValues.value = e
|
||||
}
|
||||
const getTitle = ('国内LNG采购合同')
|
||||
|
||||
async function handleSubmit() {
|
||||
if (!selectedValues.value.length) {
|
||||
notification.warning({
|
||||
message: t('提示'),
|
||||
description: t('请选择合同')
|
||||
});
|
||||
return
|
||||
}
|
||||
closeModal();
|
||||
emit('success', selectedValues.value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
<style >
|
||||
.contractPurLngListModal .basicCol{
|
||||
position: inherit !important;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
</style>
|
||||
<style lang="less" scoped>
|
||||
:deep( .ant-col-8:nth-child(1)) {
|
||||
width: 360px !important;
|
||||
max-width: 360px !important;;
|
||||
}
|
||||
:deep(.ant-col-8:nth-child(1) .ant-form-item-label) {
|
||||
width: 80px !important;
|
||||
}
|
||||
</style>
|
||||
@ -17,7 +17,7 @@
|
||||
<a-row>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="交易主体" name="comId">
|
||||
<a-select v-model:value="formState.comId" :disabled="isDisable" placeholder="请选择" style="width: 100%" allow-clear>
|
||||
<a-select v-model:value="formState.comId" :disabled="isDisable || pageType" placeholder="请选择" style="width: 100%" allow-clear>
|
||||
<a-select-option v-for="item in optionSelect.comIdList" :key="item.value" :value="item.value">
|
||||
{{ item.label }}
|
||||
</a-select-option>
|
||||
@ -26,12 +26,12 @@
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="接收站" name="staName">
|
||||
<a-input-search v-model:value="formState.staName" :disabled="isDisable" placeholder="请选择接收站" readonly @search="onSearchStation"/>
|
||||
<a-input-search v-model:value="formState.staName" :disabled="isDisable || pageType" placeholder="请选择接收站" readonly @search="onSearchStation"/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="入库存类型" name="typeCode">
|
||||
<a-select v-model:value="formState.typeCode" :disabled="isDisable" placeholder="请选择" @change="typeCodeChange" style="width: 100%" allow-clear>
|
||||
<a-select v-model:value="formState.typeCode" :disabled="isDisable||pageType" placeholder="请选择" @change="typeCodeChange" style="width: 100%" allow-clear>
|
||||
<a-select-option v-for="item in optionSelect.typeCodeList" :key="item.code" :value="item.code">
|
||||
{{ item.name }}
|
||||
</a-select-option>
|
||||
@ -40,12 +40,12 @@
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="船期编号" name="ssNo">
|
||||
<a-input-search v-model:value="formState.ssNo" :disabled="Boolean(isDisable || pageType ) " placeholder="请选择" readonly @search="onSearchShip"/>
|
||||
<a-input-search v-model:value="formState.ssNo" :disabled="Boolean(isDisable||pageType||formState.typeCode!=='CQ' ) " placeholder="请选择" readonly @search="onSearchShip"/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="采购合同" name="kName">
|
||||
<a-input-search v-model:value="formState.kName" :disabled="isDisable" placeholder="请选择合同" readonly @search="onContract"/>
|
||||
<a-input-search v-model:value="formState.kName" :disabled="isDisable||formState.typeCode=='CQ'||formState.dataSource" placeholder="请选择合同" readonly @search="onContract"/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
@ -55,7 +55,7 @@
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="入库" name="dateIn">
|
||||
<a-date-picker :inputReadOnly="true" v-model:value="formState.dateIn" style="width: 100%" :disabled="isDisable" placeholder="请选择日期" />
|
||||
<a-date-picker :inputReadOnly="true" v-model:value="formState.dateIn" style="width: 100%" :disabled="isDisable||formState.dataSource" placeholder="请选择日期" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
@ -64,27 +64,27 @@
|
||||
<a-row>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="卸港热值(MMBtu)" name="qtyUnloadMmbtu">
|
||||
<input-number v-model:value="formState.qtyUnloadMmbtu" :disabled="isDisable" :digits="3" :min="0" @change="numCount('qtyUnloadMmbtu')" style="width: 100%" />
|
||||
<input-number v-model:value="formState.qtyUnloadMmbtu" :disabled="isDisable||formState.dataSource" :digits="3" :min="0" @change="numCount('qtyUnloadMmbtu')" style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="卸港热值(吉焦)" name="qtyUnloadGj">
|
||||
<input-number v-model:value="formState.qtyUnloadGj" :disabled="isDisable" :digits="3" :min="0" @change="numCount('qtyUnloadGj')" style="width: 100%" />
|
||||
<input-number v-model:value="formState.qtyUnloadGj" :disabled="isDisable||formState.dataSource" :digits="3" :min="0" @change="numCount('qtyUnloadGj')" style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="卸港重量(吨)" name="qtyUnloadTon">
|
||||
<input-number v-model:value="formState.qtyUnloadTon" :disabled="isDisable" :digits="3" :min="0" @change="numCount('qtyUnloadTon')" style="width: 100%" />
|
||||
<input-number v-model:value="formState.qtyUnloadTon" :disabled="isDisable||formState.dataSource" :digits="3" :min="0" @change="numCount('qtyUnloadTon')" style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="卸港体积(标方)" name="qtyUnloadM3L">
|
||||
<input-number v-model:value="formState.qtyUnloadM3L" :disabled="isDisable" :digits="3" :min="0" @change="numCount('qtyUnloadM3L')" style="width: 100%" />
|
||||
<input-number v-model:value="formState.qtyUnloadM3L" :disabled="isDisable||formState.dataSource" :digits="3" :min="0" @change="numCount('qtyUnloadM3L')" style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="卸港体积(方)" name="qtyUnloadM3">
|
||||
<input-number v-model:value="formState.qtyUnloadM3" :disabled="isDisable" :digits="3" :min="0" @change="numCount('qtyUnloadM3')" style="width: 100%" />
|
||||
<input-number v-model:value="formState.qtyUnloadM3" :disabled="isDisable||formState.dataSource" :digits="3" :min="0" @change="numCount('qtyUnloadM3')" style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
@ -150,8 +150,8 @@
|
||||
<Card title="" :bordered="false" >
|
||||
<a-row>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="结算币种" name="curCode">
|
||||
<a-select v-model:value="formState.curCode" :disabled="isDisable" placeholder="请选择币种" style="width: 100%" allow-clear>
|
||||
<a-form-item label="结算币种" name="currCode">
|
||||
<a-select v-model:value="formState.currCode" :disabled="isDisable||formState.opsId" placeholder="请选择币种" style="width: 100%" allow-clear>
|
||||
<a-select-option v-for="item in optionSelect.curCodeList" :key="item.code" :value="item.code">
|
||||
{{ item.fullName }}
|
||||
</a-select-option>
|
||||
@ -202,7 +202,7 @@
|
||||
</Card>
|
||||
</a-form>
|
||||
</div>
|
||||
<contractPurIntListModal @register="registerContractPurInt" @success="handleSuccessContractPurInt" selectType="radio" pageType="pur"/>
|
||||
<contractPurLngListModal @register="registerContractPurLng" @success="handleSuccessContractPurLng"/>
|
||||
<lngStationModal @register="registerStation" @success="handleSuccessStation"/>
|
||||
<OpsPurIntListModal @register="registerShip" @success="handleSuccessShip" :defaultDateType="true"/>
|
||||
</a-spin>
|
||||
@ -227,7 +227,7 @@
|
||||
import { getAppEnvConfig } from '/@/utils/env';
|
||||
import { message } from 'ant-design-vue';
|
||||
import UploadList from '/@/components/Form/src/components/UploadList.vue';
|
||||
import contractPurIntListModal from '../../../../components/common/contractPurIntListModal.vue';
|
||||
import contractPurLngListModal from '/@/components/common/contractPurLngListModal.vue';
|
||||
import lngStationModal from '/@/components/common/lngStationModal.vue';
|
||||
import { getAllCom} from '/@/api/contract/ContractPurInt';
|
||||
import OpsPurIntListModal from '/@/components/common/OpsPurIntListModal.vue';
|
||||
@ -267,15 +267,13 @@
|
||||
catCode: 'LNG'
|
||||
});
|
||||
const [register, { openModal:openModal}] = useModal();
|
||||
const [registerContractPurInt, { openModal:openModalContractPurInt}] = useModal();
|
||||
const [registerContractPurLng, { openModal:openModalContractPurLng}] = useModal();
|
||||
const [registerStation, { openModal:openModalStation}] = useModal();
|
||||
const [registerPort, { openModal:openModalPort}] = useModal();
|
||||
const [registerShip, { openModal:openModalShip}] = useModal();
|
||||
|
||||
const rules= reactive({
|
||||
comId: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
ssTypeCode: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
suName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
typeCode: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
kName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
staName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
@ -287,9 +285,6 @@
|
||||
qtyLostMmbtu: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
qtyLostGj: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
qtyLostTon: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
// qtyMmbtu: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
// qtyGj: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
// qtyTon: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
});
|
||||
const layout = {
|
||||
labelCol: { span: 8 },
|
||||
@ -340,7 +335,7 @@
|
||||
spinning.value = false
|
||||
Object.assign(formState, {...data})
|
||||
Object.assign(dataFile.value, formState.lngFileUploadList || [])
|
||||
formState.dateNor = formState.dateNor ? dayjs(formState.dateNor) : null
|
||||
formState.dateIn = formState.dateIn ? dayjs(formState.dateIn) : null
|
||||
getOptionParams()
|
||||
|
||||
|
||||
@ -361,14 +356,20 @@
|
||||
|
||||
}
|
||||
async function getOptionParams() {
|
||||
optionSelect.curCodeList = await getAllCurrency({eid: formState.curCode})
|
||||
optionSelect.curCodeList = await getAllCurrency({eid: formState.currCode})
|
||||
}
|
||||
const typeCodeChange = (val) => {
|
||||
if (val == 'ZN') {
|
||||
formState.opsId = ''
|
||||
formState.ssId = ''
|
||||
formState.ssNo = ''
|
||||
formState.kId = ''
|
||||
formState.kName = ''
|
||||
formState.suCode = ''
|
||||
formState.suName = ''
|
||||
rules.kName = [{ required: true, message: "该项为必填项", trigger: 'change' }]
|
||||
} else {
|
||||
rules.kName = [{ required: false, message: "该项为必填项", trigger: 'change' }]
|
||||
}
|
||||
}
|
||||
const numCount = (k) => {
|
||||
@ -393,16 +394,14 @@
|
||||
}
|
||||
|
||||
const onSearchShip = () => {
|
||||
if (formState.typeCode == 'CQ') {
|
||||
openModalShip(true,{isUpdate: false})
|
||||
}
|
||||
}
|
||||
const onSearchStation = (val)=> {
|
||||
openModalStation(true,{isUpdate: false})
|
||||
}
|
||||
|
||||
const onContract = (val)=> {
|
||||
openModalContractPurInt(true,{isUpdate: false})
|
||||
openModalContractPurLng(true,{isUpdate: false})
|
||||
}
|
||||
|
||||
const handleSuccessStation = (val) => {
|
||||
@ -419,7 +418,7 @@
|
||||
try {
|
||||
spinning.value = true
|
||||
let data = await getLngOpsPurInt(id)
|
||||
let res = await getLngInventoryInShip(id)
|
||||
let res = await getLngInventoryInShip(id) || []
|
||||
spinning.value = false
|
||||
formState.ssNo = data.ssNo
|
||||
formState.opsId = data.id
|
||||
@ -433,11 +432,16 @@
|
||||
formState.suName = data.suName
|
||||
|
||||
formState.dateIn = data.dateEta ? dayjs(data.dateEta) : null
|
||||
formState.curCode = data.curCode
|
||||
formState.currCode = data.curCode
|
||||
formState.priceMmbtu = data.priceCurr
|
||||
formState.amountCurr = data.amountCurr
|
||||
formState.rateExPur = data.rateEx
|
||||
|
||||
formState.qtyUnloadMmbtu = res[0]?.qtyMmbtu
|
||||
formState.qtyUnloadTon = res[0]?.qtyTon
|
||||
formState.qtyUnloadM3L = res[0]?.qtyM3L
|
||||
formState.qtyUnloadM3 = res[0]?.qtyM3
|
||||
formState.qtyUnloadGj = res[0]?.qtyGj
|
||||
|
||||
numCount()
|
||||
|
||||
@ -448,15 +452,12 @@
|
||||
spinning.value = false
|
||||
}
|
||||
}
|
||||
const handleSuccessContractPurInt = (val) => {
|
||||
const handleSuccessContractPurLng = (val) => {
|
||||
formState.kId = val[0].id
|
||||
formState.kName = val[0].kName
|
||||
formState.comId = val[0].comId
|
||||
formState.suCode = val[0].suCode
|
||||
formState.suName = val[0].suSname
|
||||
formState.longSpotCode = val[0].longSpotCode
|
||||
formState.prcTermCode = val[0].prcTermCode
|
||||
formState.sourceName = val[0].sourceName
|
||||
}
|
||||
function close() {
|
||||
tabStore.closeTab(currentRoute.value, router);
|
||||
|
||||
@ -192,12 +192,12 @@
|
||||
function handleEdit(record: Recordable) {
|
||||
|
||||
router.push({
|
||||
path: '/form/LngInventoryIn/' + record.id + '/updateForm',
|
||||
path: '/inventory/LngInventoryIn/createForm',
|
||||
query: {
|
||||
formPath: 'inventory/LngInventoryIn',
|
||||
formName: formName,
|
||||
formName: '编辑'+formName,
|
||||
formId:currentRoute.value.meta.formId,
|
||||
type: 'view',
|
||||
type: 'edit',
|
||||
id: record.id
|
||||
}
|
||||
});
|
||||
@ -216,7 +216,7 @@
|
||||
deleteLngInventoryIn(ids).then((_) => {
|
||||
handleSuccess();
|
||||
notification.success({
|
||||
message: 'Tip',
|
||||
message: '提示',
|
||||
description: t('删除成功!'),
|
||||
});
|
||||
});
|
||||
@ -268,27 +268,28 @@
|
||||
}
|
||||
});
|
||||
function getActions(record: Recordable):ActionItem[] {
|
||||
|
||||
const actionsList: ActionItem[] = actionButtonConfig.value?.map((button) => {
|
||||
if (!record.workflowData?.processId) {
|
||||
return {
|
||||
let actionsList: ActionItem[] = []
|
||||
let editAndDelBtn: ActionItem[] = []
|
||||
actionButtonConfig.value?.map((button) => {
|
||||
if (['view', 'copyData', 'datalog'].includes(button.code)) {
|
||||
actionsList.push({
|
||||
icon: button?.icon,
|
||||
tooltip: button?.name,
|
||||
onClick: btnEvent[button.code].bind(null, record),
|
||||
});
|
||||
}
|
||||
if (['edit', 'delete'].includes(button.code)) {
|
||||
editAndDelBtn.push({
|
||||
icon: button?.icon,
|
||||
tooltip: button?.name,
|
||||
color: button.code === 'delete' ? 'error' : undefined,
|
||||
onClick: btnEvent[button.code].bind(null, record),
|
||||
};
|
||||
} else {
|
||||
if (button.code === 'view') {
|
||||
return {
|
||||
icon: button?.icon,
|
||||
tooltip: button?.name,
|
||||
onClick: btnEvent[button.code].bind(null, record),
|
||||
};
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
if (!record.dataSource) {
|
||||
actionsList = actionsList.concat(editAndDelBtn);
|
||||
}
|
||||
return actionsList;
|
||||
}
|
||||
async function mergeCustomListRenderConfig(){
|
||||
|
||||
Reference in New Issue
Block a user