- 格式化 Ollama 和 OpenAI API 的错误消息字符串以提高可读性 - 移除 AI 视图中的 BaseURL 输入字段并硬编码为固定端点 - 简化 AI 视图中 API 调用的基础 URL 配置逻辑 - 修复多个组件中的代码格式和空格缩进问题 - 清理经销商订单视图中的多余注释和代码结构 - 调整表单组件的标签和布局格式以提升用户体验
144 lines
3.6 KiB
Vue
144 lines
3.6 KiB
Vue
<!-- 搜索表单 -->
|
|
<template>
|
|
<a-space :size="10" style="flex-wrap: wrap">
|
|
<a-input-search
|
|
allow-clear
|
|
placeholder="客户名称|订单编号"
|
|
style="width: 240px"
|
|
v-model:value="where.keywords"
|
|
@search="reload"
|
|
/>
|
|
<a-button type="dashed" @click="handleExport">导出xls</a-button>
|
|
</a-space>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import type { GradeParam } from '@/api/user/grade/model';
|
|
import { ref, watch } from 'vue';
|
|
import { utils, writeFile } from 'xlsx';
|
|
import { message } from 'ant-design-vue';
|
|
import { ShopDealerCapital } from '@/api/shop/shopDealerCapital/model';
|
|
import { getTenantId } from '@/utils/domain';
|
|
import useSearch from '@/utils/use-search';
|
|
import {
|
|
ShopDealerOrder,
|
|
ShopDealerOrderParam
|
|
} from '@/api/sdy/sdyDealerOrder/model';
|
|
import { pageShopDealerOrder } from '@/api/shop/shopDealerOrder';
|
|
|
|
const props = withDefaults(
|
|
defineProps<{
|
|
// 选中的角色
|
|
selection?: [];
|
|
}>(),
|
|
{}
|
|
);
|
|
|
|
const emit = defineEmits<{
|
|
(e: 'search', where?: GradeParam): void;
|
|
(e: 'add'): void;
|
|
(e: 'remove'): void;
|
|
(e: 'batchMove'): void;
|
|
}>();
|
|
|
|
const reload = () => {
|
|
emit('search', where);
|
|
};
|
|
|
|
// 表单数据
|
|
const { where } = useSearch<ShopDealerOrderParam>({
|
|
keywords: '',
|
|
userId: undefined,
|
|
orderNo: undefined,
|
|
limit: 5000
|
|
});
|
|
|
|
const list = ref<ShopDealerCapital[]>([]);
|
|
|
|
// 导出
|
|
const handleExport = async () => {
|
|
const array: (string | number)[][] = [
|
|
[
|
|
'客户名称',
|
|
'业务员',
|
|
'订单编号',
|
|
'结算电量',
|
|
'换算成度',
|
|
'结算单价',
|
|
'结算金额',
|
|
'税费',
|
|
'实发金额',
|
|
'一级佣金30%',
|
|
'一级佣金收益',
|
|
'二级佣金10%',
|
|
'二级佣金收益',
|
|
'三级佣金60%',
|
|
'三级佣金收益',
|
|
'月份',
|
|
'创建时间',
|
|
'结算时间',
|
|
'租户ID'
|
|
]
|
|
];
|
|
|
|
// 按搜索结果导出
|
|
await pageShopDealerOrder(where)
|
|
.then((data) => {
|
|
list.value = data?.list || [];
|
|
list.value?.forEach((d: ShopDealerOrder) => {
|
|
array.push([
|
|
`${d.title}`,
|
|
`${d.nickname}(${d.userId})`,
|
|
`${d.orderNo}`,
|
|
`${d.orderPrice}`,
|
|
`${d.degreePrice}`,
|
|
`${d.price}`,
|
|
`${d.settledPrice}`,
|
|
`${d.rate}`,
|
|
`${d.payPrice}`,
|
|
`${d.firstNickname}(${d.firstUserId})`,
|
|
`${d.firstMoney}`,
|
|
`${d.secondNickname}(${d.secondUserId})`,
|
|
`${d.secondMoney}`,
|
|
`${d.thirdNickname}(${d.thirdUserId})`,
|
|
`${d.thirdMoney}`,
|
|
`${d.month}`,
|
|
`${d.createTime}`,
|
|
`${d.settleTime}`,
|
|
`${d.tenantId}`
|
|
]);
|
|
});
|
|
const sheetName = `bak_shop_dealer_order_${getTenantId()}`;
|
|
const workbook = {
|
|
SheetNames: [sheetName],
|
|
Sheets: {}
|
|
};
|
|
const sheet = utils.aoa_to_sheet(array);
|
|
workbook.Sheets[sheetName] = sheet;
|
|
// 设置列宽
|
|
sheet['!cols'] = [
|
|
{ wch: 10 },
|
|
{ wch: 20 },
|
|
{ wch: 20 },
|
|
{ wch: 15 },
|
|
{ wch: 10 },
|
|
{ wch: 10 },
|
|
{ wch: 20 }
|
|
];
|
|
message.loading('正在导出...');
|
|
setTimeout(() => {
|
|
writeFile(workbook, `${sheetName}.xlsx`);
|
|
}, 1000);
|
|
})
|
|
.catch((msg) => {
|
|
message.error(msg);
|
|
})
|
|
.finally(() => {});
|
|
};
|
|
|
|
watch(
|
|
() => props.selection,
|
|
() => {}
|
|
);
|
|
</script>
|