feat: 统一 api 组件的调用方法

This commit is contained in:
xingyu4j
2025-10-20 10:41:57 +08:00
parent c6ef77694e
commit 30c7727361
88 changed files with 22772 additions and 554 deletions

View File

@@ -25,13 +25,9 @@ export function useImportTableFormSchema(): VbenFormSchema[] {
label: '数据源',
component: 'ApiSelect',
componentProps: {
api: async () => {
const data = await getDataSourceConfigList();
return data.map((item) => ({
label: item.name,
value: item.id,
}));
},
api: () => getDataSourceConfigList(),
labelField: 'name',
valueField: 'id',
autoSelect: 'first',
placeholder: '请选择数据源',
},

View File

@@ -23,7 +23,7 @@ export function useFormSchema(): VbenFormSchema[] {
label: '商品',
component: 'ApiSelect',
componentProps: {
api: getSpuSimpleList,
api: () => getSpuSimpleList(),
labelField: 'name',
valueField: 'id',
placeholder: '请选择商品',

View File

@@ -113,7 +113,7 @@ export function useValueFormSchema(): VbenFormSchema[] {
component: 'ApiSelect',
componentProps: (values) => {
return {
api: getPropertySimpleList,
api: () => getPropertySimpleList(),
placeholder: '请选择属性',
labelField: 'name',
valueField: 'id',
@@ -153,7 +153,7 @@ export function useValueGridFormSchema(): VbenFormSchema[] {
label: '属性项',
component: 'ApiSelect',
componentProps: {
api: getPropertySimpleList,
api: () => getPropertySimpleList(),
placeholder: '请选择属性项',
labelField: 'name',
valueField: 'id',

View File

@@ -181,7 +181,7 @@ export function useDeliveryFormSchema(): VbenFormSchema[] {
label: '运费模板',
component: 'ApiSelect',
componentProps: {
api: getSimpleTemplateList,
api: () => getSimpleTemplateList(),
labelField: 'name',
valueField: 'id',
},

View File

@@ -38,7 +38,7 @@ export function useFormSchema(): VbenFormSchema[] {
label: '文章分类',
component: 'ApiSelect',
componentProps: {
api: getSimpleArticleCategoryList,
api: () => getSimpleArticleCategoryList(),
labelField: 'name',
valueField: 'id',
placeholder: '请选择文章分类',
@@ -140,7 +140,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
label: '文章分类',
component: 'ApiSelect',
componentProps: {
api: getSimpleArticleCategoryList,
api: () => getSimpleArticleCategoryList(),
labelField: 'name',
valueField: 'id',
placeholder: '请选择文章分类',

View File

@@ -74,7 +74,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
label: '快递公司',
component: 'ApiSelect',
componentProps: {
api: getSimpleDeliveryExpressList,
api: () => getSimpleDeliveryExpressList(),
labelField: 'name',
valueField: 'id',
placeholder: '请选择快递公司',
@@ -90,11 +90,9 @@ export function useGridFormSchema(): VbenFormSchema[] {
label: '自提门店',
component: 'ApiSelect',
componentProps: {
api: getSimpleDeliveryPickUpStoreList,
fieldNames: {
label: 'name',
value: 'id',
},
api: () => getSimpleDeliveryPickUpStoreList(),
labelField: 'name',
valueField: 'id',
placeholder: '请选择自提门店',
clearable: true,
},
@@ -374,11 +372,9 @@ export function useAddressFormSchema(): VbenFormSchema[] {
component: 'ApiTreeSelect',
componentProps: {
api: () => getAreaTree(),
fieldNames: {
label: 'name',
value: 'id',
children: 'children',
},
labelField: 'name',
valueField: 'id',
childrenField: 'children',
placeholder: '请选择收件人所在地',
treeDefaultExpandAll: true,
},
@@ -426,7 +422,7 @@ export function useDeliveryFormSchema(): VbenFormSchema[] {
label: '物流公司',
component: 'ApiSelect',
componentProps: {
api: getSimpleDeliveryExpressList,
api: () => getSimpleDeliveryExpressList(),
labelField: 'name',
valueField: 'id',
placeholder: '请选择物流公司',

View File

@@ -6,7 +6,8 @@ import type { MallOrderApi } from '#/api/mall/trade/order/index';
import { ref } from 'vue';
import { useRouter } from 'vue-router';
import { DeliveryTypeEnum } from '@vben/constants';
import { DeliveryTypeEnum, DICT_TYPE } from '@vben/constants';
import { getDictOptions } from '@vben/hooks';
import { $t } from '@vben/locales';
import { fenToYuan } from '@vben/utils';
@@ -17,9 +18,6 @@ import { getSimpleDeliveryExpressList } from '#/api/mall/trade/delivery/express'
import { getSimpleDeliveryPickUpStoreList } from '#/api/mall/trade/delivery/pickUpStore';
import * as OrderApi from '#/api/mall/trade/order/index';
import { DictTag } from '#/components/dict-tag';
import { DICT_TYPE } from '@vben/constants';
import { getDictOptions } from '@vben/hooks';
import { getRangePickerDefaultProps } from '#/utils';
import { useGridColumns } from '#/views/mall/trade/order/data';
@@ -106,7 +104,7 @@ const [Grid] = useVbenVxeGrid({
component: 'ApiSelect',
componentProps: {
clearable: true,
api: getSimpleDeliveryExpressList,
api: () => getSimpleDeliveryExpressList(),
labelField: 'name',
valueField: 'id',
placeholder: '全部',
@@ -122,7 +120,7 @@ const [Grid] = useVbenVxeGrid({
label: '自提门店',
component: 'ApiSelect',
componentProps: {
api: getSimpleDeliveryPickUpStoreList,
api: () => getSimpleDeliveryPickUpStoreList(),
labelField: 'name',
valueField: 'id',
},

View File

@@ -21,13 +21,9 @@ export function useGridFormSchema(): VbenFormSchema[] {
label: '应用编号',
component: 'ApiSelect',
componentProps: {
api: async () => {
const data = await getAppList();
return data.map((item) => ({
label: item.name,
value: item.id,
}));
},
api: () => getAppList(),
labelField: 'name',
valueField: 'id',
autoSelect: 'first',
placeholder: '请选择应用编号',
},

View File

@@ -74,7 +74,7 @@ export function useFormSchema(): VbenFormSchema[] {
label: '负责人',
component: 'ApiSelect',
componentProps: {
api: getSimpleUserList,
api: () => getSimpleUserList(),
labelField: 'nickname',
valueField: 'id',
placeholder: '请选择负责人',

View File

@@ -183,7 +183,7 @@ export function useDataFormSchema(): VbenFormSchema[] {
component: 'ApiSelect',
componentProps: (values) => {
return {
api: getSimpleDictTypeList,
api: () => getSimpleDictTypeList(),
placeholder: '请输入字典类型',
labelField: 'name',
valueField: 'type',

View File

@@ -59,7 +59,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
label: '邮箱账号',
component: 'ApiSelect',
componentProps: {
api: async () => await getSimpleMailAccountList(),
api: () => getSimpleMailAccountList(),
labelField: 'mail',
valueField: 'id',
clearable: true,

View File

@@ -42,7 +42,7 @@ export function useFormSchema(): VbenFormSchema[] {
label: '邮箱账号',
component: 'ApiSelect',
componentProps: {
api: async () => await getSimpleMailAccountList(),
api: () => getSimpleMailAccountList(),
labelField: 'mail',
valueField: 'id',
placeholder: '请选择邮箱账号',
@@ -177,7 +177,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
label: '邮箱账号',
component: 'ApiSelect',
componentProps: {
api: async () => await getSimpleMailAccountList(),
api: () => getSimpleMailAccountList(),
labelField: 'mail',
valueField: 'id',
clearable: true,

View File

@@ -193,7 +193,7 @@ export function useSendNotifyFormSchema(): VbenFormSchema[] {
label: '接收人',
component: 'ApiSelect',
componentProps: {
api: getSimpleUserList,
api: () => getSimpleUserList(),
labelField: 'nickname',
valueField: 'id',
placeholder: '请选择接收人',

View File

@@ -16,11 +16,9 @@ export function useGridFormSchema(): VbenFormSchema[] {
label: '操作人',
component: 'ApiSelect',
componentProps: {
api: getSimpleUserList,
props: {
label: 'nickname',
value: 'id',
},
api: () => getSimpleUserList(),
labelField: 'nickname',
valueField: 'id',
clearable: true,
placeholder: '请选择操作人员',
},

View File

@@ -30,7 +30,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
label: '短信渠道',
component: 'ApiSelect',
componentProps: {
api: async () => await getSimpleSmsChannelList(),
api: () => getSimpleSmsChannelList(),
labelField: 'signature',
valueField: 'id',
clearable: true,

View File

@@ -52,7 +52,7 @@ export function useFormSchema(): VbenFormSchema[] {
label: '短信渠道',
component: 'ApiSelect',
componentProps: {
api: async () => await getSimpleSmsChannelList(),
api: () => getSimpleSmsChannelList(),
labelField: 'signature',
valueField: 'id',
placeholder: '请选择短信渠道',
@@ -144,7 +144,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
label: '短信渠道',
component: 'ApiSelect',
componentProps: {
api: async () => await getSimpleSmsChannelList(),
api: () => getSimpleSmsChannelList(),
labelField: 'signature',
valueField: 'id',
clearable: true,

View File

@@ -70,7 +70,7 @@ export function useFormSchema(): VbenFormSchema[] {
label: '岗位',
component: 'ApiSelect',
componentProps: {
api: getSimplePostList,
api: () => getSimplePostList(),
labelField: 'name',
valueField: 'id',
multiple: true,
@@ -212,7 +212,7 @@ export function useAssignRoleFormSchema(): VbenFormSchema[] {
label: '角色',
component: 'ApiSelect',
componentProps: {
api: getSimpleRoleList,
api: () => getSimpleRoleList(),
labelField: 'name',
valueField: 'id',
multiple: true,