<template>
  <div style="padding:16px;">
    <el-form ref="queryForm" :model="queryParams" :inline="true" label-width="68px" @submit.native.prevent>
      <el-form-item label="" prop="url">
        <el-input
          v-model="queryParams.url"
          placeholder="请输入url"
          clearable
          size="mini"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          v-permisaction="['disposition:index:add']"
          type="primary"
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
        >新增</el-button>
      </el-col>
    </el-row>

    <div>
      <!-- v-el-table-infinite-scroll="loadMore"  :height="tableHeight"-->
      <el-table
        v-loading="loading"
        :data="serveceMapList"
        @row-click="handleRowClick"
      >
        <el-table-column header-align="left" label="接口名" prop="name" align="left" :show-overflow-tooltip="true" />
        <el-table-column header-align="left" label="URL组" prop="url" align="left" :show-overflow-tooltip="true">
          <template slot-scope="scope">
            <!-- <span style="cursor:pointer" @click="toogleExpand(row,$index)">{{scope.row.url}}</span> -->
            <span>{{ scope.row.url }}</span>
          </template>
        </el-table-column>
        <el-table-column header-align="center" label="rpm" sortable prop="rpm" align="center" :show-overflow-tooltip="true">
          <template slot-scope="scope">
            <!-- <span>{{ Number(scope.row.rpm).toFixed(2)}}</span> -->
            <el-tag>{{ Number(scope.row.rpm).toFixed(2) }}</el-tag>
          </template>
        </el-table-column>
        <el-table-column header-align="center" label="count" sortable prop="total" align="center">
          <template slot-scope="scope">
            <!-- <span>{{ Number(scope.row.rpm).toFixed(2)}}</span> -->
            <el-tag>{{ Number(scope.row.total).toFixed(2) }}</el-tag>
          </template>
        </el-table-column>
        <el-table-column header-align="center" label="errRate" sortable prop="error_rate" align="center">
          <template slot-scope="scope">
            <el-tag v-if="scope.row.error_rate==0">{{ scope.row.error_rate }}</el-tag>
            <el-tag v-else type="danger">{{ Number(scope.row.error_rate).toFixed(2) }}</el-tag>
          </template>
        </el-table-column>
        <el-table-column header-align="center" label="max(ms)" sortable prop="max" align="center" width="100">
          <template slot-scope="scope">
            <!-- <span>{{ Number(scope.row.max).toFixed(2)}}</span> -->
            <el-tag v-if="scope.row.max>=2000" type="danger">{{ Number(scope.row.max).toFixed(2) }}</el-tag>
            <el-tag v-if="scope.row.max<2000">{{ Number(scope.row.max).toFixed(2) }}</el-tag>
          </template>
        </el-table-column>
        <el-table-column header-align="center" label="avg(ms)" sortable prop="avg" align="center" width="100">
          <template slot-scope="scope">
            <!-- <span>{{ Number(scope.row.avg).toFixed(2)}}</span> -->
            <el-tag v-if="scope.row.avg>=2000" type="danger">{{ Number(scope.row.avg).toFixed(2) }}</el-tag>
            <el-tag v-if="scope.row.avg<2000">{{ Number(scope.row.avg).toFixed(2) }}</el-tag>
          </template>
        </el-table-column>
        <el-table-column header-align="center" label="延迟比例" prop="duration_stats" align="center">
          <template slot-scope="scope">
            {{ drawEchartsp5(scope.row, scope.$index, 'five') }}
            <div :id="`tiger-five-trend-index` + scope.$index" class="tiger-trend-charts" />
          </template>
        </el-table-column>
        <el-table-column
          label="操作"
          align="center"
          class-name="small-padding fixed-width"
          sortable
          prop="favor"
        >
          <template slot-scope="scope">
            <el-button
              v-permisaction="['disposition:index:edit']"
              size="mini"
              type="text"
              icon="el-icon-edit"
              @click.native.stop="handleUpdate(scope.row)"
            >标注</el-button>
            <el-button
              v-if="scope.row.favor == 0"
              size="mini"
              type="text"
              icon="el-icon-star-off"
              @click.native.stop="handleFavor(scope.row)"
            />
            <el-button
              v-if="scope.row.favor == 1"
              size="mini"
              type="text"
              icon="el-icon-star-on"
              @click.native.stop="handleFavor(scope.row)"
            />
            <el-button
              style="color:#F56C6C"
              size="mini"
              type="text"
              icon="el-icon-delete"
              @click.native.stop="handleDelete(scope.row)"
            >删除</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <div v-if="serveceMapList.length<tableCount" class="more" @click="loadMore">加载更多</div>
    <div v-if="loading==false&&serveceMapList.length>=tableCount" class="more nomore">已加载完所有的数据！</div>
    <!-- <pagination
          v-show="total>0"
          :total="total"
          :page.sync="childQueryParams.pageIndex"
          :limit.sync="childQueryParams.pageSize"
          @pagination="handelgetUrlMappingRange"
        /> -->

    <!-- 添加或修改应用配置对话框 -->
    <el-dialog v-if="open" :title="title" :visible.sync="open" width="700px" :center="true" :close-on-click-modal="false">
      <el-form ref="form" :model="form" :rules="rules" label-width="95px">
        <el-form-item label="业务定义" prop="name">
          <el-input v-model="form.name" placeholder="请输入业务定义" />
        </el-form-item>
        <el-form-item label="URL组" prop="url">
          <span slot="label">
            URL组
            <el-tooltip>
              <div slot="content">
                <div>URL匹配示例：</div>
                <div style="display:flex;justify-content:space-between;font-size:12px;">
                  <div>1、/aaa/bbb 完全匹配</div>
                </div>
                <div>
                  <div>2、/aaa/{regexp}, 如/aaa/.*  正则匹配</div>
                </div>
                <!-- <div>
                      <div>3、/aaa/{:words} 匹配任意字母</div>
                    </div> -->
              </div>
              <i class="el-icon-question" />
            </el-tooltip>
          </span>
          <el-input v-model="form.url" placeholder="请输入URL组" />
        </el-form-item>
        <el-form-item label="类型" prop="type">
          <el-radio-group v-model="form.type">
            <el-radio label="1">对外</el-radio>
            <el-radio label="2">对内</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="所属模块" prop="module">
          <el-input v-model="form.module" placeholder="所属模块" />
        </el-form-item>
        <el-form-item label="业务概述" prop="summary">
          <el-input v-model="form.summary" type="textarea" placeholder="请输入业务概述" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
    <!-- <div class="back" @click="toggle()">
            <i class="iconfont icon-qiehuan1"></i>
          </div> -->
    <el-drawer
      :visible.sync="drawer"
      direction="rtl"
      size="55%"
      @close="drawerClose"
    >
      <div style="margin-bottom:16px">

        <div id="scaleMain" style="width:100%;min-width:500px;height:180px;margin-bottom:24px" />

        <el-table
          v-loading="tableLoading"
          :data="rowData"
        >
          <el-table-column header-align="center" label="TraceID" prop="trace_id" align="center" width="240">
            <template slot-scope="scope">
              <span @click="goto(scope.row)">{{ scope.row.trace_id }}</span>
            </template>
          </el-table-column>
          <el-table-column header-align="center" label="服务名称" prop="service_name" align="center" :show-overflow-tooltip="true" />
          <!-- <el-table-column header-align="center" label="SpanName" prop="span_name" align="center" :show-overflow-tooltip="true" />
              <el-table-column header-align="center" label="SpanKind" prop="span_kind" align="center" width="100"/> -->
          <el-table-column header-align="center" label="Target" prop="target" align="center" :show-overflow-tooltip="true" />
          <el-table-column header-align="center" label="方法" prop="method" align="center">
            <template slot-scope="scope">
              <el-tag type="info">{{ scope.row.method }}</el-tag>
            </template>
          </el-table-column>
          <el-table-column header-align="center" label="状态码" prop="status_code" align="center">
            <template slot-scope="scope">
              <span>
                <span v-if="scope.row.status_code<400"><i class="green_small" />{{ scope.row.status_code }}</span>
                <span v-else><i class="red_small" />{{ scope.row.status_code }}</span>
              </span>
            </template>
          </el-table-column>
          <el-table-column header-align="center" label="请求时长(ms)" prop="duration" align="center">
            <template slot-scope="scope">
              <el-tag v-if="scope.row.duration>=2000" type="danger">{{ scope.row.duration }}</el-tag>
              <el-tag v-if="scope.row.duration<2000" type="info">{{ scope.row.duration }}</el-tag>
            </template>
          </el-table-column>
          <!-- <el-table-column header-align="center" label="max(ms)" sortable="custom" prop="duration_stats" align="center" width="100">
                <template slot-scope="scope">
                  <span>{{ Number(scope.row.max).toFixed(2)}}</span>
                </template>
              </el-table-column>
              <el-table-column header-align="center" label="avg(ms)" sortable="custom" prop="duration_stats" align="center" width="100">
                <template slot-scope="scope">
                  <span>{{ Number(scope.row.avg).toFixed(2)}}</span>
                </template>
              </el-table-column> -->
        </el-table>
        <pagination
          v-show="total>0"
          :total="total"
          :page.sync="childQueryParams.pageIndex"
          :limit.sync="childQueryParams.pageSize"
          @pagination="handelgetUrlMappingRange"
        />
      </div>
    </el-drawer>
  </div>
</template>

<script>
import { listUrlMapping, addUrlMapping, getUrlMapping, updateUrlMapping, delUrlMapping, favor, getUrlMappingRange } from '@/api/mapping'
import { formatJson } from '@/utils'
import storage from '@/utils/storage'
// import bus from '@/utils/bus'

import { getToken } from '@/utils/auth'
import resize from './mixins/resize'
import moment from 'moment'
export default {
  name: 'ServiceMap',
  components: {

  },
  mixins: [resize],
  data() {
    return {
      drawer: false,
      detailData: {},
      tableLoading: false,
      // 表格高度
      tableHeight: '',
      // 数据总数
      tableCount: 0,
      serveceMapList: [],
      // 应用数据列表
      appData: [],
      // 遮罩层
      loading: false,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 总条数
      total: 0,
      menuIdsChecked: [],
      // 弹出层标题
      title: '',
      // 是否显示弹出层
      open: false,
      isEdit: false,
      // 日期范围
      dateRange: [],
      // 查询参数
      queryParams: {
        // start_time:Math.round((new Date().getTime())/1000 - (5*60)),
        // end_time:Math.round(new Date().getTime()/1000),
        start_time: 0,
        end_time: 0,
        app_id: undefined,
        favor: '',
        url: '',
        pageIndex: 1,
        pageSize: 50
      },
      // 表单参数
      form: {
      },
      // 表单校验
      rules: {
        name: [
          { required: true, message: '接口名称不能为空', trigger: 'blur' }
        ],
        url: [
          { required: true, message: 'URL组不能为空', trigger: 'blur' }
        ]
      },
      appsfileList: [],
      headers: { 'Authorization': 'Bearer ' + getToken() },
      appsItem: {},
      expands: [],
      childQueryParams: {
        // start_time:Math.round((new Date().getTime())/1000 - (5*60)),
        // end_time:Math.round(new Date().getTime()/1000),
        start_time: 0,
        end_time: 0,
        id: 0,
        app_id: 0,
        kind: '',
        only_error: 0,
        pageIndex: 1,
        pageSize: 10
      },
      rowData: [],
      serviceMapTimer: null
    }
  },
  watch: {
    '$store.state.time.globalTimes': {
      handler(newValue, oldValue) {
        if (newValue) {
          this.queryParams.start_time = newValue.startTime
          this.queryParams.end_time = newValue.endTime
          this.childQueryParams.start_time = newValue.startTime
          this.childQueryParams.end_time = newValue.endTime
          this.queryParams.pageIndex = 1
          this.serveceMapList = []
          this.getList()
          if (newValue.timeOut) {
            if (newValue.timeOut == 1) {
              clearInterval(this.serviceMapTimer)
            } else {
              clearInterval(this.serviceMapTimer)
              this.Refresh(newValue.timeOut)
            }
          }
        }
      },
      // immediate: true,
      deep: true
    }
  },
  beforeDestroy() {
    clearInterval(this.serviceMapTimer)
  },
  created() {
    // this.queryParams.start_time = this.$store.getters.globalTimes.startTime;
    // this.queryParams.end_time = this.$store.getters.globalTimes.endTime
    // this.childQueryParams.start_time = this.$store.getters.globalTimes.startTime;
    // this.childQueryParams.end_time = this.$store.getters.globalTimes.endTime
    const windowHeight = document.documentElement.clientHeight || document.body.clientHeight
    // 动态计算表格的高度，200为屏幕内除了表格以外其他元素的高度，依实际情况而定
    this.tableHeight = windowHeight - 200 + 'px'
    this.appsItem = storage.get('appsItem')
    if (this.appsItem.id != '' || this.appsItem.id != undefined) {
      this.queryParams.app_id = this.appsItem.id
      this.childQueryParams.app_id = this.appsItem.id
      this.getList()
    }
  },
  mounted() {
  },
  methods: {
    Refresh(timeOut) {
      this.serviceMapTimer = setInterval(() => {
        this.getList()
      }, timeOut)
    },
    goto(row) {
      const datetime = Date.parse(row.datetime) / 1000
      const href = this.$router.resolve({
        path: '/latency/index',
        query: {
          id: row.trace_id,
          span_id: row.span_id,
          datetime: datetime
        }
      })
      window.open(window.location.origin + '/' + href.href, '_blank')
    },
    drawerClose() {
      this.drawer = false
    },
    toogleExpand(row, column, event) {
      this.drawer = true
      this.childQueryParams.id = row.id
      this.handelgetUrlMappingRange()
    },
    handleRowClick(row, column, event) {
      this.drawer = true
      this.$nextTick(() => {
        this.drawEchartsScale(row)
      })
      setTimeout(() => {
        // this.childQueryParams.id = row.id;
        this.childQueryParams.kind = row.kind
        this.handelgetUrlMappingRange()
      }, 0)
    },
    handelgetUrlMappingRange() {
      this.tableLoading = true
      getUrlMappingRange(this.childQueryParams).then(res => {
        if (res.code == 200) {
          this.tableLoading = false
          this.rowData = res.data.list
          this.total = res.data.count
        }
      })
    },
    // 根据行的id判断
    getRowKeys(row) {
      return row.id
    },
    clickRowHandle(row, column, event) {
    //  alert('a')
    },
    handleSortChang(column, prop, order) {
      prop = column.prop
      order = column.order
      if (this.order !== '' && this.order !== prop + 'Order') {
        this.queryParams[this.order] = undefined
      }
      if (order === 'descending') {
        this.queryParams[prop + 'Order'] = 'desc'
        this.order = prop + 'Order'
      } else if (order === 'ascending') {
        this.queryParams[prop + 'Order'] = 'asc'
        this.order = prop + 'Order'
      } else {
        this.queryParams[prop + 'Order'] = undefined
      }
      this.getList()
    },
    toggle() {
      this.$router.push({
        path: 'dashboard'
      })
    },
    // 加载更多
    loadMore() {
      if (!this.loading) {
        this.loading = true
        if (this.serveceMapList.length < this.tableCount) {
          this.queryParams.pageIndex++
          this.getList()
        } else {
          // this.$message("已加载完所有的数据！");
          this.loading = false
        }
      }
    },
    getList() {
      this.loading = true
      listUrlMapping(this.queryParams).then(res => {
        if (res.code == 200) {
          this.loading = false
          this.serveceMapList = this.serveceMapList.concat(res.data.list)
          this.tableCount = res.data.count
          this.queryParams.pageIndex = res.data.pageIndex
        }
      })
    },
    uploadSuccess(response, file, fileList) {
      this.form.imgUrl = process.env.VUE_APP_BASE_API + response.data.full_path
    },
    // 取消按钮
    cancel() {
      this.open = false
      this.reset()
    },
    // 表单重置
    reset() {
      this.form = {
        id: undefined,
        name: undefined,
        url: undefined,
        type: undefined,
        module: undefined,
        summary: undefined,
        favor: undefined
      }
      this.resetForm('form')
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageIndex = 1
      this.serveceMapList = []
      this.getList()
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.dateRange = []
      this.resetForm('queryForm')
      this.handleQuery()
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length !== 1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset()
      // this.getMenuTreeselect(0)
      this.open = true
      this.title = '新增URL组'
      this.isEdit = false
    },
    handleSortChang(column, prop, order) {
      prop = column.prop
      order = column.order
      if (order === 'descending') {
        this.queryParams[prop + 'Order'] = 'desc'
      } else if (order === 'ascending') {
        this.queryParams[prop + 'Order'] = 'asc'
      } else {
        this.queryParams[prop + 'Order'] = undefined
      }
      this.getList()
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset()
      const id = row.id || this.ids
      if (row.id != 0) {
        getUrlMapping(id).then(response => {
          this.form = response.data
          this.form.id = row.id
          this.title = '修改URL组'
          this.isEdit = true
          this.open = true
        })
      } else {
        this.form = row
        // this.form.id = undefined
        this.isEdit = true
        this.open = true
      }
    },
    /** 提交按钮 */
    submitForm: function() {
      this.$refs['form'].validate(valid => {
        if (valid) {
          if (this.form.id !== undefined || this.form.id != 0) {
            updateUrlMapping(this.form, this.form.id).then(response => {
              if (response.code === 200) {
                this.msgSuccess(response.msg)
                this.open = false
                this.queryParams.pageIndex = 1
                this.serveceMapList = []
                this.getList()
              } else {
                this.msgError(response.msg)
              }
            })
          } else {
            addUrlMapping(this.form).then(response => {
              if (response.code === 200) {
                this.msgSuccess(response.msg)
                this.open = false
                this.queryParams.pageIndex = 1
                this.serveceMapList = []
                this.getList()
              } else {
                this.msgError(response.msg)
              }
            })
          }
        }
      })
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      // const id = (row.id && [row.id]) || this.ids
      const id = row.id
      this.$confirm('是否确认删除接口映射编号为"' + id + '"的数据项?', '警告', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(function() {
        return delUrlMapping(id)
      }).then((response) => {
        this.queryParams.pageIndex = 1
        this.serveceMapList = []
        this.msgSuccess(response.msg)
        this.getList()
      }).catch(function() {})
    },
    handleFavor(row) {
      if (row.favor == 1) {
        row.favor = '0'
      } else if (row.favor == 0) {
        row.favor = '1'
      }

      favor({ favor: row.favor }, row.id).then(res => {
        if (res.code = 200) {
          this.msgSuccess(res.msg)
          this.queryParams.pageIndex = 1
          this.serveceMapList = []
          this.getList()
        }
      })
    },
    /** 导出按钮操作 */
    handleExport() {
      this.$confirm('是否确认导出所有角色数据项?', '警告', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.downloadLoading = true
        import('@/vendor/Export2Excel').then(excel => {
          const tHeader = ['角色编号', '角色名称', '权限字符', '显示顺序', '状态', '创建时间']
          const filterVal = ['roleId', 'roleName', 'roleKey', 'roleSort', 'status', 'createdAt']
          const list = this.roleList
          const data = formatJson(filterVal, list)
          excel.export_json_to_excel({
            header: tHeader,
            data,
            filename: '角色管理',
            autoWidth: true, // Optional
            bookType: 'xlsx' // Optional
          })
          this.downloadLoading = false
        })
      })
    },
    drawEchartsp5(row, index) {
      const option = {
        tooltip: {
          trigger: 'axis',
          confine: false,
          appendToBody: true
        },
        grid: {
          top: 10,
          left: 0,
          right: '4%',
          bottom: '-2%',
          containLabel: false
        },
        xAxis: {
          type: 'category',
          boundaryGap: false,
          // data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
          data: row.duration_stats.time,
          show: false
        },
        yAxis: {
          type: 'value',
          show: false
        },
        series: [
          {
            name: 'P.50',
            type: 'line',
            stack: 'Total',
            symbol: 'none',
            data: row.duration_stats.p50
          },
          {
            name: 'P.95',
            type: 'line',
            stack: 'Total',
            symbol: 'none',
            data: row.duration_stats.p90
          },
          {
            name: 'P.99',
            type: 'line',
            stack: 'Total',
            symbol: 'none',
            // data: [820, 932, 901, 934, 1290, 1330, 1320]
            // data: Number(row.duration_stats.p99).toFixed(2)
            data: row.duration_stats.p99
          }
        ]
      }
      const chartId = 'tiger-' + arguments[2] + '-trend-index' + arguments[1]
      this.$nextTick(() => {
        const myChart = this.$echarts5.init(document.getElementById(chartId), 'macarons')
        myChart.setOption(option)
        myChart.resize()
      })
    },
    drawEchartsScale(row) {
      const _this = this
      const myChartScale = this.$echarts5.init(document.getElementById('scaleMain'))
      // 绘制趋势echarts
      const option = {
        tooltip: {
          trigger: 'axis',
          confine: false,
          appendToBody: true,
          show: true,
          formatter: function(params) {
            storage.set('paramsValue', params)
            const axisValueLabel = params[0].axisValueLabel
            let str0 = ''
            params.forEach((item, idx) => {
              // str1+=`${}`
              str0 += `${item.marker}${item.seriesName}<span style='margin-left:30px;text-align:right;font-weight:400'>${item.data}</span>`
              switch (idx) {
                case 0:
                  str0
                  break
                case 1:
                  str0
                  break
                default:
                  str0
              }
              str0 += idx === params.length - 1 ? '' : '<br/>'
            })
            return axisValueLabel + '<br>' + str0
          }
        },
        grid: {
          left: '4%',
          right: '4%',
          bottom: '3%',
          containLabel: true
        },
        xAxis: {
          type: 'category',
          boundaryGap: false,
          data: row.duration_stats.time
          // show:true
        },
        yAxis: {
          type: 'value',
          scale: true,
          gridIndex: 0,
          axisLabel: {
            formatter: '{value}'
          },
          axisLine: {
            show: true
          },
          axisTick: {
            show: true
          },
          splitLine: {
            show: true
          }
        },
        series: [
          {
            name: 'P.50',
            type: 'line',
            stack: 'Total',
            symbol: 'none',
            // symbol: 'emptyCircle',//拐点
            data: row.duration_stats.p50
          },
          {
            name: 'P.95',
            type: 'line',
            stack: 'Total',
            symbol: 'none', // 拐点
            // symbol: 'emptyCircle',//拐点
            data: row.duration_stats.p90
          },
          {
            name: 'P.99',
            type: 'line',
            stack: 'Total',
            symbol: 'none', // 拐点
            // symbol: 'emptyCircle',//拐点
            data: row.duration_stats.p99
          }
        ]
      }
      // this.$nextTick(() => {
      //   let myChartScale = this.$echarts5.init(document.getElementById('scale'));
      myChartScale.setOption(option)
      //   myChartScale.resize();
      // });
      // myChartScale.on('click',params=>{
      // })

      myChartScale.getZr().on('click', params => {
        //  myChartScale.on('click', params => {
        //    const {target} = params;
        //     if (target && target.z === 3) {
        //   const parent = params.target.parent.parent;
        //   let seriesIndex = parent.__ecComponentInfo ? parent.__ecComponentInfo.index : parent.parent.__ecComponentInfo.index
        //  // 获取数据，进行操作
        // }
        const data = storage.get('paramsValue')
        const timestamp = moment(data[0].name).unix()

        _this.childQueryParams.start_time = timestamp
        _this.childQueryParams.end_time = timestamp
        _this.handelgetUrlMappingRange()
      })
    },
    drawEchartsp99() {
      // 绘制趋势echarts
      const option = {
        xAxis: {
          type: 'category',
          boundaryGap: false,
          show: false
          // data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
        },
        yAxis: {
          type: 'value',
          show: false
        },
        series: [
          {
            // data: arguments[0].duration_stats.p99,
            data: [156, 932, 876, 234, 424, 189, 1320],
            type: 'line',
            smooth: true,
            areaStyle: {
              color: '#EAF5F8'
            },
            lineStyle: {
              color: '#7EBBD6'
            },
            symbol: 'none'
          }
        ]
      }
      const chartId = 'tiger-' + arguments[2] + '-trend-index' + arguments[1]
      this.$nextTick(() => {
        const myChart = this.$echarts5.init(document.getElementById(chartId), 'macarons')
        myChart.setOption(option)
        myChart.resize()
      })
    }
  }
}
</script>
<style lang="scss" scoped>
// @font-face {
//   font-family: 'iconfont';  /* Project id 4241886 */
//   src: url('https://at.alicdn.com/t/c/font_4241886_44emlzl9ad4.woff2?t=1694073615647') format('woff2'),
//        url('https://at.alicdn.com/t/c/font_4241886_44emlzl9ad4.woff?t=1694073615647') format('woff'),
//        url('https://at.alicdn.com/t/c/font_4241886_44emlzl9ad4.ttf?t=1694073615647') format('truetype');
// }
.iconfont {
  font-family: "iconfont" !important;
  font-size: 20px;
  font-style: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.icon-jiantou_zuoyouqiehuan:before {
  content: "\eb0d";
}

.icon-qiehuan:before {
  content: "\e606";
}

.icon-qiehuan1:before {
  content: "\e789";
}
::v-deep .el-card__body{
  position: relative !important;
}
.back{
  position: absolute;
  top:10px;
  right:10px;
  width:20px;
  height:20px;
}
.tiger-trend-charts {
   height: 40px;
   width:100px;
   min-width: 80px;
   max-width: 100px;
  }
  ::v-deep .el-icon-star-on{
    font-size: 16px;
  }
  .more{
    margin:16px 0;
    text-align: center;
    font-size: 16px;
    color:#1890ff;
    cursor: pointer;
  }
  .nomore{
    color:#999;
  }
  .green_small{
    display: inline-block;
    width:8px;
    height: 8px;
    border-radius: 50%;
    background:#67C23A;
    margin-right:8px;
  }
  .red_small{
    width:8px;
    height: 8px;
    display: inline-block;
    border-radius: 50%;
    background:#F56C6C;
    margin-right:8px;
  }
</style>
