feat:添加数字识别

This commit is contained in:
shijing 2026-06-03 12:26:36 +08:00
parent 1ee913c8cc
commit a03f42f732
5 changed files with 130 additions and 1 deletions

View File

@ -126,6 +126,14 @@ export default {
data); data);
} }
}, },
get_svs_char: {
name: "获取数据识别",
req: async function(data){
return await http.get(
`${config.API_URL}/em/equipment/get_svs_char/`,
data);
}
}
}, },
//巡检记录 //巡检记录
einspect: { einspect: {

View File

@ -15,6 +15,11 @@
<el-icon-brush :size="26"/> <el-icon-brush :size="26"/>
</el-icon> </el-icon>
</div> </div>
<div class="screen panel-item" @click="ocrSetting" title="数字识别设置">
<el-icon>
<el-icon-view :size="26"/>
</el-icon>
</div>
<scan-dialog ref="scanDialog" :type="'info'" @closed="scanClose"> </scan-dialog> <scan-dialog ref="scanDialog" :type="'info'" @closed="scanClose"> </scan-dialog>
<div class="screen panel-item hidden-sm-and-down" @click="screen"> <div class="screen panel-item hidden-sm-and-down" @click="screen">
<el-icon> <el-icon>
@ -139,6 +144,22 @@
<el-button type="primary" @click="saveCoder">保存</el-button> <el-button type="primary" @click="saveCoder">保存</el-button>
</el-footer> </el-footer>
</el-dialog> </el-dialog>
<el-dialog title="数字识别设置" v-model="setOcrVisible" width="600px">
<el-form label-width="140px">
<el-form-item label="IP">
<el-input v-model="ocr_ip" placeholder="IP"></el-input>
</el-form-item>
<el-form-item label="Port">
<el-input v-model="ocr_port" placeholder="端口号"></el-input>
</el-form-item>
<el-form-item label="unit">
<el-input v-model="ocr_unit" placeholder="位号"></el-input>
</el-form-item>
</el-form>
<el-footer>
<el-button type="primary" @click="saveOcr">保存</el-button>
</el-footer>
</el-dialog>
<el-dialog <el-dialog
v-model="searchVisible" v-model="searchVisible"
:width="700" :width="700"
@ -202,6 +223,7 @@ export default {
visible:false, visible:false,
setNameVisible:false, setNameVisible:false,
setCoderVisible:false, setCoderVisible:false,
setOcrVisible:false,
searchVisible: false, searchVisible: false,
msg: false, msg: false,
msgList: {}, msgList: {},
@ -221,6 +243,9 @@ export default {
coder_field2:'', coder_field2:'',
coder_jobname:'', coder_jobname:'',
coder_jobname2:'', coder_jobname2:'',
ocr_ip:'192.168.1.231',
ocr_port:'80',
ocr_unit:'',
scanVisible:false, scanVisible:false,
addCoderVisible: false, addCoderVisible: false,
addCoderSearch: '', addCoderSearch: '',
@ -252,6 +277,9 @@ export default {
this.coder_field2 = localStorage.getItem("coder_field2") || ""; this.coder_field2 = localStorage.getItem("coder_field2") || "";
this.coder_jobname = localStorage.getItem("coder_jobname") || ""; this.coder_jobname = localStorage.getItem("coder_jobname") || "";
this.coder_jobname2 = localStorage.getItem("coder_jobname2") || ""; this.coder_jobname2 = localStorage.getItem("coder_jobname2") || "";
this.ocr_ip = localStorage.getItem("ocr_ip") || "";
this.ocr_port = localStorage.getItem("ocr_port") || "";
this.ocr_unit = localStorage.getItem("ocr_unit") || "";
}, },
methods: { methods: {
openBook() { openBook() {
@ -365,6 +393,17 @@ export default {
}); });
this.setCoderVisible=false; this.setCoderVisible=false;
}, },
ocrSetting(){
this.setOcrVisible=true;
},
saveOcr(){
this.$TOOL.setOcr({
"ocr_ip":this.ocr_ip,
"ocr_port":this.ocr_port,
"ocr_unit":this.ocr_unit
});
this.setOcrVisible=false;
},
// //
showMsg() { showMsg() {
this.msg = true; this.msg = true;

View File

@ -155,6 +155,11 @@ tool.setCoder = function (val) {
localStorage.setItem('coder_jobname', val.coder_jobname || '') localStorage.setItem('coder_jobname', val.coder_jobname || '')
localStorage.setItem('coder_jobname2', val.coder_jobname2 || '') localStorage.setItem('coder_jobname2', val.coder_jobname2 || '')
} }
tool.setOcr = function (val) {
localStorage.setItem('ocr_ip', val.ocr_ip || '')
localStorage.setItem('ocr_port', val.ocr_port || '')
localStorage.setItem('ocr_unit', val.ocr_unit || '')
}
/* 复制对象 */ /* 复制对象 */
tool.objCopy = function (obj) { tool.objCopy = function (obj) {
return JSON.parse(JSON.stringify(obj)); return JSON.parse(JSON.stringify(obj));

View File

@ -392,7 +392,7 @@
style="width: 100%;height: 500px;" style="width: 100%;height: 500px;"
></check-table> ></check-table>
</el-card> </el-card>
<div style="height: 200px;"></div> <div style="height: 100px;"></div>
<save-dialog <save-dialog
v-if="dialog.save" v-if="dialog.save"
ref="saveDialog" ref="saveDialog"

View File

@ -22,6 +22,7 @@
<el-button type="primary" v-if="!isSubmit&&processType=='20'" @click="check_start">检验</el-button> <el-button type="primary" v-if="!isSubmit&&processType=='20'" @click="check_start">检验</el-button>
<el-button type="primary" v-if="multipleSet" @click="check_set" style="position: absolute;left: 210px;">批量操作</el-button> <el-button type="primary" v-if="multipleSet" @click="check_set" style="position: absolute;left: 210px;">批量操作</el-button>
<el-input v-if="multipleSet" v-model="wprInputText" @change="wprinputChange" style="width:200px;position: absolute;left: 308px;"></el-input> <el-input v-if="multipleSet" v-model="wprInputText" @change="wprinputChange" style="width:200px;position: absolute;left: 308px;"></el-input>
<el-button v-if="multipleSet" type="primary" @click="digital ">数字识别</el-button>
<div style="width:fit-content;position: absolute;right: 0;display: inline-block;"> <div style="width:fit-content;position: absolute;right: 0;display: inline-block;">
<div style="display: flex;align-items: center;gap: 8px;"> <div style="display: flex;align-items: center;gap: 8px;">
<el-link v-if="test_file!==''" :href="test_file" target="_blank">{{ test_file_name }}</el-linK> <el-link v-if="test_file!==''" :href="test_file" target="_blank">{{ test_file_name }}</el-linK>
@ -1118,6 +1119,82 @@ that.$API.wpm.prints.req(printer_ip, obj).then((response) => {
that.wprNumber = ""; that.wprNumber = "";
that.setVisible=true; that.setVisible=true;
}, },
//numbernumber
digital(){
let that = this;
that.ocr_ip = localStorage.getItem("ocr_ip") || "";
that.ocr_port = localStorage.getItem("ocr_port") || "";
that.ocr_unit = localStorage.getItem("ocr_unit") || "";
//number
if(!that.ocr_ip || !that.ocr_port || !that.ocr_unit){
that.$message.warning('请先在右上角"数字识别设置"配置IP、端口号和位号');
return;
}
that.$API.em.equipment.get_svs_char.req({
ip: that.ocr_ip,
port: that.ocr_port,
unit: that.ocr_unit
}).then((res) => {
alert(res);
// if(res.number){
// that.mlogbwlist.forEach((item,index) => {
// if(item.number==res.number){
// let obj = Object.assign({},item);
// obj.isEdit = true;
// that.mlogbwlist.splice(index,1);
// that.wprInputText = "";
// that.mlogbwlist.unshift(obj);
// that.$nextTick(() => {
// that.selectedindexes.push(obj.id);
// that.selectWprList.push(item);
// })
// //
// //
// if(that.qct_testitems.length>0 && !!that.setForm.cd_req_addr){
// that.$API.em.cd.req({method:that.setForm.cd_req_addr}).then((res) => {
// that.qct_testitems.forEach(item0 => {
// if(item0.testitem_cd_expr!=null){
// that.mlogbwlist[index][item0.testitem_name]= eval(item0.testitem_cd_expr);
// that.qct_defects.forEach(item => {
// if(item.rule_expression!==''&&item.rule_expression!==undefined&&item.rule_expression!==null){
// let str = item.rule_expression.replace(/`/g, '');
// str = str.replace(/\${(.*?)}/g, 'row.\$1');
// let judge = false;
// try {
// judge = eval(str);
// that.mlogbwlist[index][item.defect_name] = judge;
// }catch (error) {
// console.error(error);
// }
// }else{
// that.mlogbwlist[index][item.defect_name] = false;
// }
// });
// }
// })
// }).catch((err) => {
// this.$notify.error({
// title: '',
// message: err.data
// })
// return err;
// });
// }
// }
// })
// }
}).catch((err) => {
that.$notify.error({
title: '数字识别获取失败',
message: err.data
})
return err;
});
},
// //
wprinputChange(){ wprinputChange(){
let that = this; let that = this;