mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
perf: 优化函数复制功能
This commit is contained in:
parent
9ac6c84b01
commit
c3b2838955
|
|
@ -134,6 +134,7 @@ watch(dialogVisible, (bool) => {
|
|||
const open = (data: any) => {
|
||||
const obj = cloneDeep(data)
|
||||
delete obj['id']
|
||||
obj['name'] = obj['name'] + ' 副本'
|
||||
applicationForm.value = obj
|
||||
dialogVisible.value = true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<el-drawer v-model="visible" size="60%">
|
||||
<template #header>
|
||||
<h4>{{ isEdit ? '编辑函数' : '创建函数' }}</h4>
|
||||
<h4>{{ title }}</h4>
|
||||
</template>
|
||||
<div>
|
||||
<h4 class="title-decoration-1 mb-16">基础信息</h4>
|
||||
|
|
@ -120,6 +120,10 @@ import type { FormInstance } from 'element-plus'
|
|||
import { MsgSuccess, MsgError } from '@/utils/message'
|
||||
import { cloneDeep } from 'lodash'
|
||||
|
||||
const props = defineProps({
|
||||
title: String
|
||||
})
|
||||
|
||||
const emit = defineEmits(['refresh'])
|
||||
const FieldFormDialogRef = ref()
|
||||
const FunctionDebugDrawerRef = ref()
|
||||
|
|
@ -182,10 +186,6 @@ function refreshFieldList(data: any) {
|
|||
currentIndex.value = null
|
||||
}
|
||||
|
||||
// function changeCode(value: string) {
|
||||
// form.value.code = value
|
||||
// }
|
||||
|
||||
const submit = async (formEl: FormInstance | undefined) => {
|
||||
if (!formEl) return
|
||||
await formEl.validate((valid: any) => {
|
||||
|
|
@ -209,7 +209,7 @@ const submit = async (formEl: FormInstance | undefined) => {
|
|||
|
||||
const open = (data: any) => {
|
||||
if (data) {
|
||||
isEdit.value = true
|
||||
isEdit.value = data?.id ? true : false
|
||||
form.value = cloneDeep(data)
|
||||
}
|
||||
visible.value = true
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@
|
|||
</el-row>
|
||||
</InfiniteScroll>
|
||||
</div>
|
||||
<FunctionFormDrawer ref="FunctionFormDrawerRef" @refresh="refresh" />
|
||||
<FunctionFormDrawer ref="FunctionFormDrawerRef" @refresh="refresh" :title="title" />
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
|
|
@ -88,8 +88,10 @@ const paginationConfig = reactive({
|
|||
})
|
||||
|
||||
const searchValue = ref('')
|
||||
const title = ref('')
|
||||
|
||||
function openCreateDialog(data?: any) {
|
||||
title.value = data ? '编辑函数' : '创建函数'
|
||||
FunctionFormDrawerRef.value.open(data)
|
||||
}
|
||||
|
||||
|
|
@ -121,15 +123,11 @@ function deleteFunctionLib(row: any) {
|
|||
}
|
||||
|
||||
function copyFunctionLib(row: any) {
|
||||
title.value = '复制函数'
|
||||
const obj = cloneDeep(row)
|
||||
delete obj['id']
|
||||
functionLibApi.postFunctionLib(obj, loading).then((res) => {
|
||||
MsgSuccess('复制成功')
|
||||
paginationConfig.total = 0
|
||||
paginationConfig.current_page = 1
|
||||
functionLibList.value = []
|
||||
getList()
|
||||
})
|
||||
obj['name'] = obj['name'] + ' 副本'
|
||||
FunctionFormDrawerRef.value.open(obj)
|
||||
}
|
||||
|
||||
function getList() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue