为工作站增加二维码显示功能

This commit is contained in:
yinjinlu-pc\尹金路 2024-09-06 09:53:23 +08:00
parent 8c913e67a1
commit 288b93ac17
2 changed files with 132 additions and 46 deletions

View File

@ -224,11 +224,13 @@
</el-row> </el-row>
</el-col> </el-col>
<el-col :span="10"> <el-col :span="10">
<el-image class="barcodeClass" fit="scale-down" :src="form.barcodeUrl"> <div class="flex-container">
<div slot="error" class="image-slot"> <el-image class="barcodeClass" fit="scale-down" :src="form.barcodeUrl">
<i class="el-icon-picture-outline"></i> <div slot="error" class="image-slot">
</div> <i class="el-icon-picture-outline"></i>
</el-image> </div>
</el-image>
</div>
</el-col> </el-col>
</el-row> </el-row>
@ -665,7 +667,9 @@ export default {
this.barcodeParams.bussinessId = this.form.vendorId; this.barcodeParams.bussinessId = this.form.vendorId;
this.barcodeParams.bussinessCode = this.form.vendorCode; this.barcodeParams.bussinessCode = this.form.vendorCode;
getBarcodeUrl(this.barcodeParams).then( response =>{ getBarcodeUrl(this.barcodeParams).then( response =>{
this.$set(this.form,'barcodeUrl',response.data.barcodeUrl);//DOM if(response.data != null){
this.$set(this.form,'barcodeUrl',response.data.barcodeUrl);//DOM
}
}); });
}, },
// //
@ -686,6 +690,14 @@ export default {
.barcodeClass { .barcodeClass {
width: 200px; width: 200px;
height: 200px; height: 200px;
border: 1px dashed;
position: relative;
display: inline-block;
} }
.flex-container{
display: flex;
justify-content: center; /* 水平居中 */
align-items: center; /* 垂直居中 */
}
</style> </style>

View File

@ -156,43 +156,60 @@
<el-dialog :title="title" :visible.sync="open" width="960px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="960px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px"> <el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-row> <el-row>
<el-col :span="8"> <el-col :span="14">
<el-form-item label="工作站编号" prop="workstationCode"> <el-row>
<el-input v-model="form.workstationCode" placeholder="请输入工作站编码" /> <el-col :span="16">
</el-form-item> <el-form-item label="工作站编号" prop="workstationCode">
<el-input v-model="form.workstationCode" placeholder="请输入工作站编码" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label-width="80">
<el-switch v-model="autoGenFlag"
active-color="#13ce66"
active-text="自动生成"
@change="handleAutoGenChange(autoGenFlag)" v-if="optType != 'view'">
</el-switch>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="工作站名称" prop="workstationName">
<el-input v-model="form.workstationName" placeholder="请输入工作站名称" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="工作站地点" prop="workstationAddress">
<el-input v-model="form.workstationAddress" placeholder="请输入工作站地点" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="所在车间" prop="workshopId">
<el-select v-model="form.workshopId" placeholder="请选择车间">
<el-option
v-for="item in workshopOptions"
:key="item.workshopId"
:label="item.workshopName"
:value="item.workshopId"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-col> </el-col>
<el-col :span="4"> <el-col :span="10">
<el-form-item label-width="80"> <div class="flex-container">
<el-switch v-model="autoGenFlag" <el-image class="barcodeClass" fit="scale-down" :src="form.barcodeUrl">
active-color="#13ce66" <div slot="error" class="image-slot">
active-text="自动生成" <i class="el-icon-picture-outline"></i>
@change="handleAutoGenChange(autoGenFlag)" v-if="optType != 'view'"> </div>
</el-switch> </el-image>
</el-form-item> </div>
</el-col>
<el-col :span="12">
<el-form-item label="工作站名称" prop="workstationName">
<el-input v-model="form.workstationName" placeholder="请输入工作站名称" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="工作站地点" prop="workstationAddress">
<el-input v-model="form.workstationAddress" placeholder="请输入工作站地点" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="所在车间" prop="workshopId">
<el-select v-model="form.workshopId" placeholder="请选择车间">
<el-option
v-for="item in workshopOptions"
:key="item.workshopId"
:label="item.workshopName"
:value="item.workshopId"
></el-option>
</el-select>
</el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
@ -294,6 +311,7 @@ import {getTreeList} from "@/api/mes/wm/warehouse"
import {listAllProcess} from "@/api/mes/pro/process"; import {listAllProcess} from "@/api/mes/pro/process";
import {genCode} from "@/api/system/autocode/rule"; import {genCode} from "@/api/system/autocode/rule";
import { listAllWorkshop } from "@/api/mes/md/workshop"; import { listAllWorkshop } from "@/api/mes/md/workshop";
import { getBarcodeUrl } from "@/api/mes/wm/barcode";
export default { export default {
name: "Workstation", name: "Workstation",
dicts: ['sys_yes_no'], dicts: ['sys_yes_no'],
@ -350,8 +368,36 @@ export default {
areaId: null, areaId: null,
enableFlag: null, enableFlag: null,
}, },
//
barcodeParams: {
bussinessId: null,
bussinessCode: null,
barcodeFormart: 'QR_CODE', //
barcodeType: 'WORKSTATION' //
},
// //
form: {}, form: {
workstationId: null,
workstationCode: null,
workstationName: null,
workstationAddress: null,
workshopId: null,
workshopCode: null,
workshopName: null,
processId: null,
processCode: null,
processName: null,
warehouseId: null,
locationId: null,
areaId: null,
enableFlag: 'Y',
remark: null,
barcodeUrl: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
},
// //
rules: { rules: {
workstationCode: [ workstationCode: [
@ -449,6 +495,7 @@ export default {
areaId: null, areaId: null,
enableFlag: 'Y', enableFlag: 'Y',
remark: null, remark: null,
barcodeUrl: null,
createBy: null, createBy: null,
createTime: null, createTime: null,
updateBy: null, updateBy: null,
@ -508,6 +555,7 @@ export default {
this.open = true; this.open = true;
this.title = "查看车间信息"; this.title = "查看车间信息";
this.optType = "view"; this.optType = "view";
this.getBarcodeUrl();
}); });
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
@ -520,6 +568,7 @@ export default {
this.open = true; this.open = true;
this.title = "修改工作站"; this.title = "修改工作站";
this.optType = "edit"; this.optType = "edit";
this.getBarcodeUrl();
}); });
}, },
/** 提交按钮 */ /** 提交按钮 */
@ -589,7 +638,32 @@ export default {
// //
handleToolTypeAdd(){ handleToolTypeAdd(){
this.$refs.toolList.handleAdd(); this.$refs.toolList.handleAdd();
} },
//
getBarcodeUrl(){
this.barcodeParams.bussinessId = this.form.workstationId;
this.barcodeParams.bussinessCode = this.form.workstationCode;
getBarcodeUrl(this.barcodeParams).then( response =>{
if(response.data != null){
this.$set(this.form,'barcodeUrl',response.data.barcodeUrl);//DOM
}
});
},
} }
}; };
</script> </script>
<style scoped>
.barcodeClass {
width: 200px;
height: 200px;
border: 1px dashed;
position: relative;
display: inline-block;
}
.flex-container{
display: flex;
justify-content: center; /* 水平居中 */
align-items: center; /* 垂直居中 */
}
</style>