-
+
{
- const res = await getFeeSettingList()
- const savedId = currentRow.value?.id
- tableData.value = res
- console.log(res)
- if (res && res.length > 0) {
- const targetRow = savedId ? res.find((item: any) => item.id === savedId) : null
- if (targetRow) {
- setCurrent(targetRow)
- handleCurrentChange(targetRow)
- } else {
- setCurrent(res[0])
- handleCurrentChange(res[0])
+ startLoading()
+ try {
+ const res = await getFeeSettingList()
+ const savedId = currentRow.value?.id
+ tableData.value = res
+ console.log(res)
+ if (res && res.length > 0) {
+ const targetRow = savedId ? res.find((item: any) => item.id === savedId) : null
+ if (targetRow) {
+ setCurrent(targetRow)
+ handleCurrentChange(targetRow)
+ } else {
+ setCurrent(res[0])
+ handleCurrentChange(res[0])
+ }
}
+ } finally {
+ stopLoading()
}
}
diff --git a/src/views/mould/risk/index.vue b/src/views/mould/risk/index.vue
index 5a75ede..ad1c219 100644
--- a/src/views/mould/risk/index.vue
+++ b/src/views/mould/risk/index.vue
@@ -34,6 +34,7 @@
row-key="id"
highlight-current-row
:current-row-key="selectedRowId"
+ :loading="loading"
>
{{ row.status === 1 ? '启用' : '停用' }}
@@ -44,6 +45,7 @@
:table-data="currentContent"
class="table-content"
row-key="id"
+ :loading="loading"
>
@@ -75,6 +77,9 @@ defineOptions({
name: 'Risk'
})
// 组件
+import { usePageLoading } from '@/composables/useLoading'
+const { loading, startLoading, stopLoading } = usePageLoading()
+
import RiskTableSwitch from '@/components/common/Table.vue'
import RiskTableContent from '@/components/common/Table.vue'
import RiskDialog from '@/components/common/Dialog.vue'
@@ -165,39 +170,41 @@ const colSpan = ref(12)
* @description: 定义请求数据方法
*/
const getRiskList = async () => {
- const data: any = await getRiskListApi()
- // 保存原始数据
- riskOriginData.value = data
- // 处理数据
- tableTreeSwitch.value = data.map((item: any) => ({
- id: item.id,
- name: item.name,
- status: item.status,
- }))
- tableTreeContent.value = data.map((item: any) => ({
- id: item.id,
- isDefault: item.is_default,
- // 单笔开仓最大数量
- maxOpenPosition: item.max_opening_quantity_per_transaction,
- // 单品种最大持仓数量
- maxPositionPerSymbol: item.max_holding_quantity_per_variety,
- // 总品种最大持仓数量
- maxTotalPosition: item.max_holding_quantity_per_transaction,
- // 强平比例
- strongCloseRatio: item.strong_to_average_ratio,
- // 每次出金最大金额
- maxWithdrawalAmount: item.max_withdrawal_amount_per_transaction,
- // 是否允许出金
- isWithdrawalAllowed: item.withdraw_status === 1 ? '是' : '否',
- // 出金时间设置
- withdrawalTimeSetting: item.withdraw_time,
- // 是否需要出金审核
- isWithdrawalAuditRequired: item.withdraw_is_check === 1 ? '是' : '否',
- // 建仓多少秒不能平仓
- buildCloseTime: item.open_close_time,
- // 每次出金最小金额
- minWithdrawalAmount: item.min_withdrawal_amount_per_transaction,
- // 滑点
+ startLoading()
+ const data: any = await getRiskListApi()
+ stopLoading()
+ // 保存原始数据
+ riskOriginData.value = data
+ // 处理数据
+ tableTreeSwitch.value = data.map((item: any) => ({
+ id: item.id,
+ name: item.name,
+ status: item.status,
+ }))
+ tableTreeContent.value = data.map((item: any) => ({
+ id: item.id,
+ isDefault: item.is_default,
+ // 单笔开仓最大数量
+ maxOpenPosition: item.max_opening_quantity_per_transaction,
+ // 单品种最大持仓数量
+ maxPositionPerSymbol: item.max_holding_quantity_per_variety,
+ // 总品种最大持仓数量
+ maxTotalPosition: item.max_holding_quantity_per_transaction,
+ // 强平比例
+ strongCloseRatio: item.strong_to_average_ratio,
+ // 每次出金最大金额
+ maxWithdrawalAmount: item.max_withdrawal_amount_per_transaction,
+ // 是否允许出金
+ isWithdrawalAllowed: item.withdraw_status === 1 ? '是' : '否',
+ // 出金时间设置
+ withdrawalTimeSetting: item.withdraw_time,
+ // 是否需要出金审核
+ isWithdrawalAuditRequired: item.withdraw_is_check === 1 ? '是' : '否',
+ // 建仓多少秒不能平仓
+ buildCloseTime: item.open_close_time,
+ // 每次出金最小金额
+ minWithdrawalAmount: item.min_withdrawal_amount_per_transaction,
+ // 滑点
slippage: item.slippage,
// 每次入金最小金额
minDepositAmount: item.min_recharge_amount_per_transaction,
diff --git a/src/views/order/history/index.vue b/src/views/order/history/index.vue
index 4b9b40c..54a8afb 100644
--- a/src/views/order/history/index.vue
+++ b/src/views/order/history/index.vue
@@ -10,7 +10,7 @@
交易盈亏:0.00 USD
-
+
{
+ startLoading()
const params = {
page: currentPage.value,
page_size: pageSize.value,
@@ -92,7 +95,7 @@ const getCustomerTradeOrderList = async () => {
}
console.log(params)
const data: any = await getCustomTradeOrderListApi(params)
-
+ stopLoading()
//表格数据
// table数据映射
tableTree.value = data.data.map((item: any) => ({
diff --git a/src/views/order/rechange/index.vue b/src/views/order/rechange/index.vue
index 2b82475..5b2f177 100644
--- a/src/views/order/rechange/index.vue
+++ b/src/views/order/rechange/index.vue
@@ -13,6 +13,7 @@
:table-data="tableTree"
:columns="tableColumnsOptions"
:highlight-current-row="false"
+ :loading="loading"
>
@@ -43,6 +44,7 @@ defineOptions({
import { onMounted, ref } from 'vue'
import OrderRechangeSearch from '@/components/common/Search.vue'
import OrderRechangeTable from '@/components/common/Table.vue'
+import { usePageLoading } from '@/composables/useLoading'
import OrderRechangePagination from '@/components/common/Pagination.vue'
import { getRechargeOrderListApi, reviewRechargeOrder } from '@/api/modules/order/rechange.ts'
import { search, tableColumns } from './options'
@@ -86,6 +88,7 @@ const createDefaultSearchForm = (): SearchFormData => ({
const searchForm = ref(createDefaultSearchForm())
+const { loading, startLoading, stopLoading } = usePageLoading()
// 表格数据与列配置。
const tableTree = ref([])
const tableColumnsOptions = ref(tableColumns)
@@ -109,6 +112,7 @@ const getRechargeStatusText = (status: string | number | null | undefined) => {
// 获取充值订单列表:把接口返回字段统一映射成页面表格结构。
const getRechargeOrderList = async () => {
+ startLoading()
const params = {
page: currentPage.value,
page_size: pageSize.value,
@@ -150,6 +154,8 @@ const getRechargeOrderList = async () => {
tableTree.value = []
total.value = 0
console.error('获取充值订单列表失败', error)
+ } finally {
+ stopLoading()
}
}
diff --git a/src/views/order/transfer/index.vue b/src/views/order/transfer/index.vue
index e823de2..1be64c6 100644
--- a/src/views/order/transfer/index.vue
+++ b/src/views/order/transfer/index.vue
@@ -16,6 +16,7 @@
:table-data="tableTree"
:columns="tableColumnsOptions"
row-key="id"
+ :loading="loading"
ref="tableRef"
>
@@ -37,6 +38,7 @@ defineOptions({
// 组件
import TransferSearch from '@/components/common/Search.vue'
import TransferTable from '@/components/common/Table.vue'
+import { usePageLoading } from '@/composables/useLoading'
import TransferPagination from '@/components/common/Pagination.vue'
// 配置以及表单验证
import { search, tableColumns } from './options'
@@ -60,6 +62,7 @@ const searchForm = ref({
transferTime: [initTime.start, initTime.end],
})
const searchOptions = ref(search)
+const { loading, startLoading, stopLoading } = usePageLoading()
/**
* @description: 定义表格数据
*/
@@ -77,6 +80,7 @@ const total = ref(0)
*/
const getTransferDetailList = async () => {
+ startLoading()
const params = {
page: currentPage.value,
page_size: pageSize.value,
@@ -108,6 +112,8 @@ const getTransferDetailList = async () => {
}))
// 分页数据
total.value = data.total
+
+ stopLoading()
currentPage.value = data.current_page
pageSize.value = Number(data.per_page)
}
diff --git a/src/views/profile/agent/index.vue b/src/views/profile/agent/index.vue
index 2dee708..e9b3fa0 100644
--- a/src/views/profile/agent/index.vue
+++ b/src/views/profile/agent/index.vue
@@ -5,7 +5,7 @@
@reset="handleReset">
+ :default-sort="{ prop: 'createTime', order: 'descending' }" :loading="loading" @expand-change="handleGetSubList">
@@ -112,6 +112,7 @@ defineOptions({
// 组件
import CustomerListSearch from '@/components/common/Search.vue'
import CustomerListTable from '@/components/common/Table.vue'
+import { usePageLoading } from '@/composables/useLoading'
import CustomerListPagination from '@/components/common/Pagination.vue'
import CustomerListDialog from '@/components/common/Dialog.vue'
import CustomerListForm from '@/components/common/Form.vue'
@@ -145,6 +146,7 @@ const searchForm = ref({
const searchOptions = ref(search)
const tableColumnsOptions = ref(tableColumns)
+const { loading, startLoading, stopLoading } = usePageLoading()
/**
* @description: 定义表格数据
*/
@@ -291,6 +293,7 @@ const roleMap: any = {
*/
// 获取客户列表
const getCustomerList = async () => {
+ startLoading()
const params = {
page: currentPage.value,
page_size: pageSize.value,
@@ -315,6 +318,8 @@ const getCustomerList = async () => {
//分页数据
total.value = data.total
+
+ stopLoading()
currentPage.value = data.current_page
pageSize.value = Number(data.per_page)
}
diff --git a/src/views/profile/business/index.vue b/src/views/profile/business/index.vue
index 1107d5f..c3f8e41 100644
--- a/src/views/profile/business/index.vue
+++ b/src/views/profile/business/index.vue
@@ -27,6 +27,7 @@
:table-data="marketTree"
:columns="marketTableColumnsOptions"
row-key="id"
+ :loading="loading"
@row-click="handleRowClick"
@row-contextmenu="handleRowContextMenu"
>
@@ -195,6 +196,7 @@ defineOptions({
// 组件
import MarketSearch from '@/components/common/Search.vue'
import MarketTable from '@/components/common/Table.vue'
+import { usePageLoading } from '@/composables/useLoading'
import MarketPagination from '@/components/common/Pagination.vue'
import MarketDialog from '@/components/common/Dialog.vue'
import MarketForm from '@/components/common/Form.vue'
@@ -239,6 +241,7 @@ const marketSearchForm = ref({
})
const marketSearchOptions = ref(marketSearch)
+const { loading, startLoading, stopLoading } = usePageLoading()
/**
* @description 定义表格数据
*/
@@ -565,6 +568,7 @@ const handleMarketFormLinkage = async (type: 'level' | 'parentAccountName', valu
*/
//获取做市商列表
const getMarketList = async () => {
+ startLoading()
const params = {
page: currentPage.value,
page_size: pageSize.value,
@@ -573,8 +577,10 @@ const getMarketList = async () => {
const data = await getMarketListApi(params)
// 表格数据
marketTree.value = mapMarketTree(data.data)
+ total.value = data.total
+
//分页数据
- total.value = data.total
+ stopLoading()
currentPage.value = data.current_page
pageSize.value = Number(data.per_page)
}
diff --git a/src/views/profile/user/index.vue b/src/views/profile/user/index.vue
index 513cb06..6bd3303 100644
--- a/src/views/profile/user/index.vue
+++ b/src/views/profile/user/index.vue
@@ -15,7 +15,7 @@
-
+
{{ row.status === 1 ? '正常' : '禁用' }}
@@ -137,6 +137,7 @@ defineOptions({
// 组件
import ClientSearch from '@/components/common/Search.vue'
import ClientTable from '@/components/common/Table.vue'
+import { usePageLoading } from '@/composables/useLoading'
import ClientPagination from '@/components/common/Pagination.vue'
import ClientDialog from '@/components/common/Dialog.vue'
import ClientForm from '@/components/common/Form.vue'
@@ -172,6 +173,7 @@ const clientSearchForm = ref({
endDateTime: '',
})
+const { loading, startLoading, stopLoading } = usePageLoading()
/**
* @description 定义表格数据
*/
@@ -281,6 +283,7 @@ const mapObjectToOptions = (obj: Record) => {
* @description 统一获取数据方法
*/
const getClientList = async () => {
+ startLoading()
const params = {
page: currentPage.value,
page_size: pageSize.value,
@@ -304,8 +307,9 @@ const getClientList = async () => {
// 映射所属代理用户名
agentUsername: item.par_uid === item.parent?.id ? item.parent?.username : '',
}))
- //分页数据
total.value = Number(data.total)
+ //分页数据
+ stopLoading()
currentPage.value = Number(data.current_page)
pageSize.value = Number(data.per_page)
}
diff --git a/src/views/system/menu/index.vue b/src/views/system/menu/index.vue
index e40d192..e3d988b 100644
--- a/src/views/system/menu/index.vue
+++ b/src/views/system/menu/index.vue
@@ -11,6 +11,7 @@
:columns="menuTableColumns"
row-key="id"
:tree-props="treeProps"
+ :loading="loading"
>
@@ -71,6 +72,9 @@ defineOptions({
})
import type { FormInstance } from 'element-plus'
import { Plus } from '@element-plus/icons-vue'
+import { usePageLoading } from '@/composables/useLoading'
+const { loading, startLoading, stopLoading } = usePageLoading()
+
// 组件配置
import MenuTable from '@/components/common/Table.vue'
import MenuDialog from '@/components/common/Dialog.vue'
@@ -137,6 +141,7 @@ const handleAddMenu = () => {
// 获取菜单列表
const fetchMenuList = async () => {
+ startLoading()
try {
const data = await getMenuApi()
menuTree.value = data
@@ -148,6 +153,8 @@ const fetchMenuList = async () => {
menuFormOptionsMap.value.parent_id = [{ label: '一级菜单', value: '0' }, ...parentNameOptions]
} catch (err) {
console.error('获取菜单列表失败', err)
+ } finally {
+ stopLoading()
}
}
// 页面加载时获取菜单列表
diff --git a/src/views/system/notice/index.vue b/src/views/system/notice/index.vue
index 049b91e..e11264e 100644
--- a/src/views/system/notice/index.vue
+++ b/src/views/system/notice/index.vue
@@ -14,7 +14,7 @@
-
+
{{ row.status === 1 ? '草稿' : '已发布' }}
@@ -99,6 +99,9 @@
defineOptions({
name: 'Notice'
})
+import { usePageLoading } from '@/composables/useLoading'
+const { loading, startLoading, stopLoading } = usePageLoading()
+
// 组件
import NoticeSearch from '@/components/common/Search.vue'
import NoticeTable from '@/components/common/Table.vue'
@@ -223,6 +226,7 @@ const noticeFormOptionsMap = ref({
*/
//获取公告列表
const getNoticeList = async () => {
+ startLoading()
const params = {
page: currentPage.value,
page_size: pageSize.value,
@@ -231,19 +235,23 @@ const getNoticeList = async () => {
publish_start_time: searchForm.value.startDateTime,
publish_end_time: searchForm.value.endDateTime,
}
- const data: any = await getNoticeListApi(params)
- // 表格数据
- noticeTree.value = data.data.map((item: any) => ({
- id: item.id,
- noticeName: item.name,
- noticeContent: item.content,
- publishTime: item.publish_time,
- status: item.status,
- }))
- // 分页数据
- total.value = data.total
- currentPage.value = data.current_page
- pageSize.value = Number(data.per_page)
+ try {
+ const data: any = await getNoticeListApi(params)
+ // 表格数据
+ noticeTree.value = data.data.map((item: any) => ({
+ id: item.id,
+ noticeName: item.name,
+ noticeContent: item.content,
+ publishTime: item.publish_time,
+ status: item.status,
+ }))
+ // 分页数据
+ total.value = data.total
+ currentPage.value = data.current_page
+ pageSize.value = Number(data.per_page)
+ } finally {
+ stopLoading()
+ }
}
/**
diff --git a/src/views/system/role/index.vue b/src/views/system/role/index.vue
index 1626030..6d9aab7 100644
--- a/src/views/system/role/index.vue
+++ b/src/views/system/role/index.vue
@@ -6,7 +6,7 @@
新增角色
-
+
@@ -54,6 +54,8 @@ defineOptions({
})
import type { FormInstance, TreeInstance } from 'element-plus'
import { Plus } from '@element-plus/icons-vue'
+import { usePageLoading } from '@/composables/useLoading'
+const { loading, startLoading, stopLoading } = usePageLoading()
// 组件配置
import RoleTable from '@/components/common/Table.vue'
@@ -140,11 +142,14 @@ const filterRoles = (roleList: any[]) => {
// 获取角色列表
const fetchRoleList = async () => {
+ startLoading()
try {
const data = await getRoleApi()
roleTree.value = data
} catch (err) {
console.error('获取角色列表失败', err)
+ } finally {
+ stopLoading()
}
}
diff --git a/src/views/system/setting/index.vue b/src/views/system/setting/index.vue
index 63f1241..2517e67 100644
--- a/src/views/system/setting/index.vue
+++ b/src/views/system/setting/index.vue
@@ -3,7 +3,7 @@
-
+
编辑
@@ -33,6 +33,9 @@ defineOptions({
})
import type { FormInstance } from 'element-plus'
import { Plus } from '@element-plus/icons-vue'
+import { usePageLoading } from '@/composables/useLoading'
+const { loading, startLoading, stopLoading } = usePageLoading()
+
// 组件配置
import MenuHeader from '@/components/common/Header.vue'
import MenuTable from '@/components/common/Table.vue'
@@ -88,11 +91,14 @@ const handleAddMenu = () => {
// 获取菜单列表
const fetchSettingList = async () => {
+ startLoading()
try {
const data = await getSettingApi()
menuTree.value = data
} catch (err) {
console.error('获取菜单列表失败', err)
+ } finally {
+ stopLoading()
}
}
// 页面加载时获取菜单列表
diff --git a/src/views/trade/variety/index.vue b/src/views/trade/variety/index.vue
index e4ff52f..b98c271 100644
--- a/src/views/trade/variety/index.vue
+++ b/src/views/trade/variety/index.vue
@@ -28,6 +28,7 @@
:columns="varietyTableColumnsOptions"
row-key="id"
@row-click="handleRowClick"
+ :loading="loading"
>
{{ ['', '上线', '下线'][row.onlineStatus] }}
@@ -94,6 +95,9 @@ defineOptions({
name: 'Variety'
})
// 组件
+import { usePageLoading } from '@/composables/useLoading'
+const { loading, startLoading, stopLoading } = usePageLoading()
+
import VarietySearch from '@/components/common/Search.vue'
import VarietyTable from '@/components/common/Table.vue'
import VarietyDialog from '@/components/common/Dialog.vue'
@@ -233,31 +237,36 @@ const typeMap: any = {
//获取品种列表
const getVarietyList = async () => {
+ startLoading()
const params = {
name: searchForm.value.varietyName,
}
- const data = await getVarietyListApi(params)
- console.log('data', data)
- //格式化表格数据
- varietyTree.value = data.map((item: any) => ({
- ...item,
- id: item.id,
- varietyName: item.name,
- varietyCode: item.code,
- onlineStatus: item.online_status,
- tradeStatus: item.status,
- minPoint: item.point_diff,
- maxPoint: item.point_diff_max,
- contractSize: item.multiplier,
- minFlux: item.undulate_min,
- unit: item.unit,
- tradeGroup: item.group.name,
- longStockFee: item.fee_inventory_long,
- shortStockFee: item.fee_inventory_short,
- profitLevel: item.stop_loss_level,
- type: typeMap[item.type],
- image: item.image,
- }))
+ try {
+ const data = await getVarietyListApi(params)
+ console.log('data', data)
+ //格式化表格数据
+ varietyTree.value = data.map((item: any) => ({
+ ...item,
+ id: item.id,
+ varietyName: item.name,
+ varietyCode: item.code,
+ onlineStatus: item.online_status,
+ tradeStatus: item.status,
+ minPoint: item.point_diff,
+ maxPoint: item.point_diff_max,
+ contractSize: item.multiplier,
+ minFlux: item.undulate_min,
+ unit: item.unit,
+ tradeGroup: item.group.name,
+ longStockFee: item.fee_inventory_long,
+ shortStockFee: item.fee_inventory_short,
+ profitLevel: item.stop_loss_level,
+ type: typeMap[item.type],
+ image: item.image,
+ }))
+ } finally {
+ stopLoading()
+ }
}
// 获取合约品种分组列表