From 48e9f706257fe6f184bb357024a5b883cf3bd302 Mon Sep 17 00:00:00 2001 From: zwq Date: Fri, 28 Nov 2025 16:27:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/ssdl/product&recipe.js | 19 +- src/mixins/basic-page.js | 4 +- src/views/login.vue | 2 +- .../product&recipe/product/add-or-updata.vue | 18 +- src/views/product&recipe/product/index.vue | 12 +- .../product&recipe/recipe/add-or-updata.vue | 170 +++++-------- src/views/product&recipe/recipe/attr-add.vue | 83 +++---- src/views/product&recipe/recipe/index.vue | 231 ++++++++++-------- .../product&recipe/recipe/product-mini.vue | 85 +++++++ 9 files changed, 355 insertions(+), 269 deletions(-) create mode 100644 src/views/product&recipe/recipe/product-mini.vue diff --git a/src/api/ssdl/product&recipe.js b/src/api/ssdl/product&recipe.js index 408b1fa5..dfe0b5aa 100644 --- a/src/api/ssdl/product&recipe.js +++ b/src/api/ssdl/product&recipe.js @@ -2,7 +2,7 @@ * @Author: zwq * @Date: 2025-11-17 09:25:12 * @LastEditors: zwq - * @LastEditTime: 2025-11-19 13:11:54 + * @LastEditTime: 2025-11-28 09:29:14 * @Description: */ import request from '@/utils/request' @@ -52,7 +52,15 @@ export function createProduct(data) { // 获得工艺分页 export function getProcessPage(query) { return request({ - url: '/wms/process/page', + url: '/wms/process/page/group/by', + method: 'get', + params: query + }) +} +// 获得工艺点击展开表格 +export function getProcessDetailPage(query) { + return request({ + url: '/wms/process/page/group/by/detail', method: 'get', params: query }) @@ -64,6 +72,13 @@ export function deleteProcess(id) { method: 'delete' }) } +// 批量删除工艺 +export function deleteProcessList(ids) { + return request({ + url: '/wms/process/delete-list?ids=' + ids, + method: 'delete' + }) +} // 更新 export function updateProcess(data) { return request({ diff --git a/src/mixins/basic-page.js b/src/mixins/basic-page.js index 978497c4..1ac38a03 100644 --- a/src/mixins/basic-page.js +++ b/src/mixins/basic-page.js @@ -2,7 +2,7 @@ * @Author: zwq * @Date: 2022-08-24 11:19:43 * @LastEditors: zwq - * @LastEditTime: 2025-11-19 13:20:30 + * @LastEditTime: 2025-11-28 09:35:03 * @Description: */ export default { @@ -16,7 +16,7 @@ export default { }, tableData: [], //table数据 listQuery: { //分页 - pageSize: 10, + pageSize: 20, pageNo: 1, total: 1, }, diff --git a/src/views/login.vue b/src/views/login.vue index c412f3c1..cbe54e4a 100644 --- a/src/views/login.vue +++ b/src/views/login.vue @@ -284,7 +284,7 @@ export default { mobile: '', mobileCode: '', rememberMe: false, - tenantName: '技术中心', + tenantName: '芋道源码', }, scene: 21, diff --git a/src/views/product&recipe/product/add-or-updata.vue b/src/views/product&recipe/product/add-or-updata.vue index 15282c6f..eef8a936 100644 --- a/src/views/product&recipe/product/add-or-updata.vue +++ b/src/views/product&recipe/product/add-or-updata.vue @@ -2,7 +2,7 @@ * @Author: zwq * @Date: 2021-11-18 14:16:25 * @LastEditors: zwq - * @LastEditTime: 2025-11-18 15:01:42 + * @LastEditTime: 2025-11-28 14:38:31 * @Description: --> @@ -122,9 +109,8 @@ import { updateProcess, createProcess, getProcess, - getProcessMaterialPage, - deleteProcessMaterial, - getProductPage, + getProcessDetailPage, + deleteProcess, } from '@/api/ssdl/product&recipe'; import productAttrAdd from './attr-add'; import { parseTime } from '@/filter/code-filter'; @@ -146,17 +132,17 @@ const tableProps = [ label: '添加时间', filter: parseTime, }, - { - prop: 'equipmentName', - label: '设备名称', - }, { prop: 'materialName', - label: '原料名称', + label: '物料型号', }, { - prop: 'quantity', - label: '数量', + prop: 'material', + label: '物料规格', + }, + { + prop: 'materialNumber', + label: '物料数量', }, ]; @@ -171,41 +157,30 @@ export default { productAttributeList: [], dataForm: { id: null, - processName: '', // 配方名称 - processCode: '', // 配方编码 + processName: '', // 配方型号 + processSize: '', // 配方规格 processDesc: '', // 配方描述 - materialId: '', // 物料id - materialName: '', // 物料名称 - materialCode: '', // 物料编码 }, - productArr: [], listQuery: { pageSize: 10, pageNo: 1, total: 0, }, dataRule: { - processCode: [ + processSize: [ { required: true, - message: '配方编码不能为空', + message: '配方规格不能为空', trigger: 'blur', }, ], processName: [ { required: true, - message: '配方名称不能为空', + message: '配方型号不能为空', trigger: 'blur', }, ], - materialId: [ - { - required: true, - message: '物料不能为空', - trigger: 'change', - }, - ], }, isdetail: false, }; @@ -217,9 +192,6 @@ export default { }, init(id, isdetail) { this.initData(); - getProductPage({ pageNo: 1, pageSize: 100 }).then((res) => { - this.productArr = res.data.list; - }); this.isdetail = isdetail || false; this.dataForm.id = id || null; this.visible = true; @@ -228,31 +200,26 @@ export default { this.$refs['dataForm'].resetFields(); if (this.dataForm.id) { - // 获取产品详情 + // 获取物料详情 getProcess(id).then((response) => { this.dataForm = response.data; + // 获取物料的属性列表 + this.getList(); }); - // 获取产品的属性列表 - this.getList(); } }); }, - setMaterial() { - const data = this.productArr.find( - (i) => i.id === this.dataForm.materialId - ); - this.dataForm.materialName = data.materialName; - this.dataForm.materialCode = data.materialCode; - }, getList() { - // 获取产品的属性列表 - getProcessMaterialPage({ - ...this.listQuery, - productId: this.dataForm.id, + // 获取物料的属性列表 + getProcessDetailPage({ + processName: this.dataForm.processName, + processSize: this.dataForm.processSize, + pageSize: 100, + pageNo: 1, + total: 1, }).then((response) => { - this.productAttributeList = response.data.list; - this.listQuery.total = response.data.total; + this.productAttributeList = response.data; }); }, handleClick(raw) { @@ -271,7 +238,7 @@ export default { } ) .then(() => { - deleteProcessMaterial(raw.data.id).then(({ data }) => { + deleteProcess(raw.data.id).then(({ data }) => { this.$message({ message: '操作成功', type: 'success', @@ -291,31 +258,30 @@ export default { dataFormSubmit() { this.$refs['dataForm'].validate((valid) => { if (valid) { - // 修改的提交 - if (this.dataForm.id) { - updateProcess(this.dataForm).then((response) => { - this.$modal.msgSuccess('修改成功'); - this.visible = false; - this.$emit('refreshDataList'); - }); + if ( + !this.productAttributeList || + !(this.productAttributeList.length > 0) + ) { + this.$modal.msg('物料属性不能为空'); return; } + this.productAttributeList.forEach((item) => { + item.processName = this.dataForm.processName; + item.processSize = this.dataForm.processSize; + item.processDesc = this.dataForm.processDesc; + }); + // 修改的提交 + updateProcess(this.productAttributeList).then((response) => { + this.$modal.msgSuccess('提交成功'); + this.visible = false; + this.$emit('refreshDataList'); + }); + return; // 添加的提交 - createProcess(this.dataForm).then((response) => { + createProcess(this.productAttributeList).then((response) => { this.$modal.msgSuccess('新增成功'); - this.$confirm(`是否新增产品属性?`, '系统提示', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', - }) - .then(() => { - this.dataForm.id = response.data; - this.addNew(); - }) - .catch(() => { - this.visible = false; - this.$emit('refreshDataList'); - }); + this.visible = false; + this.$emit('refreshDataList'); }); } }); @@ -325,14 +291,10 @@ export default { }, // 新增 / 修改 addNew(id) { - if (this.dataForm.id) { - this.addOrUpdateVisible = true; - this.$nextTick(() => { - this.$refs.addOrUpdate.init(id); - }); - } else { - this.$message('请先创建配方!'); - } + this.addOrUpdateVisible = true; + this.$nextTick(() => { + this.$refs.addOrUpdate.init(id, this.dataForm); + }); }, goback() { this.$emit('refreshDataList'); diff --git a/src/views/product&recipe/recipe/attr-add.vue b/src/views/product&recipe/recipe/attr-add.vue index 1c6e9973..42127466 100644 --- a/src/views/product&recipe/recipe/attr-add.vue +++ b/src/views/product&recipe/recipe/attr-add.vue @@ -19,7 +19,7 @@ :rules="dataRule" label-width="100px" @keyup.enter.native="dataFormSubmit()"> - + + + placeholder="请选择物料"> - + @@ -64,61 +67,56 @@ + + diff --git a/src/views/product&recipe/recipe/product-mini.vue b/src/views/product&recipe/recipe/product-mini.vue new file mode 100644 index 00000000..3f1e5bd1 --- /dev/null +++ b/src/views/product&recipe/recipe/product-mini.vue @@ -0,0 +1,85 @@ + + + + -- 2.49.1