|
@@ -1,6 +1,6 @@
|
|
|
<script setup>
|
|
|
import apiDataEDB from '@/api/dataEDB'
|
|
|
-import {ref,reactive, computed} from 'vue'
|
|
|
+import {ref,reactive, computed,watch} from 'vue'
|
|
|
import SelectEDB from './SelectEDB.vue'
|
|
|
import SelectEDBClassify from '../../components/SelectEDBClassify.vue'
|
|
|
import SelectEDBUnit from '../../components/SelectEDBUnit.vue'
|
|
@@ -12,6 +12,52 @@ import { useRoute, useRouter } from 'vue-router'
|
|
|
const route=useRoute()
|
|
|
const router=useRouter()
|
|
|
|
|
|
+const props=defineProps({
|
|
|
+ edbInfo:{
|
|
|
+ type:Object,
|
|
|
+ default:null
|
|
|
+ }
|
|
|
+})
|
|
|
+watch(
|
|
|
+ ()=>props.edbInfo,
|
|
|
+ ()=>{
|
|
|
+ if(route.query.type==='edit'){
|
|
|
+ const edbInfoData=props.edbInfo.EdbInfoDetail
|
|
|
+ if(edbInfoData.Source===24){//累计同比拼接
|
|
|
+ tabActive.value=2
|
|
|
+ }else{
|
|
|
+ tabActive.value=1
|
|
|
+ jointDate.value=edbInfoData.CalculateFormula
|
|
|
+ }
|
|
|
+ const temBeforeEDBInfo=props.edbInfo.CalculateList.find(item => item.FromTag === 'A')
|
|
|
+ const temAfterEDBInfo=props.edbInfo.CalculateList.find(item => item.FromTag === 'B')
|
|
|
+ beforeEDBInfo.value={
|
|
|
+ EdbName:temBeforeEDBInfo.FromEdbName,
|
|
|
+ EdbInfoId:temBeforeEDBInfo.FromEdbInfoId,
|
|
|
+ EndDate:temBeforeEDBInfo.EndDate,
|
|
|
+ StartDate:temBeforeEDBInfo.StartDate
|
|
|
+ }
|
|
|
+ afterEBDInfo.value={
|
|
|
+ EdbName:temAfterEDBInfo.FromEdbName,
|
|
|
+ EdbInfoId:temAfterEDBInfo.FromEdbInfoId,
|
|
|
+ EndDate:temAfterEDBInfo.EndDate,
|
|
|
+ StartDate:temAfterEDBInfo.StartDate
|
|
|
+ }
|
|
|
+
|
|
|
+ baseInfo.name=edbInfoData.EdbName
|
|
|
+ baseInfo.unit=edbInfoData.Unit
|
|
|
+ baseInfo.classify=edbInfoData.ClassifyId
|
|
|
+ baseInfo.frequency=edbInfoData.Frequency
|
|
|
+
|
|
|
+
|
|
|
+ setTimeout(() => {
|
|
|
+ selectEDBClassifyINS.value?.getSelectClassifyOpt(props.edbInfo.EdbInfoDetail.ClassifyId)//获取选择的分类目录
|
|
|
+ }, 1000);
|
|
|
+ }
|
|
|
+ }
|
|
|
+)
|
|
|
+
|
|
|
+
|
|
|
//公式说明
|
|
|
const tipsConfig=new Map([
|
|
|
[1,`
|
|
@@ -99,6 +145,7 @@ function onConfirmSelectUnit(value){
|
|
|
//选择分类
|
|
|
const showSelectClassify=ref(false)
|
|
|
const classifyStr=ref('')
|
|
|
+const selectEDBClassifyINS=ref(null)
|
|
|
function handleConfirmClassify({value,selectedOptions}){
|
|
|
baseInfo.classify=value
|
|
|
classifyStr.value=`${selectedOptions[0].ClassifyName}/${selectedOptions[1].ClassifyName}/${selectedOptions[2].ClassifyName}`
|
|
@@ -164,10 +211,10 @@ async function handleSave(){
|
|
|
Source:24
|
|
|
}
|
|
|
saveBtnLoading.value=true
|
|
|
- const res=await apiDataEDB.addCalculateEDB(params)
|
|
|
+ const res=route.query.type==='edit'?await apiDataEDB.editCalculateEDB({...params,EdbInfoId:Number(route.query.edbInfoId)}) : await apiDataEDB.addCalculateEDB(params)
|
|
|
saveBtnLoading.value=false
|
|
|
if(res.Ret===200){
|
|
|
- showToast('新增成功')
|
|
|
+ showToast(route.query.type==='edit'?'编辑成功':'新增成功')
|
|
|
setTimeout(() => {
|
|
|
router.back()
|
|
|
}, 1500);
|
|
@@ -187,6 +234,7 @@ async function handleSave(){
|
|
|
title-inactive-color="#333"
|
|
|
line-width="16px"
|
|
|
@change="handleTabChange"
|
|
|
+ v-if="$route.query.type!=='edit'"
|
|
|
>
|
|
|
<van-tab
|
|
|
:title="tab.label"
|
|
@@ -316,7 +364,7 @@ async function handleSave(){
|
|
|
<SelectEDBUnit v-model:show="showSelectUnit" @select="onConfirmSelectUnit"/>
|
|
|
|
|
|
<!-- 选择分类 -->
|
|
|
- <SelectEDBClassify v-model:show="showSelectClassify" @select="handleConfirmClassify" />
|
|
|
+ <SelectEDBClassify ref="selectEDBClassifyINS" :defaultId="baseInfo.classify" v-model:show="showSelectClassify" @select="handleConfirmClassify" />
|
|
|
|
|
|
<!-- 选择频度 -->
|
|
|
<SelectEDBFrequency v-model:show="showSelectFrequency" @select="handleConfirmFrequency"/>
|