|
|
@@ -56,14 +56,41 @@
|
|
|
<el-table-column prop="templateName" label="模板名称" min-width="180" />
|
|
|
<el-table-column prop="templateCode" label="模板编码" min-width="140" />
|
|
|
<el-table-column prop="industryType" label="行业类型" width="110" />
|
|
|
- <el-table-column prop="status" label="状态" width="80" />
|
|
|
+ <el-table-column prop="status" label="状态" width="90">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-tag size="mini" :type="scope.row.status === 1 ? 'success' : 'info'">
|
|
|
+ {{ scope.row.status === 1 ? '已发布' : '未发布' }}
|
|
|
+ </el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column prop="createTime" label="创建时间" width="160" />
|
|
|
<el-table-column label="操作" width="220" fixed="right">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-button type="text" @click="handlePreview(scope.row)">预览</el-button>
|
|
|
- <el-button type="text" @click="handleEditTemplate(scope.row)">编辑</el-button>
|
|
|
- <el-button type="text" @click="handleVisual(scope.row)">流程图</el-button>
|
|
|
- <el-button type="text" style="color:#f56c6c" @click="handleDeleteTemplate(scope.row)">删除</el-button>
|
|
|
+ <div class="table-action-group">
|
|
|
+ <el-button class="action-btn" type="text" @click="handlePreview(scope.row)">预览</el-button>
|
|
|
+ <el-button v-if="scope.row.status !== 1" class="action-btn" type="text" @click="handleEditTemplate(scope.row)">编辑</el-button>
|
|
|
+ <el-button class="action-btn" type="text" @click="handleVisual(scope.row)">流程图</el-button>
|
|
|
+ <el-button
|
|
|
+ v-if="scope.row.status !== 1"
|
|
|
+ class="action-btn danger-btn"
|
|
|
+ type="text"
|
|
|
+ @click="handleDeleteTemplate(scope.row)"
|
|
|
+ >删除</el-button>
|
|
|
+ <el-button
|
|
|
+ v-if="scope.row.status !== 1"
|
|
|
+ class="action-btn"
|
|
|
+ type="text"
|
|
|
+ :loading="statusChangingId === scope.row.id"
|
|
|
+ @click="handlePublish(scope.row)"
|
|
|
+ >发布</el-button>
|
|
|
+ <el-button
|
|
|
+ v-else
|
|
|
+ class="action-btn"
|
|
|
+ type="text"
|
|
|
+ :loading="statusChangingId === scope.row.id"
|
|
|
+ @click="handleUnpublish(scope.row)"
|
|
|
+ >取消发布</el-button>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
@@ -102,6 +129,7 @@ import {
|
|
|
listWorkflowTemplate,
|
|
|
getWorkflowTemplateDetail,
|
|
|
updateWorkflowTemplate,
|
|
|
+ updateWorkflowTemplateStatus,
|
|
|
deleteWorkflowTemplate,
|
|
|
aiGenerateWorkflow,
|
|
|
getGenerateResultDetail,
|
|
|
@@ -125,6 +153,7 @@ export default {
|
|
|
templateDialogVisible: false,
|
|
|
templateDialogMode: 'preview',
|
|
|
templateSaving: false,
|
|
|
+ statusChangingId: null,
|
|
|
page: {
|
|
|
current: 1,
|
|
|
size: 10,
|
|
|
@@ -293,7 +322,9 @@ export default {
|
|
|
await this.openTemplateDialog(row, 'edit')
|
|
|
},
|
|
|
handleVisual(row) {
|
|
|
- this.$router.push('/workflow/visual/' + row.id)
|
|
|
+ this.$router.push({
|
|
|
+ path: '/workflow/visual/' + row.id,
|
|
|
+ })
|
|
|
},
|
|
|
async openTemplateDialog(row, mode) {
|
|
|
this.templateDialogMode = mode
|
|
|
@@ -352,6 +383,28 @@ export default {
|
|
|
this.$message.error(e.message || '删除失败')
|
|
|
}
|
|
|
}
|
|
|
+ },
|
|
|
+ async handlePublish(row) {
|
|
|
+ await this.changeTemplateStatus(row, 1)
|
|
|
+ },
|
|
|
+ async handleUnpublish(row) {
|
|
|
+ await this.changeTemplateStatus(row, 0)
|
|
|
+ },
|
|
|
+ async changeTemplateStatus(row, status) {
|
|
|
+ const actionText = status === 1 ? '发布' : '取消发布'
|
|
|
+ try {
|
|
|
+ await this.$confirm(`确认${actionText}该模板吗?`, '提示', { type: 'warning' })
|
|
|
+ this.statusChangingId = row.id
|
|
|
+ await updateWorkflowTemplateStatus(row.id, status)
|
|
|
+ this.$message.success(`${actionText}成功`)
|
|
|
+ await this.loadTemplateList()
|
|
|
+ } catch (e) {
|
|
|
+ if (e !== 'cancel') {
|
|
|
+ this.$message.error(e.message || `${actionText}失败`)
|
|
|
+ }
|
|
|
+ } finally {
|
|
|
+ this.statusChangingId = null
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -397,5 +450,23 @@ export default {
|
|
|
display: flex;
|
|
|
justify-content: flex-end;
|
|
|
}
|
|
|
+
|
|
|
+ .table-action-group {
|
|
|
+ display: flex;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ align-items: center;
|
|
|
+ gap: 2px 10px;
|
|
|
+ }
|
|
|
+
|
|
|
+ ::v-deep .table-action-group .action-btn {
|
|
|
+ margin: 0;
|
|
|
+ min-width: 44px;
|
|
|
+ text-align: center;
|
|
|
+ padding: 2px 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ ::v-deep .table-action-group .danger-btn {
|
|
|
+ color: #f56c6c;
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|