提交新版本
This commit is contained in:
35
apps/web-antd/.env
Normal file
35
apps/web-antd/.env
Normal file
@@ -0,0 +1,35 @@
|
||||
# 应用标题
|
||||
VITE_APP_TITLE=芋道管理系统
|
||||
|
||||
# 应用命名空间,用于缓存、store等功能的前缀,确保隔离
|
||||
VITE_APP_NAMESPACE=yudao-vben-antd
|
||||
|
||||
# 对store进行加密的密钥,在将store持久化到localStorage时会使用该密钥进行加密
|
||||
VITE_APP_STORE_SECURE_KEY=please-replace-me-with-your-own-key
|
||||
|
||||
# 是否开启模拟数据
|
||||
VITE_NITRO_MOCK=false
|
||||
|
||||
# 租户开关
|
||||
VITE_APP_TENANT_ENABLE=true
|
||||
|
||||
# 验证码的开关
|
||||
VITE_APP_CAPTCHA_ENABLE=false
|
||||
|
||||
# 文档地址的开关
|
||||
VITE_APP_DOCALERT_ENABLE=true
|
||||
|
||||
# 百度统计
|
||||
VITE_APP_BAIDU_CODE = e98f2eab6ceb8688bc6d8fc5332ff093
|
||||
|
||||
# GoView域名
|
||||
VITE_GOVIEW_URL='http://127.0.0.1:3000'
|
||||
|
||||
# API 加解密
|
||||
VITE_APP_API_ENCRYPT_ENABLE = true
|
||||
VITE_APP_API_ENCRYPT_HEADER = X-Api-Encrypt
|
||||
VITE_APP_API_ENCRYPT_ALGORITHM = AES
|
||||
VITE_APP_API_ENCRYPT_REQUEST_KEY = 52549111389893486934626385991395
|
||||
VITE_APP_API_ENCRYPT_RESPONSE_KEY = 96103715984234343991809655248883
|
||||
# VITE_APP_API_ENCRYPT_REQUEST_KEY = MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCls2rIpnGdYnLFgz1XU13GbNQ5DloyPpvW00FPGjqn5Z6JpK+kDtVlnkhwR87iRrE5Vf2WNqRX6vzbLSgveIQY8e8oqGCb829myjf1MuI+ZzN4ghf/7tEYhZJGPI9AbfxFqBUzm+kR3/HByAI22GLT96WM26QiMK8n3tIP/yiLswIDAQAB
|
||||
# VITE_APP_API_ENCRYPT_RESPONSE_KEY = MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAOH8IfIFxL/MR9XIg1UDv5z1fGXQI93E8wrU4iPFovL/sEt9uSgSkjyidC2O7N+m7EKtoN6b1u7cEwXSkwf3kfK0jdWLSQaNpX5YshqXCBzbDfugDaxuyYrNA4/tIMs7mzZAk0APuRXB35Dmupou7Yw7TFW/7QhQmGfzeEKULQvnAgMBAAECgYAw8LqlQGyQoPv5p3gRxEMOCfgL0JzD3XBJKztiRd35RDh40Nx1ejgjW4dPioFwGiVWd2W8cAGHLzALdcQT2KDJh+T/tsd4SPmI6uSBBK6Ff2DkO+kFFcuYvfclQQKqxma5CaZOSqhgenacmgTMFeg2eKlY3symV6JlFNu/IKU42QJBAOhxAK/Eq3e61aYQV2JSguhMR3b8NXJJRroRs/QHEanksJtl+M+2qhkC9nQVXBmBkndnkU/l2tYcHfSBlAyFySMCQQD445tgm/J2b6qMQmuUGQAYDN8FIkHjeKmha+l/fv0igWm8NDlBAem91lNDIPBUzHL1X1+pcts5bjmq99YdOnhtAkAg2J8dN3B3idpZDiQbC8fd5bGPmdI/pSUudAP27uzLEjr2qrE/QPPGdwm2m7IZFJtK7kK1hKio6u48t/bg0iL7AkEAuUUs94h+v702Fnym+jJ2CHEkXvz2US8UDs52nWrZYiM1o1y4tfSHm8H8bv8JCAa9GHyriEawfBraILOmllFdLQJAQSRZy4wmlaG48MhVXodB85X+VZ9krGXZ2TLhz7kz9iuToy53l9jTkESt6L5BfBDCVdIwcXLYgK+8KFdHN5W7HQ==
|
||||
71
apps/web-antd/package.json
Normal file
71
apps/web-antd/package.json
Normal file
@@ -0,0 +1,71 @@
|
||||
{
|
||||
"name": "@vben/web-antd",
|
||||
"version": "5.5.9",
|
||||
"homepage": "https://vben.pro",
|
||||
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vbenjs/vue-vben-admin.git",
|
||||
"directory": "apps/web-antd"
|
||||
},
|
||||
"license": "MIT",
|
||||
"author": {
|
||||
"name": "vben",
|
||||
"email": "ann.vben@gmail.com",
|
||||
"url": "https://github.com/anncwb"
|
||||
},
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"build": "pnpm vite build --mode production",
|
||||
"build:analyze": "pnpm vite build --mode analyze",
|
||||
"dev": "pnpm vite --mode development",
|
||||
"preview": "vite preview",
|
||||
"typecheck": "vue-tsc --noEmit --skipLibCheck"
|
||||
},
|
||||
"imports": {
|
||||
"#/*": "./src/*"
|
||||
},
|
||||
"dependencies": {
|
||||
"@form-create/ant-design-vue": "catalog:",
|
||||
"@form-create/antd-designer": "catalog:",
|
||||
"@tinymce/tinymce-vue": "catalog:",
|
||||
"@vben/access": "workspace:*",
|
||||
"@vben/common-ui": "workspace:*",
|
||||
"@vben/constants": "workspace:*",
|
||||
"@vben/hooks": "workspace:*",
|
||||
"@vben/icons": "workspace:*",
|
||||
"@vben/layouts": "workspace:*",
|
||||
"@vben/locales": "workspace:*",
|
||||
"@vben/plugins": "workspace:*",
|
||||
"@vben/preferences": "workspace:*",
|
||||
"@vben/request": "workspace:*",
|
||||
"@vben/stores": "workspace:*",
|
||||
"@vben/styles": "workspace:*",
|
||||
"@vben/types": "workspace:*",
|
||||
"@vben/utils": "workspace:*",
|
||||
"@videojs-player/vue": "catalog:",
|
||||
"@vueuse/core": "catalog:",
|
||||
"@vueuse/integrations": "catalog:",
|
||||
"ant-design-vue": "catalog:",
|
||||
"benz-amr-recorder": "catalog:",
|
||||
"bpmn-js": "catalog:",
|
||||
"bpmn-js-properties-panel": "catalog:",
|
||||
"bpmn-js-token-simulation": "catalog:",
|
||||
"camunda-bpmn-moddle": "catalog:",
|
||||
"cropperjs": "catalog:",
|
||||
"dayjs": "catalog:",
|
||||
"diagram-js": "catalog:",
|
||||
"fast-xml-parser": "catalog:",
|
||||
"highlight.js": "catalog:",
|
||||
"pinia": "catalog:",
|
||||
"steady-xml": "catalog:",
|
||||
"tinymce": "catalog:",
|
||||
"video.js": "catalog:",
|
||||
"vue": "catalog:",
|
||||
"vue-dompurify-html": "catalog:",
|
||||
"vue-router": "catalog:",
|
||||
"vue3-print-nb": "catalog:",
|
||||
"vue3-signature": "catalog:",
|
||||
"vuedraggable": "catalog:"
|
||||
}
|
||||
}
|
||||
BIN
apps/web-antd/public/wx-xingyu.png
Normal file
BIN
apps/web-antd/public/wx-xingyu.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 495 KiB |
244
apps/web-antd/src/adapter/component/index.ts
Normal file
244
apps/web-antd/src/adapter/component/index.ts
Normal file
@@ -0,0 +1,244 @@
|
||||
/**
|
||||
* 通用组件共同的使用的基础组件,原先放在 adapter/form 内部,限制了使用范围,这里提取出来,方便其他地方使用
|
||||
* 可用于 vben-form、vben-modal、vben-drawer 等组件使用,
|
||||
*/
|
||||
|
||||
import type { Component } from 'vue';
|
||||
|
||||
import type { BaseFormComponentType } from '@vben/common-ui';
|
||||
import type { Recordable } from '@vben/types';
|
||||
|
||||
import { defineAsyncComponent, defineComponent, h, ref } from 'vue';
|
||||
|
||||
import { ApiComponent, globalShareState, IconPicker } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
|
||||
import { notification } from 'ant-design-vue';
|
||||
|
||||
import { Tinymce as RichTextarea } from '#/components/tinymce';
|
||||
import { FileUpload, ImageUpload } from '#/components/upload';
|
||||
|
||||
const AutoComplete = defineAsyncComponent(
|
||||
() => import('ant-design-vue/es/auto-complete'),
|
||||
);
|
||||
const Button = defineAsyncComponent(() => import('ant-design-vue/es/button'));
|
||||
const Cascader = defineAsyncComponent(
|
||||
() => import('ant-design-vue/es/cascader'),
|
||||
);
|
||||
const Checkbox = defineAsyncComponent(
|
||||
() => import('ant-design-vue/es/checkbox'),
|
||||
);
|
||||
const CheckboxGroup = defineAsyncComponent(() =>
|
||||
import('ant-design-vue/es/checkbox').then((res) => res.CheckboxGroup),
|
||||
);
|
||||
const DatePicker = defineAsyncComponent(
|
||||
() => import('ant-design-vue/es/date-picker'),
|
||||
);
|
||||
const Divider = defineAsyncComponent(() => import('ant-design-vue/es/divider'));
|
||||
const Input = defineAsyncComponent(() => import('ant-design-vue/es/input'));
|
||||
const InputNumber = defineAsyncComponent(
|
||||
() => import('ant-design-vue/es/input-number'),
|
||||
);
|
||||
const InputPassword = defineAsyncComponent(() =>
|
||||
import('ant-design-vue/es/input').then((res) => res.InputPassword),
|
||||
);
|
||||
const Mentions = defineAsyncComponent(
|
||||
() => import('ant-design-vue/es/mentions'),
|
||||
);
|
||||
const Radio = defineAsyncComponent(() => import('ant-design-vue/es/radio'));
|
||||
const RadioGroup = defineAsyncComponent(() =>
|
||||
import('ant-design-vue/es/radio').then((res) => res.RadioGroup),
|
||||
);
|
||||
const RangePicker = defineAsyncComponent(() =>
|
||||
import('ant-design-vue/es/date-picker').then((res) => res.RangePicker),
|
||||
);
|
||||
const Rate = defineAsyncComponent(() => import('ant-design-vue/es/rate'));
|
||||
const Select = defineAsyncComponent(() => import('ant-design-vue/es/select'));
|
||||
const Space = defineAsyncComponent(() => import('ant-design-vue/es/space'));
|
||||
const Switch = defineAsyncComponent(() => import('ant-design-vue/es/switch'));
|
||||
const Textarea = defineAsyncComponent(() =>
|
||||
import('ant-design-vue/es/input').then((res) => res.Textarea),
|
||||
);
|
||||
const TimePicker = defineAsyncComponent(
|
||||
() => import('ant-design-vue/es/time-picker'),
|
||||
);
|
||||
const TimeRangePicker = defineAsyncComponent(() =>
|
||||
import('ant-design-vue/es/time-picker').then((res) => res.TimeRangePicker),
|
||||
);
|
||||
const TreeSelect = defineAsyncComponent(
|
||||
() => import('ant-design-vue/es/tree-select'),
|
||||
);
|
||||
const Upload = defineAsyncComponent(() => import('ant-design-vue/es/upload'));
|
||||
|
||||
const withDefaultPlaceholder = <T extends Component>(
|
||||
component: T,
|
||||
type: 'input' | 'select',
|
||||
componentProps: Recordable<any> = {},
|
||||
) => {
|
||||
return defineComponent({
|
||||
name: component.name,
|
||||
inheritAttrs: false,
|
||||
setup: (props: any, { attrs, expose, slots }) => {
|
||||
const placeholder =
|
||||
props?.placeholder ||
|
||||
attrs?.placeholder ||
|
||||
$t(`ui.placeholder.${type}`);
|
||||
// 透传组件暴露的方法
|
||||
const innerRef = ref();
|
||||
expose(
|
||||
new Proxy(
|
||||
{},
|
||||
{
|
||||
get: (_target, key) => innerRef.value?.[key],
|
||||
has: (_target, key) => key in (innerRef.value || {}),
|
||||
},
|
||||
),
|
||||
);
|
||||
return () =>
|
||||
h(
|
||||
component,
|
||||
{ ...componentProps, placeholder, ...props, ...attrs, ref: innerRef },
|
||||
slots,
|
||||
);
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
// 这里需要自行根据业务组件库进行适配,需要用到的组件都需要在这里类型说明
|
||||
export type ComponentType =
|
||||
| 'ApiCascader'
|
||||
| 'ApiSelect'
|
||||
| 'ApiTreeSelect'
|
||||
| 'AutoComplete'
|
||||
| 'Checkbox'
|
||||
| 'CheckboxGroup'
|
||||
| 'DatePicker'
|
||||
| 'DefaultButton'
|
||||
| 'Divider'
|
||||
| 'FileUpload'
|
||||
| 'IconPicker'
|
||||
| 'ImageUpload'
|
||||
| 'Input'
|
||||
| 'InputNumber'
|
||||
| 'InputPassword'
|
||||
| 'Mentions'
|
||||
| 'PrimaryButton'
|
||||
| 'Radio'
|
||||
| 'RadioGroup'
|
||||
| 'RangePicker'
|
||||
| 'Rate'
|
||||
| 'RichTextarea'
|
||||
| 'Select'
|
||||
| 'Space'
|
||||
| 'Switch'
|
||||
| 'Textarea'
|
||||
| 'TimePicker'
|
||||
| 'TimeRangePicker'
|
||||
| 'TreeSelect'
|
||||
| 'Upload'
|
||||
| BaseFormComponentType;
|
||||
|
||||
async function initComponentAdapter() {
|
||||
const components: Partial<Record<ComponentType, Component>> = {
|
||||
// 如果你的组件体积比较大,可以使用异步加载
|
||||
// Button: () =>
|
||||
// import('xxx').then((res) => res.Button),
|
||||
ApiCascader: withDefaultPlaceholder(
|
||||
{
|
||||
...ApiComponent,
|
||||
name: 'ApiCascader',
|
||||
},
|
||||
'select',
|
||||
{
|
||||
component: Cascader,
|
||||
fieldNames: { label: 'label', value: 'value', children: 'children' },
|
||||
loadingSlot: 'suffixIcon',
|
||||
modelPropName: 'value',
|
||||
optionsPropName: 'treeData',
|
||||
visibleEvent: 'onVisibleChange',
|
||||
},
|
||||
),
|
||||
ApiSelect: withDefaultPlaceholder(
|
||||
{
|
||||
...ApiComponent,
|
||||
name: 'ApiSelect',
|
||||
},
|
||||
'select',
|
||||
{
|
||||
component: Select,
|
||||
loadingSlot: 'suffixIcon',
|
||||
visibleEvent: 'onDropdownVisibleChange',
|
||||
modelPropName: 'value',
|
||||
},
|
||||
),
|
||||
ApiTreeSelect: withDefaultPlaceholder(
|
||||
{
|
||||
...ApiComponent,
|
||||
name: 'ApiTreeSelect',
|
||||
},
|
||||
'select',
|
||||
{
|
||||
component: TreeSelect,
|
||||
fieldNames: { label: 'label', value: 'value', children: 'children' },
|
||||
loadingSlot: 'suffixIcon',
|
||||
modelPropName: 'value',
|
||||
optionsPropName: 'treeData',
|
||||
visibleEvent: 'onVisibleChange',
|
||||
},
|
||||
),
|
||||
AutoComplete,
|
||||
Checkbox,
|
||||
CheckboxGroup,
|
||||
DatePicker,
|
||||
// 自定义默认按钮
|
||||
DefaultButton: (props, { attrs, slots }) => {
|
||||
return h(Button, { ...props, attrs, type: 'default' }, slots);
|
||||
},
|
||||
Divider,
|
||||
IconPicker: withDefaultPlaceholder(IconPicker, 'select', {
|
||||
iconSlot: 'addonAfter',
|
||||
inputComponent: Input,
|
||||
modelValueProp: 'value',
|
||||
}),
|
||||
Input: withDefaultPlaceholder(Input, 'input'),
|
||||
InputNumber: withDefaultPlaceholder(InputNumber, 'input'),
|
||||
InputPassword: withDefaultPlaceholder(InputPassword, 'input'),
|
||||
Mentions: withDefaultPlaceholder(Mentions, 'input'),
|
||||
// 自定义主要按钮
|
||||
PrimaryButton: (props, { attrs, slots }) => {
|
||||
return h(Button, { ...props, attrs, type: 'primary' }, slots);
|
||||
},
|
||||
Radio,
|
||||
RadioGroup,
|
||||
RangePicker,
|
||||
Rate,
|
||||
Select: withDefaultPlaceholder(Select, 'select'),
|
||||
Space,
|
||||
Switch,
|
||||
Textarea: withDefaultPlaceholder(Textarea, 'input'),
|
||||
RichTextarea,
|
||||
TimePicker,
|
||||
TimeRangePicker,
|
||||
TreeSelect: withDefaultPlaceholder(TreeSelect, 'select'),
|
||||
Upload,
|
||||
FileUpload,
|
||||
ImageUpload,
|
||||
};
|
||||
|
||||
// 将组件注册到全局共享状态中
|
||||
globalShareState.setComponents(components);
|
||||
|
||||
// 定义全局共享状态中的消息提示
|
||||
globalShareState.defineMessage({
|
||||
// 复制成功消息提示
|
||||
copyPreferencesSuccess: (title, content) => {
|
||||
notification.success({
|
||||
description: content,
|
||||
message: title,
|
||||
placement: 'bottomRight',
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export { initComponentAdapter };
|
||||
69
apps/web-antd/src/adapter/form.ts
Normal file
69
apps/web-antd/src/adapter/form.ts
Normal file
@@ -0,0 +1,69 @@
|
||||
import type {
|
||||
VbenFormSchema as FormSchema,
|
||||
VbenFormProps,
|
||||
} from '@vben/common-ui';
|
||||
|
||||
import type { ComponentType } from './component';
|
||||
|
||||
import { setupVbenForm, useVbenForm as useForm, z } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
import { isMobile } from '@vben/utils';
|
||||
|
||||
async function initSetupVbenForm() {
|
||||
setupVbenForm<ComponentType>({
|
||||
config: {
|
||||
// ant design vue组件库默认都是 v-model:value
|
||||
baseModelPropName: 'value',
|
||||
|
||||
// 一些组件是 v-model:checked 或者 v-model:fileList
|
||||
modelPropNameMap: {
|
||||
Checkbox: 'checked',
|
||||
Radio: 'checked',
|
||||
Switch: 'checked',
|
||||
Upload: 'fileList',
|
||||
},
|
||||
},
|
||||
defineRules: {
|
||||
// 输入项目必填国际化适配
|
||||
required: (value, _params, ctx) => {
|
||||
if (value === undefined || value === null || value.length === 0) {
|
||||
return $t('ui.formRules.required', [ctx.label]);
|
||||
}
|
||||
return true;
|
||||
},
|
||||
// 选择项目必填国际化适配
|
||||
selectRequired: (value, _params, ctx) => {
|
||||
if (value === undefined || value === null) {
|
||||
return $t('ui.formRules.selectRequired', [ctx.label]);
|
||||
}
|
||||
return true;
|
||||
},
|
||||
// 手机号非必填
|
||||
mobile: (value, _params, ctx) => {
|
||||
if (value === undefined || value === null || value.length === 0) {
|
||||
return true;
|
||||
} else if (!isMobile(value)) {
|
||||
return $t('ui.formRules.mobile', [ctx.label]);
|
||||
}
|
||||
return true;
|
||||
},
|
||||
// 手机号必填
|
||||
mobileRequired: (value, _params, ctx) => {
|
||||
if (value === undefined || value === null || value.length === 0) {
|
||||
return $t('ui.formRules.required', [ctx.label]);
|
||||
}
|
||||
if (!isMobile(value)) {
|
||||
return $t('ui.formRules.mobile', [ctx.label]);
|
||||
}
|
||||
return true;
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
const useVbenForm = useForm<ComponentType>;
|
||||
|
||||
export { initSetupVbenForm, useVbenForm, z };
|
||||
|
||||
export type VbenFormSchema = FormSchema<ComponentType>;
|
||||
export type { VbenFormProps };
|
||||
371
apps/web-antd/src/adapter/vxe-table.ts
Normal file
371
apps/web-antd/src/adapter/vxe-table.ts
Normal file
@@ -0,0 +1,371 @@
|
||||
import type { VxeTableGridOptions } from '@vben/plugins/vxe-table';
|
||||
import type { Recordable } from '@vben/types';
|
||||
|
||||
import { h } from 'vue';
|
||||
|
||||
import { IconifyIcon } from '@vben/icons';
|
||||
import { $te } from '@vben/locales';
|
||||
import {
|
||||
AsyncVxeColumn,
|
||||
AsyncVxeTable,
|
||||
createRequiredValidation,
|
||||
setupVbenVxeTable,
|
||||
useVbenVxeGrid,
|
||||
} from '@vben/plugins/vxe-table';
|
||||
import {
|
||||
erpCountInputFormatter,
|
||||
erpNumberFormatter,
|
||||
fenToYuan,
|
||||
formatFileSize,
|
||||
formatPast2,
|
||||
isFunction,
|
||||
isString,
|
||||
} from '@vben/utils';
|
||||
|
||||
import {
|
||||
Button,
|
||||
Image,
|
||||
ImagePreviewGroup,
|
||||
Popconfirm,
|
||||
Switch,
|
||||
Tag,
|
||||
} from 'ant-design-vue';
|
||||
|
||||
import { DictTag } from '#/components/dict-tag';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import { useVbenForm } from './form';
|
||||
|
||||
setupVbenVxeTable({
|
||||
configVxeTable: (vxeUI) => {
|
||||
vxeUI.setConfig({
|
||||
grid: {
|
||||
align: 'center',
|
||||
border: false,
|
||||
columnConfig: {
|
||||
resizable: true,
|
||||
},
|
||||
minHeight: 180,
|
||||
formConfig: {
|
||||
// 全局禁用vxe-table的表单配置,使用formOptions
|
||||
enabled: false,
|
||||
},
|
||||
toolbarConfig: {
|
||||
import: false, // 是否导入
|
||||
export: false, // 是否导出
|
||||
refresh: true, // 是否刷新
|
||||
print: false, // 是否打印
|
||||
zoom: true, // 是否缩放
|
||||
custom: true, // 是否自定义配置
|
||||
},
|
||||
customConfig: {
|
||||
mode: 'modal',
|
||||
},
|
||||
proxyConfig: {
|
||||
autoLoad: true,
|
||||
response: {
|
||||
result: 'list',
|
||||
total: 'total',
|
||||
},
|
||||
showActiveMsg: true,
|
||||
showResponseMsg: false,
|
||||
},
|
||||
pagerConfig: {
|
||||
enabled: true,
|
||||
},
|
||||
sortConfig: {
|
||||
multiple: true,
|
||||
},
|
||||
round: true,
|
||||
showOverflow: true,
|
||||
size: 'small',
|
||||
} as VxeTableGridOptions,
|
||||
});
|
||||
|
||||
// 表格配置项可以用 cellRender: { name: 'CellImage' },
|
||||
vxeUI.renderer.add('CellImage', {
|
||||
renderTableDefault(_renderOpts, params) {
|
||||
const { column, row } = params;
|
||||
return h(Image, { src: row[column.field] });
|
||||
},
|
||||
});
|
||||
|
||||
vxeUI.renderer.add('CellImages', {
|
||||
renderTableDefault(_renderOpts, params) {
|
||||
const { column, row } = params;
|
||||
if (column && column.field && row[column.field]) {
|
||||
return h(ImagePreviewGroup, {}, () => {
|
||||
return row[column.field].map((item: any) =>
|
||||
h(Image, { src: item }),
|
||||
);
|
||||
});
|
||||
}
|
||||
return '';
|
||||
},
|
||||
});
|
||||
|
||||
// 表格配置项可以用 cellRender: { name: 'CellLink' },
|
||||
vxeUI.renderer.add('CellLink', {
|
||||
renderTableDefault(renderOpts) {
|
||||
const { props } = renderOpts;
|
||||
return h(
|
||||
Button,
|
||||
{ size: 'small', type: 'link' },
|
||||
{ default: () => props?.text },
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
// 表格配置项可以用 cellRender: { name: 'CellTag' },
|
||||
vxeUI.renderer.add('CellTag', {
|
||||
renderTableDefault(renderOpts, params) {
|
||||
const { props } = renderOpts;
|
||||
const { column, row } = params;
|
||||
return h(Tag, { color: props?.color }, () => row[column.field]);
|
||||
},
|
||||
});
|
||||
|
||||
vxeUI.renderer.add('CellTags', {
|
||||
renderTableDefault(renderOpts, params) {
|
||||
const { props } = renderOpts;
|
||||
const { column, row } = params;
|
||||
if (!row[column.field] || row[column.field].length === 0) {
|
||||
return '';
|
||||
}
|
||||
return h(
|
||||
'div',
|
||||
{ class: 'flex items-center justify-center' },
|
||||
{
|
||||
default: () =>
|
||||
row[column.field].map((item: any) =>
|
||||
h(Tag, { color: props?.color }, { default: () => item }),
|
||||
),
|
||||
},
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
// 表格配置项可以用 cellRender: { name: 'CellDict', props:{dictType: ''} },
|
||||
vxeUI.renderer.add('CellDict', {
|
||||
renderTableDefault(renderOpts, params) {
|
||||
const { props } = renderOpts;
|
||||
const { column, row } = params;
|
||||
if (!props) {
|
||||
return '';
|
||||
}
|
||||
// 使用 DictTag 组件替代原来的实现
|
||||
return h(DictTag, {
|
||||
type: props.type,
|
||||
value: row[column.field]?.toString(),
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
// 表格配置项可以用 cellRender: { name: 'CellSwitch', props: { beforeChange: () => {} } },
|
||||
// add by 芋艿:from https://github.com/vbenjs/vue-vben-admin/blob/main/playground/src/adapter/vxe-table.ts#L97-L123
|
||||
vxeUI.renderer.add('CellSwitch', {
|
||||
renderTableDefault({ attrs, props }, { column, row }) {
|
||||
const loadingKey = `__loading_${column.field}`;
|
||||
const finallyProps = {
|
||||
checkedChildren: $t('common.enabled'),
|
||||
checkedValue: 1,
|
||||
unCheckedChildren: $t('common.disabled'),
|
||||
unCheckedValue: 0,
|
||||
...props,
|
||||
checked: row[column.field],
|
||||
loading: row[loadingKey] ?? false,
|
||||
'onUpdate:checked': onChange,
|
||||
};
|
||||
|
||||
async function onChange(newVal: any) {
|
||||
row[loadingKey] = true;
|
||||
try {
|
||||
const result = await attrs?.beforeChange?.(newVal, row);
|
||||
if (result !== false) {
|
||||
row[column.field] = newVal;
|
||||
}
|
||||
} finally {
|
||||
row[loadingKey] = false;
|
||||
}
|
||||
}
|
||||
|
||||
return h(Switch, finallyProps);
|
||||
},
|
||||
});
|
||||
|
||||
// 注册表格的操作按钮渲染器 cellRender: { name: 'CellOperation', options: ['edit', 'delete'] }
|
||||
// add by 芋艿:from https://github.com/vbenjs/vue-vben-admin/blob/main/playground/src/adapter/vxe-table.ts#L125-L255
|
||||
vxeUI.renderer.add('CellOperation', {
|
||||
renderTableDefault({ attrs, options, props }, { column, row }) {
|
||||
const defaultProps = { size: 'small', type: 'link', ...props };
|
||||
let align = 'end';
|
||||
switch (column.align) {
|
||||
case 'center': {
|
||||
align = 'center';
|
||||
break;
|
||||
}
|
||||
case 'left': {
|
||||
align = 'start';
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
align = 'end';
|
||||
break;
|
||||
}
|
||||
}
|
||||
const presets: Recordable<Recordable<any>> = {
|
||||
delete: {
|
||||
danger: true,
|
||||
text: $t('common.delete'),
|
||||
},
|
||||
edit: {
|
||||
text: $t('common.edit'),
|
||||
},
|
||||
};
|
||||
const operations: Array<Recordable<any>> = (
|
||||
options || ['edit', 'delete']
|
||||
)
|
||||
.map((opt) => {
|
||||
if (isString(opt)) {
|
||||
return presets[opt]
|
||||
? { code: opt, ...presets[opt], ...defaultProps }
|
||||
: {
|
||||
code: opt,
|
||||
text: $te(`common.${opt}`) ? $t(`common.${opt}`) : opt,
|
||||
...defaultProps,
|
||||
};
|
||||
} else {
|
||||
return { ...defaultProps, ...presets[opt.code], ...opt };
|
||||
}
|
||||
})
|
||||
.map((opt) => {
|
||||
const optBtn: Recordable<any> = {};
|
||||
Object.keys(opt).forEach((key) => {
|
||||
optBtn[key] = isFunction(opt[key]) ? opt[key](row) : opt[key];
|
||||
});
|
||||
return optBtn;
|
||||
})
|
||||
.filter((opt) => opt.show !== false);
|
||||
|
||||
function renderBtn(opt: Recordable<any>, listen = true) {
|
||||
return h(
|
||||
Button,
|
||||
{
|
||||
...props,
|
||||
...opt,
|
||||
icon: undefined,
|
||||
onClick: listen
|
||||
? () =>
|
||||
attrs?.onClick?.({
|
||||
code: opt.code,
|
||||
row,
|
||||
})
|
||||
: undefined,
|
||||
},
|
||||
{
|
||||
default: () => {
|
||||
const content = [];
|
||||
if (opt.icon) {
|
||||
content.push(
|
||||
h(IconifyIcon, { class: 'size-5', icon: opt.icon }),
|
||||
);
|
||||
}
|
||||
content.push(opt.text);
|
||||
return content;
|
||||
},
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
function renderConfirm(opt: Recordable<any>) {
|
||||
return h(
|
||||
Popconfirm,
|
||||
{
|
||||
getPopupContainer(el) {
|
||||
return el.closest('tbody') || document.body;
|
||||
},
|
||||
placement: 'topLeft',
|
||||
title: $t('ui.actionTitle.delete', [attrs?.nameTitle || '']),
|
||||
...props,
|
||||
...opt,
|
||||
icon: undefined,
|
||||
onConfirm: () => {
|
||||
attrs?.onClick?.({
|
||||
code: opt.code,
|
||||
row,
|
||||
});
|
||||
},
|
||||
},
|
||||
{
|
||||
default: () => renderBtn({ ...opt }, false),
|
||||
description: () =>
|
||||
h(
|
||||
'div',
|
||||
{ class: 'truncate' },
|
||||
$t('ui.actionMessage.deleteConfirm', [
|
||||
row[attrs?.nameField || 'name'],
|
||||
]),
|
||||
),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
const btns = operations.map((opt) =>
|
||||
opt.code === 'delete' ? renderConfirm(opt) : renderBtn(opt),
|
||||
);
|
||||
return h(
|
||||
'div',
|
||||
{
|
||||
class: 'flex table-operations',
|
||||
style: { justifyContent: align },
|
||||
},
|
||||
btns,
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
// 这里可以自行扩展 vxe-table 的全局配置,比如自定义格式化
|
||||
// vxeUI.formats.add
|
||||
|
||||
vxeUI.formats.add('formatPast2', {
|
||||
tableCellFormatMethod({ cellValue }) {
|
||||
return formatPast2(cellValue);
|
||||
},
|
||||
});
|
||||
|
||||
// add by 星语:数量格式化,保留 3 位
|
||||
vxeUI.formats.add('formatAmount3', {
|
||||
tableCellFormatMethod({ cellValue }) {
|
||||
return erpCountInputFormatter(cellValue);
|
||||
},
|
||||
});
|
||||
// add by 星语:数量格式化,保留 2 位
|
||||
vxeUI.formats.add('formatAmount2', {
|
||||
tableCellFormatMethod({ cellValue }, digits = 2) {
|
||||
return `${erpNumberFormatter(cellValue, digits)}`;
|
||||
},
|
||||
});
|
||||
|
||||
vxeUI.formats.add('formatFenToYuanAmount', {
|
||||
tableCellFormatMethod({ cellValue }, digits = 2) {
|
||||
return `${erpNumberFormatter(fenToYuan(cellValue), digits)}`;
|
||||
},
|
||||
});
|
||||
|
||||
// add by 星语:文件大小格式化
|
||||
vxeUI.formats.add('formatFileSize', {
|
||||
tableCellFormatMethod({ cellValue }, digits = 2) {
|
||||
return formatFileSize(cellValue, digits);
|
||||
},
|
||||
});
|
||||
},
|
||||
useVbenForm,
|
||||
});
|
||||
|
||||
export { createRequiredValidation, useVbenVxeGrid };
|
||||
|
||||
export const [VxeTable, VxeColumn] = [AsyncVxeTable, AsyncVxeColumn];
|
||||
|
||||
export * from '#/components/table-action';
|
||||
|
||||
export type * from '@vben/plugins/vxe-table';
|
||||
74
apps/web-antd/src/api/ai/chat/conversation/index.ts
Normal file
74
apps/web-antd/src/api/ai/chat/conversation/index.ts
Normal file
@@ -0,0 +1,74 @@
|
||||
import type { PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace AiChatConversationApi {
|
||||
export interface ChatConversation {
|
||||
id: number; // ID 编号
|
||||
userId: number; // 用户编号
|
||||
title: string; // 对话标题
|
||||
pinned: boolean; // 是否置顶
|
||||
roleId: number; // 角色编号
|
||||
modelId: number; // 模型编号
|
||||
model: string; // 模型标志
|
||||
temperature: number; // 温度参数
|
||||
maxTokens: number; // 单条回复的最大 Token 数量
|
||||
maxContexts: number; // 上下文的最大 Message 数量
|
||||
createTime?: Date; // 创建时间
|
||||
systemMessage?: string; // 角色设定
|
||||
modelName?: string; // 模型名字
|
||||
roleAvatar?: string; // 角色头像
|
||||
modelMaxTokens?: string; // 模型的单条回复的最大 Token 数量
|
||||
modelMaxContexts?: string; // 模型的上下文的最大 Message 数量
|
||||
}
|
||||
}
|
||||
|
||||
/** 获得【我的】聊天对话 */
|
||||
export function getChatConversationMy(id: number) {
|
||||
return requestClient.get<AiChatConversationApi.ChatConversation>(
|
||||
`/ai/chat/conversation/get-my?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增【我的】聊天对话 */
|
||||
export function createChatConversationMy(
|
||||
data: AiChatConversationApi.ChatConversation,
|
||||
) {
|
||||
return requestClient.post('/ai/chat/conversation/create-my', data);
|
||||
}
|
||||
|
||||
/** 更新【我的】聊天对话 */
|
||||
export function updateChatConversationMy(
|
||||
data: AiChatConversationApi.ChatConversation,
|
||||
) {
|
||||
return requestClient.put(`/ai/chat/conversation/update-my`, data);
|
||||
}
|
||||
|
||||
/** 删除【我的】聊天对话 */
|
||||
export function deleteChatConversationMy(id: number) {
|
||||
return requestClient.delete(`/ai/chat/conversation/delete-my?id=${id}`);
|
||||
}
|
||||
|
||||
/** 删除【我的】所有对话,置顶除外 */
|
||||
export function deleteChatConversationMyByUnpinned() {
|
||||
return requestClient.delete(`/ai/chat/conversation/delete-by-unpinned`);
|
||||
}
|
||||
|
||||
/** 获得【我的】聊天对话列表 */
|
||||
export function getChatConversationMyList() {
|
||||
return requestClient.get<AiChatConversationApi.ChatConversation[]>(
|
||||
`/ai/chat/conversation/my-list`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 获得【我的】聊天对话列表 */
|
||||
export function getChatConversationPage(params: any) {
|
||||
return requestClient.get<
|
||||
PageResult<AiChatConversationApi.ChatConversation[]>
|
||||
>(`/ai/chat/conversation/page`, { params });
|
||||
}
|
||||
|
||||
/** 管理员删除消息 */
|
||||
export function deleteChatConversationByAdmin(id: number) {
|
||||
return requestClient.delete(`/ai/chat/conversation/delete-by-admin?id=${id}`);
|
||||
}
|
||||
115
apps/web-antd/src/api/ai/chat/message/index.ts
Normal file
115
apps/web-antd/src/api/ai/chat/message/index.ts
Normal file
@@ -0,0 +1,115 @@
|
||||
import type { PageResult } from '@vben/request';
|
||||
|
||||
import { useAppConfig } from '@vben/hooks';
|
||||
import { fetchEventSource } from '@vben/request';
|
||||
import { useAccessStore } from '@vben/stores';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
const { apiURL } = useAppConfig(import.meta.env, import.meta.env.PROD);
|
||||
const accessStore = useAccessStore();
|
||||
|
||||
export namespace AiChatMessageApi {
|
||||
export interface ChatMessage {
|
||||
id: number; // 编号
|
||||
conversationId: number; // 对话编号
|
||||
type: string; // 消息类型
|
||||
userId: string; // 用户编号
|
||||
roleId: string; // 角色编号
|
||||
model: number; // 模型标志
|
||||
modelId: number; // 模型编号
|
||||
content: string; // 聊天内容
|
||||
reasoningContent?: string; // 推理内容(深度思考)
|
||||
tokens: number; // 消耗 Token 数量
|
||||
segmentIds?: number[]; // 段落编号
|
||||
segments?: {
|
||||
content: string; // 段落内容
|
||||
documentId: number; // 文档编号
|
||||
documentName: string; // 文档名称
|
||||
id: number; // 段落编号
|
||||
}[];
|
||||
webSearchPages?: WebSearchPage[]; // 联网搜索结果
|
||||
attachmentUrls?: string[]; // 附件 URL 数组
|
||||
createTime: Date; // 创建时间
|
||||
roleAvatar: string; // 角色头像
|
||||
userAvatar: string; // 用户头像
|
||||
}
|
||||
|
||||
/** 联网搜索页面接口 */
|
||||
export interface WebSearchPage {
|
||||
name: string; // 网站名称
|
||||
icon: string; // 网站图标 URL
|
||||
title: string; // 页面标题
|
||||
url: string; // 页面 URL
|
||||
snippet: string; // 简短描述
|
||||
summary: string; // 内容摘要
|
||||
}
|
||||
}
|
||||
|
||||
/** 消息列表 */
|
||||
export function getChatMessageListByConversationId(
|
||||
conversationId: null | number,
|
||||
) {
|
||||
return requestClient.get<AiChatMessageApi.ChatMessage[]>(
|
||||
`/ai/chat/message/list-by-conversation-id?conversationId=${conversationId}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 发送 Stream 消息 */
|
||||
export function sendChatMessageStream(
|
||||
conversationId: number,
|
||||
content: string,
|
||||
ctrl: any,
|
||||
enableContext: boolean,
|
||||
enableWebSearch: boolean,
|
||||
onMessage: any,
|
||||
onError: any,
|
||||
onClose: any,
|
||||
attachmentUrls?: string[],
|
||||
) {
|
||||
const token = accessStore.accessToken;
|
||||
return fetchEventSource(`${apiURL}/ai/chat/message/send-stream`, {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
openWhenHidden: true,
|
||||
body: JSON.stringify({
|
||||
conversationId,
|
||||
content,
|
||||
useContext: enableContext,
|
||||
useSearch: enableWebSearch,
|
||||
attachmentUrls: attachmentUrls || [],
|
||||
}),
|
||||
onmessage: onMessage,
|
||||
onerror: onError,
|
||||
onclose: onClose,
|
||||
signal: ctrl.signal,
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除消息 */
|
||||
export function deleteChatMessage(id: number) {
|
||||
return requestClient.delete(`/ai/chat/message/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 删除指定对话的消息 */
|
||||
export function deleteByConversationId(conversationId: number) {
|
||||
return requestClient.delete(
|
||||
`/ai/chat/message/delete-by-conversation-id?conversationId=${conversationId}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 获得消息分页 */
|
||||
export function getChatMessagePage(params: any) {
|
||||
return requestClient.get<PageResult<AiChatMessageApi.ChatMessage>>(
|
||||
'/ai/chat/message/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 管理员删除消息 */
|
||||
export function deleteChatMessageByAdmin(id: number) {
|
||||
return requestClient.delete(`/ai/chat/message/delete-by-admin?id=${id}`);
|
||||
}
|
||||
115
apps/web-antd/src/api/ai/image/index.ts
Normal file
115
apps/web-antd/src/api/ai/image/index.ts
Normal file
@@ -0,0 +1,115 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace AiImageApi {
|
||||
/** 绘图 */
|
||||
export interface Image {
|
||||
id: number; // 编号
|
||||
userId: number;
|
||||
platform: string; // 平台
|
||||
model: string; // 模型
|
||||
prompt: string; // 提示词
|
||||
width: number; // 图片宽度
|
||||
height: number; // 图片高度
|
||||
status: number; // 状态
|
||||
publicStatus: boolean; // 公开状态
|
||||
picUrl: string; // 任务地址
|
||||
errorMessage: string; // 错误信息
|
||||
options: any; // 配置 Map<string, string>
|
||||
taskId: number; // 任务编号
|
||||
buttons: ImageMidjourneyButtons[]; // mj 操作按钮
|
||||
createTime: Date; // 创建时间
|
||||
finishTime: Date; // 完成时间
|
||||
}
|
||||
|
||||
export interface ImageMidjourneyButtons {
|
||||
customId: string; // MJ::JOB::upsample::1::85a4b4c1-8835-46c5-a15c-aea34fad1862 动作标识
|
||||
emoji: string; // 图标 emoji
|
||||
label: string; // Make Variations 文本
|
||||
style: number; // 样式: 2(Primary)、3(Green)
|
||||
}
|
||||
|
||||
export interface ImageDrawReqVO {
|
||||
prompt: string; // 提示词
|
||||
modelId: number; // 模型
|
||||
style: string; // 图像生成的风格
|
||||
width: string; // 图片宽度
|
||||
height: string; // 图片高度
|
||||
options: object; // 绘制参数,Map<String, String>
|
||||
}
|
||||
|
||||
export interface ImageMidjourneyImagineReqVO {
|
||||
prompt: string; // 提示词
|
||||
modelId: number; // 模型
|
||||
base64Array?: string[]; // size不能为空
|
||||
width: string; // 图片宽度
|
||||
height: string; // 图片高度
|
||||
version: string; // 版本
|
||||
}
|
||||
|
||||
export interface ImageMidjourneyAction {
|
||||
id: number; // 图片编号
|
||||
customId: string; // MJ::JOB::upsample::1::85a4b4c1-8835-46c5-a15c-aea34fad1862 动作标识
|
||||
}
|
||||
}
|
||||
|
||||
/** 获取【我的】绘图分页 */
|
||||
export function getImagePageMy(params: PageParam) {
|
||||
return requestClient.get<PageResult<AiImageApi.Image>>('/ai/image/my-page', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取【我的】绘图记录 */
|
||||
export function getImageMy(id: number) {
|
||||
return requestClient.get<AiImageApi.Image>(`/ai/image/get-my?id=${id}`);
|
||||
}
|
||||
|
||||
/** 获取【我的】绘图记录列表 */
|
||||
export function getImageListMyByIds(ids: number[]) {
|
||||
return requestClient.get<AiImageApi.Image[]>(`/ai/image/my-list-by-ids`, {
|
||||
params: { ids: ids.join(',') },
|
||||
});
|
||||
}
|
||||
|
||||
/** 生成图片 */
|
||||
export function drawImage(data: AiImageApi.ImageDrawReqVO) {
|
||||
return requestClient.post(`/ai/image/draw`, data);
|
||||
}
|
||||
|
||||
/** 删除【我的】绘画记录 */
|
||||
export function deleteImageMy(id: number) {
|
||||
return requestClient.delete(`/ai/image/delete-my?id=${id}`);
|
||||
}
|
||||
|
||||
/** ================ midjourney 专属 ================ */
|
||||
|
||||
/** 【Midjourney】生成图片 */
|
||||
export function midjourneyImagine(
|
||||
data: AiImageApi.ImageMidjourneyImagineReqVO,
|
||||
) {
|
||||
return requestClient.post(`/ai/image/midjourney/imagine`, data);
|
||||
}
|
||||
|
||||
/** 【Midjourney】Action 操作(二次生成图片) */
|
||||
export function midjourneyAction(data: AiImageApi.ImageMidjourneyAction) {
|
||||
return requestClient.post(`/ai/image/midjourney/action`, data);
|
||||
}
|
||||
|
||||
/** ================ 绘图管理 ================ */
|
||||
|
||||
/** 查询绘画分页 */
|
||||
export function getImagePage(params: any) {
|
||||
return requestClient.get<AiImageApi.Image[]>(`/ai/image/page`, { params });
|
||||
}
|
||||
|
||||
/** 更新绘画发布状态 */
|
||||
export function updateImage(data: any) {
|
||||
return requestClient.put(`/ai/image/update`, data);
|
||||
}
|
||||
|
||||
/** 删除绘画 */
|
||||
export function deleteImage(id: number) {
|
||||
return requestClient.delete(`/ai/image/delete?id=${id}`);
|
||||
}
|
||||
53
apps/web-antd/src/api/ai/knowledge/document/index.ts
Normal file
53
apps/web-antd/src/api/ai/knowledge/document/index.ts
Normal file
@@ -0,0 +1,53 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace AiKnowledgeDocumentApi {
|
||||
export interface KnowledgeDocument {
|
||||
id: number; // 编号
|
||||
knowledgeId: number; // 知识库编号
|
||||
name: string; // 文档名称
|
||||
contentLength: number; // 字符数
|
||||
tokens: number; // token 数
|
||||
segmentMaxTokens: number; // 分片最大 token 数
|
||||
retrievalCount: number; // 召回次数
|
||||
status: number; // 是否启用
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询知识库文档分页 */
|
||||
export function getKnowledgeDocumentPage(params: PageParam) {
|
||||
return requestClient.get<
|
||||
PageResult<AiKnowledgeDocumentApi.KnowledgeDocument>
|
||||
>('/ai/knowledge/document/page', { params });
|
||||
}
|
||||
|
||||
/** 查询知识库文档详情 */
|
||||
export function getKnowledgeDocument(id: number) {
|
||||
return requestClient.get(`/ai/knowledge/document/get?id=${id}`);
|
||||
}
|
||||
|
||||
/** 新增知识库文档(单个) */
|
||||
export function createKnowledge(data: any) {
|
||||
return requestClient.post('/ai/knowledge/document/create', data);
|
||||
}
|
||||
|
||||
/** 新增知识库文档(多个) */
|
||||
export function createKnowledgeDocumentList(data: any) {
|
||||
return requestClient.post('/ai/knowledge/document/create-list', data);
|
||||
}
|
||||
|
||||
/** 修改知识库文档 */
|
||||
export function updateKnowledgeDocument(data: any) {
|
||||
return requestClient.put('/ai/knowledge/document/update', data);
|
||||
}
|
||||
|
||||
/** 修改知识库文档状态 */
|
||||
export function updateKnowledgeDocumentStatus(data: any) {
|
||||
return requestClient.put('/ai/knowledge/document/update-status', data);
|
||||
}
|
||||
|
||||
/** 删除知识库文档 */
|
||||
export function deleteKnowledgeDocument(id: number) {
|
||||
return requestClient.delete(`/ai/knowledge/document/delete?id=${id}`);
|
||||
}
|
||||
51
apps/web-antd/src/api/ai/knowledge/knowledge/index.ts
Normal file
51
apps/web-antd/src/api/ai/knowledge/knowledge/index.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace AiKnowledgeKnowledgeApi {
|
||||
export interface Knowledge {
|
||||
id: number; // 编号
|
||||
name: string; // 知识库名称
|
||||
description: string; // 知识库描述
|
||||
embeddingModelId: number; // 嵌入模型编号,高质量模式时维护
|
||||
topK: number; // topK
|
||||
similarityThreshold: number; // 相似度阈值
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询知识库分页 */
|
||||
export function getKnowledgePage(params: PageParam) {
|
||||
return requestClient.get<PageResult<AiKnowledgeKnowledgeApi.Knowledge>>(
|
||||
'/ai/knowledge/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询知识库详情 */
|
||||
export function getKnowledge(id: number) {
|
||||
return requestClient.get<AiKnowledgeKnowledgeApi.Knowledge>(
|
||||
`/ai/knowledge/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增知识库 */
|
||||
export function createKnowledge(data: AiKnowledgeKnowledgeApi.Knowledge) {
|
||||
return requestClient.post('/ai/knowledge/create', data);
|
||||
}
|
||||
|
||||
/** 修改知识库 */
|
||||
export function updateKnowledge(data: AiKnowledgeKnowledgeApi.Knowledge) {
|
||||
return requestClient.put('/ai/knowledge/update', data);
|
||||
}
|
||||
|
||||
/** 删除知识库 */
|
||||
export function deleteKnowledge(id: number) {
|
||||
return requestClient.delete(`/ai/knowledge/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 获取知识库简单列表 */
|
||||
export function getSimpleKnowledgeList() {
|
||||
return requestClient.get<AiKnowledgeKnowledgeApi.Knowledge[]>(
|
||||
'/ai/knowledge/simple-list',
|
||||
);
|
||||
}
|
||||
81
apps/web-antd/src/api/ai/knowledge/segment/index.ts
Normal file
81
apps/web-antd/src/api/ai/knowledge/segment/index.ts
Normal file
@@ -0,0 +1,81 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace AiKnowledgeSegmentApi {
|
||||
export interface KnowledgeSegment {
|
||||
id: number; // 编号
|
||||
documentId: number; // 文档编号
|
||||
knowledgeId: number; // 知识库编号
|
||||
vectorId: string; // 向量库编号
|
||||
content: string; // 切片内容
|
||||
contentLength: number; // 切片内容长度
|
||||
tokens: number; // token 数量
|
||||
retrievalCount: number; // 召回次数
|
||||
status: number; // 文档状态
|
||||
createTime: number; // 创建时间
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询知识库分段分页 */
|
||||
export function getKnowledgeSegmentPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<AiKnowledgeSegmentApi.KnowledgeSegment>>(
|
||||
'/ai/knowledge/segment/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询知识库分段详情 */
|
||||
export function getKnowledgeSegment(id: number) {
|
||||
return requestClient.get<AiKnowledgeSegmentApi.KnowledgeSegment>(
|
||||
`/ai/knowledge/segment/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增知识库分段 */
|
||||
export function createKnowledgeSegment(
|
||||
data: AiKnowledgeSegmentApi.KnowledgeSegment,
|
||||
) {
|
||||
return requestClient.post('/ai/knowledge/segment/create', data);
|
||||
}
|
||||
|
||||
/** 修改知识库分段 */
|
||||
export function updateKnowledgeSegment(
|
||||
data: AiKnowledgeSegmentApi.KnowledgeSegment,
|
||||
) {
|
||||
return requestClient.put('/ai/knowledge/segment/update', data);
|
||||
}
|
||||
|
||||
/** 修改知识库分段状态 */
|
||||
export function updateKnowledgeSegmentStatus(id: number, status: number) {
|
||||
return requestClient.put('/ai/knowledge/segment/update-status', {
|
||||
id,
|
||||
status,
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除知识库分段 */
|
||||
export function deleteKnowledgeSegment(id: number) {
|
||||
return requestClient.delete(`/ai/knowledge/segment/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 切片内容 */
|
||||
export function splitContent(url: string, segmentMaxTokens: number) {
|
||||
return requestClient.get('/ai/knowledge/segment/split', {
|
||||
params: { url, segmentMaxTokens },
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取文档处理列表 */
|
||||
export function getKnowledgeSegmentProcessList(documentIds: number[]) {
|
||||
return requestClient.get('/ai/knowledge/segment/get-process-list', {
|
||||
params: { documentIds: documentIds.join(',') },
|
||||
});
|
||||
}
|
||||
|
||||
/** 搜索知识库分段 */
|
||||
export function searchKnowledgeSegment(params: any) {
|
||||
return requestClient.get('/ai/knowledge/segment/search', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
64
apps/web-antd/src/api/ai/mindmap/index.ts
Normal file
64
apps/web-antd/src/api/ai/mindmap/index.ts
Normal file
@@ -0,0 +1,64 @@
|
||||
import { useAppConfig } from '@vben/hooks';
|
||||
import { fetchEventSource } from '@vben/request';
|
||||
import { useAccessStore } from '@vben/stores';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
const { apiURL } = useAppConfig(import.meta.env, import.meta.env.PROD);
|
||||
const accessStore = useAccessStore();
|
||||
|
||||
export namespace AiMindmapApi {
|
||||
export interface MindMap {
|
||||
id: number; // 编号
|
||||
userId: number; // 用户编号
|
||||
prompt: string; // 生成内容提示
|
||||
generatedContent: string; // 生成的思维导图内容
|
||||
platform: string; // 平台
|
||||
model: string; // 模型
|
||||
errorMessage: string; // 错误信息
|
||||
}
|
||||
|
||||
export interface AiMindMapGenerateReqVO {
|
||||
prompt: string;
|
||||
}
|
||||
}
|
||||
|
||||
/** 生成思维导图 Stream */
|
||||
export function generateMindMap({
|
||||
data,
|
||||
onClose,
|
||||
onMessage,
|
||||
onError,
|
||||
ctrl,
|
||||
}: {
|
||||
ctrl: AbortController;
|
||||
data: AiMindmapApi.AiMindMapGenerateReqVO;
|
||||
onClose?: (...args: any[]) => void;
|
||||
onError?: (...args: any[]) => void;
|
||||
onMessage?: (res: any) => void;
|
||||
}) {
|
||||
const token = accessStore.accessToken;
|
||||
return fetchEventSource(`${apiURL}/ai/mind-map/generate-stream`, {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
openWhenHidden: true,
|
||||
body: JSON.stringify(data),
|
||||
onmessage: onMessage,
|
||||
onerror: onError,
|
||||
onclose: onClose,
|
||||
signal: ctrl.signal,
|
||||
});
|
||||
}
|
||||
|
||||
/** 查询思维导图分页 */
|
||||
export function getMindMapPage(params: any) {
|
||||
return requestClient.get(`/ai/mind-map/page`, { params });
|
||||
}
|
||||
|
||||
/** 删除思维导图 */
|
||||
export function deleteMindMap(id: number) {
|
||||
return requestClient.delete(`/ai/mind-map/delete?id=${id}`);
|
||||
}
|
||||
49
apps/web-antd/src/api/ai/model/apiKey/index.ts
Normal file
49
apps/web-antd/src/api/ai/model/apiKey/index.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace AiModelApiKeyApi {
|
||||
export interface ApiKey {
|
||||
id: number; // 编号
|
||||
name: string; // 名称
|
||||
apiKey: string; // 密钥
|
||||
platform: string; // 平台
|
||||
url: string; // 自定义 API 地址
|
||||
status: number; // 状态
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询 API 密钥分页 */
|
||||
export function getApiKeyPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<AiModelApiKeyApi.ApiKey>>(
|
||||
'/ai/api-key/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 获得 API 密钥列表 */
|
||||
export function getApiKeySimpleList() {
|
||||
return requestClient.get<AiModelApiKeyApi.ApiKey[]>(
|
||||
'/ai/api-key/simple-list',
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询 API 密钥详情 */
|
||||
export function getApiKey(id: number) {
|
||||
return requestClient.get<AiModelApiKeyApi.ApiKey>(`/ai/api-key/get?id=${id}`);
|
||||
}
|
||||
|
||||
/** 新增 API 密钥 */
|
||||
export function createApiKey(data: AiModelApiKeyApi.ApiKey) {
|
||||
return requestClient.post('/ai/api-key/create', data);
|
||||
}
|
||||
|
||||
/** 修改 API 密钥 */
|
||||
export function updateApiKey(data: AiModelApiKeyApi.ApiKey) {
|
||||
return requestClient.put('/ai/api-key/update', data);
|
||||
}
|
||||
|
||||
/** 删除 API 密钥 */
|
||||
export function deleteApiKey(id: number) {
|
||||
return requestClient.delete(`/ai/api-key/delete?id=${id}`);
|
||||
}
|
||||
85
apps/web-antd/src/api/ai/model/chatRole/index.ts
Normal file
85
apps/web-antd/src/api/ai/model/chatRole/index.ts
Normal file
@@ -0,0 +1,85 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace AiModelChatRoleApi {
|
||||
export interface ChatRole {
|
||||
id: number; // 角色编号
|
||||
modelId: number; // 模型编号
|
||||
name: string; // 角色名称
|
||||
avatar: string; // 角色头像
|
||||
category: string; // 角色类别
|
||||
sort: number; // 角色排序
|
||||
description: string; // 角色描述
|
||||
systemMessage: string; // 角色设定
|
||||
welcomeMessage: string; // 角色设定
|
||||
publicStatus: boolean; // 是否公开
|
||||
status: number; // 状态
|
||||
knowledgeIds?: number[]; // 引用的知识库 ID 列表
|
||||
toolIds?: number[]; // 引用的工具 ID 列表
|
||||
}
|
||||
|
||||
// AI 聊天角色 分页请求
|
||||
export interface ChatRolePageReqVO {
|
||||
name?: string; // 角色名称
|
||||
category?: string; // 角色类别
|
||||
publicStatus: boolean; // 是否公开
|
||||
pageNo: number; // 是否公开
|
||||
pageSize: number; // 是否公开
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询聊天角色分页 */
|
||||
export function getChatRolePage(params: PageParam) {
|
||||
return requestClient.get<PageResult<AiModelChatRoleApi.ChatRole>>(
|
||||
'/ai/chat-role/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询聊天角色详情 */
|
||||
export function getChatRole(id: number) {
|
||||
return requestClient.get<AiModelChatRoleApi.ChatRole>(
|
||||
`/ai/chat-role/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增聊天角色 */
|
||||
export function createChatRole(data: AiModelChatRoleApi.ChatRole) {
|
||||
return requestClient.post('/ai/chat-role/create', data);
|
||||
}
|
||||
|
||||
/** 修改聊天角色 */
|
||||
export function updateChatRole(data: AiModelChatRoleApi.ChatRole) {
|
||||
return requestClient.put('/ai/chat-role/update', data);
|
||||
}
|
||||
|
||||
/** 删除聊天角色 */
|
||||
export function deleteChatRole(id: number) {
|
||||
return requestClient.delete(`/ai/chat-role/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 获取 my role */
|
||||
export function getMyPage(params: AiModelChatRoleApi.ChatRolePageReqVO) {
|
||||
return requestClient.get('/ai/chat-role/my-page', { params });
|
||||
}
|
||||
|
||||
/** 获取角色分类 */
|
||||
export function getCategoryList() {
|
||||
return requestClient.get('/ai/chat-role/category-list');
|
||||
}
|
||||
|
||||
/** 创建角色 */
|
||||
export function createMy(data: AiModelChatRoleApi.ChatRole) {
|
||||
return requestClient.post('/ai/chat-role/create-my', data);
|
||||
}
|
||||
|
||||
/** 更新角色 */
|
||||
export function updateMy(data: AiModelChatRoleApi.ChatRole) {
|
||||
return requestClient.put('/ai/chat-role/update', data);
|
||||
}
|
||||
|
||||
/** 删除角色 my */
|
||||
export function deleteMy(id: number) {
|
||||
return requestClient.delete(`/ai/chat-role/delete-my?id=${id}`);
|
||||
}
|
||||
56
apps/web-antd/src/api/ai/model/model/index.ts
Normal file
56
apps/web-antd/src/api/ai/model/model/index.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace AiModelModelApi {
|
||||
export interface Model {
|
||||
id: number; // 编号
|
||||
keyId: number; // API 秘钥编号
|
||||
name: string; // 模型名字
|
||||
model: string; // 模型标识
|
||||
platform: string; // 模型平台
|
||||
type: number; // 模型类型
|
||||
sort: number; // 排序
|
||||
status: number; // 状态
|
||||
temperature?: number; // 温度参数
|
||||
maxTokens?: number; // 单条回复的最大 Token 数量
|
||||
maxContexts?: number; // 上下文的最大 Message 数量
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询模型分页 */
|
||||
export function getModelPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<AiModelModelApi.Model>>(
|
||||
'/ai/model/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 获得模型列表 */
|
||||
export function getModelSimpleList(type?: number) {
|
||||
return requestClient.get<AiModelModelApi.Model[]>('/ai/model/simple-list', {
|
||||
params: {
|
||||
type,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/** 查询模型详情 */
|
||||
export function getModel(id: number) {
|
||||
return requestClient.get<AiModelModelApi.Model>(`/ai/model/get?id=${id}`);
|
||||
}
|
||||
|
||||
/** 新增模型 */
|
||||
export function createModel(data: AiModelModelApi.Model) {
|
||||
return requestClient.post('/ai/model/create', data);
|
||||
}
|
||||
|
||||
/** 修改模型 */
|
||||
export function updateModel(data: AiModelModelApi.Model) {
|
||||
return requestClient.put('/ai/model/update', data);
|
||||
}
|
||||
|
||||
/** 删除模型 */
|
||||
export function deleteModel(id: number) {
|
||||
return requestClient.delete(`/ai/model/delete?id=${id}`);
|
||||
}
|
||||
44
apps/web-antd/src/api/ai/model/tool/index.ts
Normal file
44
apps/web-antd/src/api/ai/model/tool/index.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace AiModelToolApi {
|
||||
export interface Tool {
|
||||
id: number; // 工具编号
|
||||
name: string; // 工具名称
|
||||
description: string; // 工具描述
|
||||
status: number; // 状态
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询工具分页 */
|
||||
export function getToolPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<AiModelToolApi.Tool>>('/ai/tool/page', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/** 查询工具详情 */
|
||||
export function getTool(id: number) {
|
||||
return requestClient.get<AiModelToolApi.Tool>(`/ai/tool/get?id=${id}`);
|
||||
}
|
||||
|
||||
/** 新增工具 */
|
||||
export function createTool(data: AiModelToolApi.Tool) {
|
||||
return requestClient.post('/ai/tool/create', data);
|
||||
}
|
||||
|
||||
/** 修改工具 */
|
||||
export function updateTool(data: AiModelToolApi.Tool) {
|
||||
return requestClient.put('/ai/tool/update', data);
|
||||
}
|
||||
|
||||
/** 删除工具 */
|
||||
export function deleteTool(id: number) {
|
||||
return requestClient.delete(`/ai/tool/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 获取工具简单列表 */
|
||||
export function getToolSimpleList() {
|
||||
return requestClient.get<AiModelToolApi.Tool[]>('/ai/tool/simple-list');
|
||||
}
|
||||
44
apps/web-antd/src/api/ai/music/index.ts
Normal file
44
apps/web-antd/src/api/ai/music/index.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace AiMusicApi {
|
||||
// AI 音乐
|
||||
export interface Music {
|
||||
id: number; // 编号
|
||||
userId: number; // 用户编号
|
||||
title: string; // 音乐名称
|
||||
lyric: string; // 歌词
|
||||
imageUrl: string; // 图片地址
|
||||
audioUrl: string; // 音频地址
|
||||
videoUrl: string; // 视频地址
|
||||
status: number; // 音乐状态
|
||||
gptDescriptionPrompt: string; // 描述词
|
||||
prompt: string; // 提示词
|
||||
platform: string; // 模型平台
|
||||
model: string; // 模型
|
||||
generateMode: number; // 生成模式
|
||||
tags: string; // 音乐风格标签
|
||||
duration: number; // 音乐时长
|
||||
publicStatus: boolean; // 是否发布
|
||||
taskId: string; // 任务id
|
||||
errorMessage: string; // 错误信息
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询音乐分页 */
|
||||
export function getMusicPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<AiMusicApi.Music>>(`/ai/music/page`, {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/** 更新音乐 */
|
||||
export function updateMusic(data: any) {
|
||||
return requestClient.put('/ai/music/update', data);
|
||||
}
|
||||
|
||||
/** 删除音乐 */
|
||||
export function deleteMusic(id: number) {
|
||||
return requestClient.delete(`/ai/music/delete?id=${id}`);
|
||||
}
|
||||
49
apps/web-antd/src/api/ai/workflow/index.ts
Normal file
49
apps/web-antd/src/api/ai/workflow/index.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace AiWorkflowApi {
|
||||
/** 工作流 */
|
||||
export interface Workflow {
|
||||
id?: number; // 编号
|
||||
name: string; // 工作流名称
|
||||
code: string; // 工作流标识
|
||||
graph: string; // 工作流模型 JSON 数据
|
||||
remark?: string; // 备注
|
||||
status: number; // 状态
|
||||
createTime?: Date; // 创建时间
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询工作流管理列表 */
|
||||
export function getWorkflowPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<AiWorkflowApi.Workflow>>(
|
||||
'/ai/workflow/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询工作流详情 */
|
||||
export function getWorkflow(id: number) {
|
||||
return requestClient.get<AiWorkflowApi.Workflow>(`/ai/workflow/get?id=${id}`);
|
||||
}
|
||||
|
||||
/** 新增工作流 */
|
||||
export function createWorkflow(data: AiWorkflowApi.Workflow) {
|
||||
return requestClient.post('/ai/workflow/create', data);
|
||||
}
|
||||
|
||||
/** 修改工作流 */
|
||||
export function updateWorkflow(data: AiWorkflowApi.Workflow) {
|
||||
return requestClient.put('/ai/workflow/update', data);
|
||||
}
|
||||
|
||||
/** 删除工作流 */
|
||||
export function deleteWorkflow(id: number) {
|
||||
return requestClient.delete(`/ai/workflow/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 测试工作流 */
|
||||
export function testWorkflow(data: any) {
|
||||
return requestClient.post('/ai/workflow/test', data);
|
||||
}
|
||||
79
apps/web-antd/src/api/ai/write/index.ts
Normal file
79
apps/web-antd/src/api/ai/write/index.ts
Normal file
@@ -0,0 +1,79 @@
|
||||
import type { AiWriteTypeEnum } from '@vben/constants';
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { useAppConfig } from '@vben/hooks';
|
||||
import { fetchEventSource } from '@vben/request';
|
||||
import { useAccessStore } from '@vben/stores';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
const { apiURL } = useAppConfig(import.meta.env, import.meta.env.PROD);
|
||||
const accessStore = useAccessStore();
|
||||
|
||||
export namespace AiWriteApi {
|
||||
export interface Write {
|
||||
id?: number;
|
||||
type: AiWriteTypeEnum.REPLY | AiWriteTypeEnum.WRITING; // 1:撰写 2:回复
|
||||
prompt: string; // 写作内容提示 1。撰写 2回复
|
||||
originalContent: string; // 原文
|
||||
length: number; // 长度
|
||||
format: number; // 格式
|
||||
tone: number; // 语气
|
||||
language: number; // 语言
|
||||
userId?: number; // 用户编号
|
||||
platform?: string; // 平台
|
||||
model?: string; // 模型
|
||||
generatedContent?: string; // 生成的内容
|
||||
errorMessage?: string; // 错误信息
|
||||
createTime?: Date; // 创建时间
|
||||
}
|
||||
|
||||
export interface AiWritePageReqVO extends PageParam {
|
||||
userId?: number; // 用户编号
|
||||
type?: AiWriteTypeEnum; // 写作类型
|
||||
platform?: string; // 平台
|
||||
createTime?: [string, string]; // 创建时间
|
||||
}
|
||||
}
|
||||
|
||||
/** 写作 Stream */
|
||||
export function writeStream({
|
||||
data,
|
||||
onClose,
|
||||
onMessage,
|
||||
onError,
|
||||
ctrl,
|
||||
}: {
|
||||
ctrl: AbortController;
|
||||
data: Partial<AiWriteApi.Write>;
|
||||
onClose?: (...args: any[]) => void;
|
||||
onError?: (...args: any[]) => void;
|
||||
onMessage?: (res: any) => void;
|
||||
}) {
|
||||
const token = accessStore.accessToken;
|
||||
return fetchEventSource(`${apiURL}/ai/write/generate-stream`, {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
openWhenHidden: true,
|
||||
body: JSON.stringify(data),
|
||||
onmessage: onMessage,
|
||||
onerror: onError,
|
||||
onclose: onClose,
|
||||
signal: ctrl.signal,
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取写作列表 */
|
||||
export function getWritePage(params: AiWriteApi.AiWritePageReqVO) {
|
||||
return requestClient.get<PageResult<AiWriteApi.Write>>(`/ai/write/page`, {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除写作记录 */
|
||||
export function deleteWrite(id: number) {
|
||||
return requestClient.delete(`/ai/write/delete`, { params: { id } });
|
||||
}
|
||||
60
apps/web-antd/src/api/bpm/category/index.ts
Normal file
60
apps/web-antd/src/api/bpm/category/index.ts
Normal file
@@ -0,0 +1,60 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace BpmCategoryApi {
|
||||
/** 流程分类 */
|
||||
export interface Category {
|
||||
id: number;
|
||||
name: string;
|
||||
code: string;
|
||||
status: number;
|
||||
description?: string;
|
||||
sort: number;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询流程分类分页 */
|
||||
export async function getCategoryPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<BpmCategoryApi.Category>>(
|
||||
'/bpm/category/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询流程分类详情 */
|
||||
export async function getCategory(id: number) {
|
||||
return requestClient.get<BpmCategoryApi.Category>(
|
||||
`/bpm/category/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增流程分类 */
|
||||
export async function createCategory(data: BpmCategoryApi.Category) {
|
||||
return requestClient.post<number>('/bpm/category/create', data);
|
||||
}
|
||||
|
||||
/** 修改流程分类 */
|
||||
export async function updateCategory(data: BpmCategoryApi.Category) {
|
||||
return requestClient.put<boolean>('/bpm/category/update', data);
|
||||
}
|
||||
|
||||
/** 删除流程分类 */
|
||||
export async function deleteCategory(id: number) {
|
||||
return requestClient.delete<boolean>(`/bpm/category/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 查询流程分类列表 */
|
||||
export async function getCategorySimpleList() {
|
||||
return requestClient.get<BpmCategoryApi.Category[]>(
|
||||
`/bpm/category/simple-list`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 批量修改流程分类的排序 */
|
||||
export async function updateCategorySortBatch(ids: number[]) {
|
||||
const params = ids.join(',');
|
||||
return requestClient.put<boolean>(
|
||||
`/bpm/category/update-sort-batch?ids=${params}`,
|
||||
);
|
||||
}
|
||||
64
apps/web-antd/src/api/bpm/definition/index.ts
Normal file
64
apps/web-antd/src/api/bpm/definition/index.ts
Normal file
@@ -0,0 +1,64 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import type { BpmModelApi } from '#/api/bpm/model';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace BpmProcessDefinitionApi {
|
||||
/** 流程定义 */
|
||||
export interface ProcessDefinition {
|
||||
id: string;
|
||||
key?: string;
|
||||
version: number;
|
||||
name: string;
|
||||
category: string;
|
||||
description: string;
|
||||
deploymentTime: number;
|
||||
suspensionState: number;
|
||||
modelType: number;
|
||||
modelId: string;
|
||||
formType?: number;
|
||||
formId?: number;
|
||||
formName?: string;
|
||||
formCustomCreatePath?: string;
|
||||
bpmnXml?: string;
|
||||
simpleModel?: string;
|
||||
formFields?: string[];
|
||||
icon?: string;
|
||||
startUsers?: BpmModelApi.UserInfo[];
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询流程定义 */
|
||||
export async function getProcessDefinition(id?: string, key?: string) {
|
||||
return requestClient.get<BpmProcessDefinitionApi.ProcessDefinition>(
|
||||
'/bpm/process-definition/get',
|
||||
{
|
||||
params: { id, key },
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** 分页查询流程定义 */
|
||||
export async function getProcessDefinitionPage(params: PageParam) {
|
||||
return requestClient.get<
|
||||
PageResult<BpmProcessDefinitionApi.ProcessDefinition>
|
||||
>('/bpm/process-definition/page', { params });
|
||||
}
|
||||
|
||||
/** 查询流程定义列表 */
|
||||
export async function getProcessDefinitionList(params: any) {
|
||||
return requestClient.get<BpmProcessDefinitionApi.ProcessDefinition[]>(
|
||||
'/bpm/process-definition/list',
|
||||
{
|
||||
params,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询流程定义列表(简单列表) */
|
||||
export async function getSimpleProcessDefinitionList() {
|
||||
return requestClient.get<
|
||||
PageResult<BpmProcessDefinitionApi.ProcessDefinition>
|
||||
>('/bpm/process-definition/simple-list');
|
||||
}
|
||||
48
apps/web-antd/src/api/bpm/form/index.ts
Normal file
48
apps/web-antd/src/api/bpm/form/index.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace BpmFormApi {
|
||||
/** 流程表单 */
|
||||
export interface Form {
|
||||
id?: number;
|
||||
name: string;
|
||||
conf: string;
|
||||
fields: string[];
|
||||
status: number;
|
||||
remark: string;
|
||||
createTime: number;
|
||||
}
|
||||
}
|
||||
|
||||
/** 获取表单分页列表 */
|
||||
export async function getFormPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<BpmFormApi.Form>>('/bpm/form/page', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取表单详情 */
|
||||
export async function getForm(id: number) {
|
||||
return requestClient.get<BpmFormApi.Form>(`/bpm/form/get?id=${id}`);
|
||||
}
|
||||
|
||||
/** 创建表单 */
|
||||
export async function createForm(data: BpmFormApi.Form) {
|
||||
return requestClient.post('/bpm/form/create', data);
|
||||
}
|
||||
|
||||
/** 更新表单 */
|
||||
export async function updateForm(data: BpmFormApi.Form) {
|
||||
return requestClient.put('/bpm/form/update', data);
|
||||
}
|
||||
|
||||
/** 删除表单 */
|
||||
export async function deleteForm(id: number) {
|
||||
return requestClient.delete(`/bpm/form/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 获取表单简单列表 */
|
||||
export async function getFormSimpleList() {
|
||||
return requestClient.get<BpmFormApi.Form[]>('/bpm/form/simple-list');
|
||||
}
|
||||
111
apps/web-antd/src/api/bpm/model/index.ts
Normal file
111
apps/web-antd/src/api/bpm/model/index.ts
Normal file
@@ -0,0 +1,111 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace BpmModelApi {
|
||||
/** 流程模型 */
|
||||
export interface Model {
|
||||
id: number;
|
||||
key: string;
|
||||
name: string;
|
||||
icon?: string;
|
||||
description: string;
|
||||
category: string;
|
||||
formName: string;
|
||||
formType: number;
|
||||
formId: number;
|
||||
formCustomCreatePath: string;
|
||||
formCustomViewPath: string;
|
||||
processDefinition: ProcessDefinition;
|
||||
status: number;
|
||||
remark: string;
|
||||
createTime: string;
|
||||
bpmnXml: string;
|
||||
startUsers?: UserInfo[];
|
||||
}
|
||||
|
||||
/** 流程定义 */
|
||||
export interface ProcessDefinition {
|
||||
id: string;
|
||||
key?: string;
|
||||
version: number;
|
||||
deploymentTime: number;
|
||||
suspensionState: number;
|
||||
formType?: number;
|
||||
formCustomViewPath?: string;
|
||||
formFields?: string[];
|
||||
}
|
||||
|
||||
/** 用户信息 */
|
||||
export interface UserInfo {
|
||||
id: number;
|
||||
nickname: string;
|
||||
avatar?: string;
|
||||
deptId?: number;
|
||||
deptName?: string;
|
||||
}
|
||||
}
|
||||
|
||||
/** 模型分类信息 */
|
||||
export interface ModelCategoryInfo {
|
||||
id: number;
|
||||
name: string;
|
||||
modelList: BpmModelApi.Model[];
|
||||
}
|
||||
|
||||
/** 获取流程模型列表 */
|
||||
export async function getModelList(name?: string) {
|
||||
return requestClient.get<BpmModelApi.Model[]>('/bpm/model/list', {
|
||||
params: { name },
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取流程模型详情 */
|
||||
export async function getModel(id: string) {
|
||||
return requestClient.get<BpmModelApi.Model>(`/bpm/model/get?id=${id}`);
|
||||
}
|
||||
|
||||
/** 更新流程模型 */
|
||||
export async function updateModel(data: BpmModelApi.Model) {
|
||||
return requestClient.put('/bpm/model/update', data);
|
||||
}
|
||||
|
||||
/** 批量修改流程模型排序 */
|
||||
export async function updateModelSortBatch(ids: number[]) {
|
||||
const params = ids.join(',');
|
||||
return requestClient.put<boolean>(
|
||||
`/bpm/model/update-sort-batch?ids=${params}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 更新流程模型的 BPMN XML */
|
||||
export async function updateModelBpmn(data: BpmModelApi.Model) {
|
||||
return requestClient.put('/bpm/model/update-bpmn', data);
|
||||
}
|
||||
|
||||
/** 更新流程模型状态 */
|
||||
export async function updateModelState(id: number, state: number) {
|
||||
const data = {
|
||||
id,
|
||||
state,
|
||||
};
|
||||
return requestClient.put('/bpm/model/update-state', data);
|
||||
}
|
||||
|
||||
/** 创建流程模型 */
|
||||
export async function createModel(data: BpmModelApi.Model) {
|
||||
return requestClient.post('/bpm/model/create', data);
|
||||
}
|
||||
|
||||
/** 删除流程模型 */
|
||||
export async function deleteModel(id: number) {
|
||||
return requestClient.delete(`/bpm/model/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 部署流程模型 */
|
||||
export async function deployModel(id: number) {
|
||||
return requestClient.post(`/bpm/model/deploy?id=${id}`);
|
||||
}
|
||||
|
||||
/** 清理流程模型 */
|
||||
export async function cleanModel(id: number) {
|
||||
return requestClient.delete(`/bpm/model/clean?id=${id}`);
|
||||
}
|
||||
55
apps/web-antd/src/api/bpm/processExpression/index.ts
Normal file
55
apps/web-antd/src/api/bpm/processExpression/index.ts
Normal file
@@ -0,0 +1,55 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace BpmProcessExpressionApi {
|
||||
/** 流程表达式 */
|
||||
export interface ProcessExpression {
|
||||
id: number; // 编号
|
||||
name: string; // 表达式名字
|
||||
status: number; // 表达式状态
|
||||
expression: string; // 表达式
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询流程表达式分页 */
|
||||
export async function getProcessExpressionPage(params: PageParam) {
|
||||
return requestClient.get<
|
||||
PageResult<BpmProcessExpressionApi.ProcessExpression>
|
||||
>('/bpm/process-expression/page', { params });
|
||||
}
|
||||
|
||||
/** 查询流程表达式详情 */
|
||||
export async function getProcessExpression(id: number) {
|
||||
return requestClient.get<BpmProcessExpressionApi.ProcessExpression>(
|
||||
`/bpm/process-expression/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增流程表达式 */
|
||||
export async function createProcessExpression(
|
||||
data: BpmProcessExpressionApi.ProcessExpression,
|
||||
) {
|
||||
return requestClient.post<number>('/bpm/process-expression/create', data);
|
||||
}
|
||||
|
||||
/** 修改流程表达式 */
|
||||
export async function updateProcessExpression(
|
||||
data: BpmProcessExpressionApi.ProcessExpression,
|
||||
) {
|
||||
return requestClient.put<boolean>('/bpm/process-expression/update', data);
|
||||
}
|
||||
|
||||
/** 删除流程表达式 */
|
||||
export async function deleteProcessExpression(id: number) {
|
||||
return requestClient.delete<boolean>(
|
||||
`/bpm/process-expression/delete?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 导出流程表达式 */
|
||||
export async function exportProcessExpression(params: any) {
|
||||
return requestClient.download('/bpm/process-expression/export-excel', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
221
apps/web-antd/src/api/bpm/processInstance/index.ts
Normal file
221
apps/web-antd/src/api/bpm/processInstance/index.ts
Normal file
@@ -0,0 +1,221 @@
|
||||
import type {
|
||||
BpmCandidateStrategyEnum,
|
||||
BpmNodeTypeEnum,
|
||||
} from '@vben/constants';
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import type { BpmTaskApi } from '../task';
|
||||
|
||||
import type { BpmModelApi } from '#/api/bpm/model';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace BpmProcessInstanceApi {
|
||||
/** 流程实例 */
|
||||
export interface ProcessInstance {
|
||||
businessKey: string;
|
||||
category: string;
|
||||
categoryName?: string;
|
||||
createTime: string;
|
||||
endTime: string;
|
||||
fields: string[];
|
||||
formVariables: Record<string, any>;
|
||||
id: number;
|
||||
name: string;
|
||||
processDefinition?: BpmModelApi.ProcessDefinition;
|
||||
processDefinitionId: string;
|
||||
remark: string;
|
||||
result: number;
|
||||
startTime?: Date;
|
||||
startUser?: User;
|
||||
status: number;
|
||||
summary?: {
|
||||
key: string;
|
||||
value: string;
|
||||
}[];
|
||||
tasks?: BpmProcessInstanceApi.Task[];
|
||||
}
|
||||
|
||||
/** 流程实例的任务 */
|
||||
export interface Task {
|
||||
id: number;
|
||||
name: string;
|
||||
assigneeUser?: User;
|
||||
}
|
||||
|
||||
/** 流程实例的用户信息 */
|
||||
export interface User {
|
||||
id: number;
|
||||
nickname: string;
|
||||
avatar: string;
|
||||
deptName?: string;
|
||||
}
|
||||
|
||||
/** 审批详情 */
|
||||
export interface ApprovalDetailRespVO {
|
||||
activityNodes: BpmProcessInstanceApi.ApprovalNodeInfo[];
|
||||
formFieldsPermission: any;
|
||||
processDefinition: BpmModelApi.ProcessDefinition;
|
||||
processInstance: BpmProcessInstanceApi.ProcessInstance;
|
||||
status: number;
|
||||
todoTask: BpmTaskApi.Task;
|
||||
}
|
||||
|
||||
/** 审批详情的节点信息 */
|
||||
export interface ApprovalNodeInfo {
|
||||
candidateStrategy?: BpmCandidateStrategyEnum;
|
||||
candidateUsers?: User[];
|
||||
endTime?: Date;
|
||||
id: string;
|
||||
name: string;
|
||||
nodeType: BpmNodeTypeEnum;
|
||||
startTime?: Date;
|
||||
status: number;
|
||||
processInstanceId?: string;
|
||||
tasks: ApprovalTaskInfo[];
|
||||
}
|
||||
|
||||
/** 审批详情的节点的任务 */
|
||||
export interface ApprovalTaskInfo {
|
||||
id: number;
|
||||
assigneeUser: User;
|
||||
ownerUser: User;
|
||||
reason: string;
|
||||
signPicUrl: string;
|
||||
status: number;
|
||||
}
|
||||
|
||||
/** 抄送流程实例 */
|
||||
export interface ProcessInstanceCopyRespVO {
|
||||
activityId: string;
|
||||
activityName: string;
|
||||
createTime: number;
|
||||
createUser: User;
|
||||
id: number;
|
||||
processInstanceId: string;
|
||||
processInstanceName: string;
|
||||
processInstanceStartTime: number;
|
||||
reason: string;
|
||||
startUser: User;
|
||||
summary: {
|
||||
key: string;
|
||||
value: string;
|
||||
}[];
|
||||
taskId: string;
|
||||
}
|
||||
|
||||
/** 流程实例的打印数据响应 */
|
||||
export interface ProcessPrintDataRespVO {
|
||||
printTemplateEnable: boolean;
|
||||
printTemplateHtml?: string;
|
||||
processInstance: ProcessInstance;
|
||||
tasks: {
|
||||
description: string;
|
||||
id: number;
|
||||
name: string;
|
||||
signPicUrl?: string;
|
||||
}[];
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询我的流程实例分页 */
|
||||
export async function getProcessInstanceMyPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<BpmProcessInstanceApi.ProcessInstance>>(
|
||||
'/bpm/process-instance/my-page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询管理员流程实例分页 */
|
||||
export async function getProcessInstanceManagerPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<BpmProcessInstanceApi.ProcessInstance>>(
|
||||
'/bpm/process-instance/manager-page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增流程实例 */
|
||||
export async function createProcessInstance(data: any) {
|
||||
return requestClient.post<BpmProcessInstanceApi.ProcessInstance>(
|
||||
'/bpm/process-instance/create',
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
/** 申请人主动取消流程实例 */
|
||||
export async function cancelProcessInstanceByStartUser(
|
||||
id: number,
|
||||
reason: string,
|
||||
) {
|
||||
return requestClient.delete<boolean>(
|
||||
'/bpm/process-instance/cancel-by-start-user',
|
||||
{
|
||||
data: { id, reason },
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** 管理员取消流程实例 */
|
||||
export async function cancelProcessInstanceByAdmin(id: number, reason: string) {
|
||||
return requestClient.delete<boolean>(
|
||||
'/bpm/process-instance/cancel-by-admin',
|
||||
{
|
||||
data: { id, reason },
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询流程实例详情 */
|
||||
export async function getProcessInstance(id: number) {
|
||||
return requestClient.get<BpmProcessInstanceApi.ProcessInstance>(
|
||||
`/bpm/process-instance/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询复制流程实例分页 */
|
||||
export async function getProcessInstanceCopyPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<BpmProcessInstanceApi.ProcessInstance>>(
|
||||
'/bpm/process-instance/copy/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 更新流程实例 */
|
||||
export async function updateProcessInstance(
|
||||
data: BpmProcessInstanceApi.ProcessInstance,
|
||||
) {
|
||||
return requestClient.put<BpmProcessInstanceApi.ProcessInstance>(
|
||||
'/bpm/process-instance/update',
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
/** 获取审批详情 */
|
||||
export async function getApprovalDetail(params: any) {
|
||||
return requestClient.get<BpmProcessInstanceApi.ApprovalDetailRespVO>(
|
||||
`/bpm/process-instance/get-approval-detail`,
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 获取下一个执行的流程节点 */
|
||||
export async function getNextApprovalNodes(params: any) {
|
||||
return requestClient.get<BpmProcessInstanceApi.ApprovalNodeInfo[]>(
|
||||
`/bpm/process-instance/get-next-approval-nodes`,
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 获取流程实例 BPMN 模型视图 */
|
||||
export async function getProcessInstanceBpmnModelView(id: string) {
|
||||
return requestClient.get<BpmProcessInstanceApi.ProcessInstance>(
|
||||
`/bpm/process-instance/get-bpmn-model-view?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 获取流程实例打印数据 */
|
||||
export async function getProcessInstancePrintData(id: string) {
|
||||
return requestClient.get<BpmProcessInstanceApi.ProcessPrintDataRespVO>(
|
||||
`/bpm/process-instance/get-print-data?processInstanceId=${id}`,
|
||||
);
|
||||
}
|
||||
50
apps/web-antd/src/api/bpm/processListener/index.ts
Normal file
50
apps/web-antd/src/api/bpm/processListener/index.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace BpmProcessListenerApi {
|
||||
/** 流程监听器 */
|
||||
export interface ProcessListener {
|
||||
id: number; // 编号
|
||||
name: string; // 监听器名字
|
||||
type: string; // 监听器类型
|
||||
status: number; // 监听器状态
|
||||
event: string; // 监听事件
|
||||
valueType: string; // 监听器值类型
|
||||
value: string; // 监听器值
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询流程监听器分页 */
|
||||
export async function getProcessListenerPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<BpmProcessListenerApi.ProcessListener>>(
|
||||
'/bpm/process-listener/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询流程监听器详情 */
|
||||
export async function getProcessListener(id: number) {
|
||||
return requestClient.get<BpmProcessListenerApi.ProcessListener>(
|
||||
`/bpm/process-listener/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增流程监听器 */
|
||||
export async function createProcessListener(
|
||||
data: BpmProcessListenerApi.ProcessListener,
|
||||
) {
|
||||
return requestClient.post<number>('/bpm/process-listener/create', data);
|
||||
}
|
||||
|
||||
/** 修改流程监听器 */
|
||||
export async function updateProcessListener(
|
||||
data: BpmProcessListenerApi.ProcessListener,
|
||||
) {
|
||||
return requestClient.put<boolean>('/bpm/process-listener/update', data);
|
||||
}
|
||||
|
||||
/** 删除流程监听器 */
|
||||
export async function deleteProcessListener(id: number) {
|
||||
return requestClient.delete<boolean>(`/bpm/process-listener/delete?id=${id}`);
|
||||
}
|
||||
106
apps/web-antd/src/api/bpm/task/index.ts
Normal file
106
apps/web-antd/src/api/bpm/task/index.ts
Normal file
@@ -0,0 +1,106 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import type { BpmProcessInstanceApi } from '../processInstance';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace BpmTaskApi {
|
||||
/** 流程任务 */
|
||||
export interface Task {
|
||||
id: number; // 编号
|
||||
name: string; // 监听器名字
|
||||
type: string; // 监听器类型
|
||||
status: number; // 监听器状态
|
||||
event: string; // 监听事件
|
||||
valueType: string; // 监听器值类型
|
||||
processInstance?: BpmProcessInstanceApi.ProcessInstance; // 流程实例
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询待办任务分页 */
|
||||
export async function getTaskTodoPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<BpmTaskApi.Task>>('/bpm/task/todo-page', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/** 查询已办任务分页 */
|
||||
export async function getTaskDonePage(params: PageParam) {
|
||||
return requestClient.get<PageResult<BpmTaskApi.Task>>('/bpm/task/done-page', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/** 查询任务管理分页 */
|
||||
export async function getTaskManagerPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<BpmTaskApi.Task>>(
|
||||
'/bpm/task/manager-page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 审批任务 */
|
||||
export const approveTask = async (data: any) => {
|
||||
return await requestClient.put('/bpm/task/approve', data);
|
||||
};
|
||||
|
||||
/** 驳回任务 */
|
||||
export const rejectTask = async (data: any) => {
|
||||
return await requestClient.put('/bpm/task/reject', data);
|
||||
};
|
||||
|
||||
/** 根据流程实例 ID 查询任务列表 */
|
||||
export const getTaskListByProcessInstanceId = async (id: string) => {
|
||||
return await requestClient.get(
|
||||
`/bpm/task/list-by-process-instance-id?processInstanceId=${id}`,
|
||||
);
|
||||
};
|
||||
|
||||
/** 获取所有可退回的节点 */
|
||||
export const getTaskListByReturn = async (id: string) => {
|
||||
return await requestClient.get(`/bpm/task/list-by-return?id=${id}`);
|
||||
};
|
||||
|
||||
/** 退回任务 */
|
||||
export const returnTask = async (data: any) => {
|
||||
return await requestClient.put('/bpm/task/return', data);
|
||||
};
|
||||
|
||||
/** 委派任务 */
|
||||
export const delegateTask = async (data: any) => {
|
||||
return await requestClient.put('/bpm/task/delegate', data);
|
||||
};
|
||||
|
||||
/** 转派任务 */
|
||||
export const transferTask = async (data: any) => {
|
||||
return await requestClient.put('/bpm/task/transfer', data);
|
||||
};
|
||||
|
||||
/** 加签任务 */
|
||||
export const signCreateTask = async (data: any) => {
|
||||
return await requestClient.put('/bpm/task/create-sign', data);
|
||||
};
|
||||
|
||||
/** 减签任务 */
|
||||
export const signDeleteTask = async (data: any) => {
|
||||
return await requestClient.delete('/bpm/task/delete-sign', data);
|
||||
};
|
||||
|
||||
/** 抄送任务 */
|
||||
export const copyTask = async (data: any) => {
|
||||
return await requestClient.put('/bpm/task/copy', data);
|
||||
};
|
||||
|
||||
/** 获取加签任务列表 */
|
||||
export const getChildrenTaskList = async (id: string) => {
|
||||
return await requestClient.get(
|
||||
`/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 },
|
||||
});
|
||||
};
|
||||
53
apps/web-antd/src/api/bpm/userGroup/index.ts
Normal file
53
apps/web-antd/src/api/bpm/userGroup/index.ts
Normal file
@@ -0,0 +1,53 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace BpmUserGroupApi {
|
||||
/** 用户组 */
|
||||
export interface UserGroup {
|
||||
id: number;
|
||||
name: string;
|
||||
description: string;
|
||||
userIds: number[];
|
||||
status: number;
|
||||
remark: string;
|
||||
createTime: string;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询用户组分页 */
|
||||
export async function getUserGroupPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<BpmUserGroupApi.UserGroup>>(
|
||||
'/bpm/user-group/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询用户组详情 */
|
||||
export async function getUserGroup(id: number) {
|
||||
return requestClient.get<BpmUserGroupApi.UserGroup>(
|
||||
`/bpm/user-group/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增用户组 */
|
||||
export async function createUserGroup(data: BpmUserGroupApi.UserGroup) {
|
||||
return requestClient.post<number>('/bpm/user-group/create', data);
|
||||
}
|
||||
|
||||
/** 修改用户组 */
|
||||
export async function updateUserGroup(data: BpmUserGroupApi.UserGroup) {
|
||||
return requestClient.put<boolean>('/bpm/user-group/update', data);
|
||||
}
|
||||
|
||||
/** 删除用户组 */
|
||||
export async function deleteUserGroup(id: number) {
|
||||
return requestClient.delete<boolean>(`/bpm/user-group/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 查询用户组列表 */
|
||||
export async function getUserGroupSimpleList() {
|
||||
return requestClient.get<BpmUserGroupApi.UserGroup[]>(
|
||||
`/bpm/user-group/simple-list`,
|
||||
);
|
||||
}
|
||||
161
apps/web-antd/src/api/core/auth.ts
Normal file
161
apps/web-antd/src/api/core/auth.ts
Normal file
@@ -0,0 +1,161 @@
|
||||
import type { AuthPermissionInfo } from '@vben/types';
|
||||
|
||||
import { baseRequestClient, requestClient } from '#/api/request';
|
||||
|
||||
export namespace AuthApi {
|
||||
/** 登录接口参数 */
|
||||
export interface LoginParams {
|
||||
password?: string;
|
||||
username?: string;
|
||||
captchaVerification?: string;
|
||||
// 绑定社交登录时,需要传递如下参数
|
||||
socialType?: number;
|
||||
socialCode?: string;
|
||||
socialState?: string;
|
||||
}
|
||||
|
||||
/** 登录接口返回值 */
|
||||
export interface LoginResult {
|
||||
accessToken: string;
|
||||
refreshToken: string;
|
||||
userId: number;
|
||||
expiresTime: number;
|
||||
}
|
||||
|
||||
/** 租户信息返回值 */
|
||||
export interface TenantResult {
|
||||
id: number;
|
||||
name: string;
|
||||
}
|
||||
|
||||
/** 手机验证码获取接口参数 */
|
||||
export interface SmsCodeParams {
|
||||
mobile: string;
|
||||
scene: number;
|
||||
}
|
||||
|
||||
/** 手机验证码登录接口参数 */
|
||||
export interface SmsLoginParams {
|
||||
mobile: string;
|
||||
code: string;
|
||||
}
|
||||
|
||||
/** 注册接口参数 */
|
||||
export interface RegisterParams {
|
||||
username: string;
|
||||
password: string;
|
||||
captchaVerification: string;
|
||||
}
|
||||
|
||||
/** 重置密码接口参数 */
|
||||
export interface ResetPasswordParams {
|
||||
password: string;
|
||||
mobile: string;
|
||||
code: string;
|
||||
}
|
||||
|
||||
/** 社交快捷登录接口参数 */
|
||||
export interface SocialLoginParams {
|
||||
type: number;
|
||||
code: string;
|
||||
state: string;
|
||||
}
|
||||
}
|
||||
|
||||
/** 登录 */
|
||||
export async function loginApi(data: AuthApi.LoginParams) {
|
||||
return requestClient.post<AuthApi.LoginResult>('/system/auth/login', data, {
|
||||
headers: {
|
||||
isEncrypt: false,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/** 刷新 accessToken */
|
||||
export async function refreshTokenApi(refreshToken: string) {
|
||||
return baseRequestClient.post(
|
||||
`/system/auth/refresh-token?refreshToken=${refreshToken}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 退出登录 */
|
||||
export async function logoutApi(accessToken: string) {
|
||||
return baseRequestClient.post(
|
||||
'/system/auth/logout',
|
||||
{},
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
},
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** 获取权限信息 */
|
||||
export async function getAuthPermissionInfoApi() {
|
||||
return requestClient.get<AuthPermissionInfo>(
|
||||
'/system/auth/get-permission-info',
|
||||
);
|
||||
}
|
||||
|
||||
/** 获取租户列表 */
|
||||
export async function getTenantSimpleList() {
|
||||
return requestClient.get<AuthApi.TenantResult[]>(
|
||||
`/system/tenant/simple-list`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 使用租户域名,获得租户信息 */
|
||||
export async function getTenantByWebsite(website: string) {
|
||||
return requestClient.get<AuthApi.TenantResult>(
|
||||
`/system/tenant/get-by-website?website=${website}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 获取验证码 */
|
||||
export async function getCaptcha(data: any) {
|
||||
return baseRequestClient.post('/system/captcha/get', data);
|
||||
}
|
||||
|
||||
/** 校验验证码 */
|
||||
export async function checkCaptcha(data: any) {
|
||||
return baseRequestClient.post('/system/captcha/check', data);
|
||||
}
|
||||
|
||||
/** 获取登录验证码 */
|
||||
export async function sendSmsCode(data: AuthApi.SmsCodeParams) {
|
||||
return requestClient.post('/system/auth/send-sms-code', data);
|
||||
}
|
||||
|
||||
/** 短信验证码登录 */
|
||||
export async function smsLogin(data: AuthApi.SmsLoginParams) {
|
||||
return requestClient.post('/system/auth/sms-login', data);
|
||||
}
|
||||
|
||||
/** 注册 */
|
||||
export async function register(data: AuthApi.RegisterParams) {
|
||||
return requestClient.post('/system/auth/register', data);
|
||||
}
|
||||
|
||||
/** 通过短信重置密码 */
|
||||
export async function smsResetPassword(data: AuthApi.ResetPasswordParams) {
|
||||
return requestClient.post('/system/auth/reset-password', data);
|
||||
}
|
||||
|
||||
/** 社交授权的跳转 */
|
||||
export async function socialAuthRedirect(type: number, redirectUri: string) {
|
||||
return requestClient.get('/system/auth/social-auth-redirect', {
|
||||
params: {
|
||||
type,
|
||||
redirectUri,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/** 社交快捷登录 */
|
||||
export async function socialLogin(data: AuthApi.SocialLoginParams) {
|
||||
return requestClient.post<AuthApi.LoginResult>(
|
||||
'/system/auth/social-login',
|
||||
data,
|
||||
);
|
||||
}
|
||||
128
apps/web-antd/src/api/crm/business/index.ts
Normal file
128
apps/web-antd/src/api/crm/business/index.ts
Normal file
@@ -0,0 +1,128 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import type { CrmPermissionApi } from '#/api/crm/permission';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CrmBusinessApi {
|
||||
/** 商机信息 */
|
||||
export interface Business {
|
||||
id: number;
|
||||
name: string;
|
||||
customerId: number;
|
||||
customerName?: string;
|
||||
followUpStatus: boolean;
|
||||
contactLastTime: Date;
|
||||
contactNextTime: Date;
|
||||
ownerUserId: number;
|
||||
ownerUserName?: string; // 负责人的用户名称
|
||||
ownerUserDept?: string; // 负责人的部门名称
|
||||
statusTypeId: number;
|
||||
statusTypeName?: string;
|
||||
statusId: number;
|
||||
statusName?: string;
|
||||
endStatus: number;
|
||||
endRemark: string;
|
||||
dealTime: Date;
|
||||
totalProductPrice: number;
|
||||
totalPrice: number;
|
||||
discountPercent: number;
|
||||
status?: number;
|
||||
remark: string;
|
||||
creator: string; // 创建人
|
||||
creatorName?: string; // 创建人名称
|
||||
createTime: Date; // 创建时间
|
||||
updateTime: Date; // 更新时间
|
||||
products?: BusinessProduct[];
|
||||
}
|
||||
|
||||
/** 商机产品信息 */
|
||||
export interface BusinessProduct {
|
||||
id: number;
|
||||
productId: number;
|
||||
productName: string;
|
||||
productNo: string;
|
||||
productUnit: number;
|
||||
productPrice: number;
|
||||
businessPrice: number;
|
||||
count: number;
|
||||
totalPrice: number;
|
||||
}
|
||||
|
||||
/** 商机更新状态请求 */
|
||||
export interface BusinessUpdateStatusReqVO {
|
||||
id: number;
|
||||
statusId: number | undefined;
|
||||
endStatus: number | undefined;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询商机列表 */
|
||||
export function getBusinessPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<CrmBusinessApi.Business>>(
|
||||
'/crm/business/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询商机列表,基于指定客户 */
|
||||
export function getBusinessPageByCustomer(params: PageParam) {
|
||||
return requestClient.get<PageResult<CrmBusinessApi.Business>>(
|
||||
'/crm/business/page-by-customer',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询商机详情 */
|
||||
export function getBusiness(id: number) {
|
||||
return requestClient.get<CrmBusinessApi.Business>(
|
||||
`/crm/business/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 获得商机列表(精简) */
|
||||
export function getSimpleBusinessList() {
|
||||
return requestClient.get<CrmBusinessApi.Business[]>(
|
||||
'/crm/business/simple-all-list',
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增商机 */
|
||||
export function createBusiness(data: CrmBusinessApi.Business) {
|
||||
return requestClient.post('/crm/business/create', data);
|
||||
}
|
||||
|
||||
/** 修改商机 */
|
||||
export function updateBusiness(data: CrmBusinessApi.Business) {
|
||||
return requestClient.put('/crm/business/update', data);
|
||||
}
|
||||
|
||||
/** 修改商机状态 */
|
||||
export function updateBusinessStatus(
|
||||
data: CrmBusinessApi.BusinessUpdateStatusReqVO,
|
||||
) {
|
||||
return requestClient.put('/crm/business/update-status', data);
|
||||
}
|
||||
|
||||
/** 删除商机 */
|
||||
export function deleteBusiness(id: number) {
|
||||
return requestClient.delete(`/crm/business/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 导出商机 */
|
||||
export function exportBusiness(params: any) {
|
||||
return requestClient.download('/crm/business/export-excel', { params });
|
||||
}
|
||||
|
||||
/** 联系人关联商机列表 */
|
||||
export function getBusinessPageByContact(params: PageParam) {
|
||||
return requestClient.get<PageResult<CrmBusinessApi.Business>>(
|
||||
'/crm/business/page-by-contact',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 商机转移 */
|
||||
export function transferBusiness(data: CrmPermissionApi.BusinessTransferReqVO) {
|
||||
return requestClient.put('/crm/business/transfer', data);
|
||||
}
|
||||
95
apps/web-antd/src/api/crm/business/status/index.ts
Normal file
95
apps/web-antd/src/api/crm/business/status/index.ts
Normal file
@@ -0,0 +1,95 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CrmBusinessStatusApi {
|
||||
/** 商机状态组信息 */
|
||||
export interface BusinessStatus {
|
||||
id?: number;
|
||||
name: string;
|
||||
deptIds?: number[];
|
||||
deptNames?: string[];
|
||||
creator?: string;
|
||||
createTime?: Date;
|
||||
statuses?: BusinessStatusType[];
|
||||
}
|
||||
|
||||
/** 商机状态信息 */
|
||||
export interface BusinessStatusType {
|
||||
id?: number;
|
||||
name: string;
|
||||
percent: number;
|
||||
[x: string]: any;
|
||||
}
|
||||
}
|
||||
|
||||
/** 默认商机状态 */
|
||||
export const DEFAULT_STATUSES = [
|
||||
{
|
||||
endStatus: 1,
|
||||
key: '结束',
|
||||
name: '赢单',
|
||||
percent: 100,
|
||||
},
|
||||
{
|
||||
endStatus: 2,
|
||||
key: '结束',
|
||||
name: '输单',
|
||||
percent: 0,
|
||||
},
|
||||
{
|
||||
endStatus: 3,
|
||||
key: '结束',
|
||||
name: '无效',
|
||||
percent: 0,
|
||||
},
|
||||
];
|
||||
|
||||
/** 查询商机状态组列表 */
|
||||
export function getBusinessStatusPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<CrmBusinessStatusApi.BusinessStatus>>(
|
||||
'/crm/business-status/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增商机状态组 */
|
||||
export function createBusinessStatus(
|
||||
data: CrmBusinessStatusApi.BusinessStatus,
|
||||
) {
|
||||
return requestClient.post('/crm/business-status/create', data);
|
||||
}
|
||||
|
||||
/** 修改商机状态组 */
|
||||
export function updateBusinessStatus(
|
||||
data: CrmBusinessStatusApi.BusinessStatus,
|
||||
) {
|
||||
return requestClient.put('/crm/business-status/update', data);
|
||||
}
|
||||
|
||||
/** 查询商机状态类型详情 */
|
||||
export function getBusinessStatus(id: number) {
|
||||
return requestClient.get<CrmBusinessStatusApi.BusinessStatus>(
|
||||
`/crm/business-status/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 删除商机状态 */
|
||||
export function deleteBusinessStatus(id: number) {
|
||||
return requestClient.delete(`/crm/business-status/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 获得商机状态组列表 */
|
||||
export function getBusinessStatusTypeSimpleList() {
|
||||
return requestClient.get<CrmBusinessStatusApi.BusinessStatus[]>(
|
||||
'/crm/business-status/type-simple-list',
|
||||
);
|
||||
}
|
||||
|
||||
/** 获得商机阶段列表 */
|
||||
export function getBusinessStatusSimpleList(typeId: number) {
|
||||
return requestClient.get<CrmBusinessStatusApi.BusinessStatusType[]>(
|
||||
'/crm/business-status/status-simple-list',
|
||||
{ params: { typeId } },
|
||||
);
|
||||
}
|
||||
86
apps/web-antd/src/api/crm/clue/index.ts
Normal file
86
apps/web-antd/src/api/crm/clue/index.ts
Normal file
@@ -0,0 +1,86 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import type { CrmPermissionApi } from '#/api/crm/permission';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CrmClueApi {
|
||||
/** 线索信息 */
|
||||
export interface Clue {
|
||||
id: number; // 编号
|
||||
name: string; // 线索名称
|
||||
followUpStatus: boolean; // 跟进状态
|
||||
contactLastTime: Date; // 最后跟进时间
|
||||
contactLastContent: string; // 最后跟进内容
|
||||
contactNextTime: Date; // 下次联系时间
|
||||
ownerUserId: number; // 负责人的用户编号
|
||||
ownerUserName?: string; // 负责人的用户名称
|
||||
ownerUserDept?: string; // 负责人的部门名称
|
||||
transformStatus: boolean; // 转化状态
|
||||
customerId: number; // 客户编号
|
||||
customerName?: string; // 客户名称
|
||||
mobile: string; // 手机号
|
||||
telephone: string; // 电话
|
||||
qq: string; // QQ
|
||||
wechat: string; // wechat
|
||||
email: string; // email
|
||||
areaId: number; // 所在地
|
||||
areaName?: string; // 所在地名称
|
||||
detailAddress: string; // 详细地址
|
||||
industryId: number; // 所属行业
|
||||
level: number; // 客户等级
|
||||
source: number; // 客户来源
|
||||
remark: string; // 备注
|
||||
creator: string; // 创建人
|
||||
creatorName?: string; // 创建人名称
|
||||
createTime: Date; // 创建时间
|
||||
updateTime: Date; // 更新时间
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询线索列表 */
|
||||
export function getCluePage(params: PageParam) {
|
||||
return requestClient.get<PageResult<CrmClueApi.Clue>>('/crm/clue/page', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/** 查询线索详情 */
|
||||
export function getClue(id: number) {
|
||||
return requestClient.get<CrmClueApi.Clue>(`/crm/clue/get?id=${id}`);
|
||||
}
|
||||
|
||||
/** 新增线索 */
|
||||
export function createClue(data: CrmClueApi.Clue) {
|
||||
return requestClient.post('/crm/clue/create', data);
|
||||
}
|
||||
|
||||
/** 修改线索 */
|
||||
export function updateClue(data: CrmClueApi.Clue) {
|
||||
return requestClient.put('/crm/clue/update', data);
|
||||
}
|
||||
|
||||
/** 删除线索 */
|
||||
export function deleteClue(id: number) {
|
||||
return requestClient.delete(`/crm/clue/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 导出线索 */
|
||||
export function exportClue(params: any) {
|
||||
return requestClient.download('/crm/clue/export-excel', { params });
|
||||
}
|
||||
|
||||
/** 线索转移 */
|
||||
export function transferClue(data: CrmPermissionApi.BusinessTransferReqVO) {
|
||||
return requestClient.put('/crm/clue/transfer', data);
|
||||
}
|
||||
|
||||
/** 线索转化为客户 */
|
||||
export function transformClue(id: number) {
|
||||
return requestClient.put(`/crm/clue/transform?id=${id}`);
|
||||
}
|
||||
|
||||
/** 获得分配给我的、待跟进的线索数量 */
|
||||
export function getFollowClueCount() {
|
||||
return requestClient.get<number>('/crm/clue/follow-count');
|
||||
}
|
||||
140
apps/web-antd/src/api/crm/contact/index.ts
Normal file
140
apps/web-antd/src/api/crm/contact/index.ts
Normal file
@@ -0,0 +1,140 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import type { CrmPermissionApi } from '#/api/crm/permission';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CrmContactApi {
|
||||
/** 联系人信息 */
|
||||
export interface Contact {
|
||||
id: number; // 编号
|
||||
name: string; // 联系人名称
|
||||
customerId: number; // 客户编号
|
||||
customerName?: string; // 客户名称
|
||||
contactLastTime: Date; // 最后跟进时间
|
||||
contactLastContent: string; // 最后跟进内容
|
||||
contactNextTime: Date; // 下次联系时间
|
||||
ownerUserId: number; // 负责人的用户编号
|
||||
ownerUserName?: string; // 负责人的用户名称
|
||||
ownerUserDept?: string; // 负责人的部门名称
|
||||
mobile: string; // 手机号
|
||||
telephone: string; // 电话
|
||||
qq: string; // QQ
|
||||
wechat: string; // wechat
|
||||
email: string; // email
|
||||
areaId: number; // 所在地
|
||||
areaName?: string; // 所在地名称
|
||||
detailAddress: string; // 详细地址
|
||||
sex: number; // 性别
|
||||
master: boolean; // 是否主联系人
|
||||
post: string; // 职务
|
||||
parentId: number; // 上级联系人编号
|
||||
parentName?: string; // 上级联系人名称
|
||||
remark: string; // 备注
|
||||
creator: string; // 创建人
|
||||
creatorName?: string; // 创建人名称
|
||||
createTime: Date; // 创建时间
|
||||
updateTime: Date; // 更新时间
|
||||
}
|
||||
|
||||
/** 联系人商机关联请求 */
|
||||
export interface ContactBusinessReqVO {
|
||||
contactId: number;
|
||||
businessIds: number[];
|
||||
}
|
||||
|
||||
/** 商机联系人关联请求 */
|
||||
export interface BusinessContactReqVO {
|
||||
businessId: number;
|
||||
contactIds: number[];
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询联系人列表 */
|
||||
export function getContactPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<CrmContactApi.Contact>>(
|
||||
'/crm/contact/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询联系人列表,基于指定客户 */
|
||||
export function getContactPageByCustomer(params: PageParam) {
|
||||
return requestClient.get<PageResult<CrmContactApi.Contact>>(
|
||||
'/crm/contact/page-by-customer',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询联系人列表,基于指定商机 */
|
||||
export function getContactPageByBusiness(params: PageParam) {
|
||||
return requestClient.get<PageResult<CrmContactApi.Contact>>(
|
||||
'/crm/contact/page-by-business',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询联系人详情 */
|
||||
export function getContact(id: number) {
|
||||
return requestClient.get<CrmContactApi.Contact>(`/crm/contact/get?id=${id}`);
|
||||
}
|
||||
|
||||
/** 新增联系人 */
|
||||
export function createContact(data: CrmContactApi.Contact) {
|
||||
return requestClient.post('/crm/contact/create', data);
|
||||
}
|
||||
|
||||
/** 修改联系人 */
|
||||
export function updateContact(data: CrmContactApi.Contact) {
|
||||
return requestClient.put('/crm/contact/update', data);
|
||||
}
|
||||
|
||||
/** 删除联系人 */
|
||||
export function deleteContact(id: number) {
|
||||
return requestClient.delete(`/crm/contact/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 导出联系人 */
|
||||
export function exportContact(params: any) {
|
||||
return requestClient.download('/crm/contact/export-excel', { params });
|
||||
}
|
||||
|
||||
/** 获得联系人列表(精简) */
|
||||
export function getSimpleContactList() {
|
||||
return requestClient.get<CrmContactApi.Contact[]>(
|
||||
'/crm/contact/simple-all-list',
|
||||
);
|
||||
}
|
||||
|
||||
/** 批量新增联系人商机关联 */
|
||||
export function createContactBusinessList(
|
||||
data: CrmContactApi.ContactBusinessReqVO,
|
||||
) {
|
||||
return requestClient.post('/crm/contact/create-business-list', data);
|
||||
}
|
||||
|
||||
/** 批量新增商机联系人关联 */
|
||||
export function createBusinessContactList(
|
||||
data: CrmContactApi.BusinessContactReqVO,
|
||||
) {
|
||||
return requestClient.post('/crm/contact/create-business-list2', data);
|
||||
}
|
||||
|
||||
/** 解除联系人商机关联 */
|
||||
export function deleteContactBusinessList(
|
||||
data: CrmContactApi.ContactBusinessReqVO,
|
||||
) {
|
||||
return requestClient.delete('/crm/contact/delete-business-list', { data });
|
||||
}
|
||||
|
||||
/** 解除商机联系人关联 */
|
||||
export function deleteBusinessContactList(
|
||||
data: CrmContactApi.BusinessContactReqVO,
|
||||
) {
|
||||
return requestClient.delete('/crm/contact/delete-business-list2', { data });
|
||||
}
|
||||
|
||||
/** 联系人转移 */
|
||||
export function transferContact(data: CrmPermissionApi.BusinessTransferReqVO) {
|
||||
return requestClient.put('/crm/contact/transfer', data);
|
||||
}
|
||||
133
apps/web-antd/src/api/crm/contract/index.ts
Normal file
133
apps/web-antd/src/api/crm/contract/index.ts
Normal file
@@ -0,0 +1,133 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import type { CrmPermissionApi } from '#/api/crm/permission';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CrmContractApi {
|
||||
/** 合同信息 */
|
||||
export interface Contract {
|
||||
id: number;
|
||||
name: string;
|
||||
no: string;
|
||||
customerId: number;
|
||||
customerName?: string;
|
||||
businessId: number;
|
||||
businessName: string;
|
||||
contactLastTime: Date;
|
||||
ownerUserId: number;
|
||||
ownerUserName?: string;
|
||||
ownerUserDeptName?: string;
|
||||
processInstanceId: number;
|
||||
auditStatus: number;
|
||||
orderDate: Date;
|
||||
startTime: Date;
|
||||
endTime: Date;
|
||||
totalProductPrice: number;
|
||||
discountPercent: number;
|
||||
totalPrice: number;
|
||||
totalReceivablePrice: number;
|
||||
signContactId: number;
|
||||
signContactName?: string;
|
||||
signUserId: number;
|
||||
signUserName: string;
|
||||
remark: string;
|
||||
createTime?: Date;
|
||||
creator: string;
|
||||
creatorName: string;
|
||||
updateTime?: Date;
|
||||
products?: ContractProduct[];
|
||||
contactName?: string;
|
||||
}
|
||||
|
||||
/** 合同产品信息 */
|
||||
export interface ContractProduct {
|
||||
id: number;
|
||||
productId: number;
|
||||
productName: string;
|
||||
productNo: string;
|
||||
productUnit: number;
|
||||
productPrice: number;
|
||||
contractPrice: number;
|
||||
count: number;
|
||||
totalPrice: number;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询合同列表 */
|
||||
export function getContractPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<CrmContractApi.Contract>>(
|
||||
'/crm/contract/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询合同列表,基于指定客户 */
|
||||
export function getContractPageByCustomer(params: PageParam) {
|
||||
return requestClient.get<PageResult<CrmContractApi.Contract>>(
|
||||
'/crm/contract/page-by-customer',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询合同列表,基于指定商机 */
|
||||
export function getContractPageByBusiness(params: PageParam) {
|
||||
return requestClient.get<PageResult<CrmContractApi.Contract>>(
|
||||
'/crm/contract/page-by-business',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询合同详情 */
|
||||
export function getContract(id: number) {
|
||||
return requestClient.get<CrmContractApi.Contract>(
|
||||
`/crm/contract/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询合同下拉列表 */
|
||||
export function getContractSimpleList(customerId: number) {
|
||||
return requestClient.get<CrmContractApi.Contract[]>(
|
||||
`/crm/contract/simple-list?customerId=${customerId}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增合同 */
|
||||
export function createContract(data: CrmContractApi.Contract) {
|
||||
return requestClient.post('/crm/contract/create', data);
|
||||
}
|
||||
|
||||
/** 修改合同 */
|
||||
export function updateContract(data: CrmContractApi.Contract) {
|
||||
return requestClient.put('/crm/contract/update', data);
|
||||
}
|
||||
|
||||
/** 删除合同 */
|
||||
export function deleteContract(id: number) {
|
||||
return requestClient.delete(`/crm/contract/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 导出合同 */
|
||||
export function exportContract(params: any) {
|
||||
return requestClient.download('/crm/contract/export-excel', { params });
|
||||
}
|
||||
|
||||
/** 提交审核 */
|
||||
export function submitContract(id: number) {
|
||||
return requestClient.put(`/crm/contract/submit?id=${id}`);
|
||||
}
|
||||
|
||||
/** 合同转移 */
|
||||
export function transferContract(data: CrmPermissionApi.BusinessTransferReqVO) {
|
||||
return requestClient.put('/crm/contract/transfer', data);
|
||||
}
|
||||
|
||||
/** 获得待审核合同数量 */
|
||||
export function getAuditContractCount() {
|
||||
return requestClient.get<number>('/crm/contract/audit-count');
|
||||
}
|
||||
|
||||
/** 获得即将到期(提醒)的合同数量 */
|
||||
export function getRemindContractCount() {
|
||||
return requestClient.get<number>('/crm/contract/remind-count');
|
||||
}
|
||||
154
apps/web-antd/src/api/crm/customer/index.ts
Normal file
154
apps/web-antd/src/api/crm/customer/index.ts
Normal file
@@ -0,0 +1,154 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import type { CrmPermissionApi } from '#/api/crm/permission';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CrmCustomerApi {
|
||||
/** 客户信息 */
|
||||
export interface Customer {
|
||||
id: number; // 编号
|
||||
name: string; // 客户名称
|
||||
followUpStatus: boolean; // 跟进状态
|
||||
contactLastTime: Date; // 最后跟进时间
|
||||
contactLastContent: string; // 最后跟进内容
|
||||
contactNextTime: Date; // 下次联系时间
|
||||
ownerUserId: number; // 负责人的用户编号
|
||||
ownerUserName?: string; // 负责人的用户名称
|
||||
ownerUserDept?: string; // 负责人的部门名称
|
||||
ownerUserDeptName?: string; // 负责人的部门名称
|
||||
lockStatus?: boolean;
|
||||
dealStatus?: boolean;
|
||||
mobile: string; // 手机号
|
||||
telephone: string; // 电话
|
||||
qq: string; // QQ
|
||||
wechat: string; // wechat
|
||||
email: string; // email
|
||||
areaId: number; // 所在地
|
||||
areaName?: string; // 所在地名称
|
||||
detailAddress: string; // 详细地址
|
||||
industryId: number; // 所属行业
|
||||
level: number; // 客户等级
|
||||
source: number; // 客户来源
|
||||
remark: string; // 备注
|
||||
creator: string; // 创建人
|
||||
creatorName?: string; // 创建人名称
|
||||
createTime: Date; // 创建时间
|
||||
updateTime: Date; // 更新时间
|
||||
poolDay?: number; // 距离进入公海天数
|
||||
}
|
||||
|
||||
/** 客户导入请求 */
|
||||
export interface CustomerImportReqVO {
|
||||
ownerUserId: number;
|
||||
file: File;
|
||||
updateSupport: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询客户列表 */
|
||||
export function getCustomerPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<CrmCustomerApi.Customer>>(
|
||||
'/crm/customer/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询客户详情 */
|
||||
export function getCustomer(id: number) {
|
||||
return requestClient.get<CrmCustomerApi.Customer>(
|
||||
`/crm/customer/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增客户 */
|
||||
export function createCustomer(data: CrmCustomerApi.Customer) {
|
||||
return requestClient.post('/crm/customer/create', data);
|
||||
}
|
||||
|
||||
/** 修改客户 */
|
||||
export function updateCustomer(data: CrmCustomerApi.Customer) {
|
||||
return requestClient.put('/crm/customer/update', data);
|
||||
}
|
||||
|
||||
/** 删除客户 */
|
||||
export function deleteCustomer(id: number) {
|
||||
return requestClient.delete(`/crm/customer/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 导出客户 */
|
||||
export function exportCustomer(params: any) {
|
||||
return requestClient.download('/crm/customer/export-excel', { params });
|
||||
}
|
||||
|
||||
/** 下载客户导入模板 */
|
||||
export function importCustomerTemplate() {
|
||||
return requestClient.download('/crm/customer/get-import-template');
|
||||
}
|
||||
|
||||
/** 导入客户 */
|
||||
export function importCustomer(data: CrmCustomerApi.CustomerImportReqVO) {
|
||||
return requestClient.upload('/crm/customer/import', data);
|
||||
}
|
||||
|
||||
/** 获取客户精简信息列表 */
|
||||
export function getCustomerSimpleList() {
|
||||
return requestClient.get<CrmCustomerApi.Customer[]>(
|
||||
'/crm/customer/simple-list',
|
||||
);
|
||||
}
|
||||
|
||||
/** 客户转移 */
|
||||
export function transferCustomer(data: CrmPermissionApi.BusinessTransferReqVO) {
|
||||
return requestClient.put('/crm/customer/transfer', data);
|
||||
}
|
||||
|
||||
/** 锁定/解锁客户 */
|
||||
export function lockCustomer(id: number, lockStatus: boolean) {
|
||||
return requestClient.put('/crm/customer/lock', { id, lockStatus });
|
||||
}
|
||||
|
||||
/** 领取公海客户 */
|
||||
export function receiveCustomer(ids: number[]) {
|
||||
return requestClient.put('/crm/customer/receive', { ids: ids.join(',') });
|
||||
}
|
||||
|
||||
/** 分配公海给对应负责人 */
|
||||
export function distributeCustomer(ids: number[], ownerUserId: number) {
|
||||
return requestClient.put('/crm/customer/distribute', { ids, ownerUserId });
|
||||
}
|
||||
|
||||
/** 客户放入公海 */
|
||||
export function putCustomerPool(id: number) {
|
||||
return requestClient.put(`/crm/customer/put-pool?id=${id}`);
|
||||
}
|
||||
|
||||
/** 更新客户的成交状态 */
|
||||
export function updateCustomerDealStatus(id: number, dealStatus: boolean) {
|
||||
return requestClient.put(
|
||||
`/crm/customer/update-deal-status?id=${id}&dealStatus=${dealStatus}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 进入公海客户提醒的客户列表 */
|
||||
export function getPutPoolRemindCustomerPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<CrmCustomerApi.Customer>>(
|
||||
'/crm/customer/put-pool-remind-page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 获得待进入公海客户数量 */
|
||||
export function getPutPoolRemindCustomerCount() {
|
||||
return requestClient.get<number>('/crm/customer/put-pool-remind-count');
|
||||
}
|
||||
|
||||
/** 获得今日需联系客户数量 */
|
||||
export function getTodayContactCustomerCount() {
|
||||
return requestClient.get<number>('/crm/customer/today-contact-count');
|
||||
}
|
||||
|
||||
/** 获得分配给我、待跟进的线索数量的客户数量 */
|
||||
export function getFollowCustomerCount() {
|
||||
return requestClient.get<number>('/crm/customer/follow-count');
|
||||
}
|
||||
53
apps/web-antd/src/api/crm/followup/index.ts
Normal file
53
apps/web-antd/src/api/crm/followup/index.ts
Normal file
@@ -0,0 +1,53 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CrmFollowUpApi {
|
||||
/** 跟进记录信息 */
|
||||
export interface FollowUpRecord {
|
||||
id: number; // 编号
|
||||
bizType: number; // 数据类型
|
||||
bizId: number; // 数据编号
|
||||
type: number; // 跟进类型
|
||||
content: string; // 跟进内容
|
||||
picUrls: string[]; // 图片
|
||||
fileUrls: string[]; // 附件
|
||||
nextTime: Date; // 下次联系时间
|
||||
businessIds: number[]; // 关联的商机编号数组
|
||||
businesses: Business[]; // 关联的商机数组
|
||||
contactIds: number[]; // 关联的联系人编号数组
|
||||
contacts: Contact[]; // 关联的联系人数组
|
||||
creator: string;
|
||||
creatorName?: string;
|
||||
}
|
||||
|
||||
/** 关联商机信息 */
|
||||
export interface Business {
|
||||
id: number;
|
||||
name: string;
|
||||
}
|
||||
|
||||
/** 关联联系人信息 */
|
||||
export interface Contact {
|
||||
id: number;
|
||||
name: string;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询跟进记录分页 */
|
||||
export function getFollowUpRecordPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<CrmFollowUpApi.FollowUpRecord>>(
|
||||
'/crm/follow-up-record/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增跟进记录 */
|
||||
export function createFollowUpRecord(data: CrmFollowUpApi.FollowUpRecord) {
|
||||
return requestClient.post('/crm/follow-up-record/create', data);
|
||||
}
|
||||
|
||||
/** 删除跟进记录 */
|
||||
export function deleteFollowUpRecord(id: number) {
|
||||
return requestClient.delete(`/crm/follow-up-record/delete?id=${id}`);
|
||||
}
|
||||
35
apps/web-antd/src/api/crm/operateLog/index.ts
Normal file
35
apps/web-antd/src/api/crm/operateLog/index.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import type { PageResult } from '@vben/request';
|
||||
|
||||
import type { SystemOperateLogApi } from '#/api/system/operate-log';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CrmOperateLogApi {
|
||||
/** 操作日志信息 */
|
||||
export interface OperateLog {
|
||||
id: number;
|
||||
bizType: number;
|
||||
bizId: number;
|
||||
type: number;
|
||||
content: string;
|
||||
creator: string;
|
||||
creatorName?: string;
|
||||
createTime: Date;
|
||||
}
|
||||
|
||||
/** 操作日志查询请求 */
|
||||
export interface OperateLogQueryReqVO {
|
||||
bizType: number;
|
||||
bizId: number;
|
||||
}
|
||||
}
|
||||
|
||||
/** 获得操作日志 */
|
||||
export function getOperateLogPage(
|
||||
params: CrmOperateLogApi.OperateLogQueryReqVO,
|
||||
) {
|
||||
return requestClient.get<PageResult<SystemOperateLogApi.OperateLog>>(
|
||||
'/crm/operate-log/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
85
apps/web-antd/src/api/crm/permission/index.ts
Normal file
85
apps/web-antd/src/api/crm/permission/index.ts
Normal file
@@ -0,0 +1,85 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CrmPermissionApi {
|
||||
/** 数据权限信息 */
|
||||
export interface Permission {
|
||||
id?: number; // 数据权限编号
|
||||
ids?: number[];
|
||||
userId?: number; // 用户编号
|
||||
bizType: number; // Crm 类型
|
||||
bizId: number; // Crm 类型数据编号
|
||||
level: number; // 权限级别
|
||||
toBizTypes?: number[]; // 同时添加至
|
||||
deptName?: string; // 部门名称
|
||||
nickname?: string; // 用户昵称
|
||||
postNames?: string[]; // 岗位名称数组
|
||||
createTime?: Date;
|
||||
}
|
||||
|
||||
/** 数据权限转移请求 */
|
||||
export interface BusinessTransferReqVO {
|
||||
id: number; // 模块编号
|
||||
newOwnerUserId: number; // 新负责人的用户编号
|
||||
oldOwnerPermissionLevel?: number; // 老负责人加入团队后的权限级别
|
||||
toBizTypes?: number[]; // 转移客户时,需要额外有【联系人】【商机】【合同】的 checkbox 选择
|
||||
}
|
||||
|
||||
/** 权限列表请求 */
|
||||
export interface PermissionListReqVO {
|
||||
bizId: number; // 模块数据编号
|
||||
bizType: number; // 模块类型
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* CRM 业务类型枚举
|
||||
*/
|
||||
export enum BizTypeEnum {
|
||||
CRM_BUSINESS = 4, // 商机
|
||||
CRM_CLUE = 1, // 线索
|
||||
CRM_CONTACT = 3, // 联系人
|
||||
CRM_CONTRACT = 5, // 合同
|
||||
CRM_CUSTOMER = 2, // 客户
|
||||
CRM_PRODUCT = 6, // 产品
|
||||
CRM_RECEIVABLE = 7, // 回款
|
||||
CRM_RECEIVABLE_PLAN = 8, // 回款计划
|
||||
}
|
||||
|
||||
/**
|
||||
* CRM 数据权限级别枚举
|
||||
*/
|
||||
export enum PermissionLevelEnum {
|
||||
OWNER = 1, // 负责人
|
||||
READ = 2, // 只读
|
||||
WRITE = 3, // 读写
|
||||
}
|
||||
|
||||
/** 获得数据权限列表(查询团队成员列表) */
|
||||
export function getPermissionList(
|
||||
params: CrmPermissionApi.PermissionListReqVO,
|
||||
) {
|
||||
return requestClient.get<CrmPermissionApi.Permission[]>(
|
||||
'/crm/permission/list',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 创建数据权限(新增团队成员) */
|
||||
export function createPermission(data: CrmPermissionApi.Permission) {
|
||||
return requestClient.post('/crm/permission/create', data);
|
||||
}
|
||||
|
||||
/** 编辑数据权限(修改团队成员权限级别) */
|
||||
export function updatePermission(data: CrmPermissionApi.Permission) {
|
||||
return requestClient.put('/crm/permission/update', data);
|
||||
}
|
||||
|
||||
/** 删除数据权限(删除团队成员) */
|
||||
export function deletePermissionBatch(ids: number[]) {
|
||||
return requestClient.delete(`/crm/permission/delete?ids=${ids.join(',')}`);
|
||||
}
|
||||
|
||||
/** 删除自己的数据权限(退出团队) */
|
||||
export function deleteSelfPermission(id: number) {
|
||||
return requestClient.delete(`/crm/permission/delete-self?id=${id}`);
|
||||
}
|
||||
57
apps/web-antd/src/api/crm/product/index.ts
Normal file
57
apps/web-antd/src/api/crm/product/index.ts
Normal file
@@ -0,0 +1,57 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CrmProductApi {
|
||||
/** 产品信息 */
|
||||
export interface Product {
|
||||
id: number;
|
||||
name: string;
|
||||
no: string;
|
||||
unit: number;
|
||||
price: number;
|
||||
status: number;
|
||||
categoryId: number;
|
||||
categoryName?: string;
|
||||
description: string;
|
||||
ownerUserId: number;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询产品列表 */
|
||||
export function getProductPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<CrmProductApi.Product>>(
|
||||
'/crm/product/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 获得产品精简列表 */
|
||||
export function getProductSimpleList() {
|
||||
return requestClient.get<CrmProductApi.Product[]>('/crm/product/simple-list');
|
||||
}
|
||||
|
||||
/** 查询产品详情 */
|
||||
export function getProduct(id: number) {
|
||||
return requestClient.get<CrmProductApi.Product>(`/crm/product/get?id=${id}`);
|
||||
}
|
||||
|
||||
/** 新增产品 */
|
||||
export function createProduct(data: CrmProductApi.Product) {
|
||||
return requestClient.post('/crm/product/create', data);
|
||||
}
|
||||
|
||||
/** 修改产品 */
|
||||
export function updateProduct(data: CrmProductApi.Product) {
|
||||
return requestClient.put('/crm/product/update', data);
|
||||
}
|
||||
|
||||
/** 删除产品 */
|
||||
export function deleteProduct(id: number) {
|
||||
return requestClient.delete(`/crm/product/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 导出产品 */
|
||||
export function exportProduct(params: any) {
|
||||
return requestClient.download('/crm/product/export-excel', { params });
|
||||
}
|
||||
90
apps/web-antd/src/api/crm/receivable/index.ts
Normal file
90
apps/web-antd/src/api/crm/receivable/index.ts
Normal file
@@ -0,0 +1,90 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CrmReceivableApi {
|
||||
/** 回款信息 */
|
||||
export interface Receivable {
|
||||
id: number;
|
||||
no: string;
|
||||
planId?: number;
|
||||
period?: number;
|
||||
customerId?: number;
|
||||
customerName?: string;
|
||||
contractId?: number;
|
||||
contract?: Contract;
|
||||
auditStatus: number;
|
||||
processInstanceId: number;
|
||||
returnTime: Date;
|
||||
returnType: number;
|
||||
price: number;
|
||||
ownerUserId: number;
|
||||
ownerUserName?: string;
|
||||
remark: string;
|
||||
creator: string; // 创建人
|
||||
creatorName?: string; // 创建人名称
|
||||
createTime: Date; // 创建时间
|
||||
updateTime: Date; // 更新时间
|
||||
}
|
||||
|
||||
/** 合同信息 */
|
||||
export interface Contract {
|
||||
id?: number;
|
||||
name?: string;
|
||||
no: string;
|
||||
totalPrice: number;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询回款列表 */
|
||||
export function getReceivablePage(params: PageParam) {
|
||||
return requestClient.get<PageResult<CrmReceivableApi.Receivable>>(
|
||||
'/crm/receivable/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询回款列表,基于指定客户 */
|
||||
export function getReceivablePageByCustomer(params: PageParam) {
|
||||
return requestClient.get<PageResult<CrmReceivableApi.Receivable>>(
|
||||
'/crm/receivable/page-by-customer',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询回款详情 */
|
||||
export function getReceivable(id: number) {
|
||||
return requestClient.get<CrmReceivableApi.Receivable>(
|
||||
`/crm/receivable/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增回款 */
|
||||
export function createReceivable(data: CrmReceivableApi.Receivable) {
|
||||
return requestClient.post('/crm/receivable/create', data);
|
||||
}
|
||||
|
||||
/** 修改回款 */
|
||||
export function updateReceivable(data: CrmReceivableApi.Receivable) {
|
||||
return requestClient.put('/crm/receivable/update', data);
|
||||
}
|
||||
|
||||
/** 删除回款 */
|
||||
export function deleteReceivable(id: number) {
|
||||
return requestClient.delete(`/crm/receivable/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 导出回款 */
|
||||
export function exportReceivable(params: any) {
|
||||
return requestClient.download('/crm/receivable/export-excel', { params });
|
||||
}
|
||||
|
||||
/** 提交审核 */
|
||||
export function submitReceivable(id: number) {
|
||||
return requestClient.put(`/crm/receivable/submit?id=${id}`);
|
||||
}
|
||||
|
||||
/** 获得待审核回款数量 */
|
||||
export function getAuditReceivableCount() {
|
||||
return requestClient.get<number>('/crm/receivable/audit-count');
|
||||
}
|
||||
98
apps/web-antd/src/api/crm/receivable/plan/index.ts
Normal file
98
apps/web-antd/src/api/crm/receivable/plan/index.ts
Normal file
@@ -0,0 +1,98 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CrmReceivablePlanApi {
|
||||
/** 回款计划信息 */
|
||||
export interface Plan {
|
||||
id: number;
|
||||
period: number;
|
||||
receivableId: number;
|
||||
price: number;
|
||||
returnTime: Date;
|
||||
remindDays: number;
|
||||
returnType: number;
|
||||
remindTime: Date;
|
||||
customerId: number;
|
||||
customerName?: string;
|
||||
contractId?: number;
|
||||
contractNo?: string;
|
||||
ownerUserId: number;
|
||||
ownerUserName?: string;
|
||||
remark: string;
|
||||
creator: string;
|
||||
creatorName?: string;
|
||||
createTime: Date;
|
||||
updateTime: Date;
|
||||
receivable?: {
|
||||
price: number;
|
||||
returnTime: Date;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询回款计划列表 */
|
||||
export function getReceivablePlanPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<CrmReceivablePlanApi.Plan>>(
|
||||
'/crm/receivable-plan/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询回款计划列表(按客户) */
|
||||
export function getReceivablePlanPageByCustomer(params: PageParam) {
|
||||
return requestClient.get<PageResult<CrmReceivablePlanApi.Plan>>(
|
||||
'/crm/receivable-plan/page-by-customer',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询回款计划详情 */
|
||||
export function getReceivablePlan(id: number) {
|
||||
return requestClient.get<CrmReceivablePlanApi.Plan>(
|
||||
'/crm/receivable-plan/get',
|
||||
{ params: { id } },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询回款计划下拉数据 */
|
||||
export function getReceivablePlanSimpleList(
|
||||
customerId: number,
|
||||
contractId: number,
|
||||
) {
|
||||
return requestClient.get<CrmReceivablePlanApi.Plan[]>(
|
||||
'/crm/receivable-plan/simple-list',
|
||||
{
|
||||
params: { customerId, contractId },
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增回款计划 */
|
||||
export function createReceivablePlan(data: CrmReceivablePlanApi.Plan) {
|
||||
return requestClient.post('/crm/receivable-plan/create', data);
|
||||
}
|
||||
|
||||
/** 修改回款计划 */
|
||||
export function updateReceivablePlan(data: CrmReceivablePlanApi.Plan) {
|
||||
return requestClient.put('/crm/receivable-plan/update', data);
|
||||
}
|
||||
|
||||
/** 删除回款计划 */
|
||||
export function deleteReceivablePlan(id: number) {
|
||||
return requestClient.delete('/crm/receivable-plan/delete', {
|
||||
params: { id },
|
||||
});
|
||||
}
|
||||
|
||||
/** 导出回款计划 Excel */
|
||||
export function exportReceivablePlan(params: any) {
|
||||
return requestClient.download('/crm/receivable-plan/export-excel', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/** 获得待回款提醒数量 */
|
||||
export function getReceivablePlanRemindCount() {
|
||||
return requestClient.get<number>('/crm/receivable-plan/remind-count');
|
||||
}
|
||||
277
apps/web-antd/src/api/crm/statistics/customer.ts
Normal file
277
apps/web-antd/src/api/crm/statistics/customer.ts
Normal file
@@ -0,0 +1,277 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CrmStatisticsCustomerApi {
|
||||
/** 客户统计请求 */
|
||||
export interface CustomerSummaryReqVO {
|
||||
times: string[];
|
||||
interval: number;
|
||||
deptId: number;
|
||||
userId: number;
|
||||
userIds: number[];
|
||||
}
|
||||
|
||||
/** 客户总量分析(按日期)响应 */
|
||||
export interface CustomerSummaryByDateRespVO {
|
||||
time: string;
|
||||
customerCreateCount: number;
|
||||
customerDealCount: number;
|
||||
}
|
||||
|
||||
/** 客户总量分析(按用户)响应 */
|
||||
export interface CustomerSummaryByUserRespVO {
|
||||
ownerUserName: string;
|
||||
customerCreateCount: number;
|
||||
customerDealCount: number;
|
||||
contractPrice: number;
|
||||
receivablePrice: number;
|
||||
}
|
||||
|
||||
/** 客户跟进次数分析(按日期)响应 */
|
||||
export interface FollowUpSummaryByDateRespVO {
|
||||
time: string;
|
||||
followUpRecordCount: number;
|
||||
followUpCustomerCount: number;
|
||||
}
|
||||
|
||||
/** 客户跟进次数分析(按用户)响应 */
|
||||
export interface FollowUpSummaryByUserRespVO {
|
||||
ownerUserName: string;
|
||||
followupRecordCount: number;
|
||||
followupCustomerCount: number;
|
||||
}
|
||||
|
||||
/** 客户跟进方式统计响应 */
|
||||
export interface FollowUpSummaryByTypeRespVO {
|
||||
followUpType: string;
|
||||
followUpRecordCount: number;
|
||||
}
|
||||
|
||||
/** 合同摘要信息响应 */
|
||||
export interface CustomerContractSummaryRespVO {
|
||||
customerName: string;
|
||||
contractName: string;
|
||||
totalPrice: number;
|
||||
receivablePrice: number;
|
||||
customerType: string;
|
||||
customerSource: string;
|
||||
ownerUserName: string;
|
||||
creatorUserName: string;
|
||||
createTime: Date;
|
||||
orderDate: Date;
|
||||
}
|
||||
|
||||
/** 客户公海分析(按日期)响应 */
|
||||
export interface PoolSummaryByDateRespVO {
|
||||
time: string;
|
||||
customerPutCount: number;
|
||||
customerTakeCount: number;
|
||||
}
|
||||
|
||||
/** 客户公海分析(按用户)响应 */
|
||||
export interface PoolSummaryByUserRespVO {
|
||||
ownerUserName: string;
|
||||
customerPutCount: number;
|
||||
customerTakeCount: number;
|
||||
}
|
||||
|
||||
/** 客户成交周期(按日期)响应 */
|
||||
export interface CustomerDealCycleByDateRespVO {
|
||||
time: string;
|
||||
customerDealCycle: number;
|
||||
}
|
||||
|
||||
/** 客户成交周期(按用户)响应 */
|
||||
export interface CustomerDealCycleByUserRespVO {
|
||||
ownerUserName: string;
|
||||
customerDealCycle: number;
|
||||
customerDealCount: number;
|
||||
}
|
||||
|
||||
/** 客户成交周期(按地区)响应 */
|
||||
export interface CustomerDealCycleByAreaRespVO {
|
||||
areaName: string;
|
||||
customerDealCycle: number;
|
||||
customerDealCount: number;
|
||||
}
|
||||
|
||||
/** 客户成交周期(按产品)响应 */
|
||||
export interface CustomerDealCycleByProductRespVO {
|
||||
productName: string;
|
||||
customerDealCycle: number;
|
||||
customerDealCount: number;
|
||||
}
|
||||
}
|
||||
|
||||
export function getDatas(activeTabName: any, params: any) {
|
||||
switch (activeTabName) {
|
||||
case 'conversionStat': {
|
||||
return getContractSummary(params);
|
||||
}
|
||||
case 'customerSummary': {
|
||||
return getCustomerSummaryByUser(params);
|
||||
}
|
||||
case 'dealCycleByArea': {
|
||||
return getCustomerDealCycleByArea(params);
|
||||
}
|
||||
case 'dealCycleByProduct': {
|
||||
return getCustomerDealCycleByProduct(params);
|
||||
}
|
||||
case 'dealCycleByUser': {
|
||||
return getCustomerDealCycleByUser(params);
|
||||
}
|
||||
case 'followUpSummary': {
|
||||
return getFollowUpSummaryByUser(params);
|
||||
}
|
||||
case 'followUpType': {
|
||||
return getFollowUpSummaryByType(params);
|
||||
}
|
||||
case 'poolSummary': {
|
||||
return getPoolSummaryByUser(params);
|
||||
}
|
||||
default: {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function getChartDatas(activeTabName: any, params: any) {
|
||||
switch (activeTabName) {
|
||||
case 'conversionStat': {
|
||||
return getCustomerSummaryByDate(params);
|
||||
}
|
||||
case 'customerSummary': {
|
||||
return getCustomerSummaryByDate(params);
|
||||
}
|
||||
case 'dealCycleByArea': {
|
||||
return getCustomerDealCycleByArea(params);
|
||||
}
|
||||
case 'dealCycleByProduct': {
|
||||
return getCustomerDealCycleByProduct(params);
|
||||
}
|
||||
case 'dealCycleByUser': {
|
||||
return getCustomerDealCycleByUser(params);
|
||||
}
|
||||
case 'followUpSummary': {
|
||||
return getFollowUpSummaryByDate(params);
|
||||
}
|
||||
case 'followUpType': {
|
||||
return getFollowUpSummaryByType(params);
|
||||
}
|
||||
case 'poolSummary': {
|
||||
return getPoolSummaryByDate(params);
|
||||
}
|
||||
default: {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** 客户总量分析(按日期) */
|
||||
export function getCustomerSummaryByDate(
|
||||
params: CrmStatisticsCustomerApi.CustomerSummaryReqVO,
|
||||
) {
|
||||
return requestClient.get<
|
||||
CrmStatisticsCustomerApi.CustomerSummaryByDateRespVO[]
|
||||
>('/crm/statistics-customer/get-customer-summary-by-date', { params });
|
||||
}
|
||||
|
||||
/** 客户总量分析(按用户) */
|
||||
export function getCustomerSummaryByUser(
|
||||
params: CrmStatisticsCustomerApi.CustomerSummaryReqVO,
|
||||
) {
|
||||
return requestClient.get<
|
||||
CrmStatisticsCustomerApi.CustomerSummaryByUserRespVO[]
|
||||
>('/crm/statistics-customer/get-customer-summary-by-user', { params });
|
||||
}
|
||||
|
||||
/** 客户跟进次数分析(按日期) */
|
||||
export function getFollowUpSummaryByDate(
|
||||
params: CrmStatisticsCustomerApi.CustomerSummaryReqVO,
|
||||
) {
|
||||
return requestClient.get<
|
||||
CrmStatisticsCustomerApi.FollowUpSummaryByDateRespVO[]
|
||||
>('/crm/statistics-customer/get-follow-up-summary-by-date', { params });
|
||||
}
|
||||
|
||||
/** 客户跟进次数分析(按用户) */
|
||||
export function getFollowUpSummaryByUser(
|
||||
params: CrmStatisticsCustomerApi.CustomerSummaryReqVO,
|
||||
) {
|
||||
return requestClient.get<
|
||||
CrmStatisticsCustomerApi.FollowUpSummaryByUserRespVO[]
|
||||
>('/crm/statistics-customer/get-follow-up-summary-by-user', { params });
|
||||
}
|
||||
|
||||
/** 获取客户跟进方式统计数 */
|
||||
export function getFollowUpSummaryByType(
|
||||
params: CrmStatisticsCustomerApi.CustomerSummaryReqVO,
|
||||
) {
|
||||
return requestClient.get<
|
||||
CrmStatisticsCustomerApi.FollowUpSummaryByTypeRespVO[]
|
||||
>('/crm/statistics-customer/get-follow-up-summary-by-type', { params });
|
||||
}
|
||||
|
||||
/** 合同摘要信息(客户转化率页面) */
|
||||
export function getContractSummary(
|
||||
params: CrmStatisticsCustomerApi.CustomerSummaryReqVO,
|
||||
) {
|
||||
return requestClient.get<
|
||||
CrmStatisticsCustomerApi.CustomerContractSummaryRespVO[]
|
||||
>('/crm/statistics-customer/get-contract-summary', { params });
|
||||
}
|
||||
|
||||
/** 获取客户公海分析(按日期) */
|
||||
export function getPoolSummaryByDate(
|
||||
params: CrmStatisticsCustomerApi.CustomerSummaryReqVO,
|
||||
) {
|
||||
return requestClient.get<CrmStatisticsCustomerApi.PoolSummaryByDateRespVO[]>(
|
||||
'/crm/statistics-customer/get-pool-summary-by-date',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 获取客户公海分析(按用户) */
|
||||
export function getPoolSummaryByUser(
|
||||
params: CrmStatisticsCustomerApi.CustomerSummaryReqVO,
|
||||
) {
|
||||
return requestClient.get<CrmStatisticsCustomerApi.PoolSummaryByUserRespVO[]>(
|
||||
'/crm/statistics-customer/get-pool-summary-by-user',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 获取客户成交周期(按日期) */
|
||||
export function getCustomerDealCycleByDate(
|
||||
params: CrmStatisticsCustomerApi.CustomerSummaryReqVO,
|
||||
) {
|
||||
return requestClient.get<
|
||||
CrmStatisticsCustomerApi.CustomerDealCycleByDateRespVO[]
|
||||
>('/crm/statistics-customer/get-customer-deal-cycle-by-date', { params });
|
||||
}
|
||||
|
||||
/** 获取客户成交周期(按用户) */
|
||||
export function getCustomerDealCycleByUser(
|
||||
params: CrmStatisticsCustomerApi.CustomerSummaryReqVO,
|
||||
) {
|
||||
return requestClient.get<
|
||||
CrmStatisticsCustomerApi.CustomerDealCycleByUserRespVO[]
|
||||
>('/crm/statistics-customer/get-customer-deal-cycle-by-user', { params });
|
||||
}
|
||||
|
||||
/** 获取客户成交周期(按地区) */
|
||||
export function getCustomerDealCycleByArea(
|
||||
params: CrmStatisticsCustomerApi.CustomerSummaryReqVO,
|
||||
) {
|
||||
return requestClient.get<
|
||||
CrmStatisticsCustomerApi.CustomerDealCycleByAreaRespVO[]
|
||||
>('/crm/statistics-customer/get-customer-deal-cycle-by-area', { params });
|
||||
}
|
||||
|
||||
/** 获取客户成交周期(按产品) */
|
||||
export function getCustomerDealCycleByProduct(
|
||||
params: CrmStatisticsCustomerApi.CustomerSummaryReqVO,
|
||||
) {
|
||||
return requestClient.get<
|
||||
CrmStatisticsCustomerApi.CustomerDealCycleByProductRespVO[]
|
||||
>('/crm/statistics-customer/get-customer-deal-cycle-by-product', { params });
|
||||
}
|
||||
100
apps/web-antd/src/api/crm/statistics/funnel.ts
Normal file
100
apps/web-antd/src/api/crm/statistics/funnel.ts
Normal file
@@ -0,0 +1,100 @@
|
||||
import type { PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CrmStatisticsFunnelApi {
|
||||
/** 销售漏斗统计数据响应 */
|
||||
export interface FunnelSummaryRespVO {
|
||||
customerCount: number; // 客户数
|
||||
businessCount: number; // 商机数
|
||||
businessWinCount: number; // 赢单数
|
||||
}
|
||||
|
||||
/** 商机分析(按日期)响应 */
|
||||
export interface BusinessSummaryByDateRespVO {
|
||||
time: string; // 时间
|
||||
businessCreateCount: number; // 商机数
|
||||
totalPrice: number | string; // 商机金额
|
||||
}
|
||||
|
||||
/** 商机转化率分析(按日期)响应 */
|
||||
export interface BusinessInversionRateSummaryByDateRespVO {
|
||||
time: string; // 时间
|
||||
businessCount: number; // 商机数量
|
||||
businessWinCount: number; // 赢单商机数
|
||||
}
|
||||
}
|
||||
|
||||
export function getDatas(activeTabName: any, params: any) {
|
||||
switch (activeTabName) {
|
||||
case 'businessInversionRateSummary': {
|
||||
return getBusinessPageByDate(params);
|
||||
}
|
||||
case 'businessSummary': {
|
||||
return getBusinessPageByDate(params);
|
||||
}
|
||||
case 'funnel': {
|
||||
return getBusinessSummaryByEndStatus(params);
|
||||
}
|
||||
default: {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function getChartDatas(activeTabName: any, params: any) {
|
||||
switch (activeTabName) {
|
||||
case 'businessInversionRateSummary': {
|
||||
return getBusinessInversionRateSummaryByDate(params);
|
||||
}
|
||||
case 'businessSummary': {
|
||||
return getBusinessSummaryByDate(params);
|
||||
}
|
||||
case 'funnel': {
|
||||
return getFunnelSummary(params);
|
||||
}
|
||||
default: {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** 获取销售漏斗统计数据 */
|
||||
export function getFunnelSummary(params: any) {
|
||||
return requestClient.get<CrmStatisticsFunnelApi.FunnelSummaryRespVO>(
|
||||
'/crm/statistics-funnel/get-funnel-summary',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 获取商机结束状态统计 */
|
||||
export function getBusinessSummaryByEndStatus(params: any) {
|
||||
return requestClient.get<Record<string, number>>(
|
||||
'/crm/statistics-funnel/get-business-summary-by-end-status',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 获取新增商机分析(按日期) */
|
||||
export function getBusinessSummaryByDate(params: any) {
|
||||
return requestClient.get<
|
||||
CrmStatisticsFunnelApi.BusinessSummaryByDateRespVO[]
|
||||
>('/crm/statistics-funnel/get-business-summary-by-date', { params });
|
||||
}
|
||||
|
||||
/** 获取商机转化率分析(按日期) */
|
||||
export function getBusinessInversionRateSummaryByDate(params: any) {
|
||||
return requestClient.get<
|
||||
CrmStatisticsFunnelApi.BusinessInversionRateSummaryByDateRespVO[]
|
||||
>('/crm/statistics-funnel/get-business-inversion-rate-summary-by-date', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取商机列表(按日期) */
|
||||
export function getBusinessPageByDate(params: any) {
|
||||
return requestClient.get<PageResult<any>>(
|
||||
'/crm/statistics-funnel/get-business-page-by-date',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
48
apps/web-antd/src/api/crm/statistics/performance.ts
Normal file
48
apps/web-antd/src/api/crm/statistics/performance.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CrmStatisticsPerformanceApi {
|
||||
/** 员工业绩统计请求 */
|
||||
export interface PerformanceReqVO {
|
||||
times: string[];
|
||||
deptId: number;
|
||||
userId: number;
|
||||
}
|
||||
|
||||
/** 员工业绩统计响应 */
|
||||
export interface PerformanceRespVO {
|
||||
time: string;
|
||||
currentMonthCount: number;
|
||||
lastMonthCount: number;
|
||||
lastYearCount: number;
|
||||
}
|
||||
}
|
||||
|
||||
/** 员工获得合同金额统计 */
|
||||
export function getContractPricePerformance(
|
||||
params: CrmStatisticsPerformanceApi.PerformanceReqVO,
|
||||
) {
|
||||
return requestClient.get<CrmStatisticsPerformanceApi.PerformanceRespVO[]>(
|
||||
'/crm/statistics-performance/get-contract-price-performance',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 员工获得回款统计 */
|
||||
export function getReceivablePricePerformance(
|
||||
params: CrmStatisticsPerformanceApi.PerformanceReqVO,
|
||||
) {
|
||||
return requestClient.get<CrmStatisticsPerformanceApi.PerformanceRespVO[]>(
|
||||
'/crm/statistics-performance/get-receivable-price-performance',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 员工获得签约合同数量统计 */
|
||||
export function getContractCountPerformance(
|
||||
params: CrmStatisticsPerformanceApi.PerformanceReqVO,
|
||||
) {
|
||||
return requestClient.get<CrmStatisticsPerformanceApi.PerformanceRespVO[]>(
|
||||
'/crm/statistics-performance/get-contract-count-performance',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
89
apps/web-antd/src/api/crm/statistics/portrait.ts
Normal file
89
apps/web-antd/src/api/crm/statistics/portrait.ts
Normal file
@@ -0,0 +1,89 @@
|
||||
import type { PageParam } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CrmStatisticsPortraitApi {
|
||||
/** 客户基础统计响应 */
|
||||
export interface CustomerBaseRespVO {
|
||||
customerCount: number;
|
||||
dealCount: number;
|
||||
dealPortion: number | string;
|
||||
}
|
||||
|
||||
/** 客户行业统计响应 */
|
||||
export interface CustomerIndustryRespVO extends CustomerBaseRespVO {
|
||||
industryId: number;
|
||||
industryPortion: number | string;
|
||||
}
|
||||
|
||||
/** 客户来源统计响应 */
|
||||
export interface CustomerSourceRespVO extends CustomerBaseRespVO {
|
||||
source: number;
|
||||
sourcePortion: number | string;
|
||||
}
|
||||
|
||||
/** 客户级别统计响应 */
|
||||
export interface CustomerLevelRespVO extends CustomerBaseRespVO {
|
||||
level: number;
|
||||
levelPortion: number | string;
|
||||
}
|
||||
|
||||
/** 客户地区统计响应 */
|
||||
export interface CustomerAreaRespVO extends CustomerBaseRespVO {
|
||||
areaId: number;
|
||||
areaName: string;
|
||||
areaPortion: number | string;
|
||||
}
|
||||
}
|
||||
|
||||
export function getDatas(activeTabName: any, params: any) {
|
||||
switch (activeTabName) {
|
||||
case 'area': {
|
||||
return getCustomerArea(params);
|
||||
}
|
||||
case 'industry': {
|
||||
return getCustomerIndustry(params);
|
||||
}
|
||||
case 'level': {
|
||||
return getCustomerLevel(params);
|
||||
}
|
||||
case 'source': {
|
||||
return getCustomerSource(params);
|
||||
}
|
||||
default: {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** 获取客户行业统计数据 */
|
||||
export function getCustomerIndustry(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsPortraitApi.CustomerIndustryRespVO[]>(
|
||||
'/crm/statistics-portrait/get-customer-industry-summary',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 获取客户来源统计数据 */
|
||||
export function getCustomerSource(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsPortraitApi.CustomerSourceRespVO[]>(
|
||||
'/crm/statistics-portrait/get-customer-source-summary',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 获取客户级别统计数据 */
|
||||
export function getCustomerLevel(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsPortraitApi.CustomerLevelRespVO[]>(
|
||||
'/crm/statistics-portrait/get-customer-level-summary',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 获取客户地区统计数据 */
|
||||
export function getCustomerArea(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsPortraitApi.CustomerAreaRespVO[]>(
|
||||
'/crm/statistics-portrait/get-customer-area-summary',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
108
apps/web-antd/src/api/crm/statistics/rank.ts
Normal file
108
apps/web-antd/src/api/crm/statistics/rank.ts
Normal file
@@ -0,0 +1,108 @@
|
||||
import type { PageParam } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CrmStatisticsRankApi {
|
||||
/** 排行统计响应 */
|
||||
export interface RankRespVO {
|
||||
count: number;
|
||||
nickname: string;
|
||||
deptName: string;
|
||||
}
|
||||
}
|
||||
|
||||
export function getDatas(activeTabName: any, params: any) {
|
||||
switch (activeTabName) {
|
||||
case 'contactCountRank': {
|
||||
return getContactsCountRank(params);
|
||||
}
|
||||
case 'contractCountRank': {
|
||||
return getContractCountRank(params);
|
||||
}
|
||||
case 'contractPriceRank': {
|
||||
return getContractPriceRank(params);
|
||||
}
|
||||
case 'customerCountRank': {
|
||||
return getCustomerCountRank(params);
|
||||
}
|
||||
case 'followCountRank': {
|
||||
return getFollowCountRank(params);
|
||||
}
|
||||
case 'followCustomerCountRank': {
|
||||
return getFollowCustomerCountRank(params);
|
||||
}
|
||||
case 'productSalesRank': {
|
||||
return getProductSalesRank(params);
|
||||
}
|
||||
case 'receivablePriceRank': {
|
||||
return getReceivablePriceRank(params);
|
||||
}
|
||||
default: {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** 获得合同排行榜 */
|
||||
export function getContractPriceRank(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsRankApi.RankRespVO[]>(
|
||||
'/crm/statistics-rank/get-contract-price-rank',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 获得回款排行榜 */
|
||||
export function getReceivablePriceRank(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsRankApi.RankRespVO[]>(
|
||||
'/crm/statistics-rank/get-receivable-price-rank',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 签约合同排行 */
|
||||
export function getContractCountRank(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsRankApi.RankRespVO[]>(
|
||||
'/crm/statistics-rank/get-contract-count-rank',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 产品销量排行 */
|
||||
export function getProductSalesRank(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsRankApi.RankRespVO[]>(
|
||||
'/crm/statistics-rank/get-product-sales-rank',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增客户数排行 */
|
||||
export function getCustomerCountRank(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsRankApi.RankRespVO[]>(
|
||||
'/crm/statistics-rank/get-customer-count-rank',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增联系人数排行 */
|
||||
export function getContactsCountRank(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsRankApi.RankRespVO[]>(
|
||||
'/crm/statistics-rank/get-contacts-count-rank',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 跟进次数排行 */
|
||||
export function getFollowCountRank(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsRankApi.RankRespVO[]>(
|
||||
'/crm/statistics-rank/get-follow-count-rank',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 跟进客户数排行 */
|
||||
export function getFollowCustomerCountRank(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsRankApi.RankRespVO[]>(
|
||||
'/crm/statistics-rank/get-follow-customer-count-rank',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
61
apps/web-antd/src/api/erp/finance/account/index.ts
Normal file
61
apps/web-antd/src/api/erp/finance/account/index.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpAccountApi {
|
||||
/** 结算账户信息 */
|
||||
export interface Account {
|
||||
id?: number; // 结算账户编号
|
||||
no: string; // 账户编码
|
||||
remark: string; // 备注
|
||||
status: number; // 开启状态
|
||||
sort: number; // 排序
|
||||
defaultStatus: boolean; // 是否默认
|
||||
name: string; // 账户名称
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询结算账户分页 */
|
||||
export function getAccountPage(params: PageParam) {
|
||||
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 });
|
||||
}
|
||||
95
apps/web-antd/src/api/erp/finance/payment/index.ts
Normal file
95
apps/web-antd/src/api/erp/finance/payment/index.ts
Normal file
@@ -0,0 +1,95 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpFinancePaymentApi {
|
||||
/** 付款单信息 */
|
||||
export interface FinancePayment {
|
||||
id?: number; // 付款单编号
|
||||
no: string; // 付款单号
|
||||
supplierId?: number; // 供应商编号
|
||||
supplierName?: string; // 供应商名称
|
||||
paymentTime?: Date; // 付款时间
|
||||
totalPrice: number; // 合计金额,单位:元
|
||||
discountPrice: number; // 优惠金额
|
||||
paymentPrice: number; // 实际付款金额
|
||||
status: number; // 状态
|
||||
remark: string; // 备注
|
||||
fileUrl?: string; // 附件
|
||||
accountId?: number; // 付款账户
|
||||
accountName?: string; // 账户名称
|
||||
financeUserId?: number; // 财务人员
|
||||
financeUserName?: string; // 财务人员姓名
|
||||
creator?: string; // 创建人
|
||||
creatorName?: string; // 创建人姓名
|
||||
items?: FinancePaymentItem[]; // 付款明细
|
||||
bizNo?: string; // 业务单号
|
||||
}
|
||||
|
||||
/** 付款单项 */
|
||||
export interface FinancePaymentItem {
|
||||
id?: number;
|
||||
row_id?: number; // 前端使用的临时 ID
|
||||
bizId: number; // 业务ID
|
||||
bizType: number; // 业务类型
|
||||
bizNo: string; // 业务编号
|
||||
totalPrice: number; // 应付金额
|
||||
paidPrice: number; // 已付金额
|
||||
paymentPrice: number; // 本次付款
|
||||
remark?: string; // 备注
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询付款单分页 */
|
||||
export function getFinancePaymentPage(params: PageParam) {
|
||||
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(id: number, status: number) {
|
||||
return requestClient.put('/erp/finance-payment/update-status', null, {
|
||||
params: { id, status },
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除付款单 */
|
||||
export function deleteFinancePayment(ids: number[]) {
|
||||
return requestClient.delete('/erp/finance-payment/delete', {
|
||||
params: {
|
||||
ids: ids.join(','),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/** 导出付款单 Excel */
|
||||
export function exportFinancePayment(params: any) {
|
||||
return requestClient.download('/erp/finance-payment/export-excel', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
95
apps/web-antd/src/api/erp/finance/receipt/index.ts
Normal file
95
apps/web-antd/src/api/erp/finance/receipt/index.ts
Normal file
@@ -0,0 +1,95 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpFinanceReceiptApi {
|
||||
/** 收款单项 */
|
||||
export interface FinanceReceiptItem {
|
||||
id?: number;
|
||||
row_id?: number; // 前端使用的临时 ID
|
||||
bizId: number; // 业务ID
|
||||
bizType: number; // 业务类型
|
||||
bizNo: string; // 业务编号
|
||||
totalPrice: number; // 应收金额
|
||||
receiptedPrice: number; // 已收金额
|
||||
receiptPrice: number; // 本次收款
|
||||
remark?: string; // 备注
|
||||
}
|
||||
|
||||
/** 收款单信息 */
|
||||
export interface FinanceReceipt {
|
||||
id?: number; // 收款单编号
|
||||
no: string; // 收款单号
|
||||
customerId: number; // 客户编号
|
||||
customerName?: string; // 客户名称
|
||||
receiptTime: Date; // 收款时间
|
||||
totalPrice: number; // 合计金额,单位:元
|
||||
discountPrice: number; // 优惠金额
|
||||
receiptPrice: number; // 实际收款金额
|
||||
status: number; // 状态
|
||||
remark: string; // 备注
|
||||
fileUrl?: string; // 附件
|
||||
accountId?: number; // 收款账户
|
||||
accountName?: string; // 账户名称
|
||||
financeUserId?: number; // 财务人员
|
||||
financeUserName?: string; // 财务人员姓名
|
||||
creator?: string; // 创建人
|
||||
creatorName?: string; // 创建人姓名
|
||||
items?: FinanceReceiptItem[]; // 收款明细
|
||||
bizNo?: string; // 业务单号
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询收款单分页 */
|
||||
export function getFinanceReceiptPage(params: PageParam) {
|
||||
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(id: number, status: number) {
|
||||
return requestClient.put('/erp/finance-receipt/update-status', null, {
|
||||
params: { id, status },
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除收款单 */
|
||||
export function deleteFinanceReceipt(ids: number[]) {
|
||||
return requestClient.delete('/erp/finance-receipt/delete', {
|
||||
params: {
|
||||
ids: ids.join(','),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/** 导出收款单 Excel */
|
||||
export function exportFinanceReceipt(params: any) {
|
||||
return requestClient.download('/erp/finance-receipt/export-excel', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
62
apps/web-antd/src/api/erp/product/category/index.ts
Normal file
62
apps/web-antd/src/api/erp/product/category/index.ts
Normal file
@@ -0,0 +1,62 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpProductCategoryApi {
|
||||
/** 产品分类信息 */
|
||||
export interface ProductCategory {
|
||||
id?: number; // 分类编号
|
||||
parentId?: number; // 父分类编号
|
||||
name: string; // 分类名称
|
||||
code?: string; // 分类编码
|
||||
sort?: number; // 分类排序
|
||||
status?: number; // 开启状态
|
||||
children?: ProductCategory[]; // 子分类
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询产品分类列表 */
|
||||
export function getProductCategoryList(params?: any) {
|
||||
return requestClient.get<ErpProductCategoryApi.ProductCategory[]>(
|
||||
'/erp/product-category/list',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询产品分类精简列表 */
|
||||
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,
|
||||
});
|
||||
}
|
||||
61
apps/web-antd/src/api/erp/product/product/index.ts
Normal file
61
apps/web-antd/src/api/erp/product/product/index.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpProductApi {
|
||||
/** 产品信息 */
|
||||
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 });
|
||||
}
|
||||
54
apps/web-antd/src/api/erp/product/unit/index.ts
Normal file
54
apps/web-antd/src/api/erp/product/unit/index.ts
Normal file
@@ -0,0 +1,54 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpProductUnitApi {
|
||||
/** 产品单位信息 */
|
||||
export interface ProductUnit {
|
||||
id?: number; // 单位编号
|
||||
name: string; // 单位名字
|
||||
status: number; // 单位状态
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询产品单位分页 */
|
||||
export function getProductUnitPage(params: PageParam) {
|
||||
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 });
|
||||
}
|
||||
100
apps/web-antd/src/api/erp/purchase/in/index.ts
Normal file
100
apps/web-antd/src/api/erp/purchase/in/index.ts
Normal file
@@ -0,0 +1,100 @@
|
||||
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 function getPurchaseInPage(params: PageParam) {
|
||||
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: any) {
|
||||
return requestClient.download('/erp/purchase-in/export-excel', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
97
apps/web-antd/src/api/erp/purchase/order/index.ts
Normal file
97
apps/web-antd/src/api/erp/purchase/order/index.ts
Normal file
@@ -0,0 +1,97 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpPurchaseOrderApi {
|
||||
/** 采购订单信息 */
|
||||
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 PurchaseOrderItem {
|
||||
id?: number; // 订单项编号
|
||||
orderId?: number; // 采购订单编号
|
||||
productId?: number; // 产品编号
|
||||
productName?: string; // 产品名称
|
||||
productBarCode?: string; // 产品条码
|
||||
productUnitId?: number; // 产品单位编号
|
||||
productUnitName?: string; // 产品单位名称
|
||||
productPrice?: number; // 产品单价,单位:元
|
||||
totalProductPrice?: number; // 产品总价,单位:元
|
||||
count?: number; // 数量
|
||||
totalPrice?: number; // 总价,单位:元
|
||||
taxPercent?: number; // 税率,百分比
|
||||
taxPrice?: number; // 税额,单位:元
|
||||
totalTaxPrice?: number; // 含税总价,单位:元
|
||||
remark?: string; // 备注
|
||||
stockCount?: number; // 库存数量(显示字段)
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询采购订单分页 */
|
||||
export function getPurchaseOrderPage(params: PageParam) {
|
||||
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(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 });
|
||||
}
|
||||
96
apps/web-antd/src/api/erp/purchase/return/index.ts
Normal file
96
apps/web-antd/src/api/erp/purchase/return/index.ts
Normal file
@@ -0,0 +1,96 @@
|
||||
import type { 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 function getPurchaseReturnPage(params: any) {
|
||||
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(id: number, status: number) {
|
||||
return requestClient.put('/erp/purchase-return/update-status', null, {
|
||||
params: { id, status },
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除采购退货 */
|
||||
export function deletePurchaseReturn(ids: number[]) {
|
||||
return requestClient.delete('/erp/purchase-return/delete', {
|
||||
params: {
|
||||
ids: ids.join(','),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/** 导出采购退货 Excel */
|
||||
export function exportPurchaseReturn(params: any) {
|
||||
return requestClient.download('/erp/purchase-return/export-excel', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
66
apps/web-antd/src/api/erp/purchase/supplier/index.ts
Normal file
66
apps/web-antd/src/api/erp/purchase/supplier/index.ts
Normal file
@@ -0,0 +1,66 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpSupplierApi {
|
||||
/** 供应商信息 */
|
||||
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 function getSupplierPage(params: PageParam) {
|
||||
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 });
|
||||
}
|
||||
66
apps/web-antd/src/api/erp/sale/customer/index.ts
Normal file
66
apps/web-antd/src/api/erp/sale/customer/index.ts
Normal file
@@ -0,0 +1,66 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpCustomerApi {
|
||||
/** 客户信息 */
|
||||
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 function getCustomerPage(params: PageParam) {
|
||||
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 });
|
||||
}
|
||||
98
apps/web-antd/src/api/erp/sale/order/index.ts
Normal file
98
apps/web-antd/src/api/erp/sale/order/index.ts
Normal file
@@ -0,0 +1,98 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpSaleOrderApi {
|
||||
/** 销售订单信息 */
|
||||
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[]; // 销售订单产品明细列表
|
||||
}
|
||||
|
||||
/** 销售订单项 */
|
||||
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 function getSaleOrderPage(params: PageParam) {
|
||||
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 getSaleOrderItemListByOrderId(orderId: number) {
|
||||
return requestClient.get<ErpSaleOrderApi.SaleOrderItem[]>(
|
||||
`/erp/sale-order/item/list-by-order-id?orderId=${orderId}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增销售订单 */
|
||||
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 });
|
||||
}
|
||||
95
apps/web-antd/src/api/erp/sale/out/index.ts
Normal file
95
apps/web-antd/src/api/erp/sale/out/index.ts
Normal file
@@ -0,0 +1,95 @@
|
||||
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 function getSaleOutPage(params: PageParam) {
|
||||
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(id: number, status: number) {
|
||||
return requestClient.put('/erp/sale-out/update-status', null, {
|
||||
params: { id, status },
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除销售出库 */
|
||||
export function deleteSaleOut(ids: number[]) {
|
||||
return requestClient.delete('/erp/sale-out/delete', {
|
||||
params: {
|
||||
ids: ids.join(','),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/** 导出销售出库 Excel */
|
||||
export function exportSaleOut(params: any) {
|
||||
return requestClient.download('/erp/sale-out/export-excel', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
96
apps/web-antd/src/api/erp/sale/return/index.ts
Normal file
96
apps/web-antd/src/api/erp/sale/return/index.ts
Normal file
@@ -0,0 +1,96 @@
|
||||
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 function getSaleReturnPage(params: PageParam) {
|
||||
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(id: number, status: number) {
|
||||
return requestClient.put('/erp/sale-return/update-status', null, {
|
||||
params: { id, status },
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除销售退货 */
|
||||
export function deleteSaleReturn(ids: number[]) {
|
||||
return requestClient.delete('/erp/sale-return/delete', {
|
||||
params: {
|
||||
ids: ids.join(','),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/** 导出销售退货 Excel */
|
||||
export function exportSaleReturn(params: any) {
|
||||
return requestClient.download('/erp/sale-return/export-excel', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
31
apps/web-antd/src/api/erp/statistics/purchase/index.ts
Normal file
31
apps/web-antd/src/api/erp/statistics/purchase/index.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpPurchaseStatisticsApi {
|
||||
/** 采购全局统计 */
|
||||
export interface PurchaseSummaryRespVO {
|
||||
todayPrice: number; // 今日采购金额
|
||||
yesterdayPrice: number; // 昨日采购金额
|
||||
monthPrice: number; // 本月采购金额
|
||||
yearPrice: number; // 今年采购金额
|
||||
}
|
||||
|
||||
/** 采购时间段统计 */
|
||||
export interface PurchaseTimeSummaryRespVO {
|
||||
time: string; // 时间
|
||||
price: number; // 采购金额
|
||||
}
|
||||
}
|
||||
|
||||
/** 获得采购统计 */
|
||||
export function getPurchaseSummary() {
|
||||
return requestClient.get<ErpPurchaseStatisticsApi.PurchaseSummaryRespVO>(
|
||||
'/erp/purchase-statistics/summary',
|
||||
);
|
||||
}
|
||||
|
||||
/** 获得采购时间段统计 */
|
||||
export function getPurchaseTimeSummary() {
|
||||
return requestClient.get<
|
||||
ErpPurchaseStatisticsApi.PurchaseTimeSummaryRespVO[]
|
||||
>('/erp/purchase-statistics/time-summary');
|
||||
}
|
||||
31
apps/web-antd/src/api/erp/statistics/sale/index.ts
Normal file
31
apps/web-antd/src/api/erp/statistics/sale/index.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpSaleStatisticsApi {
|
||||
/** 销售全局统计 */
|
||||
export interface SaleSummaryRespVO {
|
||||
todayPrice: number; // 今日销售金额
|
||||
yesterdayPrice: number; // 昨日销售金额
|
||||
monthPrice: number; // 本月销售金额
|
||||
yearPrice: number; // 今年销售金额
|
||||
}
|
||||
|
||||
/** 销售时间段统计 */
|
||||
export interface SaleTimeSummaryRespVO {
|
||||
time: string; // 时间
|
||||
price: number; // 销售金额
|
||||
}
|
||||
}
|
||||
|
||||
/** 获得销售统计 */
|
||||
export function getSaleSummary() {
|
||||
return requestClient.get<ErpSaleStatisticsApi.SaleSummaryRespVO>(
|
||||
'/erp/sale-statistics/summary',
|
||||
);
|
||||
}
|
||||
|
||||
/** 获得销售时间段统计 */
|
||||
export function getSaleTimeSummary() {
|
||||
return requestClient.get<ErpSaleStatisticsApi.SaleTimeSummaryRespVO[]>(
|
||||
'/erp/sale-statistics/time-summary',
|
||||
);
|
||||
}
|
||||
87
apps/web-antd/src/api/erp/stock/check/index.ts
Normal file
87
apps/web-antd/src/api/erp/stock/check/index.ts
Normal file
@@ -0,0 +1,87 @@
|
||||
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 function getStockCheckPage(params: PageParam) {
|
||||
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(id: number, status: number) {
|
||||
return requestClient.put('/erp/stock-check/update-status', null, {
|
||||
params: { id, status },
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除库存盘点 */
|
||||
export function deleteStockCheck(ids: number[]) {
|
||||
return requestClient.delete('/erp/stock-check/delete', {
|
||||
params: {
|
||||
ids: ids.join(','),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/** 导出库存盘点单 Excel */
|
||||
export function exportStockCheck(params: any) {
|
||||
return requestClient.download('/erp/stock-check/export-excel', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
86
apps/web-antd/src/api/erp/stock/in/index.ts
Normal file
86
apps/web-antd/src/api/erp/stock/in/index.ts
Normal file
@@ -0,0 +1,86 @@
|
||||
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 function getStockInPage(params: PageParam) {
|
||||
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(id: number, status: number) {
|
||||
return requestClient.put('/erp/stock-in/update-status', null, {
|
||||
params: { id, status },
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除其它入库单 */
|
||||
export function deleteStockIn(ids: number[]) {
|
||||
return requestClient.delete('/erp/stock-in/delete', {
|
||||
params: {
|
||||
ids: ids.join(','),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/** 导出其它入库单 Excel */
|
||||
export function exportStockIn(params: any) {
|
||||
return requestClient.download('/erp/stock-in/export-excel', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
87
apps/web-antd/src/api/erp/stock/move/index.ts
Normal file
87
apps/web-antd/src/api/erp/stock/move/index.ts
Normal file
@@ -0,0 +1,87 @@
|
||||
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 function getStockMovePage(params: PageParam) {
|
||||
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(id: number, status: number) {
|
||||
return requestClient.put('/erp/stock-move/update-status', null, {
|
||||
params: { id, status },
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除库存调拨单 */
|
||||
export function deleteStockMove(ids: number[]) {
|
||||
return requestClient.delete('/erp/stock-move/delete', {
|
||||
params: {
|
||||
ids: ids.join(','),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/** 导出库存调拨单 Excel */
|
||||
export function exportStockMove(params: any) {
|
||||
return requestClient.download('/erp/stock-move/export-excel', { params });
|
||||
}
|
||||
85
apps/web-antd/src/api/erp/stock/out/index.ts
Normal file
85
apps/web-antd/src/api/erp/stock/out/index.ts
Normal file
@@ -0,0 +1,85 @@
|
||||
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 function getStockOutPage(params: PageParam) {
|
||||
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(id: number, status: number) {
|
||||
return requestClient.put('/erp/stock-out/update-status', null, {
|
||||
params: { id, status },
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除其它出库单 */
|
||||
export function deleteStockOut(ids: number[]) {
|
||||
return requestClient.delete('/erp/stock-out/delete', {
|
||||
params: {
|
||||
ids: ids.join(','),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/** 导出其它出库单 Excel */
|
||||
export function exportStockOut(params: any) {
|
||||
return requestClient.download('/erp/stock-out/export-excel', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
31
apps/web-antd/src/api/erp/stock/record/index.ts
Normal file
31
apps/web-antd/src/api/erp/stock/record/index.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpStockRecordApi {
|
||||
/** 产品库存明细 */
|
||||
export interface StockRecord {
|
||||
id?: number; // 编号
|
||||
productId: number; // 产品编号
|
||||
warehouseId: number; // 仓库编号
|
||||
count: number; // 出入库数量
|
||||
totalCount: number; // 总库存量
|
||||
bizType: number; // 业务类型
|
||||
bizId: number; // 业务编号
|
||||
bizItemId: number; // 业务项编号
|
||||
bizNo: string; // 业务单号
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询产品库存明细分页 */
|
||||
export function getStockRecordPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<ErpStockRecordApi.StockRecord>>(
|
||||
'/erp/stock-record/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 导出产品库存明细 Excel */
|
||||
export function exportStockRecord(params: any) {
|
||||
return requestClient.download('/erp/stock-record/export-excel', { params });
|
||||
}
|
||||
51
apps/web-antd/src/api/erp/stock/stock/index.ts
Normal file
51
apps/web-antd/src/api/erp/stock/stock/index.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
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 StockQueryReqVO {
|
||||
productId: number;
|
||||
warehouseId: number;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询产品库存分页 */
|
||||
export function getStockPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<ErpStockApi.Stock>>('/erp/stock/page', {
|
||||
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: any) {
|
||||
return requestClient.download('/erp/stock/export-excel', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取库存数量 */
|
||||
export function getWarehouseStockCount(params: ErpStockApi.StockQueryReqVO) {
|
||||
return requestClient.get<number>('/erp/stock/get-count', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
71
apps/web-antd/src/api/erp/stock/warehouse/index.ts
Normal file
71
apps/web-antd/src/api/erp/stock/warehouse/index.ts
Normal file
@@ -0,0 +1,71 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpWarehouseApi {
|
||||
/** 仓库信息 */
|
||||
export interface Warehouse {
|
||||
id?: number; // 仓库编号
|
||||
name: string; // 仓库名称
|
||||
address: string; // 仓库地址
|
||||
sort: number; // 排序
|
||||
remark: string; // 备注
|
||||
principal: string; // 负责人
|
||||
warehousePrice: number; // 仓储费,单位:元
|
||||
truckagePrice: number; // 搬运费,单位:元
|
||||
status: number; // 开启状态
|
||||
defaultStatus: boolean; // 是否默认
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询仓库分页 */
|
||||
export function getWarehousePage(params: PageParam) {
|
||||
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 });
|
||||
}
|
||||
168
apps/web-antd/src/api/infra/codegen/index.ts
Normal file
168
apps/web-antd/src/api/infra/codegen/index.ts
Normal file
@@ -0,0 +1,168 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace InfraCodegenApi {
|
||||
/** 代码生成表定义 */
|
||||
export interface CodegenTable {
|
||||
id: number;
|
||||
tableId: number;
|
||||
isParentMenuIdValid: boolean;
|
||||
dataSourceConfigId: number;
|
||||
scene: number;
|
||||
tableName: string;
|
||||
tableComment: string;
|
||||
remark: string;
|
||||
moduleName: string;
|
||||
businessName: string;
|
||||
className: string;
|
||||
classComment: string;
|
||||
author: string;
|
||||
createTime: Date;
|
||||
updateTime: Date;
|
||||
templateType: number;
|
||||
parentMenuId: number;
|
||||
}
|
||||
|
||||
/** 代码生成字段定义 */
|
||||
export interface CodegenColumn {
|
||||
id: number;
|
||||
tableId: number;
|
||||
columnName: string;
|
||||
dataType: string;
|
||||
columnComment: string;
|
||||
nullable: number;
|
||||
primaryKey: number;
|
||||
ordinalPosition: number;
|
||||
javaType: string;
|
||||
javaField: string;
|
||||
dictType: string;
|
||||
example: string;
|
||||
createOperation: number;
|
||||
updateOperation: number;
|
||||
listOperation: number;
|
||||
listOperationCondition: string;
|
||||
listOperationResult: number;
|
||||
htmlType: string;
|
||||
}
|
||||
|
||||
/** 数据库表定义 */
|
||||
export interface DatabaseTable {
|
||||
name: string;
|
||||
comment: string;
|
||||
}
|
||||
|
||||
/** 代码生成详情 */
|
||||
export interface CodegenDetail {
|
||||
table: CodegenTable;
|
||||
columns: CodegenColumn[];
|
||||
}
|
||||
|
||||
/** 代码预览 */
|
||||
export interface CodegenPreview {
|
||||
filePath: string;
|
||||
code: string;
|
||||
}
|
||||
|
||||
/** 更新代码生成请求 */
|
||||
export interface CodegenUpdateReqVO {
|
||||
table: any | CodegenTable;
|
||||
columns: CodegenColumn[];
|
||||
}
|
||||
|
||||
/** 创建代码生成请求 */
|
||||
export interface CodegenCreateListReqVO {
|
||||
dataSourceConfigId?: number;
|
||||
tableNames: string[];
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询列表代码生成表定义 */
|
||||
export function getCodegenTableList(dataSourceConfigId: number) {
|
||||
return requestClient.get<InfraCodegenApi.CodegenTable[]>(
|
||||
'/infra/codegen/table/list?',
|
||||
{
|
||||
params: { dataSourceConfigId },
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询列表代码生成表定义 */
|
||||
export function getCodegenTablePage(params: PageParam) {
|
||||
return requestClient.get<PageResult<InfraCodegenApi.CodegenTable>>(
|
||||
'/infra/codegen/table/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询详情代码生成表定义 */
|
||||
export function getCodegenTable(tableId: number) {
|
||||
return requestClient.get<InfraCodegenApi.CodegenDetail>(
|
||||
'/infra/codegen/detail',
|
||||
{
|
||||
params: { tableId },
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** 修改代码生成表定义 */
|
||||
export function updateCodegenTable(data: InfraCodegenApi.CodegenUpdateReqVO) {
|
||||
return requestClient.put('/infra/codegen/update', data);
|
||||
}
|
||||
|
||||
/** 基于数据库的表结构,同步数据库的表和字段定义 */
|
||||
export function syncCodegenFromDB(tableId: number) {
|
||||
return requestClient.put(
|
||||
'/infra/codegen/sync-from-db',
|
||||
{},
|
||||
{
|
||||
params: { tableId },
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** 预览生成代码 */
|
||||
export function previewCodegen(tableId: number) {
|
||||
return requestClient.get<InfraCodegenApi.CodegenPreview[]>(
|
||||
'/infra/codegen/preview',
|
||||
{
|
||||
params: { tableId },
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** 下载生成代码 */
|
||||
export function downloadCodegen(tableId: number) {
|
||||
return requestClient.download('/infra/codegen/download', {
|
||||
params: { tableId },
|
||||
});
|
||||
}
|
||||
|
||||
/** 获得表定义 */
|
||||
export function getSchemaTableList(params: any) {
|
||||
return requestClient.get<InfraCodegenApi.DatabaseTable[]>(
|
||||
'/infra/codegen/db/table/list',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 基于数据库的表结构,创建代码生成器的表定义 */
|
||||
export function createCodegenList(
|
||||
data: InfraCodegenApi.CodegenCreateListReqVO,
|
||||
) {
|
||||
return requestClient.post('/infra/codegen/create-list', data);
|
||||
}
|
||||
|
||||
/** 删除代码生成表定义 */
|
||||
export function deleteCodegenTable(tableId: number) {
|
||||
return requestClient.delete('/infra/codegen/delete', {
|
||||
params: { tableId },
|
||||
});
|
||||
}
|
||||
|
||||
/** 批量删除代码生成表定义 */
|
||||
export function deleteCodegenTableList(tableIds: number[]) {
|
||||
return requestClient.delete(
|
||||
`/infra/codegen/delete-list?tableIds=${tableIds.join(',')}`,
|
||||
);
|
||||
}
|
||||
53
apps/web-antd/src/api/infra/data-source-config/index.ts
Normal file
53
apps/web-antd/src/api/infra/data-source-config/index.ts
Normal file
@@ -0,0 +1,53 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace InfraDataSourceConfigApi {
|
||||
/** 数据源配置信息 */
|
||||
export interface DataSourceConfig {
|
||||
id?: number;
|
||||
name: string;
|
||||
url: string;
|
||||
username: string;
|
||||
password: string;
|
||||
createTime?: Date;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询数据源配置列表 */
|
||||
export function getDataSourceConfigList() {
|
||||
return requestClient.get<InfraDataSourceConfigApi.DataSourceConfig[]>(
|
||||
'/infra/data-source-config/list',
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询数据源配置详情 */
|
||||
export function getDataSourceConfig(id: number) {
|
||||
return requestClient.get<InfraDataSourceConfigApi.DataSourceConfig>(
|
||||
`/infra/data-source-config/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增数据源配置 */
|
||||
export function createDataSourceConfig(
|
||||
data: InfraDataSourceConfigApi.DataSourceConfig,
|
||||
) {
|
||||
return requestClient.post('/infra/data-source-config/create', data);
|
||||
}
|
||||
|
||||
/** 修改数据源配置 */
|
||||
export function updateDataSourceConfig(
|
||||
data: InfraDataSourceConfigApi.DataSourceConfig,
|
||||
) {
|
||||
return requestClient.put('/infra/data-source-config/update', data);
|
||||
}
|
||||
|
||||
/** 删除数据源配置 */
|
||||
export function deleteDataSourceConfig(id: number) {
|
||||
return requestClient.delete(`/infra/data-source-config/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 批量删除数据源配置 */
|
||||
export function deleteDataSourceConfigList(ids: number[]) {
|
||||
return requestClient.delete(
|
||||
`/infra/data-source-config/delete-list?ids=${ids.join(',')}`,
|
||||
);
|
||||
}
|
||||
61
apps/web-antd/src/api/infra/demo/demo01/index.ts
Normal file
61
apps/web-antd/src/api/infra/demo/demo01/index.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
import type { Dayjs } from 'dayjs';
|
||||
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace Demo01ContactApi {
|
||||
/** 示例联系人信息 */
|
||||
export interface Demo01Contact {
|
||||
id: number; // 编号
|
||||
name?: string; // 名字
|
||||
sex?: number; // 性别
|
||||
birthday?: Dayjs | string; // 出生年
|
||||
description?: string; // 简介
|
||||
avatar: string; // 头像
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询示例联系人分页 */
|
||||
export function getDemo01ContactPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<Demo01ContactApi.Demo01Contact>>(
|
||||
'/infra/demo01-contact/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询示例联系人详情 */
|
||||
export function getDemo01Contact(id: number) {
|
||||
return requestClient.get<Demo01ContactApi.Demo01Contact>(
|
||||
`/infra/demo01-contact/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增示例联系人 */
|
||||
export function createDemo01Contact(data: Demo01ContactApi.Demo01Contact) {
|
||||
return requestClient.post('/infra/demo01-contact/create', data);
|
||||
}
|
||||
|
||||
/** 修改示例联系人 */
|
||||
export function updateDemo01Contact(data: Demo01ContactApi.Demo01Contact) {
|
||||
return requestClient.put('/infra/demo01-contact/update', data);
|
||||
}
|
||||
|
||||
/** 删除示例联系人 */
|
||||
export function deleteDemo01Contact(id: number) {
|
||||
return requestClient.delete(`/infra/demo01-contact/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 批量删除示例联系人 */
|
||||
export function deleteDemo01ContactList(ids: number[]) {
|
||||
return requestClient.delete(
|
||||
`/infra/demo01-contact/delete-list?ids=${ids.join(',')}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 导出示例联系人 */
|
||||
export function exportDemo01Contact(params: any) {
|
||||
return requestClient.download('/infra/demo01-contact/export-excel', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
48
apps/web-antd/src/api/infra/demo/demo02/index.ts
Normal file
48
apps/web-antd/src/api/infra/demo/demo02/index.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace Demo02CategoryApi {
|
||||
/** 示例分类信息 */
|
||||
export interface Demo02Category {
|
||||
id: number; // 编号
|
||||
name?: string; // 名字
|
||||
parentId?: number; // 父级编号
|
||||
children?: Demo02Category[];
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询示例分类列表 */
|
||||
export function getDemo02CategoryList(params: any) {
|
||||
return requestClient.get<Demo02CategoryApi.Demo02Category[]>(
|
||||
'/infra/demo02-category/list',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询示例分类详情 */
|
||||
export function getDemo02Category(id: number) {
|
||||
return requestClient.get<Demo02CategoryApi.Demo02Category>(
|
||||
`/infra/demo02-category/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增示例分类 */
|
||||
export function createDemo02Category(data: Demo02CategoryApi.Demo02Category) {
|
||||
return requestClient.post('/infra/demo02-category/create', data);
|
||||
}
|
||||
|
||||
/** 修改示例分类 */
|
||||
export function updateDemo02Category(data: Demo02CategoryApi.Demo02Category) {
|
||||
return requestClient.put('/infra/demo02-category/update', data);
|
||||
}
|
||||
|
||||
/** 删除示例分类 */
|
||||
export function deleteDemo02Category(id: number) {
|
||||
return requestClient.delete(`/infra/demo02-category/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 导出示例分类 */
|
||||
export function exportDemo02Category(params: any) {
|
||||
return requestClient.download('/infra/demo02-category/export-excel', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
168
apps/web-antd/src/api/infra/demo/demo03/erp/index.ts
Normal file
168
apps/web-antd/src/api/infra/demo/demo03/erp/index.ts
Normal file
@@ -0,0 +1,168 @@
|
||||
import type { Dayjs } from 'dayjs';
|
||||
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace Demo03StudentApi {
|
||||
/** 学生课程信息 */
|
||||
export interface Demo03Course {
|
||||
id: number; // 编号
|
||||
studentId?: number; // 学生编号
|
||||
name?: string; // 名字
|
||||
score?: number; // 分数
|
||||
}
|
||||
|
||||
/** 学生班级信息 */
|
||||
export interface Demo03Grade {
|
||||
id: number; // 编号
|
||||
studentId?: number; // 学生编号
|
||||
name?: string; // 名字
|
||||
teacher?: string; // 班主任
|
||||
}
|
||||
|
||||
/** 学生信息 */
|
||||
export interface Demo03Student {
|
||||
id: number; // 编号
|
||||
name?: string; // 名字
|
||||
sex?: number; // 性别
|
||||
birthday?: Dayjs | string; // 出生日期
|
||||
description?: string; // 简介
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询学生分页 */
|
||||
export function getDemo03StudentPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<Demo03StudentApi.Demo03Student>>(
|
||||
'/infra/demo03-student-erp/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询学生详情 */
|
||||
export function getDemo03Student(id: number) {
|
||||
return requestClient.get<Demo03StudentApi.Demo03Student>(
|
||||
`/infra/demo03-student-erp/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增学生 */
|
||||
export function createDemo03Student(data: Demo03StudentApi.Demo03Student) {
|
||||
return requestClient.post('/infra/demo03-student-erp/create', data);
|
||||
}
|
||||
|
||||
/** 修改学生 */
|
||||
export function updateDemo03Student(data: Demo03StudentApi.Demo03Student) {
|
||||
return requestClient.put('/infra/demo03-student-erp/update', data);
|
||||
}
|
||||
|
||||
/** 删除学生 */
|
||||
export function deleteDemo03Student(id: number) {
|
||||
return requestClient.delete(`/infra/demo03-student-erp/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 批量删除学生 */
|
||||
export function deleteDemo03StudentList(ids: number[]) {
|
||||
return requestClient.delete(
|
||||
`/infra/demo03-student-erp/delete-list?ids=${ids.join(',')}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 导出学生 */
|
||||
export function exportDemo03Student(params: any) {
|
||||
return requestClient.download('/infra/demo03-student-erp/export-excel', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
// ==================== 子表(学生课程) ====================
|
||||
|
||||
/** 获得学生课程分页 */
|
||||
export function getDemo03CoursePage(params: PageParam) {
|
||||
return requestClient.get<PageResult<Demo03StudentApi.Demo03Course>>(
|
||||
`/infra/demo03-student-erp/demo03-course/page`,
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
/** 新增学生课程 */
|
||||
export function createDemo03Course(data: Demo03StudentApi.Demo03Course) {
|
||||
return requestClient.post(
|
||||
`/infra/demo03-student-erp/demo03-course/create`,
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
/** 修改学生课程 */
|
||||
export function updateDemo03Course(data: Demo03StudentApi.Demo03Course) {
|
||||
return requestClient.put(
|
||||
`/infra/demo03-student-erp/demo03-course/update`,
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
/** 删除学生课程 */
|
||||
export function deleteDemo03Course(id: number) {
|
||||
return requestClient.delete(
|
||||
`/infra/demo03-student-erp/demo03-course/delete?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 批量删除学生课程 */
|
||||
export function deleteDemo03CourseList(ids: number[]) {
|
||||
return requestClient.delete(
|
||||
`/infra/demo03-student-erp/demo03-course/delete-list?ids=${ids.join(',')}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 获得学生课程 */
|
||||
export function getDemo03Course(id: number) {
|
||||
return requestClient.get<Demo03StudentApi.Demo03Course>(
|
||||
`/infra/demo03-student-erp/demo03-course/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
// ==================== 子表(学生班级) ====================
|
||||
|
||||
/** 获得学生班级分页 */
|
||||
export function getDemo03GradePage(params: PageParam) {
|
||||
return requestClient.get<PageResult<Demo03StudentApi.Demo03Grade>>(
|
||||
`/infra/demo03-student-erp/demo03-grade/page`,
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
/** 新增学生班级 */
|
||||
export function createDemo03Grade(data: Demo03StudentApi.Demo03Grade) {
|
||||
return requestClient.post(
|
||||
`/infra/demo03-student-erp/demo03-grade/create`,
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
/** 修改学生班级 */
|
||||
export function updateDemo03Grade(data: Demo03StudentApi.Demo03Grade) {
|
||||
return requestClient.put(
|
||||
`/infra/demo03-student-erp/demo03-grade/update`,
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
/** 删除学生班级 */
|
||||
export function deleteDemo03Grade(id: number) {
|
||||
return requestClient.delete(
|
||||
`/infra/demo03-student-erp/demo03-grade/delete?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 批量删除学生班级 */
|
||||
export function deleteDemo03GradeList(ids: number[]) {
|
||||
return requestClient.delete(
|
||||
`/infra/demo03-student-erp/demo03-grade/delete-list?ids=${ids.join(',')}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 获得学生班级 */
|
||||
export function getDemo03Grade(id: number) {
|
||||
return requestClient.get<Demo03StudentApi.Demo03Grade>(
|
||||
`/infra/demo03-student-erp/demo03-grade/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
96
apps/web-antd/src/api/infra/demo/demo03/inner/index.ts
Normal file
96
apps/web-antd/src/api/infra/demo/demo03/inner/index.ts
Normal file
@@ -0,0 +1,96 @@
|
||||
import type { Dayjs } from 'dayjs';
|
||||
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace Demo03StudentApi {
|
||||
/** 学生课程信息 */
|
||||
export interface Demo03Course {
|
||||
id: number; // 编号
|
||||
studentId?: number; // 学生编号
|
||||
name?: string; // 名字
|
||||
score?: number; // 分数
|
||||
}
|
||||
|
||||
/** 学生班级信息 */
|
||||
export interface Demo03Grade {
|
||||
id: number; // 编号
|
||||
studentId?: number; // 学生编号
|
||||
name?: string; // 名字
|
||||
teacher?: string; // 班主任
|
||||
}
|
||||
|
||||
/** 学生信息 */
|
||||
export interface Demo03Student {
|
||||
id: number; // 编号
|
||||
name?: string; // 名字
|
||||
sex?: number; // 性别
|
||||
birthday?: Dayjs | string; // 出生日期
|
||||
description?: string; // 简介
|
||||
demo03courses?: Demo03Course[];
|
||||
demo03grade?: Demo03Grade;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询学生分页 */
|
||||
export function getDemo03StudentPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<Demo03StudentApi.Demo03Student>>(
|
||||
'/infra/demo03-student-inner/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询学生详情 */
|
||||
export function getDemo03Student(id: number) {
|
||||
return requestClient.get<Demo03StudentApi.Demo03Student>(
|
||||
`/infra/demo03-student-inner/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增学生 */
|
||||
export function createDemo03Student(data: Demo03StudentApi.Demo03Student) {
|
||||
return requestClient.post('/infra/demo03-student-inner/create', data);
|
||||
}
|
||||
|
||||
/** 修改学生 */
|
||||
export function updateDemo03Student(data: Demo03StudentApi.Demo03Student) {
|
||||
return requestClient.put('/infra/demo03-student-inner/update', data);
|
||||
}
|
||||
|
||||
/** 删除学生 */
|
||||
export function deleteDemo03Student(id: number) {
|
||||
return requestClient.delete(`/infra/demo03-student-inner/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 批量删除学生 */
|
||||
export function deleteDemo03StudentList(ids: number[]) {
|
||||
return requestClient.delete(
|
||||
`/infra/demo03-student-inner/delete-list?ids=${ids.join(',')}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 导出学生 */
|
||||
export function exportDemo03Student(params: any) {
|
||||
return requestClient.download('/infra/demo03-student-inner/export-excel', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
// ==================== 子表(学生课程) ====================
|
||||
|
||||
/** 获得学生课程列表 */
|
||||
export function getDemo03CourseListByStudentId(studentId: number) {
|
||||
return requestClient.get<Demo03StudentApi.Demo03Course[]>(
|
||||
`/infra/demo03-student-inner/demo03-course/list-by-student-id?studentId=${studentId}`,
|
||||
);
|
||||
}
|
||||
|
||||
// ==================== 子表(学生班级) ====================
|
||||
|
||||
/** 获得学生班级 */
|
||||
export function getDemo03GradeByStudentId(studentId: number) {
|
||||
return requestClient.get<Demo03StudentApi.Demo03Grade>(
|
||||
`/infra/demo03-student-inner/demo03-grade/get-by-student-id?studentId=${studentId}`,
|
||||
);
|
||||
}
|
||||
96
apps/web-antd/src/api/infra/demo/demo03/normal/index.ts
Normal file
96
apps/web-antd/src/api/infra/demo/demo03/normal/index.ts
Normal file
@@ -0,0 +1,96 @@
|
||||
import type { Dayjs } from 'dayjs';
|
||||
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace Demo03StudentApi {
|
||||
/** 学生课程信息 */
|
||||
export interface Demo03Course {
|
||||
id: number; // 编号
|
||||
studentId?: number; // 学生编号
|
||||
name?: string; // 名字
|
||||
score?: number; // 分数
|
||||
}
|
||||
|
||||
/** 学生班级信息 */
|
||||
export interface Demo03Grade {
|
||||
id: number; // 编号
|
||||
studentId?: number; // 学生编号
|
||||
name?: string; // 名字
|
||||
teacher?: string; // 班主任
|
||||
}
|
||||
|
||||
/** 学生信息 */
|
||||
export interface Demo03Student {
|
||||
id: number; // 编号
|
||||
name?: string; // 名字
|
||||
sex?: number; // 性别
|
||||
birthday?: Dayjs | string; // 出生日期
|
||||
description?: string; // 简介
|
||||
demo03courses?: Demo03Course[];
|
||||
demo03grade?: Demo03Grade;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询学生分页 */
|
||||
export function getDemo03StudentPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<Demo03StudentApi.Demo03Student>>(
|
||||
'/infra/demo03-student-normal/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询学生详情 */
|
||||
export function getDemo03Student(id: number) {
|
||||
return requestClient.get<Demo03StudentApi.Demo03Student>(
|
||||
`/infra/demo03-student-normal/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增学生 */
|
||||
export function createDemo03Student(data: Demo03StudentApi.Demo03Student) {
|
||||
return requestClient.post('/infra/demo03-student-normal/create', data);
|
||||
}
|
||||
|
||||
/** 修改学生 */
|
||||
export function updateDemo03Student(data: Demo03StudentApi.Demo03Student) {
|
||||
return requestClient.put('/infra/demo03-student-normal/update', data);
|
||||
}
|
||||
|
||||
/** 删除学生 */
|
||||
export function deleteDemo03Student(id: number) {
|
||||
return requestClient.delete(`/infra/demo03-student-normal/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 批量删除学生 */
|
||||
export function deleteDemo03StudentList(ids: number[]) {
|
||||
return requestClient.delete(
|
||||
`/infra/demo03-student-normal/delete-list?ids=${ids.join(',')}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 导出学生 */
|
||||
export function exportDemo03Student(params: any) {
|
||||
return requestClient.download('/infra/demo03-student-normal/export-excel', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
// ==================== 子表(学生课程) ====================
|
||||
|
||||
/** 获得学生课程列表 */
|
||||
export function getDemo03CourseListByStudentId(studentId: number) {
|
||||
return requestClient.get<Demo03StudentApi.Demo03Course[]>(
|
||||
`/infra/demo03-student-normal/demo03-course/list-by-student-id?studentId=${studentId}`,
|
||||
);
|
||||
}
|
||||
|
||||
// ==================== 子表(学生班级) ====================
|
||||
|
||||
/** 获得学生班级 */
|
||||
export function getDemo03GradeByStudentId(studentId: number) {
|
||||
return requestClient.get<Demo03StudentApi.Demo03Grade>(
|
||||
`/infra/demo03-student-normal/demo03-grade/get-by-student-id?studentId=${studentId}`,
|
||||
);
|
||||
}
|
||||
83
apps/web-antd/src/api/infra/file-config/index.ts
Normal file
83
apps/web-antd/src/api/infra/file-config/index.ts
Normal file
@@ -0,0 +1,83 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace InfraFileConfigApi {
|
||||
/** 文件客户端配置 */
|
||||
export interface FileClientConfig {
|
||||
basePath: string;
|
||||
host?: string;
|
||||
port?: number;
|
||||
username?: string;
|
||||
password?: string;
|
||||
mode?: string;
|
||||
endpoint?: string;
|
||||
bucket?: string;
|
||||
accessKey?: string;
|
||||
accessSecret?: string;
|
||||
pathStyle?: boolean;
|
||||
enablePublicAccess?: boolean;
|
||||
domain: string;
|
||||
}
|
||||
|
||||
/** 文件配置信息 */
|
||||
export interface FileConfig {
|
||||
id?: number;
|
||||
name: string;
|
||||
storage?: number;
|
||||
master: boolean;
|
||||
visible: boolean;
|
||||
config: FileClientConfig;
|
||||
remark: string;
|
||||
createTime?: Date;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询文件配置列表 */
|
||||
export function getFileConfigPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<InfraFileConfigApi.FileConfig>>(
|
||||
'/infra/file-config/page',
|
||||
{
|
||||
params,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询文件配置详情 */
|
||||
export function getFileConfig(id: number) {
|
||||
return requestClient.get<InfraFileConfigApi.FileConfig>(
|
||||
`/infra/file-config/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 更新文件配置为主配置 */
|
||||
export function updateFileConfigMaster(id: number) {
|
||||
return requestClient.put(`/infra/file-config/update-master?id=${id}`);
|
||||
}
|
||||
|
||||
/** 新增文件配置 */
|
||||
export function createFileConfig(data: InfraFileConfigApi.FileConfig) {
|
||||
return requestClient.post('/infra/file-config/create', data);
|
||||
}
|
||||
|
||||
/** 修改文件配置 */
|
||||
export function updateFileConfig(data: InfraFileConfigApi.FileConfig) {
|
||||
return requestClient.put('/infra/file-config/update', data);
|
||||
}
|
||||
|
||||
/** 删除文件配置 */
|
||||
export function deleteFileConfig(id: number) {
|
||||
return requestClient.delete(`/infra/file-config/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 批量删除文件配置 */
|
||||
export function deleteFileConfigList(ids: number[]) {
|
||||
return requestClient.delete(
|
||||
`/infra/file-config/delete-list?ids=${ids.join(',')}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 测试文件配置 */
|
||||
export function testFileConfig(id: number) {
|
||||
return requestClient.get(`/infra/file-config/test?id=${id}`);
|
||||
}
|
||||
78
apps/web-antd/src/api/infra/file/index.ts
Normal file
78
apps/web-antd/src/api/infra/file/index.ts
Normal file
@@ -0,0 +1,78 @@
|
||||
import type { AxiosRequestConfig, PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
/** Axios 上传进度事件 */
|
||||
export type AxiosProgressEvent = AxiosRequestConfig['onUploadProgress'];
|
||||
|
||||
export namespace InfraFileApi {
|
||||
/** 文件信息 */
|
||||
export interface File {
|
||||
id?: number;
|
||||
configId?: number;
|
||||
path: string;
|
||||
name?: string;
|
||||
url?: string;
|
||||
size?: number;
|
||||
type?: string;
|
||||
createTime?: Date;
|
||||
}
|
||||
|
||||
/** 文件预签名地址 */
|
||||
export interface FilePresignedUrlRespVO {
|
||||
configId: number; // 文件配置编号
|
||||
uploadUrl: string; // 文件上传 URL
|
||||
url: string; // 文件 URL
|
||||
path: string; // 文件路径
|
||||
}
|
||||
|
||||
/** 上传文件 */
|
||||
export interface FileUploadReqVO {
|
||||
file: globalThis.File;
|
||||
directory?: string;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询文件列表 */
|
||||
export function getFilePage(params: PageParam) {
|
||||
return requestClient.get<PageResult<InfraFileApi.File>>('/infra/file/page', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除文件 */
|
||||
export function deleteFile(id: number) {
|
||||
return requestClient.delete(`/infra/file/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 批量删除文件 */
|
||||
export function deleteFileList(ids: number[]) {
|
||||
return requestClient.delete(`/infra/file/delete-list?ids=${ids.join(',')}`);
|
||||
}
|
||||
|
||||
/** 获取文件预签名地址 */
|
||||
export function getFilePresignedUrl(name: string, directory?: string) {
|
||||
return requestClient.get<InfraFileApi.FilePresignedUrlRespVO>(
|
||||
'/infra/file/presigned-url',
|
||||
{
|
||||
params: { name, directory },
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** 创建文件 */
|
||||
export function createFile(data: InfraFileApi.File) {
|
||||
return requestClient.post('/infra/file/create', data);
|
||||
}
|
||||
|
||||
/** 上传文件 */
|
||||
export function uploadFile(
|
||||
data: InfraFileApi.FileUploadReqVO,
|
||||
onUploadProgress?: AxiosProgressEvent,
|
||||
) {
|
||||
// 特殊:由于 upload 内部封装,即使 directory 为 undefined,也会传递给后端
|
||||
if (!data.directory) {
|
||||
delete data.directory;
|
||||
}
|
||||
return requestClient.upload('/infra/file/upload', data, { onUploadProgress });
|
||||
}
|
||||
77
apps/web-antd/src/api/infra/job/index.ts
Normal file
77
apps/web-antd/src/api/infra/job/index.ts
Normal file
@@ -0,0 +1,77 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace InfraJobApi {
|
||||
/** 任务信息 */
|
||||
export interface Job {
|
||||
id?: number;
|
||||
name: string;
|
||||
status: number;
|
||||
handlerName: string;
|
||||
handlerParam: string;
|
||||
cronExpression: string;
|
||||
retryCount: number;
|
||||
retryInterval: number;
|
||||
monitorTimeout: number;
|
||||
createTime?: Date;
|
||||
nextTimes?: Date[];
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询任务列表 */
|
||||
export function getJobPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<InfraJobApi.Job>>('/infra/job/page', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/** 查询任务详情 */
|
||||
export function getJob(id: number) {
|
||||
return requestClient.get<InfraJobApi.Job>(`/infra/job/get?id=${id}`);
|
||||
}
|
||||
|
||||
/** 新增任务 */
|
||||
export function createJob(data: InfraJobApi.Job) {
|
||||
return requestClient.post('/infra/job/create', data);
|
||||
}
|
||||
|
||||
/** 修改定时任务调度 */
|
||||
export function updateJob(data: InfraJobApi.Job) {
|
||||
return requestClient.put('/infra/job/update', data);
|
||||
}
|
||||
|
||||
/** 删除定时任务调度 */
|
||||
export function deleteJob(id: number) {
|
||||
return requestClient.delete(`/infra/job/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 批量删除定时任务调度 */
|
||||
export function deleteJobList(ids: number[]) {
|
||||
return requestClient.delete(`/infra/job/delete-list?ids=${ids.join(',')}`);
|
||||
}
|
||||
|
||||
/** 导出定时任务调度 */
|
||||
export function exportJob(params: any) {
|
||||
return requestClient.download('/infra/job/export-excel', { params });
|
||||
}
|
||||
|
||||
/** 任务状态修改 */
|
||||
export function updateJobStatus(id: number, status: number) {
|
||||
return requestClient.put('/infra/job/update-status', undefined, {
|
||||
params: {
|
||||
id,
|
||||
status,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/** 定时任务立即执行一次 */
|
||||
export function runJob(id: number) {
|
||||
return requestClient.put(`/infra/job/trigger?id=${id}`);
|
||||
}
|
||||
|
||||
/** 获得定时任务的下 n 次执行时间 */
|
||||
export function getJobNextTimes(id: number) {
|
||||
return requestClient.get(`/infra/job/get_next_times?id=${id}`);
|
||||
}
|
||||
94
apps/web-antd/src/api/iot/alert/config/index.ts
Normal file
94
apps/web-antd/src/api/iot/alert/config/index.ts
Normal file
@@ -0,0 +1,94 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace AlertConfigApi {
|
||||
/** IoT 告警配置 VO */
|
||||
export interface AlertConfig {
|
||||
id?: number;
|
||||
name: string;
|
||||
description?: string;
|
||||
level?: number;
|
||||
status?: number;
|
||||
sceneRuleIds?: number[];
|
||||
receiveUserIds?: number[];
|
||||
receiveUserNames?: string;
|
||||
receiveTypes?: number[];
|
||||
createTime?: Date;
|
||||
updateTime?: Date;
|
||||
}
|
||||
}
|
||||
|
||||
/** IoT 告警配置 */
|
||||
export interface AlertConfig {
|
||||
id?: number;
|
||||
name?: string;
|
||||
description?: string;
|
||||
level?: number;
|
||||
status?: number;
|
||||
sceneRuleIds?: number[];
|
||||
receiveUserIds?: number[];
|
||||
receiveUserNames?: string;
|
||||
receiveTypes?: number[];
|
||||
createTime?: Date;
|
||||
updateTime?: Date;
|
||||
}
|
||||
|
||||
/** 查询告警配置分页 */
|
||||
export function getAlertConfigPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<AlertConfigApi.AlertConfig>>(
|
||||
'/iot/alert-config/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询告警配置详情 */
|
||||
export function getAlertConfig(id: number) {
|
||||
return requestClient.get<AlertConfigApi.AlertConfig>(
|
||||
`/iot/alert-config/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询所有告警配置列表 */
|
||||
export function getAlertConfigList() {
|
||||
return requestClient.get<AlertConfigApi.AlertConfig[]>(
|
||||
'/iot/alert-config/list',
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增告警配置 */
|
||||
export function createAlertConfig(data: AlertConfig) {
|
||||
return requestClient.post('/iot/alert-config/create', data);
|
||||
}
|
||||
|
||||
/** 修改告警配置 */
|
||||
export function updateAlertConfig(data: AlertConfig) {
|
||||
return requestClient.put('/iot/alert-config/update', data);
|
||||
}
|
||||
|
||||
/** 删除告警配置 */
|
||||
export function deleteAlertConfig(id: number) {
|
||||
return requestClient.delete(`/iot/alert-config/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 批量删除告警配置 */
|
||||
export function deleteAlertConfigList(ids: number[]) {
|
||||
return requestClient.delete('/iot/alert-config/delete-list', {
|
||||
params: { ids: ids.join(',') },
|
||||
});
|
||||
}
|
||||
|
||||
/** 启用/禁用告警配置 */
|
||||
export function toggleAlertConfig(id: number, enabled: boolean) {
|
||||
return requestClient.put(`/iot/alert-config/toggle`, {
|
||||
id,
|
||||
enabled,
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取告警配置简单列表 */
|
||||
export function getSimpleAlertConfigList() {
|
||||
return requestClient.get<AlertConfigApi.AlertConfig[]>(
|
||||
'/iot/alert-config/simple-list',
|
||||
);
|
||||
}
|
||||
82
apps/web-antd/src/api/iot/alert/record/index.ts
Normal file
82
apps/web-antd/src/api/iot/alert/record/index.ts
Normal file
@@ -0,0 +1,82 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace AlertRecordApi {
|
||||
/** IoT 告警记录 VO */
|
||||
export interface AlertRecord {
|
||||
id?: number;
|
||||
configId?: number;
|
||||
configName?: string;
|
||||
configLevel?: number;
|
||||
deviceId?: number;
|
||||
deviceName?: string;
|
||||
productId?: number;
|
||||
productName?: string;
|
||||
deviceMessage?: string;
|
||||
processStatus?: boolean;
|
||||
processRemark?: string;
|
||||
processTime?: Date;
|
||||
createTime?: Date;
|
||||
}
|
||||
}
|
||||
|
||||
/** IoT 告警记录 */
|
||||
export interface AlertRecord {
|
||||
id?: number;
|
||||
configId?: number;
|
||||
configName?: string;
|
||||
configLevel?: number;
|
||||
deviceId?: number;
|
||||
deviceName?: string;
|
||||
productId?: number;
|
||||
productName?: string;
|
||||
deviceMessage?: string;
|
||||
processStatus?: boolean;
|
||||
processRemark?: string;
|
||||
processTime?: Date;
|
||||
createTime?: Date;
|
||||
}
|
||||
|
||||
/** 查询告警记录分页 */
|
||||
export function getAlertRecordPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<AlertRecordApi.AlertRecord>>(
|
||||
'/iot/alert-record/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询告警记录详情 */
|
||||
export function getAlertRecord(id: number) {
|
||||
return requestClient.get<AlertRecordApi.AlertRecord>(
|
||||
`/iot/alert-record/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 处理告警记录 */
|
||||
export function processAlertRecord(id: number, remark?: string) {
|
||||
return requestClient.put('/iot/alert-record/process', {
|
||||
id,
|
||||
remark,
|
||||
});
|
||||
}
|
||||
|
||||
/** 批量处理告警记录 */
|
||||
export function batchProcessAlertRecord(ids: number[], remark?: string) {
|
||||
return requestClient.put('/iot/alert-record/batch-process', {
|
||||
ids,
|
||||
remark,
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除告警记录 */
|
||||
export function deleteAlertRecord(id: number) {
|
||||
return requestClient.delete(`/iot/alert-record/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 批量删除告警记录 */
|
||||
export function deleteAlertRecordList(ids: number[]) {
|
||||
return requestClient.delete('/iot/alert-record/delete-list', {
|
||||
params: { ids: ids.join(',') },
|
||||
});
|
||||
}
|
||||
198
apps/web-antd/src/api/iot/device/device/index.ts
Normal file
198
apps/web-antd/src/api/iot/device/device/index.ts
Normal file
@@ -0,0 +1,198 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace IotDeviceApi {
|
||||
// TODO @haohao:需要跟后端对齐,必要的 ReqVO、RespVO
|
||||
/** 设备 */
|
||||
export interface Device {
|
||||
id?: number; // 设备 ID,主键,自增
|
||||
deviceName: string; // 设备名称
|
||||
productId: number; // 产品编号
|
||||
productKey?: string; // 产品标识
|
||||
deviceType?: number; // 设备类型
|
||||
nickname?: string; // 设备备注名称
|
||||
gatewayId?: number; // 网关设备 ID
|
||||
state?: number; // 设备状态
|
||||
status?: number; // 设备状态(兼容字段)
|
||||
onlineTime?: Date; // 最后上线时间
|
||||
offlineTime?: Date; // 最后离线时间
|
||||
activeTime?: Date; // 设备激活时间
|
||||
createTime?: Date; // 创建时间
|
||||
ip?: string; // 设备的 IP 地址
|
||||
firmwareVersion?: string; // 设备的固件版本
|
||||
deviceSecret?: string; // 设备密钥,用于设备认证,需安全存储
|
||||
mqttClientId?: string; // MQTT 客户端 ID
|
||||
mqttUsername?: string; // MQTT 用户名
|
||||
mqttPassword?: string; // MQTT 密码
|
||||
authType?: string; // 认证类型
|
||||
locationType?: number; // 定位类型
|
||||
latitude?: number; // 设备位置的纬度
|
||||
longitude?: number; // 设备位置的经度
|
||||
areaId?: number; // 地区编码
|
||||
address?: string; // 设备详细地址
|
||||
serialNumber?: string; // 设备序列号
|
||||
config?: string; // 设备配置
|
||||
groupIds?: number[]; // 添加分组 ID
|
||||
picUrl?: string; // 设备图片
|
||||
location?: string; // 位置信息(格式:经度,纬度)
|
||||
}
|
||||
|
||||
/** IoT 设备属性详细 VO */
|
||||
export interface DevicePropertyDetail {
|
||||
identifier: string; // 属性标识符
|
||||
value: string; // 最新值
|
||||
updateTime: Date; // 更新时间
|
||||
name: string; // 属性名称
|
||||
dataType: string; // 数据类型
|
||||
dataSpecs: any; // 数据定义
|
||||
dataSpecsList: any[]; // 数据定义列表
|
||||
}
|
||||
|
||||
/** 设备属性 VO */
|
||||
export interface DeviceProperty {
|
||||
identifier: string; // 属性标识符
|
||||
value: string; // 最新值
|
||||
updateTime: Date; // 更新时间
|
||||
}
|
||||
|
||||
/** 设备认证参数 VO */
|
||||
export interface DeviceAuthInfo {
|
||||
clientId: string; // 客户端 ID
|
||||
username: string; // 用户名
|
||||
password: string; // 密码
|
||||
}
|
||||
|
||||
/** 设备发送消息 Request VO */
|
||||
export interface DeviceMessageSendReq {
|
||||
deviceId: number; // 设备编号
|
||||
method: string; // 请求方法
|
||||
params?: any; // 请求参数
|
||||
}
|
||||
|
||||
/** 设备分组更新请求 */
|
||||
export interface DeviceGroupUpdateReq {
|
||||
ids: number[]; // 设备 ID 列表
|
||||
groupIds: number[]; // 分组 ID 列表
|
||||
}
|
||||
}
|
||||
|
||||
/** IoT 设备状态枚举 */
|
||||
// TODO @haohao:packages/constants/src/biz-iot-enum.ts 枚举;
|
||||
export enum DeviceStateEnum {
|
||||
INACTIVE = 0, // 未激活
|
||||
OFFLINE = 2, // 离线
|
||||
ONLINE = 1, // 在线
|
||||
}
|
||||
|
||||
/** 查询设备分页 */
|
||||
export function getDevicePage(params: PageParam) {
|
||||
return requestClient.get<PageResult<IotDeviceApi.Device>>(
|
||||
'/iot/device/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询设备详情 */
|
||||
export function getDevice(id: number) {
|
||||
return requestClient.get<IotDeviceApi.Device>(`/iot/device/get?id=${id}`);
|
||||
}
|
||||
|
||||
/** 新增设备 */
|
||||
export function createDevice(data: IotDeviceApi.Device) {
|
||||
return requestClient.post('/iot/device/create', data);
|
||||
}
|
||||
|
||||
/** 修改设备 */
|
||||
export function updateDevice(data: IotDeviceApi.Device) {
|
||||
return requestClient.put('/iot/device/update', data);
|
||||
}
|
||||
|
||||
/** 修改设备分组 */
|
||||
export function updateDeviceGroup(data: IotDeviceApi.DeviceGroupUpdateReq) {
|
||||
return requestClient.put('/iot/device/update-group', data);
|
||||
}
|
||||
|
||||
/** 删除单个设备 */
|
||||
export function deleteDevice(id: number) {
|
||||
return requestClient.delete(`/iot/device/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 删除多个设备 */
|
||||
export function deleteDeviceList(ids: number[]) {
|
||||
return requestClient.delete('/iot/device/delete-list', {
|
||||
params: { ids: ids.join(',') },
|
||||
});
|
||||
}
|
||||
|
||||
/** 导出设备 */
|
||||
export function exportDeviceExcel(params: any) {
|
||||
return requestClient.download('/iot/device/export-excel', { params });
|
||||
}
|
||||
|
||||
/** 获取设备数量 */
|
||||
export function getDeviceCount(productId: number) {
|
||||
return requestClient.get<number>(`/iot/device/count?productId=${productId}`);
|
||||
}
|
||||
|
||||
/** 获取设备的精简信息列表 */
|
||||
export function getSimpleDeviceList(deviceType?: number, productId?: number) {
|
||||
return requestClient.get<IotDeviceApi.Device[]>('/iot/device/simple-list', {
|
||||
params: { deviceType, productId },
|
||||
});
|
||||
}
|
||||
|
||||
/** 根据产品编号,获取设备的精简信息列表 */
|
||||
export function getDeviceListByProductId(productId: number) {
|
||||
return requestClient.get<IotDeviceApi.Device[]>('/iot/device/simple-list', {
|
||||
params: { productId },
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取导入模板 */
|
||||
export function importDeviceTemplate() {
|
||||
return requestClient.download('/iot/device/get-import-template');
|
||||
}
|
||||
|
||||
/** 获取设备属性最新数据 */
|
||||
export function getLatestDeviceProperties(params: any) {
|
||||
return requestClient.get<IotDeviceApi.DevicePropertyDetail[]>(
|
||||
'/iot/device/property/get-latest',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 获取设备属性历史数据 */
|
||||
export function getHistoryDevicePropertyList(params: any) {
|
||||
return requestClient.get<PageResult<IotDeviceApi.DeviceProperty>>(
|
||||
'/iot/device/property/history-list',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 获取设备认证信息 */
|
||||
export function getDeviceAuthInfo(id: number) {
|
||||
return requestClient.get<IotDeviceApi.DeviceAuthInfo>(
|
||||
'/iot/device/get-auth-info',
|
||||
{ params: { id } },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询设备消息分页 */
|
||||
export function getDeviceMessagePage(params: PageParam) {
|
||||
return requestClient.get<PageResult<any>>('/iot/device/message/page', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/** 查询设备消息配对分页 */
|
||||
export function getDeviceMessagePairPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<any>>('/iot/device/message/pair-page', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/** 发送设备消息 */
|
||||
export function sendDeviceMessage(params: IotDeviceApi.DeviceMessageSendReq) {
|
||||
return requestClient.post('/iot/device/message/send', params);
|
||||
}
|
||||
51
apps/web-antd/src/api/iot/device/group/index.ts
Normal file
51
apps/web-antd/src/api/iot/device/group/index.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace IotDeviceGroupApi {
|
||||
/** 设备分组 */
|
||||
export interface DeviceGroup {
|
||||
id?: number; // 分组 ID
|
||||
name: string; // 分组名字
|
||||
status?: number; // 分组状态
|
||||
description?: string; // 分组描述
|
||||
deviceCount?: number; // 设备数量
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询设备分组分页 */
|
||||
export function getDeviceGroupPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<IotDeviceGroupApi.DeviceGroup>>(
|
||||
'/iot/device-group/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询设备分组详情 */
|
||||
export function getDeviceGroup(id: number) {
|
||||
return requestClient.get<IotDeviceGroupApi.DeviceGroup>(
|
||||
`/iot/device-group/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增设备分组 */
|
||||
export function createDeviceGroup(data: IotDeviceGroupApi.DeviceGroup) {
|
||||
return requestClient.post('/iot/device-group/create', data);
|
||||
}
|
||||
|
||||
/** 修改设备分组 */
|
||||
export function updateDeviceGroup(data: IotDeviceGroupApi.DeviceGroup) {
|
||||
return requestClient.put('/iot/device-group/update', data);
|
||||
}
|
||||
|
||||
/** 删除设备分组 */
|
||||
export function deleteDeviceGroup(id: number) {
|
||||
return requestClient.delete(`/iot/device-group/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 获取设备分组的精简信息列表 */
|
||||
export function getSimpleDeviceGroupList() {
|
||||
return requestClient.get<IotDeviceGroupApi.DeviceGroup[]>(
|
||||
'/iot/device-group/simple-list',
|
||||
);
|
||||
}
|
||||
90
apps/web-antd/src/api/iot/ota/firmware/index.ts
Normal file
90
apps/web-antd/src/api/iot/ota/firmware/index.ts
Normal file
@@ -0,0 +1,90 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace IoTOtaFirmwareApi {
|
||||
/** IoT OTA 固件 VO */
|
||||
export interface Firmware {
|
||||
id?: number;
|
||||
name: string;
|
||||
version: string;
|
||||
productId: number;
|
||||
productName?: string;
|
||||
description?: string;
|
||||
fileUrl?: string;
|
||||
fileMd5?: string;
|
||||
fileSize?: number;
|
||||
status?: number;
|
||||
createTime?: Date;
|
||||
updateTime?: Date;
|
||||
}
|
||||
}
|
||||
|
||||
/** IoT OTA 固件 */
|
||||
export interface IoTOtaFirmware {
|
||||
id?: number;
|
||||
name?: string;
|
||||
version?: string;
|
||||
productId?: number;
|
||||
productName?: string;
|
||||
description?: string;
|
||||
fileUrl?: string;
|
||||
fileMd5?: string;
|
||||
fileSize?: number;
|
||||
status?: number;
|
||||
createTime?: Date;
|
||||
updateTime?: Date;
|
||||
}
|
||||
|
||||
/** 查询 OTA 固件分页 */
|
||||
export function getOtaFirmwarePage(params: PageParam) {
|
||||
return requestClient.get<PageResult<IoTOtaFirmwareApi.Firmware>>(
|
||||
'/iot/ota/firmware/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询 OTA 固件详情 */
|
||||
export function getOtaFirmware(id: number) {
|
||||
return requestClient.get<IoTOtaFirmwareApi.Firmware>(
|
||||
`/iot/ota/firmware/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增 OTA 固件 */
|
||||
export function createOtaFirmware(data: IoTOtaFirmware) {
|
||||
return requestClient.post('/iot/ota/firmware/create', data);
|
||||
}
|
||||
|
||||
/** 修改 OTA 固件 */
|
||||
export function updateOtaFirmware(data: IoTOtaFirmware) {
|
||||
return requestClient.put('/iot/ota/firmware/update', data);
|
||||
}
|
||||
|
||||
/** 删除 OTA 固件 */
|
||||
export function deleteOtaFirmware(id: number) {
|
||||
return requestClient.delete(`/iot/ota/firmware/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 批量删除 OTA 固件 */
|
||||
export function deleteOtaFirmwareList(ids: number[]) {
|
||||
return requestClient.delete('/iot/ota/firmware/delete-list', {
|
||||
params: { ids: ids.join(',') },
|
||||
});
|
||||
}
|
||||
|
||||
/** 更新 OTA 固件状态 */
|
||||
export function updateOtaFirmwareStatus(id: number, status: number) {
|
||||
return requestClient.put(`/iot/ota/firmware/update-status`, {
|
||||
id,
|
||||
status,
|
||||
});
|
||||
}
|
||||
|
||||
/** 根据产品 ID 查询固件列表 */
|
||||
export function getOtaFirmwareListByProductId(productId: number) {
|
||||
return requestClient.get<IoTOtaFirmwareApi.Firmware[]>(
|
||||
'/iot/ota/firmware/list-by-product-id',
|
||||
{ params: { productId } },
|
||||
);
|
||||
}
|
||||
98
apps/web-antd/src/api/iot/ota/task/index.ts
Normal file
98
apps/web-antd/src/api/iot/ota/task/index.ts
Normal file
@@ -0,0 +1,98 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace IoTOtaTaskApi {
|
||||
/** IoT OTA 升级任务 VO */
|
||||
export interface Task {
|
||||
id?: number;
|
||||
name: string;
|
||||
description?: string;
|
||||
firmwareId: number;
|
||||
firmwareName?: string;
|
||||
productId?: number;
|
||||
productName?: string;
|
||||
deviceScope?: number;
|
||||
deviceIds?: number[];
|
||||
status?: number;
|
||||
successCount?: number;
|
||||
failureCount?: number;
|
||||
pendingCount?: number;
|
||||
createTime?: Date;
|
||||
updateTime?: Date;
|
||||
}
|
||||
}
|
||||
|
||||
/** IoT OTA 升级任务 */
|
||||
export interface OtaTask {
|
||||
id?: number;
|
||||
name?: string;
|
||||
description?: string;
|
||||
firmwareId?: number;
|
||||
firmwareName?: string;
|
||||
productId?: number;
|
||||
productName?: string;
|
||||
deviceScope?: number;
|
||||
deviceIds?: number[];
|
||||
status?: number;
|
||||
successCount?: number;
|
||||
failureCount?: number;
|
||||
pendingCount?: number;
|
||||
createTime?: Date;
|
||||
updateTime?: Date;
|
||||
}
|
||||
|
||||
/** 查询 OTA 升级任务分页 */
|
||||
export function getOtaTaskPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<IoTOtaTaskApi.Task>>(
|
||||
'/iot/ota/task/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询 OTA 升级任务详情 */
|
||||
export function getOtaTask(id: number) {
|
||||
return requestClient.get<IoTOtaTaskApi.Task>(`/iot/ota/task/get?id=${id}`);
|
||||
}
|
||||
|
||||
/** 新增 OTA 升级任务 */
|
||||
export function createOtaTask(data: OtaTask) {
|
||||
return requestClient.post('/iot/ota/task/create', data);
|
||||
}
|
||||
|
||||
/** 修改 OTA 升级任务 */
|
||||
export function updateOtaTask(data: OtaTask) {
|
||||
return requestClient.put('/iot/ota/task/update', data);
|
||||
}
|
||||
|
||||
/** 删除 OTA 升级任务 */
|
||||
export function deleteOtaTask(id: number) {
|
||||
return requestClient.delete(`/iot/ota/task/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 批量删除 OTA 升级任务 */
|
||||
export function deleteOtaTaskList(ids: number[]) {
|
||||
return requestClient.delete('/iot/ota/task/delete-list', {
|
||||
params: { ids: ids.join(',') },
|
||||
});
|
||||
}
|
||||
|
||||
/** 取消 OTA 升级任务 */
|
||||
export function cancelOtaTask(id: number) {
|
||||
return requestClient.put(`/iot/ota/task/cancel?id=${id}`);
|
||||
}
|
||||
|
||||
/** 启动 OTA 升级任务 */
|
||||
export function startOtaTask(id: number) {
|
||||
return requestClient.put(`/iot/ota/task/start?id=${id}`);
|
||||
}
|
||||
|
||||
/** 暂停 OTA 升级任务 */
|
||||
export function pauseOtaTask(id: number) {
|
||||
return requestClient.put(`/iot/ota/task/pause?id=${id}`);
|
||||
}
|
||||
|
||||
/** 恢复 OTA 升级任务 */
|
||||
export function resumeOtaTask(id: number) {
|
||||
return requestClient.put(`/iot/ota/task/resume?id=${id}`);
|
||||
}
|
||||
102
apps/web-antd/src/api/iot/ota/task/record/index.ts
Normal file
102
apps/web-antd/src/api/iot/ota/task/record/index.ts
Normal file
@@ -0,0 +1,102 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace IoTOtaTaskRecordApi {
|
||||
/** IoT OTA 升级任务记录 VO */
|
||||
export interface TaskRecord {
|
||||
id?: number;
|
||||
taskId: number;
|
||||
taskName?: string;
|
||||
deviceId: number;
|
||||
deviceName?: string;
|
||||
firmwareId?: number;
|
||||
firmwareName?: string;
|
||||
firmwareVersion?: string;
|
||||
status?: number;
|
||||
progress?: number;
|
||||
errorMessage?: string;
|
||||
startTime?: Date;
|
||||
endTime?: Date;
|
||||
createTime?: Date;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO @AI:这里应该拿到 IoTOtaTaskRecordApi 里
|
||||
/** IoT OTA 升级任务记录 */
|
||||
export interface OtaTaskRecord {
|
||||
id?: number;
|
||||
taskId?: number;
|
||||
taskName?: string;
|
||||
deviceId?: number;
|
||||
deviceName?: string;
|
||||
firmwareId?: number;
|
||||
firmwareName?: string;
|
||||
firmwareVersion?: string;
|
||||
status?: number;
|
||||
progress?: number;
|
||||
errorMessage?: string;
|
||||
startTime?: Date;
|
||||
endTime?: Date;
|
||||
createTime?: Date;
|
||||
}
|
||||
|
||||
/** 查询 OTA 升级任务记录分页 */
|
||||
export function getOtaTaskRecordPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<IoTOtaTaskRecordApi.TaskRecord>>(
|
||||
'/iot/ota/task/record/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询 OTA 升级任务记录详情 */
|
||||
export function getOtaTaskRecord(id: number) {
|
||||
return requestClient.get<IoTOtaTaskRecordApi.TaskRecord>(
|
||||
`/iot/ota/task/record/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 根据任务 ID 查询记录列表 */
|
||||
export function getOtaTaskRecordListByTaskId(taskId: number) {
|
||||
return requestClient.get<IoTOtaTaskRecordApi.TaskRecord[]>(
|
||||
'/iot/ota/task/record/list-by-task-id',
|
||||
{ params: { taskId } },
|
||||
);
|
||||
}
|
||||
|
||||
/** 根据设备 ID 查询记录列表 */
|
||||
export function getOtaTaskRecordListByDeviceId(deviceId: number) {
|
||||
return requestClient.get<IoTOtaTaskRecordApi.TaskRecord[]>(
|
||||
'/iot/ota/task/record/list-by-device-id',
|
||||
{ params: { deviceId } },
|
||||
);
|
||||
}
|
||||
|
||||
/** 根据固件 ID 查询记录列表 */
|
||||
export function getOtaTaskRecordListByFirmwareId(firmwareId: number) {
|
||||
return requestClient.get<IoTOtaTaskRecordApi.TaskRecord[]>(
|
||||
'/iot/ota/task/record/list-by-firmware-id',
|
||||
{ params: { firmwareId } },
|
||||
);
|
||||
}
|
||||
|
||||
/** 重试升级任务记录 */
|
||||
export function retryOtaTaskRecord(id: number) {
|
||||
return requestClient.put(`/iot/ota/task/record/retry?id=${id}`);
|
||||
}
|
||||
|
||||
/** 取消升级任务记录 */
|
||||
export function cancelOtaTaskRecord(id: number) {
|
||||
return requestClient.put(`/iot/ota/task/record/cancel?id=${id}`);
|
||||
}
|
||||
|
||||
/** 获取升级任务记录状态统计 */
|
||||
export function getOtaTaskRecordStatusStatistics(
|
||||
firmwareId?: number,
|
||||
taskId?: number,
|
||||
) {
|
||||
return requestClient.get<Record<string, number>>(
|
||||
'/iot/ota/task/record/get-status-statistics',
|
||||
{ params: { firmwareId, taskId } },
|
||||
);
|
||||
}
|
||||
57
apps/web-antd/src/api/iot/product/category/index.ts
Normal file
57
apps/web-antd/src/api/iot/product/category/index.ts
Normal file
@@ -0,0 +1,57 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace IotProductCategoryApi {
|
||||
/** 产品分类 */
|
||||
export interface ProductCategory {
|
||||
id?: number; // 分类 ID
|
||||
name: string; // 分类名称
|
||||
parentId?: number; // 父级分类 ID
|
||||
sort?: number; // 分类排序
|
||||
status?: number; // 分类状态
|
||||
description?: string; // 分类描述
|
||||
createTime?: string; // 创建时间
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询产品分类分页 */
|
||||
export function getProductCategoryPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<IotProductCategoryApi.ProductCategory>>(
|
||||
'/iot/product-category/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询产品分类详情 */
|
||||
export function getProductCategory(id: number) {
|
||||
return requestClient.get<IotProductCategoryApi.ProductCategory>(
|
||||
`/iot/product-category/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增产品分类 */
|
||||
export function createProductCategory(
|
||||
data: IotProductCategoryApi.ProductCategory,
|
||||
) {
|
||||
return requestClient.post('/iot/product-category/create', data);
|
||||
}
|
||||
|
||||
/** 修改产品分类 */
|
||||
export function updateProductCategory(
|
||||
data: IotProductCategoryApi.ProductCategory,
|
||||
) {
|
||||
return requestClient.put('/iot/product-category/update', data);
|
||||
}
|
||||
|
||||
/** 刪除产品分类 */
|
||||
export function deleteProductCategory(id: number) {
|
||||
return requestClient.delete(`/iot/product-category/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 获取产品分类精简列表 */
|
||||
export function getSimpleProductCategoryList() {
|
||||
return requestClient.get<IotProductCategoryApi.ProductCategory[]>(
|
||||
'/iot/product-category/simple-list',
|
||||
);
|
||||
}
|
||||
101
apps/web-antd/src/api/iot/product/product/index.ts
Normal file
101
apps/web-antd/src/api/iot/product/product/index.ts
Normal file
@@ -0,0 +1,101 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace IotProductApi {
|
||||
/** 产品 */
|
||||
export interface Product {
|
||||
id?: number; // 产品编号
|
||||
name: string; // 产品名称
|
||||
productKey?: string; // 产品标识
|
||||
protocolId?: number; // 协议编号
|
||||
protocolType?: number; // 接入协议类型
|
||||
categoryId?: number; // 产品所属品类标识符
|
||||
categoryName?: string; // 产品所属品类名称
|
||||
icon?: string; // 产品图标
|
||||
picUrl?: string; // 产品图片
|
||||
description?: string; // 产品描述
|
||||
status?: number; // 产品状态
|
||||
deviceType?: number; // 设备类型
|
||||
locationType?: number; // 定位类型
|
||||
netType?: number; // 联网方式
|
||||
codecType?: string; // 数据格式(编解码器类型)
|
||||
dataFormat?: number; // 数据格式
|
||||
validateType?: number; // 认证方式
|
||||
deviceCount?: number; // 设备数量
|
||||
createTime?: Date; // 创建时间
|
||||
}
|
||||
}
|
||||
|
||||
// TODO @haohao:packages/constants/src/biz-iot-enum.ts 枚举;
|
||||
|
||||
/** IOT 产品设备类型枚举类 */
|
||||
export enum DeviceTypeEnum {
|
||||
DEVICE = 0, // 直连设备
|
||||
GATEWAY = 2, // 网关设备
|
||||
GATEWAY_SUB = 1, // 网关子设备
|
||||
}
|
||||
|
||||
/** IOT 产品定位类型枚举类 */
|
||||
export enum LocationTypeEnum {
|
||||
IP = 1, // IP 定位
|
||||
MANUAL = 3, // 手动定位
|
||||
MODULE = 2, // 设备定位
|
||||
}
|
||||
|
||||
/** IOT 数据格式(编解码器类型)枚举类 */
|
||||
export enum CodecTypeEnum {
|
||||
ALINK = 'Alink', // 阿里云 Alink 协议
|
||||
}
|
||||
|
||||
/** 查询产品分页 */
|
||||
export function getProductPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<IotProductApi.Product>>(
|
||||
'/iot/product/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询产品详情 */
|
||||
export function getProduct(id: number) {
|
||||
return requestClient.get<IotProductApi.Product>(`/iot/product/get?id=${id}`);
|
||||
}
|
||||
|
||||
/** 新增产品 */
|
||||
export function createProduct(data: IotProductApi.Product) {
|
||||
return requestClient.post('/iot/product/create', data);
|
||||
}
|
||||
|
||||
/** 修改产品 */
|
||||
export function updateProduct(data: IotProductApi.Product) {
|
||||
return requestClient.put('/iot/product/update', data);
|
||||
}
|
||||
|
||||
/** 删除产品 */
|
||||
export function deleteProduct(id: number) {
|
||||
return requestClient.delete(`/iot/product/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 导出产品 Excel */
|
||||
export function exportProduct(params: any) {
|
||||
return requestClient.download('/iot/product/export-excel', { params });
|
||||
}
|
||||
|
||||
/** 更新产品状态 */
|
||||
export function updateProductStatus(id: number, status: number) {
|
||||
return requestClient.put(
|
||||
`/iot/product/update-status?id=${id}&status=${status}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询产品(精简)列表 */
|
||||
export function getSimpleProductList() {
|
||||
return requestClient.get<IotProductApi.Product[]>('/iot/product/simple-list');
|
||||
}
|
||||
|
||||
/** 根据 ProductKey 获取产品信息 */
|
||||
export function getProductByKey(productKey: string) {
|
||||
return requestClient.get<IotProductApi.Product>('/iot/product/get-by-key', {
|
||||
params: { productKey },
|
||||
});
|
||||
}
|
||||
83
apps/web-antd/src/api/iot/rule/data/rule/index.ts
Normal file
83
apps/web-antd/src/api/iot/rule/data/rule/index.ts
Normal file
@@ -0,0 +1,83 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace DataRuleApi {
|
||||
/** IoT 数据流转规则 VO */
|
||||
export interface Rule {
|
||||
id?: number;
|
||||
name: string;
|
||||
description?: string;
|
||||
status?: number;
|
||||
productId?: number;
|
||||
productKey?: string;
|
||||
sourceConfigs?: SourceConfig[];
|
||||
sinkIds?: number[];
|
||||
createTime?: Date;
|
||||
}
|
||||
|
||||
/** IoT 数据源配置 */
|
||||
export interface SourceConfig {
|
||||
productId?: number;
|
||||
productKey?: string;
|
||||
deviceId?: number;
|
||||
type?: string;
|
||||
topic?: string;
|
||||
}
|
||||
}
|
||||
|
||||
/** IoT 数据流转规则 */
|
||||
export interface DataRule {
|
||||
id?: number;
|
||||
name?: string;
|
||||
description?: string;
|
||||
status?: number;
|
||||
productId?: number;
|
||||
productKey?: string;
|
||||
sourceConfigs?: any[];
|
||||
sinkIds?: number[];
|
||||
createTime?: Date;
|
||||
}
|
||||
|
||||
/** 查询数据流转规则分页 */
|
||||
export function getDataRulePage(params: PageParam) {
|
||||
return requestClient.get<PageResult<DataRuleApi.Rule>>(
|
||||
'/iot/data-rule/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询数据流转规则详情 */
|
||||
export function getDataRule(id: number) {
|
||||
return requestClient.get<DataRuleApi.Rule>(`/iot/data-rule/get?id=${id}`);
|
||||
}
|
||||
|
||||
/** 新增数据流转规则 */
|
||||
export function createDataRule(data: DataRule) {
|
||||
return requestClient.post('/iot/data-rule/create', data);
|
||||
}
|
||||
|
||||
/** 修改数据流转规则 */
|
||||
export function updateDataRule(data: DataRule) {
|
||||
return requestClient.put('/iot/data-rule/update', data);
|
||||
}
|
||||
|
||||
/** 删除数据流转规则 */
|
||||
export function deleteDataRule(id: number) {
|
||||
return requestClient.delete(`/iot/data-rule/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 批量删除数据流转规则 */
|
||||
export function deleteDataRuleList(ids: number[]) {
|
||||
return requestClient.delete('/iot/data-rule/delete-list', {
|
||||
params: { ids: ids.join(',') },
|
||||
});
|
||||
}
|
||||
|
||||
/** 更新数据流转规则状态 */
|
||||
export function updateDataRuleStatus(id: number, status: number) {
|
||||
return requestClient.put(`/iot/data-rule/update-status`, {
|
||||
id,
|
||||
status,
|
||||
});
|
||||
}
|
||||
148
apps/web-antd/src/api/iot/rule/data/sink/index.ts
Normal file
148
apps/web-antd/src/api/iot/rule/data/sink/index.ts
Normal file
@@ -0,0 +1,148 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace DataSinkApi {
|
||||
/** IoT 数据流转目的 VO */
|
||||
export interface Sink {
|
||||
id?: number;
|
||||
name: string;
|
||||
description?: string;
|
||||
status?: number;
|
||||
type: string;
|
||||
config?: any;
|
||||
createTime?: Date;
|
||||
}
|
||||
}
|
||||
|
||||
/** IoT 数据流转目的 */
|
||||
export interface DataSinkVO {
|
||||
id?: number;
|
||||
name?: string;
|
||||
description?: string;
|
||||
status?: number;
|
||||
type?: string;
|
||||
config?: any;
|
||||
createTime?: Date;
|
||||
}
|
||||
|
||||
/** IoT 数据目的类型枚举 */
|
||||
export enum IotDataSinkTypeEnum {
|
||||
HTTP = 'HTTP',
|
||||
KAFKA = 'KAFKA',
|
||||
MQTT = 'MQTT',
|
||||
RABBITMQ = 'RABBITMQ',
|
||||
REDIS_STREAM = 'REDIS_STREAM',
|
||||
ROCKETMQ = 'ROCKETMQ',
|
||||
}
|
||||
|
||||
/** HTTP 配置 */
|
||||
export interface HttpConfig {
|
||||
url?: string;
|
||||
method?: string;
|
||||
headers?: Record<string, string>;
|
||||
timeout?: number;
|
||||
}
|
||||
|
||||
/** MQTT 配置 */
|
||||
export interface MqttConfig {
|
||||
broker?: string;
|
||||
port?: number;
|
||||
topic?: string;
|
||||
username?: string;
|
||||
password?: string;
|
||||
clientId?: string;
|
||||
qos?: number;
|
||||
}
|
||||
|
||||
/** Kafka 配置 */
|
||||
export interface KafkaMQConfig {
|
||||
bootstrapServers?: string;
|
||||
topic?: string;
|
||||
acks?: string;
|
||||
retries?: number;
|
||||
batchSize?: number;
|
||||
}
|
||||
|
||||
/** RabbitMQ 配置 */
|
||||
export interface RabbitMQConfig {
|
||||
host?: string;
|
||||
port?: number;
|
||||
virtualHost?: string;
|
||||
username?: string;
|
||||
password?: string;
|
||||
exchange?: string;
|
||||
routingKey?: string;
|
||||
queue?: string;
|
||||
}
|
||||
|
||||
/** RocketMQ 配置 */
|
||||
export interface RocketMQConfig {
|
||||
nameServer?: string;
|
||||
topic?: string;
|
||||
tag?: string;
|
||||
producerGroup?: string;
|
||||
}
|
||||
|
||||
/** Redis Stream 配置 */
|
||||
export interface RedisStreamMQConfig {
|
||||
host?: string;
|
||||
port?: number;
|
||||
password?: string;
|
||||
database?: number;
|
||||
streamKey?: string;
|
||||
maxLen?: number;
|
||||
}
|
||||
|
||||
/** 查询数据流转目的分页 */
|
||||
export function getDataSinkPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<DataSinkApi.Sink>>(
|
||||
'/iot/data-sink/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询数据流转目的详情 */
|
||||
export function getDataSink(id: number) {
|
||||
return requestClient.get<DataSinkApi.Sink>(`/iot/data-sink/get?id=${id}`);
|
||||
}
|
||||
|
||||
/** 查询所有数据流转目的列表 */
|
||||
export function getDataSinkList() {
|
||||
return requestClient.get<DataSinkApi.Sink[]>('/iot/data-sink/list');
|
||||
}
|
||||
|
||||
/** 查询数据流转目的简单列表 */
|
||||
export function getDataSinkSimpleList() {
|
||||
return requestClient.get<DataSinkApi.Sink[]>('/iot/data-sink/simple-list');
|
||||
}
|
||||
|
||||
/** 新增数据流转目的 */
|
||||
export function createDataSink(data: DataSinkVO) {
|
||||
return requestClient.post('/iot/data-sink/create', data);
|
||||
}
|
||||
|
||||
/** 修改数据流转目的 */
|
||||
export function updateDataSink(data: DataSinkVO) {
|
||||
return requestClient.put('/iot/data-sink/update', data);
|
||||
}
|
||||
|
||||
/** 删除数据流转目的 */
|
||||
export function deleteDataSink(id: number) {
|
||||
return requestClient.delete(`/iot/data-sink/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 批量删除数据流转目的 */
|
||||
export function deleteDataSinkList(ids: number[]) {
|
||||
return requestClient.delete('/iot/data-sink/delete-list', {
|
||||
params: { ids: ids.join(',') },
|
||||
});
|
||||
}
|
||||
|
||||
/** 更新数据流转目的状态 */
|
||||
export function updateDataSinkStatus(id: number, status: number) {
|
||||
return requestClient.put(`/iot/data-sink/update-status`, {
|
||||
id,
|
||||
status,
|
||||
});
|
||||
}
|
||||
159
apps/web-antd/src/api/iot/rule/scene/index.ts
Normal file
159
apps/web-antd/src/api/iot/rule/scene/index.ts
Normal file
@@ -0,0 +1,159 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace RuleSceneApi {
|
||||
/** 场景联动规则 */
|
||||
export interface SceneRule {
|
||||
id?: number;
|
||||
name: string;
|
||||
description?: string;
|
||||
status?: number;
|
||||
triggers?: Trigger[];
|
||||
actions?: Action[];
|
||||
createTime?: Date;
|
||||
}
|
||||
|
||||
/** 场景联动规则的触发器 */
|
||||
export interface Trigger {
|
||||
type?: string;
|
||||
productId?: number;
|
||||
deviceId?: number;
|
||||
identifier?: string;
|
||||
operator?: string;
|
||||
value?: any;
|
||||
cronExpression?: string;
|
||||
conditionGroups?: TriggerConditionGroup[];
|
||||
}
|
||||
|
||||
/** 场景联动规则的触发条件组 */
|
||||
export interface TriggerConditionGroup {
|
||||
conditions?: TriggerCondition[];
|
||||
operator?: string;
|
||||
}
|
||||
|
||||
/** 场景联动规则的触发条件 */
|
||||
export interface TriggerCondition {
|
||||
productId?: number;
|
||||
deviceId?: number;
|
||||
identifier?: string;
|
||||
operator?: string;
|
||||
value?: any;
|
||||
type?: string;
|
||||
}
|
||||
|
||||
/** 场景联动规则的动作 */
|
||||
export interface Action {
|
||||
type?: string;
|
||||
productId?: number;
|
||||
deviceId?: number;
|
||||
identifier?: string;
|
||||
value?: any;
|
||||
alertConfigId?: number;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO @haohao:貌似下面的,和 RuleSceneApi 重复了。
|
||||
/** IoT 场景联动规则 */
|
||||
export interface IotSceneRule {
|
||||
id?: number;
|
||||
name?: string;
|
||||
description?: string;
|
||||
status?: number;
|
||||
triggers?: Trigger[];
|
||||
actions?: Action[];
|
||||
createTime?: Date;
|
||||
}
|
||||
|
||||
/** IoT 场景联动规则触发器 */
|
||||
export interface Trigger {
|
||||
type?: string;
|
||||
productId?: number;
|
||||
deviceId?: number;
|
||||
identifier?: string;
|
||||
operator?: string;
|
||||
value?: any;
|
||||
cronExpression?: string;
|
||||
conditionGroups?: TriggerConditionGroup[];
|
||||
}
|
||||
|
||||
/** IoT 场景联动规则触发条件组 */
|
||||
export interface TriggerConditionGroup {
|
||||
conditions?: TriggerCondition[];
|
||||
operator?: string;
|
||||
}
|
||||
|
||||
/** IoT 场景联动规则触发条件 */
|
||||
export interface TriggerCondition {
|
||||
productId?: number;
|
||||
deviceId?: number;
|
||||
identifier?: string;
|
||||
operator?: string;
|
||||
value?: any;
|
||||
type?: string;
|
||||
param?: string;
|
||||
}
|
||||
|
||||
/** IoT 场景联动规则动作 */
|
||||
export interface Action {
|
||||
type?: string;
|
||||
productId?: number;
|
||||
deviceId?: number;
|
||||
identifier?: string;
|
||||
value?: any;
|
||||
alertConfigId?: number;
|
||||
params?: string;
|
||||
}
|
||||
|
||||
/** 查询场景联动规则分页 */
|
||||
export function getSceneRulePage(params: PageParam) {
|
||||
return requestClient.get<PageResult<RuleSceneApi.SceneRule>>(
|
||||
'/iot/scene-rule/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询场景联动规则详情 */
|
||||
export function getSceneRule(id: number) {
|
||||
return requestClient.get<RuleSceneApi.SceneRule>(
|
||||
`/iot/scene-rule/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增场景联动规则 */
|
||||
export function createSceneRule(data: IotSceneRule) {
|
||||
return requestClient.post('/iot/scene-rule/create', data);
|
||||
}
|
||||
|
||||
/** 修改场景联动规则 */
|
||||
export function updateSceneRule(data: IotSceneRule) {
|
||||
return requestClient.put('/iot/scene-rule/update', data);
|
||||
}
|
||||
|
||||
/** 删除场景联动规则 */
|
||||
export function deleteSceneRule(id: number) {
|
||||
return requestClient.delete(`/iot/scene-rule/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 批量删除场景联动规则 */
|
||||
// TODO @haohao:貌似用上。
|
||||
export function deleteSceneRuleList(ids: number[]) {
|
||||
return requestClient.delete('/iot/scene-rule/delete-list', {
|
||||
params: { ids: ids.join(',') },
|
||||
});
|
||||
}
|
||||
|
||||
/** 更新场景联动规则状态 */
|
||||
export function updateSceneRuleStatus(id: number, status: number) {
|
||||
return requestClient.put(`/iot/scene-rule/update-status`, {
|
||||
id,
|
||||
status,
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取场景联动规则简单列表 */
|
||||
export function getSimpleRuleSceneList() {
|
||||
return requestClient.get<RuleSceneApi.SceneRule[]>(
|
||||
'/iot/scene-rule/simple-list',
|
||||
);
|
||||
}
|
||||
71
apps/web-antd/src/api/iot/statistics/index.ts
Normal file
71
apps/web-antd/src/api/iot/statistics/index.ts
Normal file
@@ -0,0 +1,71 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace IotStatisticsApi {
|
||||
// TODO @haohao:需要跟后端对齐,必要的 ReqVO、RespVO
|
||||
/** 统计摘要数据 */
|
||||
export interface StatisticsSummary {
|
||||
productCategoryCount: number;
|
||||
productCount: number;
|
||||
deviceCount: number;
|
||||
deviceMessageCount: number;
|
||||
productCategoryTodayCount: number;
|
||||
productTodayCount: number;
|
||||
deviceTodayCount: number;
|
||||
deviceMessageTodayCount: number;
|
||||
deviceOnlineCount: number;
|
||||
deviceOfflineCount: number;
|
||||
deviceInactiveCount: number;
|
||||
productCategoryDeviceCounts: Record<string, number>;
|
||||
}
|
||||
|
||||
/** 时间戳-数值的键值对类型 */
|
||||
export interface TimeValueItem {
|
||||
[key: string]: number;
|
||||
}
|
||||
|
||||
/** 消息统计数据类型 */
|
||||
export interface DeviceMessageSummary {
|
||||
statType: number;
|
||||
upstreamCounts: TimeValueItem[];
|
||||
downstreamCounts: TimeValueItem[];
|
||||
}
|
||||
|
||||
/** 消息统计数据项(按日期) */
|
||||
export interface DeviceMessageSummaryByDate {
|
||||
time: string;
|
||||
upstreamCount: number;
|
||||
downstreamCount: number;
|
||||
}
|
||||
|
||||
/** 消息统计接口参数 */
|
||||
export interface DeviceMessageReq {
|
||||
interval: number;
|
||||
times?: string[];
|
||||
}
|
||||
}
|
||||
|
||||
/** 获取 IoT 统计摘要数据 */
|
||||
export function getStatisticsSummary() {
|
||||
return requestClient.get<IotStatisticsApi.StatisticsSummary>(
|
||||
'/iot/statistics/get-summary',
|
||||
);
|
||||
}
|
||||
|
||||
/** 获取设备消息的数据统计(按日期) */
|
||||
export function getDeviceMessageSummaryByDate(
|
||||
params: IotStatisticsApi.DeviceMessageReq,
|
||||
) {
|
||||
return requestClient.get<IotStatisticsApi.DeviceMessageSummaryByDate[]>(
|
||||
'/iot/statistics/get-device-message-summary-by-date',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
// TODO @haohao:貌似这里,没用到?是不是后面哪里用,或者可以删除哈?
|
||||
/** 获取设备消息统计摘要 */
|
||||
export function getDeviceMessageSummary(statType: number) {
|
||||
return requestClient.get<IotStatisticsApi.DeviceMessageSummary>(
|
||||
'/iot/statistics/get-device-message-summary',
|
||||
{ params: { statType } },
|
||||
);
|
||||
}
|
||||
186
apps/web-antd/src/api/iot/thingmodel/index.ts
Normal file
186
apps/web-antd/src/api/iot/thingmodel/index.ts
Normal file
@@ -0,0 +1,186 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ThingModelApi {
|
||||
/** IoT 物模型数据 VO */
|
||||
export interface ThingModel {
|
||||
id?: number;
|
||||
productId?: number;
|
||||
productKey?: string;
|
||||
identifier: string;
|
||||
name: string;
|
||||
desc?: string;
|
||||
type: string;
|
||||
property?: ThingModelProperty;
|
||||
event?: ThingModelEvent;
|
||||
service?: ThingModelService;
|
||||
}
|
||||
|
||||
/** IoT 物模型属性 */
|
||||
export interface Property {
|
||||
identifier: string;
|
||||
name: string;
|
||||
accessMode: string;
|
||||
dataType: string;
|
||||
dataSpecs?: any;
|
||||
dataSpecsList?: any[];
|
||||
desc?: string;
|
||||
}
|
||||
|
||||
/** IoT 物模型服务 */
|
||||
export interface Service {
|
||||
identifier: string;
|
||||
name: string;
|
||||
callType: string;
|
||||
inputData?: any[];
|
||||
outputData?: any[];
|
||||
desc?: string;
|
||||
}
|
||||
|
||||
/** IoT 物模型事件 */
|
||||
export interface Event {
|
||||
identifier: string;
|
||||
name: string;
|
||||
type: string;
|
||||
outputData?: any[];
|
||||
desc?: string;
|
||||
}
|
||||
}
|
||||
|
||||
/** IoT 物模型数据 */
|
||||
export interface ThingModelData {
|
||||
id?: number;
|
||||
productId?: number;
|
||||
productKey?: string;
|
||||
identifier?: string;
|
||||
name?: string;
|
||||
desc?: string;
|
||||
type?: string;
|
||||
dataType?: string;
|
||||
property?: ThingModelProperty;
|
||||
event?: ThingModelEvent;
|
||||
service?: ThingModelService;
|
||||
}
|
||||
|
||||
/** IoT 物模型属性 */
|
||||
export interface ThingModelProperty {
|
||||
identifier?: string;
|
||||
name?: string;
|
||||
accessMode?: string;
|
||||
dataType?: string;
|
||||
dataSpecs?: any;
|
||||
dataSpecsList?: any[];
|
||||
desc?: string;
|
||||
}
|
||||
|
||||
/** IoT 物模型服务 */
|
||||
export interface ThingModelService {
|
||||
identifier?: string;
|
||||
name?: string;
|
||||
callType?: string;
|
||||
inputData?: any[];
|
||||
outputData?: any[];
|
||||
desc?: string;
|
||||
}
|
||||
|
||||
/** IoT 物模型事件 */
|
||||
export interface ThingModelEvent {
|
||||
identifier?: string;
|
||||
name?: string;
|
||||
type?: string;
|
||||
outputData?: any[];
|
||||
desc?: string;
|
||||
}
|
||||
|
||||
/** IoT 数据定义(数值型) */
|
||||
export interface DataSpecsNumberData {
|
||||
min?: number | string;
|
||||
max?: number | string;
|
||||
step?: number | string;
|
||||
unit?: string;
|
||||
unitName?: string;
|
||||
}
|
||||
|
||||
/** IoT 数据定义(枚举/布尔型) */
|
||||
export interface DataSpecsEnumOrBoolData {
|
||||
value: number | string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
/** IoT 物模型表单校验规则 */
|
||||
export interface ThingModelFormRules {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
/** 验证布尔型名称 */
|
||||
export function validateBoolName(_rule: any, value: any, callback: any) {
|
||||
if (value) {
|
||||
callback();
|
||||
} else {
|
||||
callback(new Error('枚举描述不能为空'));
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询产品物模型分页 */
|
||||
export function getThingModelPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<ThingModelApi.ThingModel>>(
|
||||
'/iot/thing-model/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询产品物模型详情 */
|
||||
export function getThingModel(id: number) {
|
||||
return requestClient.get<ThingModelApi.ThingModel>(
|
||||
`/iot/thing-model/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 根据产品 ID 查询物模型列表 */
|
||||
export function getThingModelListByProductId(productId: number) {
|
||||
return requestClient.get<ThingModelApi.ThingModel[]>(
|
||||
'/iot/thing-model/list',
|
||||
{ params: { productId } },
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增物模型 */
|
||||
export function createThingModel(data: ThingModelData) {
|
||||
return requestClient.post('/iot/thing-model/create', data);
|
||||
}
|
||||
|
||||
/** 修改物模型 */
|
||||
export function updateThingModel(data: ThingModelData) {
|
||||
return requestClient.put('/iot/thing-model/update', data);
|
||||
}
|
||||
|
||||
/** 删除物模型 */
|
||||
export function deleteThingModel(id: number) {
|
||||
return requestClient.delete(`/iot/thing-model/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 获取物模型 TSL */
|
||||
export function getThingModelTSL(productId: number) {
|
||||
return requestClient.get<ThingModelApi.ThingModel[]>(
|
||||
'/iot/thing-model/get-tsl',
|
||||
{ params: { productId } },
|
||||
);
|
||||
}
|
||||
|
||||
/** 导入物模型 TSL
|
||||
export function importThingModelTSL(productId: number, tslData: any) {
|
||||
return requestClient.post('/iot/thing-model/import-tsl', {
|
||||
productId,
|
||||
tslData,
|
||||
});
|
||||
}
|
||||
*/
|
||||
|
||||
/** 导出物模型 TSL
|
||||
export function exportThingModelTSL(productId: number) {
|
||||
return requestClient.get<any>('/iot/thing-model/export-tsl', {
|
||||
params: { productId },
|
||||
});
|
||||
}
|
||||
*/
|
||||
52
apps/web-antd/src/api/mall/product/brand/index.ts
Normal file
52
apps/web-antd/src/api/mall/product/brand/index.ts
Normal file
@@ -0,0 +1,52 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace MallBrandApi {
|
||||
/** 商品品牌 */
|
||||
export interface Brand {
|
||||
id?: number; // 品牌编号
|
||||
name: string; // 品牌名称
|
||||
picUrl: string; // 品牌图片
|
||||
sort?: number; // 品牌排序
|
||||
description?: string; // 品牌描述
|
||||
status: number; // 开启状态
|
||||
}
|
||||
}
|
||||
|
||||
/** 创建商品品牌 */
|
||||
export function createBrand(data: MallBrandApi.Brand) {
|
||||
return requestClient.post('/product/brand/create', data);
|
||||
}
|
||||
|
||||
/** 更新商品品牌 */
|
||||
export function updateBrand(data: MallBrandApi.Brand) {
|
||||
return requestClient.put('/product/brand/update', data);
|
||||
}
|
||||
|
||||
/** 删除商品品牌 */
|
||||
export function deleteBrand(id: number) {
|
||||
return requestClient.delete(`/product/brand/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 获得商品品牌 */
|
||||
export function getBrand(id: number) {
|
||||
return requestClient.get<MallBrandApi.Brand>(`/product/brand/get?id=${id}`);
|
||||
}
|
||||
|
||||
/** 获得商品品牌列表 */
|
||||
export function getBrandPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<MallBrandApi.Brand>>(
|
||||
'/product/brand/page',
|
||||
{
|
||||
params,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** 获得商品品牌精简信息列表 */
|
||||
export function getSimpleBrandList() {
|
||||
return requestClient.get<MallBrandApi.Brand[]>(
|
||||
'/product/brand/list-all-simple',
|
||||
);
|
||||
}
|
||||
45
apps/web-antd/src/api/mall/product/category/index.ts
Normal file
45
apps/web-antd/src/api/mall/product/category/index.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace MallCategoryApi {
|
||||
/** 产品分类 */
|
||||
export interface Category {
|
||||
id?: number; // 分类编号
|
||||
parentId?: number; // 父分类编号
|
||||
name: string; // 分类名称
|
||||
picUrl: string; // 移动端分类图
|
||||
sort: number; // 分类排序
|
||||
status: number; // 开启状态
|
||||
}
|
||||
}
|
||||
|
||||
/** 创建商品分类 */
|
||||
export function createCategory(data: MallCategoryApi.Category) {
|
||||
return requestClient.post('/product/category/create', data);
|
||||
}
|
||||
|
||||
/** 更新商品分类 */
|
||||
export function updateCategory(data: MallCategoryApi.Category) {
|
||||
return requestClient.put('/product/category/update', data);
|
||||
}
|
||||
|
||||
/** 删除商品分类 */
|
||||
export function deleteCategory(id: number) {
|
||||
return requestClient.delete(`/product/category/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 获得商品分类 */
|
||||
export function getCategory(id: number) {
|
||||
return requestClient.get<MallCategoryApi.Category>(
|
||||
`/product/category/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 获得商品分类列表 */
|
||||
export function getCategoryList(params: any) {
|
||||
return requestClient.get<MallCategoryApi.Category[]>(
|
||||
'/product/category/list',
|
||||
{
|
||||
params,
|
||||
},
|
||||
);
|
||||
}
|
||||
80
apps/web-antd/src/api/mall/product/comment/index.ts
Normal file
80
apps/web-antd/src/api/mall/product/comment/index.ts
Normal file
@@ -0,0 +1,80 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace MallCommentApi {
|
||||
/** 商品评论 */
|
||||
export interface Comment {
|
||||
id: number; // 评论编号
|
||||
userId: number; // 用户编号
|
||||
userNickname: string; // 用户昵称
|
||||
userAvatar: string; // 用户头像
|
||||
anonymous: boolean; // 是否匿名
|
||||
orderId: number; // 订单编号
|
||||
orderItemId: number; // 订单项编号
|
||||
spuId: number; // 商品SPU编号
|
||||
spuName: string; // 商品名称
|
||||
skuId: number; // 商品SKU编号
|
||||
visible: boolean; // 是否可见
|
||||
scores: number; // 总评分
|
||||
descriptionScores: number; // 描述评分
|
||||
benefitScores: number; // 服务评分
|
||||
content: string; // 评论内容
|
||||
picUrls: string[]; // 评论图片
|
||||
replyStatus: boolean; // 是否回复
|
||||
replyUserId: number; // 回复人编号
|
||||
replyContent: string; // 回复内容
|
||||
replyTime: Date; // 回复时间
|
||||
createTime: Date; // 创建时间
|
||||
skuProperties: {
|
||||
propertyId: number; // 属性 ID
|
||||
propertyName: string; // 属性名称
|
||||
valueId: number; // 属性值 ID
|
||||
valueName: string; // 属性值名称
|
||||
}[]; // SKU 属性数组
|
||||
}
|
||||
|
||||
/** 评论可见性更新请求 */
|
||||
export interface CommentVisibleUpdateReqVO {
|
||||
id: number; // 评论编号
|
||||
visible: boolean; // 是否可见
|
||||
}
|
||||
|
||||
/** 评论回复请求 */
|
||||
export interface CommentReplyReqVO {
|
||||
id: number; // 评论编号
|
||||
replyContent: string; // 回复内容
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询商品评论列表 */
|
||||
export function getCommentPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<MallCommentApi.Comment>>(
|
||||
'/product/comment/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询商品评论详情 */
|
||||
export function getComment(id: number) {
|
||||
return requestClient.get<MallCommentApi.Comment>(
|
||||
`/product/comment/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 添加自评 */
|
||||
export function createComment(data: MallCommentApi.Comment) {
|
||||
return requestClient.post('/product/comment/create', data);
|
||||
}
|
||||
|
||||
/** 显示 / 隐藏评论 */
|
||||
export function updateCommentVisible(
|
||||
data: MallCommentApi.CommentVisibleUpdateReqVO,
|
||||
) {
|
||||
return requestClient.put('/product/comment/update-visible', data);
|
||||
}
|
||||
|
||||
/** 商家回复 */
|
||||
export function replyComment(data: MallCommentApi.CommentReplyReqVO) {
|
||||
return requestClient.put('/product/comment/reply', data);
|
||||
}
|
||||
20
apps/web-antd/src/api/mall/product/favorite/index.ts
Normal file
20
apps/web-antd/src/api/mall/product/favorite/index.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace MallFavoriteApi {
|
||||
/** 商品收藏 */
|
||||
export interface Favorite {
|
||||
id?: number; // 收藏编号
|
||||
userId?: string; // 用户编号
|
||||
spuId?: number; // 商品 SPU 编号
|
||||
}
|
||||
}
|
||||
|
||||
/** 获得商品收藏列表 */
|
||||
export function getFavoritePage(params: PageParam) {
|
||||
return requestClient.get<PageResult<MallFavoriteApi.Favorite>>(
|
||||
'/product/favorite/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
21
apps/web-antd/src/api/mall/product/history/index.ts
Normal file
21
apps/web-antd/src/api/mall/product/history/index.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace MallHistoryApi {
|
||||
/** 商品浏览记录 */
|
||||
export interface BrowseHistory {
|
||||
id?: number; // 记录编号
|
||||
userId?: number; // 用户编号
|
||||
spuId?: number; // 商品 SPU 编号
|
||||
createTime?: Date; // 浏览时间
|
||||
}
|
||||
}
|
||||
|
||||
/** 获得商品浏览记录分页 */
|
||||
export function getBrowseHistoryPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<MallHistoryApi.BrowseHistory>>(
|
||||
'/product/browse-history/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
97
apps/web-antd/src/api/mall/product/property/index.ts
Normal file
97
apps/web-antd/src/api/mall/product/property/index.ts
Normal file
@@ -0,0 +1,97 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace MallPropertyApi {
|
||||
/** 商品属性 */
|
||||
export interface Property {
|
||||
id?: number; // 属性编号
|
||||
name: string; // 名称
|
||||
remark?: string; // 备注
|
||||
}
|
||||
|
||||
/** 属性值 */
|
||||
export interface PropertyValue {
|
||||
id?: number; // 属性值编号
|
||||
propertyId?: number; // 属性项的编号
|
||||
name: string; // 名称
|
||||
remark?: string; // 备注
|
||||
}
|
||||
}
|
||||
|
||||
/** 创建属性项 */
|
||||
export function createProperty(data: MallPropertyApi.Property) {
|
||||
return requestClient.post('/product/property/create', data);
|
||||
}
|
||||
|
||||
/** 更新属性项 */
|
||||
export function updateProperty(data: MallPropertyApi.Property) {
|
||||
return requestClient.put('/product/property/update', data);
|
||||
}
|
||||
|
||||
/** 删除属性项 */
|
||||
export function deleteProperty(id: number) {
|
||||
return requestClient.delete(`/product/property/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 获得属性项 */
|
||||
export function getProperty(id: number) {
|
||||
return requestClient.get<MallPropertyApi.Property>(
|
||||
`/product/property/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 获得属性项分页 */
|
||||
export function getPropertyPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<MallPropertyApi.Property>>(
|
||||
'/product/property/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 获得属性项精简列表 */
|
||||
export function getPropertySimpleList() {
|
||||
return requestClient.get<MallPropertyApi.Property[]>(
|
||||
'/product/property/simple-list',
|
||||
);
|
||||
}
|
||||
|
||||
/** 获得属性值分页 */
|
||||
export function getPropertyValuePage(params: PageParam) {
|
||||
return requestClient.get<PageResult<MallPropertyApi.PropertyValue>>(
|
||||
'/product/property/value/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 获得属性值 */
|
||||
export function getPropertyValue(id: number) {
|
||||
return requestClient.get<MallPropertyApi.PropertyValue>(
|
||||
`/product/property/value/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 创建属性值 */
|
||||
export function createPropertyValue(data: MallPropertyApi.PropertyValue) {
|
||||
return requestClient.post('/product/property/value/create', data);
|
||||
}
|
||||
|
||||
/** 更新属性值 */
|
||||
export function updatePropertyValue(data: MallPropertyApi.PropertyValue) {
|
||||
return requestClient.put('/product/property/value/update', data);
|
||||
}
|
||||
|
||||
/** 删除属性值 */
|
||||
export function deletePropertyValue(id: number) {
|
||||
return requestClient.delete(`/product/property/value/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 获得属性值精简列表 */
|
||||
export function getPropertyValueSimpleList(propertyId: number) {
|
||||
return requestClient.get<MallPropertyApi.PropertyValue[]>(
|
||||
'/product/property/value/simple-list',
|
||||
{
|
||||
params: { propertyId },
|
||||
},
|
||||
);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user