feat:禅道436
This commit is contained in:
parent
1f1088fbd5
commit
6e93de20a3
|
|
@ -101,6 +101,14 @@ export default {
|
|||
`${config.API_URL}/cm/labeltemplate/${id}/send_to_coder/`,
|
||||
data);
|
||||
}
|
||||
},
|
||||
sendToHanslaser:{
|
||||
name: "下发到激光",
|
||||
req: async function(id, data){
|
||||
return await http.post(
|
||||
`${config.API_URL}/cm/labeltemplate/${id}/send_to_hanslaser/`,
|
||||
data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,25 +1,41 @@
|
|||
<template>
|
||||
<div class="user-bar">
|
||||
<div class="screen panel-item" @click="printerSetting">
|
||||
<el-icon>
|
||||
<el-icon-printer :size="26"/>
|
||||
</el-icon>
|
||||
</div>
|
||||
<div class="screen panel-item" @click="coderSetting" title="喷码设置">
|
||||
<el-icon>
|
||||
<el-icon-postcard :size="26"/>
|
||||
</el-icon>
|
||||
</div>
|
||||
<el-dropdown
|
||||
class="screen panel-item"
|
||||
trigger="click"
|
||||
@command="handleSettingCommand"
|
||||
>
|
||||
<div class="setting-trigger" title="设置">
|
||||
<el-icon>
|
||||
<el-icon-setting color="#fff" :size="26"/>
|
||||
</el-icon>
|
||||
</div>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item command="printer">
|
||||
<el-icon><el-icon-printer/></el-icon>
|
||||
<span style="margin-left:6px">打印设置</span>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item command="coder">
|
||||
<el-icon><el-icon-postcard/></el-icon>
|
||||
<span style="margin-left:6px">喷码设置</span>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item command="ocr">
|
||||
<el-icon><el-icon-view/></el-icon>
|
||||
<span style="margin-left:6px">数字识别设置</span>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item command="marker">
|
||||
<el-icon><el-icon-edit-pen/></el-icon>
|
||||
<span style="margin-left:6px">打码设置</span>
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
<div class="screen panel-item" @click="openAddCoder" title="补喷码">
|
||||
<el-icon>
|
||||
<el-icon-brush :size="26"/>
|
||||
</el-icon>
|
||||
</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>
|
||||
<div class="screen panel-item hidden-sm-and-down" @click="screen">
|
||||
<el-icon>
|
||||
|
|
@ -160,6 +176,22 @@
|
|||
<el-button type="primary" @click="saveOcr">保存</el-button>
|
||||
</el-footer>
|
||||
</el-dialog>
|
||||
<el-dialog title="打码设置" v-model="setMarkerVisible" width="600px">
|
||||
<el-form label-width="140px">
|
||||
<el-form-item label="打码IP">
|
||||
<el-input v-model="marker_ip" placeholder="打码机器分配的IP地址"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="打码端口">
|
||||
<el-input v-model="marker_port" placeholder="打码机器分配的端口号"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="数字码模板名">
|
||||
<el-input v-model="marker_jobname" placeholder="打码机信息模板名, 如 Barcode"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-footer>
|
||||
<el-button type="primary" @click="saveMarker">保存</el-button>
|
||||
</el-footer>
|
||||
</el-dialog>
|
||||
<el-dialog
|
||||
v-model="searchVisible"
|
||||
:width="700"
|
||||
|
|
@ -224,6 +256,7 @@ export default {
|
|||
setNameVisible:false,
|
||||
setCoderVisible:false,
|
||||
setOcrVisible:false,
|
||||
setMarkerVisible:false,
|
||||
searchVisible: false,
|
||||
msg: false,
|
||||
msgList: {},
|
||||
|
|
@ -246,6 +279,9 @@ export default {
|
|||
ocr_ip:'192.168.1.231',
|
||||
ocr_port:'80',
|
||||
ocr_unit:'',
|
||||
marker_ip:'',
|
||||
marker_port:'',
|
||||
marker_jobname:'',
|
||||
scanVisible:false,
|
||||
addCoderVisible: false,
|
||||
addCoderSearch: '',
|
||||
|
|
@ -280,6 +316,9 @@ export default {
|
|||
this.ocr_ip = localStorage.getItem("ocr_ip") || "";
|
||||
this.ocr_port = localStorage.getItem("ocr_port") || "";
|
||||
this.ocr_unit = localStorage.getItem("ocr_unit") || "";
|
||||
this.marker_ip = localStorage.getItem("marker_ip") || "";
|
||||
this.marker_port = localStorage.getItem("marker_port") || "";
|
||||
this.marker_jobname = localStorage.getItem("marker_jobname") || "";
|
||||
},
|
||||
methods: {
|
||||
openBook() {
|
||||
|
|
@ -369,6 +408,12 @@ export default {
|
|||
var element = document.documentElement;
|
||||
this.$TOOL.screen(element);
|
||||
},
|
||||
handleSettingCommand(command){
|
||||
if(command === 'printer') this.printerSetting();
|
||||
else if(command === 'coder') this.coderSetting();
|
||||
else if(command === 'ocr') this.ocrSetting();
|
||||
else if(command === 'marker') this.markerSetting();
|
||||
},
|
||||
printerSetting(){
|
||||
this.setNameVisible=true;
|
||||
},
|
||||
|
|
@ -404,6 +449,17 @@ export default {
|
|||
});
|
||||
this.setOcrVisible=false;
|
||||
},
|
||||
markerSetting(){
|
||||
this.setMarkerVisible=true;
|
||||
},
|
||||
saveMarker(){
|
||||
this.$TOOL.setMarker({
|
||||
"marker_ip":this.marker_ip,
|
||||
"marker_port":this.marker_port,
|
||||
"marker_jobname":this.marker_jobname
|
||||
});
|
||||
this.setMarkerVisible=false;
|
||||
},
|
||||
//显示短消息
|
||||
showMsg() {
|
||||
this.msg = true;
|
||||
|
|
|
|||
|
|
@ -160,6 +160,11 @@ tool.setOcr = function (val) {
|
|||
localStorage.setItem('ocr_port', val.ocr_port || '')
|
||||
localStorage.setItem('ocr_unit', val.ocr_unit || '')
|
||||
}
|
||||
tool.setMarker = function (val) {
|
||||
localStorage.setItem('marker_ip', val.marker_ip || '')
|
||||
localStorage.setItem('marker_port', val.marker_port || '')
|
||||
localStorage.setItem('marker_jobname', val.marker_jobname || '')
|
||||
}
|
||||
/* 复制对象 */
|
||||
tool.objCopy = function (obj) {
|
||||
return JSON.parse(JSON.stringify(obj));
|
||||
|
|
|
|||
|
|
@ -95,6 +95,7 @@
|
|||
>
|
||||
<template #default="scope">
|
||||
<el-button v-if="mode=='ins'&&mgroupName=='毛坯检测后打码'" @click="QRCode(scope.row)" type="success">二维码</el-button>
|
||||
<el-button v-if="mode=='ins'&&mgroupName=='毛坯检测'" @click="sendToMarker(scope.row)" type="success" :loading="!!markerLoadingIds[scope.row.id]" :disabled="!!markerLoadingIds[scope.row.id]">打码</el-button>
|
||||
<span v-if="mode=='ins'&&mgroupName=='喷码'"></span>
|
||||
<el-button v-else @click="printMaterial(scope.row)" type="primary">打签</el-button>
|
||||
<el-button @click="sendToCoder(scope.row,'coder_jobname','coder_field')" type="success" v-if="mode=='ins'&&mgroupName=='喷码'" :loading="!!coderLoadingIds[scope.row.id]" :disabled="!!coderLoadingIds[scope.row.id]">喷数字码</el-button>
|
||||
|
|
@ -182,6 +183,7 @@ export default {
|
|||
printer_name:localStorage.getItem("printer_name"),
|
||||
apiObjPrint:this.$API.cm.labelmat.fromWm,
|
||||
coderLoadingIds:{},
|
||||
markerLoadingIds:{},
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
|
|
@ -480,6 +482,41 @@ export default {
|
|||
return that.$API.cm.labeltemplate.sendToCoder.req(template.id, body);
|
||||
});
|
||||
},
|
||||
//下发打码: 单行入队 1 条
|
||||
sendToMarker(row){
|
||||
let that = this;
|
||||
if (that.markerLoadingIds[row.id]) return;
|
||||
let marker_ip = localStorage.getItem('marker_ip') || '';
|
||||
if (!marker_ip) {
|
||||
that.$message.error('请先在右上角"打码设置"配置打码IP');
|
||||
return;
|
||||
}
|
||||
let release = () => {
|
||||
let map = { ...that.markerLoadingIds };
|
||||
delete map[row.id];
|
||||
that.markerLoadingIds = map;
|
||||
};
|
||||
that.markerLoadingIds = { ...that.markerLoadingIds, [row.id]: true };
|
||||
let templateName = '打码模板';
|
||||
that.$API.cm.labeltemplate.list.req({name: templateName, page: 0}).then((res) => {
|
||||
let list = Array.isArray(res) ? res : (res && res.results) || [];
|
||||
let template = list.find(t => t.name === templateName);
|
||||
if (!template) {
|
||||
that.$message.error(`未找到标签模板: ${templateName}`);
|
||||
return Promise.reject(new Error('no template'));
|
||||
}
|
||||
let body = { tdata_list: [{number: row.number}], marker_ip };
|
||||
let marker_port = localStorage.getItem('marker_port') || '';
|
||||
let marker_jobname = localStorage.getItem('marker_jobname') || '';
|
||||
if (marker_port) body.marker_port = Number(marker_port);
|
||||
if (marker_jobname) body.marker_jobname = marker_jobname;
|
||||
return that.$API.cm.labeltemplate.sendToHanslaser.req(template.id, body);
|
||||
}).then(() => {
|
||||
that.$message.success('打码下发成功');
|
||||
}).catch(e => {
|
||||
if (e && e.message !== 'no template') that.$message.error('打码下发失败');
|
||||
}).finally(release);
|
||||
},
|
||||
openSplit() {
|
||||
let that = this;
|
||||
let data = {
|
||||
|
|
|
|||
Loading…
Reference in New Issue