fix : 复制功能组件化替换

This commit is contained in:
likexuan
2022-10-20 16:38:11 +08:00
parent 9d08d29b20
commit de3f4ccc3c
7 changed files with 56 additions and 47 deletions

View File

@@ -3,7 +3,7 @@
<span class="document-copy-text">
<slot name="copy-text"></slot>
</span>
<i v-if="copyData" class="nz-icon nz-icon-override" style="visibility: hidden" @click="onCopy(copyData)" :title="$t('overall.copyText')"></i>
<i v-if="showInfo" class="nz-icon nz-icon-override" style="visibility: hidden" @click="onCopy(copyData)" :title="$t('overall.copyText')"></i>
</div>
</template>
@@ -11,7 +11,8 @@
export default {
name: 'copy',
props: {
copyData: String
copyData: String,
showInfo: String
},
data () {
return {

View File

@@ -44,14 +44,14 @@
<span class="document-copy-text">{{scope.row.name ? scope.row.name : '-'}}</span>
<i v-if="scope.row.name" class="nz-icon nz-icon-override" style="visibility: hidden" @click="onCopy(scope.row.name)" :title="$t('overall.copyText')"></i>
</div> -->
<copy :copyData='scope.row.name'>
<copy :copyData='scope.row.name' :showInfo='scope.row.name'>
<template slot="copy-text">
{{scope.row.name ? scope.row.name : '-'}}
</template>
</copy>
</template>
<template v-else-if="item.prop === 'manageIp'">
<copy :copyData='scope.row.manageIp'>
<copy :copyData='scope.row.manageIp' :showInfo='scope.row.manageIp'>
<template slot="copy-text">
{{scope.row.manageIp ? scope.row.manageIp : '-'}}
</template>

View File

@@ -37,14 +37,14 @@
</template>
<template slot-scope="scope" :column="item">
<template v-if="item.prop === 'name'">
<copy :copyData='scope.row.name'>
<copy :copyData='scope.row.name' :showInfo='scope.row.name'>
<template slot="copy-text">
{{scope.row.name ? scope.row.name : '-'}}
</template>
</copy>
</template>
<template v-else-if="item.prop === 'type'">
<copy :copyData='scope.row.type'>
<copy :copyData='scope.row.type' :showInfo='scope.row.type'>
<template slot="copy-text">
{{scope.row.type ? scope.row.type : '-'}}
</template>

View File

@@ -37,7 +37,7 @@
</template>
<template slot-scope="scope" :column="item">
<template v-if="item.prop === 'name'">
<copy :copyData='scope.row.name'>
<copy :copyData='scope.row.name' :showInfo='scope.row.name'>
<template slot="copy-text">
{{scope.row.name ? scope.row.name : '-'}}
</template>
@@ -51,7 +51,7 @@
<template v-else>{{"-"}}</template>
</template>
<template v-else-if="item.prop === 'expr'">
<copy :copyData='scope.row[item.prop]'>
<copy :copyData='scope.row[item.prop]' :showInfo='scope.row[item.prop]'>
<template slot="copy-text">
{{scope.row[item.prop] ? scope.row[item.prop] : '-'}}
</template>

View File

@@ -86,24 +86,27 @@
<div ref="detailScrollbar" class="mib-browser-detail">
<div class="mib-browser-detail-row">
<div>Name</div>
<div class="document-copy-block" >
<div class="document-copy-text">{{currentWalk.name}}</div>
<i v-if="currentWalk.name" class="nz-icon nz-icon-override" style="visibility: hidden" @click="onCopy(currentWalk.name)" :title="$t('overall.copyText')"></i>
</div>
<copy :copyData='currentWalk.name' :showInfo='currentWalk.name'>
<template slot="copy-text">
{{currentWalk.name}}
</template>
</copy>
</div>
<div class="mib-browser-detail-row">
<div>OID</div>
<div class="document-copy-block">
<div class="document-copy-text">{{currentWalk.objectID}}</div>
<i v-if="currentWalk.objectID" class="nz-icon nz-icon-override" style="visibility: hidden" @click="onCopy(currentWalk.objectID)" :title="$t('overall.copyText')"></i>
</div>
<copy :copyData='currentWalk.objectID' :showInfo='currentWalk.objectID'>
<template slot="copy-text">
{{currentWalk.objectID}}
</template>
</copy>
</div>
<div class="mib-browser-detail-row">
<div>MIB</div>
<div class="document-copy-block">
<div class="document-copy-text">{{mibName(currentWalk.objectID)}}</div>
<i v-if="mibName(currentWalk.objectID)" class="nz-icon nz-icon-override" style="visibility: hidden" @click="onCopy(mibName(currentWalk.objectID))" :title="$t('overall.copyText')"></i>
</div>
<copy :copyData='mibName(currentWalk.objectID)' :showInfo='mibName(currentWalk.objectID)'>
<template slot="copy-text">
{{mibName(currentWalk.objectID)}}
</template>
</copy>
</div>
<div class="mib-browser-detail-row">
<div>Syntax</div>
@@ -141,20 +144,18 @@
<pl-table v-if="showTable" ref="resultTable" v-my-loading="loading" :datas="resultData" :empty-text="$t('overall.noData')" :pagination-show="false" :row-height="28"
border class="mib-browser-table" size="small" style="width: 100%; height: 100%" use-virtual>
<pl-table-column v-slot="{row}" label="Name/OID">
<div class="document-copy-block">
<div class="document-copy-text">
<div class="too-long-split" @click="searchParam.oid = row.oid">{{row.name ? row.name : row.oid}}</div>
</div>
<i class="nz-icon nz-icon-override" style="visibility: hidden" @click="onCopy(row.name ? row.name : row.oid)" :title="$t('overall.copyText')"></i>
</div>
<copy :copyData='row.name ? row.name : row.oid' :showInfo='true'>
<template slot="copy-text">
<div class="too-long-split" @click="searchParam.oid = row.oid">{{row.name ? row.name : row.oid}}</div>
</template>
</copy>
</pl-table-column>
<pl-table-column v-slot="{row}" label="Value">
<div class="document-copy-block">
<div class="document-copy-text">
<div @click="searchParam.oid = row.oid">{{row.value}}</div>
</div>
<i v-if="row.value" class="nz-icon nz-icon-override" style="visibility: hidden" @click="onCopy(row.value)" :title="$t('overall.copyText')"></i>
</div>
<copy :copyData='row.value' :showInfo='row.value'>
<template slot="copy-text">
<div @click="searchParam.oid = row.oid">{{row.value}}</div>
</template>
</copy>
</pl-table-column>
<pl-table-column v-slot="{row}" label="Type">
<template><div @click="searchParam.oid = row.oid">{{row.type}}</div></template>
@@ -174,6 +175,7 @@
import fileSaver from 'file-saver'
import nzDataList from '@/components/common/table/nzDataList'
import xlsx from 'xlsx'
import copy from '@/components/common/copy'
export default {
name: 'mibBrowser',
@@ -181,7 +183,8 @@ export default {
switchTab: String
},
components: {
nzDataList
nzDataList,
copy
},
data () {
return {

View File

@@ -78,16 +78,18 @@
{{scope.row[item.prop]?utcTimeToTimezoneStr(scope.row[item.prop]):$t('config.system.apiKey.noExpire')}}
</template>
<template v-else-if="item.prop == 'token'">
<div class="document-copy-block">
<span class="document-copy-text"> {{scope.row[item.prop].replace(reg, '*')}}</span>
<i v-if="scope.row[item.prop]" class="nz-icon nz-icon-override" style="visibility: hidden" @click="onCopy(scope.row[item.prop])" :title="$t('overall.copyText')"></i>
</div>
<copy :copyData='scope.row[item.prop]' :showInfo='scope.row[item.prop]'>
<template slot="copy-text">
{{scope.row[item.prop].replace(reg, '*')}}
</template>
</copy>
</template>
<template v-else-if="item.prop === 'name'">
<div class="document-copy-block">
<span class="document-copy-text">{{scope.row.name ? scope.row.name : '-'}}</span>
<i v-if="scope.row.name" class="nz-icon nz-icon-override" style="visibility: hidden" @click="onCopy(scope.row.name)" :title="$t('overall.copyText')"></i>
</div>
<copy :copyData='scope.row[item.prop]' :showInfo='scope.row[item.prop]'>
<template slot="copy-text">
{{scope.row[item.prop]?scope.row[item.prop]:'-'}}
</template>
</copy>
</template>
<template v-else-if="scope.row[item.prop]">{{scope.row[item.prop]}}</template>
<template v-else>-</template>
@@ -138,12 +140,13 @@
import { tableCommon } from './systemCommon'
import table from '@/components/common/mixin/table'
import deleteButton from '@/components/common/deleteButton'
import copy from '@/components/common/copy'
export default {
name: 'apiKeyTable',
props: {
loading: Boolean
},
components: { deleteButton },
components: { deleteButton, copy },
mixins: [table, tableCommon],
data () {
return {

View File

@@ -40,10 +40,11 @@
{{scope.row[item.prop]?scope.row[item.prop]:'-'}}
</template>
<template v-if="item.prop == 'token'">
<div class="document-copy-block">
<span class="document-copy-text"> {{scope.row[item.prop]?scope.row[item.prop].replace(reg, '*'):'-'}}</span>
<i v-if="scope.row[item.prop]" class="nz-icon nz-icon-override" style="visibility: hidden" @click="onCopy(scope.row[item.prop])" :title="$t('overall.copyText')"></i>
</div>
<copy :copyData='scope.row[item.prop]' :showInfo='scope.row.name'>
<template slot="copy-text">
{{scope.row[item.prop]?scope.row[item.prop].replace(reg, '*'):'-'}}
</template>
</copy>
</template>
<template v-if="item.prop == 'expireAt'">
{{scope.row[item.prop]?utcTimeToTimezoneStr(scope.row[item.prop]):'-'}}
@@ -100,12 +101,13 @@
import { tableCommon } from './systemCommon'
import table from '@/components/common/mixin/table'
import deleteButton from '@/components/common/deleteButton'
import copy from '@/components/common/copy'
export default {
name: 'selfApiKeyTable',
props: {
loading: Boolean
},
components: { deleteButton },
components: { deleteButton, copy },
mixins: [table, tableCommon],
data () {
return {