feat(admin): add delete APIs and UI actions for all admin resources
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
<el-button size="small" @click="openEdit(row)">編輯</el-button>
|
||||
<el-button size="small" @click="openRelations(row, 'groups')">群組</el-button>
|
||||
<el-button size="small" @click="openRelations(row, 'members')">會員</el-button>
|
||||
<el-button size="small" type="danger" @click="handleDelete(row)">刪除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -94,9 +95,9 @@
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { Plus } from '@element-plus/icons-vue'
|
||||
import { getSystems, createSystem, updateSystem, getSystemGroups, getSystemMembers } from '@/api/systems'
|
||||
import { getSystems, createSystem, updateSystem, deleteSystem, getSystemGroups, getSystemMembers } from '@/api/systems'
|
||||
|
||||
const systems = ref([])
|
||||
const loading = ref(false)
|
||||
@@ -188,6 +189,18 @@ async function handleEdit() {
|
||||
}
|
||||
}
|
||||
|
||||
async function handleDelete(row) {
|
||||
try {
|
||||
await ElMessageBox.confirm(`確認刪除系統 ${row.name}(${row.system_key})?`, '刪除確認', { type: 'warning' })
|
||||
await deleteSystem(row.system_key)
|
||||
ElMessage.success('刪除成功')
|
||||
await load()
|
||||
} catch (err) {
|
||||
if (err === 'cancel') return
|
||||
ElMessage.error(err.response?.data?.detail || '刪除失敗')
|
||||
}
|
||||
}
|
||||
|
||||
async function openRelations(row, tab) {
|
||||
relationSystemKey.value = row.system_key
|
||||
relationTab.value = tab
|
||||
|
||||
Reference in New Issue
Block a user