feat: Internal function can modify names
This commit is contained in:
parent
e7e4570aeb
commit
5ceb8a7ff9
@ -33,6 +33,7 @@ export default {
|
|||||||
form: {
|
form: {
|
||||||
functionName: {
|
functionName: {
|
||||||
label: 'Name',
|
label: 'Name',
|
||||||
|
name: 'Function Name',
|
||||||
placeholder: 'Please enter the function name',
|
placeholder: 'Please enter the function name',
|
||||||
requiredMessage: 'Please enter the function name'
|
requiredMessage: 'Please enter the function name'
|
||||||
},
|
},
|
||||||
|
|||||||
@ -31,6 +31,7 @@ export default {
|
|||||||
form: {
|
form: {
|
||||||
functionName: {
|
functionName: {
|
||||||
label: '名称',
|
label: '名称',
|
||||||
|
name: '函数名称',
|
||||||
placeholder: '请输入函数名称',
|
placeholder: '请输入函数名称',
|
||||||
requiredMessage: '请输入函数名称'
|
requiredMessage: '请输入函数名称'
|
||||||
},
|
},
|
||||||
@ -63,7 +64,7 @@ export default {
|
|||||||
paramInfo2: '使用函数时不显示',
|
paramInfo2: '使用函数时不显示',
|
||||||
code: '函数内容(Python)',
|
code: '函数内容(Python)',
|
||||||
selectPlaceholder: '请选择参数',
|
selectPlaceholder: '请选择参数',
|
||||||
inputPlaceholder: '请输入参数值',
|
inputPlaceholder: '请输入参数值'
|
||||||
},
|
},
|
||||||
debug: {
|
debug: {
|
||||||
run: '运行',
|
run: '运行',
|
||||||
|
|||||||
@ -31,6 +31,7 @@ export default {
|
|||||||
form: {
|
form: {
|
||||||
functionName: {
|
functionName: {
|
||||||
label: '名稱',
|
label: '名稱',
|
||||||
|
name: '函數名稱',
|
||||||
placeholder: '請輸入函數名稱',
|
placeholder: '請輸入函數名稱',
|
||||||
requiredMessage: '請輸入函數名稱'
|
requiredMessage: '請輸入函數名稱'
|
||||||
},
|
},
|
||||||
@ -63,7 +64,7 @@ export default {
|
|||||||
paramInfo2: '使用函數時不顯示',
|
paramInfo2: '使用函數時不顯示',
|
||||||
code: '函数内容(Python)',
|
code: '函数内容(Python)',
|
||||||
selectPlaceholder: '請选择參數',
|
selectPlaceholder: '請选择參數',
|
||||||
inputPlaceholder: '請輸入參數值',
|
inputPlaceholder: '請輸入參數值'
|
||||||
},
|
},
|
||||||
debug: {
|
debug: {
|
||||||
run: '運行',
|
run: '運行',
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog
|
<el-dialog
|
||||||
:title="$t('views.functionLib.functionForm.form.functionName.placeholder')"
|
:title="$t('views.functionLib.functionForm.form.functionName.name')"
|
||||||
v-model="dialogVisible"
|
v-model="dialogVisible"
|
||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
:close-on-press-escape="false"
|
:close-on-press-escape="false"
|
||||||
@ -23,7 +23,7 @@
|
|||||||
<span class="dialog-footer">
|
<span class="dialog-footer">
|
||||||
<el-button @click.prevent="dialogVisible = false"> {{ $t('common.cancel') }} </el-button>
|
<el-button @click.prevent="dialogVisible = false"> {{ $t('common.cancel') }} </el-button>
|
||||||
<el-button type="primary" @click="submit(fieldFormRef)" :loading="loading">
|
<el-button type="primary" @click="submit(fieldFormRef)" :loading="loading">
|
||||||
{{ $t('common.add') }}
|
{{ isEdit ? $t('common.save') : $t('common.add') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
@ -39,6 +39,7 @@ const emit = defineEmits(['refresh'])
|
|||||||
|
|
||||||
const fieldFormRef = ref()
|
const fieldFormRef = ref()
|
||||||
const loading = ref<boolean>(false)
|
const loading = ref<boolean>(false)
|
||||||
|
const isEdit = ref<boolean>(false)
|
||||||
|
|
||||||
const form = ref<any>({
|
const form = ref<any>({
|
||||||
name: ''
|
name: ''
|
||||||
@ -64,11 +65,11 @@ watch(dialogVisible, (bool) => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const open = (row: any) => {
|
const open = (row: any, edit: boolean) => {
|
||||||
if (row) {
|
if (row) {
|
||||||
form.value = cloneDeep(row)
|
form.value = cloneDeep(row)
|
||||||
}
|
}
|
||||||
|
isEdit.value = edit || false
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,7 +77,7 @@ const submit = async (formEl: FormInstance | undefined) => {
|
|||||||
if (!formEl) return
|
if (!formEl) return
|
||||||
await formEl.validate((valid) => {
|
await formEl.validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
emit('refresh', form.value)
|
emit('refresh', form.value, isEdit.value)
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -1,12 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="function-lib-list-container p-24" style="padding-top: 16px">
|
<div class="function-lib-list-container p-24" style="padding-top: 16px">
|
||||||
<el-tabs
|
<el-tabs v-model="functionType" @tab-change="tabChangeHandle">
|
||||||
v-model="functionType"
|
|
||||||
@tab-change="
|
|
||||||
tabChangeHandle
|
|
||||||
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<el-tab-pane :label="$t('views.functionLib.title')" name="PUBLIC"></el-tab-pane>
|
<el-tab-pane :label="$t('views.functionLib.title')" name="PUBLIC"></el-tab-pane>
|
||||||
<el-tab-pane :label="$t('views.functionLib.internalTitle')" name="INTERNAL"></el-tab-pane>
|
<el-tab-pane :label="$t('views.functionLib.internalTitle')" name="INTERNAL"></el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
@ -165,6 +159,14 @@
|
|||||||
</el-button>
|
</el-button>
|
||||||
<template #dropdown>
|
<template #dropdown>
|
||||||
<el-dropdown-menu>
|
<el-dropdown-menu>
|
||||||
|
<el-dropdown-item
|
||||||
|
v-if="item.template_id"
|
||||||
|
:disabled="item.permission_type === 'PUBLIC' && !canEdit(item)"
|
||||||
|
@click.stop="addInternalFunction(item, true)"
|
||||||
|
>
|
||||||
|
<el-icon><EditPen /></el-icon>
|
||||||
|
{{ $t('common.edit') }}
|
||||||
|
</el-dropdown-item>
|
||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
v-if="!item.template_id"
|
v-if="!item.template_id"
|
||||||
:disabled="item.permission_type === 'PUBLIC' && !canEdit(item)"
|
:disabled="item.permission_type === 'PUBLIC' && !canEdit(item)"
|
||||||
@ -366,18 +368,25 @@ async function openDescDrawer(row: any) {
|
|||||||
InternalDescDrawerRef.value.open(content, row)
|
InternalDescDrawerRef.value.open(content, row)
|
||||||
}
|
}
|
||||||
|
|
||||||
function addInternalFunction(data?: any) {
|
function addInternalFunction(data?: any, isEdit?: boolean) {
|
||||||
AddInternalFunctionDialogRef.value.open(data)
|
AddInternalFunctionDialogRef.value.open(data, isEdit)
|
||||||
}
|
}
|
||||||
|
|
||||||
function confirmAddInternalFunction(data?: any) {
|
function confirmAddInternalFunction(data?: any, isEdit?: boolean) {
|
||||||
|
if (isEdit) {
|
||||||
|
functionLibApi.putFunctionLib(data?.id as string, data, loading).then((res) => {
|
||||||
|
MsgSuccess(t('common.saveSuccess'))
|
||||||
|
searchHandle()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
functionLibApi
|
functionLibApi
|
||||||
.addInternalFunction(data.id, { name: data.name }, changeStateloading)
|
.addInternalFunction(data.id, { name: data.name }, changeStateloading)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
MsgSuccess(t('common.submitSuccess'))
|
MsgSuccess(t('common.addSuccess'))
|
||||||
searchHandle()
|
searchHandle()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function searchHandle() {
|
function searchHandle() {
|
||||||
if (user.userInfo) {
|
if (user.userInfo) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user