复制id功能
This commit is contained in:
@@ -103,7 +103,8 @@ const open = async (type: string, id?: number, index?: number) => {
|
||||
formData.value = await EmployeeHostsApi.getEmployeeHosts(id)
|
||||
getStrDictOptions(DICT_TYPE.OPERATION_STATE).forEach(item => {
|
||||
if (item.value == formData.value.operationStatus) {
|
||||
formData.value.operationStatus = item.label
|
||||
console.log("item", item)
|
||||
formData.value.operationStatus = item.value
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
@@ -115,6 +115,12 @@
|
||||
{{ scope.row.hostsId }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" prop="hostsId" width="75">
|
||||
<template #default="scope">
|
||||
<el-link type="primary" @click="handleCopy(scope.row.hostsId)">复制</el-link>
|
||||
</template>
|
||||
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('employee.hostsLevel')" align="center" prop="hostsLevel" />
|
||||
<el-table-column :label="$t('employee.invitationType')" align="center" prop="invitationType">
|
||||
<template #default="scope">
|
||||
@@ -151,9 +157,12 @@
|
||||
<!-- ✅ 移动端使用卡片列表 -->
|
||||
<div v-else v-infinite-scroll="loadList">
|
||||
<div v-for="(item, index) in list" :key="index" class="mobile-card">
|
||||
<div class="card-row" @click="openHtml(item, item.hostsId)" style="color:green;">
|
||||
<b>{{ $t('employee.hostsId') }}:</b><span style=" text-decoration: underline;">{{ item.hostsId }}</span>
|
||||
<div class="card-row" style="color:green;">
|
||||
<b>{{ $t('employee.hostsId') }}:</b><span @click="openHtml(item, item.hostsId)"
|
||||
style=" text-decoration: underline;margin-right: 50px;">{{ item.hostsId }}</span>
|
||||
<el-link @click="handleCopy(item.hostsId)" type="primary">复制id</el-link>
|
||||
</div>
|
||||
|
||||
<!-- <div class="card-row"><b>{{ $t('employee.userId') }}:</b>{{ item.userId }}</div> -->
|
||||
<div class="card-row"><b>{{ $t('employee.hostsLevel') }}:</b>{{ item.hostsLevel }}</div>
|
||||
<div class="card-row"><b>{{ $t('employee.hostsCoins') }}:</b>{{ item.hostsCoins }}</div>
|
||||
@@ -426,6 +435,29 @@ function AllocationFun() {
|
||||
console.log(selectHostList.value)
|
||||
}
|
||||
|
||||
function handleCopy(text) {
|
||||
// fallback 兼容方案
|
||||
const textarea = document.createElement('textarea')
|
||||
textarea.value = text
|
||||
textarea.style.position = 'fixed' // 避免跳动
|
||||
textarea.style.opacity = '0'
|
||||
document.body.appendChild(textarea)
|
||||
textarea.select()
|
||||
try {
|
||||
const result = document.execCommand('copy')
|
||||
if (result) {
|
||||
ElMessage.success('✅复制成功 ')
|
||||
} else {
|
||||
ElMessage.error('❌复制失败')
|
||||
}
|
||||
} catch (err) {
|
||||
ElMessage.error('❌复制异常')
|
||||
console.error(err)
|
||||
} finally {
|
||||
document.body.removeChild(textarea)
|
||||
}
|
||||
}
|
||||
|
||||
const isMobile = ref(window.innerWidth <= 768)
|
||||
|
||||
onMounted(() => {
|
||||
|
||||
@@ -324,7 +324,8 @@ function AllocationFun() {
|
||||
selectBigList.value.forEach(element => {
|
||||
data.push({
|
||||
id: element.id,
|
||||
userId: allocationUser.value
|
||||
userId: allocationUser.value,
|
||||
operationStatus: 0
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -103,7 +103,9 @@ const open = async (type: string, id?: number, index?: number) => {
|
||||
formData.value = await EmployeeHostsApi.getEmployeeHosts(id)
|
||||
getStrDictOptions(DICT_TYPE.OPERATION_STATE).forEach(item => {
|
||||
if (item.value == formData.value.operationStatus) {
|
||||
formData.value.operationStatus = item.label
|
||||
console.log("item", item)
|
||||
|
||||
formData.value.operationStatus = item.value
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
@@ -114,6 +114,12 @@
|
||||
{{ scope.row.hostsId }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" prop="hostsId" width="75">
|
||||
<template #default="scope">
|
||||
<el-link type="primary" @click="handleCopy(scope.row.hostsId)">复制</el-link>
|
||||
</template>
|
||||
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('employee.hostsLevel')" align="center" prop="hostsLevel" />
|
||||
<el-table-column :label="$t('employee.invitationType')" align="center" prop="invitationType">
|
||||
<template #default="scope">
|
||||
@@ -150,9 +156,12 @@
|
||||
<!-- ✅ 移动端使用卡片列表 -->
|
||||
<div v-else v-infinite-scroll="loadList">
|
||||
<div v-for="(item, index) in list" :key="index" class="mobile-card">
|
||||
<div class="card-row" @click="openHtml(item, item.hostsId)" style="color:green;">
|
||||
<b>{{ $t('employee.hostsId') }}:</b><span style=" text-decoration: underline;">{{ item.hostsId }}</span>
|
||||
<div class="card-row" style="color:green;">
|
||||
<b>{{ $t('employee.hostsId') }}:</b><span @click="openHtml(item, item.hostsId)"
|
||||
style=" text-decoration: underline;margin-right: 50px;">{{ item.hostsId }}</span>
|
||||
<el-link @click="handleCopy(item.hostsId)" type="primary">复制id</el-link>
|
||||
</div>
|
||||
|
||||
<!-- <div class="card-row"><b>{{ $t('employee.userId') }}:</b>{{ item.userId }}</div> -->
|
||||
<div class="card-row"><b>{{ $t('employee.hostsLevel') }}:</b>{{ item.hostsLevel }}</div>
|
||||
<div class="card-row"><b>uid:</b>{{ item.uid }}</div>
|
||||
@@ -416,7 +425,8 @@ function AllocationFun() {
|
||||
selectHostList.value.forEach(element => {
|
||||
data.push({
|
||||
id: element.id,
|
||||
userId: allocationUser.value
|
||||
userId: allocationUser.value,
|
||||
operationStatus: 0
|
||||
})
|
||||
})
|
||||
|
||||
@@ -429,6 +439,30 @@ function AllocationFun() {
|
||||
dialogAllocation.value = false
|
||||
}
|
||||
|
||||
|
||||
function handleCopy(text) {
|
||||
// fallback 兼容方案
|
||||
const textarea = document.createElement('textarea')
|
||||
textarea.value = text
|
||||
textarea.style.position = 'fixed' // 避免跳动
|
||||
textarea.style.opacity = '0'
|
||||
document.body.appendChild(textarea)
|
||||
textarea.select()
|
||||
try {
|
||||
const result = document.execCommand('copy')
|
||||
if (result) {
|
||||
ElMessage.success('✅复制成功 ')
|
||||
} else {
|
||||
ElMessage.error('❌复制失败')
|
||||
}
|
||||
} catch (err) {
|
||||
ElMessage.error('❌复制异常')
|
||||
console.error(err)
|
||||
} finally {
|
||||
document.body.removeChild(textarea)
|
||||
}
|
||||
}
|
||||
|
||||
const isMobile = ref(window.innerWidth <= 768)
|
||||
|
||||
onMounted(() => {
|
||||
|
||||
@@ -113,12 +113,12 @@
|
||||
:label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('newHosts.allocationUser')" prop="allocationUser">
|
||||
<!-- <el-form-item :label="t('newHosts.allocationUser')" prop="allocationUser">
|
||||
<el-select v-model="queryParams.userId" :placeholder="t('newHosts.placeAllocationUser')" clearable
|
||||
class="!w-240px">
|
||||
<el-option v-for="(user, index) in allocationUserList" :key="index" :label="user.label" :value="user.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
<el-form-item>
|
||||
<el-button @click="handleQuery">
|
||||
<Icon icon="ep:search" class="mr-5px" /> {{ t('newHosts.search') }}
|
||||
@@ -149,6 +149,12 @@
|
||||
<el-table v-loading="loading" :data="list" :stripe="true" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column :label="t('newHosts.hostsId')" align="center" prop="hostsId" />
|
||||
<el-table-column align="center" prop="hostsId" width="75">
|
||||
<template #default="scope">
|
||||
<el-link type="primary" @click="handleCopy(scope.row.hostsId)">复制</el-link>
|
||||
</template>
|
||||
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('newHosts.hostsLevel')" sortable align="center" prop="hostsLevel" />
|
||||
<el-table-column :label="t('newHosts.invitationType')" align="center" prop="invitationType">
|
||||
<template #default="scope">
|
||||
@@ -402,7 +408,28 @@ function AllocationFun() {
|
||||
getList()
|
||||
})
|
||||
}
|
||||
|
||||
function handleCopy(text) {
|
||||
// fallback 兼容方案
|
||||
const textarea = document.createElement('textarea')
|
||||
textarea.value = text
|
||||
textarea.style.position = 'fixed' // 避免跳动
|
||||
textarea.style.opacity = '0'
|
||||
document.body.appendChild(textarea)
|
||||
textarea.select()
|
||||
try {
|
||||
const result = document.execCommand('copy')
|
||||
if (result) {
|
||||
ElMessage.success('✅复制成功 ')
|
||||
} else {
|
||||
ElMessage.error('❌复制失败')
|
||||
}
|
||||
} catch (err) {
|
||||
ElMessage.error('❌复制异常')
|
||||
console.error(err)
|
||||
} finally {
|
||||
document.body.removeChild(textarea)
|
||||
}
|
||||
}
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(() => {
|
||||
|
||||
Reference in New Issue
Block a user