Просмотр исходного кода

Merge branch 'dev' of http://git.cestong.com.cn/cecf/observe-front into dev

wanghao 7 месяцев назад
Родитель
Сommit
57bf80f34d

+ 221 - 165
src/views/business-analysis/topology/components/allBusinessCon.vue

@@ -1,8 +1,48 @@
 <template>
   <div style="padding:16px;">
     <el-row :gutter="10" class="mb8">
+      <el-col :span="6">
+        <div class="flex">
+          <span class="seach-title">涉及的服务</span>
+          <el-select v-model="queryParams.service_name" size="small" clearable @change="handChange" @clear="handleQuery">
+            <el-option
+              v-for="item in serviceList"
+              :key="item.id"
+              :label="item.name"
+              :value="item.service_name"
+            />
+          </el-select>
+        </div>
+      </el-col>
+      <el-col :span="6">
+        <div class="flex">
+          <span class="seach-title">延迟范围 >=</span>
+          <el-input v-model="queryParams.duration" type="number" size="small" clearable placeholder="请输入延迟范围" @keyup.enter.native="handleQuery" @clear="handleQuery" />
+        </div>
+      </el-col>
+      <el-col :span="6">
+        <div class="flex">
+          <span class="seach-title">错误率 >=</span>
+          <el-input v-model="queryParams.error_rate" type="number" size="small" clearable placeholder="请输入错误率" @keyup.enter.native="handleQuery" @clear="handleQuery" />
+        </div>
+      </el-col>
+      <el-col :span="6">
+        <div class="flex">
+          <span class="seach-title">请求量 >=</span>
+          <el-input v-model="queryParams.request_total" type="number" size="small" clearable placeholder="请输入错误率" @keyup.enter.native="handleQuery" @clear="handleQuery" />
+        </div>
+      </el-col>
+    </el-row>
+    <el-row :gutter="10" class="mb8 flex" style="margin-bottom: 10px;">
+      <el-col :span="4">
+        <el-checkbox v-model="queryParams.access_database" @change="handleQuery">涉及数据库</el-checkbox>
+      </el-col>
+      <el-col :span="2">
+        <el-checkbox v-model="queryParams.favor" @change="handleQuery">仅收藏</el-checkbox>
+      </el-col>
+
       <el-col :span="2">
-        <div style="display:inline-block;vertical-align: middle;">
+        <div class="flex">
           <el-dropdown
             style="margin-left: 10px"
             size="mini"
@@ -32,8 +72,7 @@
         </div>
       </el-col>
     </el-row>
-
-    <div v-if="serveceMapList.length>0" class="TableBox">
+    <div class="TableBox">
       <el-table
         ref="tableRef"
         :key="isUpdate"
@@ -41,38 +80,38 @@
         :data="serveceMapList"
         @row-click="handleRowClick"
       >
-        <el-table-column v-if="colData[0].istrue" align="center"  header-align="center" class-name="column_one" label="业务名" prop="name"  :show-overflow-tooltip="true" />
-        <el-table-column v-if="colData[4].istrue" header-align="center" align="center" label="请求总数" sortable prop="request_total"  :show-overflow-tooltip="true">
+        <el-table-column v-if="colData[0].istrue" align="center" header-align="center" class-name="column_one" label="业务名" prop="name" :show-overflow-tooltip="true" />
+        <el-table-column v-if="colData[4].istrue" header-align="center" align="center" label="请求总数" sortable prop="request_total" :show-overflow-tooltip="true">
           <template slot-scope="scope">
             <div :class="scope.row.request_total!=0&&scope.row.request_total!= undefined?'table_bg':'table_bg_yellow'">
               <div class="table-num-box">
-                {{ scope.row.request_total== undefined?0:Number(scope.row.request_total).toFixed(2)  }}
+                {{ scope.row.request_total== undefined?0:Number(scope.row.request_total).toFixed(2) }}
               </div>
               <div class="table-day-rate-box">
-                <i v-show="processNumber(scope.row.request_total_dod).sign"  :class="processNumber(scope.row.request_total_dod).sign == 'up'? 'el-icon-up up':'el-icon-down down'"></i>
+                <i v-show="processNumber(scope.row.request_total_dod).sign" :class="processNumber(scope.row.request_total_dod).sign == 'up'? 'el-icon-up up':'el-icon-down down'" />
                 <span>
-                  {{ scope.row.request_total_dod==undefined?0:getErrRate(processNumber(scope.row.request_total_dod).value)}}
+                  {{ scope.row.request_total_dod==undefined?0:getErrRate(processNumber(scope.row.request_total_dod).value) }}
                 </span>
               </div>
             </div>
           </template>
         </el-table-column>
-        <el-table-column v-if="colData[1].istrue" header-align="center" align="center" label="调用占比" prop="request_rate"  :show-overflow-tooltip="true">
+        <el-table-column v-if="colData[1].istrue" header-align="center" align="center" label="调用占比" prop="request_rate" :show-overflow-tooltip="true">
           <template slot-scope="scope">
             <div class="table_bg">
               <div class="table-num-box">
-                {{getErrRate(scope.row.request_rate)}}
+                {{ getErrRate(scope.row.request_rate) }}
               </div>
               <div class="table-day-rate-box">
-                <i v-show="processNumber(scope.row.request_rate_dod).sign"  :class="processNumber(scope.row.request_rate_dod).sign == 'up'? 'el-icon-up up':'el-icon-down down'"></i>
+                <i v-show="processNumber(scope.row.request_rate_dod).sign" :class="processNumber(scope.row.request_rate_dod).sign == 'up'? 'el-icon-up up':'el-icon-down down'" />
                 <span>
-                  {{ scope.row.request_rate_dod==undefined?0:getErrRate(scope.row.request_rate_dod)}}
+                  {{ scope.row.request_rate_dod==undefined?0:getErrRate(processNumber(scope.row.request_rate_dod).value) }}
                 </span>
               </div>
             </div>
           </template>
         </el-table-column>
-        <el-table-column v-if="colData[2].istrue" header-align="center"  align="center" label="SpanName" prop="span_name"  :show-overflow-tooltip="true">
+        <el-table-column v-if="colData[2].istrue" header-align="center" align="center" label="SpanName" prop="span_name" :show-overflow-tooltip="true">
           <template slot-scope="scope">
             <span>{{ scope.row.span_name }}</span>
           </template>
@@ -84,123 +123,93 @@
             </div>
           </template>
         </el-table-column>
-        <el-table-column v-if="colData[5].istrue" header-align="center" align="center" label="错误率" sortable prop="error_rate"  :show-overflow-tooltip="true">
+        <el-table-column v-if="colData[5].istrue" header-align="center" align="center" label="错误率" sortable prop="error_rate" :show-overflow-tooltip="true">
           <template slot-scope="scope">
             <div :class="scope.row.error_rate==0?'table_bg':'table_bg_red'">
               <div class="table-num-box">
                 {{ getErrRate(scope.row.error_rate) }}
               </div>
               <div class="table-day-rate-box">
-                <i v-show="processNumber(scope.row.error_rate_dod).sign"  :class="processNumber(scope.row.error_rate_dod).sign == 'up'? 'el-icon-up up':'el-icon-down down'"></i>
+                <i v-show="processNumber(scope.row.error_rate_dod).sign" :class="processNumber(scope.row.error_rate_dod).sign == 'up'? 'el-icon-up up':'el-icon-down down'" />
                 <span>
-                  {{ scope.row.error_rate_dod==undefined?0:getErrRate(scope.row.error_rate_dod)}}
+                  {{ scope.row.error_rate_dod==undefined?0:getErrRate(processNumber(scope.row.error_rate_dod).value) }}
                 </span>
               </div>
             </div>
           </template>
         </el-table-column>
-        <el-table-column v-if="colData[6].istrue" header-align="center" align="center" label="最大延迟(ms)" sortable prop="max"  :show-overflow-tooltip="true">
+        <el-table-column v-if="colData[6].istrue" header-align="center" align="center" label="最大延迟(ms)" sortable prop="max" :show-overflow-tooltip="true">
           <template slot-scope="scope">
             <div :class="scope.row.max<2000?'table_bg':'table_bg_red'">
               {{ scope.row.max==undefined?0:Number(scope.row.max).toFixed(2) }}
             </div>
           </template>
         </el-table-column>
-        <el-table-column v-if="colData[7].istrue" header-align="center" align="center" label="平均延迟(ms)" sortable prop="duration_average"  :show-overflow-tooltip="true">
+        <el-table-column v-if="colData[7].istrue" header-align="center" align="center" label="平均延迟(ms)" sortable prop="duration_average" :show-overflow-tooltip="true">
           <template slot-scope="scope">
             <div :class="scope.row.duration_average<2000?'table_bg':'table_bg_red'">
               <div class="table-num-box">
                 {{ scope.row.duration_average==undefined?0:Number(scope.row.duration_average).toFixed(2) }}
               </div>
               <div class="table-day-rate-box">
-                <i v-show="processNumber(scope.row.duration_average_dod).sign"  :class="processNumber(scope.row.duration_average_dod).sign == 'up'? 'el-icon-up up':'el-icon-down down'"></i>
+                <i v-show="processNumber(scope.row.duration_average_dod).sign" :class="processNumber(scope.row.duration_average_dod).sign == 'up'? 'el-icon-up up':'el-icon-down down'" />
                 <span>
-                  {{ scope.row.duration_average_dod==undefined?0:getErrRate(scope.row.duration_average_dod)}}
+                  {{ scope.row.duration_average_dod==undefined?0:getErrRate(processNumber(scope.row.duration_average_dod).value) }}
                 </span>
               </div>
             </div>
           </template>
         </el-table-column>
-        <el-table-column v-if="colData[8].istrue" header-align="center" align="center" label="中位延迟" prop="duration_median"  width="200">
+        <el-table-column header-align="center" align="center" label="中位延迟222s" prop="duration_median" width="200">
           <template slot-scope="scope">
-            <div :class="scope.row.duration_median<2000?'table_bg':'table_bg_red'">
-              <div class="table-num-box">
-                {{ scope.row.duration_median==undefined?0:Number(scope.row.duration_median).toFixed(2) }}
-              </div>
-              <div class="table-day-rate-box">
-                <i v-show="processNumber(scope.row.duration_median_dod).sign"  :class="processNumber(scope.row.duration_median_dod).sign == 'up'? 'el-icon-up up':'el-icon-down down'"></i>
-                <span>
-                  {{ scope.row.duration_median_dod==undefined?0:getErrRate(scope.row.duration_median_dod)}}
-                </span>
+            <div :class="scope.row.duration_median<2000?'table_bg':'table_bg_red'" style="display:flex;">
+              <div>
+                <div class="table-num-box">
+                  {{ scope.row.duration_median==undefined?0:Number(scope.row.duration_median).toFixed(2) }}
+                </div>
+                <div class="table-day-rate-box">
+                  <i v-show="processNumber(scope.row.duration_median_dod).sign" :class="processNumber(scope.row.duration_median_dod).sign == 'up'? 'el-icon-up up':'el-icon-down down'" />
+                  <span>
+                    {{ scope.row.duration_median_dod==undefined?0:getErrRate(processNumber(scope.row.duration_median_dod).value) }}
+                  </span>
+                </div>
               </div>
+              <span v-if="scope.row.quantiles!=undefined" style="display:flex;">
+                {{ drawEchartsp5(scope.row, scope.$index, 'five') }}
+                <div :id="`tiger-five-trend-index` + scope.$index" style="flex:1;padding-left:10px" class="tiger-trend-charts" />
+              </span>
             </div>
           </template>
-          <!-- <template slot-scope="scope">
-            <span v-if="scope.row.quantiles!=undefined" style="display:flex;">
-              {{ drawEchartsp5(scope.row, scope.$index, 'five') }}
-              <div :id="`tiger-five-trend-index` + scope.$index" style="flex:1;padding-left:10px" class="tiger-trend-charts" />
-              <el-popover trigger="hover" placement="top">
-                {{ scope.row.quantiles.p50!= undefined&&scope.row.quantiles.p50.length>0?timeConversion(scope.row.quantiles.p50[scope.row.quantiles.p50.length-1]):'' }}
-                <div slot="reference" class="name-wrapper">
-                  <div class="P_box">{{ scope.row.quantiles.p50!= undefined&&scope.row.quantiles.p50.length>0?timeConversion(scope.row.quantiles.p50[scope.row.quantiles.p50.length-1]):'' }}</div>
-                </div>
-              </el-popover>
-            </span>
-          </template> -->
         </el-table-column>
-        <el-table-column v-if="colData[9].istrue" header-align="center" align="center" label="90分位延迟" prop="duration_p90"  width="200">
+        <el-table-column v-if="colData[9].istrue" header-align="center" align="center" label="90分位延迟" prop="duration_p90" width="200">
           <template slot-scope="scope">
             <div :class="scope.row.duration_p90<2000?'table_bg':'table_bg_red'">
               <div class="table-num-box">
                 {{ scope.row.duration_p90==undefined?0:Number(scope.row.duration_p90).toFixed(2) }}
               </div>
               <div class="table-day-rate-box">
-                <i v-show="processNumber(scope.row.duration_p90_dod).sign"  :class="processNumber(scope.row.duration_p90_dod).sign == 'up'? 'el-icon-up up':'el-icon-down down'"></i>
+                <i v-show="processNumber(scope.row.duration_p90_dod).sign" :class="processNumber(scope.row.duration_p90_dod).sign == 'up'? 'el-icon-up up':'el-icon-down down'" />
                 <span>
-                  {{ scope.row.duration_p90_dod==undefined?0:getErrRate(scope.row.duration_p90_dod)}}
+                  {{ scope.row.duration_p90_dod==undefined?0:getErrRate(processNumber(scope.row.duration_p90_dod).value) }}
                 </span>
               </div>
             </div>
           </template>
-          <!-- <template slot-scope="scope">
-            <span v-if="scope.row.quantiles!=undefined" style="display:flex;">
-              {{ drawEchartsp90(scope.row, scope.$index, 'nine') }}
-              <div :id="`tiger-nine-trend-index` + scope.$index" style="flex:1;padding-left:10px" class="tiger-trend-charts" />
-              <el-popover trigger="hover" placement="top">
-                {{ scope.row.quantiles.p90!= undefined&&scope.row.quantiles.p90.length>0?timeConversion(scope.row.quantiles.p90[scope.row.quantiles.p90.length-1]):'' }}
-                <div slot="reference" class="name-wrapper">
-                  <div class="P_box">{{ scope.row.quantiles.p90!= undefined&&scope.row.quantiles.p90.length>0?timeConversion(scope.row.quantiles.p90[scope.row.quantiles.p90.length-1]):'' }}</div>
-                </div>
-              </el-popover>
-            </span>
-          </template> -->
         </el-table-column>
-        <el-table-column v-if="colData[10].istrue" header-align="center" align="center" label="99分位延迟" prop="duration_p99"  width="200">
+        <el-table-column v-if="colData[10].istrue" header-align="center" align="center" label="99分位延迟" prop="duration_p99" width="200">
           <template slot-scope="scope">
             <div :class="scope.row.duration_p99<2000?'table_bg':'table_bg_red'">
               <div class="table-num-box">
                 {{ scope.row.duration_p99==undefined?0:Number(scope.row.duration_p99).toFixed(2) }}
               </div>
               <div class="table-day-rate-box">
-                <i v-show="processNumber(scope.row.duration_p99_dod).sign"  :class="processNumber(scope.row.duration_p99_dod).sign == 'up'? 'el-icon-up up':'el-icon-down down'"></i>
+                <i v-show="processNumber(scope.row.duration_p99_dod).sign" :class="processNumber(scope.row.duration_p99_dod).sign == 'up'? 'el-icon-up up':'el-icon-down down'" />
                 <span>
-                  {{ scope.row.duration_p99_dod==undefined?0:getErrRate(scope.row.duration_p99_dod)}}
+                  {{ scope.row.duration_p99_dod==undefined?0:getErrRate(processNumber(scope.row.duration_p99_dod).value) }}
                 </span>
               </div>
             </div>
           </template>
-          <!-- <template slot-scope="scope">
-            <span v-if="scope.row.quantiles!=undefined" style="display:flex;">
-              {{ drawEchartsp99(scope.row, scope.$index, 'hundred') }}
-              <div :id="`tiger-hundred-trend-index` + scope.$index" style="flex:1;padding-left:10px" class="tiger-trend-charts" />
-              <el-popover trigger="hover" placement="top">
-                {{ scope.row.quantiles.p99!= undefined&&scope.row.quantiles.p90.length>0?timeConversion(scope.row.quantiles.p99[scope.row.quantiles.p99.length-1]):'' }}
-                <div slot="reference" class="name-wrapper">
-                  <div class="P_box">{{ scope.row.quantiles.p99!= undefined&&scope.row.quantiles.p99.length>0?timeConversion(scope.row.quantiles.p99[scope.row.quantiles.p99.length-1]):'' }}</div>
-                </div>
-              </el-popover>
-            </span>
-          </template> -->
         </el-table-column>
         <el-table-column
           label="操作"
@@ -262,7 +271,7 @@
       </div>
     </el-dialog>
     <!-- 业务空间 -->
-    <ServiceSpaceDrawer v-if="isShowServiceSpaceDrawer" :is-opendrawer="isShowServiceSpaceDrawer" :bussiness-id="currentBussinessId" :bussiness-name="currentBussinessName" @handleClose="handleClose"></ServiceSpaceDrawer>
+    <ServiceSpaceDrawer v-if="isShowServiceSpaceDrawer" :is-opendrawer="isShowServiceSpaceDrawer" :bussiness-id="currentBussinessId" :bussiness-name="currentBussinessName" @handleClose="handleClose" />
   </div>
 </template>
 
@@ -272,12 +281,9 @@ import { addUrlMapping, getNewBusinessList, listBizStats, getBizDetail, listBizG
 import { formatJson } from '@/utils'
 import storage from '@/utils/storage'
 // import bus from '@/utils/bus'
-
+import { listService } from '@/api/service'
 import { getToken } from '@/utils/auth'
-// import echarts from 'echarts'
 import resize from '../../mixins/resize'
-import moment from 'moment'
-// import elTableInfiniteScroll from 'el-table-infinite-scroll';
 import Topo from './Topo'
 import BigNumber from 'bignumber.js'
 export default {
@@ -297,10 +303,10 @@ export default {
         // "SpanName",
         // "rpm",
         '请求总数',
-        "错误率",
+        '错误率',
         // '最大延迟(ms)',
         // "延迟比例",
-        '中位延迟',
+        '中位延迟'
         // '90分位延迟',
         // '99分位延迟'
       ],
@@ -334,7 +340,6 @@ export default {
       // 应用数据列表
       appData: [],
       // 遮罩层
-      loading: false,
       // 选中数组
       ids: [],
       // 非单个禁用
@@ -353,17 +358,18 @@ export default {
       dateRange: [],
       // 查询参数
       queryParams: {
-        app_alias:'',//应用别名
-        service_name: null,//服务名称
-        // duration:'',//最小延迟
-        // error_rate:'',//最小错误率
-        // request_total:'',//最低请求量
-        // node_num:'',//最小节点数量
-        // access_database: '',//是否涉及数据库
-        // vip: true,//是否为重点业务
-        // favor:'',//是否收藏
-        page_num: 1,//当前页码
-        page_size: 10,//每页条数
+        app_alias: '', // 应用别名
+        service_name: null, // 服务名称
+        duration: '', // 最小延迟
+        error_rate: '', // 最小错误率
+        request_total: '', // 最低请求量
+        node_num: '', // 最小节点数量
+        access_database: '', // 是否涉及数据库
+        favor: '', // 是否收藏
+        sort_field: '', // 支持 request_total(请求总数,调用占比)、error_rate(错误率)、duration_median(中位延迟)
+        sort_type: 'desc',
+        page_num: 1, // 当前页码
+        page_size: 10// 每页条数
       },
       // 表单参数
       form: {
@@ -382,7 +388,7 @@ export default {
       headers: { 'Authorization': 'Bearer ' + getToken() },
       appsItem: {},
       expands: [],
-
+      serviceList: [],
       rowData: [],
       serviceMapTimer: null,
       BizStatsQuery: {
@@ -397,20 +403,31 @@ export default {
         end_time: 1702972800,
         start_time: 1702969200
       },
+      serviceParams: {
+        app_id: '',
+        start_time: '',
+        end_time: '',
+        pageIndex: 1,
+        pageSize: 200
+      },
       graphObj: [],
       detailTitle: '',
       detailObj: {},
       myChartList: [],
       myChartboxList: [],
       myChartBox2List: [],
-      currentBussinessId:'',//当前点击业务id
-      currentBussinessName:'相关业务',//当前点击业务名字
+      currentBussinessId: '', // 当前点击业务id
+      currentBussinessName: '相关业务'// 当前点击业务名字
     }
   },
   watch: {
     '$store.state.time.globalTimes': {
       handler(newValue, oldValue) {
         if (newValue) {
+          this.serviceParams.start_time = newValue.startTime
+          this.serviceParams.end_time = newValue.endTime
+          this.serviceParams.pageIndex = 1
+
           this.queryParams.start_time = newValue.startTime
           this.queryParams.end_time = newValue.endTime
           this.BizStatsQuery.start_time = newValue.startTime
@@ -419,6 +436,8 @@ export default {
           this.graphStatsQuery.end_time = newValue.endTime
           this.queryParams.page_num = 1
           this.serveceMapList = []
+
+          this.getServiceList() // 获取服务列表select
           this.getList()
           if (newValue.timeOut) {
             if (newValue.timeOut == 1) {
@@ -446,16 +465,22 @@ export default {
   },
   created() {
     this.$store.commit('time/setTimeFlag', false)
-
+    const start_time = this.$store.state.time.globalTimes.startTime
+    const end_time = this.$store.state.time.globalTimes.endTime
+    this.serviceParams.start_time = start_time
+    this.serviceParams.end_time = end_time
+    this.BizStatsQuery.start_time = start_time
+    this.BizStatsQuery.end_time = end_time
     this.appItem = storage.get('appsItem')
     if (JSON.stringify(this.appItem) != '{}') {
       this.appItem = storage.get('appsItem')
       this.queryParams.app_alias = this.appItem.alias
+      this.serviceParams.app_id = this.appItem.id
       this.getList()
       this.$forceUpdate()
     }
+    this.getServiceList() // 获取服务列表select
     this.columnChange()
-
   },
   mounted() {
     this.$forceUpdate()
@@ -467,69 +492,76 @@ export default {
     this.disposeEcharts(this.myChartBox2List)
   },
   methods: {
-    //判断数字是正是负还是零并给出标识
+    // 获取该业务的服务list
+    getServiceList() {
+      listService(this.serviceParams).then(res => {
+        if (res.code === 200) {
+          this.serviceList = res.data.list
+        }
+      })
+    },
+    // 判断数字是正是负还是零并给出标识
     processNumber(num) {
-      let result = {
+      const result = {
         value: num,
         sign: ''
-      };
+      }
       if (num > 0) {
-        result.sign = 'up';
+        result.sign = 'up'
       } else if (num < 0) {
-        result.value = Math.abs(num); // 返回绝对值
-        result.sign = 'down';
+        result.value = Math.abs(num) // 返回绝对值
+        result.sign = 'down'
       } else {
-        result.sign = '';
+        result.sign = ''
       }
-      return result;
+      return result
     },
-    getErrRate(error_rate){
-      let strErrorRate = numToString(error_rate)
+    getErrRate(error_rate) {
+      const strErrorRate = numToString(error_rate)
       let length = 0
-      if (strErrorRate !== '0'){
-        let arr = strErrorRate.split('.')
+      if (strErrorRate !== '0') {
+        const arr = strErrorRate.split('.')
         if (arr.length > 1) {
           length = strErrorRate.split('.')[1].length
         }
       }
-      if(error_rate == 0) {
+      if (error_rate == 0) {
         return error_rate
-      } else if (error_rate == 1){
+      } else if (error_rate == 1) {
         return error_rate * 100 + '%'
-      } else if (length<=2 ) {
+      } else if (length <= 2) {
         return error_rate * 100 + '%'
       } else {
         return convertToPercentage(error_rate)
       }
       function numToString(num) {
-        let str = num.toString();
+        let str = num.toString()
         if (str.includes('e')) {
-          let parts = str.split('e');
-          let base = parts[0];
-          let exp = parseInt(parts[1]);
-          let decimalPlaces = base.split('.')[1]?.length || 0;
-          let zerosNeeded = Math.abs(exp) - decimalPlaces;
+          const parts = str.split('e')
+          const base = parts[0]
+          const exp = parseInt(parts[1])
+          const decimalPlaces = base.split('.')[1]?.length || 0
+          const zerosNeeded = Math.abs(exp) - decimalPlaces
           if (exp < 0) {
-            str = '0.' + '0'.repeat(zerosNeeded) + base.replace('.', '');
+            str = '0.' + '0'.repeat(zerosNeeded) + base.replace('.', '')
           } else {
-            str = base + '0'.repeat(zerosNeeded);
+            str = base + '0'.repeat(zerosNeeded)
           }
         }
-        return str;
+        return str
       }
       function convertToPercentage(value) {
-        let bnValue = new BigNumber(value);
-        let percentage = bnValue.multipliedBy(100);// 乘法运算
-        let roundedPercentage = percentage.decimalPlaces(2, BigNumber.ROUND_FLOOR);// decimalPlaces保留小数位
+        const bnValue = new BigNumber(value)
+        const percentage = bnValue.multipliedBy(100)// 乘法运算
+        let roundedPercentage = percentage.decimalPlaces(2, BigNumber.ROUND_FLOOR)// decimalPlaces保留小数位
 
         // 如果四舍五入后的值小于原始值,手动增加 0.01
-        if (roundedPercentage.isLessThan(percentage)) {// 判断是否小于
-          roundedPercentage = roundedPercentage.plus(0.01);
+        if (roundedPercentage.isLessThan(percentage)) { // 判断是否小于
+          roundedPercentage = roundedPercentage.plus(0.01)
         }
 
-        return `${roundedPercentage.toFixed(2)}%`;
+        return `${roundedPercentage.toFixed(2)}%`
       }
-
     },
     handleUpdateName() {
       this.open = true
@@ -548,6 +580,7 @@ export default {
     Refresh(timeOut) {
       this.serviceMapTimer = setInterval(() => {
         this.getList()
+        this.getServiceList() // 获取服务列表select
       }, timeOut)
     },
     handleClose() {
@@ -557,7 +590,7 @@ export default {
       this.drawerDetail = false
     },
     handleRowClick(row, column, event) {
-      this.currentBussinessId  = row.id
+      this.currentBussinessId = row.id
       this.currentBussinessName = row.name
       this.isShowServiceSpaceDrawer = true
     },
@@ -568,7 +601,7 @@ export default {
         this.graphData = {}
         if (res.code == 200) {
           const arr = res.data
-          console.log(10000001111,arr)
+          console.log(10000001111, arr)
           if (arr.length > 0) {
             const List = this.handelListBizData(arr)
             this.graphData = List[0]
@@ -597,7 +630,7 @@ export default {
       return data
     },
     handleData(data) {
-      console.log(3000,data)
+      console.log(3000, data)
       data.forEach((v, k) => {
         v.id = v.biz_id
 
@@ -645,33 +678,39 @@ export default {
         }
       }
     },
-      // 获取左侧table 数据
-      getList(type) {
-        this.loading = true
-        this.myChartList = []
-        this.myChartboxList = []
-        this.myChartBox2List = []
-        getNewBusinessList(this.queryParams).then(res => {
-          if (res.code == 200) {
-            this.serveceMapList = res.data.list || []
-            this.tableCount = res.data.count || 0
-            this.loading = false
-            // if (res.data && res.data.list && res.data.list.length > 0) {
-              // if (type === 'created') {
-                // this.$refs.tableRef.setCurrentRow(this.serveceMapList[0])
-                // this.childQueryParams.biz_id = res.data.list[0].id
-                // this.sweetquanParams.biz_id = res.data.list[0].id
-                // if (this.switchValue) {
-                //   this.getListBizGraph(res.data.list[0].id) // 获取右侧关系拓扑图数据
-                // } else {
-                //   this.getSweetListFn()
-                // }
-                // this.handelgetBizDetail()
-              // }
-            // }
+    // 获取左侧table 数据
+    getList() {
+      const _this = this
+      this.loading = true
+      this.myChartList = []
+      this.myChartboxList = []
+      this.myChartBox2List = []
+      getNewBusinessList(this.queryParams).then(res => {
+        if (res.code == 200) {
+          this.serveceMapList = res.data.list || []
+          this.tableCount = res.data.total || 0
+          this.loading = false
+          if (_this.serveceMapList.length > 0) {
+            for (let i = 0; i < _this.serveceMapList.length; i++) {
+              this.BizStatsQuery.biz_id = _this.serveceMapList[i].id
+              listBizStats(this.BizStatsQuery).then(response => {
+                if (response.code == 200) {
+                  if (response.data.biz_id != undefined) {
+                    if (_this.serveceMapList[i].id == response.data.biz_id) {
+                      _this.serveceMapList[i] = Object.assign({}, _this.serveceMapList[i], response.data)
+                      _this.isUpdate = !_this.isUpdate
+                    }
+                  }
+                }
+              })
+            }
           }
-        })
-      },
+          this.$nextTick(() => {
+            this.$forceUpdate()
+          })
+        }
+      })
+    },
     beforeUpload(file) {
       const isRightSize = file.size / 1024 / 1024 < 2
       if (!isRightSize) {
@@ -700,6 +739,10 @@ export default {
       }
       this.resetForm('form')
     },
+    handChange(val) {
+      this.queryParams.service_name = val
+      this.handleQuery()
+    },
     /** 搜索按钮操作 */
     handleQuery() {
       this.queryParams.page_num = 1
@@ -959,20 +1002,19 @@ export default {
         ]
       }
 
-      setTimeout(() => {
-        const chartId = 'tiger-' + arguments[2] + '-trend-index' + arguments[1]
-        let myChart = this.$echarts5.getInstanceByDom(document.getElementById(chartId))
+      setTimeout(() => { // tiger-five-trend-index
+        const chartId = 'tiger-' + 'five' + '-trend-index' + index
+
+        let myChart = that.$echarts5.getInstanceByDom(document.getElementById(chartId))
         if (myChart == null) {
           myChart = that.$echarts5.init(document.getElementById(chartId), 'macarons')
         }
         myChart.dispatchAction({ type: 'hideTip' })
-        this.myChartList.push(myChart)
+        that.myChartList.push(myChart)
         option && myChart.setOption(option, true)
         // myChart.group = `index${row.id}`
-        // this.$echarts5.connect(`index${row.id}`)
-      }, 1000)
-
-      // }
+        // that.$echarts5.connect(`index${row.id}`)
+      }, 3000)
     },
     drawEchartsp90(row, index) {
       const that = this
@@ -1107,7 +1149,6 @@ export default {
       // }
     },
     drawEchartsScale(row) {
-      const _this = this
       let myChartScale = this.$echarts5.getInstanceByDom(document.getElementById(chartId))
       if (myChartScale == null) {
         myChartScale = this.$echarts5.init(document.getElementById('scaleMain'))
@@ -1234,6 +1275,18 @@ export default {
 }
 </script>
 <style lang="scss" scoped>
+::v-deep .el-input--suffix .el-input__inner{
+  padding-right: 0;
+}
+.flex{
+  display: flex;
+  align-items: center;
+}
+.seach-title{
+  width:100px;
+  display: inline-block;
+  margin-right: 10px;
+}
 .iconfont {
   font-family: "iconfont" !important;
   font-size: 20px;
@@ -1366,6 +1419,9 @@ export default {
 .el-icon-down:before{
   content:'\e6eb'
 }
+.TableBox{
+  margin-top:10px;
+}
 .TableBox ::v-deep .el-table .cell{
   line-height: 40px !important;
   padding-left: 1px;

+ 100 - 162
src/views/business-analysis/topology/components/keyBusinessCon.vue

@@ -1,6 +1,6 @@
 <template>
   <div style="padding:16px;">
-    <div v-if="serveceMapList.length>0" class="TableBox">
+    <div class="TableBox">
       <el-table
         ref="tableRef"
         :key="isUpdate"
@@ -8,38 +8,38 @@
         :data="serveceMapList"
         @row-click="handleRowClick"
       >
-        <el-table-column v-if="colData[0].istrue" align="center"  header-align="center" class-name="column_one" label="业务名" prop="name"  :show-overflow-tooltip="true" />
-        <el-table-column v-if="colData[4].istrue" header-align="center" align="center" label="请求总数" sortable prop="request_total"  :show-overflow-tooltip="true">
+        <el-table-column v-if="colData[0].istrue" align="center" header-align="center" class-name="column_one" label="业务名" prop="name" :show-overflow-tooltip="true" />
+        <el-table-column v-if="colData[4].istrue" header-align="center" align="center" label="请求总数" sortable prop="request_total" :show-overflow-tooltip="true">
           <template slot-scope="scope">
             <div :class="scope.row.request_total!=0&&scope.row.request_total!= undefined?'table_bg':'table_bg_yellow'">
               <div class="table-num-box">
-                {{ scope.row.request_total== undefined?0:Number(scope.row.request_total).toFixed(2)  }}
+                {{ scope.row.request_total== undefined?0:Number(scope.row.request_total).toFixed(2) }}
               </div>
               <div class="table-day-rate-box">
-                <i v-show="processNumber(scope.row.request_total_dod).sign"  :class="processNumber(scope.row.request_total_dod).sign == 'up'? 'el-icon-up up':'el-icon-down down'"></i>
+                <i v-show="processNumber(scope.row.request_total_dod).sign" :class="processNumber(scope.row.request_total_dod).sign == 'up'? 'el-icon-up up':'el-icon-down down'" />
                 <span>
-                  {{ scope.row.request_total_dod==undefined?0:getErrRate(processNumber(scope.row.request_total_dod).value)}}
+                  {{ scope.row.request_total_dod==undefined?0:getErrRate(processNumber(scope.row.request_total_dod).value) }}
                 </span>
               </div>
             </div>
           </template>
         </el-table-column>
-        <el-table-column v-if="colData[1].istrue" header-align="center" align="center" label="调用占比" prop="request_rate"  :show-overflow-tooltip="true">
+        <el-table-column v-if="colData[1].istrue" header-align="center" align="center" label="调用占比" prop="request_rate" :show-overflow-tooltip="true">
           <template slot-scope="scope">
             <div class="table_bg">
               <div class="table-num-box">
-                {{getErrRate(scope.row.request_rate)}}
+                {{ getErrRate(scope.row.request_rate) }}
               </div>
               <div class="table-day-rate-box">
-                <i v-show="processNumber(scope.row.request_rate_dod).sign"  :class="processNumber(scope.row.request_rate_dod).sign == 'up'? 'el-icon-up up':'el-icon-down down'"></i>
+                <i v-show="processNumber(scope.row.request_rate_dod).sign" :class="processNumber(scope.row.request_rate_dod).sign == 'up'? 'el-icon-up up':'el-icon-down down'" />
                 <span>
-                  {{ scope.row.request_rate_dod==undefined?0:getErrRate(scope.row.request_rate_dod)}}
+                  {{ scope.row.request_rate_dod==undefined?0:getErrRate(processNumber(scope.row.request_rate_dod).value) }}
                 </span>
               </div>
             </div>
           </template>
         </el-table-column>
-        <el-table-column v-if="colData[2].istrue" header-align="center"  align="center" label="SpanName" prop="span_name"  :show-overflow-tooltip="true">
+        <el-table-column v-if="colData[2].istrue" header-align="center" align="center" label="SpanName" prop="span_name" :show-overflow-tooltip="true">
           <template slot-scope="scope">
             <span>{{ scope.row.span_name }}</span>
           </template>
@@ -51,124 +51,60 @@
             </div>
           </template>
         </el-table-column>
-        <el-table-column v-if="colData[5].istrue" header-align="center" align="center" label="错误率" sortable prop="error_rate"  :show-overflow-tooltip="true">
+        <el-table-column v-if="colData[5].istrue" header-align="center" align="center" label="错误率" sortable prop="error_rate" :show-overflow-tooltip="true">
           <template slot-scope="scope">
             <div :class="scope.row.error_rate==0?'table_bg':'table_bg_red'">
               <div class="table-num-box">
                 {{ getErrRate(scope.row.error_rate) }}
               </div>
               <div class="table-day-rate-box">
-                <i v-show="processNumber(scope.row.error_rate_dod).sign"  :class="processNumber(scope.row.error_rate_dod).sign == 'up'? 'el-icon-up up':'el-icon-down down'"></i>
+                <i v-show="processNumber(scope.row.error_rate_dod).sign" :class="processNumber(scope.row.error_rate_dod).sign == 'up'? 'el-icon-up up':'el-icon-down down'" />
                 <span>
-                  {{ scope.row.error_rate_dod==undefined?0:getErrRate(scope.row.error_rate_dod)}}
+                  {{ scope.row.error_rate_dod==undefined?0:getErrRate(processNumber(scope.row.error_rate_dod).value) }}
                 </span>
               </div>
             </div>
           </template>
         </el-table-column>
-        <el-table-column v-if="colData[6].istrue" header-align="center" align="center" label="最大延迟(ms)" sortable prop="max"  :show-overflow-tooltip="true">
+        <el-table-column header-align="center" align="center" label="最大延迟(ms)" sortable prop="max" :show-overflow-tooltip="true">
           <template slot-scope="scope">
             <div :class="scope.row.max<2000?'table_bg':'table_bg_red'">
               {{ scope.row.max==undefined?0:Number(scope.row.max).toFixed(2) }}
             </div>
           </template>
         </el-table-column>
-        <el-table-column v-if="colData[7].istrue" header-align="center" align="center" label="平均延迟(ms)" sortable prop="duration_average"  :show-overflow-tooltip="true">
+        <el-table-column v-if="colData[7].istrue" header-align="center" align="center" label="平均延迟(ms)" sortable prop="duration_average" :show-overflow-tooltip="true">
           <template slot-scope="scope">
             <div :class="scope.row.duration_average<2000?'table_bg':'table_bg_red'">
               <div class="table-num-box">
                 {{ scope.row.duration_average==undefined?0:Number(scope.row.duration_average).toFixed(2) }}
               </div>
               <div class="table-day-rate-box">
-                <i v-show="processNumber(scope.row.duration_average_dod).sign"  :class="processNumber(scope.row.duration_average_dod).sign == 'up'? 'el-icon-up up':'el-icon-down down'"></i>
+                <i v-show="processNumber(scope.row.duration_average_dod).sign" :class="processNumber(scope.row.duration_average_dod).sign == 'up'? 'el-icon-up up':'el-icon-down down'" />
                 <span>
-                  {{ scope.row.duration_average_dod==undefined?0:getErrRate(scope.row.duration_average_dod)}}
+                  {{ scope.row.duration_average_dod==undefined?0:getErrRate(processNumber(scope.row.duration_average_dod).value) }}
                 </span>
               </div>
             </div>
           </template>
         </el-table-column>
-        <el-table-column v-if="colData[8].istrue" header-align="center" align="center" label="中位延迟" prop="duration_median"  width="200">
+
+        <el-table-column v-if="colData[8].istrue" header-align="center" align="center" label="中位延迟" prop="duration_median" width="200">
           <template slot-scope="scope">
             <div :class="scope.row.duration_median<2000?'table_bg':'table_bg_red'">
               <div class="table-num-box">
                 {{ scope.row.duration_median==undefined?0:Number(scope.row.duration_median).toFixed(2) }}
               </div>
               <div class="table-day-rate-box">
-                <i v-show="processNumber(scope.row.duration_median_dod).sign"  :class="processNumber(scope.row.duration_median_dod).sign == 'up'? 'el-icon-up up':'el-icon-down down'"></i>
-                <span>
-                  {{ scope.row.duration_median_dod==undefined?0:getErrRate(scope.row.duration_median_dod)}}
-                </span>
-              </div>
-            </div>
-          </template>
-          <!-- <template slot-scope="scope">
-            <span v-if="scope.row.quantiles!=undefined" style="display:flex;">
-              {{ drawEchartsp5(scope.row, scope.$index, 'five') }}
-              <div :id="`tiger-five-trend-index` + scope.$index" style="flex:1;padding-left:10px" class="tiger-trend-charts" />
-              <el-popover trigger="hover" placement="top">
-                {{ scope.row.quantiles.p50!= undefined&&scope.row.quantiles.p50.length>0?timeConversion(scope.row.quantiles.p50[scope.row.quantiles.p50.length-1]):'' }}
-                <div slot="reference" class="name-wrapper">
-                  <div class="P_box">{{ scope.row.quantiles.p50!= undefined&&scope.row.quantiles.p50.length>0?timeConversion(scope.row.quantiles.p50[scope.row.quantiles.p50.length-1]):'' }}</div>
-                </div>
-              </el-popover>
-            </span>
-          </template> -->
-        </el-table-column>
-        <el-table-column v-if="colData[9].istrue" header-align="center" align="center" label="90分位延迟" prop="duration_p90"  width="200">
-          <template slot-scope="scope">
-            <div :class="scope.row.duration_p90<2000?'table_bg':'table_bg_red'">
-              <div class="table-num-box">
-                {{ scope.row.duration_p90==undefined?0:Number(scope.row.duration_p90).toFixed(2) }}
-              </div>
-              <div class="table-day-rate-box">
-                <i v-show="processNumber(scope.row.duration_p90_dod).sign"  :class="processNumber(scope.row.duration_p90_dod).sign == 'up'? 'el-icon-up up':'el-icon-down down'"></i>
-                <span>
-                  {{ scope.row.duration_p90_dod==undefined?0:getErrRate(scope.row.duration_p90_dod)}}
-                </span>
-              </div>
-            </div>
-          </template>
-          <!-- <template slot-scope="scope">
-            <span v-if="scope.row.quantiles!=undefined" style="display:flex;">
-              {{ drawEchartsp90(scope.row, scope.$index, 'nine') }}
-              <div :id="`tiger-nine-trend-index` + scope.$index" style="flex:1;padding-left:10px" class="tiger-trend-charts" />
-              <el-popover trigger="hover" placement="top">
-                {{ scope.row.quantiles.p90!= undefined&&scope.row.quantiles.p90.length>0?timeConversion(scope.row.quantiles.p90[scope.row.quantiles.p90.length-1]):'' }}
-                <div slot="reference" class="name-wrapper">
-                  <div class="P_box">{{ scope.row.quantiles.p90!= undefined&&scope.row.quantiles.p90.length>0?timeConversion(scope.row.quantiles.p90[scope.row.quantiles.p90.length-1]):'' }}</div>
-                </div>
-              </el-popover>
-            </span>
-          </template> -->
-        </el-table-column>
-        <el-table-column v-if="colData[10].istrue" header-align="center" align="center" label="99分位延迟" prop="duration_p99"  width="200">
-          <template slot-scope="scope">
-            <div :class="scope.row.duration_p99<2000?'table_bg':'table_bg_red'">
-              <div class="table-num-box">
-                {{ scope.row.duration_p99==undefined?0:Number(scope.row.duration_p99).toFixed(2) }}
-              </div>
-              <div class="table-day-rate-box">
-                <i v-show="processNumber(scope.row.duration_p99_dod).sign"  :class="processNumber(scope.row.duration_p99_dod).sign == 'up'? 'el-icon-up up':'el-icon-down down'"></i>
+                <i v-show="processNumber(scope.row.duration_median_dod).sign" :class="processNumber(scope.row.duration_median_dod).sign == 'up'? 'el-icon-up up':'el-icon-down down'" />
                 <span>
-                  {{ scope.row.duration_p99_dod==undefined?0:getErrRate(scope.row.duration_p99_dod)}}
+                  {{ scope.row.duration_median_dod==undefined?0:getErrRate(processNumber(scope.row.duration_median_dod).value) }}
                 </span>
               </div>
             </div>
           </template>
-          <!-- <template slot-scope="scope">
-            <span v-if="scope.row.quantiles!=undefined" style="display:flex;">
-              {{ drawEchartsp99(scope.row, scope.$index, 'hundred') }}
-              <div :id="`tiger-hundred-trend-index` + scope.$index" style="flex:1;padding-left:10px" class="tiger-trend-charts" />
-              <el-popover trigger="hover" placement="top">
-                {{ scope.row.quantiles.p99!= undefined&&scope.row.quantiles.p90.length>0?timeConversion(scope.row.quantiles.p99[scope.row.quantiles.p99.length-1]):'' }}
-                <div slot="reference" class="name-wrapper">
-                  <div class="P_box">{{ scope.row.quantiles.p99!= undefined&&scope.row.quantiles.p99.length>0?timeConversion(scope.row.quantiles.p99[scope.row.quantiles.p99.length-1]):'' }}</div>
-                </div>
-              </el-popover>
-            </span>
-          </template> -->
         </el-table-column>
+
         <el-table-column
           label="操作"
           align="center"
@@ -229,13 +165,13 @@
       </div>
     </el-dialog>
     <!-- 业务空间 -->
-    <ServiceSpaceDrawer v-if="isShowServiceSpaceDrawer" :is-opendrawer="isShowServiceSpaceDrawer" :bussiness-id="currentBussinessId" :bussiness-name="currentBussinessName" @handleClose="handleClose"></ServiceSpaceDrawer>
+    <ServiceSpaceDrawer v-if="isShowServiceSpaceDrawer" :is-opendrawer="isShowServiceSpaceDrawer" :bussiness-id="currentBussinessId" :bussiness-name="currentBussinessName" @handleClose="handleClose" />
   </div>
 </template>
 
 <script>
 import ServiceSpaceDrawer from './ServiceSpaceDrawer.vue'
-import { addUrlMapping, getNewBusinessList, listBizStats, getBizDetail, listBizGraph, updateBiz, delBiz, favorBiz } from '@/api/mapping'
+import { addUrlMapping, getNewBusinessList, listBizStats, listBizGraph, updateBiz, delBiz, favorBiz } from '@/api/mapping'
 import { formatJson } from '@/utils'
 import storage from '@/utils/storage'
 // import bus from '@/utils/bus'
@@ -264,10 +200,10 @@ export default {
         // "SpanName",
         // "rpm",
         '请求总数',
-        "错误率",
+        '错误率',
         // '最大延迟(ms)',
         // "延迟比例",
-        '中位延迟',
+        '中位延迟'
         // '90分位延迟',
         // '99分位延迟'
       ],
@@ -281,9 +217,7 @@ export default {
         { title: '最大延迟(ms)', istrue: false },
         { title: '平均延迟(ms)', istrue: false },
         // { title: "延迟比例", istrue: false },
-        { title: '中位延迟', istrue: false },
-        { title: '90分位延迟', istrue: false },
-        { title: '99分位延迟', istrue: false }
+        { title: '中位延迟', istrue: false }
       ],
       isUpdate: false,
       isflag: false,
@@ -320,17 +254,17 @@ export default {
       dateRange: [],
       // 查询参数
       queryParams: {
-        app_alias:'',//应用别名
-        service_name: null,//服务名称
+        app_alias: '', // 应用别名
+        service_name: null, // 服务名称
         // duration:'',//最小延迟
         // error_rate:'',//最小错误率
         // request_total:'',//最低请求量
         // node_num:'',//最小节点数量
         // access_database: '',//是否涉及数据库
-        // vip: true,//是否为重点业务
+        vip: true, // 是否为重点业务
         // favor:'',//是否收藏
-        page_num: 1,//当前页码
-        page_size: 10,//每页条数
+        page_num: 1, // 当前页码
+        page_size: 10 // 每页条数
       },
       // 表单参数
       form: {
@@ -370,8 +304,8 @@ export default {
       myChartList: [],
       myChartboxList: [],
       myChartBox2List: [],
-      currentBussinessId:'',//当前点击业务id
-      currentBussinessName:'相关业务',//当前点击业务名字
+      currentBussinessId: '', // 当前点击业务id
+      currentBussinessName: '相关业务'// 当前点击业务名字
     }
   },
   watch: {
@@ -422,7 +356,6 @@ export default {
       this.$forceUpdate()
     }
     this.columnChange()
-
   },
   mounted() {
     this.$forceUpdate()
@@ -434,69 +367,68 @@ export default {
     this.disposeEcharts(this.myChartBox2List)
   },
   methods: {
-    //判断数字是正是负还是零并给出标识
+    // 判断数字是正是负还是零并给出标识
     processNumber(num) {
-      let result = {
+      const result = {
         value: num,
         sign: ''
-      };
+      }
       if (num > 0) {
-        result.sign = 'up';
+        result.sign = 'up'
       } else if (num < 0) {
-        result.value = Math.abs(num); // 返回绝对值
-        result.sign = 'down';
+        result.value = Math.abs(num) // 返回绝对值
+        result.sign = 'down'
       } else {
-        result.sign = '';
+        result.sign = ''
       }
-      return result;
+      return result
     },
-    getErrRate(error_rate){
-      let strErrorRate = numToString(error_rate)
+    getErrRate(error_rate) {
+      const strErrorRate = numToString(error_rate)
       let length = 0
-      if (strErrorRate !== '0'){
-        let arr = strErrorRate.split('.')
+      if (strErrorRate !== '0') {
+        const arr = strErrorRate.split('.')
         if (arr.length > 1) {
           length = strErrorRate.split('.')[1].length
         }
       }
-      if(error_rate == 0) {
+      if (error_rate == 0) {
         return error_rate
-      } else if (error_rate == 1){
+      } else if (error_rate == 1) {
         return error_rate * 100 + '%'
-      } else if (length<=2 ) {
+      } else if (length <= 2) {
         return error_rate * 100 + '%'
       } else {
         return convertToPercentage(error_rate)
       }
       function numToString(num) {
-        let str = num.toString();
+        let str = num.toString()
         if (str.includes('e')) {
-          let parts = str.split('e');
-          let base = parts[0];
-          let exp = parseInt(parts[1]);
-          let decimalPlaces = base.split('.')[1]?.length || 0;
-          let zerosNeeded = Math.abs(exp) - decimalPlaces;
+          const parts = str.split('e')
+          const base = parts[0]
+          const exp = parseInt(parts[1])
+          const decimalPlaces = base.split('.')[1]?.length || 0
+          const zerosNeeded = Math.abs(exp) - decimalPlaces
           if (exp < 0) {
-            str = '0.' + '0'.repeat(zerosNeeded) + base.replace('.', '');
+            str = '0.' + '0'.repeat(zerosNeeded) + base.replace('.', '')
           } else {
-            str = base + '0'.repeat(zerosNeeded);
+            str = base + '0'.repeat(zerosNeeded)
           }
         }
-        return str;
+        return str
       }
       function convertToPercentage(value) {
-        let bnValue = new BigNumber(value);
-        let percentage = bnValue.multipliedBy(100);// 乘法运算
-        let roundedPercentage = percentage.decimalPlaces(2, BigNumber.ROUND_FLOOR);// decimalPlaces保留小数位
+        const bnValue = new BigNumber(value)
+        const percentage = bnValue.multipliedBy(100)// 乘法运算
+        let roundedPercentage = percentage.decimalPlaces(2, BigNumber.ROUND_FLOOR)// decimalPlaces保留小数位
 
         // 如果四舍五入后的值小于原始值,手动增加 0.01
-        if (roundedPercentage.isLessThan(percentage)) {// 判断是否小于
-          roundedPercentage = roundedPercentage.plus(0.01);
+        if (roundedPercentage.isLessThan(percentage)) { // 判断是否小于
+          roundedPercentage = roundedPercentage.plus(0.01)
         }
 
-        return `${roundedPercentage.toFixed(2)}%`;
+        return `${roundedPercentage.toFixed(2)}%`
       }
-
     },
     handleUpdateName() {
       this.open = true
@@ -524,7 +456,7 @@ export default {
       this.drawerDetail = false
     },
     handleRowClick(row, column, event) {
-      this.currentBussinessId  = row.id
+      this.currentBussinessId = row.id
       this.currentBussinessName = row.name
       this.isShowServiceSpaceDrawer = true
     },
@@ -535,7 +467,7 @@ export default {
         this.graphData = {}
         if (res.code == 200) {
           const arr = res.data
-          console.log(10000001111,arr)
+          console.log(10000001111, arr)
           if (arr.length > 0) {
             const List = this.handelListBizData(arr)
             this.graphData = List[0]
@@ -564,7 +496,7 @@ export default {
       return data
     },
     handleData(data) {
-      console.log(3000,data)
+      console.log(3000, data)
       data.forEach((v, k) => {
         v.id = v.biz_id
 
@@ -612,33 +544,39 @@ export default {
         }
       }
     },
-      // 获取左侧table 数据
-      getList(type) {
-        this.loading = true
-        this.myChartList = []
-        this.myChartboxList = []
-        this.myChartBox2List = []
-        getNewBusinessList(this.queryParams).then(res => {
-          if (res.code == 200) {
-            this.serveceMapList = res.data.list || []
-            this.tableCount = res.data.count || 0
-            this.loading = false
-            // if (res.data && res.data.list && res.data.list.length > 0) {
-              // if (type === 'created') {
-                // this.$refs.tableRef.setCurrentRow(this.serveceMapList[0])
-                // this.childQueryParams.biz_id = res.data.list[0].id
-                // this.sweetquanParams.biz_id = res.data.list[0].id
-                // if (this.switchValue) {
-                //   this.getListBizGraph(res.data.list[0].id) // 获取右侧关系拓扑图数据
-                // } else {
-                //   this.getSweetListFn()
-                // }
-                // this.handelgetBizDetail()
-              // }
-            // }
+    // 获取左侧table 数据
+    getList() {
+      const _this = this
+      this.loading = true
+      this.myChartList = []
+      this.myChartboxList = []
+      this.myChartBox2List = []
+      getNewBusinessList(this.queryParams).then(res => {
+        if (res.code == 200) {
+          this.serveceMapList = res.data.list || []
+          this.tableCount = res.data.total || 0
+          this.loading = false
+          if (_this.serveceMapList.length > 0) {
+            for (let i = 0; i < _this.serveceMapList.length; i++) {
+              this.BizStatsQuery.biz_id = _this.serveceMapList[i].id
+              listBizStats(this.BizStatsQuery).then(response => {
+                if (response.code == 200) {
+                  if (response.data.biz_id != undefined) {
+                    if (_this.serveceMapList[i].id == response.data.biz_id) {
+                      _this.serveceMapList[i] = Object.assign({}, _this.serveceMapList[i], response.data)
+                      _this.isUpdate = !_this.isUpdate
+                    }
+                  }
+                }
+              })
+            }
           }
-        })
-      },
+          this.$nextTick(() => {
+            this.$forceUpdate()
+          })
+        }
+      })
+    },
     beforeUpload(file) {
       const isRightSize = file.size / 1024 / 1024 < 2
       if (!isRightSize) {

+ 7 - 3
src/views/business-analysis/topology/components/topoCon.vue

@@ -56,6 +56,7 @@ export default {
       appId: '',
       appItem: {},
       collapsed: false,
+      iframe: null,
       // bellpin: require('../../../../assets/apply/bellpin.png'),
       // green_down: require('../../../../assets/apply/green_down.png'),
       // green_up: require('../../../../../assets/apply/green_up.png'),
@@ -74,7 +75,7 @@ export default {
       // red_circle: require('../../../../assets/apply/red_circle.png'),
       // panelImageURL: require('../../../../assets/apply/custom-gauge-panel.png'),
       // togglePng: require('../../../../assets/apply/toggle.png'),
-      timer: null,
+      timer: null
     }
   },
   watch: {
@@ -97,8 +98,8 @@ export default {
           live = false
           this.topoUrl = '/ui/index.html'
         }
-        var iframe = document.getElementById('topoFrame');
-        iframe.contentWindow.postMessage(newValue, '*')
+
+        this.iframe && this.iframe.contentWindow.postMessage(newValue, '*')
       },
       deep: true
     },
@@ -128,6 +129,9 @@ export default {
       this.appId = this.$route.query.id
     }
   },
+  mounted() {
+    this.iframe = document.getElementById('topoFrame');
+  },
   methods:{
     clickFull() {
       this.VisibleTopo = true

+ 6 - 3
src/views/business-analysis/topology/index.vue

@@ -261,7 +261,8 @@ export default {
         start_time: '',
         end_time: ''
       },
-      loading3: false
+      loading3: false,
+      iframe: null
     }
   },
   watch: {
@@ -308,8 +309,7 @@ export default {
           this.changeQuery('/business-analysis/topology/index', newValue.startTime, newValue.endTime, live)
           this.topoUrl = '/ui/index.html'
         }
-        var iframe = document.getElementById('topoFrame');
-        iframe.contentWindow.postMessage(newValue, '*')
+        this.iframe && this.iframe.contentWindow.postMessage(newValue, '*')
       },
       deep: true
     },
@@ -401,6 +401,9 @@ export default {
       this.appId = this.$route.query.id
     }
   },
+  mounted(){
+    this.iframe = document.getElementById('topoFrame');
+  },
   beforeDestroy() {
     clearInterval(this.timer)
   },

+ 2 - 2
src/views/business-analysis/topology/systemTab.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="system-tab-content">
-    <el-tabs v-model="activeName" @tab-click="handleClick" class="customTab">
+    <el-tabs v-model="activeName" class="customTab" @tab-click="handleClick">
       <el-tab-pane v-for="item in btnArr" :key="item.name" :name="item.name">
         <span slot="label">
           <el-button size="small" round class="ob-header-btn">{{ item.name }}</el-button>
@@ -18,7 +18,7 @@ export default {
   components: {
     topoCon,
     KeyBusinessCon,
-    AllBusinessCon,
+    AllBusinessCon
   },
   data() {
     return {

+ 74 - 79
src/views/service/InterfaceSublist/index.vue

@@ -85,80 +85,80 @@
         </div>
 
         <div class="search-box">
-            <el-form ref="subListQuery"  :model="subListQuery" :inline="true" label-width="68px" @submit.native.prevent>
-              <el-form-item label="" prop="url">
-                <el-input
-                  style="width:300px;"
-                  v-model.trim="subListQuery.url"
-                  placeholder="请输入url"
-                  clearable
-                  size="mini"
-                  @keyup.enter.native="handleQuery"
-                  @clear="handleQuery"
-                />
-              </el-form-item>
-
-              <el-form-item label="" prop="service_name">
-                <el-select
-                  v-model="subListQuery.service_name"
-                  placeholder="请选择服务"
-                  clearable
-                  filterable
-                  value-key="id"
-                  size="mini"
-                  @change="handChange"
-                >
-                  <el-option
-                    v-for="item in serviceList"
-                    :key="item.id"
-                    :label="item.name"
-                    :value="item.service_name"
-                  />
-                </el-select>
-              </el-form-item>
+          <el-form ref="subListQuery" :model="subListQuery" :inline="true" label-width="68px" @submit.native.prevent>
+            <el-form-item label="" prop="url">
+              <el-input
+                v-model.trim="subListQuery.url"
+                style="width:300px;"
+                placeholder="请输入url"
+                clearable
+                size="mini"
+                @keyup.enter.native="handleQuery"
+                @clear="handleQuery"
+              />
+            </el-form-item>
 
-            </el-form>
-            <div class="search-box-right">
-              <el-upload
-                ref="upload"
-                class="comp-start-upload"
-                drag
-                action="#"
-                :auto-upload="false"
-                :multiple="false"
-                :show-file-list="false"
-                accept=".xls, .xlsx"
-                :on-change="handelUpload"
-              >
-                <el-button size="mini" icon="el-icon-upload2" type="primary">上传Excel</el-button>
-              </el-upload>
-              <el-dropdown
-                style="margin-left: 10px"
+            <el-form-item label="" prop="service_name">
+              <el-select
+                v-model="subListQuery.service_name"
+                placeholder="请选择服务"
+                clearable
+                filterable
+                value-key="id"
                 size="mini"
-                trigger="click"
-                placement="bottom"
+                @change="handChange"
               >
-                <el-button type="primary" size="mini">
-                  <!-- 下拉菜单 -->
-                  <i class="el-icon-s-grid" />
-                  <i class="el-icon-arrow-down" />
-                </el-button>
-                <el-dropdown-menu slot="dropdown">
-                  <el-checkbox-group
-                    v-model="colSelect"
-                    style="text-align: left"
-                    @change="columnChange"
-                  >
-                    <el-dropdown-item
-                      v-for="(item, index) in colData"
-                      :key="index"
-                    ><el-checkbox :label="item.title">{{
-                      item.title
-                    }}</el-checkbox></el-dropdown-item>
-                  </el-checkbox-group>
-                </el-dropdown-menu>
-              </el-dropdown>
-            </div>
+                <el-option
+                  v-for="item in serviceList"
+                  :key="item.id"
+                  :label="item.name"
+                  :value="item.service_name"
+                />
+              </el-select>
+            </el-form-item>
+
+          </el-form>
+          <div class="search-box-right">
+            <el-upload
+              ref="upload"
+              class="comp-start-upload"
+              drag
+              action="#"
+              :auto-upload="false"
+              :multiple="false"
+              :show-file-list="false"
+              accept=".xls, .xlsx"
+              :on-change="handelUpload"
+            >
+              <el-button size="mini" icon="el-icon-upload2" type="primary">上传Excel</el-button>
+            </el-upload>
+            <el-dropdown
+              style="margin-left: 10px"
+              size="mini"
+              trigger="click"
+              placement="bottom"
+            >
+              <el-button type="primary" size="mini">
+                <!-- 下拉菜单 -->
+                <i class="el-icon-s-grid" />
+                <i class="el-icon-arrow-down" />
+              </el-button>
+              <el-dropdown-menu slot="dropdown">
+                <el-checkbox-group
+                  v-model="colSelect"
+                  style="text-align: left"
+                  @change="columnChange"
+                >
+                  <el-dropdown-item
+                    v-for="(item, index) in colData"
+                    :key="index"
+                  ><el-checkbox :label="item.title">{{
+                    item.title
+                  }}</el-checkbox></el-dropdown-item>
+                </el-checkbox-group>
+              </el-dropdown-menu>
+            </el-dropdown>
+          </div>
         </div>
 
         <div class="TableBox">
@@ -387,7 +387,7 @@ export default {
       myChartList: [],
       myChartboxList: [],
       myChartBox2List: [],
-      serviceList: [],
+      serviceList: []
     }
   },
   watch: {
@@ -437,7 +437,6 @@ export default {
       this.subdigitsQuery.app_alias = this.appItem.alias
       this.subListQuery.app_alias = this.appItem.alias
       this.serviceParams.app_id = this.appItem.id
-
     }
 
     this.getUrlMappingSubdigits() // 获取上面统计数
@@ -455,7 +454,7 @@ export default {
     async handelUpload(file, fileList) {
       const isLt5M = file.size / 1024 / 1024 < 5
       if (isLt5M) {
-        let param = new FormData()
+        const param = new FormData()
         param.append('file', file.raw)
         param.append('app_alias', this.appItem.alias)
         const res = await uploadExcel(param)
@@ -467,7 +466,6 @@ export default {
         this.$message.error('上传文件不能超过5M!')
         return false
       }
-
     },
     // 获取该业务的服务list
     getServiceList() {
@@ -744,9 +742,6 @@ export default {
             myChartbox = that.$echarts5.init(document.getElementById(chartId), 'ninebox')
           }
 
-
-
-
           this.myChartboxList.push(myChartbox)
           myChartbox.dispatchAction({ type: 'hideTip' })
           myChartbox.setOption(option)
@@ -840,7 +835,7 @@ export default {
       this.subListQuery.service_name = val
       this.subListQuery.pageIndex = 1
       this.getUrlMappingSublist()
-    },
+    }
   }
 }
 </script>