年度计划接口
This commit is contained in:
@ -3,7 +3,8 @@ import { defHttp } from '/@/utils/http/axios';
|
|||||||
import { ErrorMessageMode } from '/#/axios';
|
import { ErrorMessageMode } from '/#/axios';
|
||||||
|
|
||||||
enum Api {
|
enum Api {
|
||||||
Page = '/plan/planYearDemandHdr/page',
|
// Page = '/plan/planYearDemandHdr/page',
|
||||||
|
Page = '/magic-api/plan/planYearDemandHdrPageList',
|
||||||
List = '/plan/planYearDemandHdr/list',
|
List = '/plan/planYearDemandHdr/list',
|
||||||
Info = '/plan/planYearDemandHdr/info',
|
Info = '/plan/planYearDemandHdr/info',
|
||||||
LngPlanYearDemandHdr = '/plan/planYearDemandHdr',
|
LngPlanYearDemandHdr = '/plan/planYearDemandHdr',
|
||||||
|
|||||||
@ -3,17 +3,65 @@ import { defHttp } from '/@/utils/http/axios';
|
|||||||
import { ErrorMessageMode } from '/#/axios';
|
import { ErrorMessageMode } from '/#/axios';
|
||||||
|
|
||||||
enum Api {
|
enum Api {
|
||||||
Page = '/plan/planYearDemandHdrEc/page',
|
// Page = '/plan/planYearDemandHdrEc/page',
|
||||||
|
Page = '/magic-api/plan/planYearDemandHdrEcPageList',
|
||||||
List = '/plan/planYearDemandHdrEc/list',
|
List = '/plan/planYearDemandHdrEc/list',
|
||||||
Info = '/plan/planYearDemandHdrEc/info',
|
Info = '/plan/planYearDemandHdrEc/info',
|
||||||
|
yearTip ='/magic-api/plan/planYearDemandHdrSelectDate',
|
||||||
LngPlanYearDemandHdr = '/plan/planYearDemandHdrEc',
|
LngPlanYearDemandHdr = '/plan/planYearDemandHdrEc',
|
||||||
|
save = '/plan/planYearDemandHdrEc/save',
|
||||||
|
saveAndSubmit = '/plan/planYearDemandHdrEc/saveAndSubmit',
|
||||||
|
toChange = '/plan/planYearDemandHdrEc/toChange',
|
||||||
|
|
||||||
|
|
||||||
Export = '/plan/planYearDemandHdrEc/export',
|
Export = '/plan/planYearDemandHdrEc/export',
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
export async function getUpdateLngPlanYearDemandHdr(id: String, mode: ErrorMessageMode = 'modal') {
|
||||||
|
return defHttp.get<LngPlanYearDemandHdrPageModel>(
|
||||||
|
{
|
||||||
|
url: Api.toChange,
|
||||||
|
params: { id },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
errorMessageMode: mode,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
export async function saveAndSubmitLngPlanYearDemandHdr(lngPlanYearDemandHdr: Recordable, mode: ErrorMessageMode = 'modal') {
|
||||||
|
return defHttp.post<boolean>(
|
||||||
|
{
|
||||||
|
url: Api.saveAndSubmit,
|
||||||
|
params: lngPlanYearDemandHdr,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
errorMessageMode: mode,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
export async function saveLngPlanYearDemandHdr(lngPlanYearDemandHdr: Recordable, mode: ErrorMessageMode = 'modal') {
|
||||||
|
return defHttp.post<boolean>(
|
||||||
|
{
|
||||||
|
url: Api.save,
|
||||||
|
params: lngPlanYearDemandHdr,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
errorMessageMode: mode,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
export async function getPlanYearTip( mode: ErrorMessageMode = 'modal') {
|
||||||
|
return defHttp.get<LngPlanYearDemandHdrPageModel>(
|
||||||
|
{
|
||||||
|
url: Api.yearTip,
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
errorMessageMode: mode,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* @description: 查询LngPlanYearDemandHdr分页列表
|
* @description: 查询LngPlanYearDemandHdr分页列表
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -414,6 +414,14 @@ export const PAGE_CUSTOM_ROUTE: AppRouteRecordRaw[] = [{
|
|||||||
title: (route) => (route.query.formName)
|
title: (route) => (route.query.formName)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/plan/PlanYearDemandHdr/createForm',
|
||||||
|
name: 'PlanYearDemandHdr',
|
||||||
|
component: () => import('/@/views/plan/PlanYearDemandHdr/components/createForm.vue'),
|
||||||
|
meta: {
|
||||||
|
title: (route) => (route.query.formName)
|
||||||
|
}
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
230
src/views/plan/PlanYearDemandHdr/components/createForm.vue
Normal file
230
src/views/plan/PlanYearDemandHdr/components/createForm.vue
Normal file
@ -0,0 +1,230 @@
|
|||||||
|
<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>
|
||||||
|
</div>
|
||||||
|
<a-form ref="formRef" :model="formState" v-bind="layout">
|
||||||
|
<Card title="" :bordered="false">
|
||||||
|
<a-row>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="年度" name="planYear">
|
||||||
|
{{ formState.planYear }}
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="版本号" name="demandVerNo">
|
||||||
|
{{ formState.demandVerNo }}
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="状态" name="approName">
|
||||||
|
{{ (optionSelect.approCodeList.find(v => v.code == formState.approCode) || {}).name }}
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="备注" name="note">
|
||||||
|
{{ formState.note }}
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="批复意见" name="reply">
|
||||||
|
{{ formState.reply }}
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
</Card>
|
||||||
|
<Card :bordered="false">
|
||||||
|
<template #title>
|
||||||
|
<div style="display: flex; align-items: center;">
|
||||||
|
<span style="margin-left: 8px;">年度需求明细</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<a-table style="width: 100%" :columns="columns" :data-source="dataList" :pagination="false">
|
||||||
|
<template #bodyCell="{ column, record, index }">
|
||||||
|
<template v-if="column.dataIndex === 'index'">
|
||||||
|
{{ index + 1 }}
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</a-table>
|
||||||
|
</Card>
|
||||||
|
</a-form>
|
||||||
|
</div>
|
||||||
|
</a-spin>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { Card } from 'ant-design-vue';
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
|
import { ref, onMounted, reactive } from 'vue';
|
||||||
|
import { 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 { getDictionary } from '/@/api/sales/Customer';
|
||||||
|
import { getLngPlanYearDemandHdr } from '/@/api/plan/PlanYearDemandHdr';
|
||||||
|
import { getParameter } from '/@/api/contract/ContractProc';
|
||||||
|
import { DataFormat, FormatOption } from '/@/utils/dataFormat';
|
||||||
|
import Index from '/@/views/sys/error-log/index.vue';
|
||||||
|
|
||||||
|
const formRef = ref();
|
||||||
|
const router = useRouter();
|
||||||
|
const { currentRoute } = router;
|
||||||
|
const tabStore = useMultipleTabStore();
|
||||||
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
const spinning = ref(false);
|
||||||
|
const pageId = ref(currentRoute.value.query?.id as string);
|
||||||
|
const dataList = ref<any[]>([]);
|
||||||
|
const rateTonM3 = ref();
|
||||||
|
|
||||||
|
const formState = reactive<Record<string, any>>({});
|
||||||
|
|
||||||
|
const layout = {
|
||||||
|
labelCol: { span: 8 },
|
||||||
|
wrapperCol: { span: 16 },
|
||||||
|
};
|
||||||
|
|
||||||
|
let optionSelect = reactive({
|
||||||
|
approCodeList: [] as any[],
|
||||||
|
});
|
||||||
|
|
||||||
|
const columns = ref([
|
||||||
|
{ title: t('序号'), dataIndex: 'index', key: 'index', width: 50 },
|
||||||
|
{ title: t('月份'), dataIndex: 'month', width: 80 },
|
||||||
|
{ title: t('管道气(万方)'), dataIndex: 'qty', width: 250 },
|
||||||
|
{ title: t('LNG(吨)'), dataIndex: 'lng', width: 250 },
|
||||||
|
{ title: t('LNG(万方)(气化率1400)'), dataIndex: 'lngNum' },
|
||||||
|
{ title: t('小计(万方)'), dataIndex: 'total' },
|
||||||
|
]);
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
await getSysRate();
|
||||||
|
await getOption();
|
||||||
|
if (pageId.value) {
|
||||||
|
await getInfo(pageId.value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
async function getSysRate() {
|
||||||
|
let a = (await getParameter({ code: 'RATE_TON_M3' })) || [];
|
||||||
|
rateTonM3.value = a[0]?.valueNum1;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getOption() {
|
||||||
|
optionSelect.approCodeList = await getDictionary('LNG_APPRO2');
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getInfo(id: string) {
|
||||||
|
spinning.value = true;
|
||||||
|
try {
|
||||||
|
const data = await getLngPlanYearDemandHdr(id);
|
||||||
|
Object.assign(formState, data);
|
||||||
|
let arr = data?.lngPlanYearDemandList || [];
|
||||||
|
let objPng = {}
|
||||||
|
let objLng = {}
|
||||||
|
arr.forEach(v=> {
|
||||||
|
if (v.catCode == 'PNG') {
|
||||||
|
objPng = {...v}
|
||||||
|
}
|
||||||
|
if (v.catCode == 'LNG') {
|
||||||
|
objLng = {...v}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
for(let k in objPng) {
|
||||||
|
if (k.includes('qty')) {
|
||||||
|
dataList.value.push({'qty': objPng[k]})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let lngkeys = []
|
||||||
|
for(let k in objLng) {
|
||||||
|
if (k.includes('qty')) {
|
||||||
|
lngkeys.push({lng: k, value : objLng[k]})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lngkeys.forEach((i,idx)=> {
|
||||||
|
dataList.value[idx].lng = i.value
|
||||||
|
})
|
||||||
|
let totalObj = {month: '合计'}
|
||||||
|
dataList.value.splice(12,0,totalObj)
|
||||||
|
dataList.value.forEach((v,idx)=> {
|
||||||
|
|
||||||
|
if (idx<12) {
|
||||||
|
v.month = (idx+1)+'月'
|
||||||
|
}
|
||||||
|
if (idx>12) {
|
||||||
|
let a = null
|
||||||
|
if (idx==13)a=1
|
||||||
|
if (idx==14)a=2
|
||||||
|
if (idx==15)a=3
|
||||||
|
v.month = '次年'+a+'月'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
setTimeout(() => {
|
||||||
|
numCount()
|
||||||
|
}, 100);
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
spinning.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const numCount = () => {
|
||||||
|
|
||||||
|
let qytTotal = 0
|
||||||
|
let lngTotal = 0
|
||||||
|
let lngNumTotal = 0
|
||||||
|
let subtotal= 0
|
||||||
|
let index = null
|
||||||
|
dataList.value.forEach((v, idx)=> {
|
||||||
|
// LNG(万方)=LNG(吨)*气化率/10000;
|
||||||
|
v.lngNum = Number(v.lng || 0) * Number(rateTonM3.value || 0)/10000
|
||||||
|
// v.lngNum = Number(v.lngNum) ? v.lngNum : ''
|
||||||
|
// 小计=管道气(万方)+LNG(万方);
|
||||||
|
v.total = Number(v.qty || 0) + Number(v.lngNum || 0)
|
||||||
|
// v.total = Number(v.total) ? v.total : ''
|
||||||
|
// console.log(Number(v.total), 52354)
|
||||||
|
if (idx<12) {
|
||||||
|
qytTotal+=(Number(v.qty)||0)
|
||||||
|
lngTotal+=(Number(v.lng)||0)
|
||||||
|
lngNumTotal+=(Number(v.lngNum)||0)
|
||||||
|
subtotal+=(Number(v.total)||0)
|
||||||
|
}
|
||||||
|
if (v.month == '合计') {
|
||||||
|
index = idx
|
||||||
|
}
|
||||||
|
})
|
||||||
|
dataList.value[index].qty = qytTotal?.toFixed(3)
|
||||||
|
dataList.value[index].lng = lngTotal?.toFixed(3)
|
||||||
|
dataList.value[index].lngNum = lngNumTotal?.toFixed(3)
|
||||||
|
dataList.value[index].total = subtotal?.toFixed(3)
|
||||||
|
dataList.value = DataFormat.format(dataList.value, [
|
||||||
|
FormatOption.createQty('lngNum'),
|
||||||
|
FormatOption.createQty('total'),
|
||||||
|
FormatOption.createQty('qty'),
|
||||||
|
FormatOption.createQty('lng'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
function close() {
|
||||||
|
tabStore.closeTab(currentRoute.value, router);
|
||||||
|
}
|
||||||
|
</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;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -180,9 +180,16 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleView(record: Recordable) {
|
function handleView(record: Recordable) {
|
||||||
|
router.push({
|
||||||
dbClickRow(record);
|
path: '/plan/PlanYearDemandHdr/createForm',
|
||||||
|
query: {
|
||||||
|
formPath: 'plan/PlanYearDemandHdr',
|
||||||
|
formName: '查看' + formName,
|
||||||
|
formId: currentRoute.value.meta.formId,
|
||||||
|
id: record.id,
|
||||||
|
type: 'view',
|
||||||
|
},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
function handleReject (record: Recordable) {
|
function handleReject (record: Recordable) {
|
||||||
curData.value = record
|
curData.value = record
|
||||||
|
|||||||
@ -20,7 +20,8 @@
|
|||||||
<a-row>
|
<a-row>
|
||||||
<a-col :span="8">
|
<a-col :span="8">
|
||||||
<a-form-item label="年度" name="planYear">
|
<a-form-item label="年度" name="planYear">
|
||||||
<a-date-picker :inputReadOnly="true" v-model:value="formState.planYear" picker='year' style="width: 100%" :disabled="isDisable||pageType=='edit'" placeholder="请选择" @change="yearChange" />
|
<a-date-picker v-if="!pageType" :inputReadOnly="true" v-model:value="formState.planYear" picker='year' style="width: 100%" :disabled="isDisable||pageType=='edit'" placeholder="请选择" @change="yearChange" />
|
||||||
|
<div v-else>{{ formState.planYear }}</div>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="8">
|
<a-col :span="8">
|
||||||
@ -44,23 +45,30 @@
|
|||||||
<template #title>
|
<template #title>
|
||||||
<div style="display: flex; align-items: center;">
|
<div style="display: flex; align-items: center;">
|
||||||
<span style="margin-left: 8px;">年度需求明细</span>
|
<span style="margin-left: 8px;">年度需求明细</span>
|
||||||
<a-button style="margin: 0 10px" v-if="!isDisable">下载模板</a-button>
|
<a-button style="margin: 0 10px" v-if="!isDisable" @click="handleDownloadTemplate">下载模板</a-button>
|
||||||
<a-button type="primary" style="margin: 0 10px" v-if="!isDisable">导入</a-button>
|
<a-button type="primary" style="margin: 0 10px" v-if="!isDisable" @click="handleImport">导入</a-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<a-table style="width: 100%" :columns="columns" :data-source="dataList" :pagination="false">
|
<a-table style="width: 100%" :columns="columns" :data-source="dataList" :pagination="false">
|
||||||
<template #bodyCell="{ column, record, index }">
|
<template #bodyCell="{ column, record, index }">
|
||||||
<template v-if="column.dataIndex === 'qty'">
|
<template v-if="column.dataIndex === 'qty'">
|
||||||
<input-number v-model:value="record.qty" :disabled="isDisable || record.month=='合计'" :digits="3" :min="0" style="width: 100%" @blur="numCount(record.qty, record)"/>
|
<input-number v-model:value="record.qty" :disabled="isDisable || record.month=='合计'" :digits="3" :min="0" style="width: 100%" @blur="numCount(record)"/>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="column.dataIndex === 'lng'">
|
<template v-if="column.dataIndex === 'lng'">
|
||||||
<input-number v-model:value="record.lng" :disabled="isDisable|| record.month=='合计'" :digits="3" :min="0" style="width: 100%" @blur="numCount(record.lng, record)"/>
|
<input-number v-model:value="record.lng" :disabled="isDisable|| record.month=='合计'" :digits="3" :min="0" style="width: 100%" @blur="numCount( record)"/>
|
||||||
|
</template>
|
||||||
|
<template v-if="column.dataIndex === 'lngNum'">
|
||||||
|
<input-number v-model:value="record.lngNum" disabled :digits="3" :min="0" style="width: 100%"/>
|
||||||
|
</template>
|
||||||
|
<template v-if="column.dataIndex === 'total'">
|
||||||
|
<input-number v-model:value="record.total" disabled :digits="3" :min="0" style="width: 100%"/>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</a-table>
|
</a-table>
|
||||||
</Card>
|
</Card>
|
||||||
</a-form>
|
</a-form>
|
||||||
</div>
|
</div>
|
||||||
|
<ImportModal @register="registerImportModal" importUrl="/plan/planYearDemandHdrEc/import" @success="handleImportSuccess" />
|
||||||
</a-spin>
|
</a-spin>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -77,7 +85,9 @@
|
|||||||
import type { Rule } from 'ant-design-vue/es/form';
|
import type { Rule } from 'ant-design-vue/es/form';
|
||||||
import { getDictionary } from '/@/api/sales/Customer';
|
import { getDictionary } from '/@/api/sales/Customer';
|
||||||
import { useModal } from '/@/components/Modal';
|
import { useModal } from '/@/components/Modal';
|
||||||
import { addLngPlanYearDemandHdr,updateLngPlanYearDemandHdr, getLngPlanYearDemandHdr, getContractScPageList} from '/@/api/plan/PlanYearDemandHdrEc';
|
import ImportModal from '/@/components/Import/src/ImportModal.vue';
|
||||||
|
import { saveLngPlanYearDemandHdr,saveAndSubmitLngPlanYearDemandHdr,getUpdateLngPlanYearDemandHdr, getLngPlanYearDemandHdr, exportLngPlanYearDemandHdr} from '/@/api/plan/PlanYearDemandHdrEc';
|
||||||
|
import { downloadByData } from '/@/utils/file/download';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import { getAppEnvConfig } from '/@/utils/env';
|
import { getAppEnvConfig } from '/@/utils/env';
|
||||||
import { message } from 'ant-design-vue';
|
import { message } from 'ant-design-vue';
|
||||||
@ -108,6 +118,7 @@
|
|||||||
const formId = ref(currentRoute.value?.params?.id);
|
const formId = ref(currentRoute.value?.params?.id);
|
||||||
const pageType = ref(currentRoute.value.query?.type);
|
const pageType = ref(currentRoute.value.query?.type);
|
||||||
const pageId = ref(currentRoute.value.query?.id)
|
const pageId = ref(currentRoute.value.query?.id)
|
||||||
|
|
||||||
const dataList = ref([])
|
const dataList = ref([])
|
||||||
const curIdx = ref(null)
|
const curIdx = ref(null)
|
||||||
const curIndex = ref(null)
|
const curIndex = ref(null)
|
||||||
@ -130,6 +141,7 @@
|
|||||||
{ title: t('LNG(万方)(气化率1400)'), dataIndex: 'lngNum'},
|
{ title: t('LNG(万方)(气化率1400)'), dataIndex: 'lngNum'},
|
||||||
{ title: t('小计(万方)'), dataIndex: 'total'},
|
{ title: t('小计(万方)'), dataIndex: 'total'},
|
||||||
]);
|
]);
|
||||||
|
formState.cuCode = currentRoute.value.query?.cuCode
|
||||||
const layout = {
|
const layout = {
|
||||||
labelCol: { span: 8 },
|
labelCol: { span: 8 },
|
||||||
wrapperCol: { span: 16 },
|
wrapperCol: { span: 16 },
|
||||||
@ -182,29 +194,79 @@
|
|||||||
async function getInfo(id) {
|
async function getInfo(id) {
|
||||||
spinning.value = true
|
spinning.value = true
|
||||||
try {
|
try {
|
||||||
let data = await getLngPlanYearDemandHdr(id)
|
let request = pageType.value=='update' ? getUpdateLngPlanYearDemandHdr : getLngPlanYearDemandHdr
|
||||||
|
let data = await request(id)
|
||||||
Object.assign(formState, {...data})
|
|
||||||
|
|
||||||
spinning.value = false
|
spinning.value = false
|
||||||
dataList.value = data?.lngContractSalesPngPointPurList || []
|
Object.assign(formState, {...data})
|
||||||
|
updateData(data)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
spinning.value = false
|
spinning.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const numCount = (val, record) => {
|
const updateData = (data)=> {
|
||||||
if (!val) return
|
let arr = data?.lngPlanYearDemandList || [];
|
||||||
|
let objPng = {}
|
||||||
|
let objLng = {}
|
||||||
|
arr.forEach(v=> {
|
||||||
|
if (v.catCode == 'PNG') {
|
||||||
|
objPng = {...v}
|
||||||
|
}
|
||||||
|
if (v.catCode == 'LNG') {
|
||||||
|
objLng = {...v}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
for(let k in objPng) {
|
||||||
|
if (k.includes('qty')) {
|
||||||
|
dataList.value.push({'qty': objPng[k]})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let lngkeys = []
|
||||||
|
for(let k in objLng) {
|
||||||
|
if (k.includes('qty')) {
|
||||||
|
lngkeys.push({lng: k, value : objLng[k]})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lngkeys.forEach((i,idx)=> {
|
||||||
|
dataList.value[idx].lng = i.value
|
||||||
|
})
|
||||||
|
let totalObj = {month: '合计'}
|
||||||
|
dataList.value.splice(12,0,totalObj)
|
||||||
|
dataList.value.forEach((v,idx)=> {
|
||||||
|
|
||||||
|
if (idx<12) {
|
||||||
|
v.month = (idx+1)+'月'
|
||||||
|
}
|
||||||
|
if (idx>12) {
|
||||||
|
let a = null
|
||||||
|
if (idx==13)a=1
|
||||||
|
if (idx==14)a=2
|
||||||
|
if (idx==15)a=3
|
||||||
|
v.month = '次年'+a+'月'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
setTimeout(() => {
|
||||||
|
numCount()
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
|
const numCount = (record) => {
|
||||||
|
if (record) {
|
||||||
// LNG(万方)=LNG(吨)*气化率/10000;
|
// LNG(万方)=LNG(吨)*气化率/10000;
|
||||||
record.lngNum = Number(record.lng || 0) * Number(rateTonM3.value || 0)/10000
|
record.lngNum = Number(record.lng || 0) * Number(rateTonM3.value || 0)/10000
|
||||||
// 小计=管道气(万方)+LNG(万方);
|
// 小计=管道气(万方)+LNG(万方);
|
||||||
record.total = Number(record.qty || 0) + Number(record.lngNum || 0)
|
record.total = Number(record.qty || 0) + Number(record.lngNum || 0)
|
||||||
|
}
|
||||||
let qytTotal = 0
|
let qytTotal = 0
|
||||||
let lngTotal = 0
|
let lngTotal = 0
|
||||||
let lngNumTotal = 0
|
let lngNumTotal = 0
|
||||||
let subtotal= 0
|
let subtotal= 0
|
||||||
let index = null
|
let index = null
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
dataList.value.forEach((v, idx)=> {
|
dataList.value.forEach((v, idx)=> {
|
||||||
|
if (!record) {
|
||||||
|
v.lngNum = Number(v.lng || 0) * Number(rateTonM3.value || 0)/10000
|
||||||
|
v.total = Number(v.qty || 0) + Number(v.lngNum || 0)
|
||||||
|
}
|
||||||
if (idx<12) {
|
if (idx<12) {
|
||||||
qytTotal+=(Number(v.qty)||0)
|
qytTotal+=(Number(v.qty)||0)
|
||||||
lngTotal+=(Number(v.lng)||0)
|
lngTotal+=(Number(v.lng)||0)
|
||||||
@ -215,18 +277,32 @@
|
|||||||
index = idx
|
index = idx
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
setTimeout(() => {
|
dataList.value[index].qty = qytTotal?.toFixed(3)
|
||||||
dataList.value[index].qty = qytTotal
|
dataList.value[index].lng = lngTotal?.toFixed(3)
|
||||||
dataList.value[index].lng = lngTotal
|
dataList.value[index].lngNum = lngNumTotal?.toFixed(3)
|
||||||
dataList.value[index].lngNum = lngNumTotal
|
dataList.value[index].total = subtotal?.toFixed(3)
|
||||||
dataList.value[index].total = subtotal
|
|
||||||
|
|
||||||
dataList.value = DataFormat.format(dataList.value, [
|
|
||||||
FormatOption.createQty('lngNum'),
|
|
||||||
FormatOption.createQty('total'),
|
|
||||||
]);
|
|
||||||
}, 100);
|
}, 100);
|
||||||
}
|
}
|
||||||
|
const [registerImportModal, { openModal: openImportModal }] = useModal();
|
||||||
|
|
||||||
|
async function handleDownloadTemplate() {
|
||||||
|
const res = await exportLngPlanYearDemandHdr({ isTemplate: true });
|
||||||
|
downloadByData(res.data, '年度需求模板.xlsx', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleImport() {
|
||||||
|
openImportModal(true, {
|
||||||
|
title: '导入',
|
||||||
|
downLoadUrl: '/plan/planYearDemandHdrEc/export',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleImportSuccess() {
|
||||||
|
if (pageId.value) {
|
||||||
|
getInfo(pageId.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function getOption() {
|
async function getOption() {
|
||||||
optionSelect.approCodeList = await getDictionary('LNG_APPRO2')
|
optionSelect.approCodeList = await getDictionary('LNG_APPRO2')
|
||||||
}
|
}
|
||||||
@ -242,9 +318,33 @@
|
|||||||
}
|
}
|
||||||
async function handleSubmit(type) {
|
async function handleSubmit(type) {
|
||||||
try {
|
try {
|
||||||
|
let objLng = {catCode:'LNG'}
|
||||||
|
let objPng = {catCode:'PNG'}
|
||||||
|
dataList.value.forEach((v,idx)=> {
|
||||||
|
let k = ''
|
||||||
|
if (idx<12) {
|
||||||
|
k = 'qty'+(idx<9 ? ('0'+(idx+1)) : idx+1)
|
||||||
|
}
|
||||||
|
if (idx>12) {
|
||||||
|
let a = null
|
||||||
|
if (idx==13)a=1
|
||||||
|
if (idx==14)a=2
|
||||||
|
if (idx==15)a=3
|
||||||
|
k = 'qtyn'+a
|
||||||
|
}
|
||||||
|
if (idx!=12) {
|
||||||
|
objPng[k] = v.qty
|
||||||
|
objLng[k] = v.lng
|
||||||
|
}
|
||||||
|
})
|
||||||
|
let arr = [objLng, objPng]
|
||||||
spinning.value = true;
|
spinning.value = true;
|
||||||
let request = !pageId.value ? addLngPlanYearDemandHdr : updateLngPlanYearDemandHdr
|
let request = type == 'save' ? saveLngPlanYearDemandHdr : saveAndSubmitLngPlanYearDemandHdr
|
||||||
let obj = {}
|
let obj = {
|
||||||
|
...formState,
|
||||||
|
planYear: formState.planYear ? dayjs(formState.planYear).format('YYYY') : null,
|
||||||
|
lngPlanYearDemandList: arr
|
||||||
|
}
|
||||||
await request(obj)
|
await request(obj)
|
||||||
spinning.value = false;
|
spinning.value = false;
|
||||||
notification.success({
|
notification.success({
|
||||||
|
|||||||
@ -13,6 +13,7 @@
|
|||||||
{{ button.name }}
|
{{ button.name }}
|
||||||
</a-button>
|
</a-button>
|
||||||
</template>
|
</template>
|
||||||
|
<a-alert :message="yearTip" type="info" show-icon style="margin-left: 8px;" />
|
||||||
</template>
|
</template>
|
||||||
<template #bodyCell="{ column, record }">
|
<template #bodyCell="{ column, record }">
|
||||||
<template v-if="column.dataIndex === 'action'">
|
<template v-if="column.dataIndex === 'action'">
|
||||||
@ -34,7 +35,7 @@
|
|||||||
import { Modal } from 'ant-design-vue';
|
import { Modal } from 'ant-design-vue';
|
||||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||||
import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table';
|
import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table';
|
||||||
import { getLngPlanYearDemandHdrPage, deleteLngPlanYearDemandHdr, exportLngPlanYearDemandHdr} from '/@/api/plan/PlanYearDemandHdrEc';
|
import { getLngPlanYearDemandHdrPage, deleteLngPlanYearDemandHdr, exportLngPlanYearDemandHdr,getPlanYearTip} from '/@/api/plan/PlanYearDemandHdrEc';
|
||||||
import { PageWrapper } from '/@/components/Page';
|
import { PageWrapper } from '/@/components/Page';
|
||||||
import { useMessage } from '/@/hooks/web/useMessage';
|
import { useMessage } from '/@/hooks/web/useMessage';
|
||||||
import { useI18n } from '/@/hooks/web/useI18n';
|
import { useI18n } from '/@/hooks/web/useI18n';
|
||||||
@ -50,8 +51,13 @@
|
|||||||
import Icon from '/@/components/Icon/index';
|
import Icon from '/@/components/Icon/index';
|
||||||
import useEventBus from '/@/hooks/event/useEventBus';
|
import useEventBus from '/@/hooks/event/useEventBus';
|
||||||
import { cloneDeep } from 'lodash-es';
|
import { cloneDeep } from 'lodash-es';
|
||||||
|
import { useUserStore } from '/@/store/modules/user';
|
||||||
|
import { getCompDept } from '/@/api/approve/Appro';
|
||||||
const { bus, CREATE_FLOW, FLOW_PROCESSED, FORM_LIST_MODIFIED } = useEventBus();
|
const { bus, CREATE_FLOW, FLOW_PROCESSED, FORM_LIST_MODIFIED } = useEventBus();
|
||||||
|
const userStore = useUserStore();
|
||||||
|
const userInfo = userStore.getUserInfo;
|
||||||
|
const curCuCode = ref('')
|
||||||
|
const yearTip = ref()
|
||||||
|
|
||||||
const { notification } = useMessage();
|
const { notification } = useMessage();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
@ -104,7 +110,7 @@
|
|||||||
showResetButton: true,
|
showResetButton: true,
|
||||||
},
|
},
|
||||||
beforeFetch: (params) => {
|
beforeFetch: (params) => {
|
||||||
return { ...params, FormId: formIdComputedRef.value, PK: 'id', page: params.limit };
|
return { ...params, FormId: formIdComputedRef.value, PK: 'id', page: params.limit, cuCode: curCuCode.value };
|
||||||
},
|
},
|
||||||
afterFetch: (res) => {
|
afterFetch: (res) => {
|
||||||
tableRef.value.setToolBarWidth();
|
tableRef.value.setToolBarWidth();
|
||||||
@ -115,7 +121,7 @@
|
|||||||
|
|
||||||
striped: false,
|
striped: false,
|
||||||
actionColumn: {
|
actionColumn: {
|
||||||
width: 160,
|
width: 180,
|
||||||
title: '操作',
|
title: '操作',
|
||||||
dataIndex: 'action',
|
dataIndex: 'action',
|
||||||
slots: { customRender: 'action' },
|
slots: { customRender: 'action' },
|
||||||
@ -160,7 +166,8 @@
|
|||||||
query: {
|
query: {
|
||||||
formPath: 'plan/PlanYearDemandHdrEc',
|
formPath: 'plan/PlanYearDemandHdrEc',
|
||||||
formName: '新建'+formName,
|
formName: '新建'+formName,
|
||||||
formId:currentRoute.value.meta.formId
|
formId:currentRoute.value.meta.formId,
|
||||||
|
cuCode: curCuCode.value
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -214,8 +221,17 @@
|
|||||||
dbClickRow(record);
|
dbClickRow(record);
|
||||||
|
|
||||||
}
|
}
|
||||||
function handleUpdate () {
|
function handleUpdate (record) {
|
||||||
|
router.push({
|
||||||
|
path: '/plan/PlanYearDemandHdrEc/createForm',
|
||||||
|
query: {
|
||||||
|
formPath: 'plan/PlanYearDemandHdrEc',
|
||||||
|
formName: '变更'+formName,
|
||||||
|
formId:currentRoute.value.meta.formId,
|
||||||
|
id: record.id,
|
||||||
|
type: 'update'
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
async function handleExport() {
|
async function handleExport() {
|
||||||
const res = await exportLngPlanYearDemandHdr({ isTemplate: false });
|
const res = await exportLngPlanYearDemandHdr({ isTemplate: false });
|
||||||
@ -225,8 +241,12 @@
|
|||||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
onMounted(() => {
|
onMounted(async() => {
|
||||||
|
const res = await getCompDept(userInfo.id)
|
||||||
|
curCuCode.value = res?.comp?.cuCode
|
||||||
|
|
||||||
|
const data = await getPlanYearTip()
|
||||||
|
yearTip.value = data?.msg
|
||||||
if (schemaIdComputedRef.value) {
|
if (schemaIdComputedRef.value) {
|
||||||
bus.on(FLOW_PROCESSED, handleRefresh);
|
bus.on(FLOW_PROCESSED, handleRefresh);
|
||||||
bus.on(CREATE_FLOW, handleRefresh);
|
bus.on(CREATE_FLOW, handleRefresh);
|
||||||
|
|||||||
Reference in New Issue
Block a user