This commit is contained in:
2026-10-21 23:23:48 +08:00
commit a9e4f6cd90
2983 changed files with 303453 additions and 0 deletions
+4
View File
@@ -0,0 +1,4 @@
> 1%
last 2 versions
not dead
not ie 11
+5
View File
@@ -0,0 +1,5 @@
# Changesets
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works with multi-package repos, or single-package repos to help you version and publish your code. You can find the full documentation for it [in our repository](https://github.com/changesets/changesets)
We have a quick list of common questions to get you started engaging with this project in [our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
+18
View File
@@ -0,0 +1,18 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json",
"changelog": [
"@changesets/changelog-github",
{ "repo": "vbenjs/vue-vben-admin" }
],
"commit": false,
"fixed": [["@vben-core/*", "@vben/*"]],
"snapshot": {
"prereleaseTemplate": "{tag}-{datetime}"
},
"privatePackages": { "version": true, "tag": true },
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
+1
View File
@@ -0,0 +1 @@
export { default } from '@vben/commitlint-config';
+7
View File
@@ -0,0 +1,7 @@
node_modules
.git
.gitignore
*.md
dist
.turbo
dist.zip
+18
View File
@@ -0,0 +1,18 @@
root = true
[*]
charset=utf-8
end_of_line=lf
insert_final_newline=true
indent_style=space
indent_size=2
max_line_length = 100
trim_trailing_whitespace = true
quote_type = single
[*.{yml,yaml,json}]
indent_style = space
indent_size = 2
[*.md]
trim_trailing_whitespace = false
+11
View File
@@ -0,0 +1,11 @@
# https://docs.github.com/cn/get-started/getting-started-with-git/configuring-git-to-handle-line-endings
# Automatically normalize line endings (to LF) for all text-based files.
* text=auto eol=lf
# Declare files that will always have CRLF line endings on checkout.
*.{cmd,[cC][mM][dD]} text eol=crlf
*.{bat,[bB][aA][tT]} text eol=crlf
# Denote all files that are truly binary and should not be modified.
*.{ico,png,jpg,jpeg,gif,webp,svg,woff,woff2} binary
+2
View File
@@ -0,0 +1,2 @@
[core]
ignorecase = false
+14
View File
@@ -0,0 +1,14 @@
# default onwer
* anncwb@126.com vince292007@gmail.com netfan@foxmail.com jinmao88@qq.com
# vben core onwer
/.github/ anncwb@126.com vince292007@gmail.com netfan@foxmail.com jinmao88@qq.com
/.vscode/ anncwb@126.com vince292007@gmail.com netfan@foxmail.com jinmao88@qq.com
/packages/ anncwb@126.com vince292007@gmail.com netfan@foxmail.com jinmao88@qq.com
/packages/@core/ anncwb@126.com vince292007@gmail.com netfan@foxmail.com jinmao88@qq.com
/internal/ anncwb@126.com vince292007@gmail.com netfan@foxmail.com jinmao88@qq.com
/scripts/ anncwb@126.com vince292007@gmail.com netfan@foxmail.com jinmao88@qq.com
# vben team onwer
apps/ anncwb@126.com vince292007@gmail.com netfan@foxmail.com @vbenjs/team-v5 jinmao88@qq.com
docs/ anncwb@126.com vince292007@gmail.com netfan@foxmail.com @vbenjs/team-v5 jinmao88@qq.com
+74
View File
@@ -0,0 +1,74 @@
name: 🐞 Bug Report
description: Report an issue with Vben Admin to help us make it better.
title: 'Bug: '
labels: ['bug: pending triage']
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
- type: dropdown
id: version
attributes:
label: Version
description: What version of our software are you running?
options:
- Vben Admin V5
- Vben Admin V2
default: 0
validations:
required: true
- type: textarea
id: bug-desc
attributes:
label: Describe the bug?
description: A clear and concise description of what the bug is. If you intend to submit a PR for this issue, tell us in the description. Thanks!
placeholder: Bug Description
validations:
required: true
- type: textarea
id: reproduction
attributes:
label: Reproduction
description: Please provide a link to [StackBlitz](https://stackblitz.com/fork/github/vitest-dev/vitest/tree/main/examples/basic?initialPath=__vitest__/) (you can also use [examples](https://github.com/vitest-dev/vitest/tree/main/examples)) or a github repo that can reproduce the problem you ran into. A [minimal reproduction](https://stackoverflow.com/help/minimal-reproducible-example) is required unless you are absolutely sure that the issue is obvious and the provided information is enough to understand the problem. If a report is vague (e.g. just a generic error message) and has no reproduction, it will receive a "needs reproduction" label. If no reproduction is provided after 3 days, it will be auto-closed.
placeholder: Reproduction
validations:
required: true
- type: textarea
id: system-info
attributes:
label: System Info
description: Output of `npx envinfo --system --npmPackages '{vue}' --binaries --browsers`
render: shell
placeholder: System, Binaries, Browsers
validations:
required: true
- type: textarea
id: logs
attributes:
label: Relevant log output
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
render: shell
- type: checkboxes
id: terms
attributes:
label: Validations
description: Before submitting the issue, please make sure you do the following
# description: By submitting this issue, you agree to follow our [Code of Conduct](https://example.com).
options:
- label: Read the [docs](https://doc.vben.pro/)
required: true
- label: Ensure the code is up to date. (Some issues have been fixed in the latest version)
required: true
- label: I have searched the [existing issues](https://github.com/vbenjs/vue-vben-admin/issues) and checked that my issue does not duplicate any existing issues.
required: true
- label: Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/vbenjs/vue-vben-admin/discussions) or join our [Discord Chat Server](https://discord.gg/8GuAdwDhj6).
required: true
- label: The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.
required: true
+38
View File
@@ -0,0 +1,38 @@
name: 📚 Documentation
description: Report an issue with Vben Admin Website to help us make it better.
title: 'Docs: '
labels: [documentation]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this issue!
- type: checkboxes
id: documentation_is
attributes:
label: Documentation is
options:
- label: Missing
- label: Outdated
- label: Confusing
- label: Not sure?
- type: textarea
id: description
attributes:
label: Explain in Detail
description: A clear and concise description of your suggestion. If you intend to submit a PR for this issue, tell us in the description. Thanks!
placeholder: The description of ... page is not clear. I thought it meant ... but it wasn't.
validations:
required: true
- type: textarea
id: suggestion
attributes:
label: Your Suggestion for Changes
validations:
required: true
- type: textarea
id: reproduction-steps
attributes:
label: Steps to reproduce
description: Please provide any reproduction steps that may need to be described. E.g. if it happens only when running the dev or build script make sure it's clear which one to use.
placeholder: Run `pnpm install` followed by `pnpm run docs:dev`
+70
View File
@@ -0,0 +1,70 @@
name: ✨ New Feature Proposal
description: Propose a new feature to be added to Vben Admin
title: 'FEATURE: '
labels: ['enhancement: pending triage']
body:
- type: markdown
attributes:
value: |
Thank you for suggesting a feature for our project! Please fill out the information below to help us understand and implement your request!
- type: dropdown
id: version
attributes:
label: Version
description: What version of our software are you running?
options:
- Vben Admin V5
- Vben Admin V2
default: 0
validations:
required: true
- type: textarea
id: description
attributes:
label: Description
description: A detailed description of the feature request.
placeholder: Please describe the feature you would like to see, and why it would be useful.
validations:
required: true
- type: textarea
id: proposed-solution
attributes:
label: Proposed Solution
description: A clear and concise description of what you want to happen.
placeholder: Describe the solution you'd like to see
validations:
required: true
- type: textarea
id: alternatives
attributes:
label: Alternatives Considered
description: |
A clear and concise description of any alternative solutions or features you've considered.
placeholder: Describe any alternative solutions or features you've considered
validations:
required: false
- type: input
id: additional-context
attributes:
label: Additional Context
description: Add any other context or screenshots about the feature request here.
placeholder: Any additional information
validations:
required: false
- type: checkboxes
id: checkboxes
attributes:
label: Validations
description: Before submitting the issue, please make sure you do the following
options:
- label: Read the [docs](https://doc.vben.pro/)
required: true
- label: Ensure the code is up to date. (Some issues have been fixed in the latest version)
required: true
- label: I have searched the [existing issues](https://github.com/vbenjs/vue-vben-admin/issues) and checked that my issue does not duplicate any existing issues.
required: true
+40
View File
@@ -0,0 +1,40 @@
name: 'Setup Node'
description: 'Setup node and pnpm'
runs:
using: 'composite'
steps:
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: 'pnpm'
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
if: ${{ github.ref_name == 'main' }}
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- uses: actions/cache/restore@v4
if: ${{ github.ref_name != 'main' }}
with:
path: ${{ env.STORE_PATH }}
key: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
shell: bash
run: pnpm install --frozen-lockfile
+89
View File
@@ -0,0 +1,89 @@
## Git Commit Message Convention
> This is adapted from [Angular's commit convention](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular).
#### TL;DR:
Messages must be matched by the following regex:
```js
/^(revert: )?(feat|fix|docs|style|refactor|perf|test|workflow|build|ci|chore|types|wip): .{1,50}/;
```
#### Examples
Appears under "Features" header, `dev` subheader:
```
feat(dev): add 'comments' option
```
Appears under "Bug Fixes" header, `dev` subheader, with a link to issue #28:
```
fix(dev): fix dev error
close #28
```
Appears under "Performance Improvements" header, and under "Breaking Changes" with the breaking change explanation:
```
perf(build): remove 'foo' option
BREAKING CHANGE: The 'foo' option has been removed.
```
The following commit and commit `667ecc1` do not appear in the changelog if they are under the same release. If not, the revert commit appears under the "Reverts" header.
```
revert: feat(compiler): add 'comments' option
This reverts commit 667ecc1654a317a13331b17617d973392f415f02.
```
### Full Message Format
A commit message consists of a **header**, **body** and **footer**. The header has a **type**, **scope** and **subject**:
```
<type>(<scope>): <subject>
<BLANK LINE>
<body>
<BLANK LINE>
<footer>
```
The **header** is mandatory and the **scope** of the header is optional.
### Revert
If the commit reverts a previous commit, it should begin with `revert: `, followed by the header of the reverted commit. In the body, it should say: `This reverts commit <hash>.`, where the hash is the SHA of the commit being reverted.
### Type
If the prefix is `feat`, `fix` or `perf`, it will appear in the changelog. However, if there is any [BREAKING CHANGE](#footer), the commit will always appear in the changelog.
Other prefixes are up to your discretion. Suggested prefixes are `docs`, `chore`, `style`, `refactor`, and `test` for non-changelog related tasks.
### Scope
The scope could be anything specifying the place of the commit change. For example `dev`, `build`, `workflow`, `cli` etc...
### Subject
The subject contains a succinct description of the change:
- use the imperative, present tense: "change" not "changed" nor "changes"
- don't capitalize the first letter
- no dot (.) at the end
### Body
Just as in the **subject**, use the imperative, present tense: "change" not "changed" nor "changes". The body should include the motivation for the change and contrast this with previous behavior.
### Footer
The footer should contain any information about **Breaking Changes** and is also the place to reference GitHub issues that this commit **Closes**.
**Breaking Changes** should start with the word `BREAKING CHANGE:` with a space or two newlines. The rest of the commit message is then used for this.
+39
View File
@@ -0,0 +1,39 @@
# Prevent issues being created without using the template
blank_issues_enabled: false
checkIssueTemplate: true
checkPullRequestTemplate: true
contact_links:
- name: 💬 Discord Chat
url: https://discord.gg/8GuAdwDhj6
about: Ask questions and discuss with other Vben users in real time.
- name: ❓ Questions & Discussions
url: https://github.com/@vbenjs/vue-vben-admin/discussions
about: Use GitHub discussions for message-board style questions and discussions.
# Comment to be posted to on PRs from first time contributors in your repository
newPRWelcomeComment: |
💖 Thanks for opening this pull request! 💖
Please be patient and we will get back to you as soon as we can.
# Comment to be posted to on pull requests merged by a first time user
firstPRMergeComment: >
Thanks for your contribution! 🎉🎉🎉
# Comment to be posted to on first time issues
newIssueWelcomeComment: >
Thanks for opening your first issue! Be sure to follow the issue template and provide every bit of information to help the developers!
# *OPTIONAL* default titles to check against for lack of descriptiveness
# MUST BE ALL LOWERCASE
requestInfoDefaultTitles:
- update readme.md
- updates
# *Required* Comment to reply with
requestInfoReplyComment: >
Thanks for filing this issue/PR! It would be much appreciated if you could provide us with more information so we can effectively analyze the situation in context.
+40
View File
@@ -0,0 +1,40 @@
# Vben Admin Contributing Guide
Hi! We're really excited that you are interested in contributing to Vben Admin. Before submitting your contribution, please make sure to take a moment and read through the following guidelines:
- [Pull Request Guidelines](#pull-request-guidelines)
## Contributor Code of Conduct
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
We are committed to making participation in this project a harassment-free experience for everyone, regardless of the level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
## Pull Request Guidelines
- Checkout a topic branch from the relevant branch, e.g. main, and merge back against that branch.
- If adding a new feature:
- Provide a convincing reason to add this feature. Ideally, you should open a suggestion issue first and have it approved before working on it.
- If fixing bug:
- Provide a detailed description of the bug in the PR. Live demo preferred.
- It's OK to have multiple small commits as you work on the PR - GitHub can automatically squash them before merging.
## Development Setup
You will need [pnpm](https://pnpm.io/)
After cloning the repo, run:
```bash
# install the dependencies of the project
$ pnpm install
# start the project
$ pnpm run dev
```
+17
View File
@@ -0,0 +1,17 @@
version: 2
updates:
- package-ecosystem: npm
directory: '/'
schedule:
interval: daily
groups:
non-breaking-changes:
update-types: [minor, patch]
- package-ecosystem: github-actions
directory: '/'
schedule:
interval: weekly
groups:
non-breaking-changes:
update-types: [minor, patch]
+33
View File
@@ -0,0 +1,33 @@
## Description
<!-- Please describe the change as necessary. If it's a feature or enhancement please be as detailed as possible. If it's a bug fix, please link the issue that it fixes or describe the bug in as much detail.
-->
<!-- You can also add additional context here -->
## Type of change
Please delete options that are not relevant.
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update
- [ ] Please, don't make changes to `pnpm-lock.yaml` unless you introduce a new test example.
## Checklist
> ℹ️ Check all checkboxes - this will indicate that you have done everything in accordance with the rules in [CONTRIBUTING](contributing.md).
- [ ] If you introduce new functionality, document it. You can run documentation with `pnpm run docs:dev` command.
- [ ] Run the tests with `pnpm test`.
- [ ] Changes in changelog are generated from PR name. Please, make sure that it explains your changes in an understandable manner. Please, prefix changeset messages with `feat:`, `fix:`, `perf:`, `docs:`, or `chore:`.
- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream modules
+61
View File
@@ -0,0 +1,61 @@
name-template: 'v$RESOLVED_VERSION'
tag-template: 'v$RESOLVED_VERSION'
version-template: $MAJOR.$MINOR.$PATCH
change-template: '* $TITLE (#$NUMBER) @$AUTHOR'
template: |
# What's Changed
$CHANGES
**Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION
categories:
- title: '🚀 Features'
labels:
- 'feature'
- title: '🐞 Bug Fixes'
labels:
- 'bug'
- title: '📈 Performance & Enhancement'
labels:
- 'perf'
- 'enhancement'
- title: 📝 Documentation
labels:
- 'documentation'
- title: 👻 Maintenance
labels:
- 'chore'
- 'dependencies'
# collapse-after: 12
- title: 🚦 Tests
labels:
- 'tests'
- title: 'Breaking'
label: 'breaking'
version-resolver:
major:
labels:
- 'major'
- 'breaking'
minor:
labels:
- 'minor'
patch:
labels:
- 'feature'
- 'patch'
- 'bug'
- 'maintenance'
- 'docs'
- 'dependencies'
- 'security'
exclude-labels:
- 'skip-changelog'
- 'no-changelog'
- 'changelog'
- 'bump versions'
- 'reverted'
- 'invalid'
+13
View File
@@ -0,0 +1,13 @@
titleAndCommits: true
types:
- feat
- fix
- docs
- chore
- style
- refactor
- perf
- test
- build
- ci
- revert
+48
View File
@@ -0,0 +1,48 @@
# name: Dependabot post-update
name: Build detection
on:
pull_request_target:
types: [opened, synchronize, reopened]
branches:
- main
env:
HUSKY: '0'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
permissions:
contents: read
pull-requests: write
jobs:
post-update:
if: github.repository == 'vbenjs/vue-vben-admin'
# if: ${{ github.actor == 'dependabot[bot]' }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
# - macos-latest
- windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Checkout out pull request
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr checkout ${{ github.event.pull_request.number }}
- name: Setup Node
uses: ./.github/actions/setup-node
- name: Build
run: |
pnpm run build
+42
View File
@@ -0,0 +1,42 @@
# https://github.com/changesets/action
name: Changeset version
on:
workflow_dispatch:
pull_request:
types:
- closed
branches:
- main
permissions:
pull-requests: write
contents: write
env:
CI: true
jobs:
version:
if: (github.event.pull_request.merged || github.event_name == 'workflow_dispatch') && github.actor != 'dependabot[bot]' && !contains(github.event.head_commit.message, '[skip ci]') && github.repository == 'vbenjs/vue-vben-admin'
# if: github.repository == 'vbenjs/vue-vben-admin'
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node
uses: ./.github/actions/setup-node
- name: Create Release Pull Request
uses: changesets/action@v1
with:
version: pnpm run version
commit: 'chore: bump versions'
title: 'chore: bump versions'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+125
View File
@@ -0,0 +1,125 @@
name: CI
on:
pull_request:
push:
branches:
- main
- 'releases/*'
permissions:
contents: read
env:
CI: true
TZ: Asia/Shanghai
jobs:
test:
name: Test
if: github.repository == 'vbenjs/vue-vben-admin'
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
# - macos-latest
- windows-latest
timeout-minutes: 20
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
run_install: false
- name: Setup Node
uses: ./.github/actions/setup-node
# - name: Check Git version
# run: git --version
# - name: Setup mock Git user
# run: git config --global user.email "you@example.com" && git config --global user.name "Your Name"
- name: Vitest tests
run: pnpm run test:unit
# - name: Upload coverage
# uses: codecov/codecov-action@v4
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
lint:
name: Lint
if: github.repository == 'vbenjs/vue-vben-admin'
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
# - macos-latest
- windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node
uses: ./.github/actions/setup-node
- name: Lint
run: pnpm run lint
check:
name: Check
if: github.repository == 'vbenjs/vue-vben-admin'
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
matrix:
os:
- ubuntu-latest
# - macos-latest
- windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node
uses: ./.github/actions/setup-node
- name: Typecheck
run: pnpm check:type
# From https://github.com/rhysd/actionlint/blob/main/docs/usage.md#use-actionlint-on-github-actions
- name: Check workflow files
if: runner.os == 'Linux'
run: |
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
./actionlint -color -shellcheck=""
ci-ok:
name: CI OK
if: github.repository == 'vbenjs/vue-vben-admin'
runs-on: ubuntu-latest
needs: [test, check, lint]
env:
FAILURE: ${{ contains(join(needs.*.result, ','), 'failure') }}
steps:
- name: Check for failure
run: |
echo $FAILURE
if [ "$FAILURE" = "false" ]; then
exit 0
else
exit 1
fi
+94
View File
@@ -0,0 +1,94 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: 'CodeQL'
on:
push:
branches: ['main']
pull_request:
branches: ['main']
schedule:
- cron: '35 0 * * 0'
jobs:
analyze:
name: Analyze (${{ matrix.language }})
if: github.repository == 'vbenjs/vue-vben-admin'
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners (GitHub.com only)
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
permissions:
# required for all workflows
security-events: write
# required to fetch internal or private CodeQL packs
packages: read
# only required for workflows in private repositories
actions: read
contents: read
strategy:
fail-fast: false
matrix:
include:
- language: javascript-typescript
build-mode: none
# CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
# Use `c-cpp` to analyze code written in C, C++ or both
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# If the analyze step fails for one of the languages you are analyzing with
# "We were unable to automatically build your code", modify the matrix above
# to set the build mode to "manual" for that language. Then modify this step
# to build your code.
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
- if: matrix.build-mode == 'manual'
shell: bash
run: |
echo 'If you are using a "manual" build mode for one or more of the' \
'languages you are analyzing, replace this with the commands to build' \
'your code, for example:'
echo ' make bootstrap'
echo ' make release'
exit 1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: '/language:${{matrix.language}}'
+172
View File
@@ -0,0 +1,172 @@
name: Deploy Website on push
on:
push:
branches:
- main
jobs:
deploy-playground-ftp:
name: Deploy Push Playground Ftp
if: github.actor != 'dependabot[bot]' && !contains(github.event.head_commit.message, '[skip ci]') && github.repository == 'vbenjs/vue-vben-admin'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Sed Config Base
shell: bash
run: |
sed -i "s#VITE_COMPRESS\s*=.*#VITE_COMPRESS = gzip#g" ./playground/.env.production
sed -i "s#VITE_PWA\s*=.*#VITE_PWA = true#g" ./playground/.env.production
cat ./playground/.env.production
- name: Setup Node
uses: ./.github/actions/setup-node
- name: Build
run: pnpm build:play
- name: Sync Playground files
uses: SamKirkland/FTP-Deploy-Action@v4.3.5
with:
server: ${{ secrets.PRO_FTP_HOST }}
username: ${{ secrets.WEB_PLAYGROUND_FTP_ACCOUNT }}
password: ${{ secrets.WEB_PLAYGROUND_FTP_PWSSWORD }}
local-dir: ./playground/dist/
deploy-docs-ftp:
name: Deploy Push Docs Ftp
if: github.actor != 'dependabot[bot]' && !contains(github.event.head_commit.message, '[skip ci]') && github.repository == 'vbenjs/vue-vben-admin'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node
uses: ./.github/actions/setup-node
- name: Build
run: pnpm build:docs
- name: Sync Docs files
uses: SamKirkland/FTP-Deploy-Action@v4.3.5
with:
server: ${{ secrets.PRO_FTP_HOST }}
username: ${{ secrets.WEBSITE_FTP_ACCOUNT }}
password: ${{ secrets.WEBSITE_FTP_PASSWORD }}
local-dir: ./docs/.vitepress/dist/
deploy-antd-ftp:
name: Deploy Push Antd Ftp
if: github.actor != 'dependabot[bot]' && !contains(github.event.head_commit.message, '[skip ci]') && github.repository == 'vbenjs/vue-vben-admin'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Sed Config Base
shell: bash
run: |
sed -i "s#VITE_COMPRESS\s*=.*#VITE_COMPRESS = gzip#g" ./apps/web-antd/.env.production
sed -i "s#VITE_PWA\s*=.*#VITE_PWA = true#g" ./apps/web-antd/.env.production
cat ./apps/web-antd/.env.production
- name: Setup Node
uses: ./.github/actions/setup-node
- name: Build
run: pnpm run build:antd
- name: Sync files
uses: SamKirkland/FTP-Deploy-Action@v4.3.5
with:
server: ${{ secrets.PRO_FTP_HOST }}
username: ${{ secrets.WEB_ANTD_FTP_ACCOUNT }}
password: ${{ secrets.WEB_ANTD_FTP_PASSWORD }}
local-dir: ./apps/web-antd/dist/
deploy-ele-ftp:
name: Deploy Push Element Ftp
if: github.actor != 'dependabot[bot]' && !contains(github.event.head_commit.message, '[skip ci]') && github.repository == 'vbenjs/vue-vben-admin'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Sed Config Base
shell: bash
run: |
sed -i "s#VITE_COMPRESS\s*=.*#VITE_COMPRESS = gzip#g" ./apps/web-ele/.env.production
sed -i "s#VITE_PWA\s*=.*#VITE_PWA = true#g" ./apps/web-ele/.env.production
cat ./apps/web-ele/.env.production
- name: Setup Node
uses: ./.github/actions/setup-node
- name: Build
run: pnpm run build:ele
- name: Sync files
uses: SamKirkland/FTP-Deploy-Action@v4.3.5
with:
server: ${{ secrets.PRO_FTP_HOST }}
username: ${{ secrets.WEB_ELE_FTP_ACCOUNT }}
password: ${{ secrets.WEB_ELE_FTP_PASSWORD }}
local-dir: ./apps/web-ele/dist/
deploy-naive-ftp:
name: Deploy Push Naive Ftp
if: github.actor != 'dependabot[bot]' && !contains(github.event.head_commit.message, '[skip ci]') && github.repository == 'vbenjs/vue-vben-admin'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Sed Config Base
shell: bash
run: |
sed -i "s#VITE_COMPRESS\s*=.*#VITE_COMPRESS = gzip#g" ./apps/web-naive/.env.production
sed -i "s#VITE_PWA\s*=.*#VITE_PWA = true#g" ./apps/web-naive/.env.production
cat ./apps/web-naive/.env.production
- name: Setup Node
uses: ./.github/actions/setup-node
- name: Build
run: pnpm run build:naive
- name: Sync files
uses: SamKirkland/FTP-Deploy-Action@v4.3.5
with:
server: ${{ secrets.PRO_FTP_HOST }}
username: ${{ secrets.WEB_NAIVE_FTP_ACCOUNT }}
password: ${{ secrets.WEB_NAIVE_FTP_PASSWORD }}
local-dir: ./apps/web-naive/dist/
rerun-on-failure:
name: Rerun on failure
needs:
- deploy-playground-ftp
- deploy-docs-ftp
- deploy-antd-ftp
- deploy-ele-ftp
- deploy-naive-ftp
if: failure() && fromJSON(github.run_attempt) < 10
runs-on: ubuntu-latest
steps:
- name: Retry ${{ fromJSON(github.run_attempt) }} of 10
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ github.token }}
run: gh workflow run rerun.yml -F run_id=${{ github.run_id }}
+25
View File
@@ -0,0 +1,25 @@
name: Release Drafter
on:
push:
branches:
- main
permissions:
contents: read
pull-requests: write
jobs:
update_release_draft:
permissions:
# write permission is required to create a github release
contents: write
# write permission is required for autolabeler
# otherwise, read permission is required at least
pull-requests: write
if: github.repository == 'vbenjs/vue-vben-admin'
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+31
View File
@@ -0,0 +1,31 @@
# 每天零点运行一次,它会检查所有带有 "need reproduction" 标签的 Issues。如果这些 Issues 在过去的 3 天内没有任何活动,它们将会被自动关闭。这有助于保持 Issue 列表的整洁,并且提醒用户在必要时提供更多的信息。
name: Issue Close Require
# 触发条件:每天零点
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
permissions:
pull-requests: write
contents: write
issues: write
jobs:
close-issues:
if: github.repository == 'vbenjs/vue-vben-admin'
runs-on: ubuntu-latest
steps:
# 关闭未活动的 Issues
- name: Close Inactive Issues
uses: actions/stale@v9
with:
days-before-stale: -1 # Issues and PR will never be flagged stale automatically.
stale-issue-label: needs-reproduction # Label that flags an issue as stale.
only-labels: needs-reproduction # Only process these issues
days-before-issue-close: 3
ignore-updates: true
remove-stale-when-updated: false
close-issue-message: This issue was closed because it was open for 3 days without a valid reproduction.
close-issue-label: closed-by-action
+46
View File
@@ -0,0 +1,46 @@
name: Label Based Actions
on:
issues:
types: [labeled]
# pull_request:
# types: [labeled]
permissions:
issues: write
pull-requests: write
contents: write
jobs:
reply-labeled:
if: github.repository == 'vbenjs/vue-vben-admin'
runs-on: ubuntu-latest
steps:
- name: remove enhancement pending
if: github.event.label.name == 'enhancement'
uses: actions-cool/issues-helper@v3
with:
actions: 'remove-labels'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
labels: 'enhancement: pending triage'
- name: remove bug pending
if: github.event.label.name == 'bug'
uses: actions-cool/issues-helper@v3
with:
actions: 'remove-labels'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
labels: 'bug: pending triage'
- name: needs reproduction
if: github.event.label.name == 'needs reproduction'
uses: actions-cool/issues-helper@v3
with:
actions: 'create-comment, remove-labels'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
body: |
Hello @${{ github.event.issue.user.login }}. Please provide the complete reproduction steps and code. Issues labeled by `needs reproduction` will be closed if no activities in 3 days.
labels: 'bug: pending triage'
+24
View File
@@ -0,0 +1,24 @@
name: Lock Threads
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
permissions:
issues: write
pull-requests: write
jobs:
action:
if: github.repository == 'vbenjs/vue-vben-admin'
runs-on: ubuntu-latest
steps:
- uses: dessant/lock-threads@v5
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
issue-inactive-days: '14'
issue-lock-reason: ''
pr-inactive-days: '30'
pr-lock-reason: ''
process-only: 'issues, prs'
+80
View File
@@ -0,0 +1,80 @@
name: Create Release Tag
on:
push:
tags:
- 'v*.*.*' # Push events to matching v*, i.e. v1.0, v20.15.10
env:
HUSKY: '0'
permissions:
pull-requests: write
contents: write
jobs:
build:
name: Create Release
if: github.repository == 'vbenjs/vue-vben-admin'
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
# - name: Checkout code
# uses: actions/checkout@v4
# with:
# fetch-depth: 0
# - name: Install pnpm
# uses: pnpm/action-setup@v4
# - name: Use Node.js ${{ matrix.node-version }}
# uses: actions/setup-node@v4
# with:
# node-version: ${{ matrix.node-version }}
# cache: "pnpm"
# - name: Install dependencies
# run: pnpm install --frozen-lockfile
# - name: Test and Build
# run: |
# pnpm run test
# pnpm run build
- name: version
id: version
run: |
tag=${GITHUB_REF/refs\/tags\//}
version=${tag#v}
major=${version%%.*}
echo "tag=${tag}" >> $GITHUB_OUTPUT
echo "version=${version}" >> $GITHUB_OUTPUT
echo "major=${major}" >> $GITHUB_OUTPUT
- uses: release-drafter/release-drafter@v6
with:
version: ${{ steps.version.outputs.version }}
publish: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: force update major tag
# run: |
# git tag v${{ steps.version.outputs.major }} ${{ steps.version.outputs.tag }} -f
# git push origin refs/tags/v${{ steps.version.outputs.major }} -f
# - name: Create Release for Tag
# id: release_tag
# uses: ncipollo/release-action@v1
# with:
# token: ${{ secrets.GITHUB_TOKEN }}
# generateReleaseNotes: "true"
# body: |
# > Please refer to [CHANGELOG.md](https://github.com/vbenjs/vue-vben-admin/blob/main/CHANGELOG.md) for details.
+19
View File
@@ -0,0 +1,19 @@
name: Rerun workflow
on:
workflow_dispatch:
inputs:
run_id:
description: The workflow id to relanch
required: true
jobs:
rerun:
runs-on: ubuntu-latest
steps:
- name: rerun ${{ inputs.run_id }}
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ github.token }}
run: |
gh run watch ${{ inputs.run_id }} > /dev/null 2>&1
gh run rerun ${{ inputs.run_id }} --failed
+41
View File
@@ -0,0 +1,41 @@
name: Semantic Pull Request
on:
pull_request_target:
types:
- opened
- edited
- synchronize
jobs:
main:
name: Semantic Pull Request
if: github.repository == 'vbenjs/vue-vben-admin'
runs-on: ubuntu-latest
steps:
- name: Validate PR title
uses: amannn/action-semantic-pull-request@v5
with:
wip: true
subjectPattern: ^(?![A-Z]).+$
subjectPatternError: |
The subject "{subject}" found in the pull request title "{title}"
didn't match the configured pattern. Please ensure that the subject
doesn't start with an uppercase character.
requireScope: false
types: |
fix
feat
docs
style
refactor
perf
test
build
ci
chore
revert
types
release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+19
View File
@@ -0,0 +1,19 @@
name: 'Close stale issues'
on:
schedule:
- cron: '0 1 * * *'
jobs:
stale:
if: github.repository == 'vbenjs/vue-vben-admin'
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v9
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days'
stale-pr-message: 'This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days'
exempt-issue-labels: 'bug,enhancement'
days-before-stale: 60
days-before-close: 7
+52
View File
@@ -0,0 +1,52 @@
node_modules
.DS_Store
dist
dist-ssr
dist.zip
dist.tar
dist.war
.nitro
.output
*-dist.zip
*-dist.tar
*-dist.war
coverage
*.local
**/.vitepress/cache
.cache
.turbo
.temp
dev-dist
.stylelintcache
yarn.lock
package-lock.json
.VSCodeCounter
**/backend-mock/data
# local env files
.env.local
.env.*.local
.eslintcache
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
vite.config.mts.*
vite.config.mjs.*
vite.config.js.*
vite.config.ts.*
# Editor directories and files
.idea
# .vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
.history
.cursor
+6
View File
@@ -0,0 +1,6 @@
ports:
- port: 5555
onOpen: open-preview
tasks:
- init: npm i -g corepack && pnpm install
command: pnpm run dev:play
+1
View File
@@ -0,0 +1 @@
22.1.0
+1
View File
@@ -0,0 +1 @@
registry=https://registry.npmmirror.com
+18
View File
@@ -0,0 +1,18 @@
dist
dev-dist
.local
.output.js
node_modules
.nvmrc
coverage
CODEOWNERS
.nitro
.output
**/*.svg
**/*.sh
public
.npmrc
*-lock.yaml
+1
View File
@@ -0,0 +1 @@
export { default } from '@vben/prettier-config';
+4
View File
@@ -0,0 +1,4 @@
dist
public
__tests__
coverage
+30
View File
@@ -0,0 +1,30 @@
{
"recommendations": [
// Vue 3 的语言支持
"Vue.volar",
// 将 ESLint JavaScript 集成到 VS Code 中。
"dbaeumer.vscode-eslint",
// Visual Studio Code 的官方 Stylelint 扩展
"stylelint.vscode-stylelint",
// 使用 Prettier 的代码格式化程序
"esbenp.prettier-vscode",
// 支持 dotenv 文件语法
"mikestead.dotenv",
// 源代码的拼写检查器
"streetsidesoftware.code-spell-checker",
// Tailwind CSS 的官方 VS Code 插件
"bradlc.vscode-tailwindcss",
// iconify 图标插件
"antfu.iconify",
// i18n 插件
"Lokalise.i18n-ally",
// CSS 变量提示
"vunguyentuan.vscode-css-variables",
// 在 package.json 中显示 PNPM catalog 的版本
"antfu.pnpm-catalog-lens"
],
"unwantedRecommendations": [
// 和 volar 冲突
"octref.vetur"
]
}
+37
View File
@@ -0,0 +1,37 @@
{
"import": {
"scope": "javascript,typescript",
"prefix": "im",
"body": ["import { $2 } from '$1';"],
"description": "Import a module",
},
"export-all": {
"scope": "javascript,typescript",
"prefix": "ex",
"body": ["export * from '$1';"],
"description": "Export a module",
},
"vue-script-setup": {
"scope": "vue",
"prefix": "<sc",
"body": [
"<script setup lang=\"ts\">",
"const props = defineProps<{",
" modelValue?: boolean,",
"}>()",
"$1",
"</script>",
"",
"<template>",
" <div>",
" <slot/>",
" </div>",
"</template>",
],
},
"vue-computed": {
"scope": "javascript,typescript,vue",
"prefix": "com",
"body": ["computed(() => { $1 })"],
},
}
+42
View File
@@ -0,0 +1,42 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"name": "vben admin playground dev",
"request": "launch",
"url": "http://localhost:5555",
"env": { "NODE_ENV": "development" },
"sourceMaps": true,
"webRoot": "${workspaceFolder}/playground"
},
{
"type": "chrome",
"name": "vben admin antd dev",
"request": "launch",
"url": "http://localhost:5666",
"env": { "NODE_ENV": "development" },
"sourceMaps": true,
"webRoot": "${workspaceFolder}/apps/web-antd"
},
{
"type": "chrome",
"name": "vben admin ele dev",
"request": "launch",
"url": "http://localhost:5777",
"env": { "NODE_ENV": "development" },
"sourceMaps": true,
"webRoot": "${workspaceFolder}/apps/web-ele"
},
{
"type": "chrome",
"name": "vben admin naive dev",
"request": "launch",
"url": "http://localhost:5888",
"env": { "NODE_ENV": "development" },
"sourceMaps": true,
"webRoot": "${workspaceFolder}/apps/web-naive"
}
]
}
+241
View File
@@ -0,0 +1,241 @@
{
"tailwindCSS.experimental.configFile": "internal/tailwind-config/src/index.ts",
// workbench
"workbench.list.smoothScrolling": true,
"workbench.startupEditor": "newUntitledFile",
"workbench.tree.indent": 10,
"workbench.editor.highlightModifiedTabs": true,
"workbench.editor.closeOnFileDelete": true,
"workbench.editor.limit.enabled": true,
"workbench.editor.limit.perEditorGroup": true,
"workbench.editor.limit.value": 5,
// editor
"editor.tabSize": 2,
"editor.detectIndentation": false,
"editor.cursorBlinking": "expand",
"editor.largeFileOptimizations": true,
"editor.accessibilitySupport": "off",
"editor.cursorSmoothCaretAnimation": "on",
"editor.guides.bracketPairs": "active",
"editor.inlineSuggest.enabled": true,
"editor.suggestSelection": "recentlyUsedByPrefix",
"editor.acceptSuggestionOnEnter": "smart",
"editor.suggest.snippetsPreventQuickSuggestions": false,
"editor.stickyScroll.enabled": true,
"editor.hover.sticky": true,
"editor.suggest.insertMode": "replace",
"editor.bracketPairColorization.enabled": true,
"editor.autoClosingBrackets": "beforeWhitespace",
"editor.autoClosingDelete": "always",
"editor.autoClosingOvertype": "always",
"editor.autoClosingQuotes": "beforeWhitespace",
"editor.wordSeparators": "`~!@#%^&*()=+[{]}\\|;:'\",.<>/?",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.fixAll.stylelint": "explicit",
"source.organizeImports": "never"
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[html]": {
"editor.defaultFormatter": "vscode.html-language-features"
},
"[css]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[scss]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[markdown]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[vue]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
// extensions
"extensions.ignoreRecommendations": true,
// terminal
"terminal.integrated.cursorBlinking": true,
"terminal.integrated.persistentSessionReviveProcess": "never",
"terminal.integrated.tabs.enabled": true,
"terminal.integrated.scrollback": 10000,
"terminal.integrated.stickyScroll.enabled": true,
// files
"files.eol": "\n",
"files.insertFinalNewline": true,
"files.simpleDialog.enable": true,
"files.associations": {
"*.ejs": "html",
"*.art": "html",
"**/tsconfig.json": "jsonc",
"*.json": "jsonc",
"package.json": "json"
},
"files.exclude": {
"**/.eslintcache": true,
"**/bower_components": true,
"**/.turbo": true,
"**/.idea": true,
"**/.vitepress": true,
"**/tmp": true,
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.stylelintcache": true,
"**/.DS_Store": true,
"**/vite.config.mts.*": true,
"**/tea.yaml": true
},
"files.watcherExclude": {
"**/.git/objects/**": true,
"**/.git/subtree-cache/**": true,
"**/.vscode/**": true,
"**/node_modules/**": true,
"**/tmp/**": true,
"**/bower_components/**": true,
"**/dist/**": true,
"**/yarn.lock": true
},
"typescript.tsserver.exclude": ["**/node_modules", "**/dist", "**/.turbo"],
// search
"search.searchEditor.singleClickBehaviour": "peekDefinition",
"search.followSymlinks": false,
// 在使用搜索功能时,将这些文件夹/文件排除在外
"search.exclude": {
"**/node_modules": true,
"**/*.log": true,
"**/*.log*": true,
"**/bower_components": true,
"**/dist": true,
"**/elehukouben": true,
"**/.git": true,
"**/.github": true,
"**/.gitignore": true,
"**/.svn": true,
"**/.DS_Store": true,
"**/.vitepress/cache": true,
"**/.idea": true,
"**/.vscode": false,
"**/.yarn": true,
"**/tmp": true,
"*.xml": true,
"out": true,
"dist": true,
"node_modules": true,
"CHANGELOG.md": true,
"**/pnpm-lock.yaml": true,
"**/yarn.lock": true
},
"debug.onTaskErrors": "debugAnyway",
"diffEditor.ignoreTrimWhitespace": false,
"npm.packageManager": "pnpm",
"css.validate": false,
"less.validate": false,
"scss.validate": false,
// extension
"emmet.showSuggestionsAsSnippets": true,
"emmet.triggerExpansionOnTab": false,
"errorLens.enabledDiagnosticLevels": ["warning", "error"],
"errorLens.excludeBySource": ["cSpell", "Grammarly", "eslint"],
"stylelint.enable": true,
"stylelint.packageManager": "pnpm",
"stylelint.validate": ["css", "less", "postcss", "scss", "vue"],
"stylelint.customSyntax": "postcss-html",
"stylelint.snippet": ["css", "less", "postcss", "scss", "vue"],
"typescript.inlayHints.enumMemberValues.enabled": true,
"typescript.preferences.preferTypeOnlyAutoImports": true,
"typescript.preferences.includePackageJsonAutoImports": "on",
"eslint.validate": [
"javascript",
"typescript",
"javascriptreact",
"typescriptreact",
"vue",
"html",
"markdown",
"json",
"jsonc",
"json5"
],
"tailwindCSS.experimental.classRegex": [
["cva\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"]
],
"github.copilot.enable": {
"*": true,
"markdown": true,
"plaintext": false,
"yaml": false
},
"cssVariables.lookupFiles": ["packages/core/base/design/src/**/*.css"],
"i18n-ally.localesPaths": [
"packages/locales/src/langs",
"playground/src/locales/langs",
"apps/*/src/locales/langs"
],
"i18n-ally.pathMatcher": "{locale}/{namespace}.{ext}",
"i18n-ally.enabledParsers": ["json"],
"i18n-ally.sourceLanguage": "en",
"i18n-ally.displayLanguage": "zh-CN",
"i18n-ally.enabledFrameworks": ["vue", "react"],
"i18n-ally.keystyle": "nested",
"i18n-ally.sortKeys": true,
"i18n-ally.namespace": true,
// 控制相关文件嵌套展示
"explorer.fileNesting.enabled": true,
"explorer.fileNesting.expand": false,
"explorer.fileNesting.patterns": {
"*.ts": "$(capture).test.ts, $(capture).test.tsx, $(capture).spec.ts, $(capture).spec.tsx, $(capture).d.ts",
"*.tsx": "$(capture).test.ts, $(capture).test.tsx, $(capture).spec.ts, $(capture).spec.tsx,$(capture).d.ts",
"*.env": "$(capture).env.*",
"README.md": "README*,CHANGELOG*,LICENSE,CNAME",
"package.json": "pnpm-lock.yaml,pnpm-workspace.yaml,.gitattributes,.gitignore,.gitpod.yml,.npmrc,.browserslistrc,.node-version,.git*,.tazerc.json",
"eslint.config.mjs": ".eslintignore,.prettierignore,.stylelintignore,.commitlintrc.*,.prettierrc.*,stylelint.config.*,.lintstagedrc.mjs,cspell.json,lefthook.yml",
"tailwind.config.mjs": "postcss.*"
},
"commentTranslate.hover.enabled": false,
"commentTranslate.multiLineMerge": true,
"vue.server.hybridMode": true,
"typescript.tsdk": "node_modules/typescript/lib",
"oxc.enable": false,
"cSpell.words": [
"archiver",
"axios",
"dotenv",
"isequal",
"jspm",
"napi",
"nolebase",
"rollup",
"vitest"
]
}
+9
View File
@@ -0,0 +1,9 @@
MIT License
Copyright (c) 2024-present, Vben
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+153
View File
@@ -0,0 +1,153 @@
<div align="center">
<a href="https://github.com/anncwb/vue-vben-admin">
<img alt="VbenAdmin Logo" width="215" src="https://unpkg.com/@vbenjs/static-source@0.1.7/source/logo-v1.webp">
</a>
<br>
<br>
[![license](https://img.shields.io/github/license/anncwb/vue-vben-admin.svg)](LICENSE)
<h1>Vue Vben Admin</h1>
</div>
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=vbenjs_vue-vben-admin&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=vbenjs_vue-vben-admin) ![codeql](https://github.com/vbenjs/vue-vben-admin/actions/workflows/codeql.yml/badge.svg) ![build](https://github.com/vbenjs/vue-vben-admin/actions/workflows/build.yml/badge.svg) ![ci](https://github.com/vbenjs/vue-vben-admin/actions/workflows/ci.yml/badge.svg) ![deploy](https://github.com/vbenjs/vue-vben-admin/actions/workflows/deploy.yml/badge.svg)
**日本語** | [English](./README.md) | [中文](./README.zh-CN.md)
## 紹介
Vue Vben Adminは、最新の`vue3`、`vite`、`TypeScript`などの主流技術を使用して開発された、無料でオープンソースの中・後端テンプレートです。すぐに使える中・後端のフロントエンドソリューションとして、学習の参考にもなります。
## アップグレード通知
これは最新バージョン `5.0` であり、以前のバージョンとは互換性がありません。新しいプロジェクトを開始する場合は、最新バージョンを使用することをお勧めします。古いバージョンを表示したい場合は、[v2ブランチ](https://github.com/vbenjs/vue-vben-admin/tree/v2)を使用してください。
## 特徴
- **最新技術スタック**:Vue 3やViteなどの最先端フロントエンド技術で開発
- **TypeScript**:アプリケーション規模のJavaScriptのための言語
- **テーマ**:複数のテーマカラーが利用可能で、カスタマイズオプションも豊富
- **国際化**:完全な内蔵国際化サポート
- **権限管理**:動的ルートベースの権限生成ソリューションを内蔵
## プレビュー
- [Vben Admin](https://vben.pro/) - フルバージョンの中国語サイト
テストアカウント:vben/123456
<div align="center">
<img alt="VbenAdmin Logo" width="100%" src="https://anncwb.github.io/anncwb/images/preview1.png">
<img alt="VbenAdmin Logo" width="100%" src="https://anncwb.github.io/anncwb/images/preview2.png">
<img alt="VbenAdmin Logo" width="100%" src="https://anncwb.github.io/anncwb/images/preview3.png">
</div>
### Gitpodを使用
Gitpod(GitHub用の無料オンライン開発環境)でプロジェクトを開き、すぐにコーディングを開始します。
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/vbenjs/vue-vben-admin)
## ドキュメント
[ドキュメント](https://doc.vben.pro/)
## インストールと使用
1. プロジェクトコードを取得
```bash
git clone https://github.com/vbenjs/vue-vben-admin.git
```
2. 依存関係のインストール
```bash
cd vue-vben-admin
npm i -g corepack
pnpm install
```
3. 実行
```bash
pnpm dev
```
4. ビルド
```bash
pnpm build
```
## 変更ログ
[CHANGELOG](https://github.com/vbenjs/vue-vben-admin/releases)
## 貢献方法
ご参加をお待ちしております![Issueを提出](https://github.com/anncwb/vue-vben-admin/issues/new/choose)するか、Pull Requestを送信してください。
**Pull Request プロセス:**
1. コードをフォーク
2. 自分のブランチを作成:`git checkout -b feat/xxxx`
3. 変更をコミット:`git commit -am 'feat(function): add xxxxx'`
4. ブランチをプッシュ:`git push origin feat/xxxx`
5. `pull request`を送信
## Git貢献提出規則
参考 [vue](https://github.com/vuejs/vue/blob/dev/.github/COMMIT_CONVENTION.md) 規則 ([Angular](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular))
- `feat` 新機能の追加
- `fix` 問題/バグの修正
- `style` コードスタイルに関連し、実行結果に影響しない
- `perf` 最適化/パフォーマンス向上
- `refactor` リファクタリング
- `revert` 変更の取り消し
- `test` テスト関連
- `docs` ドキュメント/注釈
- `chore` 依存関係の更新/スキャフォールディング設定の変更など
- `ci` 継続的インテグレーション
- `types` 型定義ファイルの変更
## ブラウザサポート
ローカル開発には `Chrome 80+` ブラウザを推奨します
モダンブラウザをサポートし、IEはサポートしません
| [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png" alt="Edge" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Edge | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png" alt="Firefox" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Firefox | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png" alt="Chrome" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Chrome | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_48x48.png" alt="Safari" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Safari |
| :-: | :-: | :-: | :-: |
| 最新2バージョン | 最新2バージョン | 最新2バージョン | 最新2バージョン |
## メンテナー
[@Vben](https://github.com/anncwb)
## スター歴史
[![Star History Chart](https://api.star-history.com/svg?repos=vbenjs/vue-vben-admin&type=Date)](https://star-history.com/#vbenjs/vue-vben-admin&Date)
## 寄付
このプロジェクトが役に立つと思われた場合、作者にコーヒーを一杯おごってサポートを示すことができます!
![donate](https://unpkg.com/@vbenjs/static-source@0.1.7/source/sponsor.png)
<a style="display: block;width: 100px;height: 50px;line-height: 50px; color: #fff;text-align: center; background: #408aed;border-radius: 4px;" href="https://www.paypal.com/paypalme/cvvben">Paypal Me</a>
## 貢献者
<a href="https://github.com/vbenjs/vue-vben-admin/graphs/contributors">
<img alt="Contributors" src="https://opencollective.com/vbenjs/contributors.svg?button=false" />
</a>
## Discord
- [Github Discussions](https://github.com/anncwb/vue-vben-admin/discussions)
## ライセンス
[MIT © Vben-2020](./LICENSE)
+60
View File
@@ -0,0 +1,60 @@
# ecom-dmb-frontend
电商 DMB 前端(Vben Admin 5.5.9)
## 技术栈
- Vue 3 + TypeScript
- Vben Admin 5.5.9(monorepo)
- Ant Design Vue 组件库
- Tailwind CSS 样式
- ECharts 图表
- Vite 6 构建
## 快速启动
```bash
cd ecom-dmb-frontend
pnpm install
pnpm dev
```
访问:http://localhost:5666
## 构建生产版本
```bash
pnpm run build
```
## 项目结构
```
ecom-dmb-frontend/apps/
├── web-antd/ # 主应用
│ └── src/
│ ├── api/ # API 接口(按模块划分)
│ │ ├── ecommerce/ # 电商模块 API
│ │ ├── organization/
│ │ ├── media/
│ │ └── system/
│ ├── views/
│ │ ├── dashboard/ # Dashboard 页面
│ │ ├── ecommerce/ # 电商页面
│ │ └── ...
│ └── utils/ # 工具函数
└── backend-mock/ # Mock 服务
```
## 样式规范
- 全局使用 **Tailwind CSS** 类名
- 禁止在 Vue 文件中混用普通 CSS(保证一致性)
- 使用 `@vben/common-ui` 的 `Page` 组件做页面包裹
- 响应式布局使用 `grid` + `flex`
## 新增页面流程
1. 在 `views/` 下创建页面组件
2. 在 `api/` 下定义对应的 API 函数
3. 在后端菜单管理中添加路由并分配权限
+153
View File
@@ -0,0 +1,153 @@
<div align="center">
<a href="https://github.com/anncwb/vue-vben-admin">
<img alt="VbenAdmin Logo" width="215" src="https://unpkg.com/@vbenjs/static-source@0.1.7/source/logo-v1.webp">
</a>
<br>
<br>
[![license](https://img.shields.io/github/license/anncwb/vue-vben-admin.svg)](LICENSE)
<h1>Vue Vben Admin</h1>
</div>
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=vbenjs_vue-vben-admin&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=vbenjs_vue-vben-admin) ![codeql](https://github.com/vbenjs/vue-vben-admin/actions/workflows/codeql.yml/badge.svg) ![build](https://github.com/vbenjs/vue-vben-admin/actions/workflows/build.yml/badge.svg) ![ci](https://github.com/vbenjs/vue-vben-admin/actions/workflows/ci.yml/badge.svg) ![deploy](https://github.com/vbenjs/vue-vben-admin/actions/workflows/deploy.yml/badge.svg)
**中文** | [English](./README.md) | [日本語](./README.ja-JP.md)
## 简介
Vue Vben Admin 是 Vue Vben Admin 的升级版本。作为一个免费开源的中后台模板,它采用了最新的 Vue 3、Vite、TypeScript 等主流技术开发,开箱即用,可用于中后台前端开发,也适合学习参考。
## 升级提示
该版本为最新版本 `5.0`,与其他版本不兼容,如果你是新项目,建议使用最新版本。如果你想查看旧版本,请使用 [v2 分支](https://github.com/vbenjs/vue-vben-admin/tree/v2)
## 特性
- **最新技术栈**:使用 Vue3/vite 等前端前沿技术开发
- **TypeScript**:应用程序级 JavaScript 的语言
- **主题**:提供多套主题色彩,可配置自定义主题
- **国际化**:内置完善的国际化方案
- **权限**:内置完善的动态路由权限生成方案
## 预览
- [Vben Admin](https://vben.pro/) - 完整版中文站点
测试账号:vben/123456
<div align="center">
<img alt="VbenAdmin Logo" width="100%" src="https://anncwb.github.io/anncwb/images/preview1.png">
<img alt="VbenAdmin Logo" width="100%" src="https://anncwb.github.io/anncwb/images/preview2.png">
<img alt="VbenAdmin Logo" width="100%" src="https://anncwb.github.io/anncwb/images/preview3.png">
</div>
### 使用 Gitpod
在 Gitpod(适用于 GitHub 的免费在线开发环境)中打开项目,并立即开始编码。
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/vbenjs/vue-vben-admin)
## 文档
[文档地址](https://doc.vben.pro/)
## 安装使用
1. 获取项目代码
```bash
git clone https://github.com/vbenjs/vue-vben-admin.git
```
2. 安装依赖
```bash
cd vue-vben-admin
npm i -g corepack
pnpm install
```
3. 运行
```bash
pnpm dev
```
4. 打包
```bash
pnpm build
```
## 更新日志
[CHANGELOG](https://github.com/vbenjs/vue-vben-admin/releases)
## 如何贡献
非常欢迎你的加入![提一个 Issue](https://github.com/anncwb/vue-vben-admin/issues/new/choose) 或者提交一个 Pull Request。
**Pull Request 流程:**
1. Fork 代码
2. 创建自己的分支:`git checkout -b feature/xxxx`
3. 提交你的修改:`git commit -am 'feat(function): add xxxxx'`
4. 推送您的分支:`git push origin feature/xxxx`
5. 提交 `pull request`
## Git 贡献提交规范
参考 [vue](https://github.com/vuejs/vue/blob/dev/.github/COMMIT_CONVENTION.md) 规范 ([Angular](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular))
- `feat` 增加新功能
- `fix` 修复问题/BUG
- `style` 代码风格相关无影响运行结果的
- `perf` 优化/性能提升
- `refactor` 重构
- `revert` 撤销修改
- `test` 测试相关
- `docs` 文档/注释
- `chore` 依赖更新/脚手架配置修改等
- `ci` 持续集成
- `types` 类型定义文件更改
## 浏览器支持
本地开发推荐使用 `Chrome 80+` 浏览器
支持现代浏览器,不支持 IE
| [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png" alt="Edge" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Edge | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png" alt="Firefox" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Firefox | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png" alt="Chrome" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Chrome | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_48x48.png" alt="Safari" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Safari |
| :-: | :-: | :-: | :-: |
| last 2 versions | last 2 versions | last 2 versions | last 2 versions |
## 维护者
[@Vben](https://github.com/anncwb)
## Star 历史
[![Star History Chart](https://api.star-history.com/svg?repos=vbenjs/vue-vben-admin&type=Date)](https://star-history.com/#vbenjs/vue-vben-admin&Date)
## 捐赠
如果你觉得这个项目对你有帮助,你可以帮作者买一杯咖啡表示支持!
![donate](https://unpkg.com/@vbenjs/static-source@0.1.7/source/sponsor.png)
<a style="display: block;width: 100px;height: 50px;line-height: 50px; color: #fff;text-align: center; background: #408aed;border-radius: 4px;" href="https://www.paypal.com/paypalme/cvvben">Paypal Me</a>
## 贡献者
<a href="https://github.com/vbenjs/vue-vben-admin/graphs/contributors">
<img alt="Contributors" src="https://opencollective.com/vbenjs/contributors.svg?button=false" />
</a>
## Discord
- [Github Discussions](https://github.com/anncwb/vue-vben-admin/discussions)
## 许可证
[MIT © Vben-2020](./LICENSE)
+8
View File
@@ -0,0 +1,8 @@
# 应用标题
VITE_APP_TITLE=CD ECOMDMB
# 应用命名空间,用于缓存、store等功能的前缀,确保隔离
VITE_APP_NAMESPACE=ce-ecom-dmb
# 对store进行加密的密钥,在将store持久化到localStorage时会使用该密钥进行加密
VITE_APP_STORE_SECURE_KEY=please-replace-me-with-your-own-key
+7
View File
@@ -0,0 +1,7 @@
# public path
VITE_BASE=/
# Basic interface address SPA
VITE_GLOB_API_URL=/api
VITE_VISUALIZER=true
+16
View File
@@ -0,0 +1,16 @@
# 端口号
VITE_PORT=5666
VITE_BASE=/
# 接口地址
VITE_GLOB_API_URL=/api
# 是否开启 Nitro Mock服务,true 为开启,false 为关闭
VITE_NITRO_MOCK=false
# 是否打开 devtools,true 为打开,false 为关闭
VITE_DEVTOOLS=false
# 是否注入全局loading
VITE_INJECT_APP_LOADING=true
+19
View File
@@ -0,0 +1,19 @@
VITE_BASE=/
# 接口地址
VITE_GLOB_API_URL=/api
# 是否开启压缩,可以设置为 none, brotli, gzip
VITE_COMPRESS=none
# 是否开启 PWA
VITE_PWA=false
# vue-router 的模式
VITE_ROUTER_HISTORY=history
# 是否注入全局loading
VITE_INJECT_APP_LOADING=true
# 打包后是否生成dist.zip
VITE_ARCHIVER=false
+22
View File
@@ -0,0 +1,22 @@
<!doctype html>
<html lang="zh">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="renderer" content="webkit" />
<meta name="description" content="电商数据中台 - 订单导入与管理" />
<meta name="keywords" content="电商 数据中台 订单管理" />
<meta name="author" content="CD" />
<meta
name="viewport"
content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0"
/>
<!-- 由 vite 注入 VITE_APP_TITLE 变量,在 .env 文件内配置 -->
<title>%VITE_APP_TITLE%</title>
<link rel="icon" href="/cd-logo.png" type="image/png" />
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
+60
View File
@@ -0,0 +1,60 @@
{
"name": "@vben/web-antd",
"version": "5.7.0",
"homepage": "https://vben.pro",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {
"type": "git",
"url": "git+https://github.com/vbenjs/vue-vben-admin.git",
"directory": "apps/web-antd"
},
"license": "MIT",
"author": {
"name": "vben",
"email": "ann.vben@gmail.com",
"url": "https://github.com/anncwb"
},
"type": "module",
"scripts": {
"build": "pnpm vite build --mode production",
"build:analyze": "pnpm vite build --mode analyze",
"dev": "pnpm vite --mode development",
"preview": "vite preview",
"typecheck": "vue-tsc --noEmit --skipLibCheck"
},
"imports": {
"#/*": "./src/*"
},
"dependencies": {
"@ant-design/icons-vue": "^7.0.1",
"@tdesign-vue-next/chat": "^0.7.0",
"@vben/access": "workspace:*",
"@vben/common-ui": "workspace:*",
"@vben/constants": "workspace:*",
"@vben/hooks": "workspace:*",
"@vben/icons": "workspace:*",
"@vben/layouts": "workspace:*",
"@vben/locales": "workspace:*",
"@vben/plugins": "workspace:*",
"@vben/preferences": "workspace:*",
"@vben/request": "workspace:*",
"@vben/stores": "workspace:*",
"@vben/styles": "workspace:*",
"@vben/types": "workspace:*",
"@vben/utils": "workspace:*",
"@vueuse/core": "catalog:",
"ant-design-vue": "catalog:",
"dayjs": "catalog:",
"papaparse": "^5.4.1",
"pinia": "catalog:",
"spark-md5": "^3.0.2",
"tdesign-vue-next": "^1.20.8",
"vue": "catalog:",
"vue-router": "catalog:",
"vue-waterfall-plugin-next": "^3.0.0"
},
"devDependencies": {
"@types/papaparse": "^5.3.14",
"@types/spark-md5": "^3.0.5"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 791 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,51 @@
{
"metadata": {
"source": "CSV导入",
"totalRecords": 3,
"exportTime": "2024-01-15T10:30:00.000Z",
"fieldMappings": {
"商品": "product_name",
"订单号": "order_id",
"订单状态": "order_status",
"商品数量(件)": "quantity",
"商品id": "product_id",
"商品规格": "product_spec",
"售后状态": "after_sale_status",
"商家实收金额(元)": "amount"
},
"customFieldNames": {},
"shopName": "居家专营"
},
"data": [
{
"product_name": "【山姆特惠购】洗衣液香味持久留香强效洁净抑菌除污学生母婴家用",
"order_id": "250908-427708925610575",
"order_status": "待发货",
"quantity": 1,
"product_id": "787611070565",
"product_spec": "摩擦生香/打造自然伪体香/72h优雅香随,超值推荐【10斤/1大桶】加量不加价",
"after_sale_status": "无售后或售后取消",
"amount": 29.9
},
{
"product_name": "【山姆特惠购】洗衣液香味持久留香强效洁净抑菌除污学生母婴家用",
"order_id": "250908-275702147461177",
"order_status": "待发货",
"quantity": 1,
"product_id": "787611070565",
"product_spec": "摩擦生香/打造自然伪体香/72h优雅香随,日用套装【4斤/1瓶】植萃护衣",
"after_sale_status": "无售后或售后取消",
"amount": 18.8
},
{
"product_name": "【山姆特惠购】洗衣液香味持久留香强效洁净抑菌除污学生母婴家用",
"order_id": "250908-419461895710461",
"order_status": "待发货",
"quantity": 1,
"product_id": "787611070565",
"product_spec": "摩擦生香/打造自然伪体香/72h优雅香随,单人套装【9斤/2件套】洁净抑菌",
"after_sale_status": "无售后或售后取消",
"amount": 29.9
}
]
}
@@ -0,0 +1,211 @@
/**
* 通用组件共同的使用的基础组件,原先放在 adapter/form 内部,限制了使用范围,这里提取出来,方便其他地方使用
* 可用于 vben-form、vben-modal、vben-drawer 等组件使用,
*/
import type { Component } from 'vue';
import type { BaseFormComponentType } from '@vben/common-ui';
import type { Recordable } from '@vben/types';
import { defineAsyncComponent, defineComponent, h, ref } from 'vue';
import { ApiComponent, globalShareState, IconPicker } from '@vben/common-ui';
import { $t } from '@vben/locales';
import { notification } from 'ant-design-vue';
const AutoComplete = defineAsyncComponent(
() => import('ant-design-vue/es/auto-complete'),
);
const Button = defineAsyncComponent(() => import('ant-design-vue/es/button'));
const Checkbox = defineAsyncComponent(
() => import('ant-design-vue/es/checkbox'),
);
const CheckboxGroup = defineAsyncComponent(() =>
import('ant-design-vue/es/checkbox').then((res) => res.CheckboxGroup),
);
const DatePicker = defineAsyncComponent(
() => import('ant-design-vue/es/date-picker'),
);
const Divider = defineAsyncComponent(() => import('ant-design-vue/es/divider'));
const Input = defineAsyncComponent(() => import('ant-design-vue/es/input'));
const InputNumber = defineAsyncComponent(
() => import('ant-design-vue/es/input-number'),
);
const InputPassword = defineAsyncComponent(() =>
import('ant-design-vue/es/input').then((res) => res.InputPassword),
);
const Mentions = defineAsyncComponent(
() => import('ant-design-vue/es/mentions'),
);
const Radio = defineAsyncComponent(() => import('ant-design-vue/es/radio'));
const RadioGroup = defineAsyncComponent(() =>
import('ant-design-vue/es/radio').then((res) => res.RadioGroup),
);
const RangePicker = defineAsyncComponent(() =>
import('ant-design-vue/es/date-picker').then((res) => res.RangePicker),
);
const Rate = defineAsyncComponent(() => import('ant-design-vue/es/rate'));
const Select = defineAsyncComponent(() => import('ant-design-vue/es/select'));
const Space = defineAsyncComponent(() => import('ant-design-vue/es/space'));
const Switch = defineAsyncComponent(() => import('ant-design-vue/es/switch'));
const Textarea = defineAsyncComponent(() =>
import('ant-design-vue/es/input').then((res) => res.Textarea),
);
const TimePicker = defineAsyncComponent(
() => import('ant-design-vue/es/time-picker'),
);
const TreeSelect = defineAsyncComponent(
() => import('ant-design-vue/es/tree-select'),
);
const Upload = defineAsyncComponent(() => import('ant-design-vue/es/upload'));
const withDefaultPlaceholder = <T extends Component>(
component: T,
type: 'input' | 'select',
componentProps: Recordable<any> = {},
) => {
return defineComponent({
name: component.name,
inheritAttrs: false,
setup: (props: any, { attrs, expose, slots }) => {
const placeholder =
props?.placeholder ||
attrs?.placeholder ||
$t(`ui.placeholder.${type}`);
// 透传组件暴露的方法
const innerRef = ref();
expose(
new Proxy(
{},
{
get: (_target, key) => innerRef.value?.[key],
has: (_target, key) => key in (innerRef.value || {}),
},
),
);
return () =>
h(
component,
{ ...componentProps, placeholder, ...props, ...attrs, ref: innerRef },
slots,
);
},
});
};
// 这里需要自行根据业务组件库进行适配,需要用到的组件都需要在这里类型说明
export type ComponentType =
| 'ApiSelect'
| 'ApiTreeSelect'
| 'AutoComplete'
| 'Checkbox'
| 'CheckboxGroup'
| 'DatePicker'
| 'DefaultButton'
| 'Divider'
| 'IconPicker'
| 'Input'
| 'InputNumber'
| 'InputPassword'
| 'Mentions'
| 'PrimaryButton'
| 'Radio'
| 'RadioGroup'
| 'RangePicker'
| 'Rate'
| 'Select'
| 'Space'
| 'Switch'
| 'Textarea'
| 'TimePicker'
| 'TreeSelect'
| 'Upload'
| BaseFormComponentType;
async function initComponentAdapter() {
const components: Partial<Record<ComponentType, Component>> = {
// 如果你的组件体积比较大,可以使用异步加载
// Button: () =>
// import('xxx').then((res) => res.Button),
ApiSelect: withDefaultPlaceholder(
{
...ApiComponent,
name: 'ApiSelect',
},
'select',
{
component: Select,
loadingSlot: 'suffixIcon',
visibleEvent: 'onDropdownVisibleChange',
modelPropName: 'value',
},
),
ApiTreeSelect: withDefaultPlaceholder(
{
...ApiComponent,
name: 'ApiTreeSelect',
},
'select',
{
component: TreeSelect,
fieldNames: { label: 'label', value: 'value', children: 'children' },
loadingSlot: 'suffixIcon',
modelPropName: 'value',
optionsPropName: 'treeData',
visibleEvent: 'onVisibleChange',
},
),
AutoComplete,
Checkbox,
CheckboxGroup,
DatePicker,
// 自定义默认按钮
DefaultButton: (props, { attrs, slots }) => {
return h(Button, { ...props, attrs, type: 'default' }, slots);
},
Divider,
IconPicker: withDefaultPlaceholder(IconPicker, 'select', {
iconSlot: 'addonAfter',
inputComponent: Input,
modelValueProp: 'value',
}),
Input: withDefaultPlaceholder(Input, 'input'),
InputNumber: withDefaultPlaceholder(InputNumber, 'input'),
InputPassword: withDefaultPlaceholder(InputPassword, 'input'),
Mentions: withDefaultPlaceholder(Mentions, 'input'),
// 自定义主要按钮
PrimaryButton: (props, { attrs, slots }) => {
return h(Button, { ...props, attrs, type: 'primary' }, slots);
},
Radio,
RadioGroup,
RangePicker,
Rate,
Select: withDefaultPlaceholder(Select, 'select'),
Space,
Switch,
Textarea: withDefaultPlaceholder(Textarea, 'input'),
TimePicker,
TreeSelect: withDefaultPlaceholder(TreeSelect, 'select'),
Upload,
};
// 将组件注册到全局共享状态中
globalShareState.setComponents(components);
// 定义全局共享状态中的消息提示
globalShareState.defineMessage({
// 复制成功消息提示
copyPreferencesSuccess: (title, content) => {
notification.success({
description: content,
message: title,
placement: 'bottomRight',
});
},
});
}
export { initComponentAdapter };
@@ -0,0 +1,49 @@
import type {
VbenFormSchema as FormSchema,
VbenFormProps,
} from '@vben/common-ui';
import type { ComponentType } from './component';
import { setupVbenForm, useVbenForm as useForm, z } from '@vben/common-ui';
import { $t } from '@vben/locales';
async function initSetupVbenForm() {
setupVbenForm<ComponentType>({
config: {
// ant design vue组件库默认都是 v-model:value
baseModelPropName: 'value',
// 一些组件是 v-model:checked 或者 v-model:fileList
modelPropNameMap: {
Checkbox: 'checked',
Radio: 'checked',
Switch: 'checked',
Upload: 'fileList',
},
},
defineRules: {
// 输入项目必填国际化适配
required: (value, _params, ctx) => {
if (value === undefined || value === null || value.length === 0) {
return $t('ui.formRules.required', [ctx.label]);
}
return true;
},
// 选择项目必填国际化适配
selectRequired: (value, _params, ctx) => {
if (value === undefined || value === null) {
return $t('ui.formRules.selectRequired', [ctx.label]);
}
return true;
},
},
});
}
const useVbenForm = useForm<ComponentType>;
export { initSetupVbenForm, useVbenForm, z };
export type VbenFormSchema = FormSchema<ComponentType>;
export type { VbenFormProps };
@@ -0,0 +1,208 @@
import type { VxeTableGridOptions } from '@vben/plugins/vxe-table';
import { h } from 'vue';
import { setupVbenVxeTable, useVbenVxeGrid } from '@vben/plugins/vxe-table';
import { Button, Image, Select, TreeSelect } from 'ant-design-vue';
import { CaretUpOutlined, CaretDownOutlined } from '@ant-design/icons-vue';
import { useVbenForm } from './form';
function createArrowHandlers(
getData: () => any[],
getIdx: (data: any[]) => number,
colField: string,
sourceRow: any,
) {
let timer: ReturnType<typeof setTimeout> | null = null;
const copyTo = (targetRow: any) => {
if (targetRow) targetRow[colField] = sourceRow[colField];
};
const copyRange = (from: number, to: number, data: any[]) => {
for (let i = from; i < to; i++) {
copyTo(data[i]);
}
};
const withData = (fn: (data: any[], idx: number) => void) => {
const data = getData();
const idx = getIdx(data);
fn(data, idx);
};
const singleUp = () => {
if (timer) { clearTimeout(timer); timer = null; }
timer = setTimeout(() => {
withData((data, idx) => { if (idx > 0) copyTo(data[idx - 1]); });
timer = null;
}, 200);
};
const dblUp = () => {
if (timer) { clearTimeout(timer); timer = null; }
withData((data, idx) => { if (idx > 0) copyRange(0, idx, data); });
};
const singleDown = () => {
if (timer) { clearTimeout(timer); timer = null; }
timer = setTimeout(() => {
withData((data, idx) => { if (idx >= 0 && idx < data.length - 1) copyTo(data[idx + 1]); });
timer = null;
}, 200);
};
const dblDown = () => {
if (timer) { clearTimeout(timer); timer = null; }
withData((data, idx) => { if (idx < data.length - 1) copyRange(idx + 1, data.length, data); });
};
return { singleUp, dblUp, singleDown, dblDown };
}
setupVbenVxeTable({
configVxeTable: (vxeUI) => {
vxeUI.setConfig({
grid: {
align: 'center',
border: false,
columnConfig: {
resizable: true,
},
minHeight: 180,
formConfig: {
enabled: false,
},
proxyConfig: {
autoLoad: true,
response: {
result: 'items',
total: 'total',
list: 'items',
},
showActiveMsg: true,
showResponseMsg: false,
},
round: true,
showOverflow: true,
size: 'small',
} as VxeTableGridOptions,
});
vxeUI.renderer.add('CellImage', {
renderTableDefault(_renderOpts, params) {
const { column, row } = params;
return h(Image, { src: row[column.field] });
},
});
vxeUI.renderer.add('CellLink', {
renderTableDefault(renderOpts) {
const { props } = renderOpts;
return h(Button, { size: 'small', type: 'link' }, { default: () => props?.text });
},
});
function sharedGetData($table: any, $grid: any): any[] {
return ($grid as any)?.getTableData?.()?.fullData
|| ($table as any)?.getTableData?.()?.fullData
|| ($table as any)?.tableData
|| [];
}
function sharedGetIdx(data: any[], row: any): number {
const srcIdx = (row as any).__srcRowIndex;
return typeof srcIdx === 'number'
? data.findIndex((r: any) => r.__srcRowIndex === srcIdx)
: data.indexOf(row);
}
vxeUI.renderer.add('CellSelect', {
renderTableDefault(renderOpts, params) {
const { props } = renderOpts;
const { row, column, $table, $grid } = params;
const getData = () => sharedGetData($table, $grid);
const getIdx = (data: any[]) => sharedGetIdx(data, row);
const { singleUp, dblUp, singleDown, dblDown } = createArrowHandlers(getData, getIdx, column.field, row);
const allOptions: any[] = props?.options || [];
const filterField = props?.filterByRowField as string | undefined;
const filterKey = props?.filterOptionKey as string | undefined;
const rowFilterVal = filterField ? row[filterField] : undefined;
const displayOptions = filterField && rowFilterVal && filterKey
? allOptions.filter((opt: any) => String(opt[filterKey]) === String(rowFilterVal))
: allOptions;
return h('div', { style: 'display: flex; align-items: center; gap: 2px;' }, [
h(Select, {
value: row[column.field] ?? undefined,
'onUpdate:value': (val: any) => { row[column.field] = val; },
options: displayOptions,
allowClear: props?.allowClear ?? true,
placeholder: props?.placeholder || '',
showSearch: props?.showSearch ?? false,
filterOption: props?.filterOption,
style: 'flex: 1; min-width: 0;',
size: 'small',
}),
h('div', { style: 'display: flex; flex-direction: column; gap: 0; flex-shrink: 0; width: 18px;' }, [
h(Button, {
size: 'small', type: 'text',
onClick: singleUp, onDblclick: dblUp,
title: '单击复制上一行,双击复制上面全部',
style: 'padding: 0; height: 11px; width: 18px; line-height: 11px; font-size: 8px; border-radius: 2px 2px 0 0; min-width: 0;',
}, { default: () => h(CaretUpOutlined) }),
h(Button, {
size: 'small', type: 'text',
onClick: singleDown, onDblclick: dblDown,
title: '单击复制下一行,双击复制下面全部',
style: 'padding: 0; height: 11px; width: 18px; line-height: 11px; font-size: 8px; border-radius: 0 0 2px 2px; min-width: 0;',
}, { default: () => h(CaretDownOutlined) }),
]),
]);
},
});
vxeUI.renderer.add('CellTreeSelect', {
renderTableDefault(renderOpts, params) {
const { props } = renderOpts;
const { row, column, $table, $grid } = params;
const getData = () => sharedGetData($table, $grid);
const getIdx = (data: any[]) => sharedGetIdx(data, row);
const { singleUp, dblUp, singleDown, dblDown } = createArrowHandlers(getData, getIdx, column.field, row);
return h('div', { style: 'display: flex; align-items: center; gap: 2px;' }, [
h(TreeSelect, {
value: row[column.field] ?? undefined,
'onUpdate:value': (val: any) => { row[column.field] = val; },
treeData: props?.treeData || [],
fieldNames: props?.fieldNames || { label: 'name', value: 'id', children: 'children' },
allowClear: props?.allowClear ?? true,
placeholder: props?.placeholder || '',
treeDefaultExpandAll: props?.treeDefaultExpandAll ?? false,
style: 'flex: 1; min-width: 0;',
size: 'small',
}),
h('div', { style: 'display: flex; flex-direction: column; gap: 0; flex-shrink: 0; width: 18px;' }, [
h(Button, {
size: 'small', type: 'text',
onClick: singleUp, onDblclick: dblUp,
title: '单击复制上一行,双击复制上面全部',
style: 'padding: 0; height: 11px; width: 18px; line-height: 11px; font-size: 8px; border-radius: 2px 2px 0 0; min-width: 0;',
}, { default: () => h(CaretUpOutlined) }),
h(Button, {
size: 'small', type: 'text',
onClick: singleDown, onDblclick: dblDown,
title: '单击复制下一行,双击复制下面全部',
style: 'padding: 0; height: 11px; width: 18px; line-height: 11px; font-size: 8px; border-radius: 0 0 2px 2px; min-width: 0;',
}, { default: () => h(CaretDownOutlined) }),
]),
]);
},
});
},
useVbenForm,
});
export { useVbenVxeGrid };
export type * from '@vben/plugins/vxe-table';
@@ -0,0 +1,402 @@
import { useAccessStore } from '@vben/stores';
import { requestClient } from '#/api/request';
/** Agent 服务走 /api/agent,开发态由 Vite 代理到 :8200 */
export namespace AgentVO {
/** general=经营助手;ecom_goods_publish=拼多多商品发布 */
export type SessionScene = 'general' | 'ecom_goods_publish' | string;
export interface Session {
threadId: string;
title: string;
status: string;
scene?: SessionScene;
sceneRef?: string | null;
llmProviderId?: number | null;
llmModel?: string | null;
createdAt?: string;
updatedAt?: string;
lastMessageAt?: string | null;
}
/** SSE client_tool:前端执行后需把真实结果 POST 回当前轮 */
export interface ClientToolCall {
toolCallId: string;
name: string;
args: Record<string, unknown>;
label?: string;
}
export interface Message {
id?: string;
seq: number;
role: 'user' | 'assistant' | 'system' | 'tool';
content: string;
createdAt?: string;
}
export interface LlmModelItem {
id?: number;
providerId: number;
providerDisplayName?: string | null;
model: string;
label?: string | null;
contextWindow?: number | null;
isDefault?: boolean;
enabled?: boolean;
}
export interface LlmProvider {
id: number;
configured: boolean;
baseUrl?: string | null;
displayName?: string | null;
/** auto | completions | responses */
apiStyle?: string | null;
apiKeyMasked?: string | null;
models?: LlmModelItem[];
updateTime?: string;
}
export interface ProbedLlmModel {
id: string;
contextWindow?: number | null;
}
export interface Memory {
id: string;
kind: string;
key?: string | null;
text: string;
summary?: string;
updatedAt?: string;
}
}
export async function listAgentSessionsApi(options?: {
scene?: AgentVO.SessionScene;
}) {
return requestClient.get<{ items: AgentVO.Session[] }>('/agent/sessions', {
params: { scene: options?.scene ?? 'general' },
});
}
export async function createAgentSessionApi(options?: {
title?: string;
llmProviderId?: number;
llmModel?: string;
scene?: AgentVO.SessionScene;
sceneRef?: string;
/** 同 scene+sceneRef 已有活跃会话则复用 */
reuseBySceneRef?: boolean;
}) {
return requestClient.post<AgentVO.Session>('/agent/sessions', {
title: options?.title,
llmProviderId: options?.llmProviderId,
llmModel: options?.llmModel,
scene: options?.scene,
sceneRef: options?.sceneRef,
reuseBySceneRef: options?.reuseBySceneRef,
});
}
/** 前端工具真实结果,唤醒 Agent 当前轮里挂起的 ui_set_* */
export async function submitAgentClientToolResultApi(
threadId: string,
body: { toolCallId: string; ok: boolean; message: string },
) {
return requestClient.post<{ accepted: boolean }>(
`/agent/sessions/${threadId}/client-tool-results`,
body,
);
}
export async function patchAgentSessionApi(
threadId: string,
body: {
title?: string;
llmProviderId?: number;
llmModel?: string;
/** 未落库会话(local-*)改绑到系统草稿 ID */
sceneRef?: string;
},
) {
return requestClient.patch<AgentVO.Session>(
`/agent/sessions/${threadId}`,
body,
);
}
/** 软删会话(级联软删消息) */
export async function deleteAgentSessionApi(threadId: string) {
return requestClient.delete<AgentVO.Session>(`/agent/sessions/${threadId}`);
}
export async function listAgentMessagesApi(threadId: string) {
return requestClient.get<{ items: AgentVO.Message[] }>(
`/agent/sessions/${threadId}/messages`,
);
}
export async function listAgentMemoriesApi() {
return requestClient.get<{ items: AgentVO.Memory[] }>('/agent/memories');
}
export async function deleteAgentMemoryApi(memoryId: string) {
return requestClient.delete<{ ok: boolean }>(`/agent/memories/${memoryId}`);
}
export async function listAgentLlmProvidersApi() {
return requestClient.get<{ items: AgentVO.LlmProvider[] }>(
'/company/agent-llm-providers',
);
}
export async function getAgentLlmProviderApi(providerId: number) {
return requestClient.get<AgentVO.LlmProvider>(
`/company/agent-llm-providers/${providerId}`,
);
}
export async function createAgentLlmProviderApi(body: {
baseUrl: string;
apiKey: string;
displayName?: string;
apiStyle?: string;
}) {
return requestClient.post<AgentVO.LlmProvider>(
'/company/agent-llm-providers',
body,
);
}
export async function updateAgentLlmProviderApi(
providerId: number,
body: {
baseUrl?: string;
apiKey?: string;
displayName?: string;
apiStyle?: string;
},
) {
return requestClient.put<AgentVO.LlmProvider>(
`/company/agent-llm-providers/${providerId}`,
body,
);
}
export async function deleteAgentLlmProviderApi(providerId: number) {
return requestClient.delete<void>(
`/company/agent-llm-providers/${providerId}`,
);
}
export async function upsertAgentLlmProviderModelsApi(
providerId: number,
models: Array<{
model: string;
label?: string;
contextWindow?: number | null;
isDefault?: boolean;
enabled?: boolean;
}>,
) {
return requestClient.put<AgentVO.LlmProvider>(
`/company/agent-llm-providers/${providerId}/models`,
{ models },
);
}
export async function setAgentLlmModelEnabledApi(
providerId: number,
body: { model: string; enabled: boolean },
) {
return requestClient.put<AgentVO.LlmProvider>(
`/company/agent-llm-providers/${providerId}/models/enabled`,
body,
);
}
/** 聊天选模型:已启用列表,不含 Key */
export async function listAgentEnabledLlmModelsApi() {
return requestClient.get<{ items: AgentVO.LlmModelItem[] }>(
'/company/agent-llm-models',
);
}
/** 服务端代理 GET /v1/models,不落库 */
export async function probeAgentLlmModelsApi(body: {
baseUrl?: string;
apiKey?: string;
useStoredKey?: boolean;
providerId?: number;
}) {
return requestClient.post<{ items: AgentVO.ProbedLlmModel[] }>(
'/company/agent-llm-settings/probe-models',
body,
);
}
/** SSE 流式发消息 */
export function streamAgentChat(options: {
threadId: string;
content: string;
/** 发布场景:当前表单快照,注入 Agent system */
formSnapshot?: Record<string, unknown>;
onToken: (text: string) => void;
onTool?: (payload: {
phase: string;
name?: string;
label: string;
}) => void;
/** 前端工具:执行后应尽快 POST 回执;打字动画不要堵在这个回调里 */
onClientTool?: (
call: AgentVO.ClientToolCall,
) => void | Promise<void>;
onDone?: () => void;
onError?: (message: string) => void;
}): AbortController {
const controller = new AbortController();
const accessStore = useAccessStore();
const token = accessStore.accessToken;
const url = `/api/agent/sessions/${options.threadId}/chat`;
void (async () => {
try {
const res = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Accept: 'text/event-stream',
...(token ? { Authorization: `Bearer ${token}` } : {}),
},
body: JSON.stringify({
content: options.content,
...(options.formSnapshot
? { formSnapshot: options.formSnapshot }
: {}),
}),
signal: controller.signal,
});
if (!res.ok || !res.body) {
options.onError?.(`请求失败 HTTP ${res.status}`);
return;
}
const reader = res.body.getReader();
const decoder = new TextDecoder();
let buffer = '';
let finished = false;
const consumeBlock = async (part: string) => {
const lines = part.split('\n');
let event = 'message';
const dataLines: string[] = [];
for (const rawLine of lines) {
const line = rawLine.replace(/\r$/, '');
if (!line || line.startsWith(':')) continue;
if (line.startsWith('event:')) {
event = line.slice(6).trim();
} else if (line.startsWith('data:')) {
dataLines.push(line.slice(5).replace(/^ /, ''));
}
}
const data = dataLines.join('\n');
if (!data && event !== 'done') return;
if (event === 'token') {
try {
const parsed = JSON.parse(data) as { text?: string };
if (parsed.text) options.onToken(parsed.text);
} catch {
options.onToken(data);
}
} else if (event === 'tool') {
try {
const parsed = JSON.parse(data) as {
phase?: string;
name?: string;
label?: string;
};
if (parsed.phase && parsed.label) {
options.onTool?.({
phase: parsed.phase,
name: parsed.name,
label: parsed.label,
});
}
} catch {
/* ignore malformed tool events */
}
} else if (event === 'client_tool') {
try {
const parsed = JSON.parse(data) as {
toolCallId?: string;
name?: string;
args?: unknown;
label?: string;
};
if (parsed.name) {
let toolArgs: Record<string, unknown> = {};
const rawArgs = parsed.args;
if (rawArgs && typeof rawArgs === 'object' && !Array.isArray(rawArgs)) {
toolArgs = rawArgs as Record<string, unknown>;
} else if (typeof rawArgs === 'string' && rawArgs.trim()) {
try {
const parsedArgs = JSON.parse(rawArgs) as unknown;
if (
parsedArgs &&
typeof parsedArgs === 'object' &&
!Array.isArray(parsedArgs)
) {
toolArgs = parsedArgs as Record<string, unknown>;
}
} catch {
/* ignore */
}
}
// 串行等待前端写入(含打字动效),避免连续 ui_* 互相 abort 后未落盘
await options.onClientTool?.({
toolCallId: parsed.toolCallId || parsed.name,
name: parsed.name,
args: toolArgs,
label: parsed.label,
});
}
} catch {
/* ignore malformed client_tool events */
}
} else if (event === 'error') {
try {
const parsed = JSON.parse(data) as { message?: string };
options.onError?.(parsed.message || data);
} catch {
options.onError?.(data);
}
} else if (event === 'done') {
finished = true;
options.onDone?.();
}
};
while (true) {
const { done, value } = await reader.read();
if (done) break;
buffer += decoder.decode(value, { stream: true });
buffer = buffer.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
const parts = buffer.split('\n\n');
buffer = parts.pop() || '';
for (const part of parts) {
if (part.trim()) await consumeBlock(part);
}
}
if (buffer.trim()) await consumeBlock(buffer);
if (!finished) options.onDone?.();
} catch (e: any) {
if (e?.name === 'AbortError') return;
options.onError?.(e?.message || '流式连接失败');
}
})();
return controller;
}
@@ -0,0 +1,21 @@
export type { AgentVO } from './apis';
export {
createAgentLlmProviderApi,
createAgentSessionApi,
deleteAgentLlmProviderApi,
deleteAgentMemoryApi,
deleteAgentSessionApi,
getAgentLlmProviderApi,
listAgentEnabledLlmModelsApi,
listAgentLlmProvidersApi,
listAgentMemoriesApi,
listAgentMessagesApi,
listAgentSessionsApi,
patchAgentSessionApi,
probeAgentLlmModelsApi,
setAgentLlmModelEnabledApi,
streamAgentChat,
submitAgentClientToolResultApi,
updateAgentLlmProviderApi,
upsertAgentLlmProviderModelsApi,
} from './apis';
@@ -0,0 +1,40 @@
import type { BiOrderStatCalcVO } from './types';
import { requestClient } from '#/api/request';
export async function getBiOrderStatIncCalcStatusApi(shopId: number) {
return requestClient.get<BiOrderStatCalcVO.IncStatus>(
'/bi/order-stat/calc/inc/status',
{ params: { shopId } },
);
}
export async function resumeBiOrderStatIncCalcApi(shopId: number) {
return requestClient.post<BiOrderStatCalcVO.IncStatus>(
'/bi/order-stat/calc/inc/resume',
undefined,
{ params: { shopId } },
);
}
export async function listBiOrderStatFullCalcTasksApi(
shopId: number,
limit = 20,
) {
return requestClient.get<BiOrderStatCalcVO.FullTask[]>(
'/bi/order-stat/calc/full-task/list',
{ params: { shopId, limit } },
);
}
/** 手动创建 BI 全量计算任务 */
export async function createBiOrderStatFullCalcTaskApi(data: {
shopId: number;
dateFrom: string;
dateTo: string;
}) {
return requestClient.post<BiOrderStatCalcVO.FullTask>(
'/bi/order-stat/calc/full-task',
data,
);
}
@@ -0,0 +1,2 @@
export * from './apis';
export type * from './types';
@@ -0,0 +1 @@
export type * from './types.vo';
@@ -0,0 +1,33 @@
export namespace BiOrderStatCalcVO {
export interface IncStatus {
shopId: number;
status?: number;
lastSummary?: string;
lastError?: string;
lastSuccessTime?: string;
lastStatDate?: string;
lastAppliedOrderId?: number;
lastSkipped?: number;
}
export interface FullTask {
id: number;
shopId: number;
/** MANUAL / CONVERT / DIRTY_DAY(历史:COST_SYNC / SKU_MIGRATE) */
triggerSource?: string;
/** 上游任务 id;含义由 triggerSource 决定 */
upstreamTaskId?: number;
platformCode?: string;
dateFrom: string;
dateTo: string;
currentDate?: string;
totalDays: number;
doneDays: number;
failedDays: number;
skippedDays?: number;
status: string;
lastError?: string;
createTime?: string;
finishTime?: string;
}
}
@@ -0,0 +1,25 @@
import type { BiOrderStatDirtyVO } from './types';
import { requestClient } from '#/api/request';
/** BI 脏日健康度摘要 */
export async function getBiOrderStatDirtyHealthApi() {
return requestClient.get<BiOrderStatDirtyVO.HealthSummary>(
'/bi/order-stat/dirty/health',
);
}
/** 待重算脏日列表 */
export async function listBiOrderStatDirtyPendingApi(limit = 200) {
return requestClient.get<BiOrderStatDirtyVO.PendingRow[]>(
'/bi/order-stat/dirty/pending',
{ params: { limit } },
);
}
/** 一键重算全部待处理脏日 */
export async function applyBiOrderStatDirtyPendingApi() {
return requestClient.post<BiOrderStatDirtyVO.ApplyResult>(
'/bi/order-stat/dirty/apply-pending',
);
}
@@ -0,0 +1,2 @@
export * from './apis';
export * from './types';
@@ -0,0 +1 @@
export * from './types.vo';
@@ -0,0 +1,34 @@
export namespace BiOrderStatDirtyVO {
export interface HealthSummary {
pendingDayCount: number;
pendingShopCount: number;
oldestPendingDate?: string;
hasRunning: boolean;
}
export interface PendingRow {
id: number;
shopId: number;
shopName?: string;
statDate: string;
reasons: string[];
status: string;
updateTime?: string;
}
export interface TaskBrief {
biCalcTaskId?: number;
shopId: number;
dateFrom: string;
dateTo: string;
totalDays: number;
status: string;
}
export interface ApplyResult {
applyBatchId: string;
dirtyDayCount: number;
taskCount: number;
tasks: TaskBrief[];
}
}
@@ -0,0 +1,33 @@
import type { BiOrderStatIncHealthVO } from './types';
import { requestClient } from '#/api/request';
/** BI 增量计算健康度摘要 */
export async function getBiOrderStatIncHealthApi() {
return requestClient.get<BiOrderStatIncHealthVO.HealthSummary>(
'/bi/order-stat/inc/health',
);
}
/** BI 增量计算按店明细 */
export async function listBiOrderStatIncShopsApi() {
return requestClient.get<BiOrderStatIncHealthVO.ShopRow[]>(
'/bi/order-stat/inc/shops',
);
}
/** 批量恢复暂停店 */
export async function resumeBiOrderStatIncPausedApi() {
return requestClient.post<BiOrderStatIncHealthVO.ResumePausedResult>(
'/bi/order-stat/inc/resume-paused',
);
}
/** 恢复单店增量计算 */
export async function resumeBiOrderStatIncShopApi(shopId: number) {
return requestClient.post(
'/bi/order-stat/inc/resume',
undefined,
{ params: { shopId } },
);
}
@@ -0,0 +1,2 @@
export * from './apis';
export type * from './types';
@@ -0,0 +1 @@
export type * from './types.vo';
@@ -0,0 +1,34 @@
export namespace BiOrderStatIncHealthVO {
export interface HealthSummary {
shopCount: number;
okCount: number;
idleCount: number;
laggedCount: number;
pausedCount: number;
worstLagMinutes?: number;
lagThresholdMinutes: number;
activityWindowHours: number;
healthy: boolean;
}
export interface ShopRow {
shopId: number;
shopName?: string;
platformCode?: string;
status?: number;
/** OK / IDLE / LAGGED / PAUSED */
healthKind: string;
lagMinutes?: number;
lastSuccessTime?: string;
lastStatDate?: string;
lastSummary?: string;
lastError?: string;
recentOrderActivity?: boolean;
recentIncSuccess?: boolean;
}
export interface ResumePausedResult {
resumedCount: number;
shopIds: number[];
}
}
@@ -0,0 +1 @@
export * from './types';
@@ -0,0 +1 @@
export type { CompanyOverviewVO } from './types.vo';
@@ -0,0 +1,193 @@
/**
* 全店铺概览 / 工作台汇总表 VO(对齐后端 CompanyOverviewVO)
* @see top.xyquan.ecomdmbbackend.modules.bi.overview.model.vo.CompanyOverviewVO
*/
export namespace CompanyOverviewVO {
/** 全店总销售额 */
export interface Overview {
totalSalesAmount?: number;
/** 较上月同期增长百分比 */
monthOverMonthGrowth?: number;
totalOrderCount?: number;
totalPromotionFee?: number;
/** 平均费比(推广费/销售额,小数如 0.05) */
averageFeeRatio?: number;
totalNetProfitAfterTax?: number;
totalTaxAmount?: number;
shopSalesRatios?: ShopSalesRatio[];
shopEfficiencyQuadrants?: ShopEfficiencyQuadrant[];
shopSummary?: ShopOverview;
categorySummary?: CategoryOverview;
platformSummary?: PlatformOverview;
totalROI?: number;
totalProfitAfterTax?: number;
totalTargetOrderCount?: number;
totalTargetAmount?: number;
orderCountAchievementRate?: number;
salesAmountAchievementRate?: number;
}
export interface ShopSalesRatio {
shopId?: number;
shopName?: string;
salesAmount?: number;
/** 占比百分比 */
ratio?: number;
}
export interface ShopEfficiencyQuadrant {
shopId?: number;
shopName?: string;
roi?: number;
netProfit?: number;
/** 1–4 象限 */
quadrant?: number;
}
/** 平台维度概览 */
export interface PlatformOverview {
total?: PlatformSummary;
platforms?: PlatformSummary[];
}
/** 多店铺概览 */
export interface ShopOverview {
total?: ShopSummary;
shops?: ShopSummary[];
}
/** 多品类概览(商品表复用同一结构;categoryId 存商品 ID) */
export interface CategoryOverview {
total?: CategorySummary;
categories?: CategorySummary[];
}
/** 工作台底部汇总表 */
export interface WorkbenchTableBundle {
shopTable?: ShopOverview;
platformTable?: PlatformOverview;
categoryTable?: CategoryOverview;
productTable?: CategoryOverview;
/** SKU 汇总;categoryId=skuId */
skuTable?: CategoryOverview;
}
/** 店铺汇总行 */
export interface ShopSummary {
shopId?: number;
shopName?: string;
platform?: string;
targetOrderCount?: number;
orderCountAchievementRate?: number;
targetAmount?: number;
salesAmountAchievementRate?: number;
/** 净销售额 = 成交 − 退款 */
salesAmount?: number;
/** 成交金额 */
dealAmount?: number;
/** 净销售单量 */
salesOrderCount?: number;
/** 成交单量 */
dealOrderCount?: number;
/** 成交量(件数) */
dealQuantitySum?: number;
/** 净销量(件数) */
salesQuantitySum?: number;
/** 净销售客单价 */
salesAverageOrderValue?: number;
/** 成交客单价 */
dealAverageOrderValue?: number;
productCost?: number;
shippingCost?: number;
otherCost?: number;
/** 订单成本(商品成本+运费+其他成本,不含推广费、刷单费) */
orderCost?: number;
/** 退款金额(经营规模) */
refundAmount?: number;
/** 退款单量 */
refundOrderCount?: number;
/** 退款件数 */
refundQuantitySum?: number;
totalPromotionFee?: number;
brushFee?: number;
/** 费比(推广费/销售额,小数) */
feeRatio?: number;
grossProfit?: number;
totalProfitBeforeTax?: number;
salesTaxAmount?: number;
profitAfterTax?: number;
roi?: number;
}
/** 品类/商品汇总行 */
export interface CategorySummary {
categoryId?: number | null;
categoryName?: string;
/** SKU 汇总:所属商品名 */
productName?: string;
/** SKU 汇总:规格编码(悬停) */
skuCode?: string;
salesAmount?: number;
dealAmount?: number;
salesOrderCount?: number;
dealOrderCount?: number;
dealQuantitySum?: number;
salesQuantitySum?: number;
salesAverageOrderValue?: number;
dealAverageOrderValue?: number;
productCost?: number;
shippingCost?: number;
otherCost?: number;
orderCost?: number;
/** 退款金额(经营规模) */
refundAmount?: number;
/** 退款单量 */
refundOrderCount?: number;
/** 退款件数 */
refundQuantitySum?: number;
totalPromotionFee?: number;
brushFee?: number;
feeRatio?: number;
grossProfit?: number;
totalProfitBeforeTax?: number;
salesTaxAmount?: number;
profitAfterTax?: number;
roi?: number;
}
/** 平台维度汇总行 */
export interface PlatformSummary {
platformCode?: string;
platformName?: string;
targetOrderCount?: number;
orderCountAchievementRate?: number;
targetAmount?: number;
salesAmountAchievementRate?: number;
salesAmount?: number;
dealAmount?: number;
salesOrderCount?: number;
dealOrderCount?: number;
dealQuantitySum?: number;
salesQuantitySum?: number;
salesAverageOrderValue?: number;
dealAverageOrderValue?: number;
productCost?: number;
shippingCost?: number;
otherCost?: number;
orderCost?: number;
/** 退款金额(经营规模) */
refundAmount?: number;
/** 退款单量 */
refundOrderCount?: number;
/** 退款件数 */
refundQuantitySum?: number;
totalPromotionFee?: number;
brushFee?: number;
feeRatio?: number;
grossProfit?: number;
totalProfitBeforeTax?: number;
salesTaxAmount?: number;
roi?: number;
profitAfterTax?: number;
}
}
@@ -0,0 +1,11 @@
import type { RegionOverviewDTO, RegionOverviewVO } from './types';
import { requestClient } from '#/api/request';
/** 区域销量:省级净销售列表(地图 + 排行) */
export async function getRegionOverviewApi(data: RegionOverviewDTO.Query) {
return requestClient.post<RegionOverviewVO.Overview>(
'/bi/region/overview',
data,
);
}
@@ -0,0 +1,2 @@
export * from './apis';
export * from './types';
@@ -0,0 +1,2 @@
export * from './types.dto';
export * from './types.vo';
@@ -0,0 +1,13 @@
/**
* 区域销量查询 DTO(与后端 RegionOverviewQueryDTO 对齐)
*/
export namespace RegionOverviewDTO {
export interface Query {
/** 日期范围 [开始, 结束],单元素表示当天 */
dateRange: string[];
/** 平台代码,不传表示全平台 */
platformCode?: string;
/** 店铺 ID,不传表示当前筛选下全部门店 */
shopId?: number;
}
}
@@ -0,0 +1,25 @@
/**
* 区域销量概览 VO(与后端 RegionOverviewVO 对齐)
*/
export namespace RegionOverviewVO {
export interface ProvinceRow {
/** 规范化省名,与地图 geoJSON 对齐 */
province: string;
/** 净销售额(元) */
salesAmount: number;
/** 净销量(件) */
salesQuantitySum: number;
/** 净销售单量 */
salesOrderCount: number;
/** 退款额(元) */
refundAmount: number;
/** 成交额(元) */
dealAmount?: number;
}
export interface Overview {
provinces: ProvinceRow[];
startDate: string;
endDate: string;
}
}
@@ -0,0 +1,11 @@
import type { WorkbenchDTO, WorkbenchVO } from './types';
import { requestClient } from '#/api/request';
/** 经营概览 Tab:KPI/趋势/饼图 + 底部四表 */
export async function getWorkbenchFinanceApi(data: WorkbenchDTO.Query) {
return requestClient.post<WorkbenchVO.FinanceSlice>(
'/bi/workbench/finance',
data,
);
}
@@ -0,0 +1,2 @@
export * from './apis';
export * from './types';
@@ -0,0 +1,2 @@
export * from './types.dto';
export * from './types.vo';
@@ -0,0 +1,23 @@
/**
* 工作台查询 DTO(与后端 WorkbenchQueryDTO 对齐)
*/
export namespace WorkbenchDTO {
export interface Query {
/** 日期范围 [开始, 结束],单元素表示当天 */
dateRange: string[];
/** 税率,默认 0.04 */
taxRate?: number;
/** 平台代码,不传表示全平台 */
platformCode?: string;
/** 店铺 ID,不传表示当前筛选下全部门店 */
shopId?: number;
}
/** 工作台四表导出(与后端 WorkbenchExportDTO 对齐) */
export interface ExportPayload extends Query {
shopIds?: number[];
platformCodes?: string[];
categoryIds?: number[];
productIds?: number[];
}
}
@@ -0,0 +1,69 @@
/**
* 工作台聚合 VO(与后端 Workbench*VO 对齐)
*/
import type { CompanyOverviewVO } from '#/api/bi/overview';
export namespace WorkbenchVO {
export interface KpiItem {
label: string;
/** 主指标原始数值(金额为元;不含千分位) */
value: number;
unit: string;
changePct?: number;
up?: boolean;
/** 同比去年变化 %(相对去年同期时段) */
yoyChangePct?: number | null;
/** 同比是否上涨 */
yoyUp?: boolean | null;
sub?: string;
/** 主指标金额(元),用于换算万与悬停显示 */
amountYuan?: number | null;
/** true 时主数字建议按「万」展示 */
preferWanDisplay?: boolean | null;
}
export interface TrendPoint {
date: string;
/** 日成交金额(元):计入成交状态商家实收(不含已取消、未知) */
dealYuan?: number;
/** 日成交单量:与 KPI「成交单量」同口径 */
dealOrderCount?: number;
/** 日净销售额(元),与 KPI「净销售额」同口径 */
salesYuan?: number;
/** 日净销售单量:与 KPI「净销售单量」同口径 */
salesOrderCount?: number;
/** 日毛利润(元)= 净销售额 − 订单成本 */
profitYuan?: number;
/** 日净利润(元),与 KPI「净利润」分摊口径一致 */
netProfitYuan?: number;
refundYuan?: number;
}
/** 饼图扇区(平台销售额占比等) */
export interface PieSlice {
name: string;
/** 金额(元,两位小数) */
value?: number;
/** 占净销售额合计的比例 % */
pct?: number;
}
export interface FinancePanel {
kpis: KpiItem[];
dealTrend: TrendPoint[];
/** 各平台净销售额占比 */
platformSalesShare: PieSlice[];
/** 环比对比期起(yyyy-MM-dd) */
momCompareDateStart?: string | null;
momCompareDateEnd?: string | null;
/** 同比对比期起止(yyyy-MM-dd) */
yoyCompareDateStart?: string | null;
yoyCompareDateEnd?: string | null;
}
/** 经营概览 Tab 专用 */
export interface FinanceSlice {
finance: FinancePanel;
summaryTables?: CompanyOverviewVO.WorkbenchTableBundle | null;
}
}
@@ -0,0 +1,12 @@
import type { PddAuthVO } from './types';
import { requestClient } from '#/api/request';
/**
* 获取拼多多店铺授权跳转 URL(绑定指定内部店铺)
*/
export async function getPddAuthorizeUrlApi(shopId: number) {
return requestClient.get<PddAuthVO.AuthorizeUrl>('/channel/pdd/auth/authorize-url', {
params: { shopId },
});
}
@@ -0,0 +1,2 @@
export * from './apis';
export * from './types';
@@ -0,0 +1 @@
export * from './types.vo';
@@ -0,0 +1,12 @@
/**
* 拼多多授权相关 VO
*/
export namespace PddAuthVO {
/** 授权跳转信息 */
export interface AuthorizeUrl {
/** 拼多多授权页完整 URL */
authorizeUrl: string;
/** 本次授权 state */
state: string;
}
}
@@ -0,0 +1,26 @@
/**
* 拼多多平台类目(本地落库)API
*/
import { requestClient } from '#/api/request';
import type { PddCatDTO, PddCatVO } from './types';
/** 触发全量同步 */
export async function syncPddCatsApi() {
return requestClient.post<void>('/channel/pdd/cat/sync');
}
/** 同步状态 */
export async function getPddCatSyncStatusApi() {
return requestClient.get<PddCatVO.SyncStatus>('/channel/pdd/cat/sync/status');
}
/** 子类目列表(懒加载树) */
export async function listPddCatChildrenApi(data: PddCatDTO.ChildrenQuery) {
return requestClient.post<PddCatVO.Cat[]>('/channel/pdd/cat/children', data);
}
/** 按名称/路径搜索(跨层级) */
export async function searchPddCatsApi(data: PddCatDTO.SearchQuery) {
return requestClient.post<PddCatVO.Cat[]>('/channel/pdd/cat/search', data);
}
@@ -0,0 +1,2 @@
export * from './apis';
export type * from './types';
@@ -0,0 +1,40 @@
/** 拼多多类目 DTO / VO */
export namespace PddCatDTO {
export interface ChildrenQuery {
/** 父类目;0 或省略为顶级 */
parentCatId?: number;
}
export interface SearchQuery {
keyword: string;
/** 默认 true:仅叶子(可发布) */
leafOnly?: boolean;
/** 默认 50,最大 100 */
limit?: number;
}
}
export namespace PddCatVO {
export interface Cat {
catId: number;
parentCatId?: number;
catName?: string;
level?: number;
leaf?: boolean;
/** 如 1/23/456 */
pathIds?: string;
/** 如 洗护/纸品/抽纸 */
pathNames?: string;
lastSyncTime?: string;
}
export interface SyncStatus {
status?: 'IDLE' | 'RUNNING' | 'SUCCESS' | 'FAILED' | string;
startedAt?: string | null;
finishedAt?: string | null;
lastError?: string | null;
syncedCount?: number | null;
message?: string | null;
}
}
@@ -0,0 +1,47 @@
import type {
PageQueryDTO,
PageResultVO,
PddGoodsAdFeeImportVO,
} from './types';
import { requestClient } from '#/api/request';
export async function batchPddAdFeePipelineStatusApi(shopIds: number[]) {
return requestClient.post<PddGoodsAdFeeImportVO.ShopStatus[]>(
'/channel/pdd/goods/adfee/import-task/pipeline/status/batch',
{ shopIds },
);
}
export async function listPddGoodsAdFeeImportTasksApi(
params: PageQueryDTO<PddGoodsAdFeeImportVO.TaskFilters>,
) {
return requestClient.post<PageResultVO<PddGoodsAdFeeImportVO.ImportTask>>(
'/channel/pdd/goods/adfee/import-task/list',
params,
);
}
export async function getPddGoodsAdFeeImportTaskApi(taskId: number) {
return requestClient.get<PddGoodsAdFeeImportVO.ImportTask>(
`/channel/pdd/goods/adfee/import-task/detail/${taskId}`,
);
}
export async function listPddGoodsAdFeeImportFailedItemsApi(
taskId: number,
params: PageQueryDTO<void>,
) {
return requestClient.post<PageResultVO<PddGoodsAdFeeImportVO.ImportItem>>(
`/channel/pdd/goods/adfee/import-task/${taskId}/failed-items`,
params,
);
}
export async function retryPddGoodsAdFeeConvertApi(taskId: number) {
return requestClient.post<void>(
`/channel/pdd/goods/adfee/import-task/${taskId}/retry-convert`,
);
}
export type { PddGoodsAdFeeImportVO };
@@ -0,0 +1,2 @@
export * from './apis';
export * from './types';
@@ -0,0 +1,62 @@
import type { PageQueryDTO, PageResultVO } from '#/types/common';
/**
* 推广费导入任务与管线状态。
*/
export namespace PddGoodsAdFeeImportVO {
export type ImportTask = {
id: number;
companyId: number;
channelShopId: number;
status: string;
totalCount: number;
successCount: number;
failCount: number;
authExpired?: number;
message?: string;
startedAt?: string;
finishedAt?: string;
createTime?: string;
convertStatus?: string;
convertSuccessCount?: number;
convertFailCount?: number;
convertMessage?: string;
convertStartedAt?: string;
convertFinishedAt?: string;
};
export type ImportItem = {
id: number;
taskId: number;
goodsId: string;
feeDate: string;
feeAmount: number;
status: string;
failCode?: string;
failReason?: string;
createTime?: string;
};
export type PipelineStage = {
status?: string | null;
summary?: string | null;
lastFinishedAt?: string | null;
successCount?: number | null;
failCount?: number | null;
};
export type ShopStatus = {
shopId: number;
latestTaskId?: number | null;
importStage?: PipelineStage;
convertStage?: PipelineStage;
};
export type TaskFilters = {
channelShopId?: number;
ecShopId?: number;
status?: string;
};
}
export type { PageQueryDTO, PageResultVO };
@@ -0,0 +1,41 @@
import type { PageQueryDTO, PageResultVO } from '#/types/common';
import { requestClient } from '#/api/request';
import type { PddGoodsAdFeeDTO, PddGoodsAdFeeVO } from './types';
export async function getPddGoodsAdFeePageApi(
params: PageQueryDTO<PddGoodsAdFeeDTO.Filters>,
) {
return requestClient.post<PageResultVO<PddGoodsAdFeeVO.Info>>(
'/channel/pdd/goods/adfee/list',
params,
);
}
export async function getPddGoodsAdFeeDetailApi(id: number) {
return requestClient.get<PddGoodsAdFeeVO.Info>(
`/channel/pdd/goods/adfee/detail/${id}`,
);
}
export async function createPddGoodsAdFeeApi(data: PddGoodsAdFeeDTO.Create) {
return requestClient.post<PddGoodsAdFeeVO.Info>(
'/channel/pdd/goods/adfee/create',
data,
);
}
export async function updatePddGoodsAdFeeApi(
id: number,
data: PddGoodsAdFeeDTO.Update,
) {
return requestClient.put<PddGoodsAdFeeVO.Info>(
`/channel/pdd/goods/adfee/update/${id}`,
data,
);
}
export async function deletePddGoodsAdFeeApi(id: number) {
return requestClient.delete<void>(`/channel/pdd/goods/adfee/delete/${id}`);
}

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