chore: 🔨 分享文档链接按钮 (#224)

Co-authored-by: tk <fiyne1a@dingtalk.com>
This commit is contained in:
nsnail 2024-11-27 16:54:15 +08:00 committed by GitHub
parent e8b568426b
commit 440c7ffcb9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 40 additions and 13 deletions

View File

@ -18,8 +18,14 @@
size="small"></el-button> size="small"></el-button>
</template> </template>
</el-popconfirm> </el-popconfirm>
<el-button v-else v-loading="loading" :icon="item.icon" :title="item.title" @click="click(item, row, vue)" size="small" <el-button
>{{ item.title }} v-else
v-loading="loading"
:icon="item.icon"
:title="item.title"
:type="item.type"
@click="click(item, row, vue)"
size="small">
</el-button> </el-button>
</template> </template>
</el-button-group> </el-button-group>

View File

@ -48,7 +48,7 @@
</div> </div>
<div class="right-panel"> <div class="right-panel">
<el-button <el-button
@click="(this.dialog.save = { mode: 'add', data: { catalogId: this.catalogId } })" @click="this.dialog.save = { mode: 'add', data: { catalogId: this.catalogId } }"
icon="el-icon-plus" icon="el-icon-plus"
type="primary"></el-button> type="primary"></el-button>
<na-button-bulk-del :api="$API.sys_doc.bulkDeleteContent" :vue="this" /> <na-button-bulk-del :api="$API.sys_doc.bulkDeleteContent" :vue="this" />
@ -107,23 +107,30 @@
</el-table-column> </el-table-column>
<na-col-operation <na-col-operation
:buttons=" :buttons="
naColOperation.buttons.concat({ naColOperation.buttons.concat([
{
icon: 'el-icon-share',
click: share,
title: '删除文档',
},
{
icon: 'el-icon-delete', icon: 'el-icon-delete',
confirm: true, confirm: true,
title: '删除文档', title: '删除文档',
click: rowDel, click: rowDel,
type: 'danger', type: 'danger',
}) },
])
" "
:vue="this" :vue="this"
width="150" /> width="180" />
</sc-table> </sc-table>
</el-main> </el-main>
</el-container> </el-container>
<save-dialog <save-dialog
v-if="dialog.save" v-if="dialog.save"
@closed="(dialog.save = null)" @closed="dialog.save = null"
@mounted="$refs.saveDialog.open(dialog.save)" @mounted="$refs.saveDialog.open(dialog.save)"
@success="(data, mode) => table.handleUpdate($refs.table, data, mode)" @success="(data, mode) => table.handleUpdate($refs.table, data, mode)"
ref="saveDialog"></save-dialog> ref="saveDialog"></save-dialog>
@ -232,7 +239,21 @@ export default {
this.$refs.table.upData() this.$refs.table.upData()
}, },
async share(row) {
const textarea = document.createElement('textarea')
textarea.readOnly = 'readonly'
textarea.style.position = 'absolute'
textarea.style.left = '-9999px'
textarea.value = window.location.origin + `/guest/view-doc/${row.id}`
document.body.appendChild(textarea)
textarea.select()
textarea.setSelectionRange(0, textarea.value.length)
const result = document.execCommand('Copy')
if (result) {
this.$message.success(this.$t('文档链接已复制'))
}
document.body.removeChild(textarea)
},
// //
async rowDel(row) { async rowDel(row) {
try { try {