销售审批
This commit is contained in:
@ -1,19 +1,21 @@
|
||||
<template>
|
||||
<a-spin :spinning="spinning" tip="加载中...">
|
||||
<div class="page-bg-wrap formViewStyle pdcss">
|
||||
<div class="top-toolbar" v-if="currentRoute.query.type!=='compare'">
|
||||
<div class="top-toolbar" >
|
||||
<a-button style="margin-right: 10px" @click="close">
|
||||
<slot name="icon"><close-outlined /></slot>关闭
|
||||
</a-button>
|
||||
<a-button style="margin-right: 10px" type="primary" @click="checkBtn('agree')" v-if="!currentRoute.query.type">
|
||||
<slot name="icon"><check-circle-outlined /></slot>通过
|
||||
</a-button>
|
||||
<a-button style="margin-right: 10px" @click="checkBtn('reject')" v-if="!currentRoute.query.type">
|
||||
<slot name="icon"><stop-outlined /></slot>驳回
|
||||
</a-button>
|
||||
<template v-if="currentRoute.query.type!=='compare'">
|
||||
<a-button style="margin-right: 10px" type="primary" @click="checkBtn('agree')" v-if="!currentRoute.query.type">
|
||||
<slot name="icon"><check-circle-outlined /></slot>通过
|
||||
</a-button>
|
||||
<a-button style="margin-right: 10px" @click="checkBtn('reject')" v-if="!currentRoute.query.type">
|
||||
<slot name="icon"><stop-outlined /></slot>驳回
|
||||
</a-button>
|
||||
</template>
|
||||
</div>
|
||||
<a-form ref="formRef" :model="formState" :rules="rules" v-bind="layout">
|
||||
<a-row v-if="currentRoute.query.type!=='compare'">
|
||||
<a-row v-if="!currentRoute.query.type">
|
||||
<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="currentRoute.query.type=='view'" placeholder="请输入备注" :auto-size="{ minRows: 2, maxRows: 5 }"/>
|
||||
@ -23,8 +25,8 @@
|
||||
<Card :title="title" :bordered="false" >
|
||||
<basicForm ref="basicFormRef" :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>
|
||||
<Card :title="titleNew" :bordered="false" v-if="currentRoute.query.type=='compare'&&titleNew">
|
||||
<basicForm ref="basicFormRef" :formObj="formStateNew" :list="dataListNew" :disable="currentRoute.query.type"></basicForm>
|
||||
</Card>
|
||||
</a-form>
|
||||
</div>
|
||||
@ -44,7 +46,7 @@
|
||||
import type { Rule } from 'ant-design-vue/es/form';
|
||||
import { getDictionary } from '/@/api/sales/Customer';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { getLngPngAppro,approveLngPngAppro,getLngPngApproCompare } from '/@/api/dayPlan/PngAppro';
|
||||
import { getLngPngAppro,approveLngPngAppro,getLngPngApproCompare,approveLngPngApproSZ,approveLngPngApproGD } from '/@/api/dayPlan/PngAppro';
|
||||
import dayjs from 'dayjs';
|
||||
import { getAppEnvConfig } from '/@/utils/env';
|
||||
import { message } from 'ant-design-vue';
|
||||
@ -83,6 +85,9 @@
|
||||
const hasDel = ref(false)
|
||||
const formState = reactive({
|
||||
|
||||
});
|
||||
const formStateNew = reactive({
|
||||
|
||||
});
|
||||
const [register, { openModal:openModal}] = useModal();
|
||||
const rules= reactive({
|
||||
@ -93,7 +98,9 @@
|
||||
wrapperCol: { span: 18 },
|
||||
}
|
||||
const title = ref('日计划审批')
|
||||
const titleNew = ref('')
|
||||
const dataList = ref([])
|
||||
const dataListNew = ref([])
|
||||
const basicFormRef = ref()
|
||||
let optionSelect= reactive({
|
||||
approCodeList: [],
|
||||
@ -112,39 +119,27 @@
|
||||
async function getCompareInfo(id) {
|
||||
spinning.value = true
|
||||
try {
|
||||
let data = await getLngPngApproCompare(id)
|
||||
let data = await getLngPngApproCompare(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 = ''
|
||||
if (data.length == 1) {
|
||||
let obj = changeData(data[0])
|
||||
Object.assign(formState, {...obj.params})
|
||||
Object.assign(dataList.value, obj.list || [{}])
|
||||
title.value = '版本V'+ formState.verNo
|
||||
}
|
||||
if (data.length > 1) {
|
||||
let obj = changeData(data[0])
|
||||
Object.assign(formState, {...obj.params})
|
||||
Object.assign(dataList.value, obj.list || [{}])
|
||||
title.value = '版本V'+ formState.verNo
|
||||
|
||||
let obj1 = changeData(data[1])
|
||||
Object.assign(formStateNew, {...obj1.params})
|
||||
Object.assign(dataListNew.value, obj1.list || [{}])
|
||||
titleNew.value = '版本V'+ formStateNew.verNo
|
||||
}
|
||||
formState.qtyContractM3 = Number(formState.qtyContractM3)/10000
|
||||
formState.qtyPlanM3 = Number(formState.qtyPlanM3)/10000
|
||||
formState.qtyDemandM3 = Number(formState.qtyDemandM3)/10000
|
||||
formState.qtySalesM3 = Number(formState.qtySalesM3)/10000
|
||||
let num = 0;
|
||||
let num1 = 0;
|
||||
dataList.value.forEach(v => {
|
||||
v.qtyDemandM3 = Number(v.qtyDemandM3)/10000
|
||||
v.qtySalesM3 = Number(v.qtySalesM3)/10000
|
||||
num+=(Number(v.qtySalesGj) || 0)
|
||||
num1+=(Number(v.qtySalesM3) || 0)
|
||||
});
|
||||
formState.qtySalesGj = num
|
||||
formState.qtySalesM3 = num1
|
||||
|
||||
} catch (error) {
|
||||
console.log(error, 'error')
|
||||
spinning.value = false
|
||||
}
|
||||
|
||||
@ -154,40 +149,46 @@
|
||||
try {
|
||||
let data = await getLngPngAppro(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 = ''
|
||||
let obj = changeData(data)
|
||||
Object.assign(formState, {...obj.params})
|
||||
Object.assign(dataList.value, obj.list || [{}])
|
||||
} catch (error) {
|
||||
spinning.value = false
|
||||
}
|
||||
formState.qtyContractM3 = Number(formState.qtyContractM3)/10000
|
||||
formState.qtyPlanM3 = Number(formState.qtyPlanM3)/10000
|
||||
formState.qtyDemandM3 = Number(formState.qtyDemandM3)/10000
|
||||
formState.qtySalesM3 = Number(formState.qtySalesM3)/10000
|
||||
}
|
||||
const changeData = (obj) => {
|
||||
let arr = obj.lngPngApproPurList || [{}]
|
||||
// const startDate = dayjs(obj.datePlan);
|
||||
// const endDate = dayjs(new Date());
|
||||
// const diffInDays = endDate.diff(startDate, 'day');
|
||||
// if (diffInDays == 0) {
|
||||
// obj.dayDesc = '当日'
|
||||
// } else if (diffInDays == 1) {
|
||||
// obj.dayDesc = '次日'
|
||||
// } else if (diffInDays > 1) {
|
||||
// obj.dayDesc = diffInDays + '日后'
|
||||
// } else {
|
||||
// obj.dayDesc = ''
|
||||
// }
|
||||
obj.qtyContractM3 = Number(obj.qtyContractM3)/10000
|
||||
obj.qtyPlanM3 = Number(obj.qtyPlanM3)/10000
|
||||
obj.qtyDemandM3 = Number(obj.qtyDemandM3)/10000
|
||||
obj.qtySalesM3 = Number(obj.qtySalesM3)/10000
|
||||
let num = 0;
|
||||
let num1 = 0;
|
||||
dataList.value.forEach(v => {
|
||||
arr.forEach(v => {
|
||||
v.qtyDemandM3 = Number(v.qtyDemandM3)/10000
|
||||
v.qtySalesM3 = Number(v.qtySalesM3)/10000
|
||||
num+=(Number(v.qtySalesGj) || 0)
|
||||
num1+=(Number(v.qtySalesM3) || 0)
|
||||
});
|
||||
formState.qtySalesGj = num
|
||||
formState.qtySalesM3 = num1
|
||||
|
||||
} catch (error) {
|
||||
console.log(error, 'error')
|
||||
spinning.value = false
|
||||
obj.qtySalesGj = num
|
||||
obj.qtySalesM3 = num1
|
||||
return {
|
||||
list : arr,
|
||||
params: obj
|
||||
}
|
||||
}
|
||||
}
|
||||
async function getOption() {
|
||||
optionSelect.approCodeList = await getDictionary('LNG_APPRO')
|
||||
|
||||
@ -197,7 +198,6 @@
|
||||
}
|
||||
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
|
||||
@ -214,7 +214,7 @@
|
||||
let params = {
|
||||
result: type == 'agree' ? 'C' : 'R',
|
||||
remark: formState.reply,
|
||||
data: obj
|
||||
data: [obj]
|
||||
}
|
||||
spinning.value = true;
|
||||
try {
|
||||
@ -224,7 +224,17 @@
|
||||
return
|
||||
}
|
||||
}
|
||||
await approveLngPngAppro(params);
|
||||
let request = ''
|
||||
if (formPath.includes('dayPlan/PngAppro/index')) {
|
||||
request = approveLngPngAppro
|
||||
}
|
||||
if (formPath.includes('dayPlan/pngPipeAppro/index')) {
|
||||
request = approveLngPngApproGD
|
||||
}
|
||||
if (formPath.includes('dayPlan/pngReceiveStationAppro/index')) {
|
||||
request = approveLngPngApproSZ
|
||||
}
|
||||
await request(params);
|
||||
spinning.value = false;
|
||||
notification.success({
|
||||
message: 'Tip',
|
||||
|
||||
Reference in New Issue
Block a user