年度计划接口
This commit is contained in:
@ -3,7 +3,8 @@ import { defHttp } from '/@/utils/http/axios';
|
||||
import { ErrorMessageMode } from '/#/axios';
|
||||
|
||||
enum Api {
|
||||
Page = '/plan/planYearDemandHdr/page',
|
||||
// Page = '/plan/planYearDemandHdr/page',
|
||||
Page = '/magic-api/plan/planYearDemandHdrPageList',
|
||||
List = '/plan/planYearDemandHdr/list',
|
||||
Info = '/plan/planYearDemandHdr/info',
|
||||
LngPlanYearDemandHdr = '/plan/planYearDemandHdr',
|
||||
|
||||
@ -3,17 +3,65 @@ import { defHttp } from '/@/utils/http/axios';
|
||||
import { ErrorMessageMode } from '/#/axios';
|
||||
|
||||
enum Api {
|
||||
Page = '/plan/planYearDemandHdrEc/page',
|
||||
// Page = '/plan/planYearDemandHdrEc/page',
|
||||
Page = '/magic-api/plan/planYearDemandHdrEcPageList',
|
||||
List = '/plan/planYearDemandHdrEc/list',
|
||||
Info = '/plan/planYearDemandHdrEc/info',
|
||||
yearTip ='/magic-api/plan/planYearDemandHdrSelectDate',
|
||||
LngPlanYearDemandHdr = '/plan/planYearDemandHdrEc',
|
||||
save = '/plan/planYearDemandHdrEc/save',
|
||||
saveAndSubmit = '/plan/planYearDemandHdrEc/saveAndSubmit',
|
||||
toChange = '/plan/planYearDemandHdrEc/toChange',
|
||||
|
||||
|
||||
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分页列表
|
||||
*/
|
||||
|
||||
@ -414,6 +414,14 @@ export const PAGE_CUSTOM_ROUTE: AppRouteRecordRaw[] = [{
|
||||
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) {
|
||||
|
||||
dbClickRow(record);
|
||||
|
||||
router.push({
|
||||
path: '/plan/PlanYearDemandHdr/createForm',
|
||||
query: {
|
||||
formPath: 'plan/PlanYearDemandHdr',
|
||||
formName: '查看' + formName,
|
||||
formId: currentRoute.value.meta.formId,
|
||||
id: record.id,
|
||||
type: 'view',
|
||||
},
|
||||
});
|
||||
}
|
||||
function handleReject (record: Recordable) {
|
||||
curData.value = record
|
||||
|
||||
@ -20,7 +20,8 @@
|
||||
<a-row>
|
||||
<a-col :span="8">
|
||||
<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-col>
|
||||
<a-col :span="8">
|
||||
@ -44,23 +45,30 @@
|
||||
<template #title>
|
||||
<div style="display: flex; align-items: center;">
|
||||
<span style="margin-left: 8px;">年度需求明细</span>
|
||||
<a-button style="margin: 0 10px" v-if="!isDisable">下载模板</a-button>
|
||||
<a-button type="primary" 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" @click="handleImport">导入</a-button>
|
||||
</div>
|
||||
</template>
|
||||
<a-table style="width: 100%" :columns="columns" :data-source="dataList" :pagination="false">
|
||||
<template #bodyCell="{ column, record, index }">
|
||||
<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 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>
|
||||
</a-table>
|
||||
</Card>
|
||||
</a-form>
|
||||
</div>
|
||||
<ImportModal @register="registerImportModal" importUrl="/plan/planYearDemandHdrEc/import" @success="handleImportSuccess" />
|
||||
</a-spin>
|
||||
</template>
|
||||
|
||||
@ -77,7 +85,9 @@
|
||||
import type { Rule } from 'ant-design-vue/es/form';
|
||||
import { getDictionary } from '/@/api/sales/Customer';
|
||||
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 { getAppEnvConfig } from '/@/utils/env';
|
||||
import { message } from 'ant-design-vue';
|
||||
@ -108,6 +118,7 @@
|
||||
const formId = ref(currentRoute.value?.params?.id);
|
||||
const pageType = ref(currentRoute.value.query?.type);
|
||||
const pageId = ref(currentRoute.value.query?.id)
|
||||
|
||||
const dataList = ref([])
|
||||
const curIdx = ref(null)
|
||||
const curIndex = ref(null)
|
||||
@ -130,6 +141,7 @@
|
||||
{ title: t('LNG(万方)(气化率1400)'), dataIndex: 'lngNum'},
|
||||
{ title: t('小计(万方)'), dataIndex: 'total'},
|
||||
]);
|
||||
formState.cuCode = currentRoute.value.query?.cuCode
|
||||
const layout = {
|
||||
labelCol: { span: 8 },
|
||||
wrapperCol: { span: 16 },
|
||||
@ -182,51 +194,115 @@
|
||||
async function getInfo(id) {
|
||||
spinning.value = true
|
||||
try {
|
||||
let data = await getLngPlanYearDemandHdr(id)
|
||||
|
||||
Object.assign(formState, {...data})
|
||||
|
||||
spinning.value = false
|
||||
dataList.value = data?.lngContractSalesPngPointPurList || []
|
||||
|
||||
let request = pageType.value=='update' ? getUpdateLngPlanYearDemandHdr : getLngPlanYearDemandHdr
|
||||
let data = await request(id)
|
||||
spinning.value = false
|
||||
Object.assign(formState, {...data})
|
||||
updateData(data)
|
||||
} catch (error) {
|
||||
spinning.value = false
|
||||
}
|
||||
}
|
||||
const numCount = (val, record) => {
|
||||
if (!val) return
|
||||
// LNG(万方)=LNG(吨)*气化率/10000;
|
||||
record.lngNum = Number(record.lng || 0) * Number(rateTonM3.value || 0)/10000
|
||||
// 小计=管道气(万方)+LNG(万方);
|
||||
record.total = Number(record.qty || 0) + Number(record.lngNum || 0)
|
||||
const updateData = (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()
|
||||
}, 500);
|
||||
}
|
||||
const numCount = (record) => {
|
||||
if (record) {
|
||||
// LNG(万方)=LNG(吨)*气化率/10000;
|
||||
record.lngNum = Number(record.lng || 0) * Number(rateTonM3.value || 0)/10000
|
||||
// 小计=管道气(万方)+LNG(万方);
|
||||
record.total = Number(record.qty || 0) + Number(record.lngNum || 0)
|
||||
}
|
||||
let qytTotal = 0
|
||||
let lngTotal = 0
|
||||
let lngNumTotal = 0
|
||||
let subtotal= 0
|
||||
let index = null
|
||||
dataList.value.forEach((v, idx)=> {
|
||||
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
|
||||
}
|
||||
})
|
||||
|
||||
setTimeout(() => {
|
||||
dataList.value[index].qty = qytTotal
|
||||
dataList.value[index].lng = lngTotal
|
||||
dataList.value[index].lngNum = lngNumTotal
|
||||
dataList.value[index].total = subtotal
|
||||
|
||||
dataList.value = DataFormat.format(dataList.value, [
|
||||
FormatOption.createQty('lngNum'),
|
||||
FormatOption.createQty('total'),
|
||||
]);
|
||||
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) {
|
||||
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)
|
||||
}, 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() {
|
||||
optionSelect.approCodeList = await getDictionary('LNG_APPRO2')
|
||||
}
|
||||
@ -242,9 +318,33 @@
|
||||
}
|
||||
async function handleSubmit(type) {
|
||||
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;
|
||||
let request = !pageId.value ? addLngPlanYearDemandHdr : updateLngPlanYearDemandHdr
|
||||
let obj = {}
|
||||
let request = type == 'save' ? saveLngPlanYearDemandHdr : saveAndSubmitLngPlanYearDemandHdr
|
||||
let obj = {
|
||||
...formState,
|
||||
planYear: formState.planYear ? dayjs(formState.planYear).format('YYYY') : null,
|
||||
lngPlanYearDemandList: arr
|
||||
}
|
||||
await request(obj)
|
||||
spinning.value = false;
|
||||
notification.success({
|
||||
|
||||
@ -13,7 +13,8 @@
|
||||
{{ button.name }}
|
||||
</a-button>
|
||||
</template>
|
||||
</template>
|
||||
<a-alert :message="yearTip" type="info" show-icon style="margin-left: 8px;" />
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.dataIndex === 'action'">
|
||||
<TableAction :actions="getActions(record)" />
|
||||
@ -34,7 +35,7 @@
|
||||
import { Modal } from 'ant-design-vue';
|
||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||
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 { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { useI18n } from '/@/hooks/web/useI18n';
|
||||
@ -50,8 +51,13 @@
|
||||
import Icon from '/@/components/Icon/index';
|
||||
import useEventBus from '/@/hooks/event/useEventBus';
|
||||
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 userStore = useUserStore();
|
||||
const userInfo = userStore.getUserInfo;
|
||||
const curCuCode = ref('')
|
||||
const yearTip = ref()
|
||||
|
||||
const { notification } = useMessage();
|
||||
const { t } = useI18n();
|
||||
@ -104,7 +110,7 @@
|
||||
showResetButton: true,
|
||||
},
|
||||
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) => {
|
||||
tableRef.value.setToolBarWidth();
|
||||
@ -115,7 +121,7 @@
|
||||
|
||||
striped: false,
|
||||
actionColumn: {
|
||||
width: 160,
|
||||
width: 180,
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
slots: { customRender: 'action' },
|
||||
@ -160,7 +166,8 @@
|
||||
query: {
|
||||
formPath: 'plan/PlanYearDemandHdrEc',
|
||||
formName: '新建'+formName,
|
||||
formId:currentRoute.value.meta.formId
|
||||
formId:currentRoute.value.meta.formId,
|
||||
cuCode: curCuCode.value
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -214,8 +221,17 @@
|
||||
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() {
|
||||
const res = await exportLngPlanYearDemandHdr({ isTemplate: false });
|
||||
@ -225,8 +241,12 @@
|
||||
'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) {
|
||||
bus.on(FLOW_PROCESSED, handleRefresh);
|
||||
bus.on(CREATE_FLOW, handleRefresh);
|
||||
|
||||
Reference in New Issue
Block a user