|
@@ -1,7 +1,7 @@
|
|
|
<script setup>
|
|
|
import apiDataEDB from '@/api/dataEDB'
|
|
|
import { showToast } from 'vant';
|
|
|
-import {computed, reactive, ref} from 'vue'
|
|
|
+import {computed, nextTick, reactive, ref, watch} from 'vue'
|
|
|
import SelectEDB from './SelectEDB.vue'
|
|
|
import SelectEDBClassify from '../../components/SelectEDBClassify.vue'
|
|
|
import SelectEDBUnit from '../../components/SelectEDBUnit.vue'
|
|
@@ -10,14 +10,50 @@ import {calculateTypeTipsMap} from '../../util/config'
|
|
|
import { useRoute, useRouter } from 'vue-router';
|
|
|
import moment from 'moment';
|
|
|
|
|
|
+const props=defineProps({
|
|
|
+ edbInfo:{
|
|
|
+ type:Object,
|
|
|
+ default:null
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
+watch(
|
|
|
+ ()=>props.edbInfo,
|
|
|
+ ()=>{
|
|
|
+ if(route.query.type==='edit'){
|
|
|
+ edbList.value=props.edbInfo.CalculateList.map(item=>{
|
|
|
+ return {
|
|
|
+ tag:item.FromTag,
|
|
|
+ target:item.FromEdbInfoId,
|
|
|
+ startDate:item.StartDate,
|
|
|
+ endDate:item.EndDate,
|
|
|
+ name:item.FromEdbName
|
|
|
+ }
|
|
|
+ })
|
|
|
+ const obj=JSON.parse(props.edbInfo.EdbInfoDetail.CalculateFormula)
|
|
|
+ dateContactState.type=obj.DateType//会触发radio的change事件 所有下面用个nextTick
|
|
|
+ nextTick(()=>{
|
|
|
+ dateContactState.list=obj.CheckList
|
|
|
+ })
|
|
|
+ baseInfo.name=props.edbInfo.EdbInfoDetail.EdbName
|
|
|
+ baseInfo.unit=props.edbInfo.EdbInfoDetail.Unit
|
|
|
+ baseInfo.classify=props.edbInfo.EdbInfoDetail.ClassifyId
|
|
|
+ baseInfo.frequency=props.edbInfo.EdbInfoDetail.Frequency
|
|
|
+ setTimeout(() => {
|
|
|
+ selectEDBClassifyINS.value?.getSelectClassifyOpt(props.edbInfo.EdbInfoDetail.ClassifyId)//获取选择的分类目录
|
|
|
+ }, 1000);
|
|
|
+ }
|
|
|
+ }
|
|
|
+)
|
|
|
+
|
|
|
const route=useRoute()
|
|
|
const router=useRouter()
|
|
|
|
|
|
-const source=ref(Number(route.query.type)||0)//计算类型
|
|
|
+const source=ref(Number(route.query.source)||0)//计算类型
|
|
|
|
|
|
//公式说明
|
|
|
const showTips=ref(false)
|
|
|
-const tipsContent=ref(calculateTypeTipsMap.get(Number(route.query.type))||'')
|
|
|
+const tipsContent=ref(calculateTypeTipsMap.get(Number(route.query.source))||'')
|
|
|
|
|
|
|
|
|
const letterOpts = [];//字母数据
|
|
@@ -121,6 +157,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}`
|
|
@@ -171,7 +208,7 @@ async function handleSave(){
|
|
|
EdbInfoIdArr:arr
|
|
|
}
|
|
|
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(res.Msg)
|
|
@@ -305,7 +342,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"/>
|