chore: initial commit
Some checks failed
Synchronize to Gitee / repo-sync (push) Has been cancelled
Typos Checking / Spell Check with Typos (push) Has been cancelled

This commit is contained in:
2026-06-23 11:56:23 +08:00
commit 72e2110987
2883 changed files with 367388 additions and 0 deletions

32
frontend/.gitignore vendored Normal file
View File

@@ -0,0 +1,32 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
.DS_Store
dist
dist-ssr
coverage
*.local
# Editor directories and files
**/.vscode/*
!.vscode/extensions.json
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
.vscode
*.tsbuildinfo
.node/
pnpm-lock.yaml
package-lock.json
yarn.lock

4
frontend/.husky/commit-msg Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
cd frontend && npx commitlint --edit $1

6
frontend/.husky/pre-commit Executable file
View File

@@ -0,0 +1,6 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
cd frontend/packages/lib-shared && npm run type:check && npm run lint-staged
cd ../mobile && npm run type:check && npm run lint-staged
cd ../web && npm run type:check && npm run lint-staged

7
frontend/.prettierignore Normal file
View File

@@ -0,0 +1,7 @@
/dist/*
.local
.output.js
/node_modules/**
**/*.svg
**/*.sh

14
frontend/.prettierrc.cjs Normal file
View File

@@ -0,0 +1,14 @@
module.exports = {
plugins: [require('prettier-plugin-tailwindcss')],
tabWidth: 2,
semi: true,
singleQuote: true,
quoteProps: 'consistent',
htmlWhitespaceSensitivity: 'strict',
vueIndentScriptAndStyle: true,
useTabs: false,
trailingComma: 'es5',
printWidth: 120,
arrowParens: 'always',
endOfLine: 'auto',
};

125
frontend/.stylelintrc.cjs Normal file
View File

@@ -0,0 +1,125 @@
module.exports = {
extends: [
'stylelint-config-standard',
'stylelint-config-prettier',
'stylelint-config-html/vue',
'stylelint-config-recommended-less',
],
plugins: ['stylelint-less', 'stylelint-order'],
overrides: [
{
files: ['**/*.vue'],
customSyntax: 'postcss-html',
},
],
customSyntax: 'postcss-less',
ignoreFiles: ['**/*.js', '**/*.jsx', '**/*.tsx', '**/*.ts', '**/*.json', 'node_modules/**/*'],
rules: {
'indentation': 2,
'selector-pseudo-element-no-unknown': [
true,
{
ignorePseudoElements: ['v-deep', ':deep'],
},
],
'number-leading-zero': 'always',
'no-descending-specificity': null,
'function-url-quotes': 'always',
'string-quotes': 'single',
'unit-case': null,
'color-hex-case': 'lower',
'color-hex-length': 'long',
'rule-empty-line-before': 'never',
'font-family-no-missing-generic-family-keyword': null,
'selector-type-no-unknown': null,
'block-opening-brace-space-before': 'always',
'at-rule-no-unknown': [true, { ignoreAtRules: ['apply', 'tailwind', 'variants', 'responsive', 'screen'] }],
'no-duplicate-selectors': null,
'property-no-unknown': null,
'no-empty-source': null,
'selector-class-pattern': null,
'keyframes-name-pattern': null,
'selector-pseudo-class-no-unknown': [true, { ignorePseudoClasses: ['global', 'deep'] }],
'function-no-unknown': null,
'declaration-block-no-redundant-longhand-properties': null,
'no-descending-specificity': null,
'order/properties-order': [
'position',
'top',
'right',
'bottom',
'left',
'z-index',
'display',
'justify-content',
'align-items',
'float',
'clear',
'overflow',
'overflow-x',
'overflow-y',
'margin',
'margin-top',
'margin-right',
'margin-bottom',
'margin-left',
'padding',
'padding-top',
'padding-right',
'padding-bottom',
'padding-left',
'width',
'min-width',
'max-width',
'height',
'min-height',
'max-height',
'font-size',
'font-family',
'font-weight',
'border',
'border-style',
'border-width',
'border-color',
'border-top',
'border-top-style',
'border-top-width',
'border-top-color',
'border-right',
'border-right-style',
'border-right-width',
'border-right-color',
'border-bottom',
'border-bottom-style',
'border-bottom-width',
'border-bottom-color',
'border-left',
'border-left-style',
'border-left-width',
'border-left-color',
'border-radius',
'text-align',
'text-justify',
'text-indent',
'text-overflow',
'text-decoration',
'white-space',
'color',
'background',
'background-position',
'background-repeat',
'background-size',
'background-color',
'background-clip',
'opacity',
'filter',
'list-style',
'outline',
'visibility',
'box-shadow',
'text-shadow',
'resize',
'transition',
],
},
};

78
frontend/REDEME.md Normal file
View File

@@ -0,0 +1,78 @@
# Cordys CRM 前端工程
## 工程简介
使用 `monorepo` 模式管理前端工程,拆分为`lib-shared`公共资源包、`mobile`移动端工程包和`web`工程包。
## 工程结构
```plaintext
├── packages
│ ├── lib-shared # 公共库模块
│ │ ├── api # API 封装
│ │ ├── assets # 静态资源
│ │ ├── enums # 枚举
│ │ ├── hooks # 钩子函数
│ │ ├── locale # 国际化封装
│ │ ├── method # 工具函数
│ │ ├── model # 数据模型
│ │ ├── types # 全局类型声明
│ ├── mobile # 移动端项目
│ ├── web # WEB 端项目
```
## 工程初始化&运行
`/packages`目录下运行依赖安装命令:
```node
pnpm i -w
```
统一构建工程:
```node
npm run build
```
## mobile 移动端工程包
移动端工程由 Vite+Vue3+TS+Vant-UI 基础框架组成。
运行移动端项目:
```node
cd package/mobile
npm run dev
```
`package/mobile`下单独构建移动端项目:
```node
npm run build
```
### mobile 调试&开发
移动端项目接入了企业微信登录,所以在 PC 上开发调试时需要模拟登录态方便快速开发调试:
1. 先运行 `web` 项目,并登录,登录后打开控制台,将`localStorage`中的`sessionId``csrfToken`俩属性及值复制
2. 运行 `mobile` 项目,打开控制台,将第 1 步复制的`localStorage`属性值粘贴后,刷新页面即可模拟完成登录(登录过期的话重新登录`web`后再复制新的属性值到`mobile`页面中替换即可)
3. 在手机端调试,进入页面授权登录后,切换到`我的`菜单,短时间内点击 10 次用户名区域可唤出`Eruda`调试工具
## WEB 端工程包
WEB 端工程由 Vite+Vue3+TS+Naive-UI 基础框架组成。
运行 WEB 端项目:
```node
cd package/web
npm run dev
```
`package/web`下单独构建 WEB 端项目:
```node
npm run build
```

View File

@@ -0,0 +1,3 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
};

95
frontend/package.json Normal file
View File

@@ -0,0 +1,95 @@
{
"name": "vue-login-cordys",
"version": "1.0.0",
"description": "A simple Vue 3 login page cordys",
"main": "index.js",
"workspaces": [
"packages/mobile",
"packages/web"
],
"scripts": {
"build": "pnpm -r run build",
"prepare": "cd .. && husky install frontend/.husky"
},
"keywords": [],
"author": "",
"license": "MIT",
"dependencies": {
"@cordys/mobile": "workspace:mobile",
"@cordys/web": "workspace:web",
"@lib/shared": "workspace:lib-shared",
"@types/node": "^22.10.2",
"@vitejs/plugin-legacy": "^6.0.0",
"@vueuse/core": "^10.11.0",
"axios": "^1.7.2",
"canvg": "^4.0.2",
"dayjs": "^1.11.11",
"dotenv": "^16.4.5",
"echarts": "^5.5.1",
"element-china-area-data": "^6.1.0",
"html2canvas-pro": "^1.5.8",
"jsencrypt": "^3.3.2",
"jspdf": "^4.2.0",
"localforage": "^1.10.0",
"lodash-es": "^4.17.21",
"mitt": "^3.0.1",
"pinia": "^2.3.0",
"pinia-plugin-persistedstate": "^3.2.1",
"query-string": "^8.2.0",
"vue": "3.5.22",
"vue-echarts": "^6.7.3",
"vue-i18n": "^9.13.1",
"vue-router": "^4.5.0"
},
"devDependencies": {
"@commitlint/cli": "^17.8.1",
"@commitlint/config-conventional": "^17.8.1",
"@eslint/compat": "^1.4.1",
"@eslint/eslintrc": "^3.3.1",
"@eslint/js": "^9.39.1",
"@types/lodash": "^4.17.6",
"@types/lodash-es": "^4.17.12",
"@types/nprogress": "^0.2.3",
"@types/pretty": "^2.0.3",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@typescript-eslint/eslint-plugin": "^8.46.4",
"@typescript-eslint/parser": "^8.46.4",
"autoprefixer": "^10.4.19",
"eslint": "^9.39.1",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^10.1.8",
"eslint-import-resolver-typescript": "^4.4.4",
"eslint-plugin-import": "^2.32.0",
"eslint-plugin-prettier": "^5.5.4",
"eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-vue": "^10.5.1",
"globals": "^16.5.0",
"husky": "^8.0.3",
"jiti": "^2.6.1",
"lint-staged": "^13.3.0",
"postcss": "^8.4.45",
"postcss-html": "^1.7.0",
"postcss-import": "^16.1.0",
"postcss-less": "^6.0.0",
"prettier": "^2.8.8",
"prettier-plugin-tailwindcss": "^0.3.0",
"stylelint": "^14.16.1",
"stylelint-config-html": "^1.1.0",
"stylelint-config-prettier": "^9.0.5",
"stylelint-config-rational-order": "^0.1.2",
"stylelint-config-recommended": "^7.0.0",
"stylelint-config-recommended-less": "^1.0.4",
"stylelint-config-recommended-scss": "^7.0.0",
"stylelint-config-recommended-vue": "^1.5.0",
"stylelint-config-standard": "^25.0.0",
"stylelint-config-standard-scss": "^4.0.0",
"stylelint-less": "^1.0.8",
"stylelint-order": "^5.0.0",
"tailwindcss": "^3.4.4",
"typescript": "5.9.3",
"typescript-eslint": "^8.47.0",
"vue-eslint-parser": "^10.2.0",
"vue-tsc": "3.1.4"
}
}

View File

@@ -0,0 +1,5 @@
/*.json
/src/**/*.json
dist
postcss.config.js
*.md

View File

@@ -0,0 +1,74 @@
{
"globals": {
"Component": true,
"ComponentPublicInstance": true,
"ComputedRef": true,
"DirectiveBinding": true,
"EffectScope": true,
"ExtractDefaultPropTypes": true,
"ExtractPropTypes": true,
"ExtractPublicPropTypes": true,
"InjectionKey": true,
"MaybeRef": true,
"MaybeRefOrGetter": true,
"PropType": true,
"Ref": true,
"VNode": true,
"WritableComputedRef": true,
"computed": true,
"createApp": true,
"customRef": true,
"defineAsyncComponent": true,
"defineComponent": true,
"effectScope": true,
"getCurrentInstance": true,
"getCurrentScope": true,
"h": true,
"inject": true,
"isProxy": true,
"isReactive": true,
"isReadonly": true,
"isRef": true,
"markRaw": true,
"nextTick": true,
"onActivated": true,
"onBeforeMount": true,
"onBeforeUnmount": true,
"onBeforeUpdate": true,
"onDeactivated": true,
"onErrorCaptured": true,
"onMounted": true,
"onRenderTracked": true,
"onRenderTriggered": true,
"onScopeDispose": true,
"onServerPrefetch": true,
"onUnmounted": true,
"onUpdated": true,
"onWatcherCleanup": true,
"provide": true,
"reactive": true,
"readonly": true,
"ref": true,
"resolveComponent": true,
"shallowReactive": true,
"shallowReadonly": true,
"shallowRef": true,
"toRaw": true,
"toRef": true,
"toRefs": true,
"toValue": true,
"triggerRef": true,
"unref": true,
"useAttrs": true,
"useCssModule": true,
"useCssVars": true,
"useId": true,
"useModel": true,
"useSlots": true,
"useTemplateRef": true,
"watch": true,
"watchEffect": true,
"watchPostEffect": true,
"watchSyncEffect": true
}
}

View File

@@ -0,0 +1,140 @@
// eslint-disable-next-line @typescript-eslint/no-var-requires
const path = require('path');
module.exports = {
root: true,
parser: 'vue-eslint-parser',
parserOptions: {
// Parser that checks the content of the <script> tag
parser: '@typescript-eslint/parser',
sourceType: 'module',
ecmaVersion: 2020,
ecmaFeatures: {
jsx: true,
},
},
env: {
'browser': true,
'node': true,
'vue/setup-compiler-macros': true,
},
plugins: ['@typescript-eslint', 'simple-import-sort'],
extends: [
// Airbnb JavaScript Style Guide https://github.com/airbnb/javascript
'airbnb-base',
'plugin:@typescript-eslint/recommended',
'plugin:import/recommended',
'plugin:import/typescript',
'plugin:vue/vue3-recommended',
'plugin:prettier/recommended',
'./.eslintrc-auto-import.json',
],
settings: {
'import/resolver': {
typescript: {
project: path.resolve(__dirname, './tsconfig.json'),
},
},
},
rules: {
'prettier/prettier': 1,
// Vue: Recommended rules to be closed or modify
'vue/require-default-prop': 0,
'vue/singleline-html-element-content-newline': 0,
'vue/max-attributes-per-line': 0,
// Vue: Add extra rules
'vue/custom-event-name-casing': [2, 'camelCase'],
'vue/no-v-text': 1,
'vue/padding-line-between-blocks': 1,
'vue/require-direct-export': 1,
'vue/multi-word-component-names': 0,
// Allow @ts-ignore comment
'@typescript-eslint/ban-ts-comment': 0,
'@typescript-eslint/no-unused-vars': 1,
'@typescript-eslint/no-empty-function': 1,
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/no-duplicate-enum-values': 0,
'consistent-return': 'off',
'vue/return-in-computed-property': ['off'],
'vue/no-side-effects-in-computed-properties': 'off',
'import/no-unresolved': [
'error',
{
ignore: ['^@lib/shared', '^@web/'],
},
],
'import/extensions': [
2,
'ignorePackages',
{
js: 'never',
jsx: 'never',
ts: 'never',
tsx: 'never',
},
],
'no-debugger': 2,
'no-param-reassign': 0,
'prefer-regex-literals': 0,
'import/no-extraneous-dependencies': 0,
'import/no-cycle': 'off',
'import/order': 'off',
'class-methods-use-this': 'off',
'global-require': 0,
'no-plusplus': 'off',
'no-underscore-dangle': 'off',
'vue/attributes-order': 1,
'simple-import-sort/exports': 'error',
'no-case-declarations': 'off',
// 调整导入语句的顺序
'simple-import-sort/imports': [
'error',
{
groups: [
[
'^vue$',
'^vue-router$',
'^vue-i18n$',
'^pinia$',
'^@vueuse/core$',
'^naive-ui$',
'^lodash-es$',
'^axios$',
'^dayjs$',
'^jsencrypt$',
'^echarts$',
'^localforage$',
], // node依赖
['.*/assets/.*', '^@/assets$'], // 项目静态资源
['^@/components/pure/.*', '^@/components/business/.*', '.*\\.vue$'], // 组件
[
'^@/api($|/.*)',
'^@/config($|/.*)',
'^@/directive($|/.*)',
'^@/hooks($|/.*)',
'^@/locale($|/.*)',
'^@/router($|/.*)',
'^@/store($|/.*)',
'^@/utils($|/.*)',
], // 项目公共模块
['^@/models($|/.*)', '^@/enums($|/.*)'], // model、enum
['^type'], // 第三方类型声明 or 全局类型声明
],
},
],
},
// 对特定文件进行配置
overrides: [
{
files: ['src/enums/**/*.ts'],
rules: {
'no-shadow': 'off', // eslint会报错提示重复声明暂未找到问题原因先关闭
// 可以在这里添加更多的规则禁用
},
},
],
globals: {
// 在这里添加全局变量
NodeJS: 'readonly',
},
};

View File

@@ -0,0 +1,207 @@
import { cloneDeep } from 'lodash-es';
import axios from 'axios';
import { ContentTypeEnum } from '../../enums/httpEnum';
import { isFunction } from '../../method/is';
import type { RequestOptions, Result, UploadFileParams } from '../../types/axios';
import { AxiosCanceler } from './axiosCancel';
import type { CreateAxiosOptions } from './axiosTransform';
import type { AxiosError, AxiosInstance, AxiosRequestConfig, AxiosResponse, InternalAxiosRequestConfig } from 'axios';
export * from './axiosTransform';
/**
* @description: 封装axios请求返回重新封装的数据格式
*/
export class CordysAxios {
public axiosInstance: AxiosInstance;
private readonly options: CreateAxiosOptions;
constructor(options: CreateAxiosOptions) {
this.options = options;
this.axiosInstance = axios.create(options);
this.setupInterceptors();
}
private getTransform() {
const { transform } = this.options;
return transform;
}
/**
* @description: 拦截器配置
*/
private setupInterceptors() {
const transform = this.getTransform();
if (!transform) {
return;
}
const { requestInterceptors, responseInterceptors, responseInterceptorsCatch } = transform;
const axiosCanceler = new AxiosCanceler();
// TODO: 拦截配置升级了 请求拦截器
this.axiosInstance.interceptors.request.use((config: CreateAxiosOptions) => {
// 如果ignoreCancelToken为true则不添加到pending中
const ignoreCancelToken = config.requestOptions?.ignoreCancelToken;
const ignoreCancel =
ignoreCancelToken !== undefined ? ignoreCancelToken : this.options.requestOptions?.ignoreCancelToken;
if (!ignoreCancel) {
axiosCanceler.addPending(config);
}
if (requestInterceptors && isFunction(requestInterceptors)) {
config = requestInterceptors(config, this.options);
}
// TODO: 拦截配置升级了,暂时 as 处理
return config as InternalAxiosRequestConfig;
}, undefined);
// 响应拦截器
this.axiosInstance.interceptors.response.use((res: AxiosResponse<any>) => {
if (res) {
axiosCanceler.removePending(res.config);
}
if (responseInterceptors && isFunction(responseInterceptors)) {
res = responseInterceptors(res);
}
return res;
}, undefined);
// 响应错误处理
if (responseInterceptorsCatch && isFunction(responseInterceptorsCatch)) {
this.axiosInstance.interceptors.response.use(undefined, responseInterceptorsCatch);
}
}
/**
* @description: 文件上传
*/
uploadFile<T = any>(
config: AxiosRequestConfig & RequestOptions,
params: UploadFileParams,
customFileKey = '',
isMultiple = false
): Promise<T> {
const formData = new window.FormData();
const fileName = isMultiple ? 'files' : 'file';
if (customFileKey !== '') {
params.fileList.forEach((file: File) => {
formData.append(customFileKey, file);
});
} else if (!isMultiple && !customFileKey) {
params.fileList.forEach((file: File) => {
formData.append(fileName, file);
});
} else {
params.fileList.forEach((item: any) => {
formData.append(fileName, item.file, item.file.name);
});
}
if (params.request) {
const requestData = JSON.stringify(params.request);
formData.append('request', new Blob([requestData], { type: ContentTypeEnum.JSON }));
}
const transform = this.getTransform();
const { requestOptions } = this.options;
const opt = { ...requestOptions, isTransformResponse: false };
const { transformRequestHook } = transform || {};
return new Promise((resolve, reject) => {
this.axiosInstance
.request<any, AxiosResponse<Result>>({
...config,
method: 'POST',
data: formData,
headers: {
'Content-type': ContentTypeEnum.FORM_DATA,
},
// @ts-ignore
requestOptions: {
ignoreCancelToken: true, // 文件上传请求不需要添加到pending中以免路由切换导致文件上传请求被取消
},
})
.then((res: AxiosResponse<Result>) => {
// 请求成功后的处理
if (transformRequestHook && isFunction(transformRequestHook)) {
try {
const ret = transformRequestHook(res, opt);
resolve(ret);
} catch (err) {
reject(err || new Error('request error!'));
}
return;
}
resolve(res as unknown as Promise<T>);
})
.catch((e: Error | AxiosError) => {
if (axios.isAxiosError(e)) {
// 在这可重写axios错误消息
// eslint-disable-next-line no-console
console.log(e);
}
reject(e);
});
});
}
get<T = any>(config: AxiosRequestConfig, options?: RequestOptions): Promise<T> {
return this.request({ ...config, method: 'GET' }, options);
}
post<T = any>(config: AxiosRequestConfig, options?: RequestOptions): Promise<T> {
return this.request({ ...config, method: 'POST' }, options);
}
put<T = any>(config: AxiosRequestConfig, options?: RequestOptions): Promise<T> {
return this.request({ ...config, method: 'PUT' }, options);
}
delete<T = any>(config: AxiosRequestConfig, options?: RequestOptions): Promise<T> {
return this.request({ ...config, method: 'DELETE' }, options);
}
request<T = any>(config: AxiosRequestConfig, options?: RequestOptions): Promise<T> {
let conf: CreateAxiosOptions = cloneDeep(config);
const transform = this.getTransform();
const { requestOptions } = this.options;
const opt = { ...requestOptions, ...options };
const { beforeRequestHook, transformRequestHook } = transform || {};
// 请求之前处理config
if (beforeRequestHook && isFunction(beforeRequestHook)) {
conf = beforeRequestHook(conf, opt);
}
conf.requestOptions = opt;
return new Promise((resolve, reject) => {
this.axiosInstance
.request<any, AxiosResponse<Result>>(conf)
.then((res: AxiosResponse<Result>) => {
// 请求成功后的处理
if (transformRequestHook && isFunction(transformRequestHook)) {
try {
const ret = transformRequestHook(res, opt);
resolve(ret);
} catch (err) {
reject(err || new Error('request error!'));
}
return;
}
resolve(res as unknown as Promise<T>);
})
.catch((e: Error | AxiosError) => {
if (axios.isAxiosError(e)) {
// 在这可重写axios错误消息
// eslint-disable-next-line no-console
console.log(e);
}
reject(e);
});
});
}
}

View File

@@ -0,0 +1,63 @@
import axios from 'axios';
import { isFunction } from '../../method/is';
import type { AxiosRequestConfig, Canceler } from 'axios';
let pendingMap = new Map<string, Canceler>();
export const getPendingUrl = (config: AxiosRequestConfig) => [config.method, config.url].join('&');
export class AxiosCanceler {
/**
* 添加请求
* @param {Object} config
*/
addPending(config: AxiosRequestConfig) {
this.removePending(config);
const url = getPendingUrl(config);
config.cancelToken =
config.cancelToken ||
new axios.CancelToken((cancel) => {
if (!pendingMap.has(url)) {
// 非重复请求存入pending中
pendingMap.set(url, cancel);
}
});
}
/**
* @description: 清理全部pending中的请求
*/
removeAllPending() {
pendingMap.forEach((cancel) => {
if (cancel && isFunction(cancel)) {
cancel();
}
});
pendingMap.clear();
}
/**
* 取消并移除指定请求
* @param {Object} config
*/
removePending(config: AxiosRequestConfig) {
const url = getPendingUrl(config);
if (pendingMap.has(url)) {
// 根据标识找到pending中对应的请求并取消
const cancel = pendingMap.get(url);
if (cancel && isFunction(cancel)) {
cancel(url);
}
pendingMap.delete(url);
}
}
/**
* @description: 重置pending列表
*/
static reset(): void {
pendingMap = new Map<string, Canceler>();
}
}

View File

@@ -0,0 +1,48 @@
/**
* Data processing class, can be configured according to the project
*/
import type { RequestOptions, Result } from '../../types/axios';
import type { AxiosRequestConfig, AxiosResponse } from 'axios';
export abstract class AxiosTransform {
/**
* @description: 请求之前处理配置
*/
beforeRequestHook?: (config: AxiosRequestConfig, options: RequestOptions) => AxiosRequestConfig;
/**
* @description: 处理请求数据。如果数据不是预期格式,可直接抛出错
*/
transformRequestHook?: (res: AxiosResponse<Result>, options: RequestOptions) => any;
/**
* @description: 请求之前的拦截器
*/
// eslint-disable-next-line no-use-before-define
requestInterceptors?: (config: AxiosRequestConfig, options: CreateAxiosOptions) => AxiosRequestConfig;
/**
* @description: 请求之后的拦截器
*/
responseInterceptors?: (res: AxiosResponse<any>) => AxiosResponse<any>;
/**
* @description: 请求之后的拦截器错误处理
*/
responseInterceptorsCatch?: (error: Error) => void;
}
export interface CreateAxiosOptions extends AxiosRequestConfig {
authenticationScheme?: string;
transform?: AxiosTransform;
requestOptions?: RequestOptions;
useAppStore?: any;
showErrorMsg?: (options: any) => void;
checkStatus?: (
status: number,
msg: string,
msgDetail: string | Record<string, any>,
code?: number,
noErrorTip?: boolean
) => void;
}

View File

@@ -0,0 +1,12 @@
export function joinTimestamp<T extends boolean>(join: boolean, restful: T): T extends true ? string : object;
export function joinTimestamp(join: boolean, restful = false): string | object {
if (!join) {
return restful ? '' : {};
}
const now = new Date().getTime();
if (restful) {
return `?_t=${now}`;
}
return { _t: now };
}

View File

@@ -0,0 +1,191 @@
import { getLocalStorage } from '../../method/local-storage';
import { CordysAxios } from './Axios';
import type { AxiosTransform, CreateAxiosOptions } from './axiosTransform';
import { joinTimestamp } from './helper';
import { ContentTypeEnum, RequestEnum } from '@lib/shared/enums/httpEnum';
import { useI18n } from '@lib/shared/hooks/useI18n';
import { deepMerge, setObjToUrlParams } from '@lib/shared/method';
import { getToken } from '@lib/shared/method/auth';
import { isString } from '@lib/shared/method/is';
import type CommonResponse from '@lib/shared/models/common';
import type { RequestOptions, Result } from '@lib/shared/types/axios';
import type { Recordable } from '@lib/shared/types/global';
import type { AxiosResponse } from 'axios';
export default function createAxios(opt: Partial<CreateAxiosOptions>) {
/**
* @description: 数据处理,方便区分多种处理方式
*/
const transform: AxiosTransform = {
/**
* @description 请求之前处理config
*/
beforeRequestHook: (config, options) => {
const { joinParamsToUrl, joinTime = true } = options;
const params = config.params || {};
const data = config.data || false;
if (config.method?.toUpperCase() === RequestEnum.GET) {
if (!isString(params)) {
// 给 get 请求加上时间戳参数,避免从缓存中拿数据。
config.params = Object.assign(params || {}, joinTimestamp(joinTime, false));
} else {
// 兼容restful风格
config.url = `${config.url}/${params}${joinTimestamp(joinTime, true)}`;
config.params = undefined;
}
} else if (isString(params)) {
// 兼容restful风格
config.url += params;
config.params = undefined;
} else {
if (
Reflect.has(config, 'data') &&
config.data &&
(Object.keys(config.data).length > 0 || Array.isArray(config.data))
) {
config.data = data;
config.params = params;
} else {
// 非GET请求如果没有提供data则将params视为data
config.data = { ...params };
config.params = undefined;
}
if (joinParamsToUrl) {
config.url = setObjToUrlParams(config.url as string, { ...config.params, ...config.data });
}
}
return config;
},
/**
* @description: 处理请求数据。如果数据不是预期格式,可直接抛出错误
*/
transformRequestHook: (res: AxiosResponse<Result>, options: RequestOptions) => {
const { t } = useI18n();
const { isTransformResponse, isReturnNativeResponse } = options;
// 是否返回原生响应头 比如:需要获取响应头时使用该属性
if (isReturnNativeResponse) {
return res;
}
// 不进行任何处理,直接返回
// 用于页面代码可能需要直接获取codedatamessage这些信息时开启
if (!isTransformResponse) {
return res.data;
}
// 错误的时候返回
const { data } = res;
if (!data) {
throw new Error(t('api.apiRequestFailed'));
}
// 这里 coderesultmessage为 后台统一的字段
const { data: dataResult } = data;
// 这里直接返回正常结果,因为拦截器已经拦截了非 200 的请求
return dataResult;
},
/**
* @description: 请求拦截器处理
*/
requestInterceptors: (config) => {
// 请求之前处理config
const currentLocale = localStorage.getItem('CRM-locale') || 'zh-CN';
const app = getLocalStorage<Record<string, any>>('app', true);
const token = getToken();
if (token && (config as Recordable)?.requestOptions?.withToken !== false) {
const { sessionId, csrfToken } = token;
(config as Recordable).headers = {
...config.headers,
'X-AUTH-TOKEN': sessionId,
'CSRF-TOKEN': csrfToken,
'Accept-Language': currentLocale,
'Organization-Id': app?.orgId,
};
}
return config;
},
/**
* @description: 响应拦截器处理
*/
responseInterceptors: (res: AxiosResponse<CommonResponse<any>>) => {
return res;
},
/**
* @description: 响应错误处理
*/
responseInterceptorsCatch: (error: any) => {
const { t } = useI18n();
const { response, code, message, config } = error || {};
const msg: string = response?.data?.message ?? '';
const msgDetail: string = response?.data?.messageDetail ?? '';
const err: string = error?.toString?.() ?? '';
let errMessage = '';
try {
if (code === 'ECONNABORTED' && message.indexOf('timeout') !== -1) {
errMessage = t('api.apiTimeoutMessage');
}
if (err?.includes('Network Error')) {
errMessage = t('api.networkExceptionMsg');
}
if (errMessage) {
opt.showErrorMsg?.({ message: errMessage, duration: 5000 });
return Promise.reject(error);
}
} catch (e) {
throw new Error(e as unknown as string);
}
opt.checkStatus?.(response?.status, msg, msgDetail, response?.data?.code, config?.requestOptions?.noErrorTip);
return Promise.reject(
response?.config?.requestOptions?.isReturnNativeResponse ? response?.data : response?.data?.message || error
);
},
};
return new CordysAxios(
deepMerge(
{
// See https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication#authentication_schemes
// authentication schemese.g: Bearer
// authenticationScheme: 'Bearer',
authenticationScheme: '',
baseURL: `${window.location.origin}/${import.meta.env.VITE_API_BASE_URL as string}`,
timeout: 300 * 1000,
headers: { 'Content-Type': ContentTypeEnum.JSON },
// 如果是form-data格式
// headers: { 'Content-Type': ContentTypeEnum.FORM_URLENCODED },
// 数据处理方式
transform,
// 配置项,下面的选项都可以在独立的接口请求中覆盖
requestOptions: {
// 默认将prefix 添加到url
joinPrefix: true,
// 是否返回原生响应头 比如:需要获取响应头时使用该属性
isReturnNativeResponse: false,
// 需要对返回数据进行处理
isTransformResponse: true,
// post请求的时候添加参数到url
joinParamsToUrl: false,
// 格式化提交参数时间
formatDate: true,
// 消息提示类型
errorMessageMode: 'message',
// 是否加入时间戳
joinTime: true,
// 忽略取消请求的token
ignoreCancelToken: false,
// 是否携带token
withToken: true,
},
},
opt || {}
)
);
}

View File

@@ -0,0 +1,177 @@
import { ThirdPartyResourceConfig } from '@lib/shared/models/system/business';
import type {
AddAgentModuleParams,
AddAgentParams,
AgentApplicationScript,
AgentModuleRenameParams,
AgentModuleTreeNode,
AgentPosParams,
AgentRenameParams,
AgentTableQueryParams,
ApplicationScriptParams,
UpdateAgentParams,
} from '../../models/agent';
import type { ModuleDragParams, TableQueryParams } from '../../models/common';
import {
addAgentUrl,
agentApplicationUrl,
agentCollectPageUrl,
agentCollectUrl,
agentDeleteUrl,
agentDetailUrl,
agentModuleAddUrl,
agentModuleCountUrl,
agentModuleDeleteUrl,
agentModuleMoveUrl,
agentModuleRenameUrl,
agentModuleTreeUrl,
agentOptionUrl,
agentPageUrl,
agentPosUrl,
agentScriptUrl,
agentWorkspaceUrl,
getMkAgentVersionUrl,
getMkApplicationUrl,
renameAgentUrl,
unCollectAgentUrl,
updateAgentUrl,
} from '../requrls/agent';
import type { CrmTreeNodeData } from '@cordys/web/src/components/pure/crm-tree/type';
import type { CordysAxios } from '@lib/shared/api/http/Axios';
export default function useAgentApi(CDR: CordysAxios) {
// 智能体模块重命名
function agentModuleRename(data: AgentModuleRenameParams) {
return CDR.post({ url: agentModuleRenameUrl, data });
}
// 智能体模块移动
function agentModuleMove(data: ModuleDragParams) {
return CDR.post({ url: agentModuleMoveUrl, data });
}
// 智能体模块删除
function agentModuleDelete(ids: string[]) {
return CDR.post({ url: agentModuleDeleteUrl, data: ids });
}
// 添加智能体模块
function agentModuleAdd(data: AddAgentModuleParams) {
return CDR.post({ url: agentModuleAddUrl, data });
}
// 获取智能体模块树
function getAgentModuleTree() {
return CDR.get<CrmTreeNodeData<AgentModuleTreeNode>[]>({ url: agentModuleTreeUrl });
}
// 获取智能体模块树数量
function getAgentModuleTreeCount() {
return CDR.get<Record<string, number>>({ url: agentModuleCountUrl });
}
// 更新智能体
function updateAgent(data: UpdateAgentParams) {
return CDR.post({ url: updateAgentUrl, data });
}
// 智能体重命名
function agentRename(data: AgentRenameParams) {
return CDR.post({ url: renameAgentUrl, data });
}
// 获取智能体列表
function getAgentPage(data: AgentTableQueryParams) {
return CDR.post({ url: agentPageUrl, data });
}
// 获取智能体收藏列表
function getAgentCollectPage(data: TableQueryParams) {
return CDR.post({ url: agentCollectPageUrl, data });
}
// 添加智能体
function addAgent(data: AddAgentParams) {
return CDR.post({ url: addAgentUrl, data });
}
// 取消收藏智能体
function unCollectAgent(id: string) {
return CDR.get({ url: `${unCollectAgentUrl}/${id}` });
}
// 获取智能体详情
function getAgentDetail(id: string) {
return CDR.get({ url: `${agentDetailUrl}/${id}` });
}
// 删除智能体
function agentDelete(id: string) {
return CDR.get({ url: `${agentDeleteUrl}/${id}` });
}
// 收藏智能体
function agentCollect(id: string) {
return CDR.get({ url: `${agentCollectUrl}/${id}` });
}
// 获取智能体选项
function getAgentOptions() {
return CDR.get({ url: agentOptionUrl });
}
// 获取智能体应用
function agentApplicationOptions(workspaceId: string) {
return CDR.get<AgentModuleRenameParams[]>({ url: `${agentApplicationUrl}/${workspaceId}` });
}
// 获取工作空间
function agentWorkspaceOptions() {
return CDR.get<AgentModuleRenameParams[]>({ url: agentWorkspaceUrl });
}
// 获取工作空间应用脚本
function getApplicationScript(data: ApplicationScriptParams) {
return CDR.post<AgentApplicationScript>({ url: agentScriptUrl, data });
}
// 获取智能体mk版本
function getMkAgentVersion() {
return CDR.get<'PE' | 'EE'>({ url: getMkAgentVersionUrl }, { noErrorTip: true });
}
// 智能体排序
function agentPos(data: AgentPosParams) {
return CDR.post({ url: agentPosUrl, data });
}
// 获取智能体mk应用配置
function getMkApplication() {
return CDR.get<ThirdPartyResourceConfig>({ url: getMkApplicationUrl });
}
return {
agentModuleRename,
agentModuleMove,
agentModuleDelete,
agentModuleAdd,
getAgentModuleTree,
getAgentModuleTreeCount,
updateAgent,
agentRename,
getAgentPage,
getAgentCollectPage,
addAgent,
unCollectAgent,
getAgentDetail,
agentDelete,
agentCollect,
getAgentOptions,
agentApplicationOptions,
agentWorkspaceOptions,
getApplicationScript,
getMkAgentVersion,
agentPos,
getMkApplication,
};
}

View File

@@ -0,0 +1,535 @@
import type { CordysAxios } from '@lib/shared/api/http/Axios';
import {
AddClueFollowPlanUrl,
AddClueFollowRecordUrl,
AddClueUrl,
AddClueViewUrl,
AddPoolLeadViewUrl,
AssignClueUrl,
BatchAssignClueUrl,
BatchDeleteCluePoolUrl,
BatchDeleteClueUrl,
BatchPickClueUrl,
BatchToPoolClueUrl,
BatchTransferClueUrl,
BatchUpdateCluePoolUrl,
BatchUpdateLeadUrl,
CancelClueFollowPlanUrl,
ClueTransitionCustomerUrl,
DeleteClueFollowPlanUrl,
DeleteClueFollowRecordUrl,
DeleteCluePoolUrl,
DeleteClueUrl,
DeleteClueViewUrl,
DeletePoolLeadViewUrl,
DownloadTemplateUrl,
DragClueViewUrl,
DragPoolLeadViewUrl,
EnableClueViewUrl,
EnablePoolLeadViewUrl,
ExportClueAllUrl,
ExportCluePoolAllUrl,
ExportCluePoolSelectedUrl,
ExportClueSelectedUrl,
FixedClueViewUrl,
FixedPoolLeadViewUrl,
GenerateLeadChartUrl,
GenerateLeadPoolChartUrl,
GetAdvancedCluePoolListUrl,
GetAdvancedSearchClueDetailUrl,
GetAdvancedSearchClueListUrl,
GetClueFollowPlanListUrl,
GetClueFollowPlanUrl,
GetClueFollowRecordListUrl,
GetClueFollowRecordUrl,
GetClueFormConfigUrl,
GetClueHeaderListUrl,
GetClueListUrl,
GetCluePoolFollowRecordListUrl,
GetCluePoolListUrl,
GetClueTabUrl,
GetClueTransitionCustomerListUrl,
GetClueUrl,
GetClueViewDetailUrl,
GetClueViewListUrl,
GetGlobalCluePoolListUrl,
GetGlobalSearchClueListUrl,
GetPoolClueUrl,
GetPoolLeadViewDetailUrl,
GetPoolLeadViewListUrl,
GetPoolOptionsUrl,
ImportLeadUrl,
MoveToPoolLeadUrl,
PickClueUrl,
PreCheckImportUrl,
ReTransitionCustomerUrl,
TransformClueUrl,
UpdateClueFollowPlanStatusUrl,
UpdateClueFollowPlanUrl,
UpdateClueFollowRecordUrl,
UpdateClueStatusUrl,
UpdateClueUrl,
UpdateClueViewUrl,
UpdatePoolLeadViewUrl,
} from '@lib/shared/api/requrls/clue';
import type {
AssignClueParams,
BatchAssignClueParams,
BatchPickClueParams,
ClueDetail,
ClueListItem,
CluePoolListItem,
CluePoolTableParams,
ClueTransitionCustomerParams,
ConvertClueParams,
PickClueParams,
SaveClueParams,
UpdateClueParams,
} from '@lib/shared/models/clue';
import type {
ChartResponseDataItem,
CommonList,
GenerateChartParams,
TableDraggedParams,
TableExportParams,
TableExportSelectedParams,
} from '@lib/shared/models/common';
import type {
BatchMoveToPublicPoolParams,
BatchUpdatePoolAccountParams,
CustomerContractTableParams,
CustomerFollowPlanTableParams,
CustomerFollowRecordTableParams,
CustomerTabHidden,
CustomerTableParams,
FollowDetailItem,
MoveToPublicPoolParams,
PoolTableExportParams,
SaveCustomerFollowPlanParams,
SaveCustomerFollowRecordParams,
TransferParams,
UpdateCustomerFollowPlanParams,
UpdateCustomerFollowRecordParams,
UpdateFollowPlanStatusParams,
} from '@lib/shared/models/customer';
import type { CluePoolItem, FormDesignConfigDetailParams } from '@lib/shared/models/system/module';
import { ValidateInfo } from '@lib/shared/models/system/org';
import type { ViewItem, ViewParams } from '@lib/shared/models/view';
export default function useProductApi(CDR: CordysAxios) {
// 添加线索
function addClue(data: SaveClueParams) {
return CDR.post({ url: AddClueUrl, data });
}
// 更新线索
function updateClue(data: UpdateClueParams) {
return CDR.post({ url: UpdateClueUrl, data });
}
// 更新线索状态
function updateClueStatus(data: { id: string; stage: string }) {
return CDR.post({ url: UpdateClueStatusUrl, data });
}
// 获取线索列表
function getClueList(data: CustomerTableParams) {
return CDR.post<CommonList<ClueListItem>>({ url: GetClueListUrl, data });
}
// 获取线索转为客户列表
function getClueTransitionCustomerList(data: CustomerTableParams) {
return CDR.post<CommonList<ClueListItem>>({ url: GetClueTransitionCustomerListUrl, data });
}
// 批量转移线索
function batchTransferClue(data: TransferParams) {
return CDR.post({ url: BatchTransferClueUrl, data });
}
// 线索合并客户
function reTransitionCustomer(data: { clueIds: (string | number)[]; customerId: string }) {
return CDR.post({ url: ReTransitionCustomerUrl, data });
}
// 批量移入线索池
function batchToCluePool(data: BatchMoveToPublicPoolParams) {
return CDR.post({ url: BatchToPoolClueUrl, data });
}
// 移入线索池
function moveToLeadPool(data: MoveToPublicPoolParams) {
return CDR.post({ url: MoveToPoolLeadUrl, data });
}
// 导出全量线索池列表
function exportCluePoolAll(data: PoolTableExportParams) {
return CDR.post({ url: ExportCluePoolAllUrl, data });
}
// 导出选中线索池列表
function exportCluePoolSelected(data: TableExportSelectedParams) {
return CDR.post({ url: ExportCluePoolSelectedUrl, data });
}
// 批量删除线索
function batchDeleteClue(data: string[]) {
return CDR.post({ url: BatchDeleteClueUrl, data });
}
// 获取线索表单配置
function getClueFormConfig() {
return CDR.get<FormDesignConfigDetailParams>({ url: GetClueFormConfigUrl });
}
// 获取线索详情
function getClue(id: string) {
return CDR.get<ClueDetail>({ url: `${GetClueUrl}/${id}` });
}
// 删除线索
function deleteClue(id: string) {
return CDR.get({ url: `${DeleteClueUrl}/${id}` });
}
// 转为客户
function ClueTransitionCustomer(data: ClueTransitionCustomerParams) {
return CDR.post({ url: ClueTransitionCustomerUrl, data });
}
// 添加线索跟进记录
function addClueFollowRecord(data: SaveCustomerFollowRecordParams) {
return CDR.post({ url: AddClueFollowRecordUrl, data });
}
// 更新线索跟进记录
function updateClueFollowRecord(data: UpdateCustomerFollowRecordParams) {
return CDR.post({ url: UpdateClueFollowRecordUrl, data });
}
// 获取线索跟进记录列表
function getClueFollowRecordList(data: CustomerFollowRecordTableParams) {
return CDR.post<CommonList<FollowDetailItem>>({ url: GetClueFollowRecordListUrl, data });
}
// 删除线索跟进记录
function deleteClueFollowRecord(id: string) {
return CDR.get({ url: `${DeleteClueFollowRecordUrl}/${id}` });
}
// 获取线索跟进记录详情
function getClueFollowRecord(id: string) {
return CDR.get<FollowDetailItem>({ url: `${GetClueFollowRecordUrl}/${id}` });
}
// 添加线索跟进计划
function addClueFollowPlan(data: SaveCustomerFollowPlanParams) {
return CDR.post({ url: AddClueFollowPlanUrl, data });
}
// 更新线索跟进计划
function updateClueFollowPlan(data: UpdateCustomerFollowPlanParams) {
return CDR.post({ url: UpdateClueFollowPlanUrl, data });
}
// 删除线索跟进计划
function deleteClueFollowPlan(id: string) {
return CDR.get({ url: `${DeleteClueFollowPlanUrl}/${id}` });
}
// 获取线索跟进计划列表
function getClueFollowPlanList(data: CustomerFollowPlanTableParams) {
return CDR.post<CommonList<FollowDetailItem>>({ url: GetClueFollowPlanListUrl, data });
}
// 获取线索跟进计划详情
function getClueFollowPlan(id: string) {
return CDR.get<FollowDetailItem>({ url: `${GetClueFollowPlanUrl}/${id}` });
}
// 取消跟进计划
function cancelClueFollowPlan(id: string) {
return CDR.get({ url: `${CancelClueFollowPlanUrl}/${id}` });
}
// 获取线索负责人列表
function getClueHeaderList(data: CustomerContractTableParams) {
return CDR.get({ url: `${GetClueHeaderListUrl}/${data.sourceId}` });
}
// 线索池领取线索
function pickClue(data: PickClueParams) {
return CDR.post({ url: PickClueUrl, data });
}
// 获取线索池线索列表
function getCluePoolList(data: CluePoolTableParams) {
return CDR.post<CommonList<CluePoolListItem>>({ url: GetCluePoolListUrl, data });
}
// 批量领取线索池线索
function batchPickClue(data: BatchPickClueParams) {
return CDR.post({ url: BatchPickClueUrl, data });
}
// 批量删除线索池线索
function batchDeleteCluePool(data: string[]) {
return CDR.post({ url: BatchDeleteCluePoolUrl, data });
}
// 批量分配线索池线索
function batchAssignClue(data: BatchAssignClueParams) {
return CDR.post({ url: BatchAssignClueUrl, data });
}
// 批量更新线索池线索
function batchUpdateCluePool(data: BatchUpdatePoolAccountParams) {
return CDR.post({ url: BatchUpdateCluePoolUrl, data });
}
// 分配线索池线索
function assignClue(data: AssignClueParams) {
return CDR.post({ url: AssignClueUrl, data });
}
// 获取当前用户线索池选项
function getPoolOptions() {
return CDR.get<CluePoolItem[]>({ url: GetPoolOptionsUrl });
}
// 删除线索池线索
function deleteCluePool(id: string) {
return CDR.get({ url: `${DeleteCluePoolUrl}/${id}` });
}
// 获取线索池跟进记录列表
function getCluePoolFollowRecordList(data: CustomerFollowRecordTableParams) {
return CDR.post<CommonList<FollowDetailItem>>({ url: GetCluePoolFollowRecordListUrl, data });
}
// 获取线索池详情
function getPoolClue(id: string) {
return CDR.get<ClueDetail>({ url: `${GetPoolClueUrl}/${id}` });
}
// 生成线索池图表
function generateLeadPoolChart(data: GenerateChartParams) {
return CDR.post<ChartResponseDataItem[]>({ url: GenerateLeadPoolChartUrl, data });
}
// 获取线索tab显隐藏
function getClueTab() {
return CDR.get<CustomerTabHidden>({ url: GetClueTabUrl });
}
// 更新线索跟进计划状态
function updateClueFollowPlanStatus(data: UpdateFollowPlanStatusParams) {
return CDR.post({ url: UpdateClueFollowPlanStatusUrl, data });
}
// 导出全量线索列表
function exportClueAll(data: TableExportParams) {
return CDR.post({ url: ExportClueAllUrl, data });
}
// 导出选中线索列表
function exportClueSelected(data: TableExportSelectedParams) {
return CDR.post({ url: ExportClueSelectedUrl, data });
}
// 转换线索
function transformClue(data: ConvertClueParams) {
return CDR.post({ url: TransformClueUrl, data });
}
// 生成线索图表
function generateLeadChart(data: GenerateChartParams) {
return CDR.post<ChartResponseDataItem[]>({ url: GenerateLeadChartUrl, data });
}
// 视图
function addClueView(data: ViewParams) {
return CDR.post({ url: AddClueViewUrl, data });
}
function updateClueView(data: ViewParams) {
return CDR.post({ url: UpdateClueViewUrl, data });
}
function getClueViewList() {
return CDR.get<ViewItem[]>({ url: GetClueViewListUrl });
}
function getClueViewDetail(id: string) {
return CDR.get({ url: `${GetClueViewDetailUrl}/${id}` });
}
function fixedClueView(id: string) {
return CDR.get({ url: `${FixedClueViewUrl}/${id}` });
}
function enableClueView(id: string) {
return CDR.get({ url: `${EnableClueViewUrl}/${id}` });
}
function deleteClueView(id: string) {
return CDR.get({ url: `${DeleteClueViewUrl}/${id}` });
}
function dragClueView(data: TableDraggedParams) {
return CDR.post({ url: DragClueViewUrl, data });
}
function preCheckImportLead(file: File) {
return CDR.uploadFile<{ data: ValidateInfo }>({ url: PreCheckImportUrl }, { fileList: [file] }, 'file');
}
function downloadLeadTemplate() {
return CDR.get(
{
url: DownloadTemplateUrl,
responseType: 'blob',
},
{ isTransformResponse: false, isReturnNativeResponse: true }
);
}
function importLead(file: File) {
return CDR.uploadFile({ url: ImportLeadUrl }, { fileList: [file] }, 'file');
}
function getAdvancedSearchClueList(data: CustomerTableParams) {
return CDR.post<CommonList<ClueListItem>>({ url: GetAdvancedSearchClueListUrl, data }, { ignoreCancelToken: true });
}
function getAdvancedSearchClueDetail(data: CustomerTableParams) {
return CDR.post<CommonList<ClueListItem>>({ url: GetAdvancedSearchClueDetailUrl, data });
}
function getAdvancedCluePoolList(data: CluePoolTableParams) {
return CDR.post<CommonList<CluePoolListItem>>(
{ url: GetAdvancedCluePoolListUrl, data },
{ ignoreCancelToken: true }
);
}
function getGlobalSearchClueList(data: CustomerTableParams) {
return CDR.post<CommonList<ClueListItem>>({ url: GetGlobalSearchClueListUrl, data }, { ignoreCancelToken: true });
}
function getGlobalCluePoolList(data: CluePoolTableParams) {
return CDR.post<CommonList<CluePoolListItem>>({ url: GetGlobalCluePoolListUrl, data }, { ignoreCancelToken: true });
}
// 线索池视图
function addLeadPoolView(data: ViewParams) {
return CDR.post({ url: AddPoolLeadViewUrl, data });
}
function updateLeadPoolView(data: ViewParams) {
return CDR.post({ url: UpdatePoolLeadViewUrl, data });
}
function getLeadPoolViewList() {
return CDR.get<ViewItem[]>({ url: GetPoolLeadViewListUrl });
}
function getLeadPoolViewDetail(id: string) {
return CDR.get({ url: `${GetPoolLeadViewDetailUrl}/${id}` });
}
function fixedLeadPoolView(id: string) {
return CDR.get({ url: `${FixedPoolLeadViewUrl}/${id}` });
}
function enableLeadPoolView(id: string) {
return CDR.get({ url: `${EnablePoolLeadViewUrl}/${id}` });
}
function deleteLeadPoolView(id: string) {
return CDR.get({ url: `${DeletePoolLeadViewUrl}/${id}` });
}
function dragLeadPoolView(data: TableDraggedParams) {
return CDR.post({ url: DragPoolLeadViewUrl, data });
}
// 批量更新线索
function batchUpdateLead(data: BatchUpdatePoolAccountParams) {
return CDR.post({ url: BatchUpdateLeadUrl, data });
}
return {
addClue,
updateClue,
updateClueStatus,
getClueList,
batchTransferClue,
batchToCluePool,
batchDeleteClue,
getClueFormConfig,
getClue,
deleteClue,
ClueTransitionCustomer,
addClueFollowRecord,
updateClueFollowRecord,
getClueFollowRecordList,
deleteClueFollowRecord,
getClueFollowRecord,
addClueFollowPlan,
updateClueFollowPlan,
deleteClueFollowPlan,
getClueFollowPlanList,
getClueFollowPlan,
cancelClueFollowPlan,
getClueHeaderList,
pickClue,
getCluePoolList,
batchPickClue,
batchDeleteCluePool,
batchAssignClue,
assignClue,
getPoolOptions,
deleteCluePool,
getCluePoolFollowRecordList,
getPoolClue,
getClueTab,
updateClueFollowPlanStatus,
exportClueAll,
exportClueSelected,
getClueTransitionCustomerList,
reTransitionCustomer,
moveToLeadPool,
addClueView,
deleteClueView,
fixedClueView,
getClueViewDetail,
getClueViewList,
updateClueView,
enableClueView,
dragClueView,
preCheckImportLead,
downloadLeadTemplate,
importLead,
getAdvancedSearchClueList,
getAdvancedCluePoolList,
getAdvancedSearchClueDetail,
getGlobalCluePoolList,
getGlobalSearchClueList,
exportCluePoolAll,
exportCluePoolSelected,
transformClue,
batchUpdateCluePool,
addLeadPoolView,
deleteLeadPoolView,
fixedLeadPoolView,
getLeadPoolViewDetail,
getLeadPoolViewList,
updateLeadPoolView,
enableLeadPoolView,
dragLeadPoolView,
batchUpdateLead,
generateLeadChart,
generateLeadPoolChart,
};
}

View File

@@ -0,0 +1,901 @@
import type { CordysAxios } from '@lib/shared/api/http/Axios';
import type { FormDesignConfigDetailParams } from '@lib/shared/models/system/module';
import type { TableQueryParams } from '@lib/shared/models/common';
import { ValidateInfo } from '@lib/shared/models/system/org';
import {
ContractPageUrl,
ContractAddUrl,
ContractUpdateUrl,
ContractDeleteUrl,
GetContractDetailUrl,
GetContractFormConfigUrl,
GetContractTabUrl,
ChangeContractStatusUrl,
GetContractFormSnapshotConfigUrl,
ExportContractAllUrl,
ExportContractSelectedUrl,
GenerateContractChartUrl,
AddContractViewUrl,
UpdateContractViewUrl,
GetContractViewListUrl,
GetContractViewDetailUrl,
FixedContractViewUrl,
EnableContractViewUrl,
DeleteContractViewUrl,
DragContractViewUrl,
PaymentPlanPageUrl,
PaymentPlanAddUrl,
ContractPaymentPlanPageUrl,
PaymentPlanUpdateUrl,
PaymentPlanDeleteUrl,
GetPaymentPlanDetailUrl,
GetPaymentPlanFormConfigUrl,
GetPaymentPlanTabUrl,
ExportPaymentPlanAllUrl,
ExportPaymentPlanSelectedUrl,
GeneratePaymentPlanChartUrl,
AddPaymentPlanViewUrl,
UpdatePaymentPlanViewUrl,
GetPaymentPlanViewListUrl,
GetPaymentPlanViewDetailUrl,
FixedPaymentPlanViewUrl,
EnablePaymentPlanViewUrl,
DeletePaymentPlanViewUrl,
DragPaymentPlanViewUrl,
BatchApproveContractUrl,
BatchUpdateContractUrl,
ApproveContractUrl,
RevokeContractUrl,
PaymentRecordPageUrl,
PaymentRecordAddUrl,
PaymentRecordUpdateUrl,
PaymentRecordDeleteUrl,
GetPaymentRecordDetailUrl,
GetPaymentRecordFormConfigUrl,
GetPaymentRecordTabUrl,
ExportPaymentRecordAllUrl,
ExportPaymentRecordSelectedUrl,
AddPaymentRecordViewUrl,
UpdatePaymentRecordViewUrl,
GetPaymentRecordViewListUrl,
GetPaymentRecordViewDetailUrl,
FixedPaymentRecordViewUrl,
EnablePaymentRecordViewUrl,
DeletePaymentRecordViewUrl,
DragPaymentRecordViewUrl,
PreCheckPaymentRecordImportUrl,
DownloadPaymentRecordTemplateUrl,
ImportPaymentRecordUrl,
DownloadBusinessTitleTemplateUrl,
ImportBusinessTitleUrl,
PreCheckBusinessTitleImportUrl,
BusinessTitlePageUrl,
BusinessTitleAddUrl,
BusinessTitleUpdateUrl,
BusinessTitleDeleteUrl,
GetBusinessTitleDetailUrl,
BusinessTitleRevokeUrl,
GetBusinessTitleInvoiceCheckUrl,
ExportBusinessTitleSelectedUrl,
ExportBusinessTitleAllUrl,
GetBusinessTitleThirdQueryUrl,
GetBusinessTitleThirdQueryOptionUrl,
BusinessTitleConfigUrl,
BusinessTitleFormConfigSwitchUrl,
ContractInvoicedAddUrl,
ContractInvoicedUpdateUrl,
ContractInvoicedApprovalUrl,
ContractInvoicedDeleteUrl,
ContractInvoicedBatchDeleteUrl,
ContractInvoicedDetailUrl,
ContractInvoicedExportAllUrl,
ContractInvoicedExportSelectedUrl,
ContractInvoicedFormConfigSnapshotUrl,
ContractInvoicedFormConfigUrl,
ContractInvoicedPageUrl,
ContractInvoicedRevokeUrl,
ContractInvoicedTabUrl,
DeleteContractInvoicedViewUrl,
DragContractInvoicedViewUrl,
EnableContractInvoicedViewUrl,
FixedContractInvoicedViewUrl,
GetContractInvoicedViewDetailUrl,
ListContractInvoicedViewUrl,
UpdateContractInvoicedViewUrl,
AddContractInvoicedViewUrl,
BusinessTitleModuleFormUrl,
ContractInvoicedInContractPageUrl,
GetContractDetailSnapshotUrl,
ContractInvoicedDetailSnapshotUrl,
ContractStatisticUrl,
SortContractUrl,
GetPaymentRecordStatisticUrl,
UpdateContractStatusUrl,
UpdateContractStatusRollbackUrl,
SortContractStatusUrl,
AddContractStatusUrl,
GetContractStatusConfigUrl,
DeleteContractStatusUrl,
UpdateContractStageUrl,
SwitchContractCirculationTypeUrl,
SaveContractCirculationConfigUrl,
} from '@lib/shared/api/requrls/contract';
import type { CustomerTabHidden } from '@lib/shared/models/customer';
import type {
ChartResponseDataItem,
CommonList,
GenerateChartParams,
TableDraggedParams,
TableExportParams,
TableExportSelectedParams,
} from '@lib/shared/models/common';
import type { ViewItem, ViewParams } from '@lib/shared/models/view';
import type {
ContractDetail,
ContractItem,
SaveContractParams,
UpdateContractParams,
PaymentPlanItem,
PaymentPlanDetail,
SavePaymentPlanParams,
UpdatePaymentPlanParams,
ApprovalContractParams,
PaymentRecordItem,
PaymentRecordDetail,
SavePaymentRecordParams,
UpdatePaymentRecordParams,
BusinessTitleItem,
SaveBusinessTitleParams,
BusinessTitleValidateConfig,
ContractInvoiceTableQueryParam,
ContractInvoiceItem,
SaveContractInvoiceParams,
UpdateContractInvoiceParams,
ContractInvoiceDetail,
} from '@lib/shared/models/contract';
import type {
BatchOperationResult,
BatchUpdateQuotationStatusParams,
SaveCirculationConfigParams,
UpdateStageParams,
StageBoardDraggedParams,
StageBoardPageQueryParams,
} from '@lib/shared/models/opportunity';
import type { BatchUpdatePoolAccountParams } from '@lib/shared/models/customer';
import {
StageBaseParams,
OpportunityStageConfig,
UpdateOpportunityStageRollbackParams,
UpdateStageBaseParams,
} from '@lib/shared/models/opportunity';
import type { CirculationTypeEnum } from '@lib/shared/enums/opportunityEnum';
export default function useContractApi(CDR: CordysAxios) {
// 合同列表
function getContractList(data: StageBoardPageQueryParams) {
return CDR.post<CommonList<ContractItem>>({ url: ContractPageUrl, data }, { ignoreCancelToken: true });
}
// 合同看板拖拽排序
function sortContract(data: StageBoardDraggedParams) {
return CDR.post({ url: SortContractUrl, data });
}
// 添加合同
function addContract(data: SaveContractParams) {
return CDR.post({ url: ContractAddUrl, data });
}
// 更新合同
function updateContract(data: UpdateContractParams, approvalTaskId?: string) {
return CDR.post({ url: ContractUpdateUrl, data, params: { approvalTaskId } });
}
// 删除合同
function deleteContract(id: string) {
return CDR.get({ url: `${ContractDeleteUrl}/${id}` });
}
// 合同详情
function getContractDetail(id: string, approvalTaskId?: string) {
return CDR.get<ContractDetail>({ url: `${GetContractDetailUrl}/${id}`, params: { approvalTaskId } });
}
// 合同详情快照
function getContractDetailSnapshot(id: string, approvalTaskId?: string) {
return CDR.get<ContractDetail>({ url: `${GetContractDetailSnapshotUrl}/${id}`, params: { approvalTaskId } });
}
// 获取合同表单配置
function getContractFormConfig() {
return CDR.get<FormDesignConfigDetailParams>({
url: GetContractFormConfigUrl,
});
}
function getContractFormSnapshotConfig(id?: string, approvalTaskId?: string) {
return CDR.get<FormDesignConfigDetailParams>({
url: `${GetContractFormSnapshotConfigUrl}/${id}`,
params: { approvalTaskId },
});
}
function changeContractStatus(data: UpdateStageParams) {
return CDR.post({ url: `${ChangeContractStatusUrl}`, data });
}
// 获取合同tab显隐藏
function getContractTab() {
return CDR.get<CustomerTabHidden>({ url: GetContractTabUrl });
}
// 导出全量合同列表
function exportContractAll(data: TableExportParams) {
return CDR.post({ url: ExportContractAllUrl, data });
}
// 导出选中合同列表
function exportContractSelected(data: TableExportSelectedParams) {
return CDR.post({ url: ExportContractSelectedUrl, data });
}
// 生成合同图表
function generateContractChart(data: GenerateChartParams) {
return CDR.post<ChartResponseDataItem[]>({
url: GenerateContractChartUrl,
data,
});
}
function batchApproveContract(data: BatchUpdateQuotationStatusParams) {
return CDR.post<BatchOperationResult>({ url: BatchApproveContractUrl, data });
}
function batchUpdateContract(data: BatchUpdatePoolAccountParams) {
return CDR.post({ url: BatchUpdateContractUrl, data });
}
function approvalContract(data: ApprovalContractParams) {
return CDR.post({ url: ApproveContractUrl, data });
}
function revokeContract(id: string) {
return CDR.get({ url: `${RevokeContractUrl}/${id}` });
}
// 视图
function addContractView(data: ViewParams) {
return CDR.post({ url: AddContractViewUrl, data });
}
function updateContractView(data: ViewParams) {
return CDR.post({ url: UpdateContractViewUrl, data });
}
function getContractViewList() {
return CDR.get<ViewItem[]>({ url: GetContractViewListUrl });
}
function getContractViewDetail(id: string) {
return CDR.get({ url: `${GetContractViewDetailUrl}/${id}` });
}
function fixedContractView(id: string) {
return CDR.get({ url: `${FixedContractViewUrl}/${id}` });
}
function enableContractView(id: string) {
return CDR.get({ url: `${EnableContractViewUrl}/${id}` });
}
function deleteContractView(id: string) {
return CDR.get({ url: `${DeleteContractViewUrl}/${id}` });
}
function dragContractView(data: TableDraggedParams) {
return CDR.post({ url: DragContractViewUrl, data });
}
// 回款计划列表
function getPaymentPlanList(data: TableQueryParams) {
return CDR.post<CommonList<PaymentPlanItem>>({ url: PaymentPlanPageUrl, data });
}
function getContractPaymentPlanList(data: TableQueryParams) {
return CDR.post<CommonList<PaymentPlanItem>>({ url: ContractPaymentPlanPageUrl, data });
}
// 添加回款计划
function addPaymentPlan(data: SavePaymentPlanParams) {
return CDR.post({ url: PaymentPlanAddUrl, data });
}
// 更新回款计划
function updatePaymentPlan(data: UpdatePaymentPlanParams) {
return CDR.post({ url: PaymentPlanUpdateUrl, data });
}
// 删除回款计划
function deletePaymentPlan(id: string) {
return CDR.get({ url: `${PaymentPlanDeleteUrl}/${id}` });
}
// 回款计划详情
function getPaymentPlanDetail(id: string) {
return CDR.get<PaymentPlanDetail>({ url: `${GetPaymentPlanDetailUrl}/${id}` });
}
// 获取回款计划表单配置
function getPaymentPlanFormConfig() {
return CDR.get<FormDesignConfigDetailParams>({
url: GetPaymentPlanFormConfigUrl,
});
}
// 获取回款计划 tab 显隐
function getPaymentPlanTab() {
return CDR.get<CustomerTabHidden>({ url: GetPaymentPlanTabUrl });
}
// 导出全量回款计划
function exportPaymentPlanAll(data: TableExportParams) {
return CDR.post({ url: ExportPaymentPlanAllUrl, data });
}
// 导出选中回款计划
function exportPaymentPlanSelected(data: TableExportSelectedParams) {
return CDR.post({ url: ExportPaymentPlanSelectedUrl, data });
}
// 生成回款计划图表
function generatePaymentPlanChart(data: GenerateChartParams) {
return CDR.post<ChartResponseDataItem[]>({
url: GeneratePaymentPlanChartUrl,
data,
});
}
// 添加视图
function addPaymentPlanView(data: ViewParams) {
return CDR.post({ url: AddPaymentPlanViewUrl, data });
}
// 更新视图
function updatePaymentPlanView(data: ViewParams) {
return CDR.post({ url: UpdatePaymentPlanViewUrl, data });
}
// 获取视图列表
function getPaymentPlanViewList() {
return CDR.get<ViewItem[]>({ url: GetPaymentPlanViewListUrl });
}
// 获取视图详情
function getPaymentPlanViewDetail(id: string) {
return CDR.get({ url: `${GetPaymentPlanViewDetailUrl}/${id}` });
}
// 固定视图
function fixedPaymentPlanView(id: string) {
return CDR.get({ url: `${FixedPaymentPlanViewUrl}/${id}` });
}
// 启用视图
function enablePaymentPlanView(id: string) {
return CDR.get({ url: `${EnablePaymentPlanViewUrl}/${id}` });
}
// 删除视图
function deletePaymentPlanView(id: string) {
return CDR.get({ url: `${DeletePaymentPlanViewUrl}/${id}` });
}
// 拖拽排序视图
function dragPaymentPlanView(data: TableDraggedParams) {
return CDR.post({ url: DragPaymentPlanViewUrl, data });
}
// 回款记录列表
function getPaymentRecordList(data: TableQueryParams) {
return CDR.post<CommonList<PaymentRecordItem>>({ url: PaymentRecordPageUrl, data }, { ignoreCancelToken: true });
}
// 添加回款记录
function addPaymentRecord(data: SavePaymentRecordParams) {
return CDR.post({ url: PaymentRecordAddUrl, data });
}
// 更新回款记录
function updatePaymentRecord(data: UpdatePaymentRecordParams) {
return CDR.post({ url: PaymentRecordUpdateUrl, data });
}
// 删除回款记录
function deletePaymentRecord(id: string) {
return CDR.get({ url: `${PaymentRecordDeleteUrl}/${id}` });
}
// 回款记录详情
function getPaymentRecordDetail(id: string) {
return CDR.get<PaymentRecordDetail>({ url: `${GetPaymentRecordDetailUrl}/${id}` });
}
// 获取回款记录表单配置
function getPaymentRecordFormConfig() {
return CDR.get<FormDesignConfigDetailParams>({
url: GetPaymentRecordFormConfigUrl,
});
}
// 获取回款记录 tab 显隐
function getPaymentRecordTab() {
return CDR.get<CustomerTabHidden>({ url: GetPaymentRecordTabUrl });
}
// 导出全量回款记录
function exportPaymentRecordAll(data: TableExportParams) {
return CDR.post({ url: ExportPaymentRecordAllUrl, data });
}
// 导出选中回款记录
function exportPaymentRecordSelected(data: TableExportSelectedParams) {
return CDR.post({ url: ExportPaymentRecordSelectedUrl, data });
}
// 添加视图
function addPaymentRecordView(data: ViewParams) {
return CDR.post({ url: AddPaymentRecordViewUrl, data });
}
// 更新视图
function updatePaymentRecordView(data: ViewParams) {
return CDR.post({ url: UpdatePaymentRecordViewUrl, data });
}
// 获取视图列表
function getPaymentRecordViewList() {
return CDR.get<ViewItem[]>({ url: GetPaymentRecordViewListUrl });
}
// 获取视图详情
function getPaymentRecordViewDetail(id: string) {
return CDR.get({ url: `${GetPaymentRecordViewDetailUrl}/${id}` });
}
// 固定视图
function fixedPaymentRecordView(id: string) {
return CDR.get({ url: `${FixedPaymentRecordViewUrl}/${id}` });
}
// 启用视图
function enablePaymentRecordView(id: string) {
return CDR.get({ url: `${EnablePaymentRecordViewUrl}/${id}` });
}
// 删除视图
function deletePaymentRecordView(id: string) {
return CDR.get({ url: `${DeletePaymentRecordViewUrl}/${id}` });
}
// 拖拽排序视图
function dragPaymentRecordView(data: TableDraggedParams) {
return CDR.post({ url: DragPaymentRecordViewUrl, data });
}
function preCheckImportContractPaymentRecord(file: File) {
return CDR.uploadFile<{ data: ValidateInfo }>(
{ url: PreCheckPaymentRecordImportUrl },
{ fileList: [file] },
'file'
);
}
function downloadContractPaymentRecordTemplate() {
return CDR.get(
{
url: DownloadPaymentRecordTemplateUrl,
responseType: 'blob',
},
{ isTransformResponse: false, isReturnNativeResponse: true }
);
}
function importContractPaymentRecord(file: File) {
return CDR.uploadFile({ url: ImportPaymentRecordUrl }, { fileList: [file] }, 'file');
}
// 合同-工商抬头导入
function preCheckImportBusinessTitle(file: File, importType?: string) {
return CDR.uploadFile<{ data: ValidateInfo }>(
{ url: PreCheckBusinessTitleImportUrl },
{ fileList: [file], request: { importType } },
'file'
);
}
function downloadBusinessTitleTemplate() {
return CDR.get(
{
url: DownloadBusinessTitleTemplateUrl,
responseType: 'blob',
},
{ isTransformResponse: false, isReturnNativeResponse: true }
);
}
function importBusinessTitle(file: File, importType?: string) {
return CDR.uploadFile({ url: ImportBusinessTitleUrl }, { fileList: [file], request: { importType } }, 'file');
}
// 工商抬头列表
function getBusinessTitleList(data: TableQueryParams) {
return CDR.post<CommonList<BusinessTitleItem>>({ url: BusinessTitlePageUrl, data }, { ignoreCancelToken: true });
}
// 添加工商抬头
function addBusinessTitle(data: SaveBusinessTitleParams) {
return CDR.post({ url: BusinessTitleAddUrl, data });
}
// 更新工商抬头
function updateBusinessTitle(data: SaveBusinessTitleParams) {
return CDR.post({ url: BusinessTitleUpdateUrl, data });
}
// 删除工商抬头
function deleteBusinessTitle(id: string) {
return CDR.get({ url: `${BusinessTitleDeleteUrl}/${id}` });
}
//撤销工商抬头
function revokeBusinessTitle(id: string) {
return CDR.get({ url: `${BusinessTitleRevokeUrl}/${id}` });
}
// 工商抬头详情
function getBusinessTitleDetail(id: string) {
return CDR.get<BusinessTitleItem>({ url: `${GetBusinessTitleDetailUrl}/${id}` });
}
// 工商抬头发票核验
function getBusinessTitleInvoiceCheck(id: string) {
return CDR.get({ url: `${GetBusinessTitleInvoiceCheckUrl}/${id}` });
}
// 导出全量工商抬头
function exportBusinessTitleAll(data: TableExportParams) {
return CDR.post({ url: ExportBusinessTitleAllUrl, data });
}
// 导出选中的工商抬头
function exportBusinessTitleSelected(data: TableExportSelectedParams) {
return CDR.post({ url: ExportBusinessTitleSelectedUrl, data });
}
// 第三方接口分页模糊查询工商名称
function getBusinessTitleThirdQueryOption(data: TableQueryParams) {
return CDR.post<CommonList<string[]>>({ url: GetBusinessTitleThirdQueryOptionUrl, data });
}
// 第三方接口查询工商抬头信息
function getBusinessTitleThirdQuery(keyword: string) {
return CDR.get({ url: GetBusinessTitleThirdQueryUrl, params: { keyword } });
}
// 获取工商抬头表单校验配置
function getBusinessTitleConfig() {
return CDR.get<BusinessTitleValidateConfig[]>({ url: BusinessTitleConfigUrl });
}
// 工商抬头表单配置开关
function switchBusinessTitleFormConfig(id: string) {
return CDR.get({ url: `${BusinessTitleFormConfigSwitchUrl}/${id}` });
}
// 获取工商抬头表单字段
function getBusinessTitleModuleForm() {
return CDR.get<FormDesignConfigDetailParams>({ url: BusinessTitleModuleFormUrl });
}
// 发票列表
function getInvoicedList(data: ContractInvoiceTableQueryParam) {
return CDR.post<CommonList<ContractInvoiceItem>>({ url: ContractInvoicedPageUrl, data });
}
// 合同下的发票列表
function getInvoicedInContractList(data: ContractInvoiceTableQueryParam) {
return CDR.post<CommonList<ContractInvoiceItem>>({ url: ContractInvoicedInContractPageUrl, data });
}
// 添加发票
function addInvoiced(data: SaveContractInvoiceParams) {
return CDR.post({ url: ContractInvoicedAddUrl, data });
}
// 更新发票
function updateInvoiced(data: UpdateContractInvoiceParams, approvalTaskId?: string) {
return CDR.post({ url: ContractInvoicedUpdateUrl, data, params: { approvalTaskId } });
}
// 发票详情
function getInvoicedDetail(id: string, approvalTaskId?: string) {
return CDR.get<ContractInvoiceDetail>({ url: `${ContractInvoicedDetailUrl}/${id}`, params: { approvalTaskId } });
}
// 发票详情快照
function getInvoicedDetailSnapshot(id: string, approvalTaskId?: string) {
return CDR.get<ContractInvoiceDetail>({
url: `${ContractInvoicedDetailSnapshotUrl}/${id}`,
params: { approvalTaskId },
});
}
// 获取发票表单配置
function getInvoicedFormConfig() {
return CDR.get<FormDesignConfigDetailParams>({
url: ContractInvoicedFormConfigUrl,
});
}
// 获取发票表单配置快照
function getInvoicedFormSnapshotConfig(id?: string, approvalTaskId?: string) {
return CDR.get<FormDesignConfigDetailParams>({
url: `${ContractInvoicedFormConfigSnapshotUrl}/${id}`,
params: { approvalTaskId },
});
}
// 发票审批
function approvalInvoiced(data: ApprovalContractParams) {
return CDR.post({ url: ContractInvoicedApprovalUrl, data });
}
// 发票撤回
function revokeInvoiced(id: string) {
return CDR.get({ url: `${ContractInvoicedRevokeUrl}/${id}` });
}
// 删除发票
function deleteInvoiced(id: string) {
return CDR.get({ url: `${ContractInvoicedDeleteUrl}/${id}` });
}
// 发票批量删除
function batchDeleteInvoiced(ids: string[]) {
return CDR.post({ url: ContractInvoicedBatchDeleteUrl, data: ids });
}
// 导出全量发票
function exportInvoicedAll(data: TableExportParams) {
return CDR.post({ url: ContractInvoicedExportAllUrl, data });
}
// 导出选中发票
function exportInvoicedSelected(data: TableExportSelectedParams) {
return CDR.post({ url: ContractInvoicedExportSelectedUrl, data });
}
// 获取发票 tab 显隐
function getInvoicedTab() {
return CDR.get<CustomerTabHidden>({ url: ContractInvoicedTabUrl });
}
// 添加发票视图
function addContractInvoicedView(data: ViewParams) {
return CDR.post({ url: AddContractInvoicedViewUrl, data });
}
// 更新发票视图
function updateContractInvoicedView(data: ViewParams) {
return CDR.post({ url: UpdateContractInvoicedViewUrl, data });
}
// 获取发票视图列表
function getContractInvoicedViewList() {
return CDR.get<ViewItem[]>({ url: ListContractInvoicedViewUrl });
}
// 获取发票视图详情
function getContractInvoicedViewDetail(id: string) {
return CDR.get({ url: `${GetContractInvoicedViewDetailUrl}/${id}` });
}
// 固定发票视图
function fixedContractInvoicedView(id: string) {
return CDR.get({ url: `${FixedContractInvoicedViewUrl}/${id}` });
}
// 启用/禁用发票视图
function enableContractInvoicedView(id: string) {
return CDR.get({ url: `${EnableContractInvoicedViewUrl}/${id}` });
}
// 删除发票视图
function deleteContractInvoicedView(id: string) {
return CDR.get({ url: `${DeleteContractInvoicedViewUrl}/${id}` });
}
// 拖拽发票视图排序
function dragContractInvoicedView(data: TableDraggedParams) {
return CDR.post({ url: DragContractInvoicedViewUrl, data });
}
// 合同统计
function getContractStatistic(data: TableQueryParams) {
return CDR.post({ url: ContractStatisticUrl, data }, { ignoreCancelToken: true });
}
// 回款记录统计
function getPaymentRecordStatistic(data: TableQueryParams) {
return CDR.post({ url: GetPaymentRecordStatisticUrl, data }, { ignoreCancelToken: true });
}
// 更新合同状态配置
function updateContractStatus(data: UpdateStageBaseParams) {
return CDR.post({ url: UpdateContractStatusUrl, data });
}
// 合同状态回退配置
function updateContractStatusRollback(data: UpdateOpportunityStageRollbackParams) {
return CDR.post({ url: UpdateContractStatusRollbackUrl, data });
}
// 合同状态排序
function sortContractStatus(data: string[]) {
return CDR.post({ url: SortContractStatusUrl, data });
}
// 添加合同状态
function addContractStatus(data: StageBaseParams) {
return CDR.post({ url: AddContractStatusUrl, data });
}
// 获取合同状态配置
function getContractStatusConfig() {
return CDR.get<OpportunityStageConfig>({ url: GetContractStatusConfigUrl }, { ignoreCancelToken: true });
}
// 删除合同状态
function deleteContractStatus(id: string) {
return CDR.get({ url: `${DeleteContractStatusUrl}/${id}` });
}
// 更新阶段
function updateContractStage(data: { id: string; stage: string }) {
return CDR.post({ url: UpdateContractStageUrl, data });
}
// 保存高级流转配置
function saveContractAdvanceConfig(data: SaveCirculationConfigParams) {
return CDR.post({ url: SaveContractCirculationConfigUrl, data });
}
// 切换流转配置
function switchContractCirculationType(type: CirculationTypeEnum) {
return CDR.get({ url: `${SwitchContractCirculationTypeUrl}/${type}` });
}
return {
exportContractAll,
exportContractSelected,
generateContractChart,
getContractDetail,
getContractDetailSnapshot,
getContractList,
sortContract,
getContractTab,
getContractViewDetail,
getContractViewList,
addContractView,
updateContractView,
fixedContractView,
enableContractView,
deleteContractView,
dragContractView,
addContract,
updateContract,
deleteContract,
changeContractStatus,
getContractFormConfig,
getContractFormSnapshotConfig,
batchApproveContract,
batchUpdateContract,
approvalContract,
revokeContract,
getContractStatistic,
// 回款计划
getPaymentPlanList,
getContractPaymentPlanList,
addPaymentPlan,
updatePaymentPlan,
deletePaymentPlan,
getPaymentPlanDetail,
getPaymentPlanFormConfig,
getPaymentPlanTab,
exportPaymentPlanAll,
exportPaymentPlanSelected,
generatePaymentPlanChart,
addPaymentPlanView,
updatePaymentPlanView,
getPaymentPlanViewList,
getPaymentPlanViewDetail,
fixedPaymentPlanView,
enablePaymentPlanView,
deletePaymentPlanView,
dragPaymentPlanView,
// 回款记录
getPaymentRecordFormConfig,
addPaymentRecord,
updatePaymentRecord,
getPaymentRecordDetail,
getPaymentRecordList,
deletePaymentRecord,
getPaymentRecordTab,
exportPaymentRecordAll,
exportPaymentRecordSelected,
addPaymentRecordView,
updatePaymentRecordView,
getPaymentRecordViewList,
getPaymentRecordViewDetail,
fixedPaymentRecordView,
enablePaymentRecordView,
deletePaymentRecordView,
dragPaymentRecordView,
preCheckImportContractPaymentRecord,
importContractPaymentRecord,
downloadContractPaymentRecordTemplate,
getPaymentRecordStatistic,
// 合同工商抬头
preCheckImportBusinessTitle,
downloadBusinessTitleTemplate,
importBusinessTitle,
getBusinessTitleList,
addBusinessTitle,
updateBusinessTitle,
deleteBusinessTitle,
revokeBusinessTitle,
getBusinessTitleDetail,
getBusinessTitleInvoiceCheck,
exportBusinessTitleAll,
exportBusinessTitleSelected,
getBusinessTitleThirdQuery,
getBusinessTitleThirdQueryOption,
getBusinessTitleConfig,
switchBusinessTitleFormConfig,
getBusinessTitleModuleForm,
// 发票
getInvoicedList,
getInvoicedInContractList,
addInvoiced,
updateInvoiced,
getInvoicedDetail,
getInvoicedDetailSnapshot,
getInvoicedFormConfig,
getInvoicedFormSnapshotConfig,
approvalInvoiced,
revokeInvoiced,
deleteInvoiced,
batchDeleteInvoiced,
exportInvoicedAll,
exportInvoicedSelected,
addContractInvoicedView,
updateContractInvoicedView,
getContractInvoicedViewList,
getContractInvoicedViewDetail,
fixedContractInvoicedView,
enableContractInvoicedView,
deleteContractInvoicedView,
dragContractInvoicedView,
getInvoicedTab,
// 合同阶段
updateContractStatus,
updateContractStatusRollback,
sortContractStatus,
addContractStatus,
getContractStatusConfig,
deleteContractStatus,
updateContractStage,
saveContractAdvanceConfig,
switchContractCirculationType,
};
}

View File

@@ -0,0 +1,204 @@
import type { CordysAxios } from '@lib/shared/api/http/Axios';
import {
AddCustomFormUrl,
GetCustomFormAdminUrl,
GetCustomFormRoleUserDeptTreeUrl,
GetCustomFormRoleUserRoleTreeUrl,
GetCustomFormRoleListUrl,
GetCustomFormRoleUsersUrl,
GetCustomFormUrl,
RelateCustomFormMemberUrl,
RemoveCustomFormMemberUrl,
SaveCustomFormAdminUrl,
UpdateCustomFormUrl,
GetCustomFormDataDetailUrl,
GetCustomFormDataPageUrl,
AddCustomFormDataUrl,
UpdateCustomFormDataUrl,
DeleteCustomFormDataUrl,
BatchDeleteCustomFormDataUrl,
BatchUpdateCustomFormDataUrl,
GetCustomFormListUrl,
GetCustomFormOptionsUrl,
DeleteCustomFormUrl,
EnableCustomFormUrl,
DisableCustomFormUrl,
PreCheckCustomFormImportUrl,
DownloadCustomFormTemplateUrl,
ImportCustomFormUrl,
CustomFormExportAllUrl,
CustomFormExportSelectedUrl,
} from '@lib/shared/api/requrls/customForm';
import type { CommonList, TableExportParams, TableExportSelectedParams } from '@lib/shared/models/common';
import type {
AddCustomFormDataParams,
BatchUpdateCustomFormDataParams,
CustomFormAdminParams,
CustomFormDataDetail,
CustomFormDetail,
CustomFormItem,
CustomFormMemberItem,
CustomFormRoleItem,
CustomFormRoleUserQueryParams,
CustomFormPageItem,
CustomFormSaveRequest,
GetCustomFormDataPageParams,
RelateCustomFormMemberParams,
UpdateCustomFormDataParams,
} from '@lib/shared/models/customForm';
import type { SelectedUsersItem } from '@lib/shared/models/system/module';
import type { DeptUserTreeNode } from '@lib/shared/models/system/role';
import { ValidateInfo } from '@lib/shared/models/system/org';
export default function useCustomFormApi(CDR: CordysAxios) {
function addCustomForm(data: CustomFormSaveRequest) {
return CDR.post({ url: AddCustomFormUrl, data });
}
function updateCustomForm(data: CustomFormSaveRequest) {
return CDR.post({ url: UpdateCustomFormUrl, data });
}
function getCustomFormDetail(id?: string) {
return CDR.get<CustomFormDetail>({ url: `${GetCustomFormUrl}/${id}` });
}
function getCustomFormAdmins(customFormId: string) {
return CDR.get<SelectedUsersItem[]>({ url: `${GetCustomFormAdminUrl}/${customFormId}` });
}
function saveCustomFormAdmins(data: CustomFormAdminParams) {
return CDR.post({ url: SaveCustomFormAdminUrl, data });
}
// 表单成员
function relateCustomFormMember(data: RelateCustomFormMemberParams) {
return CDR.post({ url: RelateCustomFormMemberUrl, data });
}
function getCustomFormRoles(customFormId: string) {
return CDR.get<CustomFormRoleItem[]>({ url: `${GetCustomFormRoleListUrl}/${customFormId}` });
}
function getCustomFormRoleUsers(data: CustomFormRoleUserQueryParams) {
return CDR.post<CommonList<CustomFormMemberItem>>({ url: GetCustomFormRoleUsersUrl, data });
}
function getCustomFormRoleUserDeptTree() {
return CDR.get<DeptUserTreeNode[]>({ url: GetCustomFormRoleUserDeptTreeUrl });
}
function getCustomFormRoleUserRoleTree() {
return CDR.get<DeptUserTreeNode[]>({ url: GetCustomFormRoleUserRoleTreeUrl });
}
function removeCustomFormMember(data: RelateCustomFormMemberParams) {
return CDR.post({ url: RemoveCustomFormMemberUrl, data });
}
function deleteCustomForm(id: string) {
return CDR.get({ url: `${DeleteCustomFormUrl}/${id}` });
}
function enableCustomForm(id: string) {
return CDR.get({ url: `${EnableCustomFormUrl}/${id}` });
}
function disableCustomForm(id: string) {
return CDR.get({ url: `${DisableCustomFormUrl}/${id}` });
}
function getCustomFormList() {
return CDR.get<CustomFormItem[]>({ url: GetCustomFormListUrl });
}
function getCustomFormDataDetail(id: string) {
return CDR.get<CustomFormDataDetail>({ url: `${GetCustomFormDataDetailUrl}/${id}` });
}
function getCustomFormDataPage(data: GetCustomFormDataPageParams) {
return CDR.post<CommonList<CustomFormPageItem>>({ url: GetCustomFormDataPageUrl, data });
}
function addCustomFormData(data: AddCustomFormDataParams) {
return CDR.post({ url: AddCustomFormDataUrl, data });
}
function updateCustomFormData(data: UpdateCustomFormDataParams) {
return CDR.post({ url: UpdateCustomFormDataUrl, data });
}
function deleteCustomFormData(id: string) {
return CDR.get({ url: `${DeleteCustomFormDataUrl}/${id}` });
}
function batchDeleteCustomFormData(ids: string[]) {
return CDR.post({ url: BatchDeleteCustomFormDataUrl, data: ids });
}
function batchUpdateCustomFormData(data: BatchUpdateCustomFormDataParams) {
return CDR.post({ url: BatchUpdateCustomFormDataUrl, data });
}
function getCustomFormOptions() {
return CDR.get<CustomFormItem[]>({ url:GetCustomFormOptionsUrl });
}
function preCheckImportCustomForm(file: File, customFormId?: string) {
return CDR.uploadFile<{ data: ValidateInfo }>({ url: PreCheckCustomFormImportUrl, params:{ customFormId } }, { fileList: [file] }, 'file');
}
function downloadCustomFormTemplate(customFormId?: string) {
return CDR.get(
{
url: DownloadCustomFormTemplateUrl,
responseType: 'blob',
params:{ customFormId },
},
{ isTransformResponse: false, isReturnNativeResponse: true }
);
}
function importCustomForm(file: File, customFormId?: string) {
return CDR.uploadFile({ url: ImportCustomFormUrl, params:{ customFormId } }, { fileList: [file] }, 'file');
}
function exportCustomFormAll(data: TableExportParams) {
return CDR.post({ url: CustomFormExportAllUrl, data });
}
function exportCustomFormSelected(data: TableExportSelectedParams) {
return CDR.post({ url: CustomFormExportSelectedUrl, data });
}
return {
addCustomForm,
updateCustomForm,
getCustomFormDetail,
saveCustomFormAdmins,
getCustomFormAdmins,
relateCustomFormMember,
getCustomFormRoles,
getCustomFormRoleUsers,
getCustomFormRoleUserDeptTree,
getCustomFormRoleUserRoleTree,
removeCustomFormMember,
getCustomFormList,
getCustomFormDataDetail,
getCustomFormDataPage,
addCustomFormData,
updateCustomFormData,
deleteCustomFormData,
batchDeleteCustomFormData,
batchUpdateCustomFormData,
getCustomFormOptions,
deleteCustomForm,
enableCustomForm,
disableCustomForm,
preCheckImportCustomForm,
downloadCustomFormTemplate,
importCustomForm,
exportCustomFormAll,
exportCustomFormSelected,
};
}

View File

@@ -0,0 +1,932 @@
import type { CordysAxios } from '@lib/shared/api/http/Axios';
import {
AddAccountPoolViewUrl,
AddContactViewUrl,
AddCustomerCollaborationUrl,
AddCustomerContactUrl,
AddCustomerFollowPlanUrl,
AddCustomerFollowRecordUrl,
AddCustomerOpenSeaUrl,
AddCustomerRelationItemUrl,
AddCustomerUrl,
AddCustomerViewUrl,
AssignOpenSeaCustomerUrl,
BatchAssignOpenSeaCustomerUrl,
BatchDeleteCustomerCollaborationUrl,
BatchDeleteCustomerUrl,
BatchDeleteOpenSeaCustomerUrl,
BatchMoveCustomerUrl,
BatchPickOpenSeaCustomerUrl,
BatchTransferCustomerUrl,
BatchUpdateAccountUrl,
BatchUpdateContactUrl,
CancelCustomerFollowPlanUrl,
CheckOpportunityContactUrl,
ContactListUnderCustomerUrl,
DeleteAccountPoolViewUrl,
DeleteContactViewUrl,
DeleteCustomerCollaborationUrl,
DeleteCustomerContactUrl,
DeleteCustomerFollowPlanUrl,
DeleteCustomerFollowRecordUrl,
DeleteCustomerOpenSeaUrl,
DeleteCustomerRelationItemUrl,
DeleteCustomerUrl,
DeleteCustomerViewUrl,
DeleteOpenSeaCustomerUrl,
DisableCustomerContactUrl,
DownloadAccountTemplateUrl,
DownloadContactTemplateUrl,
DragAccountPoolViewUrl,
DragContactViewUrl,
DragCustomerViewUrl,
EnableAccountPoolViewUrl,
EnableContactViewUrl,
EnableCustomerContactUrl,
EnableCustomerViewUrl,
ExportContactAllUrl,
ExportContactSelectedUrl,
ExportCustomerAllUrl,
ExportCustomerSelectedUrl,
ExportOpenSeaCustomerAllUrl,
ExportOpenSeaCustomerSelectedUrl,
FixedAccountPoolViewUrl,
FixedContactViewUrl,
FixedCustomerViewUrl,
GenerateCustomerChartUrl,
generateCustomerContactChartUrl,
generateCustomerPoolChartUrl,
GetAccountPoolViewDetailUrl,
GetAccountPoolViewListUrl,
GetAdvancedCustomerContactListUrl,
GetAdvancedCustomerListUrl,
GetAdvancedOpenSeaCustomerListUrl,
GetContactViewDetailUrl,
GetContactViewListUrl,
GetCustomerCollaborationListUrl,
GetCustomerContactFormConfigUrl,
GetCustomerContactListUrl,
GetCustomerContactTabUrl,
GetCustomerContactUrl,
GetCustomerFollowPlanFormConfigUrl,
GetCustomerFollowPlanListUrl,
GetCustomerFollowPlanUrl,
GetCustomerFollowRecordFormConfigUrl,
GetCustomerFollowRecordListUrl,
GetCustomerFollowRecordUrl,
GetCustomerFormConfigUrl,
GetCustomerHeaderListUrl,
GetCustomerListUrl,
GetCustomerOpenSeaFollowRecordListUrl,
GetCustomerOpenSeaListUrl,
GetCustomerOpportunityListUrl,
GetCustomerOptionsUrl,
GetCustomerRelationListUrl,
GetCustomerTabUrl,
GetCustomerUrl,
GetCustomerViewDetailUrl,
GetCustomerViewListUrl,
GetGlobalCustomerContactListUrl,
GetGlobalCustomerListUrl,
GetGlobalModuleCountUrl,
GetGlobalOpenSeaCustomerListUrl,
GetOpenSeaCustomerListUrl,
GetOpenSeaCustomerUrl,
GetOpenSeaOptionsUrl,
ImportAccountUrl,
ImportContactUrl,
IsCustomerOpenSeaNoPickUrl,
MergeAccountPageUrl,
MergeAccountUrl,
MoveToCustomerUrl,
PickOpenSeaCustomerUrl,
PoolAccountBatchUpdateUrl,
PreCheckAccountImportUrl,
PreCheckContactImportUrl,
SaveCustomerRelationUrl,
SwitchCustomerOpenSeaUrl,
UpdateAccountPoolViewUrl,
UpdateContactViewUrl,
UpdateCustomerCollaborationUrl,
UpdateCustomerContactUrl,
UpdateCustomerFollowPlanStatusUrl,
UpdateCustomerFollowPlanUrl,
UpdateCustomerFollowRecordUrl,
UpdateCustomerOpenSeaUrl,
UpdateCustomerRelationItemUrl,
UpdateCustomerUrl,
UpdateCustomerViewUrl,
GetAccountContractListUrl,
GetAccountContractStatisticUrl,
GetAccountPaymentListUrl,
GetAccountPaymentStatisticUrl,
GetAccountPaymentRecordStatisticUrl,
GetAccountPaymentRecordListUrl,
GetAccountInvoiceListUrl,
GetAccountInvoiceStatisticUrl,
GetAccountOrderListUrl,
} from '@lib/shared/api/requrls/customer';
import type {
ChartResponseDataItem,
CommonList,
GenerateChartParams,
TableDraggedParams,
TableExportParams,
TableExportSelectedParams,
TableQueryParams,
} from '@lib/shared/models/common';
import type {
AddCustomerCollaborationParams,
AddCustomerRelationItemParams,
AssignOpenSeaCustomerParams,
BatchAssignOpenSeaCustomerParams,
BatchMoveToPublicPoolParams,
BatchOperationOpenSeaCustomerParams,
BatchUpdatePoolAccountParams,
CollaborationItem,
CustomerContractListItem,
CustomerContractTableParams,
CustomerDetail,
CustomerFollowPlanListItem,
CustomerFollowPlanTableParams,
CustomerFollowRecordListItem,
CustomerFollowRecordTableParams,
CustomerInvoiceItem,
CustomerInvoicePageQueryParams,
CustomerInvoiceStatistic,
CustomerListItem,
CustomerOpenSeaListItem,
CustomerOpportunityTableParams,
CustomerOptionsItem,
CustomerTabHidden,
CustomerTableParams,
FollowDetailItem,
MergeAccountParams,
MoveToPublicPoolParams,
OpenSeaCustomerTableParams,
PickOpenSeaCustomerParams,
PoolTableExportParams,
RelationItem,
RelationListItem,
SaveCustomerContractParams,
SaveCustomerFollowPlanParams,
SaveCustomerFollowRecordParams,
SaveCustomerOpenSeaParams,
SaveCustomerParams,
TransferParams,
UpdateCustomerCollaborationParams,
UpdateCustomerContractParams,
UpdateCustomerFollowPlanParams,
UpdateCustomerFollowRecordParams,
UpdateCustomerOpenSeaParams,
UpdateCustomerParams,
UpdateCustomerRelationItemParams,
UpdateFollowPlanStatusParams,
} from '@lib/shared/models/customer';
import type { OrderItem } from '@lib/shared/models/order';
import type { CluePoolItem, FormDesignConfigDetailParams, OpportunityItem } from '@lib/shared/models/system/module';
import { ValidateInfo } from '@lib/shared/models/system/org';
import type { ViewItem, ViewParams } from '@lib/shared/models/view';
import type { ContractItem, PaymentPlanItem, PaymentRecordItem } from '@lib/shared/models/contract';
export default function useProductApi(CDR: CordysAxios) {
// 添加客户
function addCustomer(data: SaveCustomerParams) {
return CDR.post({ url: AddCustomerUrl, data });
}
// 更新客户
function updateCustomer(data: UpdateCustomerParams) {
return CDR.post({ url: UpdateCustomerUrl, data });
}
// 获取客户列表
function getCustomerList(data: CustomerTableParams) {
return CDR.post<CommonList<CustomerListItem>>({ url: GetCustomerListUrl, data });
}
// 获取客户表单配置
function getCustomerFormConfig() {
return CDR.get<FormDesignConfigDetailParams>({ url: GetCustomerFormConfigUrl });
}
// 获取客户详情
function getCustomer(id: string, approvalTaskId?: string) {
return CDR.get<CustomerDetail>({ url: `${GetCustomerUrl}/${id}`, params: { approvalTaskId } });
}
// 删除客户
function deleteCustomer(id: string) {
return CDR.get({ url: `${DeleteCustomerUrl}/${id}` });
}
// 批量删除客户
function batchDeleteCustomer(batchIds: (string | number)[]) {
return CDR.post({ url: BatchDeleteCustomerUrl, data: batchIds });
}
// 批量转移客户
function batchTransferCustomer(data: TransferParams) {
return CDR.post({ url: BatchTransferCustomerUrl, data });
}
// 批量移入公海
function batchMoveCustomer(data: BatchMoveToPublicPoolParams) {
return CDR.post({ url: BatchMoveCustomerUrl, data });
}
// 批量移入公海
function moveCustomerToPool(data: MoveToPublicPoolParams) {
return CDR.post({ url: MoveToCustomerUrl, data });
}
// 批量更新公海客户
function batchUpdateOpenSeaCustomer(data: BatchUpdatePoolAccountParams) {
return CDR.post({ url: PoolAccountBatchUpdateUrl, data });
}
// 批量更新客户
function batchUpdateAccount(data: BatchUpdatePoolAccountParams) {
return CDR.post({ url: BatchUpdateAccountUrl, data });
}
// 批量更新联系人
function batchUpdateContact(data: BatchUpdatePoolAccountParams) {
return CDR.post({ url: BatchUpdateContactUrl, data });
}
// 生成客户图表
function generateCustomerChart(data: GenerateChartParams) {
return CDR.post<ChartResponseDataItem[]>({ url: GenerateCustomerChartUrl, data });
}
// 添加客户跟进记录
function addCustomerFollowRecord(data: SaveCustomerFollowRecordParams) {
return CDR.post({ url: AddCustomerFollowRecordUrl, data });
}
// 更新客户跟进记录
function updateCustomerFollowRecord(data: UpdateCustomerFollowRecordParams) {
return CDR.post({ url: UpdateCustomerFollowRecordUrl, data });
}
// 删除客户跟进记录
function deleteCustomerFollowRecord(id: string) {
return CDR.get({ url: `${DeleteCustomerFollowRecordUrl}/${id}` });
}
// 获取客户跟进记录列表
function getCustomerFollowRecordList(data: CustomerFollowRecordTableParams) {
return CDR.post<CommonList<CustomerFollowRecordListItem>>({ url: GetCustomerFollowRecordListUrl, data });
}
// 获取客户跟进记录表单配置
function getCustomerFollowRecordFormConfig() {
return CDR.get<FormDesignConfigDetailParams>({ url: GetCustomerFollowRecordFormConfigUrl });
}
// 获取客户跟进记录详情
function getCustomerFollowRecord(id: string) {
return CDR.get<CustomerFollowRecordListItem>({ url: `${GetCustomerFollowRecordUrl}/${id}` });
}
// 添加客户跟进计划
function addCustomerFollowPlan(data: SaveCustomerFollowPlanParams) {
return CDR.post({ url: AddCustomerFollowPlanUrl, data });
}
// 更新客户跟进计划
function updateCustomerFollowPlan(data: UpdateCustomerFollowPlanParams) {
return CDR.post({ url: UpdateCustomerFollowPlanUrl, data });
}
// 删除客户跟进计划
function deleteCustomerFollowPlan(id: string) {
return CDR.get({ url: `${DeleteCustomerFollowPlanUrl}/${id}` });
}
// 获取客户跟进计划列表
function getCustomerFollowPlanList(data: CustomerFollowPlanTableParams) {
return CDR.post<CommonList<CustomerFollowPlanListItem>>({ url: GetCustomerFollowPlanListUrl, data });
}
// 取消客户跟进计划
function cancelCustomerFollowPlan(id: string) {
return CDR.get({ url: `${CancelCustomerFollowPlanUrl}/${id}` });
}
// 获取客户跟进计划表单配置
function getCustomerFollowPlanFormConfig() {
return CDR.get<FormDesignConfigDetailParams>({ url: GetCustomerFollowPlanFormConfigUrl });
}
// 获取客户跟进计划详情
function getCustomerFollowPlan(id: string) {
return CDR.get<FollowDetailItem>({ url: `${GetCustomerFollowPlanUrl}/${id}` });
}
// 添加客户联系人
function addCustomerContact(data: SaveCustomerContractParams) {
return CDR.post({ url: AddCustomerContactUrl, data });
}
// 获取客户联系人列表
function getCustomerContactList(data: CustomerContractTableParams) {
return CDR.post<CommonList<CustomerContractListItem>>({ url: GetCustomerContactListUrl, data });
}
// 更新客户联系人
function updateCustomerContact(data: UpdateCustomerContractParams) {
return CDR.post({ url: UpdateCustomerContactUrl, data });
}
// 禁用客户联系人
function disableCustomerContact(id: string, reason: string) {
return CDR.post({ url: `${DisableCustomerContactUrl}/${id}`, data: { reason } });
}
// 获取客户联系人表单配置
function getCustomerContactFormConfig() {
return CDR.get<FormDesignConfigDetailParams>({ url: GetCustomerContactFormConfigUrl });
}
// 获取客户联系人详情
function getCustomerContact(id: string) {
return CDR.get<CustomerContractListItem>({ url: `${GetCustomerContactUrl}/${id}` });
}
// 获取客户的发票记录
function getCustomerInvoiceList(data: CustomerInvoicePageQueryParams) {
return CDR.post<CommonList<CustomerInvoiceItem>>({ url: GetAccountInvoiceListUrl, data });
}
// 获取客户发票统计
function getCustomerInvoiceStatistic(id: string) {
return CDR.get<CustomerInvoiceStatistic[]>({ url: `${GetAccountInvoiceStatisticUrl}/${id}` });
}
// 获取客户的订单
function getCustomerOrderList(data: TableQueryParams) {
return CDR.post<CommonList<OrderItem>>({ url: GetAccountOrderListUrl, data });
}
// 启用客户联系人
function enableCustomerContact(id: string) {
return CDR.get({ url: `${EnableCustomerContactUrl}/${id}` });
}
// 删除客户联系人
function deleteCustomerContact(id: string) {
return CDR.get({ url: `${DeleteCustomerContactUrl}/${id}` });
}
// 生成客户联系人图表
function generateCustomerContactChart(data: GenerateChartParams) {
return CDR.post<ChartResponseDataItem[]>({ url: generateCustomerContactChartUrl, data });
}
// 是否绑定商机
function checkOpportunity(id: string) {
return CDR.get({ url: `${CheckOpportunityContactUrl}/${id}` });
}
// 客户下的联系人列表
function getContactListUnderCustomer(data: { id: string }) {
return CDR.get({ url: `${ContactListUnderCustomerUrl}/${data.id}` });
}
// 添加公海
function addCustomerOpenSea(data: SaveCustomerOpenSeaParams) {
return CDR.post({ url: AddCustomerOpenSeaUrl, data });
}
// 更新公海
function updateCustomerOpenSea(data: UpdateCustomerOpenSeaParams) {
return CDR.post({ url: UpdateCustomerOpenSeaUrl, data });
}
// 获取公海列表
function getCustomerOpenSeaList(data: TableQueryParams) {
return CDR.post<CommonList<CustomerOpenSeaListItem>>({ url: GetCustomerOpenSeaListUrl, data });
}
// 启用/禁用公海
function switchCustomerOpenSea(id: string) {
return CDR.get({ url: `${SwitchCustomerOpenSeaUrl}/${id}` });
}
// 删除公海
function deleteCustomerOpenSea(id: string) {
return CDR.get({ url: `${DeleteCustomerOpenSeaUrl}/${id}` });
}
// 公海是否存在未领取线索
function isCustomerOpenSeaNoPick(id: string) {
return CDR.get<boolean>({ url: `${IsCustomerOpenSeaNoPickUrl}/${id}` });
}
// 获取公海客户列表
function getOpenSeaCustomerList(data: OpenSeaCustomerTableParams) {
return CDR.post<CommonList<CustomerOpenSeaListItem>>({ url: GetOpenSeaCustomerListUrl, data });
}
// 领取公海客户
function pickOpenSeaCustomer(data: PickOpenSeaCustomerParams) {
return CDR.post({ url: PickOpenSeaCustomerUrl, data });
}
// 批量领取公海客户
function batchPickOpenSeaCustomer(data: BatchOperationOpenSeaCustomerParams) {
return CDR.post({ url: BatchPickOpenSeaCustomerUrl, data });
}
// 批量删除公海客户
function batchDeleteOpenSeaCustomer(data: BatchOperationOpenSeaCustomerParams) {
return CDR.post({ url: BatchDeleteOpenSeaCustomerUrl, data });
}
// 批量分配公海客户
function batchAssignOpenSeaCustomer(data: BatchAssignOpenSeaCustomerParams) {
return CDR.post({ url: BatchAssignOpenSeaCustomerUrl, data });
}
// 分配公海客户
function assignOpenSeaCustomer(data: AssignOpenSeaCustomerParams) {
return CDR.post({ url: AssignOpenSeaCustomerUrl, data });
}
// 获取公海选项
function getOpenSeaOptions() {
return CDR.get<CluePoolItem[]>({ url: GetOpenSeaOptionsUrl });
}
// 获取公海客户详情
function getOpenSeaCustomer(id: string) {
return CDR.get<CustomerDetail>({ url: `${GetOpenSeaCustomerUrl}/${id}` });
}
// 删除公海客户
function deleteOpenSeaCustomer(id: string) {
return CDR.get({ url: `${DeleteOpenSeaCustomerUrl}/${id}` });
}
// 导出全量客户列表
function exportCustomerOpenSeaAll(data: PoolTableExportParams) {
return CDR.post({ url: ExportOpenSeaCustomerAllUrl, data });
}
// 导出选中客户列表
function exportCustomerOpenSeaSelected(data: TableExportSelectedParams) {
return CDR.post({ url: ExportOpenSeaCustomerSelectedUrl, data });
}
// 获取客户负责人列表
function getCustomerHeaderList(data: CustomerContractTableParams) {
return CDR.get({ url: `${GetCustomerHeaderListUrl}/${data.sourceId}` });
}
// 保存客户关系
function saveCustomerRelation(customerId: string, data: RelationItem[]) {
return CDR.post({ url: `${SaveCustomerRelationUrl}/${customerId}`, data });
}
// 获取客户关系列表
function getCustomerRelationList(customerId: string) {
return CDR.get<RelationListItem[]>({ url: `${GetCustomerRelationListUrl}/${customerId}` });
}
// 获取客户协作成员列表
function getCustomerCollaborationList({ customerId }: { customerId: string }) {
return CDR.get<CollaborationItem[]>({ url: `${GetCustomerCollaborationListUrl}/${customerId}` });
}
// 更新单条客户关系
function updateCustomerRelationItem(customerId: string, data: UpdateCustomerRelationItemParams) {
return CDR.post({ url: `${UpdateCustomerRelationItemUrl}/${customerId}`, data });
}
// 添加单条客户关系
function addCustomerRelationItem(customerId: string, data: AddCustomerRelationItemParams) {
return CDR.post({ url: `${AddCustomerRelationItemUrl}/${customerId}`, data });
}
// 删除单条客户关系
function deleteCustomerRelationItem(id: string) {
return CDR.get({ url: `${DeleteCustomerRelationItemUrl}/${id}` });
}
// 批量删除客户协作成员
function batchDeleteCustomerCollaboration(data: string[]) {
return CDR.post({ url: BatchDeleteCustomerCollaborationUrl, data });
}
// 更新客户协作成员
function updateCustomerCollaboration(data: UpdateCustomerCollaborationParams) {
return CDR.post({ url: UpdateCustomerCollaborationUrl, data });
}
// 添加客户协作成员
function addCustomerCollaboration(data: AddCustomerCollaborationParams) {
return CDR.post({ url: AddCustomerCollaborationUrl, data });
}
// 删除客户协作成员
function deleteCustomerCollaboration(id: string) {
return CDR.get({ url: `${DeleteCustomerCollaborationUrl}/${id}` });
}
// 获取客户选项列表
function getCustomerOptions(data: TableQueryParams) {
return CDR.post<CommonList<CustomerOptionsItem>>({ url: GetCustomerOptionsUrl, data });
}
// 获取客户公海跟进记录列表
function getCustomerOpenSeaFollowRecordList(data: CustomerFollowRecordTableParams) {
return CDR.post<CommonList<CustomerFollowRecordListItem>>({ url: GetCustomerOpenSeaFollowRecordListUrl, data });
}
// 生成客户公海图表
function generateCustomerPoolChart(data: GenerateChartParams) {
return CDR.post<ChartResponseDataItem[]>({ url: generateCustomerPoolChartUrl, data });
}
// 获取客户tab显隐藏
function getCustomerTab() {
return CDR.get<CustomerTabHidden>({ url: GetCustomerTabUrl });
}
// 获取客户联系人tab显隐藏
function getCustomerContactTab() {
return CDR.get<CustomerTabHidden>({ url: GetCustomerContactTabUrl });
}
// 更新客户跟进计划状态
function updateCustomerFollowPlanStatus(data: UpdateFollowPlanStatusParams) {
return CDR.post({ url: UpdateCustomerFollowPlanStatusUrl, data });
}
// 获取客户商机列表
function getCustomerOpportunityPage(data: CustomerOpportunityTableParams) {
return CDR.post<CommonList<OpportunityItem>>({ url: GetCustomerOpportunityListUrl, data });
}
// 导出全量客户列表
function exportCustomerAll(data: TableExportParams) {
return CDR.post({ url: ExportCustomerAllUrl, data });
}
// 导出选中客户列表
function exportCustomerSelected(data: TableExportSelectedParams) {
return CDR.post({ url: ExportCustomerSelectedUrl, data });
}
// 导出全量联系人列表
function exportContactAll(data: TableExportParams) {
return CDR.post({ url: ExportContactAllUrl, data });
}
// 导出选中联系人列表
function exportContactSelected(data: TableExportSelectedParams) {
return CDR.post({ url: ExportContactSelectedUrl, data });
}
// 视图
function addCustomerView(data: ViewParams) {
return CDR.post({ url: AddCustomerViewUrl, data });
}
function updateCustomerView(data: ViewParams) {
return CDR.post({ url: UpdateCustomerViewUrl, data });
}
function getCustomerViewList() {
return CDR.get<ViewItem[]>({ url: GetCustomerViewListUrl });
}
function getCustomerViewDetail(id: string) {
return CDR.get({ url: `${GetCustomerViewDetailUrl}/${id}` });
}
function fixedCustomerView(id: string) {
return CDR.get({ url: `${FixedCustomerViewUrl}/${id}` });
}
function enableCustomerView(id: string) {
return CDR.get({ url: `${EnableCustomerViewUrl}/${id}` });
}
function deleteCustomerView(id: string) {
return CDR.get({ url: `${DeleteCustomerViewUrl}/${id}` });
}
function dragCustomerView(data: TableDraggedParams) {
return CDR.post({ url: DragCustomerViewUrl, data });
}
function addContactView(data: ViewParams) {
return CDR.post({ url: AddContactViewUrl, data });
}
function updateContactView(data: ViewParams) {
return CDR.post({ url: UpdateContactViewUrl, data });
}
function getContactViewList() {
return CDR.get<ViewItem[]>({ url: GetContactViewListUrl });
}
function getContactViewDetail(id: string) {
return CDR.get({ url: `${GetContactViewDetailUrl}/${id}` });
}
function fixedContactView(id: string) {
return CDR.get({ url: `${FixedContactViewUrl}/${id}` });
}
function enableContactView(id: string) {
return CDR.get({ url: `${EnableContactViewUrl}/${id}` });
}
function deleteContactView(id: string) {
return CDR.get({ url: `${DeleteContactViewUrl}/${id}` });
}
function dragContactView(data: TableDraggedParams) {
return CDR.post({ url: DragContactViewUrl, data });
}
function geAdvancedCustomerList(data: CustomerTableParams) {
return CDR.post<CommonList<CustomerListItem>>(
{ url: GetAdvancedCustomerListUrl, data },
{ ignoreCancelToken: true }
);
}
function getAdvancedOpenSeaCustomerList(data: OpenSeaCustomerTableParams) {
return CDR.post<CommonList<CustomerOpenSeaListItem>>(
{ url: GetAdvancedOpenSeaCustomerListUrl, data },
{ ignoreCancelToken: true }
);
}
function getAdvancedCustomerContactList(data: CustomerContractTableParams) {
return CDR.post<CommonList<CustomerContractListItem>>(
{ url: GetAdvancedCustomerContactListUrl, data },
{ ignoreCancelToken: true }
);
}
function getGlobalCustomerList(data: TableQueryParams) {
return CDR.post<CommonList<CustomerListItem>>({ url: GetGlobalCustomerListUrl, data }, { ignoreCancelToken: true });
}
function getGlobalOpenSeaCustomerList(data: TableQueryParams) {
return CDR.post<CommonList<CustomerOpenSeaListItem>>(
{ url: GetGlobalOpenSeaCustomerListUrl, data },
{ ignoreCancelToken: true }
);
}
function getGlobalCustomerContactList(data: TableQueryParams) {
return CDR.post<CommonList<CustomerContractListItem>>(
{ url: GetGlobalCustomerContactListUrl, data },
{ ignoreCancelToken: true }
);
}
function getGlobalModuleCount(keyword: string) {
return CDR.post<{ key: string; count: number }[]>(
{ url: `${GetGlobalModuleCountUrl}?keyword=${keyword}` },
{ ignoreCancelToken: true }
);
}
// 客户导入
function preCheckImportAccount(file: File) {
return CDR.uploadFile<{ data: ValidateInfo }>({ url: PreCheckAccountImportUrl }, { fileList: [file] }, 'file');
}
function downloadAccountTemplate() {
return CDR.get(
{
url: DownloadAccountTemplateUrl,
responseType: 'blob',
},
{ isTransformResponse: false, isReturnNativeResponse: true }
);
}
function importAccount(file: File) {
return CDR.uploadFile({ url: ImportAccountUrl }, { fileList: [file] }, 'file');
}
// 联系人导入
function preCheckImportContact(file: File) {
return CDR.uploadFile<{ data: ValidateInfo }>({ url: PreCheckContactImportUrl }, { fileList: [file] }, 'file');
}
function downloadContactTemplate() {
return CDR.get(
{
url: DownloadContactTemplateUrl,
responseType: 'blob',
},
{ isTransformResponse: false, isReturnNativeResponse: true }
);
}
function importContact(file: File) {
return CDR.uploadFile({ url: ImportContactUrl }, { fileList: [file] }, 'file');
}
// 公海视图
function addAccountPoolView(data: ViewParams) {
return CDR.post({ url: AddAccountPoolViewUrl, data });
}
function updateAccountPoolView(data: ViewParams) {
return CDR.post({ url: UpdateAccountPoolViewUrl, data });
}
function getAccountPoolViewList() {
return CDR.get<ViewItem[]>({ url: GetAccountPoolViewListUrl });
}
function getAccountPoolViewDetail(id: string) {
return CDR.get({ url: `${GetAccountPoolViewDetailUrl}/${id}` });
}
function fixedAccountPoolView(id: string) {
return CDR.get({ url: `${FixedAccountPoolViewUrl}/${id}` });
}
function enableAccountPoolView(id: string) {
return CDR.get({ url: `${EnableAccountPoolViewUrl}/${id}` });
}
function deleteAccountPoolView(id: string) {
return CDR.get({ url: `${DeleteAccountPoolViewUrl}/${id}` });
}
function dragAccountPoolView(data: TableDraggedParams) {
return CDR.post({ url: DragAccountPoolViewUrl, data });
}
function mergeAccount(data: MergeAccountParams) {
return CDR.post({ url: MergeAccountUrl, data });
}
function mergeAccountPage(data: TableQueryParams) {
return CDR.post({ url: MergeAccountPageUrl, data });
}
function getAccountContract(data: TableQueryParams) {
return CDR.post<CommonList<ContractItem>>({ url: GetAccountContractListUrl, data });
}
function getAccountContractStatistic(id: string) {
return CDR.get({ url: `${GetAccountContractStatisticUrl}/${id}` });
}
function getAccountPayment(data: TableQueryParams) {
return CDR.post<CommonList<PaymentPlanItem>>({ url: GetAccountPaymentListUrl, data });
}
function getAccountPaymentStatistic(id: string) {
return CDR.get({ url: `${GetAccountPaymentStatisticUrl}/${id}` });
}
function getAccountPaymentRecord(data: TableQueryParams) {
return CDR.post<CommonList<PaymentRecordItem>>({ url: GetAccountPaymentRecordListUrl, data });
}
function getAccountPaymentRecordStatistic(id: string) {
return CDR.get({ url: `${GetAccountPaymentRecordStatisticUrl}/${id}` });
}
return {
addCustomer,
updateCustomer,
getCustomerList,
getCustomerContactTab,
getCustomerFormConfig,
getCustomer,
deleteCustomer,
getGlobalCustomerList,
getGlobalOpenSeaCustomerList,
getGlobalCustomerContactList,
getGlobalModuleCount,
batchDeleteCustomer,
batchTransferCustomer,
batchMoveCustomer,
addCustomerFollowRecord,
updateCustomerFollowRecord,
deleteCustomerFollowRecord,
getCustomerFollowRecordList,
getCustomerFollowRecordFormConfig,
getCustomerFollowRecord,
addCustomerFollowPlan,
updateCustomerFollowPlan,
deleteCustomerFollowPlan,
getCustomerFollowPlanList,
cancelCustomerFollowPlan,
getCustomerFollowPlanFormConfig,
getCustomerFollowPlan,
addCustomerContact,
getCustomerContactList,
updateCustomerContact,
disableCustomerContact,
getCustomerContactFormConfig,
getCustomerContact,
enableCustomerContact,
deleteCustomerContact,
checkOpportunity,
getContactListUnderCustomer,
addCustomerOpenSea,
updateCustomerOpenSea,
getCustomerOpenSeaList,
switchCustomerOpenSea,
deleteCustomerOpenSea,
isCustomerOpenSeaNoPick,
getOpenSeaCustomerList,
getCustomerOpportunityPage,
pickOpenSeaCustomer,
batchPickOpenSeaCustomer,
batchDeleteOpenSeaCustomer,
batchAssignOpenSeaCustomer,
assignOpenSeaCustomer,
getOpenSeaOptions,
getOpenSeaCustomer,
deleteOpenSeaCustomer,
getCustomerHeaderList,
saveCustomerRelation,
getCustomerRelationList,
getCustomerCollaborationList,
batchDeleteCustomerCollaboration,
updateCustomerCollaboration,
addCustomerCollaboration,
deleteCustomerCollaboration,
getCustomerOptions,
getCustomerOpenSeaFollowRecordList,
updateCustomerRelationItem,
addCustomerRelationItem,
deleteCustomerRelationItem,
getCustomerTab,
updateCustomerFollowPlanStatus,
exportCustomerAll,
exportContactAll,
exportContactSelected,
exportCustomerSelected,
moveCustomerToPool,
addCustomerView,
deleteCustomerView,
fixedCustomerView,
getCustomerViewDetail,
getCustomerViewList,
updateCustomerView,
enableCustomerView,
dragCustomerView,
addContactView,
deleteContactView,
fixedContactView,
getContactViewDetail,
getContactViewList,
updateContactView,
enableContactView,
dragContactView,
geAdvancedCustomerList,
getAdvancedOpenSeaCustomerList,
getAdvancedCustomerContactList,
exportCustomerOpenSeaAll,
exportCustomerOpenSeaSelected,
preCheckImportAccount,
downloadAccountTemplate,
importAccount,
preCheckImportContact,
downloadContactTemplate,
importContact,
batchUpdateOpenSeaCustomer,
addAccountPoolView,
deleteAccountPoolView,
fixedAccountPoolView,
getAccountPoolViewDetail,
getAccountPoolViewList,
updateAccountPoolView,
enableAccountPoolView,
dragAccountPoolView,
batchUpdateAccount,
batchUpdateContact,
mergeAccount,
mergeAccountPage,
generateCustomerChart,
generateCustomerPoolChart,
generateCustomerContactChart,
getAccountContract,
getAccountContractStatistic,
getAccountPayment,
getAccountPaymentStatistic,
getAccountPaymentRecord,
getAccountPaymentRecordStatistic,
getCustomerInvoiceList,
getCustomerOrderList,
getCustomerInvoiceStatistic,
};
}

View File

@@ -0,0 +1,133 @@
import type { CommonList, TableQueryParams } from '../../models/common';
import type {
DashboardAddModuleParams,
DashboardAddParams,
DashboardDetail,
DashboardDragParams,
DashboardModuleDragParams,
DashboardModuleRenameParams,
DashboardRenameParams,
DashboardTableItem,
DashboardTableQueryParams,
DashboardUpdateParams,
} from '../../models/dashboard';
import {
dashboardAddUrl,
dashboardCollectPageUrl,
dashboardCollectUrl,
dashboardDeleteUrl,
dashboardDetailUrl,
dashboardDragUrl,
dashboardModuleAddUrl,
dashboardModuleCountUrl,
dashboardModuleDeleteUrl,
dashboardModuleDragUrl,
dashboardModuleRenameUrl,
dashboardModuleTreeUrl,
dashboardPageUrl,
dashboardRenameUrl,
dashboardUnCollectUrl,
dashboardUpdateUrl,
} from '../requrls/dashboard';
import type { CordysAxios } from '@lib/shared/api/http/Axios';
export default function useDashboardApi(CDR: CordysAxios) {
// 重命名仪表板模块
function dashboardModuleRename(data: DashboardModuleRenameParams) {
return CDR.post({ url: dashboardModuleRenameUrl, data });
}
// 删除仪表板模块
function dashboardModuleDelete(ids: string[]) {
return CDR.post({ url: dashboardModuleDeleteUrl, data: ids });
}
// 添加仪表板模块
function dashboardModuleAdd(data: DashboardAddModuleParams) {
return CDR.post({ url: dashboardModuleAddUrl, data });
}
// 更新仪表板
function dashboardUpdate(data: DashboardUpdateParams) {
return CDR.post({ url: dashboardUpdateUrl, data });
}
// 重命名仪表板
function dashboardRename(data: DashboardRenameParams) {
return CDR.post({ url: dashboardRenameUrl, data });
}
// 添加仪表板
function dashboardAdd(data: DashboardAddParams) {
return CDR.post({ url: dashboardAddUrl, data });
}
// 获取仪表板详情
function dashboardDetail(id: string) {
return CDR.get<DashboardDetail>({ url: `${dashboardDetailUrl}/${id}` });
}
// 删除仪表板
function dashboardDelete(id: string) {
return CDR.get({ url: `${dashboardDeleteUrl}/${id}` });
}
// 获取仪表板模块树
function dashboardModuleTree() {
return CDR.get({ url: dashboardModuleTreeUrl });
}
// 获取仪表板模块数量
function dashboardModuleCount() {
return CDR.get({ url: dashboardModuleCountUrl });
}
// 仪表板拖拽
function dashboardDrag(data: DashboardDragParams) {
return CDR.post({ url: dashboardDragUrl, data });
}
// 仪表板模块拖拽
function dashboardModuleDrag(data: DashboardModuleDragParams) {
return CDR.post({ url: dashboardModuleDragUrl, data });
}
// 获取仪表板列表
function dashboardPage(data: DashboardTableQueryParams) {
return CDR.post<CommonList<DashboardTableItem>>({ url: dashboardPageUrl, data });
}
// 获取仪表板收藏列表
function dashboardCollectPage(data: TableQueryParams) {
return CDR.post<CommonList<DashboardTableItem>>({ url: dashboardCollectPageUrl, data });
}
// 收藏仪表板
function dashboardCollect(id: string) {
return CDR.get({ url: `${dashboardCollectUrl}/${id}` });
}
// 取消收藏仪表板
function dashboardUnCollect(id: string) {
return CDR.get({ url: `${dashboardUnCollectUrl}/${id}` });
}
return {
dashboardModuleRename,
dashboardModuleDelete,
dashboardModuleAdd,
dashboardUpdate,
dashboardRename,
dashboardAdd,
dashboardDetail,
dashboardDelete,
dashboardModuleTree,
dashboardPage,
dashboardCollectPage,
dashboardCollect,
dashboardUnCollect,
dashboardModuleCount,
dashboardModuleDrag,
dashboardDrag,
};
}

View File

@@ -0,0 +1,199 @@
import type { CordysAxios } from '@lib/shared/api/http/Axios';
import {
AddFollowPlanViewUrl,
AddFollowRecordViewUrl,
DeleteFollowPlanUrl,
DeleteFollowPlanViewUrl,
DeleteFollowRecordUrl,
DeleteFollowRecordViewUrl,
DragFollowPlanViewUrl,
DragFollowRecordViewUrl,
EnableFollowPlanViewUrl,
EnableFollowRecordViewUrl,
FixedFollowPlanViewUrl,
FixedFollowRecordViewUrl,
GetFollowPlanPageUrl,
GetFollowPlanTabUrl,
GetFollowPlanUrl,
GetFollowPlanViewDetailUrl,
GetFollowPlanViewListUrl,
GetFollowRecordPageUrl,
GetFollowRecordTabUrl,
GetFollowRecordUrl,
GetFollowRecordViewDetailUrl,
GetFollowRecordViewListUrl,
UpdateFollowPlanStatusUrl,
UpdateFollowPlanUrl,
UpdateFollowPlanViewUrl,
UpdateFollowRecordUrl,
AddFollowRecordUrl,
AddFollowPlanUrl,
UpdateFollowRecordViewUrl,
} from '@lib/shared/api/requrls/follow';
import type { CommonList, TableDraggedParams } from '@lib/shared/models/common';
import type {
CustomerFollowRecordTableParams,
CustomerTabHidden,
FollowDetailItem,
UpdateCustomerFollowRecordParams,
UpdateFollowPlanStatusParams,
} from '@lib/shared/models/customer';
import type { ViewItem, ViewParams } from '@lib/shared/models/view';
export default function useFollowApi(CDR: CordysAxios) {
// 跟进记录列表
function getFollowRecordPage(data: CustomerFollowRecordTableParams) {
return CDR.post<CommonList<FollowDetailItem>>({ url: GetFollowRecordPageUrl, data });
}
// 跟进记录详情
function getFollowRecordDetail(id: string) {
return CDR.get<FollowDetailItem>({ url: `${GetFollowRecordUrl}/${id}` });
}
// 获取tab显隐藏
function getFollowRecordTab() {
return CDR.get<CustomerTabHidden>({ url: GetFollowRecordTabUrl });
}
function deleteFollowRecord(id: string) {
return CDR.get({ url: `${DeleteFollowRecordUrl}/${id}` });
}
// 跟进计划列表
function getFollowPLanPage(data: CustomerFollowRecordTableParams) {
return CDR.post<CommonList<FollowDetailItem>>({ url: GetFollowPlanPageUrl, data });
}
// 跟进记录详情
function getFollowPlanDetail(id: string) {
return CDR.get<FollowDetailItem>({ url: `${GetFollowPlanUrl}/${id}` });
}
function updateFollowRecord(data: UpdateCustomerFollowRecordParams) {
return CDR.post({ url: UpdateFollowRecordUrl, data });
}
function addFollowRecord(data: UpdateCustomerFollowRecordParams) {
return CDR.post({ url: AddFollowRecordUrl, data });
}
// 获取tab显隐藏
function getFollowPlanTab() {
return CDR.get<CustomerTabHidden>({ url: GetFollowPlanTabUrl });
}
function deleteFollowPlan(id: string) {
return CDR.get({ url: `${DeleteFollowPlanUrl}/${id}` });
}
function updateFollowPlanStatus(data: UpdateFollowPlanStatusParams) {
return CDR.post({ url: UpdateFollowPlanStatusUrl, data });
}
function updateFollowPlan(data: UpdateCustomerFollowRecordParams) {
return CDR.post({ url: UpdateFollowPlanUrl, data });
}
function addFollowPlan(data: UpdateCustomerFollowRecordParams) {
return CDR.post({ url: AddFollowPlanUrl, data });
}
// 视图
function addFollowRecordView(data: ViewParams) {
return CDR.post({ url: AddFollowRecordViewUrl, data });
}
function updateFollowRecordView(data: ViewParams) {
return CDR.post({ url: UpdateFollowRecordViewUrl, data });
}
function getFollowRecordViewList() {
return CDR.get<ViewItem[]>({ url: GetFollowRecordViewListUrl });
}
function getFollowRecordViewDetail(id: string) {
return CDR.get({ url: `${GetFollowRecordViewDetailUrl}/${id}` });
}
function fixedFollowRecordView(id: string) {
return CDR.get({ url: `${FixedFollowRecordViewUrl}/${id}` });
}
function enableFollowRecordView(id: string) {
return CDR.get({ url: `${EnableFollowRecordViewUrl}/${id}` });
}
function deleteFollowRecordView(id: string) {
return CDR.get({ url: `${DeleteFollowRecordViewUrl}/${id}` });
}
function dragFollowRecordView(data: TableDraggedParams) {
return CDR.post({ url: DragFollowRecordViewUrl, data });
}
// 跟进计划视图
function addFollowPlanView(data: ViewParams) {
return CDR.post({ url: AddFollowPlanViewUrl, data });
}
function updateFollowPlanView(data: ViewParams) {
return CDR.post({ url: UpdateFollowPlanViewUrl, data });
}
function getFollowPlanViewList() {
return CDR.get<ViewItem[]>({ url: GetFollowPlanViewListUrl });
}
function getFollowPlanViewDetail(id: string) {
return CDR.get({ url: `${GetFollowPlanViewDetailUrl}/${id}` });
}
function fixedFollowPlanView(id: string) {
return CDR.get({ url: `${FixedFollowPlanViewUrl}/${id}` });
}
function enableFollowPlanView(id: string) {
return CDR.get({ url: `${EnableFollowPlanViewUrl}/${id}` });
}
function deleteFollowPlanView(id: string) {
return CDR.get({ url: `${DeleteFollowPlanViewUrl}/${id}` });
}
function dragFollowPlanView(data: TableDraggedParams) {
return CDR.post({ url: DragFollowPlanViewUrl, data });
}
return {
getFollowPlanDetail,
getFollowPLanPage,
getFollowRecordDetail,
getFollowRecordPage,
deleteFollowRecord,
getFollowRecordTab,
getFollowPlanTab,
deleteFollowPlan,
updateFollowPlanStatus,
updateFollowPlan,
updateFollowRecord,
addFollowRecord,
addFollowPlan,
addFollowRecordView,
updateFollowRecordView,
getFollowRecordViewList,
getFollowRecordViewDetail,
fixedFollowRecordView,
enableFollowRecordView,
deleteFollowRecordView,
dragFollowRecordView,
addFollowPlanView,
updateFollowPlanView,
getFollowPlanViewList,
getFollowPlanViewDetail,
fixedFollowPlanView,
enableFollowPlanView,
deleteFollowPlanView,
dragFollowPlanView,
};
}

View File

@@ -0,0 +1,37 @@
import type { FollowOptStatisticDetail, GetHomeStatisticParams, HomeLeadStatisticDetail, HomeWinOrderDetail } from '../../models/home';
import { HomeDepartmentTree, HomeFollowOpportunity, HomeLeadStatistic, HomeSuccessOpportunity, HomeOpportunityUnderwayUrl } from '../requrls/home';
import { CrmTreeNodeData } from '@cordys/web/src/components/pure/crm-tree/type';
import type { CordysAxios } from '@lib/shared/api/http/Axios';
export default function useHomeApi(CDR: CordysAxios) {
// 用户部门权限树
function getHomeDepartmentTree() {
return CDR.get<CrmTreeNodeData[]>({ url: HomeDepartmentTree });
}
// 跟进商机统计
function getHomeFollowOpportunity(data: GetHomeStatisticParams) {
return CDR.post<FollowOptStatisticDetail>({ url: HomeFollowOpportunity, data });
}
// 线索统计
function getHomeLeadStatistic(data: GetHomeStatisticParams) {
return CDR.post<HomeLeadStatisticDetail>({ url: HomeLeadStatistic, data });
}
function getHomeSuccessOptStatistic(data: GetHomeStatisticParams) {
return CDR.post<HomeWinOrderDetail>({ url: HomeSuccessOpportunity, data });
}
function getHomeOpportunityUnderwayStatistic(data: GetHomeStatisticParams) {
return CDR.post<HomeWinOrderDetail>({ url: HomeOpportunityUnderwayUrl, data });
}
return {
getHomeDepartmentTree,
getHomeFollowOpportunity,
getHomeLeadStatistic,
getHomeSuccessOptStatistic,
getHomeOpportunityUnderwayStatistic,
};
}

View File

@@ -0,0 +1,551 @@
import type { CordysAxios } from '@lib/shared/api/http/Axios';
import {
AddBusinessViewUrl,
AddOpportunityStageUrl,
AddOptFollowPlanUrl,
AddOptFollowRecordUrl,
AddQuotationUrl,
AddQuotationViewUrl,
AdvancedSearchOptDetailUrl,
AdvancedSearchOptPageUrl,
ApprovalQuotationUrl,
BatchApproveUrl,
BatchUpdateQuotationUrl,
BatchUpdateOpportunityUrl,
BatchVoidedUrl,
CancelOptFollowPlanUrl,
DeleteBusinessViewUrl,
DeleteOpportunityStageUrl,
DeleteOptFollowPlanUrl,
DeleteOptFollowRecordUrl,
DeleteQuotationUrl,
DeleteQuotationViewUrl,
DownloadOptTemplateUrl,
DownloadQuotationUrl,
DragBusinessViewUrl,
DragQuotationViewUrl,
EnableBusinessViewUrl,
EnableQuotationViewUrl,
ExportOpportunityAllUrl,
ExportOpportunitySelectedUrl,
FixedBusinessViewUrl,
FixedQuotationViewUrl,
GenerateOpportunityChartUrl,
GetBusinessViewDetailUrl,
GetBusinessViewListUrl,
GetOpportunityContactListUrl,
GetOpportunityStageConfigUrl,
GetOptDetailUrl,
GetOptFollowPlanUrl,
GetOptFollowRecordUrl,
GetOptFormConfigUrl,
GetOptStatisticUrl,
GetOptTabUrl,
GetQuotationDetailUrl,
GetQuotationFormConfigUrl,
GetQuotationSnapshotDetailUrl,
GetQuotationSnapshotFormConfigUrl,
GetQuotationTabUrl,
GetQuotationViewDetailUrl,
GetQuotationViewListUrl,
GlobalSearchOptPageUrl,
ImportOpportunityUrl,
OptAddUrl,
OptBatchDeleteUrl,
OptBatchTransferUrl,
OptDeleteUrl,
OptFollowPlanPageUrl,
OptFollowRecordListUrl,
OptPageUrl,
OptUpdateStageUrl,
OptUpdateUrl,
PreCheckOptImportUrl,
QuotationPageUrl,
RevokeQuotationUrl,
SortOpportunityStageUrl,
SortOpportunityUrl,
UpdateBusinessViewUrl,
UpdateOpportunityStageRollbackUrl,
UpdateOpportunityStageUrl,
UpdateOptFollowPlanStatusUrl,
UpdateOptFollowPlanUrl,
UpdateOptFollowRecordUrl,
UpdateQuotationUrl,
UpdateQuotationViewUrl,
VoidQuotationUrl,
} from '@lib/shared/api/requrls/opportunity';
import type {
ChartResponseDataItem,
CommonList,
GenerateChartParams,
TableDraggedParams,
TableExportParams,
TableExportSelectedParams,
TableQueryParams,
} from '@lib/shared/models/common';
import type {
BatchUpdatePoolAccountParams,
CustomerContractTableParams,
CustomerFollowPlanTableParams,
CustomerFollowRecordTableParams,
CustomerTabHidden,
FollowDetailItem,
SaveCustomerFollowPlanParams,
SaveCustomerFollowRecordParams,
TransferParams,
UpdateCustomerFollowPlanParams,
UpdateCustomerFollowRecordParams,
UpdateFollowPlanStatusParams,
} from '@lib/shared/models/customer';
import type {
AddOpportunityStageParams,
ApproveQuotation,
BatchOperationResult,
BatchUpdateQuotationStatusParams,
BatchVoidQuotationStatusParams,
StageBoardPageQueryParams,
StageBoardDraggedParams,
OpportunityDetail,
OpportunityItem,
OpportunityStageConfig,
QuotationItem,
QuotationQueryParams,
SaveOpportunityParams,
SaveQuotationParams,
UpdateOpportunityParams,
UpdateOpportunityStageParams,
UpdateOpportunityStageRollbackParams,
UpdateQuotationParams,
} from '@lib/shared/models/opportunity';
import type { FormDesignConfigDetailParams } from '@lib/shared/models/system/module';
import { ValidateInfo } from '@lib/shared/models/system/org';
import type { ViewItem, ViewParams } from '@lib/shared/models/view';
export default function useProductApi(CDR: CordysAxios) {
// 商机列表
function getOpportunityList(data: StageBoardPageQueryParams) {
return CDR.post<CommonList<OpportunityItem>>({ url: OptPageUrl, data }, { ignoreCancelToken: true });
}
// 添加商机
function addOpportunity(data: SaveOpportunityParams) {
return CDR.post({ url: OptAddUrl, data });
}
// 更新商机
function updateOpportunity(data: UpdateOpportunityParams) {
return CDR.post({ url: OptUpdateUrl, data });
}
// 商机详情
function getOpportunityDetail(id: string) {
return CDR.get<OpportunityDetail>({ url: `${GetOptDetailUrl}/${id}` });
}
// 商机看板拖拽排序
function sortOpportunity(data: StageBoardDraggedParams) {
return CDR.post({ url: SortOpportunityUrl, data });
}
// 获取商机表单配置
function getOptFormConfig() {
return CDR.get<FormDesignConfigDetailParams>({ url: GetOptFormConfigUrl });
}
// 商机跟进记录列表
function getOptFollowRecordList(data: CustomerFollowRecordTableParams) {
return CDR.post<CommonList<FollowDetailItem>>({ url: OptFollowRecordListUrl, data });
}
// 删除商机跟进记录
function deleteOptFollowRecord(id: string) {
return CDR.get({ url: `${DeleteOptFollowRecordUrl}/${id}` });
}
// 添加商机跟进记录
function addOptFollowRecord(data: SaveCustomerFollowRecordParams) {
return CDR.post({ url: AddOptFollowRecordUrl, data });
}
// 更新商机跟进记录
function updateOptFollowRecord(data: UpdateCustomerFollowRecordParams) {
return CDR.post({ url: UpdateOptFollowRecordUrl, data });
}
// 获取商机跟进记录详情
function getOptFollowRecord(id: string) {
return CDR.get<FollowDetailItem>({ url: `${GetOptFollowRecordUrl}/${id}` });
}
// 跟进计划列表
function getOptFollowPlanList(data: CustomerFollowPlanTableParams) {
return CDR.post<CommonList<FollowDetailItem>>({ url: OptFollowPlanPageUrl, data });
}
// 添加商机跟进计划
function addOptFollowPlan(data: SaveCustomerFollowPlanParams) {
return CDR.post({ url: AddOptFollowPlanUrl, data });
}
// 更新商机跟进计划
function updateOptFollowPlan(data: UpdateCustomerFollowPlanParams) {
return CDR.post({ url: UpdateOptFollowPlanUrl, data });
}
// 删除商机跟进计划
function deleteOptFollowPlan(id: string) {
return CDR.get({ url: `${DeleteOptFollowPlanUrl}/${id}` });
}
// 获取商机跟进计划详情
function getOptFollowPlan(id: string) {
return CDR.get<FollowDetailItem>({ url: `${GetOptFollowPlanUrl}/${id}` });
}
// 取消商机跟进计划
function cancelOptFollowPlan(id: string) {
return CDR.get({ url: `${CancelOptFollowPlanUrl}/${id}` });
}
// 批量转移商机
function transferOpt(data: TransferParams) {
return CDR.post({ url: OptBatchTransferUrl, data });
}
// 批量删除商机
function batchDeleteOpt(data: (string | number)[]) {
return CDR.post({ url: OptBatchDeleteUrl, data });
}
// 删除商机
function deleteOpt(id: string) {
return CDR.get({ url: `${OptDeleteUrl}/${id}` });
}
// 更新商机阶段
function updateOptStage(data: { id: string; stage: string; failureReason?: string | null }) {
return CDR.post({ url: OptUpdateStageUrl, data });
}
// 获取商机tab显隐藏
function getOptTab() {
return CDR.get<CustomerTabHidden>({ url: GetOptTabUrl });
}
// 获取商机联系人列表
function getOpportunityContactList(data: CustomerContractTableParams) {
return CDR.get({ url: `${GetOpportunityContactListUrl}/${data.id}` });
}
// 更新商机跟进计划状态
function updateOptFollowPlanStatus(data: UpdateFollowPlanStatusParams) {
return CDR.post({ url: UpdateOptFollowPlanStatusUrl, data });
}
// 导出全量商机列表
function exportOpportunityAll(data: TableExportParams) {
return CDR.post({ url: ExportOpportunityAllUrl, data });
}
// 导出选中商机列表
function exportOpportunitySelected(data: TableExportSelectedParams) {
return CDR.post({ url: ExportOpportunitySelectedUrl, data });
}
// 商机列表的金额数据
function getOptStatistic(data: TableQueryParams) {
return CDR.post({ url: GetOptStatisticUrl, data }, { ignoreCancelToken: true });
}
// 更新商机阶段配置
function updateOpportunityStage(data: UpdateOpportunityStageParams) {
return CDR.post({ url: UpdateOpportunityStageUrl, data });
}
// 商机阶段回退配置
function updateOpportunityStageRollback(data: UpdateOpportunityStageRollbackParams) {
return CDR.post({ url: UpdateOpportunityStageRollbackUrl, data });
}
// 商机阶段排序
function sortOpportunityStage(data: string[]) {
return CDR.post({ url: SortOpportunityStageUrl, data });
}
// 添加商机阶段
function addOpportunityStage(data: AddOpportunityStageParams) {
return CDR.post({ url: AddOpportunityStageUrl, data });
}
// 获取商机阶段配置
function getOpportunityStageConfig() {
return CDR.get<OpportunityStageConfig>({ url: GetOpportunityStageConfigUrl }, { ignoreCancelToken: true });
}
// 删除商机阶段
function deleteOpportunityStage(id: string) {
return CDR.get({ url: `${DeleteOpportunityStageUrl}/${id}` });
}
// 生成商机图表
function generateOpportunityChart(data: GenerateChartParams) {
return CDR.post<ChartResponseDataItem[]>({ url: GenerateOpportunityChartUrl, data });
}
// 商机视图
function addBusinessView(data: ViewParams) {
return CDR.post({ url: AddBusinessViewUrl, data });
}
function updateBusinessView(data: ViewParams) {
return CDR.post({ url: UpdateBusinessViewUrl, data });
}
function getBusinessViewList() {
return CDR.get<ViewItem[]>({ url: GetBusinessViewListUrl });
}
function getBusinessViewDetail(id: string) {
return CDR.get({ url: `${GetBusinessViewDetailUrl}/${id}` });
}
function fixedBusinessView(id: string) {
return CDR.get({ url: `${FixedBusinessViewUrl}/${id}` });
}
function enableBusinessView(id: string) {
return CDR.get({ url: `${EnableBusinessViewUrl}/${id}` });
}
function deleteBusinessView(id: string) {
return CDR.get({ url: `${DeleteBusinessViewUrl}/${id}` });
}
function dragBusinessView(data: TableDraggedParams) {
return CDR.post({ url: DragBusinessViewUrl, data });
}
function globalSearchOptPage(data: TableQueryParams) {
return CDR.post<CommonList<OpportunityItem>>({ url: GlobalSearchOptPageUrl, data }, { ignoreCancelToken: true });
}
function advancedSearchOptPage(data: TableQueryParams) {
return CDR.post<CommonList<OpportunityItem>>({ url: AdvancedSearchOptPageUrl, data }, { ignoreCancelToken: true });
}
function advancedSearchOptDetail(data: TableQueryParams) {
return CDR.post<CommonList<OpportunityItem>>({ url: AdvancedSearchOptDetailUrl, data });
}
function preCheckImportOpt(file: File) {
return CDR.uploadFile<{ data: ValidateInfo }>({ url: PreCheckOptImportUrl }, { fileList: [file] }, 'file');
}
function downloadOptTemplate() {
return CDR.get(
{
url: DownloadOptTemplateUrl,
responseType: 'blob',
},
{ isTransformResponse: false, isReturnNativeResponse: true }
);
}
function importOpportunity(file: File) {
return CDR.uploadFile({ url: ImportOpportunityUrl }, { fileList: [file] }, 'file');
}
// 批量更新商机
function batchUpdateOpportunity(data: BatchUpdatePoolAccountParams) {
return CDR.post({ url: BatchUpdateOpportunityUrl, data });
}
// 获取商机报价单tab显隐藏
function getQuotationTab() {
return CDR.get<CustomerTabHidden>({ url: GetQuotationTabUrl });
}
// 报价单视图
function addQuotationView(data: ViewParams) {
return CDR.post({ url: AddQuotationViewUrl, data });
}
function updateQuotationView(data: ViewParams) {
return CDR.post({ url: UpdateQuotationViewUrl, data });
}
function getQuotationViewList() {
return CDR.get<ViewItem[]>({ url: GetQuotationViewListUrl });
}
function getQuotationViewDetail(id: string) {
return CDR.get({ url: `${GetQuotationViewDetailUrl}/${id}` });
}
function fixedQuotationView(id: string) {
return CDR.get({ url: `${FixedQuotationViewUrl}/${id}` });
}
function enableQuotationView(id: string) {
return CDR.get({ url: `${EnableQuotationViewUrl}/${id}` });
}
function deleteQuotationView(id: string) {
return CDR.get({ url: `${DeleteQuotationViewUrl}/${id}` });
}
function dragQuotationView(data: TableDraggedParams) {
return CDR.post({ url: DragQuotationViewUrl, data });
}
// 报价单
// 报价列表
function getQuotationList(data: QuotationQueryParams) {
return CDR.post<CommonList<QuotationItem>>({ url: QuotationPageUrl, data });
}
// 添加报价
function addQuotation(data: SaveQuotationParams) {
return CDR.post({ url: AddQuotationUrl, data });
}
// 更新报价
function updateQuotation(data: UpdateQuotationParams, approvalTaskId?: string) {
return CDR.post({ url: UpdateQuotationUrl, data, params: { approvalTaskId } });
}
// 报价详情
function getQuotationDetail(id: string, approvalTaskId?: string) {
return CDR.get<QuotationItem>({ url: `${GetQuotationDetailUrl}/${id}`, params: { approvalTaskId } });
}
// 报价单快照详情
function getQuotationSnapshotDetail(id: string, approvalTaskId?: string) {
return CDR.get<QuotationItem>({ url: `${GetQuotationSnapshotDetailUrl}/${id}`, params: { approvalTaskId } });
}
// 获取报价表单配置
function getQuotationFormConfig() {
return CDR.get<FormDesignConfigDetailParams>({ url: GetQuotationFormConfigUrl });
}
// 获取报价表单快照配置
function getQuotationSnapshotFormConfig(id?: string, approvalTaskId?: string) {
return CDR.get<FormDesignConfigDetailParams>({
url: `${GetQuotationSnapshotFormConfigUrl}/${id}`,
params: { approvalTaskId },
});
}
// 删除报价
function deleteQuotation(id: string) {
return CDR.get({ url: `${DeleteQuotationUrl}/${id}` });
}
// 作废报价
function voidQuotation(id: string) {
return CDR.get({ url: `${VoidQuotationUrl}/${id}` });
}
// 审批报价
function approvalQuotation(data: ApproveQuotation) {
return CDR.post({ url: ApprovalQuotationUrl, data });
}
// 撤销报价
function revokeQuotation(id: string) {
return CDR.get({ url: `${RevokeQuotationUrl}/${id}` });
}
function batchApprove(data: BatchUpdateQuotationStatusParams) {
return CDR.post<BatchOperationResult>({ url: BatchApproveUrl, data });
}
function batchVoided(data: BatchVoidQuotationStatusParams) {
return CDR.post<BatchOperationResult>({ url: BatchVoidedUrl, data });
}
function batchUpdateQuotation(data: BatchUpdatePoolAccountParams) {
return CDR.post({ url: BatchUpdateQuotationUrl, data });
}
function downloadQuotation(id: string) {
return CDR.get({ url: `${DownloadQuotationUrl}/${id}` });
}
return {
getOpportunityList,
addOpportunity,
updateOpportunity,
getOpportunityDetail,
getOptFormConfig,
getOptFollowRecordList,
deleteOptFollowRecord,
addOptFollowRecord,
updateOptFollowRecord,
getOptFollowRecord,
getOptFollowPlanList,
addOptFollowPlan,
updateOptFollowPlan,
deleteOptFollowPlan,
getOptFollowPlan,
cancelOptFollowPlan,
transferOpt,
batchDeleteOpt,
deleteOpt,
updateOptStage,
getOptTab,
getOpportunityContactList,
updateOptFollowPlanStatus,
exportOpportunityAll,
exportOpportunitySelected,
addBusinessView,
deleteBusinessView,
fixedBusinessView,
getBusinessViewDetail,
getBusinessViewList,
updateBusinessView,
enableBusinessView,
dragBusinessView,
advancedSearchOptPage,
globalSearchOptPage,
advancedSearchOptDetail,
preCheckImportOpt,
downloadOptTemplate,
importOpportunity,
getOptStatistic,
batchUpdateOpportunity,
sortOpportunity,
updateOpportunityStage,
updateOpportunityStageRollback,
sortOpportunityStage,
addOpportunityStage,
getOpportunityStageConfig,
deleteOpportunityStage,
generateOpportunityChart,
getQuotationTab,
addQuotationView,
deleteQuotationView,
fixedQuotationView,
getQuotationViewDetail,
getQuotationViewList,
updateQuotationView,
enableQuotationView,
dragQuotationView,
getQuotationList,
addQuotation,
updateQuotation,
getQuotationDetail,
getQuotationSnapshotDetail,
getQuotationFormConfig,
getQuotationSnapshotFormConfig,
deleteQuotation,
approvalQuotation,
voidQuotation,
revokeQuotation,
batchApprove,
batchVoided,
batchUpdateQuotation,
downloadQuotation,
};
}

View File

@@ -0,0 +1,240 @@
import type { CordysAxios } from '@lib/shared/api/http/Axios';
import {
AddOrderUrl,
AddOrderViewUrl,
BatchUpdateOrderUrl,
DeleteOrderUrl,
UpdateOrderStageUrl,
DeleteOrderViewUrl,
DragOrderViewUrl,
EnableOrderViewUrl,
FixedOrderViewUrl,
GetOrderDetailUrl,
OrderPageUrl,
SortOrderUrl,
OrderDetailSnapshotUrl,
OrderFormConfigUrl,
OrderFormConfigSnapshotUrl,
OrderInContractPageUrl,
GetOrderTabUrl,
GetOrderViewDetailUrl,
GetOrderViewListUrl,
UpdateOrderUrl,
UpdateOrderViewUrl,
UpdateOrderStatusUrl,
UpdateOrderStatusRollbackUrl,
SortOrderStatusUrl,
AddOrderStatusUrl,
GetOrderStatusConfigUrl,
DeleteOrderStatusUrl,
DownloadOrderUrl,
OrderStatisticUrl,
SaveAdvanceConfigUrl,
SwitchOrderCirculationTypeUrl,
} from '@lib/shared/api/requrls/order';
import type { FormDesignConfigDetailParams } from '@lib/shared/models/system/module';
import type { CommonList, TableDraggedParams } from '@lib/shared/models/common';
import type { BatchUpdatePoolAccountParams, CustomerTabHidden } from '@lib/shared/models/customer';
import type { OrderItem, UpdateOrderParams } from '@lib/shared/models/order';
import type { TableQueryParams } from '@lib/shared/models/common';
import type { ViewItem, ViewParams } from '@lib/shared/models/view';
import {
StageBoardPageQueryParams,
StageBoardDraggedParams,
StageBaseParams,
OpportunityStageConfig,
UpdateOpportunityStageRollbackParams,
UpdateStageBaseParams,
type SaveCirculationConfigParams,
type UpdateStageParams,
} from '@lib/shared/models/opportunity';
import type { CirculationTypeEnum } from '@lib/shared/enums/opportunityEnum';
export default function useOrderApi(CDR: CordysAxios) {
// 列表
function getOrderList(data: StageBoardPageQueryParams) {
return CDR.post<CommonList<OrderItem>>({ url: OrderPageUrl, data }, { ignoreCancelToken: true });
}
// 合同下的列表
function getOrderInContractList(data: TableQueryParams) {
return CDR.post<CommonList<OrderItem>>({ url: OrderInContractPageUrl, data });
}
// 订单详情
function getOrderDetail(id: string, approvalTaskId?: string) {
return CDR.get<OrderItem>({ url: `${GetOrderDetailUrl}/${id}`, params: { approvalTaskId } });
}
// 详情快照
function getOrderDetailSnapshot(id: string, approvalTaskId?: string) {
return CDR.get<OrderItem>({ url: `${OrderDetailSnapshotUrl}/${id}`, params: { approvalTaskId } });
}
// 新增订单
function addOrder(data: UpdateOrderParams) {
return CDR.post({ url: AddOrderUrl, data });
}
// 更新订单
function updateOrder(data: UpdateOrderParams, approvalTaskId?: string) {
return CDR.post({ url: UpdateOrderUrl, data, params: { approvalTaskId } });
}
// 批量更新订单
function batchUpdateOrder(data: BatchUpdatePoolAccountParams) {
return CDR.post({ url: BatchUpdateOrderUrl, data });
}
// 删除订单
function deleteOrder(id: string) {
return CDR.get({ url: `${DeleteOrderUrl}/${id}` });
}
// 获取表单配置
function getOrderFormConfig() {
return CDR.get<FormDesignConfigDetailParams>({
url: OrderFormConfigUrl,
});
}
// 获取表单配置快照
function getOrderFormSnapshotConfig(id?: string, approvalTaskId?: string) {
return CDR.get<FormDesignConfigDetailParams>({
url: `${OrderFormConfigSnapshotUrl}/${id}`,
params: { approvalTaskId },
});
}
function downloadOrder(id: string) {
return CDR.get({ url: `${DownloadOrderUrl}/${id}` });
}
// 获取订单tab显隐配置
function getOrderTab() {
return CDR.get<CustomerTabHidden>({ url: GetOrderTabUrl });
}
// 视图管理
function addOrderView(data: ViewParams) {
return CDR.post({ url: AddOrderViewUrl, data });
}
function updateOrderView(data: ViewParams) {
return CDR.post({ url: UpdateOrderViewUrl, data });
}
function getOrderViewList() {
return CDR.get<ViewItem[]>({ url: GetOrderViewListUrl });
}
function getOrderViewDetail(id: string) {
return CDR.get({ url: `${GetOrderViewDetailUrl}/${id}` });
}
function fixedOrderView(id: string) {
return CDR.get({ url: `${FixedOrderViewUrl}/${id}` });
}
function enableOrderView(id: string) {
return CDR.get({ url: `${EnableOrderViewUrl}/${id}` });
}
function deleteOrderView(id: string) {
return CDR.get({ url: `${DeleteOrderViewUrl}/${id}` });
}
function dragOrderView(data: TableDraggedParams) {
return CDR.post({ url: DragOrderViewUrl, data });
}
// 更新订单状态配置
function updateOrderStatus(data: UpdateStageBaseParams) {
return CDR.post({ url: UpdateOrderStatusUrl, data });
}
// 订单状态回退配置
function updateOrderStatusRollback(data: UpdateOpportunityStageRollbackParams) {
return CDR.post({ url: UpdateOrderStatusRollbackUrl, data });
}
// 订单状态排序
function sortOrderStatus(data: string[]) {
return CDR.post({ url: SortOrderStatusUrl, data });
}
// 添加订单状态
function addOrderStatus(data: StageBaseParams) {
return CDR.post({ url: AddOrderStatusUrl, data });
}
// 获取订单状态配置
function getOrderStatusConfig() {
return CDR.get<OpportunityStageConfig>({ url: GetOrderStatusConfigUrl }, { ignoreCancelToken: true });
}
// 删除订单状态
function deleteOrderStatus(id: string) {
return CDR.get({ url: `${DeleteOrderStatusUrl}/${id}` });
}
// 更新阶段
function updateOrderStage(data: UpdateStageParams) {
return CDR.post({ url: UpdateOrderStageUrl, data });
}
// 订单看板拖拽排序
function sortOrder(data: StageBoardDraggedParams) {
return CDR.post({ url: SortOrderUrl, data });
}
// 订单统计
function getOrderStatistic(data: TableQueryParams) {
return CDR.post({ url: OrderStatisticUrl, data }, { ignoreCancelToken: true });
}
// 保存高级流转配置
function saveAdvanceConfig(data: SaveCirculationConfigParams) {
return CDR.post({ url: SaveAdvanceConfigUrl, data });
}
// 切换流转配置
function switchOrderCirculationType(type: CirculationTypeEnum) {
return CDR.get({ url: `${SwitchOrderCirculationTypeUrl}/${type}` });
}
return {
getOrderFormConfig,
getOrderFormSnapshotConfig,
addOrder,
getOrderDetail,
getOrderDetailSnapshot,
updateOrder,
batchUpdateOrder,
deleteOrder,
getOrderList,
getOrderInContractList,
getOrderTab,
addOrderView,
updateOrderView,
getOrderViewList,
getOrderViewDetail,
fixedOrderView,
enableOrderView,
deleteOrderView,
dragOrderView,
updateOrderStatus,
updateOrderStatusRollback,
sortOrderStatus,
addOrderStatus,
getOrderStatusConfig,
deleteOrderStatus,
updateOrderStage,
sortOrder,
downloadOrder,
getOrderStatistic,
switchOrderCirculationType,
saveAdvanceConfig,
};
}

View File

@@ -0,0 +1,222 @@
import type { CordysAxios } from '@lib/shared/api/http/Axios';
import {
AddProductPriceUrl,
AddProductUrl,
BatchDeleteProductUrl,
BatchUpdateProductPriceUrl,
BatchUpdateProductUrl,
DeleteProductPriceUrl,
DeleteProductUrl,
DownloadProductPriceTemplateUrl,
DownloadProductTemplateUrl,
DragSortProductPriceUrl,
DragSortProductUrl,
ExportAllProductPriceUrl,
ExportProductPriceUrl,
GetProductFormConfigUrl,
GetProductListUrl,
GetProductOptionsUrl,
GetProductPriceFormConfigUrl,
GetProductPriceListUrl,
GetProductPriceUrl,
GetProductUrl,
ImportProductPriceUrl,
ImportProductUrl,
PreCheckImportProductPriceUrl,
PreCheckProductImportUrl,
UpdateProductPriceUrl,
UpdateProductUrl,
CopyProductPriceUrl,
} from '@lib/shared/api/requrls/product';
import type {
CommonList,
TableDraggedParams,
TableExportParams,
TableExportSelectedParams,
TableQueryParams,
} from '@lib/shared/models/common';
import { BatchUpdatePoolAccountParams } from '@lib/shared/models/customer';
import type {
AddPriceParams,
ProductListItem,
SaveProductParams,
UpdatePriceParams,
UpdateProductParams,
} from '@lib/shared/models/product';
import type { FormDesignConfigDetailParams } from '@lib/shared/models/system/module';
import { ValidateInfo } from '@lib/shared/models/system/org';
export default function useProductApi(CDR: CordysAxios) {
// 添加产品
function addProduct(data: SaveProductParams) {
return CDR.post({ url: AddProductUrl, data });
}
// 更新产品
function updateProduct(data: UpdateProductParams) {
return CDR.post({ url: UpdateProductUrl, data });
}
// 获取产品列表
function getProductList(data: TableQueryParams) {
return CDR.post<CommonList<ProductListItem>>({ url: GetProductListUrl, data });
}
// 获取产品表单配置
function getProductFormConfig() {
return CDR.get<FormDesignConfigDetailParams>({ url: GetProductFormConfigUrl });
}
// 获取产品详情
function getProduct(id: string) {
return CDR.get<ProductListItem>({ url: `${GetProductUrl}/${id}` });
}
// 删除产品
function deleteProduct(id: string) {
return CDR.get({ url: `${DeleteProductUrl}/${id}` });
}
// 批量删除产品
function batchDeleteProduct(data: (string | number)[]) {
return CDR.post({ url: BatchDeleteProductUrl, data });
}
// 批量更新产品
function batchUpdateProduct(data: BatchUpdatePoolAccountParams) {
return CDR.post({ url: BatchUpdateProductUrl, data });
}
// 拖拽排序产品
function dragSortProduct(data: TableDraggedParams) {
return CDR.post({ url: DragSortProductUrl, data });
}
function preCheckImportProduct(file: File) {
return CDR.uploadFile<{ data: ValidateInfo }>({ url: PreCheckProductImportUrl }, { fileList: [file] }, 'file');
}
function downloadProductTemplate() {
return CDR.get(
{
url: DownloadProductTemplateUrl,
responseType: 'blob',
},
{ isTransformResponse: false, isReturnNativeResponse: true }
);
}
function importProduct(file: File) {
return CDR.uploadFile({ url: ImportProductUrl }, { fileList: [file] }, 'file');
}
// 获取意向产品选项
function getProductOptions() {
return CDR.get<{ id: string; name: string }[]>({ url: GetProductOptionsUrl });
}
// 更新价格表
function updateProductPrice(data: UpdatePriceParams) {
return CDR.post({ url: UpdateProductPriceUrl, data });
}
// 批量更新价格表
function batchUpdateProductPrice(data: BatchUpdatePoolAccountParams) {
return CDR.post({ url: BatchUpdateProductPriceUrl, data });
}
// 获取价格表列表
function getProductPriceList(data: TableQueryParams) {
return CDR.post({ url: GetProductPriceListUrl, data });
}
// 添加价格表
function addProductPrice(data: AddPriceParams) {
return CDR.post({ url: AddProductPriceUrl, data });
}
// 获取价格表详情
function getProductPrice(id: string) {
return CDR.get<ProductListItem>({ url: `${GetProductPriceUrl}/${id}` });
}
// 删除价格表
function deleteProductPrice(id: string) {
return CDR.get({ url: `${DeleteProductPriceUrl}/${id}` });
}
// 获取价格表单配置
function getProductPriceFormConfig() {
return CDR.get<FormDesignConfigDetailParams>({ url: GetProductPriceFormConfigUrl });
}
// 拖拽排序价格表
function dragSortProductPrice(data: TableDraggedParams) {
return CDR.post({ url: DragSortProductPriceUrl, data });
}
// 下载价格表模板
function downloadProductPriceTemplate() {
return CDR.get(
{
url: DownloadProductPriceTemplateUrl,
responseType: 'blob',
},
{ isTransformResponse: false, isReturnNativeResponse: true }
);
}
// 预检查导入价格表
function preCheckImportProductPrice(file: File) {
return CDR.uploadFile<{ data: ValidateInfo }>({ url: PreCheckImportProductPriceUrl }, { fileList: [file] }, 'file');
}
// 导入价格表
function importProductPrice(file: File) {
return CDR.uploadFile({ url: ImportProductPriceUrl }, { fileList: [file] }, 'file');
}
// 导出所有的价格表
function exportProductPriceAll(data: TableExportParams) {
return CDR.post({ url: ExportAllProductPriceUrl, data });
}
// 导出选择的价格表
function exportProductPriceSelected(data: TableExportSelectedParams) {
return CDR.post({ url: ExportProductPriceUrl, data });
}
// 复制价格表
function copyProductPrice(id: string) {
return CDR.get({ url: `${CopyProductPriceUrl}/${id}` });
}
return {
addProduct,
updateProduct,
getProductList,
getProductFormConfig,
getProduct,
deleteProduct,
batchDeleteProduct,
batchUpdateProduct,
dragSortProduct,
preCheckImportProduct,
downloadProductTemplate,
importProduct,
getProductOptions,
updateProductPrice,
getProductPriceList,
addProductPrice,
getProductPrice,
deleteProductPrice,
getProductPriceFormConfig,
dragSortProductPrice,
batchUpdateProductPrice,
downloadProductPriceTemplate,
exportProductPriceAll,
exportProductPriceSelected,
preCheckImportProductPrice,
importProductPrice,
copyProductPrice,
};
}

View File

@@ -0,0 +1,19 @@
import type { CordysAxios } from '@lib/shared/api/http/Axios';
import { LocaleChangeUrl, VersionUrl } from '@lib/shared/api/requrls/sys';
import type { SystemVersion } from '@lib/shared/models/common';
export default function useSysApi(CDR: CordysAxios) {
// 获取系统版本信息
function getSystemVersion() {
return CDR.get<SystemVersion>({ url: VersionUrl });
}
function changeLocaleBackEnd(language: string) {
return CDR.post({ url: LocaleChangeUrl, data: { language } });
}
return {
getSystemVersion,
changeLocaleBackEnd,
};
}

View File

@@ -0,0 +1,23 @@
import type { CordysAxios } from '@lib/shared/api/http/Axios';
import { AddLicenseUrl, GetLicenseUrl } from '@lib/shared/api/requrls/system/authorizedManagement';
import type { LicenseInfo } from '@lib/shared/models/system/authorizedManagement';
export default function useProductApi(CDR: CordysAxios) {
/**
* 授权管理相关API
*/
// 获取License
function getLicense() {
return CDR.get<LicenseInfo>({ url: GetLicenseUrl }, { ignoreCancelToken: true });
}
// 添加License
function addLicense(data: string) {
return CDR.post({ url: AddLicenseUrl, data });
}
return {
getLicense,
addLicense,
};
}

View File

@@ -0,0 +1,312 @@
import type { CordysAxios } from '@lib/shared/api/http/Axios';
import {
AddApiKeyUrl,
CancelCenterExportUrl,
CreateAuthUrl,
DeleteApiKeyUrl,
DeleteAuthUrl,
DisableApiKeyUrl,
EnableApiKeyUrl,
ExportCenterDownloadUrl,
GetApiKeyListUrl,
GetAuthDetailUrl,
GetAuthsUrl,
GetConfigEmailUrl,
GetConfigSynchronizationUrl,
GetDEOrgListUrl,
GetDETokenUrl,
GetExportCenterListUrl,
GetPageConfigUrl,
GetPersonalFollowUrl,
GetPersonalUrl,
GetTenderConfigUrl,
GetThirdPartyConfigUrl,
GetThirdPartyResourceUrl,
GetThirdTypeListUrl,
SavePageConfigUrl,
SendEmailCodeUrl,
SwitchThirdPartyUrl,
SyncDEUrl,
TestConfigEmailUrl,
TestConfigSynchronizationUrl,
UpdateApiKeyUrl,
UpdateAuthNameUrl,
UpdateAuthStatusUrl,
UpdateAuthUrl,
UpdateConfigEmailUrl,
UpdateConfigSynchronizationUrl,
UpdatePersonalUrl,
UpdateUserPasswordUrl,
} from '@lib/shared/api/requrls/system/business';
import { CompanyTypeEnum } from '@lib/shared/enums/commonEnum';
import type { CommonList } from '@lib/shared/models/common';
import { CustomerFollowPlanTableParams, FollowDetailItem } from '@lib/shared/models/customer';
import type {
ApiKey,
Auth,
AuthItem,
AuthTableQueryParams,
AuthUpdateParams,
ConfigEmailParams,
ThirdPartyResourceConfig,
DEOrgItem,
PageConfigReturns,
SavePageConfigParams,
ThirdPartyResource,
UpdateApiKeyParams,
ThirdPartyDEConfig,
} from '@lib/shared/models/system/business';
import {
ExportCenterItem,
ExportCenterListParams,
OptionDTO,
PersonalInfoRequest,
PersonalPassword,
SendEmailDTO,
} from '@lib/shared/models/system/business';
import { type DEToken, OrgUserInfo } from '@lib/shared/models/system/org';
export default function useProductApi(CDR: CordysAxios) {
// 获取邮件设置
function getConfigEmail() {
return CDR.get<ConfigEmailParams>({ url: GetConfigEmailUrl });
}
// 更新邮件设置
function updateConfigEmail(data: ConfigEmailParams) {
return CDR.post({ url: UpdateConfigEmailUrl, data });
}
// 邮件设置-测试连接
function testConfigEmail(data: ConfigEmailParams) {
return CDR.post({ url: TestConfigEmailUrl, data });
}
// 同步组织设置-测试连接
function testConfigSynchronization(data: ThirdPartyResourceConfig) {
return CDR.post({ url: TestConfigSynchronizationUrl, data }, { isReturnNativeResponse: true });
}
// 获取同步组织设置
function getConfigSynchronization() {
return CDR.get<ThirdPartyResourceConfig[]>({ url: GetConfigSynchronizationUrl }, { ignoreCancelToken: true });
}
// 更新同步组织设置
function updateConfigSynchronization(data: ThirdPartyResourceConfig) {
return CDR.post({ url: UpdateConfigSynchronizationUrl, data }, { isReturnNativeResponse: true });
}
// 根据类型获取开启的三方扫码设置
function getThirdConfigByType<T = ThirdPartyResourceConfig>(type: string, isReturnNativeResponse = false) {
return CDR.get<T>(
{ url: `${GetThirdPartyConfigUrl}/${type}` },
{
noErrorTip: true,
isReturnNativeResponse,
}
);
}
// 获取三方应用扫码类型集合
function getThirdTypeList() {
return CDR.get<OptionDTO[]>({ url: GetThirdTypeListUrl });
}
// 切换三方平台
function switchThirdParty(type: CompanyTypeEnum) {
return CDR.get({ url: SwitchThirdPartyUrl, params: { type } });
}
// 获取最新的三方同步来源
function getThirdPartyResource() {
return CDR.get<ThirdPartyResource>(
{ url: GetThirdPartyResourceUrl },
{
ignoreCancelToken: true,
}
);
}
// 获取认证设置列表
function getAuthList(data: AuthTableQueryParams) {
return CDR.post<CommonList<AuthItem>>({ url: GetAuthsUrl, data });
}
// 获取认证设置详情
function getAuthDetail(id: string) {
return CDR.get<AuthUpdateParams>({ url: `${GetAuthDetailUrl}/${id}` });
}
// 更新认证设置
function updateAuth(data: AuthUpdateParams) {
return CDR.post({ url: UpdateAuthUrl, data });
}
// 新建认证设置
function createAuth(data: Auth) {
return CDR.post({ url: CreateAuthUrl, data });
}
// 更新认证设置状态
function updateAuthStatus(id: string, enable: boolean) {
return CDR.get({ url: `${UpdateAuthStatusUrl}/${id}`, params: { enable } });
}
// 更新认证设置名称
function updateAuthName(id: string, name: string) {
return CDR.get({ url: `${UpdateAuthNameUrl}/${id}`, params: { name } });
}
// 删除认证设置
function deleteAuth(id: string) {
return CDR.get({ url: `${DeleteAuthUrl}/${id}` });
}
// 获取DEToken
function getDEToken(isModule = false) {
return CDR.get<DEToken>({ url: GetDETokenUrl, params: { isModule } });
}
// 同步 DE
function syncDE() {
return CDR.get({ url: SyncDEUrl });
}
// 获取第三方配置
function getThirdPartyConfig(type: string) {
return CDR.get<ThirdPartyResourceConfig>({ url: `${GetThirdPartyConfigUrl}/${type}` }, { noErrorTip: true });
}
// 获取 DE 组织列表
function getDEOrgList(data: ThirdPartyDEConfig) {
return CDR.post<DEOrgItem[]>({ url: GetDEOrgListUrl, data });
}
// 获取个人信息
function getPersonalInfo() {
return CDR.get<OrgUserInfo>({ url: GetPersonalUrl });
}
// 更新个人信息
function updatePersonalInfo(data: PersonalInfoRequest) {
return CDR.post({ url: UpdatePersonalUrl, data });
}
// 发送验证码
function sendEmailCode(email: SendEmailDTO) {
return CDR.post({ url: SendEmailCodeUrl, params: { email } });
}
// 修改密码
function updateUserPassword(data: PersonalPassword) {
return CDR.post({ url: UpdateUserPasswordUrl, data });
}
// 获取个人跟进计划
function getPersonalFollow(data: CustomerFollowPlanTableParams) {
return CDR.post<CommonList<FollowDetailItem>>({ url: GetPersonalFollowUrl, data });
}
// 个人中心导出列表
function getExportCenterList(data: ExportCenterListParams) {
return CDR.post<ExportCenterItem[]>({ url: GetExportCenterListUrl, data });
}
// 个人中心导出下载
function exportCenterDownload(taskId: string) {
return CDR.get(
{ url: `${ExportCenterDownloadUrl}/${taskId}`, responseType: 'blob' },
{ isTransformResponse: false }
);
}
// 个人中心取消导出
function cancelCenterExport(taskId: string) {
return CDR.get({ url: `${CancelCenterExportUrl}/${taskId}` });
}
// 个人中心 ApiKey
// 更新ApiKey
function updateApiKey(data: UpdateApiKeyParams) {
return CDR.post({ url: UpdateApiKeyUrl, data });
}
// 获取ApiKey列表
function getApiKeyList() {
return CDR.get<ApiKey[]>({ url: GetApiKeyListUrl });
}
// 开启ApiKey
function enableApiKey(id: string) {
return CDR.get({ url: EnableApiKeyUrl, params: id });
}
// 关闭ApiKey
function disableApiKey(id: string) {
return CDR.get({ url: DisableApiKeyUrl, params: id });
}
// 删除ApiKey
function deleteApiKey(id: string) {
return CDR.get({ url: DeleteApiKeyUrl, params: id });
}
// 新增ApiKey
function addApiKey() {
return CDR.get({ url: AddApiKeyUrl });
}
// 保存界面配置
function savePageConfig(data: SavePageConfigParams) {
return CDR.uploadFile({ url: SavePageConfigUrl }, data, 'files');
}
// 获取界面配置
function getPageConfig() {
return CDR.get<PageConfigReturns>({ url: GetPageConfigUrl }, { ignoreCancelToken: true });
}
// 获取招投标配置项
function getTenderConfig() {
return CDR.get<ThirdPartyResourceConfig>({ url: GetTenderConfigUrl }, { ignoreCancelToken: true });
}
return {
getConfigEmail,
updateConfigEmail,
testConfigEmail,
testConfigSynchronization,
getConfigSynchronization,
updateConfigSynchronization,
getThirdConfigByType,
getThirdTypeList,
getAuthList,
getAuthDetail,
updateAuth,
createAuth,
updateAuthStatus,
updateAuthName,
deleteAuth,
switchThirdParty,
getThirdPartyResource,
getPersonalInfo,
updatePersonalInfo,
sendEmailCode,
updateUserPassword,
getPersonalFollow,
getExportCenterList,
exportCenterDownload,
cancelCenterExport,
getDEToken,
syncDE,
getDEOrgList,
getThirdPartyConfig,
updateApiKey,
getApiKeyList,
enableApiKey,
disableApiKey,
deleteApiKey,
addApiKey,
savePageConfig,
getPageConfig,
getTenderConfig,
};
}

View File

@@ -0,0 +1,57 @@
import type { CordysAxios } from '@lib/shared/api/http/Axios';
import {
getKeyUrl,
isLoginUrl,
loginUrl,
signoutUrl,
thirdCallbackUrl,
thirdOauthCallbackUrl,
} from '@lib/shared/api/requrls/system/login';
import type { LoginParams } from '@lib/shared/models/system/login';
import type { UserInfo } from '@lib/shared/models/user';
import type { Result } from '@lib/shared/types/axios';
import type { AxiosResponse } from 'axios';
export default function useProductApi(CDR: CordysAxios) {
// 登录
function login(data: LoginParams) {
return CDR.post<UserInfo>({ url: loginUrl, data });
}
// 登出
function signout() {
return CDR.get({ url: signoutUrl });
}
// 是否登录
function isLogin(isDisabledErrorTip = false) {
return CDR.get<UserInfo>({ url: isLoginUrl }, { ignoreCancelToken: true, noErrorTip: isDisabledErrorTip });
}
// 获取登录密钥
function getKey() {
return CDR.get<string>({ url: getKeyUrl });
}
// 三方二维码登录
function getThirdCallback(code: string, type: string) {
return CDR.get<UserInfo>({ url: `${thirdCallbackUrl}/${type}`, params: { code } });
}
// 三方oauth2登录
function getThirdOauthCallback(code: string, type: string) {
return CDR.get<AxiosResponse<Result<UserInfo>>>(
{ url: `${thirdOauthCallbackUrl}/${type}`, params: { code } },
{ ignoreCancelToken: true, isReturnNativeResponse: true, noErrorTip: true }
);
}
return {
login,
signout,
isLogin,
getKey,
getThirdCallback,
getThirdOauthCallback,
};
}

View File

@@ -0,0 +1,133 @@
import type { CordysAxios } from '@lib/shared/api/http/Axios';
import {
AddAnnouncementUrl,
BatchSaveMessageTaskUrl,
CloseMessageUrl,
DeleteAnnouncementUrl,
GetAnnouncementDetailUrl,
GetAnnouncementListUrl,
GetHomeMessageUrl,
getMessageTaskConfigDetailUrl,
GetMessageTaskUrl,
GetNotificationCountUrl,
GetNotificationListUrl,
GetUnReadAnnouncement,
SaveMessageTaskUrl,
SetAllNotificationReadUrl,
SetNotificationReadUrl,
UpdateAnnouncementUrl,
} from '@lib/shared/api/requrls/system/message';
import type { CommonList } from '@lib/shared/models/common';
import type {
AnnouncementItemDetail,
AnnouncementSaveParams,
AnnouncementTableQueryParams,
MessageCenterItem,
MessageCenterQueryParams,
MessageConfigItem,
MessageSettingsConfig,
SaveMessageConfigParams,
} from '@lib/shared/models/system/message';
export default function useProductApi(CDR: CordysAxios) {
// 公告
// 添加公告
function addAnnouncement(data: AnnouncementSaveParams) {
return CDR.post({ url: AddAnnouncementUrl, data });
}
// 更新公告
function updateAnnouncement(data: AnnouncementSaveParams) {
return CDR.post({ url: UpdateAnnouncementUrl, data });
}
// 获取公告列表
function getAnnouncementList(data: AnnouncementTableQueryParams) {
return CDR.post<CommonList<AnnouncementItemDetail>>({ url: GetAnnouncementListUrl, data });
}
// 公告详情
function getAnnouncementDetail(id: string) {
return CDR.get<AnnouncementItemDetail>({ url: `${GetAnnouncementDetailUrl}/${id}` });
}
// 删除公告
function deleteAnnouncement(id: string) {
return CDR.get({ url: `${DeleteAnnouncementUrl}/${id}` });
}
// 消息中心
// 消息列表
function getNotificationList(data: MessageCenterQueryParams) {
return CDR.post<CommonList<MessageCenterItem>>({ url: GetNotificationListUrl, data });
}
// 具体消息类型具体状态的数量
function getNotificationCount(data: MessageCenterQueryParams) {
return CDR.post<{ key: string; count: number }[]>({ url: GetNotificationCountUrl, data });
}
// 设置消息已读
function setNotificationRead(id: string) {
return CDR.get({ url: `${SetNotificationReadUrl}/${id}` });
}
// 所有信息设置为已读消息
function setAllNotificationRead() {
return CDR.get({ url: SetAllNotificationReadUrl });
}
// 获取消息设置
function getMessageTask() {
return CDR.get<MessageConfigItem[]>({ url: GetMessageTaskUrl });
}
// 获取首页消息列表
function getHomeMessageList() {
return CDR.get<MessageCenterItem[]>({ url: GetHomeMessageUrl });
}
// 保存消息设置
function saveMessageTask(data: SaveMessageConfigParams) {
return CDR.post({ url: SaveMessageTaskUrl, data });
}
// 批量编辑消息设置
function batchSaveMessageTask(data: Pick<SaveMessageConfigParams, 'emailEnable' | 'sysEnable' | 'weComEnable'>) {
return CDR.post({ url: BatchSaveMessageTaskUrl, data });
}
// 关闭订阅消息SSE事件流
function closeMessageSubscribe(params: { userId: string; clientId: string }) {
return CDR.get({ url: CloseMessageUrl, params }, { ignoreCancelToken: true });
}
// 获取未读公告
function getUnReadAnnouncement() {
return CDR.get<MessageCenterItem[]>({ url: GetUnReadAnnouncement });
}
// 获取消息任务配置详情
function getMessageTaskConfigDetail(data: { module: string ,event:string}) {
return CDR.post<MessageSettingsConfig>({ url: getMessageTaskConfigDetailUrl, data });
}
return {
addAnnouncement,
updateAnnouncement,
getAnnouncementList,
getAnnouncementDetail,
deleteAnnouncement,
getNotificationList,
getNotificationCount,
setNotificationRead,
setAllNotificationRead,
getMessageTask,
saveMessageTask,
batchSaveMessageTask,
getHomeMessageList,
closeMessageSubscribe,
getUnReadAnnouncement,
getMessageTaskConfigDetail,
};
}

View File

@@ -0,0 +1,507 @@
import type { CordysAxios } from '@lib/shared/api/http/Axios';
import {
AddClueCapacityUrl,
AddCluePoolUrl,
AddCustomerCapacityUrl,
AddCustomerPoolUrl,
addOpportunityRuleUrl,
AddReasonUrl,
CheckRepeatUrl,
DeleteAttachmentUrl,
DeleteClueCapacityUrl,
DeleteCluePoolUrl,
DeleteCustomerCapacityUrl,
DeleteCustomerPoolUrl,
deleteOpportunityUrl,
DeleteReasonUrl,
DownloadAttachmentUrl,
DownloadPictureUrl,
GetClueCapacityPageUrl,
GetCluePoolPageUrl,
GetCustomerCapacityPageUrl,
GetCustomerPoolPageUrl,
GetFieldClueListUrl,
GetFieldContractListUrl,
GetFieldInvoiceListUrl,
GetFieldContractPaymentPlanListUrl,
GetFieldContractPaymentRecordListUrl,
GetFieldContactListUrl,
GetFieldCustomerListUrl,
GetFieldDeptTreeUrl,
GetFieldDeptUerTreeUrl,
GetFieldOpportunityListUrl,
GetFieldProductListUrl,
GetFormDesignConfigUrl,
GetModuleMaskSearchConfigUrl,
getModuleNavConfigListUrl,
GetModuleTopNavListUrl,
getOpportunityListUrl,
GetReasonConfigUrl,
GetReasonUrl,
GetSearchConfigUrl,
ModuleMaskSearchConfigUrl,
moduleNavListSortUrl,
ModuleRoleTreeUrl,
ModuleUserDeptTreeUrl,
NoPickCluePoolUrl,
NoPickCustomerPoolUrl,
PreviewAttachmentUrl,
PreviewPictureUrl,
QuickUpdateCluePoolUrl,
QuickUpdateCustomerPoolUrl,
ResetSearchConfigUrl,
SaveFormDesignConfigUrl,
SearchConfigUrl,
SetModuleTopNavSortUrl,
SortReasonUrl,
SwitchCluePoolStatusUrl,
SwitchCustomerPoolStatusUrl,
switchOpportunityStatusUrl,
toggleModuleNavStatusUrl,
UpdateClueCapacityUrl,
GetFieldDisplayListUrl,
UpdateCluePoolUrl,
UpdateCustomerCapacityUrl,
UpdateCustomerPoolUrl,
updateOpportunityRuleUrl,
UpdateReasonEnableUrl,
UpdateReasonUrl,
UploadTempAttachmentUrl,
UploadTempFileUrl,
GetFieldPriceListUrl,
GetFieldQuotationListUrl,
GetFieldBusinessTitleListUrl,
SetDisplayAdvancedUrl,
GetAdvancedSwitchUrl,
GetFieldRefDetailListUrl,
GetFieldOrderListUrl,
GetFieldCustomFormListUrl,
GetFieldConfigUrl,
} from '@lib/shared/api/requrls/system/module';
import { QuotationItem } from '@lib/shared/models/opportunity';
import { ModuleConfigEnum, ReasonTypeEnum } from '@lib/shared/enums/moduleEnum';
import type { ClueListItem } from '@lib/shared/models/clue';
import type { CommonList, TableQueryParams } from '@lib/shared/models/common';
import type { CustomerContractListItem, CustomerListItem } from '@lib/shared/models/customer';
import type { ProductListItem } from '@lib/shared/models/product';
import type {
CapacityItem,
CapacityParams,
CheckRepeatInfo,
CheckRepeatParams,
CluePoolItem,
CluePoolParams,
DefaultSearchSetFormModel,
FormDesignConfigDetailParams,
FormDesignDataSourceTableQueryParams,
GetRefDataSourceFieldParams,
ModuleNavBaseInfoItem,
ModuleNavTopItem,
ModuleSortParams,
OpportunityItem,
OpportunityParams,
ReasonConfig,
ReasonItem,
ReasonParams,
RefDataSourceFieldItem,
SaveFormDesignConfigParams,
SortReasonParams,
UpdateReasonEnableParams,
} from '@lib/shared/models/system/module';
import type { DeptUserTreeNode } from '@lib/shared/models/system/role';
import type { Result } from '@lib/shared/types/axios';
import { FormDesignKeyEnum } from '@lib/shared/enums/formDesignEnum';
import type { BusinessTitleItem, ContractItem, PaymentPlanItem, PaymentRecordItem } from '@lib/shared/models/contract';
import type { OrderItem } from '@lib/shared/models/order';
import { CustomFormPageItem, type CustomFormDetail } from '@lib/shared/models/customForm';
export default function useProductApi(CDR: CordysAxios) {
// 模块首页-导航模块列表
function getModuleNavConfigList(data: { organizationId: string }) {
return CDR.post<ModuleNavBaseInfoItem[]>({ url: getModuleNavConfigListUrl, data });
}
// 模块首页-导航模块排序
function moduleNavListSort(data: ModuleSortParams) {
return CDR.post({ url: moduleNavListSortUrl, data });
}
// 模块首页-导航模块状态切换
function toggleModuleNavStatus(id: string) {
return CDR.get({ url: `${toggleModuleNavStatusUrl}/${id}` });
}
// 模块首页-顶导配置列表
function getModuleTopNavList() {
return CDR.get<ModuleNavTopItem[]>({ url: GetModuleTopNavListUrl });
}
// 模块首页-导航模块排序
function setTopNavListSort(data: ModuleSortParams) {
return CDR.post({ url: SetModuleTopNavSortUrl, data });
}
// 获取部门用户树
function getModuleUserDeptTree() {
return CDR.get<DeptUserTreeNode[]>({ url: ModuleUserDeptTreeUrl });
}
// 获取角色树
function getModuleRoleTree() {
return CDR.get<DeptUserTreeNode[]>({ url: ModuleRoleTreeUrl });
}
// 模块-商机-商机规则列表
function getOpportunityRuleList(data: TableQueryParams) {
return CDR.post<CommonList<OpportunityItem>>({ url: getOpportunityListUrl, data });
}
// 模块-商机-添加商机规则
function addOpportunityRule(data: OpportunityParams) {
return CDR.post({ url: addOpportunityRuleUrl, data });
}
// 模块-商机-更新商机规则
function updateOpportunityRule(data: OpportunityParams) {
return CDR.post({ url: updateOpportunityRuleUrl, data });
}
// 模块-商机-更新商机规则状态
function switchOpportunityStatus(ruleId: string) {
return CDR.get({ url: `${switchOpportunityStatusUrl}/${ruleId}` });
}
// 模块-商机-删除商机规则
function deleteOpportunity(ruleId: string) {
return CDR.get({ url: `${deleteOpportunityUrl}/${ruleId}` });
}
// 线索池相关API
function getCluePoolPage(data: TableQueryParams) {
return CDR.post<CommonList<CluePoolItem>>({ url: GetCluePoolPageUrl, data });
}
function addCluePool(data: CluePoolParams) {
return CDR.post({ url: AddCluePoolUrl, data });
}
function updateCluePool(data: CluePoolParams, quick = false) {
return CDR.post({ url: quick ? QuickUpdateCluePoolUrl : UpdateCluePoolUrl, data });
}
function switchCluePoolStatus(id: string) {
return CDR.get({ url: `${SwitchCluePoolStatusUrl}/${id}` });
}
function deleteModuleCluePool(id: string) {
return CDR.get({ url: `${DeleteCluePoolUrl}/${id}` });
}
function noPickCluePool(id: string) {
return CDR.get({ url: `${NoPickCluePoolUrl}/${id}` });
}
// 库容相关API
function getCapacityPage(type: ModuleConfigEnum) {
return CDR.get<CapacityItem[]>({
url: type === ModuleConfigEnum.CLUE_MANAGEMENT ? GetClueCapacityPageUrl : GetCustomerCapacityPageUrl,
});
}
function deleteCapacity(id: string, type: ModuleConfigEnum) {
return CDR.get({
url: `${type === ModuleConfigEnum.CLUE_MANAGEMENT ? DeleteClueCapacityUrl : DeleteCustomerCapacityUrl}/${id}`,
});
}
function updateCapacity(data: CapacityParams, type: ModuleConfigEnum) {
return CDR.post({
url: type === ModuleConfigEnum.CLUE_MANAGEMENT ? UpdateClueCapacityUrl : UpdateCustomerCapacityUrl,
data,
});
}
function addCapacity(data: CapacityParams, type: ModuleConfigEnum) {
return CDR.post({
url: type === ModuleConfigEnum.CLUE_MANAGEMENT ? AddClueCapacityUrl : AddCustomerCapacityUrl,
data,
});
}
// 公海相关API
function getCustomerPoolPage(data: TableQueryParams) {
return CDR.post<CommonList<CluePoolItem>>({ url: GetCustomerPoolPageUrl, data });
}
function addCustomerPool(data: CluePoolParams) {
return CDR.post({ url: AddCustomerPoolUrl, data });
}
function updateCustomerPool(data: CluePoolParams, quick = false) {
return CDR.post({ url: quick ? QuickUpdateCustomerPoolUrl : UpdateCustomerPoolUrl, data });
}
function switchCustomerPoolStatus(id: string) {
return CDR.get({ url: `${SwitchCustomerPoolStatusUrl}/${id}` });
}
function deleteCustomerPool(id: string) {
return CDR.get({ url: `${DeleteCustomerPoolUrl}/${id}` });
}
function noPickCustomerPool(id: string) {
return CDR.get({ url: `${NoPickCustomerPoolUrl}/${id}` });
}
// 表单设计
function saveFormDesignConfig(data: SaveFormDesignConfigParams) {
return CDR.post({ url: SaveFormDesignConfigUrl, data });
}
function getFormDesignConfig(id: string) {
return CDR.get<FormDesignConfigDetailParams>(
{ url: `${GetFormDesignConfigUrl}/${id}` },
{ ignoreCancelToken: true }
);
}
function getFieldDeptUerTree() {
return CDR.get<DeptUserTreeNode[]>({ url: GetFieldDeptUerTreeUrl });
}
function getFieldDeptTree() {
return CDR.get<DeptUserTreeNode[]>({ url: GetFieldDeptTreeUrl }, { ignoreCancelToken: true });
}
function getFieldClueList(data: FormDesignDataSourceTableQueryParams) {
return CDR.post<CommonList<ClueListItem>>({ url: GetFieldClueListUrl, data });
}
function getFieldContractList(data: FormDesignDataSourceTableQueryParams) {
return CDR.post<CommonList<ContractItem>>({ url: GetFieldContractListUrl, data });
}
function getFieldInvoiceList(data: FormDesignDataSourceTableQueryParams) {
return CDR.post<CommonList<ContractItem>>({ url: GetFieldInvoiceListUrl, data });
}
function getFieldContractPaymentPlanList(data: FormDesignDataSourceTableQueryParams) {
return CDR.post<CommonList<PaymentPlanItem>>({ url: GetFieldContractPaymentPlanListUrl, data });
}
function getFieldContractPaymentRecordList(data: FormDesignDataSourceTableQueryParams) {
return CDR.post<CommonList<PaymentRecordItem>>({ url: GetFieldContractPaymentRecordListUrl, data });
}
function getFieldContactList(data: FormDesignDataSourceTableQueryParams) {
return CDR.post<CommonList<CustomerContractListItem>>({ url: GetFieldContactListUrl, data });
}
function getFieldCustomerList(data: FormDesignDataSourceTableQueryParams) {
return CDR.post<CommonList<CustomerListItem>>({ url: GetFieldCustomerListUrl, data });
}
function getFieldOpportunityList(data: FormDesignDataSourceTableQueryParams) {
return CDR.post<CommonList<OpportunityItem>>({ url: GetFieldOpportunityListUrl, data });
}
function getFieldProductList(data: FormDesignDataSourceTableQueryParams) {
return CDR.post<CommonList<ProductListItem>>({ url: GetFieldProductListUrl, data });
}
function getFieldCustomFormList(data: FormDesignDataSourceTableQueryParams) {
return CDR.post<CommonList<CustomFormPageItem>>({ url: GetFieldCustomFormListUrl, data });
}
function checkRepeat(data: CheckRepeatParams) {
return CDR.post<CheckRepeatInfo>({ url: CheckRepeatUrl, data }, { ignoreCancelToken: true });
}
function uploadTempFile(file: File | null) {
return CDR.uploadFile<Result<string[]>>({ url: UploadTempFileUrl }, { fileList: [file] }, 'files', true);
}
function uploadTempAttachment(file: File | null) {
return CDR.uploadFile<Result<string[]>>({ url: UploadTempAttachmentUrl }, { fileList: [file] }, 'files', true);
}
function previewAttachment(id: string) {
return CDR.get({ url: `${PreviewAttachmentUrl}/${id}` });
}
function downloadAttachment(id: string) {
return CDR.get({ url: `${DownloadAttachmentUrl}/${id}`, responseType: 'blob' }, { isTransformResponse: false });
}
function deleteAttachment(id: string) {
return CDR.get({ url: `${DeleteAttachmentUrl}/${id}` });
}
function previewPicture(id: string) {
return CDR.get({ url: `${PreviewPictureUrl}/${id}` });
}
function downloadPicture(id: string) {
return CDR.get({ url: `${DownloadPictureUrl}/${id}` });
}
// 模块配置-原因配置
function getReasonList(type: ReasonTypeEnum) {
return CDR.get<ReasonItem[]>({ url: `${GetReasonUrl}/${type}` });
}
function addReason(data: ReasonParams) {
return CDR.post({ url: AddReasonUrl, data });
}
function updateReason(data: ReasonParams) {
return CDR.post({ url: UpdateReasonUrl, data });
}
function deleteReasonItem(id: string) {
return CDR.get({ url: `${DeleteReasonUrl}/${id}` });
}
function getReasonConfig(type: ReasonTypeEnum) {
return CDR.get<ReasonConfig>({ url: `${GetReasonConfigUrl}/${type}` });
}
function updateReasonEnable(data: UpdateReasonEnableParams) {
return CDR.post<ReasonConfig>({ url: UpdateReasonEnableUrl, data });
}
function sortReason(data: SortReasonParams) {
return CDR.post({ url: SortReasonUrl, data });
}
function searchConfig(data: DefaultSearchSetFormModel) {
return CDR.post({ url: SearchConfigUrl, data });
}
function getSearchConfig() {
return CDR.get<DefaultSearchSetFormModel>({ url: GetSearchConfigUrl });
}
function resetSearchConfig() {
return CDR.get({ url: ResetSearchConfigUrl });
}
function moduleSearchMaskConfig(data: Record<string, any>) {
return CDR.post({ url: ModuleMaskSearchConfigUrl, data });
}
function getModuleSearchMaskConfig() {
return CDR.get<Pick<DefaultSearchSetFormModel, 'searchFields'>>({ url: GetModuleMaskSearchConfigUrl });
}
function getFieldPriceList(data: FormDesignDataSourceTableQueryParams) {
return CDR.post<CommonList<ClueListItem>>({ url: GetFieldPriceListUrl, data });
}
function getFieldQuotationList(data: FormDesignDataSourceTableQueryParams) {
return CDR.post<CommonList<QuotationItem>>({ url: GetFieldQuotationListUrl, data });
}
function getFieldOrderList(data: FormDesignDataSourceTableQueryParams) {
return CDR.post<CommonList<OrderItem>>({ url: GetFieldOrderListUrl, data });
}
function getFieldDisplayList(formKey: FormDesignKeyEnum | string) {
return CDR.get<FormDesignConfigDetailParams>({ url: `${GetFieldDisplayListUrl}/${formKey}` });
}
function getFieldBusinessTitleList(data: FormDesignDataSourceTableQueryParams) {
return CDR.post<CommonList<BusinessTitleItem>>({ url: GetFieldBusinessTitleListUrl, data });
}
function getDatasourceRefDetailList(data: GetRefDataSourceFieldParams) {
return CDR.post<RefDataSourceFieldItem[]>({ url: GetFieldRefDetailListUrl, data }, { ignoreCancelToken: true });
}
// 设置高级筛选开关
function setDisplayAdvanced() {
return CDR.get({ url: SetDisplayAdvancedUrl });
}
// 高级筛选开关
function getAdvancedSwitch() {
return CDR.get({ url: GetAdvancedSwitchUrl });
}
function getDatasourceFieldConfig(type: FormDesignKeyEnum | string, approvalTaskId?: string) {
return CDR.get<FormDesignConfigDetailParams | CustomFormDetail>({ url: `${GetFieldConfigUrl}/${type}` });
}
return {
getFieldDisplayList,
getModuleNavConfigList,
moduleNavListSort,
toggleModuleNavStatus,
getModuleUserDeptTree,
getModuleRoleTree,
getOpportunityRuleList,
addOpportunityRule,
updateOpportunityRule,
switchOpportunityStatus,
deleteOpportunity,
getCluePoolPage,
addCluePool,
updateCluePool,
switchCluePoolStatus,
deleteModuleCluePool,
noPickCluePool,
getCapacityPage,
updateCapacity,
addCapacity,
deleteCapacity,
getCustomerPoolPage,
addCustomerPool,
updateCustomerPool,
switchCustomerPoolStatus,
deleteCustomerPool,
noPickCustomerPool,
saveFormDesignConfig,
getFormDesignConfig,
getFieldDeptUerTree,
getFieldDeptTree,
getFieldClueList,
getFieldContractList,
getFieldInvoiceList,
getFieldContractPaymentPlanList,
getFieldContractPaymentRecordList,
getFieldContactList,
getFieldCustomerList,
getFieldOpportunityList,
getFieldProductList,
checkRepeat,
uploadTempFile,
previewPicture,
downloadPicture,
getReasonList,
addReason,
updateReason,
deleteReasonItem,
getReasonConfig,
updateReasonEnable,
sortReason,
searchConfig,
getSearchConfig,
resetSearchConfig,
moduleSearchMaskConfig,
getModuleSearchMaskConfig,
getModuleTopNavList,
setTopNavListSort,
setDisplayAdvanced,
getAdvancedSwitch,
uploadTempAttachment,
previewAttachment,
deleteAttachment,
downloadAttachment,
getFieldPriceList,
getFieldQuotationList,
getFieldOrderList,
getFieldBusinessTitleList,
getDatasourceRefDetailList,
getFieldCustomFormList,
getDatasourceFieldConfig,
};
}

View File

@@ -0,0 +1,207 @@
import type { CrmTreeNodeData } from '@cordys/web/src/components/pure/crm-tree/type';
import type { CordysAxios } from '@lib/shared/api/http/Axios';
import {
addDepartmentUrl,
addUserUrl,
batchEditUserUrl,
batchEnableUserUrl,
batchResetPasswordUrl,
checkDeleteDepartmentUrl,
checkSyncUserFromThirdUrl,
deleteDepartmentUrl,
deleteUserCheckUrl,
deleteUserUrl,
getDepartmentTreeUrl,
getAdminOptionsUrl,
getOrgDepartmentUserUrl,
CheckSyncUrl,
getRoleOptionsUrl,
getUserDetailUrl,
getUserListUrl,
getUserOptionsUrl,
importUserPreCheckUrl,
importUserUrl,
renameDepartmentUrl,
resetUserPasswordUrl,
setCommanderUrl,
sortDepartmentUrl,
syncOrgUrl,
updateUserNameUrl,
updateUserUrl,
} from '@lib/shared/api/requrls/system/org';
import type { CommonList } from '@lib/shared/models/common';
import type {
DepartmentItemParams,
DragNodeParams,
MemberItem,
MemberParams,
SetCommanderParams,
UpdateDepartmentItemParams,
UserTableQueryParams,
ValidateInfo,
} from '@lib/shared/models/system/org';
import type { DeptUserTreeNode } from '@lib/shared/models/system/role';
export default function useProductApi(CDR: CordysAxios) {
// 组织架构-部门树查询
function getDepartmentTree() {
return CDR.get<CrmTreeNodeData[]>({ url: getDepartmentTreeUrl });
}
// 组织架构-添加子部门
function addDepartment(data: DepartmentItemParams) {
return CDR.post({ url: addDepartmentUrl, data });
}
// 组织架构-重命名部门
function renameDepartment(data: UpdateDepartmentItemParams) {
return CDR.post({ url: renameDepartmentUrl, data });
}
// 组织架构-设置部门负责人
function setCommander(data: SetCommanderParams) {
return CDR.post({ url: setCommanderUrl, data });
}
// 组织架构-删除部门
function deleteDepartment(data: (string | number)[]) {
return CDR.post({ url: deleteDepartmentUrl, data });
}
// 组织架构-删除部门校验
function checkDeleteDepartment(data: (string | number)[]) {
return CDR.post({ url: checkDeleteDepartmentUrl, data });
}
// 组织架构-部门排序
function sortDepartment(data: DragNodeParams) {
return CDR.post({ url: sortDepartmentUrl, data });
}
// 用户(员工)-添加员工
function addUser(data: MemberParams) {
return CDR.post({ url: addUserUrl, data });
}
// 用户(员工)-更新员工
function updateUser(data: MemberParams) {
return CDR.post({ url: updateUserUrl, data });
}
// 用户(员工)-更新员工姓名
function updateOrgUserName(data: { userId: string; name: string }) {
return CDR.post({ url: updateUserNameUrl, data });
}
// 用户(员工)-列表查询
function getUserList(data: UserTableQueryParams) {
return CDR.post<CommonList<MemberItem>>({ url: getUserListUrl, data });
}
// 用户(员工)-员工详情
function getUserDetail(userId: string) {
return CDR.get<MemberParams>({ url: `${getUserDetailUrl}/${userId}` });
}
// 用户(员工)-批量启用|禁用
function batchToggleStatusUser(data: UserTableQueryParams) {
return CDR.post({ url: batchEnableUserUrl, data });
}
// 用户(员工)-批量重置密码
function batchResetUserPassword(data: UserTableQueryParams) {
return CDR.post({ url: batchResetPasswordUrl, data });
}
// 用户(员工)-重置密码
function resetUserPassword(userId: string) {
return CDR.get({ url: `${resetUserPasswordUrl}/${userId}` });
}
// 用户(员工)- 同步组织架构
function syncOrg(type: string) {
return CDR.get({ url: `${syncOrgUrl}/${type}` });
}
// 用户(员工)-批量编辑
function batchEditUser(data: UserTableQueryParams) {
return CDR.post({ url: batchEditUserUrl, data });
}
// 用户(员工)-excel导入检查
function importUserPreCheck(file: File) {
return CDR.uploadFile<{ data: ValidateInfo }>({ url: importUserPreCheckUrl }, { fileList: [file] }, 'file');
}
// 用户(员工)-获取用户下拉
function getUserOptions() {
return CDR.get({ url: getUserOptionsUrl });
}
// 用户(员工)-获取审批管理员下拉
function getAdminOptions() {
return CDR.get<{ id: string; name: string }[]>({ url: getAdminOptionsUrl });
}
// 用户(员工)-获取角色下拉
function getRoleOptions() {
return CDR.get({ url: getRoleOptionsUrl });
}
// 用户(员工)-excel导入
function importUsers(file: File) {
return CDR.uploadFile({ url: importUserUrl }, { fileList: [file] }, 'file');
}
// 用户(员工)-删除员工
function deleteUser(userId: string) {
return CDR.get({ url: `${deleteUserUrl}/${userId}` });
}
// 用户(员工)-删除员工校验
function deleteUserCheck(userId: string) {
return CDR.get({ url: `${deleteUserCheckUrl}/${userId}` });
}
// 用户(员工)-是否同步三方校验
function checkSyncUserFromThird() {
return CDR.get({ url: checkSyncUserFromThirdUrl });
}
// 获取当前部门下组织架构
function getOrgDepartmentUser(data: { id: string }) {
return CDR.get<DeptUserTreeNode[]>({ url: `${getOrgDepartmentUserUrl}/${data.id}` });
}
function checkSync() {
return CDR.get<boolean>({ url: CheckSyncUrl });
}
return {
getDepartmentTree,
addDepartment,
renameDepartment,
setCommander,
deleteDepartment,
addUser,
updateUser,
getUserList,
getUserDetail,
batchToggleStatusUser,
batchResetUserPassword,
resetUserPassword,
syncOrg,
batchEditUser,
importUserPreCheck,
getUserOptions,
getAdminOptions,
getRoleOptions,
importUsers,
deleteUser,
deleteUserCheck,
checkSyncUserFromThird,
checkDeleteDepartment,
sortDepartment,
updateOrgUserName,
getOrgDepartmentUser,
checkSync,
};
}

View File

@@ -0,0 +1,195 @@
import type { CordysAxios } from '@lib/shared/api/http/Axios';
import {
ApprovalPermissionsUrl,
AddApprovalProcessUrl,
UpdateApprovalProcessUrl,
DeleteApprovalProcessUrl,
ApprovalProcessDetailUrl,
ToggleApprovalProcessUrl,
ApprovalProcessPageUrl,
GetApprovalConfigDetailUrl,
GetResourceApprovingDetailUrl,
ReviewResourceUrl,
RevokeResourceUrl,
GetApprovalResourceDetailUrl,
GetProcessedApprovalTodosUrl,
GetPendingApprovalTodosUrl,
GetInitiatedApprovalTodosUrl,
GetCcApprovalTodosUrl,
RejectApprovalUrl,
BackApprovalUrl,
AddSignApprovalUrl,
GetTodoStatisticUrl,
AgreeApprovalUrl,
RevokeApprovalUrl,
BatchRejectApprovalUrl,
BatchApprovalApprovalUrl,
TestApprovalWebHookUrl,
} from '@lib/shared/api/requrls/system/process';
import {
AddApprovalProcessParams,
ApprovalPermissionsDetail,
ApprovalProcessDetail,
ApprovalProcessItem,
ApprovalWebhookConfig,
CommonApprovalActionParams,
UpdateApprovalProcessParams,
type ApprovalAddSignParams,
type ApprovalBackParams,
type ApprovalDetail,
type ApprovalOperationParams,
type ApprovalTodoItem,
type ApprovalTodoTableParams,
type BatchApprovalParams,
type BatchRejectApprovalParams,
type TodoStatistic,
} from '@lib/shared/models/system/process';
import type { CommonList } from '@lib/shared/models/common';
import type { TableQueryParams } from '@lib/shared/models/common';
export default function useProcessApi(CDR: CordysAxios) {
// 审批流数据权限
function getApprovalPermissions(type: string) {
return CDR.get<ApprovalPermissionsDetail>({ url: `${ApprovalPermissionsUrl}/${type}` });
}
// 审批流配置详情 用于列表里边查询对应状态审批流详情
function getApprovalConfigDetail(type: string) {
return CDR.get<ApprovalProcessDetail>({ url: `${GetApprovalConfigDetailUrl}/${type}` });
}
// 审批流数据权限
function getApprovalProcessList(data: TableQueryParams) {
return CDR.post<CommonList<ApprovalProcessItem>>({ url: ApprovalProcessPageUrl, data });
}
// 添加审批流
function addApprovalProcess(data: AddApprovalProcessParams) {
return CDR.post({ url: AddApprovalProcessUrl, data });
}
// 更新审批流
function updateApprovalProcess(data: UpdateApprovalProcessParams) {
return CDR.post({ url: UpdateApprovalProcessUrl, data });
}
// 审批流详情
function approvalProcessDetail(id: string) {
return CDR.get<ApprovalProcessDetail>({ url: `${ApprovalProcessDetailUrl}/${id}` });
}
// 删除审批流
function deleteApprovalProcess(id: string) {
return CDR.get({ url: `${DeleteApprovalProcessUrl}/${id}` });
}
// 切换审批流
function toggleApprovalProcess(id: string, enable: boolean) {
return CDR.get({ url: `${ToggleApprovalProcessUrl}/${id}`, params: { enable } });
}
// 获取对应资源审批状态详情用于(列表小卡片)
function getResourceApprovingDetail(sourceId: string) {
return CDR.get({ url: `${GetResourceApprovingDetailUrl}/${sourceId}` });
}
// 获取已处理审批待办列表
function getProcessedApprovalList(data: ApprovalTodoTableParams) {
return CDR.post<CommonList<ApprovalTodoItem>>({ url: GetProcessedApprovalTodosUrl, data });
}
// 获取待处理审批待办列表
function getPendingApprovalList(data: ApprovalTodoTableParams) {
return CDR.post<CommonList<ApprovalTodoItem>>({ url: GetPendingApprovalTodosUrl, data });
}
// 获取我发起的审批待办列表
function getInitiatedApprovalList(data: ApprovalTodoTableParams) {
return CDR.post<CommonList<ApprovalTodoItem>>({ url: GetInitiatedApprovalTodosUrl, data });
}
// 获取抄送我的审批待办列表
function getCcApprovalList(data: ApprovalTodoTableParams) {
return CDR.post<CommonList<ApprovalTodoItem>>({ url: GetCcApprovalTodosUrl, data });
}
// 驳回
function rejectApproval(data: ApprovalOperationParams) {
return CDR.post({ url: RejectApprovalUrl, data });
}
// 退回
function backApproval(data: ApprovalBackParams) {
return CDR.post({ url: BackApprovalUrl, data });
}
// 加签
function addSignApproval(data: ApprovalAddSignParams) {
return CDR.post({ url: AddSignApprovalUrl, data });
}
// 撤回
function revokeApproval(data: { id: string }) {
return CDR.post({ url: RevokeApprovalUrl, data });
}
// 同意
function agreeApproval(data: ApprovalOperationParams) {
return CDR.post({ url: AgreeApprovalUrl, data });
}
// 批量驳回
function batchRejectApproval(data: BatchRejectApprovalParams) {
return CDR.post({ url: BatchRejectApprovalUrl, data });
}
// 批量同意
function batchAgreeApproval(data: BatchApprovalParams) {
return CDR.post({ url: BatchApprovalApprovalUrl, data });
}
// 获取审批资源详情
function getApprovalResourceDetail(id: string) {
return CDR.get<ApprovalDetail>({ url: `${GetApprovalResourceDetailUrl}/${id}` });
}
// 获取待办统计
function getTodoStatistic() {
return CDR.get<TodoStatistic>({ url: GetTodoStatisticUrl });
}
// 提审
function reviewResource(data: CommonApprovalActionParams) {
return CDR.post({ url: ReviewResourceUrl, data });
}
// 撤销
function revokeResource(data: CommonApprovalActionParams) {
return CDR.post({ url: RevokeResourceUrl, data });
}
// WebHook连接测试
function testApprovalWebHook(data: ApprovalWebhookConfig) {
return CDR.post({ url: TestApprovalWebHookUrl, data });
}
return {
getApprovalProcessList,
getApprovalPermissions,
addApprovalProcess,
updateApprovalProcess,
approvalProcessDetail,
deleteApprovalProcess,
toggleApprovalProcess,
getApprovalConfigDetail,
getResourceApprovingDetail,
reviewResource,
revokeResource,
getProcessedApprovalList,
getPendingApprovalList,
getInitiatedApprovalList,
getCcApprovalList,
rejectApproval,
backApproval,
addSignApproval,
getApprovalResourceDetail,
getTodoStatistic,
revokeApproval,
agreeApproval,
batchRejectApproval,
batchAgreeApproval,
testApprovalWebHook,
};
}

View File

@@ -0,0 +1,119 @@
import type { CordysAxios } from '@lib/shared/api/http/Axios';
import {
BatchRemoveRoleMemberUrl,
CreateRoleUrl,
DeleteRoleUrl,
GetDeptTreeUrl,
GetPermissionsUrl,
GetRoleDeptTreeUrl,
GetRoleDetailUrl,
GetRoleMemberTreeUrl,
GetRoleMemberUrl,
GetRolesUrl,
GetUserOptionUrl,
RelateRoleUrl,
RemoveRoleMemberUrl,
UpdateRoleUrl,
} from '@lib/shared/api/requrls/system/role';
import type { CommonList } from '@lib/shared/models/common';
import type {
DeptTreeNode,
DeptUserTreeNode,
PermissionTreeNode,
RelateRoleMemberParams,
RoleCreateParams,
RoleDetail,
RoleItem,
RoleMemberItem,
RoleMemberTableQueryParams,
RoleUpdateParams,
} from '@lib/shared/models/system/role';
export default function useProductApi(CDR: CordysAxios) {
// 角色关联用户
function relateRoleMember(data: RelateRoleMemberParams) {
return CDR.post({ url: RelateRoleUrl, data });
}
// 获取角色关联用户列表
function getRoleMember(data: RoleMemberTableQueryParams) {
return CDR.post<CommonList<RoleMemberItem>>({ url: GetRoleMemberUrl, data });
}
// 批量移除角色关联用户
function batchRemoveRoleMember(data: (string | number)[]) {
return CDR.post({ url: BatchRemoveRoleMemberUrl, data });
}
// 更新角色
function updateRole(data: RoleUpdateParams) {
return CDR.post({ url: UpdateRoleUrl, data });
}
// 新建角色
function createRole(data: RoleCreateParams) {
return CDR.post({ url: CreateRoleUrl, data });
}
// 获取角色关联用户树
function getRoleMemberTree(params: { roleId: string }) {
return CDR.get({ url: `${GetRoleMemberTreeUrl}/${params.roleId}` });
}
// 获取部门用户树
function getRoleDeptUserTree(params: { roleId: string }) {
return CDR.get<DeptUserTreeNode[]>({ url: `${GetRoleDeptTreeUrl}/${params.roleId}` });
}
// 获取部门树
function getRoleDeptTree() {
return CDR.get<DeptTreeNode[]>({ url: GetDeptTreeUrl });
}
// 移除角色关联用户
function removeRoleMember(id: string) {
return CDR.get({ url: `${RemoveRoleMemberUrl}/${id}` });
}
// 获取全量权限
function getPermissions() {
return CDR.get<PermissionTreeNode[]>({ url: GetPermissionsUrl });
}
// 获取角色列表
function getRoles() {
return CDR.get<RoleItem[]>({ url: GetRolesUrl });
}
// 获取角色详情
function getRoleDetail(id: string) {
return CDR.get<RoleDetail>({ url: `${GetRoleDetailUrl}/${id}` });
}
// 删除角色
function deleteRole(id: string) {
return CDR.get({ url: `${DeleteRoleUrl}/${id}` });
}
// 获取用户列表
function getUsers(data: { roleId: string }) {
return CDR.get<RoleItem[]>({ url: `${GetUserOptionUrl}/${data.roleId}` });
}
return {
relateRoleMember,
getRoleMember,
batchRemoveRoleMember,
updateRole,
createRole,
getRoleMemberTree,
getRoleDeptUserTree,
getRoleDeptTree,
removeRoleMember,
getPermissions,
getRoles,
getRoleDetail,
deleteRole,
getUsers,
};
}

View File

@@ -0,0 +1,24 @@
export const agentModuleRenameUrl = '/agent/module/rename'; // 重命名智能体模块
export const agentModuleMoveUrl = '/agent/module/move'; // 移动智能体模块
export const agentModuleDeleteUrl = '/agent/module/delete'; // 删除智能体模块
export const agentModuleAddUrl = '/agent/module/add'; // 添加智能体模块
export const agentModuleTreeUrl = '/agent/module/tree'; // 获取智能体模块树
export const agentModuleCountUrl = '/agent/module/count'; // 获取智能体模块数量
export const agentPosUrl = '/agent/edit/pos'; // 智能体排序
export const updateAgentUrl = '/agent/update'; // 更新智能体
export const renameAgentUrl = '/agent/rename'; // 重命名智能体
export const agentPageUrl = '/agent/page'; // 获取智能体列表
export const agentCollectPageUrl = '/agent/collect/page'; // 获取收藏的智能体列表
export const addAgentUrl = '/agent/add'; // 添加智能体
export const unCollectAgentUrl = '/agent/un-collect'; // 取消收藏智能体
export const agentDetailUrl = '/agent/detail'; // 获取智能体详情
export const agentDeleteUrl = '/agent/delete'; // 删除智能体
export const agentCollectUrl = '/agent/collect'; // 收藏智能体
export const agentOptionUrl = '/agent/option'; // 智能体选项
export const agentApplicationUrl = '/agent/application'; // 智能体应用
export const agentWorkspaceUrl = '/agent/workspace'; // 智能体工作空间
export const agentScriptUrl = '/agent/script'; // 工作空间应用对应脚本
export const getMkAgentVersionUrl = '/agent/edition'; // 获取智能体mk版本
export const getMkApplicationUrl = '/agent/application/config'; // 获取智能体mk应用配置

View File

@@ -0,0 +1,88 @@
// 线索
export const GetClueFormConfigUrl = '/lead/module/form'; // 获取线索表单配置
export const UpdateClueUrl = '/lead/update'; // 更新线索
export const UpdateClueStatusUrl = '/lead/status/update'; // 更新线索状态
export const GetClueListUrl = '/lead/page'; // 分页查询线索
export const GetClueTransitionCustomerListUrl = '/lead/transition/account/page'; // 线索转为客户列表
export const AddClueUrl = '/lead/add'; // 添加线索
export const GetClueUrl = '/lead/get'; // 获取线索详情
export const DeleteClueUrl = '/lead/delete'; // 删除线索
export const BatchTransferClueUrl = '/lead/batch/transfer'; // 批量转移线索
export const BatchToPoolClueUrl = '/lead/batch/to-pool'; // 批量移入线索池
export const BatchDeleteClueUrl = '/lead/batch/delete'; // 批量删除线索
export const ExportClueAllUrl = '/lead/export'; // 导出全部线索
export const ExportClueSelectedUrl = '/lead/export-select'; // 导出选中线索
export const ReTransitionCustomerUrl = '/lead/re-transition/account'; // 合并线索转为客户
export const MoveToPoolLeadUrl = '/lead/to-pool'; // 移入线索池
export const TransformClueUrl = '/lead/transform'; // 转换线索
export const GetAdvancedSearchClueListUrl = '/advanced/search/lead'; // 全局搜索线索分页查询线索
export const GetAdvancedSearchClueDetailUrl = '/advanced/search/lead/detail'; // 全局搜索线索详情
export const GetGlobalSearchClueListUrl = '/global/search/lead';
export const GetGlobalCluePoolListUrl = '/global/search/clue_pool';
export const BatchUpdateLeadUrl = '/lead/batch/update'; // 批量更新线索
export const GenerateLeadChartUrl = '/lead/chart'; // 生成线索图表
// 跟进记录
export const UpdateClueFollowRecordUrl = '/lead/follow/record/update'; // 更新跟进记录
export const GetClueFollowRecordListUrl = '/lead/follow/record/page'; // 获取跟进记录列表
export const AddClueFollowRecordUrl = '/lead/follow/record/add'; // 添加跟进记录
export const GetClueFollowRecordUrl = '/lead/follow/record/get'; // 获取跟进记录详情
export const DeleteClueFollowRecordUrl = '/lead/follow/record/delete'; // 删除跟进记录
// 跟进计划
export const UpdateClueFollowPlanUrl = '/lead/follow/plan/update'; // 更新跟进计划
export const GetClueFollowPlanListUrl = '/lead/follow/plan/page'; // 获取跟进计划列表
export const AddClueFollowPlanUrl = '/lead/follow/plan/add'; // 添加跟进计划
export const GetClueFollowPlanUrl = '/lead/follow/plan/get'; // 跟进计划详情
export const CancelClueFollowPlanUrl = '/lead/follow/plan/cancel'; // 取消跟进计划
export const DeleteClueFollowPlanUrl = '/lead/follow/plan/delete'; // 删除跟进计划
export const UpdateClueFollowPlanStatusUrl = '/lead/follow/plan/status/update'; // 更新线索跟进计划状态
export const GetClueHeaderListUrl = '/lead/owner/history/list'; // 线索负责人记录列表
// 线索池客户
export const PickClueUrl = '/pool/lead/pick'; // 领取线索
export const GetCluePoolListUrl = '/pool/lead/page'; // 分页查询线索池线索
export const BatchPickClueUrl = '/pool/lead/batch-pick'; // 批量领取线索
export const BatchDeleteCluePoolUrl = '/pool/lead/batch-delete'; // 批量删除线索池线索
export const BatchAssignClueUrl = '/pool/lead/batch-assign'; // 批量分配线索
export const AssignClueUrl = '/pool/lead/assign'; // 分配线索
export const GetPoolOptionsUrl = '/pool/lead/options'; // 获取当前用户线索池选项
export const DeleteCluePoolUrl = '/pool/lead/delete'; // 删除线索池线索
export const GetPoolClueUrl = '/pool/lead/get'; // 获取线索池详情
export const ClueTransitionCustomerUrl = '/lead/transition/account'; // 转为客户
export const GetAdvancedCluePoolListUrl = '/advanced/search/lead-pool'; // 全局搜索分页查询线索池线索
export const ExportCluePoolAllUrl = '/pool/lead/export-all'; // 导出全部线索池线索
export const ExportCluePoolSelectedUrl = '/pool/lead/export-select'; // 导出选中线索池线索
export const BatchUpdateCluePoolUrl = '/pool/lead/batch-update'; // 批量更新线索池线索
export const GenerateLeadPoolChartUrl = '/pool/lead/chart'; // 生成线索池图表
// 线索池跟进记录
export const GetCluePoolFollowRecordListUrl = '/lead/follow/record/pool/page'; // 获取跟进记录列表
export const GetClueTabUrl = '/lead/tab'; // 线索tab显隐
// 视图
export const GetClueViewDetailUrl = '/lead/view/detail';
export const GetClueViewListUrl = '/lead/view/list';
export const AddClueViewUrl = '/lead/view/add';
export const UpdateClueViewUrl = '/lead/view/update';
export const DeleteClueViewUrl = '/lead/view/delete';
export const FixedClueViewUrl = '/lead/view/fixed';
export const EnableClueViewUrl = '/lead/view/enable';
export const DragClueViewUrl = '/lead/view/edit/pos';
// 导入
export const PreCheckImportUrl = '/lead/import/pre-check';
export const DownloadTemplateUrl = '/lead/template/download';
export const ImportLeadUrl = '/lead/import';
// 线索池视图
export const GetPoolLeadViewDetailUrl = 'pool/lead/view/detail';
export const GetPoolLeadViewListUrl = 'pool/lead/view/list';
export const AddPoolLeadViewUrl = 'pool/lead/view/add';
export const UpdatePoolLeadViewUrl = 'pool/lead/view/update';
export const DeletePoolLeadViewUrl = 'pool/lead/view/delete';
export const FixedPoolLeadViewUrl = 'pool/lead/view/fixed';
export const EnablePoolLeadViewUrl = 'pool/lead/view/enable';
export const DragPoolLeadViewUrl = 'pool/lead/view/edit/pos';

View File

@@ -0,0 +1,150 @@
// 合同列表
export const ContractPageUrl = '/contract/page'; // 合同列表
export const ContractAddUrl = '/contract/add'; // 添加合同
export const ContractUpdateUrl = '/contract/update'; // 更新合同
export const ContractDeleteUrl = '/contract/delete'; // 删除合同
export const GetContractDetailUrl = '/contract/get'; // 获取合同详情
export const GetContractDetailSnapshotUrl = '/contract/get/snapshot'; // 获取合同详情快照
export const GetContractFormConfigUrl = '/contract/module/form'; // 合同表单配置
export const GetContractFormSnapshotConfigUrl = '/contract/module/form/snapshot'; // 合同表单配置
export const GetContractTabUrl = '/contract/tab'; // 合同tab显隐
export const ChangeContractStatusUrl = '/contract/update/stage';
export const BatchApproveContractUrl = '/contract/batch/approval';
export const BatchUpdateContractUrl = '/contract/batch/update';
export const ApproveContractUrl = '/contract/approval';
export const RevokeContractUrl = '/contract/revoke';
export const ContractStatisticUrl = '/contract/statistic';
export const SortContractUrl = '/contract/sort';
// 合同导出
export const ExportContractAllUrl = '/contract/export-all'; // 合同导出全量
export const ExportContractSelectedUrl = '/contract/export-select'; // 合同导出选中
// 合同图表
export const GenerateContractChartUrl = '/contract/chart'; // 生成合同图表
// 合同视图
export const AddContractViewUrl = '/contract/view/add'; // 添加合同视图
export const UpdateContractViewUrl = '/contract/view/update'; // 更新合同视图
export const GetContractViewListUrl = '/contract/view/list'; // 获取合同视图列表
export const GetContractViewDetailUrl = '/contract/view/detail'; // 获取合同视图详情
export const FixedContractViewUrl = '/contract/view/fixed'; // 固定合同视图
export const EnableContractViewUrl = '/contract/view/enable'; // 启用合同视图
export const DeleteContractViewUrl = '/contract/view/delete'; // 删除合同视图
export const DragContractViewUrl = '/contract/view/edit/pos'; // 拖拽合同视图排序
// 回款计划列表
export const PaymentPlanPageUrl = '/contract/payment-plan/page'; // 回款计划列表
export const ContractPaymentPlanPageUrl = '/contract/contract-payment-plan/page'; // 回款计划列表
export const PaymentPlanAddUrl = '/contract/payment-plan/add'; // 添加回款计划
export const PaymentPlanUpdateUrl = '/contract/payment-plan/update'; // 更新回款计划
export const PaymentPlanDeleteUrl = '/contract/payment-plan/delete'; // 删除回款计划
export const GetPaymentPlanDetailUrl = '/contract/payment-plan/get'; // 获取回款计划详情
export const GetPaymentPlanFormConfigUrl = '/contract/payment-plan/module/form'; // 回款计划表单配置
export const GetPaymentPlanTabUrl = '/contract/payment-plan/tab'; // 回款计划tab显隐
// 回款计划导出
export const ExportPaymentPlanAllUrl = '/contract/payment-plan/export-all'; // 回款计划导出全量
export const ExportPaymentPlanSelectedUrl = '/contract/payment-plan/export-select'; // 回款计划导出选中
// 回款计划图表
export const GeneratePaymentPlanChartUrl = '/contract/payment-plan/chart'; // 生成回款计划图表
// 回款计划视图
export const AddPaymentPlanViewUrl = '/contract/payment-plan/view/add'; // 添加回款计划视图
export const UpdatePaymentPlanViewUrl = '/contract/payment-plan/view/update'; // 更新回款计划视图
export const GetPaymentPlanViewListUrl = '/contract/payment-plan/view/list'; // 获取回款计划视图列表
export const GetPaymentPlanViewDetailUrl = '/contract/payment-plan/view/detail'; // 获取回款计划视图详情
export const FixedPaymentPlanViewUrl = '/contract/payment-plan/view/fixed'; // 固定回款计划视图
export const EnablePaymentPlanViewUrl = '/contract/payment-plan/view/enable'; // 启用回款计划视图
export const DeletePaymentPlanViewUrl = '/contract/payment-plan/view/delete'; // 删除回款计划视图
export const DragPaymentPlanViewUrl = '/contract/payment-plan/view/edit/pos'; // 拖拽回款计划视图排序
// 回款记录列表
export const PaymentRecordPageUrl = '/contract/payment-record/page'; // 回款记录列表
export const PaymentRecordAddUrl = '/contract/payment-record/add'; // 添加回款记录
export const PaymentRecordUpdateUrl = '/contract/payment-record/update'; // 更新回款记录
export const PaymentRecordDeleteUrl = '/contract/payment-record/delete'; // 删除回款记录
export const GetPaymentRecordDetailUrl = '/contract/payment-record/get'; // 获取回款记录详情
export const GetPaymentRecordFormConfigUrl = '/contract/payment-record/module/form'; // 回款记录表单配置
export const GetPaymentRecordTabUrl = '/contract/payment-record/tab'; // 回款记录tab显隐
export const GetPaymentRecordStatisticUrl = '/contract/payment-record/statistic'; // 回款记录统计
// 回款记录导出
export const ExportPaymentRecordAllUrl = '/contract/payment-record/export-all'; // 回款记录导出全量
export const ExportPaymentRecordSelectedUrl = '/contract/payment-record/export-select'; // 回款记录导出选中
// 回款记录视图
export const AddPaymentRecordViewUrl = '/contract/payment-record/view/add'; // 添加回款记录视图
export const UpdatePaymentRecordViewUrl = '/contract/payment-record/view/update'; // 更新回款记录视图
export const GetPaymentRecordViewListUrl = '/contract/payment-record/view/list'; // 获取回款记录视图列表
export const GetPaymentRecordViewDetailUrl = '/contract/payment-record/view/detail'; // 获取回款记录视图详情
export const FixedPaymentRecordViewUrl = '/contract/payment-record/view/fixed'; // 固定回款记录视图
export const EnablePaymentRecordViewUrl = '/contract/payment-record/view/enable'; // 启用回款记录视图
export const DeletePaymentRecordViewUrl = '/contract/payment-record/view/delete'; // 删除回款记录视图
export const DragPaymentRecordViewUrl = '/contract/payment-record/view/edit/pos'; // 拖拽回款记录视图排序
export const PreCheckPaymentRecordImportUrl = '/contract/payment-record/import/pre-check';
export const DownloadPaymentRecordTemplateUrl = '/contract/payment-record/template/download';
export const ImportPaymentRecordUrl = '/contract/payment-record/import';
// 合同-工商抬头导入
export const PreCheckBusinessTitleImportUrl = '/contract/business-title/import/pre-check';
export const DownloadBusinessTitleTemplateUrl = '/contract/business-title/template/download';
export const ImportBusinessTitleUrl = '/contract/business-title/import';
// 合同-工商抬头导出
export const ExportBusinessTitleAllUrl = '/contract/business-title/export-all';
export const ExportBusinessTitleSelectedUrl = '/contract/business-title/export-select';
// 合同-工商抬头列表
export const BusinessTitlePageUrl = '/contract/business-title/page';
export const BusinessTitleAddUrl = '/contract/business-title/add';
export const BusinessTitleUpdateUrl = '/contract/business-title/update';
export const BusinessTitleDeleteUrl = '/contract/business-title/delete';
export const BusinessTitleRevokeUrl = '/contract/business-title/revoke';
export const GetBusinessTitleDetailUrl = '/contract/business-title/get';
export const GetBusinessTitleInvoiceCheckUrl = '/contract/business-title/invoice/check';
export const GetBusinessTitleThirdQueryUrl = '/contract/business-title/third-query';
export const GetBusinessTitleThirdQueryOptionUrl = '/contract/business-title/third-query/option';
// 工商抬头表单校验
export const BusinessTitleConfigUrl = '/business-title/config/get'; // 获取表单配置校验
export const BusinessTitleFormConfigSwitchUrl = '/business-title/config/switch'; // 表单配置切换
export const BusinessTitleModuleFormUrl = '/contract/business-title/module/form'; // 表单字段
// 发票
export const ContractInvoicedUpdateUrl = '/invoice/update'; // 发票更新
export const ContractInvoicedPageUrl = '/invoice/page'; // 发票列表
export const ContractInvoicedInContractPageUrl = '/contract/invoice/page'; // 合同下的发票列表
export const ContractInvoicedExportSelectedUrl = '/invoice/export-select'; // 发票导出选中
export const ContractInvoicedExportAllUrl = '/invoice/export-all'; // 发票导出全量
export const ContractInvoicedBatchDeleteUrl = '/invoice/batch/delete'; // 发票批量删除
export const ContractInvoicedApprovalUrl = '/invoice/approval'; // 发票审批
export const ContractInvoicedAddUrl = '/invoice/add'; // 发票添加
export const ContractInvoicedFormConfigUrl = '/invoice/module/form'; // 发票表单配置
export const ContractInvoicedFormConfigSnapshotUrl = '/invoice/module/form/snapshot'; // 发票表单配置快照
export const ContractInvoicedDetailUrl = '/invoice/get'; // 发票详情
export const ContractInvoicedDetailSnapshotUrl = '/invoice/get/snapshot'; // 发票详情快照
export const ContractInvoicedDeleteUrl = '/invoice/delete'; // 发票删除
export const ContractInvoicedRevokeUrl = '/invoice/revoke'; // 发票撤回
export const ContractInvoicedTabUrl = '/invoice/tab'; // 发票tab显隐
// 发票视图
export const UpdateContractInvoicedViewUrl = '/invoice/view/update'; // 更新发票视图
export const DragContractInvoicedViewUrl = '/invoice/view/edit/pos'; // 拖拽发票视图排序
export const AddContractInvoicedViewUrl = '/invoice/view/add'; // 添加发票视图
export const ListContractInvoicedViewUrl = '/invoice/view/list'; // 发票视图列表
export const FixedContractInvoicedViewUrl = '/invoice/view/fixed'; // 固定发票视图
export const EnableContractInvoicedViewUrl = '/invoice/view/enable'; // 启用/禁用发票视图
export const GetContractInvoicedViewDetailUrl = '/invoice/view/detail'; // 发票视图详情
export const DeleteContractInvoicedViewUrl = '/invoice/view/delete'; // 发票视图删除
// 合同状态
export const UpdateContractStatusUrl = '/contract/stage/update'; // 更新合同状态配置
export const UpdateContractStatusRollbackUrl = '/contract/stage/update-rollback'; // 合同状态回退配置
export const SortContractStatusUrl = '/contract/stage/sort'; // 合同状态排序
export const AddContractStatusUrl = '/contract/stage/add'; // 合同状态添加
export const GetContractStatusConfigUrl = '/contract/stage/get'; // 获取合同状态配置
export const DeleteContractStatusUrl = '/contract/stage/delete'; // 删除合同状态
export const UpdateContractStageUrl = '/contract/update/stage'; // 更新合同详情阶段
export const SwitchContractCirculationTypeUrl = '/contract/stage/circulation-type'; // 切换流转类型
export const SaveContractCirculationConfigUrl = '/contract/stage/advanced/config'; // 保存高级流转配置

View File

@@ -0,0 +1,35 @@
// 表单模板
export const AddCustomFormUrl = '/custom-form/add'; // 创建自定义表单
export const UpdateCustomFormUrl = '/custom-form/update'; // 更新自定义表单
export const GetCustomFormUrl = '/custom-form/get'; // 自定义表单详情
export const GetCustomFormAdminUrl = '/custom-form/admin/get'; // 获取表单管理员
export const SaveCustomFormAdminUrl = '/custom-form/admin/set'; // 表单管理员
export const RelateCustomFormMemberUrl = '/custom-form/role/user/add'; // 添加表单成员
export const GetCustomFormRoleUsersUrl = '/custom-form/role/users'; // 获取角色用户列表
export const GetCustomFormRoleListUrl = '/custom-form/role/list'; // 获取表单角色tab
export const GetCustomFormRoleUserDeptTreeUrl = '/custom-form/role/user/dept/tree'; // 获取表单角色部门用户树
export const GetCustomFormRoleUserRoleTreeUrl = '/custom-form/role/user/role/tree'; // 获取表单角色树
export const RemoveCustomFormMemberUrl = '/custom-form/role/user/remove'; // 移除表单成员
export const GetCustomFormListUrl = '/custom-form/list'; // 获取表单模板列表
export const DeleteCustomFormUrl = '/custom-form/delete'; // 删除表单模板
export const EnableCustomFormUrl = '/custom-form/enable'; // 开启表单模板
export const DisableCustomFormUrl = '/custom-form/disable'; // 关闭表单模板
export const GetCustomFormOptionsUrl = '/custom-form/option'; // 自定义表单选项列表
// 表单数据
export const AddCustomFormDataUrl = '/custom-form/data/add'; // 添加自定义表单数据
export const GetCustomFormDataPageUrl = '/custom-form/data/page'; // 自定义表单数据列表
export const BatchUpdateCustomFormDataUrl = '/custom-form/data/batch/update'; // 批量更新自定义表单数据
export const BatchDeleteCustomFormDataUrl = '/custom-form/data/batch/delete'; // 批量删除自定义表单数据
export const UpdateCustomFormDataUrl = '/custom-form/data/update'; // 更新自定义表单数据
export const GetCustomFormDataDetailUrl = '/custom-form/data/get'; // 获取自定义表单数据详情
export const DeleteCustomFormDataUrl = '/custom-form/data/delete'; // 删除自定义表单数据
// 导入
export const PreCheckCustomFormImportUrl = '/custom-form/data/import/pre-check'; // 自定义表单预检查导入
export const DownloadCustomFormTemplateUrl = '/custom-form/data/template/download'; // 下载自定义表单模板
export const ImportCustomFormUrl = '/custom-form/data/import'; // 导入自定义表单
// 导出
export const CustomFormExportAllUrl = '/custom-form/data/export-all'; // 自定义表单导出全量
export const CustomFormExportSelectedUrl = '/custom-form/data/export-select'; // 自定义表单导出选中

View File

@@ -0,0 +1,137 @@
export const GetCustomerFormConfigUrl = '/account/module/form'; // 获取客户表单配置
export const UpdateCustomerUrl = '/account/update'; // 更新客户
export const GetCustomerListUrl = '/account/page'; // 分页查询客户
export const AddCustomerUrl = '/account/add'; // 添加客户
export const GetCustomerUrl = '/account/get'; // 获取客户详情
export const DeleteCustomerUrl = '/account/delete'; // 删除客户
export const BatchDeleteCustomerUrl = '/account/batch/delete'; // 批量删除客户
export const BatchTransferCustomerUrl = '/account/batch/transfer'; // 批量转移客户
export const BatchMoveCustomerUrl = '/account/batch/to-pool'; // 批量移入公海
export const MoveToCustomerUrl = '/account/to-pool'; // 移入公海
export const UpdateCustomerFollowRecordUrl = '/account/follow/record/update'; // 更新跟进记录
export const GetCustomerFollowRecordListUrl = '/account/follow/record/page'; // 获取跟进记录列表
export const AddCustomerFollowRecordUrl = '/account/follow/record/add'; // 添加跟进记录
export const DeleteCustomerFollowRecordUrl = '/account/follow/record/delete'; // 删除跟进记录
export const GetCustomerFollowRecordUrl = '/account/follow/record/get'; // 获取跟进记录详情
export const GetCustomerFollowRecordFormConfigUrl = '/follow/record/module/form'; // 获取跟进记录表单配置
export const UpdateCustomerFollowPlanUrl = '/account/follow/plan/update'; // 更新跟进计划
export const GetCustomerFollowPlanListUrl = '/account/follow/plan/page'; // 获取跟进计划列表
export const AddCustomerFollowPlanUrl = '/account/follow/plan/add'; // 添加跟进计划
export const DeleteCustomerFollowPlanUrl = '/account/follow/plan/delete'; // 删除跟进计划
export const GetCustomerFollowPlanFormConfigUrl = '/follow/plan/module/form'; // 获取跟进计划表单配置
export const GetCustomerFollowPlanUrl = '/account/follow/plan/get'; // 获取跟进记录详情
export const UpdateCustomerContactUrl = '/account/contact/update'; // 更新客户联系人
export const GetCustomerContactListUrl = '/account/contact/page'; // 获取客户联系人列表
export const DisableCustomerContactUrl = '/account/contact/disable'; // 禁用客户联系人
export const AddCustomerContactUrl = '/account/contact/add'; // 添加客户联系人
export const GetCustomerContactFormConfigUrl = '/account/contact/module/form'; // 获取客户联系人表单配置
export const GetCustomerContactUrl = '/account/contact/get'; // 获取客户联系人详情
export const EnableCustomerContactUrl = '/account/contact/enable'; // 启用客户联系人
export const DeleteCustomerContactUrl = '/account/contact/delete'; // 删除客户联系人
export const CheckOpportunityContactUrl = '/account/contact/opportunity/check'; // 是否绑定商机
export const ContactListUnderCustomerUrl = '/account/contact/list'; // 客户下的联系人列表
export const UpdateCustomerOpenSeaUrl = '/account-pool/update'; // 编辑公海
export const GetCustomerOpenSeaListUrl = '/account-pool/page'; // 公海列表
export const AddCustomerOpenSeaUrl = '/account-pool/add'; // 添加公海
export const SwitchCustomerOpenSeaUrl = '/account-pool/switch'; // 启用/禁用公海
export const IsCustomerOpenSeaNoPickUrl = '/account-pool/no-pick'; // 公海是否存在未领取线索
export const DeleteCustomerOpenSeaUrl = '/account-pool/delete'; // 删除公海
export const GetOpenSeaCustomerListUrl = '/pool/account/page'; // 公海客户列表
export const PickOpenSeaCustomerUrl = '/pool/account/pick'; // 领取公海客户
export const BatchPickOpenSeaCustomerUrl = '/pool/account/batch-pick'; // 批量领取公海客户
export const BatchDeleteOpenSeaCustomerUrl = '/pool/account/batch-delete'; // 批量删除公海客户
export const BatchAssignOpenSeaCustomerUrl = '/pool/account/batch-assign'; // 批量分配公海客户
export const AssignOpenSeaCustomerUrl = '/pool/account/assign'; // 分配公海客户
export const GetOpenSeaOptionsUrl = '/pool/account/options'; // 获取公海选项
export const DeleteOpenSeaCustomerUrl = '/pool/account/delete'; // 删除公海客户
export const GetOpenSeaCustomerUrl = '/pool/account/get'; // 获取公海客户详情
export const ExportOpenSeaCustomerAllUrl = '/pool/account/export-all'; // 导出所有公海客户
export const ExportOpenSeaCustomerSelectedUrl = '/pool/account/export-select'; // 导出选中公海客户
export const PoolAccountBatchUpdateUrl = '/pool/account/batch-update'; // 批量编辑公海列表
export const BatchUpdateAccountUrl = '/account/batch/update'; // 批量编辑客户列表
export const BatchUpdateContactUrl = '/account/contact/batch/update'; // 批量编辑联系人
export const MergeAccountUrl = '/account/merge'; // 合并客户
export const MergeAccountPageUrl = '/account/merge/page'; // 获取数据范围权限客户列表
export const GenerateCustomerChartUrl = '/account/chart'; // 生成客户图表
export const generateCustomerContactChartUrl = '/account/contact/chart'; // 生成客户联系人图表
export const CancelCustomerFollowPlanUrl = '/account/follow/plan/cancel'; // 取消客户跟进计划
export const GetCustomerHeaderListUrl = '/account/owner/history/list'; // 客户负责人记录列表
export const SaveCustomerRelationUrl = '/account/relation/save'; // 保存客户关系
export const GetCustomerRelationListUrl = '/account/relation/list'; // 获取客户关系列表
export const UpdateCustomerRelationItemUrl = '/account/relation/update'; // 更新单条客户关系
export const AddCustomerRelationItemUrl = '/account/relation/add'; // 添加单条客户关系
export const DeleteCustomerRelationItemUrl = '/account/relation/delete'; // 删除单条客户关系
export const UpdateCustomerCollaborationUrl = '/account/collaboration/update'; // 更新协作成员
export const BatchDeleteCustomerCollaborationUrl = '/account/collaboration/batch/delete'; // 批量删除协作成员
export const AddCustomerCollaborationUrl = '/account/collaboration/add'; // 添加协作成员
export const GetCustomerCollaborationListUrl = '/account/collaboration/list'; // 获取协作成员列表
export const DeleteCustomerCollaborationUrl = '/account/collaboration/delete'; // 删除协作成员
export const GetCustomerOptionsUrl = '/account/option'; // 获取客户选项列表
export const GetCustomerOpenSeaFollowRecordListUrl = '/account/follow/record/pool/page'; // 获取客户公海池跟进记录列表
export const GetCustomerTabUrl = '/account/tab'; // 客户tab显隐
export const GetCustomerContactTabUrl = '/account/contact/tab'; // 客户联系人tab显隐
export const UpdateCustomerFollowPlanStatusUrl = '/account/follow/plan/status/update'; // 更新客户跟进计划状态
export const GetCustomerOpportunityListUrl = '/account/opportunity/page'; // 客户商机列表
export const ExportCustomerAllUrl = '/account/export-all'; // 导出所有客户
export const ExportCustomerSelectedUrl = '/account/export-select'; // 导出选中客户
export const GetAdvancedCustomerListUrl = '/advanced/search/account'; // 全局搜索分页查询客户
export const GetAdvancedOpenSeaCustomerListUrl = '/advanced/search/account-pool'; // 全局搜索公海客户列表
export const GetAdvancedCustomerContactListUrl = '/advanced/search/contact'; // 全局搜索获取客户联系人列表
export const GetGlobalCustomerListUrl = '/global/search/account';
export const GetGlobalOpenSeaCustomerListUrl = '/global/search/customer_pool';
export const GetGlobalCustomerContactListUrl = '/global/search/contact';
export const GetGlobalModuleCountUrl = '/global/search/module/count'; // 数量统计
export const ExportContactAllUrl = '/account/contact/export-all'; // 导出所有联系人
export const ExportContactSelectedUrl = '/account/contact/export-select'; // 导出选中联系人
export const GetAccountContractListUrl = '/account/contract/page'; // 客户详情-合同列表
export const GetAccountContractStatisticUrl = '/account/contract/statistic'; // 客户详情-合同列表统计
export const GetAccountPaymentListUrl = '/account/contract/payment-plan/page'; // 客户详情-回款列表
export const GetAccountPaymentStatisticUrl = '/account/contract/payment-plan/statistic'; // 客户详情-回款列表统计
export const GetAccountPaymentRecordListUrl = '/account/contract/payment-record/page'; // 客户详情-回款列表
export const GetAccountPaymentRecordStatisticUrl = '/account/contract/payment-record/statistic'; // 客户详情-回款列表统计
export const GetAccountInvoiceListUrl = '/account/invoice/page'; // 客户详情-发票列表
export const GetAccountInvoiceStatisticUrl = '/account/invoice/statistic'; // 客户详情-发票列表统计
export const GetAccountOrderListUrl = '/account/order/page'; // 客户详情-订单列表
// 视图
export const GetCustomerViewDetailUrl = '/account/view/detail';
export const GetCustomerViewListUrl = '/account/view/list';
export const AddCustomerViewUrl = '/account/view/add';
export const UpdateCustomerViewUrl = '/account/view/update';
export const DeleteCustomerViewUrl = '/account/view/delete';
export const FixedCustomerViewUrl = '/account/view/fixed';
export const EnableCustomerViewUrl = '/account/view/enable';
export const DragCustomerViewUrl = '/account/view/edit/pos';
export const GetContactViewDetailUrl = '/account/contact/view/detail';
export const GetContactViewListUrl = '/account/contact/view/list';
export const AddContactViewUrl = '/account/contact/view/add';
export const UpdateContactViewUrl = '/account/contact/view/update';
export const DeleteContactViewUrl = '/account/contact/view/delete';
export const FixedContactViewUrl = '/account/contact/view/fixed';
export const EnableContactViewUrl = '/account/contact/view/enable';
export const DragContactViewUrl = '/account/contact/view/edit/pos';
// 客户导入
export const PreCheckAccountImportUrl = '/account/import/pre-check';
export const DownloadAccountTemplateUrl = '/account/template/download';
export const ImportAccountUrl = '/account/import';
// 联系人导入
export const PreCheckContactImportUrl = '/account/contact/import/pre-check';
export const DownloadContactTemplateUrl = '/account/contact/template/download';
export const ImportContactUrl = '/account/contact/import';
// 公海视图
export const GetAccountPoolViewDetailUrl = 'pool/account/view/detail';
export const GetAccountPoolViewListUrl = 'pool/account/view/list';
export const AddAccountPoolViewUrl = 'pool/account/view/add';
export const UpdateAccountPoolViewUrl = 'pool/account/view/update';
export const DeleteAccountPoolViewUrl = 'pool/account/view/delete';
export const FixedAccountPoolViewUrl = 'pool/account/view/fixed';
export const EnableAccountPoolViewUrl = 'pool/account/view/enable';
export const DragAccountPoolViewUrl = 'pool/account/view/edit/pos';
export const generateCustomerPoolChartUrl = '/pool/account/chart';

View File

@@ -0,0 +1,16 @@
export const dashboardModuleRenameUrl = '/dashboard/module/rename'; // 模块重命名
export const dashboardModuleDeleteUrl = '/dashboard/module/delete'; // 模块删除
export const dashboardModuleAddUrl = '/dashboard/module/add'; // 模块添加
export const dashboardUpdateUrl = '/dashboard/update'; // 仪表板更新
export const dashboardRenameUrl = '/dashboard/rename'; // 仪表板重命名
export const dashboardAddUrl = '/dashboard/add'; // 仪表板添加
export const dashboardDetailUrl = '/dashboard/detail'; // 仪表板详情
export const dashboardDeleteUrl = '/dashboard/delete'; // 仪表板删除
export const dashboardPageUrl = '/dashboard/page'; // 仪表板列表
export const dashboardCollectPageUrl = '/dashboard/collect/page'; // 仪表板收藏列表
export const dashboardModuleTreeUrl = '/dashboard/module/tree'; // 模块树
export const dashboardCollectUrl = '/dashboard/collect'; // 仪表板收藏
export const dashboardUnCollectUrl = '/dashboard/un-collect'; // 仪表板取消收藏
export const dashboardModuleCountUrl = '/dashboard/module/count'; // 仪表板模块数量
export const dashboardDragUrl = '/dashboard/edit/pos'; // 仪表板拖拽
export const dashboardModuleDragUrl = '/dashboard/module/move'; // 仪表板模块拖拽

View File

@@ -0,0 +1,35 @@
// 跟进记录
export const GetFollowRecordPageUrl = '/follow/record/page'; // 跟进记录列表
export const GetFollowRecordTabUrl = '/follow/record/tab'; // 数据权限TAB
export const DeleteFollowRecordUrl = '/follow/record/delete'; // 删除跟进记录
export const GetFollowRecordUrl = '/follow/record/get'; // 跟进记录详情
export const UpdateFollowRecordUrl = '/follow/record/update';
export const AddFollowRecordUrl = '/follow/record/add';
// 跟进计划
export const UpdateFollowPlanStatusUrl = '/follow/plan/status/update'; // 更新跟进计划状态
export const GetFollowPlanPageUrl = '/follow/plan/page'; // 跟进计划列表
export const GetFollowPlanTabUrl = '/follow/plan/tab'; // 数据权限TAB
export const DeleteFollowPlanUrl = '/follow/plan/delete'; // 删除跟进计划
export const GetFollowPlanUrl = '/follow/plan/get'; // 跟进计划详情
export const UpdateFollowPlanUrl = '/follow/plan/update';
export const AddFollowPlanUrl = '/follow/plan/add';
// 视图
export const AddFollowRecordViewUrl = '/follow/record/view/add';
export const UpdateFollowRecordViewUrl = '/follow/record/view/update';
export const GetFollowRecordViewListUrl = '/follow/record/view/list';
export const GetFollowRecordViewDetailUrl = '/follow/record/view/detail';
export const FixedFollowRecordViewUrl = '/follow/record/view/fixed';
export const EnableFollowRecordViewUrl = '/follow/record/view/enable';
export const DeleteFollowRecordViewUrl = '/follow/record/view/delete';
export const DragFollowRecordViewUrl = '/follow/record/view/edit/pos';
export const AddFollowPlanViewUrl = '/follow/plan/view/add';
export const UpdateFollowPlanViewUrl = '/follow/plan/view/update';
export const GetFollowPlanViewListUrl = '/follow/plan/view/list';
export const GetFollowPlanViewDetailUrl = '/follow/plan/view/detail';
export const FixedFollowPlanViewUrl = '/follow/plan/view/fixed';
export const EnableFollowPlanViewUrl = '/follow/plan/view/enable';
export const DeleteFollowPlanViewUrl = '/follow/plan/view/delete';
export const DragFollowPlanViewUrl = '/follow/plan/view/edit/pos';

View File

@@ -0,0 +1,5 @@
export const HomeDepartmentTree = '/home/statistic/department/tree'; // 用户部门权限树
export const HomeFollowOpportunity = '/home/statistic/opportunity'; // 跟进商机统计
export const HomeSuccessOpportunity = '/home/statistic/opportunity/success'; // 商机赢单统计
export const HomeLeadStatistic = '/home/statistic/lead'; // 线索统计
export const HomeOpportunityUnderwayUrl = '/home/statistic/opportunity/underway'; // 商机进行中阶段统计

View File

@@ -0,0 +1,82 @@
export const OptPageUrl = '/opportunity/page'; // 商机列表
export const OptAddUrl = '/opportunity/add'; // 添加商机
export const OptUpdateUrl = '/opportunity/update'; // 更新商机
export const GetOptFormConfigUrl = '/opportunity/module/form'; // 商机表单配置
export const OptFollowRecordListUrl = '/opportunity/follow/record/page'; // 商机跟进记录列表
export const OptFollowPlanPageUrl = '/opportunity/follow/plan/page'; // 商机跟进计划列表
export const UpdateOptFollowRecordUrl = '/opportunity/follow/record/update'; // 更新商机跟进记录
export const AddOptFollowRecordUrl = '/opportunity/follow/record/add'; // 添加商机跟进记录
export const UpdateOptFollowPlanUrl = '/opportunity/follow/plan/update'; // 更新商机跟进计划
export const AddOptFollowPlanUrl = '/opportunity/follow/plan/add'; // 添加商机跟进计划
export const GetOptFollowRecordUrl = '/opportunity/follow/record/get'; // 商机跟进记录详情
export const GetOptFollowPlanUrl = '/opportunity/follow/plan/get'; // 商机跟进计划详情
export const CancelOptFollowPlanUrl = '/opportunity/follow/plan/cancel'; // 取消商机跟进计划
export const OptBatchTransferUrl = '/opportunity/batch/transfer'; // 批量转移商机
export const OptBatchDeleteUrl = '/opportunity/batch/delete'; // 批量删除商机
export const OptDeleteUrl = '/opportunity/delete'; // 删除商机
export const OptUpdateStageUrl = '/opportunity/update/stage'; // 更新商机阶段
export const GetOptDetailUrl = '/opportunity/get'; // 获取商机详情
export const DeleteOptFollowRecordUrl = '/opportunity/follow/record/delete'; // 删除商机跟进记录
export const DeleteOptFollowPlanUrl = '/opportunity/follow/plan/delete'; // 删除商机跟进计划
export const GetOptTabUrl = '/opportunity/tab'; // 商机tab显隐
export const GetOpportunityContactListUrl = 'opportunity/contact/list'; // 商机详情联系人列表
export const UpdateOptFollowPlanStatusUrl = '/opportunity/follow/plan/status/update'; // 更新商机跟进计划状态
export const ExportOpportunityAllUrl = '/opportunity/export-all'; // 商机导出
export const ExportOpportunitySelectedUrl = '/opportunity/export-select'; // 商机导出选中
export const GetOptStatisticUrl = '/opportunity/statistic'; // 商机列表的金额数据
export const AdvancedSearchOptPageUrl = '/advanced/search/opportunity'; // 全局高级搜索商机列表
export const AdvancedSearchOptDetailUrl = '/advanced/search/opportunity/detail'; // 全局搜索商机详情
export const GlobalSearchOptPageUrl = '/global/search/opportunity'; // 全局搜索商机列表
export const BatchUpdateOpportunityUrl = '/opportunity/batch/update'; // 批量更新商机
export const SortOpportunityUrl = '/opportunity/sort'; // 商机看板拖拽排序
export const UpdateOpportunityStageUrl = '/opportunity/stage/update'; // 更新商机阶段配置
export const UpdateOpportunityStageRollbackUrl = '/opportunity/stage/update-rollback'; // 商机阶段回退配置
export const SortOpportunityStageUrl = '/opportunity/stage/sort'; // 商机阶段排序
export const AddOpportunityStageUrl = '/opportunity/stage/add'; // 商机阶段添加
export const GetOpportunityStageConfigUrl = '/opportunity/stage/get'; // 获取商机阶段配置
export const DeleteOpportunityStageUrl = '/opportunity/stage/delete'; // 删除商机阶段
export const GenerateOpportunityChartUrl = '/opportunity/chart'; // 生成商机视图
export const GetQuotationTabUrl = '/opportunity/quotation/tab'; // 报价tab显隐
// 商机视图
export const GetBusinessViewDetailUrl = '/opportunity/view/detail';
export const GetBusinessViewListUrl = '/opportunity/view/list';
export const AddBusinessViewUrl = '/opportunity/view/add';
export const UpdateBusinessViewUrl = '/opportunity/view/update';
export const DeleteBusinessViewUrl = '/opportunity/view/delete';
export const FixedBusinessViewUrl = '/opportunity/view/fixed';
export const EnableBusinessViewUrl = '/opportunity/view/enable';
export const DragBusinessViewUrl = '/opportunity/view/edit/pos';
// 报价单视图
export const GetQuotationViewDetailUrl = '/opportunity/quotation/view/detail';
export const GetQuotationViewListUrl = '/opportunity/quotation/view/list';
export const AddQuotationViewUrl = '/opportunity/quotation/view/add';
export const UpdateQuotationViewUrl = '/opportunity/quotation/view/update';
export const DeleteQuotationViewUrl = '/opportunity/quotation/view/delete';
export const FixedQuotationViewUrl = '/opportunity/quotation/view/fixed';
export const EnableQuotationViewUrl = '/opportunity/quotation/view/enable';
export const DragQuotationViewUrl = '/opportunity/quotation/view/edit/pos';
// 报价单
export const QuotationPageUrl = '/opportunity/quotation/page';
export const AddQuotationUrl = '/opportunity/quotation/add';
export const UpdateQuotationUrl = '/opportunity/quotation/update';
export const GetQuotationFormConfigUrl = '/opportunity/quotation/module/form';
export const GetQuotationDetailUrl = '/opportunity/quotation/get';
export const GetQuotationSnapshotDetailUrl = '/opportunity/quotation/get/snapshot';
export const ApprovalQuotationUrl = '/opportunity/quotation/approve';
export const VoidQuotationUrl = '/opportunity/quotation/voided';
export const DeleteQuotationUrl = '/opportunity/quotation/delete';
export const RevokeQuotationUrl = '/opportunity/quotation/revoke';
export const BatchApproveUrl = '/opportunity/quotation/batch/approve';
export const BatchVoidedUrl = '/opportunity/quotation/batch/voided';
export const BatchUpdateQuotationUrl = '/opportunity/quotation/batch/update';
export const GetQuotationSnapshotFormConfigUrl = '/opportunity/quotation/module/form/snapshot';
export const DownloadQuotationUrl = '/opportunity/quotation/download';
// 导入
export const PreCheckOptImportUrl = '/opportunity/import/pre-check';
export const DownloadOptTemplateUrl = '/opportunity/template/download';
export const ImportOpportunityUrl = '/opportunity/import';

View File

@@ -0,0 +1,35 @@
export const AddOrderUrl = '/order/add';
export const UpdateOrderUrl = '/order/update';
export const BatchUpdateOrderUrl = '/order/batch/update';
export const UpdateOrderStageUrl = '/order/update/stage';
export const DeleteOrderUrl = '/order/delete';
export const GetOrderDetailUrl = '/order/get';
export const OrderPageUrl = '/order/page';
export const OrderDetailSnapshotUrl = '/order/get/snapshot';
export const OrderFormConfigUrl = '/order/module/form';
export const OrderFormConfigSnapshotUrl = '/order/module/form/snapshot';
export const GetOrderTabUrl = '/order/tab';
export const OrderInContractPageUrl = '/contract/order/page';
export const DownloadOrderUrl = '/order/download';
export const OrderStatisticUrl = '/order/statistic';
export const SortOrderUrl = '/order/sort';
// 订单视图
export const AddOrderViewUrl = '/order/view/add';
export const UpdateOrderViewUrl = '/order/view/update';
export const DeleteOrderViewUrl = '/order/view/delete';
export const GetOrderViewListUrl = '/order/view/list';
export const GetOrderViewDetailUrl = '/order/view/detail';
export const FixedOrderViewUrl = '/order/view/fixed';
export const EnableOrderViewUrl = '/order/view/enable';
export const DragOrderViewUrl = '/order/view/edit/pos';
// 订单状态
export const UpdateOrderStatusUrl = '/order/stage/update'; // 更新订单状态配置
export const UpdateOrderStatusRollbackUrl = '/order/stage/update-rollback'; // 订单状态回退配置
export const SortOrderStatusUrl = '/order/stage/sort'; // 订单状态排序
export const AddOrderStatusUrl = '/order/stage/add'; // 订单状态添加
export const GetOrderStatusConfigUrl = '/order/stage/get'; // 获取订单状态配置
export const DeleteOrderStatusUrl = '/order/stage/delete'; // 删除订单状态
export const SwitchOrderCirculationTypeUrl = '/order/stage/circulation-type'; // 切换流转配置
export const SaveAdvanceConfigUrl = '/order/stage/advanced/config'; // 保存高级流转配置

View File

@@ -0,0 +1,29 @@
export const GetProductFormConfigUrl = '/product/module/form'; // 获取产品表单配置
export const UpdateProductUrl = '/product/update'; // 更新产品
export const GetProductListUrl = '/product/page'; // 产品列表
export const AddProductUrl = '/product/add'; // 添加产品
export const GetProductUrl = '/product/get'; // 获取产品详情
export const DeleteProductUrl = '/product/delete'; // 删除产品
export const BatchDeleteProductUrl = '/product/batch/delete'; // 批量删除产品
export const BatchUpdateProductUrl = '/product/batch/update'; // 批量更新产品
export const DragSortProductUrl = '/product/edit/pos'; // 排序拖拽产品
export const GetProductOptionsUrl = '/product/list/option'; // 获取当前组织下所有的产品
// 导入
export const PreCheckProductImportUrl = '/product/import/pre-check';
export const DownloadProductTemplateUrl = '/product/template/download';
export const ImportProductUrl = '/product/import';
export const UpdateProductPriceUrl = '/price/update'; // 更新价格表
export const BatchUpdateProductPriceUrl = '/price/batch/update'; // 批量更新价格表
export const GetProductPriceListUrl = '/price/page'; // 价格表列表
export const AddProductPriceUrl = '/price/add'; // 添加价格表
export const GetProductPriceFormConfigUrl = '/price/module/form'; // 获取价格表单配置
export const GetProductPriceUrl = '/price/get'; // 获取价格表详情
export const DeleteProductPriceUrl = '/price/delete'; // 删除价格表
export const DragSortProductPriceUrl = '/price/edit/pos'; // 排序拖拽价格表
export const DownloadProductPriceTemplateUrl = '/price/template/download'; // 下载价格表模板
export const ExportProductPriceUrl = '/price/export-select'; // 导出选择的价格表
export const ExportAllProductPriceUrl = '/price/export'; // 导出所有的价格表
export const ImportProductPriceUrl = '/price/import'; // 导入价格表
export const PreCheckImportProductPriceUrl = '/price/import/pre-check'; // 导入价格表预检查
export const CopyProductPriceUrl = '/price/copy'; // 复制价格表

View File

@@ -0,0 +1,7 @@
export const VersionUrl = '/system/version'; // 获取版本信息
export const LocaleChangeUrl = '/locale-language/change'; // 切换语言
export default {
VersionUrl,
LocaleChangeUrl,
};

View File

@@ -0,0 +1,2 @@
export const GetLicenseUrl = '/license/validate';
export const AddLicenseUrl = '/license/add';

View File

@@ -0,0 +1,50 @@
export const GetConfigEmailUrl = '/organization/settings/email'; // 获取邮件设置
export const UpdateConfigEmailUrl = '/organization/settings/email/edit'; // 更新邮件设置
export const TestConfigEmailUrl = '/organization/settings/email/test'; // 邮件设置-测试连接
export const GetConfigSynchronizationUrl = '/organization/settings/third-party'; // 获取三方设置
export const UpdateConfigSynchronizationUrl = '/organization/settings/third-party/edit'; // 更新三方设置
export const TestConfigSynchronizationUrl = '/organization/settings/third-party/test'; // 三方设置-测试连接
export const GetThirdTypeListUrl = '/organization/settings/third-party/types'; // 获取三方应用扫码类型集合
export const GetDETokenUrl = '/organization/settings/de-token'; // 获取DEToken
export const SyncDEUrl = '/organization/settings/de/sync'; // 同步 DE 配置
export const GetDEOrgListUrl = '/organization/settings/de/org/list'; // 获取 DE 组织列表
export const GetThirdPartyConfigUrl = '/organization/settings/third-party/get'; // 获取第三方配置
export const SwitchThirdPartyUrl = '/organization/settings/switch-third-party'; // 切换三方平台
export const GetThirdPartyResourceUrl = '/organization/settings/third-party/sync/resource'; // 获取最新的三方同步来源
export const GetAuthsUrl = '/system/auth-sources/list'; // 认证设置-列表查询
export const GetAuthDetailUrl = '/system/auth-sources/get'; // 认证设置-详情
export const UpdateAuthUrl = '/system/auth-sources/update'; // 认证设置-更新
export const CreateAuthUrl = '/system/auth-sources/add'; // 认证设置-新增
export const UpdateAuthStatusUrl = '/system/auth-sources/update/status'; // 认证设置-更新状态
export const UpdateAuthNameUrl = '/system/auth-sources/update/name'; // 认证设置-更新名称
export const DeleteAuthUrl = '/system/auth-sources/delete'; // 认证设置-删除
export const GetTenderConfigUrl = '/tender/application/config'; // 招投标-获取配置项
// 个人中心
export const GetPersonalUrl = '/personal/center/info';
export const UpdatePersonalUrl = '/personal/center/update';
export const SendEmailCodeUrl = '/personal/center/mail/code/send';
export const UpdateUserPasswordUrl = '/personal/center/info/reset';
export const GetPersonalFollowUrl = '/personal/center/follow/plan/list'; // 用户跟进计划列表
// 个人中心导出
export const GetExportCenterListUrl = '/export/center/list'; // 查询导出任务列表
export const ExportCenterDownloadUrl = '/export/center/download'; // 下载
export const CancelCenterExportUrl = '/export/center/cancel'; // 取消导出
// 个人中心ApiKey
export const UpdateApiKeyUrl = '/user/api/key/update'; // 更新 ApiKey
export const GetApiKeyListUrl = '/user/api/key/list'; // 获取 ApiKey 列表
export const EnableApiKeyUrl = '/user/api/key/enable'; // 开启 ApiKey
export const DisableApiKeyUrl = '/user/api/key/disable'; // 关闭 ApiKey
export const DeleteApiKeyUrl = '/user/api/key/delete'; // 删除 ApiKey
export const AddApiKeyUrl = '/user/api/key/add'; // 新增 ApiKey
// 界面设置
export const SavePageConfigUrl = '/ui/display/save'; // 保存界面配置
export const GetPageConfigUrl = '/ui/display/info'; // 获取界面配置
export const GetPageConfigImagePreviewUrl = '/ui/display/preview'; // 图片预览
export const GetTitleImgUrl = `${
import.meta.env.VITE_API_BASE_URL
}${GetPageConfigImagePreviewUrl}?paramKey=ui.logoPlatform`;

View File

@@ -0,0 +1,3 @@
export const LoginLogListUrl = '/login/log/list'; // 登录日志
export const OperationLogListUrl = '/operation/log/list'; // 操作日志
export const GetOperationLogDetailUrl = '/operation/log/detail'; // 操作日志-详情

View File

@@ -0,0 +1,6 @@
export const loginUrl = '/login'; // 登录
export const signoutUrl = '/logout'; // 登出
export const isLoginUrl = '/is-login'; // 是否登录
export const getKeyUrl = '/get-key'; // 获取登录密钥
export const thirdCallbackUrl = '/sso/callback'; // 企业微信二维码登录
export const thirdOauthCallbackUrl = '/sso/callback/oauth'; // 企业微信Oauth2登录

View File

@@ -0,0 +1,22 @@
// 公告
export const GetAnnouncementListUrl = '/announcement/page'; // 公告列表分页查询
export const UpdateAnnouncementUrl = '/announcement/edit'; // 编辑公告
export const AddAnnouncementUrl = '/announcement/add'; // 新建公告
export const GetAnnouncementDetailUrl = '/announcement/get'; // 获取公告详情
export const DeleteAnnouncementUrl = '/announcement/delete'; // 删除公告
// 消息中心
export const GetNotificationListUrl = '/notification/list/all/page'; // 消息中心列表
export const GetNotificationCountUrl = '/notification/count'; // 具体类型具体状态的数量
export const SetNotificationReadUrl = '/notification/read'; // 设置消息已读
export const SetAllNotificationReadUrl = '/notification/read/all'; // 所有信息设置为已读消息
// 消息设置
export const GetMessageTaskUrl = '/message/task/get'; // 获取消息设置
export const SaveMessageTaskUrl = '/message/task/save'; // 保存消息设置
export const BatchSaveMessageTaskUrl = '/message/task/batch/save'; // 消息设置批量编辑
export const SubscribeMessageUrl = '/sse/subscribe'; // 客户端订阅 SSE 事件流
export const CloseMessageUrl = '/sse/close'; // 客户端关闭 SSE 事件流
export const GetHomeMessageUrl = '/notification/last/list'; // 获取首页消息列表
export const GetUnReadAnnouncement = '/notification/last/announcement/list'; // 获取用户未读公告列表
export const getMessageTaskConfigDetailUrl = '/message/task/config/query'; // 获取消息任务配置详情

View File

@@ -0,0 +1,99 @@
// 模块首页
export const getModuleNavConfigListUrl = '/module/list'; // 模块-首页-获取模块设置列表
export const moduleNavListSortUrl = '/module/sort'; // 模块-首页-模块排序
export const toggleModuleNavStatusUrl = '/module/switch'; // 模块-首页-单个模块开启或关闭
export const ModuleUserDeptTreeUrl = '/module/user/dept/tree'; // 模块-获取部门用户树
export const ModuleRoleTreeUrl = '/module/role/tree'; // 模块-获取角色树
export const GetAdvancedSwitchUrl = '/module/advanced-search/settings'; // 高级筛选开关
export const SetDisplayAdvancedUrl = '/module/advanced-search/switch'; // 设置高级筛选开关
// 模块--商机
export const getOpportunityListUrl = '/opportunity-rule/page'; // 模块-商机-商机规则列表
export const addOpportunityRuleUrl = '/opportunity-rule/add'; // 模块-商机-添加商机规则
export const updateOpportunityRuleUrl = '/opportunity-rule/update'; // 模块-商机-更新商机规则
export const switchOpportunityStatusUrl = '/opportunity-rule/switch'; // 模块-商机-更新商机规则状态
export const deleteOpportunityUrl = '/opportunity-rule/delete'; // 模块-商机-删除商机规则
// 模块-线索池
export const GetCluePoolPageUrl = '/lead-pool/page'; // 分页获取线索池
export const AddCluePoolUrl = '/lead-pool/add'; // 新增线索池
export const UpdateCluePoolUrl = '/lead-pool/update'; // 编辑线索池
export const QuickUpdateCluePoolUrl = '/lead-pool/quick-update'; // 快捷编辑线索池
export const SwitchCluePoolStatusUrl = '/lead-pool/switch'; // 启用/禁用线索池
export const DeleteCluePoolUrl = '/lead-pool/delete'; // 删除线索池
export const NoPickCluePoolUrl = '/lead-pool/no-pick'; // 未领取线索
// 模块-线索库容
export const GetClueCapacityPageUrl = '/lead-capacity/get'; // 获取线索库容规则
export const AddClueCapacityUrl = '/lead-capacity/add'; // 添加线索库容规则
export const UpdateClueCapacityUrl = '/lead-capacity/update'; // 更新线索库容规则
export const DeleteClueCapacityUrl = '/lead-capacity/delete'; // 删除线索库容规则
// 模块-客户库容
export const GetCustomerCapacityPageUrl = '/account-capacity/get'; // 获取客户库容
export const AddCustomerCapacityUrl = '/account-capacity/add'; // 添加客户库容规则
export const UpdateCustomerCapacityUrl = '/account-capacity/update'; // 更新客户库容规则
export const DeleteCustomerCapacityUrl = '/account-capacity/delete'; // 删除客户库容规则
// 模块-公海池
export const GetCustomerPoolPageUrl = '/account-pool/page'; // 分页获取公海池
export const AddCustomerPoolUrl = '/account-pool/add'; // 新增公海池
export const UpdateCustomerPoolUrl = '/account-pool/update'; // 编辑公海池
export const QuickUpdateCustomerPoolUrl = '/account-pool/quick-update'; // 快捷编辑公海池
export const SwitchCustomerPoolStatusUrl = '/account-pool/switch'; // 启用/禁用公海池
export const DeleteCustomerPoolUrl = '/account-pool/delete'; // 删除公海池
export const NoPickCustomerPoolUrl = '/account-pool/no-pick'; // 未领取线索
// 模块-表单设计
export const GetFormDesignConfigUrl = '/module/form/config'; // 获取表单设计配置
export const SaveFormDesignConfigUrl = '/module/form/save'; // 保存表单设计配置
export const GetFieldDeptUerTreeUrl = '/field/user/dept/tree'; // 获取部门成员树
export const GetFieldDeptTreeUrl = '/field/dept/tree'; // 获取部门树
export const GetFieldProductListUrl = '/field/source/product'; // 获取产品列表
export const GetFieldOpportunityListUrl = '/field/source/opportunity'; // 获取商机列表
export const GetFieldCustomerListUrl = '/field/source/account'; // 获取客户列表
export const GetFieldContactListUrl = '/field/source/contact'; // 获取联系人列表
export const GetFieldClueListUrl = '/field/source/lead'; // 获取线索列表
export const GetFieldContractListUrl = '/field/source/contract'; // 获取合同列表
export const GetFieldInvoiceListUrl = '/field/source/invoice'; // 获取发票列表
export const GetFieldContractPaymentPlanListUrl = '/field/source/contract/payment-plan'; // 获取回款计划列表
export const GetFieldContractPaymentRecordListUrl = '/field/source/contract/payment-record'; // 获取回款记录列表
export const GetFieldCustomFormListUrl = '/field/source/custom-form-data'; // 自定义表单数据源列表
export const CheckRepeatUrl = '/field/check/repeat'; // 查重
export const GetFieldPriceListUrl = '/field/source/price'; // 获取价格列表
export const GetFieldQuotationListUrl = '/field/source/quotation'; // 获取报价单列表
export const GetFieldOrderListUrl = '/field/source/order'; // 获取订单列表
export const GetFieldDisplayListUrl = '/field/display';
export const GetFieldBusinessTitleListUrl = '/field/source/business-title';
export const GetFieldRefDetailListUrl = '/field/source/ref-detail'; // 批量获取数据源字段详情
export const GetFieldConfigUrl = '/field/source/config'; // 获取数据源表单配置
export const UploadTempFileUrl = '/pic/upload/temp'; // 上传临时图片
export const PreviewPictureUrl = '/pic/preview'; // 预览图片
export const DownloadPictureUrl = '/pic/download'; // 下载图片
export const UploadTempAttachmentUrl = '/attachment/upload/temp'; // 上传临时附件
export const PreviewAttachmentUrl = '/attachment/preview'; // 预览附件
export const DownloadAttachmentUrl = '/attachment/download'; // 下载附件
export const DeleteAttachmentUrl = '/attachment/delete'; // 删除附件
// 模块配置-字典管理-原因配置
export const GetReasonUrl = '/dict/get'; // 获取原因
export const AddReasonUrl = '/dict/add'; // 添加原因
export const UpdateReasonUrl = '/dict/update'; // 更新原因
export const DeleteReasonUrl = '/dict/delete'; // 删除原因
export const GetReasonConfigUrl = '/dict/config'; // 获取原因配置
export const UpdateReasonEnableUrl = '/dict/switch'; // 更新原因开关
export const SortReasonUrl = '/dict/sort'; // 原因排序
export const SearchConfigUrl = '/search/config/save'; // 搜索设置添加配置
export const GetSearchConfigUrl = '/search/config/get'; // 获取搜索字段配置
export const ResetSearchConfigUrl = '/search/config/reset'; // 重置搜索字段配置
// 搜索模糊设置
export const ModuleMaskSearchConfigUrl = '/mask/config/save'; // 搜索设置脱敏设置
export const GetModuleMaskSearchConfigUrl = '/mask/config/get'; // 获取搜索脱敏设置
// 系统导航栏
export const GetModuleTopNavListUrl = '/navigation/list'; // 获取顶导配置
export const SetModuleTopNavSortUrl = '/navigation/sort'; // 顶导排序

View File

@@ -0,0 +1,29 @@
// 部门
export const setCommanderUrl = '/department/set-commander'; // 组织架构-设置部门负责人
export const renameDepartmentUrl = '/department/rename'; // 组织架构-组织架构-重命名子部门
export const addDepartmentUrl = '/department/add'; // 组织架构-添加子部门
export const getDepartmentTreeUrl = '/department/tree'; // 组织架构-部门树查询
export const deleteDepartmentUrl = '/department/delete'; // 组织架构-删除部门
export const checkDeleteDepartmentUrl = '/department/delete/check'; // 组织架构-删除部门校验
export const sortDepartmentUrl = '/department/sort'; // 组织架构-部门排序
// 员工
export const addUserUrl = '/user/add'; // 用户(员工)-添加员工
export const updateUserUrl = '/user/update'; // 用户(员工)-更新员工
export const getUserListUrl = '/user/list'; // 用户(员工)-列表查询
export const batchResetPasswordUrl = '/user/batch/reset-password'; // 用户(员工)-批量重置密码
export const batchEnableUserUrl = '/user/batch-enable'; // 用户(员工)-批量启用/禁用
export const syncOrgUrl = '/user/sync'; // 用户(员工)-同步组织架构
export const resetUserPasswordUrl = '/user/reset-password'; // 用户(员工)-重置密码
export const getUserDetailUrl = '/user/detail'; // 用户(员工)-员工详情
export const batchEditUserUrl = '/user/batch/edit'; // 用户(员工)-批量编辑
export const importUserPreCheckUrl = '/user/import/pre-check'; // 用户(员工)-excel导入检查
export const getUserOptionsUrl = '/user/option'; // 获取用户下拉
export const getAdminOptionsUrl = '/user/admin/option'; // 获取审批管理员下拉
export const getRoleOptionsUrl = '/user/role/option'; // 获取角色下拉
export const importUserUrl = '/user/import'; // 用户(员工)-excel导入
export const deleteUserUrl = '/user/delete'; // 用户(员工)-删除
export const deleteUserCheckUrl = '/user/delete/check'; // 用户(员工)-删除校验
export const checkSyncUserFromThirdUrl = '/user/sync-check'; // 用户(员工)-是否为第三方同步数据
export const updateUserNameUrl = '/user/update/name'; // 用户(员工)-更新用户名称
export const getOrgDepartmentUserUrl = '/user/get'; // 用户(员工)-更新用户名称
export const CheckSyncUrl = '/user/sync/check'; // 检查异步是否完成接口

View File

@@ -0,0 +1,33 @@
export const ApprovalPermissionsUrl = '/approval-flow/status-permission/setting'; // 审批流数据权限
export const GetApprovalConfigDetailUrl = '/approval-flow/get-by-form-type'; // 审批流配置详情 用于列表控制操作判断
export const ApprovalProcessPageUrl = '/approval-flow/page'; // 审批流列表
export const AddApprovalProcessUrl = '/approval-flow/add'; // 新增审批流
export const UpdateApprovalProcessUrl = '/approval-flow/update'; // 修改审批流
export const DeleteApprovalProcessUrl = '/approval-flow/delete'; // 删除审批流
export const ApprovalProcessDetailUrl = '/approval-flow/get'; // 审批流详情
export const ToggleApprovalProcessUrl = '/approval-flow/enable'; // 启用|禁用审批流
export const GetResourceApprovingDetailUrl = '/approval-resource/simple-detail'; // 资源审批状态详情
export const ReviewResourceUrl = '/approval-resource/push'; // 提审
export const RevokeResourceUrl = '/approval-resource/revoke'; // 撤销
// 审批流webHook连接测试
export const TestApprovalWebHookUrl = '/approval-flow/webhook/test ';
// 审批待办
export const GetProcessedApprovalTodosUrl = '/approval-todo/processed/page'; // 已处理审批待办列表
export const GetPendingApprovalTodosUrl = '/approval-todo/pending/page'; // 待处理审批待办列表
export const GetInitiatedApprovalTodosUrl = '/approval-todo/initiated/page'; // 我发起审批待办列表
export const GetCcApprovalTodosUrl = '/approval-todo/cc/page'; // 抄送我的审批待办列表
export const GetTodoStatisticUrl = '/approval-todo/pending/count'; // 获取待办统计
// 审批
export const RejectApprovalUrl = '/approval-action/reject'; // 驳回
export const BackApprovalUrl = '/approval-action/back'; // 回退
export const AddSignApprovalUrl = '/approval-action/sign'; // 加签
export const RevokeApprovalUrl = '/approval-action/revoke'; // 撤回
export const AgreeApprovalUrl = '/approval-action/approve'; // 同意
export const BatchRejectApprovalUrl = '/approval-action/batch-reject'; // 批量驳回
export const BatchApprovalApprovalUrl = '/approval-action/batch-approve'; // 批量同意
// 审批记录
export const GetApprovalResourceDetailUrl = '/approval-resource/detail'; // 审批资源详情

View File

@@ -0,0 +1,14 @@
export const RelateRoleUrl = '/role/user/relate'; // 角色关联用户
export const GetRoleMemberUrl = '/role/user/page'; // 角色已关联用户列表
export const BatchRemoveRoleMemberUrl = '/role/user/batch/delete'; // 批量移除角色关联用户
export const UpdateRoleUrl = '/role/update'; // 更新角色
export const CreateRoleUrl = '/role/add'; // 新增角色
export const GetRoleMemberTreeUrl = '/role/user/role/tree'; // 获取角色用户树
export const GetRoleDeptTreeUrl = '/role/user/dept/tree'; // 获取部门用户树
export const RemoveRoleMemberUrl = '/role/user/delete'; // 移除角色关联用户
export const GetPermissionsUrl = '/role/permission/setting'; // 获取全量权限
export const GetRolesUrl = '/role/list'; // 获取角色列表
export const GetRoleDetailUrl = '/role/get'; // 获取角色详情
export const DeleteRoleUrl = '/role/delete'; // 删除角色
export const GetDeptTreeUrl = '/role/dept/tree'; // 获取部门树
export const GetUserOptionUrl = '/role/user/option'; // 获取用户列表

View File

@@ -0,0 +1,68 @@
@primary-color: #00a6ab; // 主色
:root {
// 主题
--primary-8: @primary-color; /* 主题品牌色 */
--primary-0: #008d91; /* P0 */
--primary-1: #26b3b8; /* P1 */
--primary-2: #4dc1c4; /* P2 */
--primary-3: #66cacd; /* P3 */
--primary-4: #b2e4e6; /* P4 */
--primary-5: #ccedee; /* P5 */
--primary-6: #e5f6f7; /* P6 */
--primary-7: #f2fbfb; /* P7 */
// 文本
--text-n0: #000000; /* N0 */
--text-n1: #323535; /* N1 */
--text-n2: #646767; /* N2 */
--text-n3: #7d8181; /* N3 */
--text-n4: #969999; /* N4 */
--text-n5: #aeb2b2; /* N5 */
--text-n6: #c8cbcb; /* N6 */
--text-n7: #d5d8d8; /* N7 */
--text-n8: #edf0f1; /* N8 */
--text-n9: #f9fbfb; /* N9 */
--text-n10: #ffffff; /* N10 */
// red
--error-0: #c0271e; /* R0 */
--error-red: #e22e23; /* R */
--error-1: #e64d44; /* R1 */
--error-2: #eb6d65; /* R2 */
--error-3: #f6c0bd; /* R3 */
--error-4: #fceae9; /* R4 */
--error-5: #fef5f4; /* R5 */
// green
--success-0: #00a552; /* G0 */
--success-green: #00c261; /* G */
--success-1: #26cb79; /* G1 */
--success-2: #4dd490; /* G2 */
--success-3: #b2edd0; /* G3 */
--success-4: #e5f9ef; /* G4 */
--success-5: #f2fcf7; /* G5 */
// yellow
--warning-0: #d98a00; /* Y0 */
--warning-yellow: #ffa200; /* Y */
--warning-1: #ffb026; /* Y1 */
--warning-2: #ffbe4d; /* Y2 */
--warning-3: #ffe3b2; /* Y3 */
--warning-4: #fff6e5; /* Y4 */
--warning-5: #fffaf2; /* Y5 */
// blue
--info-0: #2b5fd9; /* B0 */
--info-blue: #3370ff; /* B */
--info-1: #5285ff; /* B1 */
--info-2: #709bff; /* B2 */
--info-3: #c2d4ff; /* B3 */
--info-4: #ebf1ff; /* B4 */
--info-5: #f5f8ff; /* B5 */
/** 圆角 **/
--border-radius-mini: @border-radius-mini;
--border-radius-small: @border-radius-small;
--border-radius-medium: @border-radius-medium;
--border-radius-large: @border-radius-large;
}

View File

@@ -0,0 +1,12 @@
export enum ClueStatusEnum {
/** 新建 */
NEW = 'NEW',
/** 跟进中 */
FOLLOWING = 'FOLLOWING',
/** 感兴趣 */
INTERESTED = 'INTERESTED',
}
export default {};

View File

@@ -0,0 +1,49 @@
export enum CompanyTypeEnum {
WECOM = 'WECOM', // 企业微信
DINGTALK = 'DINGTALK', // 钉钉
LARK = 'LARK', // 飞书
INTERNAL = 'INTERNAL', // 国际飞书
DATA_EASE = 'DE', // DE
SQLBot = 'SQLBOT', // SQLBot
WE_COM_OAUTH2 = 'WECOM_OAUTH2', // OAUTH2认证
DINGTALK_OAUTH2 = 'DINGTALK_OAUTH2', // 钉钉OAUTH2认证
LARK_OAUTH2 = 'LARK_OAUTH2', // 飞书OAUTH2认证
MAXKB = 'MAXKB',
TENDER = 'TENDER', // 招标信息
QCC = 'QCC', // 企查查
}
// 操作符号
export enum OperatorEnum {
GE = 'GE', // 大于等于
LE = 'LE', // 小于等于
LT = 'LT', // 小于
GT = 'GT', // 大于
IN = 'IN', // 在范围内
NOT_IN = 'NOT_IN', // 不在范围内
BETWEEN = 'BETWEEN', // 在两个值之间
COUNT_GT = 'COUNT_GT', // 大于
COUNT_LT = 'COUNT_LT', // 小于
EQUALS = 'EQUALS', // 等于
NOT_EQUALS = 'NOT_EQUALS', // 不等于
CONTAINS = 'CONTAINS', // 包含
NOT_CONTAINS = 'NOT_CONTAINS', // 不包含
EMPTY = 'EMPTY', // 为空
NOT_EMPTY = 'NOT_EMPTY', // 不为空
NEW_NOT_EQUALS_OLD = 'NOT_EQUAL_ORIGINAL', // 新值不等于旧值
DYNAMICS = 'DYNAMICS',
FIXED = 'FIXED',
}
export enum ColumnTypeEnum {
SYSTEM = 'system',
CUSTOM = 'custom',
SUB_TABLE = 'subTable',
SHOW_FIELD = 'showField', // 显示字段,部分表单支持导出显示字段
}
export enum ImportTypeExcludeFormDesignEnum {
CONTRACT_BUSINESS_TITLE_IMPORT = 'contractBusinessTitleImport',
}

View File

@@ -0,0 +1,24 @@
export enum ContractStatusEnum {
PENDING_SIGNING = 'PENDING_SIGNING', // 待签署
SIGNED = 'SIGNED', // 已签署
CHANGE = 'CHANGE', //合同变更
IN_PROGRESS = 'IN_PROGRESS', // 履行中
COMPLETED_PERFORMANCE = 'COMPLETED_PERFORMANCE', // 履行完毕
VOID = 'VOID', // 作废
ARCHIVED = 'ARCHIVED', // 合同完結
}
export enum ContractPaymentPlanEnum {
PENDING = 'PENDING', // 未完成
PARTIALLY_COMPLETED = 'PARTIALLY_COMPLETED', // 部分完成
COMPLETED = 'COMPLETED', // 已完成
}
export enum ContractBusinessTitleStatusEnum {
APPROVED = 'APPROVED', // 通过
UNAPPROVED = 'UNAPPROVED', // 未通过
APPROVING = 'APPROVING', // 提审中
REVOKED = 'REVOKED', // 撤销
}

View File

@@ -0,0 +1,17 @@
export enum CustomerSearchTypeEnum {
ALL = 'ALL',
SELF = 'SELF',
DEPARTMENT = 'DEPARTMENT',
CUSTOMER_COLLABORATION = 'CUSTOMER_COLLABORATION',
CUSTOMER_TRANSITION = 'CUSTOMER_TRANSITION',
OPPORTUNITY_TRANSITION = 'OPPORTUNITY_TRANSITION',
SELF_QUOTATION = 'SELF_QUOTATION',
}
export enum CustomerFollowPlanStatusEnum {
ALL = 'ALL',
PREPARED = 'PREPARED',
UNDERWAY = 'UNDERWAY',
COMPLETED = 'COMPLETED',
CANCELLED = 'CANCELLED',
}

View File

@@ -0,0 +1,117 @@
export enum FormDesignKeyEnum {
CLUE = 'clue', // 线索
CLUE_TRANSITION_CUSTOMER = 'clueTransitionCustomer', // 转为客户
CLUE_POOL = 'cluePool', // 线索池
FOLLOW_PLAN_CLUE = 'planClue', // 线索跟进计划
FOLLOW_RECORD_CLUE = 'recordClue', // 线索跟进记录
CUSTOMER = 'customer', // 客户
CUSTOMER_OPEN_SEA = 'customerOpenSea', // 公海客户
CONTACT = 'contact', // 联系人
CUSTOMER_CONTACT = 'customerContact', // 客户下的联系人
FOLLOW_RECORD_CUSTOMER = 'record', // 客户跟进记录
FOLLOW_PLAN_CUSTOMER = 'plan', // 客户跟进计划
BUSINESS = 'opportunity', // 商机
FOLLOW_RECORD_BUSINESS = 'recordBusiness', // 商机跟进记录
FOLLOW_PLAN_BUSINESS = 'planBusiness', // 商机跟进计划
PRODUCT = 'product', // 产品
BUSINESS_CONTACT = 'opportunityContact', // 商机联系人
CUSTOMER_OPPORTUNITY = 'customerOpportunity', // 客户商机
FOLLOW_PLAN = 'followPlan',
FOLLOW_RECORD = 'followRecord',
CONTRACT = 'contract', // 合同
CONTRACT_SNAPSHOT = 'contractSnapshot', // 合同快照
CONTRACT_PAYMENT = 'contractPaymentPlan', // 回款计划
CONTRACT_CONTRACT_PAYMENT = 'contractContractPayment', // 合同下的回款计划
CONTRACT_PAYMENT_RECORD = 'contractPaymentRecord', // 回款记录
INVOICE = 'invoice', // 发票
INVOICE_SNAPSHOT = 'invoiceSnapshot', // 发票快照
CONTRACT_INVOICE = 'contractInvoice', // 合同下的发票
PRICE = 'price', // 价格表
OPPORTUNITY_QUOTATION = 'quotation', // 商机报价单
OPPORTUNITY_QUOTATION_SNAPSHOT = 'quotationSnapshot', // 商机快照报价单
BUSINESS_TITLE = 'businessTitle', // 工商抬头(数据源,无表单配置入口)
ORDER = 'order', // 订单
ORDER_SNAPSHOT = 'orderSnapshot', // 订单快照
CONTRACT_ORDER = 'contractOrder', // 合同下的订单
CUSTOMER_ORDER = 'customerOrder', // 客户下的订单
CUSTOM_FORM = 'customForm', // 自定义表单
// 全局搜索
SEARCH_ADVANCED_CLUE = 'searchAdvancedClue', // 线索
SEARCH_ADVANCED_CUSTOMER = 'searchAdvancedCustomer', // 客户
SEARCH_ADVANCED_CONTACT = 'searchAdvancedContact', // 联系人
SEARCH_ADVANCED_PUBLIC = 'searchAdvancedPublic', // 公海
SEARCH_ADVANCED_CLUE_POOL = 'searchAdvancedCluePool', // 线索池
SEARCH_ADVANCED_OPPORTUNITY = 'searchAdvancedOpportunity', // 商机
}
export enum FieldTypeEnum {
TIME_RANGE_PICKER = 'TIME_RANGE_PICKER',
INPUT = 'INPUT',
TEXTAREA = 'TEXTAREA',
INPUT_NUMBER = 'INPUT_NUMBER',
DATE_TIME = 'DATE_TIME',
RADIO = 'RADIO',
CHECKBOX = 'CHECKBOX',
SELECT = 'SELECT',
SELECT_MULTIPLE = 'SELECT_MULTIPLE',
USER_TAG_SELECTOR = 'USER_TAG_SELECTOR',
MEMBER = 'MEMBER',
MEMBER_MULTIPLE = 'MEMBER_MULTIPLE',
DEPARTMENT = 'DEPARTMENT',
DEPARTMENT_MULTIPLE = 'DEPARTMENT_MULTIPLE',
DIVIDER = 'DIVIDER',
INPUT_MULTIPLE = 'INPUT_MULTIPLE',
TREE_SELECT = 'TREE_SELECT',
USER_SELECT = 'USER_SELECT',
// 高级字段
PICTURE = 'PICTURE',
LOCATION = 'LOCATION',
PHONE = 'PHONE',
DATA_SOURCE = 'DATA_SOURCE',
DATA_SOURCE_MULTIPLE = 'DATA_SOURCE_MULTIPLE',
SERIAL_NUMBER = 'SERIAL_NUMBER', // 流水号
LINK = 'LINK', // 链接
ATTACHMENT = 'ATTACHMENT',
INDUSTRY = 'INDUSTRY',
FORMULA = 'FORMULA', // 计算公式
SUB_PRODUCT = 'SUB_PRODUCT',
SUB_PRICE = 'SUB_PRICE',
INPUT_NUMBER_WITH_UNIT = 'INPUT_NUMBER_WITH_UNIT', // 数值带单位组件用于到到期提醒等场景X年、月、天、小时
}
export enum FieldRuleEnum {
REQUIRED = 'required',
UNIQUE = 'unique',
NUMBER_RANGE = 'numberRange',
}
export enum FieldDataSourceTypeEnum {
CUSTOMER = 'CUSTOMER', // 客户
CONTACT = 'CONTACT', // 联系人
BUSINESS = 'OPPORTUNITY', // 商机
PRODUCT = 'PRODUCT', // 产品
CLUE = 'CLUE', // 线索
CUSTOMER_OPTIONS = 'CUSTOMER_OPTIONS', // 客户选项
USER_OPTIONS = 'USER_OPTIONS', // 成员选项
PRICE = 'PRICE', // 价格表
CONTRACT = 'CONTRACT',
QUOTATION = 'QUOTATION', // 报价单
CONTRACT_PAYMENT = 'PAYMENT_PLAN',
CONTRACT_PAYMENT_RECORD = 'CONTRACT_PAYMENT_RECORD', // 回款记录
BUSINESS_TITLE = 'BUSINESS_TITLE', // 工商抬头
ORDER = 'ORDER', // 订单
INVOICE = 'INVOICE', // 发票
}
export enum FormLinkScenarioEnum {
CLUE_TO_CUSTOMER = 'CLUE_TO_CUSTOMER', // 线索转客户
CLUE_TO_OPPORTUNITY = 'CLUE_TO_OPPORTUNITY', // 线索转商机
CUSTOMER_TO_OPPORTUNITY = 'CUSTOMER_TO_OPPORTUNITY', // 客户转商机
CLUE_TO_RECORD = 'CLUE_TO_RECORD', // 线索转跟进记录
CUSTOMER_TO_RECORD = 'CUSTOMER_TO_RECORD', // 客户转跟进记录
OPPORTUNITY_TO_RECORD = 'OPPORTUNITY_TO_RECORD', // 商机转跟进记录
PLAN_TO_RECORD = 'PLAN_TO_RECORD', // 跟进计划转跟进记录
CONTRACT_TO_INVOICE = 'CONTRACT_TO_INVOICE', // 合同开票
CLUE_TO_CONTACT = 'CLUE_TO_CONTACT', // 线索转联系人
CONTRACT_TO_ORDER = 'CONTRACT_TO_ORDER', // 合同创建订单
}

View File

@@ -0,0 +1,8 @@
export const enum IRNodeType {
Literal = 'literal', // string|number|boolean
Field = 'field', // 字段
Binary = 'binary', // 运算符
Compare = 'compare', // 比较运算符
Function = 'function', // 函数
Invalid = 'invalid' // 无效节点
}

View File

@@ -0,0 +1,31 @@
/**
* 请求结果枚举
*/
export enum ResultEnum {
SUCCESS = 100200,
ERROR = 1,
TIMEOUT = 401,
TYPE = 'success',
}
/**
* 请求方法枚举
*/
export enum RequestEnum {
GET = 'GET',
POST = 'POST',
PUT = 'PUT',
DELETE = 'DELETE',
}
/**
* 请求响应体格式
*/
export enum ContentTypeEnum {
// json
JSON = 'application/json;charset=UTF-8',
// form-data qs
FORM_URLENCODED = 'application/x-www-form-urlencoded;charset=UTF-8',
// form-data upload
FORM_DATA = 'multipart/form-data;charset=UTF-8',
}

View File

@@ -0,0 +1,67 @@
export enum ModuleConfigEnum {
/** 首页 */
HOME = 'home',
/** 客户管理 */
CUSTOMER_MANAGEMENT = 'customer',
/** 线索管理 */
CLUE_MANAGEMENT = 'clue',
/** 商机管理 */
BUSINESS_MANAGEMENT = 'business',
/** 数据管理 TODO 先不做 */
// DATA_MANAGEMENT = 'data',
/** 产品管理 */
PRODUCT_MANAGEMENT = 'product',
/** 系统设置 */
SYSTEM_SETTINGS = 'setting',
/** 仪表板 */
DASHBOARD = 'dashboard',
/** 智能体 */
AGENT = 'agent',
/** 合同 */
CONTRACT = 'contract',
/** 订单 */
ORDER = 'order',
/** 招标 */
TENDER = 'tender',
/** 自定义表单 */
CUSTOM_FORM = 'customForm',
}
// 添加员工API
export enum MemberApiTypeEnum {
SYSTEM_ROLE = 'SYSTEM_ROLE',
MODULE_ROLE = 'MODULE_ROLE',
FORM_FIELD = 'FORM_FIELD',
SYSTEM_ORG_USER = 'SYSTEM_ORG_USER',
CUSTOM_FORM = 'CUSTOM_FORM',
}
// 选择添加
export enum MemberSelectTypeEnum {
ORG = 'DEPARTMENT', // 组织架构
ROLE = 'ROLE', // 角色
MEMBER = 'USER', // 成员
ONLY_ORG = 'ONLY_DEPARTMENT', // 组织架构
}
// 原因类型
export enum ReasonTypeEnum {
OPPORTUNITY_FAIL_RS = 'OPPORTUNITY_FAIL_RS', // 商机失败原因
CUSTOMER_POOL_RS = 'CUSTOMER_POOL_RS', // 公海原因
CLUE_POOL_RS = 'CLUE_POOL_RS', // 线索移入原因
CONTRACT_APPROVAL = 'CONTRACT_APPROVAL', // 合同审批
INVOICE_APPROVAL = 'INVOICE_APPROVAL', // 发票审批
QUOTATION_APPROVAL = 'QUOTATION_APPROVAL', // 报价审批
}

View File

@@ -0,0 +1,16 @@
export enum OpportunitySearchTypeEnum {
ALL = 'ALL',
SELF = 'SELF',
DEPARTMENT = 'DEPARTMENT',
OPPORTUNITY_SUCCESS = 'OPPORTUNITY_SUCCESS',
}
export enum CirculationTypeEnum {
NORMAL = 'NORMAL',
ADVANCED = 'ADVANCED',
}
export enum CirculationValueTypeEnum {
FIXED_VALUE = 'FIXED_VALUE',
FIELD_VALUE = 'FIELD_VALUE',
}

View File

@@ -0,0 +1,98 @@
export enum ProcessStatusEnum {
/** 无 **/
NONE = 'NONE',
/** 待提审, 待审批 */
PENDING = 'PENDING',
/** 审批中 */
APPROVING = 'APPROVING',
/** 已通过 */
APPROVED = 'APPROVED',
AUTO_APPROVED = 'AUTO_APPROVED', // 自动通过
AUTO_UNAPPROVED = 'AUTO_UNAPPROVED', // 自动驳回
/** 已驳回 */
UNAPPROVED = 'UNAPPROVED',
/** 已撤销 */
REVOKED = 'REVOKED',
}
export enum ApprovalOperationEnum {
APPROVE = 'APPROVE', // 通过
REJECT = 'REJECT', // 驳回
SIGN = 'SIGN', // 加签
BACK = 'BACK', // 退回
}
// 审批类型
export enum ApprovalTypeEnum {
MANUAL = 'MANUAL', // 人工审批
AUTO_PASS = 'AUTO_PASS', // 自动通过
AUTO_REJECT = 'AUTO_REJECT', // 自动拒绝
}
// 审批流节点类型
export enum ApprovalNodeTypeEnum {
START = 'START', // 开始节点
APPROVER = 'APPROVER', // 审批节点
CONDITION = 'CONDITION', // 条件分支
DEFAULT = 'DEFAULT', // 默认分支
END = 'END', // 结束节点
}
// 审批人/抄送人来源类型
export enum ApproverTypeEnum {
SPECIFIED_MEMBER = 'MEMBER', // 指定成员
DIRECT_SUPERVISOR = 'SUPERIOR', // 直属上级
CONTINUOUS_SUPERVISOR = 'MULTIPLE_SUPERIOR', // 连续多级上级
SPECIFIED_DEPARTMENT_LEADER = 'DEPT_HEAD', // 指定部门负责人
CONTINUOUS_DEPARTMENT_LEADER = 'MULTIPLE_DEPT_HEAD', // 连续多级部门负责人
ROLE = 'ROLE', // 角色
}
// 连续多级审批方向
export enum ApprovalLevelDirectionEnum {
BOTTOM_UP = 'BOTTOM_UP', // 从下至上
TOP_DOWN = 'TOP_DOWN', // 从上至下
}
// 多人审批方式
export enum MultiApproverModeEnum {
ALL = 'ALL', // 会签
ANY = 'ANY', // 或签
SEQUENTIAL = 'SEQUENTIAL', // 依次审批
}
// 审批人为空时的处理方式
export enum EmptyApproverActionEnum {
AUTO_PASS = 'AUTO_PASS', // 自动通过
ASSIGN_SPECIFIC = 'ASSIGN_SPECIFIC', // 指定人员处理
ASSIGN_ADMIN = 'ASSIGN_ADMIN', // 转交审批管理员
}
// 审批人与提交人相同时的处理方式
export enum SameSubmitterActionEnum {
ALLOW = 'ALLOW', // 由提交人审批
SKIP = 'SKIP', // 自动跳过
ASSIGN_SUPERIOR = 'ASSIGN_SUPERIOR', // 转交直属上级审批
}
// 表单字段权限类型
export enum ApprovalFieldPermissionModeEnum {
HIDDEN = 'HIDDEN', // 隐藏
VIEW = 'VIEW', // 仅查看
EDIT = 'EDIT', // 可编辑
}
export enum ApprovalResourceTypeEnum {
QUOTATION = 'QUOTATION',
CONTRACT = 'CONTRACT',
ORDER = 'ORDER',
INVOICE = 'INVOICE',
ALL = 'ALL',
}
export enum ApprovalListTypeEnum {
PENDING = 'pending',
APPROVAL = 'approved',
INITIATED = 'initiated',
COPIED = 'copied',
}

View File

@@ -0,0 +1,67 @@
// 部门树节点类型枚举
export enum DeptNodeTypeEnum {
ORG = 'ORG',
USER = 'USER',
ROLE = 'ROLE',
}
export enum PersonalEnum {
INFO = 'INFO',
MY_PLAN = 'MY_PLAN',
API_KEY = 'API_KEY',
}
export enum SystemMessageTypeEnum {
ANNOUNCEMENT_NOTICE = 'ANNOUNCEMENT_NOTICE', // 系统公告
SYSTEM_NOTICE = 'SYSTEM_NOTICE', // 系统消息
}
export enum SystemResourceMessageTypeEnum {
CUSTOMER = 'CUSTOMER',
CUSTOMER_POOL = 'CUSTOMER_POOL',
CLUE = 'CLUE',
CLUE_POOL = 'CLUE_POOL',
OPPORTUNITY = 'OPPORTUNITY',
SYSTEM = 'SYSTEM',
CUSTOMER_CONTACT = 'CUSTOMER_CONTACT',
CONTRACT = 'CONTRACT',
ORDER = 'ORDER',
CONTRACT_PAYMENT_PLAN = 'CONTRACT_PAYMENT_PLAN',
CONTRACT_PAYMENT_RECORD = 'CONTRACT_PAYMENT_RECORD',
PRODUCT_PRICE = 'PRODUCT_PRICE',
BUSINESS_TITLE = 'BUSINESS_TITLE',
CONTRACT_INVOICE = 'CONTRACT_INVOICE',
CUSTOM_FORM = 'CUSTOM_FORM_DATA',
}
export enum SystemMessageStatusEnum {
READ = 'READ', // 已读
UNREAD = 'UNREAD', // 未读
}
export enum OperationTypeEnum {
UPDATE = 'UPDATE',
ADD = 'ADD',
DELETE = 'DELETE',
IMPORT = 'IMPORT',
EXPORT = 'EXPORT',
SYNC = 'SYNC',
MOVE_TO_CUSTOMER_POOL = 'MOVE_TO_CUSTOMER_POOL',
PICK = 'PICK',
ASSIGN = 'ASSIGN',
CANCEL = 'CANCEL',
ADD_USER = 'ADD_USER',
REMOVE_USER = 'REMOVE_USER',
MERGE = 'MERGE',
APPROVAL = 'APPROVAL', // 审批
VOIDED = 'VOIDED', // 作废
CANCEL_VOID = 'CANCEL_VOID', // 取消作废
DOWNLOAD = 'DOWNLOAD', // 下载
}
export enum PersonalExportStatusEnum {
STOP = 'STOP', // 已取消
PREPARED = 'PREPARED', // 导出中
ERROR = 'ERROR', // 导出失败
SUCCESS = 'SUCCESS', // 导出成功
}

View File

@@ -0,0 +1,61 @@
export enum TableKeyEnum {
ROLE_MEMBER = 'roleMember',
AUTH = 'auth',
SYSTEM_ORG_TABLE = 'systemOrgTable',
SYSTEM_MESSAGE_TABLE = 'systemMessageTable',
SYSTEM_ANNOUNCEMENT_TABLE = 'systemAnnouncementTable',
MODULE_OPPORTUNITY_RULE_TABLE = 'moduleOpportunityRuleTable',
MODULE_CLUE_POOL = 'moduleCluePool',
MODULE_OPEN_SEA = 'moduleOpenSea',
OPPORTUNITY_HEAD_LIST = 'opportunityHeadList',
CUSTOMER = 'customer',
CUSTOMER_CONTRACT = 'customerContract',
BUSINESS_CONTRACT = 'businessContract',
CUSTOMER_FOLLOW_RECORD = 'customerFollowRecord',
CUSTOMER_FOLLOW_PLAN = 'customerFollowPlan',
CUSTOMER_COLLABORATOR = 'customerCollaborator',
CUSTOMER_OPEN_SEA = 'customerOpenSea',
CLUE = 'clue',
CLUE_CONVERT_CUSTOMER = 'clueConvertCustomer',
CLUE_POOL = 'cluePool',
PRODUCT = 'product',
BUSINESS = 'business',
OPPORTUNITY_QUOTATION = 'opportunityQuotation',
LOG = 'log',
LOGIN_LOG = 'loginLog',
FOLLOW_PLAN = 'followPlan',
FOLLOW_RECORD = 'followRecord',
CONTRACT = 'contract',
CONTRACT_PAYMENT = 'contractPayment',
CONTRACT_PAYMENT_RECORD = 'contractPaymentRecord',
PRICE = 'price',
INVOICE = 'invoice',
CONTRACT_INVOICE = 'contractInvoice',
ORDER = 'order', // 订单
CONTRACT_ORDER = 'contractOrder', // 合同下的订单
// 全局搜索
SEARCH_ADVANCED_CLUE = 'searchAdvancedClue', // 线索
SEARCH_ADVANCED_CUSTOMER = 'searchAdvancedCustomer', // 客户
SEARCH_ADVANCED_CONTACT = 'searchAdvancedContact', // 联系人
SEARCH_ADVANCED_PUBLIC = 'searchAdvancedPublic', // 公海
SEARCH_ADVANCED_CLUE_POOL = 'searchAdvancedCluePool', // 线索池
SEARCH_ADVANCED_OPPORTUNITY = 'searchAdvancedOpportunity', // 商机
CONTRACT_BUSINESS_NAME = 'contractBusinessName', // 工商抬头
// 审批流
PROCESS = 'process',
// 自定义表单表格
CUSTOM_FORM = 'customForm',
CUSTOM_FORM_USER = 'customFormUser',
}
// 具有特殊功能的列
export enum SpecialColumnEnum {
// 选择框
SELECTION = 'selection',
// 操作列
OPERATION = 'operation',
// 拖拽列
DRAG = 'drag',
// 序号列
ORDER = 'crmTableOrder',
}

View File

@@ -0,0 +1,28 @@
export enum UploadAcceptEnum {
excel = '.xlsx,.xls',
word = '.docx,.doc',
pdf = '.pdf',
ppt = '.pptx,.ppt',
txt = '.txt',
plain = '.plain',
video = '.mp4',
sql = '.sql',
csv = '.csv',
zip = '.zip',
xmind = '.xmind',
image = '.jpg,.jpeg,.png,.svg,.webp,.gif,.bmp,.ico',
jar = '.jar',
sketch = '.sketch',
none = 'none',
unknown = 'unknown',
json = '.json',
jmx = '.jmx',
har = '.har',
}
export enum UploadStatus {
init = 'init',
done = 'done',
error = 'error',
uploading = 'uploading',
}

View File

@@ -0,0 +1,46 @@
import { i18n } from '../locale';
type I18nGlobalTranslation = {
(key: string): string;
(key: string, locale: string): string;
(key: string, locale: string, list: unknown[]): string;
(key: string, locale: string, named: Record<string, unknown>): string;
(key: string, list: unknown[]): string;
(key: string, named: Record<string, unknown>): string;
};
type I18nTranslationRestParameters = [string, any];
export function useI18n(namespace?: string): {
t: I18nGlobalTranslation;
} {
const normalFn = {
t: (key: string) => {
return key;
},
};
if (!i18n) {
return normalFn;
}
const { t, ...methods } = i18n.global;
const tFn: I18nGlobalTranslation = (key: string, ...arg: any[]) => {
if (!key) return '';
if (!key.includes('.') && !namespace) return key;
// @ts-ignore
return t(key, ...(arg as I18nTranslationRestParameters));
};
return {
...methods,
t: tFn,
};
}
// Why write this function
// Mainly to configure the vscode i18nn ally plugin. This function is only used for routing and menus. Please use useI18n for other places
// 为什么要编写此函数?
// 主要用于配合vscode i18nn ally插件。此功能仅用于路由和菜单。请在其他地方使用useI18n
export const t = (key: string) => key;

View File

@@ -0,0 +1,7 @@
import type { LocaleType } from '@lib/shared/types/global';
export const loadLocalePool: LocaleType[] = [];
export function setLoadLocalePool(cb: (lp: LocaleType[]) => void) {
cb(loadLocalePool);
}

View File

@@ -0,0 +1,46 @@
import { createI18n } from 'vue-i18n';
import type { LocaleType } from '../types/global';
import { setLoadLocalePool } from './helper';
import type { App } from 'vue';
import type { I18nOptions } from 'vue-i18n';
export const LOCALE_OPTIONS = [
{ label: '中文', value: 'zh-CN' },
{ label: 'English', value: 'en-US' },
];
// eslint-disable-next-line import/no-mutable-exports
export let i18n: ReturnType<typeof createI18n>;
async function createI18nOptions(): Promise<I18nOptions> {
const locale = (localStorage.getItem('CRM-locale') || 'zh-CN') as LocaleType;
const defaultLocal = await import(`@locale/${locale}/index.ts`);
const message = defaultLocal.default?.message ?? {};
setLoadLocalePool((loadLocalePool) => {
loadLocalePool.push(locale);
});
return {
locale,
fallbackLocale: 'zh-CN',
legacy: false,
allowComposition: true,
messages: {
[locale]: message,
},
sync: true, // If you dont want to inherit locale from global scope, you need to set sync of i18n component option to false.
silentTranslationWarn: true, // true - warning off
missingWarn: false,
silentFallbackWarn: true,
};
}
// 创建国际化实例
export async function setupI18n(app: App) {
const options = await createI18nOptions();
i18n = createI18n(options);
app.use(i18n);
}

View File

@@ -0,0 +1,68 @@
import { ref, unref } from 'vue';
import dayjs from 'dayjs';
import { loadLocalePool } from './helper';
import { i18n } from './index';
import type { LocaleType, Recordable } from '@lib/shared/types/global';
interface LangModule {
message: Recordable;
dayjsLocale: Recordable;
dayjsLocaleName: string;
}
export default function useLocale(showLoadingTip: (message: string) => void) {
const { locale } = i18n.global;
const currentLocale = ref(locale as LocaleType);
/**
* 设置语言
* @param _locale 语言类型
*/
function setI18nLanguage(_locale: LocaleType) {
if (i18n.mode === 'legacy') {
i18n.global.locale = _locale;
} else {
(i18n.global.locale as any).value = _locale;
}
localStorage.setItem('CRM-locale', _locale);
}
/**
* 切换语言
* @param _locale 语言类型
* @returns 语言类型
*/
async function changeLocale(_locale: LocaleType) {
const globalI18n = i18n.global;
const _currentLocale = unref(globalI18n.locale);
if (_currentLocale === _locale) {
setI18nLanguage(_locale); // 初始化的时候需要设置一次本地语言
return _locale;
}
showLoadingTip(_currentLocale === 'zh-CN' ? '语言切换中...' : 'Language switching...');
if (loadLocalePool.includes(_locale)) {
setI18nLanguage(_locale);
return _locale;
}
const langModule = ((await import(`@locale/${_locale}/index.ts`)) as any).default as LangModule;
if (!langModule) return;
const { message, dayjsLocale, dayjsLocaleName } = langModule;
globalI18n.setLocaleMessage(_locale, message);
dayjs.locale(dayjsLocaleName, dayjsLocale);
loadLocalePool.push(_locale);
setI18nLanguage(_locale);
window.location.reload();
return _locale;
}
return {
currentLocale,
changeLocale,
};
}

View File

@@ -0,0 +1,44 @@
const SESSION_ID = 'sessionId';
const CSRF_TOKEN = 'csrfToken';
const LOGIN_TYPE = 'loginType';
// 获取token
const getToken = () => {
return { [SESSION_ID]: localStorage.getItem(SESSION_ID), [CSRF_TOKEN]: localStorage.getItem(CSRF_TOKEN) || '' };
};
const setToken = (sessionId: string, csrfToken: string) => {
localStorage.setItem(SESSION_ID, sessionId);
localStorage.setItem(CSRF_TOKEN, csrfToken);
};
const setLoginType = (loginType: string) => {
localStorage.setItem(LOGIN_TYPE, loginType);
};
const getLoginType = () => {
return localStorage.getItem(LOGIN_TYPE);
};
const clearToken = () => {
localStorage.removeItem(SESSION_ID);
localStorage.removeItem(CSRF_TOKEN);
};
const hasToken = () => {
return !!localStorage.getItem(SESSION_ID) && !!localStorage.getItem(CSRF_TOKEN);
};
const setLoginExpires = () => {
localStorage.setItem('loginExpires', Date.now().toString());
};
const isLoginExpires = () => {
const lastLoginTime = Number(localStorage.getItem('loginExpires'));
const now = Date.now();
const diff = now - lastLoginTime;
const thirtyDay = 24 * 60 * 60 * 1000 * 30;
return diff > thirtyDay;
};
export { clearToken, getLoginType, getToken, hasToken, isLoginExpires, setLoginExpires, setLoginType, setToken };

View File

@@ -0,0 +1,195 @@
/**
* 滚动到指定元素
*/
export interface ScrollToViewOptions {
behavior?: 'auto' | 'smooth';
block?: 'start' | 'center' | 'end' | 'nearest';
inline?: 'start' | 'center' | 'end' | 'nearest';
}
/**
* 将指定元素滚动至视图区域内
* @param targetRef 目标 ref 或 DOM
* @param options 滚动配置
*/
export function scrollIntoView(targetRef: HTMLElement | Element | null, options: ScrollToViewOptions = {}) {
const scrollOptions: ScrollToViewOptions = {
behavior: options.behavior || 'smooth',
block: options.block || 'start',
inline: options.inline || 'nearest',
};
targetRef?.scrollIntoView(scrollOptions);
}
/**
* 无操作函数
*/
export const NOOP = () => {
return undefined;
};
/**
* 判断是否为服务端渲染
*/
export const isServerRendering = (() => {
try {
return !(typeof window !== 'undefined' && document !== undefined);
} catch (e) {
return true;
}
})();
/**
* 监听事件
*/
export const on = (() => {
if (isServerRendering) {
return NOOP;
}
return <K extends keyof HTMLElementEventMap>(
element: HTMLElement | Window,
event: K,
handler: (ev: HTMLElementEventMap[K]) => void,
options: boolean | AddEventListenerOptions = false
) => {
element.addEventListener(event, handler as EventListenerOrEventListenerObject, options);
};
})();
/**
* 移除监听事件
*/
export const off = (() => {
if (isServerRendering) {
return NOOP;
}
return <K extends keyof HTMLElementEventMap>(
element: HTMLElement | Window,
type: K,
handler: (ev: HTMLElementEventMap[K]) => void,
options: boolean | EventListenerOptions = false
) => {
element.removeEventListener(type, handler as EventListenerOrEventListenerObject, options);
};
})();
/**
* 获取元素宽度
* @param el 当前元素
* @returns number
*/
export function getNodeWidth(el: HTMLElement) {
return el && +el.getBoundingClientRect().width.toFixed(2);
}
/**
* 获取元素样式
* @param element 当前元素
* @param prop 样式属性
* @returns string
*/
export function getStyle(element: HTMLElement | null, prop: string | null) {
if (!element || !prop) return null;
let styleName = prop as keyof CSSStyleDeclaration;
if (styleName === 'float') {
styleName = 'cssFloat';
}
try {
if (document.defaultView) {
const computed = document.defaultView.getComputedStyle(element, '');
return element.style[styleName] || computed ? computed[styleName] : '';
}
} catch (e) {
return element.style[styleName];
}
return null;
}
/**
* 获取当前展示的最上层的浮层(弹窗、抽屉等)
* @param selector 浮层选择器
*/
export function getMaxZIndexLayer(selector: string): HTMLElement | null {
const layers = document.querySelectorAll<HTMLElement>(selector);
let maxZIndex = 0;
let maxZIndexDrawer: HTMLElement | null = null;
layers.forEach((layer) => {
const zIndex = parseInt(window.getComputedStyle(layer).zIndex, 10);
if (!Number.isNaN(zIndex) && zIndex > maxZIndex) {
maxZIndex = zIndex;
maxZIndexDrawer = layer;
}
});
return maxZIndexDrawer;
}
/**
* 合并样式
* @param element 当前元素
* @param stylesToAdd 要添加的样式
*/
export function mergeStyles(element: HTMLElement | Element | null, stylesToAdd: string): void {
if (element) {
const originalStyles = element.getAttribute('style') || '';
const mergedStyles: Record<string, string> = {};
const originalStylePairs = originalStyles.split(';').filter((style) => style.trim() !== '');
// 解析原有的 style 属性
originalStylePairs.forEach((pair) => {
const [key, value] = pair.split(':').map((item) => item.trim());
mergedStyles[key] = value;
});
// 解析要添加的样式属性
const stylesToAddPairs = stylesToAdd.split(';').filter((style) => style.trim() !== '');
stylesToAddPairs.forEach((pair) => {
const [key, value] = pair.split(':').map((item) => item.trim());
mergedStyles[key] = value;
});
// 构造新的 style 属性字符串
const mergedStyleString = Object.entries(mergedStyles)
.map(([key, value]) => `${key}: ${value}`)
.join(';');
// 设置新的 style 属性值
element.setAttribute('style', mergedStyleString);
}
}
/**
* 移除样式
* @param element 当前元素
* @param stylesToRemove 要移除的样式
*/
export function removeStyles(element: HTMLElement | Element | null, stylesToRemove: string): void {
if (element) {
const originalStyles = element.getAttribute('style') || '';
const updatedStyles: Record<string, string> = {};
const originalStylePairs = originalStyles.split(';').filter((style) => style.trim() !== '');
// 解析原有的 style 属性
originalStylePairs.forEach((pair) => {
const [key, value] = pair.split(':').map((item) => item.trim());
updatedStyles[key] = value;
});
// 移除指定的样式属性
const stylesToRemovePairs = stylesToRemove.split(';').filter((style) => style.trim() !== '');
stylesToRemovePairs.forEach((pair) => {
const [key] = pair.split(':').map((item) => item.trim());
delete updatedStyles[key];
});
// 构造新的 style 属性字符串
const updatedStyleString = Object.entries(updatedStyles)
.map(([key, value]) => `${key}: ${value}`)
.join(';');
// 设置新的 style 属性值
element.setAttribute('style', updatedStyleString);
}
}

View File

@@ -0,0 +1,28 @@
import { sortBy } from 'lodash-es';
/**
* 比较两个一维数组对象是否相等,不考虑顺序,
* @param arr1 数组1
* @param arr2 数组2
* @returns boolean
*/
export function isArraysEqualWithOrder<T>(arr1: T[], arr2: T[]): boolean {
if (arr1.length !== arr2.length) {
return false;
}
const sortArr1 = sortBy(arr1, 'dataIndex');
const sortArr2 = sortBy(arr2, 'dataIndex');
for (let i = 0; i < sortArr1.length; i++) {
const obj1 = sortArr1[i];
const obj2 = sortArr2[i];
// 逐一比较对象
if (JSON.stringify(obj1) !== JSON.stringify(obj2)) {
return false;
}
}
return true;
}
export default {};

View File

@@ -0,0 +1,219 @@
import { Canvg } from 'canvg';
import html2canvas from 'html2canvas-pro';
import JSPDF from 'jspdf';
import { nextTick } from 'vue';
const A4_WIDTH = 595;
const A4_HEIGHT = 842;
const HEADER_HEIGHT = 16;
const FOOTER_HEIGHT = 24;
const PAGE_HEIGHT = A4_HEIGHT - FOOTER_HEIGHT - HEADER_HEIGHT;
const PDF_WIDTH = A4_WIDTH - 32; // 左右分别 16px 间距
const CONTAINER_WIDTH = 1190;
export const SCALE_RATIO = window.devicePixelRatio * 1.5;
// 实际每页高度 = PDF页面高度/页面容器宽度与 pdf 宽度的比例(这里比例*SCALE_RATIO 是因为html2canvas截图时生成的是 SCALE_RATIO 倍的清晰度)
export const IMAGE_HEIGHT = Math.ceil(PAGE_HEIGHT * (CONTAINER_WIDTH / PDF_WIDTH) * SCALE_RATIO);
export const MAX_CANVAS_HEIGHT = IMAGE_HEIGHT * 20; // 一次截图最大高度是 20 页整(过长会无法截完整,出现空白)
/**
* 替换svg为base64
*/
async function inlineSvgUseElements(container: HTMLElement) {
const useElements = container.querySelectorAll('use');
useElements.forEach((useElement) => {
const href = useElement.getAttribute('xlink:href') || useElement.getAttribute('href');
if (href) {
const symbolId = href.substring(1);
const symbol = document.getElementById(symbolId);
if (symbol) {
const svgElement = useElement.closest('svg');
if (svgElement) {
svgElement.innerHTML = symbol.innerHTML;
}
}
}
});
}
/**
* 将svg转换为base64
*/
async function convertSvgToBase64(svgElement: SVGSVGElement) {
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
const svgString = new XMLSerializer().serializeToString(svgElement);
if (ctx) {
const v = Canvg.fromString(ctx, svgString);
canvas.width = svgElement.clientWidth;
canvas.height = svgElement.clientHeight;
await v.render();
}
return canvas.toDataURL('image/png');
}
/**
* 替换svg为base64
*/
export async function replaceSvgWithBase64(container: HTMLElement) {
await inlineSvgUseElements(container);
const svgElements = container.querySelectorAll('.c-icon');
svgElements.forEach(async (svgElement) => {
const img = new Image();
img.src = await convertSvgToBase64(svgElement as SVGSVGElement);
img.width = svgElement.clientWidth;
img.height = svgElement.clientHeight;
img.style.marginRight = '8px';
svgElement.parentNode?.replaceChild(img, svgElement);
});
}
/**
* 处理 DOM 元素的分页,防止内容被截断
* @param containerId 容器 ID
* @param pageHeight PDF 一页的有效高度 (对应你的 PAGE_HEIGHT 或 IMAGE_HEIGHT / SCALE_RATIO)
*/
function handlePageBreak(containerId: string, pageHeight: number) {
const container = document.getElementById(containerId);
if (!container) return;
// 获取所有直接子元素,这里假设子元素是不可分割的块(比如一行表格、一个段落)
// 根据实际情况,你可能需要更精确的选择器,比如 '.table-row', 'p', 'img'
const children = Array.from(container.children) as HTMLElement[];
let currentPageHeight = 0;
const nodesToMove: { node: HTMLElement; spacerHeight: number }[] = [];
children.forEach((child) => {
const childHeight = child.offsetHeight;
// 如果元素本身就比一页还高,那没法处理,只能让它截断
if (childHeight > pageHeight) {
currentPageHeight += childHeight;
// 重置当前页高度计数,近似处理
currentPageHeight = currentPageHeight % pageHeight;
return;
}
// 判断加上当前元素后是否超出一页
if (currentPageHeight + childHeight > pageHeight) {
// 计算需要插入的空白高度,把当前元素挤到下一页开头
const spacerHeight = pageHeight - currentPageHeight;
nodesToMove.push({ node: child, spacerHeight });
// 当前元素被挤到下一页了,所以新的当前页高度就是它自己的高度
currentPageHeight = childHeight;
} else {
// 没超出一页,累加高度
currentPageHeight += childHeight;
}
});
// 统一插入空白占位符
// 需要倒序插入,否则会影响后续元素的 offsetTop 计算(虽然这里用的是累加高度,倒序更安全)
for (let i = nodesToMove.length - 1; i >= 0; i--) {
const { node, spacerHeight } = nodesToMove[i];
const spacer = document.createElement('div');
spacer.style.height = `${spacerHeight}px`;
spacer.style.width = '100%';
// 标记一下,方便导出后移除
spacer.className = 'pdf-page-break-spacer';
spacer.style.backgroundColor = 'transparent'; // 确保透明
container.insertBefore(spacer, node);
}
return () => {
// 返回一个清理函数,在导出完成后移除这些占位符,恢复网页原样
const spacers = container.querySelectorAll('.pdf-page-break-spacer');
spacers.forEach(spacer => spacer.remove());
}
}
/**
* 导出PDF
* @param name 文件名
* @param contentId 内容DOM id
* @description 通过html2canvas生成图片再通过jsPDF生成pdf
* 使用html2canvas截图时因为插件有截图极限超出极限部分会出现截图失败所以这里设置了MAX_CANVAS_HEIGHT截图高度然后根据这个截图高度分页截图然后根据每个截图裁剪每页 pdf 的图片并添加到 pdf 内)
*/
export default async function exportPDF(name: string, contentId: string, doneCallback?: () => void) {
const element = document.getElementById(contentId);
if (element) {
await replaceSvgWithBase64(element);
const totalHeight = element.scrollHeight;
// jsPDFs实例
const pdf = new JSPDF({
unit: 'pt',
format: 'a4',
orientation: 'p',
});
pdf.setFontSize(10);
// 计算pdf总页数
let totalPages = 0;
let position = 0; // 当前截图位置
let pageIndex = 1;
let loopTimes = 0;
const screenshotList: HTMLCanvasElement[] = [];
// 创建图片裁剪画布
const cropCanvas = document.createElement('canvas');
cropCanvas.width = CONTAINER_WIDTH * SCALE_RATIO; // 因为截图时放大了 SCALE_RATIO 倍,所以这里也要放大
cropCanvas.height = IMAGE_HEIGHT;
const tempContext = cropCanvas.getContext('2d', { willReadFrequently: true });
// 这里是大的分页,也就是截图画布的分页
while (position < totalHeight) {
// 截图高度
const screenshotHeight = Math.min(MAX_CANVAS_HEIGHT, totalHeight - position);
// eslint-disable-next-line no-await-in-loop
const canvas = await html2canvas(element, {
x: 0,
y: position,
width: CONTAINER_WIDTH,
height: screenshotHeight,
backgroundColor: '#f9f9fe',
scale: SCALE_RATIO, // 缩放增加清晰度
});
screenshotList.push(canvas);
position += screenshotHeight;
totalPages += Math.ceil(canvas.height / IMAGE_HEIGHT);
loopTimes++;
}
totalPages -= loopTimes - 1; // 减去多余的页数
// 生成 PDF
screenshotList.forEach((_canvas) => {
const canvasWidth = _canvas.width;
const canvasHeight = _canvas.height;
const pages = Math.ceil(canvasHeight / IMAGE_HEIGHT);
for (let i = 1; i <= pages; i++) {
// 这里是小的分页,是 pdf 的每一页
const pagePosition = (i - 1) * IMAGE_HEIGHT;
if (tempContext) {
if (pageIndex === totalPages) {
// 填充背景颜色为白色
tempContext.fillStyle = '#ffffff';
tempContext.fillRect(0, 0, cropCanvas.width, cropCanvas.height);
}
// 将大分页的画布图片裁剪成pdf 页面内容大小,并渲染到临时画布上
tempContext.drawImage(_canvas, 0, -pagePosition, canvasWidth, canvasHeight);
const tempCanvasData = cropCanvas.toDataURL('image/jpeg', 1);
// 将临时画布图片渲染到 pdf 上
pdf.addImage(tempCanvasData, 'PNG', 16, 16, PDF_WIDTH, PAGE_HEIGHT);
}
cropCanvas.remove();
pdf.text(
`${pageIndex} / ${totalPages}`,
pdf.internal.pageSize.width / 2 - 10,
pdf.internal.pageSize.height - 4
);
if (i < pages) {
pdf.addPage();
pageIndex++;
}
}
_canvas.remove();
});
pdf.save(`${name}.pdf`);
nextTick(() => {
doneCallback?.();
});
}
}

View File

@@ -0,0 +1,566 @@
import type { CommonList, ModuleField } from '../models/common';
import { FieldTypeEnum } from '../enums/formDesignEnum';
import type { FormCreateField, FormDetail } from '@cordys/web/src/components/business/crm-form-create/types';
import { formatTimeValue, getCityPath, getIndustryPath } from './index';
import { useI18n } from '../hooks/useI18n';
export const linkAllAcceptTypes = [FieldTypeEnum.INPUT, FieldTypeEnum.TEXTAREA];
export const dataSourceTypes = [FieldTypeEnum.DATA_SOURCE, FieldTypeEnum.DATA_SOURCE_MULTIPLE];
export const hiddenTypes = [
FieldTypeEnum.DIVIDER,
FieldTypeEnum.PICTURE,
FieldTypeEnum.ATTACHMENT,
FieldTypeEnum.LINK,
FieldTypeEnum.SUB_PRICE,
FieldTypeEnum.SUB_PRODUCT,
];
export const needSameTypes = [
FieldTypeEnum.PHONE,
FieldTypeEnum.LOCATION,
FieldTypeEnum.DATE_TIME,
FieldTypeEnum.INPUT_NUMBER,
FieldTypeEnum.INDUSTRY,
FieldTypeEnum.SUB_PRICE,
FieldTypeEnum.SUB_PRODUCT,
];
export const multipleTypes = [FieldTypeEnum.CHECKBOX, FieldTypeEnum.SELECT_MULTIPLE, FieldTypeEnum.INPUT_MULTIPLE];
export const memberTypes = [FieldTypeEnum.MEMBER, FieldTypeEnum.MEMBER_MULTIPLE];
export const departmentTypes = [FieldTypeEnum.DEPARTMENT, FieldTypeEnum.DEPARTMENT_MULTIPLE];
export const singleTypes = [FieldTypeEnum.RADIO, FieldTypeEnum.SELECT];
export const specialBusinessKeyMap: Record<string, string> = {
customerId: 'customerName',
contactId: 'contactName',
clueId: 'clueName',
businessId: 'businessName',
contractId: 'contractName',
owner: 'ownerName',
opportunityId: 'opportunityName',
paymentPlanId: 'paymentPlanName',
businessTitleId: 'businessTitleName',
};
export function getRuleType(item: FormCreateField) {
if (
item.type === FieldTypeEnum.SELECT_MULTIPLE ||
item.type === FieldTypeEnum.CHECKBOX ||
item.type === FieldTypeEnum.INPUT_MULTIPLE ||
item.type === FieldTypeEnum.MEMBER_MULTIPLE ||
item.type === FieldTypeEnum.DEPARTMENT_MULTIPLE ||
item.type === FieldTypeEnum.DATA_SOURCE ||
item.type === FieldTypeEnum.DATA_SOURCE_MULTIPLE ||
item.type === FieldTypeEnum.PICTURE ||
item.type === FieldTypeEnum.ATTACHMENT
) {
return 'array';
}
if (item.type === FieldTypeEnum.DATE_TIME) {
return 'date';
}
if ([FieldTypeEnum.INPUT_NUMBER, FieldTypeEnum.FORMULA].includes(item.type)) {
return 'number';
}
return 'string';
}
export function getNormalFieldValue(item: FormCreateField, value: any) {
if (item.type === FieldTypeEnum.DATA_SOURCE && !value) {
return '';
}
if (
[
FieldTypeEnum.SELECT_MULTIPLE,
FieldTypeEnum.MEMBER_MULTIPLE,
FieldTypeEnum.DEPARTMENT_MULTIPLE,
FieldTypeEnum.DATA_SOURCE_MULTIPLE,
FieldTypeEnum.INPUT_MULTIPLE,
].includes(item.type) &&
!value
) {
return [];
}
if (item.type === FieldTypeEnum.INPUT_MULTIPLE && !value) {
return [];
}
if (item.multiple && !value) {
return [];
}
return value;
}
/**
* 格式化数字
* @param value 数字
* @param item
*/
export function formatNumberValue(value: string | number, item: FormCreateField) {
if (value !== undefined && value !== null && value !== '') {
if (item.numberFormat === 'percent') {
return item.precision ? `${Number(value).toFixed(item.precision)}%` : `${value}%`;
}
if (item.showThousandsSeparator) {
return (item.precision ? Number(Number(value).toFixed(item.precision)) : Number(value)).toLocaleString('en-US');
}
return item.precision ? Number(value).toFixed(item.precision) : value.toString();
}
return '-';
}
/**
* 格式化数字显示为字符串
* @param value 数字
* @param item
*/
export function formatNumberValueToString(value: number, item: FormCreateField) {
if (value !== undefined && value !== null) {
if (item.numberFormat === 'percent') {
return item.precision ? `${Number(value).toFixed(item.precision)}%` : `${value}%`;
}
if (item.showThousandsSeparator) {
if (typeof value === 'string') {
return value;
}
return item.precision
? `${value.toLocaleString('en-US').split('.')[0]}.${value.toFixed?.(item.precision).split('.')[1]}`
: value.toLocaleString('en-US');
}
return item.precision ? Number(value).toFixed(item.precision) : value.toString();
}
return '-';
}
export function initFieldValue(field: FormCreateField, value: string | number | (string | number)[]) {
if (
[FieldTypeEnum.DATA_SOURCE, FieldTypeEnum.DATA_SOURCE_MULTIPLE].includes(field.type) &&
typeof value === 'string'
) {
return value ? [value] : [];
}
return value;
}
export function getFieldItemId(field: FormCreateField) {
if (field.resourceFieldId) {
return field.id.split('_ref_')[1]; // 处理数据源显示字段
}
return field.id;
}
/**
*
* @param field
* @param fieldValue
* @returns 获取系统字段的值展示
*/
export function getDisplayFieldText(field: FormCreateField, fieldValue: any) {
const { t } = useI18n();
const fieldKey = field.businessKey || getFieldItemId(field);
if (fieldKey === 'invalid') {
if (fieldValue === true || fieldValue === 'true') {
return t('common.voided');
}
if (fieldValue === false || fieldValue === 'false') {
return t('common.normal');
}
}
const currentOption = field.options?.find((option: any) => {
if (option.value === fieldValue) {
return true;
}
if (typeof option.value === 'boolean' && typeof fieldValue === 'string') {
return String(option.value) === fieldValue;
}
return false;
});
return currentOption ? currentOption.label : fieldValue;
}
export function parseModuleFieldValue(item: FormCreateField, fieldValue: string | string[], options?: any[]) {
if (fieldValue === undefined || fieldValue === null || fieldValue === '') {
return '-';
}
const { t } = useI18n();
let value: string | string[] = fieldValue;
if (options) {
// 若字段值是选项值则取选项值的name
if (Array.isArray(fieldValue)) {
value = fieldValue.map((e) => {
const option = options.find((opt) => opt.id === e);
if (option) {
return option.name || t('common.optionNotExist');
}
return t('common.optionNotExist');
});
} else {
value = options.find((e) => e.id === fieldValue)?.name || t('common.optionNotExist');
}
} else if (
[
FieldTypeEnum.DATA_SOURCE,
FieldTypeEnum.DATA_SOURCE_MULTIPLE,
FieldTypeEnum.MEMBER,
FieldTypeEnum.MEMBER_MULTIPLE,
FieldTypeEnum.DEPARTMENT,
FieldTypeEnum.DEPARTMENT_MULTIPLE,
].includes(item.type)
) {
// 数据源/成员/部门类型字段,且没有匹配到 options则显示不存在
if (Array.isArray(fieldValue)) {
value = fieldValue.map(() => t('common.optionNotExist'));
} else {
value = t('common.optionNotExist');
}
} else if (item.type === FieldTypeEnum.LOCATION) {
const addressArr: string[] = (fieldValue as string)?.split('-')?.filter(Boolean) || [];
if (!addressArr.length) {
value = '-';
} else {
const country = addressArr[0];
const rest = addressArr.filter((e, i) => i > 0).join('-');
value = rest ? `${getCityPath(country, item.scope)}-${rest}` : getCityPath(country, item.scope);
}
} else if (item.type === FieldTypeEnum.INDUSTRY) {
value = fieldValue ? getIndustryPath(fieldValue as string) : '-';
} else if (item.type === FieldTypeEnum.INPUT_NUMBER) {
value = formatNumberValueToString(fieldValue as unknown as number, item);
if (value.includes('NaN') || value.includes('%%')) {
value = fieldValue.toString();
}
} else if (item.type === FieldTypeEnum.DATE_TIME) {
value = formatTimeValue(fieldValue as string, item.dateType);
}
if (Array.isArray(value) && item.resourceFieldId) {
value = value.join(',');
}
return value;
}
export function parseFormDetailValue(item: FormCreateField, form: FormDetail, sourceName?: Ref<string>) {
const { t } = useI18n();
if (item.businessKey && !item.resourceFieldId) {
// 引用数据源字段使用 id 读取数据,而不是 businessKey
const options = form.optionMap?.[item.businessKey];
// 业务标准字段读取最外层读取form[item.businessKey]取到 id 值,然后去 options 里取 name
let name: string | string[] = '';
const value = form[item.businessKey];
// 若字段值是选项值则取选项值的name
if (options) {
if (Array.isArray(value)) {
name = value.map((e) => {
const option = options.find((opt) => opt.id === e);
if (option) {
return option.name || t('common.optionNotExist');
}
return t('common.optionNotExist');
});
} else if (value) {
name = options.find((e) => e.id === value)?.name || t('common.optionNotExist');
}
}
if (item.type === FieldTypeEnum.DATE_TIME) {
return formatTimeValue(name || form[item.businessKey], item.dateType);
}
if (item.type === FieldTypeEnum.INPUT_NUMBER) {
return formatNumberValueToString(name || form[item.businessKey], item);
}
if (item.type === FieldTypeEnum.ATTACHMENT) {
return form.attachmentMap?.[item.businessKey] || [];
}
if (item.businessKey === 'name' && sourceName) {
sourceName.value = name || form[item.businessKey];
}
return name || form[item.businessKey];
}
const options = form.optionMap?.[item.id];
// 其他的字段读取moduleFields
const field = form.moduleFields?.find((moduleField: ModuleField) => moduleField.fieldId === item.id);
if (item.type === FieldTypeEnum.ATTACHMENT) {
return form.attachmentMap?.[item.id] || [];
}
if (field) {
return parseModuleFieldValue(item, field.fieldValue, options);
}
}
/**
* 表单配置表格回显数据
*/
export function transformData({
item,
fields,
originalData,
excludeFieldIds,
needParseSubTable = false,
}: {
fields: FormCreateField[];
item: any;
originalData?: CommonList<any>;
excludeFieldIds?: string[];
needParseSubTable?: boolean;
}) {
const { t } = useI18n();
const businessFieldAttr: Record<string, any> = {};
const customFieldAttr: Record<string, any> = {};
const addressFieldIds: string[] = [];
const industryFieldIds: string[] = [];
const dataSourceFieldIds: string[] = [];
const memberFieldIds: string[] = [];
const departmentFieldIds: string[] = [];
const timeFieldIds: string[] = [];
const fieldOptionMap: Record<string, any[]> = {};
fields.forEach((field) => {
const fieldId = field.resourceFieldId ? field.id : field.businessKey || field.id;
if (field.type === FieldTypeEnum.LOCATION) {
addressFieldIds.push(fieldId);
} else if (field.type === FieldTypeEnum.INDUSTRY) {
industryFieldIds.push(fieldId);
} else if (field.type === FieldTypeEnum.DATA_SOURCE || field.type === FieldTypeEnum.DATA_SOURCE_MULTIPLE) {
dataSourceFieldIds.push(fieldId);
} else if (field.type === FieldTypeEnum.MEMBER || field.type === FieldTypeEnum.MEMBER_MULTIPLE) {
memberFieldIds.push(fieldId);
} else if (field.type === FieldTypeEnum.DEPARTMENT || field.type === FieldTypeEnum.DEPARTMENT_MULTIPLE) {
departmentFieldIds.push(fieldId);
} else if (field.type === FieldTypeEnum.DATE_TIME) {
timeFieldIds.push(fieldId);
} else if ([FieldTypeEnum.SUB_PRICE, FieldTypeEnum.SUB_PRODUCT].includes(field.type) && needParseSubTable) {
field.subFields?.forEach((subField) => {
const subFieldData = (
item[fieldId] || item.moduleFields?.find((mf: any) => mf.fieldId === fieldId)?.fieldValue
)?.map((subItem: Record<string, any>) => {
if (subField.resourceFieldId) {
subItem[`${subField.id}_original`] = subItem[field.id]; // 备份原始值以供编辑时填充数据源
subItem[subField.id] = parseModuleFieldValue(
subField,
subItem[subField.id],
// 数据源显示字段不使用业务 key直接使用字段 id 去取值
originalData?.optionMap?.[subField.id]
);
fieldOptionMap[subField.id] = originalData?.optionMap?.[subField.id] || [];
} else {
subItem[`${subField.id}_original`] = subItem[subField.businessKey || subField.id]; // 备份原始值以供编辑时填充数据源
subItem[subField.id] = parseModuleFieldValue(
subField,
subItem[subField.businessKey || subField.id],
originalData?.optionMap?.[subField.businessKey || subField.id]
);
fieldOptionMap[subField.businessKey || subField.id] =
originalData?.optionMap?.[subField.businessKey || subField.id] || [];
}
return subItem;
});
item[fieldId] = subFieldData;
if (fieldId === field.businessKey) {
// 子表格字段可能会被设置为数据源的显示字段,而数据源显示字段都通过 id 读取,所以这里需要用 id 备份一份数据以供数据源显示字段场景读取
item[field.id] = subFieldData;
}
});
}
if (field.businessKey && !field.resourceFieldId) {
const fieldId = field.businessKey;
const options = originalData?.optionMap?.[fieldId]?.map((e: any) => ({
...e,
name: e.name || t('common.optionNotExist'),
}));
fieldOptionMap[fieldId] = options || [];
if (addressFieldIds.includes(fieldId)) {
// 地址类型字段,解析代码替换成省市区
const addressArr: string[] = item[fieldId]?.split('-')?.filter(Boolean) || [];
let value = '';
if (!addressArr.length) {
value = '-';
} else {
const country = addressArr[0];
const rest = addressArr.filter((e, i) => i > 0).join('-');
value = rest ? `${getCityPath(country)}-${rest}` : getCityPath(country);
}
businessFieldAttr[fieldId] = value;
} else if (industryFieldIds.includes(fieldId)) {
// 行业类型字段,解析代码替换成行业名称
businessFieldAttr[fieldId] = item[fieldId] ? getIndustryPath(item[fieldId] as string) : '-';
} else if (timeFieldIds.includes(fieldId)) {
// 时间类型字段,格式化时间显示
businessFieldAttr[fieldId] = formatTimeValue(item[fieldId], field.dateType);
} else if (options && options.length > 0) {
let name: string | string[] = '';
if (item[fieldId] === '' || item[fieldId] === null) {
name = '-';
} else if (dataSourceFieldIds.includes(fieldId)) {
// 处理数据源字段,需要赋值为数组
if (typeof item[fieldId] === 'string' || typeof item[fieldId] === 'number') {
// 单选
name = options?.find((e) => e.id === item[fieldId])?.name || t('common.optionNotExist');
} else {
// 多选
name = options?.filter((e) => item[fieldId]?.includes(e.id)).map((e) => e.name) || [
t('common.optionNotExist'),
];
}
} else if (typeof item[fieldId] === 'string' || typeof item[fieldId] === 'number') {
// 若值是单个字符串/数字
name = options?.find((e) => e.id === item[fieldId])?.name || t('common.optionNotExist');
} else {
// 若值是数组
name = options?.filter((e) => item[fieldId]?.includes(e.id)).map((e) => e.name) || [
t('common.optionNotExist'),
];
if (Array.isArray(name) && name.length === 0) {
name = [t('common.optionNotExist')];
}
}
if (!excludeFieldIds?.includes(field.businessKey)) {
if (specialBusinessKeyMap[fieldId]) {
// 处理特殊业务 key 映射关系
businessFieldAttr[specialBusinessKeyMap[fieldId]] = name || t('common.optionNotExist');
} else {
businessFieldAttr[fieldId] = name || t('common.optionNotExist');
}
}
if (fieldId === 'owner') {
businessFieldAttr.ownerId = item.owner;
}
} else if (specialBusinessKeyMap[fieldId]) {
// 处理特殊业务 key 映射关系
businessFieldAttr[specialBusinessKeyMap[fieldId]] = item[specialBusinessKeyMap[fieldId]];
}
businessFieldAttr[field.id] = businessFieldAttr[fieldId] || item[fieldId];
}
});
item.moduleFields?.forEach((field: ModuleField) => {
const options = originalData?.optionMap?.[field.fieldId]?.map((e) => ({
...e,
name: e.name || t('common.optionNotExist'),
}));
fieldOptionMap[field.fieldId] = options || [];
if (addressFieldIds.includes(field.fieldId)) {
// 地址类型字段,解析代码替换成省市区
const addressArr: string[] = (field?.fieldValue as string)?.split('-')?.filter(Boolean) || [];
let value = '';
if (!addressArr.length) {
value = '-';
} else {
const country = addressArr[0];
const scope = fields.find((f) => f.id === field.fieldId)?.scope;
const rest = addressArr.filter((e, i) => i > 0).join('-');
value = rest ? `${getCityPath(country, scope)}-${rest}` : getCityPath(country, scope);
}
customFieldAttr[field.fieldId] = value;
} else if (industryFieldIds.includes(field.fieldId)) {
// 行业类型字段,解析代码替换成行业名称
customFieldAttr[field.fieldId] = field.fieldValue ? getIndustryPath(field.fieldValue as string) : '-';
} else if (timeFieldIds.includes(field.fieldId)) {
// 时间类型字段,格式化时间显示
customFieldAttr[field.fieldId] = formatTimeValue(
field.fieldValue as string,
fields.find((f) => f.id === field.fieldId)?.dateType
);
} else if (options && options.length > 0) {
let name: string | string[] = '';
if (dataSourceFieldIds.includes(field.fieldId)) {
// 处理数据源字段,需要赋值为数组
if (typeof field.fieldValue === 'string' || typeof field.fieldValue === 'number') {
// 单选
name = [options.find((e) => e.id === field.fieldValue)?.name || t('common.optionNotExist')];
} else {
// 多选
name = field.fieldValue?.map((e) => options.find((o) => o.id === e)?.name || t('common.optionNotExist'));
}
} else if (typeof field.fieldValue === 'string' || typeof field.fieldValue === 'number') {
// 若值是单个字符串/数字
name = options.find((e) => e.id === field.fieldValue)?.name || t('common.optionNotExist');
} else {
// 若值是数组
name = field.fieldValue?.map((fv) => options.find((e) => e.id === fv)?.name || t('common.optionNotExist'));
if (Array.isArray(name) && name.length === 0) {
name = [t('common.optionNotExist')];
}
}
customFieldAttr[field.fieldId] = name || [t('common.optionNotExist')];
} else if (
[...dataSourceFieldIds, ...memberFieldIds, ...departmentFieldIds].includes(field.fieldId) &&
(!options || options.length === 0)
) {
// 处理匹配不到 optionsMap 的数据源/成员/部门字段
if (typeof field.fieldValue === 'string' || typeof field.fieldValue === 'number') {
// 单选
customFieldAttr[field.fieldId] = field.fieldValue !== '' ? [t('common.optionNotExist')] : ['-'];
} else {
// 避免这里返回 [['选项不存在']] 这样的嵌套数组
customFieldAttr[field.fieldId] = field.fieldValue?.map((e) => (e !== '' ? t('common.optionNotExist') : '-'));
}
} else {
// 其他类型字段,直接赋值
customFieldAttr[field.fieldId] = field.fieldValue;
}
});
// 根据 moduleFields 集合判断 fields 完整字段集合中是否有自定义字段无值,因为无值后台不会在 moduleFields 里返回该字段,需要手动置空
fields.forEach((field) => {
if (!field.resourceFieldId && !field.businessKey) {
const fieldId = field.id;
// 避免将 0 有效计算结果误判为空
if (customFieldAttr[fieldId] === undefined || customFieldAttr[fieldId] === null) {
customFieldAttr[fieldId] = undefined;
}
}
});
return {
...item,
...customFieldAttr,
...businessFieldAttr,
optionMap: fieldOptionMap,
};
}
/**
* 表单子表单计算汇总数值转换
*/
export function normalizeNumber(val: unknown): number {
if (val === null || val === undefined || val === '') return 0;
if (typeof val === 'number') {
return Number.isFinite(val) ? val : 0;
}
if (typeof val === 'string') {
let str = val.trim();
if (!str) return 0;
// 是否是百分比
const isPercent = str.endsWith('%');
// 去掉百分号
if (isPercent) {
str = str.slice(0, -1);
}
// 去掉千分位
str = str.replace(/,/g, '');
const num = Number(str);
return Number.isNaN(num) ? 0 : num;
}
return 0;
}
/**
* 合并初始选项和追加选项,去重后返回新的初始选项数组
* @param sumInitialOptions
* @param appendOptions
* @returns
*/
export function mergeUniqueOptions(sumInitialOptions: Record<string, any>[], appendOptions: Record<string, any>[]) {
const optionMap = new Map<any, Record<string, any>>();
[...sumInitialOptions, ...appendOptions].forEach((option) => {
if (!option) {
return;
}
const optionKey = option.id ?? option.value;
if (optionKey !== undefined) {
if (optionMap.has(optionKey)) {
Object.assign(optionMap.get(optionKey) || {}, option);
} else {
optionMap.set(optionKey, option);
}
}
});
sumInitialOptions = Array.from(optionMap.values());
return sumInitialOptions;
}

View File

@@ -0,0 +1,737 @@
import { cloneDeep } from 'lodash-es';
import dayjs from 'dayjs';
import JSEncrypt from 'jsencrypt';
import { isObject } from './is';
import { CHINA_PCD, COUNTRIES_TREE } from '@cordys/web/src/components/business/crm-city-select/config';
import type {
FormCreateField,
FormCreateFieldDateType,
} from '@cordys/web/src/components/business/crm-form-create/types';
import { getLocalStorage } from '@lib/shared/method/local-storage';
import industryOptions from '@cordys/web/src/components/pure/crm-industry-select/config';
/**
* 递归深度合并
* @param src 源对象
* @param target 待合并的目标对象
* @returns 合并后的对象
*/
export const deepMerge = <T = any>(src: any = {}, target: any = {}): T => {
Object.keys(target).forEach((key) => {
src[key] = isObject(src[key]) ? deepMerge(src[key], target[key]) : (src[key] = target[key]);
});
return src;
};
/**
* 遍历对象属性并一一添加到 url 地址参数上
* @param baseUrl 需要添加参数的 url
* @param obj 参数对象
* @returns 拼接后的 url
*/
export function setObjToUrlParams(baseUrl: string, obj: any): string {
let parameters = '';
Object.keys(obj).forEach((key) => {
parameters += `${key}=${encodeURIComponent(obj[key])}&`;
});
parameters = parameters.replace(/&$/, '');
return /\?$/.test(baseUrl) ? baseUrl + parameters : baseUrl.replace(/\/?$/, '?') + parameters;
}
/**
* 加密
* @param input 输入的字符串
* @param publicKey 公钥
* @returns
*/
export function encrypted(input: string) {
const publicKey = getLocalStorage('publicKey') || '';
const encrypt = new JSEncrypt({ default_key_size: '1024' });
encrypt.setPublicKey(publicKey);
return encrypt.encrypt(input);
}
/**
* 休眠
* @param ms 睡眠时长,单位毫秒
* @returns
*/
export function sleep(ms: number): Promise<void> {
return new Promise((resolve) => {
setTimeout(() => resolve(), ms);
});
}
export function getQueryVariable(variable: string) {
const urlString = window.location.href;
const queryIndex = urlString.indexOf('?');
if (queryIndex !== -1) {
// 先获取?到#之间的内容,如果没有#则获取到结尾
const hashIndex = urlString.indexOf('#');
const queryEnd = hashIndex !== -1 ? hashIndex : urlString.length;
const query = urlString.substring(queryIndex + 1, queryEnd);
// 分割查询参数
const params = query.split('&');
// 遍历参数,找到 _token 参数的值
let variableValue;
params.forEach((param) => {
const equalIndex = param.indexOf('=');
const variableName = param.substring(0, equalIndex);
if (variableName === variable) {
variableValue = param.substring(equalIndex + 1);
}
});
return variableValue;
}
}
export function getUrlParameterWidthRegExp(name: string) {
const url = window.location.href;
name = name.replace(/[[\]]/g, '\\$&');
const regex = new RegExp(`[?&]${name}(=([^&#]*)|&|#|$)`);
const results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, ' '));
}
/**
* 建立 SSE 连接
* @param url 连接地址
* @param host 连接主机
* @returns EventSource 实例
*/
export const apiSSE = (url: string, host?: string): EventSource => {
let protocol = 'http://';
// 判断是否使用 HTTPS
if (!host?.startsWith('http') && (window.location.protocol === 'https:' || host?.startsWith('https'))) {
protocol = 'https://';
}
// 解析 URL自动适配 host
const uri = protocol + (host?.split('://')[1] || window.location.host) + url;
return new EventSource(uri, {
withCredentials: true,
});
};
/**
* 获取 SSE 连接
* @param sseUrl自定义 SSE 地址
* @param host 自定义主机
* @returns EventSource 实例
*/
export function getSSE(sseUrl: string, params: Record<string, string>, host?: string): EventSource {
const queryString = new URLSearchParams(params).toString();
return apiSSE(`${sseUrl}?${queryString}`, host);
}
export interface TreeNode<T> {
children?: TreeNode<T>[];
[key: string]: any;
}
/**
* 递归遍历树形数组或树
* @param tree 树形数组或树
* @param customNodeFn 自定义节点函数
* @param customChildrenKey 自定义子节点的key
* @param continueCondition 继续递归的条件,某些情况下需要无需递归某些节点的子孙节点,可传入该条件
*/
export function traverseTree<T>(
tree: TreeNode<T> | TreeNode<T>[] | T | T[],
customNodeFn: (node: TreeNode<T>) => void,
continueCondition?: (node: TreeNode<T>) => boolean,
customChildrenKey = 'children'
) {
if (!Array.isArray(tree)) {
tree = [tree];
}
for (let i = 0; i < tree.length; i++) {
const node = (tree as TreeNode<T>[])[i];
if (typeof customNodeFn === 'function') {
customNodeFn(node);
}
if (node[customChildrenKey] && Array.isArray(node[customChildrenKey]) && node[customChildrenKey].length > 0) {
if (typeof continueCondition === 'function' && !continueCondition(node)) {
// 如果有继续递归的条件,则判断是否继续递归
break;
}
traverseTree(node[customChildrenKey], customNodeFn, continueCondition, customChildrenKey);
}
}
}
/**
* 生成 id 序列号
* @returns
*/
let lastTimestamp = 0;
let sequence = 0;
export const getGenerateId = () => {
let timestamp = new Date().getTime();
if (timestamp === lastTimestamp) {
sequence++;
if (sequence >= 100000) {
// 如果超过999则重置为0等待下一秒
sequence = 0;
while (timestamp <= lastTimestamp) {
timestamp = new Date().getTime();
}
}
} else {
sequence = 0;
}
lastTimestamp = timestamp;
return timestamp.toString() + sequence.toString().padStart(5, '0');
};
/**
* 删除树形数组中的某个节点
* @param treeArr 目标树
* @param targetKey 目标节点唯一值
*/
export function deleteNode<T>(treeArr: TreeNode<T>[], targetKey: string | number, customKey = 'key'): void {
function deleteNodeInTree(tree: TreeNode<T>[]): void {
for (let i = 0; i < tree.length; i++) {
const node = tree[i];
if (node[customKey] === targetKey) {
tree.splice(i, 1); // 直接删除当前节点
// 重新调整剩余子节点的 sort 序号
for (let j = i; j < tree.length; j++) {
tree[j].sort = j + 1;
}
return;
}
if (Array.isArray(node.children)) {
deleteNodeInTree(node.children); // 递归删除子节点
}
}
}
deleteNodeInTree(treeArr);
}
/**
* 递归遍历树形数组或树,返回新的树
* @param tree 树形数组或树
* @param customNodeFn 自定义节点函数
* @param customChildrenKey 自定义子节点的key
* @param parent 父节点
* @param parentPath 父节点路径
* @param level 节点层级
* @returns 遍历后的树形数组
*/
export function mapTree<T>(
tree: TreeNode<T> | TreeNode<T>[] | T | T[],
customNodeFn: (node: TreeNode<T>, path: string, _level: number) => TreeNode<T> | null = (node) => node,
customChildrenKey = 'children',
parentPath = '',
level = 0,
parent: TreeNode<T> | null = null
): T[] {
let cloneTree = cloneDeep(tree);
if (!Array.isArray(cloneTree)) {
cloneTree = [cloneTree];
}
function mapFunc(
_tree: TreeNode<T> | TreeNode<T>[] | T | T[],
_parentPath = '',
_level = 0,
_parent: TreeNode<T> | null = null
): T[] {
if (!Array.isArray(_tree)) {
_tree = [_tree];
}
return _tree
.map((node: TreeNode<T>, i: number) => {
const fullPath = node.path ? `${_parentPath}/${node.path}`.replace(/\/+/g, '/') : '';
node.sort = i + 1; // sort 从 1 开始
node.parent = _parent || undefined; // 没有父节点说明是树的第一层
const newNode = typeof customNodeFn === 'function' ? customNodeFn(node, fullPath, _level) : node;
if (newNode) {
newNode.level = _level;
if (newNode[customChildrenKey] && newNode[customChildrenKey].length > 0) {
newNode[customChildrenKey] = mapFunc(newNode[customChildrenKey], fullPath, _level + 1, newNode);
}
}
return newNode;
})
.filter((node: TreeNode<T> | null) => node !== null);
}
return mapFunc(cloneTree, parentPath, level, parent);
}
/**
* 获取树形数据所有有子节点的父节点
* @param treeData 树形数组
* @param childrenKey 自定义子节点的key
* @returns 遍历后父节点数组
*/
export function getAllParentNodeIds<T>(
treeData: TreeNode<T>[],
childrenKey = 'children',
customKey = 'id'
): Array<string | number> {
const parentIds: Array<string | number> = [];
const traverse = (nodes: TreeNode<T>) => {
for (let i = 0; i < nodes.length; i++) {
const node = nodes[i];
if (node[childrenKey] && node[childrenKey].length > 0) {
parentIds.push(node[customKey]); // 记录当前节点的 ID
traverse(node[childrenKey]); // 递归遍历子节点
}
}
};
traverse(treeData); // 开始递归
return parentIds;
}
/**
* 过滤树形数组或树
* @param tree 树形数组或树
* @param customNodeFn 自定义节点函数
* @param customChildrenKey 自定义子节点的key
* @returns 遍历后的树形数组
*/
export function filterTree<T>(
tree: TreeNode<T> | TreeNode<T>[] | T | T[],
filterFn: (node: TreeNode<T>, nodeIndex: number, parent?: TreeNode<T> | null) => boolean,
customChildrenKey = 'children',
parentNode: TreeNode<T> | null = null
): TreeNode<T>[] {
if (!Array.isArray(tree)) {
tree = [tree];
}
const filteredTree: TreeNode<T>[] = [];
for (let i = 0; i < tree.length; i++) {
const node = (tree as TreeNode<T>[])[i];
// 如果节点满足过滤条件,则保留该节点,并递归过滤子节点
if (filterFn(node, i, parentNode)) {
const newNode = cloneDeep({ ...node, [customChildrenKey]: [] });
if (node[customChildrenKey] && node[customChildrenKey].length > 0) {
// 递归过滤子节点,并将过滤后的子节点添加到当前节点中
newNode[customChildrenKey] = filterTree(node[customChildrenKey], filterFn, customChildrenKey, node);
} else {
newNode[customChildrenKey] = [];
}
filteredTree.push(newNode);
}
}
return filteredTree;
}
/**
*
* 返回文件的大小
* @param fileSize file文件的大小size
* @returns
*/
export function formatFileSize(fileSize: number): string {
const units = ['B', 'KB', 'MB', 'GB', 'TB'];
let size = fileSize;
let unitIndex = 0;
while (size >= 1024 && unitIndex < units.length - 1) {
size /= 1024;
unitIndex++;
}
const unit = units[unitIndex];
if (size) {
const formattedSize = size.toFixed(2);
return `${formattedSize} ${unit}`;
}
const formattedSize = 0;
return `${formattedSize} ${unit}`;
}
/**
* 字符串脱敏
* @param str 需要脱敏的字符串
* @returns 脱敏后的字符串
*/
export function desensitize(str: string): string {
if (!str || typeof str !== 'string') {
return '';
}
return str.replace(/./g, '*');
}
/**
* 对话框标题动态内容字符限制
* @param str 标题的动态内容
* @returns 转化后的字符串
*/
export function characterLimit(str?: string, length?: number): string {
if (!str) return '';
const limit = length ?? 20;
if (str.length <= limit) return str;
return `${str.slice(0, limit - 3)}...`;
}
/**
* 根据属性 key 查找树形数组中匹配的某个节点
* @param trees 属性数组
* @param targetKey 需要匹配的属性值
* @param customKey 默认为 key可自定义需要匹配的属性名
* @returns 匹配的节点/null
*/
export function findNodeByKey<T>(
trees: TreeNode<T>[],
targetKey: string | number,
customKey = 'key',
dataKey: string | undefined = undefined
): TreeNode<T> | T | null {
for (let i = 0; i < trees.length; i++) {
const node = trees[i];
if (dataKey ? node[dataKey]?.[customKey] === targetKey : node[customKey] === targetKey) {
return node; // 如果当前节点的 key 与目标 key 匹配,则返回当前节点
}
if (Array.isArray(node.children) && node.children.length > 0) {
const _node = findNodeByKey(node.children, targetKey, customKey, dataKey); // 递归在子节点中查找
if (_node) {
return _node; // 如果在子节点中找到了匹配的节点,则返回该节点
}
}
}
return null; // 如果在整个树形数组中都没有找到匹配的节点,则返回 null
}
/**
* 根据 key 遍历树,并返回找到的节点路径和节点
*/
export function findNodePathByKey<T>(
tree: TreeNode<T>[],
targetKey: string,
dataKey?: string,
customKey = 'key'
): TreeNode<T> | null {
for (let i = 0; i < tree.length; i++) {
const node = tree[i];
if (dataKey ? node[dataKey]?.[customKey] === targetKey : node[customKey] === targetKey) {
return { ...node, treePath: [dataKey ? node[dataKey] : node] }; // 如果当前节点的 key 与目标 key 匹配,则返回当前节点
}
if (Array.isArray(node.children) && node.children.length > 0) {
const result = findNodePathByKey(node.children, targetKey, dataKey, customKey); // 递归在子节点中查找
if (result) {
result.treePath.unshift(dataKey ? node[dataKey] : node);
return result; // 如果在子节点中找到了匹配的节点,则返回该节点
}
}
}
return null;
}
/**
* 根据 cityId 返回城市路径
*/
export function getCityPath(cityId: string | null, scope?: string): string {
if (!cityId) return '';
const nodePathObject = findNodePathByKey(scope === 'CN' ? CHINA_PCD.children : [CHINA_PCD, ...COUNTRIES_TREE], cityId, undefined, 'value');
const nodePathName = (nodePathObject?.treePath || []).map((item: any) => item.label);
return nodePathName.length === 1 ? nodePathName[0] : nodePathName.join('/');
}
/**
* 根据 industryId 返回行业路径
*/
export function getIndustryPath(industryId: string | null): string {
if (!industryId) return '';
const nodePathObject = findNodePathByKey(industryOptions, industryId, undefined, 'value');
const nodePathName = (nodePathObject?.treePath || []).map((item: any) => item.label);
return nodePathName.length === 1 ? nodePathName[0] : nodePathName.join('/');
}
/**
* 返回添加节点下一个有效未命名name
* @param existingNames 已存在名称列表
* @param baseName 基础名称
*/
export function getNextAvailableName(existingNames: string[], baseName: string): string {
const baseNamePattern = new RegExp(`^${baseName}(\\d+)$`);
const existingSuffixes = existingNames.reduce((suffixes: number[], name: string) => {
const match = baseNamePattern.exec(name);
if (match) {
suffixes.push(parseInt(match[1], 10));
}
return suffixes;
}, []);
if (existingSuffixes.length === 0) {
return existingNames.includes(baseName) ? `${baseName}1` : baseName;
}
return `${baseName}${Math.max(...existingSuffixes) + 1}`;
}
/**
* 分步处理分数表达式
* @param str 分数表达式
*/
export function safeFractionConvert(str: string | number) {
if (!str) {
return 1;
}
if (typeof str === 'number') {
return str;
}
const parts = str.split('/').map(Number); // 分割分子分母
if (parts.length !== 2 || parts.some((e) => Number.isNaN(e))) return 1;
return parts[0] / parts[1];
}
/**
* 打开网页链接
* @param url 链接地址
*/
export function openDocumentLink(url: string) {
const a = document.createElement('a');
a.href = url;
a.target = '_blank';
a.rel = 'noopener noreferrer'; // 防止打开页面控制当前页面
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
}
/**
* 格式化时间
* @param value 时间戳
* @param type 类型
*/
export function formatTimeValue(value: string | number, type?: FormCreateFieldDateType) {
if (value) {
const date = dayjs(Number(value));
switch (type) {
case 'month':
return date.format('YYYY-MM');
case 'date':
return date.format('YYYY-MM-DD');
case 'datetime':
default:
return date.format('YYYY-MM-DD HH:mm:ss');
}
}
return '-';
}
/**
* 下载文件
* @param byte 字节流
* @param fileName 文件名
*/
export const downloadByteFile = (byte: BlobPart, fileName: string) => {
// 创建一个Blob对象
const blob = new Blob([byte], { type: 'application/octet-stream' });
// 创建一个URL对象用于生成下载链接
const url = window.URL.createObjectURL(blob);
// 创建一个虚拟的<a>标签来触发下载
const link = document.createElement('a');
link.href = url;
link.download = fileName; // 设置下载文件的名称
document.body.appendChild(link);
link.click();
// 释放URL对象
window.URL.revokeObjectURL(url);
document.body.removeChild(link);
};
/**
* 获取每三位使用逗号隔开数字格式
* @param number 目标值
*/
export function addCommasToNumber(number: number) {
if (number === 0 || number === undefined) {
return '0';
}
// 将数字转换为字符串
const numberStr = number.toString();
// 分割整数部分和小数部分
const parts = numberStr.split('.');
const integerPart = parts[0];
const decimalPart = parts[1] || ''; // 如果没有小数部分,则设为空字符串
// 对整数部分添加逗号分隔
const integerWithCommas = integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
// 拼接整数部分和小数部分(如果有)
const result = decimalPart ? `${integerWithCommas}.${decimalPart}` : integerWithCommas;
return result;
}
// 是否是企业微信端打开
export function isWeComBrowser() {
const ua = window.navigator.userAgent.toLowerCase();
return ua.includes('wxwork'); // 企业微信 UA 一定包含 wxwork
}
export function isDingTalkBrowser() {
const ua = window.navigator.userAgent.toLowerCase();
return (
ua.includes('dingtalk') ||
ua.includes('aliapp(dingtalk') ||
(getQueryVariable('authCode') !== '' &&
getQueryVariable('authCode') !== undefined &&
getQueryVariable('authCode') !== null)
);
}
// 飞书
export function isLarkBrowser(): boolean {
const ua = window.navigator.userAgent.toLowerCase();
return ua.includes('lark') || ua.includes('feishu') || getQueryVariable('state') === 'LARK';
}
/**
* 国际单位数字缩写
* @param amount 金额数字
* @param decimals 保留小数位数
* @param currency 货币单位
*/
export function abbreviateNumber(count: number | string, currency: string, decimals = 2) {
if (typeof count !== 'number') {
return { value: '-', unit: '', full: '-' };
}
const locale = localStorage.getItem('CRM-locale') || 'zh-CN';
const truncateNumber = (num: number) => {
const factor = 10 ** decimals;
return Math.round(num * factor) / factor;
};
const full = `${count.toLocaleString('en-US', {
minimumFractionDigits: decimals,
maximumFractionDigits: decimals,
})} (${currency})`;
let value = '';
let unit = '';
if (locale === 'zh-CN') {
if (count >= 1e8) {
value = truncateNumber(count / 1e8).toString();
unit = '亿';
} else if (count >= 1e4) {
value = truncateNumber(count / 1e4).toString();
unit = '万';
} else {
value = truncateNumber(count).toString();
unit = '';
}
} else if (locale === 'en-US') {
if (count >= 1e9) {
value = truncateNumber(count / 1e9).toString();
unit = 'B';
} else if (count >= 1e6) {
value = truncateNumber(count / 1e6).toString();
unit = 'M';
} else if (count >= 1e3) {
value = truncateNumber(count / 1e3).toString();
unit = 'K';
} else {
value = truncateNumber(count).toString();
unit = '';
}
}
return { value, unit, full };
}
export function getFileIconType(type: string) {
switch (type) {
case 'zip':
return 'icona-icon_file-compressed_colorful';
case 'ppt':
return 'iconicon_file-ppt_colorful';
case 'pdf':
return 'iconicon_file-pdf_colorful';
case 'docx':
return 'iconicon_file-word_colorful';
case 'xlsx':
return 'iconicon_file-excel_colorful';
case 'csv':
return 'iconicon_file-CSV_colorful';
case 'xmind':
return 'iconicon_file-xmind_colorful';
case 'sql':
return 'iconicon_file-sql_colorful';
case 'jar':
return 'icona-icon_file-jar_colorful';
case 'json':
return 'icona-icon_file-json';
case 'jmx':
return 'icona-icon_file-JMX';
case 'har':
return 'iconicon_file_har';
case 'mp4':
case 'mov':
case 'wmv':
return 'iconicon_file_video_colorful';
default:
return /(jpg|jpeg|png|gif|bmp|webp|svg)$/i.test(type)
? 'iconicon_file-image_colorful'
: 'iconicon_file-unknown_colorful1';
}
}
/**
* 限制字符串长度并添加后缀(如 copy保证总长度不超过 maxLen
* @param name 原名称
* @param suffix 后缀(默认 "copy"
* @param maxLen 最大长度(默认 255
*/
export function getCopiedName(name: string, suffix = 'copy', maxLen = 255): string {
const baseName = name || '';
if (baseName.length + suffix.length > maxLen) {
return baseName.slice(0, maxLen - suffix.length) + suffix;
}
return baseName + suffix;
}
/**
* 通用数字千分位展示
* @param value 数值或数值字符串
* @param options 小数位配置
* @returns 格式化后的字符串
*/
export function formatThousands(
value: string | number | null | undefined,
options?: {
minimumFractionDigits?: number;
maximumFractionDigits?: number;
}
) {
if (value === null || value === undefined || value === '') {
return '';
}
const numberValue = Number(value);
if (!Number.isFinite(numberValue)) {
return String(value);
}
const decimalLength = String(value).includes('.') ? String(value).split('.')[1]?.length || 0 : 0;
return numberValue.toLocaleString('en-US', {
minimumFractionDigits: options?.minimumFractionDigits,
maximumFractionDigits: options?.maximumFractionDigits ?? decimalLength,
});
}

View File

@@ -0,0 +1,54 @@
const opt = Object.prototype.toString;
export function isArray(obj: any): obj is any[] {
return opt.call(obj) === '[object Array]';
}
export function isObject(obj: any): obj is { [key: string]: any } {
return opt.call(obj) === '[object Object]';
}
export function isString(obj: any): obj is string {
return opt.call(obj) === '[object String]';
}
export function isNumber(obj: any): obj is number {
return opt.call(obj) === '[object Number]' && obj === obj; // eslint-disable-line
}
export function isRegExp(obj: any) {
return opt.call(obj) === '[object RegExp]';
}
export function isFile(obj: any): obj is File {
return opt.call(obj) === '[object File]';
}
export function isBlob(obj: any): obj is Blob {
return opt.call(obj) === '[object Blob]';
}
export function isUndefined(obj: any): obj is undefined {
return obj === undefined;
}
export function isNull(obj: any): obj is null {
return obj === null;
}
export function isFunction(obj: any): obj is (...args: any[]) => any {
return typeof obj === 'function';
}
export function isEmptyObject(obj: any): boolean {
return isObject(obj) && Object.keys(obj).length === 0;
}
export function isExist(obj: any): boolean {
return obj || obj === 0;
}
// 判断变量非空值
export function isNotEmpty(obj: any): boolean {
return obj !== undefined && obj !== null && obj !== '';
}

View File

@@ -0,0 +1,53 @@
export const getLocalStorage = <T = string>(name: string, isJson?: boolean): T | null => {
try {
const value = localStorage.getItem(name);
if (value && isJson) {
return JSON.parse(value) as T;
}
return value as T;
} catch {
return null;
}
};
export const setLocalStorage = (name: string, value: any): void => {
try {
if (typeof value !== 'string') {
value = JSON.stringify(value);
}
localStorage.setItem(name, value);
} catch {
// ignore
}
};
export const removeLocalStorage = (name: string) => {
try {
localStorage.removeItem(name);
} catch {
// ignore
}
};
export const setSessionStorageTempState = (name: string, value: any) => {
try {
if (typeof value !== 'string') {
value = JSON.stringify(value);
}
sessionStorage.setItem(name, value);
} catch {
// ignore
}
};
export const getSessionStorageTempState = <T>(name: string, isJson?: boolean): T | null => {
try {
const value = sessionStorage.getItem(name);
if (value && isJson) {
return JSON.parse(value) as T;
}
return value as T;
} catch {
return null;
}
};

View File

@@ -0,0 +1,39 @@
/**
* 单独监听路由会浪费渲染性能。使用发布订阅模式去进行分发管理。
*/
import mitt, { Handler } from 'mitt';
import type { RouteLocationNormalized } from 'vue-router';
const emitter = mitt();
const key = Symbol('ROUTE_CHANGE');
let latestRoute: RouteLocationNormalized;
/**
* 设置路由监听
* @param to 要跳转的路由信息
*/
export function setRouteEmitter(to: RouteLocationNormalized) {
emitter.emit(key, to);
latestRoute = to;
}
/**
* 监听路由变化
* @param handler 处理回调
* @param immediate 是否立即执行
*/
export function listenerRouteChange(handler: (route: RouteLocationNormalized) => void, immediate = true) {
emitter.on(key, handler as Handler);
if (immediate && latestRoute) {
handler(latestRoute);
}
}
/**
* 移除路由监听
*/
export function removeRouteListener() {
emitter.off(key);
}

View File

@@ -0,0 +1,93 @@
import { setupDrag } from './setupDrag';
import { CompanyTypeEnum } from '@lib/shared/enums/commonEnum';
interface ScriptOptions {
identifier: string; // 脚本标识
}
const scriptElementsMap = new Map<string, string>();
function extractSQLBotId(input: string) {
const regex = /sqlbot-[^\s"']+/;
const match = input.match(regex);
return match ? match[0] : null;
}
export function loadScript(scriptContent: string, options: ScriptOptions): Promise<void> {
if (!scriptContent) {
return Promise.reject(new Error('scriptContent is empty'));
}
return new Promise((resolve, reject) => {
const content = scriptContent?.trim();
if (scriptElementsMap.has(options.identifier)) return;
// 处理IIFE格式
if (content.startsWith('(function')) {
const scriptId = extractSQLBotId(content);
if (scriptId) {
scriptElementsMap.set(options.identifier, scriptId);
}
// eslint-disable-next-line no-eval
eval(content);
setTimeout(() => {
const button = document.querySelector('.sqlbot-assistant-chat-button');
setupDrag(button as HTMLElement);
}, 300); // 等待DOM渲染
resolve();
return;
}
// 处理<script>标签
if (content.startsWith('<script')) {
const div = document.createElement('div');
div.innerHTML = content;
const originalScript = div.querySelector('script');
if (!originalScript) {
reject(new Error('无效的script标签'));
return;
}
const script = document.createElement('script');
// 复制所有属性
for (let i = 0; i < originalScript.attributes.length; i++) {
const attr = originalScript.attributes[i];
if (attr.name === 'id') {
scriptElementsMap.set(options.identifier, attr.value);
}
script.setAttribute(attr.name, attr.value);
}
script.onload = () => {
setTimeout(() => {
const button = document.querySelector('.sqlbot-assistant-chat-button');
setupDrag(button as HTMLElement);
}, 300); // 等待DOM渲染
};
document.body.appendChild(script);
resolve();
return;
}
reject(new Error('不支持的脚本格式'));
});
}
export function removeScript(identifier: string): void {
const scriptId = scriptElementsMap.get(identifier);
if (scriptId && identifier === CompanyTypeEnum.SQLBot) {
// 清理全局单例标记
const propName = `${scriptId}-state`;
delete (window as any)[propName];
if ((window as any).sqlbot_assistant_handler) {
delete (window as any).sqlbot_assistant_handler;
}
// 删除页面上渲染的
const floatingElements = document.querySelectorAll('[id^="sqlbot-"]');
floatingElements.forEach((el) => {
if (el.parentNode && !el.parentNode.isEqualNode(document.body) && !el.parentNode.isEqualNode(document.head)) {
(el.parentNode as Element).remove();
}
el.remove();
});
scriptElementsMap.delete(identifier);
}
}

View File

@@ -0,0 +1,113 @@
interface DragPosition {
startX: number;
startY: number;
startLeft: number;
startTop: number;
}
export function setupDrag(dragElement: HTMLElement | null) {
if (!dragElement) return;
let isDragging = false;
let dragPosition: DragPosition;
const moveHandler = (clientX: number, clientY: number) => {
dragElement.style.cursor = 'grabbing';
// 移动超过5px才认为是拖动
if (!isDragging && (Math.abs(clientX - dragPosition.startX) > 5 || Math.abs(clientY - dragPosition.startY) > 5)) {
isDragging = true;
}
if (isDragging) {
// 计算新位置
const newLeft = dragPosition.startLeft + clientX - dragPosition.startX;
const newTop = dragPosition.startTop + clientY - dragPosition.startY;
// 边界检查(可选) - 确保元素不会移出视口
const maxX = window.innerWidth - dragElement.offsetWidth;
const maxY = window.innerHeight - dragElement.offsetHeight;
// 设置新位置(限制在边界内)
dragElement.style.left = `${Math.max(0, Math.min(newLeft, maxX))}px`;
dragElement.style.top = `${Math.max(0, Math.min(newTop, maxY))}px`;
dragElement.style.right = 'auto';
dragElement.style.bottom = 'auto';
}
};
// 鼠标/触摸移动处理
const move = (e: MouseEvent | TouchEvent) => {
e.preventDefault();
if (e instanceof MouseEvent) {
moveHandler(e.clientX, e.clientY);
} else if (e.touches?.[0]) {
moveHandler(e.touches[0].clientX, e.touches[0].clientY);
}
};
// 停止拖动
const stopDrag = () => {
document.removeEventListener('mousemove', move);
document.removeEventListener('touchmove', move);
document.removeEventListener('mouseup', stopDrag);
document.removeEventListener('touchend', stopDrag);
dragElement.style.cursor = 'pointer';
// 如果是拖拽操作(不是点击),则阻止接下来的点击事件
if (isDragging) {
const clickHandler = (e: Event) => {
e.stopImmediatePropagation();
e.preventDefault();
dragElement.removeEventListener('click', clickHandler);
};
dragElement.addEventListener('click', clickHandler, true);
// 300ms后移除点击拦截
setTimeout(() => {
dragElement.removeEventListener('click', clickHandler, true);
}, 300);
}
};
// 开始拖动 - 鼠标事件
const startMouseDrag = (e: MouseEvent) => {
isDragging = false;
const style = window.getComputedStyle(dragElement);
dragPosition = {
startX: e.clientX,
startY: e.clientY,
startLeft: parseInt(style.left, 10) || 0,
startTop: parseInt(style.top, 10) || 0,
};
// 添加移动和松开事件
document.addEventListener('mousemove', move);
document.addEventListener('mouseup', stopDrag);
};
// 开始拖动 - 触摸事件
const startTouchDrag = (e: TouchEvent) => {
isDragging = false;
if (e.touches[0]) {
const style = window.getComputedStyle(dragElement);
dragPosition = {
startX: e.touches[0].clientX,
startY: e.touches[0].clientY,
startLeft: parseInt(style.left, 10) || 0,
startTop: parseInt(style.top, 10) || 0,
};
document.addEventListener('touchmove', move, { passive: false });
document.addEventListener('touchend', stopDrag);
}
};
// 添加事件监听
dragElement.addEventListener('mousedown', startMouseDrag);
dragElement.addEventListener('touchstart', startTouchDrag, { passive: false });
}
export default {};

View File

@@ -0,0 +1,81 @@
// 邮箱校验
export const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
// 手机号校验11位
export const phoneRegex = /^\d{11}$/;
// 密码校验8-32位
export const passwordLengthRegex = /^.{8,32}$/;
// 密码校验,必须包含数字和字母,特殊符号范围校验
export const passwordWordRegex = /^(?=.*\d)(?=.*[a-zA-Z])[0-9a-zA-Z!@#$%^&*()_+.]+$/;
// Git地址校验
export const gitRepositoryUrlRegex = /\.git$/;
// Webhook 地址校验,允许 HTTP / HTTPS
export const httpUrlRegex = /^https?:\/\/[^\s/$.?#].[^\s]*$/i;
/**
* 校验邮箱
* @param email 邮箱
* @returns boolean
*/
export function validateEmail(email: string): boolean {
return emailRegex.test(email);
}
/**
* 校验手机号
* @param phone 手机号
* @returns boolean
*/
export function validatePhone(phone: string): boolean {
return phoneRegex.test(phone);
}
/**
* 校验密码长度
* @param password 密码
* @returns boolean
*/
export function validatePasswordLength(password: string): boolean {
return passwordLengthRegex.test(password);
}
/**
* 校验密码组成
* @param password 密码
* @returns boolean
*/
export function validateWordPassword(password: string): boolean {
return passwordWordRegex.test(password);
}
/**
* 校验密码
* @param password 密码
* @returns boolean
*/
export function validatePassword(password: string): boolean {
return validatePasswordLength(password) && validateWordPassword(password);
}
/**
* 校验 HTTP / HTTPS 地址
* @param url 地址
* @returns boolean
*/
export function validateHttpUrl(url: string): boolean {
return httpUrlRegex.test(url.trim());
}
export function getPatternByAreaCode(code: string): RegExp | null {
switch (code) {
case '+86': // 中国大陆
return /^\d{10,12}$/;
case '+852': // 香港
return /^\d{8}$/;
case '+853': // 澳门
return /^\d{8}$/;
case '+886': // 台湾
return /^\d{8,11}$/;
default: // 其他
return /^\d+$/;
}
}

View File

@@ -0,0 +1,73 @@
import type { TableQueryParams } from './common';
export interface AgentModuleRenameParams {
id: string;
name: string;
}
export interface AgentRenameParams {
id: string;
name: string;
agentModuleId: string;
}
export interface AddAgentModuleParams {
name: string;
parentId: string;
}
export interface AgentModuleTreeNode {
id: string;
name: string;
parentId: string;
organizationId: string;
children: AgentModuleTreeNode[];
}
export interface AddAgentParams {
name: string;
agentModuleId: string;
scopeIds: string[];
script: string;
type: string; // 添加方式
workspaceId: string; // 工作空间
applicationId: string; // 对应工作空间应用id
description: string;
}
export interface UpdateAgentParams extends AddAgentParams {
id: string;
}
export interface AgentTableQueryParams extends TableQueryParams {
agentModuleIds: string[];
}
export interface AgentMember {
id: string;
scope: string;
name: string;
}
export interface AgentDetail {
id: string;
name: string;
agentModuleId: string;
agentModuleName: string;
scopeId: string;
members: AgentMember[];
script: string;
description: string;
}
export type ApplicationScriptParams = Pick<AddAgentParams, 'applicationId' | 'workspaceId'>;
export interface AgentApplicationScript {
parameters: { parameter: string; value: string }[];
src: string;
}
export interface AgentPosParams {
moveId: string;
targetId: string;
moveMode: 'BEFORE' | 'AFTER';
}

View File

@@ -0,0 +1,89 @@
import type { CustomerSearchTypeEnum } from '../../enums/customerEnum';
import type { ModuleField, TableQueryParams } from '../common';
import type { SaveCustomerParams } from '@lib/shared/models/customer';
export interface SaveClueParams extends SaveCustomerParams {
contact?: string;
phone?: string;
}
export interface UpdateClueParams extends SaveClueParams {
id: string;
}
export interface ClueTransitionCustomerParams extends SaveCustomerParams {
clueId: string;
}
export interface ClueDetail {
id: string;
name: string;
owner: string;
ownerName: string;
contact: string;
phone: string;
departmentId: string;
departmentName: string;
stage: string;
lastStage: string;
createUser: string;
updateUser: string;
createTime: number;
updateTime: number;
createUserName: string;
updateUserName: string;
moduleFields: ModuleField[];
transitionType?: 'CUSTOMER' | 'OPPORTUNITY';
}
export interface ClueListItem extends ClueDetail {
inSharedPool: boolean;
latestFollowUpTime: number;
collectionTime: number;
reservedDays: number;
reasonName?: string;
hasPermission?: boolean;
}
export interface CluePoolTableParams extends TableQueryParams {
searchType?: CustomerSearchTypeEnum;
poolId?: string;
}
// 线索池线索列表项
export interface CluePoolListItem extends ClueListItem {
follower: string; // 最新跟进人
followerName: string; // 最新跟进人名称
followTime: number; // 最新跟进日期
poolId: string;
recyclePoolName: string; // 默认回收公海名称
}
export interface PickClueParams {
clueId: string;
poolId: string;
}
// 批量领取线索的请求参数
export interface BatchPickClueParams {
batchIds: (string | number)[];
poolId: string;
}
// 分配线索的请求参数
export interface AssignClueParams {
clueId: string;
assignUserId: string;
}
// 批量分配线索的请求参数
export interface BatchAssignClueParams {
batchIds: (string | number)[];
assignUserId: string;
}
export interface ConvertClueParams {
clueId: string;
oppCreated: boolean;
oppName: string;
}

View File

@@ -0,0 +1,123 @@
import type { FilterResult } from '@cordys/web/src/components/pure/crm-advance-filter/type';
import { ColumnTypeEnum, OperatorEnum } from '@lib/shared/enums/commonEnum';
// 请求返回结构
export default interface CommonResponse<T> {
code: number;
message: string;
messageDetail: string;
data: T;
}
export interface SortParams {
name?: string;
type?: string; // asc或desc
}
// 表格查询
export interface TableQueryParams {
// 当前页
current?: number;
// 每页条数
pageSize?: number;
// 排序仅针对单个字段
sort?: SortParams;
// 表头筛选
filter?: object;
// 查询条件
keyword?: string;
// 视图ID
viewId?: string;
filterCondition?: FilterResult;
[key: string]: any;
}
export interface CommonList<T> {
[x: string]: any;
pageSize: number;
total: number;
current: number;
list: T[];
optionMap?: Record<string, any[]>;
}
export interface FilterConditionItem {
name: string;
value: any; // 期望值,若操作符为 BETWEEN, IN, NOT_IN 时为数组,其他操作符为单个值
operator: OperatorEnum;
multipleValue?: boolean;
}
export interface ExportTableColumnItem {
key: string;
title: string;
columnType: ColumnTypeEnum;
}
export interface TableExportParams extends TableQueryParams {
fileName: string; // 导出文件名
headList: ExportTableColumnItem[]; // 导出表头
}
export interface TableExportSelectedParams {
fileName: string;
headList: ExportTableColumnItem[];
ids: string[];
}
export interface TableDraggedParams {
moveId: string;
moveMode: 'BEFORE' | 'AFTER';
orgId: string;
targetId: string;
oldIndex: number;
newIndex: number;
}
export interface SystemVersion {
currentVersion: string; // 当前版本
releaseDate: string; // 发行日期
latestVersion: string; // 最新版本
architecture: string; // 系统架构
copyright: string; // 版权信息
hasNewVersion: boolean; // 是否有新版本
}
export interface ModuleDragParams {
dragNodeId: string;
dropNodeId: string;
dropPosition: number;
}
export interface ChartValueAxis {
fieldId: string;
aggregateMethod: string;
}
export interface ChartCategoryAxis {
fieldId: string;
}
export interface ChartConfig {
chatType: string; // TODO:chart
categoryAxis: ChartCategoryAxis;
subCategoryAxis?: ChartCategoryAxis;
valueAxis: ChartValueAxis;
}
export interface GenerateChartParams extends TableQueryParams {
chartConfig: ChartConfig;
poolId?: string | number;
}
export interface ChartResponseDataItem {
categoryAxis: string; // 类目 id
categoryAxisName: string; // 类目名称
subCategoryAxis: string; // 子类目 id
subCategoryAxisName: string; // 子类目名称
valueAxis: string; // 值
}
export interface ModuleField {
fieldId: string;
fieldValue: string | string[];
}

View File

@@ -0,0 +1,255 @@
import { AttachmentInfo } from '@cordys/web/src/components/business/crm-form-create/types';
import { ContractBusinessTitleStatusEnum } from '@lib/shared/enums/contractEnum';
import type { ModuleField, TableQueryParams } from './common';
import type { FormDesignConfigDetailParams } from './system/module';
import { ProcessStatusEnum } from '@lib/shared/enums/process';
// 合同列表项
export interface ContractItem {
id: string;
name: string;
customerId: string;
customerName: string;
amount: number;
alreadyPayAmount: number;
approved?: boolean;
approvalStatus: ProcessStatusEnum;
stage: string;
stageName: string;
owner: string;
ownerName: string;
createUser: string;
updateUser: string;
createTime: number;
updateTime: number;
createUserName: string;
updateUserName: string;
moduleFields: ModuleField[]; // 自定义字段
inCustomerPool: boolean;
poolId: string;
}
// 合同详情
export interface ContractDetail extends ContractItem {
optionMap?: Record<string, any[]>;
attachmentMap?: Record<string, AttachmentInfo[]>; // 附件信息映射
}
// 添加合同参数
export interface SaveContractParams {
name: string;
customerId: string; // 客户id
amount?: number; // 金额
owner: string; // 负责人
moduleFields: ModuleField[]; // 自定义字段
}
// 更新合同参数
export interface UpdateContractParams extends SaveContractParams {
id: string;
}
export interface ApprovalContractParams {
id: string;
approvalStatus: string;
}
// 回款计划列表项
export interface PaymentPlanItem {
id: string;
name: string;
createUser: string;
updateUser: string;
createTime: number;
updateTime: number;
contractId: string;
owner: string;
planStatus: string;
planAmount: number;
planEndTime: number;
organizationId: string;
createUserName: string;
updateUserName: string;
ownerName: string;
departmentId: string;
departmentName: string;
contractName: string;
moduleFields: ModuleField[]; // 自定义字段
}
// 回款计划详情
export interface PaymentPlanDetail extends PaymentPlanItem {
optionMap?: Record<string, any[]>;
}
// 添加回款计划参数
export interface SavePaymentPlanParams {
contractId?: string;
owner?: string;
planStatus: string;
planAmount?: number;
planEndTime?: number;
}
// 更新回款计划参数
export interface UpdatePaymentPlanParams extends SavePaymentPlanParams {
id: string;
}
// 回款记录列表项
export interface PaymentRecordItem {
id: string;
createUser: string;
updateUser: string;
createTime: number;
updateTime: number;
name: string;
contractId: string;
owner: string;
amount: number;
invoiceType: string;
taxRate: number;
businessTitleId: string;
approvalStatus: string;
organizationId: string;
contractName: string;
ownerName: string;
createUserName: string;
updateUserName: string;
paymentPlanName: string;
paymentPlanId: string;
departmentId: string;
departmentName: string;
moduleFields: ModuleField[];
}
// 回款记录详情
export interface PaymentRecordDetail extends PaymentRecordItem {
optionMap?: Record<string, any[]>;
}
// 添加回款记录参数
export interface SavePaymentRecordParams {
contractId: string;
owner: string;
name: string;
paymentPlanId?: string;
recordAmount: number;
recordEndTime: number;
recordBank: string;
recordBankNo: string;
}
// 更新回款记录参数
export interface UpdatePaymentRecordParams extends SavePaymentRecordParams {
id: string;
}
export interface BusinessTitleItem {
id: string;
name: string;
type: 'THIRD_PARTY' | 'CUSTOM';
identificationNumber: string;
province: string; // 省
city: string; // 市
remark: string;
scale: string; // 企业规模
industry: string; // 国标行业
openingBank: string;
bankAccount: string;
registrationAddress: string;
phoneNumber: string;
registeredCapital: string;
companySize: string;
registrationNumber: string;
approvalStatus: ContractBusinessTitleStatusEnum;
unapprovedReason: string;
organizationId: string;
createUserName: string;
updateUserName: string;
createUser: string;
updateUser: string;
createTime: number;
updateTime: number;
}
export interface SaveBusinessTitleParams {
id?: string;
companyNumber?: string; // 公司编号
name: string; // 公司名称
identificationNumber: string; // 纳税人识别号
openingBank: string; // 开户银行
bankAccount: string; // 银行账号
registrationAddress: string; // 注册地址
phoneNumber: string; // 注册电话
registeredCapital: string; // 注册资本
companySize: string; // 公司规模
registrationNumber: string; //工商注册号
type: string; // 来源类型
province: string; // 省
city: string; // 市
remark: string;
scale: string; // 企业规模
industry: string; // 国标行业
}
export interface BusinessTitleValidateConfig {
id: string;
field: keyof SaveBusinessTitleParams;
title: string;
required: boolean;
disabled?: boolean;
organizationId: string;
rule?: Record<string, any>[];
}
export interface ContractInvoiceTableQueryParam extends TableQueryParams {
contractId?: string;
customerId?: string;
}
export interface ContractInvoiceItem {
id: string;
contractId: string;
approved?: boolean;
name: string;
no: string;
owner: string;
businessTitleId: string;
businessTitleName: string;
organizationId: string;
createUser: string;
createUserName: string;
updateUser: string;
updateUserName: string;
ownerName: string;
departmentId: string;
departmentName: string;
contractName: string;
paymentPlanId: string;
recordBank: string;
recordBankNo: string;
paymentPlanName: string;
planName: string;
moduleFields: ModuleField[]; // 自定义字段
recordAmount: number;
recordEndTime: number;
approvalStatus: ProcessStatusEnum;
}
export interface SaveContractInvoiceParams {
name: string;
contractId: string;
owner: string;
amount: number;
invoiceType: string;
taxRate: number;
businessTitleId: string;
moduleFormConfigDTO?: FormDesignConfigDetailParams;
}
export interface UpdateContractInvoiceParams extends SaveContractInvoiceParams {
id: string;
}
export interface ContractInvoiceDetail extends ContractInvoiceItem {
optionMap?: Record<string, any[]>;
attachmentMap?: Record<string, AttachmentInfo[]>; // 附件信息映射
}

View File

@@ -0,0 +1,114 @@
import type { FormCreateField } from '@cordys/web/src/components/business/crm-form-create/types';
import type { FormConfig } from '@lib/shared/models/system/module';
import type { RoleMemberRoleItem } from '@lib/shared/models/system/role';
import type { ModuleField, TableQueryParams } from '@lib/shared/models/common';
import type { SelectedUsersItem } from '@lib/shared/models/system/module';
export interface CustomFormSaveRequest {
id?: string;
name: string;
enable: boolean;
fields: FormCreateField[];
formProp: FormConfig;
}
export interface CustomFormDetail extends CustomFormSaveRequest {
id: string;
creator: SelectedUsersItem;
}
export interface CustomFormAdminParams {
customFormId: string;
userIds: string[];
}
export interface CustomFormRoleItem {
id: string;
name: string;
customFormId: string;
internalKey: string;
}
export interface CustomFormRoleUserQueryParams extends TableQueryParams {
customFormRoleId: string;
}
export interface RelateCustomFormMemberParams {
customFormRoleId: string;
deptIds?: string[];
roleIds?: string[];
userIds?: string[];
}
export interface CustomFormMemberItem {
id: string;
userId: string;
username: string;
departmentId: string;
departmentName: string;
position: string;
createTime: number;
roles: RoleMemberRoleItem[];
}
export interface CustomFormItem {
id: string;
name: string;
enable: boolean;
isAdmin: boolean;
hasCreateDataPermission: boolean;
}
export interface AddCustomFormDataParams {
customFormId: string;
name: string;
owner: string;
moduleFields: ModuleField[];
}
export interface UpdateCustomFormDataParams extends AddCustomFormDataParams {
id: string;
}
export interface GetCustomFormDataPageParams extends TableQueryParams {
customFormId: string;
}
export interface CustomFormPageItem {
id: string;
customFormId: string;
name: string;
owner: string;
ownerName: string;
createUser: string;
updateUser: string;
createTime: number;
updateTime: number;
createUserName: string;
updateUserName: string;
moduleFields: ModuleField[];
isAdmin: boolean;
}
export interface BatchUpdateCustomFormDataParams {
ids: string[];
customFormId: string;
name: string;
owner: string;
moduleFields: ModuleField[];
}
export interface CustomFormDataDetail {
id: string;
customFormId: string;
name: string;
owner: string;
ownerName: string;
createUser: string;
updateUser: string;
createTime: number;
updateTime: number;
createUserName: string;
updateUserName: string;
moduleFields: ModuleField[];
optionMap: Record<string, any>;
}

View File

@@ -0,0 +1,393 @@
import type { CustomerFollowPlanStatusEnum, CustomerSearchTypeEnum } from '../../enums/customerEnum';
import type { ModuleField, TableExportParams, TableQueryParams } from '../common';
export interface SaveCustomerParams {
name?: string;
owner: string; // 负责人
moduleFields?: ModuleField[];
}
export interface UpdateCustomerParams extends SaveCustomerParams {
id: string;
}
export interface CustomerTableParams extends TableQueryParams {
viewId: CustomerSearchTypeEnum; // 搜索类型(ALL/SELF/DEPARTMENT/CUSTOMER_COLLABORATION)
}
export interface CustomerListItem {
id: string;
name: string;
owner: string; // 负责人
inSharedPool: boolean; // 是否在公海池
dealStatus: string; // 最终成交状态
createUser: string;
updateUser: string;
createTime: number;
updateTime: number;
createUserName: string;
updateUserName: string;
departmentId: string;
departmentName: string;
latestFollowUpTime: number;
collectionTime: number;
reservedDays: number; // 剩余归属天数
moduleFields: ModuleField[];
}
export interface CustomerDetail {
id: string;
name: string;
owner: string;
createUser: string;
updateUser: string;
createTime: number;
updateTime: number;
createUserName: string;
updateUserName: string;
moduleFields: ModuleField[];
}
export interface SaveCustomerFollowRecordParams {
customerId: string;
opportunityId: string;
type: string;
clueId: string;
content: string;
owner: string;
contactId: string;
moduleFields: ModuleField[];
}
export interface UpdateCustomerFollowRecordParams extends SaveCustomerFollowRecordParams {
id: string;
}
export interface CustomerFollowRecordTableParams extends TableQueryParams {
sourceId: string; // 客户ID/商机ID/线索ID
}
export interface CustomerOpportunityTableParams extends TableQueryParams {
customerId: string; // 客户ID
}
export interface CustomerFollowRecordListItem {
id: string;
customerId: string;
customerName: string;
opportunityId: string;
type: string;
clueId: string;
clueName: string;
content: string; // 跟进内容
organizationId: string;
owner: string;
ownerName: string;
contactId: string;
contactName: string;
createUser: string;
createUserName: string;
updateUser: string;
updateUserName: string;
createTime: number;
updateTime: number;
followTime: number;
followMethod: string;
departmentId: string;
departmentName: string;
poolId: string;
moduleFields: ModuleField[];
}
export interface SaveCustomerFollowPlanParams extends SaveCustomerFollowRecordParams {
estimatedTime: number;
}
export interface UpdateCustomerFollowPlanParams extends SaveCustomerFollowPlanParams {
id: string;
}
export type StatusTagKey = Exclude<CustomerFollowPlanStatusEnum, CustomerFollowPlanStatusEnum.ALL>;
export interface CustomerFollowPlanTableParams extends TableQueryParams {
sourceId: string; // 客户ID/商机ID/线索ID
status: StatusTagKey; // 状态: ALL/PREPARED/UNDERWAY/COMPLETED/CANCELLED
myPlan?: boolean; // 个人中心查询时传入true
}
export interface CustomerFollowPlanListItem extends CustomerFollowRecordListItem {
estimatedTime: number;
status: StatusTagKey;
method: string;
converted: boolean;
}
export interface SaveCustomerContractParams {
customerId: string;
name: string;
owner: string;
enable: boolean;
moduleFields: ModuleField[];
}
export interface UpdateCustomerContractParams extends SaveCustomerContractParams {
id: string;
}
export interface CustomerContractTableParams extends TableQueryParams {
sourceId: string; // 客户ID
searchType?: CustomerSearchTypeEnum;
}
export interface CustomerContractListItem {
id: string;
createUser: string;
updateUser: string;
createTime: number;
updateTime: number;
customerId: string;
owner: string;
ownerName: string;
name: string;
enable: boolean; // 是否启用
disableReason: string; // 停用原因
organizationId: string;
departmentId: string;
departmentName: string;
customerName: string;
createUserName: string;
updateUserName: string;
moduleFields: ModuleField[];
phone: string; // 联系电话
}
export interface Condition {
column: string;
operator: string;
value: string;
}
export interface RecycleRule {
operator: string; // 操作符
conditions: Condition[]; // 规则条件集合
}
export interface PickRule {
limitOnNumber: boolean; // 是否限制每日领取数量
pickNumber: number; // 领取数量
limitPreOwner: boolean; // 是否限制前归属人领取
pickIntervalDays: number; // 领取间隔天数
}
export interface SaveCustomerOpenSeaParams {
name: string;
scopeIds: string[]; // 范围ID集合
ownerIds: string[]; // 管理员ID集合
enable: boolean;
auto: boolean; // 是否自动回收
pickRule: PickRule; // 领取规则
recycleRule: RecycleRule; // 回收规则
}
export interface UpdateCustomerOpenSeaParams extends SaveCustomerOpenSeaParams {
id: string;
}
export interface Member {
id: string;
scope: string;
name: string;
}
export interface CustomerOpenSeaListItem {
id: string;
createUser: string;
updateUser: string;
createTime: number;
updateTime: number;
organizationId: string;
name: string;
scopeId: string;
ownerId: string;
enable: boolean;
auto: boolean;
members: Member[];
owners: Member[];
createUserName: string;
updateUserName: string;
pickRule: PickRule;
recycleRule: RecycleRule;
}
export type FollowDetailItemType<T> = T;
// 跟进详情(跟进记录|跟进计划)
export type FollowDetailItem = FollowDetailItemType<CustomerFollowRecordListItem | CustomerFollowPlanListItem>;
export interface TransferParams {
ids?: (string | number)[];
owner: string | null; // 负责人
[key: string]: any;
}
export interface PickOpenSeaCustomerParams {
customerId: string;
poolId: string | number;
}
export interface BatchOperationOpenSeaCustomerParams {
batchIds: (string | number)[];
poolId?: string | number;
}
export interface BatchAssignOpenSeaCustomerParams extends BatchOperationOpenSeaCustomerParams {
assignUserId: string;
}
export interface AssignOpenSeaCustomerParams {
customerId: string;
assignUserId: string;
}
export interface OpenSeaCustomerTableParams extends TableQueryParams {
poolId: string;
}
export interface HeaderHistoryItem {
id: string;
customerId: string; // 客户id
owner: string; // 责任人
collectionTime: number; // 领取时间
endTime: number; // 结束时间
operator: string; // 操作人
operatorName: string; // 操作人名称
ownerName: string; // 责任人名称
departmentId: string;
departmentName: string;
}
export type RelationType = 'GROUP' | 'SUBSIDIARY';
export interface RelationItem {
customerId: string | number;
relationType: RelationType;
}
export interface RelationListItem extends RelationItem {
id: string | number;
customerName: string;
}
export type CollaborationType = 'READ_ONLY' | 'COLLABORATION';
export interface UpdateCustomerCollaborationParams {
id: string;
collaborationType: CollaborationType;
}
export interface AddCustomerCollaborationParams {
customerId: string;
userId: string;
collaborationType: CollaborationType;
}
export interface CollaborationItem {
id: string;
createUser: string;
updateUser: string;
createTime: number;
updateTime: number;
userId: string;
customerId: string;
collaborationType: CollaborationType;
userName: string;
createUserName: string;
updateUserName: string;
departmentId: string;
departmentName: string;
}
export interface AddCustomerRelationItemParams {
customerId: string;
relationType: string;
}
export interface UpdateCustomerRelationItemParams extends AddCustomerRelationItemParams {
id: string;
}
export interface CustomerOptionsItem {
id: string | number;
name: string;
editable: boolean; // 是否可编辑
}
export interface CustomerTabHidden {
all: boolean; // 是否显示所有数据tab
dept: boolean; // 是否显示部门数据tab
}
export interface UpdateFollowPlanStatusParams {
id: string;
status: StatusTagKey;
}
export interface MoveToPublicPoolParams {
id: string | number;
reasonId?: string | null;
}
export interface BatchMoveToPublicPoolParams {
ids: (string | number)[];
reasonId?: string | null;
}
export interface PoolTableExportParams extends TableExportParams {
poolId?: string;
}
export interface BatchUpdatePoolAccountParams {
ids: (string | number)[];
fieldId: string | null;
fieldValue: any;
}
export interface MergeAccountParams {
mergeIds: string[]; // 合并客户ids
toMergeId: string | null; // 合并目标客户id
ownerId: string | null;
}
export interface CustomerInvoiceStatistic {
contractAmount: number;
uninvoicedAmount: number;
invoicedAmount: number;
}
export interface CustomerInvoiceItem {
id: string;
createUser: string;
updateUser: string;
createTime: number;
updateTime: number;
name: string;
contractId: string;
owner: string;
amount: number;
invoiceType: string;
taxRate: number;
businessTitleId: string;
approvalStatus: string;
organizationId: string;
contractName: string;
ownerName: string;
createUserName: string;
updateUserName: string;
departmentId: string;
departmentName: string;
businessTitleName: string;
moduleFields: ModuleField[];
}
export interface CustomerInvoicePageQueryParams extends TableQueryParams {
customerId: string;
}

View File

@@ -0,0 +1,76 @@
import type { TableQueryParams } from './common';
import type { SelectedUsersItem } from './system/module';
import type { CrmTreeNodeData } from '@cordys/web/src/components/pure/crm-tree/type';
export interface DashboardModuleRenameParams {
id: string;
name: string;
}
export interface DashboardAddModuleParams {
parentId: string;
name: string;
}
export interface DashboardAddParams {
dashboardModuleId: string;
resourceUrl: string;
scopeIds: string[];
name: string;
description: string;
}
export interface DashboardUpdateParams extends DashboardAddParams {
id: string;
}
export interface DashboardRenameParams {
dashboardModuleId: string;
id: string;
name: string;
}
export interface DashboardTableItem {
id: string;
createUser: string;
updateUser: string;
createTime: number;
updateTime: number;
name: string;
resourceUrl: string;
dashboardModuleId: string;
organizationId: string;
pos: number;
scopeId: string;
description: string;
}
export interface DashboardTableQueryParams extends TableQueryParams {
dashboardModuleIds: string[];
}
export type DashboardModuleTreeItem = CrmTreeNodeData<{ type: 'MODULE' | 'DASHBOARD'; myCollect: boolean }>;
export interface DashboardDetail {
dashboardModuleId: string;
members: SelectedUsersItem[];
id: string;
description: string;
dashboardModuleName: string;
name: string;
scopeId: string;
resourceUrl: string;
}
export interface DashboardDragParams {
moveId: string;
targetId: string;
dashboardModuleId: string;
moveMode: string;
}
export interface DashboardModuleDragParams {
dragNodeId: string;
dropNodeId: string;
dropPosition: number;
}

View File

@@ -0,0 +1,42 @@
export interface GetHomeStatisticParams {
searchType: string;
deptIds: string[];
userField?: string;
timeField?: string;
winOrderTimeField?: string; // 赢单维度字段
priorPeriodEnable?: boolean;
}
export interface DimPeriodValue {
value: number;
priorPeriodCompareRate: number;
}
// 跟进商机
export interface FollowOptStatisticDetail {
todayOpportunity: DimPeriodValue;
thisWeekOpportunity: DimPeriodValue;
thisMonthOpportunity: DimPeriodValue;
thisYearOpportunity: DimPeriodValue;
thisYearOpportunityAmount: DimPeriodValue;
thisMonthOpportunityAmount: DimPeriodValue;
thisWeekOpportunityAmount: DimPeriodValue;
todayOpportunityAmount: DimPeriodValue;
}
// 线索统计
export interface HomeLeadStatisticDetail {
thisYearClue: DimPeriodValue;
thisMonthClue: DimPeriodValue;
thisWeekClue: DimPeriodValue;
todayClue: DimPeriodValue;
}
// 赢单统计
export interface HomeWinOrderDetail {
thisYearOpportunity: DimPeriodValue;
thisMonthOpportunity: DimPeriodValue;
thisWeekOpportunity: DimPeriodValue;
todayOpportunity: DimPeriodValue;
thisYearOpportunityAmount: DimPeriodValue;
thisMonthOpportunityAmount: DimPeriodValue;
thisWeekOpportunityAmount: DimPeriodValue;
todayOpportunityAmount: DimPeriodValue;
}

View File

@@ -0,0 +1,221 @@
import type { ModuleField, TableQueryParams } from './common';
import type { FormDesignConfigDetailParams } from '@lib/shared/models/system/module';
import { ProcessStatusEnum } from '@lib/shared/enums/process';
import type { CirculationTypeEnum, CirculationValueTypeEnum } from '@lib/shared/enums/opportunityEnum';
import type { FormCreateField } from '@cordys/web/src/components/business/crm-form-create/types';
export interface OpportunityItem {
id: string; // 商机ID
name: string;
status: string;
opportunityName: string; // 商机名称
customerId: string;
customerName: string; // 客户名称
createUser: string; // 创建人ID
updateUser: string; // 更新人ID
createTime: number; // 创建时间
updateTime: number; // 更新时间
createUserName: string; // 创建人名称
updateUserName: string; // 更新人名称
reservedDays: number; // 归属天数
stage: string;
stageName: string;
lastStage: string;
inCustomerPool: boolean;
poolId?: string;
failureReason: string;
hasPermission?: boolean;
moduleFields: ModuleField[]; // 自定义字段
amount: number; // 金额
}
export interface SaveOpportunityParams {
name: string;
customerId: string; // 客户id
amount: number; // 金额
products: string[]; // 意向产品
possible: number; // 可能性
contactId: string; // 联系人ID
owner: string; // 负责人
moduleFields: ModuleField[]; // 自定义字段
}
export interface UpdateOpportunityParams extends SaveOpportunityParams {
id: string;
}
export interface OpportunityDetail extends OpportunityItem {
id: string;
name: string;
amount: number;
possible: number;
products: string[];
contactId: string;
contactName: string;
stage: string; // 当前阶段
status: string;
owner: string;
ownerName: string;
lastStage: string; // 上一个阶段
}
export interface UpdateStageParams {
id: string;
stage: string;
// expectedEndTime?: number; // 预计结束时间
failureReason?: string | null; // 失败原因
voidReason?: string;
fields?: ModuleField[];
}
export interface StageBoardPageQueryParams extends TableQueryParams {
board?: boolean; // 是否是看板模式
}
export interface StageBoardDraggedParams {
dragNodeId: string;
dropNodeId: string;
dropPosition: number;
stage: string;
}
export interface UpdateStageBaseParams {
id: string;
name: string;
}
export interface UpdateOpportunityStageParams {
rate: string;
}
export interface UpdateOpportunityStageRollbackParams {
afootRollBack: boolean;
endRollBack: boolean;
}
export interface StageBaseParams {
name: string;
type: 'AFOOT' | 'END';
dropPosition: number;
targetId: string;
}
export interface AddOpportunityStageParams extends StageBaseParams {
rate: string;
}
export interface StageConfigBaseItem {
id: string;
createUser: string;
updateUser: string;
createTime: number;
updateTime: number;
name: string;
type: 'AFOOT' | 'END';
afootRollBack: boolean;
endRollBack: boolean;
pos: number;
organizationId: string;
}
export interface StageConfigItem extends StageConfigBaseItem {
rate: string;
}
export interface OpportunityStageConfig {
stageConfigList: StageConfigItem[];
afootRollBack: boolean;
endRollBack: boolean;
stageHasData: boolean;
circulationType: CirculationTypeEnum;
advancedConfigs: CirculationSetting[];
}
export interface QuotationQueryParams extends TableQueryParams {
board?: boolean; // 是否是看板模式
}
export interface QuotationItem {
id: string;
name: string;
approved?: boolean;
approvalStatus: ProcessStatusEnum;
invalid: boolean;
opportunityId: string;
opportunityName: string;
amount: number;
createUser: string;
updateUser: string;
createTime: number;
updateTime: number;
createUserName: string;
updateUserName: string;
moduleFields: ModuleField[];
products?: any[];
}
export interface SaveQuotationParams {
name: string;
opportunityId: string;
amount: number;
moduleFields: ModuleField[]; // 自定义字段
moduleFormConfigDTO?: FormDesignConfigDetailParams;
}
export interface UpdateQuotationParams extends SaveQuotationParams {
id: string;
approvalStatus: ProcessStatusEnum;
}
export interface ApproveQuotation {
id: string;
name: string;
opportunityId: string;
approvalStatus: ProcessStatusEnum;
moduleFormConfigDTO?: FormDesignConfigDetailParams;
moduleFields: ModuleField[];
products: any[];
}
export interface BatchUpdateQuotationStatusParams {
ids: (string | number)[];
approvalStatus: ProcessStatusEnum;
}
export interface BatchVoidQuotationStatusParams {
ids: (string | number)[];
}
export interface BatchOperationResult {
success: number;
fail: number;
skip?: number;
errorMessages?: string;
}
export interface CirculationFieldValueItem {
fieldId?: string;
fieldValue: any;
required: boolean;
valueType: CirculationValueTypeEnum;
// 前端渲染使用
fieldProps?: FormCreateField;
}
export interface CirculationFieldTargetItem {
targetId: string;
enable: boolean;
circulationFieldValues: CirculationFieldValueItem[];
}
export interface CirculationSetting {
originId: string;
targets: CirculationFieldTargetItem[];
moduleType: string;
// 前端渲染使用
name?: string;
type?: 'AFOOT' | 'END' | string;
}
export interface SaveCirculationConfigParams {
circulationType: CirculationTypeEnum;
circulationSettings: CirculationSetting[];
}

View File

@@ -0,0 +1,47 @@
import type { ModuleField } from './common';
import type { FormDesignConfigDetailParams } from '@lib/shared/models/system/module';
import { ProcessStatusEnum } from '@lib/shared/enums/process';
export interface SaveOrderParams {
name: string;
customerId: string; // 客户id
contractId: string;
amount?: number; // 金额
owner: string; // 负责人
moduleFields?: ModuleField[]; // 自定义字段
moduleFormConfigDTO?: FormDesignConfigDetailParams;
}
export interface UpdateOrderParams extends SaveOrderParams {
id: string;
}
export interface OrderItem {
id: string;
name: string;
approved?: boolean;
contractName: string;
contractId: string;
moduleFields: ModuleField[]; // 自定义字段
createUser: string;
updateUser: string;
customerId: string;
owner: string;
number: string;
stage: string;
approvalStatus: ProcessStatusEnum;
stageName: string;
organizationId: string;
customerName: string;
createUserName: string;
updateUserName: string;
departmentId: string;
departmentName: string;
createTime:number;
updateTime:number;
amount:number;
inCustomerPool: boolean;
poolId: string;
optionMap?: Record<string, any>;
attachmentMap?: Record<string, any>;
}

View File

@@ -0,0 +1,33 @@
import type { ModuleField } from './common';
export interface ProductListItem {
id: string;
name: string;
status: string;
price: number;
createUser: string;
updateUser: string;
createTime: number;
updateTime: number;
createUserName: string;
updateUserName: string;
moduleFields: ModuleField[];
}
export interface SaveProductParams {
name: string;
moduleFields: ModuleField[];
}
export interface UpdateProductParams extends SaveProductParams {
id: string;
}
export interface UpdatePriceParams extends SaveProductParams {
id: string;
status: boolean;
}
export interface AddPriceParams extends SaveProductParams {
status: boolean;
}

View File

@@ -0,0 +1,9 @@
export interface LicenseInfo {
status: string | null;
corporation: string; // 客户名称
expired: string; // 授权时间
product: string; // 产品名称
edition: string; // 版本
licenseVersion: string; // 授权版本
count: number; // 授权数量
}

Some files were not shown because too many files have changed in this diff Show More