mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-25 06:29:20 +08:00
fix: 修复前端若干类型报错
This commit is contained in:
+4
-2
@@ -139,13 +139,14 @@ const gridOptions: VxeGridProps<any> = {
|
||||
};
|
||||
|
||||
// 搜索表单配置
|
||||
const gridReloadRef = ref<(() => void) | null>(null);
|
||||
const formOptions = computed(() => ({
|
||||
schema: [
|
||||
{
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入商品名称(回车搜索)',
|
||||
onPressEnter: () => gridApi?.reload(),
|
||||
onPressEnter: () => gridReloadRef.value?.(),
|
||||
},
|
||||
fieldName: 'name',
|
||||
label: '商品名称',
|
||||
@@ -154,7 +155,7 @@ const formOptions = computed(() => ({
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入商品编码(回车搜索)',
|
||||
onPressEnter: () => gridApi?.reload(),
|
||||
onPressEnter: () => gridReloadRef.value?.(),
|
||||
},
|
||||
fieldName: 'productCode',
|
||||
label: '商品编码',
|
||||
@@ -172,6 +173,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
showSearchForm: true,
|
||||
tableTitle: '商品列表',
|
||||
});
|
||||
gridReloadRef.value = () => gridApi.reload();
|
||||
|
||||
// 监听 shopId 变化,刷新表格
|
||||
watch(
|
||||
|
||||
+4
-2
@@ -139,13 +139,14 @@ const gridOptions: VxeGridProps<any> = {
|
||||
};
|
||||
|
||||
// 搜索表单配置
|
||||
const gridReloadRef = ref<(() => void) | null>(null);
|
||||
const formOptions = computed(() => ({
|
||||
schema: [
|
||||
{
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入商品名称(回车搜索)',
|
||||
onPressEnter: () => gridApi?.reload(),
|
||||
onPressEnter: () => gridReloadRef.value?.(),
|
||||
},
|
||||
fieldName: 'name',
|
||||
label: '商品名称',
|
||||
@@ -154,7 +155,7 @@ const formOptions = computed(() => ({
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入商品编码(回车搜索)',
|
||||
onPressEnter: () => gridApi?.reload(),
|
||||
onPressEnter: () => gridReloadRef.value?.(),
|
||||
},
|
||||
fieldName: 'productCode',
|
||||
label: '商品编码',
|
||||
@@ -172,6 +173,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
showSearchForm: true,
|
||||
tableTitle: '商品列表',
|
||||
});
|
||||
gridReloadRef.value = () => gridApi.reload();
|
||||
|
||||
// 监听 shopId 变化,刷新表格
|
||||
watch(
|
||||
|
||||
@@ -157,13 +157,14 @@ const gridOptions: VxeGridProps<any> = {
|
||||
};
|
||||
|
||||
// 搜索表单配置
|
||||
const gridReloadRef = ref<(() => void) | null>(null);
|
||||
const formOptions = computed(() => ({
|
||||
schema: [
|
||||
{
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入店铺名称(回车搜索)',
|
||||
onPressEnter: () => gridApi?.reload(),
|
||||
onPressEnter: () => gridReloadRef.value?.(),
|
||||
},
|
||||
fieldName: 'name',
|
||||
label: '店铺名称',
|
||||
@@ -174,7 +175,7 @@ const formOptions = computed(() => ({
|
||||
placeholder: '请选择平台',
|
||||
options: platformOptions,
|
||||
allowClear: true,
|
||||
onChange: () => gridApi?.reload(),
|
||||
onChange: () => gridReloadRef.value?.(),
|
||||
},
|
||||
fieldName: 'platform',
|
||||
label: '平台',
|
||||
@@ -192,6 +193,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
showSearchForm: true,
|
||||
tableTitle: '店铺管理',
|
||||
});
|
||||
gridReloadRef.value = () => gridApi.reload();
|
||||
|
||||
// 刷新表格数据
|
||||
function refreshTable() {
|
||||
|
||||
+2
-3
@@ -5,7 +5,6 @@ import type {
|
||||
} from '#/api/ecommerce/shop-monthly-target';
|
||||
import type { ShopVO } from '#/api/ecommerce/shop/types';
|
||||
|
||||
import dayjs from 'dayjs';
|
||||
import { onMounted, ref, watch } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
@@ -18,12 +17,13 @@ import {
|
||||
message,
|
||||
Select,
|
||||
} from 'ant-design-vue';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import { getShopPageApi } from '#/api/ecommerce/shop';
|
||||
import {
|
||||
createShopMonthlyTargetApi,
|
||||
updateShopMonthlyTargetApi,
|
||||
} from '#/api/ecommerce/shop-monthly-target';
|
||||
import { getShopPageApi } from '#/api/ecommerce/shop';
|
||||
|
||||
defineOptions({ name: 'ShopMonthlyTargetFormModal' });
|
||||
|
||||
@@ -271,4 +271,3 @@ onMounted(() => {
|
||||
</Form>
|
||||
</Modal>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -161,6 +161,8 @@ const gridOptions: VxeGridProps<any> = {
|
||||
};
|
||||
|
||||
// 搜索表单配置
|
||||
const gridReloadRef = ref<(() => void) | null>(null);
|
||||
|
||||
const formOptions = computed(() => ({
|
||||
schema: [
|
||||
{
|
||||
@@ -169,7 +171,7 @@ const formOptions = computed(() => ({
|
||||
placeholder: '请选择店铺',
|
||||
options: shopOptions,
|
||||
allowClear: true,
|
||||
onChange: () => gridApi?.reload(),
|
||||
onChange: () => gridReloadRef.value?.(),
|
||||
},
|
||||
fieldName: 'shopId',
|
||||
label: '店铺',
|
||||
@@ -180,7 +182,7 @@ const formOptions = computed(() => ({
|
||||
placeholder: '开始月份',
|
||||
picker: 'month',
|
||||
style: { width: '100%' },
|
||||
onChange: () => gridApi?.reload(),
|
||||
onChange: () => gridReloadRef.value?.(),
|
||||
},
|
||||
fieldName: 'startTargetMonth',
|
||||
label: '目标月份',
|
||||
@@ -191,7 +193,7 @@ const formOptions = computed(() => ({
|
||||
placeholder: '结束月份',
|
||||
picker: 'month',
|
||||
style: { width: '100%' },
|
||||
onChange: () => gridApi?.reload(),
|
||||
onChange: () => gridReloadRef.value?.(),
|
||||
},
|
||||
fieldName: 'endTargetMonth',
|
||||
label: '至',
|
||||
@@ -216,6 +218,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
showSearchForm: true,
|
||||
tableTitle: '店铺月销量目标管理',
|
||||
});
|
||||
gridReloadRef.value = () => gridApi.reload();
|
||||
|
||||
// 处理新增
|
||||
const handleAdd = () => {
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
<script lang="ts" setup>
|
||||
import type { EchartsUIType } from '@vben/plugins/echarts';
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
import type { OrderDTO } from '#/api/ecommerce/order';
|
||||
import type { PageQueryDTO } from '#/types/common';
|
||||
import type { OrderStatusVO } from '#/api/ecommerce/order-status/types';
|
||||
import type { ShopDTO, ShopVO } from '#/api/ecommerce/shop/types';
|
||||
import type { PageQueryDTO } from '#/types/common';
|
||||
|
||||
import { computed, onActivated, onMounted, ref, watch } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
@@ -16,10 +17,9 @@ import { Button, DatePicker, message, Spin, Tag } from 'ant-design-vue';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { getShopOverviewStatisticsApi } from '#/api/ecommerce/shop';
|
||||
import { getOrderPageApi } from '#/api/ecommerce/order';
|
||||
import { getAllOrderStatusListApi } from '#/api/ecommerce/order-status';
|
||||
import type { OrderStatusVO } from '#/api/ecommerce/order-status/types';
|
||||
import { getShopOverviewStatisticsApi } from '#/api/ecommerce/shop';
|
||||
import { exportByPost } from '#/utils/export';
|
||||
|
||||
defineOptions({ name: 'ShopOverview' });
|
||||
@@ -517,7 +517,8 @@ const orderGridOptions: VxeGridProps<any> = {
|
||||
pageSize: page.pageSize,
|
||||
filters: {
|
||||
shopId: shopId.value,
|
||||
platformOrderNo: orderSearchForm.value.platformOrderNo || undefined,
|
||||
platformOrderNo:
|
||||
orderSearchForm.value.platformOrderNo || undefined,
|
||||
statusId: orderSearchForm.value.statusId,
|
||||
minReceivedAmount: orderSearchForm.value.minReceivedAmount,
|
||||
maxReceivedAmount: orderSearchForm.value.maxReceivedAmount,
|
||||
@@ -525,7 +526,10 @@ const orderGridOptions: VxeGridProps<any> = {
|
||||
},
|
||||
};
|
||||
// 添加排序参数
|
||||
if (orderSearchForm.value.sortField && orderSearchForm.value.sortOrder) {
|
||||
if (
|
||||
orderSearchForm.value.sortField &&
|
||||
orderSearchForm.value.sortOrder
|
||||
) {
|
||||
params.sorts = [
|
||||
{
|
||||
field: orderSearchForm.value.sortField,
|
||||
@@ -540,7 +544,11 @@ const orderGridOptions: VxeGridProps<any> = {
|
||||
};
|
||||
} catch (error: any) {
|
||||
console.error('获取订单列表失败:', error);
|
||||
message.error('获取订单列表失败: ' + (error?.message || error?.response?.data?.message || '未知错误'));
|
||||
message.error(
|
||||
`获取订单列表失败: ${
|
||||
error?.message || error?.response?.data?.message || '未知错误'
|
||||
}`,
|
||||
);
|
||||
return {
|
||||
items: [],
|
||||
total: 0,
|
||||
@@ -553,6 +561,9 @@ const orderGridOptions: VxeGridProps<any> = {
|
||||
},
|
||||
};
|
||||
|
||||
/** 避免 orderFormOptions 与 orderGridApi 循环引用导致隐式 any */
|
||||
const orderGridReloadRef = ref<(() => void) | null>(null);
|
||||
|
||||
// 订单搜索表单配置
|
||||
const orderFormOptions = computed(() => ({
|
||||
schema: [
|
||||
@@ -560,7 +571,7 @@ const orderFormOptions = computed(() => ({
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入平台订单号(回车搜索)',
|
||||
onPressEnter: () => orderGridApi?.reload(),
|
||||
onPressEnter: () => orderGridReloadRef.value?.(),
|
||||
},
|
||||
fieldName: 'platformOrderNo',
|
||||
label: '订单号',
|
||||
@@ -571,7 +582,7 @@ const orderFormOptions = computed(() => ({
|
||||
placeholder: '请选择订单状态',
|
||||
options: orderStatusOptions,
|
||||
allowClear: true,
|
||||
onChange: () => orderGridApi?.reload(),
|
||||
onChange: () => orderGridReloadRef.value?.(),
|
||||
},
|
||||
fieldName: 'statusId',
|
||||
label: '订单状态',
|
||||
@@ -582,7 +593,7 @@ const orderFormOptions = computed(() => ({
|
||||
placeholder: '最小金额',
|
||||
min: 0,
|
||||
style: { width: '100%' },
|
||||
onPressEnter: () => orderGridApi?.reload(),
|
||||
onPressEnter: () => orderGridReloadRef.value?.(),
|
||||
},
|
||||
fieldName: 'minReceivedAmount',
|
||||
label: '实收金额(起)',
|
||||
@@ -593,7 +604,7 @@ const orderFormOptions = computed(() => ({
|
||||
placeholder: '最大金额',
|
||||
min: 0,
|
||||
style: { width: '100%' },
|
||||
onPressEnter: () => orderGridApi?.reload(),
|
||||
onPressEnter: () => orderGridReloadRef.value?.(),
|
||||
},
|
||||
fieldName: 'maxReceivedAmount',
|
||||
label: '实收金额(止)',
|
||||
@@ -607,7 +618,7 @@ const orderFormOptions = computed(() => ({
|
||||
{ label: '未确认', value: 0 },
|
||||
],
|
||||
allowClear: true,
|
||||
onChange: () => orderGridApi?.reload(),
|
||||
onChange: () => orderGridReloadRef.value?.(),
|
||||
},
|
||||
fieldName: 'confirm',
|
||||
label: '确认状态',
|
||||
@@ -618,7 +629,7 @@ const orderFormOptions = computed(() => ({
|
||||
placeholder: '选择排序字段',
|
||||
options: orderSortFieldOptions,
|
||||
allowClear: true,
|
||||
onChange: () => orderGridApi?.reload(),
|
||||
onChange: () => orderGridReloadRef.value?.(),
|
||||
},
|
||||
fieldName: 'sortField',
|
||||
label: '排序字段',
|
||||
@@ -629,7 +640,7 @@ const orderFormOptions = computed(() => ({
|
||||
placeholder: '选择排序方式',
|
||||
options: orderSortOrderOptions,
|
||||
allowClear: true,
|
||||
onChange: () => orderGridApi?.reload(),
|
||||
onChange: () => orderGridReloadRef.value?.(),
|
||||
},
|
||||
fieldName: 'sortOrder',
|
||||
label: '排序方式',
|
||||
@@ -646,6 +657,7 @@ const [OrderGrid, orderGridApi] = useVbenVxeGrid({
|
||||
formOptions: orderFormOptions.value,
|
||||
showSearchForm: true,
|
||||
});
|
||||
orderGridReloadRef.value = () => orderGridApi.reload();
|
||||
|
||||
// 刷新订单列表
|
||||
function refreshOrderGrid() {
|
||||
|
||||
Reference in New Issue
Block a user