4月14日

This commit is contained in:
yin 2026-04-14 18:44:25 +08:00
parent a97c7214dd
commit 9712731d19
30 changed files with 2627 additions and 912 deletions

6
.prettierignore Normal file
View File

@ -0,0 +1,6 @@
dist
node_modules
.vite
coverage
package-lock.json
workflows/api-doc-sync/data/history

7
.prettierrc.json Normal file
View File

@ -0,0 +1,7 @@
{
"semi": true,
"singleQuote": false,
"printWidth": 100,
"tabWidth": 2,
"trailingComma": "all"
}

Binary file not shown.

43
eslint.config.js Normal file
View File

@ -0,0 +1,43 @@
import js from "@eslint/js";
import tseslint from "typescript-eslint";
import vueParser from "vue-eslint-parser";
import vuePlugin from "eslint-plugin-vue";
import eslintConfigPrettier from "eslint-config-prettier";
export default [
{
ignores: [
"dist/**",
"node_modules/**",
"coverage/**",
".vite/**",
"workflows/api-doc-sync/data/history/**",
],
},
js.configs.recommended,
...tseslint.configs.recommended,
...vuePlugin.configs["flat/recommended"],
{
files: ["**/*.{ts,tsx,vue,js,mjs,cjs}"],
languageOptions: {
parser: vueParser,
parserOptions: {
parser: tseslint.parser,
ecmaVersion: "latest",
sourceType: "module",
extraFileExtensions: [".vue"],
},
globals: {
fetch: "readonly",
AbortSignal: "readonly",
console: "readonly",
process: "readonly",
},
},
rules: {
"no-console": "off",
"vue/multi-word-component-names": "off",
},
},
eslintConfigPrettier,
];

407
package-lock.json generated
View File

@ -33,6 +33,7 @@
"xlsx": "^0.18.5"
},
"devDependencies": {
"@eslint/js": "^10.0.1",
"@tsconfig/node24": "^24.0.4",
"@types/js-cookie": "^3.0.6",
"@types/node": "^24.11.0",
@ -42,14 +43,19 @@
"@types/three": "^0.183.1",
"@vitejs/plugin-vue": "^6.0.4",
"@vue/tsconfig": "^0.8.1",
"eslint": "^10.2.0",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-vue": "^10.8.0",
"fast-glob": "^3.3.3",
"npm-run-all2": "^8.0.4",
"prettier": "^3.8.2",
"sass": "^1.97.3",
"typescript": "~5.9.3",
"typescript-eslint": "^8.58.2",
"vite": "^7.3.1",
"vite-plugin-svg-icons": "^2.0.1",
"vite-plugin-vue-devtools": "^8.0.6",
"vue-eslint-parser": "^10.4.0",
"vue-tsc": "^3.2.5"
},
"engines": {
@ -1021,13 +1027,13 @@
}
},
"node_modules/@eslint/config-array": {
"version": "0.23.3",
"resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.23.3.tgz",
"integrity": "sha512-j+eEWmB6YYLwcNOdlwQ6L2OsptI/LO6lNBuLIqe5R7RetD658HLoF+Mn7LzYmAWWNNzdC6cqP+L6r8ujeYXWLw==",
"version": "0.23.5",
"resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.23.5.tgz",
"integrity": "sha512-Y3kKLvC1dvTOT+oGlqNQ1XLqK6D1HU2YXPc52NmAlJZbMMWDzGYXMiPRJ8TYD39muD/OTjlZmNJ4ib7dvSrMBA==",
"dev": true,
"license": "Apache-2.0",
"dependencies": {
"@eslint/object-schema": "^3.0.3",
"@eslint/object-schema": "^3.0.5",
"debug": "^4.3.1",
"minimatch": "^10.2.4"
},
@ -1036,22 +1042,22 @@
}
},
"node_modules/@eslint/config-helpers": {
"version": "0.5.3",
"resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.5.3.tgz",
"integrity": "sha512-lzGN0onllOZCGroKJmRwY6QcEHxbjBw1gwB8SgRSqK8YbbtEXMvKynsXc3553ckIEBxsbMBU7oOZXKIPGZNeZw==",
"version": "0.5.5",
"resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.5.5.tgz",
"integrity": "sha512-eIJYKTCECbP/nsKaaruF6LW967mtbQbsw4JTtSVkUQc9MneSkbrgPJAbKl9nWr0ZeowV8BfsarBmPpBzGelA2w==",
"dev": true,
"license": "Apache-2.0",
"dependencies": {
"@eslint/core": "^1.1.1"
"@eslint/core": "^1.2.1"
},
"engines": {
"node": "^20.19.0 || ^22.13.0 || >=24"
}
},
"node_modules/@eslint/core": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@eslint/core/-/core-1.1.1.tgz",
"integrity": "sha512-QUPblTtE51/7/Zhfv8BDwO0qkkzQL7P/aWWbqcf4xWLEYn1oKjdO0gglQBB4GAsu7u6wjijbCmzsUTy6mnk6oQ==",
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/@eslint/core/-/core-1.2.1.tgz",
"integrity": "sha512-MwcE1P+AZ4C6DWlpin/OmOA54mmIZ/+xZuJiQd4SyB29oAJjN30UW9wkKNptW2ctp4cEsvhlLY/CsQ1uoHDloQ==",
"dev": true,
"license": "Apache-2.0",
"dependencies": {
@ -1061,10 +1067,31 @@
"node": "^20.19.0 || ^22.13.0 || >=24"
}
},
"node_modules/@eslint/js": {
"version": "10.0.1",
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-10.0.1.tgz",
"integrity": "sha512-zeR9k5pd4gxjZ0abRoIaxdc7I3nDktoXZk2qOv9gCNWx3mVwEn32VRhyLaRsDiJjTs0xq/T8mfPtyuXu7GWBcA==",
"dev": true,
"license": "MIT",
"engines": {
"node": "^20.19.0 || ^22.13.0 || >=24"
},
"funding": {
"url": "https://eslint.org/donate"
},
"peerDependencies": {
"eslint": "^10.0.0"
},
"peerDependenciesMeta": {
"eslint": {
"optional": true
}
}
},
"node_modules/@eslint/object-schema": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-3.0.3.tgz",
"integrity": "sha512-iM869Pugn9Nsxbh/YHRqYiqd23AmIbxJOcpUMOuWCVNdoQJ5ZtwL6h3t0bcZzJUlC3Dq9jCFCESBZnX0GTv7iQ==",
"version": "3.0.5",
"resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-3.0.5.tgz",
"integrity": "sha512-vqTaUEgxzm+YDSdElad6PiRoX4t8VGDjCtt05zn4nU810UIx/uNEV7/lZJ6KwFThKZOzOxzXy48da+No7HZaMw==",
"dev": true,
"license": "Apache-2.0",
"engines": {
@ -1072,13 +1099,13 @@
}
},
"node_modules/@eslint/plugin-kit": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.6.1.tgz",
"integrity": "sha512-iH1B076HoAshH1mLpHMgwdGeTs0CYwL0SPMkGuSebZrwBp16v415e9NZXg2jtrqPVQjf6IANe2Vtlr5KswtcZQ==",
"version": "0.7.1",
"resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.7.1.tgz",
"integrity": "sha512-rZAP3aVgB9ds9KOeUSL+zZ21hPmo8dh6fnIFwRQj5EAZl9gzR7wxYbYXYysAM8CTqGmUGyp2S4kUdV17MnGuWQ==",
"dev": true,
"license": "Apache-2.0",
"dependencies": {
"@eslint/core": "^1.1.1",
"@eslint/core": "^1.2.1",
"levn": "^0.4.1"
},
"engines": {
@ -2134,6 +2161,250 @@
"dev": true,
"license": "MIT"
},
"node_modules/@typescript-eslint/eslint-plugin": {
"version": "8.58.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.58.2.tgz",
"integrity": "sha512-aC2qc5thQahutKjP+cl8cgN9DWe3ZUqVko30CMSZHnFEHyhOYoZSzkGtAI2mcwZ38xeImDucI4dnqsHiOYuuCw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@eslint-community/regexpp": "^4.12.2",
"@typescript-eslint/scope-manager": "8.58.2",
"@typescript-eslint/type-utils": "8.58.2",
"@typescript-eslint/utils": "8.58.2",
"@typescript-eslint/visitor-keys": "8.58.2",
"ignore": "^7.0.5",
"natural-compare": "^1.4.0",
"ts-api-utils": "^2.5.0"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependencies": {
"@typescript-eslint/parser": "^8.58.2",
"eslint": "^8.57.0 || ^9.0.0 || ^10.0.0",
"typescript": ">=4.8.4 <6.1.0"
}
},
"node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": {
"version": "7.0.5",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz",
"integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">= 4"
}
},
"node_modules/@typescript-eslint/parser": {
"version": "8.58.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.58.2.tgz",
"integrity": "sha512-/Zb/xaIDfxeJnvishjGdcR4jmr7S+bda8PKNhRGdljDM+elXhlvN0FyPSsMnLmJUrVG9aPO6dof80wjMawsASg==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@typescript-eslint/scope-manager": "8.58.2",
"@typescript-eslint/types": "8.58.2",
"@typescript-eslint/typescript-estree": "8.58.2",
"@typescript-eslint/visitor-keys": "8.58.2",
"debug": "^4.4.3"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependencies": {
"eslint": "^8.57.0 || ^9.0.0 || ^10.0.0",
"typescript": ">=4.8.4 <6.1.0"
}
},
"node_modules/@typescript-eslint/project-service": {
"version": "8.58.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.58.2.tgz",
"integrity": "sha512-Cq6UfpZZk15+r87BkIh5rDpi38W4b+Sjnb8wQCPPDDweS/LRCFjCyViEbzHk5Ck3f2QDfgmlxqSa7S7clDtlfg==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/tsconfig-utils": "^8.58.2",
"@typescript-eslint/types": "^8.58.2",
"debug": "^4.4.3"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependencies": {
"typescript": ">=4.8.4 <6.1.0"
}
},
"node_modules/@typescript-eslint/scope-manager": {
"version": "8.58.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.58.2.tgz",
"integrity": "sha512-SgmyvDPexWETQek+qzZnrG6844IaO02UVyOLhI4wpo82dpZJY9+6YZCKAMFzXb7qhx37mFK1QcPQ18tud+vo6Q==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/types": "8.58.2",
"@typescript-eslint/visitor-keys": "8.58.2"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@typescript-eslint/tsconfig-utils": {
"version": "8.58.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.58.2.tgz",
"integrity": "sha512-3SR+RukipDvkkKp/d0jP0dyzuls3DbGmwDpVEc5wqk5f38KFThakqAAO0XMirWAE+kT00oTauTbzMFGPoAzB0A==",
"dev": true,
"license": "MIT",
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependencies": {
"typescript": ">=4.8.4 <6.1.0"
}
},
"node_modules/@typescript-eslint/type-utils": {
"version": "8.58.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.58.2.tgz",
"integrity": "sha512-Z7EloNR/B389FvabdGeTo2XMs4W9TjtPiO9DAsmT0yom0bwlPyRjkJ1uCdW1DvrrrYP50AJZ9Xc3sByZA9+dcg==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/types": "8.58.2",
"@typescript-eslint/typescript-estree": "8.58.2",
"@typescript-eslint/utils": "8.58.2",
"debug": "^4.4.3",
"ts-api-utils": "^2.5.0"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependencies": {
"eslint": "^8.57.0 || ^9.0.0 || ^10.0.0",
"typescript": ">=4.8.4 <6.1.0"
}
},
"node_modules/@typescript-eslint/types": {
"version": "8.58.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.58.2.tgz",
"integrity": "sha512-9TukXyATBQf/Jq9AMQXfvurk+G5R2MwfqQGDR2GzGz28HvY/lXNKGhkY+6IOubwcquikWk5cjlgPvD2uAA7htQ==",
"dev": true,
"license": "MIT",
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@typescript-eslint/typescript-estree": {
"version": "8.58.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.58.2.tgz",
"integrity": "sha512-ELGuoofuhhoCvNbQjFFiobFcGgcDCEm0ThWdmO4Z0UzLqPXS3KFvnEZ+SHewwOYHjM09tkzOWXNTv9u6Gqtyuw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/project-service": "8.58.2",
"@typescript-eslint/tsconfig-utils": "8.58.2",
"@typescript-eslint/types": "8.58.2",
"@typescript-eslint/visitor-keys": "8.58.2",
"debug": "^4.4.3",
"minimatch": "^10.2.2",
"semver": "^7.7.3",
"tinyglobby": "^0.2.15",
"ts-api-utils": "^2.5.0"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependencies": {
"typescript": ">=4.8.4 <6.1.0"
}
},
"node_modules/@typescript-eslint/typescript-estree/node_modules/semver": {
"version": "7.7.4",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz",
"integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==",
"dev": true,
"license": "ISC",
"bin": {
"semver": "bin/semver.js"
},
"engines": {
"node": ">=10"
}
},
"node_modules/@typescript-eslint/utils": {
"version": "8.58.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.58.2.tgz",
"integrity": "sha512-QZfjHNEzPY8+l0+fIXMvuQ2sJlplB4zgDZvA+NmvZsZv3EQwOcc1DuIU1VJUTWZ/RKouBMhDyNaBMx4sWvrzRA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@eslint-community/eslint-utils": "^4.9.1",
"@typescript-eslint/scope-manager": "8.58.2",
"@typescript-eslint/types": "8.58.2",
"@typescript-eslint/typescript-estree": "8.58.2"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependencies": {
"eslint": "^8.57.0 || ^9.0.0 || ^10.0.0",
"typescript": ">=4.8.4 <6.1.0"
}
},
"node_modules/@typescript-eslint/visitor-keys": {
"version": "8.58.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.58.2.tgz",
"integrity": "sha512-f1WO2Lx8a9t8DARmcWAUPJbu0G20bJlj8L4z72K00TMeJAoyLr/tHhI/pzYBLrR4dXWkcxO1cWYZEOX8DKHTqA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/types": "8.58.2",
"eslint-visitor-keys": "^5.0.0"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@vitejs/plugin-vue": {
"version": "6.0.4",
"resolved": "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-6.0.4.tgz",
@ -2872,9 +3143,9 @@
"license": "ISC"
},
"node_modules/brace-expansion": {
"version": "5.0.4",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.4.tgz",
"integrity": "sha512-h+DEnpVvxmfVefa4jFbCf5HdH5YMDXRsmKflpf1pILZWRFlTbJpxeU55nJl4Smt5HQaGzg1o6RHFPJaOqnmBDg==",
"version": "5.0.5",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.5.tgz",
"integrity": "sha512-VZznLgtwhn+Mact9tfiwx64fA9erHH/MCXEUfB/0bX/6Fz6ny5EGTXYltMocqg4xFAQZtnO3DHWWXi8RiuN7cQ==",
"dev": true,
"license": "MIT",
"dependencies": {
@ -4209,19 +4480,19 @@
}
},
"node_modules/eslint": {
"version": "10.0.3",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-10.0.3.tgz",
"integrity": "sha512-COV33RzXZkqhG9P2rZCFl9ZmJ7WL+gQSCRzE7RhkbclbQPtLAWReL7ysA0Sh4c8Im2U9ynybdR56PV0XcKvqaQ==",
"version": "10.2.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-10.2.0.tgz",
"integrity": "sha512-+L0vBFYGIpSNIt/KWTpFonPrqYvgKw1eUI5Vn7mEogrQcWtWYtNQ7dNqC+px/J0idT3BAkiWrhfS7k+Tum8TUA==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.8.0",
"@eslint-community/regexpp": "^4.12.2",
"@eslint/config-array": "^0.23.3",
"@eslint/config-helpers": "^0.5.2",
"@eslint/core": "^1.1.1",
"@eslint/plugin-kit": "^0.6.1",
"@eslint/config-array": "^0.23.4",
"@eslint/config-helpers": "^0.5.4",
"@eslint/core": "^1.2.0",
"@eslint/plugin-kit": "^0.7.0",
"@humanfs/node": "^0.16.6",
"@humanwhocodes/module-importer": "^1.0.1",
"@humanwhocodes/retry": "^0.4.2",
@ -4232,7 +4503,7 @@
"escape-string-regexp": "^4.0.0",
"eslint-scope": "^9.1.2",
"eslint-visitor-keys": "^5.0.1",
"espree": "^11.1.1",
"espree": "^11.2.0",
"esquery": "^1.7.0",
"esutils": "^2.0.2",
"fast-deep-equal": "^3.1.3",
@ -4265,6 +4536,22 @@
}
}
},
"node_modules/eslint-config-prettier": {
"version": "10.1.8",
"resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-10.1.8.tgz",
"integrity": "sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w==",
"dev": true,
"license": "MIT",
"bin": {
"eslint-config-prettier": "bin/cli.js"
},
"funding": {
"url": "https://opencollective.com/eslint-config-prettier"
},
"peerDependencies": {
"eslint": ">=7.0.0"
}
},
"node_modules/eslint-plugin-vue": {
"version": "10.8.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-vue/-/eslint-plugin-vue-10.8.0.tgz",
@ -6240,13 +6527,13 @@
}
},
"node_modules/minimatch": {
"version": "10.2.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.4.tgz",
"integrity": "sha512-oRjTw/97aTBN0RHbYCdtF1MQfvusSIBQM0IZEgzl6426+8jSC0nF1a/GmnVLpfB9yyr6g6FTqWqiZVbxrtaCIg==",
"version": "10.2.5",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.5.tgz",
"integrity": "sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg==",
"dev": true,
"license": "BlueOak-1.0.0",
"dependencies": {
"brace-expansion": "^5.0.2"
"brace-expansion": "^5.0.5"
},
"engines": {
"node": "18 || 20 || >=22"
@ -7065,6 +7352,22 @@
"node": ">= 0.8.0"
}
},
"node_modules/prettier": {
"version": "3.8.2",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.8.2.tgz",
"integrity": "sha512-8c3mgTe0ASwWAJK+78dpviD+A8EqhndQPUBpNUIPt6+xWlIigCwfN01lWr9MAede4uqXGTEKeQWTvzb3vjia0Q==",
"dev": true,
"license": "MIT",
"bin": {
"prettier": "bin/prettier.cjs"
},
"engines": {
"node": ">=14"
},
"funding": {
"url": "https://github.com/prettier/prettier?sponsor=1"
}
},
"node_modules/proxy-from-env": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
@ -8581,6 +8884,19 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/ts-api-utils": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.5.0.tgz",
"integrity": "sha512-OJ/ibxhPlqrMM0UiNHJ/0CKQkoKF243/AEmplt3qpRgkW8VG7IfOS41h7V8TjITqdByHzrjcS/2si+y4lIh8NA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=18.12"
},
"peerDependencies": {
"typescript": ">=4.8.4"
}
},
"node_modules/tslib": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.0.tgz",
@ -8716,6 +9032,30 @@
"node": ">=14.17"
}
},
"node_modules/typescript-eslint": {
"version": "8.58.2",
"resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.58.2.tgz",
"integrity": "sha512-V8iSng9mRbdZjl54VJ9NKr6ZB+dW0J3TzRXRGcSbLIej9jV86ZRtlYeTKDR/QLxXykocJ5icNzbsl2+5TzIvcQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/eslint-plugin": "8.58.2",
"@typescript-eslint/parser": "8.58.2",
"@typescript-eslint/typescript-estree": "8.58.2",
"@typescript-eslint/utils": "8.58.2"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependencies": {
"eslint": "^8.57.0 || ^9.0.0 || ^10.0.0",
"typescript": ">=4.8.4 <6.1.0"
}
},
"node_modules/ufo": {
"version": "1.6.3",
"resolved": "https://registry.npmjs.org/ufo/-/ufo-1.6.3.tgz",
@ -9248,6 +9588,7 @@
"integrity": "sha512-Vxi9pJdbN3ZnVGLODVtZ7y4Y2kzAAE2Cm0CZ3ZDRvydVYxZ6VrnBhLikBsRS+dpwj4Jv4UCv21PTEwF5rQ9WXg==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"debug": "^4.4.0",
"eslint-scope": "^8.2.0 || ^9.0.0",

View File

@ -9,6 +9,11 @@
"preview": "vite preview",
"build-only": "vite build",
"type-check": "vue-tsc --build",
"update": "node ./workflows/api-doc-sync/update.mjs",
"lint": "eslint . --cache",
"lint:fix": "eslint . --cache --fix",
"format": "prettier . --write",
"format:check": "prettier . --check",
"deploy": "sh deploy.sh",
"rollback": "sh rollback.sh"
},
@ -38,6 +43,7 @@
"xlsx": "^0.18.5"
},
"devDependencies": {
"@eslint/js": "^10.0.1",
"@tsconfig/node24": "^24.0.4",
"@types/js-cookie": "^3.0.6",
"@types/node": "^24.11.0",
@ -47,14 +53,19 @@
"@types/three": "^0.183.1",
"@vitejs/plugin-vue": "^6.0.4",
"@vue/tsconfig": "^0.8.1",
"eslint": "^10.2.0",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-vue": "^10.8.0",
"fast-glob": "^3.3.3",
"npm-run-all2": "^8.0.4",
"prettier": "^3.8.2",
"sass": "^1.97.3",
"typescript": "~5.9.3",
"typescript-eslint": "^8.58.2",
"vite": "^7.3.1",
"vite-plugin-svg-icons": "^2.0.1",
"vite-plugin-vue-devtools": "^8.0.6",
"vue-eslint-parser": "^10.4.0",
"vue-tsc": "^3.2.5"
},
"engines": {

View File

@ -150,3 +150,17 @@ export function listInterfaceTypes() {
isSystemApi: true
} as any)
}
export function searchSpace(data:any){
return request({
url: '/system',
method: 'post',
params: {
method: 'index.searchSpace',
v: '1.0',
timestamp: new Date().getTime()
},
data: data,
isSystemApi: true
} as any)
}

View File

@ -14,6 +14,19 @@ export const getreviewOrderlist = (data: any): Promise<any> => {
})
}
export const reviewOrder = (data: any): Promise<any> => {
return request({
url: '/system',
method: 'post',
params: {
method: 'order.reviewOrder.reviewOrder',
v,
timestamp: new Date().getTime()
},
data: data
})
}
export function getdeliveryOrderlist(data: any): Promise<any> {
return request({
url: '/system',
@ -110,8 +123,8 @@ export const orderDetail = (data: any): Promise<any> => {
// New APIs from test.txt
export const orderReviewList = (data: any): Promise<any> => request({ url: '/system', method: 'post', params: { method: 'order.reviewOrder.list', v: '1.0', timestamp: Date.now() }, data: data });
export const orderReviewOrder = (data: any): Promise<any> => request({ url: '/system', method: 'post', params: { method: 'order.reviewOrder.reviewOrder', v: '1.0', timestamp: Date.now() }, data: data });
export const orderPendingList = (data: any): Promise<any> => request({ url: '/system', method: 'post', params: { method: 'order.pendingOrder.list', v: '1.0', timestamp: Date.now() }, data: data });
export const orderExpectionList = (data: any): Promise<any> => request({ url: '/system', method: 'post', params: { method: 'order.expectionOrder.list', v: '1.0', timestamp: Date.now() }, data: data });
export const orderPendingList = (data: any): Promise<any> => request({ url: '/system', method: 'post', params: { method: 'order.pendingOrder.getpendingOrderlist', v: '1.0', timestamp: Date.now() }, data: data });
export const orderExpectionList = (data: any): Promise<any> => request({ url: '/system', method: 'post', params: { method: 'order.expectionOrder.getexpectionOrderlist', v: '1.0', timestamp: Date.now() }, data: data });
export const orderEntrustList = (data: any): Promise<any> => request({ url: '/system', method: 'post', params: { method: 'order.entrustOrder.list', v: '1.0', timestamp: Date.now() }, data: data });
export const orderDeliveryList = (data: any): Promise<any> => request({ url: '/system', method: 'post', params: { method: 'order.deliveryOrder.list', v: '1.0', timestamp: Date.now() }, data: data });
export const orderDeliveryExpectionList = (data: any): Promise<any> => request({ url: '/system', method: 'post', params: { method: 'order.deliveryExpectionOrder.list', v: '1.0', timestamp: Date.now() }, data: data });

View File

@ -21,5 +21,5 @@ export const componentMap: Record<string, any> = {
// 'system/setting/printStation/index': () => import('@/views/system/setting/printStation/index.vue'),
'system/print/station': () => import('@/views/system/setting/printStation/index.vue'),
'storage/log': () => import('@/views/storage/log/index.vue'),
'storage/validityperiod':import('@/views/storage/validityperiod/index.vue'),
'storage/validityperiod':() =>import('@/views/storage/validityperiod/index.vue'),
};

View File

@ -0,0 +1,97 @@
<template>
<div class="archive-order-panel">
<div class="panel-toolbar">
<el-button size="small" type="primary" :loading="loading" @click="loadArchiveOrders">刷新归档订单</el-button>
</div>
<el-table :data="archiveList" border stripe size="small" v-loading="loading">
<el-table-column prop="delivery_order_code" label="发货单号" min-width="180" />
<el-table-column prop="order_code" label="订单号" min-width="180" />
<el-table-column prop="status" label="状态" min-width="110" />
<el-table-column prop="updated_at" label="归档时间" min-width="170" />
</el-table>
<div v-if="!loading && !archiveList.length" class="empty-tip">当前订单暂无归档记录</div>
</div>
</template>
<script setup lang="ts">
import { ref, watch } from 'vue'
import { getarchiveOrderlist } from '@/api/order/order'
const props = defineProps<{
orderId?: number | string | null
deliveryOrderCode?: string
}>()
const loading = ref(false)
const archiveList = ref<any[]>([])
watch(
() => [props.orderId, props.deliveryOrderCode],
() => {
loadArchiveOrders()
},
{ immediate: true }
)
async function loadArchiveOrders() {
if (!props.orderId && !props.deliveryOrderCode) {
archiveList.value = []
return
}
loading.value = true
try {
const where: Record<string, any> = {}
if (props.deliveryOrderCode) {
where.delivery_order_code = {
operator: 'eq',
value: props.deliveryOrderCode,
type: 'text'
}
} else if (props.orderId) {
where.id = {
operator: 'eq',
value: props.orderId,
type: 'number'
}
}
const res = await getarchiveOrderlist({
pagination: {
page: 1,
pageSize: 20
},
where
})
if (res && (res.code === 1 || res.code === 200)) {
archiveList.value = res.data?.list || []
return
}
archiveList.value = []
} catch (error) {
archiveList.value = []
} finally {
loading.value = false
}
}
</script>
<style scoped lang="scss">
.archive-order-panel {
display: flex;
flex-direction: column;
gap: 10px;
}
.panel-toolbar {
display: flex;
justify-content: flex-end;
}
.empty-tip {
color: #909399;
text-align: center;
padding: 8px 0;
}
</style>

View File

@ -0,0 +1,102 @@
<template>
<el-dialog
:model-value="modelValue"
title="订单审核"
width="560px"
destroy-on-close
@close="handleClose"
>
<el-alert
type="info"
:closable="false"
show-icon
style="margin-bottom: 12px"
:title="`本次将审核 ${orders.length} 条订单`"
/>
<el-form label-width="110px">
<el-form-item label="审核结果">
<el-radio-group v-model="form.review_status">
<el-radio label="fin">审核通过</el-radio>
<el-radio label="reject">审核驳回</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="审核人">
<el-input v-model.trim="form.operator_name" placeholder="请输入审核人" clearable />
</el-form-item>
<el-form-item label="审核时间">
<el-date-picker
v-model="form.operate_time"
type="datetime"
value-format="YYYY-MM-DD HH:mm:ss"
placeholder="选择审核时间"
style="width: 100%"
/>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="handleClose">取消</el-button>
<el-button type="primary" :loading="submitting" @click="handleSubmit">确认审核</el-button>
</template>
</el-dialog>
</template>
<script setup lang="ts">
import { reactive, watch } from 'vue'
import { ElMessage } from 'element-plus'
interface ReviewOrderItem {
id?: number | string
delivery_order_code?: string
}
const props = defineProps<{
modelValue: boolean
orders: ReviewOrderItem[]
submitting?: boolean
}>()
const emit = defineEmits<{
(e: 'update:modelValue', value: boolean): void
(e: 'submit', payload: { review_status: string; operator_name: string; operate_time: string }): void
}>()
const form = reactive({
review_status: 'fin',
operator_name: '',
operate_time: ''
})
watch(
() => props.modelValue,
(visible) => {
if (visible && !form.operate_time) {
form.operate_time = formatNow()
}
}
)
function formatNow() {
const date = new Date()
const yyyy = date.getFullYear()
const MM = `${date.getMonth() + 1}`.padStart(2, '0')
const dd = `${date.getDate()}`.padStart(2, '0')
const HH = `${date.getHours()}`.padStart(2, '0')
const mm = `${date.getMinutes()}`.padStart(2, '0')
const ss = `${date.getSeconds()}`.padStart(2, '0')
return `${yyyy}-${MM}-${dd} ${HH}:${mm}:${ss}`
}
function handleClose() {
emit('update:modelValue', false)
}
function handleSubmit() {
if (!props.orders.length) {
ElMessage.warning('请先选择需要审核的订单')
return
}
emit('submit', { ...form })
}
</script>

View File

@ -8,14 +8,13 @@
:span="item.span || 1"
>
<template v-if="item.prop === 'items'">
<!-- 商品清单特殊处理 -->
<div v-if="data?.[item.prop]">
{{ data[item.prop] }}
<div v-if="displayValue(item.prop) !== '-'">
{{ displayValue(item.prop) }}
</div>
<span v-else>-</span>
</template>
<template v-else>
{{ data ? data[item.prop] : '-' }}
{{ displayValue(item.prop) }}
</template>
</el-descriptions-item>
</el-descriptions>
@ -23,17 +22,62 @@
</template>
<script setup lang="ts">
import { translateOrderField } from '../config/order-common-config'
interface ConfigItem {
label: string
prop: string
span?: number
}
defineProps<{
const props = defineProps<{
data: any
config: ConfigItem[]
column?: number
}>()
const needTranslateFields = new Set([
'status',
'inspection_status',
'is_urgency',
'sync_status',
'invoice_flag',
'post_status',
'storage_status',
'pick_status',
'print_status',
'order_status',
'intercept_status',
'source_platform_code'
])
function displayValue(prop: string) {
if (!props.data) return '-'
if (prop === 'full_address') {
const address = [
props.data.province,
props.data.city,
props.data.area,
props.data.town,
props.data.detail_address
]
.filter((part: any) => part !== undefined && part !== null && `${part}`.trim() !== '')
.join(' ')
return address || '-'
}
const raw = props.data[prop]
if (raw === undefined || raw === null || raw === '') {
return '-'
}
if (needTranslateFields.has(prop)) {
return translateOrderField(prop, raw)
}
return raw
}
</script>
<style lang="scss" scoped>

View File

@ -59,7 +59,17 @@ export const COMMON_TRANSLATIONS: Record<string, Record<string, string>> = {
'OFFLINE': '线下',
'PDD': '拼多多',
'JD': '京东',
'TAOBAO': '淘宝'
'TAOBAO': '淘宝',
'TB': '淘宝'
}
,
inspection_status: {
'none': '未审核',
'pending': '待审核',
'padding': '审核中',
'fin': '审核通过',
'reject': '审核驳回',
'error': '审核异常'
}
}
@ -173,28 +183,73 @@ export const reviewAvailableFields = [
]
export const reviewColums = [
{ prop: 'delivery_order_code', label: '发货单号', width: '170' },
{ prop: 'shop_nick', label: '店铺名称', width: '140' },
{ prop: 'source_platform_code', label: '平台编码', width: '100' },
{ prop: 'status', label: '详情状态', width: '100' },
{ prop: 'source_platform_code', label: '平台来源', width: '100' },
{ prop: 'name', label: '收货人', width: '110' },
{ prop: 'mobile', label: '手机号', width: '120' },
{ prop: 'status', label: '订单状态', width: '100' },
{ prop: 'inspection_status', label: '审核状态', width: '100' },
{ prop: 'is_urgency', label: '紧急', width: '80' },
{ prop: 'logistics_name', label: '物流公司', width: '120' },
{ prop: 'items_total', label: '商品总数', width: '100' },
{ prop: 'total_amount', label: '订单金额', width: '110' },
{ prop: 'pay_time', label: '支付时间', width: '165' },
{ prop: 'operator_name', label: '审核人', width: '100' },
{ prop: 'is_urgency', label: '是否紧急', width: '100' },
{ prop: 'total_amount', label: '订单总金额', width: '120' },
{ prop: 'ar_amount', label: '应收金额', width: '120' },
{ prop: 'pay_time', label: '支付时间', width: '160' },
{ prop: 'items_total', label: '总数量', width: '90' },
{ prop: 'store_id', label: '货主', width: '100' },
{ prop: 'operate_time', label: '审核时间', width: '165' },
{ prop: 'create_at', label: '创建时间', width: '165' },
]
export const reviewOrderDetail = [
{ prop: 'items', label: '商品详情' },
{ prop: 'items_weight', label: '总重量' },
{ prop: 'pay_no', label: '支付单号' },
// 基础信息
{ prop: 'delivery_order_code', label: '发货单号' },
{ prop: 'pre_delivery_order_code', label: '前置单号' },
{ prop: 'order_type', label: '订单类型' },
{ prop: 'order_flag', label: '订单标记' },
{ prop: 'source_platform_name', label: '来源平台' },
{ prop: 'shop_nick', label: '店铺名称' },
{ prop: 'buyer_nick', label: '买家昵称' },
{ prop: 'seller_nick', label: '卖家昵称' },
{ prop: 'status', label: '订单状态' },
{ prop: 'inspection_status', label: '审核状态' },
{ prop: 'step', label: '流程步骤' },
{ prop: 'is_urgency', label: '是否紧急' },
{ prop: 'invoice_flag', label: '发票标记' },
{ prop: 'sync_status', label: '同步状态' },
{ prop: 'store_id', label: '货主ID' },
{ prop: 'warehouse_id', label: '仓库ID' },
{ prop: 'warehouse_code', label: '仓库编码' },
// 金额与商品
{ prop: 'total_amount', label: '订单总金额' },
{ prop: 'item_amount', label: '商品金额' },
{ prop: 'discount_amount', label: '折扣金额' },
{ prop: 'freight', label: '运费' },
{ prop: 'ar_amount', label: '应收金额' },
{ prop: 'got_amount', label: '实收金额' },
{ prop: 'items', label: '商品清单', span: 3 },
{ prop: 'items_count', label: '商品种类' },
{ prop: 'items_total', label: '商品总数' },
{ prop: 'items_weight', label: '总重量' },
// 收货与物流
{ prop: 'name', label: '收货人' },
{ prop: 'mobile', label: '手机号码' },
{ prop: 'tel', label: '固定电话' },
{ prop: 'full_address', label: '完整地址', span: 2 },
{ prop: 'logistics_name', label: '物流公司' },
{ prop: 'logistics_code', label: '物流编码' },
{ prop: 'invoice_flag', label: '发票标记' },
{ prop: 'express_code', label: '物流单号' },
{ prop: 'delivery_type', label: '发货类型' },
{ prop: 'logistics_area_code', label: '物流区域编码' },
// 时间信息
{ prop: 'place_order_time', label: '下单时间' },
{ prop: 'pay_time', label: '支付时间' },
{ prop: 'create_at', label: '创建时间' },
{ prop: 'updated_at', label: '更新时间' },
{ prop: 'operator_name', label: '审核人' },
{ prop: 'operate_time', label: '审核时间' },
]
export const reviewOrderbuttonList: any[] = [
@ -228,23 +283,80 @@ export const pendingAvailableFields = [
]
export const pendingCloums = [
{ prop: 'wave_id', label: '波次ID', width: '100' },
{ prop: 'delivery_order_code', label: '发货单号', width: '170' },
{ prop: 'shop_nick', label: '店铺名称', width: '140' },
{ prop: 'source_platform_code', label: '平台来源', width: '100' },
{ prop: 'name', label: '收货人', width: '100' },
{ prop: 'mobile', label: '手机号', width: '120' },
{ prop: 'status', label: '订单状态', width: '100' },
{ prop: 'sync_status', label: '同步状态', width: '100' },
{ prop: 'inspection_status', label: '审核状态', width: '100' },
{ prop: 'storage_status', label: '分配状态', width: '100' },
{ prop: 'post_status', label: '快递状态', width: '100' },
{ prop: 'pick_status', label: '拣货状态', width: '100' },
{ prop: 'pack_status', label: '打包状态', width: '100' },
{ prop: 'logistics_name', label: '物流公司', width: '120' },
{ prop: 'express_code', label: '单号', width: '160' },
{ prop: 'express_code', label: '物流单号', width: '160' },
{ prop: 'is_urgency', label: '紧急', width: '80' },
{ prop: 'total_amount', label: '订单金额', width: '110' },
{ prop: 'items_count', label: '商品种类', width: '100' },
{ prop: 'items_total', label: '商品总数', width: '100' },
{ prop: 'operator_name', label: '操作人', width: '100' },
{ prop: 'operate_time', label: '操作时间', width: '165' },
{ prop: 'pay_time', label: '支付时间', width: '160' },
{ prop: 'create_at', label: '创建时间', width: '165' },
]
export const pendingOrderDetail = [
// 基础信息
{ prop: 'delivery_order_code', label: '发货单号' },
{ prop: 'pre_delivery_order_code', label: '前置单号' },
{ prop: 'order_type', label: '订单类型' },
{ prop: 'order_flag', label: '订单标记' },
{ prop: 'source_platform_name', label: '来源平台' },
{ prop: 'shop_nick', label: '店铺名称' },
{ prop: 'buyer_nick', label: '买家昵称' },
{ prop: 'seller_nick', label: '卖家昵称' },
{ prop: 'status', label: '订单状态' },
{ prop: 'sync_status', label: '同步状态' },
{ prop: 'inspection_status', label: '审核状态' },
{ prop: 'step', label: '流程步骤' },
{ prop: 'is_urgency', label: '是否紧急' },
{ prop: 'invoice_flag', label: '发票标记' },
{ prop: 'store_id', label: '货主ID' },
{ prop: 'warehouse_id', label: '仓库ID' },
{ prop: 'warehouse_code', label: '仓库编码' },
// 金额与商品
{ prop: 'total_amount', label: '订单总金额' },
{ prop: 'item_amount', label: '商品金额' },
{ prop: 'discount_amount', label: '折扣金额' },
{ prop: 'freight', label: '运费' },
{ prop: 'ar_amount', label: '应收金额' },
{ prop: 'got_amount', label: '实收金额' },
{ prop: 'items', label: '商品清单', span: 3 },
{ prop: 'items_count', label: '商品种类' },
{ prop: 'items_total', label: '商品总数' },
{ prop: 'items_weight', label: '总重量' },
// 收货与物流
{ prop: 'name', label: '收货人' },
{ prop: 'mobile', label: '手机号码' },
{ prop: 'tel', label: '固定电话' },
{ prop: 'full_address', label: '完整地址', span: 2 },
{ prop: 'logistics_name', label: '物流公司' },
{ prop: 'logistics_code', label: '物流编码' },
{ prop: 'express_code', label: '物流单号' },
{ prop: 'delivery_type', label: '发货服务类型' },
{ prop: 'logistics_area_code', label: '快递区域编码' },
// 时间信息
{ prop: 'place_order_time', label: '下单时间' },
{ prop: 'pay_time', label: '支付时间' },
{ prop: 'create_at', label: '创建时间' },
{ prop: 'updated_at', label: '更新时间' },
{ prop: 'operator_name', label: '操作人' },
{ prop: 'operate_time', label: '操作时间' },
]
export const pendingOrderbuttonList: any[] = [

View File

@ -82,6 +82,22 @@
</el-tag>
</template>
<template #column-source_platform_code="{ row }">
{{ translateOrderField('source_platform_code', row.source_platform_code) }}
</template>
<template #column-status="{ row }">
<el-tag :type="row.status === 'pedding' ? 'warning' : row.status === 'error' ? 'danger' : 'info'" size="small">
{{ translateOrderField('status', row.status) }}
</el-tag>
</template>
<template #column-inspection_status="{ row }">
<el-tag :type="row.inspection_status === 'fin' ? 'success' : row.inspection_status === 'reject' ? 'danger' : 'info'" size="small">
{{ translateOrderField('inspection_status', row.inspection_status) }}
</el-tag>
</template>
<template #column-is_urgency="{ row }">
<el-tag :type="row.is_urgency === 'Y' ? 'danger' : 'info'" size="small">
{{ translateOrderField('is_urgency', row.is_urgency) }}
@ -122,25 +138,24 @@
<el-tab-pane label="订单详情" name="details" />
<el-tab-pane label="配货信息" name="picking" />
<el-tab-pane label="操作日志" name="logs" />
<el-tab-pane label="归档订单" name="archive" />
</el-tabs>
</div>
<div class="detail-container">
<KeepAlive>
<div v-if="activeTab === 'details'">
<el-descriptions :column="3" border>
<el-descriptions-item
v-for="field in pendingOrderDetail"
:key="field.prop"
:label="field.label"
>
{{ selectedRow?.[field.prop] ?? '-' }}
</el-descriptions-item>
</el-descriptions>
<detail :data="selectedRow" :config="pendingOrderDetail" :column="3" />
</div>
<div v-else-if="activeTab === 'picking'">
<p>配货明细加载中...</p>
</div>
<div v-else-if="activeTab === 'archive'">
<archive-order-panel
:order-id="selectedRow?.id || null"
:delivery-order-code="selectedRow?.delivery_order_code || ''"
/>
</div>
<div v-else>
<p>操作日志暂无</p>
</div>
@ -173,8 +188,8 @@ import {
pendingOrderbuttonList,
translateOrderField
} from './config/order-common-config'
import ArchiveOrderPanel from './component/ArchiveOrderPanel.vue'
import detail from './component/detail.vue'
import log from './component/log.vue'
const scanBox = ref<any>(null)
const upperTable = ref<any>(null)
@ -204,15 +219,6 @@ const selectedRow = computed(() => {
return list.value.find((i: any) => i.id === selectedOrderId.value) || null
})
function translateField(fieldValue: string, value: any) {
const field = availableFieldsRef.find((f: any) => f.value === fieldValue)
if (field && field.options) {
const option = field.options.find((opt: any) => opt.value === value)
return option ? option.label : value
}
return value
}
function getStatusType(status: string) {
return 'primary'
}
@ -226,86 +232,62 @@ async function loadData() {
if (loading.value) return
loading.value = true
const start = Date.now()
// 构造查询参数
const where = buildWhereConditions(scanBox.value?.getConditions?.() || {})
if (quickSearch.value) {
where.delivery_order_code = {
operator: 'like',
value: quickSearch.value,
type: 'text'
}
}
const queryParams = {
page: pagination.currentPage,
limit: pagination.pageSize,
quick_search: quickSearch.value,
...scanBox.value?.getConditions?.()
pagination: {
page: pagination.currentPage,
pageSize: pagination.pageSize
},
where
}
try {
const res = await getpendingOrderlist(queryParams)
if (res && res.code === 200 && res.data) {
if (res && (res.code === 1 || res.code === 200) && res.data) {
list.value = res.data.list || []
pagination.total = res.data.total || 0
pagination.total = res.data.pagination?.total || res.data.total || 0
} else {
throw new Error('接口返回异常')
list.value = []
pagination.total = 0
}
} catch (e) {
console.warn('获取待处理订单列表失败,使用模拟数据:', e)
const mockData = [
{
id: 14,
wave_id: 0,
storage_status: 'none',
post_status: 'none',
logistics_name: '顺丰',
express_code: '',
is_urgency: 'N',
items_total: 5,
pay_time: '2026-01-13 13:37:42',
warehouse_id: 100000,
warehouse_code: 'khgj2025100902',
items_weight: 0.00,
logistics_code: 'SF',
delivery_type: 'JYCK',
logistics_area_code: '',
},
{
id: 21,
wave_id: 0,
storage_status: 'none',
post_status: 'none',
logistics_name: '顺丰空运',
express_code: '',
is_urgency: 'N',
items_total: 10,
pay_time: '2026-01-13 15:22:03',
warehouse_id: 100000,
warehouse_code: '100000',
items_weight: 0.00,
logistics_code: 'SFKY',
delivery_type: 'JYCK',
logistics_area_code: '',
},
{
id: 29,
wave_id: 0,
storage_status: 'none',
post_status: 'none',
logistics_name: '圆通',
express_code: '',
is_urgency: 'N',
items_total: 101,
pay_time: '2026-01-20 13:02:59',
warehouse_id: 100000,
warehouse_code: 'wdt02060120001',
items_weight: 2.00,
logistics_code: 'YTO',
delivery_type: 'JYCK',
logistics_area_code: '',
},
]
list.value = mockData
pagination.total = mockData.length
list.value = []
pagination.total = 0
ElMessage.error('获取待处理订单列表失败')
} finally {
loading.value = false
queryTime.value = Date.now() - start
}
}
function buildWhereConditions(rawConditions: Record<string, any>) {
const where: Record<string, any> = {}
Object.keys(rawConditions || {}).forEach((key) => {
const condition = rawConditions[key]
if (condition && typeof condition === 'object' && 'operator' in condition) {
where[key] = condition
return
}
if (condition !== undefined && condition !== null && condition !== '') {
where[key] = {
operator: 'eq',
value: condition,
type: Array.isArray(condition) ? 'array' : typeof condition
}
}
})
return where
}
async function loadFilterData() {
try {
const [storesRes, presetRes]: any = await Promise.all([

View File

@ -17,7 +17,7 @@
<div class="toolbar">
<div class="toolbar-left">
<el-button size="small" type="primary" @click="loadData">刷新</el-button>
<el-button size="small" type="success" :disabled="!hasSelection" @click="handleBatchAudit">批量审核</el-button>
<el-button size="small" type="success" :disabled="!hasSelection" @click="openReviewDialog(selectionRows)">批量审核</el-button>
<el-button size="small" type="danger" :disabled="!hasSelection" @click="confirmBatchCancel">批量拦截</el-button>
<el-button size="small" :loading="exportLoading" @click="handleExport">导出</el-button>
</div>
@ -56,6 +56,12 @@
</el-tag>
</template>
<template #column-inspection_status="{ row }">
<el-tag :type="row.inspection_status === 'fin' ? 'success' : row.inspection_status === 'reject' ? 'danger' : 'warning'" size="small">
{{ translateOrderField('inspection_status', row.inspection_status) }}
</el-tag>
</template>
<template #column-order_status="{ row }">
<el-tag :type="getStatusType(row.order_status)" size="small">
{{ translateOrderField('order_status', row.order_status) }}
@ -80,6 +86,7 @@
<el-tab-pane label="订单详情" name="details" />
<el-tab-pane label="收货信息" name="receiver" />
<el-tab-pane label="操作日志" name="logs" />
<el-tab-pane label="订单审核" name="review" />
</el-tabs>
</div>
@ -94,6 +101,12 @@
<el-descriptions-item label="手机">{{ selectedRow?.mobile }}</el-descriptions-item>
</el-descriptions>
</div>
<div v-else-if="activeTab === 'review'" class="review-tab-panel">
<el-alert type="info" :closable="false" show-icon title="可对当前选中订单发起审核操作" />
<div class="review-tab-action">
<el-button size="small" type="primary" @click="openReviewDialog([selectedRow])">审核当前订单</el-button>
</div>
</div>
<div v-else>
<log :data="selectedRow" />
</div>
@ -107,6 +120,13 @@
</div>
</div>
</div>
<order-review-dialog
v-model="reviewDialogVisible"
:orders="reviewTargets"
:submitting="reviewSubmitting"
@submit="handleSubmitReview"
/>
</div>
</template>
@ -116,7 +136,7 @@ import { ElMessage, ElMessageBox } from 'element-plus'
import ScanBox from '@/components/ScanBox/index.vue'
import UpperTable from '@/components/UpperTable/index.vue'
import * as indexApi from '@/api/index'
import { getreviewOrderlist } from '@/api/order/order'
import { getreviewOrderlist, reviewOrder } from '@/api/order/order'
import {
reviewAvailableFields,
@ -126,6 +146,7 @@ import {
} from './config/order-common-config'
import detail from './component/detail.vue'
import log from './component/log.vue'
import OrderReviewDialog from './component/OrderReviewDialog.vue'
const scanBox = ref<any>(null)
const upperTable = ref<any>(null)
@ -148,6 +169,9 @@ const columns = ref(reviewColums)
const selectionRows = ref<any[]>([])
const hasSelection = ref(false)
const selectedOrderId = ref<number | string | null>(null)
const reviewDialogVisible = ref(false)
const reviewSubmitting = ref(false)
const reviewTargets = ref<any[]>([])
const quickSearch = ref('')
@ -178,79 +202,61 @@ async function loadData() {
loading.value = true
const start = Date.now()
const where = buildWhereConditions(scanBox.value?.getConditions?.() || {})
if (quickSearch.value) {
where.delivery_order_code = {
operator: 'like',
value: quickSearch.value,
type: 'text'
}
}
const queryParams = {
page: pagination.currentPage,
limit: pagination.pageSize,
quick_search: quickSearch.value,
...scanBox.value?.getConditions?.()
pagination: {
page: pagination.currentPage,
pageSize: pagination.pageSize
},
where
}
try {
const res = await getreviewOrderlist(queryParams)
if (res && res.code === 200 && res.data) {
if (res && (res.code === 1 || res.code === 200) && res.data) {
list.value = res.data.list || []
pagination.total = res.data.total || 0
pagination.total = res.data.pagination?.total || res.data.total || 0
} else {
throw new Error('接口返回异常')
list.value = []
pagination.total = 0
}
} catch (e) {
console.warn('获取待审核订单列表失败,使用模拟数据:', e)
const mockData = [
{
id: 14,
shop_nick: '线下店铺',
source_platform_code: 'OFFLINE',
items: '101845+5',
status: 'pedding',
operator_name: '系统',
is_urgency: 'N',
total_amount: 0.00,
ar_amount: 0.00,
pay_time: '2026-01-13 13:37:42',
pay_no: '',
order_flag: '',
warehouse_id: 100000,
warehouse_code: 'khgj2025100902',
store_id: 1000016,
items_total: 5,
items_weight: 0.00,
logistics_code: 'SF',
invoice_flag: 'N',
delivery_type: '普通快递',
order_status: 'WAIT_AUDIT'
},
{
id: 21,
shop_nick: '火火家de小店',
source_platform_code: 'PDD',
items: '101384+10',
status: 'pedding',
operator_name: '1',
is_urgency: 'N',
total_amount: 10.00,
ar_amount: 0.00,
pay_time: '2026-01-13 15:22:03',
pay_no: '',
order_flag: '',
warehouse_id: 100000,
warehouse_code: '100000',
store_id: 1000000,
items_total: 10,
items_weight: 0.00,
logistics_code: 'SFKY',
invoice_flag: 'N',
delivery_type: '顺丰空运',
order_status: 'WAIT_AUDIT'
}
]
list.value = mockData
pagination.total = mockData.length
list.value = []
pagination.total = 0
ElMessage.error('获取待审核订单列表失败')
} finally {
loading.value = false
queryTime.value = Date.now() - start
}
}
function buildWhereConditions(rawConditions: Record<string, any>) {
const where: Record<string, any> = {}
Object.keys(rawConditions || {}).forEach((key) => {
const condition = rawConditions[key]
if (condition && typeof condition === 'object' && 'operator' in condition) {
where[key] = condition
return
}
if (condition !== undefined && condition !== null && condition !== '') {
where[key] = {
operator: 'eq',
value: condition,
type: Array.isArray(condition) ? 'array' : typeof condition
}
}
})
return where
}
async function loadFilterData() {
try {
const [storesRes, presetRes]: any = await Promise.all([
@ -308,9 +314,52 @@ function onQuickSearch() {
loadData()
}
function handleBatchAudit() {
ElMessage.success(`成功审核 ${selectionRows.value.length} 个订单`)
loadData()
function openReviewDialog(rows: any[]) {
const targets = (rows || []).filter((item: any) => item?.id || item?.delivery_order_code)
if (!targets.length) {
ElMessage.warning('请先选择需要审核的订单')
return
}
reviewTargets.value = targets
reviewDialogVisible.value = true
}
async function handleSubmitReview(payload: { review_status: string; operator_name: string; operate_time: string }) {
if (reviewSubmitting.value) return
reviewSubmitting.value = true
try {
const results = await Promise.all(
reviewTargets.value.map((order) =>
reviewOrder({
id: order.id,
delivery_order_code: order.delivery_order_code,
review_status: payload.review_status,
inspection_status: payload.review_status,
operator_name: payload.operator_name,
operate_time: payload.operate_time
})
)
)
const successCount = results.filter((res) => res && (res.code === 1 || res.code === 200)).length
const failCount = results.length - successCount
if (successCount > 0) {
ElMessage.success(`审核成功 ${successCount} 条${failCount > 0 ? `,失败 ${failCount} 条` : ''}`)
reviewDialogVisible.value = false
reviewTargets.value = []
upperTable.value?.clearSelection?.()
selectionRows.value = []
hasSelection.value = false
loadData()
return
}
ElMessage.error('订单审核失败,请稍后重试')
} catch (error) {
ElMessage.error('订单审核失败,请稍后重试')
} finally {
reviewSubmitting.value = false
}
}
async function confirmBatchCancel() {

View File

@ -1,7 +1,26 @@
<template>
<div class="panel-stock-detail">
<div class="main-content">
<el-table :data="detailList" border stripe size="small" v-loading="loading">
<div class="panel-actions" style="padding-bottom:8px;">
<el-button-group class="toolbar-btn-group">
<el-button size="small" type="primary" @click="handleTransfer" v-if="showTransferBtn">移库</el-button>
</el-button-group>
</div>
<el-dialog v-model="dialogVisible" title="移库" width="480px">
<div style="display:flex;flex-direction:column;gap:8px;">
<el-input v-model="targetSpace" placeholder="目标库位 ID,扫码或输入" clearable />
<div style="min-height:22px;margin-top:4px;">
<span v-if="spaceName">目标库位名称: {{ spaceName }}</span>
<span v-else-if="targetSpace && targetSpaceError" style="color:#f56c6c">未找到库位</span>
</div>
<el-input-number v-model="transferQty" :min="1" placeholder="移库数量(不填则全量移库)" style="width:200px;" />
</div>
<template #footer>
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" :loading="transferLoading" @click="confirmTransfer">确认移库</el-button>
</template>
</el-dialog>
<el-table :data="detailList" border stripe size="small" v-loading="loading">
<el-table-column
v-for="col in detailColumns"
:key="col.prop"
@ -17,6 +36,10 @@
<script setup lang="ts">
import { computed, ref, watch } from 'vue'
import * as inventoryApi from '@/api/storage/inventory'
import * as warehouseApi from '@/api/warehouse'
import * as indexApi from '@/api/index'
import { ElMessage, ElMessageBox } from 'element-plus'
const props = defineProps<{
id: string | number
@ -24,8 +47,18 @@ const props = defineProps<{
groupByBatch?: boolean
}>()
const emit = defineEmits(['refresh'])
const loading = ref(false)
const detailList = ref<any[]>([])
const currentRow = ref<any>(null)
const dialogVisible = ref(false)
const targetSpace = ref<string | number>('')
const spaceName = ref<string>('')
const targetSpaceError = ref<string>('')
let spaceInfoTimer: any = null
const transferQty = ref<number | null>(null)
const transferLoading = ref(false)
const detailColumns = computed(() => {
if (props.groupByBatch) {
@ -56,15 +89,170 @@ const detailColumns = computed(() => {
]
})
function normalizeRow(r: any) {
if (!r) return null
const row = { ...r }
row.stock = row.stock || {}
if (row.stock.is_batch_mgmt_enabled === undefined || row.stock.is_batch_mgmt_enabled === null) {
row.stock.is_batch_mgmt_enabled = false
}
row.batch_count = Number(row.batch_count || 0)
return row
}
const loadData = () => {
loading.value = true
setTimeout(() => {
detailList.value = props.row ? [props.row] : []
currentRow.value = props.row ? normalizeRow(props.row) : null
detailList.value = currentRow.value ? [currentRow.value] : []
loading.value = false
}, 120)
}
const showTransferBtn = computed(() => {
const row = currentRow.value || props.row || {}
const stock = row.stock || {}
console.log(stock, 'stock info for transfer button visibility')
const flag = stock?.is_batch_mgmt_enabled
const isBatchMgmt = (function (v: any) {
if (v === true || v === 1) return true
if (v === false || v === 0) return false
const s = String(v || '').toLowerCase()
return s === 'y' || s === '1' || s === 'true'
})(flag)
const batchCount = Number(row.batch_count || 0)
if (isBatchMgmt && batchCount > 1) return false
return true
})
function handleTransfer() {
targetSpace.value = ''
transferQty.value = null
dialogVisible.value = true
}
async function confirmTransfer() {
if (!targetSpace.value) {
ElMessage.warning('请输入或扫码目标库位ID')
return
}
const row = currentRow.value || props.row || {}
transferLoading.value = true
try {
// resolve target_space_id: if numeric use directly, otherwise try search API to get id
const raw = String(targetSpace.value).trim()
let targetSpaceId: number | null = null
const num = Number(raw)
if (!isNaN(num) && raw !== '') targetSpaceId = num
if (targetSpaceId === null) {
// try searchSpace to resolve by code/keyword
try {
const res: any = await indexApi.searchSpace({ keyword: raw })
const data = res && (res.data || res.list || res)
const item = Array.isArray(data) ? (data[0] || null) : data
if (item) targetSpaceId = item.id || item.space_id || null
} catch (e) {
// ignore, will attempt warehouse.getSpaceInfo fallback
}
}
if (targetSpaceId === null) {
// fallback: if numeric parse failed earlier, try warehouse.getSpaceInfo with raw (some backends accept code)
const maybeNum = Number(raw)
if (!isNaN(maybeNum)) targetSpaceId = maybeNum
}
if (!targetSpaceId) {
ElMessage.warning('未解析到目标库位 ID,请检查输入或使用扫码')
transferLoading.value = false
return
}
// validate transferQty if provided
if (transferQty.value !== null && transferQty.value !== undefined && String(transferQty.value).trim() !== '') {
const q = Number(transferQty.value)
if (isNaN(q) || q <= 0) {
ElMessage.warning('移库数量必须为正数')
transferLoading.value = false
return
}
transferQty.value = q
}
// 优先使用 storage_id 精确移库
if (row.storage_id) {
const payload: any = { storage_id: row.storage_id, target_space_id: targetSpaceId }
if (transferQty.value && Number(transferQty.value) > 0) payload.quantity = Number(transferQty.value)
const res: any = await inventoryApi.transferLocation(payload)
ElMessage.success(res?.message || '移库成功')
} else {
// 回退到按商品移库(仅适用于非批次管理场景)
const payload: any = { space_id: row.space_id, stock_id: row.stock_id, target_space_id: targetSpaceId }
if (transferQty.value && Number(transferQty.value) > 0) payload.quantity = Number(transferQty.value)
const res: any = await inventoryApi.transferByProduct(payload)
ElMessage.success(res?.message || '移库成功')
}
dialogVisible.value = false
// 触发父组件刷新(父组件在使用时绑定了 @refresh)
emit('refresh')
// 保留全局事件兼容旧逻辑
try {
// @ts-ignore
const ev = new CustomEvent('transfer-success')
window.dispatchEvent(ev)
} catch (e) {}
} catch (e: any) {
console.error('移库失败', e)
ElMessage.error(e?.message || '移库失败')
} finally {
transferLoading.value = false
}
}
watch(() => [props.id, props.row, props.groupByBatch], loadData, { immediate: true })
watch(targetSpace, (val) => {
if (spaceInfoTimer) clearTimeout(spaceInfoTimer)
spaceName.value = ''
targetSpaceError.value = ''
const v = String(val || '').trim()
if (!v) return
spaceInfoTimer = setTimeout(async () => {
try {
const id = Number(v)
let res: any = null
try {
// prefer index.searchSpace which supports code/keyword search
res = await indexApi.searchSpace({ keyword: v })
} catch (e) {
// fallback to warehouse.getSpaceInfo by id if searchSpace fails
if (!isNaN(id)) res = await warehouseApi.getSpaceInfo(id)
}
// normalize various possible response shapes
const data = res && (res.data || res.list || res)
if (data) {
// if list/array, take first
const item = Array.isArray(data) ? (data[0] || null) : data
if (item) {
spaceName.value = item.custom_name || item.space_code || item.name || ''
targetSpaceError.value = ''
} else {
spaceName.value = ''
targetSpaceError.value = 'not_found'
}
} else {
spaceName.value = ''
targetSpaceError.value = 'not_found'
}
} catch (err) {
console.error('getSpaceInfo failed', err)
spaceName.value = ''
targetSpaceError.value = 'error'
}
}, 300)
})
</script>
<style scoped lang="scss">

View File

@ -64,6 +64,18 @@
</el-tag>
</template>
<template #column-is_batch_mgmt_enabled="{ row }">
<div style="text-align:center">
<el-tag :type="(row.is_batch_mgmt_enabled === true || String(row.is_batch_mgmt_enabled).toLowerCase() === 'y' || String(row.is_batch_mgmt_enabled) === '1') ? 'success' : 'info'" size="small">
{{ (row.is_batch_mgmt_enabled === true || String(row.is_batch_mgmt_enabled).toLowerCase() === 'y' || String(row.is_batch_mgmt_enabled) === '1') ? '是' : '否' }}
</el-tag>
</div>
</template>
<template #column-batch_count="{ row }">
<div style="text-align:center">{{ row.batch_count || 0 }}</div>
</template>
<template #column-status="{ row }">
<el-tag v-if="row.status" size="small">
{{ row.status }}
@ -140,8 +152,17 @@ const pagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
const tableSize = ref('small')
const groupByBatch = ref(false)
const columns = computed(() => {
if (groupByBatch.value) return productstockColums
return productstockColums.filter((col: any) => !['production_date', 'expiry_date'].includes(col.prop))
const cols: any[] = JSON.parse(JSON.stringify(productstockColums))
if (groupByBatch.value) {
if (!cols.find((c: any) => c.prop === 'batch_no')) {
const batchCol = { prop: 'batch_no', label: '批次号', width: '120' }
const idx = cols.findIndex((c: any) => c.prop === 'item_name')
if (idx >= 0) cols.splice(idx + 1, 0, batchCol)
else cols.push(batchCol)
}
return cols
}
return cols.filter((col: any) => !['production_date', 'expiry_date'].includes(col.prop))
})
@ -189,6 +210,7 @@ async function loadData() {
stock_id: item.stock_id,
item_code: item.stock?.item_code || '',
item_name: item.stock?.item_name || '',
batch_no: item.batch_no || item.batch?.batch_no || '',
production_date: item.production_date || item.batch?.production_date || '',
expiry_date: item.expiry_date || item.batch?.expiry_date || '',
is_shelf_life_warning_triggered: Boolean(item.is_shelf_life_warning_triggered),
@ -199,7 +221,14 @@ async function loadData() {
available_quantity: item.available_quantity,
locked_quantity: item.locked_quantity,
last_inbound_time: item.last_inbound_time,
batch_count: item.batch_count
batch_count: Number(item.batch_count || 0),
is_batch_mgmt_enabled: item.stock?.is_batch_mgmt_enabled,
// preserve original structures for child components that need full network shape
stock: item.stock || null,
space: item.space || null,
storage_id: item.storage_id || item.id || null,
space_id: item.space_id || null,
__raw: item
}))
const pager = data.pagination || {}

View File

@ -29,6 +29,7 @@ export const productstockColums = [
{ prop: 'available_quantity', label: '可用数量', width: '100' },
{ prop: 'locked_quantity', label: '锁定数量', width: '100' },
{ prop: 'last_inbound_time', label: '最后入库时间', width: '160' },
{ prop: 'is_batch_mgmt_enabled', label: '批次管理', width: '100' },
{ prop: 'batch_count', label: '批次数', width: '80' }
]

View File

@ -23,7 +23,7 @@
>
导出
</el-button>
<el-checkbox v-model="groupByBatch" @change="loadData">按批次分组</el-checkbox>
</div>
</div>

View File

@ -584,6 +584,13 @@ const submitDateChange = async () => {
ElMessage.warning('缺少明细ID,无法保存')
return
}
const receivingId = Number(
editingDateRow.value.receiving_id ?? props.id ?? props.row?.id
)
if (!receivingId) {
ElMessage.warning('缺少收货单ID,无法保存')
return
}
if (!dateForm.production_date || !dateForm.expiry_date) {
ElMessage.warning('请选择生产日期和到期日期')
return
@ -593,30 +600,32 @@ const submitDateChange = async () => {
return
}
const detailId = Number(editingDateRow.value.id)
if (!Number.isFinite(detailId) || detailId <= 0) {
ElMessage.warning('缺少有效的明细ID')
return
}
dateSaving.value = true
try {
// 前端模拟修改:本地更新明细日期,不请求后端
await new Promise(resolve => setTimeout(resolve, 200))
const idx = tableData.value.findIndex((item: any) => item.id === editingDateRow.value.id)
if (idx !== -1) {
tableData.value[idx] = {
...tableData.value[idx],
production_date: dateForm.production_date,
expiry_date: dateForm.expiry_date
}
if (isExpired(dateForm.expiry_date)) {
ElMessageBox.alert(
`商品名称:${tableData.value[idx]?.product_name || '--'}已过期,请移除拒绝收货。`,
'过期提醒',
{ type: 'warning' }
)
}
// 与 bindDetailProduct 一致:服务端以 detail_id 定位明细;部分实现不读取 id 字段
const res: any = await receivingApi.detailChange({
detail_id: detailId,
id: detailId,
receiving_id: receivingId,
production_date: dateForm.production_date,
expiry_date: dateForm.expiry_date
})
if (res && (res.code === 200 || res.flag === 'success')) {
ElMessage.success(res.message || '日期修改成功')
dateDialogVisible.value = false
loadProductData()
} else {
ElMessage.error(res?.message || '日期修改失败')
}
ElMessage.success('日期修改成功')
dateDialogVisible.value = false
} catch (e) {
console.error('日期修改失败', e)
ElMessage.error('日期修改失败')
} finally {
dateSaving.value = false
}

View File

@ -16,7 +16,7 @@
</el-button> -->
<el-button type="primary" size="small" icon="el-icon-delete" @click="confirmcomplete" title="一键入库"
:disabled="!hasSelection" class="toolbar-btn">
一键入库
完成收货
</el-button>
<el-button size="small" :disabled="!hasSelection" @click="confirmBatchCancel">批量作废</el-button>
<el-button type="success" size="small" :disabled="selectionRows.length !== 1" :loading="quickPutawayLoading" @click="handleQuickPutaway">快捷入库</el-button>

View File

@ -1,37 +1,43 @@
<template>
<div class="expiry-query">
<el-descriptions class="info-panel" :column="4" border size="small">
<el-descriptions-item label="商品编码">{{ currentRow.item_code || '--' }}</el-descriptions-item>
<el-descriptions-item label="商品名称">{{ currentRow.item_name || '--' }}</el-descriptions-item>
<el-descriptions-item label="库位">{{ currentRow.space_code || '--' }}</el-descriptions-item>
<el-descriptions-item label="库存类型">{{ currentRow.inventory_type || '--' }}</el-descriptions-item>
<el-descriptions-item label="阈值天数">{{ currentRow.threshold_days ?? '--' }}</el-descriptions-item>
<el-descriptions-item label="剩余天数">{{ currentRow.remaining_days ?? '--' }}</el-descriptions-item>
<el-descriptions-item label="状态">
<el-tag size="small" :type="currentRow.is_expired ? 'danger' : 'success'">
{{ currentRow.is_expired ? '已过期' : '有效' }}
</el-tag>
<el-descriptions-item v-for="item in expiryQueryInfoItems" :key="item.label" :label="item.label">
<template v-if="item.kind === 'expiry_tag'">
<el-tag
class="status-tag"
size="small"
:type="currentRow[item.expiredField] ? 'danger' : 'success'"
>
{{ currentRow[item.expiredField] ? expiryStatusText.expired : expiryStatusText.valid }}
</el-tag>
</template>
<template v-else>
{{ formatInfoField(currentRow, item.field) }}
</template>
</el-descriptions-item>
<el-descriptions-item label="到期日期">{{ currentRow.expiry_date || '--' }}</el-descriptions-item>
</el-descriptions>
<el-table :data="tableData" border stripe size="small" v-loading="loading" height="calc(100% - 90px)">
<el-table-column prop="stock_id" label="商品ID" width="120" />
<el-table-column prop="item_name" label="商品名称" min-width="200" show-overflow-tooltip />
<el-table-column prop="batch_no" label="批次号" width="160" />
<el-table-column prop="production_date" label="生产日期" width="120" />
<el-table-column prop="expiry_date" label="有效期至" width="120">
<el-table-column
v-for="col in expiryQueryTableColumns"
:key="col.prop"
:prop="col.prop"
:label="col.label"
:width="col.width"
:min-width="col.minWidth"
:show-overflow-tooltip="col.showOverflowTooltip"
>
<template #default="{ row }">
<span class="expiry-date-highlight">{{ row.expiry_date || '--' }}</span>
</template>
</el-table-column>
<el-table-column prop="remaining_days" label="剩余天数" width="100" />
<el-table-column prop="quantity" label="库存数量" width="100" />
<el-table-column label="状态" width="100">
<template #default="{ row }">
<el-tag size="small" :type="getStatusTagType(row.warning_status)">
{{ getStatusLabel(row.warning_status) }}
<span v-if="col.slot === 'expiry'" class="expiry-date-highlight">{{ row.expiry_date || '--' }}</span>
<el-tag
v-else-if="col.slot === 'status'"
class="status-tag"
size="small"
:type="getExpiryDetailStatusTagType(row.warning_status)"
>
{{ getExpiryDetailStatusLabel(row.warning_status) }}
</el-tag>
<span v-else>{{ row[col.prop] }}</span>
</template>
</el-table-column>
</el-table>
@ -40,6 +46,14 @@
<script setup lang="ts">
import { computed, ref, watch } from 'vue'
import {
expiryQueryInfoItems,
expiryQueryTableColumns,
expiryStatusText,
expiryWarningStatus,
getExpiryDetailStatusLabel,
getExpiryDetailStatusTagType
} from '../validityperiod-config'
const props = defineProps<{
id: string | number
@ -51,6 +65,12 @@ const tableData = ref<any[]>([])
const currentRow = computed(() => props.row || {})
function formatInfoField(row: Record<string, any>, field: string) {
const v = row[field]
if (v === null || v === undefined || v === '') return '--'
return v
}
function loadData() {
loading.value = true
setTimeout(() => {
@ -64,23 +84,13 @@ function loadData() {
expiry_date: row.expiry_date,
remaining_days: row.remaining_days,
quantity: row.quantity,
warning_status: row.is_expired ? 'expired' : 'normal'
warning_status: row.is_expired ? expiryWarningStatus.expired : expiryWarningStatus.normal
}]
: []
loading.value = false
}, 250)
}
function getStatusLabel(status: string) {
if (status === 'expired') return '已过期'
return '正常'
}
function getStatusTagType(status: string) {
if (status === 'expired') return 'danger'
return 'success'
}
watch(() => props.id, loadData, { immediate: true })
</script>
@ -100,5 +110,11 @@ watch(() => props.id, loadData, { immediate: true })
color: #e6a23c;
font-weight: 600;
}
:deep(.status-tag.el-tag--success) {
--el-tag-bg-color: #ecf5ff;
--el-tag-border-color: #b3d8ff;
--el-tag-text-color: #409eff;
}
}
</style>

View File

@ -2,9 +2,9 @@
<div class="validity-period-container">
<scan-box
ref="scanBox"
width="320px"
:tree-props="{ children: 'children', label: 'label' }"
:auto-submit="false"
:width="scanBoxConfig.width"
:tree-props="scanBoxConfig.treeProps"
:auto-submit="scanBoxConfig.autoSubmit"
:preset-tree="presetTree"
:available-fields="availableFieldsRef"
@condition-change="handleConditionChange"
@ -17,31 +17,45 @@
<div class="toolbar-left">
<el-button size="small" type="primary" @click="loadData">刷新</el-button>
<el-button size="small" :loading="exportLoading" @click="handleExport">导出</el-button>
<el-button size="small" @click="openMessageDialog">消息管理</el-button>
<el-button size="small" >转残</el-button>
<el-button size="small" >出库</el-button>
</div>
</div>
<div class="upper-wrapper">
<upper-table
ref="upperTable"
title="有效期商品列表"
:title="upperTableConfig.title"
:data="list"
:columns="columns"
:table-size="tableSize"
:pagination="pagination"
:show-index="true"
:show-actions="true"
:show-selection="false"
:show-selection="true"
:loading="loading"
:queryTime="queryTime"
@current-change="handleRowClick"
@page-change="handlePageChange"
@page-size-change="handlePageSizeChange"
@sort-change="handleSortChange"
@selection-change="onSelectionChange"
@refresh="loadData"
>
<template #column-expiry_date="{ row }">
<span class="expiry-date-highlight">{{ row.expiry_date || '--' }}</span>
</template>
<template #column-is_expired_text="{ row }">
<span
class="expiry-status-text"
:class="row.is_expired ? 'expiry-status--expired' : 'expiry-status--valid'"
>
{{ row.is_expired ? expiryStatusText.expired : expiryStatusText.valid }}
</span>
</template>
<template #empty>
<div class="empty-tip">暂无有效期商品</div>
</template>
@ -68,47 +82,140 @@
</div>
</div>
</div>
<el-dialog
v-model="messageDialogVisible"
title="预警消息中心"
align-center
width="1000px"
:modal="false"
append-to-body
class="message-dialog-custom"
>
<div class="message-dialog-layout">
<div class="message-sidebar">
<div class="sidebar-header">
<div class="header-top">
<span class="header-title">通知列表</span>
<el-badge :value="unreadMessageCount" :hidden="unreadMessageCount === 0" type="danger">
<el-button link type="primary" size="small" @click="markAllAsRead">全部已读</el-button>
</el-badge>
</div>
<div class="filter-wrapper">
<el-radio-group v-model="messageFilter" size="small" class="custom-radio-group">
<el-radio-button label="all">全部</el-radio-button>
<el-radio-button label="unread">未读</el-radio-button>
<el-radio-button label="read">已读</el-radio-button>
</el-radio-group>
</div>
</div>
<div class="message-list-scroll">
<div
v-for="item in filteredMessages"
:key="item.id"
class="message-card"
:class="{ active: activeMessage?.id === item.id, unread: !item.read }"
@click="handleSelectMessage(item)"
>
<div class="card-title">
<span class="dot"></span>
<span class="text">{{ item.item_name || '--' }}</span>
</div>
<div class="card-subtitle">批次号:{{ item.batch_no || '--' }}</div>
<div class="card-footer">
<span class="time">{{ item.expiry_date || '--' }}</span>
<el-tag size="small" :type="item.read ? 'info' : 'primary'" effect="light">
{{ item.read ? '已读' : '未读' }}
</el-tag>
</div>
</div>
<el-empty v-if="filteredMessages.length === 0" description="暂无此状态消息" :image-size="60" />
</div>
</div>
<div class="message-detail-area">
<template v-if="activeMessage">
<div class="detail-header">
<div class="detail-title-row">
<h2>{{ activeMessage.item_name || '--' }}</h2>
<el-button
v-if="!activeMessage.read"
type="primary"
plain
size="small"
@click="markMessageRead(activeMessage)"
>
标记已读
</el-button>
</div>
<div class="detail-meta">
<span class="meta-item">到期日期:{{ activeMessage.expiry_date || '--' }}</span>
<span class="meta-item">剩余天数:{{ activeMessage.remaining_days ?? '--' }}</span>
</div>
</div>
<div class="detail-body">
<div class="info-section">
<div class="section-label">消息</div>
<div class="detail-grid">
<div class="detail-alert">
<span class="alert-icon">!</span>
<span class="alert-text">预警信息:有 <span class="alert-highlight">1种</span> 商品已临期,建议转残,请及时处理!</span>
</div>
</div>
</div>
</div>
</template>
<div v-else class="empty-detail">
<el-empty description="点击左侧列表查看详细预警信息" />
</div>
</div>
</div>
</el-dialog>
</div>
</template>
<script setup lang="ts">
import { computed, onMounted, reactive, ref } from 'vue'
import { computed, onMounted, reactive, ref, watch } from 'vue'
import { ElMessage } from 'element-plus'
import ScanBox from '@/components/ScanBox/index.vue'
import UpperTable from '@/components/UpperTable/index.vue'
import * as indexApi from '@/api/index'
import * as validityApi from '@/api/storage/validityperiod'
import * as XLSX from 'xlsx'
import expiryQuery from './component/expiryQuery.vue'
import { availableFields } from '../inventory/inventory-config'
import {
availableFields,
expiryStatusListClass,
expiryStatusText,
scanBoxConfig,
upperTableConfig,
validityPeriodColumns
} from './validityperiod-config'
// --- 变量定义与初始化 (保持原逻辑) ---
const scanBox = ref<any>(null)
const upperTable = ref<any>(null)
const presetTree = ref<any[]>([])
const availableFieldsRef = reactive(JSON.parse(JSON.stringify(availableFields)))
const activeTab = ref('expiry')
const list = ref<any[]>([])
const loading = ref(false)
const exportLoading = ref(false)
const queryTime = ref(0)
const pagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
const tableSize = ref('small')
const columns = ref([
{ prop: 'stock_id', label: '商品ID', width: '110' },
{ prop: 'item_code', label: '商品编码', width: '140' },
{ prop: 'item_name', label: '商品名称', minWidth: '180' },
{ prop: 'batch_no', label: '批次号', width: '160' },
{ prop: 'stock_unit', label: '单位', width: '80' },
{ prop: 'quantity', label: '库存数量', width: '100' },
{ prop: 'remaining_days', label: '剩余天数', width: '100' },
{ prop: 'threshold_days', label: '阈值天数', width: '100' },
{ prop: 'expiry_date', label: '到期日期', width: '170' },
{ prop: 'production_date', label: '生产日期', width: '170' },
{ prop: 'space_code', label: '库位', minWidth: '140' },
{ prop: 'is_expired_text', label: '过期状态', width: '100' }
])
const columns = ref(JSON.parse(JSON.stringify(validityPeriodColumns)))
const selectedEntryId = ref<number | string | null>(null)
const selectionRows = ref<any[]>([])
const currentSort = reactive({ prop: '', order: '' })
// --- 消息中心相关逻辑 ---
const messageDialogVisible = ref(false)
const messageFilter = ref<'all' | 'read' | 'unread'>('all')
const messageReadMap = ref<Record<string, boolean>>({})
const activeMessage = ref<any>(null)
const componentMap: Record<string, any> = {
expiry: expiryQuery
@ -116,12 +223,46 @@ const componentMap: Record<string, any> = {
const activeComponent = computed(() => componentMap[activeTab.value] || componentMap.expiry)
const selectedRow = computed(() => list.value.find((i: any) => i.id === selectedEntryId.value) || null)
const messageList = computed(() =>
list.value.map((item: any) => ({
...item,
read: Boolean(messageReadMap.value[item.id])
}))
)
const filteredMessages = computed(() => {
if (messageFilter.value === 'all') return messageList.value
if (messageFilter.value === 'read') return messageList.value.filter((item: any) => item.read)
return messageList.value.filter((item: any) => !item.read)
})
const unreadMessageCount = computed(() => messageList.value.filter((item: any) => !item.read).length)
// --- 方法实现 (保持原逻辑并针对消息中心做了微调) ---
onMounted(() => {
loadData()
loadFilterData()
openMessageDialog()
})
watch(
filteredMessages,
(messages) => {
if (!messageDialogVisible.value) return
if (!messages.length) {
activeMessage.value = null
return
}
const exists = activeMessage.value && messages.some((item: any) => item.id === activeMessage.value.id)
if (!exists) {
activeMessage.value = messages[0]
} else {
activeMessage.value = messages.find((item: any) => item.id === activeMessage.value.id) || messages[0]
}
},
{ immediate: true }
)
async function loadData() {
if (loading.value) return
loading.value = true
@ -129,7 +270,10 @@ async function loadData() {
try {
const params: any = {
pagination: { page: pagination.currentPage, pageSize: pagination.pageSize },
where: scanBox.value?.getConditions?.() || {}
where: scanBox.value?.getConditions?.() || {},
order: currentSort.prop
? { [currentSort.prop]: currentSort.order === 'ascending' ? 'ASC' : 'DESC' }
: undefined
}
const res: any = await validityApi.getExpiryList(params)
@ -138,6 +282,7 @@ async function loadData() {
const rows = Array.isArray(data.list) ? data.list : []
list.value = rows.map((item: any) => ({
id: item.id || (item.stock_id + '-' + item.space_id + '-' + (item.batch_no || '')),
// ... (保持原本的字段映射不变)
stock_id: item.stock_id,
item_code: item.stock?.item_code || '',
goods_code: item.stock?.goods_code || '',
@ -158,19 +303,13 @@ async function loadData() {
threshold_days: item.threshold_days,
remaining_days: item.remaining_days,
is_expired: Boolean(item.is_expired),
is_expired_text: item.is_expired ? '已过期' : '有效'
is_expired_text: item.is_expired ? expiryStatusText.expired : expiryStatusText.valid
}))
const pager = data.pagination || {}
pagination.total = pager.total || data.total || list.value.length
} else {
list.value = []
pagination.total = 0
}
} catch (e) {
console.error('获取有效期列表失败', e)
ElMessage.error('加载有效期列表失败')
list.value = []
pagination.total = 0
ElMessage.error('加载列表失败')
} finally {
loading.value = false
queryTime.value = Date.now() - start
@ -183,59 +322,101 @@ async function loadFilterData() {
indexApi.loadStores({ type: 'entry' }),
indexApi.fastWhereTree('entry')
])
if (storesRes && storesRes.code === 200) {
if (storesRes?.code === 200) {
const f = availableFieldsRef.find((i: any) => i.value === 'store_id')
if (f) f.options = storesRes.stores || []
}
if (presetRes && presetRes.code === 200) {
presetTree.value = presetRes.presetTree || []
}
} catch (e) {
console.error('加载筛选配置失败', e)
}
}
function handleConditionChange() {
pagination.currentPage = 1
loadData()
}
function handleConditionClear() {
pagination.currentPage = 1
loadData()
if (presetRes?.code === 200) presetTree.value = presetRes.presetTree || []
} catch (e) {}
}
function handleConditionChange() { pagination.currentPage = 1; loadData(); }
function handleConditionClear() { pagination.currentPage = 1; loadData(); }
function handleConditionReset() {
pagination.currentPage = 1
if (scanBox.value?.reset) scanBox.value.reset()
loadData()
}
function handleRowClick(row: any) {
selectedEntryId.value = row?.id || null
function handleRowClick(row: any) { selectedEntryId.value = row?.id || null; }
function handlePageChange(page: number) { pagination.currentPage = page; loadData(); }
function handlePageSizeChange(size: number) {
pagination.pageSize = size; pagination.currentPage = 1; loadData();
}
function handleSortChange({ prop, order }: any) {
currentSort.prop = prop || ''; currentSort.order = order || '';
pagination.currentPage = 1; loadData();
}
function onSelectionChange(rows: any[]) { selectionRows.value = rows || []; }
// --- 消息中心逻辑 ---
function openMessageDialog() {
messageDialogVisible.value = true
if (!activeMessage.value && filteredMessages.value.length > 0) {
activeMessage.value = filteredMessages.value[0]
}
}
function handlePageChange(page: number) {
pagination.currentPage = page
loadData()
function handleSelectMessage(item: any) {
activeMessage.value = item
}
function handlePageSizeChange(size: number) {
pagination.pageSize = size
pagination.currentPage = 1
loadData()
function markMessageRead(item: any) {
if (item?.id) {
messageReadMap.value[item.id] = true
}
if (activeMessage.value?.id === item.id) {
const latest = messageList.value.find((msg: any) => msg.id === item.id)
activeMessage.value = latest || null
}
if (messageFilter.value !== 'all' && activeMessage.value?.read && messageFilter.value === 'unread') {
activeMessage.value = filteredMessages.value[0] || null
}
ElMessage.success('已标记已读')
}
function handleExport() {
function markAllAsRead() {
messageList.value.forEach((m: any) => {
messageReadMap.value[m.id] = true
})
if (messageFilter.value === 'unread') {
activeMessage.value = null
} else if (activeMessage.value) {
const latest = messageList.value.find((msg: any) => msg.id === activeMessage.value.id)
activeMessage.value = latest || null
}
ElMessage.success('全部标记成功')
}
async function handleExport() {
if (exportLoading.value) return
if (selectionRows.value.length === 0) {
ElMessage.warning('请先勾选数据')
return
}
exportLoading.value = true
setTimeout(() => {
try {
const exportData = selectionRows.value.map((item: any) => ({
商品名称: item.item_name || '',
批次号: item.batch_no || '',
到期日期: item.expiry_date || '',
剩余天数: item.remaining_days ?? '',
过期状态: item.is_expired ? '已过期' : '正常'
}))
const ws = XLSX.utils.json_to_sheet(exportData)
const wb = XLSX.utils.book_new()
XLSX.utils.book_append_sheet(wb, ws, '有效期数据')
XLSX.writeFile(wb, `有效期商品_${Date.now()}.xlsx`)
} catch (e) {
ElMessage.error('导出失败')
} finally {
exportLoading.value = false
ElMessage.success('导出成功')
}, 1000)
}
}
</script>
<style scoped lang="scss">
// 基础容器样式
.validity-period-container {
display: flex;
height: calc(100vh - 130px);
@ -250,93 +431,317 @@ function handleExport() {
overflow: hidden;
.toolbar {
padding: 5px;
padding: 8px 12px;
border-bottom: 1px solid #ebeef5;
background-color: #fff;
display: flex;
justify-content: space-between;
align-items: center;
background-color: #fff;
}
.upper-wrapper {
flex: 1;
min-height: 0;
overflow: hidden;
}
.upper-wrapper :deep(.upper-table-container) {
height: 100%;
display: flex;
flex-direction: column;
}
.upper-wrapper :deep(.upper-table-container) :deep(.table-container) {
height: auto !important;
flex: 1 1 auto;
min-height: 0;
overflow: hidden;
}
.upper-wrapper :deep(.el-table__header-wrapper) {
position: sticky;
top: 0;
z-index: 3;
background: #fff;
}
.upper-wrapper :deep(.el-table__body-wrapper) {
overflow: auto;
min-height: 0;
/* 仅高亮数据行,不改变整表或表头背景 */
:deep(.el-table__body-wrapper .el-table__row > td.el-table__cell) {
background-color: #ff0000 !important;
border-bottom-color: #ffffff;
color: #ffffff !important;
}
:deep(.el-table__body-wrapper .el-table__row:hover > td.el-table__cell) {
background-color: #ff7575 !important;
}
:deep(.el-table__body-wrapper .el-table__row > td.el-table__cell .cell) {
color: #ffffff !important;
}
:deep(.el-table__body-wrapper .el-table__row > td.el-table__cell .expiry-date-highlight),
:deep(.el-table__body-wrapper .el-table__row > td.el-table__cell .expiry-status--valid),
:deep(.el-table__body-wrapper .el-table__row > td.el-table__cell .expiry-status--expired) {
color: #ffffff !important;
}
:deep(.el-table__body-wrapper .el-table__row > td.el-tooltip) {
background-color: #ff0000 !important;
border-bottom-color: #ffffff;
}
}
.lower-level {
flex: 0 0 40%;
height: 40%;
flex: 0 0 350px;
background-color: #fff;
border-top: 1px solid #ebeef5;
display: flex;
flex-direction: column;
border-top: 1px solid #ebeef5;
overflow: hidden;
background-color: #fff;
.detail-header {
padding: 0 10px;
border-bottom: 1px solid #ebeef5;
background-color: #fafafa;
.detail-tab {
margin-bottom: -1px;
:deep(.el-tabs__header) { margin: 0; }
:deep(.el-tabs__item) {
height: 32px;
line-height: 32px;
font-size: 13px;
}
:deep(.el-tabs__nav-wrap::after) { height: 1px; }
}
}
.detail-container {
flex: 1;
overflow: auto;
padding: 10px;
}
}
.no-selection {
flex: 0 0 40%;
height: 40%;
flex: 0 0 300px;
display: flex;
align-items: center;
justify-content: center;
background: #fff;
color: #909399;
}
}
}
// 状态文字颜色
.expiry-date-highlight { color: #db1e1e; font-weight: 700; }
.expiry-status--valid { color: #1f7a34; font-weight: 600; }
.expiry-status--expired { color: #db1e1e; font-weight: 700; }
/* UpperTable 溢出提示文字 */
:global(.el-popper.is-dark) {
color: #ffffff !important;
}
/* --- 消息中心弹窗样式深度定制 --- */
:global(.message-dialog-custom .el-dialog__body) {
padding: 0 !important;
}
.message-dialog-layout {
display: flex;
height: 600px;
background-color: #fff;
overflow: hidden;
// 左侧边栏
.message-sidebar {
width: 320px;
border-right: 1px solid #f0f0f0;
display: flex;
flex-direction: column;
background-color: #fafafa;
.sidebar-header {
padding: 16px;
background-color: #fff;
.empty-tip { text-align: center; font-size: 14px; }
border-bottom: 1px solid #f0f0f0;
.header-top {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 12px;
.header-title { font-weight: 600; font-size: 15px; color: #333; }
}
.custom-radio-group {
width: 100%;
display: flex;
:deep(.el-radio-button) {
flex: 1;
.el-radio-button__inner { width: 100%; }
}
}
}
.message-list-scroll {
flex: 1;
overflow-y: auto;
padding: 10px;
.message-card {
padding: 12px;
background: #fff;
border-radius: 8px;
margin-bottom: 10px;
cursor: pointer;
border: 1px solid #e4e7ed;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
position: relative;
&:hover { border-color: #409eff; transform: translateY(-1px); }
&.active {
border-color: #409eff;
background: #ecf5ff;
box-shadow: 0 2px 12px 0 rgba(64,158,255,0.1);
&::before {
content: '';
position: absolute;
left: 0;
top: 0;
bottom: 0;
width: 4px;
background: #409eff;
border-radius: 8px 0 0 8px;
}
}
&.unread .card-title .text { font-weight: 600; color: #000; }
&.unread .dot { background: #ee0f0f; }
.card-title {
display: flex;
align-items: center;
margin-bottom: 8px;
.dot {
width: 6px;
height: 6px;
border-radius: 50%;
background: #dcdfe6;
margin-right: 8px;
}
.text {
font-size: 13px;
color: #606266;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
.card-subtitle {
font-size: 12px;
color: #909399;
margin-bottom: 8px;
}
.card-footer {
display: flex;
justify-content: space-between;
align-items: center;
.time { font-size: 11px; color: #999; }
}
}
}
}
.expiry-date-highlight {
color: #f56c6c;
font-weight: 600;
// 右侧详情区
.message-detail-area {
flex: 1;
padding: 24px;
overflow-y: auto;
background: #fff;
.detail-header {
margin-bottom: 24px;
border-bottom: 1px solid #f0f0f0;
padding-bottom: 16px;
.detail-title-row {
display: flex;
justify-content: space-between;
align-items: flex-start;
margin-bottom: 12px;
h2 { margin: 0; font-size: 20px; color: #303133; }
}
.detail-meta {
display: flex;
gap: 20px;
font-size: 13px;
color: #909399;
.expired { color: #e94444; font-weight: bold; }
.warning { color: #e6a23c; font-weight: bold; }
}
}
.detail-body {
.info-section {
margin-bottom: 24px;
.section-label {
font-weight: 600;
font-size: 14px;
color: #333;
margin-bottom: 12px;
display: flex;
align-items: center;
&::before {
content: '';
width: 3px;
height: 14px;
background: #409eff;
margin-right: 8px;
}
}
.detail-grid {
display: grid;
grid-template-columns: repeat(2, minmax(200px, 1fr));
gap: 10px 14px;
}
.detail-alert {
grid-column: 1 / -1;
display: flex;
align-items: center;
gap: 10px;
min-height: 44px;
padding: 10px 14px;
border-radius: 6px;
border: 1px solid #fbc4c4;
background: linear-gradient(90deg, #fff1f0 0%, #fff8f8 100%);
color: #c45656;
font-size: 14px;
font-weight: 500;
}
.alert-icon {
width: 18px;
height: 18px;
border-radius: 50%;
display: inline-flex;
align-items: center;
justify-content: center;
font-size: 12px;
font-weight: 700;
color: #ffffff;
background: #f56c6c;
flex-shrink: 0;
}
.alert-text {
line-height: 1.5;
}
.alert-highlight {
color: #f56c6c;
font-weight: 700;
text-decoration: underline;
text-underline-offset: 2px;
padding: 0 2px;
}
.detail-item {
display: flex;
align-items: center;
justify-content: space-between;
background: #f8fafc;
border: 1px solid #ebeef5;
border-radius: 6px;
padding: 10px 12px;
min-height: 42px;
}
.detail-label {
color: #909399;
font-size: 13px;
margin-right: 12px;
flex-shrink: 0;
}
.detail-value {
color: #303133;
font-size: 13px;
font-weight: 500;
text-align: right;
word-break: break-all;
}
}
}
.empty-detail {
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
}
}
</style>

View File

@ -0,0 +1,120 @@
/** 有效期页面:ScanBox / UpperTable / 详情面板 集中配置 */
export const availableFields = [
{ label: '商品ID', value: 'stock_id', type: 'text' },
{ label: '库位', value: 'space_id', type: 'text' },
{ label: '货主', value: 'store_id', type: 'select', options: [] as { label: string; value: unknown }[] },
{
label: '库存类型',
value: 'inventory_type',
type: 'select',
options: [
{ label: '正品', value: 'ZP' },
{ label: '次品', value: 'CC' },
{ label: '机损', value: 'JS' },
{ label: '箱损', value: 'XS' },
{ label: '在途', value: 'ZT' },
{ label: '冻结', value: 'DJ' },
{ label: '分配', value: 'FP' }
]
},
{ label: '批次号', value: 'batch_no', type: 'text' },
{ label: '入库单号', value: 'inbound_order_no', type: 'text' },
{ label: '创建日期', value: 'created_at', type: 'daterange' }
]
export const scanBoxConfig = {
width: '320px',
treeProps: { children: 'children', label: 'label' },
autoSubmit: false
}
export const upperTableConfig = {
title: '有效期商品列表'
}
export const validityPeriodColumns = [
{ prop: 'stock_id', label: '商品ID', width: '110' },
{ prop: 'item_code', label: '商品编码', width: '140' },
{ prop: 'item_name', label: '商品名称', minWidth: '180' },
{ prop: 'batch_no', label: '批次号', width: '160' },
{ prop: 'stock_unit', label: '单位', width: '80' },
{ prop: 'quantity', label: '库存数量', width: '100', sortable: true },
{ prop: 'remaining_days', label: '剩余天数', width: '100', sortable: true },
{ prop: 'threshold_days', label: '阈值天数', width: '100', sortable: true },
{ prop: 'expiry_date', label: '到期日期', width: '170', sortable: true },
{ prop: 'production_date', label: '生产日期', width: '170', sortable: true },
{ prop: 'space_code', label: '库位', minWidth: '140' },
{ prop: 'is_expired_text', label: '过期状态', width: '100' }
]
/** 列表「过期状态」展示文案与样式类(有效绿色 / 已过期红色) */
export const expiryStatusListClass = {
valid: 'expiry-status--valid',
expired: 'expiry-status--expired'
} as const
export const expiryStatusText = {
valid: '临期',
expired: '已过期'
} as const
/** 详情区 warning_status 与 el-tag 映射 */
export const expiryWarningStatus = {
expired: 'expired',
normal: 'normal'
} as const
export function getExpiryDetailStatusLabel(status: string) {
if (status === expiryWarningStatus.expired) return expiryStatusText.expired
return '临期'
}
export function getExpiryDetailStatusTagType(status: string) {
if (status === expiryWarningStatus.expired) return 'danger'
return 'success'
}
export type ExpiryQueryInfoItem =
| { label: string; field: string; kind?: 'text' }
| { label: string; kind: 'expiry_tag'; expiredField: string }
export const expiryQueryInfoItems: ExpiryQueryInfoItem[] = [
{ label: '商品编码', field: 'item_code' },
{ label: '商品名称', field: 'item_name' },
{ label: '库位', field: 'space_code' },
{ label: '库存类型', field: 'inventory_type' },
{ label: '阈值天数', field: 'threshold_days' },
{ label: '剩余天数', field: 'remaining_days' },
{ label: '状态', kind: 'expiry_tag', expiredField: 'is_expired' },
{ label: '到期日期', field: 'expiry_date' }
]
export type ExpiryQueryTableColumn =
| {
prop: string
label: string
width?: number
minWidth?: number
showOverflowTooltip?: boolean
slot?: never
}
| {
prop: string
label: string
width?: number
minWidth?: number
showOverflowTooltip?: boolean
slot: 'expiry' | 'status'
}
export const expiryQueryTableColumns: ExpiryQueryTableColumn[] = [
{ prop: 'stock_id', label: '商品ID', width: 120 },
{ prop: 'item_name', label: '商品名称', minWidth: 200, showOverflowTooltip: true },
{ prop: 'batch_no', label: '批次号', width: 160 },
{ prop: 'production_date', label: '生产日期', width: 120 },
{ prop: 'expiry_date', label: '有效期至', width: 120, slot: 'expiry' },
{ prop: 'remaining_days', label: '剩余天数', width: 100 },
{ prop: 'quantity', label: '库存数量', width: 100 },
{ prop: 'warning_status', label: '状态', width: 100, slot: 'status' }
]

View File

@ -1,68 +1,92 @@
storage.expiry.list
库存有效期列表查询(效期预警),按 wms_storage 查询并计算剩余天数与过期状态,支持 where 条件与分页。注意:无需传 warehouse_id/store_id,服务端会从当前登录用户取仓库上下文。
order.reviewOrder.getreviewOrderlist
分页查询订单审核列表(目录化路由)
Params (2)
名称 类型 必填 说明
where object 否 统一 where 条件对象;支持字段:item_code、goods_code、item_name、sku_property、stock_unit、is_shelf_life_mgmt、remaining_threshold_days。示例:where.item_code={operator:like,value:ABC}; where.remaining_threshold_days={operator:lte,value:7}。注意:无需传入 store_id 或 warehouse_id,服务端会从当前登录用户获取仓库上下文。
pagination object 否 分页参数 { page, pageSize },默认 page=1, pageSize=20
Response (3)
名称 类型 必填 说明
data.list array 是 匹配到的库存效期项数组
data.list[] object 否 列表项,包含至少以下字段
data.pagination object 是 分页信息,含 page、pageSize、total、totalPages
pagination object 否 pagination 参数
where object 否 统一 where 条件对象;推荐使用 { operator, value, type } 标准结构;支持 inspection_status、step、operator_name、operate_time_start、operate_time_end 等字段。示例:where.step={operator:in,value:[0,1]}; where.inspection_status={operator:eq,value:pending}; where.operator_name={operator:like,value:张}; where.operate_time_start={value:2026-03-01}。
接口响应:
{
"flag": "success",
"code": 200,
"message": "查询成功",
"code": 1,
"message": "ok",
"data": {
"list": [
{
"id": 142,
"warehouse_id": 100000,
"store_id": 1000000,
"space_id": 1,
"stock_id": 157059,
"batch_no": "R20554119",
"inventory_type": "ZP",
"quantity": 10,
"locked_quantity": 0,
"available_quantity": 10,
"production_date": "2024-01-01 08:00:00",
"expiry_date": "2026-04-12 08:00:00",
"inbound_time": "2026-04-12 00:01:11",
"inbound_order_no": "TEST-ENTRY-1775923270905",
"receiving_id": 666,
"entry_order_id": 189,
"supplier_id": null,
"supplier_batch_no": null,
"is_enabled": 1,
"created_at": "2026-04-12 00:01:11",
"updated_at": "2026-04-13 17:11:15",
"id": 2,
"delivery_order_code": "JY2026041416334",
"pre_delivery_order_code": "",
"pre_delivery_order_id": "",
"order_type": "JYCK",
"warehouse_code": "100000",
"order_flag": "",
"source_platform_code": "TB",
"source_platform_name": "淘宝",
"create_at": "2026-04-14T07:37:11.000Z",
"delete_at": null,
"stock": {
"id": 157059,
"item_code": "yjm20260411",
"goods_code": null,
"item_name": "yjm0411",
"sku_property": "",
"stock_unit": "个",
"store_id": 1000000,
"warehouse_id": 100000,
"is_shelf_life_mgmt": "Y",
"remaining_threshold_days": 547
},
"space": {
"id": 1,
"space_code": "AREA-01-01-01",
"custom_name": "默认收货区"
},
"threshold_days": 547,
"remaining_days": 0,
"is_expired": true
"updated_at": "2026-04-14T07:37:11.000Z",
"place_order_time": "2026-04-14T07:34:40.000Z",
"pay_time": "2026-04-14T07:34:40.000Z",
"pay_no": "",
"service_code": null,
"operator_name": "1",
"operate_time": "2026-04-14T07:37:11.000Z",
"delivery_time": null,
"shop_nick": "加能量袜子店",
"seller_nick": "1",
"buyer_nick": "学习18022440198",
"total_amount": "150.00",
"item_amount": "150.00",
"discount_amount": "0.00",
"freight": "0.00",
"ar_amount": "0.00",
"got_amount": "0.00",
"service_fee": null,
"logistics_code": "ZTO",
"logistics_name": "中通快递",
"express_code": "",
"logistics_area_code": "",
"delivery_type": null,
"is_urgency": "N",
"invoice_flag": "N",
"status": "pedding",
"name": "学习",
"zip_code": "",
"tel": "",
"mobile": "18022440198",
"email": "",
"country_code": "CN",
"province": "广东省",
"city": "广州市",
"area": "白云区",
"town": "江高镇",
"detail_address": "广东省 广州市 白云区 江高镇 测试地址",
"id_type": null,
"id_number": null,
"oaid": null,
"sync_status": "padding",
"store_id": 1000000,
"warehouse_id": 100000,
"from_key": 24869601,
"items": "101384+5",
"items_count": 1,
"items_total": 5,
"items_weight": "0.00",
"items_hash": "9e26ada8b89136b8850576a5356026b2",
"items_crc": 2613025742,
"wave_id": 0,
"post_status": "none",
"storage_status": "none",
"pick_status": "none",
"pack_status": "none",
"inspection_status": "none",
"step": 0,
"print_status": null,
"claim_status": "none",
"outbound_status": "none",
"lock_status": null,
"intercept_status": null
}
],
"pagination": {
@ -74,353 +98,263 @@ data.pagination object 是 分页信息,含 page、pageSize、total、totalPag
"hasNext": false
}
},
"timestamp": 1776083463
"timestamp": 1776152560
}
-----
storage.inventory.list
库存列表查询(查 wms_storage),支持 where 条件、分页、排序、批次分组。默认按库位+商品合并数量(合并模式),group_by_batch=true 时返回每条库存明细(明细模式)
order.reviewOrder.reviewOrder
订单审核(目录化路由)。执行后会更新 inspection_status,并同步更新订单整数字段 step。
Params (4)
Params (6)
名称 类型 必填 说明
where object 否 统一 where 条件对象,可用字段:stock_id(商品ID)、space_id(库位ID)、store_id(货主ID)、inventory_type(ZP/CC/JS/XS/ZT/DJ/FP)、batch_no(批次号)、inbound_order_no(入库单号)、available_quantity(可用数量,支持 gt/lt)、inbound_time(入库时间,支持 between)、created_at(创建时间,支持 between)
pagination object 否 分页参数 { page, pageSize },默认 page=1, pageSize=20
sort object 否 排序参数 { sortField, sortOrder },默认 sortField='created_at', sortOrder='DESC'
group_by_batch boolean 否 是否按批次查询,默认 false。false=合并模式(按库位+商品聚合quantity/locked_quantity/available_quantity),true=明细模式(逐条返回含 batch_no/production_date/expiry_date 等)
delivery_order_code string 否 delivery_order_code 参数
id number 否 id 参数
inspection_status string 否 inspection_status 参数(兼容入参)
review_status string 否 review_status 参数,默认 fin
operator_name string 否 operator_name 参数
operate_time string 否 operate_time 参数
无参数接口响应:
{
"flag": "success",
"code": 1,
"message": "ok",
"list": [
{
"stock_id": 101391,
"space_id": 1,
"inventory_type": "ZP",
"warehouse_id": 100000,
"store_id": 1000000,
"production_date": "",
"expiry_date": "",
"quantity": "200",
"locked_quantity": "0",
"available_quantity": "200",
"first_inbound_time": "2026-04-12 22:04:49",
"last_inbound_time": "2026-04-12 22:04:49",
"batch_count": 1,
"stock": {
"id": 101391,
"item_code": "023802",
"item_name": "空包",
"sku_property": "",
"stock_unit": "个",
"is_shelf_life_mgmt": "Y",
"remaining_threshold_days": null
},
"space": {
"id": 1,
"space_code": "AREA-01-01-01",
"custom_name": "默认收货区"
},
"is_shelf_life_warning_triggered": false
},
{
"stock_id": 157059,
"space_id": 1,
"inventory_type": "ZP",
"warehouse_id": 100000,
"store_id": 1000000,
"production_date": "2024-01-01 08:00:00",
"expiry_date": "2026-04-12 08:00:00",
"quantity": "34",
"locked_quantity": "0",
"available_quantity": "34",
"first_inbound_time": "2026-04-12 00:01:11",
"last_inbound_time": "2026-04-12 17:56:28",
"batch_count": 6,
"stock": {
"id": 157059,
"item_code": "yjm20260411",
"item_name": "yjm0411",
"sku_property": "",
"stock_unit": "个",
"is_shelf_life_mgmt": "Y",
"remaining_threshold_days": 547
},
"space": {
"id": 1,
"space_code": "AREA-01-01-01",
"custom_name": "默认收货区"
},
"is_shelf_life_warning_triggered": true
},
{
"stock_id": 157008,
"space_id": 1,
"inventory_type": "ZP",
"warehouse_id": 100000,
"store_id": 1000000,
"production_date": "",
"expiry_date": "",
"quantity": "367",
"locked_quantity": "0",
"available_quantity": "367",
"first_inbound_time": "2026-04-08 16:45:25",
"last_inbound_time": "2026-04-12 00:01:20",
"batch_count": 46,
"stock": {
"id": 157008,
"item_code": "6902226191553",
"item_name": "测试加货主商品1",
"sku_property": "",
"stock_unit": "件",
"is_shelf_life_mgmt": "N",
"remaining_threshold_days": null
},
"space": {
"id": 1,
"space_code": "AREA-01-01-01",
"custom_name": "默认收货区"
},
"is_shelf_life_warning_triggered": false
},
{
"stock_id": 156968,
"space_id": 1,
"inventory_type": "ZP",
"warehouse_id": 100000,
"store_id": 1000000,
"production_date": "",
"expiry_date": "",
"quantity": "316",
"locked_quantity": "0",
"available_quantity": "316",
"first_inbound_time": "2026-04-08 00:39:08",
"last_inbound_time": "2026-04-11 16:32:02",
"batch_count": 56,
"stock": {
"id": 156968,
"item_code": "6902226191552",
"item_name": "新商品",
"sku_property": "",
"stock_unit": "个",
"is_shelf_life_mgmt": "N",
"remaining_threshold_days": null
},
"space": {
"id": 1,
"space_code": "AREA-01-01-01",
"custom_name": "默认收货区"
},
"is_shelf_life_warning_triggered": false
},
{
"stock_id": 101841,
"space_id": 1,
"inventory_type": "ZP",
"warehouse_id": 100000,
"store_id": 1000000,
"production_date": "",
"expiry_date": "",
"quantity": "67",
"locked_quantity": "0",
"available_quantity": "67",
"first_inbound_time": "2026-04-08 00:39:08",
"last_inbound_time": "2026-04-08 11:23:27",
"batch_count": 15,
"stock": {
"id": 101841,
"item_code": "纸箱24121410-1",
"item_name": "纸箱24121410yc#zy-消退",
"sku_property": "",
"stock_unit": "盒",
"is_shelf_life_mgmt": "N",
"remaining_threshold_days": null
},
"space": {
"id": 1,
"space_code": "AREA-01-01-01",
"custom_name": "默认收货区"
},
"is_shelf_life_warning_triggered": false
}
],
"pagination": {
"page": 1,
"pageSize": 20,
"total": 5,
"totalPages": 1
},
"timestamp": 1776083855
}
-----
order.deliveryOrder.getdeliveryOrderlist
分页查询已进入出库流程的订单列表
--
请求参数:
{
"group_by_batch":"true"
}
Params (2)
名称 类型 必填 说明
pagination object 否 pagination 参数
where object 否 统一 where 条件对象;推荐使用 { operator, value, type } 标准结构;未传 outbound_status 时默认过滤 outbound_status != none;支持 step 筛选。示例:where.outbound_status={operator:in,value:[created,processing]}; where.step={operator:in,value:[4,5]}; where.store_id={operator:eq,value:1001}。
接口响应:{
"flag": "success",
"code": 1,
"message": "ok",
"list": [
{
"stock_id": 101391,
"space_id": 1,
"inventory_type": "ZP",
"warehouse_id": 100000,
"store_id": 1000000,
"production_date": "",
"expiry_date": "",
"quantity": "200",
"locked_quantity": "0",
"available_quantity": "200",
"first_inbound_time": "2026-04-12 22:04:49",
"last_inbound_time": "2026-04-12 22:04:49",
"batch_count": 1,
"stock": {
"id": 101391,
"item_code": "023802",
"item_name": "空包",
"sku_property": "",
"stock_unit": "个",
"is_shelf_life_mgmt": "Y",
"remaining_threshold_days": null
},
"space": {
"data": {
"list": [
{
"id": 1,
"space_code": "AREA-01-01-01",
"custom_name": "默认收货区"
},
"is_shelf_life_warning_triggered": false
},
{
"stock_id": 157059,
"space_id": 1,
"inventory_type": "ZP",
"warehouse_id": 100000,
"store_id": 1000000,
"production_date": "2024-01-01 08:00:00",
"expiry_date": "2026-04-12 08:00:00",
"quantity": "34",
"locked_quantity": "0",
"available_quantity": "34",
"first_inbound_time": "2026-04-12 00:01:11",
"last_inbound_time": "2026-04-12 17:56:28",
"batch_count": 6,
"stock": {
"id": 157059,
"item_code": "yjm20260411",
"item_name": "yjm0411",
"sku_property": "",
"stock_unit": "个",
"is_shelf_life_mgmt": "Y",
"remaining_threshold_days": 547
},
"space": {
"id": 1,
"space_code": "AREA-01-01-01",
"custom_name": "默认收货区"
},
"is_shelf_life_warning_triggered": true
},
{
"stock_id": 157008,
"space_id": 1,
"inventory_type": "ZP",
"warehouse_id": 100000,
"store_id": 1000000,
"production_date": "",
"expiry_date": "",
"quantity": "367",
"locked_quantity": "0",
"available_quantity": "367",
"first_inbound_time": "2026-04-08 16:45:25",
"last_inbound_time": "2026-04-12 00:01:20",
"batch_count": 46,
"stock": {
"id": 157008,
"item_code": "6902226191553",
"item_name": "测试加货主商品1",
"sku_property": "",
"stock_unit": "件",
"is_shelf_life_mgmt": "N",
"remaining_threshold_days": null
},
"space": {
"id": 1,
"space_code": "AREA-01-01-01",
"custom_name": "默认收货区"
},
"is_shelf_life_warning_triggered": false
},
{
"stock_id": 156968,
"space_id": 1,
"inventory_type": "ZP",
"warehouse_id": 100000,
"store_id": 1000000,
"production_date": "",
"expiry_date": "",
"quantity": "316",
"locked_quantity": "0",
"available_quantity": "316",
"first_inbound_time": "2026-04-08 00:39:08",
"last_inbound_time": "2026-04-11 16:32:02",
"batch_count": 56,
"stock": {
"id": 156968,
"item_code": "6902226191552",
"item_name": "新商品",
"sku_property": "",
"stock_unit": "个",
"is_shelf_life_mgmt": "N",
"remaining_threshold_days": null
},
"space": {
"id": 1,
"space_code": "AREA-01-01-01",
"custom_name": "默认收货区"
},
"is_shelf_life_warning_triggered": false
},
{
"stock_id": 101841,
"space_id": 1,
"inventory_type": "ZP",
"warehouse_id": 100000,
"store_id": 1000000,
"production_date": "",
"expiry_date": "",
"quantity": "67",
"locked_quantity": "0",
"available_quantity": "67",
"first_inbound_time": "2026-04-08 00:39:08",
"last_inbound_time": "2026-04-08 11:23:27",
"batch_count": 15,
"stock": {
"id": 101841,
"item_code": "纸箱24121410-1",
"item_name": "纸箱24121410yc#zy-消退",
"sku_property": "",
"stock_unit": "盒",
"is_shelf_life_mgmt": "N",
"remaining_threshold_days": null
},
"space": {
"id": 1,
"space_code": "AREA-01-01-01",
"custom_name": "默认收货区"
},
"is_shelf_life_warning_triggered": false
"delivery_order_code": "TRACE_OUTBOUND_1776007027818_0E2C252D",
"pre_delivery_order_code": "",
"pre_delivery_order_id": "",
"order_type": "JYCK",
"warehouse_code": "100000",
"order_flag": "",
"source_platform_code": "TB",
"source_platform_name": "淘宝",
"create_at": "2026-04-12T15:17:15.000Z",
"delete_at": null,
"updated_at": "2026-04-12T15:17:16.000Z",
"place_order_time": null,
"pay_time": null,
"pay_no": "",
"service_code": null,
"operator_name": null,
"operate_time": null,
"delivery_time": "2026-04-12T15:17:16.000Z",
"shop_nick": null,
"seller_nick": null,
"buyer_nick": null,
"total_amount": "0.00",
"item_amount": "0.00",
"discount_amount": "0.00",
"freight": "0.00",
"ar_amount": "0.00",
"got_amount": "0.00",
"service_fee": null,
"logistics_code": null,
"logistics_name": null,
"express_code": "",
"logistics_area_code": "",
"delivery_type": null,
"is_urgency": "N",
"invoice_flag": "N",
"status": "pedding",
"name": "自动化验证收件人",
"zip_code": "510000",
"tel": "",
"mobile": "13800138000",
"email": "",
"country_code": "",
"province": "广东省",
"city": "广州市",
"area": "黄埔区",
"town": "知识城街道",
"detail_address": "自动化验证地址 TRACE_OUTBOUND_1776007027818_0E2C252D",
"id_type": null,
"id_number": null,
"oaid": null,
"sync_status": "padding",
"store_id": 1000000,
"warehouse_id": 100000,
"from_key": 24869601,
"items": "101391+1",
"items_count": 1,
"items_total": 1,
"items_weight": "0.00",
"items_hash": "c160b2ea32b53aba930f55e3a306de01",
"items_crc": 581302873,
"wave_id": 0,
"post_status": "none",
"storage_status": "none",
"pick_status": "none",
"pack_status": "none",
"inspection_status": "none",
"step": 4,
"print_status": null,
"claim_status": "none",
"outbound_status": "fin",
"lock_status": null,
"intercept_status": null,
"dispatch_lane": "m4"
}
],
"pagination": {
"page": 1,
"pageSize": 20,
"total": 1,
"totalPages": 1,
"hasPrevious": false,
"hasNext": false
}
],
"pagination": {
"page": 1,
"pageSize": 20,
"total": 5,
"totalPages": 1
},
"timestamp": 1776084545
"timestamp": 1776154762
}
----------
order.pendingOrder.getpendingOrderlist
分页查询待处理订单列表
Params (2)
名称 类型 必填 说明
pagination object 否 pagination 参数
where object 否 统一 where 条件对象;推荐使用 { operator, value, type } 标准结构;未传时默认 status in [pedding, created] 且 outbound_status = none。示例:where.status={operator:in,value:[pedding,created]}; where.outbound_status={operator:eq,value:none}。
接口响应:
{
"flag": "success",
"code": 1,
"message": "ok",
"data": {
"list": [
{
"id": 1,
"delivery_order_code": "JY202604142929",
"pre_delivery_order_code": "",
"pre_delivery_order_id": "",
"order_type": "JYCK",
"warehouse_code": "100000",
"order_flag": "",
"source_platform_code": "TB",
"source_platform_name": "淘宝",
"create_at": "2026-04-14T06:53:07.000Z",
"delete_at": null,
"updated_at": "2026-04-14T06:53:07.000Z",
"place_order_time": "2026-04-13T23:09:39.000Z",
"pay_time": "2026-04-13T23:09:39.000Z",
"pay_no": "",
"service_code": null,
"operator_name": "1",
"operate_time": "2026-04-14T06:53:07.000Z",
"delivery_time": null,
"shop_nick": "加能量袜子店",
"seller_nick": "1",
"buyer_nick": "张三",
"total_amount": "600.00",
"item_amount": "600.00",
"discount_amount": "0.00",
"freight": "0.00",
"ar_amount": "0.00",
"got_amount": "0.00",
"service_fee": null,
"logistics_code": "ZTO",
"logistics_name": "中通快递",
"express_code": "",
"logistics_area_code": "",
"delivery_type": null,
"is_urgency": "N",
"invoice_flag": "N",
"status": "pedding",
"name": "张三",
"zip_code": "",
"tel": "",
"mobile": "18022440198",
"email": "",
"country_code": "CN",
"province": "广东省",
"city": "广州市",
"area": "白云区",
"town": "人和镇",
"detail_address": "广东省 广州市 白云区 人和镇 测试地址",
"id_type": null,
"id_number": null,
"oaid": null,
"sync_status": "padding",
"store_id": 1000000,
"warehouse_id": 100000,
"from_key": 24869601,
"items": "101384+20",
"items_count": 1,
"items_total": 20,
"items_weight": "0.00",
"items_hash": "23ef3c5bc7ab12dc9bd25877afded196",
"items_crc": 3353156042,
"wave_id": 0,
"post_status": "none",
"storage_status": "none",
"pick_status": "none",
"pack_status": "none",
"inspection_status": "none",
"step": 1,
"print_status": null,
"claim_status": "none",
"outbound_status": "none",
"lock_status": null,
"intercept_status": null
}
],
"pagination": {
"page": 1,
"pageSize": 20,
"total": 1,
"totalPages": 1,
"hasPrevious": false,
"hasNext": false
}
},
"timestamp": 1776154872
}
order.expectionOrder.getexpectionOrderlist
分页查询异常订单列表
Params (2)
名称 类型 必填 说明
pagination object 否 pagination 参数
where object 否 统一 where 条件对象;推荐使用 { operator, value, type } 标准结构;未传时默认筛选各流程 error 或拦截 exception。示例:where.status={operator:eq,value:error}; where.outbound_status={operator:eq,value:exception}。
接口响应:{
"flag": "success",
"code": 1,
"message": "ok",
"data": {
"list": [],
"pagination": {
"page": 1,
"pageSize": 20,
"total": 0,
"totalPages": 0,
"hasPrevious": false,
"hasNext": false
}
},
"timestamp": 1776154895
}
-----
order.archiveOrder.getarchiveOrderlist
分页查询归档订单列表(暂使用当前订单表完成态数据)
Params (2)
名称 类型 必填 说明
pagination object 否 pagination 参数
where object 否 统一 where 条件对象;推荐使用 { operator, value, type } 标准结构;未传 outbound_status 时默认过滤 outbound_status = fin。示例:where.outbound_status={operator:eq,value:fin}; where.store_id={operator:eq,value:1001}。

View File

@ -0,0 +1,22 @@
# API Doc Sync Workflow
该目录集中管理接口文档变更抓取相关的脚本、配置和数据,避免与业务 `src` 代码混放。
## 目录说明
- `config.mjs`:工作流配置(抓取地址、文件路径、历史保留数量)。
- `update.mjs`:抓取并更新接口变更的主流程脚本。
- `data/changes.json`:本地最新接口更新日志(全量)。
- `data/pending-updates.json`:待更新接口清单(仅 `summary`、`methods`、`notes`)。
- `data/history/`:历史快照,自动保留最近 5 份。
## 运行
```bash
npm run update
```
## 扩展建议
- 新增工作流功能时,优先在 `workflows/api-doc-sync` 内按模块拆分文件。
- 如果增加新的数据产物,统一放在 `data/` 内并在此文档补充说明。

View File

@ -0,0 +1,18 @@
import path from "node:path";
const WORKFLOW_ROOT = path.join("workflows", "api-doc-sync");
const DATA_DIR = path.join(WORKFLOW_ROOT, "data");
export const API_DOC_SYNC_CONFIG = {
changesUrl: "http://192.168.11.56:6060/api/docs/system/changes",
historyMaxFiles: 5,
file: {
localChanges: path.join(DATA_DIR, "changes.json"),
pendingChanges: path.join(DATA_DIR, "pending-updates.json"),
historyDir: path.join(DATA_DIR, "history"),
},
history: {
prefix: "changes-",
suffix: ".json",
},
};

View File

@ -1,11 +1,33 @@
[
{
"version": "2026.04.14-system-01",
"date": "2026-04-14",
"summary": "库存列表新增货主名称字段 stock.store_name",
"methods": ["storage.inventory.list"],
"notes": [
"在 methods/system.json 的 storage.inventory.list response 中补充 stock.store_name:来源于签约表 store_remask,若无签约关系则为 null。",
"只同步文档,不修改业务代码。"
],
"type": "updated"
},
{
"version": "2026.04.13-system-01",
"date": "2026-04-13",
"summary": "补全 storage.receiving.detailChange 的入参/出参契约与错误码说明",
"methods": ["storage.receiving.detailChange"],
"notes": [
"在 methods/system.json 中补充 storage.receiving.detailChange 的 params/response/errors,明确 id 与 receiving_id 必填。",
"说明 expiry_date 小于当前日期时返回 400 且 message 为 \"到期日期已过期,不能录入收货\"。",
"说明当传入 system_product_id 时会回填条码、重量、箱规、商品名称与 product_snapshot;未传时 barcode/product_name 也可单独更新。",
"同步补充文档:docs/storage-receiving-api.md 中新增 detailChange 段落。"
],
"type": "updated"
},
{
"version": "2026.04.07-system-01",
"date": "2026-04-07",
"summary": "修正 warehouse.getAreaRacks 的鉴权/权限链路文档,明确该接口需要 登录并走权限校验。",
"methods": [
"warehouse.getAreaRacks"
],
"methods": ["warehouse.getAreaRacks"],
"notes": [
"对齐当前 system 文档中的 isNeedAuth=true、isNeedLogin=true。",
"用于补充该接口权限链路修正文档的历史上下文,不改变 methods/system.json 的 SSOT 角色。"
@ -58,9 +80,7 @@
"version": "2026.04.07-system-05",
"date": "2026-04-07",
"summary": "修正 storeWarehouse.store.adjustPrintQuantity 的面单余额调整语义:由增减/累加改为覆盖设置目标余额。",
"methods": [
"storeWarehouse.store.adjustPrintQuantity"
],
"methods": ["storeWarehouse.store.adjustPrintQuantity"],
"notes": [
"adjustPrintQuantity 当前兼容 print_quantity、target_quantity、change_quantity、adjust_quantity 作为目标面单余额输入,不再按增减量解释。",
"变更日志中的 change_quantity 由 before/after 自动计算差值,以兼容历史审计与展示。"
@ -70,9 +90,7 @@
"version": "2026.04.07-system-06",
"date": "2026-04-07",
"summary": "按接口类型分类限制必填字段,OPEN_API 创建时自动生成 self_app_key/self_app_secret",
"methods": [
"storeWarehouse.store.saveApiConfig"
],
"methods": ["storeWarehouse.store.saveApiConfig"],
"notes": [
"QM_WMS 类型须填写 qimen_app_key/qimen_customer_id/qimen_warehouse_code;OPEN_API 类型三个奇门字段非必填,创建时自动生成 self_app_key(WMS+32位HEX)和 self_app_secret(64位HEX),更新时保留已有密钥。"
],
@ -82,9 +100,7 @@
"version": "2026.04.07-system-07",
"date": "2026-04-07",
"summary": "新增接口类型列表查询接口,归属基础模块,无需权限",
"methods": [
"index.listInterfaceTypes"
],
"methods": ["index.listInterfaceTypes"],
"notes": [
"返回所有已启用的接口类型(wms_interface_type),包含 id、interface_code、interface_name、interface_category、description 字段。设置 isNeedAuth: false, isNeedLogin: true。"
],
@ -94,9 +110,7 @@
"version": "2026.04.07-system-08",
"date": "2026-04-07",
"summary": "app_name 改为必传参数",
"methods": [
"storeWarehouse.store.saveApiConfig"
],
"methods": ["storeWarehouse.store.saveApiConfig"],
"notes": [
"app_name 不再有默认值自动生成逻辑,调用方必须传入非空的 app_name,否则返 回 400 错误。"
],
@ -106,9 +120,7 @@
"version": "2026.04.07-system-09",
"date": "2026-04-07",
"summary": "新增收货单快捷入库上架接口",
"methods": [
"storage.inventory.quickPutaway"
],
"methods": ["storage.inventory.quickPutaway"],
"notes": [
"新建 storage.inventory 库存操作模块。quickPutaway 从收货单直接生成入库单 (SCRK)并写入 wms_storage 库存表,同时更新 wms_stock_warehouse 库存数量(悲观行锁),回填收货明细入库状态。要求收货单已完成且所有明细已匹配系统商品。"
],
@ -118,9 +130,7 @@
"version": "2026.04.08-system-01",
"date": "2026-04-08",
"summary": "新增收货单与入库单匹配入库接口",
"methods": [
"storage.inventory.matchPutaway"
],
"methods": ["storage.inventory.matchPutaway"],
"notes": [
"接收多个收货单和入库单,按商品(stock_warehouse_id)进行数量匹配入库,完 成后根据入库单来源(QM/API)自动触发回传。入参为 receiving_ids(数组)和 entry_order_ids(数组),返回匹配汇总、各收货单入库状态、各入库单状态及回传结果。isNeedAuth=true, isNeedLogin=true, isNeedRight=false。"
],
@ -130,9 +140,7 @@
"version": "2026.04.08-system-02",
"date": "2026-04-08",
"summary": "saveApiConfig 新增 callback_url 可选参数",
"methods": [
"storeWarehouse.store.saveApiConfig"
],
"methods": ["storeWarehouse.store.saveApiConfig"],
"notes": [
"新增 callback_url 参数(VARCHAR(500),可选),用于 OPEN_API 类型入库单的 回调地址配置。"
],
@ -142,10 +150,7 @@
"version": "2026.04.08-system-03",
"date": "2026-04-08",
"summary": "serializeQimenConfig 新增返回 callback_url 字段,影响 list 和 listApiConfig 两个接口",
"methods": [
"storeWarehouse.store.list",
"storeWarehouse.store.listApiConfig"
],
"methods": ["storeWarehouse.store.list", "storeWarehouse.store.listApiConfig"],
"notes": [
"serializeQimenConfig() 序列化方法新增 callback_url(string)字段。storeWarehouse.store.list 返回的每条记录 api_config 对象中包含 callback_url;storeWarehouse.store.listApiConfig 返回的 list 数组中每条配置包含 callback_url。"
],
@ -155,9 +160,7 @@
"version": "2026.04.08-system-04",
"date": "2026-04-08",
"summary": "新增库存移库(库位转移)接口",
"methods": [
"storage.inventory.transferLocation"
],
"methods": ["storage.inventory.transferLocation"],
"notes": [
"新增 storage.inventory.transferLocation 接口,支持批量多商品多库位移库, 包含部分数量移库与全量移库。入参为 warehouse_id(仓库ID)和 transfers 数组(storage_id、target_space_id、quantity),触发 storage_transfer_completed 通知事件, 每条移库记录独立操作日志。isNeedAuth=true, isNeedLogin=true。"
],
@ -167,9 +170,7 @@
"version": "2026.04.08-system-05",
"date": "2026-04-08",
"summary": "简化移库接口入参,从批量 transfers 数组改为单条移库",
"methods": [
"storage.inventory.transferLocation"
],
"methods": ["storage.inventory.transferLocation"],
"notes": [
"移除 warehouse_id 和 transfers 数组入参,改为扁平的 storage_id + target_space_id + quantity 三个顶层参数。warehouse_id 从库存记录自动获取,接口从批量移库简化为单商品单库位移库。响应结构同步简化为单条结果对象。"
],
@ -179,9 +180,7 @@
"version": "2026.04.08-system-06",
"date": "2026-04-08",
"summary": "新增商品库存明细查询接口",
"methods": [
"stock.warehouse.getStockDetail"
],
"methods": ["stock.warehouse.getStockDetail"],
"notes": [
"新增 stock.warehouse.getStockDetail 接口,按库位/批次维度查询商品库存分布。入参为 stock_id(必填,商品库存ID)和 pagination(可选,含 page/pageSize)。返回 stockItem(商品概要)、storageList(wms_storage 明细数组,含批次号、库位、数 量、锁定数量、生产日期、过期日期等,关联 location_space 库位信息)、pagination 分页信息。isNeedAuth=false, isNeedLogin=true。底层调用 stockStore.getStockDetail,自动校验商品归属当前仓库。"
],
@ -191,9 +190,7 @@
"version": "2026.04.08-system-07",
"date": "2026-04-08",
"summary": "新增入参 group_by_batch,支持按批次维度切换库存明细聚合方式",
"methods": [
"stock.warehouse.getStockDetail"
],
"methods": ["stock.warehouse.getStockDetail"],
"notes": [
"新增可选布尔参数 group_by_batch(默认 false)。false 时按库位合并数量,批次相关字段(batch_no, production_date, expiry_date, inbound_time, inbound_order_no, supplier_batch_no)置 null;true 时保持原逻辑返回每条明细。出参结构不变,但 storageList 中批次字段在合并模式下为 null。"
],
@ -203,9 +200,7 @@
"version": "2026.04.08-system-08",
"date": "2026-04-08",
"summary": "新增按商品维度移库接口",
"methods": [
"storage.inventory.transferByProduct"
],
"methods": ["storage.inventory.transferByProduct"],
"notes": [
"新增 storage.inventory.transferByProduct 接口,按库位+商品查找所有库存记 录合并移动。入参为 space_id(原库位ID)、stock_id(商品SKU ID,即 wms_stock_warehouse.id)、target_space_id(目标库位ID)、quantity(移库数量)。开启批次管理(is_batch_mgmt=Y)的商品会被拒绝,需使用 transferLocation 按库存记录精确移库。复用 storage_transfer_completed 通知事件,操作日志编码 STORAGE_TRANSFER_BY_PRODUCT。isNeedAuth=true, isNeedLogin=true。"
],
@ -215,9 +210,7 @@
"version": "2026.04.08-system-09",
"date": "2026-04-08",
"summary": "补充 storeWarehouse.store.list 完整 response 输出字段说明,移除 api_config / apiConfig",
"methods": [
"storeWarehouse.store.list"
],
"methods": ["storeWarehouse.store.list"],
"notes": [
"从返回结果中移除 api_config 和 apiConfig 字段(代码中 delete serialized.api_config / delete serialized.apiConfig),文档 response 补充完整输出字段列表:id, store_id, store_name, warehouse_id, warehouse_name, counterparty_id, counterparty_name, current_subject_role, auth_status, auth_status_label, apply_reason, review_comment, apply_time, review_time, auth_start, auth_end, actual_end, print_quantity, applied_by, reviewed_by, ended_by, remask, use_status, policy_config, is_auth_valid, remaining_days 以及分页和 current_subject 信息。"
],
@ -227,9 +220,7 @@
"version": "2026.04.08-system-10",
"date": "2026-04-08",
"summary": "货主列表返回新增 has_qimen_config 布尔字段",
"methods": [
"storeWarehouse.store.list"
],
"methods": ["storeWarehouse.store.list"],
"notes": [
"storeWarehouse.store.list 返回的 data.list[] 中新增 has_qimen_config(boolean),表示该货主是否已配置奇门。"
],
@ -239,9 +230,7 @@
"version": "2026.04.08-system-11",
"date": "2026-04-08",
"summary": "补全 stock.warehouse.search 接口文档,新增 params / response / errors 完整说明",
"methods": [
"stock.warehouse.search"
],
"methods": ["stock.warehouse.search"],
"notes": [
"入参补充 keyword(string,模糊匹配 item_code / item_name / goods_code / barcode)和 store_id(number,按货主筛选)。响应补充 data 数组各字段(id, item_code, goods_code, item_name, sku_property, stock_unit, quantity, locked_quantity, brand_name, item_type, barcodes, store_stock)以及 total。errors 补充 code=0 搜 索失败场景。"
],
@ -251,9 +240,7 @@
"version": "2026.04.08-system-12",
"date": "2026-04-08",
"summary": "新增 with_stock / is_batch 参数,支持返回关联库存明细(按库位分 组或按批次逐条)",
"methods": [
"stock.warehouse.search"
],
"methods": ["stock.warehouse.search"],
"notes": [
"入参新增 with_stock(boolean,默认 false,是否返回关联库存数据)和 is_batch(boolean,默认 false,仅 with_stock=true 时生效,按批次明细返回)。响应 data[] 新增 storage[] 字段:is_batch=false 时按库位分组汇总(含 space_id、space、inventory_type、quantity、locked_quantity、available_quantity);is_batch=true 时逐 条返回批次明细(含 id、stock_id、space_id、batch_no、inventory_type、quantity、locked_quantity、available_quantity、production_date、expiry_date、inbound_time、inbound_order_no、supplier_batch_no、created_at、space)。"
],
@ -263,9 +250,7 @@
"version": "2026.04.08-system-13",
"date": "2026-04-08",
"summary": "新增 wms_stock_transaction 表和模型",
"methods": [
"wms_stock_transaction"
],
"methods": ["wms_stock_transaction"],
"notes": [
"新增出入库流水记录表 wms_stock_transaction,含 transaction_type(INBOUND/OUTBOUND)、warehouse_id、store_id、stock_id、storage_id、space_id、quantity、batch_no、inventory_type、order_type、order_no、order_id、receiving_id、entry_order_id、operator_id、operator_name、remark 等字段,关联 StockWarehouse 和 Storage 模型。"
],
@ -275,10 +260,7 @@
"version": "2026.04.08-system-14",
"date": "2026-04-08",
"summary": "quickPutaway 和 matchPutaway 入库时自动写入出入库记录",
"methods": [
"storage.inventory.quickPutaway",
"storage.inventory.matchPutaway"
],
"methods": ["storage.inventory.quickPutaway", "storage.inventory.matchPutaway"],
"notes": [
"入库操作完成后自动写入 wms_stock_transaction 记录。quickPutaway 写入 order_type='SCRK'(收货入库),matchPutaway 写入 order_type='MATCH'(匹配入库),均 自动填充 warehouse_id、store_id、stock_id、storage_id、space_id、quantity、batch_no、inventory_type 等字段。"
],
@ -288,9 +270,7 @@
"version": "2026.04.08-system-15",
"date": "2026-04-08",
"summary": "新增 storage.inventory.list 出入库记录列表查询接口",
"methods": [
"storage.inventory.list"
],
"methods": ["storage.inventory.list"],
"notes": [
"出入库记录列表查询,支持 where 条件(transaction_type、stock_id、space_id、store_id、order_type、order_no、inventory_type、operator_name、created_at)、 分页(pagination)、排序(sort)和 group_by_batch 参数。默认合并模式按库位+商品 聚合返回合计数量与记录条数,group_by_batch=true 时返回每条明细含 batch_no、order_no、operator_name 等完整信息。响应均关联 stockItem(item_code、item_name、sku_property、stock_unit)。"
],
@ -300,9 +280,7 @@
"version": "2026.04.08-system-16",
"date": "2026-04-08",
"summary": "出入库流水记录查询接口从 storage.inventory.list 改名为 storage.transaction.list",
"methods": [
"storage.transaction.list"
],
"methods": ["storage.transaction.list"],
"notes": [
"将出入库流水记录查询从 storage.inventory.list 迁移到 storage.transaction.list,避免与库存列表概念混淆。功能和参数不变。isNeedAuth=false, isNeedLogin=true, isNeedRight=false。"
],
@ -313,9 +291,7 @@
"version": "2026.04.08-system-17",
"date": "2026-04-08",
"summary": "新增 storage.inventory.list 库存列表查询接口",
"methods": [
"storage.inventory.list"
],
"methods": ["storage.inventory.list"],
"notes": [
"新增库存列表查询接口,查询 wms_storage 表。支持 where 条件(stock_id/space_id/store_id/inventory_type/batch_no/inbound_order_no/available_quantity/inbound_time/created_at)、分页、排序。支持 group_by_batch 参数:默认 false 按库位+商 品合并(SUM quantity/locked_quantity/available_quantity),true 返回每条明细含 batch_no/production_date/expiry_date 等。关联 stockItem(商品信息)和 space(库位信息)。isNeedAuth=false, isNeedLogin=true, isNeedRight=false。"
],
@ -326,9 +302,7 @@
"version": "2026.04.08-system-18",
"date": "2026-04-08",
"summary": "移除 storage.entry.create 创建入库单接口",
"methods": [
"storage.entry.create"
],
"methods": ["storage.entry.create"],
"notes": [
"不再允许通过 API 创建入库单。入库单仅由快捷入库(quickPutaway)和匹配入库(matchPutaway)等内部流程自动创建。底层 service 实现保留但不再通过 systemMethods 对外暴露。"
],
@ -354,11 +328,7 @@
"version": "2026.04.08-system-20",
"date": "2026-04-08",
"summary": "新增 storage.stockout 出库单模块(非订单出库单能力)",
"methods": [
"storage.stockout.list",
"storage.stockout.toOrder",
"storage.stockout.listItems"
],
"methods": ["storage.stockout.list", "storage.stockout.toOrder", "storage.stockout.listItems"],
"notes": [
"新增 storage.stockout.list / toOrder / listItems 接口,作为非订单出库单的主出口(对应奇门 stockout.create)。storage.delivery.* 仅作为兼容转发保留;底层 部分能力仍复用 order 模块。"
],
@ -369,9 +339,7 @@
"version": "2026.04.08-system-21",
"date": "2026-04-08",
"summary": "将 storage.stockout.toOrder 标记为占位接口",
"methods": [
"storage.stockout.toOrder"
],
"methods": ["storage.stockout.toOrder"],
"notes": [
"storage.stockout.toOrder 当前仅保留方法名用于后续扩展,暂不开放实际逻辑。调用时返回 code=405、message=占位接口,暂未开放。"
],
@ -381,9 +349,7 @@
"version": "2026.04.09-system-01",
"date": "2026-04-09",
"summary": "storage.entry.cancel 支持批量作废,新增 ids 入参并兼容单条 id",
"methods": [
"storage.entry.cancel"
],
"methods": ["storage.entry.cancel"],
"notes": [
"新增入参 `ids`(number[])以支持批量作废,兼容旧入参 `id`;当同时传入 `ids` 与 `id` 时以 `ids` 为准。",
"参数校验:`ids` 必须为非空数组;非法 ID 或空数组返回 400。",
@ -396,9 +362,7 @@
"version": "2026.04.09-system-02",
"date": "2026-04-09",
"summary": "新增基础模块车牌识别接口 index.recognizeLicensePlate",
"methods": [
"index.recognizeLicensePlate"
],
"methods": ["index.recognizeLicensePlate"],
"notes": [
"入参:base64(string,必填)或 imageBase64/image_base64(兼容)",
"响应:返回归一化后的识别对象,包含 licensePlate、plateNumber、color、confidence、requestId、imageSize、rawData",
@ -411,70 +375,75 @@
"version": "2026.04.09-system-03",
"date": "2026-04-09",
"summary": "收紧基础模块车牌识别接口响应,仅返回 licensePlate 字段",
"methods": [
"index.recognizeLicensePlate"
],
"methods": ["index.recognizeLicensePlate"],
"notes": [
"出参由 {licensePlate, plateNumber, color, confidence, requestId, imageSize, rawData} 调整为 {licensePlate}",
"调用方请仅依赖 licensePlate 字段以适配新版本;历史字段已裁剪且不再保证 存 在。",
"调用方请仅依赖 licensePlate 字段以适配新版本;历史字段已裁剪且不再保证存 在。",
"文档中未包含任何云密钥或敏感配置信息。"
],
"type": "changed"
},
{
"version": "2026.04.12-system-01",
"date": "2026-04-12",
"summary": "新增订单工作台各分组 list 接口文档,说明 where 透传与分页上限(pageSize\u003C=200)",
"version": "2026.04.10-system-01",
"date": "2026-04-10",
"summary": "订单审核字段由 audit_status 替换为整数字段 step,并添加数据库迁移",
"methods": [
"order.list",
"order.reviewOrder.list",
"order.getreviewOrderlist",
"order.reviewOrder.getreviewOrderlist",
"order.reviewOrder.reviewOrder",
"order.pendingOrder.list",
"order.expectionOrder.list",
"order.entrustOrder.list",
"order.deliveryOrder.list",
"order.deliveryExpectionOrder.list",
"order.archiveOrder.list"
"order.deliveryOrder.getdeliveryOrderlist",
"order.list",
"order.stats"
],
"notes": [
"补充 order 工作台分组 list 接口,并说明所有 list 接口支持 pagination、where、sort;服务端对 pagination.pageSize 做上限截断(MAX=200)。",
"说明 where 参数会被 normalize 并交给解析器 parseWhereConditions,再与模块默认条件合并后用于底层查询;示例:reviewOrder 模块默认 step=0,pendingOrder 默认 step in [1,2],deliveryOrder 默认 dispatch_lane=m4 等。",
"补充待审核模块的审核提交接口 order.reviewOrder.reviewOrder,说明其仅接收 ids 批量入参(number[] 或 string[]),严格同仓校验,不再兼容旧字段。",
"兼容入口(如 getreviewOrderlist / getdeliveryOrderlist 等)作为历史兼容保留,在文档中标为兼容说明,不作为主入口推荐。"
"字段变更:order 相关审核字段从字符串/枚举 audit_status 替换为整数 step。",
"step 映射:0=未审核,1=已审核,2=处理中,3=驳回/异常,4=配送中,5=已完成,9=已关闭。",
"reviewOrder 接口在更新 inspection_status 的同时会写入 step 字段。",
"必须执行迁移脚本:20260410150000-replace-audit-status-with-step-on-order-delivery-tables.js"
],
"type": "added",
"module": "order"
},
{
"version": "2026.04.13-system-01",
"date": "2026-04-13",
"summary": "新增待处理订单取消接口 order.pendingOrder.cancelOrder(ids-only)",
"methods": [
"order.pendingOrder.cancelOrder"
],
"notes": [
"新增接口 order.pendingOrder.cancelOrder:用于批量取消待处理订单,接口仅接受 ids 数组入参(number[] 或 string[]),不再兼容 id/order_id/逗号字符串等兼容写法。",
"严格同仓校验:仓库上下文由当前登录用户的 store_id 决定,禁止传入 warehouse_id / warehouseId。",
"状态限制:仅允许 step ∈ [1,2] 且 outbound_status != 'padding' 的订单被取消;已取消或已完成的订单不可取消,状态不满足时返回 404/400。",
"取消后语义:接口将把订单表的 status 字段设为 'cancel' 并更新 updated_at;返回首个被取消的订单 id、status、updated_at、updated_count 与 ids 列表。",
"入参/响应契约已按代码侧约定(ids-only、同仓校验、允许状态集合、取消后语义)同步到 methods/system.json。"
],
"type": "added",
"module": "order"
"type": "changed"
},
{
"version": "2026.04.13-system-02",
"date": "2026-04-13",
"summary": "新增订单工作台角标聚合接口 order.badgeCount",
"methods": [
"order.badgeCount"
],
"summary": "stock.warehouse.search 返回新增效期管理字段并保留 is_shelf_life_mgmt",
"methods": ["stock.warehouse.search"],
"notes": [
"聚合返回 8 个订单工作台标签的展示值(用于前端 badge)。",
"按当前登录用户的 store_id 维度做短缓存;5 个模块查表统计数量,≥100 返回 '99+',否则返回实际数字(0..99)。",
"deliveryOrder、deliveryExpectionOrder、archiveOrder 三个字段固定返回 '99+'(不查表)。"
"响应 data[] 中新增字段:inbound_min_days、outbound_min_days、shelf_life_days、remaining_threshold_days(均为 number,单位:天)。",
"保留并说明 is_shelf_life_mgmt 布尔字段(boolean),表示是否启用效期管理(true=启用)。",
"仅更新文档(methods/system.json 与变更记录),代码行为不变。"
],
"type": "added",
"module": "order"
"type": "updated"
},
{
"version": "2026.04.13-system-02",
"date": "2026-04-13",
"summary": "新增 storage.expiry.list 库存有效期列表查询接口",
"methods": ["storage.expiry.list"],
"notes": [
"该接口查询 wms_storage,关联 stockWarehouse 和 locationSpace,并按当前仓库与 remaining_threshold_days / expiry_date 过滤。"
],
"type": "added"
},
{
"version": "2026.04.13-system-03",
"date": "2026-04-13",
"summary": "新增 storage.inventory.list 库存列表返回效期字段与预警标记",
"methods": ["storage.inventory.list"],
"notes": [
"库存列表响应增加生产日期、过期日期、效期预警是否触发字段",
"预警标记仅在商品启用保质期管理且到期日满足阈值条件时为 true"
],
"type": "updated"
},
{
"version": "2026.04.14-system-01",
"date": "2026-04-14",
"summary": "更新 index.searchSpace 文档",
"methods": ["index.searchSpace"],
"notes": [
"补充 index.searchSpace 的 params/response,按 ctx.user.store_id 作为仓库上下文;keyword 为可选字符串,对 space_code 与 custom_barcode 做 %keyword% 模糊匹配;返回字段 id、space_code、custom_barcode、custom_name,最多 50 条;仅文档同步,无代码变更。"
],
"type": "updated"
}
]
]

View File

@ -0,0 +1 @@
[]

View File

@ -0,0 +1,182 @@
import { mkdir, readFile, readdir, rm, stat, writeFile } from "node:fs/promises";
import { createHash } from "node:crypto";
import path from "node:path";
import { API_DOC_SYNC_CONFIG } from "./config.mjs";
const LEGACY_FILES = {
localChanges: path.join("src", "apichanges.txt"),
};
function stableId(record) {
if (record?.version) {
return String(record.version);
}
const payload = JSON.stringify({
date: record?.date ?? "",
summary: record?.summary ?? "",
methods: Array.isArray(record?.methods) ? record.methods : [],
notes: Array.isArray(record?.notes) ? record.notes : [],
});
return createHash("sha1").update(payload).digest("hex");
}
function normalizePendingRecord(record) {
return {
summary: record?.summary ?? "",
methods: Array.isArray(record?.methods) ? record.methods : [],
notes: Array.isArray(record?.notes) ? record.notes : [],
};
}
async function readJsonArray(filePath) {
try {
const content = await readFile(filePath, "utf8");
const parsed = JSON.parse(content);
return Array.isArray(parsed) ? parsed : [];
} catch (error) {
if (error?.code === "ENOENT") {
return [];
}
throw error;
}
}
async function readLocalChangesWithLegacyFallback() {
const {
file: { localChanges },
} = API_DOC_SYNC_CONFIG;
const localData = await readJsonArray(localChanges);
if (localData.length > 0) {
return localData;
}
const legacyData = await readJsonArray(LEGACY_FILES.localChanges);
if (legacyData.length > 0) {
await writeJson(localChanges, legacyData);
return legacyData;
}
return [];
}
function parseChangesPayload(content) {
const trimmed = content.trim();
try {
const parsed = JSON.parse(trimmed);
if (Array.isArray(parsed)) {
return parsed;
}
} catch {
// Fallback: extract JSON array from HTML/text.
}
const start = trimmed.indexOf("[");
const end = trimmed.lastIndexOf("]");
if (start < 0 || end < 0 || end <= start) {
throw new Error("远端返回内容中未找到可解析的 JSON 数组。");
}
const parsedFallback = JSON.parse(trimmed.slice(start, end + 1));
if (!Array.isArray(parsedFallback)) {
throw new Error("远端返回内容解析后不是数组。");
}
return parsedFallback;
}
async function fetchRemoteChanges() {
const response = await fetch(API_DOC_SYNC_CONFIG.changesUrl, {
method: "GET",
signal: AbortSignal.timeout(20000),
});
if (!response.ok) {
throw new Error(`抓取接口日志失败:HTTP ${response.status}`);
}
const text = await response.text();
return parseChangesPayload(text);
}
async function writeJson(filePath, data) {
await mkdir(path.dirname(filePath), { recursive: true });
await writeFile(filePath, `${JSON.stringify(data, null, 2)}\n`, "utf8");
}
async function writeHistorySnapshot(changes) {
const {
file: { historyDir },
history: { prefix, suffix },
} = API_DOC_SYNC_CONFIG;
await mkdir(historyDir, { recursive: true });
const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
const snapshotPath = path.join(historyDir, `${prefix}${timestamp}${suffix}`);
await writeJson(snapshotPath, changes);
return snapshotPath;
}
async function pruneHistory() {
const {
file: { historyDir },
history: { prefix, suffix },
historyMaxFiles,
} = API_DOC_SYNC_CONFIG;
await mkdir(historyDir, { recursive: true });
const files = await readdir(historyDir);
const historyFiles = files.filter((file) => file.startsWith(prefix) && file.endsWith(suffix));
if (historyFiles.length <= historyMaxFiles) {
return;
}
const fileStats = await Promise.all(
historyFiles.map(async (file) => {
const filePath = path.join(historyDir, file);
const fileInfo = await stat(filePath);
return {
filePath,
mtimeMs: fileInfo.mtimeMs,
};
}),
);
fileStats.sort((a, b) => b.mtimeMs - a.mtimeMs);
const expired = fileStats.slice(historyMaxFiles);
await Promise.all(expired.map((item) => rm(item.filePath)));
}
async function run() {
const {
file: { localChanges, pendingChanges },
} = API_DOC_SYNC_CONFIG;
const localData = await readLocalChangesWithLegacyFallback();
const remoteData = await fetchRemoteChanges();
const localIds = new Set(localData.map(stableId));
const newRecords = remoteData.filter((item) => !localIds.has(stableId(item)));
if (newRecords.length === 0) {
await writeJson(pendingChanges, []);
console.log("未检测到接口更新,已清理待更新接口文件。");
return;
}
await writeJson(localChanges, remoteData);
await writeJson(pendingChanges, newRecords.map(normalizePendingRecord));
const snapshotPath = await writeHistorySnapshot(remoteData);
await pruneHistory();
console.log(`检测到 ${newRecords.length} 条接口更新。`);
console.log(`已更新本地日志:${localChanges}`);
console.log(`已更新待更新文件:${pendingChanges}`);
console.log(`已生成历史快照:${snapshotPath}`);
}
run().catch((error) => {
console.error("执行 API 文档更新流程失败:", error);
process.exitCode = 1;
});