fix(admin): unify settings save controls

This commit is contained in:
kate522 committed 2026-11-10 21:34:00 +08:00
1 parent 7fe26d3fff
commit f3dd1ec3b1
8 files changed
+113 -68

No files matched your search

@@ -47,20 +47,19 @@
:scroll-x="1200"
/>
</n-card>
<div class="jio-form-actions">
<n-button type="primary" :loading="saving" @click="handleSave">保存能力矩阵</n-button>
</div>
</n-spin>
<JioSaveBar :dirty="dirty" :saving="saving" @save="handleSave" @reload="load" />
</div>
</template>
<script setup>
import { h, onMounted, reactive, ref } from 'vue'
import { computed, h, onMounted, reactive, ref } from 'vue'
import { NInputNumber, NSwitch, NTag } from 'naive-ui'
import { useMessage } from 'naive-ui'
import api from '@/api'
import PageHeader from '@/components/PageHeader.vue'
import JioSaveBar from '@/components/form/JioSaveBar.vue'
const message = useMessage()
const loading = ref(true)
@@ -74,6 +73,7 @@ const summary = reactive({
})
const userCaps = reactive({})
const defaultsSnapshot = ref({})
const dirty = computed(() => !loading.value && JSON.stringify(userCaps) !== JSON.stringify(defaultsSnapshot.value))
onMounted(load)
@@ -186,18 +186,11 @@ function resetDefaults() {
message.info('已恢复默认矩阵')
}
function expandAll() {
message.info('当前矩阵为平铺展示,无需展开')
}
function collapseAll() {
message.info('当前矩阵为平铺展示,无需折叠')
}
async function handleSave() {
saving.value = true
try {
await api.saveCapabilities(JSON.parse(JSON.stringify(userCaps)))
const res = await api.saveCapabilities(JSON.parse(JSON.stringify(userCaps)))
if (res?.data?.user_caps) replaceReactive(userCaps, res.data.user_caps)
defaultsSnapshot.value = JSON.parse(JSON.stringify(userCaps))
message.success('能力矩阵已保存')
} catch (error) {
@@ -241,10 +234,4 @@ async function handleSave() {
.jio-cap-matrix__empty {
color: #c0c4cc;
}
.jio-form-actions {
display: flex;
justify-content: flex-end;
margin-top: 16px;
}
</style>