出库
This commit is contained in:
@ -3,7 +3,8 @@ import { defHttp } from '/@/utils/http/axios';
|
||||
import { ErrorMessageMode } from '/#/axios';
|
||||
|
||||
enum Api {
|
||||
Page = '/inventory/lngInventoryOut/page',
|
||||
// Page = '/inventory/lngInventoryOut/page',
|
||||
Page = '/magic-api/inventory/inventoryOutPageList',
|
||||
List = '/inventory/lngInventoryOut/list',
|
||||
Info = '/inventory/lngInventoryOut/info',
|
||||
LngInventoryOut = '/inventory/lngInventoryOut',
|
||||
|
||||
142
src/components/common/contractSalesLngListModal.vue
Normal file
142
src/components/common/contractSalesLngListModal.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/ContractSalesLng';
|
||||
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>
|
||||
@ -374,6 +374,14 @@ export const PAGE_CUSTOM_ROUTE: AppRouteRecordRaw[] = [{
|
||||
title: (route) => (route.query.formName)
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/inventory/LngInventoryOut/createForm',
|
||||
name: 'LngInventoryOut',
|
||||
component: () => import('/@/views/inventory/LngInventoryOut/components/createForm.vue'),
|
||||
meta: {
|
||||
title: (route) => (route.query.formName)
|
||||
}
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
|
||||
@ -49,7 +49,7 @@ export const columns: BasicColumn[] = [
|
||||
title: '入库类型',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
|
||||
width: 120,
|
||||
sorter: true,
|
||||
},
|
||||
{
|
||||
@ -57,7 +57,7 @@ export const columns: BasicColumn[] = [
|
||||
title: '船期编号',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
|
||||
width: 120,
|
||||
sorter: true,
|
||||
},
|
||||
{
|
||||
@ -65,7 +65,7 @@ export const columns: BasicColumn[] = [
|
||||
title: '接收站',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
|
||||
width: 120,
|
||||
sorter: true,
|
||||
},
|
||||
|
||||
@ -74,7 +74,7 @@ export const columns: BasicColumn[] = [
|
||||
title: '入库日期',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
|
||||
width: 120,
|
||||
sorter: true,
|
||||
},
|
||||
|
||||
@ -83,7 +83,7 @@ export const columns: BasicColumn[] = [
|
||||
title: '入库热值(MMBtu)',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
|
||||
width: 130,
|
||||
sorter: true,
|
||||
},
|
||||
|
||||
@ -92,7 +92,7 @@ export const columns: BasicColumn[] = [
|
||||
title: '入库重量(吨)',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
|
||||
width: 120,
|
||||
sorter: true,
|
||||
},
|
||||
|
||||
@ -101,7 +101,7 @@ export const columns: BasicColumn[] = [
|
||||
title: '入库体积(标方)',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
|
||||
width: 130,
|
||||
sorter: true,
|
||||
},
|
||||
|
||||
@ -110,7 +110,7 @@ export const columns: BasicColumn[] = [
|
||||
title: '入库体积(方)',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
|
||||
width: 120,
|
||||
sorter: true,
|
||||
},
|
||||
|
||||
@ -119,7 +119,7 @@ export const columns: BasicColumn[] = [
|
||||
title: '入库热值(吉焦)',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
|
||||
width: 130,
|
||||
sorter: true,
|
||||
},
|
||||
{
|
||||
@ -127,7 +127,7 @@ export const columns: BasicColumn[] = [
|
||||
title: '合同',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
|
||||
width: 180,
|
||||
sorter: true,
|
||||
},
|
||||
{
|
||||
@ -135,7 +135,7 @@ export const columns: BasicColumn[] = [
|
||||
title: '供应商',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
|
||||
width: 180,
|
||||
sorter: true,
|
||||
},
|
||||
{
|
||||
@ -143,7 +143,7 @@ export const columns: BasicColumn[] = [
|
||||
title: '公司',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
|
||||
width: 120,
|
||||
sorter: true,
|
||||
},
|
||||
];
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
<Card title="基础信息" :bordered="false" >
|
||||
<a-row>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="交易主体" name="comId">
|
||||
<a-form-item label="公司" name="comId">
|
||||
<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 }}
|
||||
@ -30,7 +30,7 @@
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="入库存类型" name="typeCode">
|
||||
<a-form-item label="入库类型" name="typeCode">
|
||||
<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 }}
|
||||
@ -54,7 +54,7 @@
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="入库" name="dateIn">
|
||||
<a-form-item label="入库日期" name="dateIn">
|
||||
<a-date-picker :inputReadOnly="true" v-model:value="formState.dateIn" style="width: 100%" :disabled="isDisable||formState.dataSource" placeholder="请选择日期" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
@ -344,7 +344,6 @@
|
||||
}
|
||||
}
|
||||
async function getOption() {
|
||||
optionSelect.approCodeList = await getDictionary('LNG_APPRO')
|
||||
optionSelect.typeCodeList = await getDictionary('LNG_INV_I')
|
||||
let res = await getAllCom() || []
|
||||
optionSelect.comIdList = res.map(v=> {
|
||||
@ -443,11 +442,7 @@
|
||||
formState.qtyUnloadM3 = res[0]?.qtyM3
|
||||
formState.qtyUnloadGj = res[0]?.qtyGj
|
||||
|
||||
numCount()
|
||||
|
||||
if (pageSource.value) {
|
||||
getOptionParams()
|
||||
}
|
||||
numCount('')
|
||||
} catch (error) {
|
||||
spinning.value = false
|
||||
}
|
||||
|
||||
@ -48,7 +48,7 @@ export const columns: BasicColumn[] = [
|
||||
title: '出库类型',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
|
||||
width: 120,
|
||||
sorter: true,
|
||||
},
|
||||
|
||||
@ -57,7 +57,7 @@ export const columns: BasicColumn[] = [
|
||||
title: '接收站',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
|
||||
width: 150,
|
||||
sorter: true,
|
||||
},
|
||||
|
||||
@ -66,7 +66,7 @@ export const columns: BasicColumn[] = [
|
||||
title: '出库日期',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
|
||||
width: 120,
|
||||
sorter: true,
|
||||
},
|
||||
|
||||
@ -75,7 +75,7 @@ export const columns: BasicColumn[] = [
|
||||
title: '出库量(吉焦)',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
|
||||
width: 120,
|
||||
sorter: true,
|
||||
},
|
||||
|
||||
@ -84,16 +84,7 @@ export const columns: BasicColumn[] = [
|
||||
title: '出库量(吨)',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
|
||||
sorter: true,
|
||||
},
|
||||
|
||||
{
|
||||
dataIndex: 'qtyM3',
|
||||
title: '出库量(方)',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
|
||||
width: 120,
|
||||
sorter: true,
|
||||
},
|
||||
|
||||
@ -102,7 +93,7 @@ export const columns: BasicColumn[] = [
|
||||
title: '出库金额',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
|
||||
width: 120,
|
||||
sorter: true,
|
||||
},
|
||||
{
|
||||
@ -110,7 +101,7 @@ export const columns: BasicColumn[] = [
|
||||
title: '销售合同',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
|
||||
width: 180,
|
||||
sorter: true,
|
||||
},
|
||||
{
|
||||
@ -118,7 +109,7 @@ export const columns: BasicColumn[] = [
|
||||
title: '客户名称',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
|
||||
width: 150,
|
||||
sorter: true,
|
||||
},
|
||||
{
|
||||
@ -126,7 +117,7 @@ export const columns: BasicColumn[] = [
|
||||
title: '公司名称',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
|
||||
width: 120,
|
||||
sorter: true,
|
||||
},
|
||||
];
|
||||
|
||||
399
src/views/inventory/LngInventoryOut/components/createForm.vue
Normal file
399
src/views/inventory/LngInventoryOut/components/createForm.vue
Normal file
@ -0,0 +1,399 @@
|
||||
<template>
|
||||
<a-spin :spinning="spinning" tip="加载中...">
|
||||
|
||||
<div class="page-bg-wrap formViewStyle pdcss">
|
||||
<div class="top-toolbar" >
|
||||
<a-button style="margin-right: 10px" @click="close">
|
||||
<slot name="icon"><close-outlined /></slot>关闭
|
||||
</a-button>
|
||||
<template v-if="pageType!=='view'">
|
||||
<a-button style="margin-right: 10px" type="primary" @click="handleSubmit">
|
||||
<slot name="icon"><save-outlined /></slot>保存
|
||||
</a-button>
|
||||
</template>
|
||||
</div>
|
||||
<a-form ref="formRef" :model="formState" :rules="rules" v-bind="layout">
|
||||
<Card title="基础信息" :bordered="false" >
|
||||
<a-row>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="公司" name="comId">
|
||||
<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>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="接收站" name="staName">
|
||||
<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||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>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="出库日期" name="dateOut">
|
||||
<a-date-picker :inputReadOnly="true" v-model:value="formState.dateOut" style="width: 100%" :disabled="isDisable" placeholder="请选择日期" />
|
||||
</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||formState.typeCode=='CQ'||pageType" placeholder="请选择合同" readonly @search="onContract"/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="客户" name="cuName">
|
||||
<a-input-search v-model:value="formState.cuName" disabled/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="主计量单位" name="uomCode">
|
||||
<a-select v-model:value="formState.uomCode" :disabled="isDisable" placeholder="请选择" @change="uomCodeChage" 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>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="比值(吨/吉焦)" name="rateTonGj">
|
||||
<input-number v-model:value="formState.rateTonGj" :disabled="isDisable" :min="0" @blur="numCount" style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="比值(方/吉焦)" name="rateM3Gj">
|
||||
<input-number v-model:value="formState.rateM3Gj" :disabled="isDisable" :min="0" @blur="numCount" style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="出库量(吉焦)" name="qtyGj">
|
||||
<input-number v-model:value="formState.qtyGj" :disabled="isDisable" :digits="3" :min="0" @blur="numCount" style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="出库量(吨)" name="qtyTon">
|
||||
<input-number v-model:value="formState.qtyTon" :disabled="isDisable" :digits="3" :min="0" @blur="numCount" style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="出库价格(元/吉焦)" name="priceGj">
|
||||
<input-number v-model:value="formState.priceGj" :disabled="isDisable" :min="0" @blur="numCount" style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="出库价格(元/吨)" name="priceTon">
|
||||
<input-number v-model:value="formState.priceTon" :disabled="isDisable" :min="0" @blur="numCount" style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="出库金额(元)" name="amount">
|
||||
<input-number v-model:value="formState.amount" :disabled="isDisable" :digits="2" :min="0" @blur="amountCount" style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="备注" name="note" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
|
||||
<a-textarea v-model:value="formState.note" :disabled="isDisable" :maxLength="200" placeholder="请输入内容,最多200字" :auto-size="{ minRows: 2, maxRows: 5 }"/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</Card>
|
||||
<Card title="附件信息" :bordered="false" >
|
||||
<UploadList :disabled="isDisable" :list="dataFile" :value="formState.filePath" :tableName="tableName" :columnName="columnName" @blur="uploadListChange"/>
|
||||
</Card>
|
||||
</a-form>
|
||||
</div>
|
||||
<contractSalesLngListModal @register="registerContractSalesLng" @success="handleSuccessContractSalesLng"/>
|
||||
<lngStationModal @register="registerStation" @success="handleSuccessStation"/>
|
||||
</a-spin>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { Card } from 'ant-design-vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { FromPageType, RecordType } from '/@/enums/workflowEnum';
|
||||
import { ref, computed, onMounted, onBeforeMount, nextTick, defineAsyncComponent, reactive, defineComponent, watch} from 'vue';
|
||||
import { SendOutlined, SaveOutlined, CloseOutlined, } from '@ant-design/icons-vue';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { useI18n } from '/@/hooks/web/useI18n';
|
||||
import { useMultipleTabStore } from '/@/store/modules/multipleTab';
|
||||
import useEventBus from '/@/hooks/event/useEventBus';
|
||||
import type { Rule } from 'ant-design-vue/es/form';
|
||||
import { getDictionary } from '/@/api/sales/Customer';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { addLngInventoryOut,updateLngInventoryOut, getLngInventoryOut,} from '/@/api/inventory/lngInventoryOut';
|
||||
import dayjs from 'dayjs';
|
||||
import { getAppEnvConfig } from '/@/utils/env';
|
||||
import { message } from 'ant-design-vue';
|
||||
import UploadList from '/@/components/Form/src/components/UploadList.vue';
|
||||
import contractSalesLngListModal from '/@/components/common/contractSalesLngListModal.vue';
|
||||
import lngStationModal from '/@/components/common/lngStationModal.vue';
|
||||
import { getAllCom} from '/@/api/contract/ContractPurInt';
|
||||
import { getParameter } from '/@/api/contract/ContractProc';
|
||||
|
||||
const tableName = 'LngInventoryOut';
|
||||
const columnName = 'LngInventoryOut'
|
||||
|
||||
const formType = ref('2'); // 0 新建 1 修改 2 查看
|
||||
const formRef = ref();
|
||||
const props = defineProps({
|
||||
disabled: false,
|
||||
id: ''
|
||||
|
||||
});
|
||||
const { bus, FORM_LIST_MODIFIED } = useEventBus();
|
||||
|
||||
const router = useRouter();
|
||||
const { currentRoute } = router;
|
||||
const isDisable = ref(false);
|
||||
const { formPath } = currentRoute.value.query;
|
||||
const pathArr = [];
|
||||
|
||||
const tabStore = useMultipleTabStore();
|
||||
const formProps = ref(null);
|
||||
const formId = ref(currentRoute.value?.params?.id);
|
||||
const pageType = ref(currentRoute.value.query?.type);
|
||||
const pageId = ref(currentRoute.value.query?.id)
|
||||
const pageSource = ref(currentRoute.value.query?.pageSource)
|
||||
const spinning = ref(false);
|
||||
const { notification } = useMessage();
|
||||
const { t } = useI18n()
|
||||
|
||||
const formState = reactive({
|
||||
approCode: 'WTJ',
|
||||
typeCode: 'ZN',
|
||||
catCode: 'LNG'
|
||||
});
|
||||
const [register, { openModal:openModal}] = useModal();
|
||||
const [registerContractSalesLng, { openModal:openModalContractSalesLng}] = useModal();
|
||||
const [registerStation, { openModal:openModalStation}] = useModal();
|
||||
|
||||
const rules= reactive({
|
||||
comId: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
ssTypeCode: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
typeCode: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
kName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
staName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
dateOut: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
uomCode: [{ required: true, message: "该项为必填项", trigger: 'change' }]
|
||||
});
|
||||
const layout = {
|
||||
labelCol: { span: 8 },
|
||||
wrapperCol: { span: 16 },
|
||||
}
|
||||
const dataFile = ref([]);
|
||||
let optionSelect= reactive({
|
||||
comIdList: [],
|
||||
typeCodeList: [],
|
||||
uomCodeList: [],
|
||||
});
|
||||
watch(
|
||||
() => props.id,
|
||||
(val) => {
|
||||
if (val) {
|
||||
getInfo(val)
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true
|
||||
}
|
||||
);
|
||||
watch(
|
||||
() => props.disabled,
|
||||
(val) => {
|
||||
isDisable.value = val
|
||||
},
|
||||
{
|
||||
immediate: true
|
||||
}
|
||||
);
|
||||
onMounted(() => {
|
||||
isDisable.value = pageType.value == 'view'
|
||||
getOption()
|
||||
if (pageId.value) {
|
||||
getInfo(pageId.value)
|
||||
} else {
|
||||
getSysRate()
|
||||
}
|
||||
});
|
||||
async function getSysRate () {
|
||||
let a = await getParameter({code: 'RATE_TON_GJ'})||[]
|
||||
let b = await getParameter({code: 'RATE_M3_GJ'})||[]
|
||||
formState.rateTonGj = a[0]?.valueNum1
|
||||
formState.rateM3Gj = b[0]?.valueNum1
|
||||
}
|
||||
const uploadListChange = (val) => {
|
||||
dataFile.value = val
|
||||
}
|
||||
async function getInfo(id) {
|
||||
spinning.value = true
|
||||
try {
|
||||
let data = await getLngInventoryOut(id)
|
||||
spinning.value = false
|
||||
Object.assign(formState, {...data})
|
||||
Object.assign(dataFile.value, formState.lngFileUploadList || [])
|
||||
formState.dateOut = formState.dateOut ? dayjs(formState.dateOut) : null
|
||||
|
||||
|
||||
} catch (error) {
|
||||
spinning.value = false
|
||||
}
|
||||
}
|
||||
async function getOption() {
|
||||
optionSelect.uomCodeList = await getDictionary('LNG_UOM')
|
||||
optionSelect.typeCodeList = await getDictionary('LNG_INV_I')
|
||||
let res = await getAllCom() || []
|
||||
optionSelect.comIdList = res.map(v=> {
|
||||
return {
|
||||
label: v.shortName,
|
||||
value: v.id
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
const typeCodeChange = (val) => {
|
||||
if (val !== 'ZN') {
|
||||
formState.kId = ''
|
||||
formState.kName = ''
|
||||
formState.cuCode = ''
|
||||
formState.cuName = ''
|
||||
rules.kName = [{ required: false, message: "该项为必填项", trigger: 'change' }]
|
||||
} else {
|
||||
rules.kName = [{ required: true, message: "该项为必填项", trigger: 'change' }]
|
||||
}
|
||||
|
||||
}
|
||||
const uomCodeChage = () => {
|
||||
numCount()
|
||||
}
|
||||
const numCount = () => {
|
||||
|
||||
if (formState.uomCode == 'GJ') {
|
||||
if (!formState.qtyTon) {
|
||||
formState.qtyTon = Number(formState.rateTonGj) ? Number(formState.qtyGj || 0)/Number(formState.rateTonGj) : 0
|
||||
amountCount()
|
||||
}
|
||||
if (!formState.amount) {
|
||||
formState.amount = Number(formState.qtyGj || 0)*Number(formState.priceGj || 0)
|
||||
amountCount()
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (formState.uomCode == 'TON') {
|
||||
if (!formState.qtyGj) {
|
||||
formState.qtyGj = Number(formState.qtyTon || 0)*Number(formState.rateTonGj || 0)
|
||||
amountCount()
|
||||
}
|
||||
if (!formState.amount) {
|
||||
formState.amount = Number(formState.qtyTon || 0)*Number(formState.priceTon || 0)
|
||||
amountCount()
|
||||
}
|
||||
}
|
||||
}
|
||||
const amountCount = () => {
|
||||
if (!formState.priceTon) {
|
||||
formState.priceTon = Number(formState.qtyTon) ? Number(formState.amount || 0)/Number(formState.qtyTon) : null
|
||||
}
|
||||
if (!formState.priceGj) {
|
||||
formState.priceGj = Number(formState.qtyGj) ? Number(formState.amount || 0)/Number(formState.qtyGj) : null
|
||||
}
|
||||
}
|
||||
const onSearchStation = (val)=> {
|
||||
openModalStation(true,{isUpdate: false})
|
||||
}
|
||||
|
||||
const onContract = (val)=> {
|
||||
openModalContractSalesLng(true,{isUpdate: false})
|
||||
}
|
||||
|
||||
const handleSuccessStation = (val) => {
|
||||
formState.staCode = val[0].code
|
||||
formState.staName = val[0].fullName
|
||||
}
|
||||
const handleSuccessContractSalesLng = (val) => {
|
||||
formState.kId = val[0].id
|
||||
formState.kName = val[0].kName
|
||||
formState.comId = val[0].comId
|
||||
formState.cuCode = val[0].cpCode
|
||||
formState.cuName = val[0].cpName
|
||||
}
|
||||
function close() {
|
||||
tabStore.closeTab(currentRoute.value, router);
|
||||
}
|
||||
async function getFormValue() {
|
||||
return formState
|
||||
}
|
||||
async function handleSubmit(type) {
|
||||
try {
|
||||
await formRef.value.validateFields();
|
||||
let obj = {
|
||||
...formState,
|
||||
lngFileUploadList: dataFile.value,
|
||||
}
|
||||
spinning.value = true;
|
||||
let request = !formState.id ? addLngInventoryOut :updateLngInventoryOut
|
||||
|
||||
try {
|
||||
const data = await request(obj);
|
||||
notification.success({
|
||||
message: '提示',
|
||||
description: data?.id ? t('新增成功!') : t('修改成功!')
|
||||
}); //提示消息
|
||||
|
||||
setTimeout(() => {
|
||||
bus.emit(FORM_LIST_MODIFIED, {});
|
||||
close();
|
||||
}, 500);
|
||||
|
||||
} finally {
|
||||
spinning.value = false;
|
||||
}
|
||||
|
||||
} catch (errorInfo) {
|
||||
spinning.value = false;
|
||||
errorInfo?.errorFields?.length && notification.warning({
|
||||
message: '提示',
|
||||
description: '请完善信息'
|
||||
});
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
handleSubmit,
|
||||
getFormValue
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
:deep(.ant-form-item .ant-form-item-label) {
|
||||
width: 135px !important;
|
||||
max-width: 135px !important;
|
||||
}
|
||||
.page-bg-wrap {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.top-toolbar {
|
||||
min-height: 44px;
|
||||
margin-bottom: 12px;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
.pdcss {
|
||||
padding:0px 12px 6px 12px !important;
|
||||
}
|
||||
:deep(.formItemWarp .ant-form-item-label > label) {
|
||||
white-space: normal !important;
|
||||
word-break: break-word !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
@ -29,9 +29,7 @@
|
||||
const logId = ref('')
|
||||
const logPath = ref('/inventory/lngInventoryOut/datalog');
|
||||
import { DataLog } from '/@/components/pcitc';
|
||||
import { ref, computed, onMounted, onUnmounted, createVNode,
|
||||
|
||||
} from 'vue';
|
||||
import { ref, computed, onMounted, onUnmounted, createVNode, watch} from 'vue';
|
||||
|
||||
import { Modal } from 'ant-design-vue';
|
||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||
@ -52,6 +50,7 @@
|
||||
import useEventBus from '/@/hooks/event/useEventBus';
|
||||
import { cloneDeep } from 'lodash-es';
|
||||
import { getAllCom} from '/@/api/contract/ContractPurInt';
|
||||
import { DataFormat, FormatOption, DATE_FORMAT, FormatType } from '/@/utils/dataFormat';
|
||||
|
||||
const { bus, CREATE_FLOW, FLOW_PROCESSED, FORM_LIST_MODIFIED } = useEventBus();
|
||||
|
||||
@ -83,7 +82,7 @@
|
||||
});
|
||||
|
||||
const btnEvent = {add : handleAdd,edit : handleEdit,refresh : handleRefresh,view : handleView,datalog : handleDatalog,delete : handleDelete,}
|
||||
|
||||
const tableData = ref([])
|
||||
const { currentRoute } = useRouter();
|
||||
const router = useRouter();
|
||||
const formIdComputedRef = ref();
|
||||
@ -92,7 +91,7 @@
|
||||
schemaIdComputedRef.value = currentRoute.value.meta.schemaId
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
const formName=currentRoute.value.meta?.title;
|
||||
const [registerTable, { reload, }] = useTable({
|
||||
const [registerTable, { reload, setTableData }] = useTable({
|
||||
title: '' || (formName + '列表'),
|
||||
api: getLngInventoryOutPage,
|
||||
rowKey: 'id',
|
||||
@ -109,6 +108,7 @@
|
||||
return { ...params, FormId: formIdComputedRef.value, PK: 'id',page:params.limit };
|
||||
},
|
||||
afterFetch: (res) => {
|
||||
tableData.value = res || []
|
||||
tableRef.value.setToolBarWidth();
|
||||
|
||||
},
|
||||
@ -128,41 +128,37 @@
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
watch(
|
||||
() => tableData.value,
|
||||
(val) => {
|
||||
if (val) {
|
||||
let arr = DataFormat.format(val, [
|
||||
FormatOption.createQty('qtyGj'),
|
||||
FormatOption.createQty('qtyTon'),
|
||||
FormatOption.createQty('qtyM3'),
|
||||
FormatOption.createAmt('amount'),
|
||||
]);
|
||||
if (arr.length) {
|
||||
setTableData(arr)
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
deep: true,
|
||||
}
|
||||
);
|
||||
function dbClickRow(record) {
|
||||
if (!actionButtonConfig?.value.some(element => element.code == 'view')) {
|
||||
return;
|
||||
}
|
||||
const { processId, taskIds, schemaId } = record.workflowData || {};
|
||||
if (taskIds && taskIds.length) {
|
||||
router.push({
|
||||
path: '/flow/' + schemaId + '/' + (processId || '') + '/approveFlow',
|
||||
query: {
|
||||
taskId: taskIds[0],
|
||||
formName: formName,
|
||||
formId:currentRoute.value.meta.formId
|
||||
}
|
||||
});
|
||||
} else if (schemaId && !taskIds && processId) {
|
||||
router.push({
|
||||
path: '/flow/' + schemaId + '/' + processId + '/approveFlow',
|
||||
query: {
|
||||
readonly: 1,
|
||||
taskId: '',
|
||||
formName: formName,
|
||||
formId:currentRoute.value.meta.formId
|
||||
}
|
||||
});
|
||||
} else {
|
||||
router.push({
|
||||
path: '/form/LngInventoryOut/' + record.id + '/viewForm',
|
||||
query: {
|
||||
router.push({
|
||||
path: '/inventory/LngInventoryOut/createForm',
|
||||
query: {
|
||||
formPath: 'inventory/LngInventoryOut',
|
||||
formName: formName,
|
||||
formId:currentRoute.value.meta.formId
|
||||
}
|
||||
});
|
||||
}
|
||||
formName: '查看'+formName,
|
||||
formId:currentRoute.value.meta.formId,
|
||||
type: 'view',
|
||||
id: record.id
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function buttonClick(code) {
|
||||
@ -181,10 +177,10 @@
|
||||
});
|
||||
} else {
|
||||
router.push({
|
||||
path: '/form/LngInventoryOut/0/createForm',
|
||||
path: '/inventory/LngInventoryOut/createForm',
|
||||
query: {
|
||||
formPath: 'inventory/LngInventoryOut',
|
||||
formName: formName,
|
||||
formName: '新建'+formName,
|
||||
formId:currentRoute.value.meta.formId
|
||||
}
|
||||
});
|
||||
@ -194,11 +190,13 @@
|
||||
function handleEdit(record: Recordable) {
|
||||
|
||||
router.push({
|
||||
path: '/form/LngInventoryOut/' + record.id + '/updateForm',
|
||||
path: '/inventory/LngInventoryOut/createForm',
|
||||
query: {
|
||||
formPath: 'inventory/LngInventoryOut',
|
||||
formName: formName,
|
||||
formId:currentRoute.value.meta.formId
|
||||
formName: '编辑'+formName,
|
||||
formId:currentRoute.value.meta.formId,
|
||||
type: 'edit',
|
||||
id: record.id
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -216,7 +214,7 @@
|
||||
deleteLngInventoryOut(ids).then((_) => {
|
||||
handleSuccess();
|
||||
notification.success({
|
||||
message: 'Tip',
|
||||
message: '提示',
|
||||
description: t('删除成功!'),
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user