From 89539413629ff799b4e6cbcefa7fc5b4d60d986f Mon Sep 17 00:00:00 2001 From: my_ong <429426262@qq.com> Date: Sun, 2 Mar 2025 14:38:52 +0800 Subject: [PATCH] =?UTF-8?q?sparkles:=20:sparkles:=20=E7=89=A9=E6=96=99?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/api-lock.json | 397 +++++++++++++++++++++ src/api/material/api.d.ts | 46 +++ src/api/material/mods/index.ts | 13 +- src/api/material/mods/type/addAndModify.ts | 22 ++ src/api/material/mods/type/areas.ts | 26 ++ src/api/material/mods/type/deleteArea.ts | 21 ++ src/api/material/mods/type/index.ts | 17 + src/api/material/mods/type/levels.ts | 20 ++ src/api/material/mods/type/trees.ts | 18 + src/plugins/axios.ts | 2 +- src/router/index.ts | 6 + src/views/stock/material/material-page.vue | 2 +- src/views/stock/type/form.ts | 100 ++++++ src/views/stock/type/type-page.vue | 179 ++++++++++ vite.config.ts | 4 +- 15 files changed, 864 insertions(+), 9 deletions(-) create mode 100644 src/api/material/mods/type/addAndModify.ts create mode 100644 src/api/material/mods/type/areas.ts create mode 100644 src/api/material/mods/type/deleteArea.ts create mode 100644 src/api/material/mods/type/index.ts create mode 100644 src/api/material/mods/type/levels.ts create mode 100644 src/api/material/mods/type/trees.ts create mode 100644 src/views/stock/type/form.ts create mode 100644 src/views/stock/type/type-page.vue diff --git a/src/api/api-lock.json b/src/api/api-lock.json index c15432d..3195cf0 100644 --- a/src/api/api-lock.json +++ b/src/api/api-lock.json @@ -4162,6 +4162,169 @@ ] } ] + }, + { + "description": "物料类型管理", + "name": "type", + "interfaces": [ + { + "description": "增加/更新地区", + "name": "addAndModify", + "method": "post", + "path": "/area", + "response": { + "typeArgs": [], + "typeName": "Type", + "isDefsType": true, + "templateIndex": -1, + "compileTemplateKeyword": "#/definitions/", + "enum": [], + "typeProperties": [] + }, + "parameters": [ + { + "required": true, + "in": "body", + "name": "requestBody", + "dataType": { + "typeArgs": [], + "typeName": "Type", + "isDefsType": true, + "templateIndex": -1, + "compileTemplateKeyword": "#/definitions/", + "enum": [], + "typeProperties": [] + } + } + ] + }, + { + "description": "级别", + "name": "levels", + "method": "get", + "path": "/area/levels", + "response": { + "typeArgs": [ + { + "typeArgs": [], + "typeName": "Codebook", + "isDefsType": true, + "templateIndex": -1, + "compileTemplateKeyword": "#/definitions/", + "enum": [], + "typeProperties": [] + } + ], + "typeName": "Array", + "isDefsType": false, + "templateIndex": -1, + "compileTemplateKeyword": "#/definitions/", + "enum": [], + "typeProperties": [] + }, + "parameters": [] + }, + { + "description": "类型树", + "name": "trees", + "method": "get", + "path": "/area/trees", + "response": { + "typeArgs": [ + { + "typeArgs": [], + "typeName": "TypeTree", + "isDefsType": true, + "templateIndex": -1, + "compileTemplateKeyword": "#/definitions/", + "enum": [], + "typeProperties": [] + } + ], + "typeName": "Array", + "isDefsType": false, + "templateIndex": -1, + "compileTemplateKeyword": "#/definitions/", + "enum": [], + "typeProperties": [] + }, + "parameters": [] + }, + { + "description": "删除类型", + "name": "deleteArea", + "method": "delete", + "path": "/area/{id}", + "response": { + "typeArgs": [], + "typeName": "", + "isDefsType": false, + "templateIndex": -1, + "compileTemplateKeyword": "#/definitions/", + "enum": [], + "typeProperties": [] + }, + "parameters": [ + { + "description": "id", + "required": true, + "in": "path", + "name": "id", + "dataType": { + "typeArgs": [], + "typeName": "number", + "isDefsType": false, + "templateIndex": -1, + "compileTemplateKeyword": "#/definitions/", + "enum": [], + "typeProperties": [] + } + } + ] + }, + { + "description": "查询类型", + "name": "areas", + "method": "get", + "path": "/areas", + "response": { + "typeArgs": [ + { + "typeArgs": [], + "typeName": "Type", + "isDefsType": true, + "templateIndex": -1, + "compileTemplateKeyword": "#/definitions/", + "enum": [], + "typeProperties": [] + } + ], + "typeName": "Array", + "isDefsType": false, + "templateIndex": -1, + "compileTemplateKeyword": "#/definitions/", + "enum": [], + "typeProperties": [] + }, + "parameters": [ + { + "description": "搜索关键词", + "required": false, + "in": "query", + "name": "key", + "dataType": { + "typeArgs": [], + "typeName": "string", + "isDefsType": false, + "templateIndex": -1, + "compileTemplateKeyword": "#/definitions/", + "enum": [], + "typeProperties": [] + } + } + ] + } + ] } ], "name": "material", @@ -4877,6 +5040,55 @@ } ] }, + { + "description": "枚举码本", + "name": "Codebook", + "templateArgs": [], + "properties": [ + { + "dataType": { + "typeArgs": [], + "typeName": "string", + "isDefsType": false, + "templateIndex": -1, + "compileTemplateKeyword": "#/definitions/", + "enum": [], + "typeProperties": [] + }, + "name": "code", + "description": "码本编码", + "required": true + }, + { + "dataType": { + "typeArgs": [], + "typeName": "string", + "isDefsType": false, + "templateIndex": -1, + "compileTemplateKeyword": "#/definitions/", + "enum": [], + "typeProperties": [] + }, + "name": "description", + "description": "码本名称", + "required": true + }, + { + "dataType": { + "typeArgs": [], + "typeName": "string", + "isDefsType": false, + "templateIndex": -1, + "compileTemplateKeyword": "#/definitions/", + "enum": [], + "typeProperties": [] + }, + "name": "name", + "description": "码本值", + "required": true + } + ] + }, { "name": "ComparisonResDTO", "templateArgs": [], @@ -5826,6 +6038,191 @@ } ] }, + { + "description": "类型", + "name": "Type", + "templateArgs": [], + "properties": [ + { + "dataType": { + "typeArgs": [], + "typeName": "string", + "isDefsType": false, + "templateIndex": -1, + "compileTemplateKeyword": "#/definitions/", + "enum": [], + "typeProperties": [] + }, + "name": "createdTime", + "required": false + }, + { + "dataType": { + "typeArgs": [], + "typeName": "number", + "isDefsType": false, + "templateIndex": -1, + "compileTemplateKeyword": "#/definitions/", + "enum": [], + "typeProperties": [] + }, + "name": "id", + "required": false + }, + { + "dataType": { + "typeArgs": [], + "typeName": "", + "isDefsType": false, + "templateIndex": -1, + "compileTemplateKeyword": "#/definitions/", + "enum": ["'ONE'", "'TWO'"], + "typeProperties": [] + }, + "name": "level", + "description": "类型级别", + "required": true + }, + { + "dataType": { + "typeArgs": [], + "typeName": "Codebook", + "isDefsType": true, + "templateIndex": -1, + "compileTemplateKeyword": "#/definitions/", + "enum": [], + "typeProperties": [] + }, + "name": "levelInfo", + "required": false + }, + { + "dataType": { + "typeArgs": [], + "typeName": "string", + "isDefsType": false, + "templateIndex": -1, + "compileTemplateKeyword": "#/definitions/", + "enum": [], + "typeProperties": [] + }, + "name": "name", + "description": "类型名称", + "required": true + }, + { + "dataType": { + "typeArgs": [], + "typeName": "string", + "isDefsType": false, + "templateIndex": -1, + "compileTemplateKeyword": "#/definitions/", + "enum": [], + "typeProperties": [] + }, + "name": "no", + "description": "类型编码", + "required": true + }, + { + "dataType": { + "typeArgs": [], + "typeName": "string", + "isDefsType": false, + "templateIndex": -1, + "compileTemplateKeyword": "#/definitions/", + "enum": [], + "typeProperties": [] + }, + "name": "parentNo", + "description": "上级类型编码", + "required": false + }, + { + "dataType": { + "typeArgs": [], + "typeName": "string", + "isDefsType": false, + "templateIndex": -1, + "compileTemplateKeyword": "#/definitions/", + "enum": [], + "typeProperties": [] + }, + "name": "updatedTime", + "required": false + } + ] + }, + { + "name": "TypeTree", + "templateArgs": [], + "properties": [ + { + "dataType": { + "typeArgs": [ + { + "typeArgs": [], + "typeName": "TypeTree", + "isDefsType": true, + "templateIndex": -1, + "compileTemplateKeyword": "#/definitions/", + "enum": [], + "typeProperties": [] + } + ], + "typeName": "Array", + "isDefsType": false, + "templateIndex": -1, + "compileTemplateKeyword": "#/definitions/", + "enum": [], + "typeProperties": [] + }, + "name": "children", + "required": false + }, + { + "dataType": { + "typeArgs": [], + "typeName": "string", + "isDefsType": false, + "templateIndex": -1, + "compileTemplateKeyword": "#/definitions/", + "enum": [], + "typeProperties": [] + }, + "name": "label", + "description": "类型名称", + "required": true + }, + { + "dataType": { + "typeArgs": [], + "typeName": "string", + "isDefsType": false, + "templateIndex": -1, + "compileTemplateKeyword": "#/definitions/", + "enum": [], + "typeProperties": [] + }, + "name": "parentNo", + "required": false + }, + { + "dataType": { + "typeArgs": [], + "typeName": "string", + "isDefsType": false, + "templateIndex": -1, + "compileTemplateKeyword": "#/definitions/", + "enum": [], + "typeProperties": [] + }, + "name": "value", + "description": "类型编码", + "required": true + } + ] + }, { "name": "WaitScanInfo", "templateArgs": [], diff --git a/src/api/material/api.d.ts b/src/api/material/api.d.ts index 4c72eae..b306415 100644 --- a/src/api/material/api.d.ts +++ b/src/api/material/api.d.ts @@ -332,6 +332,52 @@ declare namespace material { updatedTime?: string } + /** + * 类型 + */ + export interface Type { + /** createdTime */ + createdTime?: string + + /** id */ + id?: number + + /** 类型级别 */ + level: 'ONE' | 'TWO' + + /** levelInfo */ + levelInfo?: material.Codebook + + /** 类型名称 */ + name: string + + /** 类型编码 */ + no: string + + /** 上级类型编码 */ + parentNo?: string + + /** updatedTime */ + updatedTime?: string + } + + /** + * TypeTree + */ + export interface TypeTree { + /** children */ + children?: Array + + /** 类型名称 */ + label: string + + /** parentNo */ + parentNo?: string + + /** 类型编码 */ + value: string + } + /** * WaitScanInfo */ diff --git a/src/api/material/mods/index.ts b/src/api/material/mods/index.ts index 2499b18..df5c838 100644 --- a/src/api/material/mods/index.ts +++ b/src/api/material/mods/index.ts @@ -1,8 +1,11 @@ -import apply from './apply'; +import apply from './apply' -import material from './material'; +import material from './material' + +import type from './type' export default { - apply, - material, -}; + apply, + material, + type, +} diff --git a/src/api/material/mods/type/addAndModify.ts b/src/api/material/mods/type/addAndModify.ts new file mode 100644 index 0000000..515382a --- /dev/null +++ b/src/api/material/mods/type/addAndModify.ts @@ -0,0 +1,22 @@ +/** + * @desc 增加/更新地区 + */ +import { defaultSuccess, defaultError, http } from '@/plugins/axios' +import type { AxiosResponse } from 'axios' +export default async function ( + /** 请求体 */ + requestBody: material.Type, + + success: (data: material.Type) => void = defaultSuccess, + fail: (error: { code: string; error?: string }) => void = defaultError, +): Promise { + return http({ + method: 'post', + url: `/area`, + data: requestBody, + }) + .then((data: AxiosResponse) => { + success(data.data) + }) + .catch((error: { code: string; error?: string }) => fail(error)) +} diff --git a/src/api/material/mods/type/areas.ts b/src/api/material/mods/type/areas.ts new file mode 100644 index 0000000..9373c1f --- /dev/null +++ b/src/api/material/mods/type/areas.ts @@ -0,0 +1,26 @@ +/** + * @desc 查询类型 + */ +import { defaultSuccess, defaultError, http } from '@/plugins/axios' +import type { AxiosResponse } from 'axios' +export interface Params { + /** 搜索关键词 */ + key?: string +} + +export default async function ( + params: Params, + success: (data: Array) => void = defaultSuccess, + fail: (error: { code: string; error?: string }) => void = defaultError, +): Promise { + return http({ + method: 'get', + url: `/areas`, + + params, + }) + .then((data: AxiosResponse, unknown>) => { + success(data.data) + }) + .catch((error: { code: string; error?: string }) => fail(error)) +} diff --git a/src/api/material/mods/type/deleteArea.ts b/src/api/material/mods/type/deleteArea.ts new file mode 100644 index 0000000..8da9653 --- /dev/null +++ b/src/api/material/mods/type/deleteArea.ts @@ -0,0 +1,21 @@ +/** + * @desc 删除类型 + */ +import { defaultSuccess, defaultError, http } from '@/plugins/axios' +import type { AxiosResponse } from 'axios' +export default async function ( + /** id */ + id: number, + + success: (data: void) => void = defaultSuccess, + fail: (error: { code: string; error?: string }) => void = defaultError, +): Promise { + return http({ + method: 'delete', + url: `/area/${id}`, + }) + .then((data: AxiosResponse) => { + success(data.data) + }) + .catch((error: { code: string; error?: string }) => fail(error)) +} diff --git a/src/api/material/mods/type/index.ts b/src/api/material/mods/type/index.ts new file mode 100644 index 0000000..6fb2657 --- /dev/null +++ b/src/api/material/mods/type/index.ts @@ -0,0 +1,17 @@ +/** + * @description 物料类型管理 + * + */ +import addAndModify from './addAndModify' +import levels from './levels' +import trees from './trees' +import deleteArea from './deleteArea' +import areas from './areas' + +export default { + addAndModify, + levels, + trees, + deleteArea, + areas, +} diff --git a/src/api/material/mods/type/levels.ts b/src/api/material/mods/type/levels.ts new file mode 100644 index 0000000..20b9064 --- /dev/null +++ b/src/api/material/mods/type/levels.ts @@ -0,0 +1,20 @@ +/** + * @desc 级别 + */ +import { defaultSuccess, defaultError, http } from '@/plugins/axios' +import type { AxiosResponse } from 'axios' +import type { Codebook } from '@/api/api' + +export default async function ( + success: (data: Array) => void = defaultSuccess, + fail: (error: { code: string; error?: string }) => void = defaultError, +): Promise { + return http({ + method: 'get', + url: `/area/levels`, + }) + .then((data: AxiosResponse, unknown>) => { + success(data.data) + }) + .catch((error: { code: string; error?: string }) => fail(error)) +} diff --git a/src/api/material/mods/type/trees.ts b/src/api/material/mods/type/trees.ts new file mode 100644 index 0000000..6776fb9 --- /dev/null +++ b/src/api/material/mods/type/trees.ts @@ -0,0 +1,18 @@ +/** + * @desc 类型树 + */ +import { defaultSuccess, defaultError, http } from '@/plugins/axios' +import type { AxiosResponse } from 'axios' +export default async function ( + success: (data: Array) => void = defaultSuccess, + fail: (error: { code: string; error?: string }) => void = defaultError, +): Promise { + return http({ + method: 'get', + url: `/area/trees`, + }) + .then((data: AxiosResponse, unknown>) => { + success(data.data) + }) + .catch((error: { code: string; error?: string }) => fail(error)) +} diff --git a/src/plugins/axios.ts b/src/plugins/axios.ts index da4ab7a..cb0a771 100644 --- a/src/plugins/axios.ts +++ b/src/plugins/axios.ts @@ -29,7 +29,7 @@ export function defaultError(error: { code: string; error?: string }): void { message: '操作异常: ', placement: 'top', description: error.error + '(' + error.code + ')', - duration: null, + duration: 6, }) } const config = { diff --git a/src/router/index.ts b/src/router/index.ts index 5038b53..5ee7289 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -42,6 +42,12 @@ export const routes: Array = [ meta: { title: 'menus.acl.material', icon: 'icon-permission' }, component: () => import('../views/stock/material/material-page.vue'), }, + { + path: '/admin/acl/type', //物料类型 + name: 'Type', + meta: { title: '物料类型', icon: 'icon-permission' }, + component: () => import('../views/stock/type/type-page.vue'), + }, ], }, { diff --git a/src/views/stock/material/material-page.vue b/src/views/stock/material/material-page.vue index db2e8c6..c5d3ce9 100644 --- a/src/views/stock/material/material-page.vue +++ b/src/views/stock/material/material-page.vue @@ -3,7 +3,7 @@