model-traceback.vue 74.2 KB
Newer Older
G
gaocongli 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
<!--
Copyright 2020 Huawei Technologies Co., Ltd.All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<template>
17
  <div id="cl-model-traceback">
18 19 20 21 22 23 24 25 26 27 28 29
    <div v-if="loading"
         class="no-data-page">
      <div class="no-data-img">
        <img :src="require('@/assets/images/nodata.png')"
             alt="" />
        <p class="no-data-text">{{$t("public.dataLoading")}}</p>
      </div>
    </div>
    <div class="cl-model-right"
         v-if="!loading">
      <div class="top-area"
           v-show="!errorData">
P
ph 已提交
30 31 32
        <div class="select-box"
             v-if="!noData &&
             (!summaryDirList || (summaryDirList && summaryDirList.length))">
P
ph 已提交
33
          <div v-show="showTable && !noData"
P
ph 已提交
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
               class="select-container">
            <!-- multiple collapse-tags -->
            <div class="display-column"> {{$t('modelTraceback.displayColumn')}}</div>
            <div class="inline-block-set">
              <el-select v-model="selectArrayValue"
                         multiple
                         collapse-tags
                         @change="selectValueChange"
                         :placeholder="$t('public.select')"
                         @focus="selectinputFocus">
                <div class="select-input-button">
                  <div class="select-inner-input">
                    <el-input v-model="keyWord"
                              @input="myfilter"
                              :placeholder="$t('public.search')"></el-input>
                  </div>
P
update  
ph 已提交
50 51 52
                  <button type="text"
                          @click="allSelect"
                          class="select-all-button"
P
ph 已提交
53 54 55
                          :class="[selectCheckAll ? 'checked-color' : 'button-text',
                          basearr.length > checkOptions.length ? 'btn-disabled' : '']"
                          :disabled="basearr.length > checkOptions.length">
P
ph 已提交
56
                    {{$t('public.selectAll')}}
P
update  
ph 已提交
57 58 59 60
                  </button>
                  <button type="text"
                          @click="deselectAll"
                          class="deselect-all-button"
61
                          :class="[!selectCheckAll ? 'checked-color' : 'button-text',
P
ph 已提交
62 63
                               basearr.length > checkOptions.length ? 'btn-disabled' : '']"
                          :disabled="basearr.length > checkOptions.length">
P
ph 已提交
64
                    {{$t('public.deselectAll')}}
P
update  
ph 已提交
65
                  </button>
P
ph 已提交
66 67 68 69 70 71 72 73 74
                </div>
                <el-option-group v-for="group in checkOptions"
                                 :key="group.label"
                                 :label="group.label">
                  <el-option v-for="item in group.options"
                             :key="item.value"
                             :label="item.label"
                             :value="item.value"
                             :disabled="item.disabled"
P
ph 已提交
75
                             :title="item.disabled ? $t('modelTraceback.mustExist') : ''">
P
ph 已提交
76 77 78 79 80 81 82 83 84
                  </el-option>
                </el-option-group>
              </el-select>
            </div>
            <div class="label-legend"
                 v-if="haveCustomizedParams">
              <div>[U]: {{$t('modelTraceback.userDefined')}}</div>
              <div>[M]: {{$t('modelTraceback.metric')}}</div>
            </div>
P
ph 已提交
85
          </div>
G
gaocongli 已提交
86
        </div>
P
ph 已提交
87 88 89 90 91 92
        <div class="btns">
          <el-button class="custom-btn"
                     @click="resetChart"
                     type="primary"
                     size="mini"
                     plain
P
ph 已提交
93
                     v-if="(!noData && basearr.length) ||
P
ph 已提交
94 95 96 97
                   (noData && summaryDirList && !summaryDirList.length)">
            {{ $t('modelTraceback.showAllData') }}</el-button>
        </div>

G
gaocongli 已提交
98 99
      </div>
      <div id="echart"
100
           v-show="!noData && showEchartPic && !loading"></div>
P
ph 已提交
101
      <div class="echart-no-data"
102
           v-show="!noData && !showEchartPic && !loading">
P
ph 已提交
103 104
      </div>
      <div class="btns-container"
P
ph 已提交
105
           v-show="showTable && !noData">
P
ph 已提交
106 107 108 109 110 111 112 113 114 115 116
        <el-button type="primary"
                   size="mini"
                   class="custom-btn"
                   @click="hiddenRecords"
                   plain>{{$t('modelTraceback.hide')}}</el-button>
        <el-button type="primary"
                   size="mini"
                   class="custom-btn"
                   @click="unhideRecords"
                   plain>{{$t('modelTraceback.unhide')}}</el-button>
      </div>
G
gaocongli 已提交
117 118
      <div class="table-container"
           v-show="showTable && !noData">
P
ph 已提交
119
        <el-table ref="table"
G
gaocongli 已提交
120 121 122 123
                  :data="table.data"
                  tooltip-effect="light"
                  height="calc(100% - 40px)"
                  @selection-change="selectionChange"
124
                  @sort-change="sortChange"
G
gaocongli 已提交
125 126 127
                  row-key="summary_dir">
          <el-table-column type="selection"
                           width="55"
P
ph 已提交
128
                           :reserve-selection="true"
P
ph 已提交
129
                           v-show="showTable && !noData">
P
ph 已提交
130 131 132 133 134 135 136 137 138 139 140
          </el-table-column>

          <!--metric table column-->
          <el-table-column :label="$t('modelTraceback.metricLabel')"
                           align="center"
                           v-if="metricList.length">
            <el-table-column v-for="key in metricList"
                             :key="key"
                             :prop="key"
                             :label="table.columnOptions[key].label.substring(3)"
                             show-overflow-tooltip
141
                             min-width="120"
P
ph 已提交
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
                             sortable="custom">
              <template slot="header"
                        slot-scope="scope">
                <div class="custom-label"
                     :title="scope.column.label">
                  {{scope.column.label}}
                </div>
              </template>
              <template slot-scope="scope">
                <span>{{formatNumber(key,scope.row[key])}}</span>
              </template>
            </el-table-column>
          </el-table-column>

          <!--user Defined table column-->
          <el-table-column :label="$t('modelTraceback.userDefinedLabel')"
                           align="center"
                           v-if="userDefinedList.length">
            <el-table-column v-for="key in userDefinedList"
                             :key="key"
                             :prop="key"
                             :label="table.columnOptions[key].label.substring(3)"
                             show-overflow-tooltip
165
                             min-width="120"
P
ph 已提交
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188
                             sortable="custom">
              <template slot="header"
                        slot-scope="scope">
                <div class="custom-label"
                     :title="scope.column.label">
                  {{scope.column.label}}
                </div>
              </template>
              <template slot-scope="scope">
                <span>{{formatNumber(key,scope.row[key])}}</span>
              </template>
            </el-table-column>
          </el-table-column>

          <!--hyper List table column-->
          <el-table-column :label="$t('modelTraceback.hyperLabel')"
                           align="center"
                           v-if="hyperList.length">
            <el-table-column v-for="key in hyperList"
                             :key="key"
                             :prop="key"
                             :label="table.columnOptions[key].label"
                             show-overflow-tooltip
189
                             min-width="154"
P
ph 已提交
190 191 192 193 194 195 196 197 198
                             sortable="custom">
              <template slot="header"
                        slot-scope="scope">
                <div class="custom-label"
                     :title="scope.column.label">
                  {{scope.column.label}}
                </div>
              </template>
              <template slot-scope="scope">
P
ph 已提交
199
                <span>{{formatNumber(key, scope.row[key])}}</span>
P
ph 已提交
200 201 202 203 204
              </template>
            </el-table-column>
          </el-table-column>
          <!--other column-->
          <el-table-column v-for="key in table.otherColumn"
G
gaocongli 已提交
205 206 207
                           :key="key"
                           :prop="key"
                           :label="table.columnOptions[key].label"
P
ph 已提交
208
                           :fixed="table.columnOptions[key].label === text ? true : false"
G
gaocongli 已提交
209
                           show-overflow-tooltip
P
update  
ph 已提交
210
                           min-width="150"
211 212 213 214 215 216 217 218
                           sortable="custom">
            <template slot="header"
                      slot-scope="scope">
              <div class="custom-label"
                   :title="scope.column.label">
                {{ scope.column.label }}
              </div>
            </template>
G
gaocongli 已提交
219 220
            <template slot-scope="scope">
              <a v-if="key === 'summary_dir'"
221 222
                 @click="jumpToTrainDashboard(scope.row[key])">{{ scope.row[key] }}</a>
              <span v-else>{{ formatNumber(key, scope.row[key]) }}</span>
G
gaocongli 已提交
223 224
            </template>
          </el-table-column>
P
ph 已提交
225
          <!-- remark column -->
W
溯源  
WeiFeng 已提交
226
          <el-table-column fixed="right"
P
ph 已提交
227
                           width="260">
W
溯源  
WeiFeng 已提交
228 229 230 231 232 233
            <template slot="header">
              <div>
                <div class="label-text">{{$t('public.remark')}}</div>
                <div class="remark-tip">{{$t('modelTraceback.remarkTips')}}</div>
              </div>
            </template>
P
ph 已提交
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264
            <template slot-scope="scope">
              <div class="edit-text-container"
                   v-show="scope.row.editShow">{{scope.row.remark}}</div>
              <div class="inline-block-set">
                <i class="el-icon-edit"
                   @click="editRemarks(scope.row)"
                   v-show="scope.row.editShow"></i>
                <el-input type="text"
                          v-model="scope.row.remark"
                          v-show="!scope.row.editShow"
                          :placeholder="$t('public.enter')"
                          class="remark-input-style"></el-input>
                <i class="el-icon-check"
                   @click="saveRemarksValue(scope.row)"
                   v-show="!scope.row.editShow"></i>
                <i class="el-icon-close"
                   @click="cancelRemarksValue(scope.row)"
                   v-show="!scope.row.editShow"></i>
                <div class="validation-error"
                     v-show="scope.row.isError">
                  {{$t('modelTraceback.remarkValidation')}}
                </div>
              </div>
            </template>
          </el-table-column>
          <!-- tag -->
          <el-table-column label="tag"
                           fixed="right"
                           prop="tag"
                           sortable="custom">
            <template slot-scope="scope">
265
              <div @click="showAllIcon(scope.row, scope, $event)"
P
ph 已提交
266
                   class="tag-icon-container">
267 268
                <img v-if="scope.row.tag"
                     :class="'img' + scope.$index"
269
                     :src="require('@/assets/images/icon' + scope.row.tag + '.svg')">
270 271 272
                <img v-else
                     :class="'img' + scope.$index"
                     :src="require('@/assets/images/icon-down.svg')">
P
ph 已提交
273 274 275
              </div>
            </template>
          </el-table-column>
G
gaocongli 已提交
276
        </el-table>
P
ph 已提交
277
        <div class="pagination-container">
P
ph 已提交
278 279 280 281 282 283
          <el-pagination @current-change="pagination.pageChange"
                         :current-page="pagination.currentPage"
                         :page-size="pagination.pageSize"
                         :layout="pagination.layout"
                         :total="pagination.total">
          </el-pagination>
P
ph 已提交
284 285 286 287 288
          <div class="hide-count"
               v-show="recordsNumber-showNumber">
            {{$t('modelTraceback.totalHide').replace(`{n}`, (recordsNumber-showNumber))}}
          </div>
          <div class="clear"></div>
P
ph 已提交
289
        </div>
G
gaocongli 已提交
290 291 292
      </div>
      <div v-if="noData"
           class="no-data-page">
293 294
        <div class="no-data-img"
             :class="{'set-height-class':(summaryDirList && !summaryDirList.length)}">
G
gaocongli 已提交
295
          <img :src="require('@/assets/images/nodata.png')"
296
               alt />
P
ph 已提交
297 298 299 300 301
          <p class="no-data-text"
             v-show="!summaryDirList || (summaryDirList && summaryDirList.length)">
            {{ $t('public.noData') }}</p>
          <div v-show="summaryDirList && !summaryDirList.length">
            <p class="no-data-text">{{ $t('modelTraceback.noDataFound') }}</p>
P
ph 已提交
302 303 304 305 306
            <p class="no-data-text">
              {{ $t('modelTraceback.click') }}
              <b> {{ $t('modelTraceback.showAllDataBtn') }}</b>
              {{ $t('modelTraceback.viewAllData') }}
            </p>
P
ph 已提交
307
          </div>
G
gaocongli 已提交
308 309 310
        </div>
      </div>
    </div>
311 312 313 314 315 316 317 318 319 320 321 322 323 324 325
    <!-- tag dialog -->
    <div v-show="tagDialogShow"
         id="tag-dialog"
         class="icon-dialog">
      <div>
        <div class="icon-image-container">
          <div class="icon-image"
               v-for="item in imageList"
               :key="item.number"
               :class="[tagScope.row && item.number === tagScope.row.tag ? 'icon-border':'']"
               @click="iconValueChange(tagScope.row, item.number, $event)">
            <img :src="item.iconAdd">
          </div>
        </div>
        <div class="btn-container-margin">
326 327 328 329 330 331 332 333 334 335 336 337 338
          <div class="tag-button-container">
            <el-button type="primary"
                       size="mini"
                       class="custom-btn"
                       @click="iconChangeSave(tagScope)"
                       plain>
              {{$t('public.sure')}}
            </el-button>
          </div>
          <div class="tag-button-container">
            <el-button type="primary"
                       size="mini"
                       class="custom-btn"
339
                       @click="clearIcon(tagScope, $event)"
340 341 342 343 344 345 346 347 348 349 350 351 352
                       plain>
              {{$t('public.clear')}}
            </el-button>
          </div>
          <div class="tag-button-container">
            <el-button type="primary"
                       size="mini"
                       class="custom-btn"
                       @click="cancelChangeIcon(tagScope.row)"
                       plain>
              {{$t('public.cancel')}}
            </el-button>
          </div>
353 354 355
        </div>
      </div>
    </div>
G
gaocongli 已提交
356 357 358 359 360 361 362 363 364 365 366 367
  </div>
</template>
<script>
import RequestService from '../../services/request-service';
import CommonProperty from '@/common/common-property.js';
import Echarts from 'echarts';

export default {
  props: {},
  watch: {},
  data() {
    return {
368 369
      sortChangeTimer: null,
      unhideRecordsTimer: null,
370
      tagDialogShow: false,
371
      errorData: true,
372
      tagScope: {},
P
ph 已提交
373
      iconValue: 0,
P
update  
ph 已提交
374
      imageList: [],
P
ph 已提交
375 376 377 378 379
      // Select all
      selectCheckAll: true,
      // Number of data records returned by the interface.
      recordsNumber: 0,
      showNumber: 0,
380
      delayTime: 500,
P
ph 已提交
381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398
      showEchartPic: true,
      hideRecord: false,
      hidenDirChecked: [],
      beforeEditValue: '',
      keyWord: '',
      basearr: [],
      labelObj: {metric: '', userDefined: ''},
      userOptions: [],
      metricOptions: [],
      hyperOptions: [],
      otherTypeOptions: [],
      checkOptions: [],
      selectArrayValue: [],
      // metric list
      metricList: [],
      userDefinedList: [],
      hyperList: [],
      summaryList: [],
P
ph 已提交
399 400
      table: {},
      summaryDirList: undefined,
P
ph 已提交
401
      text: this.$t('modelTraceback.summaryPath'),
P
ph 已提交
402
      checkedSummary: [],
403 404
      keysOfStringValue: [], // All keys whose values are character strings
      keysOfIntValue: [], // All keys whose values are int
P
ph 已提交
405
      keysOfMixed: [],
P
ph 已提交
406 407 408 409 410 411 412 413 414 415 416 417 418 419 420
      echart: {
        chart: null,
        allData: [],
        brushData: [],
        showData: [],
      },
      pagination: {
        currentPage: 1,
        pageSize: 8,
        total: 0,
        layout: 'total, prev, pager, next, jumper',
        pageChange: {},
      },
      chartFilter: {}, // chart filter condition
      tableFilter: {lineage_type: {in: ['model']}}, // table filter condition
P
ph 已提交
421
      sortInfo: {},
P
ph 已提交
422 423
      showTable: false,
      noData: false,
424
      loading: true,
P
ph 已提交
425 426 427 428 429
      haveCustomizedParams: false,
      replaceStr: {
        metric: 'metric/',
        userDefined: 'user_defined/',
      },
430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449
      valueType: {
        int: 'int',
        str: 'str',
        mixed: 'mixed',
        category: 'category',
        model_size: 'model_size',
        dataset_mark: 'dataset_mark',
      },
      valueName: {
        userDefined: 'userDefined',
        metric: 'metric',
        UserDefined: 'UserDefined',
        Metric: 'Metric',
      },
      labelValue: {
        loss: 'loss',
        batch_size: 'batch_size',
        epoch: 'epoch',
        learning_rate: 'learning_rate',
      },
P
ph 已提交
450 451 452 453
    };
  },
  computed: {},
  mounted() {
454
    this.setInitListValue();
P
update  
ph 已提交
455
    this.imageList = [];
456
    for (let i = 1; i <= 10; i++) {
P
update  
ph 已提交
457
      const obj = {};
458
      obj.number = i;
P
update  
ph 已提交
459 460 461
      obj.iconAdd = require('@/assets/images/icon' + obj.number + '.svg');
      this.imageList.push(obj);
    }
P
ph 已提交
462
    document.title = `${this.$t('summaryManage.modelTraceback')}-MindInsight`;
P
ph 已提交
463
    document.addEventListener('click', this.blurFloat, true);
P
ph 已提交
464 465 466 467 468 469 470 471 472 473 474
    this.$store.commit('setSelectedBarList', []);
    this.getStoreList();
    this.pagination.pageChange = (page) => {
      this.pagination.currentPage = page;
      this.queryLineagesData(false);
    };
    this.$nextTick(() => {
      this.init();
    });
  },
  methods: {
P
ph 已提交
475 476
    blurFloat(event) {
      const domArr = document.querySelectorAll('.icon-dialog');
477 478
      const path = event.path || (event.composedPath && event.composedPath());
      const isActiveDom = path.some((item) => {
P
ph 已提交
479 480 481
        return item.className === 'icon-dialog';
      });
      if (!isActiveDom) {
482
        this.removeIconBorder();
P
ph 已提交
483 484 485
        domArr.forEach((item) => {
          item.style.display = 'none';
        });
486
        this.tagDialogShow = false;
P
ph 已提交
487 488 489 490 491 492
      }
    },

    /**
     * Display of the icon dialog box
     * @param {Object} row
493
     * @param {Object} scope
494
     * @param {Object} event
P
ph 已提交
495
     */
496
    showAllIcon(row, scope, event) {
497 498 499 500 501 502 503 504 505
      this.iconValue = row.tag >= 0 ? row.tag : 0;
      this.tagScope = scope;
      if (this.tagDialogShow) {
        this.tagDialogShow = false;
        this.removeIconBorder();
        return;
      }
      this.addIconBorder(row);
      this.tagDialogShow = true;
506
      const dialogHeight = 130;
507
      const ev = window.event || event;
508
      document.getElementById('tag-dialog').style.top =
509
        ev.clientY - dialogHeight + 'px';
510 511 512 513 514 515 516 517 518 519 520 521 522 523
    },

    /**
     * Add icon border style
     * @param {Object} row
     */
    addIconBorder(row) {
      const iconImage = document.querySelectorAll('.icon-image');
      iconImage.forEach((item, index) => {
        if (index + 1 === row.tag) {
          item.classList.add('icon-border');
        }
      });
    },
P
ph 已提交
524

525 526 527 528 529 530
    /**
     * Remove  icon border style
     */
    removeIconBorder() {
      const classArr = document.querySelectorAll('.icon-border');
      if (classArr.length) {
P
ph 已提交
531 532 533 534 535 536 537 538 539 540 541 542 543
        classArr.forEach((item) => {
          item.classList.remove('icon-border');
        });
      }
    },

    /**
     * icon value change
     * @param {Object} row
     * @param {Number} num
     *  @param {Object} event
     */
    iconValueChange(row, num, event) {
544 545
      const path = event.path || (event.composedPath && event.composedPath());
      const classWrap = path.find((item) => {
P
ph 已提交
546 547 548 549 550 551
        return item.className === 'icon-dialog';
      });
      const classArr = classWrap.querySelectorAll('.icon-border');
      classArr.forEach((item) => {
        item.classList.remove('icon-border');
      });
552
      const htmDom = path.find((item) => {
P
ph 已提交
553 554 555 556 557 558 559
        return item.nodeName === 'DIV';
      });
      htmDom.classList.add('icon-border');
      this.iconValue = num;
    },
    /**
     * Save the modification of the icon.
560
     * @param {Object} scope
P
ph 已提交
561
     */
562
    iconChangeSave(scope) {
563
      this.tagDialogShow = false;
564
      if (scope.row.tag === this.iconValue || this.iconValue === 0) {
P
ph 已提交
565 566
        return;
      }
567
      this.tagScope.row.tag = this.iconValue;
568 569 570 571 572
      const imgDom = document.querySelectorAll('.img' + scope.$index);
      imgDom.forEach((item) => {
        item.src = require('@/assets/images/icon' + this.iconValue + '.svg');
      });
      this.$forceUpdate();
P
ph 已提交
573
      const params = {
574
        train_id: scope.row.summary_dir,
P
ph 已提交
575
        body: {
576
          tag: this.tagScope.row.tag,
P
ph 已提交
577 578 579 580
        },
      };
      this.putChangeToLineagesData(params);
    },
581 582 583

    /**
     * clear icon
584
     * @param {Object} scope
585
     * @param {Object} event
586
     */
587 588 589
    clearIcon(scope, event) {
      const path = event.path || (event.composedPath && event.composedPath());
      const classWrap = path.find((item) => {
P
ph 已提交
590 591 592 593 594 595
        return item.className === 'icon-dialog';
      });
      const classArr = classWrap.querySelectorAll('.icon-border');
      classArr.forEach((item) => {
        item.classList.remove('icon-border');
      });
596
      this.tagDialogShow = false;
P
ph 已提交
597
      this.iconValue = 0;
598
      this.tagScope.row.tag = 0;
599 600 601 602
      const imgDom = document.querySelectorAll('.img' + scope.$index);
      imgDom.forEach((item) => {
        item.src = require('@/assets/images/icon-down.svg');
      });
P
ph 已提交
603
      const params = {
604
        train_id: scope.row.summary_dir,
P
ph 已提交
605
        body: {
606
          tag: 0,
P
ph 已提交
607 608 609 610 611 612 613 614 615
        },
      };
      this.putChangeToLineagesData(params);
    },
    /**
     * cancel save
     * @param {Object} row
     */
    cancelChangeIcon(row) {
616 617 618
      this.removeIconBorder();
      this.addIconBorder(row);
      this.tagDialogShow = false;
P
ph 已提交
619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644
    },

    /**
     * Select all
     */
    allSelect() {
      if (this.selectCheckAll) {
        return;
      }
      this.selectArrayValue = [];
      this.checkOptions.forEach((item) => {
        item.options.forEach((option) => {
          this.selectArrayValue.push(option.label);
        });
      });
      this.selectCheckAll = !this.selectCheckAll;
      let allList = [];
      const listA = [this.$t('modelTraceback.summaryPath')];
      allList = this.selectArrayValue.concat(listA);
      //  Set selected of the column data in the table to false;
      Object.keys(this.table.columnOptions).filter((i) => {
        this.table.columnOptions[i].selected = false;
      });
      allList.forEach((item) => {
        Object.keys(this.table.columnOptions).filter((i) => {
          const labelValue = this.table.columnOptions[i].label;
W
溯源  
WeiFeng 已提交
645
          if (labelValue === item) {
P
ph 已提交
646 647 648 649 650 651
            this.table.columnOptions[i].selected = true;
          }
        });
      });
      this.initColumm();
      this.$nextTick(() => {
652
        this.initChart();
P
ph 已提交
653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679
        this.$refs.table.doLayout();
      });
    },

    /**
     * deselect all
     */
    deselectAll() {
      this.selectArrayValue = [];
      this.checkOptions.forEach((item) => {
        item.options.forEach((option) => {
          if (option.disabled) {
            this.selectArrayValue.push(option.label);
          }
        });
      });
      this.selectCheckAll = false;
      let allList = [];
      const listA = [this.$t('modelTraceback.summaryPath')];
      allList = this.selectArrayValue.concat(listA);
      // Set selected to false for these columns in the table.
      Object.keys(this.table.columnOptions).filter((i) => {
        this.table.columnOptions[i].selected = false;
      });
      allList.forEach((item) => {
        Object.keys(this.table.columnOptions).filter((i) => {
          const labelValue = this.table.columnOptions[i].label;
W
溯源  
WeiFeng 已提交
680
          if (labelValue === item) {
P
ph 已提交
681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795
            this.table.columnOptions[i].selected = true;
          }
        });
      });
      this.initChart();
      this.initColumm();
    },
    /**
     * Edit remarks
     * @param {Object} row
     */
    editRemarks(row) {
      row.editShow = false;
      row.isError = false;
      this.beforeEditValue = row.remark;
    },

    /**
     * Save remarks
     * @param {Object} row
     */
    saveRemarksValue(row) {
      const tagValidation = new RegExp('^[a-zA-Z0-9\u4e00-\u9fa5_.-]{1,128}$');
      const result = row.remark.length ? tagValidation.test(row.remark) : true;
      if (result) {
        row.isError = false;
        row.editShow = true;
        const params = {
          train_id: row.summary_dir,
          body: {
            remark: row.remark,
          },
        };
        this.putChangeToLineagesData(params);
      } else {
        row.isError = true;
      }
    },

    /**
     * Cancel save editing
     * @param {Object} row
     */
    cancelRemarksValue(row) {
      row.editShow = true;
      row.remark = this.beforeEditValue;
      row.isError = false;
    },

    /**
     *After the remark or tag is modified, invoke the interface and save the modification.
     * @param {Object} params
     */
    putChangeToLineagesData(params) {
      RequestService.putLineagesData(params)
          .then(
              (res) => {
                if (res) {
                  this.$message.success(this.$t('modelTraceback.changeSuccess'));
                }
              },
              (error) => {},
          )
          .catch(() => {});
    },

    selectinputFocus() {
      this.keyWord = '';
      this.checkOptions = this.basearr;
    },
    /**
     * Input search filtering in the select module.
     */
    myfilter() {
      const queryString = this.keyWord;
      const restaurants = this.basearr;
      const results = queryString
        ? this.createFilter(queryString, restaurants)
        : restaurants;
      this.checkOptions = results;
    },

    /**
     *Input search filtering in the select module.
     * @param {String} queryString
     * @param {Array} restaurants
     * @return {Array}
     */
    createFilter(queryString, restaurants) {
      const list = [];
      restaurants.forEach((item) => {
        const object = {};
        const options = [];
        if (item.options) {
          item.options.forEach((item) => {
            if (
              item.label.toLowerCase().indexOf(queryString.toLowerCase()) >= 0
            ) {
              const tempObj = {};
              tempObj.label = item.label;
              tempObj.value = item.value;
              tempObj.disabled = item.disabled;
              options.push(tempObj);
            }
          });
        }
        if (options.length > 0) {
          object.label = item.label;
          object.options = options;
          list.push(object);
        }
      });
      return list;
    },

P
ph 已提交
796 797 798 799 800 801 802 803 804 805
    getStoreList() {
      this.summaryDirList = this.$store.state.summaryDirList;
      if (this.summaryDirList) {
        this.tableFilter.summary_dir = {
          in: this.summaryDirList,
        };
      } else {
        this.tableFilter.summary_dir = undefined;
      }
    },
806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824
    setInitListValue() {
      this.keysOfStringValue = [
        'summary_dir',
        'network',
        'optimizer',
        'loss_function',
        'train_dataset_path',
        'test_dataset_path',
        'dataset_mark',
      ]; // All keys whose values are character strings
      this.keysOfIntValue = [
        'train_dataset_count',
        'test_dataset_count',
        'epoch',
        'batch_size',
        'device_num',
      ]; // All keys whose values are int
      this.keysOfMixed = [];
    },
P
ph 已提交
825 826 827 828 829 830

    /**
     * Initialization
     */
    init() {
      this.table = {
G
gaocongli 已提交
831 832 833 834 835 836 837 838 839 840
        columnOptions: {
          train_dataset_path: {
            label: this.$t('modelTraceback.trainSetPath'),
            required: true,
          },
          test_dataset_path: {
            label: this.$t('modelTraceback.testSetPath'),
            required: true,
          },
          loss: {
841
            label: this.labelValue.loss,
G
gaocongli 已提交
842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864
            required: true,
          },
          network: {
            label: this.$t('modelTraceback.network'),
            required: true,
          },
          optimizer: {
            label: this.$t('modelTraceback.optimizer'),
            required: true,
          },
          train_dataset_count: {
            label: this.$t('modelTraceback.trainingSampleNum'),
            required: false,
          },
          test_dataset_count: {
            label: this.$t('modelTraceback.testSampleNum'),
            required: false,
          },
          learning_rate: {
            label: this.$t('modelTraceback.learningRate'),
            required: false,
          },
          epoch: {
865
            label: this.labelValue.epoch,
G
gaocongli 已提交
866 867 868
            required: false,
          },
          batch_size: {
869
            label: this.labelValue.batch_size,
G
gaocongli 已提交
870 871
            required: false,
          },
P
update  
ph 已提交
872 873 874 875
          device_num: {
            label: this.$t('modelTraceback.deviceNum'),
            required: false,
          },
G
gaocongli 已提交
876 877 878 879 880 881 882 883 884
          model_size: {
            label: this.$t('modelTraceback.modelSize'),
            required: false,
          },
          loss_function: {
            label: this.$t('modelTraceback.lossFunc'),
            required: false,
          },
        }, // All options of the column in the table
P
ph 已提交
885
        otherColumn: [], // Table Column
G
gaocongli 已提交
886 887 888
        mandatoryColumn: [], // Mandatory Table Column
        optionalColumn: [], // Optional Table Column
        data: [],
P
ph 已提交
889
        // no checked list
G
gaocongli 已提交
890 891 892 893 894 895 896 897 898 899 900 901 902 903
        optionsNotInCheckbox: [
          'summary_dir',
          'train_dataset_path',
          'test_dataset_path',
        ],
        optionsNotInEchart: [
          'summary_dir',
          'train_dataset_path',
          'test_dataset_path',
        ],
        optionsNotInTable: ['dataset_mark'],
        selectedColumn: [],
        selectAll: false, // Whether to select all columns
        indeterminate: false,
P
ph 已提交
904
      };
P
ph 已提交
905
      this.keysOfMixed = [];
P
ph 已提交
906 907 908 909 910 911 912 913 914 915 916 917 918

      this.userOptions = [];
      this.metricOptions = [];
      // metric list
      this.metricList = [];
      // User-defined list
      this.userDefinedList = [];
      // hyper list
      this.hyperList = [];
      this.summaryList = [];
      this.hyperOptions = [];
      this.otherTypeOptions = [];
      this.checkOptions = [];
P
update  
ph 已提交
919
      this.basearr = [];
P
ph 已提交
920 921 922
      this.selectArrayValue = [];
      // Obtain the hidden summary_dir list after initialization.
      this.hidenDirChecked = this.$store.state.hidenDirChecked || [];
P
ph 已提交
923
      this.queryLineagesData(true);
G
gaocongli 已提交
924 925 926 927 928
    },
    /**
     * Column initialization
     */
    initColumm() {
P
ph 已提交
929 930 931 932 933
      this.metricList = [];
      this.userDefinedList = [];
      // hyper list
      this.hyperList = [];
      this.summaryList = [];
G
gaocongli 已提交
934 935 936 937 938 939 940 941 942 943
      this.table.mandatoryColumn = Object.keys(this.table.columnOptions).filter(
          (i) => {
            return this.table.columnOptions[i].required;
          },
      );
      this.table.optionalColumn = Object.keys(this.table.columnOptions).filter(
          (i) => {
            return !this.table.columnOptions[i].required;
          },
      );
P
ph 已提交
944 945 946 947 948 949 950 951 952 953 954
      const columnList = Object.keys(this.table.columnOptions).filter((i) => {
        return (
          !this.table.optionsNotInTable.includes(i) &&
          this.table.columnOptions[i].selected
        );
      });
      const metricArray = [];
      const userDefinedArray = [];
      const columnArray = [];
      const hyperArray = [];
      columnList.forEach((item) => {
W
溯源  
WeiFeng 已提交
955
        if (item.indexOf('metric/') === 0) {
P
ph 已提交
956
          metricArray.push(item);
W
溯源  
WeiFeng 已提交
957
        } else if (item.indexOf('user_defined/') === 0) {
P
ph 已提交
958 959
          userDefinedArray.push(item);
        } else if (
960 961 962
          item === this.labelValue.epoch ||
          item === this.labelValue.batch_size ||
          item === this.labelValue.learning_rate
P
ph 已提交
963 964 965 966 967
        ) {
          hyperArray.push(item);
        } else {
          columnArray.push(item);
        }
G
gaocongli 已提交
968
      });
P
ph 已提交
969 970 971 972 973 974 975
      this.showTable = true;
      this.table.otherColumn = columnArray;
      this.metricList = metricArray;
      this.userDefinedList = userDefinedArray;
      // hyper list
      this.hyperList = hyperArray;

G
gaocongli 已提交
976 977 978
      this.table.selectedColumn = this.table.optionalColumn;
      this.table.selectAll = true;
      this.showTable = true;
P
ph 已提交
979 980 981
      this.$nextTick(() => {
        this.$refs.table.doLayout();
      });
G
gaocongli 已提交
982 983 984 985 986
    },
    /**
     * Querying All Model Version Information
     * @param {Boolean} allData Indicates whether to query all data
     */
P
ph 已提交
987 988 989 990 991 992 993 994
    queryLineagesData(allData) {
      const params = {
        body: {},
      };
      const tempParam = {
        sorted_name: this.sortInfo.sorted_name,
        sorted_type: this.sortInfo.sorted_type,
      };
G
gaocongli 已提交
995
      if (!allData) {
P
ph 已提交
996 997 998
        this.summaryDirList = this.$store.state.summaryDirList;
        this.tableFilter.summary_dir = {
          in: this.summaryDirList,
G
gaocongli 已提交
999
        };
P
ph 已提交
1000 1001 1002

        tempParam.limit = this.pagination.pageSize;
        tempParam.offset = this.pagination.currentPage - 1;
P
ph 已提交
1003 1004 1005 1006 1007 1008 1009 1010
        params.body = Object.assign(
            params.body,
            this.chartFilter,
            tempParam,
            this.tableFilter,
        );
      } else {
        params.body = Object.assign(params.body, this.tableFilter);
G
gaocongli 已提交
1011
      }
P
ph 已提交
1012
      RequestService.queryLineagesData(params)
G
gaocongli 已提交
1013 1014
          .then(
              (res) => {
1015
                this.loading = false;
G
gaocongli 已提交
1016
                if (res && res.data && res.data.object) {
1017 1018
                  this.errorData = false;
                  this.setInitListValue();
1019 1020 1021
                  const listTemp = this.setDataOfModel(res.data.object);
                  const list = JSON.parse(JSON.stringify(listTemp));
                  const tempEchartData = JSON.parse(JSON.stringify(listTemp));
G
gaocongli 已提交
1022
                  if (allData) {
P
ph 已提交
1023
                    let customized = {};
1024
                    if (res.data.customized) {
P
ph 已提交
1025
                      customized = JSON.parse(JSON.stringify(res.data.customized));
1026
                      const customizedKeys = Object.keys(customized);
P
ph 已提交
1027
                      if (customizedKeys.length) {
1028
                        customizedKeys.forEach((i) => {
1029
                          if (customized[i].type === this.valueType.int) {
1030
                            this.keysOfIntValue.push(i);
1031
                          } else if (customized[i].type === this.valueType.str) {
1032
                            this.keysOfStringValue.push(i);
1033
                          } else if (customized[i].type === this.valueType.mixed) {
P
ph 已提交
1034 1035 1036
                            // list of type mixed
                            this.keysOfMixed.push(i);
                            this.keysOfStringValue.push(i);
1037
                          }
P
ph 已提交
1038
                          if (i.startsWith(this.replaceStr.userDefined)) {
1039
                            this.labelObj.userDefined = this.valueName.userDefined;
P
ph 已提交
1040 1041 1042 1043
                            customized[i].label = customized[i].label.replace(
                                this.replaceStr.userDefined,
                                '[U]',
                            );
P
ph 已提交
1044 1045 1046 1047
                            const userDefinedObject = {value: '', label: ''};
                            userDefinedObject.value = customized[i].label;
                            userDefinedObject.label = customized[i].label;
                            this.userOptions.push(userDefinedObject);
P
ph 已提交
1048 1049 1050 1051 1052
                          } else if (i.startsWith(this.replaceStr.metric)) {
                            customized[i].label = customized[i].label.replace(
                                this.replaceStr.metric,
                                '[M]',
                            );
1053
                            this.labelObj.metric = this.valueName.metric;
P
ph 已提交
1054 1055 1056 1057 1058
                            const metricObject = {value: '', label: ''};
                            metricObject.value = customized[i].label;
                            metricObject.label = customized[i].label;
                            metricObject.disabled = true;
                            this.metricOptions.push(metricObject);
P
ph 已提交
1059
                          }
1060
                        });
P
ph 已提交
1061
                        this.haveCustomizedParams = true;
1062
                      }
P
ph 已提交
1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088
                      this.checkOptions = [
                        {
                          label: '',
                          options: [
                            {
                              value: this.$t('modelTraceback.dataProcess'),
                              label: this.$t('modelTraceback.dataProcess'),
                              disabled: true,
                            },
                          ],
                        },
                      ];
                      this.basearr = [
                        {
                          label: '',
                          options: [
                            {
                              value: this.$t('modelTraceback.dataProcess'),
                              label: this.$t('modelTraceback.dataProcess'),
                              disabled: true,
                            },
                          ],
                        },
                      ];
                      if (this.labelObj.metric) {
                        const metricTemp = {
1089
                          label: this.valueName.Metric,
P
ph 已提交
1090 1091 1092 1093 1094 1095 1096
                          options: this.metricOptions,
                        };
                        this.checkOptions.push(metricTemp);
                        this.basearr.push(metricTemp);
                      }
                      if (this.labelObj.userDefined) {
                        const userTemp = {
1097
                          label: this.valueName.UserDefined,
P
ph 已提交
1098 1099 1100 1101 1102 1103 1104
                          options: this.userOptions,
                        };
                        this.checkOptions.push(userTemp);
                        this.basearr.push(userTemp);
                      }
                      Object.keys(this.table.columnOptions).forEach((item) => {
                        if (
1105 1106 1107
                          item !== this.labelValue.epoch &&
                      item !== this.labelValue.learning_rate &&
                      item !== this.labelValue.batch_size
P
ph 已提交
1108
                        ) {
1109
                          const haveItem = this.table.optionsNotInCheckbox.includes(
P
ph 已提交
1110 1111
                              item,
                          );
1112
                          if (!haveItem) {
P
ph 已提交
1113 1114 1115 1116
                            const otherType = {value: '', label: ''};
                            otherType.value = this.table.columnOptions[item].label;
                            otherType.label = this.table.columnOptions[item].label;
                            if (
1117
                              otherType.value === this.labelValue.loss ||
P
update  
ph 已提交
1118 1119 1120 1121
                          otherType.value ===
                            this.$t('modelTraceback.network') ||
                          otherType.value ===
                            this.$t('modelTraceback.optimizer')
P
ph 已提交
1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149
                            ) {
                              otherType.disabled = true;
                            }
                            this.otherTypeOptions.push(otherType);
                          }
                        } else {
                          const hyperObject = {value: '', label: ''};
                          hyperObject.value = this.table.columnOptions[item].label;
                          hyperObject.label = this.table.columnOptions[item].label;
                          this.hyperOptions.push(hyperObject);
                        }
                      });
                      if (this.hyperOptions.length) {
                        const hyperTemp = {
                          label: this.$t('modelTraceback.hyperLabel'),
                          options: this.hyperOptions,
                        };
                        this.checkOptions.push(hyperTemp);
                        this.basearr.push(hyperTemp);
                      }
                      if (this.otherTypeOptions.length) {
                        const otherTemp = {
                          label: this.$t('modelTraceback.otherLabel'),
                          options: this.otherTypeOptions,
                        };
                        this.checkOptions.push(otherTemp);
                        this.basearr.push(otherTemp);
                      }
1150
                    }
P
ph 已提交
1151 1152 1153 1154 1155
                    this.checkOptions.forEach((item) => {
                      item.options.forEach((option) => {
                        this.selectArrayValue.push(option.label);
                      });
                    });
P
ph 已提交
1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170
                    this.table.columnOptions = Object.assign(
                        {
                          summary_dir: {
                            label: this.$t('modelTraceback.summaryPath'),
                            required: true,
                          },
                          dataset_mark: {
                            label: this.$t('modelTraceback.dataProcess'),
                            required: true,
                          },
                        },
                        customized,
                        this.table.columnOptions,
                    );
                    this.$store.commit('customizedColumnOptions', customized);
G
gaocongli 已提交
1171

P
ph 已提交
1172
                    this.noData = !res.data.object.length;
P
ph 已提交
1173 1174 1175 1176
                    this.showEchartPic = !!res.data.object.length;
                    if (this.hidenDirChecked.length) {
                      this.hidenDirChecked.forEach((dir) => {
                        tempEchartData.forEach((item, index) => {
W
溯源  
WeiFeng 已提交
1177
                          if (item.summary_dir === dir) {
P
ph 已提交
1178 1179 1180 1181
                            tempEchartData.splice(index, 1);
                          }
                        });
                      });
W
溯源  
WeiFeng 已提交
1182
                      if (tempEchartData.length === 0) {
P
ph 已提交
1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193
                        this.showEchartPic = false;
                      } else {
                        this.showEchartPic = true;
                        this.echart.allData = tempEchartData;
                        this.echart.brushData = tempEchartData;
                      }
                    } else {
                      this.echart.allData = list;
                      this.echart.brushData = list;
                    }
                    this.echart.showData = this.echart.brushData;
G
gaocongli 已提交
1194
                    Object.keys(this.table.columnOptions).forEach((i) => {
P
ph 已提交
1195
                      this.table.columnOptions[i].selected = true;
G
gaocongli 已提交
1196 1197 1198 1199
                      const flag = list.some((val) => {
                        return val[i] || val[i] === 0;
                      });
                      if (!flag) {
1200 1201
                        let index = this.table.optionsNotInCheckbox.indexOf(i);
                        if (index >= 0) {
G
gaocongli 已提交
1202 1203
                          this.table.optionsNotInCheckbox.splice(index, 1);
                        }
1204 1205
                        index = this.table.optionsNotInEchart.indexOf(i);
                        if (index >= 0) {
G
gaocongli 已提交
1206 1207
                          this.table.optionsNotInEchart.splice(index, 1);
                        }
1208 1209
                        index = this.table.optionsNotInTable.indexOf(i);
                        if (index >= 0) {
G
gaocongli 已提交
1210 1211 1212 1213 1214 1215 1216
                          this.table.optionsNotInTable.splice(index, 1);
                        }

                        delete this.table.columnOptions[i];
                      }
                    });
                    this.initColumm();
1217 1218 1219 1220 1221
                    this.$nextTick(() => {
                      this.resizeChart();
                      this.initChart();
                    });

P
ph 已提交
1222 1223 1224 1225 1226
                    const tempList = list.slice(0, this.pagination.pageSize);
                    this.recordsNumber = tempList.length;
                    if (this.hidenDirChecked.length) {
                      this.hidenDirChecked.forEach((dir) => {
                        tempList.forEach((item, index) => {
W
溯源  
WeiFeng 已提交
1227
                          if (item.summary_dir === dir) {
P
ph 已提交
1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249
                            tempList.splice(index, 1);
                          }
                        });
                      });
                    }
                    this.showNumber = tempList.length;
                    this.table.data = tempList;
                  } else {
                    const tempList = list.slice(0, this.pagination.pageSize);
                    this.recordsNumber = tempList.length;
                    this.hidenDirChecked = this.$store.state.hidenDirChecked || [];
                    if (this.hidenDirChecked.length) {
                      this.hidenDirChecked.forEach((dir) => {
                        tempList.forEach((item, index) => {
                          if (item.summary_dir === dir) {
                            tempList.splice(index, 1);
                          }
                        });
                      });
                    }
                    this.showNumber = tempList.length;
                    this.table.data = tempList;
G
gaocongli 已提交
1250 1251 1252 1253
                  }

                  this.pagination.total = res.data.count || 0;
                } else {
1254
                  this.errorData = true;
G
gaocongli 已提交
1255
                  this.noData = allData;
P
ph 已提交
1256
                  this.showEchartPic = !allData;
G
gaocongli 已提交
1257 1258 1259
                }
              },
              (error) => {
1260
                this.errorData = true;
1261
                this.loading = false;
G
gaocongli 已提交
1262 1263
                if (allData) {
                  this.noData = allData;
P
ph 已提交
1264
                  this.showEchartPic = !allData;
G
gaocongli 已提交
1265 1266 1267
                }
              },
          )
1268
          .catch(() => {
1269
            this.errorData = true;
1270
            this.loading = false;
1271 1272
            this.noData = true;
          });
G
gaocongli 已提交
1273
    },
P
ph 已提交
1274 1275 1276 1277 1278 1279 1280 1281 1282 1283

    /**
     * Selected data in the table
     * @param {Array} data
     * @return {Array}
     */
    setDataOfModel(data = []) {
      const modelLineageList = [];
      data.forEach((item) => {
        if (item.model_lineage) {
P
ph 已提交
1284 1285
          item.model_lineage.editShow = true;
          item.model_lineage.isError = false;
P
ph 已提交
1286
          item.model_lineage.summary_dir = item.summary_dir;
P
ph 已提交
1287 1288 1289 1290 1291 1292
          item.model_lineage.remark = item.added_info.remark
            ? item.added_info.remark
            : '';
          item.model_lineage.tag = item.added_info.tag
            ? item.added_info.tag
            : 0;
P
ph 已提交
1293
          const modelData = JSON.parse(JSON.stringify(item.model_lineage));
1294
          const byteNum = 1024;
P
ph 已提交
1295
          modelData.model_size = parseFloat(
1296
              ((modelData.model_size || 0) / byteNum / byteNum).toFixed(2),
P
ph 已提交
1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326
          );
          const keys = Object.keys(modelData.metric || {});
          if (keys.length) {
            keys.forEach((key) => {
              if (modelData.metric[key] || modelData.metric[key] === 0) {
                const temp = this.replaceStr.metric + key;
                modelData[temp] = modelData.metric[key];
              }
            });
            delete modelData.metric;
          }
          const udkeys = Object.keys(modelData.user_defined || {});
          if (udkeys.length) {
            udkeys.forEach((key) => {
              if (
                modelData.user_defined[key] ||
                modelData.user_defined[key] === 0
              ) {
                const temp = this.replaceStr.userDefined + key;
                modelData[temp] = modelData.user_defined[key];
              }
            });
            delete modelData.user_defined;
          }
          modelLineageList.push(modelData);
        }
      });
      return modelLineageList;
    },

G
gaocongli 已提交
1327 1328 1329 1330 1331
    /**
     * Selected data in the table
     * @param {Array} list Selected data in the table
     */
    selectionChange(list = []) {
P
ph 已提交
1332 1333 1334
      if (this.hideRecord) {
        return;
      }
G
gaocongli 已提交
1335
      this.echart.showData = list.length ? list : this.echart.brushData;
1336 1337 1338
      this.$nextTick(() => {
        this.initChart();
      });
P
ph 已提交
1339
      this.checkedSummary = list;
G
gaocongli 已提交
1340 1341 1342 1343 1344 1345 1346 1347
      const summaryDirFilter = [];
      this.echart.showData.forEach((i) => {
        summaryDirFilter.push(i.summary_dir);
      });
      this.tableFilter.summary_dir = {
        in: summaryDirFilter,
      };
    },
P
ph 已提交
1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372

    /**
     * Selected data in the table
     */
    selectValueChange() {
      const list = [];
      this.basearr.forEach((item) => {
        item.options.forEach((option) => {
          list.push(option.label);
        });
      });
      if (list.length > this.selectArrayValue.length) {
        this.selectCheckAll = false;
      } else {
        this.selectCheckAll = true;
      }
      let allList = [];
      const listA = [this.$t('modelTraceback.summaryPath')];
      allList = this.selectArrayValue.concat(listA);
      Object.keys(this.table.columnOptions).filter((i) => {
        this.table.columnOptions[i].selected = false;
      });
      allList.forEach((item) => {
        Object.keys(this.table.columnOptions).filter((i) => {
          const labelValue = this.table.columnOptions[i].label;
W
溯源  
WeiFeng 已提交
1373
          if (labelValue === item) {
P
ph 已提交
1374 1375 1376 1377
            this.table.columnOptions[i].selected = true;
          }
        });
      });
1378 1379 1380
      this.$nextTick(() => {
        this.initChart();
      });
P
ph 已提交
1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403
      this.initColumm();
    },

    /**
     * Hidden records
     */
    hiddenRecords() {
      this.hideRecord = true;
      if (this.checkedSummary.length) {
        this.checkedSummary.forEach((i) => {
          this.hidenDirChecked.push(i.summary_dir);
        });
      }
      this.checkedSummary = [];
      this.summaryDirList = this.$store.state.summaryDirList;
      this.tableFilter.summary_dir = {
        in: this.summaryDirList,
      };
      this.$store.commit('setHidenDirChecked', this.hidenDirChecked);
      if (this.hidenDirChecked.length) {
        const tempEchartData = this.echart.brushData;
        this.hidenDirChecked.forEach((dir) => {
          tempEchartData.forEach((item, index) => {
W
溯源  
WeiFeng 已提交
1404
            if (item.summary_dir === dir) {
P
ph 已提交
1405 1406 1407 1408 1409 1410 1411
              tempEchartData.splice(index, 1);
            }
          });
        });
        const tableTemp = this.table.data;
        this.hidenDirChecked.forEach((dir) => {
          tableTemp.forEach((item, index) => {
W
溯源  
WeiFeng 已提交
1412
            if (item.summary_dir === dir) {
P
ph 已提交
1413 1414 1415 1416 1417 1418 1419 1420 1421 1422
              tableTemp.splice(index, 1);
            }
          });
        });
        this.table.data = tableTemp;
        this.showNumber = tableTemp.length;
        this.echart.showData = tempEchartData;
        // Restore the style of the table selection box.
        this.$refs.table.clearSelection();
        if (this.echart.showData.length > 0) {
1423 1424 1425
          this.$nextTick(() => {
            this.initChart();
          });
P
ph 已提交
1426 1427 1428 1429 1430 1431 1432 1433 1434 1435
        } else {
          this.showEchartPic = false;
        }
      }
      this.hideRecord = false;
    },
    /**
     * Unhide
     */
    unhideRecords() {
1436 1437 1438
      if (this.unhideRecordsTimer) {
        clearTimeout(this.unhideRecordsTimer);
        this.unhideRecordsTimer = null;
P
ph 已提交
1439
      }
1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489
      this.unhideRecordsTimer = setTimeout(() => {
        this.showEchartPic = true;
        this.$refs.table.clearSelection();
        this.$store.commit('setHidenDirChecked', []);
        if (this.hidenDirChecked.length) {
          this.checkedSummary = [];
          this.hidenDirChecked = [];
        }
        const params = {
          body: {},
        };
        const tempParam = {
          sorted_name: this.sortInfo.sorted_name,
          sorted_type: this.sortInfo.sorted_type,
        };
        this.summaryDirList = this.$store.state.summaryDirList;
        this.tableFilter.summary_dir = {
          in: this.summaryDirList,
        };
        params.body = Object.assign(
            params.body,
            this.chartFilter,
            tempParam,
            this.tableFilter,
        );
        RequestService.queryLineagesData(params).then(
            (res) => {
              if (res && res.data && res.data.object) {
                this.errorData = false;
                const list = this.setDataOfModel(res.data.object);
                this.echart.allData = list;
                this.echart.brushData = list;
                this.echart.showData = this.echart.brushData;
                this.$nextTick(() => {
                  this.resizeChart();
                  this.initChart();
                });
                const showList = list.slice(
                    (this.pagination.currentPage - 1) * this.pagination.pageSize,
                    this.pagination.currentPage * this.pagination.pageSize,
                );
                this.table.data = showList;
                this.recordsNumber = this.table.data.length;
                this.showNumber = this.table.data.length;
                this.pagination.total = res.data.count || 0;
              } else {
                this.errorData = true;
              }
            },
            (error) => {
1490
              this.errorData = true;
1491 1492 1493
            },
        );
      }, this.delayTime);
P
ph 已提交
1494 1495
    },

G
gaocongli 已提交
1496 1497 1498 1499 1500
    /**
     * Sort data in the table
     * @param {Object} column current column
     */
    sortChange(column) {
1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538
      if (this.sortChangeTimer) {
        clearTimeout(this.sortChangeTimer);
        this.sortChangeTimer = null;
      }
      this.sortChangeTimer = setTimeout(() => {
        this.sortInfo.sorted_name = column.prop;
        this.sortInfo.sorted_type = column.order;
        this.recordsNumber = 0;
        this.showNumber = 0;
        this.getStoreList();
        const tempParam = {
          limit: this.pagination.pageSize,
          offset: 0,
          sorted_name: this.sortInfo.sorted_name,
          sorted_type: this.sortInfo.sorted_type,
        };
        const params = {};
        params.body = Object.assign(
            {},
            tempParam,
            this.tableFilter,
            this.chartFilter || {},
        );
        RequestService.queryLineagesData(params)
            .then(
                (res) => {
                  if (res && res.data && res.data.object) {
                    this.errorData = false;
                    const list = this.setDataOfModel(res.data.object);
                    const tempList = list.slice(0, this.pagination.pageSize);
                    this.recordsNumber = tempList.length;
                    if (this.hidenDirChecked.length) {
                      this.hidenDirChecked.forEach((dir) => {
                        tempList.forEach((item, index) => {
                          if (item.summary_dir === dir) {
                            tempList.splice(index, 1);
                          }
                        });
P
ph 已提交
1539
                      });
1540 1541 1542 1543 1544 1545 1546
                    }
                    this.showNumber = tempList.length;
                    this.table.data = tempList;
                    this.pagination.total = res.data.count || 0;
                    this.pagination.currentPage = 1;
                  } else {
                    this.errorData = true;
P
ph 已提交
1547
                  }
1548 1549
                },
                (error) => {
1550
                  this.errorData = true;
1551 1552 1553 1554 1555 1556
                },
            )
            .catch(() => {
              this.errorData = true;
            });
      }, this.delayTime);
G
gaocongli 已提交
1557
    },
P
ph 已提交
1558

G
gaocongli 已提交
1559 1560 1561 1562
    /**
     * Initializing the Eechart
     */
    initChart() {
P
ph 已提交
1563 1564 1565 1566 1567 1568
      const chartAxis = Object.keys(this.table.columnOptions).filter((i) => {
        return (
          this.table.columnOptions[i].selected &&
          !this.table.optionsNotInEchart.includes(i)
        );
      });
G
gaocongli 已提交
1569 1570
      const data = [];
      this.echart.showData.forEach((i, index) => {
P
ph 已提交
1571 1572
        let item = {};
        item = {
G
gaocongli 已提交
1573 1574 1575 1576 1577 1578 1579 1580 1581
          lineStyle: {
            normal: {
              color: CommonProperty.commonColorArr[index % 10],
            },
          },
          value: [],
        };

        chartAxis.forEach((key) => {
P
ph 已提交
1582
          if (
W
溯源  
WeiFeng 已提交
1583
            (i[key] || i[key] === 0) &&
P
ph 已提交
1584 1585 1586 1587 1588 1589 1590 1591
            this.keysOfMixed &&
            this.keysOfMixed.length &&
            this.keysOfMixed.includes(key)
          ) {
            item.value.push(i[key].toString());
          } else {
            item.value.push(i[key]);
          }
G
gaocongli 已提交
1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603
        });
        data.push(item);
      });

      const parallelAxis = [];
      chartAxis.forEach((key, index) => {
        const obj = {dim: index, scale: true, id: key};
        obj.name = this.table.columnOptions[key].label;
        if (this.keysOfStringValue.includes(key)) {
          const values = {};
          this.echart.showData.forEach((i) => {
            if (i[key] || i[key] === 0) {
P
ph 已提交
1604
              values[i[key].toString()] = i[key].toString();
G
gaocongli 已提交
1605 1606
            }
          });
1607
          obj.type = this.valueType.category;
G
gaocongli 已提交
1608
          obj.data = Object.keys(values);
1609
          if (key === this.valueType.dataset_mark) {
G
gaocongli 已提交
1610 1611 1612
            obj.axisLabel = {
              show: false,
            };
P
ph 已提交
1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639
          } else {
            obj.axisLabel = {
              formatter: function(val) {
                const strs = val.split('');
                let str = '';
                if (val.length > 100) {
                  return val.substring(0, 12) + '...';
                } else {
                  if (chartAxis.length < 10) {
                    for (let i = 0, s = ''; (s = strs[i++]); ) {
                      str += s;
                      if (!(i % 16)) {
                        str += '\n';
                      }
                    }
                  } else {
                    for (let i = 0, s = ''; (s = strs[i++]); ) {
                      str += s;
                      if (!(i % 12)) {
                        str += '\n';
                      }
                    }
                  }
                  return str;
                }
              },
            };
G
gaocongli 已提交
1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650
          }
        }
        if (this.keysOfIntValue.includes(key)) {
          obj.minInterval = 1;
        }
        parallelAxis.push(obj);
      });

      const echartOption = {
        backgroundColor: 'white',
        parallelAxis: parallelAxis,
1651 1652 1653
        tooltip: {
          trigger: 'axis',
        },
G
gaocongli 已提交
1654
        parallel: {
W
WeiFeng 已提交
1655
          top: 25,
1656
          left: 70,
P
ph 已提交
1657
          right: 100,
G
gaocongli 已提交
1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685
          bottom: 10,
          parallelAxisDefault: {
            type: 'value',
            nameLocation: 'end',
            nameGap: 6,
            nameTextStyle: {
              color: '#000000',
              fontSize: 14,
            },
            axisLine: {
              lineStyle: {
                color: '#6D7278',
              },
            },
            axisTick: {
              lineStyle: {
                color: '#6D7278',
              },
            },
            axisLabel: {
              textStyle: {
                fontSize: 10,
                color: '#6C7280',
              },
            },
            areaSelectStyle: {
              width: 40,
            },
1686 1687 1688
            tooltip: {
              show: true,
            },
G
gaocongli 已提交
1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706
            realtime: false,
          },
        },
        series: {
          type: 'parallel',
          lineStyle: {
            normal: {
              width: 1,
              opacity: 1,
            },
          },
          data: data,
        },
      };

      if (this.echart.chart) {
        this.echart.chart.off('axisareaselected', null);
        window.removeEventListener('resize', this.resizeChart, false);
1707 1708
      } else {
        this.echart.chart = Echarts.init(document.querySelector('#echart'));
G
gaocongli 已提交
1709 1710 1711
      }
      this.echart.chart.setOption(echartOption, true);
      window.addEventListener('resize', this.resizeChart, false);
1712 1713 1714
      this.chartEventsListen(parallelAxis);
    },
    chartEventsListen(parallelAxis) {
G
gaocongli 已提交
1715 1716
      this.echart.chart.on('axisareaselected', (params) => {
        const key = params.parallelAxisId;
P
ph 已提交
1717 1718 1719 1720 1721 1722
        if (
          this.keysOfMixed &&
          this.keysOfMixed.length &&
          this.keysOfMixed.includes(key)
        ) {
          this.$message.error(this.$t('modelTraceback.mixedItemMessage'));
1723 1724 1725
          this.$nextTick(() => {
            this.initChart();
          });
P
ph 已提交
1726 1727
          return;
        }
1728 1729
        this.recordsNumber = 0;
        this.showNumber = 0;
P
ph 已提交
1730 1731 1732 1733
        const list = this.$store.state.selectedBarList || [];
        const selectedAxisId = params.parallelAxisId;
        if (list.length) {
          list.forEach((item, index) => {
W
溯源  
WeiFeng 已提交
1734
            if (item === selectedAxisId) {
P
ph 已提交
1735 1736 1737 1738 1739 1740 1741
              list.splice(index, 1);
            }
          });
        }
        list.push(selectedAxisId);
        this.$store.commit('setSelectedBarList', list);

G
gaocongli 已提交
1742 1743 1744 1745
        let range = params.intervals[0] || [];
        const [axisData] = parallelAxis.filter((i) => {
          return i.id === key;
        });
1746 1747 1748 1749
        const lineLength = 2;
        if (axisData && range.length === lineLength) {
          if (axisData && axisData.id === this.valueType.model_size) {
            const byteNum = 1024;
G
gaocongli 已提交
1750
            range = [
1751 1752
              parseInt(range[0] * byteNum * byteNum, 0),
              parseInt(range[1] * byteNum * byteNum, 0),
G
gaocongli 已提交
1753 1754
            ];
          }
1755
          if (axisData.type === this.valueType.category) {
G
gaocongli 已提交
1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778
            const rangeData = {};
            for (let i = range[0]; i <= range[1]; i++) {
              rangeData[axisData.data[i]] = axisData.data[i];
            }
            const rangeDataKey = Object.keys(rangeData);
            this.chartFilter[key] = {
              in: rangeDataKey,
            };
          } else {
            if (this.keysOfIntValue.includes(key)) {
              range[1] = Math.floor(range[1]);
              range[0] = Math.ceil(range[0]);
            }
            this.chartFilter[key] = {
              le: range[1],
              ge: range[0],
            };
          }
          const filterParams = {};
          filterParams.body = Object.assign(
              {},
              this.chartFilter,
              this.tableFilter,
P
ph 已提交
1779 1780 1781 1782 1783 1784
          );
          const tableParams = {};
          tableParams.body = Object.assign(
              {},
              this.chartFilter,
              this.tableFilter,
G
gaocongli 已提交
1785 1786
              this.sortInfo,
          );
P
ph 已提交
1787
          RequestService.queryLineagesData(filterParams)
G
gaocongli 已提交
1788 1789
              .then(
                  (res) => {
1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810
                    if (res && res.data && res.data.object) {
                      this.errorData = false;
                      if (res.data.object.length) {
                        let customized = {};
                        customized = JSON.parse(
                            JSON.stringify(res.data.customized),
                        );
                        const customizedKeys = Object.keys(customized);
                        if (customizedKeys.length) {
                          this.setInitListValue();
                          customizedKeys.forEach((i) => {
                            if (customized[i].type === this.valueType.int) {
                              this.keysOfIntValue.push(i);
                            } else if (customized[i].type === this.valueType.str) {
                              this.keysOfStringValue.push(i);
                            } else if (
                              customized[i].type === this.valueType.mixed
                            ) {
                              // list of type mixed
                              this.keysOfMixed.push(i);
                              this.keysOfStringValue.push(i);
P
ph 已提交
1811 1812
                            }
                          });
1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837
                        }

                        const list = this.setDataOfModel(res.data.object);
                        if (this.hidenDirChecked.length) {
                          this.hidenDirChecked.forEach((dir) => {
                            list.forEach((item, index) => {
                              if (item.summary_dir === dir) {
                                list.splice(index, 1);
                              }
                            });
                          });
                        }
                        if (!list.length) {
                          this.noData = true;
                          this.showEchartPic = false;
                          this.summaryDirList = [];
                          this.checkedSummary = [];
                          this.$store.commit('setSummaryDirList', []);
                          return;
                        }
                        const summaryDirList = list.map((i) => i.summary_dir);
                        this.$store.commit('setSummaryDirList', summaryDirList);
                        this.echart.showData = this.echart.brushData = list;
                        this.$nextTick(() => {
                          this.initChart();
P
ph 已提交
1838
                        });
1839 1840
                        this.getTableList(tableParams);
                      } else {
P
update  
ph 已提交
1841 1842
                        this.summaryDirList = [];
                        this.$store.commit('setSummaryDirList', []);
1843 1844 1845
                        this.checkedSummary = [];
                        this.noData = true;
                        this.showEchartPic = false;
P
update  
ph 已提交
1846
                      }
P
ph 已提交
1847
                    } else {
1848
                      this.errorData = true;
G
gaocongli 已提交
1849 1850
                    }
                  },
1851 1852 1853
                  (error) => {
                    this.errorData = true;
                  },
G
gaocongli 已提交
1854
              )
1855 1856 1857
              .catch(() => {
                this.errorData = true;
              });
G
gaocongli 已提交
1858 1859 1860
        }
      });
    },
P
ph 已提交
1861 1862 1863 1864 1865 1866 1867 1868
    /**
     * Get table data
     * @param {Object} tableParams
     */
    getTableList(tableParams) {
      RequestService.queryLineagesData(tableParams)
          .then(
              (res) => {
1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879
                if (res && res.data && res.data.object) {
                  this.errorData = false;
                  if (res.data.object.length) {
                    const list = this.setDataOfModel(res.data.object);
                    if (this.hidenDirChecked.length) {
                      this.hidenDirChecked.forEach((dir) => {
                        list.forEach((item, index) => {
                          if (item.summary_dir === dir) {
                            list.splice(index, 1);
                          }
                        });
P
ph 已提交
1880
                      });
1881 1882 1883 1884 1885 1886 1887 1888
                    }
                    const tempList = list.slice(0, this.pagination.pageSize);
                    this.recordsNumber = tempList.length;
                    this.showNumber = tempList.length;
                    this.table.data = tempList;
                    this.pagination.currentPage = 1;
                    this.pagination.total = this.echart.brushData.length;
                    this.$refs.table.clearSelection();
P
ph 已提交
1889
                  }
1890 1891
                } else {
                  this.errorData = true;
P
ph 已提交
1892 1893
                }
              },
1894 1895 1896
              (error) => {
                this.errorData = true;
              },
P
ph 已提交
1897
          )
1898 1899 1900
          .catch(() => {
            this.errorData = true;
          });
P
ph 已提交
1901
    },
G
gaocongli 已提交
1902 1903 1904 1905
    /**
     * Resetting the Eechart
     */
    resetChart() {
P
ph 已提交
1906 1907 1908 1909 1910
      this.summaryDirList = undefined;
      this.$store.commit('setSummaryDirList', undefined);
      this.$store.commit('setSelectedBarList', []);
      this.noData = false;
      this.showTable = false;
P
ph 已提交
1911
      this.selectCheckAll = true;
G
gaocongli 已提交
1912
      this.chartFilter = {};
P
ph 已提交
1913
      this.tableFilter.summary_dir = undefined;
P
ph 已提交
1914
      this.sortInfo = {};
G
gaocongli 已提交
1915
      this.pagination.currentPage = 1;
P
ph 已提交
1916 1917 1918 1919 1920
      this.echart.allData = [];
      if (this.echart.chart) {
        this.echart.chart.clear();
      }
      this.init();
G
gaocongli 已提交
1921 1922
      this.$refs.table.clearSelection();
    },
P
ph 已提交
1923

G
gaocongli 已提交
1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957
    /**
     * Jump to the training dashboard
     * @param {String} id
     */
    jumpToTrainDashboard(id) {
      const trainId = encodeURIComponent(id);
      const routeUrl = this.$router.resolve({
        path: '/train-manage/training-dashboard',
        query: {id: trainId},
      });
      window.open(routeUrl.href, '_blank');
    },
    /**
     * Keep the number with n decimal places.
     * @param {Number} num
     * @param {Number} pow Number of decimal places
     * @return {Number}
     */
    toFixedFun(num, pow) {
      if (isNaN(num) || isNaN(pow) || !num || !pow) {
        return num;
      }
      return Math.round(num * Math.pow(10, pow)) / Math.pow(10, pow);
    },
    /**
     * Formatting Data
     * @param {String} key
     * @param {String} value
     * @return {Object}
     */
    formatNumber(key, value) {
      if (isNaN(value) || !value) {
        return value;
      } else {
1958 1959 1960
        const numDigits = 4;
        if (key === this.labelValue.learning_rate) {
          let temp = value.toPrecision(numDigits);
G
gaocongli 已提交
1961 1962 1963 1964 1965
          let row = 0;
          while (temp < 1) {
            temp = temp * 10;
            row += 1;
          }
1966
          temp = this.toFixedFun(temp, numDigits);
G
gaocongli 已提交
1967
          return `${temp}${row ? `e-${row}` : ''}`;
1968
        } else if (key === this.valueType.model_size) {
G
gaocongli 已提交
1969 1970
          return value + 'MB';
        } else {
1971 1972 1973 1974 1975 1976
          const num = 1000;
          if (value < num) {
            return (
              Math.round(value * Math.pow(10, numDigits)) /
              Math.pow(10, numDigits)
            );
G
gaocongli 已提交
1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987
          } else {
            const reg = /(?=(\B)(\d{3})+$)/g;
            return (value + '').replace(reg, ',');
          }
        }
      }
    },
    /**
     * Resizing Chart
     */
    resizeChart() {
1988 1989 1990 1991 1992 1993 1994 1995 1996
      if (
        document.getElementById('echart') &&
        document.getElementById('echart').style.display !== 'none' &&
        this.echart &&
        this.echart.chart
      ) {
        this.$nextTick(() => {
          this.echart.chart.resize();
        });
1997
      }
G
gaocongli 已提交
1998 1999
    },
  },
P
ph 已提交
2000 2001 2002
  /**
   * Destroy the page
   */
G
gaocongli 已提交
2003
  destroyed() {
2004 2005
    this.sortChangeTimer = null;
    this.unhideRecordsTimer = null;
P
ph 已提交
2006 2007 2008 2009 2010 2011 2012
    if (this.checkedSummary.length) {
      const tempList = [];
      this.checkedSummary.forEach((item) => {
        tempList.push(item.summary_dir);
      });
      this.$store.commit('setSummaryDirList', tempList);
    }
G
gaocongli 已提交
2013 2014 2015 2016 2017
    if (this.echart.chart) {
      window.removeEventListener('resize', this.resizeChart, false);
      this.echart.chart.clear();
      this.echart.chart = null;
    }
P
ph 已提交
2018
    document.removeEventListener('resize', this.blurFloat);
G
gaocongli 已提交
2019 2020 2021 2022
  },
};
</script>
<style lang="scss">
W
溯源  
WeiFeng 已提交
2023 2024
.label-text {
  line-height: 20px !important;
P
ph 已提交
2025 2026
  padding-top: 20px;
  display: block !important;
W
溯源  
WeiFeng 已提交
2027 2028
}
.remark-tip {
P
ph 已提交
2029
  line-height: 20px !important;
W
溯源  
WeiFeng 已提交
2030 2031 2032
  font-size: 12px;
  white-space: pre-wrap !important;
  color: gray;
P
ph 已提交
2033
  display: block !important;
W
溯源  
WeiFeng 已提交
2034
}
P
ph 已提交
2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063
.el-color-dropdown__main-wrapper,
.el-color-dropdown__value,
.el-color-alpha-slider {
  display: none;
}
.el-tag.el-tag--info .el-tag__close {
  color: #fff;
}
.select-inner-input {
  width: calc(100% - 140px);
  margin: 2px 4px;
  display: inline-block;
}
.select-input-button {
  position: relative;
}
.el-select-group__title {
  font-size: 14px;
  font-weight: 700;
}
.el-select-dropdown__item.selected {
  font-weight: 400;
}
.checked-color {
  color: #00a5a7 !important;
}
.el-tag.el-tag--info .el-tag__close {
  display: none;
}
P
update  
ph 已提交
2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086
.btn-disabled {
  cursor: not-allowed !important;
}
.select-all-button {
  padding: 4px 0;
  display: inline-block;
  position: absolute;
  right: 80px;
  padding: 5px;
  height: 32px;
  border: none;
  background: none;
}
.deselect-all-button {
  padding: 4px 0;
  display: inline-block;
  position: absolute;
  right: 10px;
  padding: 5px;
  height: 32px;
  border: none;
  background: none;
}
P
ph 已提交
2087

G
gaocongli 已提交
2088
#cl-model-traceback {
2089
  display: flex;
G
gaocongli 已提交
2090 2091 2092
  height: 100%;
  overflow-y: auto;
  position: relative;
2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123
  background: #fff;
  .no-data-page {
    display: flex;
    width: 100%;
    flex: 1;
    justify-content: center;
    align-items: center;
    .set-height-class {
      height: 282px !important;
    }
    .no-data-img {
      background: #fff;
      text-align: center;
      height: 200px;
      width: 310px;
      margin: auto;
      img {
        max-width: 100%;
      }
      p {
        font-size: 16px;
        padding-top: 10px;
        text-align: center;
      }
    }
    .no-data-text {
      font-size: 16px;
      padding-top: 10px;
      text-align: center;
    }
  }
2124 2125 2126
  .el-table th.gutter {
    display: table-cell !important;
  }
P
ph 已提交
2127 2128 2129
  .icon-border {
    border: 1px solid #00a5a7 !important;
  }
2130
  #tag-dialog {
P
ph 已提交
2131 2132 2133 2134 2135 2136
    z-index: 999;
    border: 1px solid #d6c9c9;
    position: fixed;
    width: 326px;
    height: 120px;
    background-color: #efebeb;
2137
    right: 106px;
P
ph 已提交
2138 2139
    border-radius: 4px;
  }
2140 2141 2142 2143 2144 2145 2146 2147 2148 2149
  .custom-btn {
    border: 1px solid #00a5a7;
    border-radius: 2px;
    background-color: white;
    color: #00a5a7;
  }
  .custom-btn:hover {
    color: #00a5a7;
    background: #e9f7f7;
  }
P
ph 已提交
2150 2151 2152 2153 2154
  .icon-image {
    display: inline-block;
    padding: 4px;
    height: 30px;
    width: 30px;
W
溯源  
WeiFeng 已提交
2155
    border: 1px solid transparent;
P
ph 已提交
2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169
  }
  .icon-image-container {
    margin: 16px 10px 18px;
  }
  .edit-text-container {
    display: inline-block;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .btns {
    margin-left: 20px;
    padding-top: 12px;
P
ph 已提交
2170
    height: 46px;
P
ph 已提交
2171 2172
  }
  .btn-container-margin {
2173 2174 2175 2176 2177 2178
    margin: 0 10%;
  }
  .tag-button-container {
    display: inline-block;
    width: 33.3%;
    text-align: center;
P
ph 已提交
2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215
  }
  .btns-container {
    padding: 14px 32px 4px;
  }
  .table-container .el-icon-edit {
    margin-left: 5px;
  }
  .table-container i {
    font-size: 18px;
    margin: 0 2px;
    color: #00a5a7;
    cursor: pointer;
  }
  .table-container .el-icon-close {
    color: #f56c6c;
  }
  .table-container .validation-error {
    color: #ff0000;
  }
  .select-container {
    padding: 10px 0;
    position: relative;
    display: flex;
  }
  .display-column {
    display: inline-block;
    padding-right: 6px;
    height: 32px;
    line-height: 32px;
  }
  .inline-block-set {
    display: inline-block;
  }
  .remark-input-style {
    width: 140px;
  }
  .tag-icon-container {
2216 2217
    width: 21px;
    height: 21px;
P
ph 已提交
2218 2219 2220 2221 2222 2223 2224 2225
    border: 1px solid #e6e6e6;
    cursor: pointer;
    border-radius: 2px;
  }
  .button-text {
    color: #606266 !important;
  }

G
gaocongli 已提交
2226 2227 2228
  .cl-model-right {
    display: flex;
    flex-direction: column;
2229 2230 2231
    width: 100%;
    flex: 1;
    background-color: #fff;
G
gaocongli 已提交
2232 2233 2234
    -webkit-box-shadow: 0 1px 0 0 rgba(200, 200, 200, 0.5);
    box-shadow: 0 1px 0 0 rgba(200, 200, 200, 0.5);
    overflow: hidden;
2235 2236
    // select
    .el-select > .el-input {
2237
      min-width: 280px !important;
2238 2239
      max-width: 500px !important;
    }
P
ph 已提交
2240
    .top-area {
P
ph 已提交
2241
      margin: 24px 32px 12px;
P
ph 已提交
2242 2243
      display: flex;
      justify-content: flex-end;
P
ph 已提交
2244 2245
      .select-box {
        height: 46px;
P
ph 已提交
2246 2247 2248 2249
        flex-grow: 1;
        .label-legend {
          height: 19px;
          margin-bottom: 4px;
P
ph 已提交
2250 2251 2252 2253 2254
          display: inline-block;
          position: absolute;
          right: 30px;
          height: 32px;
          line-height: 32px;
P
ph 已提交
2255 2256 2257 2258 2259 2260 2261
          div {
            display: inline-block;
            font-size: 12px;
          }
          div + div {
            margin-left: 30px;
          }
G
gaocongli 已提交
2262 2263 2264 2265
        }
      }
    }
    #echart {
P
ph 已提交
2266 2267 2268 2269 2270 2271
      height: 32%;
      padding: 0 12px;
    }
    .echart-no-data {
      height: 32%;
      width: 100%;
G
gaocongli 已提交
2272 2273 2274
    }
    .table-container {
      background-color: white;
P
ph 已提交
2275
      height: calc(68% - 130px);
P
ph 已提交
2276
      padding: 6px 32px;
G
gaocongli 已提交
2277
      position: relative;
2278 2279 2280 2281 2282
      .custom-label {
        max-width: calc(100% - 25px);
        padding: 0;
        vertical-align: middle;
      }
G
gaocongli 已提交
2283 2284 2285
      a {
        cursor: pointer;
      }
P
ph 已提交
2286 2287 2288
      .clear {
        clear: both;
      }
P
ph 已提交
2289 2290 2291 2292
      .hide-count {
        height: 32px;
        line-height: 32px;
        color: red;
P
ph 已提交
2293 2294
        float: right;
        margin-right: 10px;
P
ph 已提交
2295
      }
G
gaocongli 已提交
2296
      .el-pagination {
P
ph 已提交
2297
        float: right;
G
gaocongli 已提交
2298 2299 2300
        margin-right: 32px;
        bottom: 10px;
      }
P
ph 已提交
2301 2302 2303
      .pagination-container {
        height: 40px;
      }
G
gaocongli 已提交
2304 2305 2306 2307
    }
  }
}
</style>