first commit
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<template>
|
||||
<el-button @click="handleCopy">复制数据</el-button>
|
||||
</template>
|
||||
|
||||
<script setup lang='ts'>
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
//一键复制代码
|
||||
function handleCopy() {
|
||||
if (!props.model) return
|
||||
|
||||
const data = [
|
||||
`客户名称: ${props.model.name || '-'}`,
|
||||
`联系人: ${props.model.contact || '-'}`,
|
||||
`电话: ${props.model.phone || '-'}`,
|
||||
`邮箱: ${props.model.email || '-'}`,
|
||||
`客户类型: ${getLabel(customerTypeOptions.value, props.model.customer_type)}`,
|
||||
`客户等级: ${getLabel(customerLevelOptions.value, props.model.customer_level)}`,
|
||||
`所属行业: ${getLabel(industryOptions.value, props.model.industry)}`,
|
||||
`客户状态: ${getLabel(customerStatusOptions.value, String(props.model.status ?? '')) || ((props.model.status===1||props.model.status==='1') ? '正常' : '停用')}`,
|
||||
`地址: ${props.model.address || '-'}`,
|
||||
`经营范围: ${props.model.business_scope || '-'}`
|
||||
].join('\n')
|
||||
|
||||
navigator.clipboard.writeText(data).then(() => {
|
||||
ElMessage.success('数据已复制到剪贴板')
|
||||
}).catch(() => {
|
||||
ElMessage.error('复制失败')
|
||||
})
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user