# 工艺参数与工艺参数模板 ## 涉及页面 - 工艺参数列表页(新增) - 工艺参数模板列表页(新增) ## API ### 工艺参数 | 方法 | 路径 | 说明 | |------|------|------| | POST | /mes/pd/process-param/create | 创建工艺参数 | | PUT | /mes/pd/process-param/update | 更新工艺参数 | | DELETE | /mes/pd/process-param/delete?id= | 删除工艺参数 | | GET | /mes/pd/process-param/get?id= | 获取工艺参数详情 | | GET | /mes/pd/process-param/page | 分页查询工艺参数 | | GET | /mes/pd/process-param/export-excel | 导出工艺参数 | **创建请求参数:** | 参数 | 类型 | 必填 | 说明 | |------|------|------|------| | paramName | String | 是 | 参数名称 | | paramType | Integer | 否 | 参数类型(字典 mes_pd_process_param_type:1=文本 2=数值 3=布尔 4=日期) | | unitMeasureId | Long | 否 | 计量单位ID | | required | Boolean | 否 | 是否必填,默认false | | remark | String | 否 | 备注 | 注意:参数编码(paramCode)由后端自动生成,前端无需传入。 **响应:** ```json { "code": 200, "data": 1, "msg": "操作成功" } ``` **分页查询参数:** | 参数 | 类型 | 必填 | 说明 | |------|------|------|------| | pageNo | Integer | 是 | 页码 | | pageSize | Integer | 是 | 每页条数 | | paramCode | String | 否 | 参数编码(模糊搜索) | | paramName | String | 否 | 参数名称(模糊搜索) | | paramType | Integer | 否 | 参数类型(精确匹配) | **响应结构:** ```json { "code": 200, "data": { "list": [ { "id": 1, "paramCode": "PP20240001", "paramName": "注塑温度", "paramType": 2, "unitMeasureId": 1, "unitMeasureName": "℃", "required": true, "remark": "", "createTime": "2024-01-01 00:00:00" } ], "total": 1 } } ``` ### 工艺参数模板 | 方法 | 路径 | 说明 | |------|------|------| | POST | /mes/pd/process-param-template/create | 创建工艺参数模板 | | PUT | /mes/pd/process-param-template/update | 更新工艺参数模板 | | DELETE | /mes/pd/process-param-template/delete?id= | 删除工艺参数模板 | | GET | /mes/pd/process-param-template/get?id= | 获取工艺参数模板详情 | | GET | /mes/pd/process-param-template/page | 分页查询工艺参数模板 | | GET | /mes/pd/process-param-template/export-excel | 导出工艺参数模板 | **创建/更新请求参数:** | 参数 | 类型 | 必填 | 说明 | |------|------|------|------| | id | Long | 否 | 编号(更新时必填) | | templateName | String | 是 | 模板名称 | | templateType | Integer | 否 | 模板类型(字典 mes_pd_process_param_template_type:1=通用 2=工序 3=产品) | | remark | String | 否 | 备注 | | details | List\ | 是 | 模板明细列表 | **Detail 结构:** | 参数 | 类型 | 必填 | 说明 | |------|------|------|------| | processParamId | Long | 是 | 工艺参数ID | | required | Boolean | 否 | 是否必填(可覆盖参数默认值) | | remark | String | 否 | 备注(可覆盖参数默认值) | 注意:模板编码(templateCode)由后端自动生成,前端无需传入。模板明细采用快照机制——关联时复制参数值,改变工艺参数列表的值不影响模板。 **响应结构:** ```json { "code": 200, "data": { "id": 1, "templateCode": "PPT20240001", "templateName": "注塑工艺参数模板", "templateType": 2, "remark": "", "createTime": "2024-01-01 00:00:00", "details": [ { "id": 1, "templateId": 1, "processParamId": 1, "paramCode": "PP20240001", "paramName": "注塑温度", "paramType": 2, "unitMeasureId": 1, "unitMeasureName": "℃", "required": true, "remark": "" } ] } } ``` ## 前端修改点 ### 1. 工艺参数列表页 - 新增页面 文件路径:`src/views/mes/pd/processparam/index.vue` ```html 搜索 重置 新增 导出 ``` ### 2. 工艺参数表单弹窗 - 新增/编辑 文件路径:`src/views/mes/pd/processparam/ProcessParamForm.vue` ```html ``` ### 3. data 数据 ```js const queryParams = reactive({ pageNo: 1, pageSize: 10, paramCode: undefined, paramName: undefined, paramType: undefined, }) const formData = reactive({ id: undefined, paramName: undefined, paramType: undefined, unitMeasureId: undefined, required: false, remark: undefined, }) ``` ### 4. 工艺参数模板列表页 - 新增页面 文件路径:`src/views/mes/pd/processparamtemplate/index.vue` ```html 搜索 重置 ``` ### 5. 工艺参数模板表单弹窗(含明细) 文件路径:`src/views/mes/pd/processparamtemplate/ProcessParamTemplateForm.vue` ```html 添加参数 ``` ### 6. API 接口定义 文件路径:`src/api/mes/pd/processparam/index.ts` ```ts import request from '@/config/axios' // 创建工艺参数 export const createProcessParam = (data) => { return request.post({ url: '/mes/pd/process-param/create', data }) } // 更新工艺参数 export const updateProcessParam = (data) => { return request.put({ url: '/mes/pd/process-param/update', data }) } // 删除工艺参数 export const deleteProcessParam = (id: number) => { return request.delete({ url: '/mes/pd/process-param/delete?id=' + id }) } // 获取工艺参数 export const getProcessParam = (id: number) => { return request.get({ url: '/mes/pd/process-param/get?id=' + id }) } // 获取工艺参数分页 export const getProcessParamPage = (params) => { return request.get({ url: '/mes/pd/process-param/page', params }) } // 导出工艺参数 Excel export const exportProcessParamExcel = (params) => { return request.download({ url: '/mes/pd/process-param/export-excel', params }) } ``` 文件路径:`src/api/mes/pd/processparamtemplate/index.ts` ```ts import request from '@/config/axios' // 创建工艺参数模板 export const createProcessParamTemplate = (data) => { return request.post({ url: '/mes/pd/process-param-template/create', data }) } // 更新工艺参数模板 export const updateProcessParamTemplate = (data) => { return request.put({ url: '/mes/pd/process-param-template/update', data }) } // 删除工艺参数模板 export const deleteProcessParamTemplate = (id: number) => { return request.delete({ url: '/mes/pd/process-param-template/delete?id=' + id }) } // 获取工艺参数模板 export const getProcessParamTemplate = (id: number) => { return request.get({ url: '/mes/pd/process-param-template/get?id=' + id }) } // 获取工艺参数模板分页 export const getProcessParamTemplatePage = (params) => { return request.get({ url: '/mes/pd/process-param-template/page', params }) } // 导出工艺参数模板 Excel export const exportProcessParamTemplateExcel = (params) => { return request.download({ url: '/mes/pd/process-param-template/export-excel', params }) } ``` ## 注意事项 - **快照机制**:模板关联工艺参数时,后端会复制参数的当前值到模板明细中。之后修改工艺参数的名称、类型、单位等,不会影响已关联的模板。这是设计上要求的"改变工艺参数列表的值不能影响模板的变化"。 - **参数编码和模板编码**由后端自动生成,前端创建时不需要传入。 - 工艺参数类型字典:`mes_pd_process_param_type`(1=文本、2=数值、3=布尔、4=日期) - 工艺参数模板类型字典:`mes_pd_process_param_template_type`(1=通用、2=工序、3=产品) - 计量单位下拉框需要调用 MDM 模块的计量单位列表接口获取数据 - 模板表单中的明细行,选择工艺参数后会自动带出参数编码、名称、类型、单位等信息