refactor: 合并保存按钮,点击保存即自动保存源数据+拍快照

This commit is contained in:
mediabot-pt
2026-07-07 13:19:50 +08:00
parent e659b9bca6
commit e953e9a7fd
4 changed files with 5 additions and 10 deletions

View File

@@ -49,20 +49,18 @@
</el-select>
<el-button size="small" @click="revertScript">回滚</el-button>
<el-button v-if="hasUnsavedChanges" size="small" @click="resetScript" type="warning">重置</el-button>
<el-button size="small" type="primary" @click="saveScript" :loading="saving">保存</el-button>
<el-button size="small" type="primary" @click="savePreview" :loading="savingPreview" v-if="snapshotStatus">保存</el-button>
<el-button size="small" type="danger" @click="deleteScript" :loading="deleting">删除</el-button>
<template v-if="selectedConfig?.status==='pending'">
<el-button size="small" type="success" @click="approveConfig" :loading="approving">通过</el-button>
<el-button size="small" type="danger" @click="rejectConfig" :loading="rejecting">拒绝</el-button>
</template>
<el-button v-if="selectedConfig?.status!=='pending'" size="small" type="success" @click="approveConfig" :loading="approving">发布</el-button>
<!-- 快照发布 -->
<el-button size="small" @click="savePreview" :loading="savingPreview" v-if="snapshotStatus">保存预览版</el-button>
<el-button size="small" type="success" @click="publishSnapshot" :loading="publishing" v-if="snapshotStatus?.draft.exists || snapshotStatus?.hasPendingPublish">发布正式版</el-button>
<el-button size="small" type="danger" @click="discardDraftSnapshot" :loading="discardingDraft" v-if="snapshotStatus?.draft.exists">丢弃预览版</el-button>
<el-tag v-if="hasUnsavedChanges" size="small" type="danger" effect="dark">未保存</el-tag>
</template>
<el-button v-if="!scriptExpanded && selectedConfigId" size="small" type="primary" @click="saveScript" :loading="saving">保存</el-button>
<el-button v-if="!scriptExpanded && selectedConfigId" size="small" type="primary" @click="savePreview" :loading="savingPreview">保存</el-button>
</div>
<template v-if="scriptExpanded">
<div style="flex:1;min-height:0;border-radius:4px;overflow:hidden">

View File

@@ -40,10 +40,9 @@
<el-tag size="small" type="info">{{ parsed.length }} 条规则</el-tag>
</div>
<div style="display:flex;gap:8px">
<el-button size="small" type="primary" @click="saveRules" :loading="saving">保存</el-button>
<el-button v-if="snapshotStatus" size="small" type="primary" @click="savePreview" :loading="savingPreview">保存</el-button>
<el-button v-if="hasUnsavedChanges" size="small" @click="resetEditor" type="warning">重置</el-button>
<el-button size="small" @click="uploadRules" :loading="uploading">上传</el-button>
<el-button v-if="snapshotStatus" size="small" @click="savePreview" :loading="savingPreview">保存预览版</el-button>
<el-button v-if="snapshotStatus?.draft.exists" size="small" type="success" @click="publishSnapshot" :loading="publishing">发布正式版</el-button>
<el-button v-if="snapshotStatus?.draft.exists" size="small" type="danger" @click="discardDraft" :loading="discardingDraft">丢弃预览版</el-button>
<el-button size="small" @click="editType=''">返回列表</el-button>

View File

@@ -52,10 +52,9 @@
<el-tag v-if="hasUnsavedChanges" size="small" type="danger" effect="dark">未保存</el-tag>
</div>
<div style="display:flex;gap:8px">
<el-button size="small" type="primary" @click="savePages" :loading="saving">保存</el-button>
<el-button v-if="!isDefaultEditor && snapshotStatus" size="small" type="primary" @click="savePreview" :loading="savingPreview">保存</el-button>
<el-button v-if="hasUnsavedChanges" size="small" @click="resetEditor" type="warning">重置</el-button>
<el-button size="small" @click="uploadPages" :loading="uploading">上传</el-button>
<el-button v-if="!isDefaultEditor && snapshotStatus" size="small" @click="savePreview" :loading="savingPreview">保存预览版</el-button>
<el-button v-if="!isDefaultEditor && snapshotStatus?.draft.exists" size="small" type="success" @click="publishSnapshot" :loading="publishing">发布正式版</el-button>
<el-button v-if="!isDefaultEditor && snapshotStatus?.draft.exists" size="small" type="danger" @click="discardDraft" :loading="discardingDraft">丢弃预览版</el-button>
<el-button size="small" type="danger" @click="deletePages" :loading="deleting">删除</el-button>

View File

@@ -64,8 +64,7 @@
<div style="display:flex;gap:8px">
<el-button size="small" @click="resetEditor" v-if="hasUnsavedChanges" type="warning">重置</el-button>
<el-button size="small" @click="editSiteId=''">返回列表</el-button>
<el-button size="small" @click="saveSite" :loading="saving">保存站点</el-button>
<el-button size="small" @click="savePreview" :loading="savingPreview">保存预览版</el-button>
<el-button size="small" type="primary" @click="savePreview" :loading="savingPreview">保存</el-button>
<el-button size="small" @click="discardDraft" :loading="discarding" v-if="snapshotStatus?.draft.exists" type="danger">丢弃预览版</el-button>
<el-button size="small" type="success" @click="publishSite" :loading="publishing">发布正式版</el-button>
</div>