接口和字段定义完成

This commit is contained in:
Leo_Ding 2026-01-26 18:34:56 +08:00
parent ca7615d962
commit a8a4e4964f
24 changed files with 1075 additions and 2691 deletions

View File

@ -0,0 +1,16 @@
/**
* 算力券接口
*/
import request from '@/utils/request'
// 获取列表
export const getPageList = (params) => request.basic.get('/api/v1/mirror', params)
// 新增
export const addVouchers = (params) => request.basic.post(`/api/v1/mirror`,params)
// 编辑
export const editeVouchers = (params) => request.basic.put(`/api/v1/mirror${params.id}`, params)
// 删除
export const deleteVouchers = (id) => request.basic.delete('/api/v1/mirror/'+id)
// 获取详情
export const getImagesInfo = (params) => request.basic.get('/api/v1/mirror')

View File

@ -0,0 +1,20 @@
/**
* 提现接口
*/
import request from '@/utils/request'
// 获取待审核列表
export const getPageList = (params) => request.basic.get('/api/v1/pendingReviewList', params)
// 审核
export const review = (params) => request.basic.post(`/api/v1/review`,params)
// 审核拒绝列表
export const getFaildList = (params) => request.basic.get('/api/v1/withdrawRejectList', params)
// 待提现列表
export const getPendingList = (params) => request.basic.get('/api/v1/withdrawList', params)
// 提现确认
export const pendingUpload = (params) => request.basic.post('/api/v1/withdrawChecked', params)
// 提现失败列表
export const getPendingFaildList = (params) => request.basic.post('/api/v1/withdrawErrorList', params)
//提现成功列表
export const getInvoicingFailedList=(params)=>request.basic.get('/api/v1/withdrawSuccessList',params)

View File

@ -0,0 +1,28 @@
/**
* 算力券接口
*/
import request from '@/utils/request'
// 获取列表
export const getPageList = (params) => request.basic.get('/api/v1/vouchers', params)
// 新增
export const addVouchers = (params) => request.basic.post(`/api/v1/vouchers`,params)
// 编辑
export const editeVouchers = (params) => request.basic.put(`/api/v1/vouchers${params.id}`, params)
// 删除
export const deleteVouchers = (id) => request.basic.delete('/api/v1/withdrawList/'+id)
//算力点列表
export const getPointList=(params)=>request.basic.get('/api/v1/points',params)
//新增算力点
export const addPoint=(params)=>request.basic.post('/api/v1/points',params)
//余额列表
export const getBalanceList=(params)=>request.basic.get('/api/v1/balances',params)
//新增余额
export const addBalance=(params)=>request.basic.post('/api/v1/balances',params)
//实例订单
export const getOrderList=(params)=>request.basic.get('/api/v1/orders',params)

View File

@ -16,7 +16,7 @@ export default [
{ {
path: 'balanceList', path: 'balanceList',
name: 'balanceList', name: 'balanceList',
component: 'balance/balanceList/index.vue', component: 'balance/index.vue',
meta: { meta: {
title: '余额列表', title: '余额列表',
isMenu: true, isMenu: true,

View File

@ -1,64 +1,32 @@
<template> <template>
<a-modal :open="modal.open" :title="modal.title" :width="640" :confirm-loading="modal.confirmLoading" <a-modal :open="modal.open" :title="modal.title" :confirm-loading="modal.confirmLoading" :after-close="onAfterClose"
:after-close="onAfterClose" :cancel-text="cancelText" :ok-text="okText" @ok="handleOk" @cancel="handleCancel"> @ok="handleOk" @cancel="handleCancel">
<a-form ref="formRef" :model="formData" :rules="formRules"> <a-card>
<a-card class="mb-8-2"> <a-form ref="formRef" scroll-to-first-error :model="formData" :rules="formRules">
<a-row :gutter="24"> <a-form-item label="金额" name="amount">
<a-col :span="24"> <a-input-number v-model:value="formData.amount" :precision="2" style="width: 100%;"></a-input-number>
<a-form-item :label="$t('pages.system.role.form.name')" name="name">
<a-input v-model:value="formData.name"></a-input>
</a-form-item> </a-form-item>
</a-col> <a-form-item label="变更类型" name="changeType">
<a-input v-model:value="formData.changeType"></a-input>
<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> </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' },
]"></a-radio-group>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item :label="'描述'">
<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> </a-form>
</a-card>
</a-modal> </a-modal>
</template> </template>
<script setup> <script setup>
import { cloneDeep } from 'lodash-es' import { cloneDeep } from 'lodash-es'
import { message } from 'ant-design-vue'
import { ref, watch } from 'vue'
import { config } from '@/config'
import apis from '@/apis' import apis from '@/apis'
import { useForm, useModal } from '@/hooks' import { useForm, useModal } from '@/hooks'
import GxUpload from '@/components/GxUpload/index.vue'
const emit = defineEmits(['ok']) const emit = defineEmits(['ok'])
import { useI18n } from 'vue-i18n'
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal() const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
const { formRecord, formData, formRef, formRules, resetForm } = useForm() const { formRef, formRules, formRecord, formData, resetForm } = useForm()
const { t } = useI18n() // t
const cancelText = ref(t('button.cancel'))
const okText = ref(t('button.confirm'))
formData.value.enabled='enabled'
formRules.value = { formRules.value = {
name: { required: true, message: t('pages.system.role.form.name.placeholder') }, point: { required: true, message: '请输入金额' },
code: { required: true, message: t('pages.system.role.form.code.placeholder') }, changeType:{required:true,message:'请选择变更类型'}
status: { required: true, message: t('pages.system.role.form.status.placeholder') },
} }
/** /**
@ -67,34 +35,20 @@ formRules.value = {
function handleCreate() { function handleCreate() {
showModal({ showModal({
type: 'create', type: 'create',
title: t('pages.system.role.add'), title: '新增算力点',
}) })
} }
/** /**
* 编辑 * 编辑
*/ */
async function handleEdit(record = {}) { function handleEdit(record = {}) {
showModal({ showModal({
type: 'edit', type: 'edit',
title: t('pages.system.role.edit'), title: '添加余额',
}) })
formRecord.value.userId = record.userId
const { data, success } = await apis.role.getRole(record.id).catch() formData.value = cloneDeep(record)
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,22 +60,24 @@ function handleOk() {
.then(async (values) => { .then(async (values) => {
try { try {
showLoading() showLoading()
const params = {...values} const params = {
...formData.value,
}
let result = null let result = null
switch (modal.value.type) { switch (modal.value.type) {
case 'create': case 'create':
result = await apis.banner.createBanner(params).catch(() => { result = await apis.vouchers.addPoint(params).catch(() => {
throw new Error() throw new Error()
}) })
break break
case 'edit': case 'edit':
result = await apis.banner.updateBanner(formData.value.id, params).catch(() => { result = await apis.vouchers.addBalance(params).catch(() => {
throw new Error() throw new Error()
}) })
break break
} }
hideLoading() hideLoading()
if (config('http.code.success') === result?.success) { if (200 === result?.code) {
hideModal() hideModal()
emit('ok') emit('ok')
} }
@ -146,7 +102,6 @@ function handleCancel() {
*/ */
function onAfterClose() { function onAfterClose() {
resetForm() resetForm()
hideLoading()
} }
defineExpose({ defineExpose({

View File

@ -4,16 +4,20 @@
<a-form :model="searchFormData" layout="inline"> <a-form :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 :label="$t('pages.system.role.form.name')" name="name"> <a-form-item name="username" label="用户名">
<a-input :placeholder="$t('pages.system.role.form.code.placeholder')" <a-input v-model:value="searchFormData.username"></a-input>
v-model:value="searchFormData.name"></a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col class="align-right" v-bind="colSpan"> <a-col v-bind="colSpan">
<a-form-item label="手机号" title="phone">
<a-input v-model:value="searchFormData.phone"></a-input>
</a-form-item>
</a-col>
<a-col class="align-left" v-bind="colSpan">
<a-space> <a-space>
<a-button @click="handleResetSearch">{{ $t('button.reset') }}</a-button> <a-button @click="handleResetSearch">{{ $t('button.reset') }}</a-button>
<a-button ghost type="primary" @click="handleSearch"> <a-button ghost type="primary" @click="handleSearch">
{{ $t('button.search') }} 搜索
</a-button> </a-button>
</a-space> </a-space>
</a-col> </a-col>
@ -21,111 +25,71 @@
</a-form> </a-form>
</template> </template>
</x-search-bar> </x-search-bar>
<a-row :gutter="8" :wrap="false"> <a-card>
<a-col flex="auto"> <!-- <p><a-button type="primary" @click="$refs.editDialogRef.handleCreate()">新增</a-button></p> -->
<a-card type="flex"> <a-table :columns="columns" :data-source="listData" :loading="loading" bordered :pagination="paginationState"
<x-action-bar class="mb-8-2"> :size="size" row-key="id" @change="onTableChange">
<a-button v-action="'add'" type="primary" @click="$refs.editDialogRef.handleCreate()">
<template #icon>
<plus-outlined></plus-outlined>
</template>
添加图片
</a-button>
</x-action-bar>
<a-table :columns="columns" :data-source="listData" :loading="loading" :pagination="paginationState"
:scroll="{ x: 1000 }" @change="onTableChange">
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
<template v-if="'statusType' === column.key">
<!--状态-->
<a-tag v-if="statusTypeEnum.is('enabled', record.status)" color="processing">
{{ statusTypeEnum.getDesc(record.status) }}
</a-tag>
<!--状态-->
<a-tag v-if="statusTypeEnum.is('disabled', record.status)" color="processing">
{{ statusTypeEnum.getDesc(record.status) }}
</a-tag>
</template>
<template v-if="'createAt' === column.key">
{{ formatUtcDateTime(record.created_at) }}
</template>
<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)">添加余额</x-action-button>
<a-tooltip> <!-- <x-action-button @click="handleDelete(record)">删除</x-action-button> -->
<template #title> {{ $t('pages.system.role.edit') }}</template>
<edit-outlined />
</a-tooltip>
</x-action-button>
<x-action-button @click="handleRemove(record)">
<a-tooltip>
<template #title> {{ $t('pages.system.delete') }}</template>
<delete-outlined style="color: #ff4d4f" />
</a-tooltip>
</x-action-button>
</template> </template>
</template> </template>
</a-table> </a-table>
</a-card> </a-card>
</a-col> <edit-dialog ref="editDialogRef" @ok="onOk" />
</a-row>
<edit-dialog ref="editDialogRef" @ok="onOk"></edit-dialog>
</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 apis from '@/apis' import apis from '@/apis'
import { formatUtcDateTime } from '@/utils/util'
import { config } from '@/config' import { config } from '@/config'
import { statusTypeEnum } from '@/enums/system' import { usePagination } from '@/hooks'
import { usePagination, useForm } from '@/hooks'
import EditDialog from './components/EditDialog.vue' import EditDialog from './components/EditDialog.vue'
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue'
import { useI18n } from 'vue-i18n'
defineOptions({ defineOptions({
name: 'systemRole', name: 'balance',
}) })
const { t } = useI18n() // t
const columns = [
{ title: '缩略图', dataIndex: 'code', width: 240 },
{ title: '名称', dataIndex: 'name' },
{ title: t('pages.system.role.form.status'), dataIndex: 'status', key: 'statusType', width: 80 },
{ title: t('pages.system.role.form.sequence'), dataIndex: 'sequence', width: 100 },
{ title: t('pages.system.role.form.created_at'), key: 'createAt', fixed: 'right', width: 120 },
{ title: t('button.action'), key: 'action', fixed: 'right', width: 120 },
]
const { listData, loading, showLoading, hideLoading, paginationState, searchFormData, resetPagination } = const columns = [
usePagination() { title: '用户名', dataIndex: 'username' },
const { resetForm } = useForm() { title: '手机号', dataIndex: 'phone' },
{ title: '变更前', dataIndex: 'balanceBeforeChange' },
{ title: '变更后', dataIndex: 'remainingBalance' },
{ title: '变更量', dataIndex: 'changeValue' },
{ title: '变更时间', dataIndex: 'lastChangeTime' },
{ title: '变更类型', dataIndex: 'changeType' },
{ title: '操作', dataIndex: 'action' },
]
const { listData, paginationState, loading, showLoading, hideLoading, resetPagination, searchFormData } =usePagination()
const editDialogRef = ref() const editDialogRef = ref()
const searchBarExpand = ref(false)
const size = ref('default')
getPageList() getPageList()
/** /**
* 获取用户列表 * 获取分页列表
* @returns {Promise<void>}
*/ */
async function getPageList() { async function getPageList() {
try { try {
showLoading() showLoading()
const { pageSize, current } = paginationState const { pageSize, current } = paginationState
const { success, data, total } = await apis.role const { code, data } = await apis.vouchers
.getRoleList({ .getBalanceList({
pageSize, pageSize,
current: current, current: current,
...searchFormData.value, ...searchFormData.value
}) })
.catch(() => { .catch(() => {
throw new Error() throw new Error()
}) })
hideLoading() hideLoading()
if (config('http.code.success') === success) { if (config('http.code.success') === code) {
listData.value = data const { records, pagination } = data
paginationState.total = total listData.value = records
paginationState.total = pagination.total
} }
} catch (error) { } catch (error) {
hideLoading() hideLoading()
@ -133,23 +97,30 @@ async function getPageList() {
} }
/** /**
* 移除 * 搜索
*/ */
function handleRemove({ id }) { function handleSearch() {
resetPagination()
getPageList()
}
/**
* 删除
*/
function handleDelete({ id }) {
Modal.confirm({ Modal.confirm({
title: t('pages.system.role.delTip'), title: '删除提示',
content: t('button.confirm'), content: '确认删除?',
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 { code } = await apis.vouchers.deleteVouchers(id).catch(() => {
throw new Error() throw new Error()
}) })
if (config('http.code.success') === success) { if (config('http.code.success') === code) {
resolve() resolve()
message.success(t('component.message.success.delete')) message.success('删除成功')
await getPageList() await getPageList()
} }
} catch (error) { } catch (error) {
@ -162,7 +133,17 @@ function handleRemove({ id }) {
} }
/** /**
* 分页 * 密度
* @param {string} key
*/
function handleSize({ key }) {
size.value = key
}
/**
* 表格发生改变
* @param current
* @param pageSize
*/ */
function onTableChange({ current, pageSize }) { function onTableChange({ current, pageSize }) {
paginationState.current = current paginationState.current = current
@ -170,6 +151,12 @@ function onTableChange({ current, pageSize }) {
getPageList() getPageList()
} }
/**
* 完成
*/
function onOk() {
getPageList()
}
/** /**
* 重置 * 重置
*/ */
@ -178,22 +165,6 @@ function handleResetSearch() {
resetPagination() resetPagination()
getPageList() getPageList()
} }
/**
* 搜索
*/
function handleSearch() {
resetForm()
resetPagination()
getPageList()
}
/**
* 编辑完成
*/
async function onOk() {
await getPageList()
}
</script> </script>
<style lang="less" scoped></style> <style lang="less" scoped></style>

View File

@ -1,222 +1,50 @@
<template> <template>
<a-modal <a-modal :open="modal.open" :title="modal.title" :confirm-loading="modal.confirmLoading" :after-close="onAfterClose"
:width="640" @ok="handleOk" @cancel="handleCancel">
:open="modal.open" <a-card>
:title="modal.title" <a-form ref="formRef" scroll-to-first-error :model="formData" :rules="formRules">
:confirm-loading="modal.confirmLoading" <a-form-item label="算力点" name="point">
:after-close="onAfterClose" <a-input-number v-model:value="formData.point" :precision="2" style="width: 100%;"></a-input-number>
:cancel-text="cancelText"
:ok-text="okText"
@ok="handleOk"
@cancel="handleCancel">
<a-form
layout="vertical"
ref="formRef"
:model="formData"
:rules="formRules">
<a-card class="mb-8-2">
<a-row :gutter="12">
<a-col :span="12">
<a-form-item
:label="$t('pages.system.menu.form.parent_name')"
name="parent_id">
<a-tree-select
v-model:value="formData.parent_id"
tree-default-expand-all></a-tree-select>
</a-form-item> </a-form-item>
</a-col>
<a-col :span="12">
<a-form-item
:label="$t('pages.system.menu.form.type')"
name="type">
<a-radio-group
v-model:value="formData.type"
:options="menuTypeEnum.getOptions()"></a-radio-group>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item
:label="$t('pages.system.menu.form.name')"
name="name">
<a-input v-model:value="formData.name"></a-input>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item
:label="$t('pages.system.menu.resource.form.path')"
name="path">
<a-input v-model:value="formData.path"></a-input>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item name="code">
<template #label>
<span class="mr-4-1">{{ $t('pages.system.menu.form.code') }}</span>
<a-tooltip :title="$t('pages.system.menu.form.code')">
<question-circle-outlined class="color-secondary"></question-circle-outlined>
</a-tooltip>
</template>
<a-input v-model:value="formData.code"></a-input>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item
:label="$t('pages.system.menu.form.status')"
name="status">
<a-radio-group
v-model:value="formData.status"
:options="statusTypeEnum.getOptions()"></a-radio-group>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item
style="width: 200px"
:label="$t('pages.system.menu.form.sequence')"
name="sequence">
<a-input
:defaultValue="0"
type="number"
v-model:value="formData.sequence"></a-input>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item
:label="$t('pages.system.menu.form.description')"
name="description">
<a-input v-model:value="formData.description"></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item
:label="$t('pages.system.menu.form.properties')"
name="properties">
<a-textarea v-model:value="formData.properties"></a-textarea>
</a-form-item>
</a-col>
</a-row>
</a-card>
<a-card :title="$t('pages.system.menu.resource.form.title')">
<a-table
:columns="columns"
:data-source="formData.resources"
:pagination="false"
row-key="id">
<template #bodyCell="{ column, record, index }">
<template v-if="column.key === 'types'">
<a-form-item :label="$t('pages.system.menu.resource.form.method')">
<a-input-group
style="display: inline-block; vertical-align: middle"
:compact="true">
<a-form-item-rest>
<a-select
v-model:value="record.method"
:default-value="record.method || 'GET'"
style="width: 100px">
<a-select-option
v-for="item of reqType"
:key="item"
:value="item"
>{{ item }}</a-select-option
>
</a-select>
</a-form-item-rest>
<a-input
v-model:value="record.path"
:style="{ width: 'calc(100% - 100px)' }" />
</a-input-group>
</a-form-item>
</template>
<template v-if="column.key === 'action'">
<x-action-button @click="handleDelete(index)"> {{ $t('button.delete') }}</x-action-button>
</template>
</template>
</a-table>
<a-button
@click="handleAddApi"
block
class="mt-8-2"
type="dashed">
<template #icon>
<plus-outlined></plus-outlined>
</template>
{{ $t('button.add') }}
</a-button>
</a-card>
<template v-if="menuTypeEnum.is('menu', formData.type)"> </template>
<template v-if="statusTypeEnum.is('enabled', formData.status)"> </template>
</a-form> </a-form>
</a-card>
</a-modal> </a-modal>
</template> </template>
<script setup> <script setup>
import { cloneDeep } from 'lodash-es' import { cloneDeep } from 'lodash-es'
import { QuestionCircleOutlined } from '@ant-design/icons-vue'
import apis from '@/apis' import apis from '@/apis'
import { useModal, useForm } from '@/hooks' import { useForm, useModal } from '@/hooks'
import { menuTypeEnum, statusTypeEnum } from '@/enums/system'
import { ref } from 'vue'
import { config } from '@/config'
import { useI18n } from 'vue-i18n'
const emit = defineEmits(['ok']) const emit = defineEmits(['ok'])
const { t } = useI18n() // t
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal() const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
const { formData, formRef, formRules, resetForm } = useForm() const { formRef, formRules, formRecord, formData, resetForm } = useForm()
formRules.value = { formRules.value = {
name: { required: true, message: t('pages.system.menu.form.name.placeholder') }, point: { required: true, message: '请输入算力点' }
code: { required: true, message: t('pages.system.menu.form.code.placeholder') },
} }
const columns = [
{ title: t('pages.system.menu.form.path'), dataIndex: 'types', key: 'types' },
{ title: t('button.action'), dataIndex: 'action', key: 'action' },
]
const reqType = ['GET', 'POST', 'PUT', 'PATCH', 'HEAD', 'DELETE']
const cancelText = ref(t('button.cancel'))
const okText = ref(t('button.confirm'))
/** /**
* 新建 * 新建
*/ */
function handleCreate() { function handleCreate() {
formData.value.resources = []
showModal({ showModal({
type: 'create', type: 'create',
title: t('pages.system.menu.add'), title: '新增算力点',
}) })
} }
/**
* 添加下级
* handleCreateChild
*/
function handleCreateChild(record = {}) {
formData.value.resources = []
showModal({
type: 'create',
title: t('pages.system.menu.button.addChild'),
})
formData.value.parent_id = record.id
}
/** /**
* 编辑 * 编辑
*/ */
async function handleEdit(record = {}) { function handleEdit(record = {}) {
showModal({ showModal({
type: 'edit', type: 'edit',
title: t('pages.system.menu.edit'), title: '新增算力点',
}) })
const { data } = await apis.menu.getMenu(record.id).catch(() => { formRecord.value.userId = record.userId
throw new Error() formData.value = cloneDeep(record)
})
formData.value = cloneDeep(data)
formData.value.properties = formData.value.properties ? JSON.parse(formData.value.properties) : ''
formData.value.resources = formData.value.resources || (formData.value.resources = [])
} }
/** /**
@ -229,28 +57,23 @@ function handleOk() {
try { try {
showLoading() showLoading()
const params = { const params = {
...values, ...formData.value,
} }
params.sequence = Number.parseInt(params.sequence) || 0
params.properties = JSON.stringify(params.properties)
let result = null let result = null
switch (modal.value.type) { switch (modal.value.type) {
case 'create': case 'create':
result = await apis.menu.createMenu(params).catch(() => { result = await apis.vouchers.addPoint(params).catch(() => {
throw new Error() throw new Error()
}) })
break break
case 'edit': case 'edit':
newApiData() result = await apis.vouchers.addPoint(params).catch(() => {
params.resources = formData.value.resources
result = await apis.menu.updateMenu(formData.value.id, params).catch(() => {
throw new Error() throw new Error()
}) })
break break
} }
hideLoading() hideLoading()
if (config('http.code.success') === result?.success) { if (200 === result?.code) {
hideModal() hideModal()
emit('ok') emit('ok')
} }
@ -270,44 +93,15 @@ function handleCancel() {
hideModal() hideModal()
} }
/**
* 针对API 做一次 menu_id
*/
function newApiData() {
if (formData.value.resources)
formData.value.resources.forEach((item) => {
item.menu_id = formData.value.id
})
}
/** /**
* 关闭后 * 关闭后
*/ */
function onAfterClose() { function onAfterClose() {
resetForm() resetForm()
hideLoading()
}
/**
* 添加API
*/
function handleAddApi() {
formData.value.resources.push({
method: 'GET',
path: '',
})
} /**
* 删除API
*/
function handleDelete(index) {
formData.value.resources.splice(index, 1)
} }
defineExpose({ defineExpose({
handleCreate, handleCreate,
handleCreateChild,
handleEdit, handleEdit,
}) })
</script> </script>

View File

@ -1,33 +1,23 @@
<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 :label-col="{ style: { width: '100px' } }" :model="searchFormData" layout="inline"> <a-form :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 :label="$t('pages.system.menu.form.name')" name="name"> <a-form-item name="username" label="用户名">
<a-input :placeholder="$t('pages.system.menu.form.name.placeholder')" <a-input v-model:value="searchFormData.username"></a-input>
v-model:value="searchFormData.name"></a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col v-bind="colSpan"> <a-col v-bind="colSpan">
<a-form-item name="code"> <a-form-item label="手机号" title="phone">
<template #label> <a-input v-model:value="searchFormData.phone"></a-input>
{{ $t('pages.system.menu.form.code') }}
<a-tooltip :title="$t('pages.system.menu.form.code')">
<question-circle-outlined class="ml-4-1 color-placeholder" />
</a-tooltip>
</template>
<a-input :placeholder="$t('pages.system.menu.form.code.placeholder')"
v-model:value="searchFormData.code"></a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col class="align-left" v-bind="colSpan">
<a-col class="align-right" v-bind="colSpan">
<a-space> <a-space>
<a-button @click="handleResetSearch">{{ $t('button.reset') }}</a-button> <a-button @click="handleResetSearch">{{ $t('button.reset') }}</a-button>
<a-button ghost type="primary" @click="handleSearch"> <a-button ghost type="primary" @click="handleSearch">
{{ $t('button.search') }} 搜索
</a-button> </a-button>
</a-space> </a-space>
</a-col> </a-col>
@ -36,168 +26,102 @@
</template> </template>
</x-search-bar> </x-search-bar>
<a-card> <a-card>
<i class="iconfont icon-gonggao" style="color: red;"></i> <!-- <p><a-button type="primary" @click="$refs.editDialogRef.handleCreate()">新增</a-button></p> -->
<span>引入阿里巴巴图标</span> <a-table :columns="columns" :data-source="listData" :loading="loading" bordered :pagination="paginationState"
<x-action-bar class="mb-8-2"> :size="size" row-key="id" @change="onTableChange">
<a-button v-action="'add'" type="primary" @click="$refs.editDialogRef.handleCreate()">
<template #icon>
<plus-outlined></plus-outlined>
</template>
{{ $t('pages.system.menu.add') }}
</a-button>
</x-action-bar>
<a-table rowKey="id" :loading="loading" :pagination="true" :columns="columns" :data-source="listData">
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
<template v-if="'menuType' === column.key">
<!--菜单-->
<a-tag v-if="menuTypeEnum.is('page', record.type)" color="processing">
{{ menuTypeEnum.getDesc(record.type) }}
</a-tag>
<!--按钮-->
<a-tag v-if="menuTypeEnum.is('button', record.type)" color="success">
{{ menuTypeEnum.getDesc(record.type) }}
</a-tag>
</template>
<template v-if="'createAt' === column.key">
{{ formatUtcDateTime(record.created_at) }}
</template>
<template v-if="'statusType' === column.key">
<!--状态-->
<a-tag v-if="statusTypeEnum.is('enabled', record.status)" color="processing">
{{ statusTypeEnum.getDesc(record.status) }}
</a-tag>
<!--状态-->
<a-tag v-if="statusTypeEnum.is('disabled', record.status)" color="processing">
{{ statusTypeEnum.getDesc(record.status) }}
</a-tag>
</template>
<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)">新增</x-action-button>
<a-tooltip> <x-action-button @click="handleDelete(record)">删除</x-action-button>
<template #title>{{ $t('pages.system.menu.edit') }}</template>
<edit-outlined />
</a-tooltip>
</x-action-button>
<x-action-button @click="$refs.editDialogRef.handleCreateChild(record)">
<a-tooltip>
<template #title>{{ $t('pages.system.menu.button.addChild') }}</template>
<plus-circle-outlined />
</a-tooltip>
</x-action-button>
<x-action-button @click="handleDelete(record)">
<a-tooltip>
<template #title>{{ $t('pages.system.delete') }}</template>
<delete-outlined style="color: #ff4d4f" />
</a-tooltip>
</x-action-button>
</template> </template>
</template> </template>
</a-table> </a-table>
</a-card> </a-card>
<edit-dialog ref="editDialogRef" @ok="onOk" />
<edit-dialog @ok="onOk" ref="editDialogRef" />
</template> </template>
<script setup> <script setup>
import { Modal, message } from 'ant-design-vue' import { message, Modal } from 'ant-design-vue'
import { ref } from 'vue' import { ref } from 'vue'
import { PlusOutlined, EditOutlined, DeleteOutlined, PlusCircleOutlined } from '@ant-design/icons-vue'
import apis from '@/apis' import apis from '@/apis'
import { config } from '@/config' import { config } from '@/config'
import { menuTypeEnum, statusTypeEnum } from '@/enums/system' import { usePagination } from '@/hooks'
import { usePagination, useForm } from '@/hooks'
import { formatUtcDateTime } from '@/utils/util'
import EditDialog from './components/EditDialog.vue' import EditDialog from './components/EditDialog.vue'
import { useI18n } from 'vue-i18n'
defineOptions({ defineOptions({
// eslint-disable-next-line vue/no-reserved-component-names name: 'listTable',
name: 'menu',
}) })
const { t } = useI18n() // t
const columns = ref([
{ title: t('pages.system.menu.form.name'), dataIndex: 'name', key: 'name', fixed: true },
{ title: t('pages.system.menu.form.code'), dataIndex: 'code', key: 'code' },
{ title: t('pages.system.menu.form.type'), dataIndex: 'type', key: 'menuType', width: 80 }, const columns = [
{ title: t('pages.system.menu.form.status'), dataIndex: 'status', key: 'statusType', width: 80 }, { title: '用户名', dataIndex: 'username' },
{ title: t('pages.system.menu.form.sequence'), dataIndex: 'sequence', width: 100 }, { title: '手机号', dataIndex: 'phone' },
{ title: t('pages.system.menu.form.created_at'), dataIndex: 'created_at', key: 'createAt', width: 180 }, { title: '变更前', dataIndex: 'pointsBeforeChange' },
{ title: t('button.action'), key: 'action', width: 180 }, { title: '变更后', dataIndex: 'remainingPoints' },
]) { title: '变更量', dataIndex: 'changeValue' },
const { listData, loading, showLoading, hideLoading, searchFormData, paginationState, resetPagination } = { title: '变更时间', dataIndex: 'lastChangeTime' },
usePagination() { title: '变更类型', dataIndex: 'changeType' },
const { resetForm } = useForm() { title: '操作', dataIndex: 'action' },
]
const { listData, paginationState, loading, showLoading, hideLoading, resetPagination, searchFormData } =usePagination()
const editDialogRef = ref() const editDialogRef = ref()
const searchBarExpand = ref(false)
const size = ref('default')
getMenuList() getPageList()
/** /**
* 获取菜单列表 * 获取分页列表
* @return {Promise<void>}
*/ */
async function getMenuList() { async function getPageList() {
try { try {
showLoading() showLoading()
// const { current } = paginationState const { pageSize, current } = paginationState
const { data, success, total } = await apis.menu const { code, data } = await apis.vouchers
.getMenuList({ .getPointList({
...searchFormData.value, pageSize,
current: current,
...searchFormData.value
}) })
.catch(() => { .catch(() => {
throw new Error() throw new Error()
}) })
hideLoading() hideLoading()
if (config('http.code.success') === success) { if (config('http.code.success') === code) {
data.forEach((item) => { const { records, pagination } = data
item.name = t(item.code) || item.name listData.value = records
}) paginationState.total = pagination.total
listData.value = data
paginationState.total = total
} }
} catch (error) { } catch (error) {
hideLoading() hideLoading()
} }
} }
/** /**
* 搜索 * 搜索
*/ */
function handleSearch() { function handleSearch() {
resetForm()
resetPagination() resetPagination()
getMenuList() getPageList()
}
/**
* 重置
*/
function handleResetSearch() {
searchFormData.value = {}
resetPagination()
getMenuList()
} }
/** /**
* 删除 * 删除
* @param id
*/ */
function handleDelete({ id }) { function handleDelete({ id }) {
Modal.confirm({ Modal.confirm({
title: t('pages.system.menu.delTip'), title: '删除提示',
content: t('button.confirm'), content: '确认删除?',
okText: t('button.confirm'),
onOk: () => { onOk: () => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
; (async () => { ; (async () => {
try { try {
const { success } = await apis.menu.delMenu(id).catch(() => { const { code } = await apis.vouchers.deleteVouchers(id).catch(() => {
throw new Error() throw new Error()
}) })
if (config('http.code.success') === success) { if (config('http.code.success') === code) {
resolve() resolve()
message.success(t('component.message.success.delete')) message.success('删除成功')
await getMenuList() await getPageList()
} }
} catch (error) { } catch (error) {
reject() reject()
@ -207,11 +131,39 @@ function handleDelete({ id }) {
}, },
}) })
} }
/** /**
* 编辑完成 * 密度
* @param {string} key
*/ */
async function onOk() { function handleSize({ key }) {
await getMenuList() size.value = key
}
/**
* 表格发生改变
* @param current
* @param pageSize
*/
function onTableChange({ current, pageSize }) {
paginationState.current = current
paginationState.pageSize = pageSize
getPageList()
}
/**
* 完成
*/
function onOk() {
getPageList()
}
/**
* 重置
*/
function handleResetSearch() {
searchFormData.value = {}
resetPagination()
getPageList()
} }
</script> </script>

View File

@ -1,222 +1,82 @@
<template> <template>
<a-modal <a-modal :open="modal.open" :title="modal.title" :confirm-loading="modal.confirmLoading" :after-close="onAfterClose"
:width="640" @ok="handleOk" @cancel="handleCancel">
:open="modal.open" <a-card>
:title="modal.title" <a-form ref="formRef" scroll-to-first-error :model="formData" :rules="formRules">
:confirm-loading="modal.confirmLoading" <a-form-item label="用户名" name="userName">
:after-close="onAfterClose" <a-input v-model:value="formData.userName"></a-input>
:cancel-text="cancelText"
:ok-text="okText"
@ok="handleOk"
@cancel="handleCancel">
<a-form
layout="vertical"
ref="formRef"
:model="formData"
:rules="formRules">
<a-card class="mb-8-2">
<a-row :gutter="12">
<a-col :span="12">
<a-form-item
:label="$t('pages.system.menu.form.parent_name')"
name="parent_id">
<a-tree-select
v-model:value="formData.parent_id"
tree-default-expand-all></a-tree-select>
</a-form-item> </a-form-item>
</a-col> <a-form-item label="手机号" name="phone">
<a-col :span="12"> <a-input v-model:value="formData.phone"></a-input>
<a-form-item
:label="$t('pages.system.menu.form.type')"
name="type">
<a-radio-group
v-model:value="formData.type"
:options="menuTypeEnum.getOptions()"></a-radio-group>
</a-form-item> </a-form-item>
</a-col> <a-form-item label="算力券名称" name="couponName">
<a-col :span="12"> <a-input v-model:value="formData.couponName"></a-input>
<a-form-item
:label="$t('pages.system.menu.form.name')"
name="name">
<a-input v-model:value="formData.name"></a-input>
</a-form-item> </a-form-item>
</a-col> <a-form-item label="券面点数" name="faceValue">
<a-col :span="12"> <a-input v-model:value="formData.faceValue"></a-input>
<a-form-item
:label="$t('pages.system.menu.resource.form.path')"
name="path">
<a-input v-model:value="formData.path"></a-input>
</a-form-item> </a-form-item>
</a-col> <a-form-item label="可用点数" name="availablePoints">
<a-col :span="12"> <a-input v-model:value="formData.availablePoints"></a-input>
<a-form-item name="code">
<template #label>
<span class="mr-4-1">{{ $t('pages.system.menu.form.code') }}</span>
<a-tooltip :title="$t('pages.system.menu.form.code')">
<question-circle-outlined class="color-secondary"></question-circle-outlined>
</a-tooltip>
</template>
<a-input v-model:value="formData.code"></a-input>
</a-form-item> </a-form-item>
</a-col> <a-form-item label="生效时间" name="effectiveTime">
<a-date-picker v-model:value="formData.effectiveTime" style="width: 100%;"/>
<a-col :span="12">
<a-form-item
:label="$t('pages.system.menu.form.status')"
name="status">
<a-radio-group
v-model:value="formData.status"
:options="statusTypeEnum.getOptions()"></a-radio-group>
</a-form-item> </a-form-item>
</a-col> <a-form-item label="失效时间" name="expiryTime">
<a-col :span="12"> <a-date-picker v-model:value="formData.expiryTime" style="width: 100%;"/>
<a-form-item
style="width: 200px"
:label="$t('pages.system.menu.form.sequence')"
name="sequence">
<a-input
:defaultValue="0"
type="number"
v-model:value="formData.sequence"></a-input>
</a-form-item> </a-form-item>
</a-col> <a-form-item label="状态" name="status">
<a-col :span="12"> <a-radio-group v-model:value="formData.status" name="radioGroup">
<a-form-item <a-radio value="1">启用</a-radio>
:label="$t('pages.system.menu.form.description')" <a-radio value="2">停用</a-radio>
name="description"> </a-radio-group>
<a-input v-model:value="formData.description"></a-input>
</a-form-item> </a-form-item>
</a-col>
<a-col :span="24">
<a-form-item
:label="$t('pages.system.menu.form.properties')"
name="properties">
<a-textarea v-model:value="formData.properties"></a-textarea>
</a-form-item>
</a-col>
</a-row>
</a-card>
<a-card :title="$t('pages.system.menu.resource.form.title')">
<a-table
:columns="columns"
:data-source="formData.resources"
:pagination="false"
row-key="id">
<template #bodyCell="{ column, record, index }">
<template v-if="column.key === 'types'">
<a-form-item :label="$t('pages.system.menu.resource.form.method')">
<a-input-group
style="display: inline-block; vertical-align: middle"
:compact="true">
<a-form-item-rest>
<a-select
v-model:value="record.method"
:default-value="record.method || 'GET'"
style="width: 100px">
<a-select-option
v-for="item of reqType"
:key="item"
:value="item"
>{{ item }}</a-select-option
>
</a-select>
</a-form-item-rest>
<a-input
v-model:value="record.path"
:style="{ width: 'calc(100% - 100px)' }" />
</a-input-group>
</a-form-item>
</template>
<template v-if="column.key === 'action'">
<x-action-button @click="handleDelete(index)"> {{ $t('button.delete') }}</x-action-button>
</template>
</template>
</a-table>
<a-button
@click="handleAddApi"
block
class="mt-8-2"
type="dashed">
<template #icon>
<plus-outlined></plus-outlined>
</template>
{{ $t('button.add') }}
</a-button>
</a-card>
<template v-if="menuTypeEnum.is('menu', formData.type)"> </template>
<template v-if="statusTypeEnum.is('enabled', formData.status)"> </template>
</a-form> </a-form>
</a-card>
</a-modal> </a-modal>
</template> </template>
<script setup> <script setup>
import { cloneDeep } from 'lodash-es' import { cloneDeep } from 'lodash-es'
import { QuestionCircleOutlined } from '@ant-design/icons-vue'
import apis from '@/apis' import apis from '@/apis'
import { useModal, useForm } from '@/hooks' import { useForm, useModal } from '@/hooks'
import { menuTypeEnum, statusTypeEnum } from '@/enums/system'
import { ref } from 'vue'
import { config } from '@/config'
import { useI18n } from 'vue-i18n'
const emit = defineEmits(['ok']) const emit = defineEmits(['ok'])
const { t } = useI18n() // t
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal() const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
const { formData, formRef, formRules, resetForm } = useForm() const { formRef, formRules, formRecord, formData, resetForm } = useForm()
formRules.value = { formRules.value = {
name: { required: true, message: t('pages.system.menu.form.name.placeholder') }, userName: { required: true, message: '请输入用户名' },
code: { required: true, message: t('pages.system.menu.form.code.placeholder') }, phone: { required: true, message: '请输入手机号' },
couponName: { required: true, message: '请输入算力券名称' },
faceValue: { required: true, message: '请输入券面点数' },
availablePoints: { required: true, message: '请输入可用点数' },
effectiveTime: { required: true, message: '请选择开始时间',trigger:'change' },
expiryTime: { required: true, message: '请选择结束时间',trigger:'change' },
status: { required: true, message: '请选择状态',trigger:'change' },
} }
const columns = [
{ title: t('pages.system.menu.form.path'), dataIndex: 'types', key: 'types' },
{ title: t('button.action'), dataIndex: 'action', key: 'action' },
]
const reqType = ['GET', 'POST', 'PUT', 'PATCH', 'HEAD', 'DELETE']
const cancelText = ref(t('button.cancel'))
const okText = ref(t('button.confirm'))
/** /**
* 新建 * 新建
*/ */
function handleCreate() { function handleCreate() {
formData.value.resources = [] formData.value.status = '1'
showModal({ showModal({
type: 'create', type: 'create',
title: t('pages.system.menu.add'), title: '新建',
}) })
} }
/**
* 添加下级
* handleCreateChild
*/
function handleCreateChild(record = {}) {
formData.value.resources = []
showModal({
type: 'create',
title: t('pages.system.menu.button.addChild'),
})
formData.value.parent_id = record.id
}
/** /**
* 编辑 * 编辑
*/ */
async function handleEdit(record = {}) { function handleEdit(record = {}) {
showModal({ showModal({
type: 'edit', type: 'edit',
title: t('pages.system.menu.edit'), title: '编辑',
}) })
const { data } = await apis.menu.getMenu(record.id).catch(() => { formRecord.value = record
throw new Error() formData.value = cloneDeep(record)
})
formData.value = cloneDeep(data)
formData.value.properties = formData.value.properties ? JSON.parse(formData.value.properties) : ''
formData.value.resources = formData.value.resources || (formData.value.resources = [])
} }
/** /**
@ -229,28 +89,23 @@ function handleOk() {
try { try {
showLoading() showLoading()
const params = { const params = {
...values, ...formData.value,
} }
params.sequence = Number.parseInt(params.sequence) || 0
params.properties = JSON.stringify(params.properties)
let result = null let result = null
switch (modal.value.type) { switch (modal.value.type) {
case 'create': case 'create':
result = await apis.menu.createMenu(params).catch(() => { result = await apis.vouchers.addVouchers(params).catch(() => {
throw new Error() throw new Error()
}) })
break break
case 'edit': case 'edit':
newApiData() result = await apis.vouchers.editeVouchers(params).catch(() => {
params.resources = formData.value.resources
result = await apis.menu.updateMenu(formData.value.id, params).catch(() => {
throw new Error() throw new Error()
}) })
break break
} }
hideLoading() hideLoading()
if (config('http.code.success') === result?.success) { if (200 === result?.code) {
hideModal() hideModal()
emit('ok') emit('ok')
} }
@ -270,44 +125,15 @@ function handleCancel() {
hideModal() hideModal()
} }
/**
* 针对API 做一次 menu_id
*/
function newApiData() {
if (formData.value.resources)
formData.value.resources.forEach((item) => {
item.menu_id = formData.value.id
})
}
/** /**
* 关闭后 * 关闭后
*/ */
function onAfterClose() { function onAfterClose() {
resetForm() resetForm()
hideLoading()
}
/**
* 添加API
*/
function handleAddApi() {
formData.value.resources.push({
method: 'GET',
path: '',
})
} /**
* 删除API
*/
function handleDelete(index) {
formData.value.resources.splice(index, 1)
} }
defineExpose({ defineExpose({
handleCreate, handleCreate,
handleCreateChild,
handleEdit, handleEdit,
}) })
</script> </script>

View File

@ -1,33 +1,28 @@
<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 :label-col="{ style: { width: '100px' } }" :model="searchFormData" layout="inline"> <a-form :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 :label="$t('pages.system.menu.form.name')" name="name"> <a-form-item name="username" label="用户名">
<a-input :placeholder="$t('pages.system.menu.form.name.placeholder')" <a-input v-model:value="searchFormData.username"></a-input>
v-model:value="searchFormData.name"></a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col v-bind="colSpan"> <a-col v-bind="colSpan">
<a-form-item name="code"> <a-form-item label="手机号" title="phone">
<template #label> <a-input v-model:value="searchFormData.phone"></a-input>
{{ $t('pages.system.menu.form.code') }}
<a-tooltip :title="$t('pages.system.menu.form.code')">
<question-circle-outlined class="ml-4-1 color-placeholder" />
</a-tooltip>
</template>
<a-input :placeholder="$t('pages.system.menu.form.code.placeholder')"
v-model:value="searchFormData.code"></a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col v-bind="colSpan">
<a-col class="align-right" v-bind="colSpan"> <a-form-item label="算力券名称" title="voucherName">
<a-input v-model:value="searchFormData.voucherName"></a-input>
</a-form-item>
</a-col>
<a-col class="align-left" v-bind="colSpan">
<a-space> <a-space>
<a-button @click="handleResetSearch">{{ $t('button.reset') }}</a-button> <a-button @click="handleResetSearch">{{ $t('button.reset') }}</a-button>
<a-button ghost type="primary" @click="handleSearch"> <a-button ghost type="primary" @click="handleSearch">
{{ $t('button.search') }} 搜索
</a-button> </a-button>
</a-space> </a-space>
</a-col> </a-col>
@ -36,168 +31,103 @@
</template> </template>
</x-search-bar> </x-search-bar>
<a-card> <a-card>
<i class="iconfont icon-gonggao" style="color: red;"></i> <p><a-button type="primary" @click="$refs.editDialogRef.handleCreate()">新增</a-button></p>
<span>引入阿里巴巴图标</span> <a-table :columns="columns" :data-source="listData" :loading="loading" bordered :pagination="paginationState"
<x-action-bar class="mb-8-2"> :size="size" row-key="id" @change="onTableChange">
<a-button v-action="'add'" type="primary" @click="$refs.editDialogRef.handleCreate()">
<template #icon>
<plus-outlined></plus-outlined>
</template>
{{ $t('pages.system.menu.add') }}
</a-button>
</x-action-bar>
<a-table rowKey="id" :loading="loading" :pagination="true" :columns="columns" :data-source="listData">
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
<template v-if="'menuType' === column.key">
<!--菜单-->
<a-tag v-if="menuTypeEnum.is('page', record.type)" color="processing">
{{ menuTypeEnum.getDesc(record.type) }}
</a-tag>
<!--按钮-->
<a-tag v-if="menuTypeEnum.is('button', record.type)" color="success">
{{ menuTypeEnum.getDesc(record.type) }}
</a-tag>
</template>
<template v-if="'createAt' === column.key">
{{ formatUtcDateTime(record.created_at) }}
</template>
<template v-if="'statusType' === column.key">
<!--状态-->
<a-tag v-if="statusTypeEnum.is('enabled', record.status)" color="processing">
{{ statusTypeEnum.getDesc(record.status) }}
</a-tag>
<!--状态-->
<a-tag v-if="statusTypeEnum.is('disabled', record.status)" color="processing">
{{ statusTypeEnum.getDesc(record.status) }}
</a-tag>
</template>
<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)">编辑</x-action-button>
<a-tooltip> <x-action-button @click="handleDelete(record)">删除</x-action-button>
<template #title>{{ $t('pages.system.menu.edit') }}</template>
<edit-outlined />
</a-tooltip>
</x-action-button>
<x-action-button @click="$refs.editDialogRef.handleCreateChild(record)">
<a-tooltip>
<template #title>{{ $t('pages.system.menu.button.addChild') }}</template>
<plus-circle-outlined />
</a-tooltip>
</x-action-button>
<x-action-button @click="handleDelete(record)">
<a-tooltip>
<template #title>{{ $t('pages.system.delete') }}</template>
<delete-outlined style="color: #ff4d4f" />
</a-tooltip>
</x-action-button>
</template> </template>
</template> </template>
</a-table> </a-table>
</a-card> </a-card>
<edit-dialog ref="editDialogRef" @ok="onOk" />
<edit-dialog @ok="onOk" ref="editDialogRef" />
</template> </template>
<script setup> <script setup>
import { Modal, message } from 'ant-design-vue' import { message, Modal } from 'ant-design-vue'
import { ref } from 'vue' import { ref } from 'vue'
import { PlusOutlined, EditOutlined, DeleteOutlined, PlusCircleOutlined } from '@ant-design/icons-vue'
import apis from '@/apis' import apis from '@/apis'
import { config } from '@/config' import { config } from '@/config'
import { menuTypeEnum, statusTypeEnum } from '@/enums/system' import { usePagination } from '@/hooks'
import { usePagination, useForm } from '@/hooks'
import { formatUtcDateTime } from '@/utils/util'
import EditDialog from './components/EditDialog.vue' import EditDialog from './components/EditDialog.vue'
import { useI18n } from 'vue-i18n'
defineOptions({ defineOptions({
// eslint-disable-next-line vue/no-reserved-component-names name: 'listTable',
name: 'menu',
}) })
const { t } = useI18n() // t
const columns = ref([
{ title: t('pages.system.menu.form.name'), dataIndex: 'name', key: 'name', fixed: true },
{ title: t('pages.system.menu.form.code'), dataIndex: 'code', key: 'code' },
{ title: t('pages.system.menu.form.type'), dataIndex: 'type', key: 'menuType', width: 80 }, const columns = [
{ title: t('pages.system.menu.form.status'), dataIndex: 'status', key: 'statusType', width: 80 }, { title: '用户名', dataIndex: 'username' },
{ title: t('pages.system.menu.form.sequence'), dataIndex: 'sequence', width: 100 }, { title: '手机号', dataIndex: 'phone' },
{ title: t('pages.system.menu.form.created_at'), dataIndex: 'created_at', key: 'createAt', width: 180 }, { title: '算力券名称', dataIndex: 'couponName' },
{ title: t('button.action'), key: 'action', width: 180 }, { title: '券面点数', dataIndex: 'faceValue' },
]) { title: '可用点数', dataIndex: 'availablePoints' },
const { listData, loading, showLoading, hideLoading, searchFormData, paginationState, resetPagination } = { title: '生效时间', dataIndex: 'effectiveTime' },
usePagination() { title: '失效时间', dataIndex: 'expiryTime' },
const { resetForm } = useForm() { title: '状态', dataIndex: 'status' },
{ title: '操作', dataIndex: 'action' },
]
const { listData, paginationState, loading, showLoading, hideLoading, resetPagination, searchFormData } =usePagination()
const editDialogRef = ref() const editDialogRef = ref()
const searchBarExpand = ref(false)
const size = ref('default')
getMenuList() getPageList()
/** /**
* 获取菜单列表 * 获取分页列表
* @return {Promise<void>}
*/ */
async function getMenuList() { async function getPageList() {
try { try {
showLoading() showLoading()
// const { current } = paginationState const { pageSize, current } = paginationState
const { data, success, total } = await apis.menu const { code, data } = await apis.vouchers
.getMenuList({ .getPageList({
...searchFormData.value, pageSize,
current: current,
...searchFormData.value
}) })
.catch(() => { .catch(() => {
throw new Error() throw new Error()
}) })
hideLoading() hideLoading()
if (config('http.code.success') === success) { if (config('http.code.success') === code) {
data.forEach((item) => { const { records, pagination } = data
item.name = t(item.code) || item.name listData.value = records
}) paginationState.total = pagination.total
listData.value = data
paginationState.total = total
} }
} catch (error) { } catch (error) {
hideLoading() hideLoading()
} }
} }
/** /**
* 搜索 * 搜索
*/ */
function handleSearch() { function handleSearch() {
resetForm()
resetPagination() resetPagination()
getMenuList() getPageList()
}
/**
* 重置
*/
function handleResetSearch() {
searchFormData.value = {}
resetPagination()
getMenuList()
} }
/** /**
* 删除 * 删除
* @param id
*/ */
function handleDelete({ id }) { function handleDelete({ id }) {
Modal.confirm({ Modal.confirm({
title: t('pages.system.menu.delTip'), title: '删除提示',
content: t('button.confirm'), content: '确认删除?',
okText: t('button.confirm'),
onOk: () => { onOk: () => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
; (async () => { ; (async () => {
try { try {
const { success } = await apis.menu.delMenu(id).catch(() => { const { code } = await apis.vouchers.deleteVouchers(id).catch(() => {
throw new Error() throw new Error()
}) })
if (config('http.code.success') === success) { if (config('http.code.success') === code) {
resolve() resolve()
message.success(t('component.message.success.delete')) message.success('删除成功')
await getMenuList() await getPageList()
} }
} catch (error) { } catch (error) {
reject() reject()
@ -207,11 +137,39 @@ function handleDelete({ id }) {
}, },
}) })
} }
/** /**
* 编辑完成 * 密度
* @param {string} key
*/ */
async function onOk() { function handleSize({ key }) {
await getMenuList() size.value = key
}
/**
* 表格发生改变
* @param current
* @param pageSize
*/
function onTableChange({ current, pageSize }) {
paginationState.current = current
paginationState.pageSize = pageSize
getPageList()
}
/**
* 完成
*/
function onOk() {
getPageList()
}
/**
* 重置
*/
function handleResetSearch() {
searchFormData.value = {}
resetPagination()
getPageList()
} }
</script> </script>

View File

@ -81,8 +81,8 @@ async function getPageList() {
try { try {
showLoading() showLoading()
const { pageSize, current } = paginationState const { pageSize, current } = paginationState
const { code, data } = await apis.invoice const { code, data } = await apis.contract
.getDeliveriesFailedList({ .getPageList({
pageSize, pageSize,
current: current, current: current,
...searchFormData.value ...searchFormData.value

View File

@ -1,64 +1,29 @@
<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 name="username" label="用户名">
<template #label> <a-input v-model:value="searchFormData.username"></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 v-bind="colSpan">
<a-form-item label="描述"> <a-form-item label="手机号" title="phone">
<a-input></a-input> <a-input v-model:value="searchFormData.phone"></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-form-item>
</a-col> </a-col>
<a-col v-bind="colSpan"> <a-col v-bind="colSpan">
<a-form-item label="状态"> <a-form-item label="合同编号" title="contractId">
<a-select></a-select> <a-input v-model:value="searchFormData.contractId"></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-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>
@ -66,101 +31,21 @@
</template> </template>
</x-search-bar> </x-search-bar>
<a-card> <a-card>
<x-action-bar class="mb-8-2"> <a-table :columns="columns" :data-source="listData" :loading="loading" bordered :pagination="paginationState"
<a-button :size="size" row-key="id" @change="onTableChange">
type="primary"
@click="$refs.editDialogRef.handleCreate()">
<template #icon>
<plus-outlined></plus-outlined>
</template>
新建
</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>
<a-table
: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="'action' === column.key"> <template v-if="'action' === column.key">
<x-action-button @click="$refs.editDialogRef.handleEdit(record)">编辑</x-action-button> <x-action-button @click="handleReview(record)">上传合同</x-action-button>
<x-action-button @click="handleDelete(record)">删除</x-action-button>
<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 ref="editDialogRef" @ok="onOk" />
<edit-dialog
ref="editDialogRef"
@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 {
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'
@ -171,47 +56,44 @@ defineOptions({
}) })
const columns = [ const columns = [
{ title: '区域ID', dataIndex: 'hostId' }, { title: '用户名', dataIndex: 'username' },
{ title: '区域名称', dataIndex: 'hostName' }, { title: '手机号', dataIndex: 'phone' },
{ title: '区域编码', dataIndex: 'regionId' }, { title: '合同编号', dataIndex: 'contractId' },
{ title: '数据中心地址', dataIndex: 'cpu' }, { title: '合同名称', dataIndex: 'contractName' },
{ title: '状态', dataIndex: 'memory' }, { title: '合同类型', dataIndex: 'contractType' },
{ title: '部署主机数量(主机数量)', dataIndex: 'storage' }, { title: '合同内容', dataIndex: 'contractContent' }
{ title: '可用计算卡总数', dataIndex: 'ip' },
{ title: '操作', key: 'action', width: 160 },
] ]
// 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 searchBarExpand = ref(false)
const size = ref('default') const size = ref('default')
// getPageList() 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 { code, data } = await apis.contract
// .getPageList({ .getFaildList({
// pageSize, pageSize,
// current: current, current: current,
// }) ...searchFormData.value
// .catch(() => { })
// throw new Error() .catch(() => {
// }) throw new Error()
// hideLoading() })
// if (config('http.code.success') === code) { hideLoading()
// const { records, pagination } = data if (config('http.code.success') === code) {
// listData.value = records const { records, pagination } = data
// paginationState.total = pagination.total listData.value = records
// } paginationState.total = pagination.total
}
} catch (error) { } catch (error) {
// hideLoading() hideLoading()
} }
} }
@ -219,8 +101,8 @@ async function getPageList() {
* 搜索 * 搜索
*/ */
function handleSearch() { function handleSearch() {
// resetPagination() resetPagination()
// getPageList() getPageList()
} }
/** /**
@ -265,16 +147,24 @@ function handleSize({ key }) {
* @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 handleResetSearch() {
searchFormData.value = {}
resetPagination()
getPageList()
} }
</script> </script>

View File

@ -1,64 +1,29 @@
<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 name="username" label="用户名">
<template #label> <a-input v-model:value="searchFormData.username"></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 v-bind="colSpan">
<a-form-item label="描述"> <a-form-item label="手机号" title="phone">
<a-input></a-input> <a-input v-model:value="searchFormData.phone"></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-form-item>
</a-col> </a-col>
<a-col v-bind="colSpan"> <a-col v-bind="colSpan">
<a-form-item label="状态"> <a-form-item label="合同编号" title="contractId">
<a-select></a-select> <a-input v-model:value="searchFormData.contractId"></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-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>
@ -66,101 +31,21 @@
</template> </template>
</x-search-bar> </x-search-bar>
<a-card> <a-card>
<x-action-bar class="mb-8-2"> <a-table :columns="columns" :data-source="listData" :loading="loading" bordered :pagination="paginationState"
<a-button :size="size" row-key="id" @change="onTableChange">
type="primary"
@click="$refs.editDialogRef.handleCreate()">
<template #icon>
<plus-outlined></plus-outlined>
</template>
新建
</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>
<a-table
: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="'action' === column.key"> <template v-if="'action' === column.key">
<x-action-button @click="$refs.editDialogRef.handleEdit(record)">编辑</x-action-button> <x-action-button @click="handleReview(record)">上传合同</x-action-button>
<x-action-button @click="handleDelete(record)">删除</x-action-button>
<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 ref="editDialogRef" @ok="onOk" />
<edit-dialog
ref="editDialogRef"
@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 {
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'
@ -171,47 +56,44 @@ defineOptions({
}) })
const columns = [ const columns = [
{ title: '区域ID', dataIndex: 'hostId' }, { title: '用户名', dataIndex: 'username' },
{ title: '区域名称', dataIndex: 'hostName' }, { title: '手机号', dataIndex: 'phone' },
{ title: '区域编码', dataIndex: 'regionId' }, { title: '合同编号', dataIndex: 'contractId' },
{ title: '数据中心地址', dataIndex: 'cpu' }, { title: '合同名称', dataIndex: 'contractName' },
{ title: '状态', dataIndex: 'memory' }, { title: '合同类型', dataIndex: 'contractType' },
{ title: '部署主机数量(主机数量)', dataIndex: 'storage' }, { title: '合同内容', dataIndex: 'contractContent' }
{ title: '可用计算卡总数', dataIndex: 'ip' },
{ title: '操作', key: 'action', width: 160 },
] ]
// 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 searchBarExpand = ref(false)
const size = ref('default') const size = ref('default')
// getPageList() 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 { code, data } = await apis.invoice
// .getPageList({ .getPendingList({
// pageSize, pageSize,
// current: current, current: current,
// }) ...searchFormData.value
// .catch(() => { })
// throw new Error() .catch(() => {
// }) throw new Error()
// hideLoading() })
// if (config('http.code.success') === code) { hideLoading()
// const { records, pagination } = data if (config('http.code.success') === code) {
// listData.value = records const { records, pagination } = data
// paginationState.total = pagination.total listData.value = records
// } paginationState.total = pagination.total
}
} catch (error) { } catch (error) {
// hideLoading() hideLoading()
} }
} }
@ -219,8 +101,8 @@ async function getPageList() {
* 搜索 * 搜索
*/ */
function handleSearch() { function handleSearch() {
// resetPagination() resetPagination()
// getPageList() getPageList()
} }
/** /**
@ -265,16 +147,24 @@ function handleSize({ key }) {
* @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 handleResetSearch() {
searchFormData.value = {}
resetPagination()
getPageList()
} }
</script> </script>

View File

@ -1,64 +1,29 @@
<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 name="username" label="用户名">
<template #label> <a-input v-model:value="searchFormData.username"></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 v-bind="colSpan">
<a-form-item label="描述"> <a-form-item label="手机号" title="phone">
<a-input></a-input> <a-input v-model:value="searchFormData.phone"></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-form-item>
</a-col> </a-col>
<a-col v-bind="colSpan"> <a-col v-bind="colSpan">
<a-form-item label="状态"> <a-form-item label="合同编号" title="contractId">
<a-select></a-select> <a-input v-model:value="searchFormData.contractId"></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-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>
@ -66,101 +31,21 @@
</template> </template>
</x-search-bar> </x-search-bar>
<a-card> <a-card>
<x-action-bar class="mb-8-2"> <a-table :columns="columns" :data-source="listData" :loading="loading" bordered :pagination="paginationState"
<a-button :size="size" row-key="id" @change="onTableChange">
type="primary"
@click="$refs.editDialogRef.handleCreate()">
<template #icon>
<plus-outlined></plus-outlined>
</template>
新建
</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>
<a-table
: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="'action' === column.key"> <template v-if="'action' === column.key">
<x-action-button @click="$refs.editDialogRef.handleEdit(record)">编辑</x-action-button> <x-action-button @click="handleReview(record)">上传合同</x-action-button>
<x-action-button @click="handleDelete(record)">删除</x-action-button>
<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 ref="editDialogRef" @ok="onOk" />
<edit-dialog
ref="editDialogRef"
@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 {
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'
@ -171,51 +56,44 @@ defineOptions({
}) })
const columns = [ const columns = [
{ title: '计算卡ID', dataIndex: 'hostId' }, { title: '用户名', dataIndex: 'username' },
{ title: '型号', dataIndex: 'hostName' }, { title: '手机号', dataIndex: 'phone' },
{ title: '显存容量', dataIndex: 'regionId' }, { title: '合同编号', dataIndex: 'contractId' },
{ title: '核心数', dataIndex: 'cpu' }, { title: '合同名称', dataIndex: 'contractName' },
{ title: '所属主机ID', dataIndex: 'memory' }, { title: '合同类型', dataIndex: 'contractType' },
{ title: '运行状态', dataIndex: 'storage' }, { title: '合同内容', dataIndex: 'contractContent' }
{ title: '当前使用实例', dataIndex: 'ip' },
{ title: '用户信息(租用者)', dataIndex: 'status' },
{ title: '开始使用时间', dataIndex: 'bandwidth' },
{ title: '预计释放时间', dataIndex: 'createdAt' },
{ title: '固件版本', dataIndex: 'updatedAt' },
{ title: '操作', key: 'action', width: 160 },
] ]
// 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 searchBarExpand = ref(false)
const size = ref('default') const size = ref('default')
// getPageList() 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 { code, data } = await apis.contract
// .getPageList({ .getinvoiceSuccessList({
// pageSize, pageSize,
// current: current, current: current,
// }) ...searchFormData.value
// .catch(() => { })
// throw new Error() .catch(() => {
// }) throw new Error()
// hideLoading() })
// if (config('http.code.success') === code) { hideLoading()
// const { records, pagination } = data if (config('http.code.success') === code) {
// listData.value = records const { records, pagination } = data
// paginationState.total = pagination.total listData.value = records
// } paginationState.total = pagination.total
}
} catch (error) { } catch (error) {
// hideLoading() hideLoading()
} }
} }
@ -223,8 +101,8 @@ async function getPageList() {
* 搜索 * 搜索
*/ */
function handleSearch() { function handleSearch() {
// resetPagination() resetPagination()
// getPageList() getPageList()
} }
/** /**
@ -269,16 +147,24 @@ function handleSize({ key }) {
* @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 handleResetSearch() {
searchFormData.value = {}
resetPagination()
getPageList()
} }
</script> </script>

View File

@ -1,21 +1,25 @@
<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">
:title="modal.title" <a-form ref="formRef" scroll-to-first-error :model="formData" :rules="formRules"
:confirm-loading="modal.confirmLoading"
:after-close="onAfterClose"
@ok="handleOk"
@cancel="handleCancel">
<a-form
ref="formRef"
scroll-to-first-error
:model="formData"
:rules="formRules"
:label-col="{ style: { width: '80px' } }"> :label-col="{ style: { width: '80px' } }">
<a-form-item <a-form-item label="镜像名称" name="imageName">
label="标题" <a-input v-model:value="formData.imageName"></a-input>
name="title"> </a-form-item>
<a-input v-model:value="formData.title"></a-input> <a-form-item label="镜像类型" name="imageType">
<a-input v-model:value="formData.imageType"></a-input>
</a-form-item>
<a-form-item label="镜像路径" name="imagePath">
<a-input v-model:value="formData.imagePath"></a-input>
</a-form-item>
<a-form-item label="镜像大小" name="imageSize">
<a-input v-model:value="formData.imageSize"></a-input>
</a-form-item>
<a-form-item label="镜像版本" name="imageVersion">
<a-input v-model:value="formData.imageVersion"></a-input>
</a-form-item>
<a-form-item label="描述" name="description">
<a-input v-model:value="formData.description"></a-input>
</a-form-item> </a-form-item>
</a-form> </a-form>
</a-modal> </a-modal>
@ -32,7 +36,13 @@ const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
const { formRef, formRules, formRecord, formData, resetForm } = useForm() const { formRef, formRules, formRecord, formData, resetForm } = useForm()
formRules.value = { formRules.value = {
title: { required: true, message: '请输入标题' }, imageName: { required: true, message: '请输入镜像名称' },
imageType: { required: true, message: '请输入镜像类型' },
description: { required: false, message: '请输入描述' },
imagePath: { required: true, message: '请输入镜像路径' },
imageSize: { required: true, message: '请输入镜像大小' },
imageVersion: { required: true, message: '请输入镜像版本' },
userName: { required: true, message: '请输入所属用户名' },
} }
/** /**
@ -72,12 +82,12 @@ 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.images.addVouchers(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.images.editeVouchers(formRecord.value.id, params).catch(() => {
throw new Error() throw new Error()
}) })
break break

View File

@ -1,64 +1,29 @@
<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 name="username" label="用户名">
<template #label> <a-input v-model:value="searchFormData.username"></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 v-bind="colSpan">
<a-form-item label="描述"> <a-form-item label="手机号" title="phone">
<a-input></a-input> <a-input v-model:value="searchFormData.phone"></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-form-item>
</a-col> </a-col>
<a-col v-bind="colSpan"> <a-col v-bind="colSpan">
<a-form-item label="状态"> <a-form-item label="镜像名称" title="imageName">
<a-select></a-select> <a-input v-model:value="searchFormData.imageName"></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-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>
@ -66,101 +31,24 @@
</template> </template>
</x-search-bar> </x-search-bar>
<a-card> <a-card>
<x-action-bar class="mb-8-2"> <p><a-button type="primary" @click="$refs.editDialogRef.handleCreate()">新增</a-button></p>
<a-button <a-table :columns="columns" :data-source="listData" :loading="loading" bordered :pagination="paginationState"
type="primary" :size="size" row-key="id" @change="onTableChange">
@click="$refs.editDialogRef.handleCreate()">
<template #icon>
<plus-outlined></plus-outlined>
</template>
新建
</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>
<a-table
: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="'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="$refs.editDialogRef.handleEdit(record)">详情</x-action-button>
<x-action-button @click="handleDelete(record)">删除</x-action-button> <x-action-button @click="handleDelete(record)">删除</x-action-button>
<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 ref="editDialogRef" @ok="onOk" />
<edit-dialog
ref="editDialogRef"
@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 {
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'
@ -171,64 +59,47 @@ defineOptions({
}) })
const columns = [ const columns = [
{ title: '订单ID', dataIndex: 'hostId' }, { title: '用户名', dataIndex: 'username' },
{ title: '订单编号', dataIndex: 'hostName' }, { title: '手机号', dataIndex: 'phone' },
{ title: '所属用户ID', dataIndex: 'regionId' }, { title: '镜像名称', dataIndex: 'imageName' },
{ title: '用户名', dataIndex: 'cpu' }, { title: '镜像类型', dataIndex: 'imageType' },
{ title: '手机号', dataIndex: 'memory' }, { title: '描述', dataIndex: 'description' },
{ title: '实例ID', dataIndex: 'ip' }, { title: '镜像路径', dataIndex: 'imagePath' },
{ title: '实例名称', dataIndex: 'hostId' }, { title: '镜像大小', dataIndex: 'imageSize' },
{ title: '租赁配置', dataIndex: 'hostName' }, { title: '镜像版本', dataIndex: 'imageVersion' },
{ title: '计费方式', dataIndex: 'regionId' }, { title: '操作', dataIndex: 'action' },
{ title: '订单金额', dataIndex: 'cpu' },
{ title: '实付金额', dataIndex: 'hostId' },
{ title: '创建时间', dataIndex: 'hostName' },
{ title: '支付时间', dataIndex: 'regionId' },
{ title: '订单状态', dataIndex: 'cpu' },
{ title: '到期时间', dataIndex: 'hostName' },
{ title: '续费状态', dataIndex: 'regionId' },
{ title: '支付方式', dataIndex: 'cpu' },
{ title: '支付订单ID', dataIndex: 'hostId' },
{ title: '发票状态', dataIndex: 'hostName' },
{ title: '合同ID', dataIndex: 'regionId' },
{ title: '是否开票', dataIndex: 'cpu' },
{ title: '备注', dataIndex: 'hostId' },
{ title: '当前运行状态', dataIndex: 'cpu' },
{ title: '剩余时长', dataIndex: 'hostId' },
{ title: '操作', key: 'action', width: 160 },
] ]
// 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 searchBarExpand = ref(false)
const size = ref('default') const size = ref('default')
// getPageList() 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 { code, data } = await apis.images
// .getPageList({ .getPageList({
// pageSize, pageSize,
// current: current, current: current,
// }) ...searchFormData.value
// .catch(() => { })
// throw new Error() .catch(() => {
// }) throw new Error()
// hideLoading() })
// if (config('http.code.success') === code) { hideLoading()
// const { records, pagination } = data if (config('http.code.success') === code) {
// listData.value = records const { records, pagination } = data
// paginationState.total = pagination.total listData.value = records
// } paginationState.total = pagination.total
}
} catch (error) { } catch (error) {
// hideLoading() hideLoading()
} }
} }
@ -236,8 +107,8 @@ async function getPageList() {
* 搜索 * 搜索
*/ */
function handleSearch() { function handleSearch() {
// resetPagination() resetPagination()
// getPageList() getPageList()
} }
/** /**
@ -251,7 +122,7 @@ function handleDelete({ id }) {
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.vouchers.deleteVouchers(id).catch(() => {
throw new Error() throw new Error()
}) })
if (config('http.code.success') === code) { if (config('http.code.success') === code) {
@ -282,16 +153,24 @@ function handleSize({ key }) {
* @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 handleResetSearch() {
searchFormData.value = {}
resetPagination()
getPageList()
} }
</script> </script>

View File

@ -1,64 +1,29 @@
<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 name="orderNumber" label="订单编号">
<template #label> <a-input v-model:value="searchFormData.orderNumber"></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 v-bind="colSpan">
<a-form-item label="描述"> <a-form-item label="用户名" title="userName">
<a-input></a-input> <a-input v-model:value="searchFormData.userName"></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-form-item>
</a-col> </a-col>
<a-col v-bind="colSpan"> <a-col v-bind="colSpan">
<a-form-item label="状态"> <a-form-item label="手机号" title="phone">
<a-select></a-select> <a-input v-model:value="searchFormData.phone"></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-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>
@ -66,101 +31,23 @@
</template> </template>
</x-search-bar> </x-search-bar>
<a-card> <a-card>
<x-action-bar class="mb-8-2"> <!-- <p><a-button type="primary" @click="$refs.editDialogRef.handleCreate()">新增</a-button></p> -->
<a-button <a-table :columns="columns" :data-source="listData" :loading="loading" bordered :pagination="paginationState"
type="primary" :size="size" row-key="id" @change="onTableChange">
@click="$refs.editDialogRef.handleCreate()">
<template #icon>
<plus-outlined></plus-outlined>
</template>
新建
</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>
<a-table
: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="'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="handleDelete(record)">删除</x-action-button>
<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 ref="editDialogRef" @ok="onOk" />
<edit-dialog
ref="editDialogRef"
@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 {
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'
@ -171,66 +58,50 @@ defineOptions({
}) })
const columns = [ const columns = [
{ title: '订单ID', dataIndex: 'hostId' }, {title:'订单编号',dataIndex:'orderNumber'},
{ title: '订单编号', dataIndex: 'hostName' }, { title: '用户名', dataIndex: 'username' },
{ title: '所属用户ID', dataIndex: 'regionId' }, { title: '手机号', dataIndex: 'phone' },
{ title: '用户名', dataIndex: 'cpu' }, { title: '实例名称', dataIndex: 'caseName' },
{ title: '手机号', dataIndex: 'memory' }, { title: '计费方式', dataIndex: 'billingMethod' },
{ title: '实例ID', dataIndex: 'ip' }, { title: '计费开始时间', dataIndex: 'billingStart' },
{ title: '实例名称', dataIndex: 'hostId' }, { title: '计费结束时间', dataIndex: 'billingEnd' },
{ title: '租赁配置', dataIndex: 'hostName' }, { title: '计费时长', dataIndex: 'billingTime' },
{ title: '计费方式', dataIndex: 'regionId' }, { title: '单价', dataIndex: 'price' },
{ title: '订单金额', dataIndex: 'cpu' }, { title: '总费用', dataIndex: 'totalAmount' },
{ title: '实付金额', dataIndex: 'hostId' }, { title: '算力券名称', dataIndex: 'voucherName' },
{ title: '创建时间', dataIndex: 'hostName' }, { title: '支付状态', dataIndex: 'payStatus' },
{ title: '支付时间', dataIndex: 'regionId' },
{ title: '订单状态', dataIndex: 'cpu' },
{ title: '到期时间', dataIndex: 'hostName' },
{ title: '续费状态', dataIndex: 'regionId' },
{ title: '支付方式', dataIndex: 'cpu' },
{ title: '支付订单ID', dataIndex: 'hostId' },
{ title: '发票状态', dataIndex: 'hostName' },
{ title: '合同ID', dataIndex: 'regionId' },
{ title: '是否开票', dataIndex: 'cpu' },
{ title: '备注', dataIndex: 'hostId' },
{ title: '结算时间', dataIndex: 'cpu' },
{ title: '结算方式', dataIndex: 'hostId' },
{ title: '对账状态', dataIndex: 'regionId' },
{ title: '退款金额', dataIndex: 'cpu' },
{ title: '操作', key: 'action', width: 160 },
] ]
// 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 searchBarExpand = ref(false)
const size = ref('default') const size = ref('default')
// getPageList() 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 { code, data } = await apis.vouchers
// .getPageList({ .getOrderList({
// pageSize, pageSize,
// current: current, current: current,
// }) ...searchFormData.value
// .catch(() => { })
// throw new Error() .catch(() => {
// }) throw new Error()
// hideLoading() })
// if (config('http.code.success') === code) { hideLoading()
// const { records, pagination } = data if (config('http.code.success') === code) {
// listData.value = records const { records, pagination } = data
// paginationState.total = pagination.total listData.value = records
// } paginationState.total = pagination.total
}
} catch (error) { } catch (error) {
// hideLoading() hideLoading()
} }
} }
@ -238,8 +109,8 @@ async function getPageList() {
* 搜索 * 搜索
*/ */
function handleSearch() { function handleSearch() {
// resetPagination() resetPagination()
// getPageList() getPageList()
} }
/** /**
@ -253,7 +124,7 @@ function handleDelete({ id }) {
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.vouchers.deleteVouchers(id).catch(() => {
throw new Error() throw new Error()
}) })
if (config('http.code.success') === code) { if (config('http.code.success') === code) {
@ -284,16 +155,24 @@ function handleSize({ key }) {
* @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 handleResetSearch() {
searchFormData.value = {}
resetPagination()
getPageList()
} }
</script> </script>

View File

@ -1,21 +1,10 @@
<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">
:title="modal.title" <a-form ref="formRef" scroll-to-first-error :model="formData" :rules="formRules"
:confirm-loading="modal.confirmLoading"
:after-close="onAfterClose"
@ok="handleOk"
@cancel="handleCancel">
<a-form
ref="formRef"
scroll-to-first-error
:model="formData"
:rules="formRules"
:label-col="{ style: { width: '80px' } }"> :label-col="{ style: { width: '80px' } }">
<a-form-item <a-form-item label="审核" name="checked">
label="标题" <a-input v-model:value="formData.checked"></a-input>
name="title">
<a-input v-model:value="formData.title"></a-input>
</a-form-item> </a-form-item>
</a-form> </a-form>
</a-modal> </a-modal>
@ -51,9 +40,9 @@ function handleCreate() {
function handleEdit(record = {}) { function handleEdit(record = {}) {
showModal({ showModal({
type: 'edit', type: 'edit',
title: '编辑', title: '审核',
}) })
formRecord.value = record formRecord.value.withdrawalOrderId = record.withdrawalOrderId
formData.value = cloneDeep(record) formData.value = cloneDeep(record)
} }
@ -77,7 +66,7 @@ function handleOk() {
}) })
break break
case 'edit': case 'edit':
result = await apis.common.update(formRecord.value.id, params).catch(() => { result = await apis.review.review(params).catch(() => {
throw new Error() throw new Error()
}) })
break break

View File

@ -1,64 +1,29 @@
<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 name="username" label="用户名">
<template #label> <a-input v-model:value="searchFormData.username"></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 v-bind="colSpan">
<a-form-item label="描述"> <a-form-item label="手机号" title="phone">
<a-input></a-input> <a-input v-model:value="searchFormData.phone"></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-form-item>
</a-col> </a-col>
<a-col v-bind="colSpan"> <a-col v-bind="colSpan">
<a-form-item label="状态"> <a-form-item label="提现编号" title="withdrawalOrderId">
<a-select></a-select> <a-input v-model:value="searchFormData.withdrawalOrderId"></a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col v-bind="colSpan"> <a-col class="align-right" 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>
@ -66,101 +31,22 @@
</template> </template>
</x-search-bar> </x-search-bar>
<a-card> <a-card>
<x-action-bar class="mb-8-2"> <a-table :columns="columns" :data-source="listData" :loading="loading" bordered :pagination="paginationState"
<a-button :size="size" row-key="id" @change="onTableChange">
type="primary"
@click="$refs.editDialogRef.handleCreate()">
<template #icon>
<plus-outlined></plus-outlined>
</template>
新建
</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>
<a-table
: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="'action' === column.key"> <template v-if="'action' === column.key">
<x-action-button @click="$refs.editDialogRef.handleEdit(record)">编辑</x-action-button> <x-action-button @click="handleReview(record)">审核</x-action-button>
<x-action-button @click="handleDelete(record)">删除</x-action-button> <!-- <x-action-button @click="$refs.editDialogRef.handleEdit(record)">详情</x-action-button> -->
<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 ref="editDialogRef" @ok="onOk" />
<edit-dialog
ref="editDialogRef"
@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 {
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'
@ -171,47 +57,43 @@ defineOptions({
}) })
const columns = [ const columns = [
{ title: '区域ID', dataIndex: 'hostId' }, { title: '用户名', dataIndex: 'username' },
{ title: '区域名称', dataIndex: 'hostName' }, { title: '手机号', dataIndex: 'phone' },
{ title: '区域编码', dataIndex: 'regionId' }, { title: '提现编号', dataIndex: 'withdrawalOrderId' },
{ title: '数据中心地址', dataIndex: 'cpu' }, { title: '提现金额', dataIndex: 'withdrawalAmount' },
{ title: '状态', dataIndex: 'memory' }, { title: '银行卡信息', dataIndex: 'bankCardInfo' }
{ title: '部署主机数量(主机数量)', dataIndex: 'storage' },
{ title: '可用计算卡总数', dataIndex: 'ip' },
{ title: '操作', key: 'action', width: 160 },
] ]
// 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 searchBarExpand = ref(false)
const size = ref('default') const size = ref('default')
// getPageList() 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 { code, data } = await apis.review
// .getPageList({ .getPageList({
// pageSize, pageSize,
// current: current, current: current,
// }) ...searchFormData.value
// .catch(() => { })
// throw new Error() .catch(() => {
// }) throw new Error()
// hideLoading() })
// if (config('http.code.success') === code) { hideLoading()
// const { records, pagination } = data if (config('http.code.success') === code) {
// listData.value = records const { records, pagination } = data
// paginationState.total = pagination.total listData.value = records
// } paginationState.total = pagination.total
}
} catch (error) { } catch (error) {
// hideLoading() hideLoading()
} }
} }
@ -219,8 +101,8 @@ async function getPageList() {
* 搜索 * 搜索
*/ */
function handleSearch() { function handleSearch() {
// resetPagination() resetPagination()
// getPageList() getPageList()
} }
/** /**
@ -265,16 +147,24 @@ function handleSize({ key }) {
* @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 handleResetSearch() {
searchFormData.value = {}
resetPagination()
getPageList()
} }
</script> </script>

View File

@ -1,64 +1,29 @@
<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 name="username" label="用户名">
<template #label> <a-input v-model:value="searchFormData.username"></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 v-bind="colSpan">
<a-form-item label="描述"> <a-form-item label="手机号" title="phone">
<a-input></a-input> <a-input v-model:value="searchFormData.phone"></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-form-item>
</a-col> </a-col>
<a-col v-bind="colSpan"> <a-col v-bind="colSpan">
<a-form-item label="状态"> <a-form-item label="提现编号" title="withdrawalOrderId">
<a-select></a-select> <a-input v-model:value="searchFormData.withdrawalOrderId"></a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col v-bind="colSpan"> <a-col class="align-right" 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>
@ -66,156 +31,64 @@
</template> </template>
</x-search-bar> </x-search-bar>
<a-card> <a-card>
<x-action-bar class="mb-8-2"> <a-table :columns="columns" :data-source="listData" :loading="loading" bordered :pagination="paginationState"
<a-button :size="size" row-key="id" @change="onTableChange">
type="primary"
@click="$refs.editDialogRef.handleCreate()">
<template #icon>
<plus-outlined></plus-outlined>
</template>
新建
</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>
<a-table
:columns="columns"
:data-source="listData"
:loading="loading"
:pagination="paginationState"
:size="size"
row-key="id"
@change="onTableChange">
<template #bodyCell="{ column, record }">
<template v-if="'action' === column.key">
<x-action-button @click="$refs.editDialogRef.handleEdit(record)">编辑</x-action-button>
<x-action-button @click="handleDelete(record)">删除</x-action-button>
<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>
</a-table> </a-table>
</a-card> </a-card>
<!-- <edit-dialog ref="editDialogRef" @ok="onOk" /> -->
<edit-dialog
ref="editDialogRef"
@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 {
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'
defineOptions({ defineOptions({
name: 'listTable', name: 'withdrawErrorList',
}) })
const columns = [ const columns = [
{ title: '计算卡ID', dataIndex: 'hostId' }, { title: '用户名', dataIndex: 'username' },
{ title: '型号', dataIndex: 'hostName' }, { title: '手机号', dataIndex: 'phone' },
{ title: '显存容量', dataIndex: 'regionId' }, { title: '提现编号', dataIndex: 'withdrawalOrderId' },
{ title: '核心数', dataIndex: 'cpu' }, { title: '提现金额', dataIndex: 'withdrawalAmount' },
{ title: '所属主机ID', dataIndex: 'memory' }, { title: '银行卡信息', dataIndex: 'bankCardInfo' },
{ title: '运行状态', dataIndex: 'storage' }, {title:"失败原因",dataIndex:'reason'},
{ title: '当前使用实例', dataIndex: 'ip' },
{ title: '用户信息(租用者)', dataIndex: 'status' },
{ title: '开始使用时间', dataIndex: 'bandwidth' },
{ title: '预计释放时间', dataIndex: 'createdAt' },
{ title: '固件版本', dataIndex: 'updatedAt' },
{ title: '操作', key: 'action', width: 160 },
] ]
// 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 searchBarExpand = ref(false)
const size = ref('default') const size = ref('default')
// getPageList() 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 { code, data } = await apis.review
// .getPageList({ .getPendingFaildList({
// pageSize, pageSize,
// current: current, current: current,
// }) ...searchFormData.value
// .catch(() => { })
// throw new Error() .catch(() => {
// }) throw new Error()
// hideLoading() })
// if (config('http.code.success') === code) { hideLoading()
// const { records, pagination } = data if (config('http.code.success') === code) {
// listData.value = records const { records, pagination } = data
// paginationState.total = pagination.total listData.value = records
// } paginationState.total = pagination.total
}
} catch (error) { } catch (error) {
// hideLoading() hideLoading()
} }
} }
@ -223,8 +96,8 @@ async function getPageList() {
* 搜索 * 搜索
*/ */
function handleSearch() { function handleSearch() {
// resetPagination() resetPagination()
// getPageList() getPageList()
} }
/** /**
@ -269,16 +142,24 @@ function handleSize({ key }) {
* @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 handleResetSearch() {
searchFormData.value = {}
resetPagination()
getPageList()
} }
</script> </script>

View File

@ -1,21 +1,16 @@
<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">
:title="modal.title" <a-form ref="formRef" scroll-to-first-error :model="formData" :rules="formRules"
:confirm-loading="modal.confirmLoading"
:after-close="onAfterClose"
@ok="handleOk"
@cancel="handleCancel">
<a-form
ref="formRef"
scroll-to-first-error
:model="formData"
:rules="formRules"
:label-col="{ style: { width: '80px' } }"> :label-col="{ style: { width: '80px' } }">
<a-form-item <a-form-item label="打款结果" name="checked">
label="标题" <a-radio-group v-model:value="formData.checked" name="radioGroup">
name="title"> <a-radio :value="true">打款成功</a-radio>
<a-input v-model:value="formData.title"></a-input> <a-radio :value="false">打款失败</a-radio>
</a-radio-group>
</a-form-item>
<a-form-item label="原因" name="reason">
<a-textarea v-model:value="formData.reason" placeholder="请输入原因" auto-size />
</a-form-item> </a-form-item>
</a-form> </a-form>
</a-modal> </a-modal>
@ -51,9 +46,9 @@ function handleCreate() {
function handleEdit(record = {}) { function handleEdit(record = {}) {
showModal({ showModal({
type: 'edit', type: 'edit',
title: '编辑', title: '提现确认',
}) })
formRecord.value = record formRecord.valu.id = record.withdrawalOrderId
formData.value = cloneDeep(record) formData.value = cloneDeep(record)
} }
@ -67,7 +62,7 @@ function handleOk() {
try { try {
showLoading() showLoading()
const params = { const params = {
...values, ...formData.value,
} }
let result = null let result = null
switch (modal.value.type) { switch (modal.value.type) {
@ -77,7 +72,7 @@ function handleOk() {
}) })
break break
case 'edit': case 'edit':
result = await apis.common.update(formRecord.value.id, params).catch(() => { result = await apis.review.pendingUpload(formRecord.value.id, params).catch(() => {
throw new Error() throw new Error()
}) })
break break

View File

@ -1,64 +1,29 @@
<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 name="username" label="用户名">
<template #label> <a-input v-model:value="searchFormData.username"></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 v-bind="colSpan">
<a-form-item label="描述"> <a-form-item label="手机号" title="phone">
<a-input></a-input> <a-input v-model:value="searchFormData.phone"></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-form-item>
</a-col> </a-col>
<a-col v-bind="colSpan"> <a-col v-bind="colSpan">
<a-form-item label="状态"> <a-form-item label="提现编号" title="withdrawalOrderId">
<a-select></a-select> <a-input v-model:value="searchFormData.withdrawalOrderId"></a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col v-bind="colSpan"> <a-col class="align-right" 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>
@ -66,101 +31,22 @@
</template> </template>
</x-search-bar> </x-search-bar>
<a-card> <a-card>
<x-action-bar class="mb-8-2"> <a-table :columns="columns" :data-source="listData" :loading="loading" bordered :pagination="paginationState"
<a-button :size="size" row-key="id" @change="onTableChange">
type="primary"
@click="$refs.editDialogRef.handleCreate()">
<template #icon>
<plus-outlined></plus-outlined>
</template>
新建
</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>
<a-table
: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="'action' === column.key"> <template v-if="'action' === column.key">
<x-action-button @click="$refs.editDialogRef.handleEdit(record)">编辑</x-action-button> <x-action-button @click="handleReview(record)">提现确认</x-action-button>
<x-action-button @click="handleDelete(record)">删除</x-action-button> <!-- <x-action-button @click="$refs.editDialogRef.handleEdit(record)">详情</x-action-button> -->
<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 ref="editDialogRef" @ok="onOk" />
<edit-dialog
ref="editDialogRef"
@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 {
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'
@ -171,47 +57,45 @@ defineOptions({
}) })
const columns = [ const columns = [
{ title: '区域ID', dataIndex: 'hostId' }, { title: '用户名', dataIndex: 'username' },
{ title: '区域名称', dataIndex: 'hostName' }, { title: '手机号', dataIndex: 'phone' },
{ title: '区域编码', dataIndex: 'regionId' }, { title: '提现编号', dataIndex: 'withdrawalOrderId' },
{ title: '数据中心地址', dataIndex: 'cpu' }, { title: '提现金额', dataIndex: 'withdrawalAmount' },
{ title: '状态', dataIndex: 'memory' }, { title: '银行卡信息', dataIndex: 'bankCardInfo' },
{ title: '部署主机数量(主机数量)', dataIndex: 'storage' }, {title:"后台确认时间",dataIndex:'backendConfirmationTime'},
{ title: '可用计算卡总数', dataIndex: 'ip' }, {title:"操作",dataIndex:'action'}
{ title: '操作', key: 'action', width: 160 },
] ]
// 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 searchBarExpand = ref(false)
const size = ref('default') const size = ref('default')
// getPageList() 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 { code, data } = await apis.review
// .getPageList({ .getPendingList({
// pageSize, pageSize,
// current: current, current: current,
// }) ...searchFormData.value
// .catch(() => { })
// throw new Error() .catch(() => {
// }) throw new Error()
// hideLoading() })
// if (config('http.code.success') === code) { hideLoading()
// const { records, pagination } = data if (config('http.code.success') === code) {
// listData.value = records const { records, pagination } = data
// paginationState.total = pagination.total listData.value = records
// } paginationState.total = pagination.total
}
} catch (error) { } catch (error) {
// hideLoading() hideLoading()
} }
} }
@ -219,8 +103,8 @@ async function getPageList() {
* 搜索 * 搜索
*/ */
function handleSearch() { function handleSearch() {
// resetPagination() resetPagination()
// getPageList() getPageList()
} }
/** /**
@ -265,16 +149,24 @@ function handleSize({ key }) {
* @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 handleResetSearch() {
searchFormData.value = {}
resetPagination()
getPageList()
} }
</script> </script>

View File

@ -1,64 +1,29 @@
<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 name="username" label="用户名">
<template #label> <a-input v-model:value="searchFormData.username"></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 v-bind="colSpan">
<a-form-item label="描述"> <a-form-item label="手机号" title="phone">
<a-input></a-input> <a-input v-model:value="searchFormData.phone"></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-form-item>
</a-col> </a-col>
<a-col v-bind="colSpan"> <a-col v-bind="colSpan">
<a-form-item label="状态"> <a-form-item label="提现编号" title="withdrawalOrderId">
<a-select></a-select> <a-input v-model:value="searchFormData.withdrawalOrderId"></a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col v-bind="colSpan"> <a-col class="align-right" 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>
@ -66,101 +31,22 @@
</template> </template>
</x-search-bar> </x-search-bar>
<a-card> <a-card>
<x-action-bar class="mb-8-2"> <a-table :columns="columns" :data-source="listData" :loading="loading" bordered :pagination="paginationState"
<a-button :size="size" row-key="id" @change="onTableChange">
type="primary" <!-- <template #bodyCell="{ column, record }">
@click="$refs.editDialogRef.handleCreate()">
<template #icon>
<plus-outlined></plus-outlined>
</template>
新建
</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>
<a-table
:columns="columns"
:data-source="listData"
:loading="loading"
:pagination="paginationState"
:size="size"
row-key="id"
@change="onTableChange">
<template #bodyCell="{ column, record }">
<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="handleReview(record)">审核</x-action-button>
<x-action-button @click="handleDelete(record)">删除</x-action-button> <x-action-button @click="$refs.editDialogRef.handleEdit(record)">详情</x-action-button>
<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 ref="editDialogRef" @ok="onOk" />
<edit-dialog
ref="editDialogRef"
@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 {
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'
@ -171,47 +57,44 @@ defineOptions({
}) })
const columns = [ const columns = [
{ title: '区域ID', dataIndex: 'hostId' }, { title: '用户名', dataIndex: 'username' },
{ title: '区域名称', dataIndex: 'hostName' }, { title: '手机号', dataIndex: 'phone' },
{ title: '区域编码', dataIndex: 'regionId' }, { title: '提现编号', dataIndex: 'withdrawalOrderId' },
{ title: '数据中心地址', dataIndex: 'cpu' }, { title: '提现金额', dataIndex: 'withdrawalAmount' },
{ title: '状态', dataIndex: 'memory' }, { title: '拒绝原因', dataIndex: 'reason' },
{ title: '部署主机数量(主机数量)', dataIndex: 'storage' }, { title: '银行卡信息', dataIndex: 'bankCardInfo' }
{ title: '可用计算卡总数', dataIndex: 'ip' },
{ title: '操作', key: 'action', width: 160 },
] ]
// 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 searchBarExpand = ref(false)
const size = ref('default') const size = ref('default')
// getPageList() 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 { code, data } = await apis.review
// .getPageList({ .getFaildList({
// pageSize, pageSize,
// current: current, current: current,
// }) ...searchFormData.value
// .catch(() => { })
// throw new Error() .catch(() => {
// }) throw new Error()
// hideLoading() })
// if (config('http.code.success') === code) { hideLoading()
// const { records, pagination } = data if (config('http.code.success') === code) {
// listData.value = records const { records, pagination } = data
// paginationState.total = pagination.total listData.value = records
// } paginationState.total = pagination.total
}
} catch (error) { } catch (error) {
// hideLoading() hideLoading()
} }
} }
@ -219,8 +102,8 @@ async function getPageList() {
* 搜索 * 搜索
*/ */
function handleSearch() { function handleSearch() {
// resetPagination() resetPagination()
// getPageList() getPageList()
} }
/** /**
@ -265,16 +148,24 @@ function handleSize({ key }) {
* @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 handleResetSearch() {
searchFormData.value = {}
resetPagination()
getPageList()
} }
</script> </script>

View File

@ -1,64 +1,29 @@
<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 name="username" label="用户名">
<template #label> <a-input v-model:value="searchFormData.username"></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 v-bind="colSpan">
<a-form-item label="描述"> <a-form-item label="手机号" title="phone">
<a-input></a-input> <a-input v-model:value="searchFormData.phone"></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-form-item>
</a-col> </a-col>
<a-col v-bind="colSpan"> <a-col v-bind="colSpan">
<a-form-item label="状态"> <a-form-item label="提现编号" title="withdrawalOrderId">
<a-select></a-select> <a-input v-model:value="searchFormData.withdrawalOrderId"></a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col v-bind="colSpan"> <a-col class="align-right" 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>
@ -66,101 +31,22 @@
</template> </template>
</x-search-bar> </x-search-bar>
<a-card> <a-card>
<x-action-bar class="mb-8-2"> <a-table :columns="columns" :data-source="listData" :loading="loading" bordered :pagination="paginationState"
<a-button :size="size" row-key="id" @change="onTableChange">
type="primary"
@click="$refs.editDialogRef.handleCreate()">
<template #icon>
<plus-outlined></plus-outlined>
</template>
新建
</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>
<a-table
: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="'action' === column.key"> <template v-if="'action' === column.key">
<x-action-button @click="$refs.editDialogRef.handleEdit(record)">编辑</x-action-button> <x-action-button @click="handleReview(record)">提现确认</x-action-button>
<x-action-button @click="handleDelete(record)">删除</x-action-button> <!-- <x-action-button @click="$refs.editDialogRef.handleEdit(record)">详情</x-action-button> -->
<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 ref="editDialogRef" @ok="onOk" />
<edit-dialog
ref="editDialogRef"
@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 {
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'
@ -171,47 +57,45 @@ defineOptions({
}) })
const columns = [ const columns = [
{ title: '区域ID', dataIndex: 'hostId' }, { title: '用户名', dataIndex: 'username' },
{ title: '区域名称', dataIndex: 'hostName' }, { title: '手机号', dataIndex: 'phone' },
{ title: '区域编码', dataIndex: 'regionId' }, { title: '提现编号', dataIndex: 'withdrawalOrderId' },
{ title: '数据中心地址', dataIndex: 'cpu' }, { title: '提现金额', dataIndex: 'withdrawalAmount' },
{ title: '状态', dataIndex: 'memory' }, { title: '银行卡信息', dataIndex: 'bankCardInfo' },
{ title: '部署主机数量(主机数量)', dataIndex: 'storage' }, {title:"后台确认时间",dataIndex:'backendConfirmationTime'},
{ title: '可用计算卡总数', dataIndex: 'ip' }, {title:"退款完成时间",dataIndex:'finishedTime'},
{ title: '操作', key: 'action', width: 160 },
] ]
// 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 searchBarExpand = ref(false)
const size = ref('default') const size = ref('default')
// getPageList() 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 { code, data } = await apis.review
// .getPageList({ .getInvoicingFailedList({
// pageSize, pageSize,
// current: current, current: current,
// }) ...searchFormData.value
// .catch(() => { })
// throw new Error() .catch(() => {
// }) throw new Error()
// hideLoading() })
// if (config('http.code.success') === code) { hideLoading()
// const { records, pagination } = data if (config('http.code.success') === code) {
// listData.value = records const { records, pagination } = data
// paginationState.total = pagination.total listData.value = records
// } paginationState.total = pagination.total
}
} catch (error) { } catch (error) {
// hideLoading() hideLoading()
} }
} }
@ -219,8 +103,8 @@ async function getPageList() {
* 搜索 * 搜索
*/ */
function handleSearch() { function handleSearch() {
// resetPagination() resetPagination()
// getPageList() getPageList()
} }
/** /**
@ -265,16 +149,24 @@ function handleSize({ key }) {
* @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 handleResetSearch() {
searchFormData.value = {}
resetPagination()
getPageList()
} }
</script> </script>