Browse Source

v1.7.1_EDB

jwyu 1 year ago
parent
commit
95db047987

+ 44 - 0
src/api/dataEDB.js

@@ -297,6 +297,50 @@ export default{
      */
     editCalculateFormula(params){
         return post('/datamanage/edb_info/calculate/edit',params)
+    },
+
+    /**
+     * 指标计算新增
+     * @param FromEdbInfoId
+     * @param Source
+     * @param ClassifyId
+     * @param EdbName
+     * @param Frequency
+     * @param Unit
+     * @param Formula
+     * @param MoveFrequency
+     * @param MoveType
+     * @param Calendar
+     */
+    addCalculateEDB(params){
+        return post('/datamanage/edb_info/calculate/batch/save',params)
+    },
+
+    /**
+     * 指标计算编辑
+     * @param EdbInfoId
+     * @param FromEdbInfoId
+     * @param Source
+     * @param ClassifyId
+     * @param EdbName
+     * @param Frequency
+     * @param Unit
+     * @param Formula
+     * @param MoveFrequency
+     * @param MoveType
+     * @param Calendar
+     */
+    editCalculateEDB(params){
+        return post('/datamanage/edb_info/calculate/batch/edit',params)
+    },
+
+    /**
+     * 拟合残差两个指标相关系数
+     * @param Formula 传的日期eg:‘2023-08-10,2023-09-10’
+     * @param EdbInfoIdArr
+     */
+    edbCorrelationIndex(params){
+        return post('/datamanage/edb_info/calculate/compute_correlation',params)
     }
 
 }

+ 8 - 0
src/assets/svg/swap.svg

@@ -0,0 +1,8 @@
+<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
+<g id="swap">
+<g id="union">
+<path d="M2.50049 11.9999L26.0165 11.9999L18.3281 4.50217L19.7244 3.07031L29.0668 12.181C29.7475 12.8447 29.2776 13.9999 28.3268 13.9999L2.50049 13.9999V11.9999Z" fill="#0052D9"/>
+<path d="M29.5 19.9999L6.04053 19.9999L13.6611 27.2007L12.2874 28.6544L2.94908 19.8303C2.2522 19.1718 2.71812 17.9999 3.6771 17.9999L29.5 17.9999V19.9999Z" fill="#0052D9"/>
+</g>
+</g>
+</svg>

+ 46 - 0
src/components/SelectDate.vue

@@ -0,0 +1,46 @@
+<script setup>
+import moment from 'moment'
+import {ref} from 'vue'
+
+const props=defineProps({
+    show:{
+        type:Boolean,
+        default:false
+    }
+})
+const emits=defineEmits(['update:show','select'])
+
+function handleClose(){
+    emits('update:show',false)
+}
+
+const minDate=new Date(1970, 0, 1)
+const maxDate=moment().add(10,'years')._d
+const currentDate=ref(moment().format('YYYY-MM-DD').split('-'))
+
+function handleConfirmDate({selectedValues, selectedOptions}){
+    // console.log(selectedValues, selectedOptions);
+    emits('select',selectedValues.join('-'))
+    handleClose()
+}
+
+</script>
+
+<template>
+    <van-popup 
+        :show="props.show"
+        position="bottom"
+        round
+        @click-overlay="handleClose"
+        @click-close-icon="handleClose"
+    >
+        <van-date-picker
+            v-model="currentDate"
+            title="选择日期"
+            :min-date="minDate"
+            :max-date="maxDate"
+            @confirm="handleConfirmDate"
+            @cancel="handleClose"
+        />
+    </van-popup>
+</template>

+ 62 - 0
src/components/SelectDateRange.vue

@@ -0,0 +1,62 @@
+<script setup>
+import moment from 'moment'
+import { showToast } from 'vant'
+import {ref} from 'vue'
+
+const props=defineProps({
+    show:{
+        type:Boolean,
+        default:false
+    }
+})
+const emits=defineEmits(['update:show','select'])
+
+function handleClose(){
+    emits('update:show',false)
+}
+
+const minDate=new Date(1970, 0, 1)
+const maxDate=moment().add(10,'years')._d
+const startDate=ref(moment().format('YYYY-MM-DD').split('-'))
+const endDate=ref(moment().format('YYYY-MM-DD').split('-'))
+
+function handleConfirmDate(){
+    const isBefore=moment(endDate.value).isBefore(startDate.value,'day')
+    if(isBefore){
+        showToast('开始日期不能晚于结束日期')
+        return
+    }
+    emits('select',[startDate.value.join('-'),endDate.value.join('-')])
+    handleClose()
+}
+
+</script>
+
+<template>
+    <van-popup 
+        :show="props.show"
+        position="bottom"
+        round
+        next-step-text="下一步"
+        @click-overlay="handleClose"
+        @click-close-icon="handleClose"
+    >
+        <van-picker-group
+            title="选择日期"
+            :tabs="['开始日期', '结束日期']"
+            @confirm="handleConfirmDate"
+            @cancel="handleClose"
+        >
+            <van-date-picker
+                v-model="startDate"
+                :min-date="minDate"
+                :max-date="maxDate"
+            />
+            <van-date-picker 
+                v-model="endDate" 
+                :min-date="minDate" 
+                :max-date="maxDate" 
+            />
+        </van-picker-group>
+    </van-popup>
+</template>

+ 6 - 0
src/views/dataEDB/calculate/Detail.vue

@@ -1,7 +1,9 @@
 <script setup name="DataEDBCalculateDetail">
 import {ref} from 'vue'
 import { useRoute } from "vue-router";
+import FittingResidualsCalculate from './components/FittingResidualsCalculate.vue';
 import FormulaCalculate from './components/FormulaCalculate.vue';
+import JointCalculate from './components/JointCalculate.vue';
 import OtherCalculate from './components/OtherCalculate.vue';
 
 const route=useRoute()
@@ -16,4 +18,8 @@ document.title=route.query.name||'指标运算'
     <FormulaCalculate v-if="['4'].includes(type)"/>
     <!-- 其他的运算 -->
     <OtherCalculate v-if="['toMonthSeason','6','7','8','12','13','14','22','35','51','52','accumulate'].includes(type)"/>
+    <!-- 拼接计算 -->
+    <JointCalculate v-if="type==='joint'"/>
+    <!-- 拟合残差计算 -->
+    <FittingResidualsCalculate v-if="type==='37'"/>
 </template>

+ 418 - 0
src/views/dataEDB/calculate/components/FittingResidualsCalculate.vue

@@ -0,0 +1,418 @@
+<script setup>
+import apiDataEDB from '@/api/dataEDB'
+import {calculateTypeTipsMap} from '../../util/config'
+import {ref,reactive} from 'vue'
+import SelectEDB from './SelectEDB.vue'
+import SelectEDBClassify from '../../components/SelectEDBClassify.vue'
+import SelectEDBUnit from '../../components/SelectEDBUnit.vue'
+import SelectEDBFrequency from '../../components/SelectEDBFrequency.vue'
+import SelectDateRange from '@/components/SelectDateRange.vue'
+import { showToast } from 'vant'
+import { useRoute, useRouter } from 'vue-router'
+import moment from 'moment'
+
+const route=useRoute()
+const router=useRouter()
+
+const source=ref(Number(route.query.type)||0)//计算类型
+
+//公式说明
+const showTips=ref(false)
+const tipsContent=ref(calculateTypeTipsMap.get(['toMonthSeason','accumulate'].includes(route.query.type)? route.query.type: Number(route.query.type))||'')
+
+// 获取两个指标的相关系数
+const correlationIndex=ref('')
+async function getEDBCorrelationIndex(){
+    if(!independentEDBInfo.value||!dependentEDBInfo.value||fittingDate.value.length===0) return correlationIndex.value=''
+    if(selfMoveType.value===1&&!selfMoveVal.value) return correlationIndex.value=''
+    const params={
+        Formula:fittingDate.value.join(','),
+        EdbInfoIdArr:[
+            {
+                EdbInfoId:independentEDBInfo.value.EdbInfoId,
+                FromTag: 'A',
+                MoveValue:selfMoveType.value===0?0:Number(selfMoveVal.value)
+            },
+            {
+                EdbInfoId:dependentEDBInfo.value.EdbInfoId,
+                FromTag: 'B',
+                MoveValue:0
+            }
+        ]
+    }
+    const res=await apiDataEDB.edbCorrelationIndex(params)
+    if(res.Ret===200){
+        correlationIndex.value=res.Data
+    }
+}
+
+// 选择指标
+const showSelectEDB=ref(false)
+const independentEDBInfo=ref(null)//自变量指标
+const dependentEDBInfo=ref(null)//因变量指标
+let currentSelectEDBType=''
+function handleShowSelectEDB(type){
+    currentSelectEDBType=type
+    showSelectEDB.value=true
+}
+function handleConfirmSelectEDB(e){
+    if(currentSelectEDBType==='independent'){
+        independentEDBInfo.value=e
+    }else{
+        dependentEDBInfo.value=e
+    }
+    if(independentEDBInfo.value&&dependentEDBInfo.value){
+        baseInfo.name=`${dependentEDBInfo.value.EdbName}拟合残差/${independentEDBInfo.value.EdbName}`
+    }
+    getEDBCorrelationIndex()
+}
+
+// 类型
+const selfMoveType=ref(0)
+const selfMoveVal=ref('')
+function handleSelfMoveTypeChange(){
+    selfMoveVal.value=''
+    getEDBCorrelationIndex()
+}
+
+//拟合时间段
+const showFittingDate=ref(false)
+const fittingDate=ref([])
+function handleConfirmFittingDate(e){
+    // 日期间隔不得少于两天
+    const diff=moment(e[1]).diff(e[0],'days')
+    if(diff<2){
+        showToast('日期间隔不得少于两天')
+        return
+    }
+    fittingDate.value=e
+    getEDBCorrelationIndex()
+}
+
+// 基础信息
+const edbNameInputFocus=ref(false)
+const baseInfo=reactive({
+    name:'',
+    unit:'',
+    classify:'',
+    frequency:''
+})
+
+// 选择单位
+const showSelectUnit=ref(false)
+function onConfirmSelectUnit(value){
+    baseInfo.unit=value
+}
+
+//选择分类
+const showSelectClassify=ref(false)
+const classifyStr=ref('')
+function handleConfirmClassify({value,selectedOptions}){
+    baseInfo.classify=value
+    classifyStr.value=`${selectedOptions[0].ClassifyName}/${selectedOptions[1].ClassifyName}/${selectedOptions[2].ClassifyName}`
+}
+
+//选择频度
+const showSelectFrequency=ref(false)
+function handleConfirmFrequency(value){
+    baseInfo.frequency=value
+}
+
+// 提交计算
+const saveBtnLoading=ref(false)
+async function handleSave(){
+    if(!independentEDBInfo.value){
+        showToast('自变量不能为空')
+        return
+    }
+    if(!dependentEDBInfo.value){
+        showToast('因变量不能为空')
+        return
+    }
+    if(fittingDate.value.length===0){
+        showToast('拟合时间段不能为空')
+        return
+    }
+    if(!baseInfo.name){
+        showToast('指标名称不能为空')
+        return
+    }
+    if(!baseInfo.unit){
+        showToast('指标单位不能为空')
+        return
+    }
+    if(!baseInfo.classify){
+        showToast('指标目录不能为空')
+        return
+    }
+    if(!baseInfo.frequency){
+        showToast('指标频度不能为空')
+        return
+    }
+    const params={
+        Source: source.value,
+		EdbName: baseInfo.name,
+		Unit: baseInfo.unit,
+		ClassifyId: baseInfo.classify,
+		Frequency: baseInfo.frequency,
+        Formula:fittingDate.value.join(','),
+        EdbInfoIdArr:[
+            {
+                EdbInfoId:independentEDBInfo.value.EdbInfoId,
+                FromTag: 'A',
+                MoveValue:selfMoveType.value===0?0:Number(selfMoveVal.value)
+            },
+            {
+                EdbInfoId:dependentEDBInfo.value.EdbInfoId,
+                FromTag: 'B',
+                MoveValue:0
+            }
+        ]
+    }
+    saveBtnLoading.value=true
+    const res=await apiDataEDB.addCalculateEDB(params)
+    saveBtnLoading.value=false
+    if(res.Ret===200){
+        showToast(res.Msg)
+        setTimeout(() => {
+            router.back()
+        }, 1500);
+    }
+}
+
+</script>
+
+<template>
+    <div class="fitting-residuals-wrap">
+        <section class="section select-edb-box">
+            <van-field 
+                label="自变量"
+                required
+                right-icon="arrow"
+                @click-input="handleShowSelectEDB('independent')"
+            >
+                <template #input>
+                    <div class="edb-info-box">
+                        <div class="edb-info" v-if="independentEDBInfo">
+                            <span class="name">{{independentEDBInfo.EdbName}}</span>
+                            <span class="time">{{independentEDBInfo.StartDate}}至{{independentEDBInfo.EndDate}}</span>
+                        </div>
+                        <span class="placeholder" v-else>请选择指标</span>
+                    </div>
+                </template>
+            </van-field>
+            <van-cell>
+                <div class="self-move-type-box">
+                    <van-radio-group v-model="selfMoveType" shape="dot" direction="horizontal" @change="handleSelfMoveTypeChange">
+                        <van-radio :name="0">标准指标</van-radio>
+                        <van-radio :name="1">领先天数</van-radio>
+                    </van-radio-group>
+                    <div class="day-box" v-show="selfMoveType===1">
+                        <input class="input" type="number" :min="0" v-model="selfMoveVal" @change="getEDBCorrelationIndex()">
+                        <span>天</span>
+                    </div>
+                </div>
+            </van-cell>
+            <van-field 
+                label="因变量"
+                required
+                right-icon="arrow"
+                @click-input="handleShowSelectEDB('dependent')"
+            >
+                <template #input>
+                    <div class="edb-info-box">
+                        <div class="edb-info" v-if="dependentEDBInfo">
+                            <span class="name">{{dependentEDBInfo.EdbName}}</span>
+                            <span class="time">{{dependentEDBInfo.StartDate}}至{{dependentEDBInfo.EndDate}}</span>
+                        </div>
+                        <span class="placeholder" v-else>请选择指标</span>
+                    </div>
+                </template>
+            </van-field>
+            <van-field
+                label="拟合时间段"
+                right-icon="arrow"
+                required
+                @click-input="showFittingDate=true"
+            >
+                <template #input>
+                    <div class="edb-info-box">
+                        <div class="edb-info" v-if="fittingDate.length>0">
+                            <span class="name">{{fittingDate[0]}}~{{fittingDate[1]}}</span>
+                            <span class="time" v-if="correlationIndex">相关系数:{{correlationIndex}}</span>
+                        </div>
+                        <span class="placeholder" v-else>请选择时间段</span>
+                    </div>
+                </template>
+            </van-field>
+        </section>
+        <section class="section baseinfo-box">
+            <van-field 
+                v-model="baseInfo.name" 
+                label="指标名称" 
+                placeholder="指标名称"
+                input-align="right"
+                required
+                @focus="edbNameInputFocus=true"
+                @blur="edbNameInputFocus=false"
+            >
+                <template #right-icon>
+                    <svg-icon class="edit-icon" name="edit" :color="edbNameInputFocus?'#0052D9':'#333333'"/>
+                </template>
+            </van-field>
+            <van-field 
+                :modelValue="baseInfo.unit"
+                readonly
+                label="单位" 
+                placeholder="请选择单位"
+                input-align="right"
+                right-icon="arrow"
+                required
+                @click-input="showSelectUnit=true"
+            />
+            <van-field 
+                :modelValue="classifyStr"
+                readonly
+                label="指标目录" 
+                placeholder="请选择指标目录"
+                input-align="right"
+                right-icon="arrow"
+                required
+                @click-input="showSelectClassify=true"
+            />
+            <van-field 
+                :modelValue="baseInfo.frequency"
+                readonly
+                label="频度" 
+                placeholder="请选择指标频度"
+                input-align="right"
+                right-icon="arrow"
+                required
+                @click-input="showSelectFrequency=true"
+            />
+        </section>
+
+        <div class="formula-intro-btn" @click="showTips=true">
+            <svg-icon class="icon" name="warning"></svg-icon>
+            <span>公式说明</span>
+        </div>
+
+        <div class="opt-btns">
+            <van-button class="primary2" @click="$router.back()">取消</van-button>
+            <van-button 
+                type="primary" 
+                :loading="saveBtnLoading"
+                loading-text="计算中..."
+                @click="handleSave"
+            >拟合残差计算</van-button>
+        </div>
+    </div>
+
+    <!-- 选择指标 -->
+    <SelectEDB v-model:show="showSelectEDB" :params="{FilterSource:1}" @select="handleConfirmSelectEDB"/>
+
+    <!-- 选择时间段 -->
+    <SelectDateRange v-model:show="showFittingDate" @select="handleConfirmFittingDate"/>
+
+    <!-- 选择单位 -->
+    <SelectEDBUnit v-model:show="showSelectUnit" @select="onConfirmSelectUnit"/>
+
+    <!-- 选择分类 -->
+    <SelectEDBClassify v-model:show="showSelectClassify" @select="handleConfirmClassify" />
+
+    <!-- 选择频度 -->
+    <SelectEDBFrequency v-model:show="showSelectFrequency" @select="handleConfirmFrequency"/>
+
+    <!-- 公式说明 -->
+    <van-dialog 
+        v-model:show="showTips" 
+        :title="$route.query.name"
+        confirmButtonText='知道啦'
+    >
+        <div class="edb-formula-tips-html-box" v-html="tipsContent"></div>
+    </van-dialog>
+</template>
+
+<style lang="scss" scoped>
+.fitting-residuals-wrap{
+    min-height: 90vh;
+    background-color: $page-bg-grey;
+    padding-bottom: 210px ;
+}
+.section{
+    background-color: #fff;
+    margin-bottom: 32px;
+}
+.self-move-type-box{
+    padding: 20px 0;
+    display: flex;
+    justify-content: space-between;
+    .day-box{
+        display: flex;
+        align-items: center;
+        gap: 5px;
+        .input{
+            width: 80px;
+            height: 48px;
+            border: 1px solid #DCDCDC;
+            border-radius: 6px;
+            text-align: center;
+            padding: 0 10px;
+            color: #333;
+        }
+    }
+}
+.select-edb-box{
+    :deep(.van-cell__right-icon){
+        align-self: center;
+        color: #333;
+    }
+    .edb-info-box{
+        width: 100%;
+        text-align: right;
+        .placeholder{
+            color: var(--van-text-color-3);
+        }
+        .edb-info{
+            display: flex;
+            flex-direction: column;
+        }
+        .time{
+            color: $font-grey_999;
+            font-size: 24px;
+        }
+    }
+}
+.formula-intro-btn{
+    width: 180px;
+    height: 60px;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    gap: 5px;
+    color: $theme-color;
+    line-height: 1;
+    background-color: #fff;
+    border-radius: 32px;
+    margin-left: auto;
+    margin-right: var(--van-cell-horizontal-padding);
+    .icon{
+        width: 24px;
+        height: 24px;
+    }
+}
+.opt-btns{
+    position: fixed;
+    left: 0;
+    right: 0;
+    bottom: 0;
+    background-color: #fff;
+    z-index: 99;
+    padding: 48px;
+    display: flex;
+    justify-content: space-between;
+    .van-button{
+        width: 48%;
+    }
+}
+</style>

+ 397 - 0
src/views/dataEDB/calculate/components/JointCalculate.vue

@@ -0,0 +1,397 @@
+<script setup>
+import apiDataEDB from '@/api/dataEDB'
+import {ref,reactive, computed} from 'vue'
+import SelectEDB from './SelectEDB.vue'
+import SelectEDBClassify from '../../components/SelectEDBClassify.vue'
+import SelectEDBUnit from '../../components/SelectEDBUnit.vue'
+import SelectEDBFrequency from '../../components/SelectEDBFrequency.vue'
+import SelectDate from '@/components/SelectDate.vue'
+import { showToast } from 'vant'
+import { useRoute, useRouter } from 'vue-router'
+
+const route=useRoute()
+const router=useRouter()
+
+//公式说明
+const tipsConfig=new Map([
+	[1,`
+		直接拼接说明:<br>
+		1、选取拼接日期<br>
+		2、在拼接日期之前的数据选择指标A<br>
+		3、拼接日期之后的数据选择指标B<br>
+		4、新指标的起始日期为A的开始日期,更新时间跟随指标B进行更新<br>
+		5、指标A和B可以是原始指标,也可以是计算指标
+	`],
+	[2,`
+		累计值同比拼接说明:<br>
+		1、只支持月频度的指标进行累计值同比拼接<br>
+		2、如果出现有空值运算,则返回空值<br>
+		3、选取待拼接指标A和同比值指标B<br>
+		4、搜索到指标A最后一个12月31日有值的年份,并且向前回溯12个值(12个月),分别乘以下一年同期对应的同比增长率(B),公式为【A*(1+同期增长率(B)/100)】,得到下一年每个月的绝对值,再用新得到的下一年的12个月的值再乘以再下一年同期对应的同比增长率,得到再下一年每个月的绝对值<br>
+		5、以此类推,直到运算至指标B的最新值,得到新的序列C<br>
+		6、新指标是将序列C和指标A进行直接拼接,拼接日期选取指标A中有值的年份的年末最后一天即12月31日,再与序列C的起始日期做拼接<br>
+		7、新指标跟随指标B进行更新
+	`],
+])
+const showTips=ref(false)
+const tipsContent=computed(()=>{
+    return tipsConfig.get(tabActive.value)
+})
+
+const tabsArr=ref([{ label: '直接拼接',key: 1 },{ label: '累计同比拼接',key: 2 }])
+const tabActive=ref(1)
+function handleTabChange(){
+    jointDate.value=''
+    beforeEDBInfo.value=null
+    afterEBDInfo.value=null
+    baseInfo.name=''
+    baseInfo.unit=''
+    baseInfo.classify=''
+    baseInfo.frequency=''
+}
+
+//拼接日期
+const jointDate=ref('')
+const showSelectJointDate=ref(false)
+function handleConfirmJointDate(e){
+    jointDate.value=e
+}
+
+
+// 选择指标
+const selectEDBSearchParams=ref({})
+const beforeEDBInfo=ref(null)
+const afterEBDInfo=ref(null)
+const showSelectEDB=ref(false)
+let currentSelectEDBType=''//当前是选择哪个指标
+function handleShowSelectEDB(type){
+    currentSelectEDBType=type
+    if(tabActive.value===2&&type==='before'){//累计同比值拼接选择待拼接指标搜索指标时Frequency传月度
+        selectEDBSearchParams.value={Frequency:'月度'}
+    }else{
+        selectEDBSearchParams.value={}
+    }
+    showSelectEDB.value=true
+}
+function handleConfirmSelectEDB(e){
+    if(currentSelectEDBType==='before'){
+        beforeEDBInfo.value=e
+    }else{
+        afterEBDInfo.value=e
+    }
+}
+
+// 基础信息
+const edbNameInputFocus=ref(false)
+const baseInfo=reactive({
+    name:'',
+    unit:'',
+    classify:'',
+    frequency:''
+})
+
+// 选择单位
+const showSelectUnit=ref(false)
+function onConfirmSelectUnit(value){
+    baseInfo.unit=value
+}
+
+//选择分类
+const showSelectClassify=ref(false)
+const classifyStr=ref('')
+function handleConfirmClassify({value,selectedOptions}){
+    baseInfo.classify=value
+    classifyStr.value=`${selectedOptions[0].ClassifyName}/${selectedOptions[1].ClassifyName}/${selectedOptions[2].ClassifyName}`
+}
+
+//选择频度
+const showSelectFrequency=ref(false)
+function handleConfirmFrequency(value){
+    baseInfo.frequency=value
+}
+
+// 提交计算
+const saveBtnLoading=ref(false)
+async function handleSave(){
+    if(tabActive.value===1&&!jointDate.value){
+        showToast('拼接日期不能为空')
+        return
+    }
+    if(!beforeEDBInfo.value){
+        showToast(tabActive.value===1?'指标不能为空':'待拼接指标不能为空')
+        return
+    }
+    if(!afterEBDInfo.value){
+        showToast(tabActive.value===1?'指标不能为空':'指标不能为空')
+        return
+    }
+    if(!baseInfo.name){
+        showToast('指标名称不能为空')
+        return
+    }
+    if(!baseInfo.unit){
+        showToast('指标单位不能为空')
+        return
+    }
+    if(!baseInfo.classify){
+        showToast('指标目录不能为空')
+        return
+    }
+    if(!baseInfo.frequency){
+        showToast('指标频度不能为空')
+        return
+    }
+    const baseParams={
+        ClassifyId:baseInfo.classify,
+        EdbName:baseInfo.name,
+        Frequency:baseInfo.frequency,
+        Unit:baseInfo.unit,
+    }
+    const params=tabActive.value===1?{
+        ...baseParams,
+        EdbInfoIdArr:[
+            {EdbInfoId:afterEBDInfo.value.EdbInfoId}
+        ],
+        Formula:jointDate.value,
+        FromEdbInfoId:beforeEDBInfo.value.EdbInfoId,
+        Source:23
+    }:{
+        ...baseParams,
+        EdbInfoIdArr:[
+            {EdbInfoId:afterEBDInfo.value.EdbInfoId}
+        ],
+        FromEdbInfoId:beforeEDBInfo.value.EdbInfoId,
+        Source:24
+    }
+    saveBtnLoading.value=true
+    const res=await apiDataEDB.addCalculateEDB(params)
+    saveBtnLoading.value=false
+    if(res.Ret===200){
+        showToast('新增成功')
+        setTimeout(() => {
+            router.back()
+        }, 1500);
+    }
+}
+
+
+</script>
+
+<template>
+    <div class="joint-calculate-wrap">
+        <van-tabs 
+            v-model:active="tabActive" 
+            sticky 
+            border 
+            title-active-color="#0052D9" 
+            title-inactive-color="#333" 
+            line-width="16px"
+            @change="handleTabChange"
+        >
+            <van-tab 
+                :title="tab.label" 
+                :name="tab.key" 
+                v-for="tab in tabsArr" 
+                :key="tab.key"
+            />
+        </van-tabs>
+        <section class="section select-edb-box">
+            <van-field 
+                :modelValue="jointDate"
+                readonly
+                label="拼接日期" 
+                placeholder="请选择日期"
+                input-align="right"
+                right-icon="arrow"
+                required
+                @click-input="showSelectJointDate=true"
+                v-if="tabActive===1"
+            />
+            <van-field
+                label-width="7em"
+                :label="tabActive===1?'拼接日期之前':'待拼接指标'"
+                required
+                right-icon="arrow"
+                @click-input="handleShowSelectEDB('before')"
+            >
+                <template #input>
+                    <div class="edb-info-box">
+                        <div class="edb-info" v-if="beforeEDBInfo">
+                            <span class="name">{{beforeEDBInfo.EdbName}}</span>
+                            <span class="time" v-if="tabActive===1">(起始日期:{{beforeEDBInfo.StartDate}})</span>
+                            <span class="time" v-if="tabActive===2">(截至日期:{{beforeEDBInfo.EndDate}})</span>
+                        </div>
+                        <span class="placeholder" v-else>请选择指标</span>
+                    </div>
+                </template>
+            </van-field>
+            <van-field
+                label-width="7em"
+                :label="tabActive===1?'拼接日期之后':'同比值指标'"
+                right-icon="arrow"
+                required
+                @click-input="handleShowSelectEDB('after')"
+            >
+                <template #input>
+                    <div class="edb-info-box">
+                        <div class="edb-info" v-if="afterEBDInfo">
+                            <span class="name">{{afterEBDInfo.EdbName}}</span>
+                            <span class="time" v-if="tabActive===1">(最新日期:{{afterEBDInfo.EndDate}})</span>
+                        </div>
+                        <span class="placeholder" v-else>请选择指标</span>
+                    </div>
+                </template>
+            </van-field>
+        </section>
+
+        <section class="section baseinfo-box">
+            <van-field 
+                v-model="baseInfo.name" 
+                label="指标名称" 
+                placeholder="指标名称"
+                input-align="right"
+                required
+                @focus="edbNameInputFocus=true"
+                @blur="edbNameInputFocus=false"
+            >
+                <template #right-icon>
+                    <svg-icon class="edit-icon" name="edit" :color="edbNameInputFocus?'#0052D9':'#333333'"/>
+                </template>
+            </van-field>
+            <van-field 
+                :modelValue="baseInfo.unit"
+                readonly
+                label="单位" 
+                placeholder="请选择单位"
+                input-align="right"
+                right-icon="arrow"
+                required
+                @click-input="showSelectUnit=true"
+            />
+            <van-field 
+                :modelValue="classifyStr"
+                readonly
+                label="指标目录" 
+                placeholder="请选择指标目录"
+                input-align="right"
+                right-icon="arrow"
+                required
+                @click-input="showSelectClassify=true"
+            />
+            <van-field 
+                :modelValue="baseInfo.frequency"
+                readonly
+                label="频度" 
+                placeholder="请选择指标频度"
+                input-align="right"
+                right-icon="arrow"
+                required
+                @click-input="showSelectFrequency=true"
+            />
+        </section>
+
+        <div class="formula-intro-btn" @click="showTips=true">
+            <svg-icon class="icon" name="warning"></svg-icon>
+            <span>公式说明</span>
+        </div>
+
+        <div class="opt-btns">
+            <van-button class="primary2" @click="$router.back()">取消</van-button>
+            <van-button 
+                type="primary" 
+                :loading="saveBtnLoading"
+                loading-text="计算中..."
+                @click="handleSave"
+            >保存</van-button>
+        </div>
+    </div>
+
+    <!-- 选择拼接日期 -->
+    <SelectDate v-model:show="showSelectJointDate" @select="handleConfirmJointDate"/>
+
+    <!-- 选择指标 -->
+    <SelectEDB v-model:show="showSelectEDB" :params="selectEDBSearchParams" @select="handleConfirmSelectEDB"/>
+
+    <!-- 选择单位 -->
+    <SelectEDBUnit v-model:show="showSelectUnit" @select="onConfirmSelectUnit"/>
+
+    <!-- 选择分类 -->
+    <SelectEDBClassify v-model:show="showSelectClassify" @select="handleConfirmClassify" />
+
+    <!-- 选择频度 -->
+    <SelectEDBFrequency v-model:show="showSelectFrequency" @select="handleConfirmFrequency"/>
+
+    <!-- 公式说明 -->
+    <van-dialog 
+        v-model:show="showTips" 
+        :title="$route.query.name"
+        confirmButtonText='知道啦'
+    >
+        <div class="edb-formula-tips-html-box" v-html="tipsContent"></div>
+    </van-dialog>
+</template>
+
+<style lang="scss" scoped>
+.joint-calculate-wrap{
+    min-height: 90vh;
+    background-color: $page-bg-grey;
+    padding-bottom: 210px ;
+}
+.section{
+    background-color: #fff;
+    margin-bottom: 32px;
+}
+.select-edb-box{
+    :deep(.van-cell__right-icon){
+        align-self: center;
+        color: #333;
+    }
+    .edb-info-box{
+        width: 100%;
+        text-align: right;
+        .placeholder{
+            color: var(--van-text-color-3);
+        }
+        .edb-info{
+            display: flex;
+            flex-direction: column;
+        }
+        .time{
+            color: $font-grey_999;
+            font-size: 24px;
+        }
+    }
+}
+.formula-intro-btn{
+    width: 180px;
+    height: 60px;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    gap: 5px;
+    color: $theme-color;
+    line-height: 1;
+    background-color: #fff;
+    border-radius: 32px;
+    margin-left: auto;
+    margin-right: var(--van-cell-horizontal-padding);
+    .icon{
+        width: 24px;
+        height: 24px;
+    }
+}
+.opt-btns{
+    position: fixed;
+    left: 0;
+    right: 0;
+    bottom: 0;
+    background-color: #fff;
+    z-index: 99;
+    padding: 48px;
+    display: flex;
+    justify-content: space-between;
+    .van-button{
+        width: 48%;
+    }
+}
+</style>

+ 239 - 17
src/views/dataEDB/calculate/components/OtherCalculate.vue

@@ -5,16 +5,53 @@ import SelectEDB from './SelectEDB.vue'
 import SelectEDBClassify from '../../components/SelectEDBClassify.vue'
 import SelectEDBUnit from '../../components/SelectEDBUnit.vue'
 import SelectEDBFrequency from '../../components/SelectEDBFrequency.vue'
+import SeeEDBDataList from './SeeEDBDataList.vue'
 import {calculateTypeTipsMap} from '../../util/config'
+import { showToast } from 'vant';
+import apiDataEDB from '@/api/dataEDB'
 
 const route=useRoute()
 const router=useRouter()
 
+const moveTypeOpts=[{name:'领先',key:1},{name:'滞后',key:2}]
+const moveUnitOpts=[
+    {name:'天',key:'天'},
+    {name:'周',key:'周'},
+    {name:'月',key:'月'},
+    {name:'季',key:'季'},
+    {name:'年',key:'年'},
+]
+
 //公式说明
 const showTips=ref(false)
 const tipsContent=ref(calculateTypeTipsMap.get(['toMonthSeason','accumulate'].includes(route.query.type)? route.query.type: Number(route.query.type))||'')
 
-let source=ref(0)//计算类型
+//提交计算按钮文字
+function getCalculateBtnText(){
+    let str='生成计算指标'
+    const btnTextMap=new Map([
+		[5,'转月值计算'],
+		[6,'同比值计算'],
+		[7,'同差值计算'],
+		[8,'移动平均计算'],
+		[12,'环比值计算'],
+		[13,'环差值计算'],
+		[14,'升频计算'],
+		[22,'保存'],
+		[35,'超季节性计算'],
+		[52,'年化计算'],
+		[51,'降频计算'],
+		[61,'转季值计算'],
+		[62,'累计值计算'],
+		[63,'年初至今计算'],
+	])
+    str=btnTextMap.get(source.value)
+
+    return str
+}
+
+const editEdbInfoId=ref(route.query.edbInfoId||0)//编辑时的指标id
+const source=ref(0)//计算类型
 const tabsArr=ref([])
 // 初始化
 function init(){
@@ -52,13 +89,13 @@ function updateBaseInfoData(data){
 	])
 	const name_map = {
 		5: data.EdbName,
-		// 8: `${data.EdbName}/${this.formData.n_num}${tMap.get(data.Frequency)}MA`,
+		8: `${data.EdbName}/${baseInfo.numberN}${tMap.get(data.Frequency)}MA`,
 		14: `${data.EdbName}/${data.Frequency}升频`,
 		6: `${data.EdbName}同比`,
 		7: `${data.EdbName}同差`,
-		// 12: `${data.EdbName}${this.formData.n_num}${data.Frequency.slice(0,1)}环比`,
-		// 13: `${data.EdbName}${this.formData.n_num}${data.Frequency.slice(0,1)}环差`,
-		// 35: `${data.EdbName}超季节性/${this.formData.n_num}年${this.formData.calendar_type==='公历'?'':'/'+this.formData.calendar_type}`,
+		12: `${data.EdbName}${baseInfo.numberN}${data.Frequency.slice(0,1)}环比`,
+		13: `${data.EdbName}${baseInfo.numberN}${data.Frequency.slice(0,1)}环差`,
+		35: `${data.EdbName}超季节性/${baseInfo.numberN}年${baseInfo.calendarType==='公历'?'':'/'+baseInfo.calendarType}`,
 		52: `${data.EdbName}年化`,
 		51: `${data.EdbName}/${data.Frequency}降频`,
 		61:  data.EdbName,
@@ -66,18 +103,27 @@ function updateBaseInfoData(data){
 		63:  data.EdbName,
 	}
     baseInfo.name=name_map[source.value]||''
-    baseInfo.unit=data.Unit
-    baseInfo.frequency=source === 14 ? '日度' : source === 61 ? '季度' : source === 62 ? '' : data.Frequency
-    baseInfo.classify=data.ClassifyId
+    baseInfo.unit=[5,8,14,7,35].includes(source.value) ? data.Unit : '无',
+    baseInfo.frequency=source.value === 14 ? '日度' : source.value === 61 ? '季度' : source.value === 62 ? '' : data.Frequency
+
+    // baseInfo.classify=data.ClassifyId
+    // selectEDBClassifyINS.value?.getSelectClassifyOpt(data.ClassifyId)//获取选择的分类目录
 }
 
 // 基础信息
 const edbNameInputFocus=ref(false)
+const numberNInputFocus=ref(false)
 const baseInfo=reactive({
     name:'',
     unit:'',
     classify:'',
-    frequency:''
+    frequency:'',
+    numberN:1,//N值
+    moveVal:'',
+    moveType:1,
+    moveUnit:'天',
+    calendarType:'公历',
+    valueType:'期末值'
 })
 
 // 选择单位
@@ -89,6 +135,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}`
@@ -100,8 +147,93 @@ function handleConfirmFrequency(value){
     baseInfo.frequency=value
 }
 
+//移动方式类型选择
+const showMoveType=ref(false)
+function onSelectMoveType(e){
+    baseInfo.moveType=e.key
+}
+function getMoveTypeName(e){
+    return moveTypeOpts.filter(item=>item.key===e)[0].name
+}
+
+//移动方式单位选择
+const showMoveUnit=ref(false)
+function onSelectMoveUnit(e){
+    baseInfo.moveUnit=e.key
+}
+
+//超季节性日历选择
+const showSelectCalendar=ref(false)
+
+//查看指标数据详情
+const showSeeEDBDataList=ref(false)
+
+// 提交计算
+const saveBtnLoading=ref(false)
+async function handleSave(){
+    if(!selectEDBinfo.value){
+        showToast('指标不能为空')
+        return
+    }
+    if(!baseInfo.name){
+        showToast('指标名称不能为空')
+        return
+    }
+    if(!baseInfo.unit){
+        showToast('指标单位不能为空')
+        return
+    }
+    if(!baseInfo.classify){
+        showToast('指标目录不能为空')
+        return
+    }
+    if(!baseInfo.frequency){
+        showToast('指标频度不能为空')
+        return
+    }
 
-function handleSave(){
+    const valueMap = {
+		22: 'moveVal',
+		51: 'valueType'
+	}
+    const params={
+        FromEdbInfoId: selectEDBinfo.value.EdbInfoId,
+        Source: source.value,
+		EdbName: baseInfo.name,
+		Unit: baseInfo.unit,
+		ClassifyId: baseInfo.classify,
+		Frequency: baseInfo.frequency,
+		Formula: valueMap[source.value] ? String(baseInfo[valueMap[source.value]]) : String(baseInfo.numberN),
+		MoveFrequency: baseInfo.moveUnit,
+		MoveType: baseInfo.moveType, 
+		Calendar: baseInfo.calendarType,
+    }
+
+    saveBtnLoading.value=true
+    const res=await apiDataEDB.addCalculateEDB(params)
+    saveBtnLoading.value=false
+    if(res.Ret===200){
+        showToast(res.Msg)
+        setTimeout(() => {
+            router.back()
+        }, 1500);
+    }
+}
+
+// tab切换重置表单
+function handleTabChange(){
+    selectEDBinfo.value=null
+    baseInfo.name=''
+    baseInfo.unit=''
+    baseInfo.classify=''
+    baseInfo.frequency=''
+    baseInfo.numberN=1
+    baseInfo.moveVal=''
+    baseInfo.moveType=1
+    baseInfo.moveUnit='天'
+    baseInfo.calendarType='公历'
+    baseInfo.valueType='期末值'
+    classifyStr.value=''
 
 }
 
@@ -115,7 +247,8 @@ function handleSave(){
             border 
             title-active-color="#0052D9" 
             title-inactive-color="#333" 
-            line-width="16px" 
+            line-width="16px"
+            @change="handleTabChange"
             v-if="tabsArr.length"
         >
             <van-tab 
@@ -161,12 +294,31 @@ function handleSave(){
                     <li class="info-item" style="width:100%">数据来源:{{selectEDBinfo.SourceName}}</li>
                 </ul>
                 <div style="text-align:right">
-                    <van-button color="#0052D9" size="small">查看数据</van-button>
-                    <van-button color="#D54941" size="small" style="color:#fff;margin-left:10px" @click="selectEDBinfo=null">删除</van-button>
+                    <van-button color="#0052D9" size="small" @click="showSeeEDBDataList=true">查看数据</van-button>
                 </div>
             </div>
         </section>
         <section class="section baseinfo-box">
+            <!-- 时间位移(移动方式) -->
+            <van-field
+                label="移动方式"
+                required
+                v-if="source===22"
+            >
+                <template #input>
+                    <div class="move-type-box">
+                        <div class="btn" @click="showMoveType=true">
+                            <svg-icon name="swap"></svg-icon>
+                            <span>{{getMoveTypeName(baseInfo.moveType)}}</span>
+                        </div>
+                        <input class="input" type="number" :min="0" v-model="baseInfo.moveVal">
+                        <div class="btn" @click="showMoveUnit=true">
+                            <svg-icon name="swap"></svg-icon>
+                            <span>{{baseInfo.moveUnit}}</span>
+                        </div>
+                    </div>
+                </template>
+            </van-field>
             <van-field 
                 v-model="baseInfo.name" 
                 label="指标名称" 
@@ -189,7 +341,7 @@ function handleSave(){
                 right-icon="arrow"
                 required
                 @click-input="showSelectUnit=true"
-                :disabled="[6,7].includes(source)"
+                :disabled="!editEdbInfoId&&[6,7].includes(source)"
             />
             <van-field 
                 :modelValue="classifyStr"
@@ -210,7 +362,33 @@ function handleSave(){
                 right-icon="arrow"
                 required
                 @click-input="showSelectFrequency=true"
-                :disabled="[5,14,61,63].includes(source)"
+                :disabled="[5,14,61,63].includes(source)||(!editEdbInfoId&&[6,7].includes(source))"
+            />
+            <van-field
+                v-if="[8,12,13,35].includes(source)"
+                v-model.number="baseInfo.numberN" 
+                label="N等于" 
+                placeholder="请输入N数值"
+                input-align="right"
+                required
+                @focus="numberNInputFocus=true"
+                @blur="numberNInputFocus=false"
+            >
+                <template #right-icon>
+                    <svg-icon class="edit-icon" name="edit" :color="numberNInputFocus?'#0052D9':'#333333'"/>
+                </template>
+            </van-field>
+            <!-- 超季节性日历 -->
+            <van-field
+                v-if="source===35"
+                :modelValue="baseInfo.calendarType"
+                readonly
+                label="日历" 
+                placeholder="请选择日历"
+                input-align="right"
+                right-icon="arrow"
+                required
+                @click-input="showSelectCalendar=true"
             />
         </section>
 
@@ -220,7 +398,12 @@ function handleSave(){
         </div>
         <div class="opt-btns">
             <van-button class="primary2" @click="$router.back()">取消</van-button>
-            <van-button type="primary" @click="handleSave">生成计算指标</van-button>
+            <van-button 
+                type="primary" 
+                :loading="saveBtnLoading"
+                loading-text="计算中..."
+                @click="handleSave"
+            >{{getCalculateBtnText()}}</van-button>
         </div>
     </div>
     
@@ -231,11 +414,23 @@ function handleSave(){
     <SelectEDBUnit v-model:show="showSelectUnit" @select="onConfirmSelectUnit"/>
 
     <!-- 选择分类 -->
-    <SelectEDBClassify v-model:show="showSelectClassify" :defaultId="baseInfo.classify" @select="handleConfirmClassify" />
+    <SelectEDBClassify ref="selectEDBClassifyINS" v-model:show="showSelectClassify" :defaultId="baseInfo.classify" @select="handleConfirmClassify" />
 
     <!-- 选择频度 -->
     <SelectEDBFrequency v-model:show="showSelectFrequency" @select="handleConfirmFrequency"/>
 
+    <!-- 查看指标数据 -->
+    <SeeEDBDataList v-model:show="showSeeEDBDataList" :edbInfoId="selectEDBinfo?.EdbInfoId" />
+
+    <!-- 移动方式类型选择 -->
+    <van-action-sheet v-model:show="showMoveType" close-on-click-action :actions="moveTypeOpts" @select="onSelectMoveType" />
+    
+    <!-- 移动方式单位选择 -->
+    <van-action-sheet v-model:show="showMoveUnit" close-on-click-action :actions="moveUnitOpts" @select="onSelectMoveUnit" />
+
+    <!-- 超季节性日历选择 -->
+    <van-action-sheet v-model:show="showSelectCalendar" close-on-click-action :actions="[{name:'公历'},{name:'农历'}]" @select="e=>baseInfo.calendarType=e.name" />
+
     <!-- 公式说明 -->
     <van-dialog 
         v-model:show="showTips" 
@@ -280,6 +475,33 @@ function handleSave(){
         }
     }
 }
+.move-type-box{
+    width: 100%;
+    display: flex;
+    align-items: center;
+    justify-content: flex-end;
+    gap: 20px;
+    .input{
+        box-sizing: border-box;
+        display: block;
+        border-radius: 12px;
+        width: 150px;
+        height: 72px;
+        padding: 0 32px;
+        background-color: #f6f6f6;
+    }
+    .btn{
+        flex-shrink: 0;
+        display: flex;
+        align-items: center;
+        justify-content: center;
+        width: 130px;
+        height: 72px;
+        border-radius: 12px;
+        background-color: #F2F3FF;
+        color: $theme-color;
+    }
+}
 .formula-intro-btn{
     width: 180px;
     height: 60px;

+ 143 - 0
src/views/dataEDB/calculate/components/SeeEDBDataList.vue

@@ -0,0 +1,143 @@
+<script setup>
+import { reactive, watch } from "vue"
+import apiDataEDB from '@/api/dataEDB'
+
+
+const props=defineProps({
+    show:{
+        type:Boolean,
+        default:false
+    },
+    edbInfoId:{
+        type:Number,
+        default:0,
+    }
+})
+const emits=defineEmits(['update:show'])
+
+function handleClose(){
+    emits('update:show',false)
+}
+
+const listState=reactive({
+    title:'',
+    list:[],
+    page:1,
+    pageSize:20,
+    loading:false,
+    finished:false
+})
+async function getEDBDataList(){
+    listState.loading=true
+    const res=await apiDataEDB.edbDataList({
+        PageSize:listState.pageSize,
+        CurrentIndex:listState.page,
+        EdbInfoId:props.edbInfoId
+    })
+    listState.loading=false
+    if(res.Ret===200){
+        listState.title=res.Data?.Item.EdbName
+        const arr=res.Data?.Item.DataList||[]
+        listState.list=[...listState.list,...arr]
+        listState.finished=res.Data.Paging.IsEnd
+    }
+}
+function onLoad(){
+    listState.page++
+    getEDBDataList()
+}
+
+watch(
+    ()=>props.show,
+    (n)=>{
+        if(n){
+            listState.title=''
+            listState.list=[]
+            listState.finished=false
+            getEDBDataList()
+        }
+    }
+)
+
+</script>
+
+<template>
+    <van-popup 
+        :show="props.show"
+        round
+        closeable
+        position="bottom"
+        @click-close-icon="handleClose"
+        @click-overlay="handleClose"
+    >
+        <div class="title">{{listState.title}}</div>
+        <div class="nodata-box" style="padding-bottom:30px" v-if="listState.list.length==0&&listState.finished">
+            <img  class="list-empty-img" src="https://hzstatic.hzinsights.com/static/ETA_mobile/empty_img.png" alt="">
+            <p style="text-align:center;color:#999">暂无数据</p>
+        </div>
+        <div class="data-list" v-else>
+            <li class="data-item">
+                <div class="label time">时间</div>
+                <div class="label">值</div>
+            </li>
+            <van-list
+                v-model:loading="listState.loading"
+                :finished="listState.finished"
+                :finished-text="listState.list.length>0?'没有更多了':'暂无数据'"
+                :immediate-check="false"
+                @load="onLoad"
+            >
+                <li class="data-item" v-for="item in listState.list" :key="item">
+                    <div class="time">{{item.DataTime}}</div>
+                    <div class="val">
+                        <span>{{item.Value}}</span>
+                    </div>
+                </li>
+            </van-list>
+        </div>
+    </van-popup>
+</template>
+
+<style lang="scss" scoped>
+.title{
+    font-size: 36px;
+    font-weight: 600;
+    padding: 34px;
+    border-bottom: 1px solid $border-color;
+}
+.data-list{
+    max-height: 60vh;
+    overflow-y: auto;
+    .data-item{
+        display: flex;
+        border-bottom: 1px solid $border-color;
+        div{
+            flex-shrink: 0;
+            width: 50%;
+            padding: 0 32px;
+            height: 112px;
+            display: flex;
+            align-items: center;
+        }
+        .lable{
+            font-size: 34px;
+            font-weight: 500;
+        }
+        .time{
+            border-right: 1px solid $border-color;
+        }
+        .val{
+            span{
+                display: inline-block;
+                padding: 0 10px;
+                line-height: 48px;
+                background-color: #F2F3FF;
+                color: $theme-color;
+                border-radius: 4px;
+                min-width: 60px;
+                text-align: center;
+            }
+        }
+    }
+}
+</style>

+ 5 - 3
src/views/dataEDB/calculate/components/SelectEDB.vue

@@ -11,7 +11,8 @@ const props=defineProps({
     source:{//计算类型
         type:Number,
         default:0
-    }
+    },
+    params:{},//传来的参数
 })
 const emits=defineEmits(['update:show','select'])
 
@@ -41,7 +42,8 @@ async function getEDBList(){
         KeyWord:searchEDBTxt.value,
         CurrentIndex:listState.page,
         PageSize:listState.pageSize,
-        ...params
+        ...params,
+        ...props.params,
     })
     listState.loading=false
     if(res.Ret===200){
@@ -129,7 +131,7 @@ function handleShowEDBInfo(item){
                     </template>
                 </van-search>
             </div>
-            <div class="list-wrap">
+            <div class="list-wrap" v-if="props.show">
                 <img v-if="listState.list.length==0&&listState.finished&&keyword" class="list-empty-img" src="https://hzstatic.hzinsights.com/static/ETA_mobile/empty_img.png" alt="">
                 <van-list
                     v-model:loading="listState.loading"

+ 16 - 2
src/views/dataEDB/components/SelectEDBClassify.vue

@@ -9,7 +9,7 @@ const props=defineProps({
     },
     defaultId:{//初始选中的分类
         type:Number,
-        default:""
+        default:0
     }
 })
 
@@ -47,9 +47,23 @@ function handleFinish({value,selectedOptions,tabIndex}){
 
 // 通过classifyid 获取当前目录
 function getSelectClassifyOpt(id){
-    // let 
+    let arr=[]
+    edbClassifyList.value.forEach(e1=>{
+        e1.Children?.forEach(e2=>{
+            e2.Children?.forEach(e3=>{
+                if(e3.ClassifyId===id){
+                    arr=[e1,e1,e3]
+                }
+            })
+        })
+    })
+
+    emits('select',{value:id,selectedOptions:arr})
+    return arr
 }
 
+defineExpose({getSelectClassifyOpt})
+
 
 </script>