fix:添加标签打印模板
This commit is contained in:
parent
cbbf1ee84f
commit
873c8b1a33
|
@ -30,10 +30,19 @@
|
|||
</el-container>
|
||||
<el-dialog :title="titleMap[type]" v-model="limitedVisible" :width="1000">
|
||||
<el-form :model="addForm" :rules="rules" ref="addForm" label-width="100px" label-position="left">
|
||||
<el-form-item label="模板名称" prop="name" auto>
|
||||
<el-form-item label="模板名称" prop="name">
|
||||
<el-input v-model="addForm.name" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="模板代码" prop="commands" auto>
|
||||
<el-form-item label="绑定工序">
|
||||
<el-select v-model="addForm.process_json" filterable multiple clearable style="width: 100%;">
|
||||
<el-option
|
||||
v-for="item in options"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
:key="item.id"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="模板代码" prop="commands">
|
||||
<el-input v-model="addForm.commands" clearable :rows="9" type="textarea"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
@ -55,7 +64,7 @@
|
|||
return {
|
||||
apiObj: this.$API.cm.labeltemplate.list,
|
||||
selection: [],
|
||||
checkList: [],
|
||||
options: [],
|
||||
search: {
|
||||
keyword: null
|
||||
},
|
||||
|
@ -80,8 +89,15 @@
|
|||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getProcess();
|
||||
},
|
||||
methods: {
|
||||
getProcess(){
|
||||
let that = this;
|
||||
that.$API.mtm.process.list.req({page:0}).then(res=>{
|
||||
that.options = res;
|
||||
})
|
||||
},
|
||||
//添加模板
|
||||
labelTemplateAdd(){
|
||||
this.limitedVisible = true;
|
||||
|
@ -92,27 +108,21 @@
|
|||
},
|
||||
submitHandle(){
|
||||
let that = this;
|
||||
|
||||
this.$refs.addForm.validate( (valid) => {
|
||||
if (valid) {
|
||||
this.isSaveing = true;
|
||||
str = [
|
||||
"SIZE 70 mm,100 mm",
|
||||
"GAP 7 mm,7 mm",
|
||||
"CLS",
|
||||
"REFERENCE 0,0",
|
||||
'QRCODE 30,400,H,5,A,0,"' +code +'"',
|
||||
"WINTEXT 240,550,28,90,0,0,Simhei," + row.number,
|
||||
"PRINT 1",
|
||||
];
|
||||
let res;
|
||||
let arr = [];
|
||||
arr = that.addForm.commands.split("\n");
|
||||
that.addForm.commands = arr;
|
||||
if(this.type==='add'){
|
||||
this.$API.system.labelTemplate.create.req(that.addForm).then(res=>{
|
||||
this.$API.cm.labeltemplate.create.req(that.addForm).then(res=>{
|
||||
this.isSaveing = false;
|
||||
this.limitedVisible = false;
|
||||
this.$refs.table.refresh();
|
||||
}).catch(e=>{this.isSaveing = false;})
|
||||
}else{
|
||||
this.$API.system.labelTemplate.update.req(that.addForm.id,that.addForm).then(res=>{
|
||||
this.$API.cm.labeltemplate.update.req(that.addForm.id,that.addForm).then(res=>{
|
||||
this.isSaveing = false;
|
||||
this.limitedVisible = false;
|
||||
this.$refs.table.refresh();
|
||||
|
@ -127,14 +137,14 @@
|
|||
this.type='edit';
|
||||
this.addForm.id=row.id;
|
||||
this.addForm.name=row.name;
|
||||
this.addForm.commands=row.commands;
|
||||
this.addForm.commands=row.commands.join("\n");
|
||||
this.limitedVisible = true;
|
||||
},
|
||||
|
||||
//删除模板
|
||||
async labelTemplateDel(row){
|
||||
var id = row.id;
|
||||
var res = await this.$API.system.labelTemplate.delete.req(id);
|
||||
var res = await this.$API.cm.labeltemplate.delete.req(id);
|
||||
if(res.err_msg){
|
||||
this.$message.error(res.err_msg)
|
||||
}else{
|
||||
|
|
Loading…
Reference in New Issue