model-traceback.vue 74.5 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">
119 120
        <div class="disabled-checked"
             v-show="!table.data.length"></div>
P
ph 已提交
121
        <el-table ref="table"
G
gaocongli 已提交
122 123 124 125
                  :data="table.data"
                  tooltip-effect="light"
                  height="calc(100% - 40px)"
                  @selection-change="selectionChange"
126
                  @sort-change="sortChange"
G
gaocongli 已提交
127 128 129
                  row-key="summary_dir">
          <el-table-column type="selection"
                           width="55"
P
ph 已提交
130
                           :reserve-selection="true"
P
ph 已提交
131
                           v-show="showTable && !noData">
P
ph 已提交
132 133 134 135 136 137 138 139 140 141 142
          </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
143
                             min-width="120"
P
ph 已提交
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
                             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
167
                             min-width="120"
P
ph 已提交
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190
                             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
191
                             min-width="154"
P
ph 已提交
192 193 194 195 196 197 198 199 200
                             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 已提交
201
                <span>{{formatNumber(key, scope.row[key])}}</span>
P
ph 已提交
202 203 204 205 206
              </template>
            </el-table-column>
          </el-table-column>
          <!--other column-->
          <el-table-column v-for="key in table.otherColumn"
G
gaocongli 已提交
207 208 209
                           :key="key"
                           :prop="key"
                           :label="table.columnOptions[key].label"
P
ph 已提交
210
                           :fixed="table.columnOptions[key].label === text ? true : false"
G
gaocongli 已提交
211
                           show-overflow-tooltip
P
update  
ph 已提交
212
                           min-width="150"
213 214 215 216 217 218 219 220
                           sortable="custom">
            <template slot="header"
                      slot-scope="scope">
              <div class="custom-label"
                   :title="scope.column.label">
                {{ scope.column.label }}
              </div>
            </template>
G
gaocongli 已提交
221 222
            <template slot-scope="scope">
              <a v-if="key === 'summary_dir'"
223 224
                 @click="jumpToTrainDashboard(scope.row[key])">{{ scope.row[key] }}</a>
              <span v-else>{{ formatNumber(key, scope.row[key]) }}</span>
G
gaocongli 已提交
225 226
            </template>
          </el-table-column>
P
ph 已提交
227
          <!-- remark column -->
W
溯源  
WeiFeng 已提交
228
          <el-table-column fixed="right"
P
ph 已提交
229
                           width="260">
W
溯源  
WeiFeng 已提交
230 231 232 233 234 235
            <template slot="header">
              <div>
                <div class="label-text">{{$t('public.remark')}}</div>
                <div class="remark-tip">{{$t('modelTraceback.remarkTips')}}</div>
              </div>
            </template>
P
ph 已提交
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 265 266
            <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">
267
              <div @click="showAllIcon(scope.row, scope, $event)"
P
ph 已提交
268
                   class="tag-icon-container">
269 270
                <img v-if="scope.row.tag"
                     :class="'img' + scope.$index"
271
                     :src="require('@/assets/images/icon' + scope.row.tag + '.svg')">
272 273 274
                <img v-else
                     :class="'img' + scope.$index"
                     :src="require('@/assets/images/icon-down.svg')">
P
ph 已提交
275 276 277
              </div>
            </template>
          </el-table-column>
G
gaocongli 已提交
278
        </el-table>
P
ph 已提交
279
        <div class="pagination-container">
P
ph 已提交
280 281 282 283 284 285
          <el-pagination @current-change="pagination.pageChange"
                         :current-page="pagination.currentPage"
                         :page-size="pagination.pageSize"
                         :layout="pagination.layout"
                         :total="pagination.total">
          </el-pagination>
P
ph 已提交
286 287 288 289 290
          <div class="hide-count"
               v-show="recordsNumber-showNumber">
            {{$t('modelTraceback.totalHide').replace(`{n}`, (recordsNumber-showNumber))}}
          </div>
          <div class="clear"></div>
P
ph 已提交
291
        </div>
G
gaocongli 已提交
292 293 294
      </div>
      <div v-if="noData"
           class="no-data-page">
295 296
        <div class="no-data-img"
             :class="{'set-height-class':(summaryDirList && !summaryDirList.length)}">
G
gaocongli 已提交
297
          <img :src="require('@/assets/images/nodata.png')"
298
               alt />
P
ph 已提交
299 300 301 302 303
          <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 已提交
304 305 306 307 308
            <p class="no-data-text">
              {{ $t('modelTraceback.click') }}
              <b> {{ $t('modelTraceback.showAllDataBtn') }}</b>
              {{ $t('modelTraceback.viewAllData') }}
            </p>
P
ph 已提交
309
          </div>
G
gaocongli 已提交
310 311 312
        </div>
      </div>
    </div>
313 314 315 316 317 318 319 320 321 322 323 324 325 326 327
    <!-- 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">
328 329 330 331 332 333 334 335 336 337 338 339 340
          <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"
341
                       @click="clearIcon(tagScope, $event)"
342 343 344 345 346 347 348 349 350 351 352 353 354
                       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>
355 356 357
        </div>
      </div>
    </div>
G
gaocongli 已提交
358 359 360 361 362 363 364 365 366 367 368 369
  </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 {
370 371
      sortChangeTimer: null,
      unhideRecordsTimer: null,
372
      tagDialogShow: false,
373
      errorData: true,
374
      tagScope: {},
P
ph 已提交
375
      iconValue: 0,
P
update  
ph 已提交
376
      imageList: [],
P
ph 已提交
377 378 379 380 381
      // Select all
      selectCheckAll: true,
      // Number of data records returned by the interface.
      recordsNumber: 0,
      showNumber: 0,
382
      delayTime: 500,
P
ph 已提交
383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400
      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 已提交
401 402
      table: {},
      summaryDirList: undefined,
P
ph 已提交
403
      text: this.$t('modelTraceback.summaryPath'),
P
ph 已提交
404
      checkedSummary: [],
405 406
      keysOfStringValue: [], // All keys whose values are character strings
      keysOfIntValue: [], // All keys whose values are int
P
ph 已提交
407
      keysOfMixed: [],
P
ph 已提交
408 409 410 411 412 413 414 415 416 417 418 419 420 421 422
      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 已提交
423
      sortInfo: {},
P
ph 已提交
424 425
      showTable: false,
      noData: false,
426
      loading: true,
P
ph 已提交
427 428 429 430 431
      haveCustomizedParams: false,
      replaceStr: {
        metric: 'metric/',
        userDefined: 'user_defined/',
      },
432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451
      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 已提交
452 453 454 455
    };
  },
  computed: {},
  mounted() {
456
    this.setInitListValue();
P
update  
ph 已提交
457
    this.imageList = [];
458
    for (let i = 1; i <= 10; i++) {
P
update  
ph 已提交
459
      const obj = {};
460
      obj.number = i;
P
update  
ph 已提交
461 462 463
      obj.iconAdd = require('@/assets/images/icon' + obj.number + '.svg');
      this.imageList.push(obj);
    }
P
ph 已提交
464
    document.title = `${this.$t('summaryManage.modelTraceback')}-MindInsight`;
P
ph 已提交
465
    document.addEventListener('click', this.blurFloat, true);
P
ph 已提交
466 467 468 469 470 471 472 473 474 475 476
    this.$store.commit('setSelectedBarList', []);
    this.getStoreList();
    this.pagination.pageChange = (page) => {
      this.pagination.currentPage = page;
      this.queryLineagesData(false);
    };
    this.$nextTick(() => {
      this.init();
    });
  },
  methods: {
P
ph 已提交
477 478
    blurFloat(event) {
      const domArr = document.querySelectorAll('.icon-dialog');
479 480
      const path = event.path || (event.composedPath && event.composedPath());
      const isActiveDom = path.some((item) => {
P
ph 已提交
481 482 483
        return item.className === 'icon-dialog';
      });
      if (!isActiveDom) {
484
        this.removeIconBorder();
P
ph 已提交
485 486 487
        domArr.forEach((item) => {
          item.style.display = 'none';
        });
488
        this.tagDialogShow = false;
P
ph 已提交
489 490 491 492 493 494
      }
    },

    /**
     * Display of the icon dialog box
     * @param {Object} row
495
     * @param {Object} scope
496
     * @param {Object} event
P
ph 已提交
497
     */
498
    showAllIcon(row, scope, event) {
499 500 501 502 503 504 505 506 507
      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;
508
      const dialogHeight = 130;
509
      const ev = window.event || event;
510
      document.getElementById('tag-dialog').style.top =
511
        ev.clientY - dialogHeight + 'px';
512 513 514 515 516 517 518 519 520 521 522 523 524 525
    },

    /**
     * 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 已提交
526

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

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

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

    /**
     * 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 已提交
647
          if (labelValue === item) {
P
ph 已提交
648 649 650 651 652 653
            this.table.columnOptions[i].selected = true;
          }
        });
      });
      this.initColumm();
      this.$nextTick(() => {
654
        this.initChart();
P
ph 已提交
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 680 681
        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 已提交
682
          if (labelValue === item) {
P
ph 已提交
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 796 797
            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 已提交
798 799 800 801 802 803 804 805 806 807
    getStoreList() {
      this.summaryDirList = this.$store.state.summaryDirList;
      if (this.summaryDirList) {
        this.tableFilter.summary_dir = {
          in: this.summaryDirList,
        };
      } else {
        this.tableFilter.summary_dir = undefined;
      }
    },
808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826
    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 已提交
827 828 829 830 831 832

    /**
     * Initialization
     */
    init() {
      this.table = {
G
gaocongli 已提交
833 834 835 836 837 838 839 840 841 842
        columnOptions: {
          train_dataset_path: {
            label: this.$t('modelTraceback.trainSetPath'),
            required: true,
          },
          test_dataset_path: {
            label: this.$t('modelTraceback.testSetPath'),
            required: true,
          },
          loss: {
843
            label: this.labelValue.loss,
G
gaocongli 已提交
844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866
            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: {
867
            label: this.labelValue.epoch,
G
gaocongli 已提交
868 869 870
            required: false,
          },
          batch_size: {
871
            label: this.labelValue.batch_size,
G
gaocongli 已提交
872 873
            required: false,
          },
P
update  
ph 已提交
874 875 876 877
          device_num: {
            label: this.$t('modelTraceback.deviceNum'),
            required: false,
          },
G
gaocongli 已提交
878 879 880 881 882 883 884 885 886
          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 已提交
887
        otherColumn: [], // Table Column
G
gaocongli 已提交
888 889 890
        mandatoryColumn: [], // Mandatory Table Column
        optionalColumn: [], // Optional Table Column
        data: [],
P
ph 已提交
891
        // no checked list
G
gaocongli 已提交
892 893 894 895 896 897 898 899 900 901 902 903 904 905
        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 已提交
906
      };
P
ph 已提交
907
      this.keysOfMixed = [];
P
ph 已提交
908 909 910 911 912 913 914 915 916 917 918 919 920

      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 已提交
921
      this.basearr = [];
P
ph 已提交
922 923 924
      this.selectArrayValue = [];
      // Obtain the hidden summary_dir list after initialization.
      this.hidenDirChecked = this.$store.state.hidenDirChecked || [];
P
ph 已提交
925
      this.queryLineagesData(true);
G
gaocongli 已提交
926 927 928 929 930
    },
    /**
     * Column initialization
     */
    initColumm() {
P
ph 已提交
931 932 933 934 935
      this.metricList = [];
      this.userDefinedList = [];
      // hyper list
      this.hyperList = [];
      this.summaryList = [];
G
gaocongli 已提交
936 937 938 939 940 941 942 943 944 945
      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 已提交
946 947 948 949 950 951 952 953 954 955 956
      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 已提交
957
        if (item.indexOf('metric/') === 0) {
P
ph 已提交
958
          metricArray.push(item);
W
溯源  
WeiFeng 已提交
959
        } else if (item.indexOf('user_defined/') === 0) {
P
ph 已提交
960 961
          userDefinedArray.push(item);
        } else if (
962 963 964
          item === this.labelValue.epoch ||
          item === this.labelValue.batch_size ||
          item === this.labelValue.learning_rate
P
ph 已提交
965 966 967 968 969
        ) {
          hyperArray.push(item);
        } else {
          columnArray.push(item);
        }
G
gaocongli 已提交
970
      });
P
ph 已提交
971 972 973 974 975 976 977
      this.showTable = true;
      this.table.otherColumn = columnArray;
      this.metricList = metricArray;
      this.userDefinedList = userDefinedArray;
      // hyper list
      this.hyperList = hyperArray;

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

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

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

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

P
ph 已提交
1224 1225 1226 1227 1228
                    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 已提交
1229
                          if (item.summary_dir === dir) {
P
ph 已提交
1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251
                            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 已提交
1252 1253 1254 1255
                  }

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

    /**
     * Selected data in the table
     * @param {Array} data
     * @return {Array}
     */
    setDataOfModel(data = []) {
      const modelLineageList = [];
      data.forEach((item) => {
        if (item.model_lineage) {
P
ph 已提交
1286 1287
          item.model_lineage.editShow = true;
          item.model_lineage.isError = false;
P
ph 已提交
1288
          item.model_lineage.summary_dir = item.summary_dir;
P
ph 已提交
1289 1290 1291 1292 1293 1294
          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 已提交
1295
          const modelData = JSON.parse(JSON.stringify(item.model_lineage));
1296
          const byteNum = 1024;
P
ph 已提交
1297
          modelData.model_size = parseFloat(
1298
              ((modelData.model_size || 0) / byteNum / byteNum).toFixed(2),
P
ph 已提交
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 1327 1328
          );
          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 已提交
1329 1330 1331 1332 1333
    /**
     * Selected data in the table
     * @param {Array} list Selected data in the table
     */
    selectionChange(list = []) {
P
ph 已提交
1334 1335 1336
      if (this.hideRecord) {
        return;
      }
G
gaocongli 已提交
1337
      this.echart.showData = list.length ? list : this.echart.brushData;
1338 1339 1340
      this.$nextTick(() => {
        this.initChart();
      });
P
ph 已提交
1341
      this.checkedSummary = list;
G
gaocongli 已提交
1342 1343 1344 1345 1346 1347 1348 1349
      const summaryDirFilter = [];
      this.echart.showData.forEach((i) => {
        summaryDirFilter.push(i.summary_dir);
      });
      this.tableFilter.summary_dir = {
        in: summaryDirFilter,
      };
    },
P
ph 已提交
1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374

    /**
     * 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 已提交
1375
          if (labelValue === item) {
P
ph 已提交
1376 1377 1378 1379
            this.table.columnOptions[i].selected = true;
          }
        });
      });
1380 1381 1382
      this.$nextTick(() => {
        this.initChart();
      });
P
ph 已提交
1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405
      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 已提交
1406
            if (item.summary_dir === dir) {
P
ph 已提交
1407 1408 1409 1410 1411 1412 1413
              tempEchartData.splice(index, 1);
            }
          });
        });
        const tableTemp = this.table.data;
        this.hidenDirChecked.forEach((dir) => {
          tableTemp.forEach((item, index) => {
W
溯源  
WeiFeng 已提交
1414
            if (item.summary_dir === dir) {
P
ph 已提交
1415 1416 1417 1418 1419 1420 1421 1422 1423 1424
              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) {
1425 1426 1427
          this.$nextTick(() => {
            this.initChart();
          });
P
ph 已提交
1428 1429 1430 1431 1432 1433 1434 1435 1436 1437
        } else {
          this.showEchartPic = false;
        }
      }
      this.hideRecord = false;
    },
    /**
     * Unhide
     */
    unhideRecords() {
1438 1439 1440
      if (this.unhideRecordsTimer) {
        clearTimeout(this.unhideRecordsTimer);
        this.unhideRecordsTimer = null;
P
ph 已提交
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 1490 1491
      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) => {
1492
              this.errorData = true;
1493 1494 1495
            },
        );
      }, this.delayTime);
P
ph 已提交
1496 1497
    },

G
gaocongli 已提交
1498 1499 1500 1501 1502
    /**
     * Sort data in the table
     * @param {Object} column current column
     */
    sortChange(column) {
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 1539 1540
      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 已提交
1541
                      });
1542 1543 1544 1545 1546 1547 1548
                    }
                    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 已提交
1549
                  }
1550 1551
                },
                (error) => {
1552
                  this.errorData = true;
1553 1554 1555 1556 1557 1558
                },
            )
            .catch(() => {
              this.errorData = true;
            });
      }, this.delayTime);
G
gaocongli 已提交
1559
    },
P
ph 已提交
1560

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

        chartAxis.forEach((key) => {
P
ph 已提交
1584
          if (
W
溯源  
WeiFeng 已提交
1585
            (i[key] || i[key] === 0) &&
P
ph 已提交
1586 1587 1588 1589 1590 1591 1592 1593
            this.keysOfMixed &&
            this.keysOfMixed.length &&
            this.keysOfMixed.includes(key)
          ) {
            item.value.push(i[key].toString());
          } else {
            item.value.push(i[key]);
          }
G
gaocongli 已提交
1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605
        });
        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 已提交
1606
              values[i[key].toString()] = i[key].toString();
G
gaocongli 已提交
1607 1608
            }
          });
1609
          obj.type = this.valueType.category;
G
gaocongli 已提交
1610
          obj.data = Object.keys(values);
1611
          if (key === this.valueType.dataset_mark) {
G
gaocongli 已提交
1612 1613 1614
            obj.axisLabel = {
              show: false,
            };
P
ph 已提交
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 1640 1641
          } 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 已提交
1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652
          }
        }
        if (this.keysOfIntValue.includes(key)) {
          obj.minInterval = 1;
        }
        parallelAxis.push(obj);
      });

      const echartOption = {
        backgroundColor: 'white',
        parallelAxis: parallelAxis,
1653 1654 1655
        tooltip: {
          trigger: 'axis',
        },
G
gaocongli 已提交
1656
        parallel: {
W
WeiFeng 已提交
1657
          top: 25,
1658
          left: 70,
P
ph 已提交
1659
          right: 100,
G
gaocongli 已提交
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 1686 1687
          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,
            },
1688 1689 1690
            tooltip: {
              show: true,
            },
G
gaocongli 已提交
1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708
            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);
1709 1710
      } else {
        this.echart.chart = Echarts.init(document.querySelector('#echart'));
G
gaocongli 已提交
1711 1712 1713
      }
      this.echart.chart.setOption(echartOption, true);
      window.addEventListener('resize', this.resizeChart, false);
1714 1715 1716
      this.chartEventsListen(parallelAxis);
    },
    chartEventsListen(parallelAxis) {
G
gaocongli 已提交
1717 1718
      this.echart.chart.on('axisareaselected', (params) => {
        const key = params.parallelAxisId;
P
ph 已提交
1719 1720 1721 1722 1723 1724
        if (
          this.keysOfMixed &&
          this.keysOfMixed.length &&
          this.keysOfMixed.includes(key)
        ) {
          this.$message.error(this.$t('modelTraceback.mixedItemMessage'));
1725 1726 1727
          this.$nextTick(() => {
            this.initChart();
          });
P
ph 已提交
1728 1729
          return;
        }
1730 1731
        this.recordsNumber = 0;
        this.showNumber = 0;
P
ph 已提交
1732 1733 1734 1735
        const list = this.$store.state.selectedBarList || [];
        const selectedAxisId = params.parallelAxisId;
        if (list.length) {
          list.forEach((item, index) => {
W
溯源  
WeiFeng 已提交
1736
            if (item === selectedAxisId) {
P
ph 已提交
1737 1738 1739 1740 1741 1742 1743
              list.splice(index, 1);
            }
          });
        }
        list.push(selectedAxisId);
        this.$store.commit('setSelectedBarList', list);

G
gaocongli 已提交
1744 1745 1746 1747
        let range = params.intervals[0] || [];
        const [axisData] = parallelAxis.filter((i) => {
          return i.id === key;
        });
1748 1749 1750 1751
        const lineLength = 2;
        if (axisData && range.length === lineLength) {
          if (axisData && axisData.id === this.valueType.model_size) {
            const byteNum = 1024;
G
gaocongli 已提交
1752
            range = [
1753 1754
              parseInt(range[0] * byteNum * byteNum, 0),
              parseInt(range[1] * byteNum * byteNum, 0),
G
gaocongli 已提交
1755 1756
            ];
          }
1757
          if (axisData.type === this.valueType.category) {
G
gaocongli 已提交
1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780
            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 已提交
1781 1782 1783 1784 1785 1786
          );
          const tableParams = {};
          tableParams.body = Object.assign(
              {},
              this.chartFilter,
              this.tableFilter,
G
gaocongli 已提交
1787 1788
              this.sortInfo,
          );
P
ph 已提交
1789
          RequestService.queryLineagesData(filterParams)
G
gaocongli 已提交
1790 1791
              .then(
                  (res) => {
1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812
                    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 已提交
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 1838 1839
                        }

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

G
gaocongli 已提交
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 1958 1959
    /**
     * 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 {
1960 1961 1962
        const numDigits = 4;
        if (key === this.labelValue.learning_rate) {
          let temp = value.toPrecision(numDigits);
G
gaocongli 已提交
1963 1964 1965 1966 1967
          let row = 0;
          while (temp < 1) {
            temp = temp * 10;
            row += 1;
          }
1968
          temp = this.toFixedFun(temp, numDigits);
G
gaocongli 已提交
1969
          return `${temp}${row ? `e-${row}` : ''}`;
1970
        } else if (key === this.valueType.model_size) {
G
gaocongli 已提交
1971 1972
          return value + 'MB';
        } else {
1973 1974 1975 1976 1977 1978
          const num = 1000;
          if (value < num) {
            return (
              Math.round(value * Math.pow(10, numDigits)) /
              Math.pow(10, numDigits)
            );
G
gaocongli 已提交
1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989
          } else {
            const reg = /(?=(\B)(\d{3})+$)/g;
            return (value + '').replace(reg, ',');
          }
        }
      }
    },
    /**
     * Resizing Chart
     */
    resizeChart() {
1990 1991 1992 1993 1994 1995 1996 1997 1998
      if (
        document.getElementById('echart') &&
        document.getElementById('echart').style.display !== 'none' &&
        this.echart &&
        this.echart.chart
      ) {
        this.$nextTick(() => {
          this.echart.chart.resize();
        });
1999
      }
G
gaocongli 已提交
2000 2001
    },
  },
P
ph 已提交
2002 2003 2004
  /**
   * Destroy the page
   */
G
gaocongli 已提交
2005
  destroyed() {
2006 2007
    this.sortChangeTimer = null;
    this.unhideRecordsTimer = null;
P
ph 已提交
2008 2009 2010 2011 2012 2013 2014
    if (this.checkedSummary.length) {
      const tempList = [];
      this.checkedSummary.forEach((item) => {
        tempList.push(item.summary_dir);
      });
      this.$store.commit('setSummaryDirList', tempList);
    }
G
gaocongli 已提交
2015 2016 2017 2018 2019
    if (this.echart.chart) {
      window.removeEventListener('resize', this.resizeChart, false);
      this.echart.chart.clear();
      this.echart.chart = null;
    }
P
ph 已提交
2020
    document.removeEventListener('resize', this.blurFloat);
G
gaocongli 已提交
2021 2022 2023 2024
  },
};
</script>
<style lang="scss">
W
溯源  
WeiFeng 已提交
2025 2026
.label-text {
  line-height: 20px !important;
P
ph 已提交
2027 2028
  padding-top: 20px;
  display: block !important;
W
溯源  
WeiFeng 已提交
2029 2030
}
.remark-tip {
P
ph 已提交
2031
  line-height: 20px !important;
W
溯源  
WeiFeng 已提交
2032 2033 2034
  font-size: 12px;
  white-space: pre-wrap !important;
  color: gray;
P
ph 已提交
2035
  display: block !important;
W
溯源  
WeiFeng 已提交
2036
}
P
ph 已提交
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 2064 2065
.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 已提交
2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088
.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 已提交
2089

G
gaocongli 已提交
2090
#cl-model-traceback {
2091
  display: flex;
G
gaocongli 已提交
2092 2093 2094
  height: 100%;
  overflow-y: auto;
  position: relative;
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 2124 2125
  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;
    }
  }
2126 2127 2128
  .el-table th.gutter {
    display: table-cell !important;
  }
P
ph 已提交
2129 2130 2131
  .icon-border {
    border: 1px solid #00a5a7 !important;
  }
2132
  #tag-dialog {
P
ph 已提交
2133 2134 2135 2136 2137 2138
    z-index: 999;
    border: 1px solid #d6c9c9;
    position: fixed;
    width: 326px;
    height: 120px;
    background-color: #efebeb;
2139
    right: 106px;
P
ph 已提交
2140 2141
    border-radius: 4px;
  }
2142 2143 2144 2145 2146 2147 2148 2149 2150 2151
  .custom-btn {
    border: 1px solid #00a5a7;
    border-radius: 2px;
    background-color: white;
    color: #00a5a7;
  }
  .custom-btn:hover {
    color: #00a5a7;
    background: #e9f7f7;
  }
P
ph 已提交
2152 2153 2154 2155 2156
  .icon-image {
    display: inline-block;
    padding: 4px;
    height: 30px;
    width: 30px;
W
溯源  
WeiFeng 已提交
2157
    border: 1px solid transparent;
P
ph 已提交
2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171
  }
  .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 已提交
2172
    height: 46px;
P
ph 已提交
2173 2174
  }
  .btn-container-margin {
2175 2176 2177 2178 2179 2180
    margin: 0 10%;
  }
  .tag-button-container {
    display: inline-block;
    width: 33.3%;
    text-align: center;
P
ph 已提交
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 2216 2217
  }
  .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 {
2218 2219
    width: 21px;
    height: 21px;
P
ph 已提交
2220 2221 2222 2223 2224 2225 2226 2227
    border: 1px solid #e6e6e6;
    cursor: pointer;
    border-radius: 2px;
  }
  .button-text {
    color: #606266 !important;
  }

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