feat:禅道422
This commit is contained in:
parent
78ccfaf84b
commit
01f8fb6665
|
|
@ -10,6 +10,11 @@
|
||||||
<el-icon-postcard :size="26"/>
|
<el-icon-postcard :size="26"/>
|
||||||
</el-icon>
|
</el-icon>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="screen panel-item" @click="openAddCoder" title="补喷码">
|
||||||
|
<el-icon>
|
||||||
|
<el-icon-brush :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>
|
||||||
|
|
@ -145,6 +150,41 @@
|
||||||
<search @success="searchVisible = false"></search>
|
<search @success="searchVisible = false"></search>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
<scan-detail ref="scanDetails" v-if="scanVisible" :mlogId="scanId"></scan-detail>
|
<scan-detail ref="scanDetails" v-if="scanVisible" :mlogId="scanId"></scan-detail>
|
||||||
|
|
||||||
|
<!-- 补喷码弹窗 -->
|
||||||
|
<el-dialog title="补喷码" v-model="addCoderVisible" width="720px" destroy-on-close>
|
||||||
|
<div style="display:flex;gap:8px;margin-bottom:16px">
|
||||||
|
<el-input
|
||||||
|
v-model="addCoderSearch"
|
||||||
|
placeholder="输入板号搜索"
|
||||||
|
clearable
|
||||||
|
style="width:320px"
|
||||||
|
@keyup.enter="searchWpr"
|
||||||
|
/>
|
||||||
|
<el-button type="primary" :loading="addCoderSearching" @click="searchWpr">搜索</el-button>
|
||||||
|
</div>
|
||||||
|
<el-table :data="wprList" v-loading="addCoderSearching" border size="small">
|
||||||
|
<el-table-column label="板号" prop="number" min-width="120" />
|
||||||
|
<el-table-column label="物料名称" min-width="160" show-overflow-tooltip>
|
||||||
|
<template #default="scope">{{ (scope.row.material_name || '').split('|')[0] }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="批次号" prop="wm_batch" min-width="130" />
|
||||||
|
<el-table-column label="操作" width="180" align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button
|
||||||
|
type="success" size="small"
|
||||||
|
:loading="!!addCoderLoadingMap[scope.row.id + '_1']"
|
||||||
|
@click="addCoderSend(scope.row, 'coder_jobname', 'coder_field', '1')"
|
||||||
|
>喷数字</el-button>
|
||||||
|
<el-button
|
||||||
|
type="primary" size="small"
|
||||||
|
:loading="!!addCoderLoadingMap[scope.row.id + '_2']"
|
||||||
|
@click="addCoderSend(scope.row, 'coder_jobname2', 'coder_field2', '2')"
|
||||||
|
>喷二维码</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
@ -182,6 +222,11 @@ export default {
|
||||||
coder_jobname:'',
|
coder_jobname:'',
|
||||||
coder_jobname2:'',
|
coder_jobname2:'',
|
||||||
scanVisible:false,
|
scanVisible:false,
|
||||||
|
addCoderVisible: false,
|
||||||
|
addCoderSearch: '',
|
||||||
|
addCoderSearching: false,
|
||||||
|
wprList: [],
|
||||||
|
addCoderLoadingMap: {},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
|
@ -333,6 +378,67 @@ export default {
|
||||||
search() {
|
search() {
|
||||||
this.searchVisible = true;
|
this.searchVisible = true;
|
||||||
},
|
},
|
||||||
|
openAddCoder() {
|
||||||
|
this.addCoderVisible = true;
|
||||||
|
this.addCoderSearch = '';
|
||||||
|
this.wprList = [];
|
||||||
|
},
|
||||||
|
async searchWpr() {
|
||||||
|
const kw = this.addCoderSearch.trim();
|
||||||
|
if (!kw) { this.$message.warning('请输入板号'); return; }
|
||||||
|
this.addCoderSearching = true;
|
||||||
|
try {
|
||||||
|
const res = await this.$API.wpm.wpr.list.req({ number: kw, page: 0 });
|
||||||
|
const list = Array.isArray(res) ? res : (res && res.results) || [];
|
||||||
|
this.wprList = list;
|
||||||
|
if (!list.length) this.$message.warning('未找到相关板号');
|
||||||
|
} finally {
|
||||||
|
this.addCoderSearching = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
addCoderSend(row, coderJobNameKey, coderFieldKey, suffix) {
|
||||||
|
const that = this;
|
||||||
|
const key = row.id + '_' + suffix;
|
||||||
|
if (that.addCoderLoadingMap[key]) return;
|
||||||
|
const coder_ip = localStorage.getItem('coder_ip') || '';
|
||||||
|
if (!coder_ip) {
|
||||||
|
that.$message.error('请先在右上角"喷码设置"配置喷码IP');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
that.addCoderLoadingMap = { ...that.addCoderLoadingMap, [key]: true };
|
||||||
|
const release = () => {
|
||||||
|
const m = { ...that.addCoderLoadingMap };
|
||||||
|
delete m[key];
|
||||||
|
that.addCoderLoadingMap = m;
|
||||||
|
};
|
||||||
|
const coder_port = localStorage.getItem('coder_port') || '';
|
||||||
|
const coder_field = localStorage.getItem(coderFieldKey) || '';
|
||||||
|
const templateName = '喷码模板';
|
||||||
|
const tdata = {
|
||||||
|
number: row.number,
|
||||||
|
name: (row.material_name || '').split('|')[0],
|
||||||
|
ofrom_name: row.wm_material_ofrom_name || '',
|
||||||
|
ofrom_batch: row.wm_batch || '',
|
||||||
|
};
|
||||||
|
that.$API.cm.labeltemplate.list.req({ name: templateName, page: 0 }).then(res => {
|
||||||
|
const list = Array.isArray(res) ? res : (res && res.results) || [];
|
||||||
|
const template = list.find(t => t.name === templateName);
|
||||||
|
if (!template) {
|
||||||
|
that.$message.error(`未找到标签模板: ${templateName}`);
|
||||||
|
return Promise.reject(new Error('no_template'));
|
||||||
|
}
|
||||||
|
const body = { tdata_list: [tdata], coder_ip };
|
||||||
|
if (coder_port) body.coder_port = Number(coder_port);
|
||||||
|
if (coder_field) body.coder_field = coder_field;
|
||||||
|
const coder_jobname = localStorage.getItem(coderJobNameKey) || '';
|
||||||
|
if (coder_jobname) body.coder_jobname = coder_jobname;
|
||||||
|
return that.$API.cm.labeltemplate.sendToCoder.req(template.id, body);
|
||||||
|
}).then(() => {
|
||||||
|
that.$message.success('喷码下发成功');
|
||||||
|
}).catch(e => {
|
||||||
|
if (e && e.message !== 'no_template') that.$message.error('喷码下发失败');
|
||||||
|
}).finally(release);
|
||||||
|
},
|
||||||
scanClose(data){
|
scanClose(data){
|
||||||
|
|
||||||
let that = this;
|
let that = this;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue