generated from Leo_Ding/web-template
算力中心
This commit is contained in:
parent
6c2042ccee
commit
7cd0f0fb05
@ -6,12 +6,14 @@ export const getCardsList = (params) => request.basic.get('/api/v1/cards', param
|
||||
//获取算力中心列表
|
||||
export const getCentersList = (params) => request.basic.get('/api/v1/centers', params)
|
||||
|
||||
// 编辑算力中心
|
||||
export const editCeCenter = (id) => request.basic.get(`/api/v1/centers/${id}`)
|
||||
|
||||
//获取单个banner
|
||||
export const getBanner = (id) => request.basic.get(`/api/v1/banners/${id}`)
|
||||
//创建banner
|
||||
export const createBanner = (data) => request.basic.post('/api/v1/banners', data)
|
||||
//更新banner
|
||||
export const updateBanner = (id, data) => request.basic.put(`/api/v1/banners/${id}`, data)
|
||||
//删除banner
|
||||
export const deleteBanner = (id) => request.basic.delete(`/api/v1/banners/${id}`)
|
||||
// 更新算力中心
|
||||
export const updateCenter = (id, data) => request.basic.put(`/api/v1/centers/${id}`, data)
|
||||
|
||||
// 新增算力中心
|
||||
export const addCenter = (data) => request.basic.post('/api/v1/centers', data)
|
||||
|
||||
// 删除算力中心
|
||||
export const deleteCenter = (id) => request.basic.delete(`/api/v1/centers/${id}`)
|
||||
@ -5,34 +5,35 @@
|
||||
<a-card class="mb-8-2">
|
||||
<a-row :gutter="24">
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="$t('pages.system.role.form.name')" name="name">
|
||||
<a-form-item :label="'算力中心名称'" name="name">
|
||||
<a-input v-model:value="formData.name"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="$t('pages.system.role.form.sequence')" name="sequence">
|
||||
<a-input :defaultValue="0" type="number" v-model:value="formData.sequence"></a-input>
|
||||
<a-form-item :label="'区域编码'" name="code">
|
||||
<a-input v-model:value="formData.code"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="'排序'" name="sort">
|
||||
<a-input :defaultValue="0" type="number" v-model:value="formData.sort"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="$t('pages.system.role.form.status')" name="status">
|
||||
<a-radio-group v-model:value="formData.status" :options="[
|
||||
{ label: $t('pages.system.role.form.status.enabled'), value: 'enabled' },
|
||||
{ label: $t('pages.system.role.form.status.disabled'), value: 'disabled' },
|
||||
{ label: $t('pages.system.role.form.status.enabled'), value: 'ENABLED' },
|
||||
{ label: $t('pages.system.role.form.status.disabled'), value: 'DISABLED' },
|
||||
]"></a-radio-group>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="'描述'">
|
||||
<a-form-item :label="'描述'" name="description">
|
||||
<a-textarea v-model:value="formData.description"></a-textarea>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="'上传图片'" name="permissions">
|
||||
<GxUpload :fileNumber="1" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-card>
|
||||
</a-form>
|
||||
@ -80,19 +81,12 @@ async function handleEdit(record = {}) {
|
||||
title: t('pages.system.role.edit'),
|
||||
})
|
||||
|
||||
const { data, success } = await apis.role.getRole(record.id).catch()
|
||||
const { data, success } = await apis.computing.editCeCenter(record.id).catch()
|
||||
if (!success) {
|
||||
message.error(t('component.message.error.save'))
|
||||
hideModal()
|
||||
return
|
||||
}
|
||||
let menus = []
|
||||
if (data.menus) {
|
||||
for (let item of data.menus) {
|
||||
menus.push(item.menu_id)
|
||||
}
|
||||
}
|
||||
checkedKeys.value = menus
|
||||
formRecord.value = data
|
||||
formData.value = cloneDeep(data)
|
||||
}
|
||||
@ -106,16 +100,18 @@ function handleOk() {
|
||||
.then(async (values) => {
|
||||
try {
|
||||
showLoading()
|
||||
console.log("===",values)
|
||||
values.sort = parseInt(values.sort)
|
||||
const params = {...values}
|
||||
let result = null
|
||||
switch (modal.value.type) {
|
||||
case 'create':
|
||||
result = await apis.banner.createBanner(params).catch(() => {
|
||||
result = await apis.computing.addCenter(params).catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
break
|
||||
case 'edit':
|
||||
result = await apis.banner.updateBanner(formData.value.id, params).catch(() => {
|
||||
result = await apis.computing.updateCenter(formData.value.id, params).catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
break
|
||||
|
||||
@ -35,31 +35,20 @@
|
||||
<a-row :gutter="8" :wrap="false">
|
||||
<a-col flex="auto">
|
||||
<a-card type="flex">
|
||||
<!-- <x-action-bar class="mb-8-2">
|
||||
<x-action-bar class="mb-8-2">
|
||||
<a-button v-action="'add'" type="primary" @click="$refs.editDialogRef.handleCreate()">
|
||||
<template #icon>
|
||||
<plus-outlined></plus-outlined>
|
||||
</template>
|
||||
添加图片
|
||||
增加算力中心
|
||||
</a-button>
|
||||
</x-action-bar> -->
|
||||
</x-action-bar>
|
||||
<a-table :columns="columns" :data-source="listData" :loading="loading" :pagination="paginationState"
|
||||
:scroll="{ x: 1000 }" @change="onTableChange">
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="'banner_type' === column.key">
|
||||
<template v-if="'status' === column.key">
|
||||
<!--状态-->
|
||||
<a-tag v-if="record.banner_type == 1" color="processing">
|
||||
首页轮播图
|
||||
</a-tag>
|
||||
<!--状态-->
|
||||
<a-tag v-else color="processing">
|
||||
营销活动图
|
||||
</a-tag>
|
||||
</template>
|
||||
|
||||
<template v-if="'is_recommend' === column.key">
|
||||
<!--状态-->
|
||||
<a-tag v-if="record.banner_type == true" color="processing">
|
||||
<a-tag v-if="record.status == 'ENABLED'" color="processing">
|
||||
启用
|
||||
</a-tag>
|
||||
<!--状态-->
|
||||
@ -74,12 +63,12 @@
|
||||
</template>
|
||||
|
||||
<template v-if="'action' === column.key">
|
||||
<!-- <x-action-button @click="$refs.editDialogRef.handleEdit(record)">
|
||||
<x-action-button @click="$refs.editDialogRef.handleEdit(record)">
|
||||
<a-tooltip>
|
||||
<template #title> {{ $t('pages.system.role.edit') }}</template>
|
||||
<edit-outlined />
|
||||
</a-tooltip>
|
||||
</x-action-button> -->
|
||||
<edit-outlined />
|
||||
</a-tooltip>
|
||||
</x-action-button>
|
||||
<x-action-button @click="handleRemove(record)">
|
||||
<a-tooltip>
|
||||
<template #title> {{ $t('pages.system.delete') }}</template>
|
||||
@ -104,7 +93,7 @@ import { formatUtcDateTime } from '@/utils/util'
|
||||
import { config } from '@/config'
|
||||
import { usePagination, useForm } from '@/hooks'
|
||||
import EditDialog from './components/EditDialog.vue'
|
||||
import { DeleteOutlined } from '@ant-design/icons-vue'
|
||||
import { PlusOutlined, EditOutlined, DeleteOutlined, PlusCircleOutlined } from '@ant-design/icons-vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { disabledDict } from '@/enums/dict'
|
||||
|
||||
@ -115,7 +104,8 @@ const { t } = useI18n() // 解构出t方法
|
||||
const columns = [
|
||||
{ title: '算力中心名称', dataIndex: 'name', width: 200 },
|
||||
{ title: '区域编码', dataIndex: 'code', width: 150 },
|
||||
{ title: '描述', dataIndex: 'descript', width: 150 },
|
||||
{ title: '描述', dataIndex: 'description', width: 150 },
|
||||
{ title: '排序', dataIndex: 'sort', width: 150 },
|
||||
{
|
||||
title: '状态',
|
||||
dataIndex: 'status',
|
||||
@ -165,14 +155,14 @@ async function getPageList() {
|
||||
*/
|
||||
function handleRemove({ id }) {
|
||||
Modal.confirm({
|
||||
title: t('pages.system.role.delTip'),
|
||||
content: t('button.confirm'),
|
||||
title: '提示',
|
||||
content: '是否删除该算力中心?',
|
||||
okText: t('button.confirm'),
|
||||
onOk: () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
; (async () => {
|
||||
try {
|
||||
const { success } = await apis.role.delRole(id).catch(() => {
|
||||
const { success } = await apis.computing.deleteCenter(id).catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
if (config('http.code.success') === success) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user