二维码回显问题改为组件

This commit is contained in:
xw88 2024-11-25 15:06:49 +08:00
parent b4cec0c147
commit ef18e8b2a7
5 changed files with 69 additions and 82 deletions

View File

@ -154,7 +154,7 @@
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['mes:dv:machinery:remove']"
>删除</el-button>
>删除</el-button>
</template>
</el-table-column>
</el-table>
@ -231,13 +231,7 @@
</el-row>
</el-col>
<el-col :span="10">
<div class="flex-container">
<el-image class="barcodeClass" fit="scale-down" :src="form.barcodeUrl?form.barcodeUrl.toString():''">
<div slot="error" class="image-slot">
<i class="el-icon-picture-outline"></i>
</div>
</el-image>
</div>
<BarcodeImg ref="barcodeImg" :bussinessId="form.machineryId" :bussinessCode="form.machineryCode" barcodeType="MACHINERY"></BarcodeImg>
</el-col>
</el-row>
<el-row>
@ -304,12 +298,13 @@ import {genCode} from "@/api/system/autocode/rule"
import { getToken } from "@/utils/auth";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import BarcodeImg from "@/components/barcodeImg/index.vue"
import {getBarcodeUrl} from "@/api/mes/wm/barcode";
export default {
name: "Machinery",
dicts: ['sys_yes_no','mes_machinery_status'],
components: { Treeselect },
components: { Treeselect,BarcodeImg },
data() {
return {
//
@ -484,7 +479,7 @@ export default {
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
updateTime: null
};
this.autoGenFlag = false;
this.resetForm("form");
@ -516,7 +511,9 @@ export default {
this.open = true;
this.title = "查看设备信息";
this.optType = "view";
this.getBarcodeUrl();
this.$nextTick(()=>{
this.$refs.barcodeImg.getBarcode();
})
});
},
/** 新增按钮操作 */
@ -543,19 +540,12 @@ export default {
this.open = true;
this.title = "修改设备";
this.optType = "edit";
this.getBarcodeUrl();
});
},
//
getBarcodeUrl(){
this.barcodeParams.bussinessId = this.form.machineryId;
this.barcodeParams.bussinessCode = this.form.machineryCode;
getBarcodeUrl(this.barcodeParams).then( response =>{
if(response.data != null){
this.$set(this.form,'barcodeUrl',response.data.barcodeUrl);//DOM
}
this.$nextTick(()=>{
this.$refs.barcodeImg.getBarcode();
})
});
},
/** 提交按钮 */
submitForm: function() {
this.$refs["form"].validate(valid => {
@ -645,4 +635,4 @@ export default {
position: relative;
display: inline-block;
}
</style>
</style>

View File

@ -246,13 +246,7 @@
</el-row>
</el-col>
<el-col :span="10">
<div class="flex-container">
<el-image class="barcodeClass" fit="scale-down" :src="form.barcodeUrl">
<div slot="error" class="image-slot">
<i class="el-icon-picture-outline"></i>
</div>
</el-image>
</div>
<BarcodeImg ref="barcodeImg" :bussinessId="form.itemId" :bussinessCode="form.itemCode" barcodeType="ITEM"></BarcodeImg>
</el-col>
</el-row>
<el-row>
@ -406,11 +400,11 @@ import { treeselect } from "@/api/mes/md/itemtype";
import Treeselect from "@riophae/vue-treeselect";
import { getBarcodeUrl } from "@/api/mes/wm/barcode";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import BarcodeImg from "@/components/barcodeImg/index.vue"
export default {
name: "MdItem",
dicts: ['sys_yes_no','mes_item_product'],
components: { Treeselect,ItemBom,SOPTab,SIPTab },
components: { Treeselect,ItemBom,SOPTab,SIPTab,BarcodeImg },
data() {
return {
//
@ -608,7 +602,9 @@ export default {
this.open = true;
this.title = "查看物料/产品";
this.optType = "view";
this.getBarcodeUrl();
this.$nextTick(()=>{
this.$refs.barcodeImg.getBarcode();
})
});
},
/** 新增按钮操作 */
@ -632,7 +628,9 @@ export default {
this.open = true;
this.optType = "edit";
this.title = "修改物料/产品";
this.getBarcodeUrl();
this.$nextTick(()=>{
this.$refs.barcodeImg.getBarcode();
})
});
},
/** 提交按钮 */

View File

@ -98,7 +98,7 @@
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
@ -172,13 +172,7 @@
</el-row>
</el-col>
<el-col :span="10">
<div class="flex-container">
<el-image class="barcodeClass" fit="scale-down" :src="form.barcodeUrl?form.barcodeUrl.toString():''">
<div slot="error" class="image-slot">
<i class="el-icon-picture-outline"></i>
</div>
</el-image>
</div>
<BarcodeImg ref="barcodeImg" :bussinessId="form.workshopId" :bussinessCode="form.workshopCode" barcodeType="WORKSHOP"></BarcodeImg>
</el-col>
</el-row>
<el-row>
@ -201,8 +195,10 @@
<script>
import { listWorkshop, getWorkshop, delWorkshop, addWorkshop, updateWorkshop } from "@/api/mes/md/workshop";
import {genCode} from "@/api/system/autocode/rule"
import BarcodeImg from "@/components/barcodeImg/index.vue"
import {getBarcodeUrl} from "@/api/mes/wm/barcode";
export default {
components:{BarcodeImg},
name: "Workshop",
dicts: ['sys_yes_no'],
data() {
@ -332,7 +328,9 @@ export default {
this.open = true;
this.title = "查看车间";
this.optType = "view";
this.getBarcodeUrl();
this.$nextTick(()=>{
this.$refs.barcodeImg.getBarcode();
})
});
},
/** 修改按钮操作 */
@ -344,7 +342,9 @@ export default {
this.open = true;
this.title = "修改车间";
this.optType = "edit";
this.getBarcodeUrl();
this.$nextTick(()=>{
this.$refs.barcodeImg.getBarcode();
})
});
},
/** 提交按钮 */
@ -403,7 +403,7 @@ export default {
}else{
this.form.workshopCode = null;
}
}
}
};

View File

@ -143,7 +143,7 @@
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
@ -168,7 +168,7 @@
<el-switch v-model="autoGenFlag"
active-color="#13ce66"
active-text="自动生成"
@change="handleAutoGenChange(autoGenFlag)" v-if="optType != 'view'">
@change="handleAutoGenChange(autoGenFlag)" v-if="optType != 'view'">
</el-switch>
</el-form-item>
</el-col>
@ -203,15 +203,9 @@
</el-row>
</el-col>
<el-col :span="10">
<div class="flex-container">
<el-image class="barcodeClass" fit="scale-down" :src="form.barcodeUrl">
<div slot="error" class="image-slot">
<i class="el-icon-picture-outline"></i>
</div>
</el-image>
</div>
</el-col>
</el-row>
<BarcodeImg ref="barcodeImg" :bussinessId="form.workstationId" :bussinessCode="form.workstationCode" barcodeType="WORKSTATION"></BarcodeImg>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="所属工序" prop="processId">
@ -224,7 +218,7 @@
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-col>
<el-col :span="8">
<el-form-item label="是否启用" prop="enableFlag">
<el-radio-group v-model="form.enableFlag" disabled v-if="optType=='view'">
@ -263,7 +257,7 @@
<span>设备资源</span>
<el-button style="float:right; padding: 3px 0" @click="handleMachineryAdd" v-if="optType !='view'" type="text">新增</el-button>
</div>
<WorkStationMachine ref="machineryList" :optType="optType" :workstationId="form.workstationId" style="align:center"></WorkStationMachine>
<WorkStationMachine ref="machineryList" :optType="optType" :workstationId="form.workstationId" style="align:center"></WorkStationMachine>
</el-card>
</el-carousel-item>
<el-carousel-item>
@ -312,10 +306,11 @@ import {listAllProcess} from "@/api/mes/pro/process";
import {genCode} from "@/api/system/autocode/rule";
import { listAllWorkshop } from "@/api/mes/md/workshop";
import { getBarcodeUrl } from "@/api/mes/wm/barcode";
import BarcodeImg from "@/components/barcodeImg/index.vue";
export default {
name: "Workstation",
dicts: ['sys_yes_no'],
components: {WorkStationMachine,MachinerySelectSingle,Workstationworker,WorkStationTool},
components: {WorkStationMachine,MachinerySelectSingle,Workstationworker,WorkStationTool,BarcodeImg},
data() {
return {
//
@ -414,7 +409,7 @@ export default {
],
processId: [
{ required: true, message: "请选择所属工序", trigger: "blur" }
]
]
}
};
},
@ -436,7 +431,7 @@ export default {
},
//
getWorkshops(){
listAllWorkshop().then( response => {
listAllWorkshop().then( response => {
this.workshopOptions = response.data;
});
},
@ -448,16 +443,16 @@ export default {
},
//
getWarehouseList(){
getTreeList().then( response =>{
getTreeList().then( response =>{
this.warehouseOptions = response.data;
this.warehouseOptions.map(w =>{
w.children.map(l =>{
let lstr =JSON.stringify(l.children).replace(/locationId/g,'lId').replace(/areaId/g, 'pId').replace(/areaName/g,'pName');
let lstr =JSON.stringify(l.children).replace(/locationId/g,'lId').replace(/areaId/g, 'pId').replace(/areaName/g,'pName');
l.children = JSON.parse(lstr);
});
let wstr = JSON.stringify(w.children).replace(/warehouseId/g,'wId').replace(/locationId/g, 'pId').replace(/locationName/g,'pName');
w.children = JSON.parse(wstr);
let wstr = JSON.stringify(w.children).replace(/warehouseId/g,'wId').replace(/locationId/g, 'pId').replace(/locationName/g,'pName');
w.children = JSON.parse(wstr);
});
let ostr=JSON.stringify(this.warehouseOptions).replace(/warehouseId/g,'pId').replace(/warehouseName/g, 'pName');
@ -555,7 +550,9 @@ export default {
this.open = true;
this.title = "查看工作站信息";
this.optType = "view";
this.getBarcodeUrl();
this.$nextTick(()=>{
this.$refs.barcodeImg.getBarcode();
})
});
},
/** 修改按钮操作 */
@ -568,7 +565,9 @@ export default {
this.open = true;
this.title = "修改工作站";
this.optType = "edit";
this.getBarcodeUrl();
this.$nextTick(()=>{
this.$refs.barcodeImg.getBarcode();
})
});
},
/** 提交按钮 */
@ -643,10 +642,10 @@ export default {
getBarcodeUrl(){
this.barcodeParams.bussinessId = this.form.workstationId;
this.barcodeParams.bussinessCode = this.form.workstationCode;
getBarcodeUrl(this.barcodeParams).then( response =>{
getBarcodeUrl(this.barcodeParams).then( response =>{
if(response.data != null){
this.$set(this.form,'barcodeUrl',response.data.barcodeUrl);//DOM
}
}
});
},
}
@ -666,4 +665,4 @@ export default {
justify-content: center; /* 水平居中 */
align-items: center; /* 垂直居中 */
}
</style>
</style>

View File

@ -176,7 +176,7 @@
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
@ -237,13 +237,7 @@
</el-row>
</el-col>
<el-col :span="10">
<div class="flex-container">
<el-image class="barcodeClass" fit="scale-down" :src="form.barcodeUrl?form.barcodeUrl.toString():''">
<div slot="error" class="image-slot">
<i class="el-icon-picture-outline"></i>
</div>
</el-image>
</div>
<BarcodeImg ref="barcodeImg" :bussinessId="form.toolId" :bussinessCode="form.toolCode" barcodeType="TOOL"></BarcodeImg>
</el-col>
</el-row>
<el-row>
@ -326,8 +320,10 @@ import { listTool, getTool, delTool, addTool, updateTool } from "@/api/mes/tm/to
import { listAllTooltype } from "@/api/mes/tm/tooltype"
import {genCode} from "@/api/system/autocode/rule"
import {getBarcodeUrl} from "@/api/mes/wm/barcode";
import BarcodeImg from "@/components/barcodeImg/index.vue";
export default {
name: "Tool",
components: {BarcodeImg},
dicts: ['mes_tool_status', 'mes_mainten_type'],
data() {
return {
@ -491,11 +487,13 @@ export default {
this.reset();
const toolId = row.toolId || this.ids;
getTool(toolId).then(response => {
this.form = response.data;
this.form = response.data;
this.open = true;
this.title = "查看工装夹具信息";
this.optType = "view";
this.getBarcodeUrl();
this.$nextTick(()=>{
this.$refs.barcodeImg.getBarcode();
})
});
},
/** 修改按钮操作 */
@ -507,7 +505,9 @@ export default {
this.open = true;
this.title = "修改工装夹具清单";
this.optType = "edit";
this.getBarcodeUrl();
this.$nextTick(()=>{
this.$refs.barcodeImg.getBarcode();
})
});
},
//