接口和字段定义完成

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',
name: 'balanceList',
component: 'balance/balanceList/index.vue',
component: 'balance/index.vue',
meta: {
title: '余额列表',
isMenu: true,

View File

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

View File

@ -4,16 +4,20 @@
<a-form :model="searchFormData" layout="inline">
<a-row :gutter="gutter">
<a-col v-bind="colSpan">
<a-form-item :label="$t('pages.system.role.form.name')" name="name">
<a-input :placeholder="$t('pages.system.role.form.code.placeholder')"
v-model:value="searchFormData.name"></a-input>
<a-form-item name="username" label="用户名">
<a-input v-model:value="searchFormData.username"></a-input>
</a-form-item>
</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-button @click="handleResetSearch">{{ $t('button.reset') }}</a-button>
<a-button ghost type="primary" @click="handleSearch">
{{ $t('button.search') }}
搜索
</a-button>
</a-space>
</a-col>
@ -21,111 +25,71 @@
</a-form>
</template>
</x-search-bar>
<a-row :gutter="8" :wrap="false">
<a-col flex="auto">
<a-card type="flex">
<x-action-bar class="mb-8-2">
<a-button v-action="'add'" type="primary" @click="$refs.editDialogRef.handleCreate()">
<template #icon>
<plus-outlined></plus-outlined>
</template>
添加图片
</a-button>
</x-action-bar>
<a-table :columns="columns" :data-source="listData" :loading="loading" :pagination="paginationState"
:scroll="{ x: 1000 }" @change="onTableChange">
<a-card>
<!-- <p><a-button type="primary" @click="$refs.editDialogRef.handleCreate()">新增</a-button></p> -->
<a-table :columns="columns" :data-source="listData" :loading="loading" bordered :pagination="paginationState"
:size="size" row-key="id" @change="onTableChange">
<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">
<x-action-button @click="$refs.editDialogRef.handleEdit(record)">
<a-tooltip>
<template #title> {{ $t('pages.system.role.edit') }}</template>
<edit-outlined />
</a-tooltip>
</x-action-button>
<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>
<x-action-button @click="$refs.editDialogRef.handleEdit(record)">添加余额</x-action-button>
<!-- <x-action-button @click="handleDelete(record)">删除</x-action-button> -->
</template>
</template>
</a-table>
</a-card>
</a-col>
</a-row>
<edit-dialog ref="editDialogRef" @ok="onOk"></edit-dialog>
<edit-dialog ref="editDialogRef" @ok="onOk" />
</template>
<script setup>
import { message, Modal } from 'ant-design-vue'
import { ref } from 'vue'
import apis from '@/apis'
import { formatUtcDateTime } from '@/utils/util'
import { config } from '@/config'
import { statusTypeEnum } from '@/enums/system'
import { usePagination, useForm } from '@/hooks'
import { usePagination } from '@/hooks'
import EditDialog from './components/EditDialog.vue'
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue'
import { useI18n } from 'vue-i18n'
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 } =
usePagination()
const { resetForm } = useForm()
const columns = [
{ title: '用户名', dataIndex: 'username' },
{ 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 searchBarExpand = ref(false)
const size = ref('default')
getPageList()
/**
* 获取用户列表
* @returns {Promise<void>}
* 获取分页列表
*/
async function getPageList() {
try {
showLoading()
const { pageSize, current } = paginationState
const { success, data, total } = await apis.role
.getRoleList({
const { code, data } = await apis.vouchers
.getBalanceList({
pageSize,
current: current,
...searchFormData.value,
...searchFormData.value
})
.catch(() => {
throw new Error()
})
hideLoading()
if (config('http.code.success') === success) {
listData.value = data
paginationState.total = total
if (config('http.code.success') === code) {
const { records, pagination } = data
listData.value = records
paginationState.total = pagination.total
}
} catch (error) {
hideLoading()
@ -133,23 +97,30 @@ async function getPageList() {
}
/**
* 移除
* 搜索
*/
function handleRemove({ id }) {
function handleSearch() {
resetPagination()
getPageList()
}
/**
* 删除
*/
function handleDelete({ id }) {
Modal.confirm({
title: t('pages.system.role.delTip'),
content: t('button.confirm'),
okText: t('button.confirm'),
title: '删除提示',
content: '确认删除?',
onOk: () => {
return new Promise((resolve, reject) => {
; (async () => {
try {
const { success } = await apis.role.delRole(id).catch(() => {
const { code } = await apis.vouchers.deleteVouchers(id).catch(() => {
throw new Error()
})
if (config('http.code.success') === success) {
if (config('http.code.success') === code) {
resolve()
message.success(t('component.message.success.delete'))
message.success('删除成功')
await getPageList()
}
} 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 }) {
paginationState.current = current
@ -170,6 +151,12 @@ function onTableChange({ current, pageSize }) {
getPageList()
}
/**
* 完成
*/
function onOk() {
getPageList()
}
/**
* 重置
*/
@ -178,22 +165,6 @@ function handleResetSearch() {
resetPagination()
getPageList()
}
/**
* 搜索
*/
function handleSearch() {
resetForm()
resetPagination()
getPageList()
}
/**
* 编辑完成
*/
async function onOk() {
await getPageList()
}
</script>
<style lang="less" scoped></style>

View File

@ -1,222 +1,50 @@
<template>
<a-modal
:width="640"
:open="modal.open"
:title="modal.title"
:confirm-loading="modal.confirmLoading"
:after-close="onAfterClose"
: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-modal :open="modal.open" :title="modal.title" :confirm-loading="modal.confirmLoading" :after-close="onAfterClose"
@ok="handleOk" @cancel="handleCancel">
<a-card>
<a-form ref="formRef" scroll-to-first-error :model="formData" :rules="formRules">
<a-form-item label="算力点" name="point">
<a-input-number v-model:value="formData.point" :precision="2" style="width: 100%;"></a-input-number>
</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-card>
</a-modal>
</template>
<script setup>
import { cloneDeep } from 'lodash-es'
import { QuestionCircleOutlined } from '@ant-design/icons-vue'
import apis from '@/apis'
import { useModal, useForm } from '@/hooks'
import { menuTypeEnum, statusTypeEnum } from '@/enums/system'
import { ref } from 'vue'
import { config } from '@/config'
import { useI18n } from 'vue-i18n'
import { useForm, useModal } from '@/hooks'
const emit = defineEmits(['ok'])
const { t } = useI18n() // t
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
const { formData, formRef, formRules, resetForm } = useForm()
const { formRef, formRules, formRecord, formData, resetForm } = useForm()
formRules.value = {
name: { required: true, message: t('pages.system.menu.form.name.placeholder') },
code: { required: true, message: t('pages.system.menu.form.code.placeholder') },
point: { required: true, message: '请输入算力点' }
}
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() {
formData.value.resources = []
showModal({
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({
type: 'edit',
title: t('pages.system.menu.edit'),
title: '新增算力点',
})
const { data } = await apis.menu.getMenu(record.id).catch(() => {
throw new Error()
})
formData.value = cloneDeep(data)
formData.value.properties = formData.value.properties ? JSON.parse(formData.value.properties) : ''
formData.value.resources = formData.value.resources || (formData.value.resources = [])
formRecord.value.userId = record.userId
formData.value = cloneDeep(record)
}
/**
@ -229,28 +57,23 @@ function handleOk() {
try {
showLoading()
const params = {
...values,
...formData.value,
}
params.sequence = Number.parseInt(params.sequence) || 0
params.properties = JSON.stringify(params.properties)
let result = null
switch (modal.value.type) {
case 'create':
result = await apis.menu.createMenu(params).catch(() => {
result = await apis.vouchers.addPoint(params).catch(() => {
throw new Error()
})
break
case 'edit':
newApiData()
params.resources = formData.value.resources
result = await apis.menu.updateMenu(formData.value.id, params).catch(() => {
result = await apis.vouchers.addPoint(params).catch(() => {
throw new Error()
})
break
}
hideLoading()
if (config('http.code.success') === result?.success) {
if (200 === result?.code) {
hideModal()
emit('ok')
}
@ -270,44 +93,15 @@ function handleCancel() {
hideModal()
}
/**
* 针对API 做一次 menu_id
*/
function newApiData() {
if (formData.value.resources)
formData.value.resources.forEach((item) => {
item.menu_id = formData.value.id
})
}
/**
* 关闭后
*/
function onAfterClose() {
resetForm()
hideLoading()
}
/**
* 添加API
*/
function handleAddApi() {
formData.value.resources.push({
method: 'GET',
path: '',
})
} /**
* 删除API
*/
function handleDelete(index) {
formData.value.resources.splice(index, 1)
}
defineExpose({
handleCreate,
handleCreateChild,
handleEdit,
})
</script>

View File

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

View File

@ -1,222 +1,82 @@
<template>
<a-modal
:width="640"
:open="modal.open"
:title="modal.title"
:confirm-loading="modal.confirmLoading"
:after-close="onAfterClose"
: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-modal :open="modal.open" :title="modal.title" :confirm-loading="modal.confirmLoading" :after-close="onAfterClose"
@ok="handleOk" @cancel="handleCancel">
<a-card>
<a-form ref="formRef" scroll-to-first-error :model="formData" :rules="formRules">
<a-form-item label="用户名" name="userName">
<a-input v-model:value="formData.userName"></a-input>
</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 label="手机号" name="phone">
<a-input v-model:value="formData.phone"></a-input>
</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 label="算力券名称" name="couponName">
<a-input v-model:value="formData.couponName"></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 label="券面点数" name="faceValue">
<a-input v-model:value="formData.faceValue"></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 label="可用点数" name="availablePoints">
<a-input v-model:value="formData.availablePoints"></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 label="生效时间" name="effectiveTime">
<a-date-picker v-model:value="formData.effectiveTime" style="width: 100%;"/>
</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 label="失效时间" name="expiryTime">
<a-date-picker v-model:value="formData.expiryTime" style="width: 100%;"/>
</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 label="状态" name="status">
<a-radio-group v-model:value="formData.status" name="radioGroup">
<a-radio value="1">启用</a-radio>
<a-radio value="2">停用</a-radio>
</a-radio-group>
</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-card>
</a-modal>
</template>
<script setup>
import { cloneDeep } from 'lodash-es'
import { QuestionCircleOutlined } from '@ant-design/icons-vue'
import apis from '@/apis'
import { useModal, useForm } from '@/hooks'
import { menuTypeEnum, statusTypeEnum } from '@/enums/system'
import { ref } from 'vue'
import { config } from '@/config'
import { useI18n } from 'vue-i18n'
import { useForm, useModal } from '@/hooks'
const emit = defineEmits(['ok'])
const { t } = useI18n() // t
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
const { formData, formRef, formRules, resetForm } = useForm()
const { formRef, formRules, formRecord, formData, resetForm } = useForm()
formRules.value = {
name: { required: true, message: t('pages.system.menu.form.name.placeholder') },
code: { required: true, message: t('pages.system.menu.form.code.placeholder') },
userName: { required: true, message: '请输入用户名' },
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() {
formData.value.resources = []
formData.value.status = '1'
showModal({
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({
type: 'edit',
title: t('pages.system.menu.edit'),
title: '编辑',
})
const { data } = await apis.menu.getMenu(record.id).catch(() => {
throw new Error()
})
formData.value = cloneDeep(data)
formData.value.properties = formData.value.properties ? JSON.parse(formData.value.properties) : ''
formData.value.resources = formData.value.resources || (formData.value.resources = [])
formRecord.value = record
formData.value = cloneDeep(record)
}
/**
@ -229,28 +89,23 @@ function handleOk() {
try {
showLoading()
const params = {
...values,
...formData.value,
}
params.sequence = Number.parseInt(params.sequence) || 0
params.properties = JSON.stringify(params.properties)
let result = null
switch (modal.value.type) {
case 'create':
result = await apis.menu.createMenu(params).catch(() => {
result = await apis.vouchers.addVouchers(params).catch(() => {
throw new Error()
})
break
case 'edit':
newApiData()
params.resources = formData.value.resources
result = await apis.menu.updateMenu(formData.value.id, params).catch(() => {
result = await apis.vouchers.editeVouchers(params).catch(() => {
throw new Error()
})
break
}
hideLoading()
if (config('http.code.success') === result?.success) {
if (200 === result?.code) {
hideModal()
emit('ok')
}
@ -270,44 +125,15 @@ function handleCancel() {
hideModal()
}
/**
* 针对API 做一次 menu_id
*/
function newApiData() {
if (formData.value.resources)
formData.value.resources.forEach((item) => {
item.menu_id = formData.value.id
})
}
/**
* 关闭后
*/
function onAfterClose() {
resetForm()
hideLoading()
}
/**
* 添加API
*/
function handleAddApi() {
formData.value.resources.push({
method: 'GET',
path: '',
})
} /**
* 删除API
*/
function handleDelete(index) {
formData.value.resources.splice(index, 1)
}
defineExpose({
handleCreate,
handleCreateChild,
handleEdit,
})
</script>

View File

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

View File

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

View File

@ -1,64 +1,29 @@
<template>
<x-search-bar class="mb-8-2">
<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-col v-bind="colSpan">
<a-form-item name="title">
<template #label>
规则名称
<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 name="username" label="用户名">
<a-input v-model:value="searchFormData.username"></a-input>
</a-form-item>
</a-col>
<a-col v-bind="colSpan">
<a-form-item label="描述">
<a-input></a-input>
</a-form-item>
</a-col>
<template v-if="searchBarExpand">
<a-col v-bind="colSpan">
<a-form-item label="服务调用次数">
<a-input></a-input>
<a-form-item label="手机号" title="phone">
<a-input v-model:value="searchFormData.phone"></a-input>
</a-form-item>
</a-col>
<a-col v-bind="colSpan">
<a-form-item label="状态">
<a-select></a-select>
<a-form-item label="合同编号" title="contractId">
<a-input v-model:value="searchFormData.contractId"></a-input>
</a-form-item>
</a-col>
<a-col v-bind="colSpan">
<a-form-item label="上次调度时间">
<a-date-picker placeholder=""></a-date-picker>
</a-form-item>
</a-col>
</template>
<a-col
class="align-right"
v-bind="colSpan">
<a-col class="align-left" v-bind="colSpan">
<a-space>
<a-button>重置</a-button>
<a-button
ghost
type="primary"
@click="handleSearch">
<a-button @click="handleResetSearch">{{ $t('button.reset') }}</a-button>
<a-button ghost type="primary" @click="handleSearch">
搜索
</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-col>
</a-row>
@ -66,101 +31,21 @@
</template>
</x-search-bar>
<a-card>
<x-action-bar class="mb-8-2">
<a-button
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">
<a-table :columns="columns" :data-source="listData" :loading="loading" bordered :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>
<x-action-button @click="handleReview(record)">上传合同</x-action-button>
</template>
</template>
</a-table>
</a-card>
<edit-dialog
ref="editDialogRef"
@ok="onOk" />
<edit-dialog ref="editDialogRef" @ok="onOk" />
</template>
<script setup>
import { message, Modal } from 'ant-design-vue'
import { ref } from 'vue'
import {
ColumnHeightOutlined,
DownOutlined,
QuestionCircleOutlined,
ReloadOutlined,
SettingOutlined,
UpOutlined,
PlusOutlined,
MoreOutlined,
} from '@ant-design/icons-vue'
import apis from '@/apis'
import { config } from '@/config'
import { usePagination } from '@/hooks'
@ -171,47 +56,44 @@ defineOptions({
})
const columns = [
{ title: '区域ID', dataIndex: 'hostId' },
{ title: '区域名称', dataIndex: 'hostName' },
{ title: '区域编码', dataIndex: 'regionId' },
{ title: '数据中心地址', dataIndex: 'cpu' },
{ title: '状态', dataIndex: 'memory' },
{ title: '部署主机数量(主机数量)', dataIndex: 'storage' },
{ title: '可用计算卡总数', dataIndex: 'ip' },
{ title: '操作', key: 'action', width: 160 },
{ title: '用户名', dataIndex: 'username' },
{ title: '手机号', dataIndex: 'phone' },
{ title: '合同编号', dataIndex: 'contractId' },
{ title: '合同名称', dataIndex: 'contractName' },
{ title: '合同类型', dataIndex: 'contractType' },
{ title: '合同内容', dataIndex: 'contractContent' }
]
// const { listData, paginationState, loading, showLoading, hideLoading, resetPagination, searchFormData } =
// usePagination()
const listData = ref([])
const { listData, paginationState, loading, showLoading, hideLoading, resetPagination, searchFormData } =usePagination()
const editDialogRef = ref()
const searchBarExpand = ref(false)
const size = ref('default')
// getPageList()
getPageList()
/**
* 获取分页列表
*/
async function getPageList() {
try {
// showLoading()
// const { pageSize, current } = paginationState
// const { code, data } = await apis.common
// .getPageList({
// pageSize,
// current: current,
// })
// .catch(() => {
// throw new Error()
// })
// hideLoading()
// if (config('http.code.success') === code) {
// const { records, pagination } = data
// listData.value = records
// paginationState.total = pagination.total
// }
showLoading()
const { pageSize, current } = paginationState
const { code, data } = await apis.contract
.getFaildList({
pageSize,
current: current,
...searchFormData.value
})
.catch(() => {
throw new Error()
})
hideLoading()
if (config('http.code.success') === code) {
const { records, pagination } = data
listData.value = records
paginationState.total = pagination.total
}
} catch (error) {
// hideLoading()
hideLoading()
}
}
@ -219,8 +101,8 @@ async function getPageList() {
* 搜索
*/
function handleSearch() {
// resetPagination()
// getPageList()
resetPagination()
getPageList()
}
/**
@ -232,7 +114,7 @@ function handleDelete({ id }) {
content: '确认删除?',
onOk: () => {
return new Promise((resolve, reject) => {
;(async () => {
; (async () => {
try {
const { code } = await apis.common.del(id).catch(() => {
throw new Error()
@ -265,16 +147,24 @@ function handleSize({ key }) {
* @param pageSize
*/
function onTableChange({ current, pageSize }) {
// paginationState.current = current
// paginationState.pageSize = pageSize
// getPageList()
paginationState.current = current
paginationState.pageSize = pageSize
getPageList()
}
/**
* 完成
*/
function onOk() {
// getPageList()
getPageList()
}
/**
* 重置
*/
function handleResetSearch() {
searchFormData.value = {}
resetPagination()
getPageList()
}
</script>

View File

@ -1,64 +1,29 @@
<template>
<x-search-bar class="mb-8-2">
<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-col v-bind="colSpan">
<a-form-item name="title">
<template #label>
规则名称
<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 name="username" label="用户名">
<a-input v-model:value="searchFormData.username"></a-input>
</a-form-item>
</a-col>
<a-col v-bind="colSpan">
<a-form-item label="描述">
<a-input></a-input>
</a-form-item>
</a-col>
<template v-if="searchBarExpand">
<a-col v-bind="colSpan">
<a-form-item label="服务调用次数">
<a-input></a-input>
<a-form-item label="手机号" title="phone">
<a-input v-model:value="searchFormData.phone"></a-input>
</a-form-item>
</a-col>
<a-col v-bind="colSpan">
<a-form-item label="状态">
<a-select></a-select>
<a-form-item label="合同编号" title="contractId">
<a-input v-model:value="searchFormData.contractId"></a-input>
</a-form-item>
</a-col>
<a-col v-bind="colSpan">
<a-form-item label="上次调度时间">
<a-date-picker placeholder=""></a-date-picker>
</a-form-item>
</a-col>
</template>
<a-col
class="align-right"
v-bind="colSpan">
<a-col class="align-left" v-bind="colSpan">
<a-space>
<a-button>重置</a-button>
<a-button
ghost
type="primary"
@click="handleSearch">
<a-button @click="handleResetSearch">{{ $t('button.reset') }}</a-button>
<a-button ghost type="primary" @click="handleSearch">
搜索
</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-col>
</a-row>
@ -66,101 +31,21 @@
</template>
</x-search-bar>
<a-card>
<x-action-bar class="mb-8-2">
<a-button
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">
<a-table :columns="columns" :data-source="listData" :loading="loading" bordered :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>
<x-action-button @click="handleReview(record)">上传合同</x-action-button>
</template>
</template>
</a-table>
</a-card>
<edit-dialog
ref="editDialogRef"
@ok="onOk" />
<edit-dialog ref="editDialogRef" @ok="onOk" />
</template>
<script setup>
import { message, Modal } from 'ant-design-vue'
import { ref } from 'vue'
import {
ColumnHeightOutlined,
DownOutlined,
QuestionCircleOutlined,
ReloadOutlined,
SettingOutlined,
UpOutlined,
PlusOutlined,
MoreOutlined,
} from '@ant-design/icons-vue'
import apis from '@/apis'
import { config } from '@/config'
import { usePagination } from '@/hooks'
@ -171,47 +56,44 @@ defineOptions({
})
const columns = [
{ title: '区域ID', dataIndex: 'hostId' },
{ title: '区域名称', dataIndex: 'hostName' },
{ title: '区域编码', dataIndex: 'regionId' },
{ title: '数据中心地址', dataIndex: 'cpu' },
{ title: '状态', dataIndex: 'memory' },
{ title: '部署主机数量(主机数量)', dataIndex: 'storage' },
{ title: '可用计算卡总数', dataIndex: 'ip' },
{ title: '操作', key: 'action', width: 160 },
{ title: '用户名', dataIndex: 'username' },
{ title: '手机号', dataIndex: 'phone' },
{ title: '合同编号', dataIndex: 'contractId' },
{ title: '合同名称', dataIndex: 'contractName' },
{ title: '合同类型', dataIndex: 'contractType' },
{ title: '合同内容', dataIndex: 'contractContent' }
]
// const { listData, paginationState, loading, showLoading, hideLoading, resetPagination, searchFormData } =
// usePagination()
const listData = ref([])
const { listData, paginationState, loading, showLoading, hideLoading, resetPagination, searchFormData } =usePagination()
const editDialogRef = ref()
const searchBarExpand = ref(false)
const size = ref('default')
// getPageList()
getPageList()
/**
* 获取分页列表
*/
async function getPageList() {
try {
// showLoading()
// const { pageSize, current } = paginationState
// const { code, data } = await apis.common
// .getPageList({
// pageSize,
// current: current,
// })
// .catch(() => {
// throw new Error()
// })
// hideLoading()
// if (config('http.code.success') === code) {
// const { records, pagination } = data
// listData.value = records
// paginationState.total = pagination.total
// }
showLoading()
const { pageSize, current } = paginationState
const { code, data } = await apis.invoice
.getPendingList({
pageSize,
current: current,
...searchFormData.value
})
.catch(() => {
throw new Error()
})
hideLoading()
if (config('http.code.success') === code) {
const { records, pagination } = data
listData.value = records
paginationState.total = pagination.total
}
} catch (error) {
// hideLoading()
hideLoading()
}
}
@ -219,8 +101,8 @@ async function getPageList() {
* 搜索
*/
function handleSearch() {
// resetPagination()
// getPageList()
resetPagination()
getPageList()
}
/**
@ -232,7 +114,7 @@ function handleDelete({ id }) {
content: '确认删除?',
onOk: () => {
return new Promise((resolve, reject) => {
;(async () => {
; (async () => {
try {
const { code } = await apis.common.del(id).catch(() => {
throw new Error()
@ -265,16 +147,24 @@ function handleSize({ key }) {
* @param pageSize
*/
function onTableChange({ current, pageSize }) {
// paginationState.current = current
// paginationState.pageSize = pageSize
// getPageList()
paginationState.current = current
paginationState.pageSize = pageSize
getPageList()
}
/**
* 完成
*/
function onOk() {
// getPageList()
getPageList()
}
/**
* 重置
*/
function handleResetSearch() {
searchFormData.value = {}
resetPagination()
getPageList()
}
</script>

View File

@ -1,64 +1,29 @@
<template>
<x-search-bar class="mb-8-2">
<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-col v-bind="colSpan">
<a-form-item name="title">
<template #label>
规则名称
<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 name="username" label="用户名">
<a-input v-model:value="searchFormData.username"></a-input>
</a-form-item>
</a-col>
<a-col v-bind="colSpan">
<a-form-item label="描述">
<a-input></a-input>
</a-form-item>
</a-col>
<template v-if="searchBarExpand">
<a-col v-bind="colSpan">
<a-form-item label="服务调用次数">
<a-input></a-input>
<a-form-item label="手机号" title="phone">
<a-input v-model:value="searchFormData.phone"></a-input>
</a-form-item>
</a-col>
<a-col v-bind="colSpan">
<a-form-item label="状态">
<a-select></a-select>
<a-form-item label="合同编号" title="contractId">
<a-input v-model:value="searchFormData.contractId"></a-input>
</a-form-item>
</a-col>
<a-col v-bind="colSpan">
<a-form-item label="上次调度时间">
<a-date-picker placeholder=""></a-date-picker>
</a-form-item>
</a-col>
</template>
<a-col
class="align-right"
v-bind="colSpan">
<a-col class="align-left" v-bind="colSpan">
<a-space>
<a-button>重置</a-button>
<a-button
ghost
type="primary"
@click="handleSearch">
<a-button @click="handleResetSearch">{{ $t('button.reset') }}</a-button>
<a-button ghost type="primary" @click="handleSearch">
搜索
</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-col>
</a-row>
@ -66,101 +31,21 @@
</template>
</x-search-bar>
<a-card>
<x-action-bar class="mb-8-2">
<a-button
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">
<a-table :columns="columns" :data-source="listData" :loading="loading" bordered :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>
<x-action-button @click="handleReview(record)">上传合同</x-action-button>
</template>
</template>
</a-table>
</a-card>
<edit-dialog
ref="editDialogRef"
@ok="onOk" />
<edit-dialog ref="editDialogRef" @ok="onOk" />
</template>
<script setup>
import { message, Modal } from 'ant-design-vue'
import { ref } from 'vue'
import {
ColumnHeightOutlined,
DownOutlined,
QuestionCircleOutlined,
ReloadOutlined,
SettingOutlined,
UpOutlined,
PlusOutlined,
MoreOutlined,
} from '@ant-design/icons-vue'
import apis from '@/apis'
import { config } from '@/config'
import { usePagination } from '@/hooks'
@ -171,51 +56,44 @@ defineOptions({
})
const columns = [
{ title: '计算卡ID', dataIndex: 'hostId' },
{ title: '型号', dataIndex: 'hostName' },
{ title: '显存容量', dataIndex: 'regionId' },
{ title: '核心数', dataIndex: 'cpu' },
{ title: '所属主机ID', dataIndex: 'memory' },
{ title: '运行状态', dataIndex: 'storage' },
{ title: '当前使用实例', dataIndex: 'ip' },
{ title: '用户信息(租用者)', dataIndex: 'status' },
{ title: '开始使用时间', dataIndex: 'bandwidth' },
{ title: '预计释放时间', dataIndex: 'createdAt' },
{ title: '固件版本', dataIndex: 'updatedAt' },
{ title: '操作', key: 'action', width: 160 },
{ title: '用户名', dataIndex: 'username' },
{ title: '手机号', dataIndex: 'phone' },
{ title: '合同编号', dataIndex: 'contractId' },
{ title: '合同名称', dataIndex: 'contractName' },
{ title: '合同类型', dataIndex: 'contractType' },
{ title: '合同内容', dataIndex: 'contractContent' }
]
// const { listData, paginationState, loading, showLoading, hideLoading, resetPagination, searchFormData } =
// usePagination()
const listData = ref([])
const { listData, paginationState, loading, showLoading, hideLoading, resetPagination, searchFormData } =usePagination()
const editDialogRef = ref()
const searchBarExpand = ref(false)
const size = ref('default')
// getPageList()
getPageList()
/**
* 获取分页列表
*/
async function getPageList() {
try {
// showLoading()
// const { pageSize, current } = paginationState
// const { code, data } = await apis.common
// .getPageList({
// pageSize,
// current: current,
// })
// .catch(() => {
// throw new Error()
// })
// hideLoading()
// if (config('http.code.success') === code) {
// const { records, pagination } = data
// listData.value = records
// paginationState.total = pagination.total
// }
showLoading()
const { pageSize, current } = paginationState
const { code, data } = await apis.contract
.getinvoiceSuccessList({
pageSize,
current: current,
...searchFormData.value
})
.catch(() => {
throw new Error()
})
hideLoading()
if (config('http.code.success') === code) {
const { records, pagination } = data
listData.value = records
paginationState.total = pagination.total
}
} catch (error) {
// hideLoading()
hideLoading()
}
}
@ -223,8 +101,8 @@ async function getPageList() {
* 搜索
*/
function handleSearch() {
// resetPagination()
// getPageList()
resetPagination()
getPageList()
}
/**
@ -236,7 +114,7 @@ function handleDelete({ id }) {
content: '确认删除?',
onOk: () => {
return new Promise((resolve, reject) => {
;(async () => {
; (async () => {
try {
const { code } = await apis.common.del(id).catch(() => {
throw new Error()
@ -269,16 +147,24 @@ function handleSize({ key }) {
* @param pageSize
*/
function onTableChange({ current, pageSize }) {
// paginationState.current = current
// paginationState.pageSize = pageSize
// getPageList()
paginationState.current = current
paginationState.pageSize = pageSize
getPageList()
}
/**
* 完成
*/
function onOk() {
// getPageList()
getPageList()
}
/**
* 重置
*/
function handleResetSearch() {
searchFormData.value = {}
resetPagination()
getPageList()
}
</script>

View File

@ -1,21 +1,25 @@
<template>
<a-modal
:open="modal.open"
:title="modal.title"
:confirm-loading="modal.confirmLoading"
:after-close="onAfterClose"
@ok="handleOk"
@cancel="handleCancel">
<a-form
ref="formRef"
scroll-to-first-error
:model="formData"
:rules="formRules"
<a-modal :open="modal.open" :title="modal.title" :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' } }">
<a-form-item
label="标题"
name="title">
<a-input v-model:value="formData.title"></a-input>
<a-form-item label="镜像名称" name="imageName">
<a-input v-model:value="formData.imageName"></a-input>
</a-form-item>
<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>
</a-modal>
@ -32,7 +36,13 @@ const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
const { formRef, formRules, formRecord, formData, resetForm } = useForm()
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
switch (modal.value.type) {
case 'create':
result = await apis.common.create(params).catch(() => {
result = await apis.images.addVouchers(params).catch(() => {
throw new Error()
})
break
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()
})
break

View File

@ -1,64 +1,29 @@
<template>
<x-search-bar class="mb-8-2">
<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-col v-bind="colSpan">
<a-form-item name="title">
<template #label>
规则名称
<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 name="username" label="用户名">
<a-input v-model:value="searchFormData.username"></a-input>
</a-form-item>
</a-col>
<a-col v-bind="colSpan">
<a-form-item label="描述">
<a-input></a-input>
</a-form-item>
</a-col>
<template v-if="searchBarExpand">
<a-col v-bind="colSpan">
<a-form-item label="服务调用次数">
<a-input></a-input>
<a-form-item label="手机号" title="phone">
<a-input v-model:value="searchFormData.phone"></a-input>
</a-form-item>
</a-col>
<a-col v-bind="colSpan">
<a-form-item label="状态">
<a-select></a-select>
<a-form-item label="镜像名称" title="imageName">
<a-input v-model:value="searchFormData.imageName"></a-input>
</a-form-item>
</a-col>
<a-col v-bind="colSpan">
<a-form-item label="上次调度时间">
<a-date-picker placeholder=""></a-date-picker>
</a-form-item>
</a-col>
</template>
<a-col
class="align-right"
v-bind="colSpan">
<a-col class="align-left" v-bind="colSpan">
<a-space>
<a-button>重置</a-button>
<a-button
ghost
type="primary"
@click="handleSearch">
<a-button @click="handleResetSearch">{{ $t('button.reset') }}</a-button>
<a-button ghost type="primary" @click="handleSearch">
搜索
</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-col>
</a-row>
@ -66,101 +31,24 @@
</template>
</x-search-bar>
<a-card>
<x-action-bar class="mb-8-2">
<a-button
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">
<p><a-button type="primary" @click="$refs.editDialogRef.handleCreate()">新增</a-button></p>
<a-table :columns="columns" :data-source="listData" :loading="loading" bordered :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="$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-card>
<edit-dialog
ref="editDialogRef"
@ok="onOk" />
<edit-dialog ref="editDialogRef" @ok="onOk" />
</template>
<script setup>
import { message, Modal } from 'ant-design-vue'
import { ref } from 'vue'
import {
ColumnHeightOutlined,
DownOutlined,
QuestionCircleOutlined,
ReloadOutlined,
SettingOutlined,
UpOutlined,
PlusOutlined,
MoreOutlined,
} from '@ant-design/icons-vue'
import apis from '@/apis'
import { config } from '@/config'
import { usePagination } from '@/hooks'
@ -171,64 +59,47 @@ defineOptions({
})
const columns = [
{ title: '订单ID', dataIndex: 'hostId' },
{ title: '订单编号', dataIndex: 'hostName' },
{ title: '所属用户ID', dataIndex: 'regionId' },
{ title: '用户名', dataIndex: 'cpu' },
{ title: '手机号', dataIndex: 'memory' },
{ title: '实例ID', dataIndex: 'ip' },
{ title: '实例名称', dataIndex: 'hostId' },
{ title: '租赁配置', dataIndex: 'hostName' },
{ title: '计费方式', dataIndex: 'regionId' },
{ 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 },
{ title: '用户名', dataIndex: 'username' },
{ title: '手机号', dataIndex: 'phone' },
{ title: '镜像名称', dataIndex: 'imageName' },
{ title: '镜像类型', dataIndex: 'imageType' },
{ title: '描述', dataIndex: 'description' },
{ title: '镜像路径', dataIndex: 'imagePath' },
{ title: '镜像大小', dataIndex: 'imageSize' },
{ title: '镜像版本', dataIndex: 'imageVersion' },
{ title: '操作', dataIndex: 'action' },
]
// const { listData, paginationState, loading, showLoading, hideLoading, resetPagination, searchFormData } =
// usePagination()
const listData = ref([])
const { listData, paginationState, loading, showLoading, hideLoading, resetPagination, searchFormData } =usePagination()
const editDialogRef = ref()
const searchBarExpand = ref(false)
const size = ref('default')
// getPageList()
getPageList()
/**
* 获取分页列表
*/
async function getPageList() {
try {
// showLoading()
// const { pageSize, current } = paginationState
// const { code, data } = await apis.common
// .getPageList({
// pageSize,
// current: current,
// })
// .catch(() => {
// throw new Error()
// })
// hideLoading()
// if (config('http.code.success') === code) {
// const { records, pagination } = data
// listData.value = records
// paginationState.total = pagination.total
// }
showLoading()
const { pageSize, current } = paginationState
const { code, data } = await apis.images
.getPageList({
pageSize,
current: current,
...searchFormData.value
})
.catch(() => {
throw new Error()
})
hideLoading()
if (config('http.code.success') === code) {
const { records, pagination } = data
listData.value = records
paginationState.total = pagination.total
}
} catch (error) {
// hideLoading()
hideLoading()
}
}
@ -236,8 +107,8 @@ async function getPageList() {
* 搜索
*/
function handleSearch() {
// resetPagination()
// getPageList()
resetPagination()
getPageList()
}
/**
@ -249,9 +120,9 @@ function handleDelete({ id }) {
content: '确认删除?',
onOk: () => {
return new Promise((resolve, reject) => {
;(async () => {
; (async () => {
try {
const { code } = await apis.common.del(id).catch(() => {
const { code } = await apis.vouchers.deleteVouchers(id).catch(() => {
throw new Error()
})
if (config('http.code.success') === code) {
@ -282,16 +153,24 @@ function handleSize({ key }) {
* @param pageSize
*/
function onTableChange({ current, pageSize }) {
// paginationState.current = current
// paginationState.pageSize = pageSize
// getPageList()
paginationState.current = current
paginationState.pageSize = pageSize
getPageList()
}
/**
* 完成
*/
function onOk() {
// getPageList()
getPageList()
}
/**
* 重置
*/
function handleResetSearch() {
searchFormData.value = {}
resetPagination()
getPageList()
}
</script>

View File

@ -1,64 +1,29 @@
<template>
<x-search-bar class="mb-8-2">
<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-col v-bind="colSpan">
<a-form-item name="title">
<template #label>
规则名称
<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 name="orderNumber" label="订单编号">
<a-input v-model:value="searchFormData.orderNumber"></a-input>
</a-form-item>
</a-col>
<a-col v-bind="colSpan">
<a-form-item label="描述">
<a-input></a-input>
</a-form-item>
</a-col>
<template v-if="searchBarExpand">
<a-col v-bind="colSpan">
<a-form-item label="服务调用次数">
<a-input></a-input>
<a-form-item label="用户名" title="userName">
<a-input v-model:value="searchFormData.userName"></a-input>
</a-form-item>
</a-col>
<a-col v-bind="colSpan">
<a-form-item label="状态">
<a-select></a-select>
<a-form-item label="手机号" title="phone">
<a-input v-model:value="searchFormData.phone"></a-input>
</a-form-item>
</a-col>
<a-col v-bind="colSpan">
<a-form-item label="上次调度时间">
<a-date-picker placeholder=""></a-date-picker>
</a-form-item>
</a-col>
</template>
<a-col
class="align-right"
v-bind="colSpan">
<a-col class="align-left" v-bind="colSpan">
<a-space>
<a-button>重置</a-button>
<a-button
ghost
type="primary"
@click="handleSearch">
<a-button @click="handleResetSearch">{{ $t('button.reset') }}</a-button>
<a-button ghost type="primary" @click="handleSearch">
搜索
</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-col>
</a-row>
@ -66,101 +31,23 @@
</template>
</x-search-bar>
<a-card>
<x-action-bar class="mb-8-2">
<a-button
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">
<!-- <p><a-button type="primary" @click="$refs.editDialogRef.handleCreate()">新增</a-button></p> -->
<a-table :columns="columns" :data-source="listData" :loading="loading" bordered :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="$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-card>
<edit-dialog
ref="editDialogRef"
@ok="onOk" />
<edit-dialog ref="editDialogRef" @ok="onOk" />
</template>
<script setup>
import { message, Modal } from 'ant-design-vue'
import { ref } from 'vue'
import {
ColumnHeightOutlined,
DownOutlined,
QuestionCircleOutlined,
ReloadOutlined,
SettingOutlined,
UpOutlined,
PlusOutlined,
MoreOutlined,
} from '@ant-design/icons-vue'
import apis from '@/apis'
import { config } from '@/config'
import { usePagination } from '@/hooks'
@ -171,66 +58,50 @@ defineOptions({
})
const columns = [
{ title: '订单ID', dataIndex: 'hostId' },
{ title: '订单编号', dataIndex: 'hostName' },
{ title: '所属用户ID', dataIndex: 'regionId' },
{ title: '用户名', dataIndex: 'cpu' },
{ title: '手机号', dataIndex: 'memory' },
{ title: '实例ID', dataIndex: 'ip' },
{ title: '实例名称', dataIndex: 'hostId' },
{ title: '租赁配置', dataIndex: 'hostName' },
{ title: '计费方式', dataIndex: 'regionId' },
{ 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: '对账状态', dataIndex: 'regionId' },
{ title: '退款金额', dataIndex: 'cpu' },
{ title: '操作', key: 'action', width: 160 },
{title:'订单编号',dataIndex:'orderNumber'},
{ title: '用户名', dataIndex: 'username' },
{ title: '手机号', dataIndex: 'phone' },
{ title: '实例名称', dataIndex: 'caseName' },
{ title: '计费方式', dataIndex: 'billingMethod' },
{ title: '计费开始时间', dataIndex: 'billingStart' },
{ title: '计费结束时间', dataIndex: 'billingEnd' },
{ title: '计费时长', dataIndex: 'billingTime' },
{ title: '单价', dataIndex: 'price' },
{ title: '总费用', dataIndex: 'totalAmount' },
{ title: '算力券名称', dataIndex: 'voucherName' },
{ title: '支付状态', dataIndex: 'payStatus' },
]
// const { listData, paginationState, loading, showLoading, hideLoading, resetPagination, searchFormData } =
// usePagination()
const listData = ref([])
const { listData, paginationState, loading, showLoading, hideLoading, resetPagination, searchFormData } =usePagination()
const editDialogRef = ref()
const searchBarExpand = ref(false)
const size = ref('default')
// getPageList()
getPageList()
/**
* 获取分页列表
*/
async function getPageList() {
try {
// showLoading()
// const { pageSize, current } = paginationState
// const { code, data } = await apis.common
// .getPageList({
// pageSize,
// current: current,
// })
// .catch(() => {
// throw new Error()
// })
// hideLoading()
// if (config('http.code.success') === code) {
// const { records, pagination } = data
// listData.value = records
// paginationState.total = pagination.total
// }
showLoading()
const { pageSize, current } = paginationState
const { code, data } = await apis.vouchers
.getOrderList({
pageSize,
current: current,
...searchFormData.value
})
.catch(() => {
throw new Error()
})
hideLoading()
if (config('http.code.success') === code) {
const { records, pagination } = data
listData.value = records
paginationState.total = pagination.total
}
} catch (error) {
// hideLoading()
hideLoading()
}
}
@ -238,8 +109,8 @@ async function getPageList() {
* 搜索
*/
function handleSearch() {
// resetPagination()
// getPageList()
resetPagination()
getPageList()
}
/**
@ -251,9 +122,9 @@ function handleDelete({ id }) {
content: '确认删除?',
onOk: () => {
return new Promise((resolve, reject) => {
;(async () => {
; (async () => {
try {
const { code } = await apis.common.del(id).catch(() => {
const { code } = await apis.vouchers.deleteVouchers(id).catch(() => {
throw new Error()
})
if (config('http.code.success') === code) {
@ -284,16 +155,24 @@ function handleSize({ key }) {
* @param pageSize
*/
function onTableChange({ current, pageSize }) {
// paginationState.current = current
// paginationState.pageSize = pageSize
// getPageList()
paginationState.current = current
paginationState.pageSize = pageSize
getPageList()
}
/**
* 完成
*/
function onOk() {
// getPageList()
getPageList()
}
/**
* 重置
*/
function handleResetSearch() {
searchFormData.value = {}
resetPagination()
getPageList()
}
</script>

View File

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

View File

@ -1,64 +1,29 @@
<template>
<x-search-bar class="mb-8-2">
<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-col v-bind="colSpan">
<a-form-item name="title">
<template #label>
规则名称
<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 name="username" label="用户名">
<a-input v-model:value="searchFormData.username"></a-input>
</a-form-item>
</a-col>
<a-col v-bind="colSpan">
<a-form-item label="描述">
<a-input></a-input>
</a-form-item>
</a-col>
<template v-if="searchBarExpand">
<a-col v-bind="colSpan">
<a-form-item label="服务调用次数">
<a-input></a-input>
<a-form-item label="手机号" title="phone">
<a-input v-model:value="searchFormData.phone"></a-input>
</a-form-item>
</a-col>
<a-col v-bind="colSpan">
<a-form-item label="状态">
<a-select></a-select>
<a-form-item label="提现编号" title="withdrawalOrderId">
<a-input v-model:value="searchFormData.withdrawalOrderId"></a-input>
</a-form-item>
</a-col>
<a-col v-bind="colSpan">
<a-form-item label="上次调度时间">
<a-date-picker placeholder=""></a-date-picker>
</a-form-item>
</a-col>
</template>
<a-col
class="align-right"
v-bind="colSpan">
<a-col class="align-right" v-bind="colSpan">
<a-space>
<a-button>重置</a-button>
<a-button
ghost
type="primary"
@click="handleSearch">
<a-button @click="handleResetSearch">{{ $t('button.reset') }}</a-button>
<a-button ghost type="primary" @click="handleSearch">
搜索
</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-col>
</a-row>
@ -66,101 +31,22 @@
</template>
</x-search-bar>
<a-card>
<x-action-bar class="mb-8-2">
<a-button
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">
<a-table :columns="columns" :data-source="listData" :loading="loading" bordered :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>
<x-action-button @click="handleReview(record)">审核</x-action-button>
<!-- <x-action-button @click="$refs.editDialogRef.handleEdit(record)">详情</x-action-button> -->
</template>
</template>
</a-table>
</a-card>
<edit-dialog
ref="editDialogRef"
@ok="onOk" />
<edit-dialog ref="editDialogRef" @ok="onOk" />
</template>
<script setup>
import { message, Modal } from 'ant-design-vue'
import { ref } from 'vue'
import {
ColumnHeightOutlined,
DownOutlined,
QuestionCircleOutlined,
ReloadOutlined,
SettingOutlined,
UpOutlined,
PlusOutlined,
MoreOutlined,
} from '@ant-design/icons-vue'
import apis from '@/apis'
import { config } from '@/config'
import { usePagination } from '@/hooks'
@ -171,47 +57,43 @@ defineOptions({
})
const columns = [
{ title: '区域ID', dataIndex: 'hostId' },
{ title: '区域名称', dataIndex: 'hostName' },
{ title: '区域编码', dataIndex: 'regionId' },
{ title: '数据中心地址', dataIndex: 'cpu' },
{ title: '状态', dataIndex: 'memory' },
{ title: '部署主机数量(主机数量)', dataIndex: 'storage' },
{ title: '可用计算卡总数', dataIndex: 'ip' },
{ title: '操作', key: 'action', width: 160 },
{ title: '用户名', dataIndex: 'username' },
{ title: '手机号', dataIndex: 'phone' },
{ title: '提现编号', dataIndex: 'withdrawalOrderId' },
{ title: '提现金额', dataIndex: 'withdrawalAmount' },
{ title: '银行卡信息', dataIndex: 'bankCardInfo' }
]
// const { listData, paginationState, loading, showLoading, hideLoading, resetPagination, searchFormData } =
// usePagination()
const listData = ref([])
const { listData, paginationState, loading, showLoading, hideLoading, resetPagination, searchFormData } =usePagination()
const editDialogRef = ref()
const searchBarExpand = ref(false)
const size = ref('default')
// getPageList()
getPageList()
/**
* 获取分页列表
*/
async function getPageList() {
try {
// showLoading()
// const { pageSize, current } = paginationState
// const { code, data } = await apis.common
// .getPageList({
// pageSize,
// current: current,
// })
// .catch(() => {
// throw new Error()
// })
// hideLoading()
// if (config('http.code.success') === code) {
// const { records, pagination } = data
// listData.value = records
// paginationState.total = pagination.total
// }
showLoading()
const { pageSize, current } = paginationState
const { code, data } = await apis.review
.getPageList({
pageSize,
current: current,
...searchFormData.value
})
.catch(() => {
throw new Error()
})
hideLoading()
if (config('http.code.success') === code) {
const { records, pagination } = data
listData.value = records
paginationState.total = pagination.total
}
} catch (error) {
// hideLoading()
hideLoading()
}
}
@ -219,8 +101,8 @@ async function getPageList() {
* 搜索
*/
function handleSearch() {
// resetPagination()
// getPageList()
resetPagination()
getPageList()
}
/**
@ -232,7 +114,7 @@ function handleDelete({ id }) {
content: '确认删除?',
onOk: () => {
return new Promise((resolve, reject) => {
;(async () => {
; (async () => {
try {
const { code } = await apis.common.del(id).catch(() => {
throw new Error()
@ -265,16 +147,24 @@ function handleSize({ key }) {
* @param pageSize
*/
function onTableChange({ current, pageSize }) {
// paginationState.current = current
// paginationState.pageSize = pageSize
// getPageList()
paginationState.current = current
paginationState.pageSize = pageSize
getPageList()
}
/**
* 完成
*/
function onOk() {
// getPageList()
getPageList()
}
/**
* 重置
*/
function handleResetSearch() {
searchFormData.value = {}
resetPagination()
getPageList()
}
</script>

View File

@ -1,64 +1,29 @@
<template>
<x-search-bar class="mb-8-2">
<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-col v-bind="colSpan">
<a-form-item name="title">
<template #label>
规则名称
<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 name="username" label="用户名">
<a-input v-model:value="searchFormData.username"></a-input>
</a-form-item>
</a-col>
<a-col v-bind="colSpan">
<a-form-item label="描述">
<a-input></a-input>
</a-form-item>
</a-col>
<template v-if="searchBarExpand">
<a-col v-bind="colSpan">
<a-form-item label="服务调用次数">
<a-input></a-input>
<a-form-item label="手机号" title="phone">
<a-input v-model:value="searchFormData.phone"></a-input>
</a-form-item>
</a-col>
<a-col v-bind="colSpan">
<a-form-item label="状态">
<a-select></a-select>
<a-form-item label="提现编号" title="withdrawalOrderId">
<a-input v-model:value="searchFormData.withdrawalOrderId"></a-input>
</a-form-item>
</a-col>
<a-col v-bind="colSpan">
<a-form-item label="上次调度时间">
<a-date-picker placeholder=""></a-date-picker>
</a-form-item>
</a-col>
</template>
<a-col
class="align-right"
v-bind="colSpan">
<a-col class="align-right" v-bind="colSpan">
<a-space>
<a-button>重置</a-button>
<a-button
ghost
type="primary"
@click="handleSearch">
<a-button @click="handleResetSearch">{{ $t('button.reset') }}</a-button>
<a-button ghost type="primary" @click="handleSearch">
搜索
</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-col>
</a-row>
@ -66,156 +31,64 @@
</template>
</x-search-bar>
<a-card>
<x-action-bar class="mb-8-2">
<a-button
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 :columns="columns" :data-source="listData" :loading="loading" bordered :pagination="paginationState"
:size="size" row-key="id" @change="onTableChange">
</a-table>
</a-card>
<edit-dialog
ref="editDialogRef"
@ok="onOk" />
<!-- <edit-dialog ref="editDialogRef" @ok="onOk" /> -->
</template>
<script setup>
import { message, Modal } from 'ant-design-vue'
import { ref } from 'vue'
import {
ColumnHeightOutlined,
DownOutlined,
QuestionCircleOutlined,
ReloadOutlined,
SettingOutlined,
UpOutlined,
PlusOutlined,
MoreOutlined,
} from '@ant-design/icons-vue'
import apis from '@/apis'
import { config } from '@/config'
import { usePagination } from '@/hooks'
import EditDialog from './components/EditDialog.vue'
defineOptions({
name: 'listTable',
name: 'withdrawErrorList',
})
const columns = [
{ title: '计算卡ID', dataIndex: 'hostId' },
{ title: '型号', dataIndex: 'hostName' },
{ title: '显存容量', dataIndex: 'regionId' },
{ title: '核心数', dataIndex: 'cpu' },
{ title: '所属主机ID', dataIndex: 'memory' },
{ title: '运行状态', dataIndex: 'storage' },
{ title: '当前使用实例', dataIndex: 'ip' },
{ title: '用户信息(租用者)', dataIndex: 'status' },
{ title: '开始使用时间', dataIndex: 'bandwidth' },
{ title: '预计释放时间', dataIndex: 'createdAt' },
{ title: '固件版本', dataIndex: 'updatedAt' },
{ title: '操作', key: 'action', width: 160 },
{ title: '用户名', dataIndex: 'username' },
{ title: '手机号', dataIndex: 'phone' },
{ title: '提现编号', dataIndex: 'withdrawalOrderId' },
{ title: '提现金额', dataIndex: 'withdrawalAmount' },
{ title: '银行卡信息', dataIndex: 'bankCardInfo' },
{title:"失败原因",dataIndex:'reason'},
]
// const { listData, paginationState, loading, showLoading, hideLoading, resetPagination, searchFormData } =
// usePagination()
const listData = ref([])
const { listData, paginationState, loading, showLoading, hideLoading, resetPagination, searchFormData } =usePagination()
const editDialogRef = ref()
const searchBarExpand = ref(false)
const size = ref('default')
// getPageList()
getPageList()
/**
* 获取分页列表
*/
async function getPageList() {
try {
// showLoading()
// const { pageSize, current } = paginationState
// const { code, data } = await apis.common
// .getPageList({
// pageSize,
// current: current,
// })
// .catch(() => {
// throw new Error()
// })
// hideLoading()
// if (config('http.code.success') === code) {
// const { records, pagination } = data
// listData.value = records
// paginationState.total = pagination.total
// }
showLoading()
const { pageSize, current } = paginationState
const { code, data } = await apis.review
.getPendingFaildList({
pageSize,
current: current,
...searchFormData.value
})
.catch(() => {
throw new Error()
})
hideLoading()
if (config('http.code.success') === code) {
const { records, pagination } = data
listData.value = records
paginationState.total = pagination.total
}
} catch (error) {
// hideLoading()
hideLoading()
}
}
@ -223,8 +96,8 @@ async function getPageList() {
* 搜索
*/
function handleSearch() {
// resetPagination()
// getPageList()
resetPagination()
getPageList()
}
/**
@ -236,7 +109,7 @@ function handleDelete({ id }) {
content: '确认删除?',
onOk: () => {
return new Promise((resolve, reject) => {
;(async () => {
; (async () => {
try {
const { code } = await apis.common.del(id).catch(() => {
throw new Error()
@ -269,16 +142,24 @@ function handleSize({ key }) {
* @param pageSize
*/
function onTableChange({ current, pageSize }) {
// paginationState.current = current
// paginationState.pageSize = pageSize
// getPageList()
paginationState.current = current
paginationState.pageSize = pageSize
getPageList()
}
/**
* 完成
*/
function onOk() {
// getPageList()
getPageList()
}
/**
* 重置
*/
function handleResetSearch() {
searchFormData.value = {}
resetPagination()
getPageList()
}
</script>

View File

@ -1,21 +1,16 @@
<template>
<a-modal
:open="modal.open"
:title="modal.title"
:confirm-loading="modal.confirmLoading"
:after-close="onAfterClose"
@ok="handleOk"
@cancel="handleCancel">
<a-form
ref="formRef"
scroll-to-first-error
:model="formData"
:rules="formRules"
<a-modal :open="modal.open" :title="modal.title" :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' } }">
<a-form-item
label="标题"
name="title">
<a-input v-model:value="formData.title"></a-input>
<a-form-item label="打款结果" name="checked">
<a-radio-group v-model:value="formData.checked" name="radioGroup">
<a-radio :value="true">打款成功</a-radio>
<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>
</a-modal>
@ -51,9 +46,9 @@ function handleCreate() {
function handleEdit(record = {}) {
showModal({
type: 'edit',
title: '编辑',
title: '提现确认',
})
formRecord.value = record
formRecord.valu.id = record.withdrawalOrderId
formData.value = cloneDeep(record)
}
@ -67,7 +62,7 @@ function handleOk() {
try {
showLoading()
const params = {
...values,
...formData.value,
}
let result = null
switch (modal.value.type) {
@ -77,7 +72,7 @@ function handleOk() {
})
break
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()
})
break

View File

@ -1,64 +1,29 @@
<template>
<x-search-bar class="mb-8-2">
<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-col v-bind="colSpan">
<a-form-item name="title">
<template #label>
规则名称
<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 name="username" label="用户名">
<a-input v-model:value="searchFormData.username"></a-input>
</a-form-item>
</a-col>
<a-col v-bind="colSpan">
<a-form-item label="描述">
<a-input></a-input>
</a-form-item>
</a-col>
<template v-if="searchBarExpand">
<a-col v-bind="colSpan">
<a-form-item label="服务调用次数">
<a-input></a-input>
<a-form-item label="手机号" title="phone">
<a-input v-model:value="searchFormData.phone"></a-input>
</a-form-item>
</a-col>
<a-col v-bind="colSpan">
<a-form-item label="状态">
<a-select></a-select>
<a-form-item label="提现编号" title="withdrawalOrderId">
<a-input v-model:value="searchFormData.withdrawalOrderId"></a-input>
</a-form-item>
</a-col>
<a-col v-bind="colSpan">
<a-form-item label="上次调度时间">
<a-date-picker placeholder=""></a-date-picker>
</a-form-item>
</a-col>
</template>
<a-col
class="align-right"
v-bind="colSpan">
<a-col class="align-right" v-bind="colSpan">
<a-space>
<a-button>重置</a-button>
<a-button
ghost
type="primary"
@click="handleSearch">
<a-button @click="handleResetSearch">{{ $t('button.reset') }}</a-button>
<a-button ghost type="primary" @click="handleSearch">
搜索
</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-col>
</a-row>
@ -66,101 +31,22 @@
</template>
</x-search-bar>
<a-card>
<x-action-bar class="mb-8-2">
<a-button
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">
<a-table :columns="columns" :data-source="listData" :loading="loading" bordered :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>
<x-action-button @click="handleReview(record)">提现确认</x-action-button>
<!-- <x-action-button @click="$refs.editDialogRef.handleEdit(record)">详情</x-action-button> -->
</template>
</template>
</a-table>
</a-card>
<edit-dialog
ref="editDialogRef"
@ok="onOk" />
<edit-dialog ref="editDialogRef" @ok="onOk" />
</template>
<script setup>
import { message, Modal } from 'ant-design-vue'
import { ref } from 'vue'
import {
ColumnHeightOutlined,
DownOutlined,
QuestionCircleOutlined,
ReloadOutlined,
SettingOutlined,
UpOutlined,
PlusOutlined,
MoreOutlined,
} from '@ant-design/icons-vue'
import apis from '@/apis'
import { config } from '@/config'
import { usePagination } from '@/hooks'
@ -171,47 +57,45 @@ defineOptions({
})
const columns = [
{ title: '区域ID', dataIndex: 'hostId' },
{ title: '区域名称', dataIndex: 'hostName' },
{ title: '区域编码', dataIndex: 'regionId' },
{ title: '数据中心地址', dataIndex: 'cpu' },
{ title: '状态', dataIndex: 'memory' },
{ title: '部署主机数量(主机数量)', dataIndex: 'storage' },
{ title: '可用计算卡总数', dataIndex: 'ip' },
{ title: '操作', key: 'action', width: 160 },
{ title: '用户名', dataIndex: 'username' },
{ title: '手机号', dataIndex: 'phone' },
{ title: '提现编号', dataIndex: 'withdrawalOrderId' },
{ title: '提现金额', dataIndex: 'withdrawalAmount' },
{ title: '银行卡信息', dataIndex: 'bankCardInfo' },
{title:"后台确认时间",dataIndex:'backendConfirmationTime'},
{title:"操作",dataIndex:'action'}
]
// const { listData, paginationState, loading, showLoading, hideLoading, resetPagination, searchFormData } =
// usePagination()
const listData = ref([])
const { listData, paginationState, loading, showLoading, hideLoading, resetPagination, searchFormData } =usePagination()
const editDialogRef = ref()
const searchBarExpand = ref(false)
const size = ref('default')
// getPageList()
getPageList()
/**
* 获取分页列表
*/
async function getPageList() {
try {
// showLoading()
// const { pageSize, current } = paginationState
// const { code, data } = await apis.common
// .getPageList({
// pageSize,
// current: current,
// })
// .catch(() => {
// throw new Error()
// })
// hideLoading()
// if (config('http.code.success') === code) {
// const { records, pagination } = data
// listData.value = records
// paginationState.total = pagination.total
// }
showLoading()
const { pageSize, current } = paginationState
const { code, data } = await apis.review
.getPendingList({
pageSize,
current: current,
...searchFormData.value
})
.catch(() => {
throw new Error()
})
hideLoading()
if (config('http.code.success') === code) {
const { records, pagination } = data
listData.value = records
paginationState.total = pagination.total
}
} catch (error) {
// hideLoading()
hideLoading()
}
}
@ -219,8 +103,8 @@ async function getPageList() {
* 搜索
*/
function handleSearch() {
// resetPagination()
// getPageList()
resetPagination()
getPageList()
}
/**
@ -232,7 +116,7 @@ function handleDelete({ id }) {
content: '确认删除?',
onOk: () => {
return new Promise((resolve, reject) => {
;(async () => {
; (async () => {
try {
const { code } = await apis.common.del(id).catch(() => {
throw new Error()
@ -265,16 +149,24 @@ function handleSize({ key }) {
* @param pageSize
*/
function onTableChange({ current, pageSize }) {
// paginationState.current = current
// paginationState.pageSize = pageSize
// getPageList()
paginationState.current = current
paginationState.pageSize = pageSize
getPageList()
}
/**
* 完成
*/
function onOk() {
// getPageList()
getPageList()
}
/**
* 重置
*/
function handleResetSearch() {
searchFormData.value = {}
resetPagination()
getPageList()
}
</script>

View File

@ -1,64 +1,29 @@
<template>
<x-search-bar class="mb-8-2">
<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-col v-bind="colSpan">
<a-form-item name="title">
<template #label>
规则名称
<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 name="username" label="用户名">
<a-input v-model:value="searchFormData.username"></a-input>
</a-form-item>
</a-col>
<a-col v-bind="colSpan">
<a-form-item label="描述">
<a-input></a-input>
</a-form-item>
</a-col>
<template v-if="searchBarExpand">
<a-col v-bind="colSpan">
<a-form-item label="服务调用次数">
<a-input></a-input>
<a-form-item label="手机号" title="phone">
<a-input v-model:value="searchFormData.phone"></a-input>
</a-form-item>
</a-col>
<a-col v-bind="colSpan">
<a-form-item label="状态">
<a-select></a-select>
<a-form-item label="提现编号" title="withdrawalOrderId">
<a-input v-model:value="searchFormData.withdrawalOrderId"></a-input>
</a-form-item>
</a-col>
<a-col v-bind="colSpan">
<a-form-item label="上次调度时间">
<a-date-picker placeholder=""></a-date-picker>
</a-form-item>
</a-col>
</template>
<a-col
class="align-right"
v-bind="colSpan">
<a-col class="align-right" v-bind="colSpan">
<a-space>
<a-button>重置</a-button>
<a-button
ghost
type="primary"
@click="handleSearch">
<a-button @click="handleResetSearch">{{ $t('button.reset') }}</a-button>
<a-button ghost type="primary" @click="handleSearch">
搜索
</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-col>
</a-row>
@ -66,101 +31,22 @@
</template>
</x-search-bar>
<a-card>
<x-action-bar class="mb-8-2">
<a-button
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 }">
<a-table :columns="columns" :data-source="listData" :loading="loading" bordered :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>
<x-action-button @click="handleReview(record)">审核</x-action-button>
<x-action-button @click="$refs.editDialogRef.handleEdit(record)">详情</x-action-button>
</template>
</template> -->
</a-table>
</a-card>
<edit-dialog
ref="editDialogRef"
@ok="onOk" />
<edit-dialog ref="editDialogRef" @ok="onOk" />
</template>
<script setup>
import { message, Modal } from 'ant-design-vue'
import { ref } from 'vue'
import {
ColumnHeightOutlined,
DownOutlined,
QuestionCircleOutlined,
ReloadOutlined,
SettingOutlined,
UpOutlined,
PlusOutlined,
MoreOutlined,
} from '@ant-design/icons-vue'
import apis from '@/apis'
import { config } from '@/config'
import { usePagination } from '@/hooks'
@ -171,47 +57,44 @@ defineOptions({
})
const columns = [
{ title: '区域ID', dataIndex: 'hostId' },
{ title: '区域名称', dataIndex: 'hostName' },
{ title: '区域编码', dataIndex: 'regionId' },
{ title: '数据中心地址', dataIndex: 'cpu' },
{ title: '状态', dataIndex: 'memory' },
{ title: '部署主机数量(主机数量)', dataIndex: 'storage' },
{ title: '可用计算卡总数', dataIndex: 'ip' },
{ title: '操作', key: 'action', width: 160 },
{ title: '用户名', dataIndex: 'username' },
{ title: '手机号', dataIndex: 'phone' },
{ title: '提现编号', dataIndex: 'withdrawalOrderId' },
{ title: '提现金额', dataIndex: 'withdrawalAmount' },
{ title: '拒绝原因', dataIndex: 'reason' },
{ title: '银行卡信息', dataIndex: 'bankCardInfo' }
]
// const { listData, paginationState, loading, showLoading, hideLoading, resetPagination, searchFormData } =
// usePagination()
const listData = ref([])
const { listData, paginationState, loading, showLoading, hideLoading, resetPagination, searchFormData } = usePagination()
const editDialogRef = ref()
const searchBarExpand = ref(false)
const size = ref('default')
// getPageList()
getPageList()
/**
* 获取分页列表
*/
async function getPageList() {
try {
// showLoading()
// const { pageSize, current } = paginationState
// const { code, data } = await apis.common
// .getPageList({
// pageSize,
// current: current,
// })
// .catch(() => {
// throw new Error()
// })
// hideLoading()
// if (config('http.code.success') === code) {
// const { records, pagination } = data
// listData.value = records
// paginationState.total = pagination.total
// }
showLoading()
const { pageSize, current } = paginationState
const { code, data } = await apis.review
.getFaildList({
pageSize,
current: current,
...searchFormData.value
})
.catch(() => {
throw new Error()
})
hideLoading()
if (config('http.code.success') === code) {
const { records, pagination } = data
listData.value = records
paginationState.total = pagination.total
}
} catch (error) {
// hideLoading()
hideLoading()
}
}
@ -219,8 +102,8 @@ async function getPageList() {
* 搜索
*/
function handleSearch() {
// resetPagination()
// getPageList()
resetPagination()
getPageList()
}
/**
@ -232,7 +115,7 @@ function handleDelete({ id }) {
content: '确认删除?',
onOk: () => {
return new Promise((resolve, reject) => {
;(async () => {
; (async () => {
try {
const { code } = await apis.common.del(id).catch(() => {
throw new Error()
@ -265,16 +148,24 @@ function handleSize({ key }) {
* @param pageSize
*/
function onTableChange({ current, pageSize }) {
// paginationState.current = current
// paginationState.pageSize = pageSize
// getPageList()
paginationState.current = current
paginationState.pageSize = pageSize
getPageList()
}
/**
* 完成
*/
function onOk() {
// getPageList()
getPageList()
}
/**
* 重置
*/
function handleResetSearch() {
searchFormData.value = {}
resetPagination()
getPageList()
}
</script>

View File

@ -1,64 +1,29 @@
<template>
<x-search-bar class="mb-8-2">
<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-col v-bind="colSpan">
<a-form-item name="title">
<template #label>
规则名称
<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 name="username" label="用户名">
<a-input v-model:value="searchFormData.username"></a-input>
</a-form-item>
</a-col>
<a-col v-bind="colSpan">
<a-form-item label="描述">
<a-input></a-input>
</a-form-item>
</a-col>
<template v-if="searchBarExpand">
<a-col v-bind="colSpan">
<a-form-item label="服务调用次数">
<a-input></a-input>
<a-form-item label="手机号" title="phone">
<a-input v-model:value="searchFormData.phone"></a-input>
</a-form-item>
</a-col>
<a-col v-bind="colSpan">
<a-form-item label="状态">
<a-select></a-select>
<a-form-item label="提现编号" title="withdrawalOrderId">
<a-input v-model:value="searchFormData.withdrawalOrderId"></a-input>
</a-form-item>
</a-col>
<a-col v-bind="colSpan">
<a-form-item label="上次调度时间">
<a-date-picker placeholder=""></a-date-picker>
</a-form-item>
</a-col>
</template>
<a-col
class="align-right"
v-bind="colSpan">
<a-col class="align-right" v-bind="colSpan">
<a-space>
<a-button>重置</a-button>
<a-button
ghost
type="primary"
@click="handleSearch">
<a-button @click="handleResetSearch">{{ $t('button.reset') }}</a-button>
<a-button ghost type="primary" @click="handleSearch">
搜索
</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-col>
</a-row>
@ -66,101 +31,22 @@
</template>
</x-search-bar>
<a-card>
<x-action-bar class="mb-8-2">
<a-button
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">
<a-table :columns="columns" :data-source="listData" :loading="loading" bordered :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>
<x-action-button @click="handleReview(record)">提现确认</x-action-button>
<!-- <x-action-button @click="$refs.editDialogRef.handleEdit(record)">详情</x-action-button> -->
</template>
</template>
</a-table>
</a-card>
<edit-dialog
ref="editDialogRef"
@ok="onOk" />
<edit-dialog ref="editDialogRef" @ok="onOk" />
</template>
<script setup>
import { message, Modal } from 'ant-design-vue'
import { ref } from 'vue'
import {
ColumnHeightOutlined,
DownOutlined,
QuestionCircleOutlined,
ReloadOutlined,
SettingOutlined,
UpOutlined,
PlusOutlined,
MoreOutlined,
} from '@ant-design/icons-vue'
import apis from '@/apis'
import { config } from '@/config'
import { usePagination } from '@/hooks'
@ -171,47 +57,45 @@ defineOptions({
})
const columns = [
{ title: '区域ID', dataIndex: 'hostId' },
{ title: '区域名称', dataIndex: 'hostName' },
{ title: '区域编码', dataIndex: 'regionId' },
{ title: '数据中心地址', dataIndex: 'cpu' },
{ title: '状态', dataIndex: 'memory' },
{ title: '部署主机数量(主机数量)', dataIndex: 'storage' },
{ title: '可用计算卡总数', dataIndex: 'ip' },
{ title: '操作', key: 'action', width: 160 },
{ title: '用户名', dataIndex: 'username' },
{ title: '手机号', dataIndex: 'phone' },
{ title: '提现编号', dataIndex: 'withdrawalOrderId' },
{ title: '提现金额', dataIndex: 'withdrawalAmount' },
{ title: '银行卡信息', dataIndex: 'bankCardInfo' },
{title:"后台确认时间",dataIndex:'backendConfirmationTime'},
{title:"退款完成时间",dataIndex:'finishedTime'},
]
// const { listData, paginationState, loading, showLoading, hideLoading, resetPagination, searchFormData } =
// usePagination()
const listData = ref([])
const { listData, paginationState, loading, showLoading, hideLoading, resetPagination, searchFormData } =usePagination()
const editDialogRef = ref()
const searchBarExpand = ref(false)
const size = ref('default')
// getPageList()
getPageList()
/**
* 获取分页列表
*/
async function getPageList() {
try {
// showLoading()
// const { pageSize, current } = paginationState
// const { code, data } = await apis.common
// .getPageList({
// pageSize,
// current: current,
// })
// .catch(() => {
// throw new Error()
// })
// hideLoading()
// if (config('http.code.success') === code) {
// const { records, pagination } = data
// listData.value = records
// paginationState.total = pagination.total
// }
showLoading()
const { pageSize, current } = paginationState
const { code, data } = await apis.review
.getInvoicingFailedList({
pageSize,
current: current,
...searchFormData.value
})
.catch(() => {
throw new Error()
})
hideLoading()
if (config('http.code.success') === code) {
const { records, pagination } = data
listData.value = records
paginationState.total = pagination.total
}
} catch (error) {
// hideLoading()
hideLoading()
}
}
@ -219,8 +103,8 @@ async function getPageList() {
* 搜索
*/
function handleSearch() {
// resetPagination()
// getPageList()
resetPagination()
getPageList()
}
/**
@ -232,7 +116,7 @@ function handleDelete({ id }) {
content: '确认删除?',
onOk: () => {
return new Promise((resolve, reject) => {
;(async () => {
; (async () => {
try {
const { code } = await apis.common.del(id).catch(() => {
throw new Error()
@ -265,16 +149,24 @@ function handleSize({ key }) {
* @param pageSize
*/
function onTableChange({ current, pageSize }) {
// paginationState.current = current
// paginationState.pageSize = pageSize
// getPageList()
paginationState.current = current
paginationState.pageSize = pageSize
getPageList()
}
/**
* 完成
*/
function onOk() {
// getPageList()
getPageList()
}
/**
* 重置
*/
function handleResetSearch() {
searchFormData.value = {}
resetPagination()
getPageList()
}
</script>