This commit is contained in:
2026-06-01 15:34:25 +08:00
parent 0ad61c0e69
commit 1710f687a6
2 changed files with 22 additions and 29 deletions

View File

@ -23,3 +23,8 @@ export async function editVarietyApi(params: any): Promise<any> {
export async function syncVarietyApi(): Promise<any> {
return request.post<any>('/contractVariety/syncVariety', {})
}
//获取品种枚举
export async function getVarietyEnumsApi(): Promise<any> {
return request.get<any>('/contractVariety/getVarietyEnums')
}

View File

@ -80,6 +80,7 @@ import {
editVarietyApi,
createVarietyApi,
syncVarietyApi,
getVarietyEnumsApi,
} from '@/api/modules/trade/variety'
//
import { uploadImageApi } from '@/api/modules/upload'
@ -160,28 +161,7 @@ const varietyFormRules = ref(rules())
const dialogFormItemOptions = ref(DialogFormItem)
const varietyFormOptionsMap = ref({
group_id: [],
type: [
{
label: '外汇',
value: 1,
},
{
label: '金属',
value: 2,
},
{
label: '能源',
value: 3,
},
{
label: '指数',
value: 4,
},
{
label: '数字货币',
value: 5,
},
],
type: [],
})
//
const selectedRow = ref<any>(null)
@ -190,12 +170,19 @@ const colSpan = ref(12)
const fileList = ref([])
const typeMap: any = {
1: '外汇',
2: '金属',
3: '能源',
4: '指数',
5: '数字货币',
//
const typeList = ref<any[]>([])
//
const getVarietyEnums = async () => {
const res = await getVarietyEnumsApi()
if (res) {
typeList.value = res.map((item: any) => ({
label: item.name,
value: item.type,
}))
varietyFormOptionsMap.value.type = typeList.value as any
}
}
/**
@ -228,7 +215,7 @@ const getVarietyList = async () => {
longStockFee: item.fee_inventory_long,
shortStockFee: item.fee_inventory_short,
profitLevel: item.stop_loss_level,
type: typeMap[item.type],
type: typeList.value.find((t: any) => t.value === item.type)?.label || '',
image: item.image,
}))
} finally {
@ -249,6 +236,7 @@ const getTradeGroupList = async () => {
* @description: 页面加载完成需要请求的数据
*/
onMounted(() => {
getVarietyEnums()
getVarietyList()
getTradeGroupList()
})