Compare commits
151 Commits
Author | SHA1 | Date |
---|---|---|
![]() |
06ea290306 | |
![]() |
8e4f52c8aa | |
![]() |
433d12ed35 | |
![]() |
f317508d39 | |
![]() |
b55c291af1 | |
![]() |
9301962e12 | |
![]() |
367a5b9924 | |
![]() |
bc2b71baa3 | |
![]() |
b0d7b177be | |
![]() |
566d3bdf7c | |
![]() |
adbf793e79 | |
![]() |
cf6c4c9aae | |
![]() |
ffaf85c8f3 | |
![]() |
2cc78f925f | |
![]() |
93f0eea4e7 | |
![]() |
4af5931e92 | |
![]() |
80e0d05f4e | |
![]() |
8e372fa7da | |
![]() |
3b2b0d5438 | |
![]() |
fb8179fef2 | |
![]() |
ebac48524d | |
![]() |
807451bf2a | |
![]() |
8fdbbfad22 | |
![]() |
1d5bfaac5a | |
![]() |
f5d9d7596a | |
![]() |
58e3941810 | |
![]() |
3ad433a50b | |
![]() |
8ac2db5b7c | |
![]() |
a441dcebae | |
![]() |
b546ea8720 | |
![]() |
90895db1e7 | |
![]() |
2dfa34d096 | |
![]() |
ff4704d5ea | |
![]() |
6ddfbd84b0 | |
![]() |
1e6417f95b | |
![]() |
e147a9d2fd | |
![]() |
cb1b441f7b | |
![]() |
43c8ce2d7d | |
![]() |
271546a98b | |
![]() |
4be6d26375 | |
![]() |
2920dabb99 | |
![]() |
5b50a91529 | |
![]() |
f0e09f78e8 | |
![]() |
133f90f34e | |
![]() |
4efebb8c0b | |
![]() |
9ce0df88ae | |
![]() |
5076e3ff72 | |
![]() |
7fb9f6e064 | |
![]() |
2a655a04c9 | |
![]() |
5eaeab0cff | |
![]() |
3cf0c0eb04 | |
![]() |
0c371a78dc | |
![]() |
ab7e363279 | |
![]() |
218f28f35c | |
![]() |
b8c66b23f9 | |
![]() |
d7397f28a0 | |
![]() |
9cac5a2937 | |
![]() |
8eae74879b | |
![]() |
ccf9c3fd53 | |
![]() |
6c425b4dbc | |
![]() |
9fc594434f | |
![]() |
63ce6f5669 | |
![]() |
9ef75f4fbe | |
![]() |
ce1f3735ad | |
![]() |
07d15f5c88 | |
![]() |
849f2becd8 | |
![]() |
d48b78a462 | |
![]() |
8e4ea3ca44 | |
![]() |
55061b73de | |
![]() |
73bddd119e | |
![]() |
e7fc44715b | |
![]() |
6d99bf3a46 | |
![]() |
02f1bd3251 | |
![]() |
9a305e6cbd | |
![]() |
990ae4463a | |
![]() |
3f1c3a283f | |
![]() |
229a6f017a | |
![]() |
93290bf441 | |
![]() |
c64be886b4 | |
![]() |
5f56b14733 | |
![]() |
9d80b9fc71 | |
![]() |
1433a0980d | |
![]() |
3afd957713 | |
![]() |
510ec12582 | |
![]() |
2e6575f368 | |
![]() |
8d660404dc | |
![]() |
1f155fa7c5 | |
![]() |
2166ce3e4e | |
![]() |
ec14751aeb | |
![]() |
aa6639a108 | |
![]() |
32ee1b11ec | |
![]() |
2c687266b2 | |
![]() |
38daaa2934 | |
![]() |
5a31e80c2d | |
![]() |
ff62e4c368 | |
![]() |
8d17d8d915 | |
![]() |
787f5168ad | |
![]() |
423bfffbea | |
![]() |
33cec7caee | |
![]() |
93c0d9e486 | |
![]() |
8b89a32813 | |
![]() |
b93e22c45a | |
![]() |
0694eb2b29 | |
![]() |
193f5b6512 | |
![]() |
cb3f96683f | |
![]() |
b3942bb8ff | |
![]() |
b3a2d29a3b | |
![]() |
f242f1c37d | |
![]() |
06ffdf164a | |
![]() |
5b75e5e917 | |
![]() |
fad0b49841 | |
![]() |
260e45cd7b | |
![]() |
8a7239ce24 | |
![]() |
e319888240 | |
![]() |
83010b6590 | |
![]() |
a24f08cbb0 | |
![]() |
f9407ca8bc | |
![]() |
7c2c249e5d | |
![]() |
1cad71f3bf | |
![]() |
0b47648650 | |
![]() |
f14954f7e2 | |
![]() |
7526ff5b87 | |
![]() |
b41ac68e06 | |
![]() |
dcffb9bbe3 | |
![]() |
f763ad2855 | |
![]() |
7b7402b986 | |
![]() |
7b06bd27b3 | |
![]() |
e6f4cf5660 | |
![]() |
c447145d62 | |
![]() |
27ad777c2c | |
![]() |
347f0ab852 | |
![]() |
df3215fef1 | |
![]() |
992f0bd2f0 | |
![]() |
4797791935 | |
![]() |
7031dbebe6 | |
![]() |
1575619d53 | |
![]() |
27a7e84def | |
![]() |
fc9ea347ca | |
![]() |
1a9b0509d5 | |
![]() |
a442eab9ea | |
![]() |
d2a2227c4c | |
![]() |
2cccbc949f | |
![]() |
4620ede9b9 | |
![]() |
73a73ac312 | |
![]() |
b480eb54c1 | |
![]() |
380a24358c | |
![]() |
ff53153782 | |
![]() |
8c2f982ab6 | |
![]() |
5edccd3efe | |
![]() |
e88c17f7e2 | |
![]() |
6ce1363dea |
|
@ -49,3 +49,4 @@ vite.config.ts.*
|
|||
*.sln
|
||||
*.sw?
|
||||
.history
|
||||
.cursor
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 40 KiB |
|
@ -21,7 +21,8 @@
|
|||
// CSS 变量提示
|
||||
"vunguyentuan.vscode-css-variables",
|
||||
// 在 package.json 中显示 PNPM catalog 的版本
|
||||
"antfu.pnpm-catalog-lens"
|
||||
"antfu.pnpm-catalog-lens",
|
||||
"augment.vscode-augment"
|
||||
],
|
||||
"unwantedRecommendations": [
|
||||
// 和 volar 冲突
|
||||
|
|
24
README.md
24
README.md
|
@ -41,24 +41,24 @@
|
|||
|
||||
| 框架 | 说明 | 版本 |
|
||||
| --- | --- | --- |
|
||||
| [Vue](https://staging-cn.vuejs.org/) | vue框架 | 3.5.13 |
|
||||
| [Vite](https://cn.vitejs.dev//) | 开发与构建工具 | 6.2.5 |
|
||||
| [Vue](https://staging-cn.vuejs.org/) | vue框架 | 3.5.17 |
|
||||
| [Vite](https://cn.vitejs.dev//) | 开发与构建工具 | 7.1.2 |
|
||||
| [Ant Design Vue](https://www.antdv.com/) | Ant Design Vue | 4.2.6 |
|
||||
| [Element Plus](https://element-plus.org/zh-CN/) | Element Plus | 2.9.7 |
|
||||
| [Naive UI](https://www.naiveui.com/) | Naive UI | 2.41.0 |
|
||||
| [Element Plus](https://element-plus.org/zh-CN/) | Element Plus | 2.10.2 |
|
||||
| [Naive UI](https://www.naiveui.com/) | Naive UI | 2.42.0 |
|
||||
| [TypeScript](https://www.typescriptlang.org/docs/) | JavaScript 超集 | 5.8.3 |
|
||||
| [pinia](https://pinia.vuejs.org/) | Vue 存储库替代 vuex5 | 2.3.1 |
|
||||
| [vueuse](https://vueuse.org/) | 常用工具集 | 12.8.2 |
|
||||
| [vue-i18n](https://kazupon.github.io/vue-i18n/zh/introduction.html/) | 国际化 | 11.1.3 |
|
||||
| [vue-router](https://router.vuejs.org/) | Vue 路由 | 4.5.0 |
|
||||
| [pinia](https://pinia.vuejs.org/) | Vue 存储库替代 vuex5 | 3.0.3 |
|
||||
| [vueuse](https://vueuse.org/) | 常用工具集 | 13.4.0 |
|
||||
| [vue-i18n](https://kazupon.github.io/vue-i18n/zh/introduction.html/) | 国际化 | 11.1.7 |
|
||||
| [vue-router](https://router.vuejs.org/) | Vue 路由 | 4.5.1 |
|
||||
| [Tailwind CSS](https://tailwindcss.com/) | 原子 CSS | 3.4.17 |
|
||||
| [Iconify](https://icon-sets.iconify.design/) | 在线图标库 | 2.2.324 |
|
||||
| [Iconify](https://icon-sets.iconify.design/) | 在线图标库 | 2.2.354 |
|
||||
| [TinyMCE](https://www.tiny.cloud/) | 富文本编辑器 | 6.1.0 |
|
||||
| [Echarts](https://echarts.apache.org/) | 图表库 | 5.6.0 |
|
||||
| [axios](https://axios-http.com/) | http客户端 | 1.8.4 |
|
||||
| [axios](https://axios-http.com/) | http客户端 | 1.10.0 |
|
||||
| [dayjs](https://day.js.org/) | 日期处理库 | 1.11.13 |
|
||||
| [vee-validate](https://vee-validate.logaretm.com/) | 表单验证 | 4.15.0 |
|
||||
| [zod](https://zod.dev/) | 数据验证 | 3.24.2 |
|
||||
| [vee-validate](https://vee-validate.logaretm.com/) | 表单验证 | 4.15.1 |
|
||||
| [zod](https://zod.dev/) | 数据验证 | 3.25.67 |
|
||||
|
||||
## 🔥 后端架构
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import { eventHandler } from 'h3';
|
||||
import { verifyAccessToken } from '~/utils/jwt-utils';
|
||||
import { unAuthorizedResponse } from '~/utils/response';
|
||||
import { MOCK_CODES } from '~/utils/mock-data';
|
||||
import { unAuthorizedResponse, useResponseSuccess } from '~/utils/response';
|
||||
|
||||
export default eventHandler((event) => {
|
||||
const userinfo = verifyAccessToken(event);
|
||||
|
|
|
@ -1,9 +1,15 @@
|
|||
import { defineEventHandler, readBody, setResponseStatus } from 'h3';
|
||||
import {
|
||||
clearRefreshTokenCookie,
|
||||
setRefreshTokenCookie,
|
||||
} from '~/utils/cookie-utils';
|
||||
import { generateAccessToken, generateRefreshToken } from '~/utils/jwt-utils';
|
||||
import { forbiddenResponse } from '~/utils/response';
|
||||
import { MOCK_USERS } from '~/utils/mock-data';
|
||||
import {
|
||||
forbiddenResponse,
|
||||
useResponseError,
|
||||
useResponseSuccess,
|
||||
} from '~/utils/response';
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
const { password, username } = await readBody(event);
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
import { defineEventHandler } from 'h3';
|
||||
import {
|
||||
clearRefreshTokenCookie,
|
||||
getRefreshTokenFromCookie,
|
||||
} from '~/utils/cookie-utils';
|
||||
import { useResponseSuccess } from '~/utils/response';
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
const refreshToken = getRefreshTokenFromCookie(event);
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
import { defineEventHandler } from 'h3';
|
||||
import {
|
||||
clearRefreshTokenCookie,
|
||||
getRefreshTokenFromCookie,
|
||||
setRefreshTokenCookie,
|
||||
} from '~/utils/cookie-utils';
|
||||
import { verifyRefreshToken } from '~/utils/jwt-utils';
|
||||
import { generateAccessToken, verifyRefreshToken } from '~/utils/jwt-utils';
|
||||
import { MOCK_USERS } from '~/utils/mock-data';
|
||||
import { forbiddenResponse } from '~/utils/response';
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
import { eventHandler, setHeader } from 'h3';
|
||||
import { verifyAccessToken } from '~/utils/jwt-utils';
|
||||
import { unAuthorizedResponse } from '~/utils/response';
|
||||
|
||||
export default eventHandler(async (event) => {
|
||||
const userinfo = verifyAccessToken(event);
|
||||
if (!userinfo) {
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import { eventHandler } from 'h3';
|
||||
import { verifyAccessToken } from '~/utils/jwt-utils';
|
||||
import { unAuthorizedResponse } from '~/utils/response';
|
||||
import { MOCK_MENUS } from '~/utils/mock-data';
|
||||
import { unAuthorizedResponse, useResponseSuccess } from '~/utils/response';
|
||||
|
||||
export default eventHandler(async (event) => {
|
||||
const userinfo = verifyAccessToken(event);
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
import { eventHandler, getQuery, setResponseStatus } from 'h3';
|
||||
import { useResponseError } from '~/utils/response';
|
||||
|
||||
export default eventHandler((event) => {
|
||||
const { status } = getQuery(event);
|
||||
setResponseStatus(event, Number(status));
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { eventHandler } from 'h3';
|
||||
import { verifyAccessToken } from '~/utils/jwt-utils';
|
||||
import {
|
||||
sleep,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { eventHandler } from 'h3';
|
||||
import { verifyAccessToken } from '~/utils/jwt-utils';
|
||||
import {
|
||||
sleep,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { eventHandler } from 'h3';
|
||||
import { verifyAccessToken } from '~/utils/jwt-utils';
|
||||
import {
|
||||
sleep,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { faker } from '@faker-js/faker';
|
||||
import { eventHandler } from 'h3';
|
||||
import { verifyAccessToken } from '~/utils/jwt-utils';
|
||||
import { unAuthorizedResponse, useResponseSuccess } from '~/utils/response';
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { eventHandler } from 'h3';
|
||||
import { verifyAccessToken } from '~/utils/jwt-utils';
|
||||
import { MOCK_MENU_LIST } from '~/utils/mock-data';
|
||||
import { unAuthorizedResponse, useResponseSuccess } from '~/utils/response';
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { eventHandler, getQuery } from 'h3';
|
||||
import { verifyAccessToken } from '~/utils/jwt-utils';
|
||||
import { MOCK_MENU_LIST } from '~/utils/mock-data';
|
||||
import { unAuthorizedResponse } from '~/utils/response';
|
||||
import { unAuthorizedResponse, useResponseSuccess } from '~/utils/response';
|
||||
|
||||
const namesMap: Record<string, any> = {};
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { eventHandler, getQuery } from 'h3';
|
||||
import { verifyAccessToken } from '~/utils/jwt-utils';
|
||||
import { MOCK_MENU_LIST } from '~/utils/mock-data';
|
||||
import { unAuthorizedResponse } from '~/utils/response';
|
||||
import { unAuthorizedResponse, useResponseSuccess } from '~/utils/response';
|
||||
|
||||
const pathMap: Record<string, any> = { '/': 0 };
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { faker } from '@faker-js/faker';
|
||||
import { eventHandler, getQuery } from 'h3';
|
||||
import { verifyAccessToken } from '~/utils/jwt-utils';
|
||||
import { getMenuIds, MOCK_MENU_LIST } from '~/utils/mock-data';
|
||||
import { unAuthorizedResponse, usePageResponseSuccess } from '~/utils/response';
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
import { faker } from '@faker-js/faker';
|
||||
import { eventHandler, getQuery } from 'h3';
|
||||
import { verifyAccessToken } from '~/utils/jwt-utils';
|
||||
import { unAuthorizedResponse, usePageResponseSuccess } from '~/utils/response';
|
||||
import {
|
||||
sleep,
|
||||
unAuthorizedResponse,
|
||||
usePageResponseSuccess,
|
||||
} from '~/utils/response';
|
||||
|
||||
function generateMockDataList(count: number) {
|
||||
const dataList = [];
|
||||
|
@ -44,30 +49,69 @@ export default eventHandler(async (event) => {
|
|||
await sleep(600);
|
||||
|
||||
const { page, pageSize, sortBy, sortOrder } = getQuery(event);
|
||||
// 规范化分页参数,处理 string[]
|
||||
const pageRaw = Array.isArray(page) ? page[0] : page;
|
||||
const pageSizeRaw = Array.isArray(pageSize) ? pageSize[0] : pageSize;
|
||||
const pageNumber = Math.max(
|
||||
1,
|
||||
Number.parseInt(String(pageRaw ?? '1'), 10) || 1,
|
||||
);
|
||||
const pageSizeNumber = Math.min(
|
||||
100,
|
||||
Math.max(1, Number.parseInt(String(pageSizeRaw ?? '10'), 10) || 10),
|
||||
);
|
||||
const listData = structuredClone(mockData);
|
||||
if (sortBy && Reflect.has(listData[0], sortBy as string)) {
|
||||
|
||||
// 规范化 query 入参,兼容 string[]
|
||||
const sortKeyRaw = Array.isArray(sortBy) ? sortBy[0] : sortBy;
|
||||
const sortOrderRaw = Array.isArray(sortOrder) ? sortOrder[0] : sortOrder;
|
||||
// 检查 sortBy 是否是 listData 元素的合法属性键
|
||||
if (
|
||||
typeof sortKeyRaw === 'string' &&
|
||||
listData[0] &&
|
||||
Object.prototype.hasOwnProperty.call(listData[0], sortKeyRaw)
|
||||
) {
|
||||
// 定义数组元素的类型
|
||||
type ItemType = (typeof listData)[0];
|
||||
const sortKey = sortKeyRaw as keyof ItemType; // 将 sortBy 断言为合法键
|
||||
const isDesc = sortOrderRaw === 'desc';
|
||||
listData.sort((a, b) => {
|
||||
if (sortOrder === 'asc') {
|
||||
if (sortBy === 'price') {
|
||||
return (
|
||||
Number.parseFloat(a[sortBy as string]) -
|
||||
Number.parseFloat(b[sortBy as string])
|
||||
);
|
||||
const aValue = a[sortKey] as unknown;
|
||||
const bValue = b[sortKey] as unknown;
|
||||
|
||||
let result = 0;
|
||||
|
||||
if (typeof aValue === 'number' && typeof bValue === 'number') {
|
||||
result = aValue - bValue;
|
||||
} else if (aValue instanceof Date && bValue instanceof Date) {
|
||||
result = aValue.getTime() - bValue.getTime();
|
||||
} else if (typeof aValue === 'boolean' && typeof bValue === 'boolean') {
|
||||
if (aValue === bValue) {
|
||||
result = 0;
|
||||
} else {
|
||||
return a[sortBy as string] > b[sortBy as string] ? 1 : -1;
|
||||
result = aValue ? 1 : -1;
|
||||
}
|
||||
} else {
|
||||
if (sortBy === 'price') {
|
||||
return (
|
||||
Number.parseFloat(b[sortBy as string]) -
|
||||
Number.parseFloat(a[sortBy as string])
|
||||
);
|
||||
} else {
|
||||
return a[sortBy as string] < b[sortBy as string] ? 1 : -1;
|
||||
}
|
||||
const aStr = String(aValue);
|
||||
const bStr = String(bValue);
|
||||
const aNum = Number(aStr);
|
||||
const bNum = Number(bStr);
|
||||
result =
|
||||
Number.isFinite(aNum) && Number.isFinite(bNum)
|
||||
? aNum - bNum
|
||||
: aStr.localeCompare(bStr, undefined, {
|
||||
numeric: true,
|
||||
sensitivity: 'base',
|
||||
});
|
||||
}
|
||||
|
||||
return isDesc ? -result : result;
|
||||
});
|
||||
}
|
||||
|
||||
return usePageResponseSuccess(page as string, pageSize as string, listData);
|
||||
return usePageResponseSuccess(
|
||||
String(pageNumber),
|
||||
String(pageSizeNumber),
|
||||
listData,
|
||||
);
|
||||
});
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
import { defineEventHandler } from 'h3';
|
||||
|
||||
export default defineEventHandler(() => 'Test get handler');
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
import { defineEventHandler } from 'h3';
|
||||
|
||||
export default defineEventHandler(() => 'Test post handler');
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { eventHandler } from 'h3';
|
||||
import { verifyAccessToken } from '~/utils/jwt-utils';
|
||||
import { unAuthorizedResponse } from '~/utils/response';
|
||||
import { unAuthorizedResponse, useResponseSuccess } from '~/utils/response';
|
||||
|
||||
export default eventHandler((event) => {
|
||||
const userinfo = verifyAccessToken(event);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { eventHandler } from 'h3';
|
||||
import { verifyAccessToken } from '~/utils/jwt-utils';
|
||||
import { unAuthorizedResponse } from '~/utils/response';
|
||||
import { unAuthorizedResponse, useResponseSuccess } from '~/utils/response';
|
||||
|
||||
export default eventHandler((event) => {
|
||||
const userinfo = verifyAccessToken(event);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { defineEventHandler } from 'h3';
|
||||
import { forbiddenResponse, sleep } from '~/utils/response';
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { defineEventHandler } from 'h3';
|
||||
|
||||
export default defineEventHandler(() => {
|
||||
return `
|
||||
<h1>Hello Vben Admin</h1>
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import type { EventHandlerRequest, H3Event } from 'h3';
|
||||
|
||||
import { deleteCookie, getCookie, setCookie } from 'h3';
|
||||
|
||||
export function clearRefreshTokenCookie(event: H3Event<EventHandlerRequest>) {
|
||||
deleteCookie(event, 'jwt', {
|
||||
httpOnly: true,
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
import type { EventHandlerRequest, H3Event } from 'h3';
|
||||
|
||||
import type { UserInfo } from './mock-data';
|
||||
|
||||
import { getHeader } from 'h3';
|
||||
import jwt from 'jsonwebtoken';
|
||||
|
||||
import { UserInfo } from './mock-data';
|
||||
import { MOCK_USERS } from './mock-data';
|
||||
|
||||
// TODO: Replace with your own secret key
|
||||
const ACCESS_TOKEN_SECRET = 'access_token_secret';
|
||||
|
@ -31,12 +34,22 @@ export function verifyAccessToken(
|
|||
return null;
|
||||
}
|
||||
|
||||
const token = authHeader.split(' ')[1];
|
||||
const tokenParts = authHeader.split(' ');
|
||||
if (tokenParts.length !== 2) {
|
||||
return null;
|
||||
}
|
||||
const token = tokenParts[1] as string;
|
||||
try {
|
||||
const decoded = jwt.verify(token, ACCESS_TOKEN_SECRET) as UserPayload;
|
||||
const decoded = jwt.verify(
|
||||
token,
|
||||
ACCESS_TOKEN_SECRET,
|
||||
) as unknown as UserPayload;
|
||||
|
||||
const username = decoded.username;
|
||||
const user = MOCK_USERS.find((item) => item.username === username);
|
||||
if (!user) {
|
||||
return null;
|
||||
}
|
||||
const { password: _pwd, ...userinfo } = user;
|
||||
return userinfo;
|
||||
} catch {
|
||||
|
@ -50,7 +63,12 @@ export function verifyRefreshToken(
|
|||
try {
|
||||
const decoded = jwt.verify(token, REFRESH_TOKEN_SECRET) as UserPayload;
|
||||
const username = decoded.username;
|
||||
const user = MOCK_USERS.find((item) => item.username === username);
|
||||
const user = MOCK_USERS.find(
|
||||
(item) => item.username === username,
|
||||
) as UserInfo;
|
||||
if (!user) {
|
||||
return null;
|
||||
}
|
||||
const { password: _pwd, ...userinfo } = user;
|
||||
return userinfo;
|
||||
} catch {
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import type { EventHandlerRequest, H3Event } from 'h3';
|
||||
|
||||
import { setResponseStatus } from 'h3';
|
||||
|
||||
export function useResponseSuccess<T = any>(data: T) {
|
||||
return {
|
||||
code: 0,
|
||||
|
|
|
@ -24,3 +24,12 @@ VITE_APP_BAIDU_CODE = e98f2eab6ceb8688bc6d8fc5332ff093
|
|||
|
||||
# GoView域名
|
||||
VITE_GOVIEW_URL='http://127.0.0.1:3000'
|
||||
|
||||
# API 加解密
|
||||
VITE_APP_API_ENCRYPT_ENABLE = true
|
||||
VITE_APP_API_ENCRYPT_HEADER = X-Api-Encrypt
|
||||
VITE_APP_API_ENCRYPT_ALGORITHM = AES
|
||||
VITE_APP_API_ENCRYPT_REQUEST_KEY = 52549111389893486934626385991395
|
||||
VITE_APP_API_ENCRYPT_RESPONSE_KEY = 96103715984234343991809655248883
|
||||
# VITE_APP_API_ENCRYPT_REQUEST_KEY = MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCls2rIpnGdYnLFgz1XU13GbNQ5DloyPpvW00FPGjqn5Z6JpK+kDtVlnkhwR87iRrE5Vf2WNqRX6vzbLSgveIQY8e8oqGCb829myjf1MuI+ZzN4ghf/7tEYhZJGPI9AbfxFqBUzm+kR3/HByAI22GLT96WM26QiMK8n3tIP/yiLswIDAQAB
|
||||
# VITE_APP_API_ENCRYPT_RESPONSE_KEY = MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAOH8IfIFxL/MR9XIg1UDv5z1fGXQI93E8wrU4iPFovL/sEt9uSgSkjyidC2O7N+m7EKtoN6b1u7cEwXSkwf3kfK0jdWLSQaNpX5YshqXCBzbDfugDaxuyYrNA4/tIMs7mzZAk0APuRXB35Dmupou7Yw7TFW/7QhQmGfzeEKULQvnAgMBAAECgYAw8LqlQGyQoPv5p3gRxEMOCfgL0JzD3XBJKztiRd35RDh40Nx1ejgjW4dPioFwGiVWd2W8cAGHLzALdcQT2KDJh+T/tsd4SPmI6uSBBK6Ff2DkO+kFFcuYvfclQQKqxma5CaZOSqhgenacmgTMFeg2eKlY3symV6JlFNu/IKU42QJBAOhxAK/Eq3e61aYQV2JSguhMR3b8NXJJRroRs/QHEanksJtl+M+2qhkC9nQVXBmBkndnkU/l2tYcHfSBlAyFySMCQQD445tgm/J2b6qMQmuUGQAYDN8FIkHjeKmha+l/fv0igWm8NDlBAem91lNDIPBUzHL1X1+pcts5bjmq99YdOnhtAkAg2J8dN3B3idpZDiQbC8fd5bGPmdI/pSUudAP27uzLEjr2qrE/QPPGdwm2m7IZFJtK7kK1hKio6u48t/bg0iL7AkEAuUUs94h+v702Fnym+jJ2CHEkXvz2US8UDs52nWrZYiM1o1y4tfSHm8H8bv8JCAa9GHyriEawfBraILOmllFdLQJAQSRZy4wmlaG48MhVXodB85X+VZ9krGXZ2TLhz7kz9iuToy53l9jTkESt6L5BfBDCVdIwcXLYgK+8KFdHN5W7HQ==
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@vben/web-antd",
|
||||
"version": "5.5.7",
|
||||
"version": "5.5.9",
|
||||
"homepage": "https://vben.pro",
|
||||
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
|
||||
"repository": {
|
||||
|
@ -47,7 +47,6 @@
|
|||
"@vueuse/integrations": "catalog:",
|
||||
"ant-design-vue": "catalog:",
|
||||
"cropperjs": "catalog:",
|
||||
"crypto-js": "catalog:",
|
||||
"dayjs": "catalog:",
|
||||
"highlight.js": "catalog:",
|
||||
"pinia": "catalog:",
|
||||
|
|
|
@ -7,6 +7,7 @@ import { IconifyIcon } from '@vben/icons';
|
|||
import { $te } from '@vben/locales';
|
||||
import {
|
||||
AsyncComponents,
|
||||
createRequiredValidation,
|
||||
setupVbenVxeTable,
|
||||
useVbenVxeGrid,
|
||||
} from '@vben/plugins/vxe-table';
|
||||
|
@ -354,7 +355,7 @@ setupVbenVxeTable({
|
|||
useVbenForm,
|
||||
});
|
||||
|
||||
export { useVbenVxeGrid };
|
||||
export { createRequiredValidation, useVbenVxeGrid };
|
||||
|
||||
const [VxeTable, VxeColumn, VxeToolbar] = AsyncComponents;
|
||||
export { VxeColumn, VxeTable, VxeToolbar };
|
||||
|
|
|
@ -40,6 +40,7 @@ export namespace BpmProcessInstanceApi {
|
|||
nodeType: BpmNodeTypeEnum;
|
||||
startTime?: Date;
|
||||
status: number;
|
||||
processInstanceId?: string;
|
||||
tasks: ApprovalTaskInfo[];
|
||||
}
|
||||
|
||||
|
|
|
@ -130,3 +130,8 @@ export const getChildrenTaskList = async (id: string) => {
|
|||
`/bpm/task/list-by-parent-task-id?parentTaskId=${id}`,
|
||||
);
|
||||
};
|
||||
|
||||
// 撤回任务
|
||||
export const withdrawTask = async (taskId: string) => {
|
||||
return await requestClient.put('/bpm/task/withdraw', null, { params: { taskId } });
|
||||
};
|
||||
|
|
|
@ -64,7 +64,11 @@ export namespace AuthApi {
|
|||
|
||||
/** 登录 */
|
||||
export async function loginApi(data: AuthApi.LoginParams) {
|
||||
return requestClient.post<AuthApi.LoginResult>('/system/auth/login', data);
|
||||
return requestClient.post<AuthApi.LoginResult>('/system/auth/login', data, {
|
||||
headers: {
|
||||
isEncrypt: false,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/** 刷新 accessToken */
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpAccountApi {
|
||||
/** ERP 结算账户信息 */
|
||||
export interface Account {
|
||||
id?: number; // 结算账户编号
|
||||
no: string; // 账户编码
|
||||
remark: string; // 备注
|
||||
status: number; // 开启状态
|
||||
sort: number; // 排序
|
||||
defaultStatus: boolean; // 是否默认
|
||||
name: string; // 账户名称
|
||||
}
|
||||
|
||||
/** 结算账户分页查询参数 */
|
||||
export interface AccountPageParam extends PageParam {
|
||||
name?: string;
|
||||
no?: string;
|
||||
status?: number;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询结算账户分页 */
|
||||
export function getAccountPage(params: ErpAccountApi.AccountPageParam) {
|
||||
return requestClient.get<PageResult<ErpAccountApi.Account>>(
|
||||
'/erp/account/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询结算账户精简列表 */
|
||||
export function getAccountSimpleList() {
|
||||
return requestClient.get<ErpAccountApi.Account[]>('/erp/account/simple-list');
|
||||
}
|
||||
|
||||
/** 查询结算账户详情 */
|
||||
export function getAccount(id: number) {
|
||||
return requestClient.get<ErpAccountApi.Account>(`/erp/account/get?id=${id}`);
|
||||
}
|
||||
|
||||
/** 新增结算账户 */
|
||||
export function createAccount(data: ErpAccountApi.Account) {
|
||||
return requestClient.post('/erp/account/create', data);
|
||||
}
|
||||
|
||||
/** 修改结算账户 */
|
||||
export function updateAccount(data: ErpAccountApi.Account) {
|
||||
return requestClient.put('/erp/account/update', data);
|
||||
}
|
||||
|
||||
/** 修改结算账户默认状态 */
|
||||
export function updateAccountDefaultStatus(id: number, defaultStatus: boolean) {
|
||||
return requestClient.put('/erp/account/update-default-status', null, {
|
||||
params: { id, defaultStatus },
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除结算账户 */
|
||||
export function deleteAccount(id: number) {
|
||||
return requestClient.delete(`/erp/account/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 导出结算账户 Excel */
|
||||
export function exportAccount(params: any) {
|
||||
return requestClient.download('/erp/account/export-excel', { params });
|
||||
}
|
|
@ -0,0 +1,103 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
namespace ErpFinancePaymentApi {
|
||||
/** 付款单信息 */
|
||||
export interface FinancePayment {
|
||||
id?: number; // 付款单编号
|
||||
no: string; // 付款单号
|
||||
supplierId: number; // 供应商编号
|
||||
paymentTime: Date; // 付款时间
|
||||
totalPrice: number; // 合计金额,单位:元
|
||||
status: number; // 状态
|
||||
remark: string; // 备注
|
||||
}
|
||||
|
||||
/** 付款单分页查询参数 */
|
||||
export interface FinancePaymentPageParams extends PageParam {
|
||||
no?: string;
|
||||
supplierId?: number;
|
||||
status?: number;
|
||||
}
|
||||
|
||||
/** 付款单状态更新参数 */
|
||||
export interface FinancePaymentStatusParams {
|
||||
id: number;
|
||||
status: number;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询付款单分页
|
||||
*/
|
||||
export function getFinancePaymentPage(
|
||||
params: ErpFinancePaymentApi.FinancePaymentPageParams,
|
||||
) {
|
||||
return requestClient.get<PageResult<ErpFinancePaymentApi.FinancePayment>>(
|
||||
'/erp/finance-payment/page',
|
||||
{
|
||||
params,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询付款单详情
|
||||
*/
|
||||
export function getFinancePayment(id: number) {
|
||||
return requestClient.get<ErpFinancePaymentApi.FinancePayment>(
|
||||
`/erp/finance-payment/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增付款单
|
||||
*/
|
||||
export function createFinancePayment(
|
||||
data: ErpFinancePaymentApi.FinancePayment,
|
||||
) {
|
||||
return requestClient.post('/erp/finance-payment/create', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改付款单
|
||||
*/
|
||||
export function updateFinancePayment(
|
||||
data: ErpFinancePaymentApi.FinancePayment,
|
||||
) {
|
||||
return requestClient.put('/erp/finance-payment/update', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新付款单的状态
|
||||
*/
|
||||
export function updateFinancePaymentStatus(
|
||||
params: ErpFinancePaymentApi.FinancePaymentStatusParams,
|
||||
) {
|
||||
return requestClient.put('/erp/finance-payment/update-status', null, {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除付款单
|
||||
*/
|
||||
export function deleteFinancePayment(ids: number[]) {
|
||||
return requestClient.delete('/erp/finance-payment/delete', {
|
||||
params: {
|
||||
ids: ids.join(','),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出付款单 Excel
|
||||
*/
|
||||
export function exportFinancePayment(
|
||||
params: ErpFinancePaymentApi.FinancePaymentPageParams,
|
||||
) {
|
||||
return requestClient.download('/erp/finance-payment/export-excel', {
|
||||
params,
|
||||
});
|
||||
}
|
|
@ -0,0 +1,103 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
namespace ErpFinanceReceiptApi {
|
||||
/** 收款单信息 */
|
||||
export interface FinanceReceipt {
|
||||
id?: number; // 收款单编号
|
||||
no: string; // 收款单号
|
||||
customerId: number; // 客户编号
|
||||
receiptTime: Date; // 收款时间
|
||||
totalPrice: number; // 合计金额,单位:元
|
||||
status: number; // 状态
|
||||
remark: string; // 备注
|
||||
}
|
||||
|
||||
/** 收款单分页查询参数 */
|
||||
export interface FinanceReceiptPageParams extends PageParam {
|
||||
no?: string;
|
||||
customerId?: number;
|
||||
status?: number;
|
||||
}
|
||||
|
||||
/** 收款单状态更新参数 */
|
||||
export interface FinanceReceiptStatusParams {
|
||||
id: number;
|
||||
status: number;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询收款单分页
|
||||
*/
|
||||
export function getFinanceReceiptPage(
|
||||
params: ErpFinanceReceiptApi.FinanceReceiptPageParams,
|
||||
) {
|
||||
return requestClient.get<PageResult<ErpFinanceReceiptApi.FinanceReceipt>>(
|
||||
'/erp/finance-receipt/page',
|
||||
{
|
||||
params,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询收款单详情
|
||||
*/
|
||||
export function getFinanceReceipt(id: number) {
|
||||
return requestClient.get<ErpFinanceReceiptApi.FinanceReceipt>(
|
||||
`/erp/finance-receipt/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增收款单
|
||||
*/
|
||||
export function createFinanceReceipt(
|
||||
data: ErpFinanceReceiptApi.FinanceReceipt,
|
||||
) {
|
||||
return requestClient.post('/erp/finance-receipt/create', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改收款单
|
||||
*/
|
||||
export function updateFinanceReceipt(
|
||||
data: ErpFinanceReceiptApi.FinanceReceipt,
|
||||
) {
|
||||
return requestClient.put('/erp/finance-receipt/update', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新收款单的状态
|
||||
*/
|
||||
export function updateFinanceReceiptStatus(
|
||||
params: ErpFinanceReceiptApi.FinanceReceiptStatusParams,
|
||||
) {
|
||||
return requestClient.put('/erp/finance-receipt/update-status', null, {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除收款单
|
||||
*/
|
||||
export function deleteFinanceReceipt(ids: number[]) {
|
||||
return requestClient.delete('/erp/finance-receipt/delete', {
|
||||
params: {
|
||||
ids: ids.join(','),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出收款单 Excel
|
||||
*/
|
||||
export function exportFinanceReceipt(
|
||||
params: ErpFinanceReceiptApi.FinanceReceiptPageParams,
|
||||
) {
|
||||
return requestClient.download('/erp/finance-receipt/export-excel', {
|
||||
params,
|
||||
});
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpProductCategoryApi {
|
||||
/** ERP 产品分类信息 */
|
||||
export interface ProductCategory {
|
||||
id?: number; // 分类编号
|
||||
parentId?: number; // 父分类编号
|
||||
name: string; // 分类名称
|
||||
code?: string; // 分类编码
|
||||
sort?: number; // 分类排序
|
||||
status?: number; // 开启状态
|
||||
children?: ProductCategory[]; // 子分类
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询产品分类列表 */
|
||||
export function getProductCategoryList() {
|
||||
return requestClient.get<ErpProductCategoryApi.ProductCategory[]>(
|
||||
'/erp/product-category/list',
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询产品分类精简列表 */
|
||||
export function getProductCategorySimpleList() {
|
||||
return requestClient.get<ErpProductCategoryApi.ProductCategory[]>(
|
||||
'/erp/product-category/simple-list',
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询产品分类详情 */
|
||||
export function getProductCategory(id: number) {
|
||||
return requestClient.get<ErpProductCategoryApi.ProductCategory>(
|
||||
`/erp/product-category/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增产品分类 */
|
||||
export function createProductCategory(
|
||||
data: ErpProductCategoryApi.ProductCategory,
|
||||
) {
|
||||
return requestClient.post('/erp/product-category/create', data);
|
||||
}
|
||||
|
||||
/** 修改产品分类 */
|
||||
export function updateProductCategory(
|
||||
data: ErpProductCategoryApi.ProductCategory,
|
||||
) {
|
||||
return requestClient.put('/erp/product-category/update', data);
|
||||
}
|
||||
|
||||
/** 删除产品分类 */
|
||||
export function deleteProductCategory(id: number) {
|
||||
return requestClient.delete(`/erp/product-category/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 导出产品分类 Excel */
|
||||
export function exportProductCategory(params: any) {
|
||||
return requestClient.download('/erp/product-category/export-excel', {
|
||||
params,
|
||||
});
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpProductApi {
|
||||
/** ERP 产品信息 */
|
||||
export interface Product {
|
||||
id?: number; // 产品编号
|
||||
name: string; // 产品名称
|
||||
barCode: string; // 产品条码
|
||||
categoryId: number; // 产品类型编号
|
||||
unitId: number; // 单位编号
|
||||
unitName?: string; // 单位名字
|
||||
status: number; // 产品状态
|
||||
standard: string; // 产品规格
|
||||
remark: string; // 产品备注
|
||||
expiryDay: number; // 保质期天数
|
||||
weight: number; // 重量(kg)
|
||||
purchasePrice: number; // 采购价格,单位:元
|
||||
salePrice: number; // 销售价格,单位:元
|
||||
minPrice: number; // 最低价格,单位:元
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询产品分页 */
|
||||
export function getProductPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<ErpProductApi.Product>>(
|
||||
'/erp/product/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询产品精简列表 */
|
||||
export function getProductSimpleList() {
|
||||
return requestClient.get<ErpProductApi.Product[]>('/erp/product/simple-list');
|
||||
}
|
||||
|
||||
/** 查询产品详情 */
|
||||
export function getProduct(id: number) {
|
||||
return requestClient.get<ErpProductApi.Product>(`/erp/product/get?id=${id}`);
|
||||
}
|
||||
|
||||
/** 新增产品 */
|
||||
export function createProduct(data: ErpProductApi.Product) {
|
||||
return requestClient.post('/erp/product/create', data);
|
||||
}
|
||||
|
||||
/** 修改产品 */
|
||||
export function updateProduct(data: ErpProductApi.Product) {
|
||||
return requestClient.put('/erp/product/update', data);
|
||||
}
|
||||
|
||||
/** 删除产品 */
|
||||
export function deleteProduct(id: number) {
|
||||
return requestClient.delete(`/erp/product/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 导出产品 Excel */
|
||||
export function exportProduct(params: any) {
|
||||
return requestClient.download('/erp/product/export-excel', { params });
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
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,
|
||||
) {
|
||||
return requestClient.get<PageResult<ErpProductUnitApi.ProductUnit>>(
|
||||
'/erp/product-unit/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询产品单位精简列表 */
|
||||
export function getProductUnitSimpleList() {
|
||||
return requestClient.get<ErpProductUnitApi.ProductUnit[]>(
|
||||
'/erp/product-unit/simple-list',
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询产品单位详情 */
|
||||
export function getProductUnit(id: number) {
|
||||
return requestClient.get<ErpProductUnitApi.ProductUnit>(
|
||||
`/erp/product-unit/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增产品单位 */
|
||||
export function createProductUnit(data: ErpProductUnitApi.ProductUnit) {
|
||||
return requestClient.post('/erp/product-unit/create', data);
|
||||
}
|
||||
|
||||
/** 修改产品单位 */
|
||||
export function updateProductUnit(data: ErpProductUnitApi.ProductUnit) {
|
||||
return requestClient.put('/erp/product-unit/update', data);
|
||||
}
|
||||
|
||||
/** 删除产品单位 */
|
||||
export function deleteProductUnit(id: number) {
|
||||
return requestClient.delete(`/erp/product-unit/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 导出产品单位 Excel */
|
||||
export function exportProductUnit(params: any) {
|
||||
return requestClient.download('/erp/product-unit/export-excel', { params });
|
||||
}
|
|
@ -0,0 +1,129 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpPurchaseInApi {
|
||||
/** 采购入库信息 */
|
||||
export interface PurchaseIn {
|
||||
id?: number; // 入库工单编号
|
||||
no?: string; // 采购入库号
|
||||
supplierId?: number; // 供应商编号
|
||||
inTime?: Date; // 入库时间
|
||||
totalCount?: number; // 合计数量
|
||||
totalPrice?: number; // 合计金额,单位:元
|
||||
status?: number; // 状态
|
||||
remark?: string; // 备注
|
||||
outCount?: number; // 采购出库数量
|
||||
returnCount?: number; // 采购退货数量
|
||||
discountPercent?: number; // 折扣百分比
|
||||
discountPrice?: number; // 折扣金额
|
||||
paymentPrice?: number; // 实际支付金额
|
||||
otherPrice?: number; // 其他费用
|
||||
totalProductPrice?: number; // 合计商品金额
|
||||
taxPrice?: number; // 合计税额
|
||||
items?: PurchaseInItem[]; // 采购入库明细
|
||||
}
|
||||
export interface PurchaseInItem {
|
||||
count?: number;
|
||||
id?: number;
|
||||
orderItemId?: number;
|
||||
productBarCode?: string;
|
||||
productId?: number;
|
||||
productName: string;
|
||||
productPrice: number;
|
||||
productUnitId?: number;
|
||||
productUnitName?: string;
|
||||
totalProductPrice?: number;
|
||||
remark: string;
|
||||
stockCount?: number;
|
||||
taxPercent?: number;
|
||||
taxPrice?: number;
|
||||
totalPrice?: number;
|
||||
warehouseId?: number;
|
||||
inCount?: number;
|
||||
}
|
||||
|
||||
/** 采购入库分页查询参数 */
|
||||
export interface PurchaseInPageParams extends PageParam {
|
||||
no?: string;
|
||||
supplierId?: number;
|
||||
status?: number;
|
||||
}
|
||||
|
||||
/** 采购入库状态更新参数 */
|
||||
export interface PurchaseInStatusParams {
|
||||
id: number;
|
||||
status: number;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询采购入库分页
|
||||
*/
|
||||
export function getPurchaseInPage(
|
||||
params: ErpPurchaseInApi.PurchaseInPageParams,
|
||||
) {
|
||||
return requestClient.get<PageResult<ErpPurchaseInApi.PurchaseIn>>(
|
||||
'/erp/purchase-in/page',
|
||||
{
|
||||
params,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询采购入库详情
|
||||
*/
|
||||
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: {
|
||||
id,
|
||||
status,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除采购入库
|
||||
*/
|
||||
export function deletePurchaseIn(ids: number[]) {
|
||||
return requestClient.delete('/erp/purchase-in/delete', {
|
||||
params: {
|
||||
ids: ids.join(','),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出采购入库 Excel
|
||||
*/
|
||||
export function exportPurchaseIn(
|
||||
params: ErpPurchaseInApi.PurchaseInPageParams,
|
||||
) {
|
||||
return requestClient.download('/erp/purchase-in/export-excel', {
|
||||
params,
|
||||
});
|
||||
}
|
|
@ -0,0 +1,117 @@
|
|||
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; // 采购订单号
|
||||
supplierId?: number; // 供应商编号
|
||||
supplierName?: string; // 供应商名称
|
||||
orderTime?: Date | string; // 订单时间
|
||||
totalCount?: number; // 合计数量
|
||||
totalPrice?: number; // 合计金额,单位:元
|
||||
totalProductPrice?: number; // 产品金额,单位:元
|
||||
discountPercent?: number; // 优惠率,百分比
|
||||
discountPrice?: number; // 优惠金额,单位:元
|
||||
depositPrice?: number; // 定金金额,单位:元
|
||||
accountId?: number; // 结算账户编号
|
||||
status?: number; // 状态
|
||||
remark?: string; // 备注
|
||||
fileUrl?: string; // 附件地址
|
||||
inCount?: number; // 采购入库数量
|
||||
count?: number; // 数量
|
||||
returnCount?: number; // 采购退货数量
|
||||
inStatus?: number; // 入库状态
|
||||
returnStatus?: number; // 退货状态
|
||||
productNames?: string; // 产品名称列表
|
||||
creatorName?: string; // 创建人名称
|
||||
createTime?: Date; // 创建时间
|
||||
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 function getPurchaseOrderPage(
|
||||
params: ErpPurchaseOrderApi.PurchaseOrderPageParam,
|
||||
) {
|
||||
return requestClient.get<PageResult<ErpPurchaseOrderApi.PurchaseOrder>>(
|
||||
'/erp/purchase-order/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询采购订单详情 */
|
||||
export function getPurchaseOrder(id: number) {
|
||||
return requestClient.get<ErpPurchaseOrderApi.PurchaseOrder>(
|
||||
`/erp/purchase-order/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增采购订单 */
|
||||
export function createPurchaseOrder(data: ErpPurchaseOrderApi.PurchaseOrder) {
|
||||
return requestClient.post('/erp/purchase-order/create', data);
|
||||
}
|
||||
|
||||
/** 修改采购订单 */
|
||||
export function updatePurchaseOrder(data: ErpPurchaseOrderApi.PurchaseOrder) {
|
||||
return requestClient.put('/erp/purchase-order/update', data);
|
||||
}
|
||||
|
||||
/** 更新采购订单的状态 */
|
||||
export function updatePurchaseOrderStatus(id: number, status: number) {
|
||||
return requestClient.put('/erp/purchase-order/update-status', null, {
|
||||
params: { id, status },
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除采购订单 */
|
||||
export function deletePurchaseOrder(id: number) {
|
||||
return requestClient.delete(`/erp/purchase-order/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 批量删除采购订单 */
|
||||
export function deletePurchaseOrderList(ids: number[]) {
|
||||
return requestClient.delete('/erp/purchase-order/delete', {
|
||||
params: { ids: ids.join(',') },
|
||||
});
|
||||
}
|
||||
|
||||
/** 导出采购订单 Excel */
|
||||
export function exportPurchaseOrder(params: any) {
|
||||
return requestClient.download('/erp/purchase-order/export-excel', { params });
|
||||
}
|
|
@ -0,0 +1,127 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpPurchaseReturnApi {
|
||||
/** 采购退货信息 */
|
||||
export interface PurchaseReturn {
|
||||
id?: number; // 采购退货编号
|
||||
no?: string; // 采购退货号
|
||||
supplierId?: number; // 供应商编号
|
||||
returnTime?: Date; // 退货时间
|
||||
totalCount?: number; // 合计数量
|
||||
totalPrice: number; // 合计金额,单位:元
|
||||
discountPercent?: number; // 折扣百分比
|
||||
discountPrice?: number; // 折扣金额
|
||||
status?: number; // 状态
|
||||
remark?: string; // 备注
|
||||
totalTaxPrice?: number; // 合计税额
|
||||
otherPrice?: number; // 其他费用
|
||||
items?: PurchaseReturnItem[];
|
||||
}
|
||||
export interface PurchaseReturnItem {
|
||||
count?: number;
|
||||
id?: number;
|
||||
orderItemId?: number;
|
||||
productBarCode?: string;
|
||||
productId?: number;
|
||||
productName: string;
|
||||
productPrice: number;
|
||||
productUnitId?: number;
|
||||
productUnitName?: string;
|
||||
totalProductPrice?: number;
|
||||
remark: string;
|
||||
stockCount?: number;
|
||||
taxPercent?: number;
|
||||
taxPrice?: number;
|
||||
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,
|
||||
) {
|
||||
return requestClient.get<PageResult<ErpPurchaseReturnApi.PurchaseReturn>>(
|
||||
'/erp/purchase-return/page',
|
||||
{
|
||||
params,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询采购退货详情
|
||||
*/
|
||||
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(
|
||||
params: ErpPurchaseReturnApi.PurchaseReturnStatusParams,
|
||||
) {
|
||||
return requestClient.put('/erp/purchase-return/update-status', null, {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除采购退货
|
||||
*/
|
||||
export function deletePurchaseReturn(ids: number[]) {
|
||||
return requestClient.delete('/erp/purchase-return/delete', {
|
||||
params: {
|
||||
ids: ids.join(','),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出采购退货 Excel
|
||||
*/
|
||||
export function exportPurchaseReturn(
|
||||
params: ErpPurchaseReturnApi.PurchaseReturnPageParams,
|
||||
) {
|
||||
return requestClient.download('/erp/purchase-return/export-excel', {
|
||||
params,
|
||||
});
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpSupplierApi {
|
||||
/** ERP 供应商信息 */
|
||||
export interface Supplier {
|
||||
id?: number; // 供应商编号
|
||||
name: string; // 供应商名称
|
||||
contact: string; // 联系人
|
||||
mobile: string; // 手机号码
|
||||
telephone: string; // 联系电话
|
||||
email: string; // 电子邮箱
|
||||
fax: string; // 传真
|
||||
remark: string; // 备注
|
||||
status: number; // 开启状态
|
||||
sort: number; // 排序
|
||||
taxNo: string; // 纳税人识别号
|
||||
taxPercent: number; // 税率
|
||||
bankName: string; // 开户行
|
||||
bankAccount: string; // 开户账号
|
||||
bankAddress: string; // 开户地址
|
||||
}
|
||||
|
||||
/** 供应商分页查询参数 */
|
||||
export interface SupplierPageParam extends PageParam {
|
||||
name?: string;
|
||||
mobile?: string;
|
||||
status?: number;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询供应商分页 */
|
||||
export function getSupplierPage(params: ErpSupplierApi.SupplierPageParam) {
|
||||
return requestClient.get<PageResult<ErpSupplierApi.Supplier>>(
|
||||
'/erp/supplier/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 获得供应商精简列表 */
|
||||
export function getSupplierSimpleList() {
|
||||
return requestClient.get<ErpSupplierApi.Supplier[]>(
|
||||
'/erp/supplier/simple-list',
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询供应商详情 */
|
||||
export function getSupplier(id: number) {
|
||||
return requestClient.get<ErpSupplierApi.Supplier>(
|
||||
`/erp/supplier/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增供应商 */
|
||||
export function createSupplier(data: ErpSupplierApi.Supplier) {
|
||||
return requestClient.post('/erp/supplier/create', data);
|
||||
}
|
||||
|
||||
/** 修改供应商 */
|
||||
export function updateSupplier(data: ErpSupplierApi.Supplier) {
|
||||
return requestClient.put('/erp/supplier/update', data);
|
||||
}
|
||||
|
||||
/** 删除供应商 */
|
||||
export function deleteSupplier(id: number) {
|
||||
return requestClient.delete(`/erp/supplier/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 导出供应商 Excel */
|
||||
export function exportSupplier(params: any) {
|
||||
return requestClient.download('/erp/supplier/export-excel', { params });
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpCustomerApi {
|
||||
/** ERP 客户信息 */
|
||||
export interface Customer {
|
||||
id?: number; // 客户编号
|
||||
name: string; // 客户名称
|
||||
contact: string; // 联系人
|
||||
mobile: string; // 手机号码
|
||||
telephone: string; // 联系电话
|
||||
email: string; // 电子邮箱
|
||||
fax: string; // 传真
|
||||
remark: string; // 备注
|
||||
status: number; // 开启状态
|
||||
sort: number; // 排序
|
||||
taxNo: string; // 纳税人识别号
|
||||
taxPercent: number; // 税率
|
||||
bankName: string; // 开户行
|
||||
bankAccount: string; // 开户账号
|
||||
bankAddress: string; // 开户地址
|
||||
}
|
||||
|
||||
/** 客户分页查询参数 */
|
||||
export interface CustomerPageParam extends PageParam {
|
||||
name?: string;
|
||||
mobile?: string;
|
||||
status?: number;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询客户分页 */
|
||||
export function getCustomerPage(params: ErpCustomerApi.CustomerPageParam) {
|
||||
return requestClient.get<PageResult<ErpCustomerApi.Customer>>(
|
||||
'/erp/customer/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询客户精简列表 */
|
||||
export function getCustomerSimpleList() {
|
||||
return requestClient.get<ErpCustomerApi.Customer[]>(
|
||||
'/erp/customer/simple-list',
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询客户详情 */
|
||||
export function getCustomer(id: number) {
|
||||
return requestClient.get<ErpCustomerApi.Customer>(
|
||||
`/erp/customer/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增客户 */
|
||||
export function createCustomer(data: ErpCustomerApi.Customer) {
|
||||
return requestClient.post('/erp/customer/create', data);
|
||||
}
|
||||
|
||||
/** 修改客户 */
|
||||
export function updateCustomer(data: ErpCustomerApi.Customer) {
|
||||
return requestClient.put('/erp/customer/update', data);
|
||||
}
|
||||
|
||||
/** 删除客户 */
|
||||
export function deleteCustomer(id: number) {
|
||||
return requestClient.delete(`/erp/customer/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 导出客户 Excel */
|
||||
export function exportCustomer(params: any) {
|
||||
return requestClient.download('/erp/customer/export-excel', { params });
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpSaleOrderApi {
|
||||
/** ERP 销售订单信息 */
|
||||
export interface SaleOrder {
|
||||
id?: number; // 订单工单编号
|
||||
no: string; // 销售订单号
|
||||
customerId: number; // 客户编号
|
||||
accountId?: number; // 收款账户编号
|
||||
orderTime: Date; // 订单时间
|
||||
totalCount: number; // 合计数量
|
||||
totalPrice: number; // 合计金额,单位:元
|
||||
status: number; // 状态
|
||||
remark: string; // 备注
|
||||
outCount: number; // 销售出库数量
|
||||
fileUrl?: string; // 附件地址
|
||||
inCount?: number; // 采购入库数量
|
||||
returnCount: number; // 销售退货数量
|
||||
totalProductPrice?: number; // 产品金额,单位:元
|
||||
discountPercent?: number; // 优惠率,百分比
|
||||
discountPrice?: number; // 优惠金额,单位:元
|
||||
depositPrice?: number; // 定金金额,单位:元
|
||||
items?: SaleOrderItem[]; // 销售订单产品明细列表
|
||||
}
|
||||
/** ERP 销售订单产品明细 */
|
||||
export interface SaleOrderItem {
|
||||
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 interface SaleOrderPageParam extends PageParam {
|
||||
no?: string;
|
||||
customerId?: number;
|
||||
status?: number;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询销售订单分页 */
|
||||
export function getSaleOrderPage(params: ErpSaleOrderApi.SaleOrderPageParam) {
|
||||
return requestClient.get<PageResult<ErpSaleOrderApi.SaleOrder>>(
|
||||
'/erp/sale-order/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询销售订单详情 */
|
||||
export function getSaleOrder(id: number) {
|
||||
return requestClient.get<ErpSaleOrderApi.SaleOrder>(
|
||||
`/erp/sale-order/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增销售订单 */
|
||||
export function createSaleOrder(data: ErpSaleOrderApi.SaleOrder) {
|
||||
return requestClient.post('/erp/sale-order/create', data);
|
||||
}
|
||||
|
||||
/** 修改销售订单 */
|
||||
export function updateSaleOrder(data: ErpSaleOrderApi.SaleOrder) {
|
||||
return requestClient.put('/erp/sale-order/update', data);
|
||||
}
|
||||
|
||||
/** 更新销售订单的状态 */
|
||||
export function updateSaleOrderStatus(id: number, status: number) {
|
||||
return requestClient.put('/erp/sale-order/update-status', null, {
|
||||
params: { id, status },
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除销售订单 */
|
||||
export function deleteSaleOrder(ids: number[]) {
|
||||
return requestClient.delete('/erp/sale-order/delete', {
|
||||
params: { ids: ids.join(',') },
|
||||
});
|
||||
}
|
||||
|
||||
/** 导出销售订单 Excel */
|
||||
export function exportSaleOrder(params: any) {
|
||||
return requestClient.download('/erp/sale-order/export-excel', { params });
|
||||
}
|
|
@ -0,0 +1,120 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpSaleOutApi {
|
||||
/** 销售出库信息 */
|
||||
export interface SaleOut {
|
||||
id?: number; // 销售出库编号
|
||||
no?: string; // 销售出库号
|
||||
customerId?: number; // 客户编号
|
||||
saleUserId?: number; // 客户编号
|
||||
outTime?: Date; // 出库时间
|
||||
totalCount?: number; // 合计数量
|
||||
totalPrice?: number; // 合计金额,单位:元
|
||||
status?: number; // 状态
|
||||
remark?: string; // 备注
|
||||
discountPercent?: number; // 折扣百分比
|
||||
discountPrice?: number; // 折扣金额
|
||||
otherPrice?: number; // 其他费用
|
||||
totalProductPrice?: number; // 合计商品金额
|
||||
taxPrice?: number; // 合计税额
|
||||
totalTaxPrice?: number; // 合计税额
|
||||
fileUrl?: string; // 附件地址
|
||||
items?: SaleOutItem[];
|
||||
}
|
||||
export interface SaleOutItem {
|
||||
count?: number;
|
||||
id?: number;
|
||||
orderItemId?: number;
|
||||
productBarCode?: string;
|
||||
productId?: number;
|
||||
productName: string;
|
||||
productPrice: number;
|
||||
productUnitId?: number;
|
||||
productUnitName?: string;
|
||||
totalProductPrice?: number;
|
||||
remark: string;
|
||||
stockCount?: number;
|
||||
taxPercent?: number;
|
||||
taxPrice?: number;
|
||||
totalPrice?: number;
|
||||
warehouseId?: number;
|
||||
outCount?: number;
|
||||
}
|
||||
|
||||
/** 销售出库分页查询参数 */
|
||||
export interface SaleOutPageParams extends PageParam {
|
||||
no?: string;
|
||||
customerId?: number;
|
||||
status?: number;
|
||||
}
|
||||
|
||||
/** 销售出库状态更新参数 */
|
||||
export interface SaleOutStatusParams {
|
||||
id: number;
|
||||
status: number;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询销售出库分页
|
||||
*/
|
||||
export function getSaleOutPage(params: ErpSaleOutApi.SaleOutPageParams) {
|
||||
return requestClient.get<PageResult<ErpSaleOutApi.SaleOut>>(
|
||||
'/erp/sale-out/page',
|
||||
{
|
||||
params,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询销售出库详情
|
||||
*/
|
||||
export function getSaleOut(id: number) {
|
||||
return requestClient.get<ErpSaleOutApi.SaleOut>(`/erp/sale-out/get?id=${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增销售出库
|
||||
*/
|
||||
export function createSaleOut(data: ErpSaleOutApi.SaleOut) {
|
||||
return requestClient.post('/erp/sale-out/create', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改销售出库
|
||||
*/
|
||||
export function updateSaleOut(data: ErpSaleOutApi.SaleOut) {
|
||||
return requestClient.put('/erp/sale-out/update', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新销售出库的状态
|
||||
*/
|
||||
export function updateSaleOutStatus(params: ErpSaleOutApi.SaleOutStatusParams) {
|
||||
return requestClient.put('/erp/sale-out/update-status', null, {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除销售出库
|
||||
*/
|
||||
export function deleteSaleOut(ids: number[]) {
|
||||
return requestClient.delete('/erp/sale-out/delete', {
|
||||
params: {
|
||||
ids: ids.join(','),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出销售出库 Excel
|
||||
*/
|
||||
export function exportSaleOut(params: ErpSaleOutApi.SaleOutPageParams) {
|
||||
return requestClient.download('/erp/sale-out/export-excel', {
|
||||
params,
|
||||
});
|
||||
}
|
|
@ -0,0 +1,127 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpSaleReturnApi {
|
||||
/** 销售退货信息 */
|
||||
export interface SaleReturn {
|
||||
id?: number; // 销售退货编号
|
||||
no?: string; // 销售退货号
|
||||
customerId?: number; // 客户编号
|
||||
returnTime?: Date; // 退货时间
|
||||
totalCount?: number; // 合计数量
|
||||
totalPrice?: number; // 合计金额,单位:元
|
||||
status?: number; // 状态
|
||||
remark?: string; // 备注
|
||||
discountPercent?: number; // 折扣百分比
|
||||
discountPrice?: number; // 折扣金额
|
||||
otherPrice?: number; // 其他费用
|
||||
totalProductPrice?: number; // 合计商品金额
|
||||
taxPrice?: number; // 合计税额
|
||||
totalTaxPrice?: number; // 合计税额
|
||||
fileUrl?: string; // 附件地址
|
||||
items?: SaleReturnItem[];
|
||||
}
|
||||
export interface SaleReturnItem {
|
||||
count?: number;
|
||||
id?: number;
|
||||
orderItemId?: number;
|
||||
productBarCode?: string;
|
||||
productId?: number;
|
||||
productName: string;
|
||||
productPrice: number;
|
||||
productUnitId?: number;
|
||||
productUnitName?: string;
|
||||
totalProductPrice?: number;
|
||||
remark: string;
|
||||
stockCount?: number;
|
||||
taxPercent?: number;
|
||||
taxPrice?: number;
|
||||
totalPrice?: number;
|
||||
warehouseId?: number;
|
||||
returnCount?: number;
|
||||
}
|
||||
|
||||
/** 销售退货分页查询参数 */
|
||||
export interface SaleReturnPageParams extends PageParam {
|
||||
no?: string;
|
||||
customerId?: number;
|
||||
status?: number;
|
||||
}
|
||||
|
||||
/** 销售退货状态更新参数 */
|
||||
export interface SaleReturnStatusParams {
|
||||
id: number;
|
||||
status: number;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询销售退货分页
|
||||
*/
|
||||
export function getSaleReturnPage(
|
||||
params: ErpSaleReturnApi.SaleReturnPageParams,
|
||||
) {
|
||||
return requestClient.get<PageResult<ErpSaleReturnApi.SaleReturn>>(
|
||||
'/erp/sale-return/page',
|
||||
{
|
||||
params,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询销售退货详情
|
||||
*/
|
||||
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(
|
||||
params: ErpSaleReturnApi.SaleReturnStatusParams,
|
||||
) {
|
||||
return requestClient.put('/erp/sale-return/update-status', null, {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除销售退货
|
||||
*/
|
||||
export function deleteSaleReturn(ids: number[]) {
|
||||
return requestClient.delete('/erp/sale-return/delete', {
|
||||
params: {
|
||||
ids: ids.join(','),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出销售退货 Excel
|
||||
*/
|
||||
export function exportSaleReturn(
|
||||
params: ErpSaleReturnApi.SaleReturnPageParams,
|
||||
) {
|
||||
return requestClient.download('/erp/sale-return/export-excel', {
|
||||
params,
|
||||
});
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpPurchaseStatisticsApi {
|
||||
/** ERP 采购全局统计 */
|
||||
export interface PurchaseSummary {
|
||||
todayPrice: number; // 今日采购金额
|
||||
yesterdayPrice: number; // 昨日采购金额
|
||||
monthPrice: number; // 本月采购金额
|
||||
yearPrice: number; // 今年采购金额
|
||||
}
|
||||
|
||||
/** ERP 采购时间段统计 */
|
||||
export interface PurchaseTimeSummary {
|
||||
time: string; // 时间
|
||||
price: number; // 采购金额
|
||||
}
|
||||
}
|
||||
|
||||
/** 获得采购统计 */
|
||||
export function getPurchaseSummary() {
|
||||
return requestClient.get<ErpPurchaseStatisticsApi.PurchaseSummary>(
|
||||
'/erp/purchase-statistics/summary',
|
||||
);
|
||||
}
|
||||
|
||||
/** 获得采购时间段统计 */
|
||||
export function getPurchaseTimeSummary() {
|
||||
return requestClient.get<ErpPurchaseStatisticsApi.PurchaseTimeSummary[]>(
|
||||
'/erp/purchase-statistics/time-summary',
|
||||
);
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpSaleStatisticsApi {
|
||||
/** ERP 销售全局统计 */
|
||||
export interface SaleSummary {
|
||||
todayPrice: number; // 今日销售金额
|
||||
yesterdayPrice: number; // 昨日销售金额
|
||||
monthPrice: number; // 本月销售金额
|
||||
yearPrice: number; // 今年销售金额
|
||||
}
|
||||
|
||||
/** ERP 销售时间段统计 */
|
||||
export interface SaleTimeSummary {
|
||||
time: string; // 时间
|
||||
price: number; // 销售金额
|
||||
}
|
||||
}
|
||||
|
||||
/** 获得销售统计 */
|
||||
export function getSaleSummary() {
|
||||
return requestClient.get<ErpSaleStatisticsApi.SaleSummary>(
|
||||
'/erp/sale-statistics/summary',
|
||||
);
|
||||
}
|
||||
|
||||
/** 获得销售时间段统计 */
|
||||
export function getSaleTimeSummary() {
|
||||
return requestClient.get<ErpSaleStatisticsApi.SaleTimeSummary[]>(
|
||||
'/erp/sale-statistics/time-summary',
|
||||
);
|
||||
}
|
|
@ -0,0 +1,117 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpStockCheckApi {
|
||||
/** 库存盘点单信息 */
|
||||
export interface StockCheck {
|
||||
id?: number; // 盘点编号
|
||||
no: string; // 盘点单号
|
||||
checkTime: Date; // 盘点时间
|
||||
totalCount: number; // 合计数量
|
||||
totalPrice: number; // 合计金额,单位:元
|
||||
status: number; // 状态
|
||||
remark: string; // 备注
|
||||
fileUrl?: string; // 附件
|
||||
productNames?: string; // 产品信息
|
||||
creatorName?: string; // 创建人
|
||||
items?: StockCheckItem[]; // 盘点产品清单
|
||||
}
|
||||
// 库存盘点单产品信息
|
||||
export interface StockCheckItem {
|
||||
id?: number; // 编号
|
||||
warehouseId?: number; // 仓库编号
|
||||
productId?: number; // 产品编号
|
||||
productName?: string; // 产品名称
|
||||
productUnitId?: number; // 产品单位编号
|
||||
productUnitName?: string; // 产品单位名称
|
||||
productBarCode?: string; // 产品条码
|
||||
count?: number; // 盈亏数量
|
||||
actualCount?: number; // 实际库存
|
||||
productPrice?: number; // 产品单价
|
||||
totalPrice?: number; // 总价
|
||||
stockCount?: number; // 账面库存
|
||||
remark?: string; // 备注
|
||||
}
|
||||
/** 库存盘点单分页查询参数 */
|
||||
export interface StockCheckPageParams extends PageParam {
|
||||
no?: string;
|
||||
status?: number;
|
||||
}
|
||||
|
||||
/** 库存盘点单状态更新参数 */
|
||||
export interface StockCheckStatusParams {
|
||||
id: number;
|
||||
status: number;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询库存盘点单分页
|
||||
*/
|
||||
export function getStockCheckPage(
|
||||
params: ErpStockCheckApi.StockCheckPageParams,
|
||||
) {
|
||||
return requestClient.get<PageResult<ErpStockCheckApi.StockCheck>>(
|
||||
'/erp/stock-check/page',
|
||||
{
|
||||
params,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询库存盘点单详情
|
||||
*/
|
||||
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(
|
||||
params: ErpStockCheckApi.StockCheckStatusParams,
|
||||
) {
|
||||
return requestClient.put('/erp/stock-check/update-status', null, {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除库存盘点单
|
||||
*/
|
||||
export function deleteStockCheck(ids: number[]) {
|
||||
return requestClient.delete('/erp/stock-check/delete', {
|
||||
params: {
|
||||
ids: ids.join(','),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出库存盘点单 Excel
|
||||
*/
|
||||
export function exportStockCheck(
|
||||
params: ErpStockCheckApi.StockCheckPageParams,
|
||||
) {
|
||||
return requestClient.download('/erp/stock-check/export-excel', {
|
||||
params,
|
||||
});
|
||||
}
|
|
@ -0,0 +1,113 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpStockInApi {
|
||||
/** 其它入库单信息 */
|
||||
export interface StockIn {
|
||||
id?: number; // 入库编号
|
||||
no: string; // 入库单号
|
||||
supplierId: number; // 供应商编号
|
||||
supplierName?: string; // 供应商名称
|
||||
inTime: Date; // 入库时间
|
||||
totalCount: number; // 合计数量
|
||||
totalPrice: number; // 合计金额,单位:元
|
||||
status: number; // 状态
|
||||
remark: string; // 备注
|
||||
fileUrl?: string; // 附件
|
||||
productNames?: string; // 产品信息
|
||||
creatorName?: string; // 创建人
|
||||
items?: StockInItem[]; // 入库产品清单
|
||||
}
|
||||
|
||||
/** 其它入库单产品信息 */
|
||||
export interface StockInItem {
|
||||
id?: number; // 编号
|
||||
warehouseId: number; // 仓库编号
|
||||
productId: number; // 产品编号
|
||||
productName?: string; // 产品名称
|
||||
productUnitId?: number; // 产品单位编号
|
||||
productUnitName?: string; // 产品单位名称
|
||||
productBarCode?: string; // 产品条码
|
||||
count: number; // 数量
|
||||
productPrice: number; // 产品单价
|
||||
totalPrice: number; // 总价
|
||||
stockCount?: number; // 库存数量
|
||||
remark?: string; // 备注
|
||||
}
|
||||
|
||||
/** 其它入库单分页查询参数 */
|
||||
export interface StockInPageParams extends PageParam {
|
||||
no?: string;
|
||||
supplierId?: number;
|
||||
status?: number;
|
||||
}
|
||||
|
||||
/** 其它入库单状态更新参数 */
|
||||
export interface StockInStatusParams {
|
||||
id: number;
|
||||
status: number;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询其它入库单分页
|
||||
*/
|
||||
export function getStockInPage(params: ErpStockInApi.StockInPageParams) {
|
||||
return requestClient.get<PageResult<ErpStockInApi.StockIn>>(
|
||||
'/erp/stock-in/page',
|
||||
{
|
||||
params,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询其它入库单详情
|
||||
*/
|
||||
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(params: ErpStockInApi.StockInStatusParams) {
|
||||
return requestClient.put('/erp/stock-in/update-status', null, {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除其它入库单
|
||||
*/
|
||||
export function deleteStockIn(ids: number[]) {
|
||||
return requestClient.delete('/erp/stock-in/delete', {
|
||||
params: {
|
||||
ids: ids.join(','),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出其它入库单 Excel
|
||||
*/
|
||||
export function exportStockIn(params: ErpStockInApi.StockInPageParams) {
|
||||
return requestClient.download('/erp/stock-in/export-excel', {
|
||||
params,
|
||||
});
|
||||
}
|
|
@ -0,0 +1,117 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpStockMoveApi {
|
||||
/** 库存调拨单信息 */
|
||||
export interface StockMove {
|
||||
id?: number; // 调拨编号
|
||||
no: string; // 调拨单号
|
||||
outTime: Date; // 调拨时间
|
||||
totalCount: number; // 合计数量
|
||||
totalPrice: number; // 合计金额,单位:元
|
||||
status: number; // 状态
|
||||
remark: string; // 备注
|
||||
fileUrl?: string; // 附件
|
||||
fromWarehouseId?: number; // 来源仓库编号
|
||||
createTime: Date; // 创建时间
|
||||
creator: string; // 创建人
|
||||
creatorName: string; // 创建人名称
|
||||
productNames: string; // 产品名称
|
||||
items?: StockMoveItem[]; // 子表信息
|
||||
}
|
||||
|
||||
/** 库存调拨单子表信息 */
|
||||
export interface StockMoveItem {
|
||||
count: number; // 数量
|
||||
fromWarehouseId?: number; // 来源仓库ID
|
||||
id?: number; // ID
|
||||
productBarCode: string; // 产品条形码
|
||||
productId?: number; // 产品ID
|
||||
productName?: string; // 产品名称
|
||||
productPrice: number; // 产品单价
|
||||
productUnitName?: string; // 产品单位
|
||||
remark?: string; // 备注
|
||||
stockCount: number; // 库存数量
|
||||
toWarehouseId?: number; // 目标仓库ID
|
||||
totalPrice?: number; // 总价
|
||||
}
|
||||
|
||||
/** 库存调拨单分页查询参数 */
|
||||
export interface StockMovePageParams extends PageParam {
|
||||
no?: string;
|
||||
status?: number;
|
||||
}
|
||||
|
||||
/** 库存调拨单状态更新参数 */
|
||||
export interface StockMoveStatusParams {
|
||||
id: number;
|
||||
status: number;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询库存调拨单分页
|
||||
*/
|
||||
export function getStockMovePage(params: ErpStockMoveApi.StockMovePageParams) {
|
||||
return requestClient.get<PageResult<ErpStockMoveApi.StockMove>>(
|
||||
'/erp/stock-move/page',
|
||||
{
|
||||
params,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询库存调拨单详情
|
||||
*/
|
||||
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(
|
||||
params: ErpStockMoveApi.StockMoveStatusParams,
|
||||
) {
|
||||
return requestClient.put('/erp/stock-move/update-status', null, {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除库存调拨单
|
||||
*/
|
||||
export function deleteStockMove(ids: number[]) {
|
||||
return requestClient.delete('/erp/stock-move/delete', {
|
||||
params: {
|
||||
ids: ids.join(','),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出库存调拨单 Excel
|
||||
*/
|
||||
export function exportStockMove(params: ErpStockMoveApi.StockMovePageParams) {
|
||||
return requestClient.download('/erp/stock-move/export-excel', {
|
||||
params,
|
||||
});
|
||||
}
|
|
@ -0,0 +1,114 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpStockOutApi {
|
||||
/** 其它出库单信息 */
|
||||
export interface StockOut {
|
||||
id?: number; // 出库编号
|
||||
no: string; // 出库单号
|
||||
customerId: number; // 客户编号
|
||||
outTime: Date; // 出库时间
|
||||
totalCount: number; // 合计数量
|
||||
totalPrice: number; // 合计金额,单位:元
|
||||
status: number; // 状态
|
||||
remark: string; // 备注
|
||||
fileUrl?: string; // 附件
|
||||
items?: StockOutItem[]; // 出库产品清单
|
||||
}
|
||||
|
||||
/** 其它出库单产品信息 */
|
||||
export interface StockOutItem {
|
||||
id?: number; // 编号
|
||||
warehouseId?: number; // 仓库编号
|
||||
productId?: number; // 产品编号
|
||||
productName?: string; // 产品名称
|
||||
productUnitId?: number; // 产品单位编号
|
||||
productUnitName?: string; // 产品单位名称
|
||||
productBarCode?: string; // 产品条码
|
||||
count: number; // 数量
|
||||
productPrice: number; // 产品单价
|
||||
totalPrice: number; // 总价
|
||||
stockCount?: number; // 库存数量
|
||||
remark?: string; // 备注
|
||||
}
|
||||
|
||||
/** 其它出库单分页查询参数 */
|
||||
export interface StockOutPageParams extends PageParam {
|
||||
no?: string;
|
||||
customerId?: number;
|
||||
status?: number;
|
||||
}
|
||||
|
||||
/** 其它出库单状态更新参数 */
|
||||
export interface StockOutStatusParams {
|
||||
id: number;
|
||||
status: number;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询其它出库单分页
|
||||
*/
|
||||
export function getStockOutPage(params: ErpStockOutApi.StockOutPageParams) {
|
||||
return requestClient.get<PageResult<ErpStockOutApi.StockOut>>(
|
||||
'/erp/stock-out/page',
|
||||
{
|
||||
params,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询其它出库单详情
|
||||
*/
|
||||
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(
|
||||
params: ErpStockOutApi.StockOutStatusParams,
|
||||
) {
|
||||
return requestClient.put('/erp/stock-out/update-status', null, {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除其它出库单
|
||||
*/
|
||||
export function deleteStockOut(ids: number[]) {
|
||||
return requestClient.delete('/erp/stock-out/delete', {
|
||||
params: {
|
||||
ids: ids.join(','),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出其它出库单 Excel
|
||||
*/
|
||||
export function exportStockOut(params: ErpStockOutApi.StockOutPageParams) {
|
||||
return requestClient.download('/erp/stock-out/export-excel', {
|
||||
params,
|
||||
});
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpStockRecordApi {
|
||||
/** ERP 产品库存明细 */
|
||||
export interface StockRecord {
|
||||
id?: number; // 编号
|
||||
productId: number; // 产品编号
|
||||
warehouseId: number; // 仓库编号
|
||||
count: number; // 出入库数量
|
||||
totalCount: number; // 总库存量
|
||||
bizType: number; // 业务类型
|
||||
bizId: number; // 业务编号
|
||||
bizItemId: number; // 业务项编号
|
||||
bizNo: string; // 业务单号
|
||||
}
|
||||
|
||||
/** 库存记录分页查询参数 */
|
||||
export interface StockRecordPageParam extends PageParam {
|
||||
productId?: number;
|
||||
warehouseId?: number;
|
||||
bizType?: number;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询产品库存明细分页 */
|
||||
export function getStockRecordPage(
|
||||
params: ErpStockRecordApi.StockRecordPageParam,
|
||||
) {
|
||||
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 });
|
||||
}
|
|
@ -0,0 +1,83 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpStockApi {
|
||||
/** 产品库存信息 */
|
||||
export interface Stock {
|
||||
id?: number; // 编号
|
||||
productId: number; // 产品编号
|
||||
warehouseId: number; // 仓库编号
|
||||
count: number; // 库存数量
|
||||
}
|
||||
|
||||
/** 产品库存分页查询参数 */
|
||||
export interface StockPageParams extends PageParam {
|
||||
productId?: number;
|
||||
warehouseId?: number;
|
||||
}
|
||||
|
||||
/** 产品库存查询参数 */
|
||||
export interface StockQueryParams {
|
||||
productId: number;
|
||||
warehouseId: number;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询产品库存分页
|
||||
*/
|
||||
export function getStockPage(params: ErpStockApi.StockPageParams) {
|
||||
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) {
|
||||
params.warehouseId = warehouseId;
|
||||
}
|
||||
return requestClient.get<number>('/erp/stock/get-count', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出产品库存 Excel
|
||||
*/
|
||||
export function exportStock(params: ErpStockApi.StockPageParams) {
|
||||
return requestClient.download('/erp/stock/export-excel', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取库存数量
|
||||
*/
|
||||
export function getWarehouseStockCount(params: ErpStockApi.StockQueryParams) {
|
||||
return requestClient.get<number>('/erp/stock/get-count', {
|
||||
params,
|
||||
});
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpWarehouseApi {
|
||||
/** ERP 仓库信息 */
|
||||
export interface Warehouse {
|
||||
id?: number; // 仓库编号
|
||||
name: string; // 仓库名称
|
||||
address: string; // 仓库地址
|
||||
sort: number; // 排序
|
||||
remark: string; // 备注
|
||||
principal: string; // 负责人
|
||||
warehousePrice: number; // 仓储费,单位:元
|
||||
truckagePrice: number; // 搬运费,单位:元
|
||||
status: number; // 开启状态
|
||||
defaultStatus: boolean; // 是否默认
|
||||
}
|
||||
|
||||
/** 仓库分页查询参数 */
|
||||
export interface WarehousePageParam extends PageParam {
|
||||
name?: string;
|
||||
status?: number;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询仓库分页 */
|
||||
export function getWarehousePage(params: ErpWarehouseApi.WarehousePageParam) {
|
||||
return requestClient.get<PageResult<ErpWarehouseApi.Warehouse>>(
|
||||
'/erp/warehouse/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询仓库精简列表 */
|
||||
export function getWarehouseSimpleList() {
|
||||
return requestClient.get<ErpWarehouseApi.Warehouse[]>(
|
||||
'/erp/warehouse/simple-list',
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询仓库详情 */
|
||||
export function getWarehouse(id: number) {
|
||||
return requestClient.get<ErpWarehouseApi.Warehouse>(
|
||||
`/erp/warehouse/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增仓库 */
|
||||
export function createWarehouse(data: ErpWarehouseApi.Warehouse) {
|
||||
return requestClient.post('/erp/warehouse/create', data);
|
||||
}
|
||||
|
||||
/** 修改仓库 */
|
||||
export function updateWarehouse(data: ErpWarehouseApi.Warehouse) {
|
||||
return requestClient.put('/erp/warehouse/update', data);
|
||||
}
|
||||
|
||||
/** 修改仓库默认状态 */
|
||||
export function updateWarehouseDefaultStatus(
|
||||
id: number,
|
||||
defaultStatus: boolean,
|
||||
) {
|
||||
return requestClient.put('/erp/warehouse/update-default-status', null, {
|
||||
params: { id, defaultStatus },
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除仓库 */
|
||||
export function deleteWarehouse(id: number) {
|
||||
return requestClient.delete(`/erp/warehouse/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 导出仓库 Excel */
|
||||
export function exportWarehouse(params: any) {
|
||||
return requestClient.download('/erp/warehouse/export-excel', { params });
|
||||
}
|
|
@ -16,6 +16,7 @@ export namespace InfraFileConfigApi {
|
|||
accessKey?: string;
|
||||
accessSecret?: string;
|
||||
pathStyle?: boolean;
|
||||
enablePublicAccess?: boolean;
|
||||
domain: string;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ import {
|
|||
RequestClient,
|
||||
} from '@vben/request';
|
||||
import { useAccessStore } from '@vben/stores';
|
||||
import { createApiEncrypt } from '@vben/utils';
|
||||
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
|
@ -21,6 +22,7 @@ import { refreshTokenApi } from './core';
|
|||
|
||||
const { apiURL } = useAppConfig(import.meta.env, import.meta.env.PROD);
|
||||
const tenantEnable = isTenantEnable();
|
||||
const apiEncrypt = createApiEncrypt(import.meta.env);
|
||||
|
||||
function createRequestClient(baseURL: string, options?: RequestClientOptions) {
|
||||
const client = new RequestClient({
|
||||
|
@ -84,10 +86,46 @@ function createRequestClient(baseURL: string, options?: RequestClientOptions) {
|
|||
config.headers['visit-tenant-id'] = tenantEnable
|
||||
? accessStore.visitTenantId
|
||||
: undefined;
|
||||
|
||||
// 是否 API 加密
|
||||
if ((config.headers || {}).isEncrypt) {
|
||||
try {
|
||||
// 加密请求数据
|
||||
if (config.data) {
|
||||
config.data = apiEncrypt.encryptRequest(config.data);
|
||||
// 设置加密标识头
|
||||
config.headers[apiEncrypt.getEncryptHeader()] = 'true';
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('请求数据加密失败:', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return config;
|
||||
},
|
||||
});
|
||||
|
||||
// API 解密响应拦截器
|
||||
client.addResponseInterceptor({
|
||||
fulfilled: (response) => {
|
||||
// 检查是否需要解密响应数据
|
||||
const encryptHeader = apiEncrypt.getEncryptHeader();
|
||||
const isEncryptResponse =
|
||||
response.headers[encryptHeader] === 'true' ||
|
||||
response.headers[encryptHeader.toLowerCase()] === 'true';
|
||||
if (isEncryptResponse && typeof response.data === 'string') {
|
||||
try {
|
||||
// 解密响应数据
|
||||
response.data = apiEncrypt.decryptResponse(response.data);
|
||||
} catch (error) {
|
||||
console.error('响应数据解密失败:', error);
|
||||
throw new Error(`响应数据解密失败: ${(error as Error).message}`);
|
||||
}
|
||||
}
|
||||
return response;
|
||||
},
|
||||
});
|
||||
|
||||
// 处理返回的响应数据格式
|
||||
client.addResponseInterceptor(
|
||||
defaultResponseInterceptor({
|
||||
|
|
|
@ -8,7 +8,9 @@ export namespace SystemMailLogApi {
|
|||
id: number;
|
||||
userId: number;
|
||||
userType: number;
|
||||
toMail: string;
|
||||
toMails: string[];
|
||||
ccMails?: string[];
|
||||
bccMails?: string[];
|
||||
accountId: number;
|
||||
fromMail: string;
|
||||
templateId: number;
|
||||
|
@ -32,15 +34,3 @@ export function getMailLogPage(params: PageParam) {
|
|||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询邮件日志详情 */
|
||||
export function getMailLog(id: number) {
|
||||
return requestClient.get<SystemMailLogApi.MailLog>(
|
||||
`/system/mail-log/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 重新发送邮件 */
|
||||
export function resendMail(id: number) {
|
||||
return requestClient.put(`/system/mail-log/resend?id=${id}`);
|
||||
}
|
||||
|
|
|
@ -20,7 +20,9 @@ export namespace SystemMailTemplateApi {
|
|||
|
||||
/** 邮件发送信息 */
|
||||
export interface MailSendReq {
|
||||
mail: string;
|
||||
toMails: string[];
|
||||
ccMails?: string[];
|
||||
bccMails?: string[];
|
||||
templateCode: string;
|
||||
templateParams: Record<string, any>;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ export namespace SystemTenantApi {
|
|||
contactMobile: string;
|
||||
accountCount: number;
|
||||
expireTime: Date;
|
||||
website: string;
|
||||
websites: string[];
|
||||
status: number;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
export { default as Tinyflow } from './tinyflow.vue';
|
||||
|
||||
export * from './ui/typing';
|
||||
|
|
|
@ -359,7 +359,8 @@ async function saveConfig() {
|
|||
currentNode.value.signEnable = configForm.value.signEnable;
|
||||
// 审批意见
|
||||
currentNode.value.reasonRequire = configForm.value.reasonRequire;
|
||||
|
||||
// 跳过表达式
|
||||
currentNode.value.skipExpression = configForm.value.skipExpression;
|
||||
currentNode.value.showText = getShowText();
|
||||
drawerApi.close();
|
||||
return true;
|
||||
|
@ -443,7 +444,8 @@ function showUserTaskNodeConfig(node: SimpleFlowNode) {
|
|||
configForm.value.signEnable = node?.signEnable ?? false;
|
||||
// 7. 审批意见
|
||||
configForm.value.reasonRequire = node?.reasonRequire ?? false;
|
||||
|
||||
// 8. 跳过表达式
|
||||
configForm.value.skipExpression = node?.skipExpression ?? '';
|
||||
drawerApi.open();
|
||||
}
|
||||
|
||||
|
@ -850,7 +852,7 @@ onMounted(() => {
|
|||
label="流程表达式"
|
||||
name="expression"
|
||||
>
|
||||
<Textarea v-model:value="configForm.expression" clearable />
|
||||
<Textarea v-model:value="configForm.expression" allow-clear />
|
||||
</FormItem>
|
||||
<!-- 多人审批/办理 方式 -->
|
||||
<FormItem :label="`多人${nodeTypeName}方式`" name="approveMethod">
|
||||
|
@ -1117,6 +1119,16 @@ onMounted(() => {
|
|||
/>
|
||||
</FormItem>
|
||||
</div>
|
||||
<div>
|
||||
<Divider content-position="left">跳过表达式</Divider>
|
||||
<FormItem prop="skipExpression">
|
||||
<Textarea
|
||||
v-model:value="configForm.skipExpression"
|
||||
allow-clear
|
||||
:rows="2"
|
||||
/>
|
||||
</FormItem>
|
||||
</div>
|
||||
</Form>
|
||||
</div>
|
||||
</TabPane>
|
||||
|
|
|
@ -602,6 +602,8 @@ export interface SimpleFlowNode {
|
|||
signEnable?: boolean;
|
||||
// 审批意见
|
||||
reasonRequire?: boolean;
|
||||
// 跳过表达式
|
||||
skipExpression?: string;
|
||||
// 触发器设置
|
||||
triggerSetting?: TriggerSetting;
|
||||
// 子流程
|
||||
|
|
|
@ -214,6 +214,7 @@ export type UserTaskFormType = {
|
|||
returnNodeId?: string;
|
||||
roleIds?: number[]; // 角色
|
||||
signEnable: boolean;
|
||||
skipExpression?: string; // 跳过表达式
|
||||
taskAssignListener?: {
|
||||
body: HttpRequestParam[];
|
||||
header: HttpRequestParam[];
|
||||
|
|
|
@ -137,7 +137,7 @@ function handleButtonClick(action: ActionItem) {
|
|||
}
|
||||
}
|
||||
|
||||
// 监听props变化,强制重新计算
|
||||
/** 监听props变化,强制重新计算 */
|
||||
watch(
|
||||
() => [props.actions, props.dropDownActions],
|
||||
() => {
|
||||
|
|
|
@ -979,11 +979,11 @@ export enum BpmTaskStatusEnum {
|
|||
* 审批通过
|
||||
*/
|
||||
APPROVE = 2,
|
||||
|
||||
/**
|
||||
* 审批通过中
|
||||
*/
|
||||
APPROVING = 7,
|
||||
|
||||
/**
|
||||
* 已取消
|
||||
*/
|
||||
|
@ -992,7 +992,6 @@ export enum BpmTaskStatusEnum {
|
|||
* 未开始
|
||||
*/
|
||||
NOT_START = -1,
|
||||
|
||||
/**
|
||||
* 审批不通过
|
||||
*/
|
||||
|
@ -1002,10 +1001,15 @@ export enum BpmTaskStatusEnum {
|
|||
* 已退回
|
||||
*/
|
||||
RETURN = 5,
|
||||
|
||||
/**
|
||||
* 审批中
|
||||
*/
|
||||
RUNNING = 1,
|
||||
/**
|
||||
* 跳过
|
||||
*/
|
||||
SKIP = -2,
|
||||
/**
|
||||
* 待审批
|
||||
*/
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
// TODO @芋艿:后续这些 form-create 的优化;另外需要使用 form-create-helper 会好点
|
||||
import { isRef } from 'vue';
|
||||
|
||||
import formCreate from '@form-create/ant-design-vue';
|
||||
// 编码表单 Conf
|
||||
export const encodeConf = (designerRef: any) => {
|
||||
return JSON.stringify(designerRef.value.getOption());
|
||||
|
@ -23,7 +24,7 @@ export const encodeFields = (designerRef: any) => {
|
|||
export const decodeFields = (fields: string[]) => {
|
||||
const rule: object[] = [];
|
||||
fields.forEach((item) => {
|
||||
rule.push(JSON.parse(item));
|
||||
rule.push(formCreate.parseJson(item));
|
||||
});
|
||||
return rule;
|
||||
};
|
||||
|
@ -34,7 +35,7 @@ export const setConfAndFields = (
|
|||
conf: string,
|
||||
fields: string | string[],
|
||||
) => {
|
||||
designerRef.value.setOption(JSON.parse(conf));
|
||||
designerRef.value.setOption(formCreate.parseJson(conf));
|
||||
// 处理 fields 参数类型,确保传入 decodeFields 的是 string[] 类型
|
||||
const fieldsArray = Array.isArray(fields) ? fields : [fields];
|
||||
designerRef.value.setRule(decodeFields(fieldsArray));
|
||||
|
@ -50,7 +51,7 @@ export const setConfAndFields2 = (
|
|||
if (isRef(detailPreview)) {
|
||||
detailPreview = detailPreview.value;
|
||||
}
|
||||
detailPreview.option = JSON.parse(conf);
|
||||
detailPreview.option = formCreate.parseJson(conf);
|
||||
detailPreview.rule = decodeFields(fields);
|
||||
if (value) {
|
||||
detailPreview.value = value;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<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';
|
||||
|
||||
|
@ -23,6 +24,7 @@ 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';
|
||||
|
||||
/** AI 聊天对话 列表 */
|
||||
defineOptions({ name: 'AiChat' });
|
||||
|
||||
|
|
|
@ -104,7 +104,10 @@ onMounted(async () => {
|
|||
</template>
|
||||
<template #userId="{ row }">
|
||||
<span>
|
||||
{{ userList.find((item) => item.id === row.userId)?.nickname }}
|
||||
{{
|
||||
userList.find((item: SystemUserApi.User) => item.id === row.userId)
|
||||
?.nickname
|
||||
}}
|
||||
</span>
|
||||
</template>
|
||||
<template #publicStatus="{ row }">
|
||||
|
|
|
@ -108,7 +108,10 @@ onMounted(async () => {
|
|||
</template>
|
||||
<template #userId="{ row }">
|
||||
<span>
|
||||
{{ userList.find((item) => item.id === row.userId)?.nickname }}
|
||||
{{
|
||||
userList.find((item: SystemUserApi.User) => item.id === row.userId)
|
||||
?.nickname
|
||||
}}
|
||||
</span>
|
||||
</template>
|
||||
<template #actions="{ row }">
|
||||
|
|
|
@ -112,7 +112,11 @@ onMounted(async () => {
|
|||
</template>
|
||||
<template #keyId="{ row }">
|
||||
<span>
|
||||
{{ apiKeyList.find((item) => item.id === row.keyId)?.name }}
|
||||
{{
|
||||
apiKeyList.find(
|
||||
(item: AiModelApiKeyApi.ApiKey) => item.id === row.keyId,
|
||||
)?.name
|
||||
}}
|
||||
</span>
|
||||
</template>
|
||||
<template #actions="{ row }">
|
||||
|
|
|
@ -123,6 +123,7 @@ const formData: any = ref({
|
|||
enable: false,
|
||||
summary: [],
|
||||
},
|
||||
allowWithdrawTask: false,
|
||||
});
|
||||
|
||||
// 流程数据
|
||||
|
@ -178,6 +179,16 @@ async function initData() {
|
|||
// 特殊:复制场景
|
||||
if (route.params.type === 'copy') {
|
||||
delete formData.value.id;
|
||||
if (formData.value.bpmnXml) {
|
||||
formData.value.bpmnXml = formData.value.bpmnXml.replaceAll(
|
||||
formData.value.name,
|
||||
`${formData.value.name}副本`,
|
||||
);
|
||||
formData.value.bpmnXml = formData.value.bpmnXml.replaceAll(
|
||||
formData.value.key,
|
||||
`${formData.value.key}_copy`,
|
||||
);
|
||||
}
|
||||
formData.value.name += '副本';
|
||||
formData.value.key += '_copy';
|
||||
}
|
||||
|
|
|
@ -69,7 +69,27 @@ const selectedUsers = ref<number[]>();
|
|||
|
||||
const rules: Record<string, Rule[]> = {
|
||||
name: [{ required: true, message: '流程名称不能为空', trigger: 'blur' }],
|
||||
key: [{ required: true, message: '流程标识不能为空', trigger: 'blur' }],
|
||||
key: [
|
||||
{ required: true, message: '流程标识不能为空', trigger: 'blur' },
|
||||
{
|
||||
validator: (_rule: any, value: string, callback: any) => {
|
||||
if (!value) {
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
if (!/^[a-z_][\-\w.$]*$/i.test(value)) {
|
||||
callback(
|
||||
new Error(
|
||||
'只能包含字母、数字、下划线、连字符和点号,且必须以字母或下划线开头',
|
||||
),
|
||||
);
|
||||
return;
|
||||
}
|
||||
callback();
|
||||
},
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
category: [{ required: true, message: '流程分类不能为空', trigger: 'blur' }],
|
||||
type: [{ required: true, message: '流程类型不能为空', trigger: 'blur' }],
|
||||
visible: [{ required: true, message: '是否可见不能为空', trigger: 'blur' }],
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script setup lang="ts">
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { computed, provide, ref, watch } from 'vue';
|
||||
|
||||
import { CircleHelp } from '@vben/icons';
|
||||
|
||||
|
@ -146,7 +146,7 @@ function handleTaskAfterTriggerEnableChange(val: boolean | number | string) {
|
|||
: null;
|
||||
}
|
||||
|
||||
/** 表单选项 */
|
||||
/** 表单字段 */
|
||||
const formField = ref<Array<{ field: string; title: string }>>([]);
|
||||
const formFieldOptions4Title = computed(() => {
|
||||
const cloneFormField = formField.value.map((item) => {
|
||||
|
@ -178,6 +178,9 @@ const formFieldOptions4Summary = computed(() => {
|
|||
};
|
||||
});
|
||||
});
|
||||
const unParsedFormFields = ref<string[]>([]); // 未解析的表单字段
|
||||
// 暴露给子组件 HttpRequestSetting 使用
|
||||
provide('formFields', unParsedFormFields);
|
||||
|
||||
/** 兼容以前未配置更多设置的流程 */
|
||||
function initData() {
|
||||
|
@ -217,6 +220,9 @@ function initData() {
|
|||
if (modelData.value.taskAfterTriggerSetting) {
|
||||
taskAfterTriggerEnable.value = true;
|
||||
}
|
||||
if (modelData.value.allowWithdrawTask === undefined) {
|
||||
modelData.value.allowWithdrawTask = false;
|
||||
}
|
||||
}
|
||||
|
||||
/** 监听表单 ID 变化,加载表单数据 */
|
||||
|
@ -227,6 +233,7 @@ watch(
|
|||
const data = await FormApi.getFormDetail(newFormId);
|
||||
const result: Array<{ field: string; title: string }> = [];
|
||||
if (data.fields) {
|
||||
unParsedFormFields.value = data.fields;
|
||||
data.fields.forEach((fieldStr: string) => {
|
||||
parseFormFields(JSON.parse(fieldStr), result);
|
||||
});
|
||||
|
@ -234,6 +241,7 @@ watch(
|
|||
formField.value = result;
|
||||
} else {
|
||||
formField.value = [];
|
||||
unParsedFormFields.value = [];
|
||||
}
|
||||
},
|
||||
{ immediate: true },
|
||||
|
@ -267,6 +275,18 @@ defineExpose({ initData, validate });
|
|||
</div>
|
||||
</div>
|
||||
</FormItem>
|
||||
<FormItem class="mb-5" label="审批人权限">
|
||||
<div class="mt-1 flex flex-col">
|
||||
<Checkbox v-model:checked="modelData.allowWithdrawTask">
|
||||
允许审批人撤回任务
|
||||
</Checkbox>
|
||||
<div class="ml-6">
|
||||
<TypographyText type="secondary">
|
||||
审批人可撤回正在审批节点的前一节点
|
||||
</TypographyText>
|
||||
</div>
|
||||
</div>
|
||||
</FormItem>
|
||||
<FormItem v-if="modelData.processIdRule" class="mb-5" label="流程编码">
|
||||
<Row :gutter="8" align="middle">
|
||||
<Col :span="1">
|
||||
|
|
|
@ -415,6 +415,7 @@ const handleRenameSuccess = () => {
|
|||
>
|
||||
<div class="flex h-12 items-center">
|
||||
<!-- 头部:分类名 -->
|
||||
<!-- TODO @jason:1)无法拖动排序;2)拖动后,直接请求排序,不用有个【保存】;排序模型分类,和排序分类里的模型,交互有点不同哈。 -->
|
||||
<div class="flex items-center">
|
||||
<Tooltip v-if="isCategorySorting" title="拖动排序">
|
||||
<span
|
||||
|
|
|
@ -7,6 +7,7 @@ import { computed, nextTick, ref, watch } from 'vue';
|
|||
import { useTabs } from '@vben/hooks';
|
||||
import { IconifyIcon } from '@vben/icons';
|
||||
|
||||
import formCreate from '@form-create/ant-design-vue';
|
||||
import { Button, Card, Col, message, Row, Space, Tabs } from 'ant-design-vue';
|
||||
|
||||
import { getProcessDefinition } from '#/api/bpm/definition';
|
||||
|
@ -50,6 +51,9 @@ const props = defineProps({
|
|||
|
||||
const emit = defineEmits(['cancel']);
|
||||
|
||||
// 增加表单就绪状态变量 表单就绪后再渲染form-create
|
||||
const isFormReady = ref(false);
|
||||
|
||||
const { closeCurrentTab } = useTabs();
|
||||
|
||||
const getTitle = computed(() => {
|
||||
|
@ -126,16 +130,18 @@ async function initProcessInfo(row: any, formVariables?: any) {
|
|||
// 注意:需要从 formVariables 中,移除不在 row.formFields 的值。
|
||||
// 原因是:后端返回的 formVariables 里面,会有一些非表单的信息。例如说,某个流程节点的审批人。
|
||||
// 这样,就可能导致一个流程被审批不通过后,重新发起时,会直接后端报错!!!
|
||||
const allowedFields = new Set(
|
||||
decodeFields(row.formFields).map((fieldObj: any) => fieldObj.field),
|
||||
);
|
||||
const formApi = formCreate.create(decodeFields(row.formFields));
|
||||
const allowedFields = formApi.fields();
|
||||
for (const key in formVariables) {
|
||||
if (!allowedFields.has(key)) {
|
||||
if (!allowedFields.includes(key)) {
|
||||
delete formVariables[key];
|
||||
}
|
||||
}
|
||||
setConfAndFields2(detailForm, row.formConf, row.formFields, formVariables);
|
||||
|
||||
// 设置表单就绪状态
|
||||
isFormReady.value = true;
|
||||
|
||||
await nextTick();
|
||||
fApi.value?.btn.show(false); // 隐藏提交按钮
|
||||
|
||||
|
@ -292,6 +298,7 @@ defineExpose({ initProcessInfo });
|
|||
class="flex-1 overflow-auto"
|
||||
>
|
||||
<form-create
|
||||
v-if="isFormReady"
|
||||
:rule="detailForm.rule"
|
||||
v-model:api="fApi"
|
||||
v-model="detailForm.value"
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
import type { BpmProcessInstanceApi } from '#/api/bpm/processInstance';
|
||||
import type { SystemUserApi } from '#/api/system/user';
|
||||
|
||||
// TODO @jason:业务表单审批时,读取不到界面,参见 https://t.zsxq.com/eif2e
|
||||
|
||||
import { nextTick, onMounted, ref, shallowRef, watch } from 'vue';
|
||||
|
||||
import { Page } from '@vben/common-ui';
|
||||
|
|
|
@ -4,7 +4,7 @@ import type { Rule } from 'ant-design-vue/es/form';
|
|||
|
||||
import type { BpmProcessInstanceApi } from '#/api/bpm/processInstance';
|
||||
|
||||
import { computed, reactive, ref, watch } from 'vue';
|
||||
import { computed, nextTick, reactive, ref, watch } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
|
@ -102,6 +102,7 @@ const approveSignFormRef = ref();
|
|||
const nextAssigneesActivityNode = ref<BpmProcessInstanceApi.ApprovalNodeInfo[]>(
|
||||
[],
|
||||
); // 下一个审批节点信息
|
||||
const nextAssigneesTimelineRef = ref(); // 下一个节点审批人时间线组件的引用
|
||||
const approveReasonForm: any = reactive({
|
||||
reason: '',
|
||||
signPicUrl: '',
|
||||
|
@ -278,6 +279,10 @@ function closePopover(type: string, formRef: any | FormInstance) {
|
|||
}
|
||||
if (popOverVisible.value[type]) popOverVisible.value[type] = false;
|
||||
nextAssigneesActivityNode.value = [];
|
||||
// 清理 Timeline 组件中的自定义审批人数据
|
||||
if (nextAssigneesTimelineRef.value) {
|
||||
nextAssigneesTimelineRef.value.batchSetCustomApproveUsers({});
|
||||
}
|
||||
}
|
||||
|
||||
/** 流程通过时,根据表单变量查询新的流程节点,判断下一个节点类型是否为自选审批人 */
|
||||
|
@ -290,6 +295,7 @@ async function initNextAssigneesFormField() {
|
|||
processVariablesStr: JSON.stringify(variables),
|
||||
});
|
||||
if (data && data.length > 0) {
|
||||
const customApproveUsersData: Record<string, any[]> = {}; // 用于收集需要设置到 Timeline 组件的自定义审批人数据
|
||||
data.forEach((node: BpmProcessInstanceApi.ApprovalNodeInfo) => {
|
||||
if (
|
||||
// 情况一:当前节点没有审批人,并且是发起人自选
|
||||
|
@ -302,7 +308,23 @@ async function initNextAssigneesFormField() {
|
|||
) {
|
||||
nextAssigneesActivityNode.value.push(node);
|
||||
}
|
||||
|
||||
// 如果节点有 candidateUsers,设置到 customApproveUsers 中
|
||||
if (node.candidateUsers && node.candidateUsers.length > 0) {
|
||||
customApproveUsersData[node.id] = node.candidateUsers;
|
||||
}
|
||||
});
|
||||
|
||||
// 将 candidateUsers 设置到 Timeline 组件中
|
||||
await nextTick(); // 等待下一个 tick,确保 Timeline 组件已经渲染
|
||||
if (
|
||||
nextAssigneesTimelineRef.value &&
|
||||
Object.keys(customApproveUsersData).length > 0
|
||||
) {
|
||||
nextAssigneesTimelineRef.value.batchSetCustomApproveUsers(
|
||||
customApproveUsersData,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -364,6 +386,10 @@ async function handleAudit(pass: boolean, formRef: FormInstance | undefined) {
|
|||
await TaskApi.approveTask(data);
|
||||
popOverVisible.value.approve = false;
|
||||
nextAssigneesActivityNode.value = [];
|
||||
// 清理 Timeline 组件中的自定义审批人数据
|
||||
if (nextAssigneesTimelineRef.value) {
|
||||
nextAssigneesTimelineRef.value.batchSetCustomApproveUsers({});
|
||||
}
|
||||
message.success('审批通过成功');
|
||||
} else {
|
||||
// 审批不通过数据
|
||||
|
@ -733,9 +759,10 @@ defineExpose({ loadTodoTask });
|
|||
>
|
||||
<div class="-mb-8 -mt-3.5 ml-2.5">
|
||||
<ProcessInstanceTimeline
|
||||
ref="nextAssigneesTimelineRef"
|
||||
:activity-nodes="nextAssigneesActivityNode"
|
||||
:show-status-icon="false"
|
||||
:use-next-assignees="true"
|
||||
:enable-approve-user-select="true"
|
||||
@select-user-confirm="selectNextAssigneesConfirm"
|
||||
/>
|
||||
</div>
|
||||
|
|
|
@ -23,12 +23,12 @@ defineOptions({ name: 'BpmProcessInstanceTimeline' });
|
|||
const props = withDefaults(
|
||||
defineProps<{
|
||||
activityNodes: BpmProcessInstanceApi.ApprovalNodeInfo[]; // 审批节点信息
|
||||
enableApproveUserSelect?: boolean; // 是否开启审批人自选功能
|
||||
showStatusIcon?: boolean; // 是否显示头像右下角状态图标
|
||||
useNextAssignees?: boolean; // 是否用于下一个节点审批人选择
|
||||
}>(),
|
||||
{
|
||||
showStatusIcon: true, // 默认值为 true
|
||||
useNextAssignees: false, // 默认值为 false
|
||||
enableApproveUserSelect: false, // 默认值为 false
|
||||
},
|
||||
);
|
||||
|
||||
|
@ -43,6 +43,8 @@ const statusIconMap: Record<
|
|||
string,
|
||||
{ animation?: string; color: string; icon: string }
|
||||
> = {
|
||||
// 跳过
|
||||
'-2': { color: '#909398', icon: 'mdi:skip-forward-outline' },
|
||||
// 审批未开始
|
||||
'-1': { color: '#909398', icon: 'mdi:clock-outline' },
|
||||
// 待审批
|
||||
|
@ -181,6 +183,9 @@ function handleUserSelectConfirm(userList: any[]) {
|
|||
|
||||
/** 跳转子流程 */
|
||||
function handleChildProcess(activity: any) {
|
||||
if (!activity.processInstanceId) {
|
||||
return;
|
||||
}
|
||||
push({
|
||||
name: 'BpmProcessInstanceDetail',
|
||||
query: {
|
||||
|
@ -195,12 +200,12 @@ function shouldShowCustomUserSelect(
|
|||
) {
|
||||
return (
|
||||
isEmpty(activity.tasks) &&
|
||||
isEmpty(activity.candidateUsers) &&
|
||||
(BpmCandidateStrategyEnum.START_USER_SELECT ===
|
||||
activity.candidateStrategy ||
|
||||
(BpmCandidateStrategyEnum.APPROVE_USER_SELECT ===
|
||||
activity.candidateStrategy &&
|
||||
props.useNextAssignees))
|
||||
((BpmCandidateStrategyEnum.START_USER_SELECT ===
|
||||
activity.candidateStrategy &&
|
||||
isEmpty(activity.candidateUsers)) ||
|
||||
(props.enableApproveUserSelect &&
|
||||
BpmCandidateStrategyEnum.APPROVE_USER_SELECT ===
|
||||
activity.candidateStrategy))
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -223,6 +228,21 @@ function handleUserSelectClosed() {
|
|||
function handleUserSelectCancel() {
|
||||
selectedUsers.value = [];
|
||||
}
|
||||
|
||||
/** 设置自定义审批人 */
|
||||
const setCustomApproveUsers = (activityId: string, users: any[]) => {
|
||||
customApproveUsers.value[activityId] = users || [];
|
||||
};
|
||||
|
||||
/** 批量设置多个节点的自定义审批人 */
|
||||
const batchSetCustomApproveUsers = (data: Record<string, any[]>) => {
|
||||
Object.keys(data).forEach((activityId) => {
|
||||
customApproveUsers.value[activityId] = data[activityId] || [];
|
||||
});
|
||||
};
|
||||
|
||||
// 暴露方法给父组件
|
||||
defineExpose({ setCustomApproveUsers, batchSetCustomApproveUsers });
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -267,7 +287,12 @@ function handleUserSelectCancel() {
|
|||
>
|
||||
<!-- 第一行:节点名称、时间 -->
|
||||
<div class="flex w-full">
|
||||
<div class="font-bold">{{ activity.name }}</div>
|
||||
<div class="font-bold">
|
||||
{{ activity.name }}
|
||||
<span v-if="activity.status === BpmTaskStatusEnum.SKIP">
|
||||
【跳过】
|
||||
</span>
|
||||
</div>
|
||||
<!-- 信息:时间 -->
|
||||
<div
|
||||
v-if="activity.status !== BpmTaskStatusEnum.NOT_START"
|
||||
|
@ -284,6 +309,7 @@ function handleUserSelectCancel() {
|
|||
ghost
|
||||
size="small"
|
||||
@click="handleChildProcess(activity)"
|
||||
:disabled="!activity.processInstanceId"
|
||||
>
|
||||
查看子流程
|
||||
</Button>
|
||||
|
|
|
@ -4,8 +4,10 @@ import type { BpmTaskApi } from '#/api/bpm/task';
|
|||
|
||||
import { DocAlert, Page } from '@vben/common-ui';
|
||||
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { getTaskDonePage } from '#/api/bpm/task';
|
||||
import { getTaskDonePage, withdrawTask } from '#/api/bpm/task';
|
||||
import { router } from '#/router';
|
||||
|
||||
import { useGridColumns, useGridFormSchema } from './data';
|
||||
|
@ -23,7 +25,15 @@ function handleHistory(row: BpmTaskApi.TaskManager) {
|
|||
});
|
||||
}
|
||||
|
||||
const [Grid] = useVbenVxeGrid({
|
||||
/** 撤回任务 */
|
||||
async function handleWithdraw(row: BpmTaskApi.TaskManager) {
|
||||
await withdrawTask(row.id);
|
||||
message.success('撤回成功');
|
||||
// 刷新表格数据
|
||||
await gridApi.query();
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
formOptions: {
|
||||
schema: useGridFormSchema(),
|
||||
},
|
||||
|
@ -52,7 +62,7 @@ const [Grid] = useVbenVxeGrid({
|
|||
cellConfig: {
|
||||
height: 64,
|
||||
},
|
||||
} as VxeTableGridOptions<BpmTaskApi.Task>,
|
||||
} as VxeTableGridOptions<BpmTaskApi.TaskManager>,
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -75,6 +85,13 @@ const [Grid] = useVbenVxeGrid({
|
|||
<template #actions="{ row }">
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: '撤回',
|
||||
type: 'link',
|
||||
icon: ACTION_ICON.EDIT,
|
||||
color: 'warning',
|
||||
onClick: handleWithdraw.bind(null, row),
|
||||
},
|
||||
{
|
||||
label: '历史',
|
||||
type: 'link',
|
||||
|
|
|
@ -66,7 +66,7 @@ function handleUpdateValue(row: any) {
|
|||
} else {
|
||||
tableData.value[index] = row;
|
||||
}
|
||||
emit('update:products', tableData.value);
|
||||
emit('update:products', [...tableData.value]);
|
||||
}
|
||||
|
||||
/** 表格配置 */
|
||||
|
|
|
@ -0,0 +1,167 @@
|
|||
import type { VbenFormSchema } from '#/adapter/form';
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
|
||||
import { h } from 'vue';
|
||||
|
||||
import { Tag } from 'ant-design-vue';
|
||||
|
||||
import { z } from '#/adapter/form';
|
||||
import { CommonStatusEnum, DICT_TYPE, getDictOptions } from '#/utils';
|
||||
|
||||
/** 新增/修改的表单 */
|
||||
export function useFormSchema(): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'id',
|
||||
dependencies: {
|
||||
triggerFields: [''],
|
||||
show: () => false,
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'name',
|
||||
label: '名称',
|
||||
rules: 'required',
|
||||
componentProps: {
|
||||
placeholder: '请输入名称',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'status',
|
||||
label: '状态',
|
||||
component: 'RadioGroup',
|
||||
componentProps: {
|
||||
options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'),
|
||||
buttonStyle: 'solid',
|
||||
optionType: 'button',
|
||||
},
|
||||
rules: z.number().default(CommonStatusEnum.ENABLE),
|
||||
},
|
||||
|
||||
{
|
||||
fieldName: 'sort',
|
||||
label: '排序',
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
placeholder: '请输入排序',
|
||||
precision: 0,
|
||||
class: 'w-full',
|
||||
},
|
||||
rules: 'required',
|
||||
defaultValue: 0,
|
||||
},
|
||||
{
|
||||
fieldName: 'defaultStatus',
|
||||
label: '是否默认',
|
||||
component: 'RadioGroup',
|
||||
componentProps: {
|
||||
options: [
|
||||
{
|
||||
label: '是',
|
||||
value: true,
|
||||
},
|
||||
{
|
||||
label: '否',
|
||||
value: false,
|
||||
},
|
||||
],
|
||||
buttonStyle: 'solid',
|
||||
optionType: 'button',
|
||||
},
|
||||
rules: z.boolean().default(false).optional(),
|
||||
},
|
||||
{
|
||||
fieldName: 'no',
|
||||
label: '编码',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入编码',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'remark',
|
||||
label: '备注',
|
||||
component: 'Textarea',
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 列表的搜索表单 */
|
||||
export function useGridFormSchema(): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
fieldName: 'name',
|
||||
label: '名称',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
fieldName: 'no',
|
||||
label: '编码',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
fieldName: 'remark',
|
||||
label: '备注',
|
||||
component: 'Input',
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 列表的字段 */
|
||||
export function useGridColumns(): VxeTableGridOptions['columns'] {
|
||||
return [
|
||||
{
|
||||
field: 'name',
|
||||
title: '名称',
|
||||
},
|
||||
{
|
||||
field: 'no',
|
||||
title: '编码',
|
||||
},
|
||||
{
|
||||
field: 'remark',
|
||||
title: '备注',
|
||||
},
|
||||
{
|
||||
field: 'sort',
|
||||
title: '排序',
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
title: '状态',
|
||||
cellRender: {
|
||||
name: 'CellDict',
|
||||
props: { type: DICT_TYPE.COMMON_STATUS },
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'defaultStatus',
|
||||
title: '是否默认',
|
||||
slots: {
|
||||
default: ({ row }) => {
|
||||
return h(
|
||||
Tag,
|
||||
{
|
||||
class: 'mr-1',
|
||||
color: row.defaultStatus ? 'blue' : 'red',
|
||||
},
|
||||
() => (row.defaultStatus ? '是' : '否'),
|
||||
);
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
title: '创建时间',
|
||||
formatter: 'formatDateTime',
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
width: 130,
|
||||
fixed: 'right',
|
||||
slots: { default: 'actions' },
|
||||
},
|
||||
];
|
||||
}
|
|
@ -1,34 +1,152 @@
|
|||
<script lang="ts" setup>
|
||||
import { DocAlert, Page } from '@vben/common-ui';
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { ErpAccountApi } from '#/api/erp/finance/account';
|
||||
|
||||
import { Button } from 'ant-design-vue';
|
||||
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||
import { downloadFileFromBlobPart } from '@vben/utils';
|
||||
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import {
|
||||
deleteAccount,
|
||||
exportAccount,
|
||||
getAccountPage,
|
||||
} from '#/api/erp/finance/account';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import { useGridColumns, useGridFormSchema } from './data';
|
||||
import Form from './modules/form.vue';
|
||||
|
||||
const [FormModal, formModalApi] = useVbenModal({
|
||||
connectedComponent: Form,
|
||||
destroyOnClose: true,
|
||||
});
|
||||
|
||||
/** 刷新表格 */
|
||||
function onRefresh() {
|
||||
gridApi.query();
|
||||
}
|
||||
|
||||
/** 导出表格 */
|
||||
async function handleExport() {
|
||||
const data = await exportAccount(await gridApi.formApi.getValues());
|
||||
downloadFileFromBlobPart({ fileName: '结算账户信息.xls', source: data });
|
||||
}
|
||||
|
||||
/** 创建结算账户 */
|
||||
function handleCreate() {
|
||||
formModalApi.setData(null).open();
|
||||
}
|
||||
|
||||
/** 编辑结算账户 */
|
||||
function handleEdit(row: ErpAccountApi.Account) {
|
||||
formModalApi.setData(row).open();
|
||||
}
|
||||
|
||||
/** 删除结算账户 */
|
||||
async function handleDelete(row: ErpAccountApi.Account) {
|
||||
const hideLoading = message.loading({
|
||||
content: $t('ui.actionMessage.deleting', [row.name]),
|
||||
key: 'action_key_msg',
|
||||
});
|
||||
try {
|
||||
await deleteAccount(row.id as number);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
|
||||
key: 'action_key_msg',
|
||||
});
|
||||
onRefresh();
|
||||
} finally {
|
||||
hideLoading();
|
||||
}
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
formOptions: {
|
||||
schema: useGridFormSchema(),
|
||||
},
|
||||
gridOptions: {
|
||||
columns: useGridColumns(),
|
||||
height: 'auto',
|
||||
keepSource: true,
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues) => {
|
||||
return await getAccountPage({
|
||||
pageNo: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...formValues,
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
isHover: true,
|
||||
},
|
||||
toolbarConfig: {
|
||||
refresh: true,
|
||||
search: true,
|
||||
},
|
||||
} as VxeTableGridOptions<ErpAccountApi.Account>,
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page>
|
||||
<Page auto-content-height>
|
||||
<template #doc>
|
||||
<DocAlert
|
||||
title="【财务】采购付款、销售收款"
|
||||
url="https://doc.iocoder.cn/sale/finance-payment-receipt/"
|
||||
/>
|
||||
</template>
|
||||
<Button
|
||||
danger
|
||||
type="link"
|
||||
target="_blank"
|
||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3"
|
||||
>
|
||||
该功能支持 Vue3 + element-plus 版本!
|
||||
</Button>
|
||||
<br />
|
||||
<Button
|
||||
type="link"
|
||||
target="_blank"
|
||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/erp/finance/account/index"
|
||||
>
|
||||
可参考
|
||||
https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/erp/finance/account/index
|
||||
代码,pull request 贡献给我们!
|
||||
</Button>
|
||||
<FormModal @success="onRefresh" />
|
||||
<Grid table-title="结算账户列表">
|
||||
<template #toolbar-tools>
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: $t('ui.actionTitle.create', ['结算账户']),
|
||||
type: 'primary',
|
||||
icon: ACTION_ICON.ADD,
|
||||
auth: ['erp:account:create'],
|
||||
onClick: handleCreate,
|
||||
},
|
||||
{
|
||||
label: $t('ui.actionTitle.export'),
|
||||
type: 'primary',
|
||||
icon: ACTION_ICON.DOWNLOAD,
|
||||
auth: ['erp:account:export'],
|
||||
onClick: handleExport,
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
<template #actions="{ row }">
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: $t('common.edit'),
|
||||
type: 'link',
|
||||
icon: ACTION_ICON.EDIT,
|
||||
auth: ['erp:account:update'],
|
||||
onClick: handleEdit.bind(null, row),
|
||||
},
|
||||
{
|
||||
label: $t('common.delete'),
|
||||
type: 'link',
|
||||
danger: true,
|
||||
icon: ACTION_ICON.DELETE,
|
||||
auth: ['erp:account:delete'],
|
||||
popConfirm: {
|
||||
title: $t('ui.actionMessage.deleteConfirm', [row.name]),
|
||||
confirm: handleDelete.bind(null, row),
|
||||
},
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
</Grid>
|
||||
</Page>
|
||||
</template>
|
||||
|
|
|
@ -0,0 +1,86 @@
|
|||
<script lang="ts" setup>
|
||||
import type { ErpAccountApi } from '#/api/erp/finance/account';
|
||||
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import {
|
||||
createAccount,
|
||||
getAccount,
|
||||
updateAccount,
|
||||
} from '#/api/erp/finance/account';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import { useFormSchema } from '../data';
|
||||
|
||||
const emit = defineEmits(['success']);
|
||||
const formData = ref<ErpAccountApi.Account>();
|
||||
const getTitle = computed(() => {
|
||||
return formData.value?.id
|
||||
? $t('ui.actionTitle.edit', ['结算产品'])
|
||||
: $t('ui.actionTitle.create', ['结算产品']);
|
||||
});
|
||||
|
||||
const [Form, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
componentProps: {
|
||||
class: 'w-full',
|
||||
},
|
||||
},
|
||||
// 一共2列
|
||||
wrapperClass: 'grid-cols-1',
|
||||
layout: 'horizontal',
|
||||
schema: useFormSchema(),
|
||||
showDefaultActions: false,
|
||||
});
|
||||
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
async onConfirm() {
|
||||
const { valid } = await formApi.validate();
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
modalApi.lock();
|
||||
// 提交表单
|
||||
const data = (await formApi.getValues()) as ErpAccountApi.Account;
|
||||
try {
|
||||
await (formData.value?.id ? updateAccount(data) : createAccount(data));
|
||||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
},
|
||||
async onOpenChange(isOpen: boolean) {
|
||||
if (!isOpen) {
|
||||
formData.value = undefined;
|
||||
return;
|
||||
}
|
||||
// 加载数据
|
||||
const data = modalApi.getData<ErpAccountApi.Account>();
|
||||
if (!data || !data.id) {
|
||||
return;
|
||||
}
|
||||
modalApi.lock();
|
||||
try {
|
||||
formData.value = await getAccount(data.id as number);
|
||||
// 设置到 values
|
||||
await formApi.setValues(formData.value);
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Modal class="w-2/5" :title="getTitle">
|
||||
<Form class="mx-4" />
|
||||
</Modal>
|
||||
</template>
|
|
@ -0,0 +1,70 @@
|
|||
<script lang="ts" setup>
|
||||
import type { AnalysisOverviewItem } from '@vben/common-ui';
|
||||
|
||||
import { computed } from 'vue';
|
||||
|
||||
import { AnalysisOverview } from '@vben/common-ui';
|
||||
import {
|
||||
SvgBellIcon,
|
||||
SvgCakeIcon,
|
||||
SvgCardIcon,
|
||||
SvgDownloadIcon,
|
||||
} from '@vben/icons';
|
||||
|
||||
interface Props {
|
||||
saleSummary?: {
|
||||
monthPrice?: number;
|
||||
todayPrice?: number;
|
||||
yearPrice?: number;
|
||||
yesterdayPrice?: number;
|
||||
};
|
||||
purchaseSummary?: {
|
||||
monthPrice?: number;
|
||||
todayPrice?: number;
|
||||
yearPrice?: number;
|
||||
yesterdayPrice?: number;
|
||||
};
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
saleSummary: () => ({}),
|
||||
purchaseSummary: () => ({}),
|
||||
});
|
||||
|
||||
/** 概览数据 */
|
||||
// TODO @nehc:应该是有 8 个小卡片,少了 4 个?
|
||||
const overviewItems = computed<AnalysisOverviewItem[]>(() => [
|
||||
{
|
||||
icon: SvgCardIcon,
|
||||
title: '今日销售',
|
||||
totalTitle: '今日采购',
|
||||
totalValue: props.purchaseSummary?.todayPrice || 0,
|
||||
value: props.saleSummary?.todayPrice || 0,
|
||||
},
|
||||
{
|
||||
icon: SvgCakeIcon,
|
||||
title: '昨日销售',
|
||||
totalTitle: '昨日采购',
|
||||
totalValue: props.purchaseSummary?.yesterdayPrice || 0,
|
||||
value: props.saleSummary?.yesterdayPrice || 0,
|
||||
},
|
||||
{
|
||||
icon: SvgDownloadIcon,
|
||||
title: '本月销售',
|
||||
totalTitle: '本月采购',
|
||||
totalValue: props.purchaseSummary?.monthPrice || 0,
|
||||
value: props.saleSummary?.monthPrice || 0,
|
||||
},
|
||||
{
|
||||
icon: SvgBellIcon,
|
||||
title: '今年销售',
|
||||
totalTitle: '今年采购',
|
||||
totalValue: props.purchaseSummary?.yearPrice || 0,
|
||||
value: props.saleSummary?.yearPrice || 0,
|
||||
},
|
||||
]);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<AnalysisOverview :items="overviewItems" />
|
||||
</template>
|
|
@ -0,0 +1,174 @@
|
|||
<script lang="ts" setup>
|
||||
import type { EChartsOption } from 'echarts';
|
||||
|
||||
import type { EchartsUIType } from '@vben/plugins/echarts';
|
||||
|
||||
import type { ErpPurchaseStatisticsApi } from '#/api/erp/statistics/purchase';
|
||||
import type { ErpSaleStatisticsApi } from '#/api/erp/statistics/sale';
|
||||
|
||||
import { onMounted, ref, watch } from 'vue';
|
||||
|
||||
import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
|
||||
|
||||
import { Card } from 'ant-design-vue';
|
||||
|
||||
import {
|
||||
getPurchaseSummary,
|
||||
getPurchaseTimeSummary,
|
||||
} from '#/api/erp/statistics/purchase';
|
||||
import { getSaleSummary, getSaleTimeSummary } from '#/api/erp/statistics/sale';
|
||||
|
||||
interface Props {
|
||||
title: string;
|
||||
type?: 'purchase' | 'sale';
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
type: 'sale',
|
||||
});
|
||||
|
||||
/** 销售统计数据 */
|
||||
const saleSummary = ref<ErpSaleStatisticsApi.SaleSummary>(); // 销售概况统计
|
||||
const saleTimeSummaryList = ref<ErpSaleStatisticsApi.SaleTimeSummary[]>(); // 销售时段统计
|
||||
const getSaleStatistics = async () => {
|
||||
saleSummary.value = await getSaleSummary();
|
||||
saleTimeSummaryList.value = await getSaleTimeSummary();
|
||||
};
|
||||
|
||||
/** 采购统计数据 */
|
||||
const purchaseSummary = ref<ErpPurchaseStatisticsApi.PurchaseSummary>(); // 采购概况统计
|
||||
const purchaseTimeSummaryList =
|
||||
ref<ErpPurchaseStatisticsApi.PurchaseTimeSummary[]>(); // 采购时段统计
|
||||
const getPurchaseStatistics = async () => {
|
||||
purchaseSummary.value = await getPurchaseSummary();
|
||||
purchaseTimeSummaryList.value = await getPurchaseTimeSummary();
|
||||
};
|
||||
|
||||
/** 获取当前类型的时段数据 */
|
||||
const currentTimeSummaryList = ref<Array<{ price: number; time: string }>>();
|
||||
|
||||
const chartRef = ref<EchartsUIType>();
|
||||
const { renderEcharts } = useEcharts(chartRef);
|
||||
|
||||
/** 折线图配置 */
|
||||
const lineChartOptions: EChartsOption = {
|
||||
grid: {
|
||||
left: 20,
|
||||
right: 20,
|
||||
bottom: 20,
|
||||
top: 80,
|
||||
containLabel: true,
|
||||
},
|
||||
legend: {
|
||||
top: 50,
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '金额',
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
areaStyle: {},
|
||||
data: [],
|
||||
},
|
||||
],
|
||||
toolbox: {
|
||||
feature: {
|
||||
dataZoom: {
|
||||
yAxisIndex: false,
|
||||
},
|
||||
brush: {
|
||||
type: ['lineX', 'clear'],
|
||||
},
|
||||
saveAsImage: {
|
||||
show: true,
|
||||
name: props.title,
|
||||
},
|
||||
},
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'cross',
|
||||
},
|
||||
padding: [5, 10],
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
boundaryGap: false,
|
||||
axisTick: {
|
||||
show: false,
|
||||
},
|
||||
data: [],
|
||||
},
|
||||
yAxis: {
|
||||
axisTick: {
|
||||
show: false,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
/** 初始化数据 */
|
||||
const initData = async () => {
|
||||
if (props.type === 'sale') {
|
||||
await getSaleStatistics();
|
||||
currentTimeSummaryList.value = saleTimeSummaryList.value;
|
||||
} else {
|
||||
await getPurchaseStatistics();
|
||||
currentTimeSummaryList.value = purchaseTimeSummaryList.value;
|
||||
}
|
||||
};
|
||||
|
||||
/** 监听数据变化并更新图表 */
|
||||
watch(
|
||||
() => currentTimeSummaryList.value,
|
||||
(val) => {
|
||||
if (!val || val.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 更新图表数据
|
||||
const xAxisData = val.map((item) => item.time);
|
||||
const seriesData = val.map((item) => item.price);
|
||||
|
||||
const options = {
|
||||
...lineChartOptions,
|
||||
xAxis: {
|
||||
...lineChartOptions.xAxis,
|
||||
data: xAxisData,
|
||||
},
|
||||
series: [
|
||||
{
|
||||
...lineChartOptions.series![0],
|
||||
data: seriesData,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
renderEcharts(options);
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
/** 组件挂载时初始化数据 */
|
||||
onMounted(() => {
|
||||
initData();
|
||||
});
|
||||
|
||||
/** 暴露数据给父组件使用 */
|
||||
defineExpose({
|
||||
saleSummary,
|
||||
purchaseSummary,
|
||||
saleTimeSummaryList,
|
||||
purchaseTimeSummaryList,
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Card>
|
||||
<template #title>
|
||||
<span>{{ title }}</span>
|
||||
</template>
|
||||
<!-- 折线图 -->
|
||||
<EchartsUI ref="chartRef" />
|
||||
</Card>
|
||||
</template>
|
|
@ -1,7 +1,21 @@
|
|||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { DocAlert, Page } from '@vben/common-ui';
|
||||
|
||||
import { Button } from 'ant-design-vue';
|
||||
import { Col, Row, Spin } from 'ant-design-vue';
|
||||
|
||||
import SummaryCard from './components/SummaryCard.vue';
|
||||
import TimeSummaryChart from './components/TimeSummaryChart.vue';
|
||||
|
||||
/** ERP首页 */
|
||||
defineOptions({ name: 'ErpHome' });
|
||||
|
||||
const loading = ref(false); // 加载中
|
||||
|
||||
/** 图表组件引用 */
|
||||
const saleChartRef = ref();
|
||||
const purchaseChartRef = ref();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -12,23 +26,28 @@ import { Button } from 'ant-design-vue';
|
|||
url="https://doc.iocoder.cn/erp/build/"
|
||||
/>
|
||||
</template>
|
||||
<Button
|
||||
danger
|
||||
type="link"
|
||||
target="_blank"
|
||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3"
|
||||
>
|
||||
该功能支持 Vue3 + element-plus 版本!
|
||||
</Button>
|
||||
<br />
|
||||
<Button
|
||||
type="link"
|
||||
target="_blank"
|
||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/erp/home/index.vue"
|
||||
>
|
||||
可参考
|
||||
https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/erp/home/index.vue
|
||||
代码,pull request 贡献给我们!
|
||||
</Button>
|
||||
|
||||
<Spin :spinning="loading">
|
||||
<div class="flex flex-col gap-4">
|
||||
<!-- 销售/采购的全局统计 -->
|
||||
<SummaryCard />
|
||||
|
||||
<!-- 销售/采购的时段统计 -->
|
||||
<Row :gutter="16">
|
||||
<!-- 销售统计 -->
|
||||
<Col :md="12" :sm="12" :xs="24">
|
||||
<TimeSummaryChart ref="saleChartRef" title="销售统计" type="sale" />
|
||||
</Col>
|
||||
<!-- 采购统计 -->
|
||||
<Col :md="12" :sm="12" :xs="24">
|
||||
<TimeSummaryChart
|
||||
ref="purchaseChartRef"
|
||||
title="采购统计"
|
||||
type="purchase"
|
||||
/>
|
||||
</Col>
|
||||
</Row>
|
||||
</div>
|
||||
</Spin>
|
||||
</Page>
|
||||
</template>
|
||||
|
|
|
@ -0,0 +1,125 @@
|
|||
import type { VbenFormSchema } from '#/adapter/form';
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { ErpProductCategoryApi } from '#/api/erp/product/category';
|
||||
|
||||
import { handleTree } from '@vben/utils';
|
||||
|
||||
import { z } from '#/adapter/form';
|
||||
import { getProductCategoryList } from '#/api/erp/product/category';
|
||||
import { CommonStatusEnum, DICT_TYPE, getDictOptions } from '#/utils';
|
||||
|
||||
/** 新增/修改的表单 */
|
||||
export function useFormSchema(): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
fieldName: 'id',
|
||||
component: 'Input',
|
||||
dependencies: {
|
||||
triggerFields: [''],
|
||||
show: () => false,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'parentId',
|
||||
label: '上级分类',
|
||||
component: 'ApiTreeSelect',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
api: async () => {
|
||||
const data = await getProductCategoryList();
|
||||
data.unshift({
|
||||
id: 0,
|
||||
name: '顶级分类',
|
||||
});
|
||||
return handleTree(data);
|
||||
},
|
||||
labelField: 'name',
|
||||
valueField: 'id',
|
||||
childrenField: 'children',
|
||||
placeholder: '请选择上级分类',
|
||||
treeDefaultExpandAll: true,
|
||||
},
|
||||
rules: 'selectRequired',
|
||||
},
|
||||
{
|
||||
fieldName: 'name',
|
||||
label: '分类名称',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入分类名称',
|
||||
},
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
fieldName: 'code',
|
||||
label: '分类编码',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入分类编码',
|
||||
},
|
||||
rules: z.string().regex(/^[A-Z]+$/, '分类编码必须为大写字母'),
|
||||
},
|
||||
{
|
||||
fieldName: 'sort',
|
||||
label: '显示顺序',
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
min: 0,
|
||||
controlsPosition: 'right',
|
||||
placeholder: '请输入显示顺序',
|
||||
},
|
||||
rules: 'required',
|
||||
},
|
||||
|
||||
{
|
||||
fieldName: 'status',
|
||||
label: '状态',
|
||||
component: 'RadioGroup',
|
||||
componentProps: {
|
||||
options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'),
|
||||
buttonStyle: 'solid',
|
||||
optionType: 'button',
|
||||
},
|
||||
rules: z.number().default(CommonStatusEnum.ENABLE),
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 列表的字段 */
|
||||
export function useGridColumns(): VxeTableGridOptions<ErpProductCategoryApi.ProductCategory>['columns'] {
|
||||
return [
|
||||
{
|
||||
field: 'name',
|
||||
title: '分类名称',
|
||||
align: 'left',
|
||||
treeNode: true,
|
||||
},
|
||||
{
|
||||
field: 'code',
|
||||
title: '分类编码',
|
||||
},
|
||||
{
|
||||
field: 'sort',
|
||||
title: '显示顺序',
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
title: '分类状态',
|
||||
cellRender: {
|
||||
name: 'CellDict',
|
||||
props: { type: DICT_TYPE.COMMON_STATUS },
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
title: '创建时间',
|
||||
formatter: 'formatDateTime',
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
width: 220,
|
||||
fixed: 'right',
|
||||
slots: { default: 'actions' },
|
||||
},
|
||||
];
|
||||
}
|
|
@ -1,34 +1,166 @@
|
|||
<script lang="ts" setup>
|
||||
import { DocAlert, Page } from '@vben/common-ui';
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { ErpProductCategoryApi } from '#/api/erp/product/category';
|
||||
|
||||
import { Button } from 'ant-design-vue';
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import {
|
||||
deleteProductCategory,
|
||||
getProductCategoryList,
|
||||
} from '#/api/erp/product/category';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import { useGridColumns } from './data';
|
||||
import Form from './modules/form.vue';
|
||||
|
||||
const [FormModal, formModalApi] = useVbenModal({
|
||||
connectedComponent: Form,
|
||||
destroyOnClose: true,
|
||||
});
|
||||
|
||||
/** 刷新表格 */
|
||||
function onRefresh() {
|
||||
gridApi.query();
|
||||
}
|
||||
|
||||
/** 切换树形展开/收缩状态 */
|
||||
const isExpanded = ref(true);
|
||||
function toggleExpand() {
|
||||
isExpanded.value = !isExpanded.value;
|
||||
gridApi.grid.setAllTreeExpand(isExpanded.value);
|
||||
}
|
||||
|
||||
/** 创建分类 */
|
||||
function handleCreate() {
|
||||
formModalApi.setData(null).open();
|
||||
}
|
||||
|
||||
/** 添加下级分类 */
|
||||
function handleAppend(row: ErpProductCategoryApi.ProductCategory) {
|
||||
formModalApi.setData({ parentId: row.id }).open();
|
||||
}
|
||||
|
||||
/** 编辑分类 */
|
||||
function handleEdit(row: ErpProductCategoryApi.ProductCategory) {
|
||||
formModalApi.setData(row).open();
|
||||
}
|
||||
|
||||
/** 删除分类 */
|
||||
async function handleDelete(row: ErpProductCategoryApi.ProductCategory) {
|
||||
const hideLoading = message.loading({
|
||||
content: $t('ui.actionMessage.deleting', [row.name]),
|
||||
key: 'action_key_msg',
|
||||
});
|
||||
try {
|
||||
await deleteProductCategory(row.id as number);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
|
||||
key: 'action_key_msg',
|
||||
});
|
||||
onRefresh();
|
||||
} finally {
|
||||
hideLoading();
|
||||
}
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
gridOptions: {
|
||||
columns: useGridColumns(),
|
||||
height: 'auto',
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async () => {
|
||||
return await getProductCategoryList();
|
||||
},
|
||||
},
|
||||
},
|
||||
pagerConfig: {
|
||||
enabled: false,
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
isHover: true,
|
||||
},
|
||||
toolbarConfig: {
|
||||
refresh: true,
|
||||
search: true,
|
||||
},
|
||||
treeConfig: {
|
||||
transform: true,
|
||||
rowField: 'id',
|
||||
parentField: 'parentId',
|
||||
expandAll: true,
|
||||
accordion: false,
|
||||
},
|
||||
} as VxeTableGridOptions<ErpProductCategoryApi.ProductCategory>,
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page>
|
||||
<Page auto-content-height>
|
||||
<template #doc>
|
||||
<DocAlert
|
||||
title="【产品】产品信息、分类、单位"
|
||||
url="https://doc.iocoder.cn/erp/product/"
|
||||
/>
|
||||
</template>
|
||||
<Button
|
||||
danger
|
||||
type="link"
|
||||
target="_blank"
|
||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3"
|
||||
>
|
||||
该功能支持 Vue3 + element-plus 版本!
|
||||
</Button>
|
||||
<br />
|
||||
<Button
|
||||
type="link"
|
||||
target="_blank"
|
||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/erp/product/category/index"
|
||||
>
|
||||
可参考
|
||||
https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/erp/product/category/index
|
||||
代码,pull request 贡献给我们!
|
||||
</Button>
|
||||
<FormModal @success="onRefresh" />
|
||||
<Grid table-title="产品分类列表">
|
||||
<template #toolbar-tools>
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: $t('ui.actionTitle.create', ['产品分类']),
|
||||
type: 'primary',
|
||||
icon: ACTION_ICON.ADD,
|
||||
auth: ['erp:product-category:create'],
|
||||
onClick: handleCreate,
|
||||
},
|
||||
{
|
||||
label: isExpanded ? '收缩' : '展开',
|
||||
type: 'primary',
|
||||
onClick: toggleExpand,
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
<template #actions="{ row }">
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: '新增下级',
|
||||
type: 'link',
|
||||
icon: ACTION_ICON.ADD,
|
||||
auth: ['erp:product-category:create'],
|
||||
onClick: handleAppend.bind(null, row),
|
||||
},
|
||||
{
|
||||
label: $t('common.edit'),
|
||||
type: 'link',
|
||||
icon: ACTION_ICON.EDIT,
|
||||
auth: ['erp:product-category:update'],
|
||||
onClick: handleEdit.bind(null, row),
|
||||
},
|
||||
{
|
||||
label: $t('common.delete'),
|
||||
type: 'link',
|
||||
danger: true,
|
||||
icon: ACTION_ICON.DELETE,
|
||||
auth: ['erp:product-category:delete'],
|
||||
ifShow: !(row.children && row.children.length > 0),
|
||||
popConfirm: {
|
||||
title: $t('ui.actionMessage.deleteConfirm', [row.name]),
|
||||
confirm: handleDelete.bind(null, row),
|
||||
},
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
</Grid>
|
||||
</Page>
|
||||
</template>
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
<script lang="ts" setup>
|
||||
import type { ErpProductCategoryApi } from '#/api/erp/product/category';
|
||||
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import {
|
||||
createProductCategory,
|
||||
getProductCategory,
|
||||
updateProductCategory,
|
||||
} from '#/api/erp/product/category';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import { useFormSchema } from '../data';
|
||||
|
||||
const emit = defineEmits(['success']);
|
||||
const formData = ref<ErpProductCategoryApi.ProductCategory>();
|
||||
const getTitle = computed(() => {
|
||||
return formData.value?.id
|
||||
? $t('ui.actionTitle.edit', ['分类'])
|
||||
: $t('ui.actionTitle.create', ['分类']);
|
||||
});
|
||||
|
||||
const [Form, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
componentProps: {
|
||||
class: 'w-full',
|
||||
},
|
||||
formItemClass: 'col-span-2',
|
||||
labelWidth: 80,
|
||||
},
|
||||
layout: 'horizontal',
|
||||
schema: useFormSchema(),
|
||||
showDefaultActions: false,
|
||||
});
|
||||
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
async onConfirm() {
|
||||
const { valid } = await formApi.validate();
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
modalApi.lock();
|
||||
// 提交表单
|
||||
const data =
|
||||
(await formApi.getValues()) as ErpProductCategoryApi.ProductCategory;
|
||||
try {
|
||||
await (formData.value?.id
|
||||
? updateProductCategory(data)
|
||||
: createProductCategory(data));
|
||||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
},
|
||||
async onOpenChange(isOpen: boolean) {
|
||||
if (!isOpen) {
|
||||
formData.value = undefined;
|
||||
return;
|
||||
}
|
||||
// 加载数据
|
||||
let data = modalApi.getData<ErpProductCategoryApi.ProductCategory>();
|
||||
if (!data) {
|
||||
return;
|
||||
}
|
||||
if (data.id) {
|
||||
modalApi.lock();
|
||||
try {
|
||||
data = await getProductCategory(data.id);
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
}
|
||||
// 设置到 values
|
||||
formData.value = data;
|
||||
await formApi.setValues(formData.value);
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Modal :title="getTitle">
|
||||
<Form class="mx-4" />
|
||||
</Modal>
|
||||
</template>
|
|
@ -0,0 +1,220 @@
|
|||
import type { VbenFormSchema } from '#/adapter/form';
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
|
||||
import { handleTree } from '@vben/utils';
|
||||
|
||||
import { z } from '#/adapter/form';
|
||||
import { getProductCategorySimpleList } from '#/api/erp/product/category';
|
||||
import { getProductUnitSimpleList } from '#/api/erp/product/unit';
|
||||
import { CommonStatusEnum, DICT_TYPE, getDictOptions } from '#/utils';
|
||||
|
||||
/** 新增/修改的表单 */
|
||||
export function useFormSchema(): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'id',
|
||||
dependencies: {
|
||||
triggerFields: [''],
|
||||
show: () => false,
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'name',
|
||||
label: '名称',
|
||||
rules: 'required',
|
||||
componentProps: {
|
||||
placeholder: '请输入名称',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'barCode',
|
||||
label: '条码',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
componentProps: {
|
||||
placeholder: '请输入条码',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'categoryId',
|
||||
label: '分类',
|
||||
component: 'ApiTreeSelect',
|
||||
componentProps: {
|
||||
api: async () => {
|
||||
const data = await getProductCategorySimpleList();
|
||||
return handleTree(data);
|
||||
},
|
||||
|
||||
labelField: 'name',
|
||||
valueField: 'id',
|
||||
childrenField: 'children',
|
||||
placeholder: '请选择分类',
|
||||
treeDefaultExpandAll: true,
|
||||
},
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
fieldName: 'unitId',
|
||||
label: '单位',
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
api: getProductUnitSimpleList,
|
||||
labelField: 'name',
|
||||
valueField: 'id',
|
||||
placeholder: '请选择单位',
|
||||
},
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
fieldName: 'status',
|
||||
label: '状态',
|
||||
component: 'RadioGroup',
|
||||
componentProps: {
|
||||
options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'),
|
||||
buttonStyle: 'solid',
|
||||
optionType: 'button',
|
||||
},
|
||||
rules: z.number().default(CommonStatusEnum.ENABLE),
|
||||
},
|
||||
{
|
||||
fieldName: 'standard',
|
||||
label: '规格',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入规格',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'expiryDay',
|
||||
label: '保质期天数',
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
placeholder: '请输入保质期天数',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'weight',
|
||||
label: '重量(kg)',
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
placeholder: '请输入重量(kg)',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'purchasePrice',
|
||||
label: '采购价格',
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
placeholder: '请输入采购价格,单位:元',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'salePrice',
|
||||
label: '销售价格',
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
placeholder: '请输入销售价格,单位:元',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'minPrice',
|
||||
label: '最低价格',
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
placeholder: '请输入最低价格,单位:元',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'remark',
|
||||
label: '备注',
|
||||
component: 'Textarea',
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 列表的搜索表单 */
|
||||
export function useGridFormSchema(): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
fieldName: 'name',
|
||||
label: '名称',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
fieldName: 'categoryId',
|
||||
label: '分类',
|
||||
component: 'ApiTreeSelect',
|
||||
componentProps: {
|
||||
api: async () => {
|
||||
const data = await getProductCategorySimpleList();
|
||||
return handleTree(data);
|
||||
},
|
||||
|
||||
labelField: 'name',
|
||||
valueField: 'id',
|
||||
childrenField: 'children',
|
||||
placeholder: '请选择分类',
|
||||
treeDefaultExpandAll: true,
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 列表的字段 */
|
||||
export function useGridColumns(): VxeTableGridOptions['columns'] {
|
||||
return [
|
||||
{
|
||||
field: 'barCode',
|
||||
title: '条码',
|
||||
},
|
||||
{
|
||||
field: 'name',
|
||||
title: '名称',
|
||||
},
|
||||
{
|
||||
field: 'standard',
|
||||
title: '规格',
|
||||
},
|
||||
{
|
||||
field: 'categoryName',
|
||||
title: '分类',
|
||||
},
|
||||
{
|
||||
field: 'unitName',
|
||||
title: '单位',
|
||||
},
|
||||
{
|
||||
field: 'purchasePrice',
|
||||
title: '采购价格',
|
||||
},
|
||||
{
|
||||
field: 'salePrice',
|
||||
title: '销售价格',
|
||||
},
|
||||
{
|
||||
field: 'minPrice',
|
||||
title: '最低价格',
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
title: '状态',
|
||||
cellRender: {
|
||||
name: 'CellDict',
|
||||
props: { type: DICT_TYPE.COMMON_STATUS },
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
title: '创建时间',
|
||||
formatter: 'formatDateTime',
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
width: 130,
|
||||
fixed: 'right',
|
||||
slots: { default: 'actions' },
|
||||
},
|
||||
];
|
||||
}
|
|
@ -1,34 +1,152 @@
|
|||
<script lang="ts" setup>
|
||||
import { DocAlert, Page } from '@vben/common-ui';
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { ErpProductApi } from '#/api/erp/product/product';
|
||||
|
||||
import { Button } from 'ant-design-vue';
|
||||
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||
import { downloadFileFromBlobPart } from '@vben/utils';
|
||||
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import {
|
||||
deleteProduct,
|
||||
exportProduct,
|
||||
getProductPage,
|
||||
} from '#/api/erp/product/product';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import { useGridColumns, useGridFormSchema } from './data';
|
||||
import Form from './modules/form.vue';
|
||||
|
||||
const [FormModal, formModalApi] = useVbenModal({
|
||||
connectedComponent: Form,
|
||||
destroyOnClose: true,
|
||||
});
|
||||
|
||||
/** 刷新表格 */
|
||||
function onRefresh() {
|
||||
gridApi.query();
|
||||
}
|
||||
|
||||
/** 导出表格 */
|
||||
async function handleExport() {
|
||||
const data = await exportProduct(await gridApi.formApi.getValues());
|
||||
downloadFileFromBlobPart({ fileName: '产品信息.xls', source: data });
|
||||
}
|
||||
|
||||
/** 创建产品 */
|
||||
function handleCreate() {
|
||||
formModalApi.setData(null).open();
|
||||
}
|
||||
|
||||
/** 编辑产品 */
|
||||
function handleEdit(row: ErpProductApi.Product) {
|
||||
formModalApi.setData(row).open();
|
||||
}
|
||||
|
||||
/** 删除产品 */
|
||||
async function handleDelete(row: ErpProductApi.Product) {
|
||||
const hideLoading = message.loading({
|
||||
content: $t('ui.actionMessage.deleting', [row.name]),
|
||||
key: 'action_key_msg',
|
||||
});
|
||||
try {
|
||||
await deleteProduct(row.id as number);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
|
||||
key: 'action_key_msg',
|
||||
});
|
||||
onRefresh();
|
||||
} finally {
|
||||
hideLoading();
|
||||
}
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
formOptions: {
|
||||
schema: useGridFormSchema(),
|
||||
},
|
||||
gridOptions: {
|
||||
columns: useGridColumns(),
|
||||
height: 'auto',
|
||||
keepSource: true,
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues) => {
|
||||
return await getProductPage({
|
||||
pageNo: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...formValues,
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
isHover: true,
|
||||
},
|
||||
toolbarConfig: {
|
||||
refresh: true,
|
||||
search: true,
|
||||
},
|
||||
} as VxeTableGridOptions<ErpProductApi.Product>,
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page>
|
||||
<Page auto-content-height>
|
||||
<template #doc>
|
||||
<DocAlert
|
||||
title="【产品】产品信息、分类、单位"
|
||||
url="https://doc.iocoder.cn/erp/product/"
|
||||
/>
|
||||
</template>
|
||||
<Button
|
||||
danger
|
||||
type="link"
|
||||
target="_blank"
|
||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3"
|
||||
>
|
||||
该功能支持 Vue3 + element-plus 版本!
|
||||
</Button>
|
||||
<br />
|
||||
<Button
|
||||
type="link"
|
||||
target="_blank"
|
||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/erp/product/product/index"
|
||||
>
|
||||
可参考
|
||||
https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/erp/product/product/index
|
||||
代码,pull request 贡献给我们!
|
||||
</Button>
|
||||
<FormModal @success="onRefresh" />
|
||||
<Grid table-title="产品列表">
|
||||
<template #toolbar-tools>
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: $t('ui.actionTitle.create', ['产品']),
|
||||
type: 'primary',
|
||||
icon: ACTION_ICON.ADD,
|
||||
auth: ['erp:product:create'],
|
||||
onClick: handleCreate,
|
||||
},
|
||||
{
|
||||
label: $t('ui.actionTitle.export'),
|
||||
type: 'primary',
|
||||
icon: ACTION_ICON.DOWNLOAD,
|
||||
auth: ['erp:product:export'],
|
||||
onClick: handleExport,
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
<template #actions="{ row }">
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: $t('common.edit'),
|
||||
type: 'link',
|
||||
icon: ACTION_ICON.EDIT,
|
||||
auth: ['erp:product:update'],
|
||||
onClick: handleEdit.bind(null, row),
|
||||
},
|
||||
{
|
||||
label: $t('common.delete'),
|
||||
type: 'link',
|
||||
danger: true,
|
||||
icon: ACTION_ICON.DELETE,
|
||||
auth: ['erp:product:delete'],
|
||||
popConfirm: {
|
||||
title: $t('ui.actionMessage.deleteConfirm', [row.name]),
|
||||
confirm: handleDelete.bind(null, row),
|
||||
},
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
</Grid>
|
||||
</Page>
|
||||
</template>
|
||||
|
|
|
@ -0,0 +1,86 @@
|
|||
<script lang="ts" setup>
|
||||
import type { ErpProductApi } from '#/api/erp/product/product';
|
||||
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import {
|
||||
createProduct,
|
||||
getProduct,
|
||||
updateProduct,
|
||||
} from '#/api/erp/product/product';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import { useFormSchema } from '../data';
|
||||
|
||||
const emit = defineEmits(['success']);
|
||||
const formData = ref<ErpProductApi.Product>();
|
||||
const getTitle = computed(() => {
|
||||
return formData.value?.id
|
||||
? $t('ui.actionTitle.edit', ['产品'])
|
||||
: $t('ui.actionTitle.create', ['产品']);
|
||||
});
|
||||
|
||||
const [Form, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
componentProps: {
|
||||
class: 'w-full',
|
||||
},
|
||||
},
|
||||
// 一共2列
|
||||
wrapperClass: 'grid-cols-2',
|
||||
layout: 'horizontal',
|
||||
schema: useFormSchema(),
|
||||
showDefaultActions: false,
|
||||
});
|
||||
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
async onConfirm() {
|
||||
const { valid } = await formApi.validate();
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
modalApi.lock();
|
||||
// 提交表单
|
||||
const data = (await formApi.getValues()) as ErpProductApi.Product;
|
||||
try {
|
||||
await (formData.value?.id ? updateProduct(data) : createProduct(data));
|
||||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
},
|
||||
async onOpenChange(isOpen: boolean) {
|
||||
if (!isOpen) {
|
||||
formData.value = undefined;
|
||||
return;
|
||||
}
|
||||
// 加载数据
|
||||
const data = modalApi.getData<ErpProductApi.Product>();
|
||||
if (!data || !data.id) {
|
||||
return;
|
||||
}
|
||||
modalApi.lock();
|
||||
try {
|
||||
formData.value = await getProduct(data.id as number);
|
||||
// 设置到 values
|
||||
await formApi.setValues(formData.value);
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Modal class="w-2/5" :title="getTitle">
|
||||
<Form class="mx-4" />
|
||||
</Modal>
|
||||
</template>
|
|
@ -0,0 +1,89 @@
|
|||
import type { VbenFormSchema } from '#/adapter/form';
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
|
||||
import { z } from '#/adapter/form';
|
||||
import { CommonStatusEnum, DICT_TYPE, getDictOptions } from '#/utils';
|
||||
|
||||
/** 新增/修改的表单 */
|
||||
export function useFormSchema(): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'id',
|
||||
dependencies: {
|
||||
triggerFields: [''],
|
||||
show: () => false,
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'name',
|
||||
label: '单位名称',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
fieldName: 'status',
|
||||
label: '单位状态',
|
||||
component: 'RadioGroup',
|
||||
componentProps: {
|
||||
options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'),
|
||||
buttonStyle: 'solid',
|
||||
optionType: 'button',
|
||||
},
|
||||
rules: z.number().default(CommonStatusEnum.ENABLE),
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 列表的搜索表单 */
|
||||
export function useGridFormSchema(): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
fieldName: 'name',
|
||||
label: '单位名称',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
fieldName: 'status',
|
||||
label: '单位状态',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'),
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 列表的字段 */
|
||||
export function useGridColumns(): VxeTableGridOptions['columns'] {
|
||||
return [
|
||||
{
|
||||
field: 'id',
|
||||
title: '单位编号',
|
||||
},
|
||||
{
|
||||
field: 'name',
|
||||
title: '单位名称',
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
title: '单位状态',
|
||||
cellRender: {
|
||||
name: 'CellDict',
|
||||
props: { type: DICT_TYPE.COMMON_STATUS },
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
title: '创建时间',
|
||||
formatter: 'formatDateTime',
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
width: 130,
|
||||
fixed: 'right',
|
||||
slots: { default: 'actions' },
|
||||
},
|
||||
];
|
||||
}
|
|
@ -1,34 +1,152 @@
|
|||
<script lang="ts" setup>
|
||||
import { DocAlert, Page } from '@vben/common-ui';
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { ErpProductUnitApi } from '#/api/erp/product/unit';
|
||||
|
||||
import { Button } from 'ant-design-vue';
|
||||
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||
import { downloadFileFromBlobPart } from '@vben/utils';
|
||||
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import {
|
||||
deleteProductUnit,
|
||||
exportProductUnit,
|
||||
getProductUnitPage,
|
||||
} from '#/api/erp/product/unit';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import { useGridColumns, useGridFormSchema } from './data';
|
||||
import Form from './modules/form.vue';
|
||||
|
||||
const [FormModal, formModalApi] = useVbenModal({
|
||||
connectedComponent: Form,
|
||||
destroyOnClose: true,
|
||||
});
|
||||
|
||||
/** 刷新表格 */
|
||||
function onRefresh() {
|
||||
gridApi.query();
|
||||
}
|
||||
|
||||
/** 导出表格 */
|
||||
async function handleExport() {
|
||||
const data = await exportProductUnit(await gridApi.formApi.getValues());
|
||||
downloadFileFromBlobPart({ fileName: '产品单位.xls', source: data });
|
||||
}
|
||||
|
||||
/** 创建产品单位 */
|
||||
function handleCreate() {
|
||||
formModalApi.setData(null).open();
|
||||
}
|
||||
|
||||
/** 编辑产品单位 */
|
||||
function handleEdit(row: ErpProductUnitApi.ProductUnit) {
|
||||
formModalApi.setData(row).open();
|
||||
}
|
||||
|
||||
/** 删除产品单位 */
|
||||
async function handleDelete(row: ErpProductUnitApi.ProductUnit) {
|
||||
const hideLoading = message.loading({
|
||||
content: $t('ui.actionMessage.deleting', [row.name]),
|
||||
key: 'action_key_msg',
|
||||
});
|
||||
try {
|
||||
await deleteProductUnit(row.id as number);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
|
||||
key: 'action_key_msg',
|
||||
});
|
||||
onRefresh();
|
||||
} finally {
|
||||
hideLoading();
|
||||
}
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
formOptions: {
|
||||
schema: useGridFormSchema(),
|
||||
},
|
||||
gridOptions: {
|
||||
columns: useGridColumns(),
|
||||
height: 'auto',
|
||||
keepSource: true,
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues) => {
|
||||
return await getProductUnitPage({
|
||||
pageNo: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...formValues,
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
isHover: true,
|
||||
},
|
||||
toolbarConfig: {
|
||||
refresh: true,
|
||||
search: true,
|
||||
},
|
||||
} as VxeTableGridOptions<ErpProductUnitApi.ProductUnit>,
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page>
|
||||
<Page auto-content-height>
|
||||
<template #doc>
|
||||
<DocAlert
|
||||
title="【产品】产品信息、分类、单位"
|
||||
url="https://doc.iocoder.cn/erp/product/"
|
||||
/>
|
||||
</template>
|
||||
<Button
|
||||
danger
|
||||
type="link"
|
||||
target="_blank"
|
||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3"
|
||||
>
|
||||
该功能支持 Vue3 + element-plus 版本!
|
||||
</Button>
|
||||
<br />
|
||||
<Button
|
||||
type="link"
|
||||
target="_blank"
|
||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/erp/product/unit/index"
|
||||
>
|
||||
可参考
|
||||
https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/erp/product/unit/index
|
||||
代码,pull request 贡献给我们!
|
||||
</Button>
|
||||
<FormModal @success="onRefresh" />
|
||||
<Grid table-title="产品单位列表">
|
||||
<template #toolbar-tools>
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: $t('ui.actionTitle.create', ['产品单位']),
|
||||
type: 'primary',
|
||||
icon: ACTION_ICON.ADD,
|
||||
auth: ['erp:product-unit:create'],
|
||||
onClick: handleCreate,
|
||||
},
|
||||
{
|
||||
label: $t('ui.actionTitle.export'),
|
||||
type: 'primary',
|
||||
icon: ACTION_ICON.DOWNLOAD,
|
||||
auth: ['erp:product-unit:export'],
|
||||
onClick: handleExport,
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
<template #actions="{ row }">
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: $t('common.edit'),
|
||||
type: 'link',
|
||||
icon: ACTION_ICON.EDIT,
|
||||
auth: ['erp:product-unit:update'],
|
||||
onClick: handleEdit.bind(null, row),
|
||||
},
|
||||
{
|
||||
label: $t('common.delete'),
|
||||
type: 'link',
|
||||
danger: true,
|
||||
icon: ACTION_ICON.DELETE,
|
||||
auth: ['erp:product-unit:delete'],
|
||||
popConfirm: {
|
||||
title: $t('ui.actionMessage.deleteConfirm', [row.name]),
|
||||
confirm: handleDelete.bind(null, row),
|
||||
},
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
</Grid>
|
||||
</Page>
|
||||
</template>
|
||||
|
|
|
@ -0,0 +1,88 @@
|
|||
<script lang="ts" setup>
|
||||
import type { ErpProductUnitApi } from '#/api/erp/product/unit';
|
||||
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import {
|
||||
createProductUnit,
|
||||
getProductUnit,
|
||||
updateProductUnit,
|
||||
} from '#/api/erp/product/unit';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import { useFormSchema } from '../data';
|
||||
|
||||
const emit = defineEmits(['success']);
|
||||
const formData = ref<ErpProductUnitApi.ProductUnit>();
|
||||
const getTitle = computed(() => {
|
||||
return formData.value?.id
|
||||
? $t('ui.actionTitle.edit', ['产品单位'])
|
||||
: $t('ui.actionTitle.create', ['产品单位']);
|
||||
});
|
||||
|
||||
const [Form, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
componentProps: {
|
||||
class: 'w-full',
|
||||
},
|
||||
formItemClass: 'col-span-2',
|
||||
labelWidth: 80,
|
||||
},
|
||||
layout: 'horizontal',
|
||||
schema: useFormSchema(),
|
||||
showDefaultActions: false,
|
||||
});
|
||||
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
async onConfirm() {
|
||||
const { valid } = await formApi.validate();
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
modalApi.lock();
|
||||
// 提交表单
|
||||
const data = (await formApi.getValues()) as ErpProductUnitApi.ProductUnit;
|
||||
try {
|
||||
await (formData.value?.id
|
||||
? updateProductUnit(data)
|
||||
: createProductUnit(data));
|
||||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
},
|
||||
async onOpenChange(isOpen: boolean) {
|
||||
if (!isOpen) {
|
||||
formData.value = undefined;
|
||||
return;
|
||||
}
|
||||
// 加载数据
|
||||
const data = modalApi.getData<ErpProductUnitApi.ProductUnit>();
|
||||
if (!data || !data.id) {
|
||||
return;
|
||||
}
|
||||
modalApi.lock();
|
||||
try {
|
||||
formData.value = await getProductUnit(data.id as number);
|
||||
// 设置到 values
|
||||
await formApi.setValues(formData.value);
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Modal class="w-2/5" :title="getTitle">
|
||||
<Form class="mx-4" />
|
||||
</Modal>
|
||||
</template>
|
|
@ -0,0 +1,586 @@
|
|||
import type { VbenFormSchema } from '#/adapter/form';
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
|
||||
import { erpPriceInputFormatter } from '@vben/utils';
|
||||
|
||||
import { z } from '#/adapter/form';
|
||||
import { getAccountSimpleList } from '#/api/erp/finance/account';
|
||||
import { getProductSimpleList } from '#/api/erp/product/product';
|
||||
import { getSupplierSimpleList } from '#/api/erp/purchase/supplier';
|
||||
import { getWarehouseSimpleList } from '#/api/erp/stock/warehouse';
|
||||
import { getSimpleUserList } from '#/api/system/user';
|
||||
import { DICT_TYPE, getDictOptions } from '#/utils';
|
||||
|
||||
/** 表单的配置项 */
|
||||
export function useFormSchema(formType: string): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
style: { display: 'none' },
|
||||
},
|
||||
fieldName: 'id',
|
||||
label: 'ID',
|
||||
hideLabel: true,
|
||||
formItemClass: 'hidden',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '系统自动生成',
|
||||
disabled: true,
|
||||
},
|
||||
fieldName: 'no',
|
||||
label: '入库单号',
|
||||
},
|
||||
|
||||
{
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
disabled: true,
|
||||
placeholder: '请选择供应商',
|
||||
allowClear: true,
|
||||
showSearch: true,
|
||||
api: getSupplierSimpleList,
|
||||
fieldNames: {
|
||||
label: 'name',
|
||||
value: 'id',
|
||||
},
|
||||
},
|
||||
fieldName: 'supplierId',
|
||||
label: '供应商',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
fieldName: 'orderNo',
|
||||
label: '关联订单',
|
||||
component: 'Input',
|
||||
formItemClass: 'col-span-1',
|
||||
componentProps: {
|
||||
disabled: formType === 'detail',
|
||||
placeholder: '请选择关联订单',
|
||||
},
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
disabled: formType === 'detail',
|
||||
placeholder: '选择订单时间',
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'x',
|
||||
style: { width: '100%' },
|
||||
},
|
||||
fieldName: 'inTime',
|
||||
label: '入库时间',
|
||||
rules: 'required',
|
||||
},
|
||||
|
||||
{
|
||||
component: 'Textarea',
|
||||
componentProps: {
|
||||
placeholder: '请输入备注',
|
||||
disabled: formType === 'detail',
|
||||
autoSize: { minRows: 1, maxRows: 1 },
|
||||
class: 'w-full',
|
||||
},
|
||||
fieldName: 'remark',
|
||||
label: '备注',
|
||||
formItemClass: 'col-span-2',
|
||||
},
|
||||
|
||||
{
|
||||
component: 'FileUpload',
|
||||
componentProps: {
|
||||
disabled: formType === 'detail',
|
||||
maxNumber: 1,
|
||||
maxSize: 10,
|
||||
accept: [
|
||||
'pdf',
|
||||
'doc',
|
||||
'docx',
|
||||
'xls',
|
||||
'xlsx',
|
||||
'txt',
|
||||
'jpg',
|
||||
'jpeg',
|
||||
'png',
|
||||
],
|
||||
showDescription: true,
|
||||
},
|
||||
fieldName: 'fileUrl',
|
||||
label: '附件',
|
||||
formItemClass: 'col-span-3',
|
||||
},
|
||||
{
|
||||
fieldName: 'product',
|
||||
label: '产品清单',
|
||||
component: 'Input',
|
||||
formItemClass: 'col-span-3',
|
||||
},
|
||||
{
|
||||
component: 'InputNumber',
|
||||
fieldName: 'discountPercent',
|
||||
componentProps: {
|
||||
placeholder: '优惠率',
|
||||
min: 0,
|
||||
max: 100,
|
||||
disabled: true,
|
||||
precision: 2,
|
||||
style: { width: '100%' },
|
||||
},
|
||||
|
||||
label: '优惠率(%)',
|
||||
},
|
||||
{
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
placeholder: '付款优惠',
|
||||
precision: 2,
|
||||
formatter: erpPriceInputFormatter,
|
||||
disabled: true,
|
||||
style: { width: '100%' },
|
||||
},
|
||||
fieldName: 'discountPrice',
|
||||
label: '付款优惠',
|
||||
},
|
||||
{
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
placeholder: '优惠后金额',
|
||||
precision: 2,
|
||||
formatter: erpPriceInputFormatter,
|
||||
disabled: true,
|
||||
style: { width: '100%' },
|
||||
},
|
||||
fieldName: 'discountedPrice',
|
||||
label: '优惠后金额',
|
||||
},
|
||||
{
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
disabled: formType === 'detail',
|
||||
placeholder: '请输入其他费用',
|
||||
precision: 2,
|
||||
formatter: erpPriceInputFormatter,
|
||||
style: { width: '100%' },
|
||||
},
|
||||
fieldName: 'otherPrice',
|
||||
label: '其他费用',
|
||||
},
|
||||
{
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
placeholder: '请选择结算账户',
|
||||
disabled: true,
|
||||
allowClear: true,
|
||||
showSearch: true,
|
||||
api: getAccountSimpleList,
|
||||
fieldNames: {
|
||||
label: 'name',
|
||||
value: 'id',
|
||||
},
|
||||
},
|
||||
fieldName: 'accountId',
|
||||
label: '结算账户',
|
||||
},
|
||||
{
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
precision: 2,
|
||||
style: { width: '100%' },
|
||||
disabled: true,
|
||||
min: 0,
|
||||
},
|
||||
fieldName: 'totalPrice',
|
||||
label: '应付金额',
|
||||
rules: z.number().min(0).optional(),
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 采购订单项表格列定义 */
|
||||
export function usePurchaseOrderItemTableColumns(): VxeTableGridOptions['columns'] {
|
||||
return [
|
||||
{ type: 'seq', title: '序号', minWidth: 50, fixed: 'left' },
|
||||
{
|
||||
field: 'warehouseId',
|
||||
title: '仓库名称',
|
||||
minWidth: 200,
|
||||
slots: { default: 'warehouseId' },
|
||||
},
|
||||
{
|
||||
field: 'productId',
|
||||
title: '产品名称',
|
||||
minWidth: 200,
|
||||
slots: { default: 'productId' },
|
||||
},
|
||||
{
|
||||
field: 'stockCount',
|
||||
title: '仓库库存',
|
||||
minWidth: 80,
|
||||
},
|
||||
{
|
||||
field: 'productBarCode',
|
||||
title: '条码',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'productUnitName',
|
||||
title: '单位',
|
||||
minWidth: 80,
|
||||
},
|
||||
{
|
||||
field: 'totalCount',
|
||||
title: '原数量',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'inCount',
|
||||
title: '已入库数量',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'count',
|
||||
title: '数量',
|
||||
minWidth: 120,
|
||||
fixed: 'right',
|
||||
slots: { default: 'count' },
|
||||
},
|
||||
{
|
||||
field: 'productPrice',
|
||||
title: '产品单价',
|
||||
fixed: 'right',
|
||||
minWidth: 120,
|
||||
slots: { default: 'productPrice' },
|
||||
},
|
||||
{
|
||||
field: 'totalProductPrice',
|
||||
fixed: 'right',
|
||||
title: '产品金额',
|
||||
minWidth: 120,
|
||||
formatter: 'formatAmount2',
|
||||
},
|
||||
{
|
||||
fixed: 'right',
|
||||
field: 'taxPercent',
|
||||
title: '税率(%)',
|
||||
minWidth: 100,
|
||||
},
|
||||
{
|
||||
fixed: 'right',
|
||||
field: 'taxPrice',
|
||||
title: '税额',
|
||||
minWidth: 120,
|
||||
formatter: 'formatAmount2',
|
||||
},
|
||||
{
|
||||
field: 'totalPrice',
|
||||
fixed: 'right',
|
||||
title: '合计金额',
|
||||
minWidth: 120,
|
||||
formatter: 'formatAmount2',
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 列表的搜索表单 */
|
||||
export function useGridFormSchema(): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
fieldName: 'no',
|
||||
label: '入库单号',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入入库单号',
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'productId',
|
||||
label: '产品',
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
placeholder: '请选择产品',
|
||||
allowClear: true,
|
||||
showSearch: true,
|
||||
api: getProductSimpleList,
|
||||
fieldNames: {
|
||||
label: 'name',
|
||||
value: 'id',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'inTime',
|
||||
label: '入库时间',
|
||||
component: 'RangePicker',
|
||||
componentProps: {
|
||||
placeholder: ['开始时间', '结束时间'],
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'supplierId',
|
||||
label: '供应商',
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
placeholder: '请选择供应商',
|
||||
allowClear: true,
|
||||
showSearch: true,
|
||||
api: getSupplierSimpleList,
|
||||
fieldNames: {
|
||||
label: 'name',
|
||||
value: 'id',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'warehouseId',
|
||||
label: '仓库',
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
placeholder: '请选择仓库',
|
||||
allowClear: true,
|
||||
showSearch: true,
|
||||
api: getWarehouseSimpleList,
|
||||
labelField: 'name',
|
||||
valueField: 'id',
|
||||
filterOption: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'creator',
|
||||
label: '创建人',
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
placeholder: '请选择创建人',
|
||||
allowClear: true,
|
||||
showSearch: true,
|
||||
api: getSimpleUserList,
|
||||
fieldNames: {
|
||||
label: 'nickname',
|
||||
value: 'id',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'orderNo',
|
||||
label: '关联订单',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入关联订单号',
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'paymentStatus',
|
||||
label: '付款状态',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: [
|
||||
{ label: '未付款', value: 0 },
|
||||
{ label: '部分付款', value: 1 },
|
||||
{ label: '全部付款', value: 2 },
|
||||
],
|
||||
placeholder: '请选择退货状态',
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'status',
|
||||
label: '状态',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
placeholder: '请选择状态',
|
||||
allowClear: true,
|
||||
options: getDictOptions(DICT_TYPE.ERP_AUDIT_STATUS, 'number'),
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'remark',
|
||||
label: '备注',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入备注',
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 列表的字段 */
|
||||
export function useGridColumns(): VxeTableGridOptions['columns'] {
|
||||
return [
|
||||
{
|
||||
type: 'checkbox',
|
||||
width: 50,
|
||||
fixed: 'left',
|
||||
},
|
||||
{
|
||||
field: 'no',
|
||||
title: '入库单号',
|
||||
width: 200,
|
||||
fixed: 'left',
|
||||
},
|
||||
{
|
||||
field: 'productNames',
|
||||
title: '产品信息',
|
||||
showOverflow: 'tooltip',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'supplierName',
|
||||
title: '供应商',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'inTime',
|
||||
title: '入库时间',
|
||||
width: 160,
|
||||
formatter: 'formatDateTime',
|
||||
},
|
||||
{
|
||||
field: 'creatorName',
|
||||
title: '创建人',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'totalCount',
|
||||
title: '总数量',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'totalPrice',
|
||||
title: '应付金额',
|
||||
formatter: 'formatNumber',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'paymentPrice',
|
||||
title: '已付金额',
|
||||
formatter: 'formatNumber',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
title: '状态',
|
||||
minWidth: 120,
|
||||
cellRender: {
|
||||
name: 'CellDict',
|
||||
props: { type: DICT_TYPE.ERP_AUDIT_STATUS },
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
minWidth: 250,
|
||||
fixed: 'right',
|
||||
slots: { default: 'actions' },
|
||||
},
|
||||
];
|
||||
}
|
||||
/** 列表的搜索表单 */
|
||||
export function useOrderGridFormSchema(): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
fieldName: 'no',
|
||||
label: '订单单号',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入订单单号',
|
||||
allowClear: true,
|
||||
disabled: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'productId',
|
||||
label: '产品',
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
placeholder: '请选择产品',
|
||||
allowClear: true,
|
||||
showSearch: true,
|
||||
api: getProductSimpleList,
|
||||
fieldNames: {
|
||||
label: 'name',
|
||||
value: 'id',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'orderTime',
|
||||
label: '订单时间',
|
||||
component: 'RangePicker',
|
||||
componentProps: {
|
||||
placeholder: ['开始时间', '结束时间'],
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 列表的字段 */
|
||||
export function useOrderGridColumns(): VxeTableGridOptions['columns'] {
|
||||
return [
|
||||
{
|
||||
type: 'radio',
|
||||
width: 50,
|
||||
fixed: 'left',
|
||||
},
|
||||
{
|
||||
field: 'no',
|
||||
title: '订单单号',
|
||||
width: 200,
|
||||
fixed: 'left',
|
||||
},
|
||||
{
|
||||
field: 'productNames',
|
||||
title: '产品信息',
|
||||
showOverflow: 'tooltip',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'supplierName',
|
||||
title: '供应商',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'orderTime',
|
||||
title: '订单时间',
|
||||
width: 160,
|
||||
formatter: 'formatDate',
|
||||
},
|
||||
{
|
||||
field: 'creatorName',
|
||||
title: '创建人',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'totalCount',
|
||||
title: '总数量',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'inCount',
|
||||
title: '入库数量',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'totalProductPrice',
|
||||
title: '金额合计',
|
||||
formatter: 'formatNumber',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'totalPrice',
|
||||
title: '含税金额',
|
||||
formatter: 'formatNumber',
|
||||
minWidth: 120,
|
||||
},
|
||||
];
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue