feat: 函数库增加复制功能

This commit is contained in:
wangdan-fit2cloud 2024-08-15 19:00:56 +08:00 committed by wangdan-fit2cloud
parent 845ee524c4
commit 5681d2d895
2 changed files with 14 additions and 3 deletions

View File

@ -141,7 +141,7 @@ const form = ref<functionLibData>({
watch(visible, (bool) => {
if (!bool) {
isEdit.value = false
showEditor.value = true
showEditor.value = false
currentIndex.value = null
form.value = {
name: '',

View File

@ -49,7 +49,7 @@
<template #footer>
<div class="footer-content">
<el-tooltip effect="dark" content="复制" placement="top">
<el-button text>
<el-button text @click.stop="copyFunctionLib(item)">
<AppIcon iconName="app-copy"></AppIcon>
</el-button>
</el-tooltip>
@ -73,7 +73,7 @@
import { ref, onMounted, reactive } from 'vue'
import functionLibApi from '@/api/function-lib'
import FunctionFormDrawer from './component/FunctionFormDrawer.vue'
import { MsgSuccess, MsgError } from '@/utils/message'
const loading = ref(false)
const FunctionFormDrawerRef = ref()
@ -114,6 +114,17 @@ function deleteFunctionLib(row: any) {
// .catch(() => {})
}
function copyFunctionLib(row: any) {
delete row['id']
functionLibApi.postFunctionLib(row, loading).then((res) => {
MsgSuccess('复制成功')
paginationConfig.total = 0
paginationConfig.current_page = 1
functionLibList.value = []
getList()
})
}
function getList() {
functionLibApi
.getFunctionLib(paginationConfig, searchValue.value && { name: searchValue.value }, loading)