From 3c620f4dfa3d2667515432078bffac228bd7cd62 Mon Sep 17 00:00:00 2001 From: zwq Date: Wed, 21 Aug 2024 11:42:23 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BB=93=E5=BA=93?= =?UTF-8?q?=E3=80=81=E7=89=A9=E6=96=99=E3=80=81=E7=8F=AD=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/warehouse/warehouse-area-setup.js | 8 + src/api/warehouse/warehouse-location-setup.js | 9 +- src/api/warehouse/warehouseRealtime.js | 8 + src/mixins/basic-add.js | 121 ++++++++++++ src/mixins/basic-page.js | 175 ++++++++++++++++++ src/mixins/code-filter.js | 73 ++++++++ src/views/base/coreCustomer/add-or-updata.vue | 2 +- src/views/base/coreCustomer/index.vue | 25 +-- src/views/base/coreSupplier/add-or-updata.vue | 8 +- src/views/base/coreSupplier/index.vue | 52 +++--- src/views/group/base/groupClasses/index.vue | 6 +- src/views/group/base/groupTeam/index.vue | 2 +- .../group/base/schedulingPlanConfig/index.vue | 4 +- .../group/base/schedulingRuleConfig/index.vue | 8 +- src/views/material/material/add-or-updata.vue | 4 +- src/views/material/material/index.vue | 34 +--- .../material/materialDate/add-or-updata.vue | 4 +- src/views/material/materialDate/index.vue | 23 +-- .../materialProductBom/add-or-updata.vue | 4 +- .../material/materialProductBom/index.vue | 5 +- .../material/materialUseLog/add-or-updata.vue | 4 +- src/views/material/materialUseLog/index.vue | 36 +--- src/views/material/mixins/code-filter.js | 2 +- .../warehouse-area-setup/add-or-updata.vue | 2 +- .../warehouse-area-setup/index.vue | 8 +- .../add-or-updata.vue | 19 +- .../warehouse-location-setup/index.vue | 8 +- .../warehouse-setup/add-or-updata.vue | 2 +- .../warehouse-base/warehouse-setup/index.vue | 6 +- .../in&out-nothing/add-or-updata.vue | 2 +- .../warehouse-manage/in&out-nothing/index.vue | 2 +- .../in&out-nothing/product-mini.vue | 2 +- .../warehouse-manage/in&out/add-or-updata.vue | 2 +- .../warehouse-manage/in&out/attr-add.vue | 1 + .../warehouse-manage/in&out/drawer.vue | 42 ++++- .../warehouse-manage/in&out/index.vue | 4 +- .../warehouse-report/inventoryList/index.vue | 87 +++------ .../locationList/add-or-updata.vue | 82 +++++--- .../warehouse-report/locationList/index.vue | 136 ++++---------- .../relocationHistory/add-or-updata.vue | 105 ++++++----- .../relocationHistory/index.vue | 36 ++-- .../warehouse-report/warehouseHis/index.vue | 6 +- .../warehouseLocationHis/add-or-updata.vue | 112 +++++------ .../warehouseLocationHis/index.vue | 33 ++-- 44 files changed, 805 insertions(+), 509 deletions(-) create mode 100644 src/mixins/basic-add.js create mode 100644 src/mixins/basic-page.js create mode 100644 src/mixins/code-filter.js diff --git a/src/api/warehouse/warehouse-area-setup.js b/src/api/warehouse/warehouse-area-setup.js index b347597e..24108449 100644 --- a/src/api/warehouse/warehouse-area-setup.js +++ b/src/api/warehouse/warehouse-area-setup.js @@ -49,6 +49,14 @@ export function getWarehouseAreaList(id) { }) } +// 获得库区设置列表 +export function getWarehouseAreaListAll() { + return request({ + url: '/extend/warehouse-area/listAll', + method: 'get' + }) +} + // 获得库区设置分页 export function getWarehouseAreaPage(query) { return request({ diff --git a/src/api/warehouse/warehouse-location-setup.js b/src/api/warehouse/warehouse-location-setup.js index ab75d29f..671acbb0 100644 --- a/src/api/warehouse/warehouse-location-setup.js +++ b/src/api/warehouse/warehouse-location-setup.js @@ -2,7 +2,7 @@ * @Author: zwq * @Date: 2023-11-02 16:20:15 * @LastEditors: zwq - * @LastEditTime: 2024-08-08 15:56:30 + * @LastEditTime: 2024-08-21 11:03:14 * @Description: */ import request from '@/utils/request' @@ -41,6 +41,13 @@ export function getWarehouseLocation(id) { }) } +// 库位存储详情 +export function getStoreInfo(id) { + return request({ + url: '/extend/warehouse-location/getStoreInfo?id=' + id, + method: 'get' + }) +} // 获得库位设置列表 export function getWarehouseLocationTree() { return request({ diff --git a/src/api/warehouse/warehouseRealtime.js b/src/api/warehouse/warehouseRealtime.js index 4ce73e64..cc4a06b7 100644 --- a/src/api/warehouse/warehouseRealtime.js +++ b/src/api/warehouse/warehouseRealtime.js @@ -63,6 +63,14 @@ export function getWarehouseRealtimePage(data) { }) } +// 获得库存列表分页 +export function inventoryPage(data) { + return request({ + url: '/extend/warehouse-realtime/allPage', + method: 'post', + data: data + }) +} // 获得出入库-无库位-历史分页 export function getWarehouseRealtimeHisPage(data) { return request({ diff --git a/src/mixins/basic-add.js b/src/mixins/basic-add.js new file mode 100644 index 00000000..7538902f --- /dev/null +++ b/src/mixins/basic-add.js @@ -0,0 +1,121 @@ +/* + * @Author: zwq + * @Date: 2022-08-24 11:19:43 + * @LastEditors: zwq + * @LastEditTime: 2023-11-02 15:33:39 + * @Description: + */ +import { listData } from "@/api/system/dict/data"; +export default { + data() { + /* eslint-disable */ + return { + urlOptions: { + createURL: '', + updateURL: '', + infoURL: '', + codeURL: '', + getOption: false, //是否加载获取下拉框方法 + isGetCode: false, //是否加载获取code方法 + getDictList: false, //是否加载获取数据字典方法 + optionArrUrl: [], //需要获取下拉框的方法数组 + optionArr: {}, //需要获取下拉框的方法数组的返回结果 + dictList: {}, //需要获取数据字典的方法数组的返回结果 + }, + visible: false, + setData: false + } + }, + created() { + }, + activated() { + }, + methods: { + init(id) { + this.dataForm.id = id || ""; + this.visible = true; + if (this.urlOptions.getOption) { + this.getArr() + } + if (this.urlOptions.getDictList) { + this.getDict() + } + this.$nextTick(() => { + this.$refs["dataForm"].resetFields(); + if (this.dataForm.id) { + this.urlOptions.infoURL(id).then(response => { + this.dataForm = response.data; + if (this.setData) { + this.setDataForm() + } + }); + } else { + if (this.urlOptions.isGetCode) { + this.getCode() + } + } + }); + }, + getCode() { + this.urlOptions.codeURL() + .then(({ data: res }) => { + this.dataForm.code = res; + }) + .catch(() => {}); + }, + getArr() { + const params = { + pageSize: 100, + pageNo: 1, + } + this.urlOptions.optionArrUrl.forEach((item, index) => { + item(params).then(({ data: res }) => { + this.$set(this.urlOptions.optionArr, `arr${index}`, res.list) + }) + .catch(() => { + }); + }); + }, + /** 查询字典数据列表 */ + getDict() { + this.nameList.forEach((item,index)=>{ + const queryParams = { + pageNo: 1, + pageSize: 99, + dictType: item, + } + listData(queryParams).then(response => { + this.$set(this.urlOptions.dictList, `dict${index}`, response.data.list) + }); + }) + }, + // 表单提交 + dataFormSubmit() { + this.$refs["dataForm"].validate((valid) => { + if (!valid) { + return false; + } + // 修改的提交 + if (this.dataForm.id) { + this.urlOptions.updateURL(this.dataForm).then(response => { + this.$modal.msgSuccess("修改成功"); + this.visible = false; + this.$emit("refreshDataList"); + }); + return; + } + // 添加的提交 + this.urlOptions.createURL(this.dataForm).then(response => { + this.$modal.msgSuccess("新增成功"); + this.visible = false; + this.$emit("refreshDataList"); + }); + }); + }, + formClear() { + if (this.$refs.dataForm!==undefined) { + this.$refs.dataForm.resetFields(); + } + } + } +} diff --git a/src/mixins/basic-page.js b/src/mixins/basic-page.js new file mode 100644 index 00000000..1261a4bf --- /dev/null +++ b/src/mixins/basic-page.js @@ -0,0 +1,175 @@ +/* + * @Author: zwq + * @Date: 2022-08-24 11:19:43 + * @LastEditors: zwq + * @LastEditTime: 2024-08-14 15:17:01 + * @Description: + */ +export default { + data() { + /* eslint-disable */ + return { + urlOptions: { + getDataListURL: '', + deleteURL: '', + statusUrl: '', + exportURL: '' + }, + tableData: [], + listQuery: { + pageSize: 20, + pageNo: 1, + total: 1, + }, + exportLoading: false, + dataListLoading: false, + addOrEditTitle: '', + addOrUpdateVisible: false, + addOrUpdate: 'addOrUpdate' + } + }, + created() { + }, + mounted() { + this.getDataList() + }, + methods: { + // 获取数据列表 + getDataList() { + this.dataListLoading = true; + this.urlOptions.getDataListURL(this.listQuery).then(response => { + if (response.hasOwnProperty('data')) { + this.tableData = response.data.list; + this.listQuery.total = response.data.total; + } else { + this.tableData = [] + } + this.dataListLoading = false; + }); + }, + // 每页数 + sizeChangeHandle(val) { + this.listQuery.pageSize = val; + this.listQuery.pageNo = 1; + this.getDataList(); + }, + // 当前页 + currentChangeHandle(val) { + this.listQuery.pageNo = val; + this.getDataList(); + }, + // 新增 / 修改 + addOrUpdateHandle(id) { + this.addOrUpdateVisible = true; + this.$nextTick(() => { + this.$refs.addOrUpdate.init(id); + }); + }, + cancel(id) { + this.$refs["popover-" + id].showPopper = false; + }, + //改变状态 + changeStatus(id) { + this.$http + .post(this.urlOptions.statusUrl, { id }) + .then(({ data: res }) => { + if (res.code !== 0) { + return this.$message.error(res.msg); + } + this.$refs["popover-" + id].showPopper = false; + this.$message({ + message: this.$t("prompt.success"), + type: "success", + duration: 500, + onClose: () => { + this.getDataList(); + }, + }); + }) + .catch(() => { }); + }, + //tableBtn点击 + handleClick(val) { + if (val.type === "edit") { + this.addOrUpdateVisible = true; + this.addOrEditTitle = "编辑"; + this.$nextTick(() => { + this.$refs.addOrUpdate.init(val.data.id); + }); + } else if (val.type === "delete") { + if (val.data.name) { + this.deleteHandle(val.data.id, val.data.name) + } else { + this.setDelete(val.data) + } + } else if (val.type === "change") { + this.changeStatus(val.data.id) + } else { + this.otherMethods(val) + } + }, + // 删除 + deleteHandle(id, name) { + this.$modal + .delConfirm(name) + .then(() => { + this.urlOptions.deleteURL(id).then(({ data }) => { + this.$message({ + message: "操作成功", + type: "success", + duration: 1500, + onClose: () => { + this.getDataList(); + }, + }); + }); + }) + .catch(() => { }); + }, + //search-bar点击 + buttonClick(val) { + switch (val.btnName) { + case "search": + this.listQuery.xm1 = val.xm1; + this.listQuery.xm2 = val.xm2; + this.listQuery.pageNo = 1; + this.getDataList(); + break; + case "add": + this.addOrEditTitle = '新增' + this.addOrUpdateVisible = true; + this.addOrUpdateHandle() + break; + default: + console.log(val) + } + }, + handleCancel() { + this.$refs[this.addOrUpdate].formClear() + this.addOrUpdateVisible = false + this.addOrEditTitle = '' + this.addOrUpdate = 'addOrUpdate' + }, + handleConfirm() { + this.$refs[this.addOrUpdate].dataFormSubmit() + }, + successSubmit() { + this.handleCancel() + this.getDataList() + }, + /** 导出按钮操作 */ + handleExport() { + // 处理查询参数 + let params = { ...this.queryParams }; + params.pageNo = undefined; + params.pageSize = undefined; + this.$modal.confirm('是否确认导出所有数据项?').then(() => { + this.exportLoading = true; + return this.urlOptions.exportURL(params); + }).then(response => { + this.$download.excel(response, '报表.xls'); + this.exportLoading = false; + }).catch(() => { }); + } + } +} diff --git a/src/mixins/code-filter.js b/src/mixins/code-filter.js new file mode 100644 index 00000000..bcf45631 --- /dev/null +++ b/src/mixins/code-filter.js @@ -0,0 +1,73 @@ + +/* + * @Date: 2020-12-29 16:49:28 + * @LastEditors: zwq + * @LastEditTime: 2024-08-21 11:14:58 + * @FilePath: \basic-admin\src\filters\basicData\index.js + * @Description: + */ + +const table = { + lineStatus: { + 1: '生产中', + 2: '停止', + 3: '未知', + }, + deactivate: { + 1: '启用', + 0: '停用', + }, + reportType: { + 1: '日', + 2: '周', + 3: '月' + } +} + +// 日期格式化 +export function parseTime(time, pattern) { + if (arguments.length === 0 || !time) { + return null + } + const format = pattern || '{y}-{m}-{d} {h}:{i}:{s}' + let date + if (typeof time === 'object') { + date = time + } else { + if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) { + time = parseInt(time) + } else if (typeof time === 'string') { + time = time.replace(new RegExp(/-/gm), '/').replace('T', ' ').replace(new RegExp(/\.\d{3}/gm),''); + } + if ((typeof time === 'number') && (time.toString().length === 10)) { + time = time * 1000 + } + date = new Date(time) + } + const formatObj = { + y: date.getFullYear(), + m: date.getMonth() + 1, + d: date.getDate(), + h: date.getHours(), + i: date.getMinutes(), + s: date.getSeconds(), + a: date.getDay() + } + const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => { + let value = formatObj[key] + // Note: getDay() returns 0 on Sunday + if (key === 'a') { + return ['日', '一', '二', '三', '四', '五', '六'][value] + } + if (result.length > 0 && value < 10) { + value = '0' + value + } + return value || 0 + }) + return time_str +} +export default function (dictTable) { + return function (val) { + return table?.[dictTable]?.[val] + } +} diff --git a/src/views/base/coreCustomer/add-or-updata.vue b/src/views/base/coreCustomer/add-or-updata.vue index 5156cc42..beb4463f 100644 --- a/src/views/base/coreCustomer/add-or-updata.vue +++ b/src/views/base/coreCustomer/add-or-updata.vue @@ -53,7 +53,7 @@ diff --git a/src/views/material/materialProductBom/add-or-updata.vue b/src/views/material/materialProductBom/add-or-updata.vue index 5ad32648..24ae435d 100644 --- a/src/views/material/materialProductBom/add-or-updata.vue +++ b/src/views/material/materialProductBom/add-or-updata.vue @@ -2,7 +2,7 @@ * @Author: zwq * @Date: 2021-11-18 14:16:25 * @LastEditors: zwq - * @LastEditTime: 2024-08-08 16:47:36 + * @LastEditTime: 2024-08-14 15:26:32 * @Description: --> diff --git a/src/views/material/materialUseLog/add-or-updata.vue b/src/views/material/materialUseLog/add-or-updata.vue index 1f2cdce2..7086e6b9 100644 --- a/src/views/material/materialUseLog/add-or-updata.vue +++ b/src/views/material/materialUseLog/add-or-updata.vue @@ -2,7 +2,7 @@ * @Author: zwq * @Date: 2021-11-18 14:16:25 * @LastEditors: zwq - * @LastEditTime: 2024-08-05 16:13:52 + * @LastEditTime: 2024-08-14 15:27:50 * @Description: --> - diff --git a/src/views/warehouse/warehouse-report/relocationHistory/add-or-updata.vue b/src/views/warehouse/warehouse-report/relocationHistory/add-or-updata.vue index 61d669ec..39c488a8 100644 --- a/src/views/warehouse/warehouse-report/relocationHistory/add-or-updata.vue +++ b/src/views/warehouse/warehouse-report/relocationHistory/add-or-updata.vue @@ -2,64 +2,67 @@ * @Author: zwq * @Date: 2021-11-18 14:16:25 * @LastEditors: zwq - * @LastEditTime: 2024-08-09 17:00:46 + * @LastEditTime: 2024-08-21 09:30:48 * @Description: -->