From b85b12209d3e8a84558469153210bb94b6dd13a3 Mon Sep 17 00:00:00 2001 From: jinna Date: Thu, 5 Mar 2026 18:28:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A7=BD=E6=B6=B2=E4=BF=A1=E6=81=AF=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E5=86=85=E5=AE=B9=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/basicData/calculationFormula.js | 8 + src/api/basicData/ruleMaintenance.js | 76 ++++ src/api/tankSolutionSystem/info.js | 10 +- src/api/tankSolutionSystem/resultsCon.js | 10 + src/utils/tankclac.js | 159 ++++++++ .../components/addEditDosing.vue | 85 ++--- .../calculationFormula/tankDosing.vue | 1 + .../calculationFormula/theoreticalValue.vue | 1 + .../basicData/components/addRuleDialog.vue | 352 ++++++++++++++++++ src/views/basicData/ruleMaintenance.vue | 352 ++++++++++++++++++ .../basic/qualityGrade.vue | 49 ++- .../components/addEditInfoDialog.vue | 24 +- .../components/batchDialog.vue | 56 ++- .../components/disposeDialog.vue | 6 +- .../tankSolutionSystem/info.vue | 32 +- .../tankSolutionSystem/inspectionReport.vue | 63 ++-- .../tankSolutionSystem/workTankLine.vue | 8 +- .../tankSolutionSystem/workTankManagement.vue | 4 + 18 files changed, 1196 insertions(+), 100 deletions(-) create mode 100644 src/api/basicData/ruleMaintenance.js create mode 100644 src/utils/tankclac.js create mode 100644 src/views/basicData/components/addRuleDialog.vue create mode 100644 src/views/basicData/ruleMaintenance.vue diff --git a/src/api/basicData/calculationFormula.js b/src/api/basicData/calculationFormula.js index a65d169..2897b21 100644 --- a/src/api/basicData/calculationFormula.js +++ b/src/api/basicData/calculationFormula.js @@ -31,4 +31,12 @@ export const deleteFormula = params => url: '/api/blade-desk/BA/Formula/remove', method: 'post', params + }) + +// 获取分析项目下拉 +export const getSelectFormula = (params) => + request({ + url: '/api/blade-desk/QA/LiquidTank/listForSelectDistinct', + method: 'get', + params }) \ No newline at end of file diff --git a/src/api/basicData/ruleMaintenance.js b/src/api/basicData/ruleMaintenance.js new file mode 100644 index 0000000..6e8f4b8 --- /dev/null +++ b/src/api/basicData/ruleMaintenance.js @@ -0,0 +1,76 @@ +import request from '@/axios'; + +// 工艺能力下拉 +export const getCapability = () =>{ + return request({ + url:'/api/blade-desk/BA/craftAbility/findList', + method:'get' + }) +} + +// 生产标识下拉 +export const getProduction = () =>{ + return request({ + url:'/api/blade-scheduling/qualityGrade/getGrades', + method:'get' + }) +} + +// 外协厂商下拉 +export const getOutsourcing = () =>{ + return request({ + url:'/api/blade-desk/BA/Oem/listForSelect', + method:'get' + }) +} + +// 作业中心下拉 +export const getWorkCenter = () =>{ + return request({ + url:'/api/blade-desk/BA/WorkCenter/listForSelect', + method:'get' + }) +} + +// 分派规则列表 +export const getList = (params) => { + return request({ + url: '/api/blade-desk/bsAssign/page', + method: 'get', + params + }); +}; + +// 获取指定类型字典 +export const getPointRule = () => { + return request({ + url: '/api/blade-system/dict/dictionary?code=AssignPoint', + method: 'get', + }); +}; + +// 获取限制类型字典 +export const getLimitRule = () => { + return request({ + url: '/api/blade-system/dict/dictionary?code=AssignLimit', + method: 'get', + }); +}; + +// 保存分派规则 +export const saveRules = (data) => { + return request({ + url: '/api/blade-desk/bsAssign/saveBat', + method: 'post', + data, + }); +}; + +// 删除分派规则 +export const deleteRules = (params) => { + return request({ + url: '/api/blade-desk/bsAssign/remove', + method: 'post', + params, + }); +}; \ No newline at end of file diff --git a/src/api/tankSolutionSystem/info.js b/src/api/tankSolutionSystem/info.js index 6b3110d..7a6b4cd 100644 --- a/src/api/tankSolutionSystem/info.js +++ b/src/api/tankSolutionSystem/info.js @@ -111,4 +111,12 @@ export const issueInfo = (params) =>{ method:"post", params }) -} \ No newline at end of file +} + +// 获取物料下拉 +export const getSelectMaterial = (params) => + request({ + url: '/api/blade-wms/stGoodsNew/listForStGoods', + method: 'get', + params + }) \ No newline at end of file diff --git a/src/api/tankSolutionSystem/resultsCon.js b/src/api/tankSolutionSystem/resultsCon.js index 100ebb9..a606f95 100644 --- a/src/api/tankSolutionSystem/resultsCon.js +++ b/src/api/tankSolutionSystem/resultsCon.js @@ -79,4 +79,14 @@ export const getLineList = (params) =>{ method:'get', params }) +} + +// 检验报告导出 +export const exportReport = (params) =>{ + return request({ + url:'/api/blade-desk/QA/LiquidTankTaskCopy/exportData', + method:'get', + params, + responseType: 'blob', + }) } \ No newline at end of file diff --git a/src/utils/tankclac.js b/src/utils/tankclac.js new file mode 100644 index 0000000..44b3afb --- /dev/null +++ b/src/utils/tankclac.js @@ -0,0 +1,159 @@ +export function calcTank(data,row,equation){ + + // 1. 获取最后一条 + const lastItem = row; + const tankId = lastItem.workTankId; + + // 2. 构建同 tankId 的药剂映射 + const chemMap = {}; + data.forEach(item => { + if (item.workTankId === tankId) { + chemMap[item.testElement] = { + actualAddValue: item.actualAddValue || 0, + fillingLocation: item.fillingLocation || 0, + firstTestValue:item.firstTestValue || 0 + }; + } + }); + + // 3. 本条自身值 + const self = { + '实际添加量': row.actualAddValue || 0, + '体积': row.volume || 0, + '测量值': row.firstTestValue || 0, + '添加点': row.fillingLocation || 0 + }; + + // 4. 替换公式 + let formula = equation + + // 替换 <药剂名>实际添加量 和 <药剂名>添加点,找不到则为 0 + formula = formula.replace(/([^\s+*/\-(){}[\]]+?)(实际添加量|添加点|测量值)/g, (match, name, suffix) => { + const chem = chemMap[name]; + console.log('name--------',name) + console.log('chem--------',chem) + if(name != ''){ + if (chem) { + if (suffix === '实际添加量') { + return String(chem.actualAddValue); + } else if (suffix === '添加点') { + return String(chem.fillingLocation); + }else if (suffix === '测量值') { + return String(chem.firstTestValue); + } + // return String(suffix === '实际添加量' ? chem.actualValue : chem.addPoint); + }else{ + return '0' + } + }else{ + return '0' + } + + // return '0'; // 未找到,替换为 0 + }); + + // 替换通用字段 + const globalReplacements = { + '实际添加量': self['实际添加量'], + '体积': self['体积'], + '测量值': self['测量值'], + '添加点': self['添加点'], + }; + + for (const [key, value] of Object.entries(globalReplacements)) { + const escapedKey = key.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); + formula = formula.replace(new RegExp(escapedKey, 'g'), String(value)); + } + + // 5. 转为合法 JS 表达式 + let expr = formula + .replace(/{/g, '(') + .replace(/}/g, ')') + .replace(/\s+/g, ''); + console.log('expo--------',expr) + return expr; + + // const tankId = row.workTankId; + + // // 2. 构建同 tankId 下 name -> { actualAddValue, fillingLocation } + // const chemMap = {}; + // data.forEach(item => { + // if (item.workTankId === tankId) { + // chemMap[item.testElement] = { + // actualAddValue: item.actualAddValue || 0, + // fillingLocation: item.fillingLocation || 0, + // firstTestValue:item.firstTestValue || 0 + // }; + // } + // }); + + // // 3. 本条自身值 + // const self = { + // '实际添加量': row.actualAddValue || 0, + // '体积': row.volume || 0, + // '测量值': row.firstTestValue || 0, + // '添加点': row.fillingLocation || 0 + // }; + + // // 4. 复制公式 + // let formula = equation; + + // // 5. 先处理 "<药剂名>实际添加量" 和 "<药剂名>添加点" + // // 使用正则匹配:连续非运算符字符 + "实际添加量" 或 "添加点" + // formula = formula.replace(/([^\s+*/\-(){}[\]]+?)(实际添加量|添加点|添加量|测量值)/g, (match, name, suffix) => { + // const chem = chemMap[name]; + // console.log('chem---------',chem) + // // if (chem) { + // // return String(suffix === '实际添加量' ? chem.actualValue : chem.addPoint); + // // } else { + // // // 未找到对应药剂,替换为 0 + // // return '0'; + // // } + // if (chem) { + // if (suffix === '实际添加量') { + // return String(chem.actualAddValue); + // } else if (suffix === '添加点') { + // return String(chem.fillingLocation); + // }else if (suffix === '添加量') { + // return String(chem.actualAddValue); + // }else if (suffix === '测量值') { + // return String(chem.firstTestValue); + // } + // } + // // 如果找不到,保留原样(避免破坏公式) + // return match; + // }); + + // // 6. 再替换通用字段(注意顺序:先长后短,但这里无包含关系) + // const globalReplacements = { + // '实际添加量': self['实际添加量'], + // '体积': self['体积'], + // '测量值': self['测量值'], + // '添加点': self['添加点'], + // }; + + // for (const [key, value] of Object.entries(globalReplacements)) { + // // 转义特殊字符(虽然中文一般不需要,但安全起见) + // const escapedKey = key.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); + // const regex = new RegExp(escapedKey, 'g'); + // formula = formula.replace(regex, String(value)); + // } + // let jsExpr = formula + // .replace(/{/g, '(') + // .replace(/}/g, ')') + // .replace(/\s+/g, ''); // 去掉空格(可选,但更安全) + // return jsExpr; +} + +export function safeEval(expr) { + // 只允许数字、括号、+ - * / . 等安全字符 + if (!/^[\d+\-*/().]+$/.test(expr)) { + throw new Error("公式包含非法字符"); + } + try { + // 使用 Function 而非 eval 更安全(无作用域访问) + return new Function('return (' + expr + ')')(); + } catch (e) { + throw new Error("公式计算失败: " + e.message); + } + } \ No newline at end of file diff --git a/src/views/basicData/calculationFormula/components/addEditDosing.vue b/src/views/basicData/calculationFormula/components/addEditDosing.vue index 272d7f0..81e22f4 100644 --- a/src/views/basicData/calculationFormula/components/addEditDosing.vue +++ b/src/views/basicData/calculationFormula/components/addEditDosing.vue @@ -33,6 +33,11 @@ + + + + + + + \ No newline at end of file diff --git a/src/views/basicData/ruleMaintenance.vue b/src/views/basicData/ruleMaintenance.vue new file mode 100644 index 0000000..207f995 --- /dev/null +++ b/src/views/basicData/ruleMaintenance.vue @@ -0,0 +1,352 @@ + + + + + \ No newline at end of file diff --git a/src/views/productionSchedulingPlan/basic/qualityGrade.vue b/src/views/productionSchedulingPlan/basic/qualityGrade.vue index d05aba1..1b271cf 100644 --- a/src/views/productionSchedulingPlan/basic/qualityGrade.vue +++ b/src/views/productionSchedulingPlan/basic/qualityGrade.vue @@ -55,7 +55,7 @@ export default { calcHeight: 32, simplePage: false, searchShow: true, - searchMenuSpan: 6, + searchMenuSpan: 18, searchIcon: true, searchIndex: 3, tree: false, @@ -108,6 +108,38 @@ export default { label: '类型', prop: 'type', search: true, + hide:true, + display:false, + sortable: true, + span: 12, + type:'select', + rules: [ + { + required: true, + message: '请选择', + trigger: 'blur', + }, + ], + dicData:[ + { + label:'军品', + value:'1' + }, + { + label:'商飞', + value:'2' + }, + { + label:'宇航', + value:'3' + } + ] + }, + { + label: '类型', + prop: 'type', + search: false, + multiple: true, sortable: true, span: 12, type:'select', @@ -148,7 +180,12 @@ export default { done(); }, rowSave(row, done, loading) { - addGualityGrade(row).then( + console.log(row); + let params = { + qualityGrade:row.qualityGrade, + types:row.type + } + addGualityGrade(params).then( () => { this.onLoad(this.page); this.$message({ @@ -164,7 +201,13 @@ export default { ); }, rowUpdate(row, index, done, loading) { - updateGualityGrade(row).then( + // row.types = row.type + let params = { + id:row.id, + qualityGrade:row.qualityGrade, + types:row.type.split(',') + } + updateGualityGrade(params).then( () => { this.onLoad(this.page); this.$message({ diff --git a/src/views/qualityManagement/tankSolutionSystem/components/addEditInfoDialog.vue b/src/views/qualityManagement/tankSolutionSystem/components/addEditInfoDialog.vue index 7907389..55d636c 100644 --- a/src/views/qualityManagement/tankSolutionSystem/components/addEditInfoDialog.vue +++ b/src/views/qualityManagement/tankSolutionSystem/components/addEditInfoDialog.vue @@ -134,15 +134,14 @@ - - - + + - + @@ -263,7 +262,7 @@