客户需求对比
This commit is contained in:
@ -5,22 +5,22 @@
|
||||
<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">
|
||||
<template v-if="pageType=='edit'||pageType=='update' ">
|
||||
<a-button style="margin-right: 10px" type="primary" @click="checkBtn('save')">
|
||||
<slot name="icon"><save-outlined /></slot>保存
|
||||
</a-button>
|
||||
<a-button style="margin-right: 10px" @click="checkBtn('submit')" v-if="!currentRoute.query.type">
|
||||
<a-button style="margin-right: 10px" @click="checkBtn('submit')">
|
||||
<slot name="icon"><send-outlined /></slot>保存并提交
|
||||
</a-button>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<Card :title="title" :bordered="false" >
|
||||
<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 :formObj="formState" :list="dataList" :disable="currentRoute.query.type"></basicForm>
|
||||
</Card>
|
||||
<Card :title="title" :bordered="false" v-if="pageType=='compare'&&titleNew">
|
||||
<basicForm :formObj="formStateNew" :changeList="diffResultList" :list="dataListNew" :disable="true"></basicForm>
|
||||
</Card>
|
||||
<Card :title="title" :bordered="false" v-if="title">
|
||||
<basicForm ref="formRef" :formObj="formState" :list="dataList" :disable="pageType=='view' || pageType=='compare'"></basicForm>
|
||||
</Card>
|
||||
|
||||
</div>
|
||||
</a-spin>
|
||||
@ -39,7 +39,7 @@
|
||||
import type { Rule } from 'ant-design-vue/es/form';
|
||||
import { getDictionary } from '/@/api/sales/Customer';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { addLngPngDemand, submitLngPngDemand,getLngPngDemand } from '/@/api/dayPlan/Demand';
|
||||
import { addLngPngDemand, submitLngPngDemand,getLngPngDemand,getLngPngDemandUpdate,getLngPngDemandCompare } from '/@/api/dayPlan/Demand';
|
||||
import dayjs from 'dayjs';
|
||||
import { getAppEnvConfig } from '/@/utils/env';
|
||||
import { message } from 'ant-design-vue';
|
||||
@ -48,70 +48,77 @@
|
||||
|
||||
const userStore = useUserStore();
|
||||
const userInfo = userStore.getUserInfo;
|
||||
|
||||
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 { currentRoute } = router
|
||||
|
||||
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 pageType = ref(currentRoute.value.query?.type)
|
||||
|
||||
const contractQty = ref()
|
||||
const spinning = ref(false);
|
||||
const curIdx = ref(null)
|
||||
const { notification } = useMessage();
|
||||
const { t } = useI18n();
|
||||
const hasDel = ref(false)
|
||||
const formState = reactive({
|
||||
datePlan: null
|
||||
});
|
||||
const formStateNew = reactive({})
|
||||
const [register, { openModal:openModal}] = useModal();
|
||||
|
||||
const title = ref('管道气需求')
|
||||
const dataList = ref([])
|
||||
const titleNew = ref('')
|
||||
const dataListNew = ref([])
|
||||
const basicFormRef = ref()
|
||||
let optionSelect= reactive({
|
||||
approCodeList: [],
|
||||
});
|
||||
watch(
|
||||
() => props.id,
|
||||
(val) => {
|
||||
if (val) {
|
||||
getInfo(val)
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true
|
||||
}
|
||||
);
|
||||
const diffResultList = ref([])
|
||||
const dataList = ref([])
|
||||
onMounted(() => {
|
||||
if (pageId.value) {
|
||||
if (pageType.value=='compare') {
|
||||
getCompareInfo(pageId.value)
|
||||
return
|
||||
}
|
||||
getInfo(pageId.value)
|
||||
}
|
||||
|
||||
});
|
||||
async function getCompareInfo(id) {
|
||||
spinning.value = true
|
||||
try {
|
||||
let data = await getLngPngDemandCompare(id) || {}
|
||||
spinning.value = false
|
||||
diffResultList.value = data.diffResultList || []
|
||||
let obj = changeData(data.oldBean || {})
|
||||
Object.assign(formState, {...obj.params})
|
||||
Object.assign(dataList.value, obj.list || [])
|
||||
title.value = formState.verNo? ('版本V'+ formState.verNo) : ''
|
||||
|
||||
let obj1 = changeData(data.newBean || {})
|
||||
Object.assign(formStateNew, {...obj1.params})
|
||||
Object.assign(dataListNew.value, obj1.list || [])
|
||||
titleNew.value = formStateNew.verNo ? ('版本V'+ formStateNew.verNo) : ''
|
||||
|
||||
} catch (error) {
|
||||
console.log(error,'error555555')
|
||||
spinning.value = false
|
||||
}
|
||||
|
||||
}
|
||||
async function getInfo(id) {
|
||||
spinning.value = true
|
||||
try {
|
||||
let data = await getLngPngDemand(id)
|
||||
spinning.value = false
|
||||
let obj = changeData(data)
|
||||
Object.assign(formState, {...obj.params})
|
||||
Object.assign(dataList.value, obj.list || [{}])
|
||||
let data = {}
|
||||
if (pageType.value == 'update') {
|
||||
data = await getLngPngDemandUpdate(id)
|
||||
} else {
|
||||
data = await getLngPngDemand(id)
|
||||
}
|
||||
spinning.value = false
|
||||
let obj = changeData(data)
|
||||
Object.assign(formState, {...obj.params})
|
||||
Object.assign(dataList.value, obj.list || [{}])
|
||||
|
||||
} catch (error) {
|
||||
console.log(error, 'error')
|
||||
@ -119,14 +126,14 @@
|
||||
}
|
||||
}
|
||||
const changeData = (obj) => {
|
||||
let arr = obj.lngPngDemandPurList || [{}]
|
||||
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 => {
|
||||
arr.length && arr.forEach(v => {
|
||||
v.qtyDemandM3 = Number(v.qtyDemandM3)/10000
|
||||
v.qtySalesM3 = Number(v.qtySalesM3)/10000
|
||||
|
||||
|
||||
Reference in New Issue
Block a user