diff --git a/ui/src/locales/lang/en-US/common.ts b/ui/src/locales/lang/en-US/common.ts index 0da8035d6..527f0967d 100644 --- a/ui/src/locales/lang/en-US/common.ts +++ b/ui/src/locales/lang/en-US/common.ts @@ -48,6 +48,7 @@ export default { }, status: { label: 'Status', + disable: 'Disable', enabled: 'Enabled', disabled: 'Disabled', enableSuccess: 'Successful', diff --git a/ui/src/locales/lang/en-US/views/function-lib.ts b/ui/src/locales/lang/en-US/views/function-lib.ts deleted file mode 100644 index 1ca7103b3..000000000 --- a/ui/src/locales/lang/en-US/views/function-lib.ts +++ /dev/null @@ -1,79 +0,0 @@ -export default { - title: 'Function', - internalTitle: 'Internal Function', - added: 'Added', - createFunction: 'Create Function', - editFunction: 'Edit Function', - copyFunction: 'Copy Function', - importFunction: 'Import Function', - searchBar: { - placeholder: 'Search by function name' - }, - setting: { - disabled: 'Disabled' - }, - tip: { - saveMessage: 'Unsaved changes will be lost. Are you sure you want to exit?' - }, - delete: { - confirmTitle: 'Confirm deletion of function:', - confirmMessage: - 'Deleting this function will cause errors in APP that reference it when they are queried. Please proceed with caution.' - }, - disabled: { - confirmTitle: 'Confirm disable function:', - confirmMessage: - 'Disabling this function will cause errors in APP that reference it when they are queried. Please proceed with caution.' - }, - functionForm: { - title: { - copy: 'Copy', - baseInfo: 'Basic Information' - }, - form: { - functionName: { - label: 'Name', - placeholder: 'Please enter the function name', - requiredMessage: 'Please enter the function name' - }, - functionDescription: { - label: 'Description', - placeholder: 'Please enter a description of the function' - }, - permission_type: { - label: 'Permissions', - requiredMessage: 'Please select' - }, - paramName: { - label: 'Parameter Name', - placeholder: 'Please enter the parameter name', - requiredMessage: 'Please enter the parameter name' - }, - dataType: { - label: 'Data Type' - }, - source: { - label: 'Source', - custom: 'Custom', - reference: 'Reference Parameter' - }, - required: { - label: 'Required' - }, - param: { - paramInfo1: 'Displayed when using the function', - paramInfo2: 'Not displayed when using the function', - code: 'Content (Python)', - selectPlaceholder: 'Please select parameter', - inputPlaceholder: 'Please enter parameter values', - }, - debug: { - run: 'Run', - output: 'Output', - runResult: 'Run Result', - runSuccess: 'Successful', - runFailed: 'Run Failed' - } - } - } -} diff --git a/ui/src/locales/lang/en-US/views/index.ts b/ui/src/locales/lang/en-US/views/index.ts index 993e5fe93..96f0b6360 100644 --- a/ui/src/locales/lang/en-US/views/index.ts +++ b/ui/src/locales/lang/en-US/views/index.ts @@ -3,7 +3,7 @@ import application from './application' import applicationOverview from './application-overview' import dataset from './dataset' import system from './system' -import functionLib from './function-lib' +import tool from './tool' import user from './user' import team from './team' import model from './model' @@ -19,7 +19,7 @@ export default { application, applicationOverview, system, - functionLib, + tool, user, team, model, diff --git a/ui/src/locales/lang/en-US/views/tool.ts b/ui/src/locales/lang/en-US/views/tool.ts new file mode 100644 index 000000000..6da1a011b --- /dev/null +++ b/ui/src/locales/lang/en-US/views/tool.ts @@ -0,0 +1,67 @@ +export default { + title: 'Tool', + internalTitle: 'Internal Tool', + added: 'Added', + createTool: 'Create Tool', + editTool: 'Edit Tool', + copyTool: 'Copy Tool', + importTool: 'Import Tool', + searchBar: { + placeholder: 'Search by tool name', + }, + tip: { + saveMessage: 'Unsaved changes will be lost. Are you sure you want to exit?', + }, + delete: { + confirmTitle: 'Confirm deletion of tool:', + confirmMessage: + 'Deleting this tool will cause errors in APP that reference it when they are queried. Please proceed with caution.', + }, + disabled: { + confirmTitle: 'Confirm disable tool:', + confirmMessage: + 'Disabling this tool will cause errors in APP that reference it when they are queried. Please proceed with caution.', + }, + + form: { + toolName: { + label: 'Name', + placeholder: 'Please enter the tool name', + requiredMessage: 'Please enter the tool name', + }, + toolDescription: { + label: 'Description', + placeholder: 'Please enter a description of the tool', + }, + paramName: { + label: 'Parameter Name', + placeholder: 'Please enter the parameter name', + requiredMessage: 'Please enter the parameter name', + }, + dataType: { + label: 'Data Type', + }, + source: { + label: 'Source', + custom: 'Custom', + reference: 'Reference Parameter', + }, + required: { + label: 'Required', + }, + param: { + paramInfo1: 'Displayed when using the tool', + paramInfo2: 'Not displayed when using the tool', + code: 'Content (Python)', + selectPlaceholder: 'Please select parameter', + inputPlaceholder: 'Please enter parameter values', + }, + debug: { + run: 'Run', + output: 'Output', + runResult: 'Run Result', + runSuccess: 'Successful', + runFailed: 'Run Failed', + }, + }, +} diff --git a/ui/src/locales/lang/zh-CN/common.ts b/ui/src/locales/lang/zh-CN/common.ts index 9e432bb5a..e81524e7c 100644 --- a/ui/src/locales/lang/zh-CN/common.ts +++ b/ui/src/locales/lang/zh-CN/common.ts @@ -52,6 +52,7 @@ export default { }, status: { label: '状态', + disable: '禁用', enabled: '已启用', disabled: '已禁用', enableSuccess: '启用成功', diff --git a/ui/src/locales/lang/zh-CN/views/index.ts b/ui/src/locales/lang/zh-CN/views/index.ts index be89022bc..a8f343b8d 100644 --- a/ui/src/locales/lang/zh-CN/views/index.ts +++ b/ui/src/locales/lang/zh-CN/views/index.ts @@ -7,7 +7,6 @@ import tool from './tool' // import applicationOverview from './application-overview' // import system from './system' -// import functionLib from './function-lib' // import user from './user' // import team from './team' @@ -27,7 +26,6 @@ export default { // application, // applicationOverview, // system, - // functionLib, // user, // team, // document, diff --git a/ui/src/locales/lang/zh-CN/views/tool.ts b/ui/src/locales/lang/zh-CN/views/tool.ts index ebdfbc3ae..4702ef7e9 100644 --- a/ui/src/locales/lang/zh-CN/views/tool.ts +++ b/ui/src/locales/lang/zh-CN/views/tool.ts @@ -1,3 +1,51 @@ export default { title: '工具', + createTool: '创建工具', + editTool: '编辑工具', + disabled: { + confirmTitle: '是否禁用工具:', + confirmMessage: '禁用后,引用了该工具的应用提问时会报错 ,请谨慎操作。', + }, + form: { + toolName: { + label: '名称', + name: '工具名称', + placeholder: '请输入工具名称', + requiredMessage: '请输入工具名称', + }, + toolDescription: { + label: '描述', + placeholder: '请输入工具的描述', + }, + paramName: { + label: '参数名', + placeholder: '请输入参数名', + requiredMessage: '请输入参数名', + }, + dataType: { + label: '数据类型', + }, + source: { + label: '来源', + custom: '自定义', + reference: '引用参数', + }, + required: { + label: '是否必填', + }, + param: { + paramInfo1: '使用工具时显示', + paramInfo2: '使用工具时不显示', + code: '工具内容(Python)', + selectPlaceholder: '请选择参数', + inputPlaceholder: '请输入参数值', + }, + debug: { + run: '运行', + output: '输出', + runResult: '运行结果', + runSuccess: '运行成功', + runFailed: '运行失败', + }, + }, } diff --git a/ui/src/locales/lang/zh-Hant/common.ts b/ui/src/locales/lang/zh-Hant/common.ts index e68e94858..a1aa4e8ec 100644 --- a/ui/src/locales/lang/zh-Hant/common.ts +++ b/ui/src/locales/lang/zh-Hant/common.ts @@ -48,6 +48,7 @@ export default { }, status: { label: '狀態', + disable: '停用', enabled: '已啟用', disabled: '已停用', enableSuccess: '啟用成功', diff --git a/ui/src/locales/lang/zh-Hant/views/function-lib.ts b/ui/src/locales/lang/zh-Hant/views/function-lib.ts deleted file mode 100644 index 789cbf0ec..000000000 --- a/ui/src/locales/lang/zh-Hant/views/function-lib.ts +++ /dev/null @@ -1,77 +0,0 @@ -export default { - title: '函數庫', - internalTitle: '內置函數', - added: '已新增', - createFunction: '建立函數', - editFunction: '編輯函數', - copyFunction: '複製函數', - importFunction: '匯入函數', - searchBar: { - placeholder: '按函數名稱搜尋' - }, - setting: { - disabled: '停用' - }, - tip: { - saveMessage: '當前的更改尚未保存,確認退出嗎?' - }, - delete: { - confirmTitle: '是否刪除函數:', - confirmMessage: '刪除後,引用該函數的應用在查詢時會報錯,請謹慎操作。' - }, - disabled: { - confirmTitle: '是否停用函數:', - confirmMessage: '停用後,引用該函數的應用在查詢時會報錯,請謹慎操作。' - }, - functionForm: { - title: { - copy: '副本', - baseInfo: '基礎信息' - }, - form: { - functionName: { - label: '名稱', - placeholder: '請輸入函數名稱', - requiredMessage: '請輸入函數名稱' - }, - functionDescription: { - label: '描述', - placeholder: '請輸入函數的描述' - }, - permission_type: { - label: '權限', - requiredMessage: '請選擇' - }, - paramName: { - label: '參數名', - placeholder: '請輸入參數名', - requiredMessage: '請輸入參數名' - }, - dataType: { - label: '數據類型' - }, - source: { - label: '來源', - custom: '自定義', - reference: '引用參數' - }, - required: { - label: '是否必填' - }, - param: { - paramInfo1: '使用函數時顯示', - paramInfo2: '使用函數時不顯示', - code: '函数内容(Python)', - selectPlaceholder: '請选择參數', - inputPlaceholder: '請輸入參數值', - }, - debug: { - run: '運行', - output: '輸出', - runResult: '運行結果', - runSuccess: '運行成功', - runFailed: '運行失敗' - } - } - } -} diff --git a/ui/src/locales/lang/zh-Hant/views/index.ts b/ui/src/locales/lang/zh-Hant/views/index.ts index 993e5fe93..96f0b6360 100644 --- a/ui/src/locales/lang/zh-Hant/views/index.ts +++ b/ui/src/locales/lang/zh-Hant/views/index.ts @@ -3,7 +3,7 @@ import application from './application' import applicationOverview from './application-overview' import dataset from './dataset' import system from './system' -import functionLib from './function-lib' +import tool from './tool' import user from './user' import team from './team' import model from './model' @@ -19,7 +19,7 @@ export default { application, applicationOverview, system, - functionLib, + tool, user, team, model, diff --git a/ui/src/locales/lang/zh-Hant/views/tool.ts b/ui/src/locales/lang/zh-Hant/views/tool.ts new file mode 100644 index 000000000..50c30823c --- /dev/null +++ b/ui/src/locales/lang/zh-Hant/views/tool.ts @@ -0,0 +1,68 @@ +export default { + title: '工具', + internalTitle: '內置工具', + added: '已新增', + createTool: '建立工具', + editTool: '編輯工具', + copyTool: '複製工具', + importTool: '匯入工具', + searchBar: { + placeholder: '按工具名稱搜尋', + }, + tip: { + saveMessage: '當前的更改尚未保存,確認退出嗎?', + }, + delete: { + confirmTitle: '是否刪除工具:', + confirmMessage: '刪除後,引用該工具的應用在查詢時會報錯,請謹慎操作。', + }, + disabled: { + confirmTitle: '是否停用工具:', + confirmMessage: '停用後,引用該工具的應用在查詢時會報錯,請謹慎操作。', + }, + form: { + toolName: { + label: '名稱', + placeholder: '請輸入工具名稱', + requiredMessage: '請輸入工具名稱', + }, + toolDescription: { + label: '描述', + placeholder: '請輸入工具的描述', + }, + permission_type: { + label: '權限', + requiredMessage: '請選擇', + }, + paramName: { + label: '參數名', + placeholder: '請輸入參數名', + requiredMessage: '請輸入參數名', + }, + dataType: { + label: '數據類型', + }, + source: { + label: '來源', + custom: '自定義', + reference: '引用參數', + }, + required: { + label: '是否必填', + }, + param: { + paramInfo1: '使用工具時顯示', + paramInfo2: '使用工具時不顯示', + code: '工具内容(Python)', + selectPlaceholder: '請选择參數', + inputPlaceholder: '請輸入參數值', + }, + debug: { + run: '運行', + output: '輸出', + runResult: '運行結果', + runSuccess: '運行成功', + runFailed: '運行失敗', + }, + }, +} diff --git a/ui/src/styles/element-plus.scss b/ui/src/styles/element-plus.scss index 1f37b696c..8a853f162 100644 --- a/ui/src/styles/element-plus.scss +++ b/ui/src/styles/element-plus.scss @@ -3,6 +3,7 @@ $primary-color: #3370ff; --el-color-primary: #3370ff; --el-color-success: #34c724; --el-text-color-primary: #1f2329; + --el-border-radius-base: 6px; // --el-menu-item-height: 45px; // --el-box-shadow-light: 0px 2px 4px 0px rgba(31, 35, 41, 0.12); // --el-border-color: #dee0e3; @@ -28,7 +29,7 @@ $primary-color: #3370ff; background: none; } .el-tree-node__content { - border-radius: 4px; + border-radius: var(--el-border-radius-base); padding: 7px 0; &:hover { background: var(--app-text-color-light-1); @@ -75,7 +76,6 @@ $primary-color: #3370ff; font-size: 16px; } - // dropdown .el-dropdown { color: var(--el-text-color-primary); @@ -99,3 +99,69 @@ $primary-color: #3370ff; background: var(--el-color-primary-light-9); } } + +// message +.el-message { + --el-message-close-icon-color: var(--app-text-color-secondary); +} +.el-message-box { + --el-messagebox-font-size: 16px; + --el-messagebox-width: 475px; + padding: 24px; + .el-message-box__header { + padding: 0; + } + .el-message-box__title { + word-break: break-all; + width: 95%; + } +} + +.el-message-box__content { + padding: 24px 0; + color: var(--app-text-color); + font-weight: 400; +} +.el-message-box__btns { + padding: 0; + button { + min-width: 80px; + &:nth-child(2) { + margin-left: 12px; + } + } + button.danger { + background: var(--el-color-danger); + border: var(--el-color-danger); + color: #ffffff; + } +} +.el-message-box__headerbtn { + right: 10px; + top: 16px; + .el-message-box__close { + font-size: 20px; + } +} + +// drawer +.el-drawer { + .el-drawer__header { + padding: 16px 24px; + margin: 0; + border-bottom: 1px solid var(--el-border-color); + color: var(--app-text-color); + } + .el-drawer__body { + padding: 16px 24px; + } + .el-drawer__footer { + border-top: 1px solid var(--el-border-color); + padding: 16px 24px; + } +} + +// popper +.el-popper { + --el-popper-border-radius: 6px; +} diff --git a/ui/src/views/tool/component/AddInternalFunctionDialog.vue b/ui/src/views/tool/component/AddInternalFunctionDialog.vue index 2f6514bc4..312fc6e98 100644 --- a/ui/src/views/tool/component/AddInternalFunctionDialog.vue +++ b/ui/src/views/tool/component/AddInternalFunctionDialog.vue @@ -1,6 +1,6 @@

- {{ $t('views.functionLib.functionForm.title.baseInfo') }} + {{ $t('views.tool.functionForm.title.baseInfo') }}

@@ -55,12 +55,12 @@
- - + +
- + -

@@ -180,7 +152,7 @@

{{ $t('common.param.inputParam') }} - {{ $t('views.functionLib.functionForm.form.param.paramInfo1') }} + {{ $t('views.tool.form.param.paramInfo1') }}

@@ -191,9 +163,9 @@ - + @@ -207,13 +179,13 @@ @@ -237,16 +209,16 @@

- {{ $t('views.functionLib.functionForm.form.param.code') }} + {{ $t('views.tool.form.param.code') }} * - {{ $t('views.functionLib.functionForm.form.param.paramInfo2') }} + {{ $t('views.tool.form.param.paramInfo2') }}

@@ -254,7 +226,7 @@

{{ $t('common.param.outputParam') }} - {{ $t('views.functionLib.functionForm.form.param.paramInfo1') }} + {{ $t('views.tool.form.param.paramInfo1') }}

@@ -274,8 +246,8 @@ - - + + @@ -283,20 +255,19 @@ import { ref, reactive, watch, nextTick } from 'vue' import FieldFormDialog from './FieldFormDialog.vue' import FunctionDebugDrawer from './FunctionDebugDrawer.vue' -import type { functionLibData } from '@/api/type/function-lib' -import functionLibApi from '@/api/function-lib' +import type { toolData } from '@/api/type/tool' +import ToolApi from '@/api/tool/tool' import type { FormInstance } from 'element-plus' import { MsgSuccess, MsgConfirm } from '@/utils/message' import { cloneDeep } from 'lodash' import { PermissionType, PermissionDesc } from '@/enums/model' import { t } from '@/locales' -import UserFieldFormDialog from '@/workflow/nodes/base-node/component/UserFieldFormDialog.vue' +// import UserFieldFormDialog from '@/workflow/nodes/base-node/component/UserFieldFormDialog.vue' import { isAppIcon } from '@/utils/application' import EditAvatarDialog from './EditAvatarDialog.vue' -import Sortable from 'sortablejs' const props = defineProps({ - title: String + title: String, }) const emit = defineEmits(['refresh']) @@ -316,14 +287,13 @@ const showEditor = ref(false) const currentIndex = ref(null) const showEditIcon = ref(false) -const form = ref({ +const form = ref({ name: '', desc: '', code: '', icon: '', input_field_list: [], init_field_list: [], - permission_type: 'PRIVATE' }) watch(visible, (bool) => { @@ -338,7 +308,6 @@ watch(visible, (bool) => { icon: '', input_field_list: [], init_field_list: [], - permission_type: 'PRIVATE' } FormRef.value?.clearValidate() } @@ -348,53 +317,12 @@ const rules = reactive({ name: [ { required: true, - message: t('views.functionLib.functionForm.form.functionName.requiredMessage'), - trigger: 'blur' - } + message: t('views.tool.form.toolName.requiredMessage'), + trigger: 'blur', + }, ], - permission_type: [ - { - required: true, - message: t('views.functionLib.functionForm.form.permission_type.requiredMessage'), - trigger: 'change' - } - ] }) -function onDragHandle() { - // For init_field_list table - if (initFieldTableRef.value) { - const el = initFieldTableRef.value.$el.querySelector('.el-table__body-wrapper tbody') - Sortable.create(el, { - animation: 150, - ghostClass: 'sortable-ghost', - onEnd: ({ newIndex, oldIndex }) => { - if (newIndex === undefined || oldIndex === undefined) return - if (newIndex !== oldIndex) { - const item = form.value.init_field_list?.splice(oldIndex, 1)[0] - form.value.init_field_list?.splice(newIndex, 0, item) - } - } - }) - } - - // For input_field_list table - if (inputFieldTableRef.value) { - const el = inputFieldTableRef.value.$el.querySelector('.el-table__body-wrapper tbody') - Sortable.create(el, { - animation: 150, - ghostClass: 'sortable-ghost', - onEnd: ({ newIndex, oldIndex }) => { - if (newIndex === undefined || oldIndex === undefined) return - if (newIndex !== oldIndex) { - const item = form.value.input_field_list?.splice(oldIndex, 1)[0] - form.value.input_field_list?.splice(newIndex, 0, item) - } - } - }) - } -} - function submitCodemirrorEditor(val: string) { form.value.code = val } @@ -403,9 +331,9 @@ function close() { if (isEdit.value || !areAllValuesNonEmpty(form.value)) { visible.value = false } else { - MsgConfirm(t('common.tip'), t('views.functionLib.tip.saveMessage'), { + MsgConfirm(t('common.tip'), t('views.tool.tip.saveMessage'), { confirmButtonText: t('common.confirm'), - type: 'warning' + type: 'warning', }) .then(() => { visible.value = false @@ -465,7 +393,7 @@ function refreshInitFieldList(data: any) { UserFieldFormDialogRef.value.close() } -function refreshFunctionLib(data: any) { +function refreshtool(data: any) { form.value.icon = data // console.log(data) } @@ -484,13 +412,13 @@ const submit = async (formEl: FormInstance | undefined) => { if (valid) { // console.log(form.value) if (isEdit.value) { - functionLibApi.putFunctionLib(form.value?.id as string, form.value, loading).then((res) => { + toolApi.puttool(form.value?.id as string, form.value, loading).then((res) => { MsgSuccess(t('common.editSuccess')) emit('refresh', res.data) visible.value = false }) } else { - functionLibApi.postFunctionLib(form.value, loading).then((res) => { + toolApi.posttool(form.value, loading).then((res) => { MsgSuccess(t('common.createSuccess')) emit('refresh') visible.value = false @@ -512,7 +440,7 @@ const open = (data: any) => { } defineExpose({ - open + open, }) diff --git a/ui/src/views/tool/index.vue b/ui/src/views/tool/index.vue index a80e735fb..6226e9261 100644 --- a/ui/src/views/tool/index.vue +++ b/ui/src/views/tool/index.vue @@ -113,25 +113,27 @@ - - --> +
@@ -161,6 +168,7 @@
+ @@ -170,12 +178,12 @@ import ToolApi from '@/api/tool/tool' import useStore from '@/stores' import { MsgConfirm } from '@/utils/message' import InitParamDrawer from '@/views/tool/component/InitParamDrawer.vue' +import ToolFormDrawer from './component/ToolFormDrawer.vue' import { t } from '@/locales' -const { folder } = useStore() +const { folder, user } = useStore() const InitParamDrawerRef = ref() - const search_type = ref('name') const search_form = ref<{ name: string @@ -202,6 +210,28 @@ const currentFolder = ref({}) const search_type_change = () => { search_form.value = { name: '', create_user: '' } } +const canEdit = (row: any) => { + return user.userInfo?.id === row?.user_id +} + +const ToolFormDrawerRef = ref() +const ToolDrawertitle = ref('') +function openCreateDialog(data?: any) { + // 有template_id的不允许编辑,是模板转换来的 + if (data?.template_id) { + return + } + ToolDrawertitle.value = data ? t('views.tool.editTool') : t('views.tool.createTool') + if (data) { + if (data?.permission_type !== 'PUBLIC' || canEdit(data)) { + ToolApi.getToolById('default', data?.id, changeStateloading).then((res) => { + ToolFormDrawerRef.value.open(res.data) + }) + } + } else { + ToolFormDrawerRef.value.open(data) + } +} function getList() { const params = { @@ -225,42 +255,49 @@ function getFolder() { } async function changeState(row: any) { - // if (!bool) { - // MsgConfirm( - // `${t('views.functionLib.disabled.confirmTitle')}${row.name} ?`, - // t('views.functionLib.disabled.confirmMessage'), - // { - // confirmButtonText: t('views.functionLib.setting.disabled'), - // confirmButtonClass: 'danger', - // }, - // ) - // .then(() => { - // const obj = { - // is_active: bool, - // } - // ToolApi.putToolLib('default', row.id, obj, changeStateloading).then((res) => {}) - // }) - // .catch(() => { - // row.is_active = true - // }) - // } else { - // const res = await ToolApi.getToolById('default', row.id, changeStateloading) - // if ( - // !res.data.init_params && - // res.data.init_field_list && - // res.data.init_field_list.length > 0 && - // res.data.init_field_list.filter((item: any) => item.default_value && item.show_default_value) - // .length !== res.data.init_field_list.length - // ) { - // row.is_active = false - // InitParamDrawerRef.value.open(res.data, bool) - // return - // } - // const obj = { - // is_active: bool, - // } - // ToolApi.putToolLib('default', row.id, obj, changeStateloading).then((res) => {}) - // } + if (row.is_active) { + MsgConfirm( + `${t('views.tool.disabled.confirmTitle')}${row.name} ?`, + t('views.tool.disabled.confirmMessage'), + { + confirmButtonText: t('common.status.disable'), + confirmButtonClass: 'danger', + }, + ).then(() => { + const obj = { + is_active: !row.is_active, + } + ToolApi.putToolLib('default', row.id, obj, changeStateloading) + .then(() => { + return true + }) + .catch(() => { + return false + }) + }) + } else { + const res = await ToolApi.getToolById('default', row.id, changeStateloading) + if ( + !res.data.init_params && + res.data.init_field_list && + res.data.init_field_list.length > 0 && + res.data.init_field_list.filter((item: any) => item.default_value && item.show_default_value) + .length !== res.data.init_field_list.length + ) { + InitParamDrawerRef.value.open(res.data, !row.is_active) + return false + } + const obj = { + is_active: !row.is_active, + } + ToolApi.putToolLib('default', row.id, obj, changeStateloading) + .then(() => { + return true + }) + .catch(() => { + return false + }) + } } function refresh(data: any) {