perf : issue 、recordRule 页面复制功能组件化
This commit is contained in:
32
nezha-fronted/src/components/common/copy.vue
Normal file
32
nezha-fronted/src/components/common/copy.vue
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<template>
|
||||||
|
<div class="document-copy-block">
|
||||||
|
<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>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'copy',
|
||||||
|
props: {
|
||||||
|
copyData: String
|
||||||
|
},
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
onCopy (txt) {
|
||||||
|
this.$copyText(txt).then(() => {
|
||||||
|
this.$message.success({ message: this.$t('overall.copySuccess') })
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -37,16 +37,18 @@
|
|||||||
</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'">
|
||||||
<div class="document-copy-block">
|
<copy :copyData='scope.row.name'>
|
||||||
<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.name ? scope.row.name : '-'}}
|
||||||
</div>
|
</template>
|
||||||
|
</copy>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="item.prop === 'type'">
|
<template v-else-if="item.prop === 'type'">
|
||||||
<div class="document-copy-block">
|
<copy :copyData='scope.row.type'>
|
||||||
<span class="document-copy-text">{{scope.row.type ? scope.row.type : '-'}}</span>
|
<template slot="copy-text">
|
||||||
<i v-if="scope.row.type" class="nz-icon nz-icon-override" style="visibility: hidden" @click="onCopy(scope.row.type)" :title="$t('overall.copyText')"></i>
|
{{scope.row.type ? scope.row.type : '-'}}
|
||||||
</div>
|
</template>
|
||||||
|
</copy>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="item.prop === 'reporter'">
|
<template v-else-if="item.prop === 'reporter'">
|
||||||
<template>{{scope.row[item.prop] ? scope.row[item.prop].name : '-'}}</template>
|
<template>{{scope.row[item.prop] ? scope.row[item.prop].name : '-'}}</template>
|
||||||
@@ -120,9 +122,14 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import table from '@/components/common/mixin/table'
|
import table from '@/components/common/mixin/table'
|
||||||
|
import copy from '@/components/common/copy'
|
||||||
export default {
|
export default {
|
||||||
name: 'issueTable',
|
name: 'issueTable',
|
||||||
mixins: [table],
|
mixins: [table],
|
||||||
|
components: {
|
||||||
|
copy
|
||||||
|
},
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
loading: Boolean
|
loading: Boolean
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -38,10 +38,11 @@
|
|||||||
</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'">
|
||||||
<div class="document-copy-block">
|
<copy :copyData='scope.row.name'>
|
||||||
<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.name ? scope.row.name : '-'}}
|
||||||
</div>
|
</template>
|
||||||
|
</copy>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="item.prop === 'type'">
|
<template v-else-if="item.prop === 'type'">
|
||||||
<template v-if="scope.row[item.prop]">
|
<template v-if="scope.row[item.prop]">
|
||||||
@@ -51,10 +52,11 @@
|
|||||||
<template v-else>{{"-"}}</template>
|
<template v-else>{{"-"}}</template>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="item.prop === 'expr'">
|
<template v-else-if="item.prop === 'expr'">
|
||||||
<div class="document-copy-block">
|
<copy :copyData='scope.row[item.prop]'>
|
||||||
<span class="document-copy-text">{{scope.row[item.prop] ? scope.row[item.prop] : '-'}}</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] : '-'}}
|
||||||
</div>
|
</template>
|
||||||
|
</copy>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="item.prop === 'inr'">
|
<template v-else-if="item.prop === 'inr'">
|
||||||
<template>{{scope.row[item.prop] ? scope.row[item.prop] : '-'}}</template>
|
<template>{{scope.row[item.prop] ? scope.row[item.prop] : '-'}}</template>
|
||||||
@@ -134,13 +136,15 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import lodash from 'lodash'
|
import lodash from 'lodash'
|
||||||
|
import copy from '@/components/common/copy'
|
||||||
import table from '@/components/common/mixin/table'
|
import table from '@/components/common/mixin/table'
|
||||||
import nzAlertTag from '../../../page/alert/nzAlertTag'
|
import nzAlertTag from '../../../page/alert/nzAlertTag'
|
||||||
import alertLabelMixin from '@/components/common/mixin/alertLabelMixin'
|
import alertLabelMixin from '@/components/common/mixin/alertLabelMixin'
|
||||||
export default {
|
export default {
|
||||||
name: 'recordRuleTable',
|
name: 'recordRuleTable',
|
||||||
components: {
|
components: {
|
||||||
nzAlertTag
|
nzAlertTag,
|
||||||
|
copy
|
||||||
},
|
},
|
||||||
mixins: [table, alertLabelMixin],
|
mixins: [table, alertLabelMixin],
|
||||||
props: {
|
props: {
|
||||||
|
|||||||
Reference in New Issue
Block a user