客户需求

This commit is contained in:
‘huanghaiixia’
2026-01-22 17:31:32 +08:00
parent 021b5074b5
commit acdc3555ac
11 changed files with 527 additions and 284 deletions

View File

@ -1,112 +1,132 @@
<template>
<a-row>
<a-col :span="8">
<a-form-item label="计划日期" name="datePlan">
<a-date-picker v-model:value="formState.datePlan" :disabled-date="disabledDateStart" style="width: 100%" placeholder="请选择计划日期" @change="datePlanChange" />
</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="onSearch"/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="下载点" name="pointDelyName" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
<a-input-search v-model:value="formState.pointDelyName" :disabled="isDisable" placeholder="请选择下载点" readonly @search="onSearchUpLoad"/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="合同量(吉焦)" name="qtyContractGj">{{ formState.qtyContractGj }}</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="合同量(方)" name="qtyContractM3">{{ formState.qtyContractM3 }}</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="月合同量执行进度%" name="rateK">{{ formState.rateK }}</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="计划量(吉焦)" name="qtyPlanGj">{{ formState.qtyPlanGj }}</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="计划量(方)" name="qtyPlanM3">{{ formState.qtyPlanM3 }}</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="月计划量执行进度%" name="rateMp">{{ formState.rateMp }}</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="指定量(吉焦)" name="qtyDemandGj">{{ formState.qtyDemandGj }}</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="指定量(方)" name="qtyDemandM3">{{ formState.qtyDemandM3 }}</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="月时间进度%" name="rateS">{{ formState.rateS }}</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="批复量(吉焦)" name="qtySalesGj">{{ formState.qtySalesGj }}</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="批复量(方)" name="qtySalesM3">{{ formState.qtySalesM3 }}</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="比值(方/吉焦)" name="rateM3Gj">{{ formState.rateM3Gj }}</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="交易主体" name="name">{{ formState.name }}</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="版本号" name="verNo">{{ formState.verNo }}</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="审批状态" name="approName">{{ formState.approName }}</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="开机方式" name="" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
<div style="display: flex;">
<div class="dot"><span style="background:#04F21C"></span>连运<i>{{ formState.powerCont }}</i></div>
<div class="dot"><span style="background:#FFFF00"></span>调峰<i>{{ formState.powerCont }}</i></div>
<div class="dot"><span style="background:#D9001B"></span>停机<i>{{ formState.powerStop }}</i></div>
<div class="dot"><span style="background:#CA90FF"></span>其他<i>{{ formState.powerOther }}</i></div>
</div>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="备注" name="note" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
{{ formState.note }}
</a-form-item>
</a-col>
</a-row>
<a-form ref="formRef" :model="formState" :rules="rules" v-bind="layout">
<a-row>
<a-col :span="8">
<a-form-item label="计划日期" name="datePlan">
<a-date-picker v-model:value="formState.datePlan" :disabled-date="disabledDateStart" style="width: 100%" :disabled="disable" placeholder="请选择计划日期" @change="datePlanChange" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="合同" name="kName">
<a-input-search v-model:value="formState.kName" :disabled="disable" placeholder="请选择合同" readonly @search="onSearch"/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="下载点" name="pointDelyName">
<a-input-search v-model:value="formState.pointDelyName" :disabled="disable" placeholder="请选择下载点" readonly @search="onSearchUpLoad"/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="合同量(吉焦)" name="qtyContractGj">{{ formState.qtyContractGj }}</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="合同量(方)" name="qtyContractM3">{{ formState.qtyContractM3 }}</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="月合同量执行进度%" name="rateK">{{ formState.rateK }}</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="计划量(吉焦)" name="qtyPlanGj">{{ formState.qtyPlanGj }}</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="计划量(方)" name="qtyPlanM3">{{ formState.qtyPlanM3 }}</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="月计划量执行进度%" name="rateMp">{{ formState.rateMp }}</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="指定量(吉焦)" name="qtyDemandGj">{{ formState.qtyDemandGj }}</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="指定量(方)" name="qtyDemandM3">{{ formState.qtyDemandM3 }}</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="月时间进度%" name="rateS">{{ formState.rateS }}</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="批复量(吉焦)" name="qtySalesGj">{{ formState.qtySalesGj }}</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="批复量(方)" name="qtySalesM3">{{ formState.qtySalesM3 }}</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="比值(方/吉焦)" name="rateM3Gj">{{ formState.rateM3Gj }}</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="交易主体" name="name">{{ formState.name }}</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="版本号" name="verNo">{{ formState.verNo }}</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="审批状态" name="approName">{{ formState.approName }}</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="开机方式" name="" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
<div style="display: flex;">
<div class="dot"><span style="background:#04F21C"></span>连运<a-input-number v-model:value="formState.powerCont" :disabled="disable" :precision="0"/></div>
<div class="dot"><span style="background:#FFFF00"></span>调峰<a-input-number v-model:value="formState.powerPeak" :disabled="disable" :precision="0"/></div>
<div class="dot"><span style="background:#D9001B"></span>停机<a-input-number v-model:value="formState.powerStop" :disabled="disable" :precision="0"/></div>
<div class="dot"><span style="background:#CA90FF"></span>其他<a-input-number v-model:value="formState.powerOther" :disabled="disable" :precision="0"/></div>
</div>
</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" placeholder="请输入备注" :auto-size="{ minRows: 2, maxRows: 5 }"/>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="批复意见" name="reply" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
<a-textarea v-model:value="formState.reply" disabled :auto-size="{ minRows: 1, maxRows: 5 }"/>
</a-form-item>
</a-col>
</a-row>
</a-form>
<a-table style="width: 100%" :columns="columns" :data-source="dataList" :pagination="false" :scroll="{x: 1000}">
<template #bodyCell="{ column, record, index }">
<template v-if="column.dataIndex === 'qtySalesGj'">
<a-input-number v-model:value="record.qtySalesGj" :disabled="record.alterSign=='D' || disable" :min="0" @change="numChange" style="width: 100%" />
<template v-if="column.dataIndex === 'qtyDemandGj'">
<a-input-number v-model:value="record.qtyDemandGj" :disabled="disable" :min="0" @change="numChange('qtyDemandGj', record)" style="width: 100%" />
</template>
<template v-if="column.dataIndex === 'qtySalesM3'">
<a-input-number v-model:value="record.qtySalesM3" :disabled="record.alterSign=='D' || disable" :min="0" @change="numChange" style="width: 100%" />
<template v-if="column.dataIndex === 'qtyDemandM3'">
<a-input-number v-model:value="record.qtyDemandM3" :disabled="disable" :min="0" @change="numChange('qtyDemandM3', record)" style="width: 100%" />
</template>
<template v-if="column.dataIndex === 'note'">
<a-input v-model:value="record.note" :disabled="record.alterSign=='D' || disable" style="width: 100%" />
<a-input v-model:value="record.note" style="width: 100%" />
</template>
</template>
</a-table>
<ContractDemandListModal @register="registerContract" @success="handleSuccessContract" />
<upLoadDemandListModal @register="registerUpLoad" @success="handleSuccessUpLoad" />
<contractDemandListModal @register="registerContract" @success="handleSuccessContract" />
<pointDelyDemandListModal @register="registerUpLoad" @success="handleSuccessUpLoad" />
</template>
<script lang="ts" setup>
import { useI18n } from '/@/hooks/web/useI18n';
import { useRouter } from 'vue-router';
import { ref, computed, onMounted, onBeforeMount, nextTick, defineAsyncComponent, reactive, defineComponent, watch} from 'vue';
import ContractDemandListModal from '/@/components/common/ContractDemandListModal.vue';
import upLoadDemandListModal from '/@/components/common/upLoadDemandListModal.vue';
import contractDemandListModal from '/@/components/common/contractDemandListModal.vue';
import pointDelyDemandListModal from '/@/components/common/pointDelyDemandListModal.vue';
import { useModal } from '/@/components/Modal';
import { message } from 'ant-design-vue';
import dayjs from 'dayjs';
import { getCompDept } from '/@/api/approve/Appro';
import { useUserStore } from '/@/store/modules/user';
import { getLngPngDemandContractList, getLngPngDemandPointDely } from '/@/api/dayPlan/Demand';
import { getLngPngDemandContractList, getLngPngDemandPointDely, getLngPngDemandContractQty, getLngPngDemandPurList, getLngPngDemandRate } from '/@/api/dayPlan/Demand';
const userStore = useUserStore();
const userInfo = userStore.getUserInfo;
const router = useRouter();
const { currentRoute } = router;
const pageId = ref(currentRoute.value.query?.id)
const formRef = ref()
const rules= reactive({
pointDelyName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
datePlan: [{ required: true, message: "该项为必填项", trigger: 'change' }],
kName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
});
const layout = {
labelCol: { span: 9 },
wrapperCol: { span: 18 },
}
const { t } = useI18n();
const [registerContract, { openModal:openModalContractSales}] = useModal();
const [registerUpLoad, { openModal:openModalUpLoad}] = useModal();
@ -117,88 +137,161 @@
});
const columns= ref([
{ title: t('序号'), dataIndex: 'index', key: 'index', sorter: true, customRender: (column) => `${column.index + 1}` ,width: 100},
{ title: t('上载点'), dataIndex: 'pointUpName', sorter: true, width:200},
{ title: t('供应商'), dataIndex: 'suSname', sorter: true, width: 130},
{ title: t('采购合同'), dataIndex: 'kName', sorter: true, width: 200},
{ title: t('指定量(吉焦)'), dataIndex: 'qtyDemandGj', sorter: true, width: 300},
{ title: t('指定量(方)'), dataIndex: 'qtyDemandM3', sorter: true, width: 200},
{ title: t('批复量(吉焦)'), dataIndex: 'qtySalesGj', sorter: true, width: 200},
{ title: t('批复量(方)'), dataIndex: 'qtySalesM3', sorter: true, width: 200},
{ title: t('备注'), dataIndex: 'note', sorter: true, width: 200},
{ title: t('序号'), dataIndex: 'index', key: 'index', customRender: (column) => `${column.index + 1}` ,width: 100},
{ title: t('供应商'), dataIndex: 'suName', width: 300},
{ title: t('上载点'), dataIndex: 'pointUpName', width:300},
{ title: t('指定量(吉焦)'), dataIndex: 'qtyDemandGj', width: 200},
{ title: t('指定量()'), dataIndex: 'qtyDemandM3', width: 200},
{ title: t('批复量(吉焦)'), dataIndex: 'qtySalesGj', width: 200},
{ title: t('批复量()'), dataIndex: 'qtySalesM3', width: 200},
{ title: t('备注'), dataIndex: 'note', width: 200},
]);
const formState = reactive({})
const formState = ref({
datePlan: null,
lastVerSign: 'Y',
validSign: 'N',
alterSign: 'I',
approCode: 'WTJ'
})
const dataList = ref([])
const contractList = ref([])
const pointDelyList = ref([])
onMounted(async () =>{
const res = await getCompDept(userInfo.id)
formState.cuCode = res?.comp?.code
formState.value.cuCode = res?.comp?.code
formState.value.comId = res?.comp?.id
const res1 = await getLngPngDemandRate({}) || []
formState.value.rateM3Gj = res1[0].rateM3Gj
})
async function numChange () {
async function numChange (k, record) {
if (k == 'qtyDemandGj') {
record.qtyDemandM3 = Number(formState.value.rateM3Gj) ? Number(record.qtyDemandGj)/Number(formState.value.rateM3Gj) : ''
} else {
record.qtyDemandGj = Number(record.qtyDemandM3)*Number(formState.value.rateM3Gj) || ''
}
record.qtyDemandM3 = record.qtyDemandM3 ? record.qtyDemandM3.toFixed(5) : ''
record.qtyDemandGj = record.qtyDemandGj ? record.qtyDemandGj.toFixed(5) : ''
let num = 0;
let num1 = 1;
dataList.forEach(v => {
num+=(Number(v.qtySalesGj) || 0)
num1+=(Number(v.qtySalesM3) || 0)
let num1 = 0;
dataList.value.forEach(v => {
num+=(Number(v.qtyDemandM3) || 0)
num1+=(Number(v.qtyDemandGj) || 0)
})
formState.qtySalesGj = num
formState.qtySalesM3 = num1
formState.value.qtyDemandM3 = num ? num.toFixed(5) : ''
formState.value.qtyDemandGj = num1 ? num1.toFixed(5) : ''
}
const datePlanChange = async (val) => {
if (!val) return
if (!val) {
formState.value = {}
dataList.value = []
return
}
let obj = {
cuCode:formState.cuCode,
datePlan: dayjs(formState.datePlan).format('YYYY-MM-DD')
cuCode:formState.value.cuCode,
datePlan: dayjs(formState.value.datePlan).format('YYYY-MM-DD')
}
let res = await getLngPngDemandContractList(obj)
contractList.value = res || []
if (contractList.value.length == 1) {
formState.kName = contractList.value[0].kName
formState.ksId = contractList.value[0].id
formState.value.kName = contractList.value[0].kName
formState.value.ksId = contractList.value[0].id
getPointDely()
getContractQty()
}
}
const onSearch = (val)=> {
if (!formState.datePlan) {
const onSearch = ()=> {
if (!formState.value.datePlan) {
message.warn('请选择计划日期')
return
}
openModalContractSales(true,{isUpdate: false, list: contractList.value})
}
const handleSuccessContract = async(val) => {
formState.kName = val[0].kName
formState.ksId = val[0].id
let res = await getLngPngDemandPointDely({kId: formState.ksId})
pointDelyList.value = res || []
if (pointDelyList.value.length == 1) {
formState.pointDelyName = contractList.value[0].kName
formState.pointDelyCode = contractList.value[0].id
}
const handleSuccessContract = (val) => {
formState.value.kName = val[0].kName
formState.value.ksId = val[0].id
getPointDely()
getContractQty()
}
const onSearchUpLoad = (val)=> {
if (!formState.kName) {
if (!formState.value.kName) {
message.warn('请选择合同')
return
}
openModalUpLoad(true,{isUpdate: false, list: pointDelyList.value})
}
const handleSuccessUpLoad = (val) => {
formState.kName = val[0].kName
formState.ksId = val[0].id
formState.value.pointDelyName = val[0].pointDelyName
formState.value.pointDelyCode = val[0].pointDelyCode
formState.value.ksppId = val[0].id
getPurList()
}
const getPointDely = async () => {
let res = await getLngPngDemandPointDely({kId: formState.value.ksId})
pointDelyList.value = res || []
if (pointDelyList.value.length == 1) {
formState.value.pointDelyName = pointDelyList.value[0].pointDelyName
formState.value.pointDelyCode = pointDelyList.value[0].pointDelyCode
formState.value.ksppId = pointDelyList.value[0].id
getPurList()
}
}
const getPurList = async () => {
let obj = {
ksppId: formState.value.ksppId,
datePlan: dayjs(formState.value.datePlan).format('YYYY-MM-DD')
}
let res = await getLngPngDemandPurList(obj)
dataList.value = res || []
let num = 0;
let num1 = 0;
let num2 = 0
let num3 = 0
dataList.value.forEach(v=> {
v.qtyDemandGj = Number(v.qtyDemandM3)*Number(formState.value.rateM3Gj) || ''
v.qtyDemandM3 = Number(formState.value.rateM3Gj) ? Number(v.qtyDemandGj)/Number(formState.value.rateM3Gj) : ''
v.qtyDemandM3 = Number(v.qtyDemandM3)? (Number(v.qtyDemandM3) / 10000) : ''
v.qtySalesM3 = Number(v.qtySalesM3)? (Number(v.qtySalesM3) / 10000) : ''
num+=(Number(v.qtySalesGj) || 0)
num1+=(Number(v.qtySalesM3) || 0)
num2+=(Number(v.qtyDemandM3) || 0)
num3+=(Number(v.qtyDemandGj) || 0)
})
formState.value.qtySalesGj = num ? num.toFixed(5) : ''
formState.value.qtySalesM3 = num1 ? num1.toFixed(5) : ''
formState.value.qtyDemandM3 = num2 ? num2.toFixed(5) : ''
formState.value.qtyDemandGj = num3 ? num3.toFixed(5) : ''
}
const getContractQty = async () => {
let obj = {
kId: formState.value.ksId,
datePlan: dayjs(formState.value.datePlan).format('YYYY-MM-DD')
}
let res = await getLngPngDemandContractQty(obj)
formState.value.qtyContractGj = res?.qtyContractGj
formState.value.qtyContractM3 = res?.qtyContractM3
formState.value.qtyContractM3 = Number(formState.value.qtyContractM3)? (Number(formState.value.qtyContractM3) / 10000) : ''
}
const disabledDateStart = (current) => {
const today = new Date();
today.setHours(0, 0, 0, 0); // 清除时分秒,确保比较时不考虑时间部分
// 获取明天的日期
const tomorrow = new Date();
tomorrow.setDate(tomorrow.getDate() + 2);
tomorrow.setDate(tomorrow.getDate() + (pageId ? 1 : 2));
tomorrow.setHours(0, 0, 0, 0); // 清除时分秒
// 当前日期小于今天或大于明天,则禁用
return current < today || current > tomorrow;
}
function getFormValue () {
async function getFormValue () {
await formRef.value.validateFields();
let obj = {
formInfo: formState,
formInfo: formState.value,
list: dataList.value
}
return obj
@ -207,7 +300,7 @@
() => props.formObj,
(val) => {
if (val) {
Object.assign(formState, {...val})
formState.value = val
}
},
{
@ -219,6 +312,7 @@
() => props.list,
(val) => {
dataList.value = val
console.log(dataList.value, 88888888888)
},
{
immediate: true,
@ -237,8 +331,8 @@
margin-right: 10px;
display: flex;
align-items: center;
i{
padding: 5px;
.ant-input-number{
margin:0 5px;
font-style: normal;
}
span{

View File

@ -1,14 +1,27 @@
<template>
<a-spin :spinning="spinning" tip="加载中...">
<div class="page-bg-wrap formViewStyle">
<a-form ref="formRef" :model="formState" :rules="rules" v-bind="layout">
<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="currentRoute.query.type!=='compare'">
<a-button style="margin-right: 10px" type="primary" @click="checkBtn('save')" v-if="!currentRoute.query.type">
<slot name="icon"><save-outlined /></slot>保存
</a-button>
<a-button style="margin-right: 10px" @click="checkBtn('submit')" v-if="!currentRoute.query.type">
<slot name="icon"><send-outlined /></slot>保存并提交
</a-button>
</template>
</div>
<Card :title="title" :bordered="false" >
<basicForm ref="basicFormRef" :formObj="formState" :list="dataList" :disable="currentRoute.query.type"></basicForm>
<basicForm ref="formRef" :formObj="formState" :list="dataList" :disable="currentRoute.query.type"></basicForm>
</Card>
<Card :title="title" :bordered="false" v-if="currentRoute.query.type=='compare'">
<basicForm ref="basicFormRef" :formObj="formState" :list="dataList" :disable="currentRoute.query.type"></basicForm>
<basicForm :formObj="formState" :list="dataList" :disable="currentRoute.query.type"></basicForm>
</Card>
</a-form>
</div>
</a-spin>
</template>
@ -18,7 +31,7 @@
import { useRouter } from 'vue-router';
import { FromPageType, RecordType } from '/@/enums/workflowEnum';
import { ref, computed, onMounted, onBeforeMount, nextTick, defineAsyncComponent, reactive, defineComponent, watch} from 'vue';
import { CheckCircleOutlined, StopOutlined, CloseOutlined, } from '@ant-design/icons-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';
@ -26,7 +39,7 @@
import type { Rule } from 'ant-design-vue/es/form';
import { getDictionary } from '/@/api/sales/Customer';
import { useModal } from '/@/components/Modal';
import { getLngPngAppro,approveLngPngAppro } from '/@/api/dayPlan/PngAppro';
import { addLngPngDemand, submitLngPngDemand,getLngPngDemand } from '/@/api/dayPlan/Demand';
import dayjs from 'dayjs';
import { getAppEnvConfig } from '/@/utils/env';
import { message } from 'ant-design-vue';
@ -64,17 +77,11 @@
const { t } = useI18n();
const hasDel = ref(false)
const formState = reactive({
datePlan: null
});
const [register, { openModal:openModal}] = useModal();
const rules= reactive({
// kNo: [{ required: true, message: "该项为必填项", trigger: 'change' }],
});
const layout = {
labelCol: { span: 9 },
wrapperCol: { span: 18 },
}
const title = ref('日计划审批')
const title = ref('管道气需求')
const dataList = ref([])
const basicFormRef = ref()
let optionSelect= reactive({
@ -92,7 +99,6 @@
}
);
onMounted(() => {
getOption()
if (pageId.value) {
getInfo(pageId.value)
}
@ -101,97 +107,88 @@
async function getInfo(id) {
spinning.value = true
try {
let data = await getLngPngAppro(id)
let data = await getLngPngDemand(id)
spinning.value = false
Object.assign(formState, {...data})
Object.assign(dataList.value, formState.lngPngApproPurList || [{}])
const startDate = dayjs(formState.datePlan);
const endDate = dayjs(new Date());
const diffInDays = endDate.diff(startDate, 'day');
if (diffInDays == 0) {
formState.dayDesc = '当日'
} else if (diffInDays == 1) {
formState.dayDesc = '次日'
} else if (diffInDays > 1) {
formState.dayDesc = diffInDays + '日后'
} else {
formState.dayDesc = ''
}
formState.qtyContractM3 = Number(formState.qtyContractM3)/10000
formState.qtyPlanM3 = Number(formState.qtyPlanM3)/10000
formState.qtyDemandM3 = Number(formState.qtyDemandM3)/10000
formState.qtySalesM3 = Number(formState.qtySalesM3)/10000
dataList.value.forEach(v => {
v.qtyDemandM3 = Number(v.qtyDemandM3)/10000
v.qtySalesM3 = Number(v.qtySalesM3)/10000
});
let obj = changeData(data)
Object.assign(formState, {...obj.params})
Object.assign(dataList.value, obj.list || [{}])
} catch (error) {
console.log(error, 'error')
spinning.value = false
}
}
async function numChange () {
let num = 0;
let num1 = 1;
dataList.value.forEach(v => {
num+=(Number(v.qtySalesGj) || 0)
num1+=(Number(v.qtySalesM3) || 0)
})
formState.qtySalesGj = num
formState.qtySalesM3 = num1
}
async function getOption() {
optionSelect.approCodeList = await getDictionary('LNG_APPRO')
const changeData = (obj) => {
let arr = obj.lngPngDemandPurList || [{}]
obj.datePlan = obj.datePlan ? dayjs(obj.datePlan) : null
obj.qtyContractM3 = Number(obj.qtyContractM3)/10000
obj.qtyPlanM3 = Number(obj.qtyPlanM3)/10000
obj.qtyDemandM3 = Number(obj.qtyDemandM3)/10000
obj.qtySalesM3 = Number(obj.qtySalesM3)/10000
arr.forEach(v => {
v.qtyDemandM3 = Number(v.qtyDemandM3)/10000
v.qtySalesM3 = Number(v.qtySalesM3)/10000
}
v.qtyDemandM3 = Number(v.qtyDemandM3) ? Number(v.qtyDemandM3).toFixed(5) : ''
v.qtySalesM3 = Number(v.qtySalesM3) ? Number(v.qtySalesM3).toFixed(5) : ''
});
obj.qtyContractM3 = Number(obj.qtyContractM3) ? Number(obj.qtyContractM3).toFixed(5) : ''
obj.qtyPlanM3 = Number(obj.qtyPlanM3) ? Number(obj.qtyPlanM3).toFixed(5) : ''
obj.qtyDemandM3 = Number(obj.qtyDemandM3) ? Number(obj.qtyDemandM3).toFixed(5) : ''
obj.qtySalesM3 = Number(obj.qtySalesM3) ? Number(obj.qtySalesM3).toFixed(5) : ''
return {
list : arr,
params: obj
}
}
function close() {
tabStore.closeTab(currentRoute.value, router);
}
async function checkBtn(type) {
let data = basicFormRef.value.getFormValue()
console.log(data, 'data')
let arr = JSON.parse(JSON.stringify(data.list))
arr.forEach(v=> {
v.qtyDemandM3 = Number(v.qtyDemandM3)*10000
v.qtySalesM3 = Number(v.qtySalesM3)*10000
})
let obj = {
...data.formInfo,
qtyContractM3: Number(data.formInfo.qtyContractM3)*10000,
qtyPlanM3: Number(data.formInfo.qtyPlanM3)*10000,
qtyDemandM3: Number(data.formInfo.qtyDemandM3)*10000,
qtySalesM3: Number(data.formInfo.qtySalesM3)*10000,
lngPngApproPurList:arr
}
let params = {
result: type == 'agree' ? 'C' : 'R',
remark: formState.reply,
data: obj
}
spinning.value = true;
try {
if (type == 'reject') {
if (!formState.reply) {
message.warn('请输入批复意见')
return
}
const data = await formRef.value.getFormValue();
let arr = JSON.parse(JSON.stringify(data.list))
arr.forEach(v=> {
v.qtyDemandM3 = Number(v.qtyDemandM3)*10000
v.qtySalesM3 = Number(v.qtySalesM3)*10000
})
let obj = {
...data.formInfo,
datePlan: dayjs(data.formInfo.datePlan).format('YYYY-MM-DD HH:mm:ss'),
qtyContractM3: Number(data.formInfo.qtyContractM3)*10000,
qtyPlanM3: Number(data.formInfo.qtyPlanM3)*10000,
qtyDemandM3: Number(data.formInfo.qtyDemandM3)*10000,
qtySalesM3: Number(data.formInfo.qtySalesM3)*10000,
lngPngDemandPurList:arr
}
await approveLngPngAppro(params);
spinning.value = true;
let request = ''
request = type == 'save'? addLngPngDemand : submitLngPngDemand
await request(obj)
spinning.value = false;
notification.success({
message: 'Tip',
description: type == 'agree' ? '审批通过':'已驳回'
description: type == 'save' ? '保存成功':'已提交'
}); //提示消息
setTimeout(() => {
bus.emit(FORM_LIST_MODIFIED, {});
close();
}, 500);
}catch (errorInfo) {
spinning.value = false;
} catch (errorInfo) {
spinning.value = false;
errorInfo?.errorFields?.length && notification.warning({
message: 'Tip',
description: '请完善信息'
});
}
}
}
</script>
@ -205,6 +202,9 @@
margin-bottom: 12px;
border-bottom: 1px solid #eee;
}
.pdcss {
padding:0px 12px 6px 12px !important;
}
.dot {
margin-right: 10px;
display: flex;

View File

@ -180,11 +180,13 @@
});
} else {
router.push({
path: '/form/Demand/' + record.id + '/viewForm',
path: '/dayPlan/Demand/createForm',
query: {
formPath: 'dayPlan/Demand',
formName: formName,
formId:currentRoute.value.meta.formId
formId:currentRoute.value.meta.formId,
id: record.Id,
type:'view'
}
});
}
@ -217,13 +219,13 @@
}
function handleEdit(record: Recordable) {
router.push({
path: '/form/Demand/' + record.id + '/updateForm',
path: '/dayPlan/Demand/createForm',
query: {
formPath: 'dayPlan/Demand',
formName: formName,
formId:currentRoute.value.meta.formId
formPath: 'dayPlan/Demand',
formName: formName,
formId:currentRoute.value.meta.formId,
id: record.Id
}
});
}