jwyu 1 år sedan
förälder
incheckning
d93e692ee4

+ 1 - 0
package.json

@@ -32,6 +32,7 @@
     "vconsole": "^3.15.0",
     "vue": "^3.2.47",
     "vue-router": "^4.1.6",
+    "vue3-clipboard": "^1.0.0",
     "vuedraggable": "^4.1.0"
   },
   "devDependencies": {

+ 31 - 0
src/api/dataEDB.js

@@ -93,6 +93,37 @@ export default{
      */
     editBaseEdbInfo(params){
         return post('/datamanage/edb_info/edit',params)
+    },
+
+    /**
+     * 指标关联的图表数据
+     * @param EdbInfoId
+     * @param CurrentIndex
+     * @param PageSize
+     */
+    edbRelationChartList(params){
+        return get('/datamanage/edb_info/relation/chart_list',params)
+    },
+
+    /**
+     * 指标数据列表
+     * @param PageSize
+     * @param CurrentIndex
+     * @param EdbInfoId
+     * @param KeyWord
+     */
+    edbDataList(params){
+        return get('/datamanage/edb_info/list',params)
+    },
+
+    /**
+     * ETA指标引用的计算指标
+     * @param EdbInfoId
+     * @param CurrentIndex
+     * @param PageSize
+     */
+    edbRelationEdbList(params){
+        return get('/datamanage/edb_info/relation/edbinfo_list',params)
     }
 
 

+ 15 - 0
src/api/dataPredictEDB.js

@@ -0,0 +1,15 @@
+//预测指标库
+import { get,post } from "./index";
+
+export default{
+    /**
+     * 预测指标数据列表
+     * @param PageSize
+     * @param CurrentIndex
+     * @param EdbInfoId
+     * @param KeyWord
+     */
+    edbDataList(params){
+        return get('/datamanage/predict_edb_info/list',params)
+    }
+}

BIN
src/assets/imgs/dataEDB/icon_edit.png


+ 31 - 1
src/assets/styles/common.scss

@@ -126,4 +126,34 @@ img {
 .fr-second-toolbar {
     display: none !important;
 }
-a[href="https://froala.com/wysiwyg-editor"], a[href="https://www.froala.com/wysiwyg-editor?k=u"]{ border:1px solid #eaeaea; background:#fff !important; color:#ccc !important; }
+a[href="https://froala.com/wysiwyg-editor"], a[href="https://www.froala.com/wysiwyg-editor?k=u"]{ border:1px solid #eaeaea; background:#fff !important; color:#ccc !important; }
+
+
+.rename-wrap{
+    padding:48px;
+    input{
+        padding: 24px 32px;
+        border-radius: 12px;
+        background-color: #F6F6F6;
+        width: 100%;
+    }
+    .label{
+        color: #666666;
+        margin-bottom: 32px;
+        text-align: center;
+    }
+}
+@media screen and (min-width:650px){
+    .rename-wrap{
+        padding:24px;
+        input{
+            padding: 12px 16px;
+            border-radius: 6px;
+            background-color: #F6F6F6;
+            width: 100%;
+        }
+        .label{
+            margin-bottom: 16px;
+        }
+    }
+}

+ 2 - 1
src/assets/styles/var.scss

@@ -8,4 +8,5 @@ $theme-red:#C54322;
 $theme-warning:#E37318;
 $media-width:650px;
 $page-padding:34px;//页面边距
-$page-bg-grey:#F6F6F6;//灰色背景
+$page-bg-grey:#F6F6F6;//灰色背景
+$box-shadow:0px 4px 12px 0px rgba(0, 0, 0, 0.05);

+ 5 - 4
src/hooks/common.js

@@ -58,16 +58,17 @@ export function transfImgTobase64(url) {
 /**
  * 设置剪切板
  * @param text 文本
+ * @param msg 提示文案
  */
-export async function setClipboardData(text){
+export async function setClipboardData(text,msg){
     if(navigator.clipboard&&window.isSecureContext){
         try{
            await navigator.clipboard.writeText(text)
-           showToast({message:'复制链接成功',type:'success'})
+           showToast({message:msg||'复制链接成功',type:'success'})
        }catch(err){
            console.log(err);
            throw new Error(JSON.stringify(err)) 
-           showToast({message:'复制链接失败',type:'fail'})
+           showToast({message:msg||'复制失败',type:'fail'})
        }
    }else{
        const input = document.createElement('input')
@@ -77,6 +78,6 @@ export async function setClipboardData(text){
        input.select();
        document.execCommand('copy');
        document.body.removeChild(input);
-       showToast({message:'复制链接成功',type:'success'})
+       showToast({message:msg||'复制链接成功',type:'success'})
    }
 }

+ 33 - 0
src/hooks/edb/useCopyEdbData.js

@@ -0,0 +1,33 @@
+// 复制指标数据
+import apiDataEDB from '@/api/dataEDB'
+import apiDataPredictEDB from '@/api/dataPredictEDB'
+import { showToast } from 'vant'
+import { copyText } from 'vue3-clipboard'
+
+export function useCopyEdbData(){
+
+    async function copyData(e){
+        const params={
+            PageSize: 100000,
+            CurrentIndex: 1,
+            EdbInfoId:e.EdbInfoId
+        }
+        const res=params.EdbInfoCategoryType===1?await apiDataPredictEDB.edbDataList(params):await apiDataEDB.edbDataList(params)
+        if(res.Ret===200){
+            const arr=res.Data.Item.DataList || [];
+            let str = '日期\t 值\n';
+            arr.forEach((item) => (str += `${item.DataTime}\t${item.Value}\n`));
+            copyText(str,undefined,(error,event)=>{
+                if(error){
+                    showToast('复制失败')
+                }else{
+                    showToast('复制成功')
+                }
+            })
+        }
+    }
+
+    return {
+        copyData
+    }
+}

+ 28 - 0
src/router/dataEDB.js

@@ -10,4 +10,32 @@ export const dataEDBRoutes=[
             hasBackTop:true,
         },
     },
+    {
+        path:"/dataEDB/relationChart",
+        name:"DataEDBRelationChart",
+        component: () => import("@/views/dataEDB/RelationChart.vue"),
+        meta: { 
+            title: "关联图表",
+            keepAlive:false,
+            hasBackTop:true,
+        },
+    },
+    {
+        path:"/dataEDB/relationEDB",
+        name:"DataEDBRelationEDB",
+        component: () => import("@/views/dataEDB/RelationEDB.vue"),
+        meta: { 
+            title: "关联指标",
+            keepAlive:false,
+            hasBackTop:true,
+        },
+    },
+    {
+        path:"/dataEDB/detail",
+        name:"DataEDBDetail",
+        component: () => import("@/views/dataEDB/Detail.vue"),
+        meta: { 
+            title: "ETA指标详情",
+        },
+    },
 ]

+ 34 - 0
src/views/dataEDB/Detail.vue

@@ -0,0 +1,34 @@
+<script setup name="DataEDBDetail">
+import {ref} from 'vue'
+import EDBChartDetailVue from './components/EDBChartDetail.vue'
+import EDBDataDetailVue from './components/EDBDataDetail.vue'
+
+const activeType=ref('chart')
+
+
+
+
+
+</script>
+
+<template>
+    <div class="edb-detail-page">
+        <div class="top-box">
+            <div class="van-multi-ellipsis--l2 edb-name-box">指标名指标名指标名指标名指标名指标名指标名指标名指标名指标名指标名指标名指标名指标名</div>
+        </div>
+        <van-tabs v-model:active="activeType" sticky line-width="16" title-active-color="#0052D9" title-inactive-color="#333">
+            <van-tab title="图表详情" name="chart"><EDBChartDetailVue /></van-tab>
+            <van-tab title="数据详情" name="data"><EDBDataDetailVue /></van-tab>
+        </van-tabs>
+    </div>
+</template>
+
+<style lang="scss" scoped>
+:deep(.van-tabs__wrap){
+    border-bottom: 1px solid $border-color;
+}
+.top-box{
+    padding: $page-padding $page-padding 10px;
+    font-size: 36px;
+}
+</style>

+ 39 - 4
src/views/dataEDB/Index.vue

@@ -5,8 +5,11 @@ import EDBClassify from './components/EDBClassify.vue'
 import EditBaseEDB from './components/EditBaseEDB.vue'
 import {useEDBDelete} from './hooks/useEDBDelete'
 import { showToast } from 'vant'
+import {useRouter} from 'vue-router'
 
 const {edbClassifyDelete} =useEDBDelete()
+const router=useRouter()
+
 
 const listState = reactive({
     list:[],
@@ -112,6 +115,7 @@ function handleEDBOpt(type,data){
             showToast('待开发,计算指标请在pc端操作')
         }
     }
+
     // 删除
     if(type==='delete'){
         edbClassifyDelete(data).then((res)=>{
@@ -120,11 +124,32 @@ function handleEDBOpt(type,data){
             }
         })
     }
+
     // 移动至
     if(type==='move'){
         handleShowEDBMove(data)
     }
 
+    //查看关联的图表
+    if(type==='relationChart'){
+        router.push({
+            path:'/dataEDB/RelationChart',
+            query:{
+                edbInfoId:data.EdbInfoId
+            }
+        })
+    }
+
+    //查看关联指标
+    if(type==='relationEDB'){
+        router.push({
+            path:'/dataEDB/relationEDB',
+            query:{
+                edbInfoId:data.EdbInfoId
+            }
+        })
+    }
+
     edbOptState.show=false
 }
 //编辑基础指标信息成功回调
@@ -175,6 +200,16 @@ async function handleConfirmEDBMove(){
     })
 }
 
+// 跳转详情
+function handleEDBDetail(item){
+    router.push({
+        path:'/dataEDB/detail',
+        query:{
+            edbInfoId:item.EdbInfoId
+        }
+    })
+}
+
 </script>
 
 <template>
@@ -211,7 +246,7 @@ async function handleConfirmEDBMove(){
             >
                 <img v-if="listState.list.length==0&&listState.finished" class="list-empty-img" src="https://hzstatic.hzinsights.com/static/ETA_mobile/empty_img.png" alt="">
                 <ul class="edb-list">
-                    <li class="edb-item" v-for="item in listState.list" :key="item.EdbInfoId">
+                    <li class="edb-item" v-for="item in listState.list" :key="item.EdbInfoId" @click="handleEDBDetail(item)">
                         <div class="van-multi-ellipsis--l2 name">{{item.ClassifyName}}</div>
                         <van-image
                             class="img"
@@ -226,7 +261,7 @@ async function handleConfirmEDBMove(){
                                 height="28" 
                                 viewBox="0 0 28 28" 
                                 fill="none"
-                                @click="handleShowEdbOpt(item)"
+                                @click.stop="handleShowEdbOpt(item)"
                             >
                                 <rect width="28" height="28" rx="4" :fill="item.EdbInfoId===edbOptState.data?.EdbInfoId?'#0052D9':'none'"/>
                                 <path d="M14 19.25C14.9625 19.25 15.75 20.0375 15.75 21C15.75 21.9625 14.9625 22.75 14 22.75C13.0375 22.75 12.25 21.9625 12.25 21C12.25 20.0375 13.0375 19.25 14 19.25ZM12.25 14C12.25 14.9625 13.0375 15.75 14 15.75C14.9625 15.75 15.75 14.9625 15.75 14C15.75 13.0375 14.9625 12.25 14 12.25C13.0375 12.25 12.25 13.0375 12.25 14ZM12.25 7C12.25 7.9625 13.0375 8.75 14 8.75C14.9625 8.75 15.75 7.9625 15.75 7C15.75 6.0375 14.9625 5.25 14 5.25C13.0375 5.25 12.25 6.0375 12.25 7Z" :fill="item.EdbInfoId===edbOptState.data?.EdbInfoId?'#fff':'#333333'"/>
@@ -283,8 +318,8 @@ async function handleConfirmEDBMove(){
                 <!-- <li class="item" v-if="seeComputeEDBInfo(edbOptState.data)">查看</li> -->
                 <!-- <li class="item color-blue" v-if="edbOptState.data?.Button.OpButton" @click="handleEDBOpt('edit',edbOptState.data)">编辑</li>
                 <li class="item color-red" v-if="edbOptState.data?.Button.DeleteButton" @click="handleEDBOpt('delete',edbOptState.data)">删除</li> -->
-                <li class="item" v-if="edbOptState.data?.Button.ShowEdbRelation">关联指标</li>
-                <li class="item" v-if="edbOptState.data?.Button.ShowChartRelation">关联图表</li>
+                <li class="item" v-if="edbOptState.data?.Button.ShowEdbRelation" @click="handleEDBOpt('relationEDB',edbOptState.data)">关联指标</li>
+                <li class="item" v-if="edbOptState.data?.Button.ShowChartRelation" @click="handleEDBOpt('relationChart',edbOptState.data)">关联图表</li>
                 <li class="item" v-if="edbOptState.data?.Button.MoveButton" @click="handleEDBOpt('move',edbOptState.data)">移动至</li>
             </ul>
         </template>

+ 150 - 0
src/views/dataEDB/RelationChart.vue

@@ -0,0 +1,150 @@
+<script setup name="DataEDBRelationChart">
+import {ref,reactive} from 'vue'
+import apiDataEDB from '@/api/dataEDB'
+import apiChart from '@/api/chart'
+import {useRoute, useRouter} from 'vue-router'
+import { useWindowSize } from '@vueuse/core'
+import AddChartToMyETA from '@/views/chartETA/components/AddChartToMyETA.vue'
+
+const route=useRoute()
+const router=useRouter()
+const { width } = useWindowSize()
+
+
+const edbInfoId=route.query.edbInfoId//当前指标的id
+
+const listState=reactive({
+    list:[],
+    page:1,
+    pageSize:20,
+    totals:0,
+    finished:false
+})
+// 获取关联的图列表
+async function getEdbRelationChartList(){
+    const res=await apiDataEDB.edbRelationChartList({
+        PageSize:listState.pageSize,
+        CurrentIndex:listState.page,
+        EdbInfoId:edbInfoId
+    })
+    if(res.Ret===200){
+        const arr=res.Data.List||[]
+        listState.list=[...listState.list,...arr]
+        listState.finished=res.Data.Paging.IsEnd
+        listState.totals=res.Data.Paging.Totals
+    }
+}
+getEdbRelationChartList()
+function onLoad(){
+    listState.page++
+    getEdbRelationChartList()
+}
+
+// 加入我的图库
+const isShowAddToMyETADialog=ref(false)
+const chartInfo=ref({})
+async function handleShowAddToMyChart(e){
+    // 获取一下图详情
+    const res=await apiChart.chartInfoByCode({UniqueCode:e.UniqueCode})
+    if(res.Ret===200){
+        chartInfo.value=res.Data.ChartInfo
+        isShowAddToMyETADialog.value=true
+    }
+}
+
+//跳转图详情
+function goChartDetail(item){
+    router.push({
+        path:'/myETA/chartdetail',
+        query:{
+            code:item.UniqueCode,
+            iscommon:true,
+            from:'edbRelationChart',
+            edbInfoId:edbInfoId
+        }
+    })
+}
+
+
+</script>
+
+<template>
+    <div class="edb-relation-chart-page">
+        <div class="total-box">共{{listState.totals}}张图表</div>
+        <div class="chart-list-wrap">
+            <van-list
+                v-model:loading="listState.loading"
+                :finished="listState.finished"
+                :finished-text="listState.list.length>0?'没有更多了':'暂无关联图表'"
+                :immediate-check="false"
+                @load="onLoad"
+            >
+                <img v-if="listState.list.length==0&&listState.finished" class="list-empty-img" src="https://hzstatic.hzinsights.com/static/ETA_mobile/empty_img.png" alt="">
+                <ul class="chart-list">
+                    <li class="item" v-for="item in listState.list" :key="item.ChartInfoId" @click="goChartDetail(item)">
+                        <div class="van-multi-ellipsis--l2 name">{{item.ChartName}}</div>
+                        <van-image
+                            class="img"
+                            :src="item.ChartImage"
+                        />
+                        <div class="time">{{item.CreateTime.slice(0,10)}}</div>
+                        <svg @click.stop="handleShowAddToMyChart(item)" class="opt-icon" xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 36 36" fill="none">
+                            <path d="M11.7892 19.081H16.9192V24.211C16.9192 24.3595 17.0407 24.481 17.1892 24.481H18.8092C18.9577 24.481 19.0792 24.3595 19.0792 24.211V19.081H24.2092C24.3577 19.081 24.4792 18.9595 24.4792 18.811V17.191C24.4792 17.0425 24.3577 16.921 24.2092 16.921H19.0792V11.791C19.0792 11.6425 18.9577 11.521 18.8092 11.521H17.1892C17.0407 11.521 16.9192 11.6425 16.9192 11.791V16.921H11.7892C11.6407 16.921 11.5192 17.0425 11.5192 17.191V18.811C11.5192 18.9595 11.6407 19.081 11.7892 19.081Z" fill="#0052D9"/>
+                            <path d="M30.42 4.5H5.58C4.98262 4.5 4.5 4.98262 4.5 5.58V30.42C4.5 31.0174 4.98262 31.5 5.58 31.5H30.42C31.0174 31.5 31.5 31.0174 31.5 30.42V5.58C31.5 4.98262 31.0174 4.5 30.42 4.5ZM29.07 29.07H6.93V6.93H29.07V29.07Z" fill="#0052D9"/>
+                        </svg>
+                    </li>
+                </ul>
+            </van-list>
+        </div>
+    </div>
+
+    <!-- 加入我的图库 -->
+    <AddChartToMyETA 
+        :isShowDialog="isShowAddToMyETADialog"
+        :dialogPosition="width>650?'center':'bottom'"
+        :chartInfo="chartInfo"
+        @close="isShowAddToMyETADialog=false"
+    />
+</template>
+
+<style lang="scss" scoped>
+.edb-relation-chart-page{
+    padding:$page-padding;
+}
+.total-box{
+    margin-bottom: 20px;
+    color: $font-grey_999;
+}
+.chart-list{
+    display: flex;
+    justify-content: space-between;
+    flex-wrap: wrap;
+    gap: 30px 0;
+    .item{
+        width: 326px;
+        border-radius: 8px;
+        background: #FFF;
+        border: 1px solid $border-color;
+        padding: 14px;
+        position: relative;
+        .name{
+            min-height: 70px;
+        }
+        .img{
+            width: 100%;
+            height: 220px;
+            margin: 14px 0;
+        }
+        .time{
+            font-size: 24px;
+        }
+        .opt-icon{
+            position: absolute;
+            bottom: 14px;
+            right: 14px;
+            width: 36px;
+            height: 36px;
+        }
+    }
+}
+</style>

+ 118 - 0
src/views/dataEDB/RelationEDB.vue

@@ -0,0 +1,118 @@
+<script setup name="DataEDBRelationEDB">
+import {ref,reactive} from 'vue'
+import apiDataEDB from '@/api/dataEDB'
+import {useRoute, useRouter} from 'vue-router'
+import {useCopyEdbData} from '@/hooks/edb/useCopyEdbData'
+
+const {copyData} =useCopyEdbData()
+
+const route=useRoute()
+const router=useRouter()
+
+
+const edbInfoId=route.query.edbInfoId//当前指标的id
+
+const listState=reactive({
+    list:[],
+    page:1,
+    pageSize:20,
+    totals:0,
+    finished:false
+})
+// 获取关联的图列表
+async function getEdbRelationEDBList(){
+    const res=await apiDataEDB.edbRelationEdbList({
+        PageSize:listState.pageSize,
+        CurrentIndex:listState.page,
+        EdbInfoId:edbInfoId
+    })
+    if(res.Ret===200){
+        if(!res.Data){
+            listState.finished=true
+            return
+        }
+        const arr=res.Data.List||[]
+        listState.list=[...listState.list,...arr]
+        listState.finished=res.Data.Paging.IsEnd
+        listState.totals=res.Data.Paging.Totals
+    }
+}
+getEdbRelationEDBList()
+function onLoad(){
+    listState.page++
+    getEdbRelationEDBList()
+}
+
+//复制数据
+function handleCopyEDBData(e){
+    copyData({EdbInfoId:e.EdbInfoId})
+}
+</script>
+
+<template>
+    <div class="edb-relation-edb-page">
+        <div class="total-box">共{{listState.totals}}个关联指标</div>
+        <div class="edb-list-wrap">
+            <van-list
+                v-model:loading="listState.loading"
+                :finished="listState.finished"
+                :finished-text="listState.list.length>0?'没有更多了':'暂无关联指标'"
+                :immediate-check="false"
+                @load="onLoad"
+            >
+                <img v-if="listState.list.length==0&&listState.finished" class="list-empty-img" src="https://hzstatic.hzinsights.com/static/ETA_mobile/empty_img.png" alt="">
+                <ul class="edb-list">
+                    <li class="item" v-for="item in listState.list" :key="item">
+                        <h2 class="name">{{item.EdbName}}</h2>
+                        <ul class="info-list">
+                            <li class="info-item">ID:{{item.EdbCode}}</li>
+                            <li class="info-item">起始时间:{{item.StartDate}}</li>
+                            <li class="info-item">频度:{{item.Frequency}}</li>
+                            <li class="info-item">最新日期:{{item.LatestDate}}</li>
+                            <li class="info-item">单位:{{item.Unit}}</li>
+                            <li class="info-item">最新值:{{item.LatestValue}}</li>
+                            <li class="info-item" style="width:100%">最近更新:{{item.ModifyTime}}</li>
+                            <li class="info-item" style="width:100%">数据来源:{{item.SourceName}}</li>
+                        </ul>
+                        <div style="text-align:right">
+                            <van-button color="#F2F3FF" size="small" style="color:#0052D9;margin-right:10px" @click="handleCopyEDBData(item)">复制数据</van-button>
+                            <van-button color="#0052D9" size="small">查看数据</van-button>
+                        </div>
+                    </li>
+                </ul>
+            </van-list>
+        </div>
+    </div>
+</template>
+
+<style lang="scss" scoped>
+.edb-relation-edb-page{
+    padding:$page-padding;
+}
+.total-box{
+    margin-bottom: 20px;
+    color: $font-grey_999;
+}
+.edb-list{
+    .item{
+        margin-bottom: 36px;
+        border-radius: 8px;
+        border: 1px solid $border-color;
+        box-shadow: $box-shadow;
+        padding: 20px;
+        .name{
+            font-size: 32px;
+        }
+        .info-list{
+            display: flex;
+            flex-wrap: wrap;
+            gap: 10px 0;
+            color: $font-grey;
+            margin-bottom: 10px;
+            .info-item{
+                width: 50%;
+            }
+        }
+    }
+}
+</style>

+ 57 - 0
src/views/dataEDB/components/EDBChartDetail.vue

@@ -0,0 +1,57 @@
+<script setup>
+
+</script>
+
+<template>
+    <div class="edb-chart-detail-wrap">
+        
+        
+        <div class="fix-bottom-box">
+            <div class="item">
+                <img class="icon" src="@/assets/imgs/report/icon_refresh.png" alt="">
+                <span>刷新</span>
+            </div>
+            <div class="item">
+                <img class="icon" src="@/assets/imgs/dataEDB/icon_edit.png" alt="">
+                <span>编辑</span>
+            </div>
+            <div class="item">
+                <img class="icon" src="@/assets/imgs/myETA/icon_limit.png" alt="">
+                <div>上下限</div>
+            </div>
+            <div class="item">
+                <img class="icon" src="@/assets/imgs/myETA/icon_menu.png" alt="">
+                <div>更多</div>
+            </div>
+        </div>
+    </div>
+</template>
+
+<style lang="scss" scoped>
+.fix-bottom-box{
+    position: fixed;
+    height: 112px;
+    border-top: 1px solid $border-color;
+    z-index: 99;
+    left: 0;
+    right: 0;
+    bottom: 0;
+    display: flex;
+    .item{
+        flex: 1;
+        display: flex;
+        flex-direction: column;
+        align-items: center;
+        justify-content: center;
+        .icon{
+            width: 40px;
+            height: 40px;
+        }
+    }
+
+}
+.edb-chart-detail-wrap{
+    padding: $page-padding;
+}
+
+</style>

+ 13 - 0
src/views/dataEDB/components/EDBDataDetail.vue

@@ -0,0 +1,13 @@
+<script setup>
+
+</script>
+
+<template>
+    <div>
+        data
+    </div>
+</template>
+
+<style lang="scss" scoped>
+
+</style>

+ 29 - 0
src/views/myETA/ChartDetail.vue

@@ -6,6 +6,7 @@ import apiCorrelationChart from '@/api/correlationChart'
 import apiLineEquationChart from '@/api/lineEquationChart'
 import apiStatisticFeatureChart from '@/api/statisticFeatureChart'
 import apiMyETAChart from '@/api/myETA'
+import apiDataEDB from '@/api/dataEDB'
 import { useRoute, useRouter } from 'vue-router'
 import {useChartRender} from '@/hooks/chart/render'
 import {yearSelectOpt,sameOptionType} from '@/hooks/chart/config'
@@ -18,6 +19,7 @@ import { useWindowSize } from '@vueuse/core'
 import {setClipboardData} from '@/hooks/common'
 import SetChartEnName from '@/components/SetChartEnName.vue'
 import {useCachedViewsStore} from '@/store/modules/cachedViews'
+import AddChartToMyETA from '@/views/chartETA/components/AddChartToMyETA.vue'
 
 const { width, height } = useWindowSize()
 const cachedViewsStore=useCachedViewsStore()
@@ -32,6 +34,19 @@ let CHARTINS=null//图表实例
 // 获取当前图表所在分类下的所有图表数据 用于上一张下一张切换
 let allChartList=ref([])
 async function getAllChartList(){
+    // 如果是从ETA指标库的指标关联的图列表跳转来的
+    if(route.query.from==='edbRelationChart'){
+        const res=await apiDataEDB.edbRelationChartList({
+            PageSize:1000000,
+            CurrentIndex:1,
+            EdbInfoId:route.query.edbInfoId
+        })
+        if(res.Ret===200){
+            allChartList.value=res.Data.List||[]
+        }
+        return
+    }
+    // 我的图库列表跳转来的
     if(!route.query.cid) return
     const res=await apiMyETAChart.myChartList({
         CurrentIndex:1,
@@ -482,6 +497,9 @@ function handleEditEnNameSuccess(){
     reloadChartInfo()
 }
 
+// 加入我的图库
+const isShowAddToMyETADialog=ref(false)
+
 </script>
 
 <template>
@@ -747,6 +765,9 @@ function handleEditEnNameSuccess(){
             <div class="item" @click.stop="handleShowCopyTo" v-if="$route.query.iscommon!='true'">
                 复制到
             </div>
+            <div class="item" @click.stop="isShowAddToMyETADialog=true" v-if="$route.query.from==='edbRelationChart'">
+                加入我的图库
+            </div>
             <div class="item" @click.stop="showSaveChartOther=true" v-if="chartInfo.Button.IsCopy">
                 另存为
             </div>
@@ -821,6 +842,14 @@ function handleEditEnNameSuccess(){
             @success="handleEditEnNameSuccess"
         />
     </van-popup>
+
+    <!-- 加入我的图库 -->
+    <AddChartToMyETA 
+        :isShowDialog="isShowAddToMyETADialog"
+        :dialogPosition="width>650?'center':'bottom'"
+        :chartInfo="chartInfo"
+        @close="isShowAddToMyETADialog=false"
+    />
 </template>
 
 <style lang="scss" scoped>

+ 14 - 1
src/views/myETA/components/EDBInfo.vue

@@ -5,6 +5,9 @@ import {sameOptionType} from '@/hooks/chart/config'
 import _ from 'lodash'
 // import apiChart from '@/api/chart'
 import SourceDetail from '@/views/chartETA/components/SourceDetail.vue'
+import {useCopyEdbData} from '@/hooks/edb/useCopyEdbData'
+
+const {copyData} =useCopyEdbData()
 
 const leadUnitOpt=[{text:'年'}, {text:'季'}, {text:'月'}, {text:'周'}, {text:'天'}]//领先指标频度配置
 
@@ -128,6 +131,10 @@ function handleLeadUnitChange(e){
 // 显示数据来源历史
 const showSourceDetail=ref(false)
 
+function handleCopyEDBData(){
+    copyData(props.data)
+}
+
 </script>
 
 <template>
@@ -143,9 +150,10 @@ const showSourceDetail=ref(false)
                     <van-icon name="arrow" v-if="item.key==='SourceName'&&data.EdbType===2" @click="showSourceDetail=true" />
                 </li>
             </ul>
-            <div class="opt-box" v-if="sameOptionType.includes(chartInfo.ChartType) && chartInfo.ChartType!==5 && chartInfo.Source===1">
+            <div class="opt-box">
                 <div class="lable">指标操作</div>
                 <div class="con">
+                    <template v-if="sameOptionType.includes(chartInfo.ChartType) && chartInfo.ChartType!==5 && chartInfo.Source===1">
                     <div class="item-box" v-if="showYOptionsHandle">
                         <div 
                             :class="['radio-box',temData.IsOrder?'active':'']"
@@ -229,6 +237,11 @@ const showSourceDetail=ref(false)
                             <van-stepper input-width="40px" v-model.number="temData.ChartWidth" />
                         </div>
                     </div>
+                    </template>
+                    <div class="item-box">
+                        <van-button color="#F2F3FF" size="small" style="color:#0052D9;margin-right:10px" @click="handleCopyEDBData">复制数据</van-button>
+                        <van-button color="#0052D9" size="small">查看数据</van-button>
+                    </div>
                 </div>
             </div>
         </div>