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"> <span class="document-copy-text">
<slot name="copy-text"></slot> <slot name="copy-text"></slot>
</span> </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> </div>
</template> </template>
@@ -11,7 +11,8 @@
export default { export default {
name: 'copy', name: 'copy',
props: { props: {
copyData: String copyData: String,
showInfo: String
}, },
data () { data () {
return { return {

View File

@@ -44,14 +44,14 @@
<span class="document-copy-text">{{scope.row.name ? scope.row.name : '-'}}</span> <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> <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> --> </div> -->
<copy :copyData='scope.row.name'> <copy :copyData='scope.row.name' :showInfo='scope.row.name'>
<template slot="copy-text"> <template slot="copy-text">
{{scope.row.name ? scope.row.name : '-'}} {{scope.row.name ? scope.row.name : '-'}}
</template> </template>
</copy> </copy>
</template> </template>
<template v-else-if="item.prop === 'manageIp'"> <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"> <template slot="copy-text">
{{scope.row.manageIp ? scope.row.manageIp : '-'}} {{scope.row.manageIp ? scope.row.manageIp : '-'}}
</template> </template>

View File

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

View File

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

View File

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

View File

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

View File

@@ -40,10 +40,11 @@
{{scope.row[item.prop]?scope.row[item.prop]:'-'}} {{scope.row[item.prop]?scope.row[item.prop]:'-'}}
</template> </template>
<template v-if="item.prop == 'token'"> <template v-if="item.prop == 'token'">
<div class="document-copy-block"> <copy :copyData='scope.row[item.prop]' :showInfo='scope.row.name'>
<span class="document-copy-text"> {{scope.row[item.prop]?scope.row[item.prop].replace(reg, '*'):'-'}}</span> <template slot="copy-text">
<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> {{scope.row[item.prop]?scope.row[item.prop].replace(reg, '*'):'-'}}
</div> </template>
</copy>
</template> </template>
<template v-if="item.prop == 'expireAt'"> <template v-if="item.prop == 'expireAt'">
{{scope.row[item.prop]?utcTimeToTimezoneStr(scope.row[item.prop]):'-'}} {{scope.row[item.prop]?utcTimeToTimezoneStr(scope.row[item.prop]):'-'}}
@@ -100,12 +101,13 @@
import { tableCommon } from './systemCommon' import { tableCommon } from './systemCommon'
import table from '@/components/common/mixin/table' import table from '@/components/common/mixin/table'
import deleteButton from '@/components/common/deleteButton' import deleteButton from '@/components/common/deleteButton'
import copy from '@/components/common/copy'
export default { export default {
name: 'selfApiKeyTable', name: 'selfApiKeyTable',
props: { props: {
loading: Boolean loading: Boolean
}, },
components: { deleteButton }, components: { deleteButton, copy },
mixins: [table, tableCommon], mixins: [table, tableCommon],
data () { data () {
return { return {