|
@@ -0,0 +1,167 @@
|
|
|
+<script setup>
|
|
|
+import apiDataEDB from '@/api/dataEDB'
|
|
|
+import { showToast } from 'vant';
|
|
|
+import {reactive, ref} from 'vue'
|
|
|
+import SelectEDB from './SelectEDB.vue'
|
|
|
+import EDBHistory from '@/views/dataEDB/components/EDBHistory.vue'
|
|
|
+import SelectEDBClassify from '../../components/SelectEDBClassify.vue'
|
|
|
+import SelectEDBUnit from '../../components/SelectEDBUnit.vue'
|
|
|
+import SelectEDBFrequency from '../../components/SelectEDBFrequency.vue'
|
|
|
+import {calculateTypeTipsMap} from '../../util/config'
|
|
|
+import { useRoute, useRouter } from 'vue-router';
|
|
|
+
|
|
|
+const route=useRoute()
|
|
|
+const router=useRouter()
|
|
|
+
|
|
|
+//公式说明
|
|
|
+const showTips=ref(false)
|
|
|
+const tipsContent=ref(calculateTypeTipsMap.get(Number(route.query.type))||'')
|
|
|
+
|
|
|
+
|
|
|
+const letterOpts = [];//字母数据
|
|
|
+function initLetterOpt(){
|
|
|
+ for(let i=0;i<26;i++){
|
|
|
+ letterOpts.push(String.fromCharCode(65+i));
|
|
|
+ }
|
|
|
+}
|
|
|
+initLetterOpt()
|
|
|
+
|
|
|
+//选择的指标集合
|
|
|
+const edbList=ref([
|
|
|
+ {
|
|
|
+ tag:letterOpts[0],
|
|
|
+ target:'',
|
|
|
+ startDate:'',
|
|
|
+ endDate:'',
|
|
|
+ name:''
|
|
|
+ },
|
|
|
+ {
|
|
|
+ tag:letterOpts[1],
|
|
|
+ target:'',
|
|
|
+ startDate:'',
|
|
|
+ endDate:'',
|
|
|
+ name:''
|
|
|
+ }
|
|
|
+])
|
|
|
+function handleAddEdbList(){
|
|
|
+ if(edbList.value.length>=26){
|
|
|
+ showToast('添加指标个数已达上限')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let tag = edbList.value[edbList.value.length-1].tag;
|
|
|
+ let index = letterOpts.findIndex(item => item === tag);
|
|
|
+ const item = {
|
|
|
+ tag: letterOpts[index+1],
|
|
|
+ target: '',
|
|
|
+ start_date: '',
|
|
|
+ end_date: '',
|
|
|
+ name:''
|
|
|
+ };
|
|
|
+ edbList.value.push(item);
|
|
|
+}
|
|
|
+function handleDeleteEDBItem(index){
|
|
|
+ edbList.value.splice(index, 1)
|
|
|
+}
|
|
|
+// 选择指标
|
|
|
+const showSelectEDB=ref(false)
|
|
|
+let whichIndex=0
|
|
|
+function handleShowSelectEDB(index){
|
|
|
+ whichIndex=index
|
|
|
+ showSelectEDB.value=true
|
|
|
+}
|
|
|
+function handleConfirmSelectEDB(e){
|
|
|
+ edbList.value[whichIndex].target=e.EdbInfoId
|
|
|
+ edbList.value[whichIndex].startDate=e.StartDate
|
|
|
+ edbList.value[whichIndex].endDate=e.EndDate
|
|
|
+ edbList.value[whichIndex].name=e.EdbName
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+</script>
|
|
|
+
|
|
|
+<template>
|
|
|
+ <div class="diffusionIndex-wrap">
|
|
|
+ <section class="section select-edb-box">
|
|
|
+ <van-swipe-cell v-for="(item,index) in edbList" :key="item.tag" :disabled="index<2">
|
|
|
+ <van-field
|
|
|
+ :label="item.tag"
|
|
|
+ is-link
|
|
|
+ @click-input="handleShowSelectEDB(index)"
|
|
|
+ >
|
|
|
+ <template #input>
|
|
|
+ <div class="edb-info-box">
|
|
|
+ <div class="edb-info" v-if="item.target">
|
|
|
+ <span class="name">{{item.name}}</span>
|
|
|
+ <span class="time">{{item.startDate}}至{{item.endDate}}</span>
|
|
|
+ </div>
|
|
|
+ <span class="placeholder" v-else>请选择指标</span>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </van-field>
|
|
|
+ <template #right>
|
|
|
+ <van-button square type="danger" text="删除" @click="handleDeleteEDBItem(index)"/>
|
|
|
+ </template>
|
|
|
+ </van-swipe-cell>
|
|
|
+ <div class="add-edb-box" @click="handleAddEdbList">
|
|
|
+ <img src="@/assets/imgs/icon01.png" alt="">
|
|
|
+ <span>添加更多参数</span>
|
|
|
+ </div>
|
|
|
+ </section>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 选择指标 -->
|
|
|
+ <SelectEDB v-model:show="showSelectEDB" @select="handleConfirmSelectEDB"/>
|
|
|
+
|
|
|
+</template>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.diffusionIndex-wrap{
|
|
|
+ min-height: 90vh;
|
|
|
+ background-color: $page-bg-grey;
|
|
|
+ padding-bottom: 210px ;
|
|
|
+}
|
|
|
+
|
|
|
+.section{
|
|
|
+ background-color: #fff;
|
|
|
+ margin-bottom: 32px;
|
|
|
+}
|
|
|
+
|
|
|
+.select-edb-box{
|
|
|
+ .left-icon{
|
|
|
+ width: 48px;
|
|
|
+ height: 48px;
|
|
|
+ }
|
|
|
+ :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;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .add-edb-box{
|
|
|
+ display: flex;
|
|
|
+ justify-content: flex-end;
|
|
|
+ align-items: center;
|
|
|
+ color: $theme-color;
|
|
|
+ font-size: 32px;
|
|
|
+ padding: 32px var(--van-cell-horizontal-padding);
|
|
|
+ img{
|
|
|
+ width: 48px;
|
|
|
+ height: 48px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+</style>
|