Merge branch 'dev' of https://gitee.com/yudaocode/yudao-ui-admin-vben into reform-mp
This commit is contained in:
89
.github/commit-convention.md
vendored
89
.github/commit-convention.md
vendored
@@ -1,89 +0,0 @@
|
||||
## Git Commit Message Convention
|
||||
|
||||
> This is adapted from [Angular's commit convention](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular).
|
||||
|
||||
#### TL;DR:
|
||||
|
||||
Messages must be matched by the following regex:
|
||||
|
||||
```js
|
||||
/^(revert: )?(feat|fix|docs|style|refactor|perf|test|workflow|build|ci|chore|types|wip): .{1,50}/;
|
||||
```
|
||||
|
||||
#### Examples
|
||||
|
||||
Appears under "Features" header, `dev` subheader:
|
||||
|
||||
```
|
||||
feat(dev): add 'comments' option
|
||||
```
|
||||
|
||||
Appears under "Bug Fixes" header, `dev` subheader, with a link to issue #28:
|
||||
|
||||
```
|
||||
fix(dev): fix dev error
|
||||
|
||||
close #28
|
||||
```
|
||||
|
||||
Appears under "Performance Improvements" header, and under "Breaking Changes" with the breaking change explanation:
|
||||
|
||||
```
|
||||
perf(build): remove 'foo' option
|
||||
|
||||
BREAKING CHANGE: The 'foo' option has been removed.
|
||||
```
|
||||
|
||||
The following commit and commit `667ecc1` do not appear in the changelog if they are under the same release. If not, the revert commit appears under the "Reverts" header.
|
||||
|
||||
```
|
||||
revert: feat(compiler): add 'comments' option
|
||||
|
||||
This reverts commit 667ecc1654a317a13331b17617d973392f415f02.
|
||||
```
|
||||
|
||||
### Full Message Format
|
||||
|
||||
A commit message consists of a **header**, **body** and **footer**. The header has a **type**, **scope** and **subject**:
|
||||
|
||||
```
|
||||
<type>(<scope>): <subject>
|
||||
<BLANK LINE>
|
||||
<body>
|
||||
<BLANK LINE>
|
||||
<footer>
|
||||
```
|
||||
|
||||
The **header** is mandatory and the **scope** of the header is optional.
|
||||
|
||||
### Revert
|
||||
|
||||
If the commit reverts a previous commit, it should begin with `revert: `, followed by the header of the reverted commit. In the body, it should say: `This reverts commit <hash>.`, where the hash is the SHA of the commit being reverted.
|
||||
|
||||
### Type
|
||||
|
||||
If the prefix is `feat`, `fix` or `perf`, it will appear in the changelog. However, if there is any [BREAKING CHANGE](#footer), the commit will always appear in the changelog.
|
||||
|
||||
Other prefixes are up to your discretion. Suggested prefixes are `docs`, `chore`, `style`, `refactor`, and `test` for non-changelog related tasks.
|
||||
|
||||
### Scope
|
||||
|
||||
The scope could be anything specifying the place of the commit change. For example `dev`, `build`, `workflow`, `cli` etc...
|
||||
|
||||
### Subject
|
||||
|
||||
The subject contains a succinct description of the change:
|
||||
|
||||
- use the imperative, present tense: "change" not "changed" nor "changes"
|
||||
- don't capitalize the first letter
|
||||
- no dot (.) at the end
|
||||
|
||||
### Body
|
||||
|
||||
Just as in the **subject**, use the imperative, present tense: "change" not "changed" nor "changes". The body should include the motivation for the change and contrast this with previous behavior.
|
||||
|
||||
### Footer
|
||||
|
||||
The footer should contain any information about **Breaking Changes** and is also the place to reference GitHub issues that this commit **Closes**.
|
||||
|
||||
**Breaking Changes** should start with the word `BREAKING CHANGE:` with a space or two newlines. The rest of the commit message is then used for this.
|
||||
@@ -8,6 +8,7 @@ import { requestClient } from '#/api/request';
|
||||
|
||||
const { apiURL } = useAppConfig(import.meta.env, import.meta.env.PROD);
|
||||
const accessStore = useAccessStore();
|
||||
|
||||
export namespace AiChatMessageApi {
|
||||
export interface ChatMessage {
|
||||
id: number; // 编号
|
||||
@@ -18,6 +19,7 @@ export namespace AiChatMessageApi {
|
||||
model: number; // 模型标志
|
||||
modelId: number; // 模型编号
|
||||
content: string; // 聊天内容
|
||||
reasoningContent?: string; // 推理内容(深度思考)
|
||||
tokens: number; // 消耗 Token 数量
|
||||
segmentIds?: number[]; // 段落编号
|
||||
segments?: {
|
||||
@@ -26,10 +28,22 @@ export namespace AiChatMessageApi {
|
||||
documentName: string; // 文档名称
|
||||
id: number; // 段落编号
|
||||
}[];
|
||||
webSearchPages?: WebSearchPage[]; // 联网搜索结果
|
||||
attachmentUrls?: string[]; // 附件 URL 数组
|
||||
createTime: Date; // 创建时间
|
||||
roleAvatar: string; // 角色头像
|
||||
userAvatar: string; // 用户头像
|
||||
}
|
||||
|
||||
/** 联网搜索页面接口 */
|
||||
export interface WebSearchPage {
|
||||
name: string; // 网站名称
|
||||
icon: string; // 网站图标 URL
|
||||
title: string; // 页面标题
|
||||
url: string; // 页面 URL
|
||||
snippet: string; // 简短描述
|
||||
summary: string; // 内容摘要
|
||||
}
|
||||
}
|
||||
|
||||
// 消息列表
|
||||
@@ -47,9 +61,11 @@ export function sendChatMessageStream(
|
||||
content: string,
|
||||
ctrl: any,
|
||||
enableContext: boolean,
|
||||
enableWebSearch: boolean,
|
||||
onMessage: any,
|
||||
onError: any,
|
||||
onClose: any,
|
||||
attachmentUrls?: string[],
|
||||
) {
|
||||
const token = accessStore.accessToken;
|
||||
return fetchEventSource(`${apiURL}/ai/chat/message/send-stream`, {
|
||||
@@ -63,6 +79,8 @@ export function sendChatMessageStream(
|
||||
conversationId,
|
||||
content,
|
||||
useContext: enableContext,
|
||||
useSearch: enableWebSearch,
|
||||
attachmentUrls: attachmentUrls || [],
|
||||
}),
|
||||
onmessage: onMessage,
|
||||
onerror: onError,
|
||||
|
||||
@@ -9,7 +9,8 @@ export namespace AiImageApi {
|
||||
label: string; // Make Variations 文本
|
||||
style: number; // 样式: 2(Primary)、3(Green)
|
||||
}
|
||||
// AI 绘图
|
||||
|
||||
/** AI 绘图 */
|
||||
export interface Image {
|
||||
id: number; // 编号
|
||||
userId: number;
|
||||
@@ -83,6 +84,7 @@ export function deleteImageMy(id: number) {
|
||||
}
|
||||
|
||||
// ================ midjourney 专属 ================
|
||||
|
||||
// 【Midjourney】生成图片
|
||||
export function midjourneyImagine(data: AiImageApi.ImageMidjourneyImagineReq) {
|
||||
return requestClient.post(`/ai/image/midjourney/imagine`, data);
|
||||
@@ -94,6 +96,7 @@ export function midjourneyAction(data: AiImageApi.ImageMidjourneyAction) {
|
||||
}
|
||||
|
||||
// ================ 绘图管理 ================
|
||||
|
||||
// 查询绘画分页
|
||||
export function getImagePage(params: any) {
|
||||
return requestClient.get<AiImageApi.Image[]>(`/ai/image/page`, { params });
|
||||
|
||||
@@ -2,28 +2,48 @@ import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export function getWorkflowPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<any>>('/ai/workflow/page', {
|
||||
params,
|
||||
});
|
||||
export namespace AiWorkflowApi {
|
||||
/** 工作流 */
|
||||
export interface Workflow {
|
||||
id?: number; // 编号
|
||||
name: string; // 工作流名称
|
||||
code: string; // 工作流标识
|
||||
graph: string; // 工作流模型 JSON 数据
|
||||
remark?: string; // 备注
|
||||
status: number; // 状态
|
||||
createTime?: Date; // 创建时间
|
||||
}
|
||||
}
|
||||
|
||||
export const getWorkflow = (id: number | string) => {
|
||||
return requestClient.get(`/ai/workflow/get?id=${id}`);
|
||||
};
|
||||
/** 查询工作流管理列表 */
|
||||
export function getWorkflowPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<AiWorkflowApi.Workflow>>(
|
||||
'/ai/workflow/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
export const createWorkflow = (data: any) => {
|
||||
/** 查询工作流详情 */
|
||||
export function getWorkflow(id: number) {
|
||||
return requestClient.get<AiWorkflowApi.Workflow>(`/ai/workflow/get?id=${id}`);
|
||||
}
|
||||
|
||||
/** 新增工作流 */
|
||||
export function createWorkflow(data: AiWorkflowApi.Workflow) {
|
||||
return requestClient.post('/ai/workflow/create', data);
|
||||
};
|
||||
}
|
||||
|
||||
export const updateWorkflow = (data: any) => {
|
||||
/** 修改工作流 */
|
||||
export function updateWorkflow(data: AiWorkflowApi.Workflow) {
|
||||
return requestClient.put('/ai/workflow/update', data);
|
||||
};
|
||||
}
|
||||
|
||||
export const deleteWorkflow = (id: number | string) => {
|
||||
/** 删除工作流 */
|
||||
export function deleteWorkflow(id: number) {
|
||||
return requestClient.delete(`/ai/workflow/delete?id=${id}`);
|
||||
};
|
||||
}
|
||||
|
||||
export const testWorkflow = (data: any) => {
|
||||
/** 测试工作流 */
|
||||
export function testWorkflow(data: any) {
|
||||
return requestClient.post('/ai/workflow/test', data);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -5,19 +5,6 @@ import type { CrmPermissionApi } from '#/api/crm/permission';
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CrmBusinessApi {
|
||||
/** 商机产品信息 */
|
||||
export interface BusinessProduct {
|
||||
id: number;
|
||||
productId: number;
|
||||
productName: string;
|
||||
productNo: string;
|
||||
productUnit: number;
|
||||
productPrice: number;
|
||||
businessPrice: number;
|
||||
count: number;
|
||||
totalPrice: number;
|
||||
}
|
||||
|
||||
/** 商机信息 */
|
||||
export interface Business {
|
||||
id: number;
|
||||
@@ -49,7 +36,21 @@ export namespace CrmBusinessApi {
|
||||
products?: BusinessProduct[];
|
||||
}
|
||||
|
||||
export interface BusinessStatus {
|
||||
/** 商机产品信息 */
|
||||
export interface BusinessProduct {
|
||||
id: number;
|
||||
productId: number;
|
||||
productName: string;
|
||||
productNo: string;
|
||||
productUnit: number;
|
||||
productPrice: number;
|
||||
businessPrice: number;
|
||||
count: number;
|
||||
totalPrice: number;
|
||||
}
|
||||
|
||||
/** 商机更新状态请求 */
|
||||
export interface BusinessUpdateStatusReqVO {
|
||||
id: number;
|
||||
statusId: number | undefined;
|
||||
endStatus: number | undefined;
|
||||
@@ -97,7 +98,9 @@ export function updateBusiness(data: CrmBusinessApi.Business) {
|
||||
}
|
||||
|
||||
/** 修改商机状态 */
|
||||
export function updateBusinessStatus(data: CrmBusinessApi.BusinessStatus) {
|
||||
export function updateBusinessStatus(
|
||||
data: CrmBusinessApi.BusinessUpdateStatusReqVO,
|
||||
) {
|
||||
return requestClient.put('/crm/business/update-status', data);
|
||||
}
|
||||
|
||||
@@ -120,6 +123,6 @@ export function getBusinessPageByContact(params: PageParam) {
|
||||
}
|
||||
|
||||
/** 商机转移 */
|
||||
export function transferBusiness(data: CrmPermissionApi.TransferReq) {
|
||||
export function transferBusiness(data: CrmPermissionApi.BusinessTransferReqVO) {
|
||||
return requestClient.put('/crm/business/transfer', data);
|
||||
}
|
||||
|
||||
@@ -3,14 +3,6 @@ import type { PageParam, PageResult } from '@vben/request';
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CrmBusinessStatusApi {
|
||||
/** 商机状态信息 */
|
||||
export interface BusinessStatusType {
|
||||
[x: string]: any;
|
||||
id?: number;
|
||||
name: string;
|
||||
percent: number;
|
||||
}
|
||||
|
||||
/** 商机状态组信息 */
|
||||
export interface BusinessStatus {
|
||||
id?: number;
|
||||
@@ -21,6 +13,14 @@ export namespace CrmBusinessStatusApi {
|
||||
createTime?: Date;
|
||||
statuses?: BusinessStatusType[];
|
||||
}
|
||||
|
||||
/** 商机状态信息 */
|
||||
export interface BusinessStatusType {
|
||||
id?: number;
|
||||
name: string;
|
||||
percent: number;
|
||||
[x: string]: any;
|
||||
}
|
||||
}
|
||||
|
||||
/** 默认商机状态 */
|
||||
|
||||
@@ -71,7 +71,7 @@ export function exportClue(params: any) {
|
||||
}
|
||||
|
||||
/** 线索转移 */
|
||||
export function transferClue(data: CrmPermissionApi.TransferReq) {
|
||||
export function transferClue(data: CrmPermissionApi.BusinessTransferReqVO) {
|
||||
return requestClient.put('/crm/clue/transfer', data);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,13 +38,13 @@ export namespace CrmContactApi {
|
||||
}
|
||||
|
||||
/** 联系人商机关联请求 */
|
||||
export interface ContactBusinessReq {
|
||||
export interface ContactBusinessReqVO {
|
||||
contactId: number;
|
||||
businessIds: number[];
|
||||
}
|
||||
|
||||
/** 商机联系人关联请求 */
|
||||
export interface BusinessContactReq {
|
||||
export interface BusinessContactReqVO {
|
||||
businessId: number;
|
||||
contactIds: number[];
|
||||
}
|
||||
@@ -108,33 +108,33 @@ export function getSimpleContactList() {
|
||||
|
||||
/** 批量新增联系人商机关联 */
|
||||
export function createContactBusinessList(
|
||||
data: CrmContactApi.ContactBusinessReq,
|
||||
data: CrmContactApi.ContactBusinessReqVO,
|
||||
) {
|
||||
return requestClient.post('/crm/contact/create-business-list', data);
|
||||
}
|
||||
|
||||
/** 批量新增商机联系人关联 */
|
||||
export function createBusinessContactList(
|
||||
data: CrmContactApi.BusinessContactReq,
|
||||
data: CrmContactApi.BusinessContactReqVO,
|
||||
) {
|
||||
return requestClient.post('/crm/contact/create-business-list2', data);
|
||||
}
|
||||
|
||||
/** 解除联系人商机关联 */
|
||||
export function deleteContactBusinessList(
|
||||
data: CrmContactApi.ContactBusinessReq,
|
||||
data: CrmContactApi.ContactBusinessReqVO,
|
||||
) {
|
||||
return requestClient.delete('/crm/contact/delete-business-list', { data });
|
||||
}
|
||||
|
||||
/** 解除商机联系人关联 */
|
||||
export function deleteBusinessContactList(
|
||||
data: CrmContactApi.BusinessContactReq,
|
||||
data: CrmContactApi.BusinessContactReqVO,
|
||||
) {
|
||||
return requestClient.delete('/crm/contact/delete-business-list2', { data });
|
||||
}
|
||||
|
||||
/** 联系人转移 */
|
||||
export function transferContact(data: CrmPermissionApi.TransferReq) {
|
||||
export function transferContact(data: CrmPermissionApi.BusinessTransferReqVO) {
|
||||
return requestClient.put('/crm/contact/transfer', data);
|
||||
}
|
||||
|
||||
@@ -5,19 +5,6 @@ import type { CrmPermissionApi } from '#/api/crm/permission';
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CrmContractApi {
|
||||
/** 合同产品信息 */
|
||||
export interface ContractProduct {
|
||||
id: number;
|
||||
productId: number;
|
||||
productName: string;
|
||||
productNo: string;
|
||||
productUnit: number;
|
||||
productPrice: number;
|
||||
contractPrice: number;
|
||||
count: number;
|
||||
totalPrice: number;
|
||||
}
|
||||
|
||||
/** 合同信息 */
|
||||
export interface Contract {
|
||||
id: number;
|
||||
@@ -52,6 +39,19 @@ export namespace CrmContractApi {
|
||||
products?: ContractProduct[];
|
||||
contactName?: string;
|
||||
}
|
||||
|
||||
/** 合同产品信息 */
|
||||
export interface ContractProduct {
|
||||
id: number;
|
||||
productId: number;
|
||||
productName: string;
|
||||
productNo: string;
|
||||
productUnit: number;
|
||||
productPrice: number;
|
||||
contractPrice: number;
|
||||
count: number;
|
||||
totalPrice: number;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询合同列表 */
|
||||
@@ -118,7 +118,7 @@ export function submitContract(id: number) {
|
||||
}
|
||||
|
||||
/** 合同转移 */
|
||||
export function transferContract(data: CrmPermissionApi.TransferReq) {
|
||||
export function transferContract(data: CrmPermissionApi.BusinessTransferReqVO) {
|
||||
return requestClient.put('/crm/contract/transfer', data);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,8 @@ export namespace CrmCustomerApi {
|
||||
poolDay?: number; // 距离进入公海天数
|
||||
}
|
||||
|
||||
export interface CustomerImport {
|
||||
/** 客户导入请求 */
|
||||
export interface CustomerImportReqVO {
|
||||
ownerUserId: number;
|
||||
file: File;
|
||||
updateSupport: boolean;
|
||||
@@ -86,7 +87,7 @@ export function importCustomerTemplate() {
|
||||
}
|
||||
|
||||
/** 导入客户 */
|
||||
export function importCustomer(data: CrmCustomerApi.CustomerImport) {
|
||||
export function importCustomer(data: CrmCustomerApi.CustomerImportReqVO) {
|
||||
return requestClient.upload('/crm/customer/import', data);
|
||||
}
|
||||
|
||||
@@ -98,7 +99,7 @@ export function getCustomerSimpleList() {
|
||||
}
|
||||
|
||||
/** 客户转移 */
|
||||
export function transferCustomer(data: CrmPermissionApi.TransferReq) {
|
||||
export function transferCustomer(data: CrmPermissionApi.BusinessTransferReqVO) {
|
||||
return requestClient.put('/crm/customer/transfer', data);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,18 +3,6 @@ import type { PageParam, PageResult } from '@vben/request';
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CrmFollowUpApi {
|
||||
/** 关联商机信息 */
|
||||
export interface Business {
|
||||
id: number;
|
||||
name: string;
|
||||
}
|
||||
|
||||
/** 关联联系人信息 */
|
||||
export interface Contact {
|
||||
id: number;
|
||||
name: string;
|
||||
}
|
||||
|
||||
/** 跟进记录信息 */
|
||||
export interface FollowUpRecord {
|
||||
id: number; // 编号
|
||||
@@ -32,6 +20,18 @@ export namespace CrmFollowUpApi {
|
||||
creator: string;
|
||||
creatorName?: string;
|
||||
}
|
||||
|
||||
/** 关联商机信息 */
|
||||
export interface Business {
|
||||
id: number;
|
||||
name: string;
|
||||
}
|
||||
|
||||
/** 关联联系人信息 */
|
||||
export interface Contact {
|
||||
id: number;
|
||||
name: string;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询跟进记录分页 */
|
||||
|
||||
@@ -5,12 +5,6 @@ import type { SystemOperateLogApi } from '#/api/system/operate-log';
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CrmOperateLogApi {
|
||||
/** 操作日志查询参数 */
|
||||
export interface OperateLogQuery {
|
||||
bizType: number;
|
||||
bizId: number;
|
||||
}
|
||||
|
||||
/** 操作日志信息 */
|
||||
export interface OperateLog {
|
||||
id: number;
|
||||
@@ -22,10 +16,18 @@ export namespace CrmOperateLogApi {
|
||||
creatorName?: string;
|
||||
createTime: Date;
|
||||
}
|
||||
|
||||
/** 操作日志查询请求 */
|
||||
export interface OperateLogQueryReqVO {
|
||||
bizType: number;
|
||||
bizId: number;
|
||||
}
|
||||
}
|
||||
|
||||
/** 获得操作日志 */
|
||||
export function getOperateLogPage(params: CrmOperateLogApi.OperateLogQuery) {
|
||||
export function getOperateLogPage(
|
||||
params: CrmOperateLogApi.OperateLogQueryReqVO,
|
||||
) {
|
||||
return requestClient.get<PageResult<SystemOperateLogApi.OperateLog>>(
|
||||
'/crm/operate-log/page',
|
||||
{ params },
|
||||
|
||||
@@ -17,14 +17,15 @@ export namespace CrmPermissionApi {
|
||||
}
|
||||
|
||||
/** 数据权限转移请求 */
|
||||
export interface TransferReq {
|
||||
export interface BusinessTransferReqVO {
|
||||
id: number; // 模块编号
|
||||
newOwnerUserId: number; // 新负责人的用户编号
|
||||
oldOwnerPermissionLevel?: number; // 老负责人加入团队后的权限级别
|
||||
toBizTypes?: number[]; // 转移客户时,需要额外有【联系人】【商机】【合同】的 checkbox 选择
|
||||
}
|
||||
|
||||
export interface PermissionListReq {
|
||||
/** 权限列表请求 */
|
||||
export interface PermissionListReqVO {
|
||||
bizId: number; // 模块数据编号
|
||||
bizType: number; // 模块类型
|
||||
}
|
||||
@@ -54,7 +55,9 @@ export enum PermissionLevelEnum {
|
||||
}
|
||||
|
||||
/** 获得数据权限列表(查询团队成员列表) */
|
||||
export function getPermissionList(params: CrmPermissionApi.PermissionListReq) {
|
||||
export function getPermissionList(
|
||||
params: CrmPermissionApi.PermissionListReqVO,
|
||||
) {
|
||||
return requestClient.get<CrmPermissionApi.Permission[]>(
|
||||
'/crm/permission/list',
|
||||
{ params },
|
||||
|
||||
@@ -3,14 +3,6 @@ import type { PageParam, PageResult } from '@vben/request';
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CrmReceivableApi {
|
||||
/** 合同信息 */
|
||||
export interface Contract {
|
||||
id?: number;
|
||||
name?: string;
|
||||
no: string;
|
||||
totalPrice: number;
|
||||
}
|
||||
|
||||
/** 回款信息 */
|
||||
export interface Receivable {
|
||||
id: number;
|
||||
@@ -35,20 +27,17 @@ export namespace CrmReceivableApi {
|
||||
updateTime: Date; // 更新时间
|
||||
}
|
||||
|
||||
export interface ReceivablePageParam extends PageParam {
|
||||
no?: string;
|
||||
planId?: number;
|
||||
customerId?: number;
|
||||
contractId?: number;
|
||||
sceneType?: number;
|
||||
auditStatus?: number;
|
||||
/** 合同信息 */
|
||||
export interface Contract {
|
||||
id?: number;
|
||||
name?: string;
|
||||
no: string;
|
||||
totalPrice: number;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询回款列表 */
|
||||
export function getReceivablePage(
|
||||
params: CrmReceivableApi.ReceivablePageParam,
|
||||
) {
|
||||
export function getReceivablePage(params: PageParam) {
|
||||
return requestClient.get<PageResult<CrmReceivableApi.Receivable>>(
|
||||
'/crm/receivable/page',
|
||||
{ params },
|
||||
@@ -56,9 +45,7 @@ export function getReceivablePage(
|
||||
}
|
||||
|
||||
/** 查询回款列表,基于指定客户 */
|
||||
export function getReceivablePageByCustomer(
|
||||
params: CrmReceivableApi.ReceivablePageParam,
|
||||
) {
|
||||
export function getReceivablePageByCustomer(params: PageParam) {
|
||||
return requestClient.get<PageResult<CrmReceivableApi.Receivable>>(
|
||||
'/crm/receivable/page-by-customer',
|
||||
{ params },
|
||||
|
||||
@@ -29,20 +29,10 @@ export namespace CrmReceivablePlanApi {
|
||||
returnTime: Date;
|
||||
};
|
||||
}
|
||||
|
||||
export interface PlanPageParam extends PageParam {
|
||||
customerId?: number;
|
||||
contractId?: number;
|
||||
contractNo?: string;
|
||||
sceneType?: number;
|
||||
remindType?: number;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询回款计划列表 */
|
||||
export function getReceivablePlanPage(
|
||||
params: CrmReceivablePlanApi.PlanPageParam,
|
||||
) {
|
||||
export function getReceivablePlanPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<CrmReceivablePlanApi.Plan>>(
|
||||
'/crm/receivable-plan/page',
|
||||
{ params },
|
||||
@@ -50,9 +40,7 @@ export function getReceivablePlanPage(
|
||||
}
|
||||
|
||||
/** 查询回款计划列表(按客户) */
|
||||
export function getReceivablePlanPageByCustomer(
|
||||
params: CrmReceivablePlanApi.PlanPageParam,
|
||||
) {
|
||||
export function getReceivablePlanPageByCustomer(params: PageParam) {
|
||||
return requestClient.get<PageResult<CrmReceivablePlanApi.Plan>>(
|
||||
'/crm/receivable-plan/page-by-customer',
|
||||
{ params },
|
||||
|
||||
@@ -1,15 +1,24 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CrmStatisticsCustomerApi {
|
||||
/** 客户总量分析(按日期) */
|
||||
export interface CustomerSummaryByDate {
|
||||
/** 客户统计请求 */
|
||||
export interface CustomerSummaryReqVO {
|
||||
times: string[];
|
||||
interval: number;
|
||||
deptId: number;
|
||||
userId: number;
|
||||
userIds: number[];
|
||||
}
|
||||
|
||||
/** 客户总量分析(按日期)响应 */
|
||||
export interface CustomerSummaryByDateRespVO {
|
||||
time: string;
|
||||
customerCreateCount: number;
|
||||
customerDealCount: number;
|
||||
}
|
||||
|
||||
/** 客户总量分析(按用户) */
|
||||
export interface CustomerSummaryByUser {
|
||||
/** 客户总量分析(按用户)响应 */
|
||||
export interface CustomerSummaryByUserRespVO {
|
||||
ownerUserName: string;
|
||||
customerCreateCount: number;
|
||||
customerDealCount: number;
|
||||
@@ -17,28 +26,28 @@ export namespace CrmStatisticsCustomerApi {
|
||||
receivablePrice: number;
|
||||
}
|
||||
|
||||
/** 客户跟进次数分析(按日期) */
|
||||
export interface FollowUpSummaryByDate {
|
||||
/** 客户跟进次数分析(按日期)响应 */
|
||||
export interface FollowUpSummaryByDateRespVO {
|
||||
time: string;
|
||||
followUpRecordCount: number;
|
||||
followUpCustomerCount: number;
|
||||
}
|
||||
|
||||
/** 客户跟进次数分析(按用户) */
|
||||
export interface FollowUpSummaryByUser {
|
||||
/** 客户跟进次数分析(按用户)响应 */
|
||||
export interface FollowUpSummaryByUserRespVO {
|
||||
ownerUserName: string;
|
||||
followupRecordCount: number;
|
||||
followupCustomerCount: number;
|
||||
}
|
||||
|
||||
/** 客户跟进方式统计 */
|
||||
export interface FollowUpSummaryByType {
|
||||
/** 客户跟进方式统计响应 */
|
||||
export interface FollowUpSummaryByTypeRespVO {
|
||||
followUpType: string;
|
||||
followUpRecordCount: number;
|
||||
}
|
||||
|
||||
/** 合同摘要信息 */
|
||||
export interface CustomerContractSummary {
|
||||
/** 合同摘要信息响应 */
|
||||
export interface CustomerContractSummaryRespVO {
|
||||
customerName: string;
|
||||
contractName: string;
|
||||
totalPrice: number;
|
||||
@@ -51,54 +60,46 @@ export namespace CrmStatisticsCustomerApi {
|
||||
orderDate: Date;
|
||||
}
|
||||
|
||||
/** 客户公海分析(按日期) */
|
||||
export interface PoolSummaryByDate {
|
||||
/** 客户公海分析(按日期)响应 */
|
||||
export interface PoolSummaryByDateRespVO {
|
||||
time: string;
|
||||
customerPutCount: number;
|
||||
customerTakeCount: number;
|
||||
}
|
||||
|
||||
/** 客户公海分析(按用户) */
|
||||
export interface PoolSummaryByUser {
|
||||
/** 客户公海分析(按用户)响应 */
|
||||
export interface PoolSummaryByUserRespVO {
|
||||
ownerUserName: string;
|
||||
customerPutCount: number;
|
||||
customerTakeCount: number;
|
||||
}
|
||||
|
||||
/** 客户成交周期(按日期) */
|
||||
export interface CustomerDealCycleByDate {
|
||||
/** 客户成交周期(按日期)响应 */
|
||||
export interface CustomerDealCycleByDateRespVO {
|
||||
time: string;
|
||||
customerDealCycle: number;
|
||||
}
|
||||
|
||||
/** 客户成交周期(按用户) */
|
||||
export interface CustomerDealCycleByUser {
|
||||
/** 客户成交周期(按用户)响应 */
|
||||
export interface CustomerDealCycleByUserRespVO {
|
||||
ownerUserName: string;
|
||||
customerDealCycle: number;
|
||||
customerDealCount: number;
|
||||
}
|
||||
|
||||
/** 客户成交周期(按地区) */
|
||||
export interface CustomerDealCycleByArea {
|
||||
/** 客户成交周期(按地区)响应 */
|
||||
export interface CustomerDealCycleByAreaRespVO {
|
||||
areaName: string;
|
||||
customerDealCycle: number;
|
||||
customerDealCount: number;
|
||||
}
|
||||
|
||||
/** 客户成交周期(按产品) */
|
||||
export interface CustomerDealCycleByProduct {
|
||||
/** 客户成交周期(按产品)响应 */
|
||||
export interface CustomerDealCycleByProductRespVO {
|
||||
productName: string;
|
||||
customerDealCycle: number;
|
||||
customerDealCount: number;
|
||||
}
|
||||
|
||||
export interface CustomerSummaryParams {
|
||||
times: string[];
|
||||
interval: number;
|
||||
deptId: number;
|
||||
userId: number;
|
||||
userIds: number[];
|
||||
}
|
||||
}
|
||||
|
||||
export function getDatas(activeTabName: any, params: any) {
|
||||
@@ -167,69 +168,63 @@ export function getChartDatas(activeTabName: any, params: any) {
|
||||
|
||||
/** 客户总量分析(按日期) */
|
||||
export function getCustomerSummaryByDate(
|
||||
params: CrmStatisticsCustomerApi.CustomerSummaryParams,
|
||||
params: CrmStatisticsCustomerApi.CustomerSummaryReqVO,
|
||||
) {
|
||||
return requestClient.get<CrmStatisticsCustomerApi.CustomerSummaryByDate[]>(
|
||||
'/crm/statistics-customer/get-customer-summary-by-date',
|
||||
{ params },
|
||||
);
|
||||
return requestClient.get<
|
||||
CrmStatisticsCustomerApi.CustomerSummaryByDateRespVO[]
|
||||
>('/crm/statistics-customer/get-customer-summary-by-date', { params });
|
||||
}
|
||||
|
||||
/** 客户总量分析(按用户) */
|
||||
export function getCustomerSummaryByUser(
|
||||
params: CrmStatisticsCustomerApi.CustomerSummaryParams,
|
||||
params: CrmStatisticsCustomerApi.CustomerSummaryReqVO,
|
||||
) {
|
||||
return requestClient.get<CrmStatisticsCustomerApi.CustomerSummaryByUser[]>(
|
||||
'/crm/statistics-customer/get-customer-summary-by-user',
|
||||
{ params },
|
||||
);
|
||||
return requestClient.get<
|
||||
CrmStatisticsCustomerApi.CustomerSummaryByUserRespVO[]
|
||||
>('/crm/statistics-customer/get-customer-summary-by-user', { params });
|
||||
}
|
||||
|
||||
/** 客户跟进次数分析(按日期) */
|
||||
export function getFollowUpSummaryByDate(
|
||||
params: CrmStatisticsCustomerApi.CustomerSummaryParams,
|
||||
params: CrmStatisticsCustomerApi.CustomerSummaryReqVO,
|
||||
) {
|
||||
return requestClient.get<CrmStatisticsCustomerApi.FollowUpSummaryByDate[]>(
|
||||
'/crm/statistics-customer/get-follow-up-summary-by-date',
|
||||
{ params },
|
||||
);
|
||||
return requestClient.get<
|
||||
CrmStatisticsCustomerApi.FollowUpSummaryByDateRespVO[]
|
||||
>('/crm/statistics-customer/get-follow-up-summary-by-date', { params });
|
||||
}
|
||||
|
||||
/** 客户跟进次数分析(按用户) */
|
||||
export function getFollowUpSummaryByUser(
|
||||
params: CrmStatisticsCustomerApi.CustomerSummaryParams,
|
||||
params: CrmStatisticsCustomerApi.CustomerSummaryReqVO,
|
||||
) {
|
||||
return requestClient.get<CrmStatisticsCustomerApi.FollowUpSummaryByUser[]>(
|
||||
'/crm/statistics-customer/get-follow-up-summary-by-user',
|
||||
{ params },
|
||||
);
|
||||
return requestClient.get<
|
||||
CrmStatisticsCustomerApi.FollowUpSummaryByUserRespVO[]
|
||||
>('/crm/statistics-customer/get-follow-up-summary-by-user', { params });
|
||||
}
|
||||
|
||||
/** 获取客户跟进方式统计数 */
|
||||
export function getFollowUpSummaryByType(
|
||||
params: CrmStatisticsCustomerApi.CustomerSummaryParams,
|
||||
params: CrmStatisticsCustomerApi.CustomerSummaryReqVO,
|
||||
) {
|
||||
return requestClient.get<CrmStatisticsCustomerApi.FollowUpSummaryByType[]>(
|
||||
'/crm/statistics-customer/get-follow-up-summary-by-type',
|
||||
{ params },
|
||||
);
|
||||
return requestClient.get<
|
||||
CrmStatisticsCustomerApi.FollowUpSummaryByTypeRespVO[]
|
||||
>('/crm/statistics-customer/get-follow-up-summary-by-type', { params });
|
||||
}
|
||||
|
||||
/** 合同摘要信息(客户转化率页面) */
|
||||
export function getContractSummary(
|
||||
params: CrmStatisticsCustomerApi.CustomerSummaryParams,
|
||||
params: CrmStatisticsCustomerApi.CustomerSummaryReqVO,
|
||||
) {
|
||||
return requestClient.get<CrmStatisticsCustomerApi.CustomerContractSummary[]>(
|
||||
'/crm/statistics-customer/get-contract-summary',
|
||||
{ params },
|
||||
);
|
||||
return requestClient.get<
|
||||
CrmStatisticsCustomerApi.CustomerContractSummaryRespVO[]
|
||||
>('/crm/statistics-customer/get-contract-summary', { params });
|
||||
}
|
||||
|
||||
/** 获取客户公海分析(按日期) */
|
||||
export function getPoolSummaryByDate(
|
||||
params: CrmStatisticsCustomerApi.CustomerSummaryParams,
|
||||
params: CrmStatisticsCustomerApi.CustomerSummaryReqVO,
|
||||
) {
|
||||
return requestClient.get<CrmStatisticsCustomerApi.PoolSummaryByDate[]>(
|
||||
return requestClient.get<CrmStatisticsCustomerApi.PoolSummaryByDateRespVO[]>(
|
||||
'/crm/statistics-customer/get-pool-summary-by-date',
|
||||
{ params },
|
||||
);
|
||||
@@ -237,9 +232,9 @@ export function getPoolSummaryByDate(
|
||||
|
||||
/** 获取客户公海分析(按用户) */
|
||||
export function getPoolSummaryByUser(
|
||||
params: CrmStatisticsCustomerApi.CustomerSummaryParams,
|
||||
params: CrmStatisticsCustomerApi.CustomerSummaryReqVO,
|
||||
) {
|
||||
return requestClient.get<CrmStatisticsCustomerApi.PoolSummaryByUser[]>(
|
||||
return requestClient.get<CrmStatisticsCustomerApi.PoolSummaryByUserRespVO[]>(
|
||||
'/crm/statistics-customer/get-pool-summary-by-user',
|
||||
{ params },
|
||||
);
|
||||
@@ -247,39 +242,36 @@ export function getPoolSummaryByUser(
|
||||
|
||||
/** 获取客户成交周期(按日期) */
|
||||
export function getCustomerDealCycleByDate(
|
||||
params: CrmStatisticsCustomerApi.CustomerSummaryParams,
|
||||
params: CrmStatisticsCustomerApi.CustomerSummaryReqVO,
|
||||
) {
|
||||
return requestClient.get<CrmStatisticsCustomerApi.CustomerDealCycleByDate[]>(
|
||||
'/crm/statistics-customer/get-customer-deal-cycle-by-date',
|
||||
{ params },
|
||||
);
|
||||
return requestClient.get<
|
||||
CrmStatisticsCustomerApi.CustomerDealCycleByDateRespVO[]
|
||||
>('/crm/statistics-customer/get-customer-deal-cycle-by-date', { params });
|
||||
}
|
||||
|
||||
/** 获取客户成交周期(按用户) */
|
||||
export function getCustomerDealCycleByUser(
|
||||
params: CrmStatisticsCustomerApi.CustomerSummaryParams,
|
||||
params: CrmStatisticsCustomerApi.CustomerSummaryReqVO,
|
||||
) {
|
||||
return requestClient.get<CrmStatisticsCustomerApi.CustomerDealCycleByUser[]>(
|
||||
'/crm/statistics-customer/get-customer-deal-cycle-by-user',
|
||||
{ params },
|
||||
);
|
||||
return requestClient.get<
|
||||
CrmStatisticsCustomerApi.CustomerDealCycleByUserRespVO[]
|
||||
>('/crm/statistics-customer/get-customer-deal-cycle-by-user', { params });
|
||||
}
|
||||
|
||||
/** 获取客户成交周期(按地区) */
|
||||
export function getCustomerDealCycleByArea(
|
||||
params: CrmStatisticsCustomerApi.CustomerSummaryParams,
|
||||
params: CrmStatisticsCustomerApi.CustomerSummaryReqVO,
|
||||
) {
|
||||
return requestClient.get<CrmStatisticsCustomerApi.CustomerDealCycleByArea[]>(
|
||||
'/crm/statistics-customer/get-customer-deal-cycle-by-area',
|
||||
{ params },
|
||||
);
|
||||
return requestClient.get<
|
||||
CrmStatisticsCustomerApi.CustomerDealCycleByAreaRespVO[]
|
||||
>('/crm/statistics-customer/get-customer-deal-cycle-by-area', { params });
|
||||
}
|
||||
|
||||
/** 获取客户成交周期(按产品) */
|
||||
export function getCustomerDealCycleByProduct(
|
||||
params: CrmStatisticsCustomerApi.CustomerSummaryParams,
|
||||
params: CrmStatisticsCustomerApi.CustomerSummaryReqVO,
|
||||
) {
|
||||
return requestClient.get<
|
||||
CrmStatisticsCustomerApi.CustomerDealCycleByProduct[]
|
||||
CrmStatisticsCustomerApi.CustomerDealCycleByProductRespVO[]
|
||||
>('/crm/statistics-customer/get-customer-deal-cycle-by-product', { params });
|
||||
}
|
||||
|
||||
@@ -3,22 +3,22 @@ import type { PageResult } from '@vben/request';
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CrmStatisticsFunnelApi {
|
||||
/** 销售漏斗统计数据 */
|
||||
export interface FunnelSummary {
|
||||
/** 销售漏斗统计数据响应 */
|
||||
export interface FunnelSummaryRespVO {
|
||||
customerCount: number; // 客户数
|
||||
businessCount: number; // 商机数
|
||||
businessWinCount: number; // 赢单数
|
||||
}
|
||||
|
||||
/** 商机分析(按日期) */
|
||||
export interface BusinessSummaryByDate {
|
||||
/** 商机分析(按日期)响应 */
|
||||
export interface BusinessSummaryByDateRespVO {
|
||||
time: string; // 时间
|
||||
businessCreateCount: number; // 商机数
|
||||
totalPrice: number | string; // 商机金额
|
||||
}
|
||||
|
||||
/** 商机转化率分析(按日期) */
|
||||
export interface BusinessInversionRateSummaryByDate {
|
||||
/** 商机转化率分析(按日期)响应 */
|
||||
export interface BusinessInversionRateSummaryByDateRespVO {
|
||||
time: string; // 时间
|
||||
businessCount: number; // 商机数量
|
||||
businessWinCount: number; // 赢单商机数
|
||||
@@ -61,7 +61,7 @@ export function getChartDatas(activeTabName: any, params: any) {
|
||||
|
||||
/** 获取销售漏斗统计数据 */
|
||||
export function getFunnelSummary(params: any) {
|
||||
return requestClient.get<CrmStatisticsFunnelApi.FunnelSummary>(
|
||||
return requestClient.get<CrmStatisticsFunnelApi.FunnelSummaryRespVO>(
|
||||
'/crm/statistics-funnel/get-funnel-summary',
|
||||
{ params },
|
||||
);
|
||||
@@ -77,16 +77,15 @@ export function getBusinessSummaryByEndStatus(params: any) {
|
||||
|
||||
/** 获取新增商机分析(按日期) */
|
||||
export function getBusinessSummaryByDate(params: any) {
|
||||
return requestClient.get<CrmStatisticsFunnelApi.BusinessSummaryByDate[]>(
|
||||
'/crm/statistics-funnel/get-business-summary-by-date',
|
||||
{ params },
|
||||
);
|
||||
return requestClient.get<
|
||||
CrmStatisticsFunnelApi.BusinessSummaryByDateRespVO[]
|
||||
>('/crm/statistics-funnel/get-business-summary-by-date', { params });
|
||||
}
|
||||
|
||||
/** 获取商机转化率分析(按日期) */
|
||||
export function getBusinessInversionRateSummaryByDate(params: any) {
|
||||
return requestClient.get<
|
||||
CrmStatisticsFunnelApi.BusinessInversionRateSummaryByDate[]
|
||||
CrmStatisticsFunnelApi.BusinessInversionRateSummaryByDateRespVO[]
|
||||
>('/crm/statistics-funnel/get-business-inversion-rate-summary-by-date', {
|
||||
params,
|
||||
});
|
||||
|
||||
@@ -1,25 +1,27 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CrmStatisticsPerformanceApi {
|
||||
/** 员工业绩统计 */
|
||||
export interface Performance {
|
||||
/** 员工业绩统计请求 */
|
||||
export interface PerformanceReqVO {
|
||||
times: string[];
|
||||
deptId: number;
|
||||
userId: number;
|
||||
}
|
||||
|
||||
/** 员工业绩统计响应 */
|
||||
export interface PerformanceRespVO {
|
||||
time: string;
|
||||
currentMonthCount: number;
|
||||
lastMonthCount: number;
|
||||
lastYearCount: number;
|
||||
}
|
||||
export interface PerformanceParams {
|
||||
times: string[];
|
||||
deptId: number;
|
||||
userId: number;
|
||||
}
|
||||
}
|
||||
|
||||
/** 员工获得合同金额统计 */
|
||||
export function getContractPricePerformance(
|
||||
params: CrmStatisticsPerformanceApi.PerformanceParams,
|
||||
params: CrmStatisticsPerformanceApi.PerformanceReqVO,
|
||||
) {
|
||||
return requestClient.get<CrmStatisticsPerformanceApi.Performance[]>(
|
||||
return requestClient.get<CrmStatisticsPerformanceApi.PerformanceRespVO[]>(
|
||||
'/crm/statistics-performance/get-contract-price-performance',
|
||||
{ params },
|
||||
);
|
||||
@@ -27,9 +29,9 @@ export function getContractPricePerformance(
|
||||
|
||||
/** 员工获得回款统计 */
|
||||
export function getReceivablePricePerformance(
|
||||
params: CrmStatisticsPerformanceApi.PerformanceParams,
|
||||
params: CrmStatisticsPerformanceApi.PerformanceReqVO,
|
||||
) {
|
||||
return requestClient.get<CrmStatisticsPerformanceApi.Performance[]>(
|
||||
return requestClient.get<CrmStatisticsPerformanceApi.PerformanceRespVO[]>(
|
||||
'/crm/statistics-performance/get-receivable-price-performance',
|
||||
{ params },
|
||||
);
|
||||
@@ -37,9 +39,9 @@ export function getReceivablePricePerformance(
|
||||
|
||||
/** 员工获得签约合同数量统计 */
|
||||
export function getContractCountPerformance(
|
||||
params: CrmStatisticsPerformanceApi.PerformanceParams,
|
||||
params: CrmStatisticsPerformanceApi.PerformanceReqVO,
|
||||
) {
|
||||
return requestClient.get<CrmStatisticsPerformanceApi.Performance[]>(
|
||||
return requestClient.get<CrmStatisticsPerformanceApi.PerformanceRespVO[]>(
|
||||
'/crm/statistics-performance/get-contract-count-performance',
|
||||
{ params },
|
||||
);
|
||||
|
||||
@@ -3,33 +3,33 @@ import type { PageParam } from '@vben/request';
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CrmStatisticsPortraitApi {
|
||||
/** 客户基础统计信息 */
|
||||
export interface CustomerBase {
|
||||
/** 客户基础统计响应 */
|
||||
export interface CustomerBaseRespVO {
|
||||
customerCount: number;
|
||||
dealCount: number;
|
||||
dealPortion: number | string;
|
||||
}
|
||||
|
||||
/** 客户行业统计信息 */
|
||||
export interface CustomerIndustry extends CustomerBase {
|
||||
/** 客户行业统计响应 */
|
||||
export interface CustomerIndustryRespVO extends CustomerBaseRespVO {
|
||||
industryId: number;
|
||||
industryPortion: number | string;
|
||||
}
|
||||
|
||||
/** 客户来源统计信息 */
|
||||
export interface CustomerSource extends CustomerBase {
|
||||
/** 客户来源统计响应 */
|
||||
export interface CustomerSourceRespVO extends CustomerBaseRespVO {
|
||||
source: number;
|
||||
sourcePortion: number | string;
|
||||
}
|
||||
|
||||
/** 客户级别统计信息 */
|
||||
export interface CustomerLevel extends CustomerBase {
|
||||
/** 客户级别统计响应 */
|
||||
export interface CustomerLevelRespVO extends CustomerBaseRespVO {
|
||||
level: number;
|
||||
levelPortion: number | string;
|
||||
}
|
||||
|
||||
/** 客户地区统计信息 */
|
||||
export interface CustomerArea extends CustomerBase {
|
||||
/** 客户地区统计响应 */
|
||||
export interface CustomerAreaRespVO extends CustomerBaseRespVO {
|
||||
areaId: number;
|
||||
areaName: string;
|
||||
areaPortion: number | string;
|
||||
@@ -58,7 +58,7 @@ export function getDatas(activeTabName: any, params: any) {
|
||||
|
||||
/** 获取客户行业统计数据 */
|
||||
export function getCustomerIndustry(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsPortraitApi.CustomerIndustry[]>(
|
||||
return requestClient.get<CrmStatisticsPortraitApi.CustomerIndustryRespVO[]>(
|
||||
'/crm/statistics-portrait/get-customer-industry-summary',
|
||||
{ params },
|
||||
);
|
||||
@@ -66,7 +66,7 @@ export function getCustomerIndustry(params: PageParam) {
|
||||
|
||||
/** 获取客户来源统计数据 */
|
||||
export function getCustomerSource(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsPortraitApi.CustomerSource[]>(
|
||||
return requestClient.get<CrmStatisticsPortraitApi.CustomerSourceRespVO[]>(
|
||||
'/crm/statistics-portrait/get-customer-source-summary',
|
||||
{ params },
|
||||
);
|
||||
@@ -74,7 +74,7 @@ export function getCustomerSource(params: PageParam) {
|
||||
|
||||
/** 获取客户级别统计数据 */
|
||||
export function getCustomerLevel(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsPortraitApi.CustomerLevel[]>(
|
||||
return requestClient.get<CrmStatisticsPortraitApi.CustomerLevelRespVO[]>(
|
||||
'/crm/statistics-portrait/get-customer-level-summary',
|
||||
{ params },
|
||||
);
|
||||
@@ -82,7 +82,7 @@ export function getCustomerLevel(params: PageParam) {
|
||||
|
||||
/** 获取客户地区统计数据 */
|
||||
export function getCustomerArea(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsPortraitApi.CustomerArea[]>(
|
||||
return requestClient.get<CrmStatisticsPortraitApi.CustomerAreaRespVO[]>(
|
||||
'/crm/statistics-portrait/get-customer-area-summary',
|
||||
{ params },
|
||||
);
|
||||
|
||||
@@ -3,8 +3,8 @@ import type { PageParam } from '@vben/request';
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CrmStatisticsRankApi {
|
||||
/** 排行统计数据 */
|
||||
export interface Rank {
|
||||
/** 排行统计响应 */
|
||||
export interface RankRespVO {
|
||||
count: number;
|
||||
nickname: string;
|
||||
deptName: string;
|
||||
@@ -45,7 +45,7 @@ export function getDatas(activeTabName: any, params: any) {
|
||||
|
||||
/** 获得合同排行榜 */
|
||||
export function getContractPriceRank(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsRankApi.Rank[]>(
|
||||
return requestClient.get<CrmStatisticsRankApi.RankRespVO[]>(
|
||||
'/crm/statistics-rank/get-contract-price-rank',
|
||||
{ params },
|
||||
);
|
||||
@@ -53,7 +53,7 @@ export function getContractPriceRank(params: PageParam) {
|
||||
|
||||
/** 获得回款排行榜 */
|
||||
export function getReceivablePriceRank(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsRankApi.Rank[]>(
|
||||
return requestClient.get<CrmStatisticsRankApi.RankRespVO[]>(
|
||||
'/crm/statistics-rank/get-receivable-price-rank',
|
||||
{ params },
|
||||
);
|
||||
@@ -61,7 +61,7 @@ export function getReceivablePriceRank(params: PageParam) {
|
||||
|
||||
/** 签约合同排行 */
|
||||
export function getContractCountRank(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsRankApi.Rank[]>(
|
||||
return requestClient.get<CrmStatisticsRankApi.RankRespVO[]>(
|
||||
'/crm/statistics-rank/get-contract-count-rank',
|
||||
{ params },
|
||||
);
|
||||
@@ -69,7 +69,7 @@ export function getContractCountRank(params: PageParam) {
|
||||
|
||||
/** 产品销量排行 */
|
||||
export function getProductSalesRank(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsRankApi.Rank[]>(
|
||||
return requestClient.get<CrmStatisticsRankApi.RankRespVO[]>(
|
||||
'/crm/statistics-rank/get-product-sales-rank',
|
||||
{ params },
|
||||
);
|
||||
@@ -77,7 +77,7 @@ export function getProductSalesRank(params: PageParam) {
|
||||
|
||||
/** 新增客户数排行 */
|
||||
export function getCustomerCountRank(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsRankApi.Rank[]>(
|
||||
return requestClient.get<CrmStatisticsRankApi.RankRespVO[]>(
|
||||
'/crm/statistics-rank/get-customer-count-rank',
|
||||
{ params },
|
||||
);
|
||||
@@ -85,7 +85,7 @@ export function getCustomerCountRank(params: PageParam) {
|
||||
|
||||
/** 新增联系人数排行 */
|
||||
export function getContactsCountRank(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsRankApi.Rank[]>(
|
||||
return requestClient.get<CrmStatisticsRankApi.RankRespVO[]>(
|
||||
'/crm/statistics-rank/get-contacts-count-rank',
|
||||
{ params },
|
||||
);
|
||||
@@ -93,7 +93,7 @@ export function getContactsCountRank(params: PageParam) {
|
||||
|
||||
/** 跟进次数排行 */
|
||||
export function getFollowCountRank(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsRankApi.Rank[]>(
|
||||
return requestClient.get<CrmStatisticsRankApi.RankRespVO[]>(
|
||||
'/crm/statistics-rank/get-follow-count-rank',
|
||||
{ params },
|
||||
);
|
||||
@@ -101,7 +101,7 @@ export function getFollowCountRank(params: PageParam) {
|
||||
|
||||
/** 跟进客户数排行 */
|
||||
export function getFollowCustomerCountRank(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsRankApi.Rank[]>(
|
||||
return requestClient.get<CrmStatisticsRankApi.RankRespVO[]>(
|
||||
'/crm/statistics-rank/get-follow-customer-count-rank',
|
||||
{ params },
|
||||
);
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { PageParam, PageResult } from '@vben/request';
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpAccountApi {
|
||||
/** ERP 结算账户信息 */
|
||||
/** 结算账户信息 */
|
||||
export interface Account {
|
||||
id?: number; // 结算账户编号
|
||||
no: string; // 账户编码
|
||||
@@ -13,17 +13,10 @@ export namespace ErpAccountApi {
|
||||
defaultStatus: boolean; // 是否默认
|
||||
name: string; // 账户名称
|
||||
}
|
||||
|
||||
/** 结算账户分页查询参数 */
|
||||
export interface AccountPageParam extends PageParam {
|
||||
name?: string;
|
||||
no?: string;
|
||||
status?: number;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询结算账户分页 */
|
||||
export function getAccountPage(params: ErpAccountApi.AccountPageParam) {
|
||||
export function getAccountPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<ErpAccountApi.Account>>(
|
||||
'/erp/account/page',
|
||||
{ params },
|
||||
|
||||
@@ -3,19 +3,6 @@ import type { PageParam, PageResult } from '@vben/request';
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpFinancePaymentApi {
|
||||
/** 付款单项 */
|
||||
export interface FinancePaymentItem {
|
||||
id?: number;
|
||||
row_id?: number; // 前端使用的临时ID
|
||||
bizId: number; // 业务ID
|
||||
bizType: number; // 业务类型
|
||||
bizNo: string; // 业务编号
|
||||
totalPrice: number; // 应付金额
|
||||
paidPrice: number; // 已付金额
|
||||
paymentPrice: number; // 本次付款
|
||||
remark?: string; // 备注
|
||||
}
|
||||
|
||||
/** 付款单信息 */
|
||||
export interface FinancePayment {
|
||||
id?: number; // 付款单编号
|
||||
@@ -39,24 +26,22 @@ export namespace ErpFinancePaymentApi {
|
||||
bizNo?: string; // 业务单号
|
||||
}
|
||||
|
||||
/** 付款单分页查询参数 */
|
||||
export interface FinancePaymentPageParams extends PageParam {
|
||||
no?: string;
|
||||
paymentTime?: [string, string];
|
||||
supplierId?: number;
|
||||
creator?: string;
|
||||
financeUserId?: number;
|
||||
accountId?: number;
|
||||
status?: number;
|
||||
remark?: string;
|
||||
bizNo?: string;
|
||||
/** 付款单项 */
|
||||
export interface FinancePaymentItem {
|
||||
id?: number;
|
||||
row_id?: number; // 前端使用的临时 ID
|
||||
bizId: number; // 业务ID
|
||||
bizType: number; // 业务类型
|
||||
bizNo: string; // 业务编号
|
||||
totalPrice: number; // 应付金额
|
||||
paidPrice: number; // 已付金额
|
||||
paymentPrice: number; // 本次付款
|
||||
remark?: string; // 备注
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询付款单分页 */
|
||||
export function getFinancePaymentPage(
|
||||
params: ErpFinancePaymentApi.FinancePaymentPageParams,
|
||||
) {
|
||||
export function getFinancePaymentPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<ErpFinancePaymentApi.FinancePayment>>(
|
||||
'/erp/finance-payment/page',
|
||||
{
|
||||
@@ -103,9 +88,7 @@ export function deleteFinancePayment(ids: number[]) {
|
||||
}
|
||||
|
||||
/** 导出付款单 Excel */
|
||||
export function exportFinancePayment(
|
||||
params: ErpFinancePaymentApi.FinancePaymentPageParams,
|
||||
) {
|
||||
export function exportFinancePayment(params: any) {
|
||||
return requestClient.download('/erp/finance-payment/export-excel', {
|
||||
params,
|
||||
});
|
||||
|
||||
@@ -6,7 +6,7 @@ export namespace ErpFinanceReceiptApi {
|
||||
/** 收款单项 */
|
||||
export interface FinanceReceiptItem {
|
||||
id?: number;
|
||||
row_id?: number; // 前端使用的临时ID
|
||||
row_id?: number; // 前端使用的临时 ID
|
||||
bizId: number; // 业务ID
|
||||
bizType: number; // 业务类型
|
||||
bizNo: string; // 业务编号
|
||||
@@ -38,25 +38,10 @@ export namespace ErpFinanceReceiptApi {
|
||||
items?: FinanceReceiptItem[]; // 收款明细
|
||||
bizNo?: string; // 业务单号
|
||||
}
|
||||
|
||||
/** 收款单分页查询参数 */
|
||||
export interface FinanceReceiptPageParams extends PageParam {
|
||||
no?: string;
|
||||
receiptTime?: [string, string];
|
||||
customerId?: number;
|
||||
creator?: string;
|
||||
financeUserId?: number;
|
||||
accountId?: number;
|
||||
status?: number;
|
||||
remark?: string;
|
||||
bizNo?: string;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询收款单分页 */
|
||||
export function getFinanceReceiptPage(
|
||||
params: ErpFinanceReceiptApi.FinanceReceiptPageParams,
|
||||
) {
|
||||
export function getFinanceReceiptPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<ErpFinanceReceiptApi.FinanceReceipt>>(
|
||||
'/erp/finance-receipt/page',
|
||||
{
|
||||
@@ -103,9 +88,7 @@ export function deleteFinanceReceipt(ids: number[]) {
|
||||
}
|
||||
|
||||
/** 导出收款单 Excel */
|
||||
export function exportFinanceReceipt(
|
||||
params: ErpFinanceReceiptApi.FinanceReceiptPageParams,
|
||||
) {
|
||||
export function exportFinanceReceipt(params: any) {
|
||||
return requestClient.download('/erp/finance-receipt/export-excel', {
|
||||
params,
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpProductCategoryApi {
|
||||
/** ERP 产品分类信息 */
|
||||
/** 产品分类信息 */
|
||||
export interface ProductCategory {
|
||||
id?: number; // 分类编号
|
||||
parentId?: number; // 父分类编号
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { PageParam, PageResult } from '@vben/request';
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpProductApi {
|
||||
/** ERP 产品信息 */
|
||||
/** 产品信息 */
|
||||
export interface Product {
|
||||
id?: number; // 产品编号
|
||||
name: string; // 产品名称
|
||||
|
||||
@@ -3,24 +3,16 @@ import type { PageParam, PageResult } from '@vben/request';
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpProductUnitApi {
|
||||
/** ERP 产品单位信息 */
|
||||
/** 产品单位信息 */
|
||||
export interface ProductUnit {
|
||||
id?: number; // 单位编号
|
||||
name: string; // 单位名字
|
||||
status: number; // 单位状态
|
||||
}
|
||||
|
||||
/** 产品单位分页查询参数 */
|
||||
export interface ProductUnitPageParam extends PageParam {
|
||||
name?: string;
|
||||
status?: number;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询产品单位分页 */
|
||||
export function getProductUnitPage(
|
||||
params: ErpProductUnitApi.ProductUnitPageParam,
|
||||
) {
|
||||
export function getProductUnitPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<ErpProductUnitApi.ProductUnit>>(
|
||||
'/erp/product-unit/page',
|
||||
{ params },
|
||||
|
||||
@@ -23,6 +23,8 @@ export namespace ErpPurchaseInApi {
|
||||
taxPrice?: number; // 合计税额
|
||||
items?: PurchaseInItem[]; // 采购入库明细
|
||||
}
|
||||
|
||||
/** 采购项信息 */
|
||||
export interface PurchaseInItem {
|
||||
count?: number;
|
||||
id?: number;
|
||||
@@ -42,21 +44,10 @@ export namespace ErpPurchaseInApi {
|
||||
warehouseId?: number;
|
||||
inCount?: number;
|
||||
}
|
||||
|
||||
/** 采购入库分页查询参数 */
|
||||
export interface PurchaseInPageParams extends PageParam {
|
||||
no?: string;
|
||||
supplierId?: number;
|
||||
status?: number;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询采购入库分页
|
||||
*/
|
||||
export function getPurchaseInPage(
|
||||
params: ErpPurchaseInApi.PurchaseInPageParams,
|
||||
) {
|
||||
/** 查询采购入库分页 */
|
||||
export function getPurchaseInPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<ErpPurchaseInApi.PurchaseIn>>(
|
||||
'/erp/purchase-in/page',
|
||||
{
|
||||
@@ -65,32 +56,24 @@ export function getPurchaseInPage(
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询采购入库详情
|
||||
*/
|
||||
/** 查询采购入库详情 */
|
||||
export function getPurchaseIn(id: number) {
|
||||
return requestClient.get<ErpPurchaseInApi.PurchaseIn>(
|
||||
`/erp/purchase-in/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增采购入库
|
||||
*/
|
||||
/** 新增采购入库 */
|
||||
export function createPurchaseIn(data: ErpPurchaseInApi.PurchaseIn) {
|
||||
return requestClient.post('/erp/purchase-in/create', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改采购入库
|
||||
*/
|
||||
/** 修改采购入库 */
|
||||
export function updatePurchaseIn(data: ErpPurchaseInApi.PurchaseIn) {
|
||||
return requestClient.put('/erp/purchase-in/update', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新采购入库的状态
|
||||
*/
|
||||
/** 更新采购入库的状态 */
|
||||
export function updatePurchaseInStatus(id: number, status: number) {
|
||||
return requestClient.put('/erp/purchase-in/update-status', null, {
|
||||
params: {
|
||||
@@ -100,9 +83,7 @@ export function updatePurchaseInStatus(id: number, status: number) {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除采购入库
|
||||
*/
|
||||
/** 删除采购入库 */
|
||||
export function deletePurchaseIn(ids: number[]) {
|
||||
return requestClient.delete('/erp/purchase-in/delete', {
|
||||
params: {
|
||||
@@ -111,12 +92,8 @@ export function deletePurchaseIn(ids: number[]) {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出采购入库 Excel
|
||||
*/
|
||||
export function exportPurchaseIn(
|
||||
params: ErpPurchaseInApi.PurchaseInPageParams,
|
||||
) {
|
||||
/** 导出采购入库 Excel */
|
||||
export function exportPurchaseIn(params: any) {
|
||||
return requestClient.download('/erp/purchase-in/export-excel', {
|
||||
params,
|
||||
});
|
||||
|
||||
@@ -3,27 +3,7 @@ import type { PageParam, PageResult } from '@vben/request';
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpPurchaseOrderApi {
|
||||
/** ERP 采购订单项信息 */
|
||||
export interface PurchaseOrderItem {
|
||||
id?: number; // 订单项编号
|
||||
orderId?: number; // 采购订单编号
|
||||
productId?: number; // 产品编号
|
||||
productName?: string; // 产品名称
|
||||
productBarCode?: string; // 产品条码
|
||||
productUnitId?: number; // 产品单位编号
|
||||
productUnitName?: string; // 产品单位名称
|
||||
productPrice?: number; // 产品单价,单位:元
|
||||
totalProductPrice?: number; // 产品总价,单位:元
|
||||
count?: number; // 数量
|
||||
totalPrice?: number; // 总价,单位:元
|
||||
taxPercent?: number; // 税率,百分比
|
||||
taxPrice?: number; // 税额,单位:元
|
||||
totalTaxPrice?: number; // 含税总价,单位:元
|
||||
remark?: string; // 备注
|
||||
stockCount?: number; // 库存数量(显示字段)
|
||||
}
|
||||
|
||||
/** ERP 采购订单信息 */
|
||||
/** 采购订单信息 */
|
||||
export interface PurchaseOrder {
|
||||
id?: number; // 订单工单编号
|
||||
no?: string; // 采购订单号
|
||||
@@ -51,24 +31,29 @@ export namespace ErpPurchaseOrderApi {
|
||||
items?: PurchaseOrderItem[]; // 订单项列表
|
||||
}
|
||||
|
||||
/** 采购订单分页查询参数 */
|
||||
export interface PurchaseOrderPageParam extends PageParam {
|
||||
no?: string;
|
||||
supplierId?: number;
|
||||
productId?: number;
|
||||
orderTime?: string[];
|
||||
status?: number;
|
||||
remark?: string;
|
||||
creator?: string;
|
||||
inStatus?: number;
|
||||
returnStatus?: number;
|
||||
/** 采购订单项信息 */
|
||||
export interface PurchaseOrderItem {
|
||||
id?: number; // 订单项编号
|
||||
orderId?: number; // 采购订单编号
|
||||
productId?: number; // 产品编号
|
||||
productName?: string; // 产品名称
|
||||
productBarCode?: string; // 产品条码
|
||||
productUnitId?: number; // 产品单位编号
|
||||
productUnitName?: string; // 产品单位名称
|
||||
productPrice?: number; // 产品单价,单位:元
|
||||
totalProductPrice?: number; // 产品总价,单位:元
|
||||
count?: number; // 数量
|
||||
totalPrice?: number; // 总价,单位:元
|
||||
taxPercent?: number; // 税率,百分比
|
||||
taxPrice?: number; // 税额,单位:元
|
||||
totalTaxPrice?: number; // 含税总价,单位:元
|
||||
remark?: string; // 备注
|
||||
stockCount?: number; // 库存数量(显示字段)
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询采购订单分页 */
|
||||
export function getPurchaseOrderPage(
|
||||
params: ErpPurchaseOrderApi.PurchaseOrderPageParam,
|
||||
) {
|
||||
export function getPurchaseOrderPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<ErpPurchaseOrderApi.PurchaseOrder>>(
|
||||
'/erp/purchase-order/page',
|
||||
{ params },
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
import type { PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
@@ -19,6 +19,8 @@ export namespace ErpPurchaseReturnApi {
|
||||
otherPrice?: number; // 其他费用
|
||||
items?: PurchaseReturnItem[];
|
||||
}
|
||||
|
||||
/** 采购退货项 */
|
||||
export interface PurchaseReturnItem {
|
||||
count?: number;
|
||||
id?: number;
|
||||
@@ -37,27 +39,10 @@ export namespace ErpPurchaseReturnApi {
|
||||
totalPrice?: number;
|
||||
warehouseId?: number;
|
||||
}
|
||||
|
||||
/** 采购退货分页查询参数 */
|
||||
export interface PurchaseReturnPageParams extends PageParam {
|
||||
no?: string;
|
||||
supplierId?: number;
|
||||
status?: number;
|
||||
}
|
||||
|
||||
/** 采购退货状态更新参数 */
|
||||
export interface PurchaseReturnStatusParams {
|
||||
id: number;
|
||||
status: number;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询采购退货分页
|
||||
*/
|
||||
export function getPurchaseReturnPage(
|
||||
params: ErpPurchaseReturnApi.PurchaseReturnPageParams,
|
||||
) {
|
||||
/** 查询采购退货分页 */
|
||||
export function getPurchaseReturnPage(params: any) {
|
||||
return requestClient.get<PageResult<ErpPurchaseReturnApi.PurchaseReturn>>(
|
||||
'/erp/purchase-return/page',
|
||||
{
|
||||
@@ -66,45 +51,35 @@ export function getPurchaseReturnPage(
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询采购退货详情
|
||||
*/
|
||||
/** 查询采购退货详情 */
|
||||
export function getPurchaseReturn(id: number) {
|
||||
return requestClient.get<ErpPurchaseReturnApi.PurchaseReturn>(
|
||||
`/erp/purchase-return/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增采购退货
|
||||
*/
|
||||
/** 新增采购退货 */
|
||||
export function createPurchaseReturn(
|
||||
data: ErpPurchaseReturnApi.PurchaseReturn,
|
||||
) {
|
||||
return requestClient.post('/erp/purchase-return/create', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改采购退货
|
||||
*/
|
||||
/** 修改采购退货 */
|
||||
export function updatePurchaseReturn(
|
||||
data: ErpPurchaseReturnApi.PurchaseReturn,
|
||||
) {
|
||||
return requestClient.put('/erp/purchase-return/update', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新采购退货的状态
|
||||
*/
|
||||
/** 更新采购退货的状态 */
|
||||
export function updatePurchaseReturnStatus(id: number, status: number) {
|
||||
return requestClient.put('/erp/purchase-return/update-status', null, {
|
||||
params: { id, status },
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除采购退货
|
||||
*/
|
||||
/** 删除采购退货 */
|
||||
export function deletePurchaseReturn(ids: number[]) {
|
||||
return requestClient.delete('/erp/purchase-return/delete', {
|
||||
params: {
|
||||
@@ -113,12 +88,8 @@ export function deletePurchaseReturn(ids: number[]) {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出采购退货 Excel
|
||||
*/
|
||||
export function exportPurchaseReturn(
|
||||
params: ErpPurchaseReturnApi.PurchaseReturnPageParams,
|
||||
) {
|
||||
/** 导出采购退货 Excel */
|
||||
export function exportPurchaseReturn(params: any) {
|
||||
return requestClient.download('/erp/purchase-return/export-excel', {
|
||||
params,
|
||||
});
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { PageParam, PageResult } from '@vben/request';
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpSupplierApi {
|
||||
/** ERP 供应商信息 */
|
||||
/** 供应商信息 */
|
||||
export interface Supplier {
|
||||
id?: number; // 供应商编号
|
||||
name: string; // 供应商名称
|
||||
@@ -21,17 +21,10 @@ export namespace ErpSupplierApi {
|
||||
bankAccount: string; // 开户账号
|
||||
bankAddress: string; // 开户地址
|
||||
}
|
||||
|
||||
/** 供应商分页查询参数 */
|
||||
export interface SupplierPageParam extends PageParam {
|
||||
name?: string;
|
||||
mobile?: string;
|
||||
status?: number;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询供应商分页 */
|
||||
export function getSupplierPage(params: ErpSupplierApi.SupplierPageParam) {
|
||||
export function getSupplierPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<ErpSupplierApi.Supplier>>(
|
||||
'/erp/supplier/page',
|
||||
{ params },
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { PageParam, PageResult } from '@vben/request';
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpCustomerApi {
|
||||
/** ERP 客户信息 */
|
||||
/** 客户信息 */
|
||||
export interface Customer {
|
||||
id?: number; // 客户编号
|
||||
name: string; // 客户名称
|
||||
@@ -21,17 +21,10 @@ export namespace ErpCustomerApi {
|
||||
bankAccount: string; // 开户账号
|
||||
bankAddress: string; // 开户地址
|
||||
}
|
||||
|
||||
/** 客户分页查询参数 */
|
||||
export interface CustomerPageParam extends PageParam {
|
||||
name?: string;
|
||||
mobile?: string;
|
||||
status?: number;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询客户分页 */
|
||||
export function getCustomerPage(params: ErpCustomerApi.CustomerPageParam) {
|
||||
export function getCustomerPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<ErpCustomerApi.Customer>>(
|
||||
'/erp/customer/page',
|
||||
{ params },
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { PageParam, PageResult } from '@vben/request';
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpSaleOrderApi {
|
||||
/** ERP 销售订单信息 */
|
||||
/** 销售订单信息 */
|
||||
export interface SaleOrder {
|
||||
id?: number; // 订单工单编号
|
||||
no: string; // 销售订单号
|
||||
@@ -25,6 +25,7 @@ export namespace ErpSaleOrderApi {
|
||||
items?: SaleOrderItem[]; // 销售订单产品明细列表
|
||||
}
|
||||
|
||||
/** 销售订单项 */
|
||||
export interface SaleOrderItem {
|
||||
id?: number; // 订单项编号
|
||||
orderId?: number; // 采购订单编号
|
||||
@@ -43,17 +44,10 @@ export namespace ErpSaleOrderApi {
|
||||
remark?: string; // 备注
|
||||
stockCount?: number; // 库存数量(显示字段)
|
||||
}
|
||||
|
||||
/** 销售订单分页查询参数 */
|
||||
export interface SaleOrderPageParam extends PageParam {
|
||||
no?: string;
|
||||
customerId?: number;
|
||||
status?: number;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询销售订单分页 */
|
||||
export function getSaleOrderPage(params: ErpSaleOrderApi.SaleOrderPageParam) {
|
||||
export function getSaleOrderPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<ErpSaleOrderApi.SaleOrder>>(
|
||||
'/erp/sale-order/page',
|
||||
{ params },
|
||||
|
||||
@@ -24,6 +24,7 @@ export namespace ErpSaleOutApi {
|
||||
items?: SaleOutItem[];
|
||||
}
|
||||
|
||||
/** 销售出库项 */
|
||||
export interface SaleOutItem {
|
||||
count?: number;
|
||||
id?: number;
|
||||
@@ -43,17 +44,10 @@ export namespace ErpSaleOutApi {
|
||||
warehouseId?: number;
|
||||
outCount?: number;
|
||||
}
|
||||
|
||||
/** 销售出库分页查询参数 */
|
||||
export interface SaleOutPageParams extends PageParam {
|
||||
no?: string;
|
||||
customerId?: number;
|
||||
status?: number;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询销售出库分页 */
|
||||
export function getSaleOutPage(params: ErpSaleOutApi.SaleOutPageParams) {
|
||||
export function getSaleOutPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<ErpSaleOutApi.SaleOut>>(
|
||||
'/erp/sale-out/page',
|
||||
{
|
||||
@@ -94,7 +88,7 @@ export function deleteSaleOut(ids: number[]) {
|
||||
}
|
||||
|
||||
/** 导出销售出库 Excel */
|
||||
export function exportSaleOut(params: ErpSaleOutApi.SaleOutPageParams) {
|
||||
export function exportSaleOut(params: any) {
|
||||
return requestClient.download('/erp/sale-out/export-excel', {
|
||||
params,
|
||||
});
|
||||
|
||||
@@ -23,6 +23,7 @@ export namespace ErpSaleReturnApi {
|
||||
items?: SaleReturnItem[];
|
||||
}
|
||||
|
||||
/** 销售退货项 */
|
||||
export interface SaleReturnItem {
|
||||
count?: number;
|
||||
id?: number;
|
||||
@@ -42,21 +43,10 @@ export namespace ErpSaleReturnApi {
|
||||
warehouseId?: number;
|
||||
returnCount?: number;
|
||||
}
|
||||
|
||||
/** 销售退货分页查询参数 */
|
||||
export interface SaleReturnPageParams extends PageParam {
|
||||
no?: string;
|
||||
customerId?: number;
|
||||
status?: number;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询销售退货分页
|
||||
*/
|
||||
export function getSaleReturnPage(
|
||||
params: ErpSaleReturnApi.SaleReturnPageParams,
|
||||
) {
|
||||
/** 查询销售退货分页 */
|
||||
export function getSaleReturnPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<ErpSaleReturnApi.SaleReturn>>(
|
||||
'/erp/sale-return/page',
|
||||
{
|
||||
@@ -65,41 +55,31 @@ export function getSaleReturnPage(
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询销售退货详情
|
||||
*/
|
||||
/** 查询销售退货详情 */
|
||||
export function getSaleReturn(id: number) {
|
||||
return requestClient.get<ErpSaleReturnApi.SaleReturn>(
|
||||
`/erp/sale-return/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增销售退货
|
||||
*/
|
||||
/** 新增销售退货 */
|
||||
export function createSaleReturn(data: ErpSaleReturnApi.SaleReturn) {
|
||||
return requestClient.post('/erp/sale-return/create', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改销售退货
|
||||
*/
|
||||
/** 修改销售退货 */
|
||||
export function updateSaleReturn(data: ErpSaleReturnApi.SaleReturn) {
|
||||
return requestClient.put('/erp/sale-return/update', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新销售退货的状态
|
||||
*/
|
||||
/** 更新销售退货的状态 */
|
||||
export function updateSaleReturnStatus(id: number, status: number) {
|
||||
return requestClient.put('/erp/sale-return/update-status', null, {
|
||||
params: { id, status },
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除销售退货
|
||||
*/
|
||||
/** 删除销售退货 */
|
||||
export function deleteSaleReturn(ids: number[]) {
|
||||
return requestClient.delete('/erp/sale-return/delete', {
|
||||
params: {
|
||||
@@ -108,12 +88,8 @@ export function deleteSaleReturn(ids: number[]) {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出销售退货 Excel
|
||||
*/
|
||||
export function exportSaleReturn(
|
||||
params: ErpSaleReturnApi.SaleReturnPageParams,
|
||||
) {
|
||||
/** 导出销售退货 Excel */
|
||||
export function exportSaleReturn(params: any) {
|
||||
return requestClient.download('/erp/sale-return/export-excel', {
|
||||
params,
|
||||
});
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpPurchaseStatisticsApi {
|
||||
/** ERP 采购全局统计 */
|
||||
export interface PurchaseSummary {
|
||||
/** 采购全局统计 */
|
||||
export interface PurchaseSummaryRespVO {
|
||||
todayPrice: number; // 今日采购金额
|
||||
yesterdayPrice: number; // 昨日采购金额
|
||||
monthPrice: number; // 本月采购金额
|
||||
yearPrice: number; // 今年采购金额
|
||||
}
|
||||
|
||||
/** ERP 采购时间段统计 */
|
||||
export interface PurchaseTimeSummary {
|
||||
/** 采购时间段统计 */
|
||||
export interface PurchaseTimeSummaryRespVO {
|
||||
time: string; // 时间
|
||||
price: number; // 采购金额
|
||||
}
|
||||
@@ -18,14 +18,14 @@ export namespace ErpPurchaseStatisticsApi {
|
||||
|
||||
/** 获得采购统计 */
|
||||
export function getPurchaseSummary() {
|
||||
return requestClient.get<ErpPurchaseStatisticsApi.PurchaseSummary>(
|
||||
return requestClient.get<ErpPurchaseStatisticsApi.PurchaseSummaryRespVO>(
|
||||
'/erp/purchase-statistics/summary',
|
||||
);
|
||||
}
|
||||
|
||||
/** 获得采购时间段统计 */
|
||||
export function getPurchaseTimeSummary() {
|
||||
return requestClient.get<ErpPurchaseStatisticsApi.PurchaseTimeSummary[]>(
|
||||
'/erp/purchase-statistics/time-summary',
|
||||
);
|
||||
return requestClient.get<
|
||||
ErpPurchaseStatisticsApi.PurchaseTimeSummaryRespVO[]
|
||||
>('/erp/purchase-statistics/time-summary');
|
||||
}
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpSaleStatisticsApi {
|
||||
/** ERP 销售全局统计 */
|
||||
export interface SaleSummary {
|
||||
/** 销售全局统计 */
|
||||
export interface SaleSummaryRespVO {
|
||||
todayPrice: number; // 今日销售金额
|
||||
yesterdayPrice: number; // 昨日销售金额
|
||||
monthPrice: number; // 本月销售金额
|
||||
yearPrice: number; // 今年销售金额
|
||||
}
|
||||
|
||||
/** ERP 销售时间段统计 */
|
||||
export interface SaleTimeSummary {
|
||||
/** 销售时间段统计 */
|
||||
export interface SaleTimeSummaryRespVO {
|
||||
time: string; // 时间
|
||||
price: number; // 销售金额
|
||||
}
|
||||
@@ -18,14 +18,14 @@ export namespace ErpSaleStatisticsApi {
|
||||
|
||||
/** 获得销售统计 */
|
||||
export function getSaleSummary() {
|
||||
return requestClient.get<ErpSaleStatisticsApi.SaleSummary>(
|
||||
return requestClient.get<ErpSaleStatisticsApi.SaleSummaryRespVO>(
|
||||
'/erp/sale-statistics/summary',
|
||||
);
|
||||
}
|
||||
|
||||
/** 获得销售时间段统计 */
|
||||
export function getSaleTimeSummary() {
|
||||
return requestClient.get<ErpSaleStatisticsApi.SaleTimeSummary[]>(
|
||||
return requestClient.get<ErpSaleStatisticsApi.SaleTimeSummaryRespVO[]>(
|
||||
'/erp/sale-statistics/time-summary',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ export namespace ErpStockCheckApi {
|
||||
items?: StockCheckItem[]; // 盘点产品清单
|
||||
}
|
||||
|
||||
/** 库存盘点项 */
|
||||
export interface StockCheckItem {
|
||||
id?: number; // 编号
|
||||
warehouseId?: number; // 仓库编号
|
||||
@@ -33,20 +34,10 @@ export namespace ErpStockCheckApi {
|
||||
stockCount?: number; // 账面库存
|
||||
remark?: string; // 备注
|
||||
}
|
||||
|
||||
/** 库存盘点单分页查询参数 */
|
||||
export interface StockCheckPageParams extends PageParam {
|
||||
no?: string;
|
||||
status?: number;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询库存盘点单分页
|
||||
*/
|
||||
export function getStockCheckPage(
|
||||
params: ErpStockCheckApi.StockCheckPageParams,
|
||||
) {
|
||||
/** 查询库存盘点单分页 */
|
||||
export function getStockCheckPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<ErpStockCheckApi.StockCheck>>(
|
||||
'/erp/stock-check/page',
|
||||
{
|
||||
@@ -55,41 +46,31 @@ export function getStockCheckPage(
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询库存盘点单详情
|
||||
*/
|
||||
/** 查询库存盘点单详情 */
|
||||
export function getStockCheck(id: number) {
|
||||
return requestClient.get<ErpStockCheckApi.StockCheck>(
|
||||
`/erp/stock-check/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增库存盘点单
|
||||
*/
|
||||
/** 新增库存盘点单 */
|
||||
export function createStockCheck(data: ErpStockCheckApi.StockCheck) {
|
||||
return requestClient.post('/erp/stock-check/create', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改库存盘点单
|
||||
*/
|
||||
/** 修改库存盘点单 */
|
||||
export function updateStockCheck(data: ErpStockCheckApi.StockCheck) {
|
||||
return requestClient.put('/erp/stock-check/update', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新库存盘点单的状态
|
||||
*/
|
||||
/** 更新库存盘点单的状态 */
|
||||
export function updateStockCheckStatus(id: number, status: number) {
|
||||
return requestClient.put('/erp/stock-check/update-status', null, {
|
||||
params: { id, status },
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除库存盘点单
|
||||
*/
|
||||
/** 删除库存盘点 */
|
||||
export function deleteStockCheck(ids: number[]) {
|
||||
return requestClient.delete('/erp/stock-check/delete', {
|
||||
params: {
|
||||
@@ -98,12 +79,8 @@ export function deleteStockCheck(ids: number[]) {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出库存盘点单 Excel
|
||||
*/
|
||||
export function exportStockCheck(
|
||||
params: ErpStockCheckApi.StockCheckPageParams,
|
||||
) {
|
||||
/** 导出库存盘点单 Excel */
|
||||
export function exportStockCheck(params: any) {
|
||||
return requestClient.download('/erp/stock-check/export-excel', {
|
||||
params,
|
||||
});
|
||||
|
||||
@@ -35,19 +35,10 @@ export namespace ErpStockInApi {
|
||||
stockCount?: number; // 库存数量
|
||||
remark?: string; // 备注
|
||||
}
|
||||
|
||||
/** 其它入库单分页查询参数 */
|
||||
export interface StockInPageParams extends PageParam {
|
||||
no?: string;
|
||||
supplierId?: number;
|
||||
status?: number;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询其它入库单分页
|
||||
*/
|
||||
export function getStockInPage(params: ErpStockInApi.StockInPageParams) {
|
||||
/** 查询其它入库单分页 */
|
||||
export function getStockInPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<ErpStockInApi.StockIn>>(
|
||||
'/erp/stock-in/page',
|
||||
{
|
||||
@@ -56,39 +47,29 @@ export function getStockInPage(params: ErpStockInApi.StockInPageParams) {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询其它入库单详情
|
||||
*/
|
||||
/** 查询其它入库单详情 */
|
||||
export function getStockIn(id: number) {
|
||||
return requestClient.get<ErpStockInApi.StockIn>(`/erp/stock-in/get?id=${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增其它入库单
|
||||
*/
|
||||
/** 新增其它入库单 */
|
||||
export function createStockIn(data: ErpStockInApi.StockIn) {
|
||||
return requestClient.post('/erp/stock-in/create', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改其它入库单
|
||||
*/
|
||||
/** 修改其它入库单 */
|
||||
export function updateStockIn(data: ErpStockInApi.StockIn) {
|
||||
return requestClient.put('/erp/stock-in/update', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新其它入库单的状态
|
||||
*/
|
||||
/** 更新其它入库单的状态 */
|
||||
export function updateStockInStatus(id: number, status: number) {
|
||||
return requestClient.put('/erp/stock-in/update-status', null, {
|
||||
params: { id, status },
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除其它入库单
|
||||
*/
|
||||
/** 删除其它入库单 */
|
||||
export function deleteStockIn(ids: number[]) {
|
||||
return requestClient.delete('/erp/stock-in/delete', {
|
||||
params: {
|
||||
@@ -97,10 +78,8 @@ export function deleteStockIn(ids: number[]) {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出其它入库单 Excel
|
||||
*/
|
||||
export function exportStockIn(params: ErpStockInApi.StockInPageParams) {
|
||||
/** 导出其它入库单 Excel */
|
||||
export function exportStockIn(params: any) {
|
||||
return requestClient.download('/erp/stock-in/export-excel', {
|
||||
params,
|
||||
});
|
||||
|
||||
@@ -36,18 +36,10 @@ export namespace ErpStockMoveApi {
|
||||
toWarehouseId?: number; // 目标仓库ID
|
||||
totalPrice?: number; // 总价
|
||||
}
|
||||
|
||||
/** 库存调拨单分页查询参数 */
|
||||
export interface StockMovePageParams extends PageParam {
|
||||
no?: string;
|
||||
status?: number;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询库存调拨单分页
|
||||
*/
|
||||
export function getStockMovePage(params: ErpStockMoveApi.StockMovePageParams) {
|
||||
/** 查询库存调拨单分页 */
|
||||
export function getStockMovePage(params: PageParam) {
|
||||
return requestClient.get<PageResult<ErpStockMoveApi.StockMove>>(
|
||||
'/erp/stock-move/page',
|
||||
{
|
||||
@@ -56,41 +48,31 @@ export function getStockMovePage(params: ErpStockMoveApi.StockMovePageParams) {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询库存调拨单详情
|
||||
*/
|
||||
/** 查询库存调拨单详情 */
|
||||
export function getStockMove(id: number) {
|
||||
return requestClient.get<ErpStockMoveApi.StockMove>(
|
||||
`/erp/stock-move/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增库存调拨单
|
||||
*/
|
||||
/** 新增库存调拨单 */
|
||||
export function createStockMove(data: ErpStockMoveApi.StockMove) {
|
||||
return requestClient.post('/erp/stock-move/create', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改库存调拨单
|
||||
*/
|
||||
/** 修改库存调拨单 */
|
||||
export function updateStockMove(data: ErpStockMoveApi.StockMove) {
|
||||
return requestClient.put('/erp/stock-move/update', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新库存调拨单的状态
|
||||
*/
|
||||
/** 更新库存调拨单的状态 */
|
||||
export function updateStockMoveStatus(id: number, status: number) {
|
||||
return requestClient.put('/erp/stock-move/update-status', null, {
|
||||
params: { id, status },
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除库存调拨单
|
||||
*/
|
||||
/** 删除库存调拨单 */
|
||||
export function deleteStockMove(ids: number[]) {
|
||||
return requestClient.delete('/erp/stock-move/delete', {
|
||||
params: {
|
||||
@@ -99,9 +81,7 @@ export function deleteStockMove(ids: number[]) {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出库存调拨单 Excel
|
||||
*/
|
||||
export function exportStockMove(params: ErpStockMoveApi.StockMovePageParams) {
|
||||
/** 导出库存调拨单 Excel */
|
||||
export function exportStockMove(params: any) {
|
||||
return requestClient.download('/erp/stock-move/export-excel', { params });
|
||||
}
|
||||
|
||||
@@ -32,19 +32,10 @@ export namespace ErpStockOutApi {
|
||||
stockCount?: number; // 库存数量
|
||||
remark?: string; // 备注
|
||||
}
|
||||
|
||||
/** 其它出库单分页查询参数 */
|
||||
export interface StockOutPageParams extends PageParam {
|
||||
no?: string;
|
||||
customerId?: number;
|
||||
status?: number;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询其它出库单分页
|
||||
*/
|
||||
export function getStockOutPage(params: ErpStockOutApi.StockOutPageParams) {
|
||||
/** 查询其它出库单分页 */
|
||||
export function getStockOutPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<ErpStockOutApi.StockOut>>(
|
||||
'/erp/stock-out/page',
|
||||
{
|
||||
@@ -53,41 +44,31 @@ export function getStockOutPage(params: ErpStockOutApi.StockOutPageParams) {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询其它出库单详情
|
||||
*/
|
||||
/** 查询其它出库单详情 */
|
||||
export function getStockOut(id: number) {
|
||||
return requestClient.get<ErpStockOutApi.StockOut>(
|
||||
`/erp/stock-out/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增其它出库单
|
||||
*/
|
||||
/** 新增其它出库单 */
|
||||
export function createStockOut(data: ErpStockOutApi.StockOut) {
|
||||
return requestClient.post('/erp/stock-out/create', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改其它出库单
|
||||
*/
|
||||
/** 修改其它出库单 */
|
||||
export function updateStockOut(data: ErpStockOutApi.StockOut) {
|
||||
return requestClient.put('/erp/stock-out/update', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新其它出库单的状态
|
||||
*/
|
||||
/** 更新其它出库单的状态 */
|
||||
export function updateStockOutStatus(id: number, status: number) {
|
||||
return requestClient.put('/erp/stock-out/update-status', null, {
|
||||
params: { id, status },
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除其它出库单
|
||||
*/
|
||||
/** 删除其它出库单 */
|
||||
export function deleteStockOut(ids: number[]) {
|
||||
return requestClient.delete('/erp/stock-out/delete', {
|
||||
params: {
|
||||
@@ -96,10 +77,8 @@ export function deleteStockOut(ids: number[]) {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出其它出库单 Excel
|
||||
*/
|
||||
export function exportStockOut(params: ErpStockOutApi.StockOutPageParams) {
|
||||
/** 导出其它出库单 Excel */
|
||||
export function exportStockOut(params: any) {
|
||||
return requestClient.download('/erp/stock-out/export-excel', {
|
||||
params,
|
||||
});
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { PageParam, PageResult } from '@vben/request';
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpStockRecordApi {
|
||||
/** ERP 产品库存明细 */
|
||||
/** 产品库存明细 */
|
||||
export interface StockRecord {
|
||||
id?: number; // 编号
|
||||
productId: number; // 产品编号
|
||||
@@ -15,32 +15,16 @@ export namespace ErpStockRecordApi {
|
||||
bizItemId: number; // 业务项编号
|
||||
bizNo: string; // 业务单号
|
||||
}
|
||||
|
||||
/** 库存记录分页查询参数 */
|
||||
export interface StockRecordPageParam extends PageParam {
|
||||
productId?: number;
|
||||
warehouseId?: number;
|
||||
bizType?: number;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询产品库存明细分页 */
|
||||
export function getStockRecordPage(
|
||||
params: ErpStockRecordApi.StockRecordPageParam,
|
||||
) {
|
||||
export function getStockRecordPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<ErpStockRecordApi.StockRecord>>(
|
||||
'/erp/stock-record/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询产品库存明细详情 */
|
||||
export function getStockRecord(id: number) {
|
||||
return requestClient.get<ErpStockRecordApi.StockRecord>(
|
||||
`/erp/stock-record/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 导出产品库存明细 Excel */
|
||||
export function exportStockRecord(params: any) {
|
||||
return requestClient.download('/erp/stock-record/export-excel', { params });
|
||||
|
||||
@@ -11,49 +11,21 @@ export namespace ErpStockApi {
|
||||
count: number; // 库存数量
|
||||
}
|
||||
|
||||
/** 产品库存分页查询参数 */
|
||||
export interface StockPageParams extends PageParam {
|
||||
productId?: number;
|
||||
warehouseId?: number;
|
||||
}
|
||||
|
||||
/** 产品库存查询参数 */
|
||||
export interface StockQueryParams {
|
||||
export interface StockQueryReqVO {
|
||||
productId: number;
|
||||
warehouseId: number;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询产品库存分页
|
||||
*/
|
||||
export function getStockPage(params: ErpStockApi.StockPageParams) {
|
||||
/** 查询产品库存分页 */
|
||||
export function getStockPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<ErpStockApi.Stock>>('/erp/stock/page', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询产品库存详情
|
||||
*/
|
||||
export function getStock(id: number) {
|
||||
return requestClient.get<ErpStockApi.Stock>(`/erp/stock/get?id=${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据产品和仓库查询库存详情
|
||||
*/
|
||||
export function getStockByProductAndWarehouse(
|
||||
params: ErpStockApi.StockQueryParams,
|
||||
) {
|
||||
return requestClient.get<ErpStockApi.Stock>('/erp/stock/get', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得产品库存数量
|
||||
*/
|
||||
/** 获得产品库存数量 */
|
||||
export function getStockCount(productId: number, warehouseId?: number) {
|
||||
const params: any = { productId };
|
||||
if (warehouseId !== undefined) {
|
||||
@@ -64,19 +36,15 @@ export function getStockCount(productId: number, warehouseId?: number) {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出产品库存 Excel
|
||||
*/
|
||||
export function exportStock(params: ErpStockApi.StockPageParams) {
|
||||
/** 导出产品库存 Excel */
|
||||
export function exportStock(params: any) {
|
||||
return requestClient.download('/erp/stock/export-excel', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取库存数量
|
||||
*/
|
||||
export function getWarehouseStockCount(params: ErpStockApi.StockQueryParams) {
|
||||
/** 获取库存数量 */
|
||||
export function getWarehouseStockCount(params: ErpStockApi.StockQueryReqVO) {
|
||||
return requestClient.get<number>('/erp/stock/get-count', {
|
||||
params,
|
||||
});
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { PageParam, PageResult } from '@vben/request';
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpWarehouseApi {
|
||||
/** ERP 仓库信息 */
|
||||
/** 仓库信息 */
|
||||
export interface Warehouse {
|
||||
id?: number; // 仓库编号
|
||||
name: string; // 仓库名称
|
||||
@@ -16,16 +16,10 @@ export namespace ErpWarehouseApi {
|
||||
status: number; // 开启状态
|
||||
defaultStatus: boolean; // 是否默认
|
||||
}
|
||||
|
||||
/** 仓库分页查询参数 */
|
||||
export interface WarehousePageParam extends PageParam {
|
||||
name?: string;
|
||||
status?: number;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询仓库分页 */
|
||||
export function getWarehousePage(params: ErpWarehouseApi.WarehousePageParam) {
|
||||
export function getWarehousePage(params: PageParam) {
|
||||
return requestClient.get<PageResult<ErpWarehouseApi.Warehouse>>(
|
||||
'/erp/warehouse/page',
|
||||
{ params },
|
||||
|
||||
@@ -3,6 +3,7 @@ import type { PageParam, PageResult } from '@vben/request';
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
/** 素材类型枚举 */
|
||||
// TODO @xingyu:芋艿,可能要整理下枚举;
|
||||
export enum MaterialType {
|
||||
IMAGE = 1, // 图片
|
||||
THUMB = 4, // 缩略图
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
/** 菜单类型枚举 */
|
||||
// TODO @xingyu:芋艿,可能要整理下枚举;
|
||||
export enum MenuType {
|
||||
CLICK = 'click', // 点击推事件
|
||||
LOCATION_SELECT = 'location_select', // 发送位置
|
||||
@@ -11,7 +12,7 @@ export enum MenuType {
|
||||
PIC_WEIXIN = 'pic_weixin', // 微信相册发图
|
||||
SCANCODE_PUSH = 'scancode_push', // 扫码推事件
|
||||
SCANCODE_WAITMSG = 'scancode_waitmsg', // 扫码带提示
|
||||
VIEW = 'view', // 跳转URL
|
||||
VIEW = 'view', // 跳转 URL
|
||||
VIEW_LIMITED = 'view_limited', // 跳转图文消息URL
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ import type { PageParam, PageResult } from '@vben/request';
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
/** 消息类型枚举 */
|
||||
// TODO @xingyu:芋艿,可能要整理下枚举;
|
||||
export enum MessageType {
|
||||
IMAGE = 'image', // 图片消息
|
||||
MPNEWS = 'mpnews', // 公众号图文消息
|
||||
@@ -29,7 +30,7 @@ export namespace MpMessageApi {
|
||||
}
|
||||
|
||||
/** 发送消息请求 */
|
||||
export interface SendMessageRequest {
|
||||
export interface MessageSendRequestVO {
|
||||
accountId: number;
|
||||
openid: string;
|
||||
type: MessageType;
|
||||
@@ -49,6 +50,6 @@ export function getMessagePage(params: PageParam) {
|
||||
}
|
||||
|
||||
/** 发送消息 */
|
||||
export function sendMessage(data: MpMessageApi.SendMessageRequest) {
|
||||
export function sendMessage(data: MpMessageApi.MessageSendRequestVO) {
|
||||
return requestClient.post('/mp/message/send', data);
|
||||
}
|
||||
|
||||
@@ -2,13 +2,13 @@ import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace MpStatisticsApi {
|
||||
/** 统计查询参数 */
|
||||
export interface StatisticsQuery {
|
||||
export interface StatisticsGetReqVO {
|
||||
accountId: number;
|
||||
date: Date[];
|
||||
}
|
||||
|
||||
/** 消息发送概况数据 */
|
||||
export interface UpstreamMessage {
|
||||
export interface StatisticsUpstreamMessageRespVO {
|
||||
refDate: string;
|
||||
msgType: string;
|
||||
msgUser: number;
|
||||
@@ -16,7 +16,7 @@ export namespace MpStatisticsApi {
|
||||
}
|
||||
|
||||
/** 用户增减数据 */
|
||||
export interface UserSummary {
|
||||
export interface StatisticsUserSummaryRespVO {
|
||||
refDate: string;
|
||||
userSource: number;
|
||||
newUser: number;
|
||||
@@ -25,13 +25,13 @@ export namespace MpStatisticsApi {
|
||||
}
|
||||
|
||||
/** 用户累计数据 */
|
||||
export interface UserCumulate {
|
||||
export interface StatisticsUserCumulateRespVO {
|
||||
refDate: string;
|
||||
cumulateUser: number;
|
||||
}
|
||||
|
||||
/** 接口分析数据 */
|
||||
export interface InterfaceSummary {
|
||||
export interface StatisticsInterfaceSummaryRespVO {
|
||||
refDate: string;
|
||||
callbackCount: number;
|
||||
failCount: number;
|
||||
@@ -41,8 +41,8 @@ export namespace MpStatisticsApi {
|
||||
}
|
||||
|
||||
/** 获取消息发送概况数据 */
|
||||
export function getUpstreamMessage(params: MpStatisticsApi.StatisticsQuery) {
|
||||
return requestClient.get<MpStatisticsApi.UpstreamMessage[]>(
|
||||
export function getUpstreamMessage(params: MpStatisticsApi.StatisticsGetReqVO) {
|
||||
return requestClient.get<MpStatisticsApi.StatisticsUpstreamMessageRespVO[]>(
|
||||
'/mp/statistics/upstream-message',
|
||||
{
|
||||
params,
|
||||
@@ -51,8 +51,8 @@ export function getUpstreamMessage(params: MpStatisticsApi.StatisticsQuery) {
|
||||
}
|
||||
|
||||
/** 获取用户增减数据 */
|
||||
export function getUserSummary(params: MpStatisticsApi.StatisticsQuery) {
|
||||
return requestClient.get<MpStatisticsApi.UserSummary[]>(
|
||||
export function getUserSummary(params: MpStatisticsApi.StatisticsGetReqVO) {
|
||||
return requestClient.get<MpStatisticsApi.StatisticsUserSummaryRespVO[]>(
|
||||
'/mp/statistics/user-summary',
|
||||
{
|
||||
params,
|
||||
@@ -61,8 +61,8 @@ export function getUserSummary(params: MpStatisticsApi.StatisticsQuery) {
|
||||
}
|
||||
|
||||
/** 获取用户累计数据 */
|
||||
export function getUserCumulate(params: MpStatisticsApi.StatisticsQuery) {
|
||||
return requestClient.get<MpStatisticsApi.UserCumulate[]>(
|
||||
export function getUserCumulate(params: MpStatisticsApi.StatisticsGetReqVO) {
|
||||
return requestClient.get<MpStatisticsApi.StatisticsUserCumulateRespVO[]>(
|
||||
'/mp/statistics/user-cumulate',
|
||||
{
|
||||
params,
|
||||
@@ -71,8 +71,10 @@ export function getUserCumulate(params: MpStatisticsApi.StatisticsQuery) {
|
||||
}
|
||||
|
||||
/** 获取接口分析数据 */
|
||||
export function getInterfaceSummary(params: MpStatisticsApi.StatisticsQuery) {
|
||||
return requestClient.get<MpStatisticsApi.InterfaceSummary[]>(
|
||||
export function getInterfaceSummary(
|
||||
params: MpStatisticsApi.StatisticsGetReqVO,
|
||||
) {
|
||||
return requestClient.get<MpStatisticsApi.StatisticsInterfaceSummaryRespVO[]>(
|
||||
'/mp/statistics/interface-summary',
|
||||
{
|
||||
params,
|
||||
|
||||
@@ -11,12 +11,6 @@ export namespace MpTagApi {
|
||||
count?: number;
|
||||
createTime?: Date;
|
||||
}
|
||||
|
||||
/** 标签分页查询参数 */
|
||||
export interface TagPageQuery extends PageParam {
|
||||
accountId?: number;
|
||||
name?: string;
|
||||
}
|
||||
}
|
||||
|
||||
/** 创建公众号标签 */
|
||||
@@ -44,7 +38,7 @@ export function getTag(id: number) {
|
||||
}
|
||||
|
||||
/** 获取公众号标签分页 */
|
||||
export function getTagPage(params: MpTagApi.TagPageQuery) {
|
||||
export function getTagPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<MpTagApi.Tag>>('/mp/tag/page', {
|
||||
params,
|
||||
});
|
||||
|
||||
@@ -21,13 +21,6 @@ export namespace MpUserApi {
|
||||
tagIds?: number[];
|
||||
createTime?: Date;
|
||||
}
|
||||
|
||||
/** 用户分页查询参数 */
|
||||
export interface UserPageQuery extends PageParam {
|
||||
accountId?: number;
|
||||
nickname?: string;
|
||||
tagId?: number;
|
||||
}
|
||||
}
|
||||
|
||||
/** 更新公众号粉丝 */
|
||||
@@ -43,7 +36,7 @@ export function getUser(id: number) {
|
||||
}
|
||||
|
||||
/** 获取公众号粉丝分页 */
|
||||
export function getUserPage(params: MpUserApi.UserPageQuery) {
|
||||
export function getUserPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<MpUserApi.User>>('/mp/user/page', {
|
||||
params,
|
||||
});
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
// TODO @xingyu:要不要改成 yudao-ui-admin-vue3/src/components/OperateLogV2/src/OperateLogV2.vue 这种;一行:时间、userType、userName、action
|
||||
import type { OperateLogProps } from './typing';
|
||||
|
||||
import { DICT_TYPE } from '@vben/constants';
|
||||
|
||||
@@ -12,4 +12,5 @@ export const ACTION_ICON = {
|
||||
COPY: 'lucide:copy',
|
||||
CLOSE: 'lucide:x',
|
||||
BOOK: 'lucide:book',
|
||||
AUDIT: 'lucide:file-check',
|
||||
};
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script lang="ts" setup>
|
||||
// TODO @gjd:https://t.zsxq.com/pmNb1 AI 对话、绘图底部没对齐,特别是样式方面
|
||||
import type { AiChatConversationApi } from '#/api/ai/chat/conversation';
|
||||
import type { AiChatMessageApi } from '#/api/ai/chat/message';
|
||||
|
||||
@@ -18,12 +17,13 @@ import {
|
||||
sendChatMessageStream,
|
||||
} from '#/api/ai/chat/message';
|
||||
|
||||
import ConversationList from './components/conversation/ConversationList.vue';
|
||||
import ConversationUpdateForm from './components/conversation/ConversationUpdateForm.vue';
|
||||
import MessageList from './components/message/MessageList.vue';
|
||||
import MessageListEmpty from './components/message/MessageListEmpty.vue';
|
||||
import MessageLoading from './components/message/MessageLoading.vue';
|
||||
import MessageNewConversation from './components/message/MessageNewConversation.vue';
|
||||
import ConversationList from './modules/conversation/list.vue';
|
||||
import ConversationUpdateForm from './modules/conversation/update-form.vue';
|
||||
import MessageFileUpload from './modules/message/file-upload.vue';
|
||||
import MessageListEmpty from './modules/message/list-empty.vue';
|
||||
import MessageList from './modules/message/list.vue';
|
||||
import MessageLoading from './modules/message/loading.vue';
|
||||
import MessageNewConversation from './modules/message/new-conversation.vue';
|
||||
|
||||
/** AI 聊天对话 列表 */
|
||||
defineOptions({ name: 'AiChat' });
|
||||
@@ -33,6 +33,7 @@ const [FormModal, formModalApi] = useVbenModal({
|
||||
connectedComponent: ConversationUpdateForm,
|
||||
destroyOnClose: true,
|
||||
});
|
||||
|
||||
// 聊天对话
|
||||
const conversationListRef = ref();
|
||||
const activeConversationId = ref<null | number>(null); // 选中的对话编号
|
||||
@@ -56,6 +57,8 @@ const conversationInAbortController = ref<any>(); // 对话进行中 abort 控
|
||||
const inputTimeout = ref<any>(); // 处理输入中回车的定时器
|
||||
const prompt = ref<string>(); // prompt
|
||||
const enableContext = ref<boolean>(true); // 是否开启上下文
|
||||
const enableWebSearch = ref<boolean>(false); // 是否开启联网搜索
|
||||
const uploadFiles = ref<string[]>([]); // 上传的文件 URL 列表
|
||||
// 接收 Stream 消息
|
||||
const receiveMessageFullText = ref('');
|
||||
const receiveMessageDisplayedText = ref('');
|
||||
@@ -87,7 +90,7 @@ async function handleConversationClick(
|
||||
) {
|
||||
// 对话进行中,不允许切换
|
||||
if (conversationInProgress.value) {
|
||||
alert('对话中,不允许切换!');
|
||||
await alert('对话中,不允许切换!');
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -97,9 +100,12 @@ async function handleConversationClick(
|
||||
// 刷新 message 列表
|
||||
await getMessageList();
|
||||
// 滚动底部
|
||||
scrollToBottom(true);
|
||||
await scrollToBottom(true);
|
||||
prompt.value = '';
|
||||
// 清空输入框
|
||||
prompt.value = '';
|
||||
// 清空文件列表
|
||||
uploadFiles.value = [];
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -117,19 +123,23 @@ async function handlerConversationDelete(
|
||||
async function handleConversationClear() {
|
||||
// 对话进行中,不允许切换
|
||||
if (conversationInProgress.value) {
|
||||
alert('对话中,不允许切换!');
|
||||
await alert('对话中,不允许切换!');
|
||||
return false;
|
||||
}
|
||||
activeConversationId.value = null;
|
||||
activeConversation.value = null;
|
||||
activeMessageList.value = [];
|
||||
// 清空输入框和文件列表
|
||||
prompt.value = '';
|
||||
uploadFiles.value = [];
|
||||
}
|
||||
|
||||
async function openChatConversationUpdateForm() {
|
||||
formModalApi.setData({ id: activeConversationId.value }).open();
|
||||
}
|
||||
|
||||
/** 对话更新成功,刷新最新信息 */
|
||||
async function handleConversationUpdateSuccess() {
|
||||
// 对话更新成功,刷新最新信息
|
||||
await getConversation(activeConversationId.value);
|
||||
}
|
||||
|
||||
@@ -138,10 +148,13 @@ async function handleConversationCreate() {
|
||||
// 创建对话
|
||||
await conversationListRef.value.createConversation();
|
||||
}
|
||||
|
||||
/** 处理聊天对话的创建成功 */
|
||||
async function handleConversationCreateSuccess() {
|
||||
// 创建新的对话,清空输入框
|
||||
prompt.value = '';
|
||||
// 清空文件列表
|
||||
uploadFiles.value = [];
|
||||
}
|
||||
|
||||
// =========== 【消息列表】相关 ===========
|
||||
@@ -228,6 +241,7 @@ function handleGoTopMessage() {
|
||||
}
|
||||
|
||||
// =========== 【发送消息】相关 ===========
|
||||
|
||||
/** 处理来自 keydown 的发送消息 */
|
||||
async function handleSendByKeydown(event: any) {
|
||||
// 判断用户是否在输入
|
||||
@@ -282,7 +296,6 @@ function onCompositionstart() {
|
||||
}
|
||||
|
||||
function onCompositionend() {
|
||||
// console.log('输入结束...')
|
||||
setTimeout(() => {
|
||||
isComposing.value = false;
|
||||
}, 200);
|
||||
@@ -299,12 +312,19 @@ async function doSendMessage(content: string) {
|
||||
message.error('还没创建对话,不能发送!');
|
||||
return;
|
||||
}
|
||||
// 清空输入框
|
||||
|
||||
// 准备附件 URL 数组
|
||||
const attachmentUrls = [...uploadFiles.value];
|
||||
|
||||
// 清空输入框和文件列表
|
||||
prompt.value = '';
|
||||
uploadFiles.value = [];
|
||||
|
||||
// 执行发送
|
||||
await doSendMessageStream({
|
||||
conversationId: activeConversationId.value,
|
||||
content,
|
||||
attachmentUrls,
|
||||
} as AiChatMessageApi.ChatMessage);
|
||||
}
|
||||
|
||||
@@ -325,6 +345,7 @@ async function doSendMessageStream(userMessage: AiChatMessageApi.ChatMessage) {
|
||||
conversationId: activeConversationId.value,
|
||||
type: 'user',
|
||||
content: userMessage.content,
|
||||
attachmentUrls: userMessage.attachmentUrls || [],
|
||||
createTime: new Date(),
|
||||
} as AiChatMessageApi.ChatMessage,
|
||||
{
|
||||
@@ -332,6 +353,7 @@ async function doSendMessageStream(userMessage: AiChatMessageApi.ChatMessage) {
|
||||
conversationId: activeConversationId.value,
|
||||
type: 'assistant',
|
||||
content: '思考中...',
|
||||
reasoningContent: '',
|
||||
createTime: new Date(),
|
||||
} as AiChatMessageApi.ChatMessage,
|
||||
);
|
||||
@@ -339,7 +361,7 @@ async function doSendMessageStream(userMessage: AiChatMessageApi.ChatMessage) {
|
||||
await nextTick();
|
||||
await scrollToBottom(); // 底部
|
||||
// 1.3 开始滚动
|
||||
textRoll();
|
||||
textRoll().then();
|
||||
|
||||
// 2. 发送 event stream
|
||||
let isFirstChunk = true; // 是否是第一个 chunk 消息段
|
||||
@@ -348,17 +370,23 @@ async function doSendMessageStream(userMessage: AiChatMessageApi.ChatMessage) {
|
||||
userMessage.content,
|
||||
conversationInAbortController.value,
|
||||
enableContext.value,
|
||||
enableWebSearch.value,
|
||||
async (res: any) => {
|
||||
const { code, data, msg } = JSON.parse(res.data);
|
||||
if (code !== 0) {
|
||||
alert(`对话异常! ${msg}`);
|
||||
await alert(`对话异常! ${msg}`);
|
||||
// 如果未接收到消息,则进行删除
|
||||
if (receiveMessageFullText.value === '') {
|
||||
activeMessageList.value.pop();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// 如果内容为空,就不处理。
|
||||
if (data.receive.content === '') {
|
||||
// 如果内容和推理内容都为空,就不处理
|
||||
if (data.receive.content === '' && !data.receive.reasoningContent) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 首次返回需要添加一个 message 到页面,后面的都是更新
|
||||
if (isFirstChunk) {
|
||||
isFirstChunk = false;
|
||||
@@ -367,15 +395,31 @@ async function doSendMessageStream(userMessage: AiChatMessageApi.ChatMessage) {
|
||||
activeMessageList.value.pop();
|
||||
// 更新返回的数据
|
||||
activeMessageList.value.push(data.send, data.receive);
|
||||
data.send.attachmentUrls = userMessage.attachmentUrls;
|
||||
}
|
||||
// debugger
|
||||
receiveMessageFullText.value =
|
||||
receiveMessageFullText.value + data.receive.content;
|
||||
|
||||
// 处理 reasoningContent
|
||||
if (data.receive.reasoningContent) {
|
||||
const lastMessage =
|
||||
activeMessageList.value[activeMessageList.value.length - 1];
|
||||
// 累加推理内容
|
||||
lastMessage.reasoningContent =
|
||||
(lastMessage.reasoningContent || '') +
|
||||
data.receive.reasoningContent;
|
||||
}
|
||||
|
||||
// 处理正常内容
|
||||
if (data.receive.content !== '') {
|
||||
receiveMessageFullText.value =
|
||||
receiveMessageFullText.value + data.receive.content;
|
||||
}
|
||||
|
||||
// 滚动到最下面
|
||||
await scrollToBottom();
|
||||
},
|
||||
(error: any) => {
|
||||
alert(`对话异常! ${error}`);
|
||||
// 异常提示,并停止流
|
||||
alert(`对话异常!`);
|
||||
stopStream();
|
||||
// 需要抛出异常,禁止重试
|
||||
throw error;
|
||||
@@ -383,6 +427,7 @@ async function doSendMessageStream(userMessage: AiChatMessageApi.ChatMessage) {
|
||||
() => {
|
||||
stopStream();
|
||||
},
|
||||
userMessage.attachmentUrls,
|
||||
);
|
||||
} catch {}
|
||||
}
|
||||
@@ -490,11 +535,6 @@ onMounted(async () => {
|
||||
activeMessageListLoading.value = true;
|
||||
await getMessageList();
|
||||
});
|
||||
// TODO @芋艿:深度思考
|
||||
// TODO @芋艿:联网搜索
|
||||
// TODO @芋艿:附件支持
|
||||
// TODO @芋艿:mcp 相关
|
||||
// TODO @芋艿:异常消息的处理
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -514,7 +554,7 @@ onMounted(async () => {
|
||||
<!-- 右侧:详情部分 -->
|
||||
<Layout class="bg-card mx-4">
|
||||
<Layout.Header
|
||||
class="!bg-card border-border flex !h-12 items-center justify-between border-b"
|
||||
class="!bg-card border-border flex !h-12 items-center justify-between border-b !px-4"
|
||||
>
|
||||
<div class="text-lg font-bold">
|
||||
{{ activeConversation?.title ? activeConversation?.title : '对话' }}
|
||||
@@ -573,8 +613,10 @@ onMounted(async () => {
|
||||
</div>
|
||||
</Layout.Content>
|
||||
|
||||
<Layout.Footer class="!bg-card m-0 flex flex-col p-0">
|
||||
<form class="border-border m-2 flex flex-col rounded-xl border p-2">
|
||||
<Layout.Footer class="!bg-card flex flex-col !p-0">
|
||||
<form
|
||||
class="border-border mx-4 mb-8 mt-2 flex flex-col rounded-xl border p-2"
|
||||
>
|
||||
<textarea
|
||||
class="box-border h-24 resize-none overflow-auto rounded-md p-2 focus:outline-none"
|
||||
v-model="prompt"
|
||||
@@ -585,9 +627,19 @@ onMounted(async () => {
|
||||
placeholder="问我任何问题...(Shift+Enter 换行,按下 Enter 发送)"
|
||||
></textarea>
|
||||
<div class="flex justify-between pb-0 pt-1">
|
||||
<div class="flex items-center">
|
||||
<Switch v-model:checked="enableContext" />
|
||||
<span class="ml-1 text-sm text-gray-400">上下文</span>
|
||||
<div class="flex items-center gap-3">
|
||||
<MessageFileUpload
|
||||
v-model="uploadFiles"
|
||||
:disabled="conversationInProgress"
|
||||
/>
|
||||
<div class="flex items-center">
|
||||
<Switch v-model:checked="enableContext" size="small" />
|
||||
<span class="ml-1 text-sm text-gray-400">上下文</span>
|
||||
</div>
|
||||
<div class="flex items-center">
|
||||
<Switch v-model:checked="enableWebSearch" size="small" />
|
||||
<span class="ml-1 text-sm text-gray-400">联网搜索</span>
|
||||
</div>
|
||||
</div>
|
||||
<Button
|
||||
type="primary"
|
||||
|
||||
@@ -19,9 +19,8 @@ import {
|
||||
} from '#/api/ai/chat/conversation';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import RoleRepository from '../role/RoleRepository.vue';
|
||||
import RoleRepository from '../role/repository.vue';
|
||||
|
||||
// 定义组件 props
|
||||
const props = defineProps({
|
||||
activeId: {
|
||||
type: [Number, null] as PropType<null | number>,
|
||||
@@ -29,7 +28,6 @@ const props = defineProps({
|
||||
},
|
||||
});
|
||||
|
||||
// 定义钩子
|
||||
const emits = defineEmits([
|
||||
'onConversationCreate',
|
||||
'onConversationClick',
|
||||
@@ -41,7 +39,6 @@ const [Drawer, drawerApi] = useVbenDrawer({
|
||||
connectedComponent: RoleRepository,
|
||||
});
|
||||
|
||||
// 定义属性
|
||||
const searchName = ref<string>(''); // 对话搜索
|
||||
const activeConversationId = ref<null | number>(null); // 选中的对话,默认为 null
|
||||
const hoverConversationId = ref<null | number>(null); // 悬浮上去的对话
|
||||
@@ -180,7 +177,7 @@ async function updateConversationTitle(
|
||||
conversation: AiChatConversationApi.ChatConversation,
|
||||
) {
|
||||
// 1. 二次确认
|
||||
prompt({
|
||||
await prompt({
|
||||
async beforeClose(scope) {
|
||||
if (scope.isConfirm) {
|
||||
if (scope.value) {
|
||||
@@ -202,8 +199,7 @@ async function updateConversationTitle(
|
||||
if (
|
||||
filterConversationList.length > 0 &&
|
||||
filterConversationList[0] && // tip:避免切换对话
|
||||
activeConversationId.value ===
|
||||
(filterConversationList[0].id as number)
|
||||
activeConversationId.value === filterConversationList[0].id!
|
||||
) {
|
||||
emits('onConversationClick', filterConversationList[0]);
|
||||
}
|
||||
@@ -252,9 +248,9 @@ async function handleClearConversation() {
|
||||
await confirm('确认后对话会全部清空,置顶的对话除外。');
|
||||
await deleteChatConversationMyByUnpinned();
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
// 清空 对话 和 对话内容
|
||||
// 清空对话、对话内容
|
||||
activeConversationId.value = null;
|
||||
// 获取 对话列表
|
||||
// 获取对话列表
|
||||
await getChatConversationList();
|
||||
// 回调 方法
|
||||
emits('onConversationClear');
|
||||
@@ -283,7 +279,6 @@ watch(activeId, async (newValue) => {
|
||||
activeConversationId.value = newValue;
|
||||
});
|
||||
|
||||
// 定义 public 方法
|
||||
defineExpose({ createConversation });
|
||||
|
||||
/** 初始化 */
|
||||
@@ -298,7 +293,7 @@ onMounted(async () => {
|
||||
if (conversationList.value.length > 0 && conversationList.value[0]) {
|
||||
activeConversationId.value = conversationList.value[0].id;
|
||||
// 回调 onConversationClick
|
||||
await emits('onConversationClick', conversationList.value[0]);
|
||||
emits('onConversationClick', conversationList.value[0]);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -357,17 +352,20 @@ onMounted(async () => {
|
||||
class="mt-1"
|
||||
>
|
||||
<div
|
||||
class="mb-2 flex cursor-pointer flex-row items-center justify-between rounded-lg px-2 leading-10"
|
||||
class="mb-2 flex cursor-pointer flex-row items-center justify-between rounded-lg px-2 leading-10 transition-colors hover:bg-gray-100 dark:hover:bg-gray-800"
|
||||
:class="[
|
||||
conversation.id === activeConversationId ? 'bg-success' : '',
|
||||
conversation.id === activeConversationId
|
||||
? 'bg-primary/10 dark:bg-primary/20'
|
||||
: '',
|
||||
]"
|
||||
>
|
||||
<div class="flex items-center">
|
||||
<Avatar
|
||||
v-if="conversation.roleAvatar"
|
||||
:src="conversation.roleAvatar"
|
||||
:size="28"
|
||||
/>
|
||||
<SvgGptIcon v-else class="size-8" />
|
||||
<SvgGptIcon v-else class="size-6" />
|
||||
<span
|
||||
class="max-w-32 overflow-hidden text-ellipsis whitespace-nowrap p-2 text-sm font-normal"
|
||||
>
|
||||
@@ -25,7 +25,7 @@ const [Form, formApi] = useVbenForm({
|
||||
class: 'w-full',
|
||||
},
|
||||
formItemClass: 'col-span-2',
|
||||
labelWidth: 140,
|
||||
labelWidth: 110,
|
||||
},
|
||||
layout: 'horizontal',
|
||||
schema: useFormSchema(),
|
||||
@@ -0,0 +1,304 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onUnmounted, ref, watch } from 'vue';
|
||||
|
||||
import { IconifyIcon } from '@vben/icons';
|
||||
import { formatFileSize, getFileIcon } from '@vben/utils';
|
||||
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
import { useUpload } from '#/components/upload/use-upload';
|
||||
|
||||
export interface FileItem {
|
||||
name: string;
|
||||
size: number;
|
||||
url?: string;
|
||||
uploading?: boolean;
|
||||
progress?: number;
|
||||
raw?: File;
|
||||
}
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
acceptTypes?: string;
|
||||
disabled?: boolean;
|
||||
limit?: number;
|
||||
maxSize?: number;
|
||||
modelValue?: string[];
|
||||
}>(),
|
||||
{
|
||||
modelValue: () => [],
|
||||
limit: 5,
|
||||
maxSize: 10,
|
||||
acceptTypes:
|
||||
'.jpg,.jpeg,.png,.gif,.webp,.pdf,.doc,.docx,.txt,.xls,.xlsx,.ppt,.pptx,.csv,.md',
|
||||
disabled: false,
|
||||
},
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:modelValue': [value: string[]];
|
||||
uploadError: [error: any];
|
||||
uploadSuccess: [file: FileItem];
|
||||
}>();
|
||||
|
||||
const fileInputRef = ref<HTMLInputElement>();
|
||||
const fileList = ref<FileItem[]>([]);
|
||||
const uploadedUrls = ref<string[]>([]);
|
||||
const showTooltip = ref(false);
|
||||
const hideTimer = ref<NodeJS.Timeout | null>(null);
|
||||
const { httpRequest } = useUpload();
|
||||
|
||||
/** 监听 v-model 变化 */
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
(newVal) => {
|
||||
uploadedUrls.value = [...newVal];
|
||||
if (newVal.length === 0) {
|
||||
fileList.value = [];
|
||||
}
|
||||
},
|
||||
{ immediate: true, deep: true },
|
||||
);
|
||||
|
||||
/** 是否有文件 */
|
||||
const hasFiles = computed(() => fileList.value.length > 0);
|
||||
|
||||
/** 是否达到上传限制 */
|
||||
const isLimitReached = computed(() => fileList.value.length >= props.limit);
|
||||
|
||||
/** 触发文件选择 */
|
||||
function triggerFileInput() {
|
||||
fileInputRef.value?.click();
|
||||
}
|
||||
|
||||
/** 显示 tooltip */
|
||||
function showTooltipHandler() {
|
||||
if (hideTimer.value) {
|
||||
clearTimeout(hideTimer.value);
|
||||
hideTimer.value = null;
|
||||
}
|
||||
showTooltip.value = true;
|
||||
}
|
||||
|
||||
/** 隐藏 tooltip */
|
||||
function hideTooltipHandler() {
|
||||
hideTimer.value = setTimeout(() => {
|
||||
showTooltip.value = false;
|
||||
hideTimer.value = null;
|
||||
}, 300);
|
||||
}
|
||||
|
||||
/** 处理文件选择 */
|
||||
async function handleFileSelect(event: Event) {
|
||||
const target = event.target as HTMLInputElement;
|
||||
const files = [...(target.files || [])];
|
||||
if (files.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (files.length + fileList.value.length > props.limit) {
|
||||
message.error(`最多只能上传 ${props.limit} 个文件`);
|
||||
target.value = '';
|
||||
return;
|
||||
}
|
||||
|
||||
for (const file of files) {
|
||||
if (file.size > props.maxSize * 1024 * 1024) {
|
||||
message.error(`文件 ${file.name} 大小超过 ${props.maxSize}MB`);
|
||||
continue;
|
||||
}
|
||||
|
||||
const fileItem: FileItem = {
|
||||
name: file.name,
|
||||
size: file.size,
|
||||
uploading: true,
|
||||
progress: 0,
|
||||
raw: file,
|
||||
};
|
||||
fileList.value.push(fileItem);
|
||||
await uploadFile(fileItem);
|
||||
}
|
||||
|
||||
target.value = '';
|
||||
}
|
||||
|
||||
/** 上传文件 */
|
||||
async function uploadFile(fileItem: FileItem) {
|
||||
try {
|
||||
const progressInterval = setInterval(() => {
|
||||
if (fileItem.progress! < 90) {
|
||||
fileItem.progress = (fileItem.progress || 0) + Math.random() * 10;
|
||||
}
|
||||
}, 100);
|
||||
|
||||
const response = await httpRequest(fileItem.raw!);
|
||||
clearInterval(progressInterval);
|
||||
|
||||
fileItem.uploading = false;
|
||||
fileItem.progress = 100;
|
||||
|
||||
// 调试日志
|
||||
console.log('上传响应:', response);
|
||||
|
||||
// 兼容不同的返回格式:{ url: '...' } 或 { data: '...' } 或直接是字符串
|
||||
const fileUrl =
|
||||
(response as any)?.url || (response as any)?.data || response;
|
||||
fileItem.url = fileUrl;
|
||||
|
||||
console.log('提取的文件 URL:', fileUrl);
|
||||
|
||||
// 只有当 URL 有效时才添加到列表
|
||||
if (fileUrl && typeof fileUrl === 'string') {
|
||||
uploadedUrls.value.push(fileUrl);
|
||||
emit('uploadSuccess', fileItem);
|
||||
updateModelValue();
|
||||
} else {
|
||||
throw new Error('上传返回的 URL 无效');
|
||||
}
|
||||
} catch (error) {
|
||||
fileItem.uploading = false;
|
||||
message.error(`文件 ${fileItem.name} 上传失败`);
|
||||
emit('uploadError', error);
|
||||
|
||||
const index = fileList.value.indexOf(fileItem);
|
||||
if (index !== -1) {
|
||||
removeFile(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** 删除文件 */
|
||||
function removeFile(index: number) {
|
||||
const removedFile = fileList.value[index];
|
||||
fileList.value.splice(index, 1);
|
||||
if (removedFile?.url) {
|
||||
const urlIndex = uploadedUrls.value.indexOf(removedFile.url);
|
||||
if (urlIndex !== -1) {
|
||||
uploadedUrls.value.splice(urlIndex, 1);
|
||||
}
|
||||
}
|
||||
updateModelValue();
|
||||
}
|
||||
|
||||
/** 更新 v-model */
|
||||
function updateModelValue() {
|
||||
emit('update:modelValue', [...uploadedUrls.value]);
|
||||
}
|
||||
|
||||
/** 清空文件 */
|
||||
function clearFiles() {
|
||||
fileList.value = [];
|
||||
uploadedUrls.value = [];
|
||||
updateModelValue();
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
triggerFileInput,
|
||||
clearFiles,
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
if (hideTimer.value) {
|
||||
clearTimeout(hideTimer.value);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
v-if="!disabled"
|
||||
class="relative inline-block"
|
||||
@mouseenter="showTooltipHandler"
|
||||
@mouseleave="hideTooltipHandler"
|
||||
>
|
||||
<!-- 文件上传按钮 -->
|
||||
<button
|
||||
type="button"
|
||||
class="relative flex h-8 w-8 items-center justify-center rounded-full border-0 bg-transparent text-gray-600 transition-all duration-200 hover:bg-gray-100"
|
||||
:class="{ 'text-blue-500 hover:bg-blue-50': hasFiles }"
|
||||
:disabled="isLimitReached"
|
||||
@click="triggerFileInput"
|
||||
>
|
||||
<IconifyIcon icon="lucide:paperclip" :size="16" />
|
||||
<!-- 文件数量徽章 -->
|
||||
<span
|
||||
v-if="hasFiles"
|
||||
class="absolute -right-1 -top-1 flex h-4 min-w-4 items-center justify-center rounded-full bg-red-500 px-1 text-[10px] font-medium leading-none text-white"
|
||||
>
|
||||
{{ fileList.length }}
|
||||
</span>
|
||||
</button>
|
||||
|
||||
<!-- 隐藏的文件输入框 -->
|
||||
<input
|
||||
ref="fileInputRef"
|
||||
type="file"
|
||||
multiple
|
||||
style="display: none"
|
||||
:accept="acceptTypes"
|
||||
@change="handleFileSelect"
|
||||
/>
|
||||
|
||||
<!-- Hover 显示的文件列表 -->
|
||||
<div
|
||||
v-if="hasFiles && showTooltip"
|
||||
class="animate-in fade-in slide-in-from-bottom-1 absolute bottom-[calc(100%+8px)] left-1/2 z-[1000] min-w-[240px] max-w-[320px] -translate-x-1/2 rounded-lg border border-gray-200 bg-white p-2 shadow-lg duration-200"
|
||||
@mouseenter="showTooltipHandler"
|
||||
@mouseleave="hideTooltipHandler"
|
||||
>
|
||||
<!-- Tooltip 箭头 -->
|
||||
<div
|
||||
class="absolute -bottom-[5px] left-1/2 h-0 w-0 -translate-x-1/2 border-l-[5px] border-r-[5px] border-t-[5px] border-l-transparent border-r-transparent border-t-gray-200"
|
||||
>
|
||||
<div
|
||||
class="absolute bottom-[1px] left-1/2 h-0 w-0 -translate-x-1/2 border-l-[4px] border-r-[4px] border-t-[4px] border-l-transparent border-r-transparent border-t-white"
|
||||
></div>
|
||||
</div>
|
||||
<!-- 文件列表 -->
|
||||
<div
|
||||
class="scrollbar-thin scrollbar-track-transparent scrollbar-thumb-gray-300 hover:scrollbar-thumb-gray-400 scrollbar-thumb-rounded-sm max-h-[200px] overflow-y-auto"
|
||||
>
|
||||
<div
|
||||
v-for="(file, index) in fileList"
|
||||
:key="index"
|
||||
class="mb-1 flex items-center justify-between rounded-md bg-gray-50 p-2 text-xs transition-all duration-200 last:mb-0 hover:bg-gray-100"
|
||||
:class="{ 'opacity-70': file.uploading }"
|
||||
>
|
||||
<div class="flex min-w-0 flex-1 items-center">
|
||||
<IconifyIcon
|
||||
:icon="getFileIcon(file.name)"
|
||||
class="mr-2 flex-shrink-0 text-blue-500"
|
||||
/>
|
||||
<span
|
||||
class="mr-1 flex-1 overflow-hidden text-ellipsis whitespace-nowrap font-medium text-gray-900"
|
||||
>
|
||||
{{ file.name }}
|
||||
</span>
|
||||
<span class="flex-shrink-0 text-[11px] text-gray-500">
|
||||
({{ formatFileSize(file.size) }})
|
||||
</span>
|
||||
</div>
|
||||
<div class="ml-2 flex flex-shrink-0 items-center gap-1">
|
||||
<div
|
||||
v-if="file.uploading"
|
||||
class="h-1 w-[60px] overflow-hidden rounded-full bg-gray-200"
|
||||
>
|
||||
<div
|
||||
class="h-full bg-blue-500 transition-all duration-300"
|
||||
:style="{ width: `${file.progress || 0}%` }"
|
||||
></div>
|
||||
</div>
|
||||
<button
|
||||
v-else-if="!disabled"
|
||||
type="button"
|
||||
class="flex h-5 w-5 items-center justify-center rounded text-red-500 hover:bg-red-50"
|
||||
@click="removeFile(index)"
|
||||
>
|
||||
<IconifyIcon icon="lucide:x" :size="12" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,53 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
|
||||
import { IconifyIcon } from '@vben/icons';
|
||||
import { getFileIcon, getFileNameFromUrl, getFileTypeClass } from '@vben/utils';
|
||||
|
||||
const props = defineProps<{
|
||||
attachmentUrls?: string[];
|
||||
}>();
|
||||
|
||||
/** 过滤掉空值的附件列表 */
|
||||
const validAttachmentUrls = computed(() => {
|
||||
return (props.attachmentUrls || []).filter((url) => url && url.trim());
|
||||
});
|
||||
|
||||
/** 点击文件 */
|
||||
function handleFileClick(url: string) {
|
||||
window.open(url, '_blank');
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-if="validAttachmentUrls.length > 0" class="mt-2">
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<div
|
||||
v-for="(url, index) in validAttachmentUrls"
|
||||
:key="index"
|
||||
class="max-w-70 flex min-w-40 cursor-pointer items-center rounded-lg border border-transparent bg-gray-100 p-3 transition-all duration-200 hover:-translate-y-1 hover:bg-gray-200 hover:shadow-lg"
|
||||
@click="handleFileClick(url)"
|
||||
>
|
||||
<div class="mr-3 flex-shrink-0">
|
||||
<div
|
||||
class="flex h-8 w-8 items-center justify-center rounded-md bg-gradient-to-br font-bold text-white"
|
||||
:class="getFileTypeClass(getFileNameFromUrl(url))"
|
||||
>
|
||||
<IconifyIcon
|
||||
:icon="getFileIcon(getFileNameFromUrl(url))"
|
||||
:size="20"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="min-w-0 flex-1">
|
||||
<div
|
||||
class="mb-1 overflow-hidden text-ellipsis whitespace-nowrap text-sm font-medium leading-tight text-gray-800"
|
||||
:title="getFileNameFromUrl(url)"
|
||||
>
|
||||
{{ getFileNameFromUrl(url) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,8 +1,7 @@
|
||||
<!-- 消息列表为空时,展示 prompt 列表 -->
|
||||
<script setup lang="ts">
|
||||
// prompt 列表
|
||||
|
||||
const emits = defineEmits(['onPrompt']);
|
||||
|
||||
const promptList = [
|
||||
{
|
||||
prompt: '今天气怎么样?',
|
||||
@@ -10,7 +9,9 @@ const promptList = [
|
||||
{
|
||||
prompt: '写一首好听的诗歌?',
|
||||
},
|
||||
]; /** 选中 prompt 点击 */
|
||||
]; // prompt 列表
|
||||
|
||||
/** 选中 prompt 点击 */
|
||||
async function handlerPromptClick(prompt: any) {
|
||||
emits('onPrompt', prompt.prompt);
|
||||
}
|
||||
@@ -9,7 +9,7 @@ import { computed, nextTick, onMounted, ref, toRefs } from 'vue';
|
||||
import { IconifyIcon, SvgGptIcon } from '@vben/icons';
|
||||
import { preferences } from '@vben/preferences';
|
||||
import { useUserStore } from '@vben/stores';
|
||||
import { formatDate } from '@vben/utils';
|
||||
import { formatDateTime } from '@vben/utils';
|
||||
|
||||
import { useClipboard } from '@vueuse/core';
|
||||
import { Avatar, Button, message } from 'ant-design-vue';
|
||||
@@ -17,8 +17,11 @@ import { Avatar, Button, message } from 'ant-design-vue';
|
||||
import { deleteChatMessage } from '#/api/ai/chat/message';
|
||||
import { MarkdownView } from '#/components/markdown-view';
|
||||
|
||||
import MessageKnowledge from './MessageKnowledge.vue';
|
||||
// 定义 props
|
||||
import MessageFiles from './files.vue';
|
||||
import MessageKnowledge from './knowledge.vue';
|
||||
import MessageReasoning from './reasoning.vue';
|
||||
import MessageWebSearch from './web-search.vue';
|
||||
|
||||
const props = defineProps({
|
||||
conversation: {
|
||||
type: Object as PropType<AiChatConversationApi.ChatConversation>,
|
||||
@@ -29,7 +32,6 @@ const props = defineProps({
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
// 消息列表
|
||||
|
||||
const emits = defineEmits(['onDeleteSuccess', 'onRefresh', 'onEdit']);
|
||||
const { copy } = useClipboard(); // 初始化 copy 到粘贴板
|
||||
@@ -48,14 +50,15 @@ const { list } = toRefs(props); // 定义 emits
|
||||
// ============ 处理对话滚动 ==============
|
||||
|
||||
/** 滚动到底部 */
|
||||
const scrollToBottom = async (isIgnore?: boolean) => {
|
||||
async function scrollToBottom(isIgnore?: boolean) {
|
||||
// 注意要使用 nextTick 以免获取不到 dom
|
||||
await nextTick();
|
||||
if (isIgnore || !isScrolling.value) {
|
||||
messageContainer.value.scrollTop =
|
||||
messageContainer.value.scrollHeight - messageContainer.value.offsetHeight;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function handleScroll() {
|
||||
const scrollContainer = messageContainer.value;
|
||||
const scrollTop = scrollContainer.scrollTop;
|
||||
@@ -122,21 +125,31 @@ onMounted(async () => {
|
||||
<Avatar
|
||||
v-if="conversation.roleAvatar"
|
||||
:src="conversation.roleAvatar"
|
||||
:size="28"
|
||||
/>
|
||||
<SvgGptIcon v-else class="size-8" />
|
||||
<SvgGptIcon v-else class="size-7" />
|
||||
</div>
|
||||
<div class="mx-4 flex flex-col text-left">
|
||||
<div class="text-left leading-10">
|
||||
{{ formatDate(item.createTime) }}
|
||||
{{ formatDateTime(item.createTime) }}
|
||||
</div>
|
||||
<div
|
||||
class="relative flex flex-col break-words rounded-lg bg-gray-100 p-2.5 pb-1 pt-2.5 shadow-sm"
|
||||
>
|
||||
<MessageReasoning
|
||||
:reasoning-content="item.reasoningContent || ''"
|
||||
:content="item.content || ''"
|
||||
/>
|
||||
<MarkdownView
|
||||
class="text-sm text-gray-600"
|
||||
:content="item.content"
|
||||
/>
|
||||
<MessageFiles :attachment-urls="item.attachmentUrls" />
|
||||
<MessageKnowledge v-if="item.segments" :segments="item.segments" />
|
||||
<MessageWebSearch
|
||||
v-if="item.webSearchPages"
|
||||
:web-search-pages="item.webSearchPages"
|
||||
/>
|
||||
</div>
|
||||
<div class="mt-2 flex flex-row">
|
||||
<Button
|
||||
@@ -161,14 +174,21 @@ onMounted(async () => {
|
||||
<!-- 右侧消息:user -->
|
||||
<div v-else class="flex flex-row-reverse justify-start">
|
||||
<div class="avatar">
|
||||
<Avatar :src="userAvatar" />
|
||||
<Avatar :src="userAvatar" :size="28" />
|
||||
</div>
|
||||
<div class="mx-4 flex flex-col text-left">
|
||||
<div class="text-left leading-8">
|
||||
{{ formatDate(item.createTime) }}
|
||||
{{ formatDateTime(item.createTime) }}
|
||||
</div>
|
||||
<div
|
||||
v-if="item.attachmentUrls && item.attachmentUrls.length > 0"
|
||||
class="mb-2 flex flex-row-reverse"
|
||||
>
|
||||
<MessageFiles :attachment-urls="item.attachmentUrls" />
|
||||
</div>
|
||||
<div class="flex flex-row-reverse">
|
||||
<div
|
||||
v-if="item.content && item.content.trim()"
|
||||
class="inline w-auto whitespace-pre-wrap break-words rounded-lg bg-blue-500 p-2.5 text-sm text-white shadow-sm"
|
||||
>
|
||||
{{ item.content }}
|
||||
@@ -0,0 +1,83 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import { IconifyIcon } from '@vben/icons';
|
||||
|
||||
import { MarkdownView } from '#/components/markdown-view';
|
||||
|
||||
const props = defineProps<{
|
||||
content?: string;
|
||||
reasoningContent?: string;
|
||||
}>();
|
||||
|
||||
const isExpanded = ref(true); // 默认展开
|
||||
|
||||
/** 判断是否应该显示组件 */
|
||||
const shouldShowComponent = computed(() => {
|
||||
return props.reasoningContent && props.reasoningContent.trim() !== '';
|
||||
});
|
||||
|
||||
/** 标题文本 */
|
||||
const titleText = computed(() => {
|
||||
const hasReasoningContent =
|
||||
props.reasoningContent && props.reasoningContent.trim() !== '';
|
||||
const hasContent = props.content && props.content.trim() !== '';
|
||||
if (hasReasoningContent && !hasContent) {
|
||||
return '深度思考中';
|
||||
}
|
||||
return '已深度思考';
|
||||
});
|
||||
|
||||
/** 切换展开/收起 */
|
||||
function toggleExpanded() {
|
||||
isExpanded.value = !isExpanded.value;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-if="shouldShowComponent" class="mt-2.5">
|
||||
<!-- 标题栏 -->
|
||||
<div
|
||||
class="flex cursor-pointer items-center justify-between rounded-t-lg border border-b-0 border-gray-200/60 bg-gradient-to-r from-blue-50 to-purple-50 p-2 transition-all duration-200 hover:from-blue-100 hover:to-purple-100"
|
||||
@click="toggleExpanded"
|
||||
>
|
||||
<div class="flex items-center gap-1.5 text-sm font-medium text-gray-700">
|
||||
<IconifyIcon icon="lucide:brain" class="text-blue-600" :size="16" />
|
||||
<span>{{ titleText }}</span>
|
||||
</div>
|
||||
<IconifyIcon
|
||||
icon="lucide:chevron-down"
|
||||
class="text-gray-500 transition-transform duration-200"
|
||||
:class="{ 'rotate-180': isExpanded }"
|
||||
:size="14"
|
||||
/>
|
||||
</div>
|
||||
<!-- 内容区 -->
|
||||
<div
|
||||
v-show="isExpanded"
|
||||
class="scrollbar-thin max-h-[300px] overflow-y-auto rounded-b-lg border border-t-0 border-gray-200/60 bg-white/70 p-3 shadow-sm backdrop-blur-sm"
|
||||
>
|
||||
<MarkdownView
|
||||
v-if="props.reasoningContent"
|
||||
class="text-sm leading-relaxed text-gray-700"
|
||||
:content="props.reasoningContent"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
/* 自定义滚动条 */
|
||||
.scrollbar-thin::-webkit-scrollbar {
|
||||
width: 4px;
|
||||
}
|
||||
.scrollbar-thin::-webkit-scrollbar-track {
|
||||
background: transparent;
|
||||
}
|
||||
.scrollbar-thin::-webkit-scrollbar-thumb {
|
||||
@apply rounded-sm bg-gray-400/40;
|
||||
}
|
||||
.scrollbar-thin::-webkit-scrollbar-thumb:hover {
|
||||
@apply bg-gray-400/60;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,173 @@
|
||||
<script setup lang="ts">
|
||||
import type { AiChatMessageApi } from '#/api/ai/chat/message';
|
||||
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { useVbenDrawer } from '@vben/common-ui';
|
||||
import { IconifyIcon } from '@vben/icons';
|
||||
|
||||
defineProps<{
|
||||
webSearchPages?: AiChatMessageApi.WebSearchPage[];
|
||||
}>();
|
||||
|
||||
const isExpanded = ref(false); // 默认收起
|
||||
const selectedResult = ref<AiChatMessageApi.WebSearchPage | null>(null); // 选中的搜索结果
|
||||
const iconLoadError = ref<Record<number, boolean>>({}); // 记录图标加载失败
|
||||
|
||||
const [Drawer, drawerApi] = useVbenDrawer({
|
||||
title: '联网搜索详情',
|
||||
closable: true,
|
||||
footer: true,
|
||||
onCancel() {
|
||||
drawerApi.close();
|
||||
},
|
||||
onConfirm() {
|
||||
if (selectedResult.value?.url) {
|
||||
window.open(selectedResult.value.url, '_blank');
|
||||
}
|
||||
drawerApi.close();
|
||||
},
|
||||
});
|
||||
|
||||
/** 切换展开/收起 */
|
||||
function toggleExpanded() {
|
||||
isExpanded.value = !isExpanded.value;
|
||||
}
|
||||
|
||||
/** 点击搜索结果 */
|
||||
function handleClick(result: AiChatMessageApi.WebSearchPage) {
|
||||
selectedResult.value = result;
|
||||
drawerApi.open();
|
||||
}
|
||||
|
||||
/** 图标加载失败处理 */
|
||||
function handleIconError(index: number) {
|
||||
iconLoadError.value[index] = true;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-if="webSearchPages && webSearchPages.length > 0" class="mt-2.5">
|
||||
<!-- 标题栏:可点击展开/收起 -->
|
||||
<div
|
||||
class="mb-2 flex cursor-pointer items-center justify-between text-sm text-gray-600 transition-colors hover:text-blue-500"
|
||||
@click="toggleExpanded"
|
||||
>
|
||||
<div class="flex items-center gap-1.5">
|
||||
<IconifyIcon icon="lucide:search" :size="14" />
|
||||
<span>联网搜索结果 ({{ webSearchPages.length }} 条)</span>
|
||||
</div>
|
||||
<IconifyIcon
|
||||
:icon="isExpanded ? 'lucide:chevron-up' : 'lucide:chevron-down'"
|
||||
class="text-xs transition-transform duration-200"
|
||||
:size="12"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- 可展开的搜索结果列表 -->
|
||||
<div
|
||||
v-show="isExpanded"
|
||||
class="flex flex-col gap-2 transition-all duration-200 ease-in-out"
|
||||
>
|
||||
<div
|
||||
v-for="(page, index) in webSearchPages"
|
||||
:key="index"
|
||||
class="cursor-pointer rounded-md bg-white p-2.5 transition-all hover:bg-blue-50"
|
||||
@click="handleClick(page)"
|
||||
>
|
||||
<div class="flex items-start gap-2">
|
||||
<!-- 网站图标 -->
|
||||
<div class="mt-0.5 h-4 w-4 flex-shrink-0">
|
||||
<img
|
||||
v-if="page.icon && !iconLoadError[index]"
|
||||
:src="page.icon"
|
||||
:alt="page.name"
|
||||
class="h-full w-full rounded-sm object-contain"
|
||||
@error="handleIconError(index)"
|
||||
/>
|
||||
<IconifyIcon
|
||||
v-else
|
||||
icon="lucide:link"
|
||||
class="h-full w-full text-gray-600"
|
||||
/>
|
||||
</div>
|
||||
<!-- 内容区域 -->
|
||||
<div class="min-w-0 flex-1">
|
||||
<!-- 网站名称 -->
|
||||
<div class="mb-1 truncate text-xs text-gray-400">
|
||||
{{ page.name }}
|
||||
</div>
|
||||
<!-- 主标题 -->
|
||||
<div
|
||||
class="mb-1 line-clamp-2 text-sm font-medium leading-snug text-blue-600"
|
||||
>
|
||||
{{ page.title }}
|
||||
</div>
|
||||
<!-- 描述 -->
|
||||
<div class="mb-1 line-clamp-2 text-xs leading-snug text-gray-600">
|
||||
{{ page.snippet }}
|
||||
</div>
|
||||
<!-- URL -->
|
||||
<div class="truncate text-xs text-green-700">
|
||||
{{ page.url }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 联网搜索详情 Drawer -->
|
||||
<Drawer class="w-[600px]" cancel-text="关闭" confirm-text="访问原文">
|
||||
<div v-if="selectedResult">
|
||||
<!-- 标题区域 -->
|
||||
<div class="mb-4 flex items-start gap-3">
|
||||
<div class="mt-0.5 h-6 w-6 flex-shrink-0">
|
||||
<img
|
||||
v-if="selectedResult.icon"
|
||||
:src="selectedResult.icon"
|
||||
:alt="selectedResult.name"
|
||||
class="h-full w-full rounded-sm object-contain"
|
||||
/>
|
||||
<IconifyIcon
|
||||
v-else
|
||||
icon="lucide:link"
|
||||
class="h-full w-full text-gray-600"
|
||||
/>
|
||||
</div>
|
||||
<div class="min-w-0 flex-1">
|
||||
<div class="mb-2 text-lg font-bold text-gray-900">
|
||||
{{ selectedResult.title }}
|
||||
</div>
|
||||
<div class="mb-1 text-sm text-gray-500">
|
||||
{{ selectedResult.name }}
|
||||
</div>
|
||||
<div class="break-all text-sm text-green-700">
|
||||
{{ selectedResult.url }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 内容区域 -->
|
||||
<div class="space-y-4">
|
||||
<!-- 简短描述 -->
|
||||
<div>
|
||||
<div class="mb-2 text-sm font-semibold text-gray-900">简短描述</div>
|
||||
<div
|
||||
class="rounded-lg bg-gray-50 p-3 text-sm leading-relaxed text-gray-700"
|
||||
>
|
||||
{{ selectedResult.snippet }}
|
||||
</div>
|
||||
</div>
|
||||
<!-- 内容摘要 -->
|
||||
<div v-if="selectedResult.summary">
|
||||
<div class="mb-2 text-sm font-semibold text-gray-900">内容摘要</div>
|
||||
<div
|
||||
class="max-h-[50vh] overflow-y-auto whitespace-pre-wrap rounded-lg bg-gray-50 p-3 text-sm leading-relaxed text-gray-900"
|
||||
>
|
||||
{{ selectedResult.summary }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Drawer>
|
||||
</div>
|
||||
</template>
|
||||
@@ -2,7 +2,7 @@
|
||||
import type { PropType } from 'vue';
|
||||
|
||||
import { Button } from 'ant-design-vue';
|
||||
// 定义属性
|
||||
|
||||
defineProps({
|
||||
categoryList: {
|
||||
type: Array as PropType<string[]>,
|
||||
@@ -15,8 +15,7 @@ defineProps({
|
||||
},
|
||||
});
|
||||
|
||||
// 定义回调
|
||||
const emits = defineEmits(['onCategoryClick']);
|
||||
const emits = defineEmits(['onCategoryClick']); // 定义回调
|
||||
|
||||
/** 处理分类点击事件 */
|
||||
async function handleCategoryClick(category: string) {
|
||||
@@ -9,9 +9,6 @@ import { IconifyIcon } from '@vben/icons';
|
||||
|
||||
import { Avatar, Button, Card, Dropdown, Menu } from 'ant-design-vue';
|
||||
|
||||
// tabs ref
|
||||
|
||||
// 定义属性
|
||||
const props = defineProps({
|
||||
loading: {
|
||||
type: Boolean,
|
||||
@@ -28,8 +25,8 @@ const props = defineProps({
|
||||
},
|
||||
});
|
||||
|
||||
// 定义钩子
|
||||
const emits = defineEmits(['onDelete', 'onEdit', 'onUse', 'onPage']);
|
||||
|
||||
const tabsRef = ref<any>();
|
||||
|
||||
/** 操作:编辑、删除 */
|
||||
@@ -53,7 +50,7 @@ async function handleTabsScroll() {
|
||||
if (tabsRef.value) {
|
||||
const { scrollTop, scrollHeight, clientHeight } = tabsRef.value;
|
||||
if (scrollTop + clientHeight >= scrollHeight - 20 && !props.loading) {
|
||||
await emits('onPage');
|
||||
emits('onPage');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,10 +14,11 @@ import { createChatConversationMy } from '#/api/ai/chat/conversation';
|
||||
import { deleteMy, getCategoryList, getMyPage } from '#/api/ai/model/chatRole';
|
||||
|
||||
import Form from '../../../../model/chatRole/modules/form.vue';
|
||||
import RoleCategoryList from './RoleCategoryList.vue';
|
||||
import RoleList from './RoleList.vue';
|
||||
import RoleCategoryList from './category-list.vue';
|
||||
import RoleList from './list.vue';
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
const [Drawer] = useVbenDrawer({
|
||||
title: '角色管理',
|
||||
footer: false,
|
||||
@@ -28,7 +29,7 @@ const [FormModal, formModalApi] = useVbenModal({
|
||||
connectedComponent: Form,
|
||||
destroyOnClose: true,
|
||||
});
|
||||
// 属性定义
|
||||
|
||||
const loading = ref<boolean>(false); // 加载中
|
||||
const activeTab = ref<string>('my-role'); // 选中的角色 Tab
|
||||
const search = ref<string>(''); // 加载中
|
||||
@@ -11,11 +11,11 @@ import { Segmented } from 'ant-design-vue';
|
||||
|
||||
import { getModelSimpleList } from '#/api/ai/model/model';
|
||||
|
||||
import Common from './components/common/index.vue';
|
||||
import Dall3 from './components/dall3/index.vue';
|
||||
import ImageList from './components/ImageList.vue';
|
||||
import Midjourney from './components/midjourney/index.vue';
|
||||
import StableDiffusion from './components/stableDiffusion/index.vue';
|
||||
import Common from './modules/common/index.vue';
|
||||
import Dall3 from './modules/dall3/index.vue';
|
||||
import ImageList from './modules/list.vue';
|
||||
import Midjourney from './modules/midjourney/index.vue';
|
||||
import StableDiffusion from './modules/stable-diffusion/index.vue';
|
||||
|
||||
const imageListRef = ref<any>(); // image 列表 ref
|
||||
const dall3Ref = ref<any>(); // dall3(openai) ref
|
||||
@@ -23,7 +23,6 @@ const midjourneyRef = ref<any>(); // midjourney ref
|
||||
const stableDiffusionRef = ref<any>(); // stable diffusion ref
|
||||
const commonRef = ref<any>(); // stable diffusion ref
|
||||
|
||||
// 定义属性
|
||||
const selectPlatform = ref('common'); // 选中的平台
|
||||
const platformOptions = [
|
||||
{
|
||||
@@ -43,7 +42,6 @@ const platformOptions = [
|
||||
value: AiPlatformEnum.STABLE_DIFFUSION,
|
||||
},
|
||||
];
|
||||
|
||||
const models = ref<AiModelModelApi.Model[]>([]); // 模型列表
|
||||
|
||||
/** 绘画 start */
|
||||
|
||||
@@ -11,8 +11,6 @@ import { IconifyIcon } from '@vben/icons';
|
||||
|
||||
import { Button, Card, Image, message } from 'ant-design-vue';
|
||||
|
||||
// 消息
|
||||
|
||||
const props = defineProps({
|
||||
detail: {
|
||||
type: Object as PropType<AiImageApi.Image>,
|
||||
@@ -32,7 +30,6 @@ async function handleButtonClick(type: string, detail: AiImageApi.Image) {
|
||||
async function handleMidjourneyBtnClick(
|
||||
button: AiImageApi.ImageMidjourneyButtons,
|
||||
) {
|
||||
// 确认窗体
|
||||
await confirm(`确认操作 "${button.label} ${button.emoji}" ?`);
|
||||
emits('onMjBtnClick', button, props.detail);
|
||||
}
|
||||
@@ -43,6 +40,7 @@ watch(detail, async (newVal) => {
|
||||
await handleLoading(newVal.status);
|
||||
});
|
||||
const loading = ref();
|
||||
|
||||
/** 处理加载状态 */
|
||||
async function handleLoading(status: number) {
|
||||
// 情况一:如果是生成中,则设置加载中的 loading
|
||||
@@ -50,10 +48,11 @@ async function handleLoading(status: number) {
|
||||
loading.value = message.loading({
|
||||
content: `生成中...`,
|
||||
});
|
||||
|
||||
// 情况二:如果已经生成结束,则移除 loading
|
||||
} else {
|
||||
if (loading.value) setTimeout(loading.value, 100);
|
||||
// 情况二:如果已经生成结束,则移除 loading
|
||||
if (loading.value) {
|
||||
setTimeout(loading.value, 100);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,6 +77,7 @@ onMounted(async () => {
|
||||
</Button>
|
||||
</div>
|
||||
<div class="flex">
|
||||
<!-- TODO @AI:居右对齐 -->
|
||||
<Button
|
||||
class="m-0 p-2"
|
||||
type="text"
|
||||
@@ -16,21 +16,17 @@ import { Button, InputNumber, Select, Space, Textarea } from 'ant-design-vue';
|
||||
|
||||
import { drawImage } from '#/api/ai/image';
|
||||
|
||||
// 消息弹窗
|
||||
|
||||
// 接收父组件传入的模型列表
|
||||
const props = defineProps({
|
||||
models: {
|
||||
type: Array<AiModelModelApi.Model>,
|
||||
default: () => [] as AiModelModelApi.Model[],
|
||||
},
|
||||
});
|
||||
}); // 接收父组件传入的模型列表
|
||||
const emits = defineEmits(['onDrawStart', 'onDrawComplete']);
|
||||
|
||||
// 定义属性
|
||||
const drawIn = ref<boolean>(false); // 生成中
|
||||
const selectHotWord = ref<string>(''); // 选中的热词
|
||||
// 表单
|
||||
|
||||
const prompt = ref<string>(''); // 提示词
|
||||
const width = ref<number>(512); // 图片宽度
|
||||
const height = ref<number>(512); // 图片高度
|
||||
@@ -45,7 +41,6 @@ async function handleHotWordClick(hotWord: string) {
|
||||
selectHotWord.value = '';
|
||||
return;
|
||||
}
|
||||
|
||||
// 情况二:选中
|
||||
selectHotWord.value = hotWord; // 选中
|
||||
prompt.value = hotWord; // 替换提示词
|
||||
@@ -91,11 +86,11 @@ async function handlerPlatformChange(platform: any) {
|
||||
platformModels.value = props.models.filter(
|
||||
(item: AiModelModelApi.Model) => item.platform === platform,
|
||||
);
|
||||
// 切换平台,默认选择一个模型
|
||||
modelId.value =
|
||||
platformModels.value.length > 0 && platformModels.value[0]
|
||||
? platformModels.value[0].id
|
||||
: undefined;
|
||||
// 切换平台,默认选择一个模型
|
||||
}
|
||||
|
||||
/** 监听 models 变化 */
|
||||
@@ -106,7 +101,7 @@ watch(
|
||||
},
|
||||
{ immediate: true, deep: true },
|
||||
);
|
||||
/** 暴露组件方法 */
|
||||
|
||||
defineExpose({ settingValues });
|
||||
</script>
|
||||
<template>
|
||||
@@ -20,16 +20,14 @@ import { Button, Image, message, Space, Textarea } from 'ant-design-vue';
|
||||
|
||||
import { drawImage } from '#/api/ai/image';
|
||||
|
||||
// 接收父组件传入的模型列表
|
||||
const props = defineProps({
|
||||
models: {
|
||||
type: Array<AiModelModelApi.Model>,
|
||||
default: () => [] as AiModelModelApi.Model[],
|
||||
},
|
||||
});
|
||||
}); // 接收父组件传入的模型列表
|
||||
const emits = defineEmits(['onDrawStart', 'onDrawComplete']);
|
||||
|
||||
// 定义属性
|
||||
const prompt = ref<string>(''); // 提示词
|
||||
const drawIn = ref<boolean>(false); // 生成中
|
||||
const selectHotWord = ref<string>(''); // 选中的热词
|
||||
@@ -44,7 +42,6 @@ async function handleHotWordClick(hotWord: string) {
|
||||
selectHotWord.value = '';
|
||||
return;
|
||||
}
|
||||
|
||||
// 情况二:选中
|
||||
selectHotWord.value = hotWord;
|
||||
prompt.value = hotWord;
|
||||
@@ -141,7 +138,6 @@ async function settingValues(detail: AiImageApi.Image) {
|
||||
await handleSizeClick(imageSize);
|
||||
}
|
||||
|
||||
/** 暴露组件方法 */
|
||||
defineExpose({ settingValues });
|
||||
</script>
|
||||
<template>
|
||||
@@ -10,22 +10,22 @@ import {
|
||||
StableDiffusionSamplers,
|
||||
StableDiffusionStylePresets,
|
||||
} from '@vben/constants';
|
||||
import { formatDate } from '@vben/utils';
|
||||
import { formatDateTime } from '@vben/utils';
|
||||
|
||||
import { Image } from 'ant-design-vue';
|
||||
|
||||
import { getImageMy } from '#/api/ai/image';
|
||||
|
||||
// 图片详细信息
|
||||
const props = defineProps({
|
||||
id: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
const detail = ref<AiImageApi.Image>({} as AiImageApi.Image);
|
||||
|
||||
/** 获取图片详情 */
|
||||
const detail = ref<AiImageApi.Image>({} as AiImageApi.Image); // 图片详细信息
|
||||
|
||||
/** 获取图片详情 */
|
||||
async function getImageDetail(id: number) {
|
||||
detail.value = await getImageMy(id);
|
||||
}
|
||||
@@ -53,12 +53,8 @@ watch(
|
||||
<div class="mb-5 w-full overflow-hidden break-words">
|
||||
<div class="text-lg font-bold">时间</div>
|
||||
<div class="mt-2">
|
||||
<div>
|
||||
提交时间:{{ formatDate(detail.createTime, 'yyyy-MM-dd HH:mm:ss') }}
|
||||
</div>
|
||||
<div>
|
||||
生成时间:{{ formatDate(detail.finishTime, 'yyyy-MM-dd HH:mm:ss') }}
|
||||
</div>
|
||||
<div>提交时间:{{ formatDateTime(detail.createTime) }}</div>
|
||||
<div>生成时间:{{ formatDateTime(detail.finishTime) }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -18,10 +18,8 @@ import {
|
||||
midjourneyAction,
|
||||
} from '#/api/ai/image';
|
||||
|
||||
import ImageCard from './ImageCard.vue';
|
||||
import ImageDetail from './ImageDetail.vue';
|
||||
|
||||
// 暴露组件方法
|
||||
import ImageCard from './card.vue';
|
||||
import ImageDetail from './detail.vue';
|
||||
|
||||
const emits = defineEmits(['onRegeneration']);
|
||||
const router = useRouter();
|
||||
@@ -29,15 +27,14 @@ const [Drawer, drawerApi] = useVbenDrawer({
|
||||
title: '图片详情',
|
||||
footer: false,
|
||||
});
|
||||
// 图片分页相关的参数
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
});
|
||||
}); // 图片分页相关的参数
|
||||
const pageTotal = ref<number>(0); // page size
|
||||
const imageList = ref<AiImageApi.Image[]>([]); // image 列表
|
||||
const imageListRef = ref<any>(); // ref
|
||||
// 图片轮询相关的参数(正在生成中的)
|
||||
|
||||
const inProgressImageMap = ref<{}>({}); // 监听的 image 映射,一般是生成中(需要轮询),key 为 image 编号,value 为 image
|
||||
const inProgressTimer = ref<any>(); // 生成中的 image 定时器,轮询生成进展
|
||||
const showImageDetailId = ref<number>(0); // 图片详情的图片编号
|
||||
@@ -60,7 +57,6 @@ async function getImageList() {
|
||||
});
|
||||
try {
|
||||
// 1. 加载图片列表
|
||||
|
||||
const { list, total } = await getImagePageMy(queryParams);
|
||||
imageList.value = list;
|
||||
pageTotal.value = total;
|
||||
@@ -78,6 +74,7 @@ async function getImageList() {
|
||||
loading();
|
||||
}
|
||||
}
|
||||
|
||||
const debounceGetImageList = useDebounceFn(getImageList, 80);
|
||||
/** 轮询生成中的 image 列表 */
|
||||
async function refreshWatchImages() {
|
||||
@@ -132,7 +129,7 @@ async function handleImageButtonClick(
|
||||
}
|
||||
// 重新生成
|
||||
if (type === 'regeneration') {
|
||||
await emits('onRegeneration', imageDetail);
|
||||
emits('onRegeneration', imageDetail);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,7 +149,9 @@ async function handleImageMidjourneyButtonClick(
|
||||
await getImageList();
|
||||
}
|
||||
|
||||
defineExpose({ getImageList }); /** 组件挂在的时候 */
|
||||
defineExpose({ getImageList });
|
||||
|
||||
/** 组件挂在的时候 */
|
||||
onMounted(async () => {
|
||||
// 获取 image 列表
|
||||
await getImageList();
|
||||
@@ -190,7 +189,7 @@ onUnmounted(async () => {
|
||||
</template>
|
||||
|
||||
<div
|
||||
class="flex flex-1 flex-wrap content-start overflow-y-auto p-5 pb-28 pt-5"
|
||||
class="flex flex-1 flex-wrap content-start overflow-y-auto p-3 pb-28 pt-5"
|
||||
ref="imageListRef"
|
||||
>
|
||||
<ImageCard
|
||||
@@ -199,7 +198,7 @@ onUnmounted(async () => {
|
||||
:detail="image"
|
||||
@on-btn-click="handleImageButtonClick"
|
||||
@on-mj-btn-click="handleImageMidjourneyButtonClick"
|
||||
class="mb-5 mr-5"
|
||||
class="mb-3 mr-3"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -29,21 +29,17 @@ import {
|
||||
import { midjourneyImagine } from '#/api/ai/image';
|
||||
import { ImageUpload } from '#/components/upload';
|
||||
|
||||
// 消息弹窗
|
||||
|
||||
// 接收父组件传入的模型列表
|
||||
const props = defineProps({
|
||||
models: {
|
||||
type: Array<AiModelModelApi.Model>,
|
||||
default: () => [] as AiModelModelApi.Model[],
|
||||
},
|
||||
});
|
||||
}); // 接收父组件传入的模型列表
|
||||
const emits = defineEmits(['onDrawStart', 'onDrawComplete']);
|
||||
|
||||
// 定义属性
|
||||
const drawIn = ref<boolean>(false); // 生成中
|
||||
const selectHotWord = ref<string>(''); // 选中的热词
|
||||
// 表单
|
||||
|
||||
const prompt = ref<string>(''); // 提示词
|
||||
const referImageUrl = ref<any>(); // 参考图
|
||||
const selectModel = ref<string>('midjourney'); // 选中的模型
|
||||
@@ -58,7 +54,6 @@ async function handleHotWordClick(hotWord: string) {
|
||||
selectHotWord.value = '';
|
||||
return;
|
||||
}
|
||||
|
||||
// 情况二:选中
|
||||
selectHotWord.value = hotWord; // 选中
|
||||
prompt.value = hotWord; // 设置提示次
|
||||
@@ -140,7 +135,6 @@ async function settingValues(detail: AiImageApi.Image) {
|
||||
referImageUrl.value = detail.options.referImageUrl;
|
||||
}
|
||||
|
||||
/** 暴露组件方法 */
|
||||
defineExpose({ settingValues });
|
||||
</script>
|
||||
<template>
|
||||
@@ -25,14 +25,12 @@ import {
|
||||
|
||||
import { drawImage } from '#/api/ai/image';
|
||||
|
||||
// 接收父组件传入的模型列表
|
||||
const props = defineProps({
|
||||
models: {
|
||||
type: Array<AiModelModelApi.Model>,
|
||||
default: () => [] as AiModelModelApi.Model[],
|
||||
},
|
||||
});
|
||||
|
||||
}); // 接收父组件传入的模型列表
|
||||
const emits = defineEmits(['onDrawStart', 'onDrawComplete']);
|
||||
|
||||
function hasChinese(str: string) {
|
||||
@@ -60,7 +58,6 @@ async function handleHotWordClick(hotWord: string) {
|
||||
selectHotWord.value = '';
|
||||
return;
|
||||
}
|
||||
|
||||
// 情况二:选中
|
||||
selectHotWord.value = hotWord; // 选中
|
||||
prompt.value = hotWord; // 替换提示词
|
||||
@@ -82,7 +79,7 @@ async function handleGenerateImage() {
|
||||
|
||||
// 二次确认
|
||||
if (hasChinese(prompt.value)) {
|
||||
alert('暂不支持中文!');
|
||||
await alert('暂不支持中文!');
|
||||
return;
|
||||
}
|
||||
await confirm(`确认生成内容?`);
|
||||
@@ -129,7 +126,6 @@ async function settingValues(detail: AiImageApi.Image) {
|
||||
stylePreset.value = detail.options?.stylePreset;
|
||||
}
|
||||
|
||||
/** 暴露组件方法 */
|
||||
defineExpose({ settingValues });
|
||||
</script>
|
||||
<template>
|
||||
@@ -228,6 +224,7 @@ defineExpose({ settingValues });
|
||||
</div>
|
||||
|
||||
<!-- 图片尺寸 -->
|
||||
<!-- TODO @AI:同 /Users/yunai/Java/yudao-ui-admin-vben-v5/apps/web-antd/src/views/ai/image/index/modules/common/index.vue 的问题 -->
|
||||
<div class="mt-8">
|
||||
<div><b>图片尺寸</b></div>
|
||||
<Space wrap class="mt-4 w-full">
|
||||
@@ -24,7 +24,7 @@ async function handleDelete(row: AiImageApi.Image) {
|
||||
duration: 0,
|
||||
});
|
||||
try {
|
||||
await deleteImage(row.id as number);
|
||||
await deleteImage(row.id!);
|
||||
message.success($t('ui.actionMessage.deleteSuccess', [row.id]));
|
||||
handleRefresh();
|
||||
} finally {
|
||||
|
||||
@@ -31,7 +31,9 @@ async function getList() {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
const debounceGetList = useDebounceFn(getList, 80);
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.pageNo = 1;
|
||||
|
||||
@@ -53,7 +53,6 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
placeholder: '请输入检索 topK',
|
||||
class: 'w-full',
|
||||
min: 0,
|
||||
max: 10,
|
||||
},
|
||||
@@ -65,7 +64,6 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
placeholder: '请输入检索相似度阈值',
|
||||
class: 'w-full',
|
||||
min: 0,
|
||||
max: 1,
|
||||
step: 0.01,
|
||||
|
||||
@@ -55,7 +55,7 @@ async function handleDelete(row: AiKnowledgeDocumentApi.KnowledgeDocument) {
|
||||
duration: 0,
|
||||
});
|
||||
try {
|
||||
await deleteKnowledgeDocument(row.id as number);
|
||||
await deleteKnowledgeDocument(row.id!);
|
||||
message.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
||||
handleRefresh();
|
||||
} finally {
|
||||
@@ -164,11 +164,10 @@ onMounted(() => {
|
||||
auth: ['ai:knowledge:update'],
|
||||
onClick: handleEdit.bind(null, row.id),
|
||||
},
|
||||
]"
|
||||
:drop-down-actions="[
|
||||
{
|
||||
label: '分段',
|
||||
type: 'link',
|
||||
icon: ACTION_ICON.BOOK,
|
||||
auth: ['ai:knowledge:query'],
|
||||
onClick: handleSegment.bind(null, row.id),
|
||||
},
|
||||
|
||||
@@ -45,7 +45,7 @@ async function handleDelete(row: AiKnowledgeKnowledgeApi.Knowledge) {
|
||||
duration: 0,
|
||||
});
|
||||
try {
|
||||
await deleteKnowledge(row.id as number);
|
||||
await deleteKnowledge(row.id!);
|
||||
message.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
||||
handleRefresh();
|
||||
} finally {
|
||||
|
||||
@@ -51,7 +51,7 @@ async function handleDelete(row: AiKnowledgeSegmentApi.KnowledgeSegment) {
|
||||
duration: 0,
|
||||
});
|
||||
try {
|
||||
await deleteKnowledgeSegment(row.id as number);
|
||||
await deleteKnowledgeSegment(row.id!);
|
||||
message.success($t('ui.actionMessage.deleteSuccess', [row.id]));
|
||||
handleRefresh();
|
||||
} finally {
|
||||
|
||||
@@ -31,7 +31,7 @@ async function handleDelete(row: AiMindmapApi.MindMap) {
|
||||
duration: 0,
|
||||
});
|
||||
try {
|
||||
await deleteMindMap(row.id as number);
|
||||
await deleteMindMap(row.id!);
|
||||
message.success($t('ui.actionMessage.deleteSuccess', [row.id]));
|
||||
handleRefresh();
|
||||
} finally {
|
||||
|
||||
@@ -11,7 +11,6 @@ defineOptions({ name: 'AiMusicAudioBarIndex' });
|
||||
const currentSong = inject<any>('currentSong', {});
|
||||
|
||||
const audioRef = ref<HTMLAudioElement | null>(null);
|
||||
// 音频相关属性https://www.runoob.com/tags/ref-av-dom.html
|
||||
const audioProps = reactive<any>({
|
||||
autoplay: true,
|
||||
paused: false,
|
||||
@@ -19,7 +18,7 @@ const audioProps = reactive<any>({
|
||||
duration: '00:00',
|
||||
muted: false,
|
||||
volume: 50,
|
||||
});
|
||||
}); // 音频相关属性https://www.runoob.com/tags/ref-av-dom.html
|
||||
|
||||
function toggleStatus(type: string) {
|
||||
audioProps[type] = !audioProps[type];
|
||||
@@ -32,7 +31,7 @@ function toggleStatus(type: string) {
|
||||
}
|
||||
}
|
||||
|
||||
// 更新播放位置
|
||||
/** 更新播放位置 */
|
||||
function audioTimeUpdate(args: any) {
|
||||
audioProps.currentTime = formatPast(new Date(args.timeStamp), 'mm:ss');
|
||||
}
|
||||
|
||||
@@ -12,19 +12,11 @@ import songInfo from './songInfo/index.vue';
|
||||
defineOptions({ name: 'AiMusicListIndex' });
|
||||
|
||||
const currentType = ref('mine');
|
||||
// loading 状态
|
||||
const loading = ref(false);
|
||||
// 当前音乐
|
||||
const currentSong = ref({});
|
||||
|
||||
const loading = ref(false); // loading 状态
|
||||
const currentSong = ref({}); // 当前音乐
|
||||
const mySongList = ref<Recordable<any>[]>([]);
|
||||
const squareSongList = ref<Recordable<any>[]>([]);
|
||||
|
||||
/*
|
||||
*@Description: 调接口生成音乐列表
|
||||
*@MethodAuthor: xiaohong
|
||||
*@Date: 2024-06-27 17:06:44
|
||||
*/
|
||||
function generateMusic(formData: Recordable<any>) {
|
||||
loading.value = true;
|
||||
setTimeout(() => {
|
||||
@@ -53,11 +45,6 @@ function generateMusic(formData: Recordable<any>) {
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
/*
|
||||
*@Description: 设置当前播放的音乐
|
||||
*@MethodAuthor: xiaohong
|
||||
*@Date: 2024-07-19 11:22:33
|
||||
*/
|
||||
function setCurrentSong(music: Recordable<any>) {
|
||||
currentSong.value = music;
|
||||
}
|
||||
|
||||
@@ -16,11 +16,6 @@ const generateMode = ref('lyric');
|
||||
|
||||
const modeRef = ref<Nullable<{ formData: Recordable<any> }>>(null);
|
||||
|
||||
/*
|
||||
*@Description: 根据信息生成音乐
|
||||
*@MethodAuthor: xiaohong
|
||||
*@Date: 2024-06-27 16:40:16
|
||||
*/
|
||||
function generateMusic() {
|
||||
emits('generateMusic', { formData: unref(modeRef)?.formData });
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ async function handleDelete(row: AiMusicApi.Music) {
|
||||
duration: 0,
|
||||
});
|
||||
try {
|
||||
await deleteMusic(row.id as number);
|
||||
await deleteMusic(row.id!);
|
||||
message.success($t('ui.actionMessage.deleteSuccess', [row.id]));
|
||||
handleRefresh();
|
||||
} finally {
|
||||
|
||||
@@ -13,19 +13,28 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
||||
fieldName: 'code',
|
||||
label: '流程标识',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入流程标识',
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'name',
|
||||
label: '流程名称',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入流程名称',
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'status',
|
||||
label: '状态',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'),
|
||||
placeholder: '请选择状态',
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -46,27 +55,33 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
|
||||
{
|
||||
field: 'id',
|
||||
title: '编号',
|
||||
minWidth: 100,
|
||||
},
|
||||
{
|
||||
field: 'code',
|
||||
title: '流程标识',
|
||||
minWidth: 150,
|
||||
},
|
||||
{
|
||||
field: 'name',
|
||||
title: '流程名称',
|
||||
minWidth: 200,
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
title: '创建时间',
|
||||
minWidth: 180,
|
||||
formatter: 'formatDateTime',
|
||||
},
|
||||
{
|
||||
field: 'remark',
|
||||
title: '备注',
|
||||
minWidth: 200,
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
title: '状态',
|
||||
minWidth: 100,
|
||||
cellRender: {
|
||||
name: 'CellDict',
|
||||
props: { type: DICT_TYPE.COMMON_STATUS },
|
||||
|
||||
@@ -25,10 +25,27 @@ const route = useRoute();
|
||||
const workflowId = ref<string>('');
|
||||
const actionType = ref<string>('');
|
||||
|
||||
// 基础信息组件引用
|
||||
const basicInfoRef = ref<InstanceType<typeof BasicInfo>>();
|
||||
// 工作流设计组件引用
|
||||
const workflowDesignRef = ref<InstanceType<typeof WorkflowDesign>>();
|
||||
const basicInfoRef = ref<InstanceType<typeof BasicInfo>>(); // 基础信息组件引用
|
||||
const workflowDesignRef = ref<InstanceType<typeof WorkflowDesign>>(); // 工作流设计组件引用
|
||||
|
||||
const currentStep = ref(-1); // 步骤控制。-1 用于,一开始全部不展示等当前页面数据初始化完成
|
||||
const steps = [
|
||||
{ title: '基本信息', validator: validateBasic },
|
||||
{ title: '工作流设计', validator: validateWorkflow },
|
||||
];
|
||||
|
||||
const formData: any = ref({
|
||||
id: undefined,
|
||||
name: '',
|
||||
code: '',
|
||||
remark: '',
|
||||
graph: '',
|
||||
status: CommonStatusEnum.ENABLE,
|
||||
}); // 表单数据
|
||||
|
||||
const llmProvider = ref<any>([]);
|
||||
const workflowData = ref<any>({});
|
||||
provide('workflowData', workflowData);
|
||||
|
||||
/** 步骤校验函数 */
|
||||
async function validateBasic() {
|
||||
@@ -40,30 +57,9 @@ async function validateWorkflow() {
|
||||
await workflowDesignRef.value?.validate();
|
||||
}
|
||||
|
||||
const currentStep = ref(-1); // 步骤控制。-1 用于,一开始全部不展示等当前页面数据初始化完成
|
||||
|
||||
const steps = [
|
||||
{ title: '基本信息', validator: validateBasic },
|
||||
{ title: '工作流设计', validator: validateWorkflow },
|
||||
];
|
||||
|
||||
// 表单数据
|
||||
const formData: any = ref({
|
||||
id: undefined,
|
||||
name: '',
|
||||
code: '',
|
||||
remark: '',
|
||||
graph: '',
|
||||
status: CommonStatusEnum.ENABLE,
|
||||
});
|
||||
|
||||
const llmProvider = ref<any>([]);
|
||||
const workflowData = ref<any>({});
|
||||
provide('workflowData', workflowData);
|
||||
|
||||
async function initData() {
|
||||
if (actionType.value === 'update' && workflowId.value) {
|
||||
formData.value = await getWorkflow(workflowId.value);
|
||||
formData.value = await getWorkflow(workflowId.value as any);
|
||||
workflowData.value = JSON.parse(formData.value.graph);
|
||||
}
|
||||
const models = await getModelSimpleList(AiModelTypeEnum.CHAT);
|
||||
|
||||
@@ -8,10 +8,8 @@ import { getDictOptions } from '@vben/hooks';
|
||||
|
||||
import { Form, Input, Select } from 'ant-design-vue';
|
||||
|
||||
// 创建本地数据副本
|
||||
const modelData = defineModel<any>();
|
||||
// 表单引用
|
||||
const formRef = ref();
|
||||
const modelData = defineModel<any>(); // 创建本地数据副本
|
||||
const formRef = ref(); // 表单引用
|
||||
const rules: Record<string, Rule[]> = {
|
||||
code: [{ required: true, message: '流程标识不能为空', trigger: 'blur' }],
|
||||
name: [{ required: true, message: '流程名称不能为空', trigger: 'blur' }],
|
||||
|
||||
@@ -28,43 +28,52 @@ const [Drawer, drawerApi] = useVbenDrawer({
|
||||
footer: false,
|
||||
closeOnClickModal: false,
|
||||
modal: false,
|
||||
onOpenChange(isOpen: boolean) {
|
||||
if (!isOpen) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
// 查找 start 节点
|
||||
const startNode = getStartNode();
|
||||
// 获取参数定义
|
||||
const parameters: any[] = (startNode.data?.parameters as any[]) || [];
|
||||
const paramDefinitions: Record<string, any> = {};
|
||||
// 加入参数选项方便用户添加非必须参数
|
||||
parameters.forEach((param: any) => {
|
||||
paramDefinitions[param.name] = param;
|
||||
});
|
||||
// 自动装载需必填的参数
|
||||
function mergeIfRequiredButNotSet(target: any[]) {
|
||||
const needPushList = [];
|
||||
for (const key in paramDefinitions) {
|
||||
const param = paramDefinitions[key];
|
||||
|
||||
if (param.required) {
|
||||
const item = target.find((item: any) => item.key === key);
|
||||
|
||||
if (!item) {
|
||||
needPushList.push({
|
||||
key: param.name,
|
||||
value: param.defaultValue || '',
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
target.push(...needPushList);
|
||||
}
|
||||
mergeIfRequiredButNotSet(params4Test.value);
|
||||
|
||||
// 设置参数
|
||||
paramsOfStartNode.value = paramDefinitions;
|
||||
} catch (error) {
|
||||
console.error('加载参数失败:', error);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
/** 展示工作流测试抽屉 */
|
||||
function testWorkflowModel() {
|
||||
drawerApi.open();
|
||||
const startNode = getStartNode();
|
||||
|
||||
// 获取参数定义
|
||||
const parameters: any[] = (startNode.data?.parameters as any[]) || [];
|
||||
const paramDefinitions: Record<string, any> = {};
|
||||
|
||||
// 加入参数选项方便用户添加非必须参数
|
||||
parameters.forEach((param: any) => {
|
||||
paramDefinitions[param.name] = param;
|
||||
});
|
||||
|
||||
function mergeIfRequiredButNotSet(target: any) {
|
||||
const needPushList = [];
|
||||
for (const key in paramDefinitions) {
|
||||
const param = paramDefinitions[key];
|
||||
|
||||
if (param.required) {
|
||||
const item = target.find((item: any) => item.key === key);
|
||||
|
||||
if (!item) {
|
||||
needPushList.push({
|
||||
key: param.name,
|
||||
value: param.defaultValue || '',
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
target.push(...needPushList);
|
||||
}
|
||||
// 自动装载需必填的参数
|
||||
mergeIfRequiredButNotSet(params4Test.value);
|
||||
|
||||
paramsOfStartNode.value = paramDefinitions;
|
||||
}
|
||||
|
||||
/** 运行流程 */
|
||||
@@ -74,27 +83,26 @@ async function goRun() {
|
||||
loading.value = true;
|
||||
error.value = null;
|
||||
testResult.value = null;
|
||||
// / 查找start节点
|
||||
const startNode = getStartNode();
|
||||
|
||||
// 查找start节点
|
||||
const startNode = getStartNode();
|
||||
// 获取参数定义
|
||||
const parameters: any[] = (startNode.data?.parameters as any[]) || [];
|
||||
const paramDefinitions: Record<string, any> = {};
|
||||
parameters.forEach((param: any) => {
|
||||
paramDefinitions[param.name] = param.dataType;
|
||||
});
|
||||
|
||||
// 参数类型转换
|
||||
const convertedParams: Record<string, any> = {};
|
||||
for (const { key, value } of params4Test.value) {
|
||||
const paramKey = key.trim();
|
||||
if (!paramKey) continue;
|
||||
|
||||
if (!paramKey) {
|
||||
continue;
|
||||
}
|
||||
let dataType = paramDefinitions[paramKey];
|
||||
if (!dataType) {
|
||||
dataType = 'String';
|
||||
}
|
||||
|
||||
try {
|
||||
convertedParams[paramKey] = convertParamValue(value, dataType);
|
||||
} catch (error: any) {
|
||||
@@ -102,13 +110,11 @@ async function goRun() {
|
||||
}
|
||||
}
|
||||
|
||||
const data = {
|
||||
// 执行测试请求
|
||||
testResult.value = await testWorkflow({
|
||||
graph: JSON.stringify(val),
|
||||
params: convertedParams,
|
||||
};
|
||||
|
||||
const response = await testWorkflow(data);
|
||||
testResult.value = response;
|
||||
});
|
||||
} catch (error: any) {
|
||||
error.value =
|
||||
error.response?.data?.message || '运行失败,请检查参数和网络连接';
|
||||
@@ -120,6 +126,7 @@ async function goRun() {
|
||||
/** 获取开始节点 */
|
||||
function getStartNode() {
|
||||
if (tinyflowRef.value) {
|
||||
// TODO @xingyu:不确定是不是这里封装了 Tinyflow,现在 .getData() 会报错;
|
||||
const val = tinyflowRef.value.getData();
|
||||
const startNode = val!.nodes.find((node: any) => node.type === 'startNode');
|
||||
if (!startNode) {
|
||||
@@ -142,8 +149,9 @@ function removeParam(index: number) {
|
||||
|
||||
/** 类型转换函数 */
|
||||
function convertParamValue(value: string, dataType: string) {
|
||||
if (value === '') return null; // 空值处理
|
||||
|
||||
if (value === '') {
|
||||
return null;
|
||||
}
|
||||
switch (dataType) {
|
||||
case 'Number': {
|
||||
const num = Number(value);
|
||||
@@ -154,8 +162,12 @@ function convertParamValue(value: string, dataType: string) {
|
||||
return String(value);
|
||||
}
|
||||
case 'Boolean': {
|
||||
if (value.toLowerCase() === 'true') return true;
|
||||
if (value.toLowerCase() === 'false') return false;
|
||||
if (value.toLowerCase() === 'true') {
|
||||
return true;
|
||||
}
|
||||
if (value.toLowerCase() === 'false') {
|
||||
return false;
|
||||
}
|
||||
throw new Error('必须为 true/false');
|
||||
}
|
||||
case 'Array':
|
||||
@@ -171,9 +183,9 @@ function convertParamValue(value: string, dataType: string) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** 表单校验 */
|
||||
async function validate() {
|
||||
// 获取最新的流程数据
|
||||
if (!workflowData.value || !tinyflowRef.value) {
|
||||
throw new Error('请设计流程');
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script lang="ts" setup>
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { AiWorkflowApi } from '#/api/ai/workflow';
|
||||
|
||||
import { Page } from '@vben/common-ui';
|
||||
|
||||
@@ -17,14 +18,14 @@ function handleRefresh() {
|
||||
gridApi.query();
|
||||
}
|
||||
|
||||
/** 创建 */
|
||||
/** 创建工作流 */
|
||||
function handleCreate() {
|
||||
router.push({
|
||||
name: 'AiWorkflowCreate',
|
||||
});
|
||||
}
|
||||
|
||||
/** 编辑 */
|
||||
/** 编辑工作流 */
|
||||
function handleEdit(row: any) {
|
||||
router.push({
|
||||
name: 'AiWorkflowCreate',
|
||||
@@ -32,17 +33,15 @@ function handleEdit(row: any) {
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除 */
|
||||
/** 删除工作流 */
|
||||
async function handleDelete(row: any) {
|
||||
const hideLoading = message.loading({
|
||||
content: $t('ui.actionMessage.deleting', [row.name]),
|
||||
duration: 0,
|
||||
});
|
||||
try {
|
||||
await deleteWorkflow(row.id as number);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
|
||||
});
|
||||
await deleteWorkflow(row.id!);
|
||||
message.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
||||
handleRefresh();
|
||||
} finally {
|
||||
hideLoading();
|
||||
@@ -70,12 +69,13 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
isHover: true,
|
||||
},
|
||||
toolbarConfig: {
|
||||
refresh: true,
|
||||
search: true,
|
||||
},
|
||||
} as VxeTableGridOptions<any>,
|
||||
} as VxeTableGridOptions<AiWorkflowApi.Workflow>,
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -9,5 +9,3 @@ export { default as MyProcessDesigner } from './designer';
|
||||
// TODO @puhui999:流程发起时,预览相关的,需要使用;
|
||||
export { default as MyProcessViewer } from './designer/index2';
|
||||
export { default as MyProcessPenal } from './penal';
|
||||
|
||||
// TODO @jason:【有个迁移的打印】【新增】流程打印,由 [@Lesan](https://gitee.com/LesanOuO) 贡献 [#816](https://gitee.com/yudaocode/yudao-ui-admin-vue3/pulls/816/)、[#1418](https://gitee.com/zhijiantianya/ruoyi-vue-pro/pulls/1418/)、[#817](https://gitee.com/yudaocode/yudao-ui-admin-vue3/pulls/817/)、[#1419](https://gitee.com/zhijiantianya/ruoyi-vue-pro/pulls/1419/)、[#1424](https://gitee.com/zhijiantianya/ruoyi-vue-pro/pulls/1424)、[#819](https://gitee.com/yudaocode/yudao-ui-admin-vue3/pulls/819)、[#821](https://gitee.com/yudaocode/yudao-ui-admin-vue3/pulls/821/)
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
<script setup lang="ts">
|
||||
import type { MentionItem } from '../modules/tinymce-plugin';
|
||||
|
||||
import { computed, onBeforeUnmount, ref, shallowRef } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import Editor from '@tinymce/tinymce-vue';
|
||||
import { Alert, Button } from 'ant-design-vue';
|
||||
|
||||
import { setupTinyPlugins } from './tinymce-plugin';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
formFields?: Array<{ field: string; title: string }>;
|
||||
}>(),
|
||||
{
|
||||
formFields: () => [],
|
||||
},
|
||||
);
|
||||
|
||||
/** TinyMCE 自托管:https://www.jianshu.com/p/59a9c3802443 */
|
||||
const tinymceScriptSrc = `${import.meta.env.VITE_BASE}tinymce/tinymce.min.js`;
|
||||
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
footer: false,
|
||||
async onOpenChange(isOpen: boolean) {
|
||||
if (!isOpen) {
|
||||
return;
|
||||
}
|
||||
modalApi.lock();
|
||||
try {
|
||||
const { template } = modalApi.getData<{
|
||||
template: string;
|
||||
}>();
|
||||
if (template !== undefined) {
|
||||
valueHtml.value = template;
|
||||
}
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
const handleConfirm = () => {
|
||||
/** 通过 setData 传递确认的数据,在父组件的 onConfirm 中获取 */
|
||||
modalApi.setData({ confirmedTemplate: valueHtml.value as string });
|
||||
modalApi.onConfirm();
|
||||
modalApi.close();
|
||||
};
|
||||
|
||||
const mentionList = computed<MentionItem[]>(() => {
|
||||
const base: MentionItem[] = [
|
||||
{ id: 'startUser', name: '发起人' },
|
||||
{ id: 'startUserDept', name: '发起人部门' },
|
||||
{ id: 'processName', name: '流程名称' },
|
||||
{ id: 'processNum', name: '流程编号' },
|
||||
{ id: 'startTime', name: '发起时间' },
|
||||
{ id: 'endTime', name: '结束时间' },
|
||||
{ id: 'processStatus', name: '流程状态' },
|
||||
{ id: 'printUser', name: '打印人' },
|
||||
{ id: 'printTime', name: '打印时间' },
|
||||
];
|
||||
|
||||
const extras: MentionItem[] = (props.formFields || []).map((it: any) => ({
|
||||
id: it.field,
|
||||
name: `[表单]${it.title}`,
|
||||
}));
|
||||
return [...base, ...extras];
|
||||
}); // 提供给 @ 自动补全的字段(默认 + 表单字段)
|
||||
|
||||
const valueHtml = ref<string>('');
|
||||
const editorRef = shallowRef<any>(); // 编辑器
|
||||
|
||||
const tinyInit = {
|
||||
height: 400,
|
||||
width: 'auto',
|
||||
menubar: false,
|
||||
plugins: 'link importcss table code preview autoresize lists ',
|
||||
toolbar:
|
||||
'undo redo | styles fontsize | bold italic underline | alignleft aligncenter alignright | link table | processrecord code preview',
|
||||
language: 'zh_CN',
|
||||
branding: false,
|
||||
statusbar: true,
|
||||
content_style:
|
||||
'body { font-family:Helvetica,Arial,sans-serif; font-size:16px }',
|
||||
setup(editor: any) {
|
||||
editorRef.value = editor;
|
||||
// 在编辑器 setup 时注册自定义插件
|
||||
setupTinyPlugins(editor, () => mentionList.value);
|
||||
},
|
||||
};
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
if (editorRef.value) {
|
||||
editorRef.value.destroy?.();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- TODO @jason:a-button 改成 Modal 自带的 onConfirm 替代;= = 我貌似试着改了下,有点问题,略奇怪 -->
|
||||
<Modal class="w-3/4" title="自定义模板">
|
||||
<div class="mb-3">
|
||||
<Alert
|
||||
message="输入 @ 可选择插入流程选项和表单选项"
|
||||
type="info"
|
||||
show-icon
|
||||
/>
|
||||
</div>
|
||||
<Editor
|
||||
v-model="valueHtml"
|
||||
:init="tinyInit"
|
||||
:tinymce-script-src="tinymceScriptSrc"
|
||||
license-key="gpl"
|
||||
/>
|
||||
<template #footer>
|
||||
<div class="flex justify-end gap-2">
|
||||
<Button @click="modalApi.onCancel()">取 消</Button>
|
||||
<Button type="primary" @click="handleConfirm">确 定</Button>
|
||||
</div>
|
||||
</template>
|
||||
</Modal>
|
||||
</template>
|
||||
@@ -1,6 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, provide, ref, watch } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
import {
|
||||
BpmAutoApproveType,
|
||||
BpmModelFormType,
|
||||
@@ -9,6 +10,7 @@ import {
|
||||
import { IconifyIcon } from '@vben/icons';
|
||||
|
||||
import {
|
||||
Button,
|
||||
Checkbox,
|
||||
Col,
|
||||
Form,
|
||||
@@ -32,6 +34,8 @@ import {
|
||||
parseFormFields,
|
||||
} from '#/views/bpm/components/simple-process-design';
|
||||
|
||||
import PrintTemplate from './custom-print-template.vue';
|
||||
|
||||
const modelData = defineModel<any>();
|
||||
|
||||
/** 自定义 ID 流程编码 */
|
||||
@@ -147,9 +151,9 @@ function handleTaskAfterTriggerEnableChange(val: boolean | number | string) {
|
||||
}
|
||||
|
||||
/** 表单字段 */
|
||||
const formField = ref<Array<{ field: string; title: string }>>([]);
|
||||
const formFields = ref<Array<{ field: string; title: string }>>([]);
|
||||
const formFieldOptions4Title = computed(() => {
|
||||
const cloneFormField = formField.value.map((item) => {
|
||||
const cloneFormField = formFields.value.map((item) => {
|
||||
return {
|
||||
label: item.title,
|
||||
value: item.field,
|
||||
@@ -171,7 +175,7 @@ const formFieldOptions4Title = computed(() => {
|
||||
return cloneFormField;
|
||||
});
|
||||
const formFieldOptions4Summary = computed(() => {
|
||||
return formField.value.map((item) => {
|
||||
return formFields.value.map((item) => {
|
||||
return {
|
||||
label: item.title,
|
||||
value: item.field,
|
||||
@@ -192,6 +196,12 @@ function initData() {
|
||||
length: 5,
|
||||
};
|
||||
}
|
||||
if (!modelData.value.printTemplateSetting) {
|
||||
modelData.value.printTemplateSetting = {
|
||||
enable: false,
|
||||
template: '',
|
||||
};
|
||||
}
|
||||
if (!modelData.value.autoApprovalType) {
|
||||
modelData.value.autoApprovalType = BpmAutoApproveType.NONE;
|
||||
}
|
||||
@@ -237,9 +247,9 @@ watch(
|
||||
parseFormFields(JSON.parse(fieldStr), result);
|
||||
});
|
||||
}
|
||||
formField.value = result;
|
||||
formFields.value = result;
|
||||
} else {
|
||||
formField.value = [];
|
||||
formFields.value = [];
|
||||
unParsedFormFields.value = [];
|
||||
}
|
||||
},
|
||||
@@ -252,6 +262,85 @@ async function validate() {
|
||||
await formRef.value?.validate();
|
||||
}
|
||||
|
||||
/** 自定义打印模板模态框 */
|
||||
const [PrintTemplateModal, printTemplateModalApi] = useVbenModal({
|
||||
connectedComponent: PrintTemplate,
|
||||
destroyOnClose: true,
|
||||
onConfirm() {
|
||||
// 会在内部模态框中设置数据,这里获取数据, 内部模态框中不能有 onConfirm 方法
|
||||
const { confirmedTemplate } = printTemplateModalApi.getData<{
|
||||
confirmedTemplate: string;
|
||||
}>();
|
||||
if (confirmedTemplate !== undefined) {
|
||||
modelData.value.printTemplateSetting.template = confirmedTemplate;
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
/** 弹出自定义打印模板弹窗 */
|
||||
const openPrintTemplateModal = () => {
|
||||
printTemplateModalApi
|
||||
.setData({ template: modelData.value.printTemplateSetting.template })
|
||||
.open();
|
||||
};
|
||||
|
||||
/** 默认的打印模板, 目前自定义模板没有引入自定义样式。 看后续是否需要 */
|
||||
const defaultTemplate = `<p style="text-align: center;font-size: 1.25rem;"><strong><span data-w-e-type="mention" data-value="流程名称" data-info="%7B%22id%22%3A%22processName%22%7D">@流程名称</span></strong></p>
|
||||
<p style="text-align: right;">打印人员:<span data-w-e-type="mention" data-info="%7B%22id%22%3A%22printUser%22%7D">@打印人</span></p>
|
||||
<p style="text-align: left;">流程编号:<span data-w-e-type="mention" data-value="流程编号" data-info="%7B%22id%22%3A%22processNum%22%7D">@流程编号</span></p>
|
||||
<p> </p>
|
||||
<table style="width: 100%; height: 72.2159px;">
|
||||
<tbody>
|
||||
<tr style="height: 36.108px;">
|
||||
<td style="width: 21.7532%; border: 1px solid;" colspan="1" rowspan="1" width="auto">发起人</td>
|
||||
<td style="width: 30.5551%; border: 1px solid;" colspan="1" rowspan="1" width="auto"><span data-w-e-type="mention" data-value="发起人" data-info="%7B%22id%22%3A%22startUser%22%7D">@发起人</span></td>
|
||||
<td style="width: 21.7532%; border: 1px solid;" colspan="1" rowspan="1" width="auto">发起时间</td>
|
||||
<td style="width: 26.0284%; border: 1px solid;" colspan="1" rowspan="1" width="auto"><span data-w-e-type="mention" data-value="发起时间" data-info="%7B%22id%22%3A%22startTime%22%7D">@发起时间</span></td>
|
||||
</tr>
|
||||
<tr style="height: 36.108px;">
|
||||
<td style="width: 21.7532%; border: 1px solid;" colspan="1" rowspan="1" width="auto">所属部门</td>
|
||||
<td style="width: 30.5551%; border: 1px solid;" colspan="1" rowspan="1" width="auto"><span data-w-e-type="mention" data-w-e-is-void="" data-w-e-is-inline="" data-value="发起人部门" data-info="%7B%22id%22%3A%22startUserDept%22%7D">@发起人部门</span></td>
|
||||
<td style="width: 21.7532%; border: 1px solid;" colspan="1" rowspan="1" width="auto">流程状态</td>
|
||||
<td style="width: 26.0284%; border: 1px solid;" colspan="1" rowspan="1" width="auto"><span data-w-e-type="mention" data-value="流程状态" data-info="%7B%22id%22%3A%22processStatus%22%7D">@流程状态</span></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p> </p>
|
||||
<div contenteditable="false" data-w-e-type="process-record" data-w-e-is-void="">
|
||||
<table class="process-record-table" style="width: 100%; border-collapse: collapse; border: 1px solid;">
|
||||
<tr>
|
||||
<td style="width: 100%; border: 1px solid; text-align: center;" colspan="2">流程记录</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: 25%; border: 1px solid;">节点</td>
|
||||
<td style="width: 75%; border: 1px solid;">操作</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<p> </p>`;
|
||||
|
||||
const printTemplateEnable = computed<boolean>({
|
||||
get() {
|
||||
return !!modelData.value?.printTemplateSetting?.enable;
|
||||
},
|
||||
set(val: boolean) {
|
||||
if (!modelData.value.printTemplateSetting) {
|
||||
modelData.value.printTemplateSetting = {
|
||||
enable: false,
|
||||
template: '',
|
||||
};
|
||||
}
|
||||
modelData.value.printTemplateSetting.enable = val;
|
||||
},
|
||||
}); // 自定义打印模板开关
|
||||
|
||||
function handlePrintTemplateEnableChange(checked: any) {
|
||||
const val = !!checked;
|
||||
if (val && !modelData.value.printTemplateSetting.template) {
|
||||
modelData.value.printTemplateSetting.template = defaultTemplate;
|
||||
}
|
||||
}
|
||||
|
||||
defineExpose({ initData, validate });
|
||||
</script>
|
||||
<template>
|
||||
@@ -515,6 +604,27 @@ defineExpose({ initData, validate });
|
||||
</Col>
|
||||
</Row>
|
||||
</FormItem>
|
||||
<!-- TODO @jason:这里有个 “自定义打印模板” -->
|
||||
<FormItem class="mb-5" label="自定义打印模板">
|
||||
<div class="flex w-full flex-col">
|
||||
<div class="flex items-center">
|
||||
<Switch
|
||||
v-model:checked="printTemplateEnable"
|
||||
@change="handlePrintTemplateEnableChange"
|
||||
/>
|
||||
<Button
|
||||
v-if="printTemplateEnable"
|
||||
class="ml-2 flex items-center"
|
||||
type="link"
|
||||
@click="openPrintTemplateModal"
|
||||
>
|
||||
<template #icon>
|
||||
<IconifyIcon icon="lucide:pencil" />
|
||||
</template>
|
||||
编辑模板
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</FormItem>
|
||||
<PrintTemplateModal :form-fields="formFields" />
|
||||
</Form>
|
||||
</template>
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
/** TinyMCE 自定义功能:
|
||||
* - processrecord 按钮:插入流程记录占位元素
|
||||
* - @ 自动补全:插入 mention 占位元素
|
||||
*/
|
||||
|
||||
// @ts-ignore TinyMCE 全局或通过打包器提供
|
||||
import type { Editor } from 'tinymce';
|
||||
|
||||
export interface MentionItem {
|
||||
id: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
/** 在编辑器 setup 回调中注册流程记录按钮和 @ 自动补全 */
|
||||
export function setupTinyPlugins(
|
||||
editor: Editor,
|
||||
getMentionList: () => MentionItem[],
|
||||
) {
|
||||
// 按钮:流程记录
|
||||
editor.ui.registry.addButton('processrecord', {
|
||||
text: '流程记录',
|
||||
tooltip: '插入流程记录占位',
|
||||
onAction: () => {
|
||||
// 流程记录占位显示, 仅用于显示。process-print.vue 组件中会替换掉
|
||||
editor.insertContent(
|
||||
[
|
||||
'<div data-w-e-type="process-record" data-w-e-is-void contenteditable="false">',
|
||||
'<table class="process-record-table" style="width: 100%; border-collapse: collapse; border: 1px solid;">',
|
||||
'<tr><td style="width: 100%; border: 1px solid; text-align: center;" colspan="2">流程记录</td></tr>',
|
||||
'<tr>',
|
||||
'<td style="width: 25%; border: 1px solid;">节点</td>',
|
||||
'<td style="width: 75%; border: 1px solid;">操作</td>',
|
||||
'</tr>',
|
||||
'</table>',
|
||||
'</div>',
|
||||
].join(''),
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
// @ 自动补全
|
||||
editor.ui.registry.addAutocompleter('bpmMention', {
|
||||
trigger: '@',
|
||||
minChars: 0,
|
||||
columns: 1,
|
||||
fetch: (
|
||||
pattern: string,
|
||||
_maxResults: number,
|
||||
_fetchOptions: Record<string, any>,
|
||||
) => {
|
||||
const list = getMentionList();
|
||||
const keyword = (pattern || '').toLowerCase().trim();
|
||||
const data = list
|
||||
.filter((i) => i.name.toLowerCase().includes(keyword))
|
||||
.map((i) => ({
|
||||
value: i.id,
|
||||
text: i.name,
|
||||
}));
|
||||
return Promise.resolve(data);
|
||||
},
|
||||
onAction: (
|
||||
autocompleteApi: any,
|
||||
rng: Range,
|
||||
value: string,
|
||||
_meta: Record<string, any>,
|
||||
) => {
|
||||
const list = getMentionList();
|
||||
const item = list.find((i) => i.id === value);
|
||||
const name = item ? item.name : value;
|
||||
const info = encodeURIComponent(JSON.stringify({ id: value }));
|
||||
editor.selection.setRng(rng);
|
||||
editor.insertContent(
|
||||
`<span data-w-e-type="mention" data-info="${info}">@${name}</span>`,
|
||||
);
|
||||
autocompleteApi.hide();
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -34,7 +34,7 @@ import { registerComponent } from '#/utils';
|
||||
|
||||
import ProcessInstanceBpmnViewer from './modules/bpm-viewer.vue';
|
||||
import ProcessInstanceOperationButton from './modules/operation-button.vue';
|
||||
import ProcessssPrint from './modules/processs-print.vue';
|
||||
import ProcessssPrint from './modules/process-print.vue';
|
||||
import ProcessInstanceSimpleViewer from './modules/simple-bpm-viewer.vue';
|
||||
import BpmProcessInstanceTaskList from './modules/task-list.vue';
|
||||
import ProcessInstanceTimeline from './modules/time-line.vue';
|
||||
|
||||
@@ -143,7 +143,7 @@ function initPrintDataMap() {
|
||||
printDataMap.value.printTime = printTime.value;
|
||||
}
|
||||
|
||||
/** 获取打印模板 HTML (TODO 需求实现配置打印模板) */
|
||||
/** 获取打印模板 HTML */
|
||||
function getPrintTemplateHTML() {
|
||||
if (!printData.value?.printTemplateHtml) return '';
|
||||
|
||||
@@ -153,16 +153,6 @@ function getPrintTemplateHTML() {
|
||||
'text/html',
|
||||
);
|
||||
|
||||
// table 添加 border
|
||||
const tables = doc.querySelectorAll('table');
|
||||
tables.forEach((item) => {
|
||||
item.setAttribute('border', '1');
|
||||
item.setAttribute(
|
||||
'style',
|
||||
`${item.getAttribute('style') || ''}border-collapse:collapse;`,
|
||||
);
|
||||
});
|
||||
|
||||
// 替换 mentions
|
||||
const mentions = doc.querySelectorAll('[data-w-e-type="mention"]');
|
||||
mentions.forEach((item) => {
|
||||
@@ -181,26 +171,23 @@ function getPrintTemplateHTML() {
|
||||
|
||||
if (processRecords.length > 0) {
|
||||
// 构建流程记录 html
|
||||
processRecordTable.setAttribute('border', '1');
|
||||
processRecordTable.setAttribute(
|
||||
'style',
|
||||
'width:100%;border-collapse:collapse;',
|
||||
);
|
||||
processRecordTable.setAttribute('class', 'w-full border-collapse');
|
||||
|
||||
const headTr = document.createElement('tr');
|
||||
const headTd = document.createElement('td');
|
||||
headTd.setAttribute('colspan', '2');
|
||||
headTd.setAttribute('width', 'auto');
|
||||
headTd.setAttribute('style', 'text-align: center;');
|
||||
headTd.innerHTML = '流程节点';
|
||||
headTd.setAttribute('class', 'border border-black p-1.5 text-center');
|
||||
headTd.innerHTML = '流程记录';
|
||||
headTr.append(headTd);
|
||||
processRecordTable.append(headTr);
|
||||
|
||||
printData.value?.tasks.forEach((item) => {
|
||||
const tr = document.createElement('tr');
|
||||
const td1 = document.createElement('td');
|
||||
td1.setAttribute('class', 'border border-black p-1.5');
|
||||
td1.innerHTML = item.name;
|
||||
const td2 = document.createElement('td');
|
||||
td2.setAttribute('class', 'border border-black p-1.5');
|
||||
td2.innerHTML = item.description;
|
||||
tr.append(td1);
|
||||
tr.append(td2);
|
||||
@@ -229,35 +216,34 @@ function getPrintTemplateHTML() {
|
||||
<h2 class="mb-3 text-center text-xl font-bold">
|
||||
{{ printData.processInstance.name }}
|
||||
</h2>
|
||||
<div class="mb-2 text-right text-sm">
|
||||
{{ `打印人员: ${userName}` }}
|
||||
</div>
|
||||
<div class="mb-2 flex justify-between text-sm">
|
||||
<div>
|
||||
{{ `流程编号: ${printData.processInstance.id}` }}
|
||||
</div>
|
||||
<div>{{ `打印时间: ${printTime}` }}</div>
|
||||
<div>
|
||||
{{ `打印人员: ${userName}` }}
|
||||
</div>
|
||||
</div>
|
||||
<table class="mt-3 w-full border-collapse border border-gray-400">
|
||||
<table class="mt-3 w-full border-collapse">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="w-1/4 border border-gray-400 p-1.5">发起人</td>
|
||||
<td class="w-1/4 border border-gray-400 p-1.5">
|
||||
<td class="w-1/4 border border-black p-1.5">发起人</td>
|
||||
<td class="w-1/4 border border-black p-1.5">
|
||||
{{ printData.processInstance.startUser?.nickname }}
|
||||
</td>
|
||||
<td class="w-1/4 border border-gray-400 p-1.5">发起时间</td>
|
||||
<td class="w-1/4 border border-gray-400 p-1.5">
|
||||
<!-- TODO @jason:这里会告警呢 -->
|
||||
<td class="w-1/4 border border-black p-1.5">发起时间</td>
|
||||
<td class="w-1/4 border border-black p-1.5">
|
||||
<!-- TODO @jason:这里会告警呢 TODO @芋艿 我这边不会有警告呀 -->
|
||||
{{ formatDate(printData.processInstance.startTime) }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="w-1/4 border border-gray-400 p-1.5">所属部门</td>
|
||||
<td class="w-1/4 border border-gray-400 p-1.5">
|
||||
<td class="w-1/4 border border-black p-1.5">所属部门</td>
|
||||
<td class="w-1/4 border border-black p-1.5">
|
||||
{{ printData.processInstance.startUser?.deptName }}
|
||||
</td>
|
||||
<td class="w-1/4 border border-gray-400 p-1.5">流程状态</td>
|
||||
<td class="w-1/4 border border-gray-400 p-1.5">
|
||||
<td class="w-1/4 border border-black p-1.5">流程状态</td>
|
||||
<td class="w-1/4 border border-black p-1.5">
|
||||
{{
|
||||
getDictLabel(
|
||||
DICT_TYPE.BPM_PROCESS_INSTANCE_STATUS,
|
||||
@@ -268,33 +254,33 @@ function getPrintTemplateHTML() {
|
||||
</tr>
|
||||
<tr>
|
||||
<td
|
||||
class="w-full border border-gray-400 p-1.5 text-center"
|
||||
class="w-full border border-black p-1.5 text-center"
|
||||
colspan="4"
|
||||
>
|
||||
<h4>表单内容</h4>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-for="item in formFields" :key="item.id">
|
||||
<td class="w-1/5 border border-gray-400 p-1.5">
|
||||
<td class="w-1/5 border border-black p-1.5">
|
||||
{{ item.name }}
|
||||
</td>
|
||||
<td class="w-4/5 border border-gray-400 p-1.5" colspan="3">
|
||||
<td class="w-4/5 border border-black p-1.5" colspan="3">
|
||||
<div v-html="item.html"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td
|
||||
class="w-full border border-gray-400 p-1.5 text-center"
|
||||
class="w-full border border-black p-1.5 text-center"
|
||||
colspan="4"
|
||||
>
|
||||
<h4>流程节点</h4>
|
||||
<h4>流程记录</h4>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-for="item in printData.tasks" :key="item.id">
|
||||
<td class="w-1/5 border border-gray-400 p-1.5">
|
||||
<td class="w-1/5 border border-black p-1.5">
|
||||
{{ item.name }}
|
||||
</td>
|
||||
<td class="w-4/5 border border-gray-400 p-1.5" colspan="3">
|
||||
<td class="w-4/5 border border-black p-1.5" colspan="3">
|
||||
{{ item.description }}
|
||||
<div v-if="item.signPicUrl && item.signPicUrl.length > 0">
|
||||
<img class="h-10 w-[90px]" :src="item.signPicUrl" alt="" />
|
||||
@@ -113,7 +113,7 @@ async function handleCreateContactBusinessList(businessIds: number[]) {
|
||||
const data = {
|
||||
contactId: props.bizId,
|
||||
businessIds,
|
||||
} as CrmContactApi.ContactBusinessReq;
|
||||
} as CrmContactApi.ContactBusinessReqVO;
|
||||
await createContactBusinessList(data);
|
||||
handleRefresh();
|
||||
}
|
||||
|
||||
@@ -36,7 +36,6 @@ const permissionListRef = ref<InstanceType<typeof PermissionList>>(); // 团队
|
||||
const [Descriptions] = useDescription({
|
||||
bordered: false,
|
||||
column: 4,
|
||||
class: 'mx-4',
|
||||
schema: useDetailSchema(),
|
||||
});
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ const [SystemDescriptions] = useDescription({
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="p-4">
|
||||
<div>
|
||||
<BaseDescriptions :data="clue" />
|
||||
<Divider />
|
||||
<SystemDescriptions :data="clue" />
|
||||
|
||||
@@ -100,7 +100,7 @@ async function handleCreateBusinessContactList(contactIds: number[]) {
|
||||
const data = {
|
||||
businessId: props.bizId,
|
||||
contactIds,
|
||||
} as CrmContactApi.BusinessContactReq;
|
||||
} as CrmContactApi.BusinessContactReqVO;
|
||||
await createBusinessContactList(data);
|
||||
handleRefresh();
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user