generated from Leo_Ding/web-template
算力卡
This commit is contained in:
parent
7cd0f0fb05
commit
7e5f276930
@ -3,6 +3,12 @@ import request from '@/utils/request'
|
|||||||
//获取算力卡列表
|
//获取算力卡列表
|
||||||
export const getCardsList = (params) => request.basic.get('/api/v1/cards', params)
|
export const getCardsList = (params) => request.basic.get('/api/v1/cards', params)
|
||||||
|
|
||||||
|
// 算力卡删除
|
||||||
|
export const deleteCard = (id) => request.basic.delete(`/api/v1/cards/${id}`)
|
||||||
|
|
||||||
|
// 下架算力卡
|
||||||
|
export const editCard = (id, params) => request.basic.put(`/api/v1/cards/${id}`, params)
|
||||||
|
|
||||||
//获取算力中心列表
|
//获取算力中心列表
|
||||||
export const getCentersList = (params) => request.basic.get('/api/v1/centers', params)
|
export const getCentersList = (params) => request.basic.get('/api/v1/centers', params)
|
||||||
|
|
||||||
@ -17,3 +23,4 @@ export const addCenter = (data) => request.basic.post('/api/v1/centers', data)
|
|||||||
|
|
||||||
// 删除算力中心
|
// 删除算力中心
|
||||||
export const deleteCenter = (id) => request.basic.delete(`/api/v1/centers/${id}`)
|
export const deleteCenter = (id) => request.basic.delete(`/api/v1/centers/${id}`)
|
||||||
|
|
||||||
|
|||||||
@ -73,13 +73,13 @@
|
|||||||
</a-tag>
|
</a-tag>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-if="'is_recommend' === column.key">
|
<template v-if="'status' === column.key">
|
||||||
<!--状态-->
|
<!--状态-->
|
||||||
<a-tag v-if="record.banner_type == true" color="processing">
|
<a-tag v-if="record.status == 'ENABLED'" color="processing">
|
||||||
启用
|
启用
|
||||||
</a-tag>
|
</a-tag>
|
||||||
<!--状态-->
|
<!--状态-->
|
||||||
<a-tag v-else color="processing">
|
<a-tag v-else color="red">
|
||||||
禁用
|
禁用
|
||||||
</a-tag>
|
</a-tag>
|
||||||
</template>
|
</template>
|
||||||
@ -92,10 +92,18 @@
|
|||||||
<template v-if="'action' === column.key">
|
<template v-if="'action' === column.key">
|
||||||
<!-- <x-action-button @click="$refs.editDialogRef.handleEdit(record)">
|
<!-- <x-action-button @click="$refs.editDialogRef.handleEdit(record)">
|
||||||
<a-tooltip>
|
<a-tooltip>
|
||||||
<template #title> {{ $t('pages.system.role.edit') }}</template>
|
<template #title> 下架算力卡</template>
|
||||||
<edit-outlined />
|
<edit-outlined />
|
||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
</x-action-button> -->
|
</x-action-button> -->
|
||||||
|
<x-action-button @click="handelEdit(record)" :disabled="record.status === 'DISABLED'">
|
||||||
|
<a-tooltip>
|
||||||
|
<template #title>
|
||||||
|
{{ record.status === 'DISABLED' ? '已下架' : '下架算力卡' }}
|
||||||
|
</template>
|
||||||
|
<edit-outlined />
|
||||||
|
</a-tooltip>
|
||||||
|
</x-action-button>
|
||||||
<x-action-button @click="handleRemove(record)">
|
<x-action-button @click="handleRemove(record)">
|
||||||
<a-tooltip>
|
<a-tooltip>
|
||||||
<template #title> {{ $t('pages.system.delete') }}</template>
|
<template #title> {{ $t('pages.system.delete') }}</template>
|
||||||
@ -150,7 +158,7 @@ const columns = [
|
|||||||
dataIndex: 'status',
|
dataIndex: 'status',
|
||||||
key: 'status',
|
key: 'status',
|
||||||
width: 150,
|
width: 150,
|
||||||
customRender: ({ text }) => disabledDict.getLabel(text) || text,
|
// customRender: ({ text }) => disabledDict.getLabel(text) || text,
|
||||||
},
|
},
|
||||||
{ title: t('button.action'), key: 'action', fixed: 'right', width: 120 },
|
{ title: t('button.action'), key: 'action', fixed: 'right', width: 120 },
|
||||||
];
|
];
|
||||||
@ -194,14 +202,14 @@ async function getPageList() {
|
|||||||
*/
|
*/
|
||||||
function handleRemove({ id }) {
|
function handleRemove({ id }) {
|
||||||
Modal.confirm({
|
Modal.confirm({
|
||||||
title: t('pages.system.role.delTip'),
|
title: '提示',
|
||||||
content: t('button.confirm'),
|
content: '是否删除该算力卡?',
|
||||||
okText: t('button.confirm'),
|
okText: t('button.confirm'),
|
||||||
onOk: () => {
|
onOk: () => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
; (async () => {
|
; (async () => {
|
||||||
try {
|
try {
|
||||||
const { success } = await apis.role.delRole(id).catch(() => {
|
const { success } = await apis.computing.deleteCard(id).catch(() => {
|
||||||
throw new Error()
|
throw new Error()
|
||||||
})
|
})
|
||||||
if (config('http.code.success') === success) {
|
if (config('http.code.success') === success) {
|
||||||
@ -218,6 +226,37 @@ function handleRemove({ id }) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 下架算力卡
|
||||||
|
function handelEdit({ id, status }) {
|
||||||
|
if (status === 'DISABLED') {
|
||||||
|
message.warning('该算力卡已下架,无法重复操作');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Modal.confirm({
|
||||||
|
title: '提示',
|
||||||
|
content: '是否下架该算力卡?',
|
||||||
|
okText: t('button.confirm'),
|
||||||
|
onOk: () => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
; (async () => {
|
||||||
|
try {
|
||||||
|
const { success } = await apis.computing.editCard(id).catch(() => {
|
||||||
|
throw new Error()
|
||||||
|
})
|
||||||
|
if (config('http.code.success') === success) {
|
||||||
|
resolve()
|
||||||
|
message.success('下架成功')
|
||||||
|
await getPageList()
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
reject()
|
||||||
|
}
|
||||||
|
})()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页
|
* 分页
|
||||||
*/
|
*/
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user