Compare commits
No commits in common. "master" and "v2.6.1" have entirely different histories.
|
|
@ -49,4 +49,3 @@ vite.config.ts.*
|
||||||
*.sln
|
*.sln
|
||||||
*.sw?
|
*.sw?
|
||||||
.history
|
.history
|
||||||
.cursor
|
|
||||||
|
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 31 KiB |
|
|
@ -21,8 +21,7 @@
|
||||||
// CSS 变量提示
|
// CSS 变量提示
|
||||||
"vunguyentuan.vscode-css-variables",
|
"vunguyentuan.vscode-css-variables",
|
||||||
// 在 package.json 中显示 PNPM catalog 的版本
|
// 在 package.json 中显示 PNPM catalog 的版本
|
||||||
"antfu.pnpm-catalog-lens",
|
"antfu.pnpm-catalog-lens"
|
||||||
"augment.vscode-augment"
|
|
||||||
],
|
],
|
||||||
"unwantedRecommendations": [
|
"unwantedRecommendations": [
|
||||||
// 和 volar 冲突
|
// 和 volar 冲突
|
||||||
|
|
|
||||||
24
README.md
24
README.md
|
|
@ -41,24 +41,24 @@
|
||||||
|
|
||||||
| 框架 | 说明 | 版本 |
|
| 框架 | 说明 | 版本 |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| [Vue](https://staging-cn.vuejs.org/) | vue框架 | 3.5.17 |
|
| [Vue](https://staging-cn.vuejs.org/) | vue框架 | 3.5.13 |
|
||||||
| [Vite](https://cn.vitejs.dev//) | 开发与构建工具 | 7.1.2 |
|
| [Vite](https://cn.vitejs.dev//) | 开发与构建工具 | 6.2.5 |
|
||||||
| [Ant Design Vue](https://www.antdv.com/) | Ant Design Vue | 4.2.6 |
|
| [Ant Design Vue](https://www.antdv.com/) | Ant Design Vue | 4.2.6 |
|
||||||
| [Element Plus](https://element-plus.org/zh-CN/) | Element Plus | 2.10.2 |
|
| [Element Plus](https://element-plus.org/zh-CN/) | Element Plus | 2.9.7 |
|
||||||
| [Naive UI](https://www.naiveui.com/) | Naive UI | 2.42.0 |
|
| [Naive UI](https://www.naiveui.com/) | Naive UI | 2.41.0 |
|
||||||
| [TypeScript](https://www.typescriptlang.org/docs/) | JavaScript 超集 | 5.8.3 |
|
| [TypeScript](https://www.typescriptlang.org/docs/) | JavaScript 超集 | 5.8.3 |
|
||||||
| [pinia](https://pinia.vuejs.org/) | Vue 存储库替代 vuex5 | 3.0.3 |
|
| [pinia](https://pinia.vuejs.org/) | Vue 存储库替代 vuex5 | 2.3.1 |
|
||||||
| [vueuse](https://vueuse.org/) | 常用工具集 | 13.4.0 |
|
| [vueuse](https://vueuse.org/) | 常用工具集 | 12.8.2 |
|
||||||
| [vue-i18n](https://kazupon.github.io/vue-i18n/zh/introduction.html/) | 国际化 | 11.1.7 |
|
| [vue-i18n](https://kazupon.github.io/vue-i18n/zh/introduction.html/) | 国际化 | 11.1.3 |
|
||||||
| [vue-router](https://router.vuejs.org/) | Vue 路由 | 4.5.1 |
|
| [vue-router](https://router.vuejs.org/) | Vue 路由 | 4.5.0 |
|
||||||
| [Tailwind CSS](https://tailwindcss.com/) | 原子 CSS | 3.4.17 |
|
| [Tailwind CSS](https://tailwindcss.com/) | 原子 CSS | 3.4.17 |
|
||||||
| [Iconify](https://icon-sets.iconify.design/) | 在线图标库 | 2.2.354 |
|
| [Iconify](https://icon-sets.iconify.design/) | 在线图标库 | 2.2.324 |
|
||||||
| [TinyMCE](https://www.tiny.cloud/) | 富文本编辑器 | 6.1.0 |
|
| [TinyMCE](https://www.tiny.cloud/) | 富文本编辑器 | 6.1.0 |
|
||||||
| [Echarts](https://echarts.apache.org/) | 图表库 | 5.6.0 |
|
| [Echarts](https://echarts.apache.org/) | 图表库 | 5.6.0 |
|
||||||
| [axios](https://axios-http.com/) | http客户端 | 1.10.0 |
|
| [axios](https://axios-http.com/) | http客户端 | 1.8.4 |
|
||||||
| [dayjs](https://day.js.org/) | 日期处理库 | 1.11.13 |
|
| [dayjs](https://day.js.org/) | 日期处理库 | 1.11.13 |
|
||||||
| [vee-validate](https://vee-validate.logaretm.com/) | 表单验证 | 4.15.1 |
|
| [vee-validate](https://vee-validate.logaretm.com/) | 表单验证 | 4.15.0 |
|
||||||
| [zod](https://zod.dev/) | 数据验证 | 3.25.67 |
|
| [zod](https://zod.dev/) | 数据验证 | 3.24.2 |
|
||||||
|
|
||||||
## 🔥 后端架构
|
## 🔥 后端架构
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
import { eventHandler } from 'h3';
|
|
||||||
import { verifyAccessToken } from '~/utils/jwt-utils';
|
import { verifyAccessToken } from '~/utils/jwt-utils';
|
||||||
import { MOCK_CODES } from '~/utils/mock-data';
|
import { unAuthorizedResponse } from '~/utils/response';
|
||||||
import { unAuthorizedResponse, useResponseSuccess } from '~/utils/response';
|
|
||||||
|
|
||||||
export default eventHandler((event) => {
|
export default eventHandler((event) => {
|
||||||
const userinfo = verifyAccessToken(event);
|
const userinfo = verifyAccessToken(event);
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,9 @@
|
||||||
import { defineEventHandler, readBody, setResponseStatus } from 'h3';
|
|
||||||
import {
|
import {
|
||||||
clearRefreshTokenCookie,
|
clearRefreshTokenCookie,
|
||||||
setRefreshTokenCookie,
|
setRefreshTokenCookie,
|
||||||
} from '~/utils/cookie-utils';
|
} from '~/utils/cookie-utils';
|
||||||
import { generateAccessToken, generateRefreshToken } from '~/utils/jwt-utils';
|
import { generateAccessToken, generateRefreshToken } from '~/utils/jwt-utils';
|
||||||
import { MOCK_USERS } from '~/utils/mock-data';
|
import { forbiddenResponse } from '~/utils/response';
|
||||||
import {
|
|
||||||
forbiddenResponse,
|
|
||||||
useResponseError,
|
|
||||||
useResponseSuccess,
|
|
||||||
} from '~/utils/response';
|
|
||||||
|
|
||||||
export default defineEventHandler(async (event) => {
|
export default defineEventHandler(async (event) => {
|
||||||
const { password, username } = await readBody(event);
|
const { password, username } = await readBody(event);
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
import { defineEventHandler } from 'h3';
|
|
||||||
import {
|
import {
|
||||||
clearRefreshTokenCookie,
|
clearRefreshTokenCookie,
|
||||||
getRefreshTokenFromCookie,
|
getRefreshTokenFromCookie,
|
||||||
} from '~/utils/cookie-utils';
|
} from '~/utils/cookie-utils';
|
||||||
import { useResponseSuccess } from '~/utils/response';
|
|
||||||
|
|
||||||
export default defineEventHandler(async (event) => {
|
export default defineEventHandler(async (event) => {
|
||||||
const refreshToken = getRefreshTokenFromCookie(event);
|
const refreshToken = getRefreshTokenFromCookie(event);
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,9 @@
|
||||||
import { defineEventHandler } from 'h3';
|
|
||||||
import {
|
import {
|
||||||
clearRefreshTokenCookie,
|
clearRefreshTokenCookie,
|
||||||
getRefreshTokenFromCookie,
|
getRefreshTokenFromCookie,
|
||||||
setRefreshTokenCookie,
|
setRefreshTokenCookie,
|
||||||
} from '~/utils/cookie-utils';
|
} from '~/utils/cookie-utils';
|
||||||
import { generateAccessToken, verifyRefreshToken } from '~/utils/jwt-utils';
|
import { verifyRefreshToken } from '~/utils/jwt-utils';
|
||||||
import { MOCK_USERS } from '~/utils/mock-data';
|
|
||||||
import { forbiddenResponse } from '~/utils/response';
|
import { forbiddenResponse } from '~/utils/response';
|
||||||
|
|
||||||
export default defineEventHandler(async (event) => {
|
export default defineEventHandler(async (event) => {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,3 @@
|
||||||
import { eventHandler, setHeader } from 'h3';
|
|
||||||
import { verifyAccessToken } from '~/utils/jwt-utils';
|
|
||||||
import { unAuthorizedResponse } from '~/utils/response';
|
|
||||||
|
|
||||||
export default eventHandler(async (event) => {
|
export default eventHandler(async (event) => {
|
||||||
const userinfo = verifyAccessToken(event);
|
const userinfo = verifyAccessToken(event);
|
||||||
if (!userinfo) {
|
if (!userinfo) {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
import { eventHandler } from 'h3';
|
|
||||||
import { verifyAccessToken } from '~/utils/jwt-utils';
|
import { verifyAccessToken } from '~/utils/jwt-utils';
|
||||||
import { MOCK_MENUS } from '~/utils/mock-data';
|
import { unAuthorizedResponse } from '~/utils/response';
|
||||||
import { unAuthorizedResponse, useResponseSuccess } from '~/utils/response';
|
|
||||||
|
|
||||||
export default eventHandler(async (event) => {
|
export default eventHandler(async (event) => {
|
||||||
const userinfo = verifyAccessToken(event);
|
const userinfo = verifyAccessToken(event);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,3 @@
|
||||||
import { eventHandler, getQuery, setResponseStatus } from 'h3';
|
|
||||||
import { useResponseError } from '~/utils/response';
|
|
||||||
|
|
||||||
export default eventHandler((event) => {
|
export default eventHandler((event) => {
|
||||||
const { status } = getQuery(event);
|
const { status } = getQuery(event);
|
||||||
setResponseStatus(event, Number(status));
|
setResponseStatus(event, Number(status));
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import { eventHandler } from 'h3';
|
|
||||||
import { verifyAccessToken } from '~/utils/jwt-utils';
|
import { verifyAccessToken } from '~/utils/jwt-utils';
|
||||||
import {
|
import {
|
||||||
sleep,
|
sleep,
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import { eventHandler } from 'h3';
|
|
||||||
import { verifyAccessToken } from '~/utils/jwt-utils';
|
import { verifyAccessToken } from '~/utils/jwt-utils';
|
||||||
import {
|
import {
|
||||||
sleep,
|
sleep,
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import { eventHandler } from 'h3';
|
|
||||||
import { verifyAccessToken } from '~/utils/jwt-utils';
|
import { verifyAccessToken } from '~/utils/jwt-utils';
|
||||||
import {
|
import {
|
||||||
sleep,
|
sleep,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import { faker } from '@faker-js/faker';
|
import { faker } from '@faker-js/faker';
|
||||||
import { eventHandler } from 'h3';
|
|
||||||
import { verifyAccessToken } from '~/utils/jwt-utils';
|
import { verifyAccessToken } from '~/utils/jwt-utils';
|
||||||
import { unAuthorizedResponse, useResponseSuccess } from '~/utils/response';
|
import { unAuthorizedResponse, useResponseSuccess } from '~/utils/response';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import { eventHandler } from 'h3';
|
|
||||||
import { verifyAccessToken } from '~/utils/jwt-utils';
|
import { verifyAccessToken } from '~/utils/jwt-utils';
|
||||||
import { MOCK_MENU_LIST } from '~/utils/mock-data';
|
import { MOCK_MENU_LIST } from '~/utils/mock-data';
|
||||||
import { unAuthorizedResponse, useResponseSuccess } from '~/utils/response';
|
import { unAuthorizedResponse, useResponseSuccess } from '~/utils/response';
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import { eventHandler, getQuery } from 'h3';
|
|
||||||
import { verifyAccessToken } from '~/utils/jwt-utils';
|
import { verifyAccessToken } from '~/utils/jwt-utils';
|
||||||
import { MOCK_MENU_LIST } from '~/utils/mock-data';
|
import { MOCK_MENU_LIST } from '~/utils/mock-data';
|
||||||
import { unAuthorizedResponse, useResponseSuccess } from '~/utils/response';
|
import { unAuthorizedResponse } from '~/utils/response';
|
||||||
|
|
||||||
const namesMap: Record<string, any> = {};
|
const namesMap: Record<string, any> = {};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import { eventHandler, getQuery } from 'h3';
|
|
||||||
import { verifyAccessToken } from '~/utils/jwt-utils';
|
import { verifyAccessToken } from '~/utils/jwt-utils';
|
||||||
import { MOCK_MENU_LIST } from '~/utils/mock-data';
|
import { MOCK_MENU_LIST } from '~/utils/mock-data';
|
||||||
import { unAuthorizedResponse, useResponseSuccess } from '~/utils/response';
|
import { unAuthorizedResponse } from '~/utils/response';
|
||||||
|
|
||||||
const pathMap: Record<string, any> = { '/': 0 };
|
const pathMap: Record<string, any> = { '/': 0 };
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import { faker } from '@faker-js/faker';
|
import { faker } from '@faker-js/faker';
|
||||||
import { eventHandler, getQuery } from 'h3';
|
|
||||||
import { verifyAccessToken } from '~/utils/jwt-utils';
|
import { verifyAccessToken } from '~/utils/jwt-utils';
|
||||||
import { getMenuIds, MOCK_MENU_LIST } from '~/utils/mock-data';
|
import { getMenuIds, MOCK_MENU_LIST } from '~/utils/mock-data';
|
||||||
import { unAuthorizedResponse, usePageResponseSuccess } from '~/utils/response';
|
import { unAuthorizedResponse, usePageResponseSuccess } from '~/utils/response';
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,6 @@
|
||||||
import { faker } from '@faker-js/faker';
|
import { faker } from '@faker-js/faker';
|
||||||
import { eventHandler, getQuery } from 'h3';
|
|
||||||
import { verifyAccessToken } from '~/utils/jwt-utils';
|
import { verifyAccessToken } from '~/utils/jwt-utils';
|
||||||
import {
|
import { unAuthorizedResponse, usePageResponseSuccess } from '~/utils/response';
|
||||||
sleep,
|
|
||||||
unAuthorizedResponse,
|
|
||||||
usePageResponseSuccess,
|
|
||||||
} from '~/utils/response';
|
|
||||||
|
|
||||||
function generateMockDataList(count: number) {
|
function generateMockDataList(count: number) {
|
||||||
const dataList = [];
|
const dataList = [];
|
||||||
|
|
@ -49,69 +44,30 @@ export default eventHandler(async (event) => {
|
||||||
await sleep(600);
|
await sleep(600);
|
||||||
|
|
||||||
const { page, pageSize, sortBy, sortOrder } = getQuery(event);
|
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);
|
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) => {
|
listData.sort((a, b) => {
|
||||||
const aValue = a[sortKey] as unknown;
|
if (sortOrder === 'asc') {
|
||||||
const bValue = b[sortKey] as unknown;
|
if (sortBy === 'price') {
|
||||||
|
return (
|
||||||
let result = 0;
|
Number.parseFloat(a[sortBy as string]) -
|
||||||
|
Number.parseFloat(b[sortBy as string])
|
||||||
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 {
|
} else {
|
||||||
result = aValue ? 1 : -1;
|
return a[sortBy as string] > b[sortBy as string] ? 1 : -1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const aStr = String(aValue);
|
if (sortBy === 'price') {
|
||||||
const bStr = String(bValue);
|
return (
|
||||||
const aNum = Number(aStr);
|
Number.parseFloat(b[sortBy as string]) -
|
||||||
const bNum = Number(bStr);
|
Number.parseFloat(a[sortBy as string])
|
||||||
result =
|
);
|
||||||
Number.isFinite(aNum) && Number.isFinite(bNum)
|
} else {
|
||||||
? aNum - bNum
|
return a[sortBy as string] < b[sortBy as string] ? 1 : -1;
|
||||||
: aStr.localeCompare(bStr, undefined, {
|
}
|
||||||
numeric: true,
|
|
||||||
sensitivity: 'base',
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return isDesc ? -result : result;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return usePageResponseSuccess(
|
return usePageResponseSuccess(page as string, pageSize as string, listData);
|
||||||
String(pageNumber),
|
|
||||||
String(pageSizeNumber),
|
|
||||||
listData,
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1 @@
|
||||||
import { defineEventHandler } from 'h3';
|
|
||||||
|
|
||||||
export default defineEventHandler(() => 'Test get handler');
|
export default defineEventHandler(() => 'Test get handler');
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1 @@
|
||||||
import { defineEventHandler } from 'h3';
|
|
||||||
|
|
||||||
export default defineEventHandler(() => 'Test post handler');
|
export default defineEventHandler(() => 'Test post handler');
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { eventHandler } from 'h3';
|
|
||||||
import { verifyAccessToken } from '~/utils/jwt-utils';
|
import { verifyAccessToken } from '~/utils/jwt-utils';
|
||||||
import { unAuthorizedResponse, useResponseSuccess } from '~/utils/response';
|
import { unAuthorizedResponse } from '~/utils/response';
|
||||||
|
|
||||||
export default eventHandler((event) => {
|
export default eventHandler((event) => {
|
||||||
const userinfo = verifyAccessToken(event);
|
const userinfo = verifyAccessToken(event);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { eventHandler } from 'h3';
|
|
||||||
import { verifyAccessToken } from '~/utils/jwt-utils';
|
import { verifyAccessToken } from '~/utils/jwt-utils';
|
||||||
import { unAuthorizedResponse, useResponseSuccess } from '~/utils/response';
|
import { unAuthorizedResponse } from '~/utils/response';
|
||||||
|
|
||||||
export default eventHandler((event) => {
|
export default eventHandler((event) => {
|
||||||
const userinfo = verifyAccessToken(event);
|
const userinfo = verifyAccessToken(event);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import { defineEventHandler } from 'h3';
|
|
||||||
import { forbiddenResponse, sleep } from '~/utils/response';
|
import { forbiddenResponse, sleep } from '~/utils/response';
|
||||||
|
|
||||||
export default defineEventHandler(async (event) => {
|
export default defineEventHandler(async (event) => {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
import { defineEventHandler } from 'h3';
|
|
||||||
|
|
||||||
export default defineEventHandler(() => {
|
export default defineEventHandler(() => {
|
||||||
return `
|
return `
|
||||||
<h1>Hello Vben Admin</h1>
|
<h1>Hello Vben Admin</h1>
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
import type { EventHandlerRequest, H3Event } from 'h3';
|
import type { EventHandlerRequest, H3Event } from 'h3';
|
||||||
|
|
||||||
import { deleteCookie, getCookie, setCookie } from 'h3';
|
|
||||||
|
|
||||||
export function clearRefreshTokenCookie(event: H3Event<EventHandlerRequest>) {
|
export function clearRefreshTokenCookie(event: H3Event<EventHandlerRequest>) {
|
||||||
deleteCookie(event, 'jwt', {
|
deleteCookie(event, 'jwt', {
|
||||||
httpOnly: true,
|
httpOnly: true,
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,8 @@
|
||||||
import type { EventHandlerRequest, H3Event } from 'h3';
|
import type { EventHandlerRequest, H3Event } from 'h3';
|
||||||
|
|
||||||
import type { UserInfo } from './mock-data';
|
|
||||||
|
|
||||||
import { getHeader } from 'h3';
|
|
||||||
import jwt from 'jsonwebtoken';
|
import jwt from 'jsonwebtoken';
|
||||||
|
|
||||||
import { MOCK_USERS } from './mock-data';
|
import { UserInfo } from './mock-data';
|
||||||
|
|
||||||
// TODO: Replace with your own secret key
|
// TODO: Replace with your own secret key
|
||||||
const ACCESS_TOKEN_SECRET = 'access_token_secret';
|
const ACCESS_TOKEN_SECRET = 'access_token_secret';
|
||||||
|
|
@ -34,22 +31,12 @@ export function verifyAccessToken(
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const tokenParts = authHeader.split(' ');
|
const token = authHeader.split(' ')[1];
|
||||||
if (tokenParts.length !== 2) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
const token = tokenParts[1] as string;
|
|
||||||
try {
|
try {
|
||||||
const decoded = jwt.verify(
|
const decoded = jwt.verify(token, ACCESS_TOKEN_SECRET) as UserPayload;
|
||||||
token,
|
|
||||||
ACCESS_TOKEN_SECRET,
|
|
||||||
) as unknown as UserPayload;
|
|
||||||
|
|
||||||
const username = decoded.username;
|
const username = decoded.username;
|
||||||
const user = MOCK_USERS.find((item) => item.username === username);
|
const user = MOCK_USERS.find((item) => item.username === username);
|
||||||
if (!user) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
const { password: _pwd, ...userinfo } = user;
|
const { password: _pwd, ...userinfo } = user;
|
||||||
return userinfo;
|
return userinfo;
|
||||||
} catch {
|
} catch {
|
||||||
|
|
@ -63,12 +50,7 @@ export function verifyRefreshToken(
|
||||||
try {
|
try {
|
||||||
const decoded = jwt.verify(token, REFRESH_TOKEN_SECRET) as UserPayload;
|
const decoded = jwt.verify(token, REFRESH_TOKEN_SECRET) as UserPayload;
|
||||||
const username = decoded.username;
|
const username = decoded.username;
|
||||||
const user = MOCK_USERS.find(
|
const user = MOCK_USERS.find((item) => item.username === username);
|
||||||
(item) => item.username === username,
|
|
||||||
) as UserInfo;
|
|
||||||
if (!user) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
const { password: _pwd, ...userinfo } = user;
|
const { password: _pwd, ...userinfo } = user;
|
||||||
return userinfo;
|
return userinfo;
|
||||||
} catch {
|
} catch {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
import type { EventHandlerRequest, H3Event } from 'h3';
|
import type { EventHandlerRequest, H3Event } from 'h3';
|
||||||
|
|
||||||
import { setResponseStatus } from 'h3';
|
|
||||||
|
|
||||||
export function useResponseSuccess<T = any>(data: T) {
|
export function useResponseSuccess<T = any>(data: T) {
|
||||||
return {
|
return {
|
||||||
code: 0,
|
code: 0,
|
||||||
|
|
|
||||||
|
|
@ -24,12 +24,3 @@ VITE_APP_BAIDU_CODE = e98f2eab6ceb8688bc6d8fc5332ff093
|
||||||
|
|
||||||
# GoView域名
|
# GoView域名
|
||||||
VITE_GOVIEW_URL='http://127.0.0.1:3000'
|
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",
|
"name": "@vben/web-antd",
|
||||||
"version": "5.5.9",
|
"version": "5.5.7",
|
||||||
"homepage": "https://vben.pro",
|
"homepage": "https://vben.pro",
|
||||||
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
|
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
@ -47,6 +47,7 @@
|
||||||
"@vueuse/integrations": "catalog:",
|
"@vueuse/integrations": "catalog:",
|
||||||
"ant-design-vue": "catalog:",
|
"ant-design-vue": "catalog:",
|
||||||
"cropperjs": "catalog:",
|
"cropperjs": "catalog:",
|
||||||
|
"crypto-js": "catalog:",
|
||||||
"dayjs": "catalog:",
|
"dayjs": "catalog:",
|
||||||
"highlight.js": "catalog:",
|
"highlight.js": "catalog:",
|
||||||
"pinia": "catalog:",
|
"pinia": "catalog:",
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ import { IconifyIcon } from '@vben/icons';
|
||||||
import { $te } from '@vben/locales';
|
import { $te } from '@vben/locales';
|
||||||
import {
|
import {
|
||||||
AsyncComponents,
|
AsyncComponents,
|
||||||
createRequiredValidation,
|
|
||||||
setupVbenVxeTable,
|
setupVbenVxeTable,
|
||||||
useVbenVxeGrid,
|
useVbenVxeGrid,
|
||||||
} from '@vben/plugins/vxe-table';
|
} from '@vben/plugins/vxe-table';
|
||||||
|
|
@ -355,7 +354,7 @@ setupVbenVxeTable({
|
||||||
useVbenForm,
|
useVbenForm,
|
||||||
});
|
});
|
||||||
|
|
||||||
export { createRequiredValidation, useVbenVxeGrid };
|
export { useVbenVxeGrid };
|
||||||
|
|
||||||
const [VxeTable, VxeColumn, VxeToolbar] = AsyncComponents;
|
const [VxeTable, VxeColumn, VxeToolbar] = AsyncComponents;
|
||||||
export { VxeColumn, VxeTable, VxeToolbar };
|
export { VxeColumn, VxeTable, VxeToolbar };
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,6 @@ export namespace BpmProcessInstanceApi {
|
||||||
nodeType: BpmNodeTypeEnum;
|
nodeType: BpmNodeTypeEnum;
|
||||||
startTime?: Date;
|
startTime?: Date;
|
||||||
status: number;
|
status: number;
|
||||||
processInstanceId?: string;
|
|
||||||
tasks: ApprovalTaskInfo[];
|
tasks: ApprovalTaskInfo[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -130,8 +130,3 @@ export const getChildrenTaskList = async (id: string) => {
|
||||||
`/bpm/task/list-by-parent-task-id?parentTaskId=${id}`,
|
`/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,11 +64,7 @@ export namespace AuthApi {
|
||||||
|
|
||||||
/** 登录 */
|
/** 登录 */
|
||||||
export async function loginApi(data: AuthApi.LoginParams) {
|
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 */
|
/** 刷新 accessToken */
|
||||||
|
|
|
||||||
|
|
@ -1,68 +0,0 @@
|
||||||
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 });
|
|
||||||
}
|
|
||||||
|
|
@ -1,103 +0,0 @@
|
||||||
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,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
@ -1,103 +0,0 @@
|
||||||
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,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
@ -1,61 +0,0 @@
|
||||||
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,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
@ -1,61 +0,0 @@
|
||||||
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 });
|
|
||||||
}
|
|
||||||
|
|
@ -1,62 +0,0 @@
|
||||||
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 });
|
|
||||||
}
|
|
||||||
|
|
@ -1,129 +0,0 @@
|
||||||
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,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
@ -1,117 +0,0 @@
|
||||||
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 });
|
|
||||||
}
|
|
||||||
|
|
@ -1,127 +0,0 @@
|
||||||
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,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
@ -1,73 +0,0 @@
|
||||||
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 });
|
|
||||||
}
|
|
||||||
|
|
@ -1,73 +0,0 @@
|
||||||
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 });
|
|
||||||
}
|
|
||||||
|
|
@ -1,97 +0,0 @@
|
||||||
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 });
|
|
||||||
}
|
|
||||||
|
|
@ -1,120 +0,0 @@
|
||||||
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,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
@ -1,127 +0,0 @@
|
||||||
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,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
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',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
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',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
@ -1,117 +0,0 @@
|
||||||
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,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
@ -1,113 +0,0 @@
|
||||||
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,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
@ -1,117 +0,0 @@
|
||||||
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,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
@ -1,114 +0,0 @@
|
||||||
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,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
@ -1,47 +0,0 @@
|
||||||
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 });
|
|
||||||
}
|
|
||||||
|
|
@ -1,83 +0,0 @@
|
||||||
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,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
@ -1,77 +0,0 @@
|
||||||
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,7 +16,6 @@ export namespace InfraFileConfigApi {
|
||||||
accessKey?: string;
|
accessKey?: string;
|
||||||
accessSecret?: string;
|
accessSecret?: string;
|
||||||
pathStyle?: boolean;
|
pathStyle?: boolean;
|
||||||
enablePublicAccess?: boolean;
|
|
||||||
domain: string;
|
domain: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ import {
|
||||||
RequestClient,
|
RequestClient,
|
||||||
} from '@vben/request';
|
} from '@vben/request';
|
||||||
import { useAccessStore } from '@vben/stores';
|
import { useAccessStore } from '@vben/stores';
|
||||||
import { createApiEncrypt } from '@vben/utils';
|
|
||||||
|
|
||||||
import { message } from 'ant-design-vue';
|
import { message } from 'ant-design-vue';
|
||||||
|
|
||||||
|
|
@ -22,7 +21,6 @@ import { refreshTokenApi } from './core';
|
||||||
|
|
||||||
const { apiURL } = useAppConfig(import.meta.env, import.meta.env.PROD);
|
const { apiURL } = useAppConfig(import.meta.env, import.meta.env.PROD);
|
||||||
const tenantEnable = isTenantEnable();
|
const tenantEnable = isTenantEnable();
|
||||||
const apiEncrypt = createApiEncrypt(import.meta.env);
|
|
||||||
|
|
||||||
function createRequestClient(baseURL: string, options?: RequestClientOptions) {
|
function createRequestClient(baseURL: string, options?: RequestClientOptions) {
|
||||||
const client = new RequestClient({
|
const client = new RequestClient({
|
||||||
|
|
@ -86,46 +84,10 @@ function createRequestClient(baseURL: string, options?: RequestClientOptions) {
|
||||||
config.headers['visit-tenant-id'] = tenantEnable
|
config.headers['visit-tenant-id'] = tenantEnable
|
||||||
? accessStore.visitTenantId
|
? accessStore.visitTenantId
|
||||||
: undefined;
|
: 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;
|
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(
|
client.addResponseInterceptor(
|
||||||
defaultResponseInterceptor({
|
defaultResponseInterceptor({
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,7 @@ export namespace SystemMailLogApi {
|
||||||
id: number;
|
id: number;
|
||||||
userId: number;
|
userId: number;
|
||||||
userType: number;
|
userType: number;
|
||||||
toMails: string[];
|
toMail: string;
|
||||||
ccMails?: string[];
|
|
||||||
bccMails?: string[];
|
|
||||||
accountId: number;
|
accountId: number;
|
||||||
fromMail: string;
|
fromMail: string;
|
||||||
templateId: number;
|
templateId: number;
|
||||||
|
|
@ -34,3 +32,15 @@ export function getMailLogPage(params: PageParam) {
|
||||||
{ params },
|
{ 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,9 +20,7 @@ export namespace SystemMailTemplateApi {
|
||||||
|
|
||||||
/** 邮件发送信息 */
|
/** 邮件发送信息 */
|
||||||
export interface MailSendReq {
|
export interface MailSendReq {
|
||||||
toMails: string[];
|
mail: string;
|
||||||
ccMails?: string[];
|
|
||||||
bccMails?: string[];
|
|
||||||
templateCode: string;
|
templateCode: string;
|
||||||
templateParams: Record<string, any>;
|
templateParams: Record<string, any>;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ export namespace SystemTenantApi {
|
||||||
contactMobile: string;
|
contactMobile: string;
|
||||||
accountCount: number;
|
accountCount: number;
|
||||||
expireTime: Date;
|
expireTime: Date;
|
||||||
websites: string[];
|
website: string;
|
||||||
status: number;
|
status: number;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,2 @@
|
||||||
export { default as Tinyflow } from './tinyflow.vue';
|
export { default as Tinyflow } from './tinyflow.vue';
|
||||||
|
|
||||||
export * from './ui/typing';
|
export * from './ui/typing';
|
||||||
|
|
|
||||||
|
|
@ -359,8 +359,7 @@ async function saveConfig() {
|
||||||
currentNode.value.signEnable = configForm.value.signEnable;
|
currentNode.value.signEnable = configForm.value.signEnable;
|
||||||
// 审批意见
|
// 审批意见
|
||||||
currentNode.value.reasonRequire = configForm.value.reasonRequire;
|
currentNode.value.reasonRequire = configForm.value.reasonRequire;
|
||||||
// 跳过表达式
|
|
||||||
currentNode.value.skipExpression = configForm.value.skipExpression;
|
|
||||||
currentNode.value.showText = getShowText();
|
currentNode.value.showText = getShowText();
|
||||||
drawerApi.close();
|
drawerApi.close();
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -444,8 +443,7 @@ function showUserTaskNodeConfig(node: SimpleFlowNode) {
|
||||||
configForm.value.signEnable = node?.signEnable ?? false;
|
configForm.value.signEnable = node?.signEnable ?? false;
|
||||||
// 7. 审批意见
|
// 7. 审批意见
|
||||||
configForm.value.reasonRequire = node?.reasonRequire ?? false;
|
configForm.value.reasonRequire = node?.reasonRequire ?? false;
|
||||||
// 8. 跳过表达式
|
|
||||||
configForm.value.skipExpression = node?.skipExpression ?? '';
|
|
||||||
drawerApi.open();
|
drawerApi.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -852,7 +850,7 @@ onMounted(() => {
|
||||||
label="流程表达式"
|
label="流程表达式"
|
||||||
name="expression"
|
name="expression"
|
||||||
>
|
>
|
||||||
<Textarea v-model:value="configForm.expression" allow-clear />
|
<Textarea v-model:value="configForm.expression" clearable />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<!-- 多人审批/办理 方式 -->
|
<!-- 多人审批/办理 方式 -->
|
||||||
<FormItem :label="`多人${nodeTypeName}方式`" name="approveMethod">
|
<FormItem :label="`多人${nodeTypeName}方式`" name="approveMethod">
|
||||||
|
|
@ -1119,16 +1117,6 @@ onMounted(() => {
|
||||||
/>
|
/>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
|
||||||
<Divider content-position="left">跳过表达式</Divider>
|
|
||||||
<FormItem prop="skipExpression">
|
|
||||||
<Textarea
|
|
||||||
v-model:value="configForm.skipExpression"
|
|
||||||
allow-clear
|
|
||||||
:rows="2"
|
|
||||||
/>
|
|
||||||
</FormItem>
|
|
||||||
</div>
|
|
||||||
</Form>
|
</Form>
|
||||||
</div>
|
</div>
|
||||||
</TabPane>
|
</TabPane>
|
||||||
|
|
|
||||||
|
|
@ -602,8 +602,6 @@ export interface SimpleFlowNode {
|
||||||
signEnable?: boolean;
|
signEnable?: boolean;
|
||||||
// 审批意见
|
// 审批意见
|
||||||
reasonRequire?: boolean;
|
reasonRequire?: boolean;
|
||||||
// 跳过表达式
|
|
||||||
skipExpression?: string;
|
|
||||||
// 触发器设置
|
// 触发器设置
|
||||||
triggerSetting?: TriggerSetting;
|
triggerSetting?: TriggerSetting;
|
||||||
// 子流程
|
// 子流程
|
||||||
|
|
|
||||||
|
|
@ -214,7 +214,6 @@ export type UserTaskFormType = {
|
||||||
returnNodeId?: string;
|
returnNodeId?: string;
|
||||||
roleIds?: number[]; // 角色
|
roleIds?: number[]; // 角色
|
||||||
signEnable: boolean;
|
signEnable: boolean;
|
||||||
skipExpression?: string; // 跳过表达式
|
|
||||||
taskAssignListener?: {
|
taskAssignListener?: {
|
||||||
body: HttpRequestParam[];
|
body: HttpRequestParam[];
|
||||||
header: HttpRequestParam[];
|
header: HttpRequestParam[];
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,7 @@ function handleButtonClick(action: ActionItem) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 监听props变化,强制重新计算 */
|
// 监听props变化,强制重新计算
|
||||||
watch(
|
watch(
|
||||||
() => [props.actions, props.dropDownActions],
|
() => [props.actions, props.dropDownActions],
|
||||||
() => {
|
() => {
|
||||||
|
|
|
||||||
|
|
@ -979,11 +979,11 @@ export enum BpmTaskStatusEnum {
|
||||||
* 审批通过
|
* 审批通过
|
||||||
*/
|
*/
|
||||||
APPROVE = 2,
|
APPROVE = 2,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 审批通过中
|
* 审批通过中
|
||||||
*/
|
*/
|
||||||
APPROVING = 7,
|
APPROVING = 7,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 已取消
|
* 已取消
|
||||||
*/
|
*/
|
||||||
|
|
@ -992,6 +992,7 @@ export enum BpmTaskStatusEnum {
|
||||||
* 未开始
|
* 未开始
|
||||||
*/
|
*/
|
||||||
NOT_START = -1,
|
NOT_START = -1,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 审批不通过
|
* 审批不通过
|
||||||
*/
|
*/
|
||||||
|
|
@ -1001,15 +1002,10 @@ export enum BpmTaskStatusEnum {
|
||||||
* 已退回
|
* 已退回
|
||||||
*/
|
*/
|
||||||
RETURN = 5,
|
RETURN = 5,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 审批中
|
* 审批中
|
||||||
*/
|
*/
|
||||||
RUNNING = 1,
|
RUNNING = 1,
|
||||||
/**
|
|
||||||
* 跳过
|
|
||||||
*/
|
|
||||||
SKIP = -2,
|
|
||||||
/**
|
/**
|
||||||
* 待审批
|
* 待审批
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@
|
||||||
// TODO @芋艿:后续这些 form-create 的优化;另外需要使用 form-create-helper 会好点
|
// TODO @芋艿:后续这些 form-create 的优化;另外需要使用 form-create-helper 会好点
|
||||||
import { isRef } from 'vue';
|
import { isRef } from 'vue';
|
||||||
|
|
||||||
import formCreate from '@form-create/ant-design-vue';
|
|
||||||
// 编码表单 Conf
|
// 编码表单 Conf
|
||||||
export const encodeConf = (designerRef: any) => {
|
export const encodeConf = (designerRef: any) => {
|
||||||
return JSON.stringify(designerRef.value.getOption());
|
return JSON.stringify(designerRef.value.getOption());
|
||||||
|
|
@ -24,7 +23,7 @@ export const encodeFields = (designerRef: any) => {
|
||||||
export const decodeFields = (fields: string[]) => {
|
export const decodeFields = (fields: string[]) => {
|
||||||
const rule: object[] = [];
|
const rule: object[] = [];
|
||||||
fields.forEach((item) => {
|
fields.forEach((item) => {
|
||||||
rule.push(formCreate.parseJson(item));
|
rule.push(JSON.parse(item));
|
||||||
});
|
});
|
||||||
return rule;
|
return rule;
|
||||||
};
|
};
|
||||||
|
|
@ -35,7 +34,7 @@ export const setConfAndFields = (
|
||||||
conf: string,
|
conf: string,
|
||||||
fields: string | string[],
|
fields: string | string[],
|
||||||
) => {
|
) => {
|
||||||
designerRef.value.setOption(formCreate.parseJson(conf));
|
designerRef.value.setOption(JSON.parse(conf));
|
||||||
// 处理 fields 参数类型,确保传入 decodeFields 的是 string[] 类型
|
// 处理 fields 参数类型,确保传入 decodeFields 的是 string[] 类型
|
||||||
const fieldsArray = Array.isArray(fields) ? fields : [fields];
|
const fieldsArray = Array.isArray(fields) ? fields : [fields];
|
||||||
designerRef.value.setRule(decodeFields(fieldsArray));
|
designerRef.value.setRule(decodeFields(fieldsArray));
|
||||||
|
|
@ -51,7 +50,7 @@ export const setConfAndFields2 = (
|
||||||
if (isRef(detailPreview)) {
|
if (isRef(detailPreview)) {
|
||||||
detailPreview = detailPreview.value;
|
detailPreview = detailPreview.value;
|
||||||
}
|
}
|
||||||
detailPreview.option = formCreate.parseJson(conf);
|
detailPreview.option = JSON.parse(conf);
|
||||||
detailPreview.rule = decodeFields(fields);
|
detailPreview.rule = decodeFields(fields);
|
||||||
if (value) {
|
if (value) {
|
||||||
detailPreview.value = value;
|
detailPreview.value = value;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
// TODO @gjd:https://t.zsxq.com/pmNb1 AI 对话、绘图底部没对齐
|
|
||||||
import type { AiChatConversationApi } from '#/api/ai/chat/conversation';
|
import type { AiChatConversationApi } from '#/api/ai/chat/conversation';
|
||||||
import type { AiChatMessageApi } from '#/api/ai/chat/message';
|
import type { AiChatMessageApi } from '#/api/ai/chat/message';
|
||||||
|
|
||||||
|
|
@ -24,7 +23,6 @@ import MessageList from './components/message/MessageList.vue';
|
||||||
import MessageListEmpty from './components/message/MessageListEmpty.vue';
|
import MessageListEmpty from './components/message/MessageListEmpty.vue';
|
||||||
import MessageLoading from './components/message/MessageLoading.vue';
|
import MessageLoading from './components/message/MessageLoading.vue';
|
||||||
import MessageNewConversation from './components/message/MessageNewConversation.vue';
|
import MessageNewConversation from './components/message/MessageNewConversation.vue';
|
||||||
|
|
||||||
/** AI 聊天对话 列表 */
|
/** AI 聊天对话 列表 */
|
||||||
defineOptions({ name: 'AiChat' });
|
defineOptions({ name: 'AiChat' });
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -104,10 +104,7 @@ onMounted(async () => {
|
||||||
</template>
|
</template>
|
||||||
<template #userId="{ row }">
|
<template #userId="{ row }">
|
||||||
<span>
|
<span>
|
||||||
{{
|
{{ userList.find((item) => item.id === row.userId)?.nickname }}
|
||||||
userList.find((item: SystemUserApi.User) => item.id === row.userId)
|
|
||||||
?.nickname
|
|
||||||
}}
|
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
<template #publicStatus="{ row }">
|
<template #publicStatus="{ row }">
|
||||||
|
|
|
||||||
|
|
@ -108,10 +108,7 @@ onMounted(async () => {
|
||||||
</template>
|
</template>
|
||||||
<template #userId="{ row }">
|
<template #userId="{ row }">
|
||||||
<span>
|
<span>
|
||||||
{{
|
{{ userList.find((item) => item.id === row.userId)?.nickname }}
|
||||||
userList.find((item: SystemUserApi.User) => item.id === row.userId)
|
|
||||||
?.nickname
|
|
||||||
}}
|
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
<template #actions="{ row }">
|
<template #actions="{ row }">
|
||||||
|
|
|
||||||
|
|
@ -112,11 +112,7 @@ onMounted(async () => {
|
||||||
</template>
|
</template>
|
||||||
<template #keyId="{ row }">
|
<template #keyId="{ row }">
|
||||||
<span>
|
<span>
|
||||||
{{
|
{{ apiKeyList.find((item) => item.id === row.keyId)?.name }}
|
||||||
apiKeyList.find(
|
|
||||||
(item: AiModelApiKeyApi.ApiKey) => item.id === row.keyId,
|
|
||||||
)?.name
|
|
||||||
}}
|
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
<template #actions="{ row }">
|
<template #actions="{ row }">
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,6 @@ const formData: any = ref({
|
||||||
enable: false,
|
enable: false,
|
||||||
summary: [],
|
summary: [],
|
||||||
},
|
},
|
||||||
allowWithdrawTask: false,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// 流程数据
|
// 流程数据
|
||||||
|
|
@ -179,16 +178,6 @@ async function initData() {
|
||||||
// 特殊:复制场景
|
// 特殊:复制场景
|
||||||
if (route.params.type === 'copy') {
|
if (route.params.type === 'copy') {
|
||||||
delete formData.value.id;
|
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.name += '副本';
|
||||||
formData.value.key += '_copy';
|
formData.value.key += '_copy';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -69,27 +69,7 @@ const selectedUsers = ref<number[]>();
|
||||||
|
|
||||||
const rules: Record<string, Rule[]> = {
|
const rules: Record<string, Rule[]> = {
|
||||||
name: [{ required: true, message: '流程名称不能为空', trigger: 'blur' }],
|
name: [{ required: true, message: '流程名称不能为空', trigger: 'blur' }],
|
||||||
key: [
|
key: [{ required: true, message: '流程标识不能为空', trigger: 'blur' }],
|
||||||
{ 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' }],
|
category: [{ required: true, message: '流程分类不能为空', trigger: 'blur' }],
|
||||||
type: [{ required: true, message: '流程类型不能为空', trigger: 'blur' }],
|
type: [{ required: true, message: '流程类型不能为空', trigger: 'blur' }],
|
||||||
visible: [{ required: true, message: '是否可见不能为空', trigger: 'blur' }],
|
visible: [{ required: true, message: '是否可见不能为空', trigger: 'blur' }],
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, provide, ref, watch } from 'vue';
|
import { computed, ref, watch } from 'vue';
|
||||||
|
|
||||||
import { CircleHelp } from '@vben/icons';
|
import { CircleHelp } from '@vben/icons';
|
||||||
|
|
||||||
|
|
@ -146,7 +146,7 @@ function handleTaskAfterTriggerEnableChange(val: boolean | number | string) {
|
||||||
: null;
|
: null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 表单字段 */
|
/** 表单选项 */
|
||||||
const formField = ref<Array<{ field: string; title: string }>>([]);
|
const formField = ref<Array<{ field: string; title: string }>>([]);
|
||||||
const formFieldOptions4Title = computed(() => {
|
const formFieldOptions4Title = computed(() => {
|
||||||
const cloneFormField = formField.value.map((item) => {
|
const cloneFormField = formField.value.map((item) => {
|
||||||
|
|
@ -178,9 +178,6 @@ const formFieldOptions4Summary = computed(() => {
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
const unParsedFormFields = ref<string[]>([]); // 未解析的表单字段
|
|
||||||
// 暴露给子组件 HttpRequestSetting 使用
|
|
||||||
provide('formFields', unParsedFormFields);
|
|
||||||
|
|
||||||
/** 兼容以前未配置更多设置的流程 */
|
/** 兼容以前未配置更多设置的流程 */
|
||||||
function initData() {
|
function initData() {
|
||||||
|
|
@ -220,9 +217,6 @@ function initData() {
|
||||||
if (modelData.value.taskAfterTriggerSetting) {
|
if (modelData.value.taskAfterTriggerSetting) {
|
||||||
taskAfterTriggerEnable.value = true;
|
taskAfterTriggerEnable.value = true;
|
||||||
}
|
}
|
||||||
if (modelData.value.allowWithdrawTask === undefined) {
|
|
||||||
modelData.value.allowWithdrawTask = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 监听表单 ID 变化,加载表单数据 */
|
/** 监听表单 ID 变化,加载表单数据 */
|
||||||
|
|
@ -233,7 +227,6 @@ watch(
|
||||||
const data = await FormApi.getFormDetail(newFormId);
|
const data = await FormApi.getFormDetail(newFormId);
|
||||||
const result: Array<{ field: string; title: string }> = [];
|
const result: Array<{ field: string; title: string }> = [];
|
||||||
if (data.fields) {
|
if (data.fields) {
|
||||||
unParsedFormFields.value = data.fields;
|
|
||||||
data.fields.forEach((fieldStr: string) => {
|
data.fields.forEach((fieldStr: string) => {
|
||||||
parseFormFields(JSON.parse(fieldStr), result);
|
parseFormFields(JSON.parse(fieldStr), result);
|
||||||
});
|
});
|
||||||
|
|
@ -241,7 +234,6 @@ watch(
|
||||||
formField.value = result;
|
formField.value = result;
|
||||||
} else {
|
} else {
|
||||||
formField.value = [];
|
formField.value = [];
|
||||||
unParsedFormFields.value = [];
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ immediate: true },
|
{ immediate: true },
|
||||||
|
|
@ -275,18 +267,6 @@ defineExpose({ initData, validate });
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</FormItem>
|
</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="流程编码">
|
<FormItem v-if="modelData.processIdRule" class="mb-5" label="流程编码">
|
||||||
<Row :gutter="8" align="middle">
|
<Row :gutter="8" align="middle">
|
||||||
<Col :span="1">
|
<Col :span="1">
|
||||||
|
|
|
||||||
|
|
@ -415,7 +415,6 @@ const handleRenameSuccess = () => {
|
||||||
>
|
>
|
||||||
<div class="flex h-12 items-center">
|
<div class="flex h-12 items-center">
|
||||||
<!-- 头部:分类名 -->
|
<!-- 头部:分类名 -->
|
||||||
<!-- TODO @jason:1)无法拖动排序;2)拖动后,直接请求排序,不用有个【保存】;排序模型分类,和排序分类里的模型,交互有点不同哈。 -->
|
|
||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
<Tooltip v-if="isCategorySorting" title="拖动排序">
|
<Tooltip v-if="isCategorySorting" title="拖动排序">
|
||||||
<span
|
<span
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ import { computed, nextTick, ref, watch } from 'vue';
|
||||||
import { useTabs } from '@vben/hooks';
|
import { useTabs } from '@vben/hooks';
|
||||||
import { IconifyIcon } from '@vben/icons';
|
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 { Button, Card, Col, message, Row, Space, Tabs } from 'ant-design-vue';
|
||||||
|
|
||||||
import { getProcessDefinition } from '#/api/bpm/definition';
|
import { getProcessDefinition } from '#/api/bpm/definition';
|
||||||
|
|
@ -51,9 +50,6 @@ const props = defineProps({
|
||||||
|
|
||||||
const emit = defineEmits(['cancel']);
|
const emit = defineEmits(['cancel']);
|
||||||
|
|
||||||
// 增加表单就绪状态变量 表单就绪后再渲染form-create
|
|
||||||
const isFormReady = ref(false);
|
|
||||||
|
|
||||||
const { closeCurrentTab } = useTabs();
|
const { closeCurrentTab } = useTabs();
|
||||||
|
|
||||||
const getTitle = computed(() => {
|
const getTitle = computed(() => {
|
||||||
|
|
@ -130,18 +126,16 @@ async function initProcessInfo(row: any, formVariables?: any) {
|
||||||
// 注意:需要从 formVariables 中,移除不在 row.formFields 的值。
|
// 注意:需要从 formVariables 中,移除不在 row.formFields 的值。
|
||||||
// 原因是:后端返回的 formVariables 里面,会有一些非表单的信息。例如说,某个流程节点的审批人。
|
// 原因是:后端返回的 formVariables 里面,会有一些非表单的信息。例如说,某个流程节点的审批人。
|
||||||
// 这样,就可能导致一个流程被审批不通过后,重新发起时,会直接后端报错!!!
|
// 这样,就可能导致一个流程被审批不通过后,重新发起时,会直接后端报错!!!
|
||||||
const formApi = formCreate.create(decodeFields(row.formFields));
|
const allowedFields = new Set(
|
||||||
const allowedFields = formApi.fields();
|
decodeFields(row.formFields).map((fieldObj: any) => fieldObj.field),
|
||||||
|
);
|
||||||
for (const key in formVariables) {
|
for (const key in formVariables) {
|
||||||
if (!allowedFields.includes(key)) {
|
if (!allowedFields.has(key)) {
|
||||||
delete formVariables[key];
|
delete formVariables[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setConfAndFields2(detailForm, row.formConf, row.formFields, formVariables);
|
setConfAndFields2(detailForm, row.formConf, row.formFields, formVariables);
|
||||||
|
|
||||||
// 设置表单就绪状态
|
|
||||||
isFormReady.value = true;
|
|
||||||
|
|
||||||
await nextTick();
|
await nextTick();
|
||||||
fApi.value?.btn.show(false); // 隐藏提交按钮
|
fApi.value?.btn.show(false); // 隐藏提交按钮
|
||||||
|
|
||||||
|
|
@ -298,7 +292,6 @@ defineExpose({ initProcessInfo });
|
||||||
class="flex-1 overflow-auto"
|
class="flex-1 overflow-auto"
|
||||||
>
|
>
|
||||||
<form-create
|
<form-create
|
||||||
v-if="isFormReady"
|
|
||||||
:rule="detailForm.rule"
|
:rule="detailForm.rule"
|
||||||
v-model:api="fApi"
|
v-model:api="fApi"
|
||||||
v-model="detailForm.value"
|
v-model="detailForm.value"
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,6 @@
|
||||||
import type { BpmProcessInstanceApi } from '#/api/bpm/processInstance';
|
import type { BpmProcessInstanceApi } from '#/api/bpm/processInstance';
|
||||||
import type { SystemUserApi } from '#/api/system/user';
|
import type { SystemUserApi } from '#/api/system/user';
|
||||||
|
|
||||||
// TODO @jason:业务表单审批时,读取不到界面,参见 https://t.zsxq.com/eif2e
|
|
||||||
|
|
||||||
import { nextTick, onMounted, ref, shallowRef, watch } from 'vue';
|
import { nextTick, onMounted, ref, shallowRef, watch } from 'vue';
|
||||||
|
|
||||||
import { Page } from '@vben/common-ui';
|
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 type { BpmProcessInstanceApi } from '#/api/bpm/processInstance';
|
||||||
|
|
||||||
import { computed, nextTick, reactive, ref, watch } from 'vue';
|
import { computed, reactive, ref, watch } from 'vue';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
|
|
||||||
import { useVbenModal } from '@vben/common-ui';
|
import { useVbenModal } from '@vben/common-ui';
|
||||||
|
|
@ -102,7 +102,6 @@ const approveSignFormRef = ref();
|
||||||
const nextAssigneesActivityNode = ref<BpmProcessInstanceApi.ApprovalNodeInfo[]>(
|
const nextAssigneesActivityNode = ref<BpmProcessInstanceApi.ApprovalNodeInfo[]>(
|
||||||
[],
|
[],
|
||||||
); // 下一个审批节点信息
|
); // 下一个审批节点信息
|
||||||
const nextAssigneesTimelineRef = ref(); // 下一个节点审批人时间线组件的引用
|
|
||||||
const approveReasonForm: any = reactive({
|
const approveReasonForm: any = reactive({
|
||||||
reason: '',
|
reason: '',
|
||||||
signPicUrl: '',
|
signPicUrl: '',
|
||||||
|
|
@ -279,10 +278,6 @@ function closePopover(type: string, formRef: any | FormInstance) {
|
||||||
}
|
}
|
||||||
if (popOverVisible.value[type]) popOverVisible.value[type] = false;
|
if (popOverVisible.value[type]) popOverVisible.value[type] = false;
|
||||||
nextAssigneesActivityNode.value = [];
|
nextAssigneesActivityNode.value = [];
|
||||||
// 清理 Timeline 组件中的自定义审批人数据
|
|
||||||
if (nextAssigneesTimelineRef.value) {
|
|
||||||
nextAssigneesTimelineRef.value.batchSetCustomApproveUsers({});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 流程通过时,根据表单变量查询新的流程节点,判断下一个节点类型是否为自选审批人 */
|
/** 流程通过时,根据表单变量查询新的流程节点,判断下一个节点类型是否为自选审批人 */
|
||||||
|
|
@ -295,7 +290,6 @@ async function initNextAssigneesFormField() {
|
||||||
processVariablesStr: JSON.stringify(variables),
|
processVariablesStr: JSON.stringify(variables),
|
||||||
});
|
});
|
||||||
if (data && data.length > 0) {
|
if (data && data.length > 0) {
|
||||||
const customApproveUsersData: Record<string, any[]> = {}; // 用于收集需要设置到 Timeline 组件的自定义审批人数据
|
|
||||||
data.forEach((node: BpmProcessInstanceApi.ApprovalNodeInfo) => {
|
data.forEach((node: BpmProcessInstanceApi.ApprovalNodeInfo) => {
|
||||||
if (
|
if (
|
||||||
// 情况一:当前节点没有审批人,并且是发起人自选
|
// 情况一:当前节点没有审批人,并且是发起人自选
|
||||||
|
|
@ -308,23 +302,7 @@ async function initNextAssigneesFormField() {
|
||||||
) {
|
) {
|
||||||
nextAssigneesActivityNode.value.push(node);
|
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,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -386,10 +364,6 @@ async function handleAudit(pass: boolean, formRef: FormInstance | undefined) {
|
||||||
await TaskApi.approveTask(data);
|
await TaskApi.approveTask(data);
|
||||||
popOverVisible.value.approve = false;
|
popOverVisible.value.approve = false;
|
||||||
nextAssigneesActivityNode.value = [];
|
nextAssigneesActivityNode.value = [];
|
||||||
// 清理 Timeline 组件中的自定义审批人数据
|
|
||||||
if (nextAssigneesTimelineRef.value) {
|
|
||||||
nextAssigneesTimelineRef.value.batchSetCustomApproveUsers({});
|
|
||||||
}
|
|
||||||
message.success('审批通过成功');
|
message.success('审批通过成功');
|
||||||
} else {
|
} else {
|
||||||
// 审批不通过数据
|
// 审批不通过数据
|
||||||
|
|
@ -759,10 +733,9 @@ defineExpose({ loadTodoTask });
|
||||||
>
|
>
|
||||||
<div class="-mb-8 -mt-3.5 ml-2.5">
|
<div class="-mb-8 -mt-3.5 ml-2.5">
|
||||||
<ProcessInstanceTimeline
|
<ProcessInstanceTimeline
|
||||||
ref="nextAssigneesTimelineRef"
|
|
||||||
:activity-nodes="nextAssigneesActivityNode"
|
:activity-nodes="nextAssigneesActivityNode"
|
||||||
:show-status-icon="false"
|
:show-status-icon="false"
|
||||||
:enable-approve-user-select="true"
|
:use-next-assignees="true"
|
||||||
@select-user-confirm="selectNextAssigneesConfirm"
|
@select-user-confirm="selectNextAssigneesConfirm"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -23,12 +23,12 @@ defineOptions({ name: 'BpmProcessInstanceTimeline' });
|
||||||
const props = withDefaults(
|
const props = withDefaults(
|
||||||
defineProps<{
|
defineProps<{
|
||||||
activityNodes: BpmProcessInstanceApi.ApprovalNodeInfo[]; // 审批节点信息
|
activityNodes: BpmProcessInstanceApi.ApprovalNodeInfo[]; // 审批节点信息
|
||||||
enableApproveUserSelect?: boolean; // 是否开启审批人自选功能
|
|
||||||
showStatusIcon?: boolean; // 是否显示头像右下角状态图标
|
showStatusIcon?: boolean; // 是否显示头像右下角状态图标
|
||||||
|
useNextAssignees?: boolean; // 是否用于下一个节点审批人选择
|
||||||
}>(),
|
}>(),
|
||||||
{
|
{
|
||||||
showStatusIcon: true, // 默认值为 true
|
showStatusIcon: true, // 默认值为 true
|
||||||
enableApproveUserSelect: false, // 默认值为 false
|
useNextAssignees: false, // 默认值为 false
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -43,8 +43,6 @@ const statusIconMap: Record<
|
||||||
string,
|
string,
|
||||||
{ animation?: string; color: string; icon: string }
|
{ animation?: string; color: string; icon: string }
|
||||||
> = {
|
> = {
|
||||||
// 跳过
|
|
||||||
'-2': { color: '#909398', icon: 'mdi:skip-forward-outline' },
|
|
||||||
// 审批未开始
|
// 审批未开始
|
||||||
'-1': { color: '#909398', icon: 'mdi:clock-outline' },
|
'-1': { color: '#909398', icon: 'mdi:clock-outline' },
|
||||||
// 待审批
|
// 待审批
|
||||||
|
|
@ -183,9 +181,6 @@ function handleUserSelectConfirm(userList: any[]) {
|
||||||
|
|
||||||
/** 跳转子流程 */
|
/** 跳转子流程 */
|
||||||
function handleChildProcess(activity: any) {
|
function handleChildProcess(activity: any) {
|
||||||
if (!activity.processInstanceId) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
push({
|
push({
|
||||||
name: 'BpmProcessInstanceDetail',
|
name: 'BpmProcessInstanceDetail',
|
||||||
query: {
|
query: {
|
||||||
|
|
@ -200,12 +195,12 @@ function shouldShowCustomUserSelect(
|
||||||
) {
|
) {
|
||||||
return (
|
return (
|
||||||
isEmpty(activity.tasks) &&
|
isEmpty(activity.tasks) &&
|
||||||
((BpmCandidateStrategyEnum.START_USER_SELECT ===
|
isEmpty(activity.candidateUsers) &&
|
||||||
activity.candidateStrategy &&
|
(BpmCandidateStrategyEnum.START_USER_SELECT ===
|
||||||
isEmpty(activity.candidateUsers)) ||
|
activity.candidateStrategy ||
|
||||||
(props.enableApproveUserSelect &&
|
(BpmCandidateStrategyEnum.APPROVE_USER_SELECT ===
|
||||||
BpmCandidateStrategyEnum.APPROVE_USER_SELECT ===
|
activity.candidateStrategy &&
|
||||||
activity.candidateStrategy))
|
props.useNextAssignees))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -228,21 +223,6 @@ function handleUserSelectClosed() {
|
||||||
function handleUserSelectCancel() {
|
function handleUserSelectCancel() {
|
||||||
selectedUsers.value = [];
|
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>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -287,12 +267,7 @@ defineExpose({ setCustomApproveUsers, batchSetCustomApproveUsers });
|
||||||
>
|
>
|
||||||
<!-- 第一行:节点名称、时间 -->
|
<!-- 第一行:节点名称、时间 -->
|
||||||
<div class="flex w-full">
|
<div class="flex w-full">
|
||||||
<div class="font-bold">
|
<div class="font-bold">{{ activity.name }}</div>
|
||||||
{{ activity.name }}
|
|
||||||
<span v-if="activity.status === BpmTaskStatusEnum.SKIP">
|
|
||||||
【跳过】
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<!-- 信息:时间 -->
|
<!-- 信息:时间 -->
|
||||||
<div
|
<div
|
||||||
v-if="activity.status !== BpmTaskStatusEnum.NOT_START"
|
v-if="activity.status !== BpmTaskStatusEnum.NOT_START"
|
||||||
|
|
@ -309,7 +284,6 @@ defineExpose({ setCustomApproveUsers, batchSetCustomApproveUsers });
|
||||||
ghost
|
ghost
|
||||||
size="small"
|
size="small"
|
||||||
@click="handleChildProcess(activity)"
|
@click="handleChildProcess(activity)"
|
||||||
:disabled="!activity.processInstanceId"
|
|
||||||
>
|
>
|
||||||
查看子流程
|
查看子流程
|
||||||
</Button>
|
</Button>
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,8 @@ import type { BpmTaskApi } from '#/api/bpm/task';
|
||||||
|
|
||||||
import { DocAlert, Page } from '@vben/common-ui';
|
import { DocAlert, Page } from '@vben/common-ui';
|
||||||
|
|
||||||
import { message } from 'ant-design-vue';
|
|
||||||
|
|
||||||
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
import { getTaskDonePage, withdrawTask } from '#/api/bpm/task';
|
import { getTaskDonePage } from '#/api/bpm/task';
|
||||||
import { router } from '#/router';
|
import { router } from '#/router';
|
||||||
|
|
||||||
import { useGridColumns, useGridFormSchema } from './data';
|
import { useGridColumns, useGridFormSchema } from './data';
|
||||||
|
|
@ -25,15 +23,7 @@ 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: {
|
formOptions: {
|
||||||
schema: useGridFormSchema(),
|
schema: useGridFormSchema(),
|
||||||
},
|
},
|
||||||
|
|
@ -62,7 +52,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
cellConfig: {
|
cellConfig: {
|
||||||
height: 64,
|
height: 64,
|
||||||
},
|
},
|
||||||
} as VxeTableGridOptions<BpmTaskApi.TaskManager>,
|
} as VxeTableGridOptions<BpmTaskApi.Task>,
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
@ -85,13 +75,6 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
<template #actions="{ row }">
|
<template #actions="{ row }">
|
||||||
<TableAction
|
<TableAction
|
||||||
:actions="[
|
:actions="[
|
||||||
{
|
|
||||||
label: '撤回',
|
|
||||||
type: 'link',
|
|
||||||
icon: ACTION_ICON.EDIT,
|
|
||||||
color: 'warning',
|
|
||||||
onClick: handleWithdraw.bind(null, row),
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
label: '历史',
|
label: '历史',
|
||||||
type: 'link',
|
type: 'link',
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ function handleUpdateValue(row: any) {
|
||||||
} else {
|
} else {
|
||||||
tableData.value[index] = row;
|
tableData.value[index] = row;
|
||||||
}
|
}
|
||||||
emit('update:products', [...tableData.value]);
|
emit('update:products', tableData.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 表格配置 */
|
/** 表格配置 */
|
||||||
|
|
|
||||||
|
|
@ -1,167 +0,0 @@
|
||||||
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,152 +1,34 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
import { DocAlert, Page } from '@vben/common-ui';
|
||||||
import type { ErpAccountApi } from '#/api/erp/finance/account';
|
|
||||||
|
|
||||||
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
import { Button } from 'ant-design-vue';
|
||||||
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>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Page auto-content-height>
|
<Page>
|
||||||
<template #doc>
|
<template #doc>
|
||||||
<DocAlert
|
<DocAlert
|
||||||
title="【财务】采购付款、销售收款"
|
title="【财务】采购付款、销售收款"
|
||||||
url="https://doc.iocoder.cn/sale/finance-payment-receipt/"
|
url="https://doc.iocoder.cn/sale/finance-payment-receipt/"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<FormModal @success="onRefresh" />
|
<Button
|
||||||
<Grid table-title="结算账户列表">
|
danger
|
||||||
<template #toolbar-tools>
|
type="link"
|
||||||
<TableAction
|
target="_blank"
|
||||||
:actions="[
|
href="https://github.com/yudaocode/yudao-ui-admin-vue3"
|
||||||
{
|
>
|
||||||
label: $t('ui.actionTitle.create', ['结算账户']),
|
该功能支持 Vue3 + element-plus 版本!
|
||||||
type: 'primary',
|
</Button>
|
||||||
icon: ACTION_ICON.ADD,
|
<br />
|
||||||
auth: ['erp:account:create'],
|
<Button
|
||||||
onClick: handleCreate,
|
type="link"
|
||||||
},
|
target="_blank"
|
||||||
{
|
href="https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/erp/finance/account/index"
|
||||||
label: $t('ui.actionTitle.export'),
|
>
|
||||||
type: 'primary',
|
可参考
|
||||||
icon: ACTION_ICON.DOWNLOAD,
|
https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/erp/finance/account/index
|
||||||
auth: ['erp:account:export'],
|
代码,pull request 贡献给我们!
|
||||||
onClick: handleExport,
|
</Button>
|
||||||
},
|
|
||||||
]"
|
|
||||||
/>
|
|
||||||
</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>
|
</Page>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -1,86 +0,0 @@
|
||||||
<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>
|
|
||||||
|
|
@ -1,70 +0,0 @@
|
||||||
<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>
|
|
||||||
|
|
@ -1,174 +0,0 @@
|
||||||
<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,21 +1,7 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref } from 'vue';
|
|
||||||
|
|
||||||
import { DocAlert, Page } from '@vben/common-ui';
|
import { DocAlert, Page } from '@vben/common-ui';
|
||||||
|
|
||||||
import { Col, Row, Spin } from 'ant-design-vue';
|
import { Button } 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>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -26,28 +12,23 @@ const purchaseChartRef = ref();
|
||||||
url="https://doc.iocoder.cn/erp/build/"
|
url="https://doc.iocoder.cn/erp/build/"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
<Button
|
||||||
<Spin :spinning="loading">
|
danger
|
||||||
<div class="flex flex-col gap-4">
|
type="link"
|
||||||
<!-- 销售/采购的全局统计 -->
|
target="_blank"
|
||||||
<SummaryCard />
|
href="https://github.com/yudaocode/yudao-ui-admin-vue3"
|
||||||
|
>
|
||||||
<!-- 销售/采购的时段统计 -->
|
该功能支持 Vue3 + element-plus 版本!
|
||||||
<Row :gutter="16">
|
</Button>
|
||||||
<!-- 销售统计 -->
|
<br />
|
||||||
<Col :md="12" :sm="12" :xs="24">
|
<Button
|
||||||
<TimeSummaryChart ref="saleChartRef" title="销售统计" type="sale" />
|
type="link"
|
||||||
</Col>
|
target="_blank"
|
||||||
<!-- 采购统计 -->
|
href="https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/erp/home/index.vue"
|
||||||
<Col :md="12" :sm="12" :xs="24">
|
>
|
||||||
<TimeSummaryChart
|
可参考
|
||||||
ref="purchaseChartRef"
|
https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/erp/home/index.vue
|
||||||
title="采购统计"
|
代码,pull request 贡献给我们!
|
||||||
type="purchase"
|
</Button>
|
||||||
/>
|
|
||||||
</Col>
|
|
||||||
</Row>
|
|
||||||
</div>
|
|
||||||
</Spin>
|
|
||||||
</Page>
|
</Page>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -1,125 +0,0 @@
|
||||||
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,166 +1,34 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
import { DocAlert, Page } from '@vben/common-ui';
|
||||||
import type { ErpProductCategoryApi } from '#/api/erp/product/category';
|
|
||||||
|
|
||||||
import { ref } from 'vue';
|
import { Button } from 'ant-design-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>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Page auto-content-height>
|
<Page>
|
||||||
<template #doc>
|
<template #doc>
|
||||||
<DocAlert
|
<DocAlert
|
||||||
title="【产品】产品信息、分类、单位"
|
title="【产品】产品信息、分类、单位"
|
||||||
url="https://doc.iocoder.cn/erp/product/"
|
url="https://doc.iocoder.cn/erp/product/"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<FormModal @success="onRefresh" />
|
<Button
|
||||||
<Grid table-title="产品分类列表">
|
danger
|
||||||
<template #toolbar-tools>
|
type="link"
|
||||||
<TableAction
|
target="_blank"
|
||||||
:actions="[
|
href="https://github.com/yudaocode/yudao-ui-admin-vue3"
|
||||||
{
|
>
|
||||||
label: $t('ui.actionTitle.create', ['产品分类']),
|
该功能支持 Vue3 + element-plus 版本!
|
||||||
type: 'primary',
|
</Button>
|
||||||
icon: ACTION_ICON.ADD,
|
<br />
|
||||||
auth: ['erp:product-category:create'],
|
<Button
|
||||||
onClick: handleCreate,
|
type="link"
|
||||||
},
|
target="_blank"
|
||||||
{
|
href="https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/erp/product/category/index"
|
||||||
label: isExpanded ? '收缩' : '展开',
|
>
|
||||||
type: 'primary',
|
可参考
|
||||||
onClick: toggleExpand,
|
https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/erp/product/category/index
|
||||||
},
|
代码,pull request 贡献给我们!
|
||||||
]"
|
</Button>
|
||||||
/>
|
|
||||||
</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>
|
</Page>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -1,92 +0,0 @@
|
||||||
<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>
|
|
||||||
|
|
@ -1,220 +0,0 @@
|
||||||
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,152 +1,34 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
import { DocAlert, Page } from '@vben/common-ui';
|
||||||
import type { ErpProductApi } from '#/api/erp/product/product';
|
|
||||||
|
|
||||||
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
import { Button } from 'ant-design-vue';
|
||||||
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>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Page auto-content-height>
|
<Page>
|
||||||
<template #doc>
|
<template #doc>
|
||||||
<DocAlert
|
<DocAlert
|
||||||
title="【产品】产品信息、分类、单位"
|
title="【产品】产品信息、分类、单位"
|
||||||
url="https://doc.iocoder.cn/erp/product/"
|
url="https://doc.iocoder.cn/erp/product/"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<FormModal @success="onRefresh" />
|
<Button
|
||||||
<Grid table-title="产品列表">
|
danger
|
||||||
<template #toolbar-tools>
|
type="link"
|
||||||
<TableAction
|
target="_blank"
|
||||||
:actions="[
|
href="https://github.com/yudaocode/yudao-ui-admin-vue3"
|
||||||
{
|
>
|
||||||
label: $t('ui.actionTitle.create', ['产品']),
|
该功能支持 Vue3 + element-plus 版本!
|
||||||
type: 'primary',
|
</Button>
|
||||||
icon: ACTION_ICON.ADD,
|
<br />
|
||||||
auth: ['erp:product:create'],
|
<Button
|
||||||
onClick: handleCreate,
|
type="link"
|
||||||
},
|
target="_blank"
|
||||||
{
|
href="https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/erp/product/product/index"
|
||||||
label: $t('ui.actionTitle.export'),
|
>
|
||||||
type: 'primary',
|
可参考
|
||||||
icon: ACTION_ICON.DOWNLOAD,
|
https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/erp/product/product/index
|
||||||
auth: ['erp:product:export'],
|
代码,pull request 贡献给我们!
|
||||||
onClick: handleExport,
|
</Button>
|
||||||
},
|
|
||||||
]"
|
|
||||||
/>
|
|
||||||
</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>
|
</Page>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -1,86 +0,0 @@
|
||||||
<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>
|
|
||||||
|
|
@ -1,89 +0,0 @@
|
||||||
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,152 +1,34 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
import { DocAlert, Page } from '@vben/common-ui';
|
||||||
import type { ErpProductUnitApi } from '#/api/erp/product/unit';
|
|
||||||
|
|
||||||
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
import { Button } from 'ant-design-vue';
|
||||||
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>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Page auto-content-height>
|
<Page>
|
||||||
<template #doc>
|
<template #doc>
|
||||||
<DocAlert
|
<DocAlert
|
||||||
title="【产品】产品信息、分类、单位"
|
title="【产品】产品信息、分类、单位"
|
||||||
url="https://doc.iocoder.cn/erp/product/"
|
url="https://doc.iocoder.cn/erp/product/"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<FormModal @success="onRefresh" />
|
<Button
|
||||||
<Grid table-title="产品单位列表">
|
danger
|
||||||
<template #toolbar-tools>
|
type="link"
|
||||||
<TableAction
|
target="_blank"
|
||||||
:actions="[
|
href="https://github.com/yudaocode/yudao-ui-admin-vue3"
|
||||||
{
|
>
|
||||||
label: $t('ui.actionTitle.create', ['产品单位']),
|
该功能支持 Vue3 + element-plus 版本!
|
||||||
type: 'primary',
|
</Button>
|
||||||
icon: ACTION_ICON.ADD,
|
<br />
|
||||||
auth: ['erp:product-unit:create'],
|
<Button
|
||||||
onClick: handleCreate,
|
type="link"
|
||||||
},
|
target="_blank"
|
||||||
{
|
href="https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/erp/product/unit/index"
|
||||||
label: $t('ui.actionTitle.export'),
|
>
|
||||||
type: 'primary',
|
可参考
|
||||||
icon: ACTION_ICON.DOWNLOAD,
|
https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/erp/product/unit/index
|
||||||
auth: ['erp:product-unit:export'],
|
代码,pull request 贡献给我们!
|
||||||
onClick: handleExport,
|
</Button>
|
||||||
},
|
|
||||||
]"
|
|
||||||
/>
|
|
||||||
</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>
|
</Page>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -1,88 +0,0 @@
|
||||||
<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>
|
|
||||||
|
|
@ -1,586 +0,0 @@
|
||||||
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