@@ -100,42 +100,6 @@ function handleOpenWorkflow(tool: ToolItem, event: MouseEvent) {
100100 return router .push (target )
101101}
102102
103- /* 商店工具仅允许修改名称,不开放模板代码编辑。 */
104- const renameVisible = ref (false )
105- const renameLoading = ref (false )
106- const renamingTool = ref <ToolItem >()
107- const renameForm = ref ({ name: ' ' })
108- const renameFormRef = useTemplateRef <FormInstance >(' renameFormRef' )
109-
110- function handleOpenRename(tool : ToolItem ) {
111- renamingTool .value = tool
112- renameForm .value = { name: tool .name }
113- renameVisible .value = true
114- }
115-
116- function handleRename() {
117- if (renameLoading .value || ! renamingTool .value ) return
118- const toolId = renamingTool .value .id
119- return renameFormRef .value ?.validate ().then (() => {
120- renameLoading .value = true
121- return SystemToolApi .putTool (toolId , { name: renameForm .value .name .trim () })
122- .then ((tool ) => {
123- handleToolUpdate (tool )
124- MsgSuccess (' 修改成功' )
125- renameVisible .value = false
126- })
127- .finally (() => {
128- renameLoading .value = false
129- })
130- })
131- }
132-
133- function handleRenameClosed() {
134- renamingTool .value = undefined
135- renameForm .value = { name: ' ' }
136- renameFormRef .value ?.clearValidate ()
137- }
138-
139103/* 删除后重新查询,保留筛选并处理末页删空。 */
140104function handleDeleteTool(tool : ToolItem ) {
141105 return MsgConfirm (
@@ -226,16 +190,10 @@ onMounted(() => {
226190 />
227191 <!-- 工具操作,前两个外露,其余进入更多菜单 -->
228192 <MkTableOperationGroup >
229- <!-- 编辑商店工具名称 -->
230- <MkAction v-if =" row .template_id && perm .tool .system .edit ()" label="编辑" icon="icon_edit_outlined" @click =" handleOpenRename (row )" />
231193 <!-- 编辑工具配置 -->
232- <EditToolAction
233- v-if =" ! row .template_id && perm .tool .system .edit ()"
234- label="编辑"
235- :api =" SystemToolApi "
236- :tool =" row "
237- @update =" handleToolUpdate "
238- />
194+ <EditToolAction label="编辑" :api =" SystemToolApi " :tool =" row " @update =" handleToolUpdate " />
195+ <!-- 资源授权 -->
196+ <AuthorizeToolAction v-if =" perm .tool .system .auth ()" label="资源授权" :tool =" row " />
239197 <!-- 打开工具工作流 -->
240198 <MkAction v-if =" row .tool_type === TOOL_TYPE .WORKFLOW " label="工作流" icon="icon_setting" @click =" handleOpenWorkflow (row , $event )" />
241199 <!-- 配置启动参数 -->
@@ -247,8 +205,7 @@ onMounted(() => {
247205 :tool =" row "
248206 @update =" handleToolUpdate "
249207 />
250- <!-- 资源授权 -->
251- <AuthorizeToolAction v-if =" perm .tool .system .auth ()" label="资源授权" :tool =" row " />
208+
252209 <!-- 导出工具 -->
253210 <ExportToolAction
254211 v-if =" ! row .template_id && perm .tool .system .export ()"
@@ -299,17 +256,4 @@ onMounted(() => {
299256 </MkTable >
300257 </template >
301258 </MkViewLayout >
302- <MkDialog v-model =" renameVisible " title="编辑工具" :show-close =" ! renameLoading " @closed =" handleRenameClosed " >
303- <el-form ref =" renameFormRef" :model =" renameForm" label-position =" top" @submit.prevent >
304- <el-form-item prop =" name" label =" 名称" :rules =" { required: true, whitespace: true, message: '请输入工具名称', trigger: 'blur' }"
305- ><el-input v-model =" renameForm.name" maxlength =" 64" show-word-limit :disabled =" renameLoading"
306- /></el-form-item >
307- </el-form >
308- <template #footer >
309- <!-- 取消编辑 -->
310- <el-button :disabled =" renameLoading" @click =" renameVisible = false" >取消</el-button >
311- <!-- 保存工具名称 -->
312- <el-button type =" primary" :loading =" renameLoading" @click =" handleRename" >保存</el-button >
313- </template >
314- </MkDialog >
315259</template >
0 commit comments