From 7b4bb0b05dc6ba33c20b22611e8fab6c747b9769 Mon Sep 17 00:00:00 2001 From: "HUOJIN\\92525" Date: Wed, 19 Mar 2025 17:45:48 +0800 Subject: [PATCH] no message --- .../src/api/business/base/item/item-api.ts | 20 +- .../business/base/location/location-api.ts | 13 +- .../src/api/business/base/stock/stock-api.ts | 69 +++ .../api/business/base/stock/stock-const.ts | 11 + .../src/constants/support/table-id-const.ts | 1 + smart-admin-web-typescript/src/lib/axios.ts | 5 +- .../views/business/base/area/area-list.vue | 2 +- .../views/business/base/area/area-select.vue | 2 +- .../views/business/base/item/item-list.vue | 125 ++++- .../business/base/location/location-form.vue | 5 +- .../business/base/location/location-list.vue | 67 ++- .../base/location/multiple-insert.vue | 5 +- .../views/business/base/stock/stock-form.vue | 157 +++++++ .../views/business/base/stock/stock-list.vue | 426 ++++++++++++++++++ 14 files changed, 855 insertions(+), 53 deletions(-) create mode 100644 smart-admin-web-typescript/src/api/business/base/stock/stock-api.ts create mode 100644 smart-admin-web-typescript/src/api/business/base/stock/stock-const.ts create mode 100644 smart-admin-web-typescript/src/views/business/base/stock/stock-form.vue create mode 100644 smart-admin-web-typescript/src/views/business/base/stock/stock-list.vue diff --git a/smart-admin-web-typescript/src/api/business/base/item/item-api.ts b/smart-admin-web-typescript/src/api/business/base/item/item-api.ts index 0510676..49c7b99 100644 --- a/smart-admin-web-typescript/src/api/business/base/item/item-api.ts +++ b/smart-admin-web-typescript/src/api/business/base/item/item-api.ts @@ -5,7 +5,7 @@ * @Date: 2024-11-25 17:08:18 * @Copyright 友仓 */ -import {postRequest, getRequest} from '/@/lib/axios'; +import {postRequest, getRequest, getDownload} from '/@/lib/axios'; export const itemApi = { @@ -34,8 +34,8 @@ export const itemApi = { /** * 删除 @author 霍锦 */ - delete: (id: number) => { - return getRequest('/item/delete', {id}); + delete: (itemId: number) => { + return getRequest('/item/delete', {itemId}); }, /** @@ -52,4 +52,18 @@ export const itemApi = { return postRequest('/item/queryItem', param); }, + /** + * 导入 @author hj + */ + importItems: (file: object) => { + return postRequest('/item/importItems', file); + }, + + /** + * 导出 @author hj + */ + exportItems: () => { + return getDownload('/item/exportItems',{}); + } + }; diff --git a/smart-admin-web-typescript/src/api/business/base/location/location-api.ts b/smart-admin-web-typescript/src/api/business/base/location/location-api.ts index 35afda2..5b7d153 100644 --- a/smart-admin-web-typescript/src/api/business/base/location/location-api.ts +++ b/smart-admin-web-typescript/src/api/business/base/location/location-api.ts @@ -5,7 +5,7 @@ * @Date: 2024-11-18 14:17:31 * @Copyright 友仓 */ -import {postRequest, getRequest} from '/@/lib/axios'; +import {postRequest, getRequest, getDownload} from '/@/lib/axios'; export const locationApi = { @@ -69,7 +69,14 @@ export const locationApi = { /** * 导入 @author hj */ - importLocations: (file: object, config = {}) => { - return postRequest('/location/importLocations', file, config); + importLocations: (file: object) => { + return postRequest('/location/importLocations', file); }, + + /** + * 导出 @author hj + */ + exportLocations : () =>{ + return getDownload('/location/exportLocations',{}); + } }; diff --git a/smart-admin-web-typescript/src/api/business/base/stock/stock-api.ts b/smart-admin-web-typescript/src/api/business/base/stock/stock-api.ts new file mode 100644 index 0000000..256370c --- /dev/null +++ b/smart-admin-web-typescript/src/api/business/base/stock/stock-api.ts @@ -0,0 +1,69 @@ +/** + * 容器信息 api 封装 + * + * @Author: 霍锦 + * @Date: 2024-11-26 11:37:48 + * @Copyright 友仓 + */ +import {postRequest, getRequest,getDownload} from '/@/lib/axios'; + +export const stockApi = { + + /** + * 分页查询 @author 霍锦 + */ + queryPage: (param: object) => { + return postRequest('/stock/queryPage', param); + }, + + /** + * 增加 @author 霍锦 + */ + add: (param: object) => { + return postRequest('/stock/add', param); + }, + + /** + * 修改 @author 霍锦 + */ + update: (param: object) => { + return postRequest('/stock/update', param); + }, + + + /** + * 删除 @author 霍锦 + */ + delete: (stockId: number) => { + return getRequest('/stock/delete', {stockId}); + }, + + /** + * 批量删除 @author 霍锦 + */ + batchDelete: (idList: number[]) => { + return postRequest('/stock/batchDelete', idList); + }, + /** + * 下拉查询 @author hj + */ + queryStock: (param: object) => { + return postRequest('/stock/queryStock', param); + }, + + /** + * 导入 @author hj + */ + importStocks: (file: object) => { + return postRequest('/stock/importStocks', file); + }, + + /** + * 导出 @author hj + */ + exportStocks: () => { + return getDownload('/stock/exportStocks', {}); + } + + +}; diff --git a/smart-admin-web-typescript/src/api/business/base/stock/stock-const.ts b/smart-admin-web-typescript/src/api/business/base/stock/stock-const.ts new file mode 100644 index 0000000..af16329 --- /dev/null +++ b/smart-admin-web-typescript/src/api/business/base/stock/stock-const.ts @@ -0,0 +1,11 @@ +/** + * 容器信息 枚举 + * + * @Author: 霍锦 + * @Date: 2024-11-26 11:37:48 + * @Copyright 友仓 + */ + + +export default { +}; \ No newline at end of file diff --git a/smart-admin-web-typescript/src/constants/support/table-id-const.ts b/smart-admin-web-typescript/src/constants/support/table-id-const.ts index 9c32c16..2344c68 100644 --- a/smart-admin-web-typescript/src/constants/support/table-id-const.ts +++ b/smart-admin-web-typescript/src/constants/support/table-id-const.ts @@ -38,6 +38,7 @@ export const TABLE_ID_CONST = { AREA:businessBASEInitTableId+1,//库区 LOCATION:businessBASEInitTableId+2,//库位 ITEM:businessBASEInitTableId+3,//商品 + STOCK:businessBASEInitTableId+4,//容器 } }, diff --git a/smart-admin-web-typescript/src/lib/axios.ts b/smart-admin-web-typescript/src/lib/axios.ts index 2b2b226..45f7523 100644 --- a/smart-admin-web-typescript/src/lib/axios.ts +++ b/smart-admin-web-typescript/src/lib/axios.ts @@ -146,12 +146,11 @@ export const request = (config) => { /** * post请求 */ -export const postRequest = (url, data,configs = {}) => { +export const postRequest = (url, data) => { return request({ data, url, - method: 'post', - ...configs, + method: 'post' }); }; diff --git a/smart-admin-web-typescript/src/views/business/base/area/area-list.vue b/smart-admin-web-typescript/src/views/business/base/area/area-list.vue index 51ebcdd..2e23f05 100644 --- a/smart-admin-web-typescript/src/views/business/base/area/area-list.vue +++ b/smart-admin-web-typescript/src/views/business/base/area/area-list.vue @@ -180,7 +180,7 @@ const columns = ref([ title: '操作', dataIndex: 'action', fixed: 'right', - width: 90, + width: 140, }, ]); diff --git a/smart-admin-web-typescript/src/views/business/base/area/area-select.vue b/smart-admin-web-typescript/src/views/business/base/area/area-select.vue index 66018e2..4f84f8c 100644 --- a/smart-admin-web-typescript/src/views/business/base/area/area-select.vue +++ b/smart-admin-web-typescript/src/views/business/base/area/area-select.vue @@ -49,7 +49,7 @@ const props = defineProps({ default: false, }, areaNames: { - type: Array as () => any[], + type: Array as () => string[], default: () => [] }, disabledFlag: { diff --git a/smart-admin-web-typescript/src/views/business/base/item/item-list.vue b/smart-admin-web-typescript/src/views/business/base/item/item-list.vue index 8844aec..c60cd50 100644 --- a/smart-admin-web-typescript/src/views/business/base/item/item-list.vue +++ b/smart-admin-web-typescript/src/views/business/base/item/item-list.vue @@ -53,6 +53,19 @@ 批量删除 + + + 导入 + + + + + 导出 +
@@ -121,8 +134,41 @@ />
+ + + +
+ + + 第一步:下载模板 + +
+
+ + + + 第二步:选择文件 + + + +
+ + + 第三步:开始导入 + +
+
+ diff --git a/smart-admin-web-typescript/src/views/business/base/location/location-form.vue b/smart-admin-web-typescript/src/views/business/base/location/location-form.vue index 6c0eeb4..1c2496d 100644 --- a/smart-admin-web-typescript/src/views/business/base/location/location-form.vue +++ b/smart-admin-web-typescript/src/views/business/base/location/location-form.vue @@ -16,7 +16,7 @@ > - + @@ -57,7 +57,6 @@ import {USAGE_STATUS_ENUM} from '/@/constants/business/base/usagestatus-const'; import SmartEnumSelect from '/@/components/framework/smart-enum-select/index.vue'; import AreaSelect from "/@/views/business/base/area/area-select.vue"; import DictSelect from "/@/components/support/dict-select/index.vue"; - // ------------------------ 事件 ------------------------ const emits = defineEmits(['reloadList']); @@ -94,7 +93,7 @@ const formDefault = { status: USAGE_STATUS_ENUM.FREE.value, //状态 areaId: undefined, //库区ID disabledFlag: true, //是否禁用 - locationType: [] //库位类型 + locationType: [], //库位类型 }; let form = reactive({...formDefault}); diff --git a/smart-admin-web-typescript/src/views/business/base/location/location-list.vue b/smart-admin-web-typescript/src/views/business/base/location/location-list.vue index c8d3ef3..5ed1bb4 100644 --- a/smart-admin-web-typescript/src/views/business/base/location/location-list.vue +++ b/smart-admin-web-typescript/src/views/business/base/location/location-list.vue @@ -10,7 +10,7 @@ - + @@ -81,6 +81,13 @@ 导入 + + + 导出 + +
@@ -173,7 +180,8 @@ - + +
@@ -201,8 +209,6 @@ 第三步:开始导入 - -
@@ -225,10 +231,12 @@ import SmartEnumSelect from '/@/components/framework/smart-enum-select/index.vue import DictPreview from '/@/components/dict-preview/index.vue'; import {useDict} from '/@/utils/dict'; import MultipleInsert from "/@/views/business/base/location/multiple-insert.vue"; -import { UploadFile } from 'ant-design-vue'; - +import {UploadFile} from 'ant-design-vue'; +import {fileApi} from "/@/api/support/file-api"; +//库位字典类型 const locType = useDict('LOC_TYPE'); + // ---------------------------- 表格列 ---------------------------- const columns = ref([ @@ -286,7 +294,7 @@ const columns = ref([ title: '操作', dataIndex: 'action', fixed: 'right', - width: 90, + width: 140, }, ]); @@ -455,25 +463,21 @@ const importModalShowFlag = ref(false); const fileList = ref([]) -// 新增上传进度 -const uploadProgress = ref(0); - // 显示导入 function showImportModal() { fileList.value = []; - uploadProgress.value = 0; importModalShowFlag.value = true; } -// 关闭 导入 -function hideImportModal() { - importModalShowFlag.value = false; - uploadProgress.value = 0; -} - //下载模板 -function downloadExcel() { - window.open('https://smartadmin.vip/cdn/%E5%95%86%E5%93%81%E6%A8%A1%E6%9D%BF.xls'); +async function downloadExcel() { + try { + //默认库位模板fileKey + let fileKey = 'public/common/2aa16b3d4c474efaad9057d3ce722067_20250317102514.xlsx'; + fileApi.downLoadFile(fileKey); + } catch (e) { + smartSentry.captureError(e); + } } // 移除文件 @@ -485,17 +489,15 @@ function handleRemove(file: UploadFile) { } // 上传文件 -function beforeUpload(file:UploadFile) { +function beforeUpload(file: UploadFile) { fileList.value = [...(fileList.value || []), file]; return false; } - //导入 async function onImportLocations() { - console.log(fileList.value.length); if (fileList.value.length === 0) { return message.error('请选择文件'); } @@ -506,24 +508,21 @@ async function onImportLocations() { SmartLoading.show(); try { - // 补全进度条的显示代码 - const config = { - onUploadProgress: (progressEvent) => { - const percentCompleted = Math.round((progressEvent.loaded * 100) / progressEvent.total); - // 更新进度条状态 - console.log(`上传进度: ${percentCompleted}%`); - uploadProgress.value = percentCompleted; - }, - }; - let res = await locationApi.importLocations(formData, config); - message.success(res.msg); + const response = await locationApi.importLocations(formData); + const {success} = JSON.parse(response.msg); + message.success(success); + importModalShowFlag.value = false; await queryData(); } catch (e) { smartSentry.captureError(e); - message.error('导入失败'); } finally { SmartLoading.hide(); } } +//导出 +function onExportLocations() { + locationApi.exportLocations(); +} + diff --git a/smart-admin-web-typescript/src/views/business/base/location/multiple-insert.vue b/smart-admin-web-typescript/src/views/business/base/location/multiple-insert.vue index 5ca1736..fcf0f84 100644 --- a/smart-admin-web-typescript/src/views/business/base/location/multiple-insert.vue +++ b/smart-admin-web-typescript/src/views/business/base/location/multiple-insert.vue @@ -19,7 +19,8 @@ - + @@ -209,7 +210,7 @@ async function save() { areaId: form.areaId, locationType: form.locationType }); - const {error, success} = JSON.parse(response.data); + const {error, success} = JSON.parse(response.msg); if (error) { message.error(error); } diff --git a/smart-admin-web-typescript/src/views/business/base/stock/stock-form.vue b/smart-admin-web-typescript/src/views/business/base/stock/stock-form.vue new file mode 100644 index 0000000..09948ba --- /dev/null +++ b/smart-admin-web-typescript/src/views/business/base/stock/stock-form.vue @@ -0,0 +1,157 @@ + + + diff --git a/smart-admin-web-typescript/src/views/business/base/stock/stock-list.vue b/smart-admin-web-typescript/src/views/business/base/stock/stock-list.vue new file mode 100644 index 0000000..c815b49 --- /dev/null +++ b/smart-admin-web-typescript/src/views/business/base/stock/stock-list.vue @@ -0,0 +1,426 @@ + + +