fix:添加标签打印模板
This commit is contained in:
parent
cbbf1ee84f
commit
873c8b1a33
|
|
@ -30,10 +30,19 @@
|
||||||
</el-container>
|
</el-container>
|
||||||
<el-dialog :title="titleMap[type]" v-model="limitedVisible" :width="1000">
|
<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 :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-input v-model="addForm.name" clearable></el-input>
|
||||||
</el-form-item>
|
</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-input v-model="addForm.commands" clearable :rows="9" type="textarea"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
@ -55,7 +64,7 @@
|
||||||
return {
|
return {
|
||||||
apiObj: this.$API.cm.labeltemplate.list,
|
apiObj: this.$API.cm.labeltemplate.list,
|
||||||
selection: [],
|
selection: [],
|
||||||
checkList: [],
|
options: [],
|
||||||
search: {
|
search: {
|
||||||
keyword: null
|
keyword: null
|
||||||
},
|
},
|
||||||
|
|
@ -80,8 +89,15 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
this.getProcess();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getProcess(){
|
||||||
|
let that = this;
|
||||||
|
that.$API.mtm.process.list.req({page:0}).then(res=>{
|
||||||
|
that.options = res;
|
||||||
|
})
|
||||||
|
},
|
||||||
//添加模板
|
//添加模板
|
||||||
labelTemplateAdd(){
|
labelTemplateAdd(){
|
||||||
this.limitedVisible = true;
|
this.limitedVisible = true;
|
||||||
|
|
@ -92,27 +108,21 @@
|
||||||
},
|
},
|
||||||
submitHandle(){
|
submitHandle(){
|
||||||
let that = this;
|
let that = this;
|
||||||
|
|
||||||
this.$refs.addForm.validate( (valid) => {
|
this.$refs.addForm.validate( (valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.isSaveing = true;
|
this.isSaveing = true;
|
||||||
str = [
|
let arr = [];
|
||||||
"SIZE 70 mm,100 mm",
|
arr = that.addForm.commands.split("\n");
|
||||||
"GAP 7 mm,7 mm",
|
that.addForm.commands = arr;
|
||||||
"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;
|
|
||||||
if(this.type==='add'){
|
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.isSaveing = false;
|
||||||
this.limitedVisible = false;
|
this.limitedVisible = false;
|
||||||
this.$refs.table.refresh();
|
this.$refs.table.refresh();
|
||||||
}).catch(e=>{this.isSaveing = false;})
|
}).catch(e=>{this.isSaveing = false;})
|
||||||
}else{
|
}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.isSaveing = false;
|
||||||
this.limitedVisible = false;
|
this.limitedVisible = false;
|
||||||
this.$refs.table.refresh();
|
this.$refs.table.refresh();
|
||||||
|
|
@ -127,14 +137,14 @@
|
||||||
this.type='edit';
|
this.type='edit';
|
||||||
this.addForm.id=row.id;
|
this.addForm.id=row.id;
|
||||||
this.addForm.name=row.name;
|
this.addForm.name=row.name;
|
||||||
this.addForm.commands=row.commands;
|
this.addForm.commands=row.commands.join("\n");
|
||||||
this.limitedVisible = true;
|
this.limitedVisible = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
//删除模板
|
//删除模板
|
||||||
async labelTemplateDel(row){
|
async labelTemplateDel(row){
|
||||||
var id = row.id;
|
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){
|
if(res.err_msg){
|
||||||
this.$message.error(res.err_msg)
|
this.$message.error(res.err_msg)
|
||||||
}else{
|
}else{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue