Compare commits

...

5 Commits

Author SHA1 Message Date
Leo_Ding
ff9383d79f Merge branch 'master' of https://gitlab.guxuan.icu/Leo_Ding/GPU_Admin 2026-01-28 18:33:06 +08:00
Leo_Ding
320113441d 合并代码 2026-01-28 18:32:56 +08:00
Leo_Ding
fc57a72f6e Merge branch 'master' of https://gitlab.guxuan.icu/Leo_Ding/GPU_Admin 2026-01-27 18:39:52 +08:00
Leo_Ding
79cf7c68c2 Merge branch 'master' of https://gitlab.guxuan.icu/Leo_Ding/GPU_Admin 2026-01-27 09:23:37 +08:00
Leo_Ding
a8a4e4964f 接口和字段定义完成 2026-01-26 18:34:56 +08:00
30 changed files with 1217 additions and 2789 deletions

View File

@ -12,7 +12,7 @@ VITE_ROUTER_BASE=/
VITE_ROUTER_HISTORY=hash
# api
VITE_API_BASIC=http://10.10.1.21:8040
VITE_API_BASIC=http://10.10.1.22:8040
VITE_API_HTTP=/api/v1/
# storage
VITE_STORAGE_NAMESPACE = gin-admin_local_

View File

@ -3,7 +3,7 @@ export default () => ({
port: 8080,
proxy: {
'/api': {
target: 'http://10.10.1.21:8040/api',
target: 'http://10.10.1.22:8040/api',
// target: 'http://127.0.0.1:8045/api',
changeOrigin: true,
rewrite: (path) => path.replace('/api', ''),

View File

@ -5,7 +5,7 @@ import request from '@/utils/request'
// 获取待审核列表
export const getPageList = (params) => request.basic.get('/api/v1/contractPendingList', params)
// 审核
export const review = (id) => request.basic.post(`/api/v1/contractPendingList/review`,params)
export const review = (params) => request.basic.post(`/api/v1/contractPendingList/review`,params)
//合同详情
export const getInfo=(id)=>request.basic.get('/api/v1/contractPendingList/'+id)
// 审核失败列表

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 = (id,params) => request.basic.put(`/api/v1/mirror/${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.get('/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/vouchers/'+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

@ -71,6 +71,36 @@ class DisabledDict extends BaseDict {
])
}
}
//镜像类型
class ImgType extends BaseDict{
constructor(){
super([
['USER','用户镜像'],
['SYSTEM','系统镜像']
])
}
}
//计费方式
class PayType extends BaseDict{
constructor(){
super([
['PayOnTime','按时付费'],
['PayOnDay','按日付费'],
['PayOnWeek','按周付费'],
['PayOnMonth','按月付费'],
['PayOnYear','按年付费'],
])
}
}
//算力券状态
class TicketStatus extends BaseDict{
constructor(){
super([
['ENABLED','启用'],
['DISABLED','禁用'],
])
}
}
//如何使用:import {payTypeDict} from '@/enums/dict
//获取下拉框列表payTypeDict.options
//获取label:payTypeDict.getLabel(1)
@ -79,3 +109,6 @@ export const payStatusDict = new PayStatusDict()
export const authenticationDict = new AuthenticationDict()
export const authenticationTypeDict = new AuthenticationTypeDict()
export const disabledDict = new DisabledDict()
export const imgType =new ImgType()
export const payType=new PayType()
export const ticketStatus=new TicketStatus()

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,30 @@
<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>
</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 +33,19 @@ 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)
formData.value = cloneDeep(record)
}
/**
@ -106,22 +57,25 @@ function handleOk() {
.then(async (values) => {
try {
showLoading()
const params = {...values}
const params = {
balanceId:formData.value.id,
amount:formData.value.amount,
}
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 (result.success) {
hideModal()
emit('ok')
}
@ -146,7 +100,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,109 +25,68 @@
</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>
<template v-if="'action' === column.dataIndex">
<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',customRender: ({ text }) => '¥'+text },
{ title: '变更后', dataIndex: 'remainingBalance',customRender: ({ text }) => '¥'+text },
{ title: '变更量', dataIndex: 'changeAmount',customRender: ({ text }) => '¥'+text },
{ title: '变更时间', dataIndex: 'lastChangeTime' },
{ title: '变更类型', dataIndex: 'changeType' },
{ title: '操作', dataIndex: 'action',align:'center' },
]
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 { success, data,total } = await apis.vouchers
.getBalanceList({
pageSize,
current: current,
...searchFormData.value,
...searchFormData.value
})
.catch(() => {
throw new Error()
})
hideLoading()
if (config('http.code.success') === success) {
if (success) {
listData.value = data
paginationState.total = total
}
@ -133,23 +96,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 +132,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 +150,12 @@ function onTableChange({ current, pageSize }) {
getPageList()
}
/**
* 完成
*/
function onOk() {
getPageList()
}
/**
* 重置
*/
@ -178,22 +164,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,49 @@
<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 = [])
formData.value = cloneDeep(record)
}
/**
@ -229,28 +56,24 @@ function handleOk() {
try {
showLoading()
const params = {
...values,
point:formData.value.point,
id:formData.value.id
}
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 (result.success) {
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,101 @@
</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>
<template v-if="'action' === column.dataIndex">
<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',align:'center' },
]
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 { success,total, 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
})
if (success) {
listData.value = data
paginationState.total = total
paginationState.total =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 { success } = await apis.vouchers.deleteVouchers(id).catch(() => {
throw new Error()
})
if (config('http.code.success') === success) {
if (success) {
resolve()
message.success(t('component.message.success.delete'))
await getMenuList()
message.success('删除成功')
await getPageList()
}
} catch (error) {
reject()
@ -207,11 +130,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,84 @@
<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-number v-model:value="formData.faceValue" style="width: 100%;"></a-input-number>
</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-number v-model:value="formData.availablePoints" style="width: 100%;"></a-input-number>
</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 v-for="item in ticketStatus.options" :value="item.value">{{ item.label }}</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'
import {ticketStatus} from '@/enums/dict'
import dayjs from 'dayjs'
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 = 'ENABLED'
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)
formData.value.effectiveTime=dayjs(record.effectiveTime)
formData.value.expiryTime=dayjs(record.expiryTime)
}
/**
@ -229,28 +91,25 @@ function handleOk() {
try {
showLoading()
const params = {
...values,
...formData.value,
effectiveTime:dayjs(formData.value.effectiveTime).format('YYYY-MM-DD'),
expiryTime:dayjs(formData.value.expiryTime).format('YYYY-MM-DD')
}
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 (result.success) {
hideModal()
emit('ok')
}
@ -270,44 +129,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,125 +31,68 @@
</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>
<template v-if="'action' === column.dataIndex">
<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'
import {ticketStatus} from '@/enums/dict'
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',customRender: ({ text }) => ticketStatus.getLabel(text)},
{ 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 { success,total, 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
})
if (success) {
listData.value = data
paginationState.total = total
}
@ -162,42 +100,33 @@ async function getMenuList() {
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 { success } = await apis.vouchers.deleteVouchers(id).catch(() => {
throw new Error()
})
if (config('http.code.success') === success) {
if (success) {
resolve()
message.success(t('component.message.success.delete'))
await getMenuList()
message.success('删除成功')
await getPageList()
}
} catch (error) {
reject()
@ -207,11 +136,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,23 +1,19 @@
<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"
:label-col="{ style: { width: '80px' } }">
<a-form-item
label="标题"
name="title">
<a-input v-model:value="formData.title"></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="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"></a-textarea>
</a-form-item>
</a-form>
</a-card>
</a-modal>
</template>
@ -32,7 +28,7 @@ const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
const { formRef, formRules, formRecord, formData, resetForm } = useForm()
formRules.value = {
title: { required: true, message: '请输入标题' },
}
/**
@ -51,10 +47,10 @@ function handleCreate() {
function handleEdit(record = {}) {
showModal({
type: 'edit',
title: '编辑',
title: '审核',
})
formRecord.value = record
formData.value = cloneDeep(record)
formData.value.checked = true
formData.value.contractId = record.id
}
/**
@ -64,10 +60,11 @@ function handleOk() {
formRef.value
.validateFields()
.then(async (values) => {
console.log(values)
try {
showLoading()
const params = {
...values,
...formData.value,
}
let result = null
switch (modal.value.type) {
@ -77,17 +74,18 @@ function handleOk() {
})
break
case 'edit':
result = await apis.common.update(formRecord.value.id, params).catch(() => {
result = await apis.contract.review(params).catch(() => {
throw new Error()
})
break
}
hideLoading()
if (200 === result?.code) {
if (result?.success) {
hideModal()
emit('ok')
}
} catch (error) {
console.log(error)
hideLoading()
}
})

View File

@ -18,7 +18,7 @@
<a-input v-model:value="searchFormData.contractId"></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">
@ -34,9 +34,9 @@
<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="handleReview(record)">审核</x-action-button>
<x-action-button @click="$refs.editDialogRef.handleEdit(record)">详情</x-action-button>
<template v-if="'action' === column.dataIndex">
<x-action-button @click="$refs.editDialogRef.handleEdit(record)">审核</x-action-button>
<!-- <x-action-button @click="$refs.editDialogRef.handleEdit(record)">详情</x-action-button> -->
</template>
</template>
</a-table>
@ -53,19 +53,17 @@ import { usePagination } from '@/hooks'
import EditDialog from './components/EditDialog.vue'
defineOptions({
name: 'listTable',
name: 'contract',
})
const columns = [
{ title: '用户名', dataIndex: 'username' },
{ title: '手机号', dataIndex: 'phone' },
{ title: '发票金额', dataIndex: 'invoiceAmount' },
{ title: '发票类型', dataIndex: 'invoiceType' },
{ title: '状态', dataIndex: 'status' },
{ title: '发票编号', dataIndex: 'invoiceNumber' },
{ title: '开票日期', dataIndex: 'issueDate' },
{ title: '开票方式', dataIndex: 'issueMethod' },
{ title: '备注', dataIndex: 'remarks' },
{ title: '合同编号', dataIndex: 'contractId' },
{ title: '合同名称', dataIndex: 'contractName' },
{ title: '合同类型', dataIndex: 'contractType' },
{ title: '合同内容', dataIndex: 'contractContent' },
{ title: '操作', dataIndex: 'action',width:120,align:'center' },
]
const { listData, paginationState, loading, showLoading, hideLoading, resetPagination, searchFormData } =usePagination()
const editDialogRef = ref()
@ -81,8 +79,8 @@ async function getPageList() {
try {
showLoading()
const { pageSize, current } = paginationState
const { code, data } = await apis.invoice
.getDeliveriesFailedList({
const { success,total, data } = await apis.contract
.getPageList({
pageSize,
current: current,
...searchFormData.value
@ -91,10 +89,9 @@ async function getPageList() {
throw new Error()
})
hideLoading()
if (config('http.code.success') === code) {
const { records, pagination } = data
listData.value = records
paginationState.total = pagination.total
if (success) {
listData.value = data
paginationState.total = total
}
} catch (error) {
hideLoading()

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,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: '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 { success,total, data } = await apis.contract
.getFaildList({
pageSize,
current: current,
...searchFormData.value
})
.catch(() => {
throw new Error()
})
hideLoading()
if (success) {
listData.value = data
paginationState.total = total
}
} catch (error) {
// hideLoading()
hideLoading()
}
}
@ -219,8 +100,8 @@ async function getPageList() {
* 搜索
*/
function handleSearch() {
// resetPagination()
// getPageList()
resetPagination()
getPageList()
}
/**
@ -232,7 +113,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 +146,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,152 +31,75 @@
</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 v-if="'contractContent' === column.dataIndex">
<a-image :width="100" :height="100" :src="config('http.apiBasic')+record.contractContent" />
</template>
</a-dropdown>
</x-action-button>
<template v-if="'action' === column.key">
<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'
import EditDialog from './components/EditDialog.vue'
defineOptions({
name: 'listTable',
})
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 { success, total, data } = await apis.contract
.getinvoiceSuccessList({
pageSize,
current: current,
...searchFormData.value
})
.catch(() => {
throw new Error()
})
hideLoading()
if (success) {
listData.value = data
paginationState.total = total
}
} catch (error) {
// hideLoading()
hideLoading()
}
}
@ -219,8 +107,8 @@ async function getPageList() {
* 搜索
*/
function handleSearch() {
// resetPagination()
// getPageList()
resetPagination()
getPageList()
}
/**
@ -232,7 +120,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 +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,23 +1,14 @@
<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-card>
<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="url">
<gx-upload v-model="formData.fileList" accept-types=".jpg,.png,.webp" :fileNumber="1" />
</a-form-item>
</a-form>
</a-card>
</a-modal>
</template>
@ -25,7 +16,8 @@
import { cloneDeep } from 'lodash-es'
import apis from '@/apis'
import { useForm, useModal } from '@/hooks'
import GxUpload from '@/components/GxUpload/index.vue'
import {spliceUrl} from '@/utils/util.js'
const emit = defineEmits(['ok'])
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
@ -51,10 +43,10 @@ function handleCreate() {
function handleEdit(record = {}) {
showModal({
type: 'edit',
title: '编辑',
title: '上传签章合同',
})
formRecord.value = record
formData.value = cloneDeep(record)
formData.value.id = record.id
}
/**
@ -64,10 +56,16 @@ function handleOk() {
formRef.value
.validateFields()
.then(async (values) => {
console.log(formData.value.fileList)
if(formData.value.fileList===undefined||formData.value.fileList.length==0){
return message.error('请上传签章图片')
}
try {
showLoading()
console.log(spliceUrl(formData.value.fileList[0]))
const params = {
...values,
id:formData.value.id,
url:spliceUrl(formData.value.fileList[0])
}
let result = null
switch (modal.value.type) {
@ -77,17 +75,18 @@ function handleOk() {
})
break
case 'edit':
result = await apis.common.update(formRecord.value.id, params).catch(() => {
result = await apis.contract.pendingUpload(params).catch(() => {
throw new Error()
})
break
}
hideLoading()
if (200 === result?.code) {
if (result?.success) {
hideModal()
emit('ok')
}
} catch (error) {
console.log(error)
hideLoading()
}
})

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>
<template v-if="'action' === column.dataIndex">
<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,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' },
{title:"操作",dataIndex:'action',width:100}
]
// 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 { success,total, data } = await apis.contract
.getPendingList({
pageSize,
current: current,
...searchFormData.value
})
.catch(() => {
throw new Error()
})
hideLoading()
if (success) {
listData.value = data
paginationState.total = 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,23 +1,33 @@
<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-card>
<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-select v-model:value="formData.imageType" placeholder="请选择类型">
<a-select-option v-for="item in imgType.options" :key="item.value" :value="item.value">
{{ item.label }}
</a-select-option>
</a-select>
</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-card>
</a-modal>
</template>
@ -25,14 +35,21 @@
import { cloneDeep } from 'lodash-es'
import apis from '@/apis'
import { useForm, useModal } from '@/hooks'
import { number } from 'echarts'
import {imgType} from '@/enums/dict'
const emit = defineEmits(['ok'])
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: '请输入所属用户名' },
}
/**
@ -53,7 +70,8 @@ function handleEdit(record = {}) {
type: 'edit',
title: '编辑',
})
formRecord.value = record
console.log(record)
// formRecord.value.id = record.id
formData.value = cloneDeep(record)
}
@ -67,23 +85,26 @@ function handleOk() {
try {
showLoading()
const params = {
...values,
...formData.value,
imageSize: Number(formData.value.imageSize),
name:formData.value.imageName
}
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(formData.value.id, params).catch(() => {
throw new Error()
})
break
}
console.log(result)
hideLoading()
if (200 === result?.code) {
if (true === result?.success) {
hideModal()
emit('ok')
}

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,169 +31,74 @@
</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">
<template v-if="'action' === column.dataIndex">
<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="$refs.editDialogRef.handleEdit(record)">详情</x-action-button> -->
<x-action-button @click="handleDelete(record)" style="color: red;">删除</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'
import EditDialog from './components/EditDialog.vue'
import {imgType} from '@/enums/dict'
defineOptions({
name: 'listTable',
})
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', width: 120 },
{ title: '手机号', dataIndex: 'phone', width: 120 },
{ title: '镜像名称', dataIndex: 'imageName'},
{ title: '镜像类型', dataIndex: 'imageType', width: 120, customRender: ({ text }) => imgType.getLabel(text) || text, },
{ title: '镜像路径', dataIndex: 'imagePath' },
{ title: '镜像大小', dataIndex: 'imageSize',customRender: ({ text }) => text },
{ title: '镜像版本', dataIndex: 'imageVersion' },
{ title: '描述', dataIndex: 'description' },
{ title: '操作', dataIndex: 'action',width:130,align:'center' },
]
// 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 { success, data, total } = await apis.images
.getPageList({
pageSize,
current: current,
...searchFormData.value
})
.catch(() => {
throw new Error()
})
hideLoading()
if (success) {
listData.value = data
paginationState.total = total
}
} catch (error) {
// hideLoading()
hideLoading()
}
}
@ -236,8 +106,8 @@ async function getPageList() {
* 搜索
*/
function handleSearch() {
// resetPagination()
// getPageList()
resetPagination()
getPageList()
}
/**
@ -249,12 +119,12 @@ function handleDelete({ id }) {
content: '确认删除?',
onOk: () => {
return new Promise((resolve, reject) => {
;(async () => {
; (async () => {
try {
const { code } = await apis.common.del(id).catch(() => {
const { success } = await apis.images.deleteVouchers(id).catch(() => {
throw new Error()
})
if (config('http.code.success') === code) {
if (success) {
resolve()
message.success('删除成功')
await getPageList()
@ -282,16 +152,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,171 +31,71 @@
</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>
<!-- <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">
</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'
import {payType} from '@/enums/dict'
defineOptions({
name: 'listTable',
})
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',customRender: ({ text }) => payType.getLabel(text) || text, },
{ title: '计费开始时间', dataIndex: 'billingStart' },
{ title: '计费结束时间', dataIndex: 'billingEnd' },
{ title: '计费时长', dataIndex: 'billingTime' },
{ title: '单价', dataIndex: 'price' },
{ title: '总费用/元', dataIndex: 'totalAmount',customRender: ({ text }) => '¥'+text, },
{ 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 { success, data ,total} = await apis.vouchers
.getOrderList({
pageSize,
current: current,
...searchFormData.value
})
.catch(() => {
throw new Error()
})
hideLoading()
if (success) {
listData.value = data
paginationState.total = total
}
} catch (error) {
// hideLoading()
hideLoading()
}
}
@ -238,8 +103,8 @@ async function getPageList() {
* 搜索
*/
function handleSearch() {
// resetPagination()
// getPageList()
resetPagination()
getPageList()
}
/**
@ -251,9 +116,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 +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,23 +1,20 @@
<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-card>
<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"></a-textarea>
</a-form-item>
</a-form>
</a-card>
</a-modal>
</template>
@ -51,12 +48,11 @@ function handleCreate() {
function handleEdit(record = {}) {
showModal({
type: 'edit',
title: '编辑',
title: '审核',
})
formRecord.value = record
formData.value = cloneDeep(record)
formData.value.checked=true
formData.value.withdrawalOrderId = record.withdrawalOrderId
}
/**
* 确定
*/
@ -67,7 +63,7 @@ function handleOk() {
try {
showLoading()
const params = {
...values,
...formData.value,
}
let result = null
switch (modal.value.type) {
@ -77,13 +73,13 @@ 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
}
hideLoading()
if (200 === result?.code) {
if (result?.success) {
hideModal()
emit('ok')
}

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-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,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>
<template v-if="'action' === column.dataIndex">
<!-- <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: 'bankCardInfo' },
{title:'申请时间',dataIndex:'withdrawalTime'},
{title:'操作',dataIndex:'action',align:'center'}
]
// 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 { success,total, data } = await apis.review
.getPageList({
pageSize,
current: current,
...searchFormData.value
})
.catch(() => {
throw new Error()
})
hideLoading()
if (success) {
listData.value = data
paginationState.total =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-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,156 +31,63 @@
</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 { success, total, data } = await apis.review
.getPendingFaildList({
pageSize,
current: current,
...searchFormData.value
})
.catch(() => {
throw new Error()
})
hideLoading()
if (success) {
listData.value = data
paginationState.total = total
}
} catch (error) {
// hideLoading()
hideLoading()
}
}
@ -223,8 +95,8 @@ async function getPageList() {
* 搜索
*/
function handleSearch() {
// resetPagination()
// getPageList()
resetPagination()
getPageList()
}
/**
@ -236,7 +108,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 +141,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,23 +1,20 @@
<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-card>
<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-card>
</a-modal>
</template>
@ -51,10 +48,11 @@ function handleCreate() {
function handleEdit(record = {}) {
showModal({
type: 'edit',
title: '编辑',
title: '提现确认',
})
formRecord.value = record
formData.value = cloneDeep(record)
console.log(1111)
formData.value.checked=true
formData.value.withdrawalOrderId = record.withdrawalOrderId
}
/**
@ -67,7 +65,7 @@ function handleOk() {
try {
showLoading()
const params = {
...values,
...formData.value,
}
let result = null
switch (modal.value.type) {
@ -77,13 +75,13 @@ function handleOk() {
})
break
case 'edit':
result = await apis.common.update(formRecord.value.id, params).catch(() => {
result = await apis.review.pendingUpload(params).catch(() => {
throw new Error()
})
break
}
hideLoading()
if (200 === result?.code) {
if (result?.success) {
hideModal()
emit('ok')
}

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-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,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>
<template v-if="'action' === column.dataIndex">
<!-- <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:'withdrawalTime'},
{title:"审核时间",dataIndex:'backendConfirmationTime'},
{title:"操作",dataIndex:'action',align:'center'}
]
// 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 { success, data,total } = await apis.review
.getPendingList({
pageSize,
current: current,
...searchFormData.value
})
.catch(() => {
throw new Error()
})
hideLoading()
if (success) {
listData.value = data
paginationState.total = 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-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,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' },
{title:'申请时间',dataIndex:'withdrawalTime'}
]
// 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 { success,total, data } = await apis.review
.getFaildList({
pageSize,
current: current,
...searchFormData.value
})
.catch(() => {
throw new Error()
})
hideLoading()
if (success) {
listData.value = data
paginationState.total =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-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,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,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: 'bankCardInfo' },
{title:"申请时间",dataIndex:'withdrawalTime'},
{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 { success,total, data } = await apis.review
.getInvoicingFailedList({
pageSize,
current: current,
...searchFormData.value
})
.catch(() => {
throw new Error()
})
hideLoading()
if (success) {
listData.value = data
paginationState.total =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>