generated from Leo_Ding/web-template
测试
This commit is contained in:
parent
a27480bb4c
commit
8e84d4e4c7
2
.env.dev
2
.env.dev
@ -12,7 +12,7 @@ VITE_ROUTER_BASE=/
|
|||||||
VITE_ROUTER_HISTORY=hash
|
VITE_ROUTER_HISTORY=hash
|
||||||
|
|
||||||
# api
|
# api
|
||||||
VITE_API_BASIC=http://10.10.1.31:8040
|
VITE_API_BASIC=http://10.10.1.42:8040
|
||||||
VITE_API_HTTP=/api/v1/
|
VITE_API_HTTP=/api/v1/
|
||||||
# storage
|
# storage
|
||||||
VITE_STORAGE_NAMESPACE = gin-admin_local_
|
VITE_STORAGE_NAMESPACE = gin-admin_local_
|
||||||
@ -3,7 +3,7 @@ export default () => ({
|
|||||||
port: 8080,
|
port: 8080,
|
||||||
proxy: {
|
proxy: {
|
||||||
'/api': {
|
'/api': {
|
||||||
target: 'http://10.10.1.31:8040/api',
|
target: 'http://10.10.1.36:8040/api',
|
||||||
// target: 'http://127.0.0.1:8045/api',
|
// target: 'http://127.0.0.1:8045/api',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
rewrite: (path) => path.replace('/api', ''),
|
rewrite: (path) => path.replace('/api', ''),
|
||||||
|
|||||||
22
src/apis/modules/host.js
Normal file
22
src/apis/modules/host.js
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/**
|
||||||
|
* 权限接口
|
||||||
|
*/
|
||||||
|
import request from '@/utils/request'
|
||||||
|
// 获取role列表
|
||||||
|
export const getPageList = (params) => request.basic.get('/api/v1/power-hosts', params)
|
||||||
|
// 获取role条数据
|
||||||
|
export const getPage = (id) => request.basic.get(`/api/v1/power-hosts/${id}`)
|
||||||
|
// 添加role
|
||||||
|
export const createPage = (params) => request.basic.post('/api/v1/power-hosts', params)
|
||||||
|
// 更新role
|
||||||
|
export const updatePage = (id, params) => request.basic.put(`/api/v1/power-hosts/${id}`, params)
|
||||||
|
// 删除role
|
||||||
|
export const delPage = (id) => request.basic.delete(`/api/v1/power-hosts/${id}`)
|
||||||
|
//获取区域列表
|
||||||
|
export const getRegionList = (params) => request.basic.get('/api/v1/computing-power-centers/label', params)
|
||||||
|
//添加算力卡
|
||||||
|
export const createComputeCard = (params) => request.basic.post('/api/v1/computing-cards', params)
|
||||||
|
//获取算力卡列表
|
||||||
|
export const getComputeCardList = (params) => request.basic.get('/api/v1/computing-cards', params)
|
||||||
|
//删除算力卡
|
||||||
|
export const delComputeCard = (id) => request.basic.delete(`/api/v1/computing-cards/${id}`)
|
||||||
@ -1,23 +1,186 @@
|
|||||||
<template>
|
<template>
|
||||||
<a-modal
|
<a-modal :open="modal.open" :title="modal.title" :confirm-loading="modal.confirmLoading" :after-close="onAfterClose"
|
||||||
:open="modal.open"
|
@ok="handleOk" @cancel="handleCancel" width="800px">
|
||||||
:title="modal.title"
|
<a-card>
|
||||||
:confirm-loading="modal.confirmLoading"
|
<a-form ref="formRef" scroll-to-first-error :model="formData" :rules="formRules">
|
||||||
:after-close="onAfterClose"
|
<a-divider>基础信息</a-divider>
|
||||||
@ok="handleOk"
|
<a-row :gutter="16">
|
||||||
@cancel="handleCancel">
|
<a-col :span="8">
|
||||||
<a-form
|
<a-form-item label="主机名称" name="name">
|
||||||
ref="formRef"
|
<a-input v-model:value="formData.name" placeholder="请输入主机名称" />
|
||||||
scroll-to-first-error
|
|
||||||
:model="formData"
|
|
||||||
:rules="formRules"
|
|
||||||
:label-col="{ style: { width: '80px' } }">
|
|
||||||
<a-form-item
|
|
||||||
label="标题"
|
|
||||||
name="title">
|
|
||||||
<a-input v-model:value="formData.title"></a-input>
|
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="区域" name="centerID">
|
||||||
|
<a-select v-model:value="formData.centerID" placeholder="请选择区域">
|
||||||
|
<a-select-option v-for="item in areaList" :value="item.id">{{ item.name }}</a-select-option>
|
||||||
|
</a-select>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="部署位置" name="deploymentLocation">
|
||||||
|
<a-input v-model:value="formData.deploymentLocation" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="描述" name="description">
|
||||||
|
<a-textarea v-model:value="formData.description" rows="1" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="状态" name="status">
|
||||||
|
<a-select v-model:value="formData.status" placeholder="请选择状态">
|
||||||
|
<a-select-option value="active">启用</a-select-option>
|
||||||
|
<a-select-option value="inactive">停用</a-select-option>
|
||||||
|
</a-select>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="内网IP" name="intranetIP">
|
||||||
|
<a-input v-model:value="formData.intranetIP" placeholder="192.168.x.x" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="公网IP" name="networkIP">
|
||||||
|
<a-input v-model:value="formData.networkIP" placeholder="x.x.x.x" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="开始时间" name="startAt">
|
||||||
|
<a-date-picker v-model:value="formData.startAt" format="YYYY-MM-DD HH:mm" show-time />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="结束时间" name="endAt">
|
||||||
|
<a-date-picker v-model:value="formData.endAt" format="YYYY-MM-DD HH:mm" show-time />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
|
||||||
|
<!-- 硬件配置 -->
|
||||||
|
<a-divider>硬件配置</a-divider>
|
||||||
|
<a-row :gutter="16">
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="CPU数量" name="cpuNum">
|
||||||
|
<a-input-number v-model:value="formData.cpuNum" style="width: 100%" :min="0" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="CPU类型" name="cpuType">
|
||||||
|
<a-input v-model:value="formData.cpuType" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="内存 (GB)" name="memory">
|
||||||
|
<a-input-number v-model:value="formData.memory" style="width: 100%" :min="0" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="内存型号" name="memoryType">
|
||||||
|
<a-input v-model:value="formData.memoryType" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="系统盘 (GB)" name="systemDisk">
|
||||||
|
<a-input-number v-model:value="formData.systemDisk" style="width: 100%" :min="0" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="系统盘类型" name="systemDiskType">
|
||||||
|
<a-input v-model:value="formData.systemDiskType" placeholder="如 SSD, HDD" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="数据盘 (GB)" name="dataDisk">
|
||||||
|
<a-input-number v-model:value="formData.dataDisk" style="width: 100%" :min="0" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="数据盘类型" name="dataDiskType">
|
||||||
|
<a-input v-model:value="formData.dataDiskType" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
|
||||||
|
<a-form-item label="数据盘是否可挂载" name="dataDiskCanMount">
|
||||||
|
<a-switch v-model:checked="formData.dataDiskCanMount" />
|
||||||
|
</a-form-item>
|
||||||
|
|
||||||
|
<!-- GPU & 驱动 -->
|
||||||
|
<a-divider>GPU 与驱动</a-divider>
|
||||||
|
<a-row :gutter="16">
|
||||||
|
<a-col :span="12">
|
||||||
|
<a-form-item label="GPU 驱动版本" name="gpuDriver">
|
||||||
|
<a-input v-model:value="formData.gpuDriver" placeholder="如 535.129.03" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="12">
|
||||||
|
<a-form-item label="CUDA 版本" name="cudaVersion">
|
||||||
|
<a-input v-model:value="formData.cudaVersion" placeholder="如 12.2" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
|
||||||
|
<!-- 带宽 -->
|
||||||
|
<a-divider>网络带宽</a-divider>
|
||||||
|
<a-row :gutter="16">
|
||||||
|
<a-col :span="12">
|
||||||
|
<a-form-item label="上行带宽" name="bandWidthUp">
|
||||||
|
<a-input-number v-model:value="formData.bandWidthUp" style="width: 100%" :min="0">
|
||||||
|
<template #addonAfter>
|
||||||
|
<a-select v-model:value="formData.bandWidthUnitUp"
|
||||||
|
default-value="Mbps" style="width: 80px;">
|
||||||
|
<a-select-option value="Mbps">Mbps</a-select-option>
|
||||||
|
<a-select-option value="Gbps">Gbps</a-select-option>
|
||||||
|
</a-select>
|
||||||
|
</template>
|
||||||
|
</a-input-number>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="12">
|
||||||
|
<a-form-item label="下行带宽" name="bandWidthDown">
|
||||||
|
<a-input-number v-model:value="formData.bandWidthDown" style="width: 100%" :min="0">
|
||||||
|
<template #addonAfter>
|
||||||
|
<a-select v-model:value="formData.bandWidthUnitDown" default-value="Mbps" style="width: 80px;">
|
||||||
|
<a-select-option value="Mbps">Mbps</a-select-option>
|
||||||
|
<a-select-option value="Gbps">Gbps</a-select-option>
|
||||||
|
</a-select>
|
||||||
|
</template>
|
||||||
|
</a-input-number>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
|
||||||
|
<!-- 价格 -->
|
||||||
|
<a-divider>计费信息</a-divider>
|
||||||
|
<a-row :gutter="16">
|
||||||
|
<a-col :span="12">
|
||||||
|
<a-form-item label="日付价格 (元)" name="dailyPrice">
|
||||||
|
<a-input-number v-model:value="formData.dailyPrice" style="width: 100%" :min="0"
|
||||||
|
:step="0.01" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="12">
|
||||||
|
<a-form-item label="周付价格 (元)" name="weekPrice">
|
||||||
|
<a-input-number v-model:value="formData.weekPrice" style="width: 100%" :min="0"
|
||||||
|
:step="0.01" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="12">
|
||||||
|
<a-form-item label="月付价格 (元)" name="monthlyPrice">
|
||||||
|
<a-input-number v-model:value="formData.monthlyPrice" style="width: 100%" :min="0"
|
||||||
|
:step="0.01" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="12">
|
||||||
|
<a-form-item label="按时计费 (元/小时)" name="payOnTime">
|
||||||
|
<a-input-number v-model:value="formData.payOnTime" style="width: 100%" :min="0"
|
||||||
|
:step="0.01" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
</a-form>
|
</a-form>
|
||||||
|
</a-card>
|
||||||
</a-modal>
|
</a-modal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -25,20 +188,22 @@
|
|||||||
import { cloneDeep } from 'lodash-es'
|
import { cloneDeep } from 'lodash-es'
|
||||||
import apis from '@/apis'
|
import apis from '@/apis'
|
||||||
import { useForm, useModal } from '@/hooks'
|
import { useForm, useModal } from '@/hooks'
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import dayjs from 'dayjs'
|
||||||
const emit = defineEmits(['ok'])
|
const emit = defineEmits(['ok'])
|
||||||
|
const areaList=ref([])
|
||||||
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
|
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
|
||||||
const { formRef, formRules, formRecord, formData, resetForm } = useForm()
|
const { formRef, formRules, formRecord, formData, resetForm } = useForm()
|
||||||
|
formData.value.computingCards = []
|
||||||
formRules.value = {
|
formRules.value = {
|
||||||
title: { required: true, message: '请输入标题' },
|
name: { required: true, message: '请输入标题' },
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新建
|
* 新建
|
||||||
*/
|
*/
|
||||||
function handleCreate() {
|
function handleCreate() {
|
||||||
|
getAreatList()
|
||||||
showModal({
|
showModal({
|
||||||
type: 'create',
|
type: 'create',
|
||||||
title: '新建',
|
title: '新建',
|
||||||
@ -53,10 +218,16 @@ function handleEdit(record = {}) {
|
|||||||
type: 'edit',
|
type: 'edit',
|
||||||
title: '编辑',
|
title: '编辑',
|
||||||
})
|
})
|
||||||
|
getAreatList()
|
||||||
formRecord.value = record
|
formRecord.value = record
|
||||||
formData.value = cloneDeep(record)
|
formData.value = cloneDeep(record)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getAreatList() {
|
||||||
|
apis.host.getRegionList().then((res) => {
|
||||||
|
areaList.value=res.data
|
||||||
|
})
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 确定
|
* 确定
|
||||||
*/
|
*/
|
||||||
@ -72,18 +243,18 @@ function handleOk() {
|
|||||||
let result = null
|
let result = null
|
||||||
switch (modal.value.type) {
|
switch (modal.value.type) {
|
||||||
case 'create':
|
case 'create':
|
||||||
result = await apis.common.create(params).catch(() => {
|
result = await apis.host.createPage(params).catch(() => {
|
||||||
throw new Error()
|
throw new Error()
|
||||||
})
|
})
|
||||||
break
|
break
|
||||||
case 'edit':
|
case 'edit':
|
||||||
result = await apis.common.update(formRecord.value.id, params).catch(() => {
|
result = await apis.host.updatePage(formRecord.value.id, params).catch(() => {
|
||||||
throw new Error()
|
throw new Error()
|
||||||
})
|
})
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
hideLoading()
|
hideLoading()
|
||||||
if (200 === result?.code) {
|
if (true === result?.success) {
|
||||||
hideModal()
|
hideModal()
|
||||||
emit('ok')
|
emit('ok')
|
||||||
}
|
}
|
||||||
|
|||||||
158
src/views/resource/host/components/computeDialog.vue
Normal file
158
src/views/resource/host/components/computeDialog.vue
Normal file
@ -0,0 +1,158 @@
|
|||||||
|
<template>
|
||||||
|
<a-modal :open="modal.open" :title="modal.title" :confirm-loading="modal.confirmLoading" :after-close="onAfterClose"
|
||||||
|
@ok="handleOk" @cancel="handleCancel" width="800px">
|
||||||
|
<a-card>
|
||||||
|
<a-form ref="formRef" scroll-to-first-error :model="formData" :rules="formRules">
|
||||||
|
<a-row :gutter="24">
|
||||||
|
<!-- <a-col :span="12">
|
||||||
|
<a-form-item label="地区ID" name="centerID">
|
||||||
|
<a-input v-model:value="formData.centerID" placeholder="请输入地区ID" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col> -->
|
||||||
|
<a-col :span="12">
|
||||||
|
<a-form-item label="核心数" name="coreNum">
|
||||||
|
<a-input-number v-model:value="formData.coreNum" placeholder="请输入核心数"
|
||||||
|
style="width: 100%" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="12">
|
||||||
|
<a-form-item label="GPU数量" name="gpuNum">
|
||||||
|
<a-input-number v-model:value="formData.gpuNum" placeholder="请输入GPU数量"
|
||||||
|
style="width: 100%" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="12">
|
||||||
|
<a-form-item label="GPU类型" name="gpuType">
|
||||||
|
<a-input v-model:value="formData.gpuType" placeholder="例如:A100, V100" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="12">
|
||||||
|
<a-form-item label="显存 (GB)" name="vram">
|
||||||
|
<a-input-number v-model:value="formData.vram" placeholder="显存大小" style="width: 100%" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="12">
|
||||||
|
<a-form-item label="状态" name="status">
|
||||||
|
<a-select v-model:value="formData.status" placeholder="请选择状态" style="width: 100%">
|
||||||
|
<a-select-option value="enabled">启用</a-select-option>
|
||||||
|
<a-select-option value="disabled">停用</a-select-option>
|
||||||
|
</a-select>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item label="描述" name="description">
|
||||||
|
<a-textarea v-model:value="formData.description" placeholder="请输入描述" :rows="3" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item label="是否使用" name="isUse">
|
||||||
|
<a-switch v-model:checked="formData.isUse" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
</a-form>
|
||||||
|
</a-card>
|
||||||
|
</a-modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { cloneDeep } from 'lodash-es'
|
||||||
|
import apis from '@/apis'
|
||||||
|
import { useForm, useModal } from '@/hooks'
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import dayjs from 'dayjs'
|
||||||
|
const emit = defineEmits(['ok'])
|
||||||
|
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
|
||||||
|
const { formRef, formRules, formRecord, formData, resetForm } = useForm()
|
||||||
|
formData.value.computingCards = []
|
||||||
|
formRules.value = {
|
||||||
|
// name: { required: true, message: '请输入标题' },
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新建
|
||||||
|
*/
|
||||||
|
function handleCreate(record = {}) {
|
||||||
|
showModal({
|
||||||
|
type: 'create',
|
||||||
|
title: '新建',
|
||||||
|
})
|
||||||
|
console.log(record);
|
||||||
|
formData.value.centerID=record.id
|
||||||
|
formData.value.hostID=record.hostID
|
||||||
|
formData.value.status='enabled'
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
*/
|
||||||
|
function handleEdit(record = {}) {
|
||||||
|
showModal({
|
||||||
|
type: 'edit',
|
||||||
|
title: '编辑',
|
||||||
|
})
|
||||||
|
formRecord.value = record
|
||||||
|
formData.value = cloneDeep(record)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 确定
|
||||||
|
*/
|
||||||
|
function handleOk() {
|
||||||
|
formRef.value
|
||||||
|
.validateFields()
|
||||||
|
.then(async (values) => {
|
||||||
|
try {
|
||||||
|
showLoading()
|
||||||
|
const params = {
|
||||||
|
...formData.value,
|
||||||
|
}
|
||||||
|
let result = null
|
||||||
|
switch (modal.value.type) {
|
||||||
|
case 'create':
|
||||||
|
result = await apis.host.createComputeCard(params).catch(() => {
|
||||||
|
throw new Error()
|
||||||
|
})
|
||||||
|
break
|
||||||
|
case 'edit':
|
||||||
|
result = await apis.host.updatePage(formRecord.value.id, params).catch(() => {
|
||||||
|
throw new Error()
|
||||||
|
})
|
||||||
|
break
|
||||||
|
}
|
||||||
|
hideLoading()
|
||||||
|
if (true === result?.success) {
|
||||||
|
hideModal()
|
||||||
|
emit('ok')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
hideLoading()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
hideLoading()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消
|
||||||
|
*/
|
||||||
|
function handleCancel() {
|
||||||
|
hideModal()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关闭后
|
||||||
|
*/
|
||||||
|
function onAfterClose() {
|
||||||
|
resetForm()
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
handleCreate,
|
||||||
|
handleEdit,
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped></style>
|
||||||
234
src/views/resource/host/components/computeList.vue
Normal file
234
src/views/resource/host/components/computeList.vue
Normal file
@ -0,0 +1,234 @@
|
|||||||
|
<template>
|
||||||
|
<a-modal :open="modal.open" :title="modal.title" :confirm-loading="modal.confirmLoading" :after-close="onAfterClose"
|
||||||
|
@ok="handleOk" @cancel="handleCancel" width="800px">
|
||||||
|
<a-card>
|
||||||
|
<div style="width: 100%;text-align: right;">
|
||||||
|
<a-button type="primary" style="margin-bottom: 10px;"
|
||||||
|
@click="$refs.computeDialogRef.handleCreate(record)">添加</a-button>
|
||||||
|
</div>
|
||||||
|
<a-table :columns="columns" :data-source="listData" :loading="loading" bordered
|
||||||
|
:pagination="paginationState" :scroll="{ x: 1000 }" row-key="id" @change="onTableChange">
|
||||||
|
<template #bodyCell="{ column, record }">
|
||||||
|
<template v-if="'action' === column.key">
|
||||||
|
<x-action-button @click="$refs.computeDialogRef.handleEdit(record)">编辑</x-action-button>
|
||||||
|
<x-action-button @click="handleDelete(record)"><span
|
||||||
|
style="color: red;">删除</span></x-action-button>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</a-table>
|
||||||
|
</a-card>
|
||||||
|
<compute-dialog ref="computeDialogRef" @ok="onComputeOk" />
|
||||||
|
</a-modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { cloneDeep } from 'lodash-es'
|
||||||
|
import apis from '@/apis'
|
||||||
|
import { useForm, useModal } from '@/hooks'
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import ComputeDialog from './ComputeDialog.vue'
|
||||||
|
import dayjs from 'dayjs'
|
||||||
|
import { message, Modal } from 'ant-design-vue'
|
||||||
|
const emit = defineEmits(['ok'])
|
||||||
|
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
|
||||||
|
const { formRef, formRules, formRecord, formData, resetForm } = useForm()
|
||||||
|
const listData = ref([])
|
||||||
|
formData.value.computingCards = []
|
||||||
|
const computeDialogRef = ref()
|
||||||
|
formRules.value = {
|
||||||
|
// name: { required: true, message: '请输入标题' },
|
||||||
|
}
|
||||||
|
const columns = [
|
||||||
|
{
|
||||||
|
title: '地区ID',
|
||||||
|
dataIndex: 'centerID',
|
||||||
|
key: 'centerID',
|
||||||
|
width: 100,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '核心数',
|
||||||
|
dataIndex: 'coreNum',
|
||||||
|
key: 'coreNum',
|
||||||
|
align: 'center',
|
||||||
|
width: 100,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'GPU数量',
|
||||||
|
dataIndex: 'gpuNum',
|
||||||
|
key: 'gpuNum',
|
||||||
|
align: 'center',
|
||||||
|
width: 100,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'GPU类型',
|
||||||
|
dataIndex: 'gpuType',
|
||||||
|
key: 'gpuType',
|
||||||
|
width: 100,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '主机ID',
|
||||||
|
dataIndex: 'hostID',
|
||||||
|
key: 'hostID',
|
||||||
|
width: 100,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '显存 (GB)',
|
||||||
|
dataIndex: 'vram',
|
||||||
|
key: 'vram',
|
||||||
|
align: 'center',
|
||||||
|
width: 120,
|
||||||
|
customRender: ({ value }) => (value !== undefined ? `${value} GB` : '-'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '是否使用',
|
||||||
|
dataIndex: 'isUse',
|
||||||
|
key: 'isUse',
|
||||||
|
align: 'center',
|
||||||
|
width: 100,
|
||||||
|
customRender: ({ value }) => (value ? '是' : '否'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '状态',
|
||||||
|
dataIndex: 'status',
|
||||||
|
key: 'status',
|
||||||
|
width: 120,
|
||||||
|
customRender: ({ value }) => {
|
||||||
|
if (value === 'active') return '启用';
|
||||||
|
if (value === 'inactive') return '停用';
|
||||||
|
return value || '-';
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '描述',
|
||||||
|
dataIndex: 'description',
|
||||||
|
key: 'description',
|
||||||
|
ellipsis: true,
|
||||||
|
width: 200,
|
||||||
|
},
|
||||||
|
{ title: '操作', key: 'action', width: 120, fixed: 'right', },
|
||||||
|
]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新建
|
||||||
|
*/
|
||||||
|
function handleCreate(record = {}) {
|
||||||
|
showModal({
|
||||||
|
type: 'create',
|
||||||
|
title: '计算卡列表',
|
||||||
|
})
|
||||||
|
formRecord.value.hostId = record.id
|
||||||
|
getDataList()
|
||||||
|
}
|
||||||
|
function getDataList() {
|
||||||
|
try {
|
||||||
|
apis.host.getComputeCardList().then((res) => {
|
||||||
|
if (true === res.success) {
|
||||||
|
listData.value = res.data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} catch (error) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
*/
|
||||||
|
function handleEdit(record = {}) {
|
||||||
|
showModal({
|
||||||
|
type: 'edit',
|
||||||
|
title: '编辑',
|
||||||
|
})
|
||||||
|
formRecord.value = record
|
||||||
|
formData.value = cloneDeep(record)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 确定
|
||||||
|
*/
|
||||||
|
function handleOk() {
|
||||||
|
formRef.value
|
||||||
|
.validateFields()
|
||||||
|
.then(async (values) => {
|
||||||
|
try {
|
||||||
|
showLoading()
|
||||||
|
const params = {
|
||||||
|
...formData.value,
|
||||||
|
}
|
||||||
|
let result = null
|
||||||
|
switch (modal.value.type) {
|
||||||
|
case 'create':
|
||||||
|
result = await apis.host.createComputeCard(params).catch(() => {
|
||||||
|
throw new Error()
|
||||||
|
})
|
||||||
|
break
|
||||||
|
case 'edit':
|
||||||
|
result = await apis.host.updatePage(formRecord.value.id, params).catch(() => {
|
||||||
|
throw new Error()
|
||||||
|
})
|
||||||
|
break
|
||||||
|
}
|
||||||
|
hideLoading()
|
||||||
|
if (true === result?.success) {
|
||||||
|
hideModal()
|
||||||
|
emit('ok')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
hideLoading()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
hideLoading()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消
|
||||||
|
*/
|
||||||
|
function handleCancel() {
|
||||||
|
hideModal()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关闭后
|
||||||
|
*/
|
||||||
|
function onAfterClose() {
|
||||||
|
resetForm()
|
||||||
|
}
|
||||||
|
function onComputeOk() {
|
||||||
|
getDataList()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
function handleDelete({ id }) {
|
||||||
|
Modal.confirm({
|
||||||
|
title: '删除提示',
|
||||||
|
content: '确认删除?',
|
||||||
|
onOk: () => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
; (async () => {
|
||||||
|
try {
|
||||||
|
const { code } = await apis.host.delComputeCard(id).catch(() => {
|
||||||
|
throw new Error()
|
||||||
|
})
|
||||||
|
if (config('http.code.success') === code) {
|
||||||
|
resolve()
|
||||||
|
message.success('删除成功')
|
||||||
|
await getDataList()
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
reject()
|
||||||
|
}
|
||||||
|
})()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
defineExpose({
|
||||||
|
handleCreate,
|
||||||
|
handleEdit,
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped></style>
|
||||||
@ -1,64 +1,19 @@
|
|||||||
<template>
|
<template>
|
||||||
<x-search-bar class="mb-8-2">
|
<x-search-bar class="mb-8-2">
|
||||||
<template #default="{ gutter, colSpan }">
|
<template #default="{ gutter, colSpan }">
|
||||||
<a-form
|
<a-form :model="searchFormData" layout="inline">
|
||||||
:label-col="{ style: { width: '100px' } }"
|
|
||||||
:model="searchFormData"
|
|
||||||
layout="inline">
|
|
||||||
<a-row :gutter="gutter">
|
<a-row :gutter="gutter">
|
||||||
<a-col v-bind="colSpan">
|
<a-col v-bind="colSpan">
|
||||||
<a-form-item name="title">
|
<a-form-item label="名称">
|
||||||
<template #label>
|
<a-input v-model="searchFormData.name"></a-input>
|
||||||
规则名称
|
|
||||||
<a-tooltip title="规则名称是唯一的 key">
|
|
||||||
<question-circle-outlined class="ml-4-1 color-placeholder" />
|
|
||||||
</a-tooltip>
|
|
||||||
</template>
|
|
||||||
<a-input v-model:value="searchFormData.title"></a-input>
|
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col v-bind="colSpan">
|
<a-col class="align-left" v-bind="colSpan">
|
||||||
<a-form-item label="描述">
|
|
||||||
<a-input></a-input>
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<template v-if="searchBarExpand">
|
|
||||||
<a-col v-bind="colSpan">
|
|
||||||
<a-form-item label="服务调用次数">
|
|
||||||
<a-input></a-input>
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col v-bind="colSpan">
|
|
||||||
<a-form-item label="状态">
|
|
||||||
<a-select></a-select>
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col v-bind="colSpan">
|
|
||||||
<a-form-item label="上次调度时间">
|
|
||||||
<a-date-picker placeholder=""></a-date-picker>
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
</template>
|
|
||||||
<a-col
|
|
||||||
class="align-right"
|
|
||||||
v-bind="colSpan">
|
|
||||||
<a-space>
|
<a-space>
|
||||||
<a-button>重置</a-button>
|
<a-button @click="handleResetSearch">{{ $t('button.reset') }}</a-button>
|
||||||
<a-button
|
<a-button ghost type="primary" @click="handleSearch">
|
||||||
ghost
|
|
||||||
type="primary"
|
|
||||||
@click="handleSearch">
|
|
||||||
搜索
|
搜索
|
||||||
</a-button>
|
</a-button>
|
||||||
<a @click="() => (searchBarExpand = !searchBarExpand)">
|
|
||||||
展开
|
|
||||||
<template v-if="searchBarExpand">
|
|
||||||
<up-outlined :style="{ fontSize: '12px' }"></up-outlined>
|
|
||||||
</template>
|
|
||||||
<template v-else>
|
|
||||||
<down-outlined :style="{ fontSize: '12px' }"></down-outlined>
|
|
||||||
</template>
|
|
||||||
</a>
|
|
||||||
</a-space>
|
</a-space>
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
@ -67,157 +22,98 @@
|
|||||||
</x-search-bar>
|
</x-search-bar>
|
||||||
<a-card>
|
<a-card>
|
||||||
<x-action-bar class="mb-8-2">
|
<x-action-bar class="mb-8-2">
|
||||||
<a-button
|
<a-button type="primary" @click="$refs.editDialogRef.handleCreate()">
|
||||||
type="primary"
|
|
||||||
@click="$refs.editDialogRef.handleCreate()">
|
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<plus-outlined></plus-outlined>
|
<plus-outlined></plus-outlined>
|
||||||
</template>
|
</template>
|
||||||
新建
|
新建
|
||||||
</a-button>
|
</a-button>
|
||||||
<template #extra>
|
|
||||||
<a-space>
|
|
||||||
<a-tooltip title="刷新">
|
|
||||||
<a-button
|
|
||||||
type="text"
|
|
||||||
@click="handleSearch">
|
|
||||||
<template #icon>
|
|
||||||
<reload-outlined></reload-outlined>
|
|
||||||
</template>
|
|
||||||
</a-button>
|
|
||||||
</a-tooltip>
|
|
||||||
<a-dropdown>
|
|
||||||
<a-tooltip title="密度">
|
|
||||||
<a-button type="text">
|
|
||||||
<template #icon>
|
|
||||||
<column-height-outlined></column-height-outlined>
|
|
||||||
</template>
|
|
||||||
</a-button>
|
|
||||||
</a-tooltip>
|
|
||||||
<template #overlay>
|
|
||||||
<a-menu
|
|
||||||
:selectedKeys="[size]"
|
|
||||||
@click="handleSize">
|
|
||||||
<a-menu-item key="default">默认</a-menu-item>
|
|
||||||
<a-menu-item key="middle">中等</a-menu-item>
|
|
||||||
<a-menu-item key="small">紧凑</a-menu-item>
|
|
||||||
</a-menu>
|
|
||||||
</template>
|
|
||||||
</a-dropdown>
|
|
||||||
<a-tooltip title="设置">
|
|
||||||
<a-button type="text">
|
|
||||||
<template #icon>
|
|
||||||
<setting-outlined></setting-outlined>
|
|
||||||
</template>
|
|
||||||
</a-button>
|
|
||||||
</a-tooltip>
|
|
||||||
</a-space>
|
|
||||||
</template>
|
|
||||||
</x-action-bar>
|
</x-action-bar>
|
||||||
<a-table
|
<a-table :columns="columns" :data-source="listData" :loading="loading" bordered :pagination="paginationState" :scroll="{ x: 1000 }" row-key="id" @change="onTableChange">
|
||||||
:columns="columns"
|
|
||||||
:data-source="listData"
|
|
||||||
:loading="loading"
|
|
||||||
:pagination="paginationState"
|
|
||||||
:size="size"
|
|
||||||
row-key="id"
|
|
||||||
@change="onTableChange">
|
|
||||||
<template #bodyCell="{ column, record }">
|
<template #bodyCell="{ column, record }">
|
||||||
|
<template v-if="'bandWidthUp' === column.dataIndex">
|
||||||
|
{{ record.bandWidthUp}}{{ record.bandWidthUnitUp }}
|
||||||
|
</template>
|
||||||
|
<template v-if="'bandWidthDown' === column.dataIndex">
|
||||||
|
{{ record.bandWidthDown}}{{ record.bandWidthUnitDown }}
|
||||||
|
</template>
|
||||||
<template v-if="'action' === column.key">
|
<template v-if="'action' === column.key">
|
||||||
<x-action-button @click="$refs.editDialogRef.handleEdit(record)">编辑</x-action-button>
|
<x-action-button @click="$refs.editDialogRef.handleEdit(record)">编辑</x-action-button>
|
||||||
<x-action-button @click="handleDelete(record)">删除</x-action-button>
|
<x-action-button @click="$refs.computeDialogRef.handleCreate(record)">算力卡</x-action-button>
|
||||||
<x-action-button>
|
<x-action-button @click="handleDelete(record)" ><span style="color: red;">删除</span></x-action-button>
|
||||||
<a-dropdown :trigger="['click']">
|
|
||||||
<more-outlined></more-outlined>
|
|
||||||
<template #overlay>
|
|
||||||
<a-menu>
|
|
||||||
<a-menu-item>菜单1</a-menu-item>
|
|
||||||
<a-menu-item>菜单2</a-menu-item>
|
|
||||||
<a-menu-item>菜单3</a-menu-item>
|
|
||||||
</a-menu>
|
|
||||||
</template>
|
|
||||||
</a-dropdown>
|
|
||||||
</x-action-button>
|
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</a-table>
|
</a-table>
|
||||||
</a-card>
|
</a-card>
|
||||||
|
|
||||||
<edit-dialog
|
<edit-dialog ref="editDialogRef" @ok="onOk" />
|
||||||
ref="editDialogRef"
|
<ComputeList ref="computeDialogRef" @ok="onComputeOk" />
|
||||||
@ok="onOk" />
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { message, Modal } from 'ant-design-vue'
|
import { message, Modal } from 'ant-design-vue'
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import {
|
import {PlusOutlined,} from '@ant-design/icons-vue'
|
||||||
ColumnHeightOutlined,
|
|
||||||
DownOutlined,
|
|
||||||
QuestionCircleOutlined,
|
|
||||||
ReloadOutlined,
|
|
||||||
SettingOutlined,
|
|
||||||
UpOutlined,
|
|
||||||
PlusOutlined,
|
|
||||||
MoreOutlined,
|
|
||||||
} from '@ant-design/icons-vue'
|
|
||||||
import apis from '@/apis'
|
import apis from '@/apis'
|
||||||
import { config } from '@/config'
|
import { config } from '@/config'
|
||||||
import { usePagination } from '@/hooks'
|
import { usePagination } from '@/hooks'
|
||||||
import EditDialog from './components/EditDialog.vue'
|
import EditDialog from './components/EditDialog.vue'
|
||||||
|
import ComputeList from './components/ComputeList.vue'
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'listTable',
|
name: 'host',
|
||||||
})
|
})
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
{ title: '主机ID', dataIndex: 'hostId' },
|
{ title: '名称', dataIndex: 'name',width: 100 },
|
||||||
{ title: '主机名称', dataIndex: 'hostName' },
|
{ title: '下行带宽', dataIndex: 'bandWidthDown',width: 100 },
|
||||||
{ title: '所属区域ID', dataIndex: 'regionId' },
|
{ title: '上行带宽', dataIndex: 'bandWidthUp',width: 100 },
|
||||||
{ title: '硬件配置—CPU', dataIndex: 'cpu' },
|
{ title: '地区名称', dataIndex: 'centerName',width: 130 },
|
||||||
{ title: '硬件配置—内存', dataIndex: 'memory' },
|
{ title: 'CPU数量', dataIndex: 'cpuNum',width: 100 },
|
||||||
{ title: '硬件配置—存储(硬盘容量)', dataIndex: 'storage' },
|
{ title: 'CPU类型', dataIndex: 'cpuType',width: 100 },
|
||||||
{ title: '挂载计算卡信息', dataIndex: 'gpu' },
|
{ title: '数据磁盘', dataIndex: 'dataDisk',width: 100 },
|
||||||
{ title: 'IP地址', dataIndex: 'ip' },
|
{ title: '数据磁盘', dataIndex: 'dataDiskType',width: 100 },
|
||||||
{ title: '运行状态', dataIndex: 'status' },
|
{ title: '部署位置', dataIndex: 'deploymentLocation',width: 100 },
|
||||||
{ title: '网络带宽', dataIndex: 'bandwidth' },
|
{ title: '外网ip', dataIndex: 'externalIp',width: 100 },
|
||||||
{ title: '创建时间', dataIndex: 'createdAt' },
|
{ title: '内网ip', dataIndex: 'intranetIP' ,width: 100},
|
||||||
{ title: '更新时间(最后更新时间)', dataIndex: 'updatedAt' },
|
{ title: '内存(GB)', dataIndex: 'memory',width: 100 },
|
||||||
{ title: '操作人', dataIndex: 'operator' },
|
{ title: '状态', dataIndex: 'status',width: 100 },
|
||||||
{ title: '操作', key: 'action', width: 160 },
|
{ title: '系统磁盘大小', dataIndex: 'systemDisk',width: 130 },
|
||||||
|
{ title: '系统磁盘类型', dataIndex: 'systemDiskType',width: 130 },
|
||||||
|
{ title: '操作', key: 'action', width: 220,fixed: 'right', },
|
||||||
]
|
]
|
||||||
// const { listData, paginationState, loading, showLoading, hideLoading, resetPagination, searchFormData } =
|
const { listData, paginationState, loading, showLoading, hideLoading, resetPagination, searchFormData } =
|
||||||
// usePagination()
|
usePagination()
|
||||||
const listData = ref([])
|
|
||||||
const editDialogRef = ref()
|
const editDialogRef = ref()
|
||||||
const searchBarExpand = ref(false)
|
const computeDialogRef = ref()
|
||||||
const size = ref('default')
|
|
||||||
|
|
||||||
// getPageList()
|
const searchBarExpand = ref(false)
|
||||||
|
|
||||||
|
|
||||||
|
getPageList()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取分页列表
|
* 获取分页列表
|
||||||
*/
|
*/
|
||||||
async function getPageList() {
|
async function getPageList() {
|
||||||
try {
|
try {
|
||||||
// showLoading()
|
showLoading()
|
||||||
// const { pageSize, current } = paginationState
|
const { pageSize, current } = paginationState
|
||||||
// const { code, data } = await apis.common
|
const { success, data } = await apis.host
|
||||||
// .getPageList({
|
.getPageList({
|
||||||
// pageSize,
|
pageSize,
|
||||||
// current: current,
|
current: current,
|
||||||
// })
|
})
|
||||||
// .catch(() => {
|
.catch(() => {
|
||||||
// throw new Error()
|
throw new Error()
|
||||||
// })
|
})
|
||||||
// hideLoading()
|
hideLoading()
|
||||||
// if (config('http.code.success') === code) {
|
if (config('http.code.success') === success) {
|
||||||
// const { records, pagination } = data
|
listData.value = data
|
||||||
// listData.value = records
|
paginationState.total = pagination.total
|
||||||
// paginationState.total = pagination.total
|
}
|
||||||
// }
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// hideLoading()
|
hideLoading()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -225,8 +121,8 @@ async function getPageList() {
|
|||||||
* 搜索
|
* 搜索
|
||||||
*/
|
*/
|
||||||
function handleSearch() {
|
function handleSearch() {
|
||||||
// resetPagination()
|
resetPagination()
|
||||||
// getPageList()
|
getPageList()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -238,9 +134,9 @@ function handleDelete({ id }) {
|
|||||||
content: '确认删除?',
|
content: '确认删除?',
|
||||||
onOk: () => {
|
onOk: () => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
;(async () => {
|
; (async () => {
|
||||||
try {
|
try {
|
||||||
const { code } = await apis.common.del(id).catch(() => {
|
const { code } = await apis.host.delPage(id).catch(() => {
|
||||||
throw new Error()
|
throw new Error()
|
||||||
})
|
})
|
||||||
if (config('http.code.success') === code) {
|
if (config('http.code.success') === code) {
|
||||||
@ -257,30 +153,30 @@ function handleDelete({ id }) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 密度
|
|
||||||
* @param {string} key
|
|
||||||
*/
|
|
||||||
function handleSize({ key }) {
|
|
||||||
size.value = key
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 表格发生改变
|
* 表格发生改变
|
||||||
* @param current
|
* @param current
|
||||||
* @param pageSize
|
* @param pageSize
|
||||||
*/
|
*/
|
||||||
function onTableChange({ current, pageSize }) {
|
function onTableChange({ current, pageSize }) {
|
||||||
// paginationState.current = current
|
paginationState.current = current
|
||||||
// paginationState.pageSize = pageSize
|
paginationState.pageSize = pageSize
|
||||||
// getPageList()
|
getPageList()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 完成
|
* 完成
|
||||||
*/
|
*/
|
||||||
function onOk() {
|
function onOk() {
|
||||||
// getPageList()
|
getPageList()
|
||||||
|
}
|
||||||
|
function onComputeOk() {
|
||||||
|
getPageList()
|
||||||
|
}
|
||||||
|
function handleResetSearch() {
|
||||||
|
searchFormData.value = {}
|
||||||
|
resetPagination()
|
||||||
|
getPageList()
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user