<template>
  <PageWrapper dense contentFullHeight  contentClass="flex">
    <StMetricList  class="w-3/5 xl:w-3/5" @onClickRow1="clickMetricRow" :mtrcCtp="1"></StMetricList>
    <MetricReportList class="w-2/5 xl:w-2/5" :data="metricData" ref="refMetricReportList"></MetricReportList>
  </PageWrapper>
</template>

<script lang="ts" setup>
  import {ref,nextTick } from 'vue';
  import StMetricList from './components/StMetricList.vue';
  import MetricReportList from './MetricReportList.vue'
  import { PageWrapper } from '/@/components/Page';
  import { defHttp } from '/@/utils/http/axios';
  import { getAuthCache, setAuthCache, removeAuthCache } from '/@/utils/auth';
  import { TOKEN_KEY} from '/@/enums/cacheEnum';
  import { useUserStore } from '/@/store/modules/user';

  // 从URL获取参数
const getUrlParams = () => {
  const winurl = window.location.href;
  const params = new URLSearchParams(winurl.split('?')[1]);
  return {
    cctoken: params.get('Token') || '',
    WorkID: params.get('WorkID') || '',
  };
};
/**
const { cctoken, WorkID } = getUrlParams();
console.log('cctoken:', cctoken, 'WorkID:', WorkID);
const timestamp = new Date().getTime();
    const gettokeyUrl = '/api/jflow/getCCWorkTokenAndTid';
    const {tid,token} = await defHttp.get({
      url: gettokeyUrl,
      params: {
        "targetKey":"targetKey",
        "flowToken":cctoken,
        "WorkID":WorkID,
        "_t": timestamp},
    });
console.log('Token:', token, 'WorkID:', WorkID);
    setAuthCache(TOKEN_KEY, token);
    */
  

  const metricData = ref({});
  const refMetricReportList = ref(null)
  function clickMetricRow(metricObj) {
      metricData.value = metricObj
  }

</script>

<style lang="less">
.container {
  display: flex; /* 使用flex布局 */
  height: 100%; /* 设置父容器高度为100% */
  width: 100%;
}

.left-area {
  flex: 1; /* 设置左侧区域的flex属性为1，表示占据剩余空间 */
  background-color:#ccc; /* 设置背景色和其他样式 */
  width: 40%;
  margin: 10px;
}

.right-area {
  background-color: #ccc; /* 设置背景色和其他样式 */
  width: 60%;
  margin: 10px;
}
</style>
