条码生成页面完善

parent b3e0ab36
<template> <template>
<div> <div class="app-container">
<qrcode-vue :value="value" :size="size" level="H"/> <div class="head-container">
<input v-model="barcodeValue" /><br> <label class="el-form-item-label">物料编码</label>
<barcode :value="barcodeValue" :format="barcodeFormat"/> <el-input
v-model="materialCode"
clearable
placeholder="请输入物料编码"
style="width: 185px;"
class="filter-item"
/>
<label class="el-form-item-label">条码类型</label>
<el-select
v-model="nowBarCode"
clearable
placeholder="请选择条码类型"
style="width: 185px;"
>
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
<el-button @click="firstButton">二维码</el-button>
<el-button @click="SecButton">条形码</el-button>
<div v-if="(qrDisplay = true)">
<qrcode-vue :value="qrCode" :size="size" level="H" />
</div>
<div>
<barcode :value="qrCode" :format="barcodeFormat" />
</div>
</div>
</div> </div>
<!-- <div>
<qrcode-vue :value="value" :size="size" level="H" />
<input v-model="barcodeValue" /><br />
<barcode :value="barcodeValue" :format="barcodeFormat" />
</div> -->
</template> </template>
<script> <script>
import QrcodeVue from 'qrcode.vue' import QrcodeVue from 'qrcode.vue'
...@@ -11,19 +46,96 @@ import VueBarcode from 'vue-barcode' ...@@ -11,19 +46,96 @@ import VueBarcode from 'vue-barcode'
export default { export default {
components: { components: {
QrcodeVue, QrcodeVue,
'barcode': VueBarcode barcode: VueBarcode
}, },
data() { data() {
return { return {
value: 'https://www.baidu.com', // value: "https://www.baidu.com",
nowBarCode: '',
size: 300, size: 300,
barcodeValue: 'test', barcodeValue: 'test',
barcodeFormat: '' barcodeFormat: '',
qrDisplay: false,
qrCode: '',
materialCode: '',
options: [
{
value: 'CODE128',
label: 'CODE128'
},
{
value: 'EAN',
label: 'EAN'
},
{
value: 'EAN-13',
label: 'EAN-13'
},
{
value: 'EAN-8',
label: 'EAN-8'
},
{
value: 'EAN-5',
label: 'EAN-5'
},
{
value: 'EAN-2',
label: 'EAN-2'
},
{
value: 'UPC (A)',
label: 'UPC (A)'
},
{
value: 'CODE39',
label: 'CODE39'
},
{
value: 'ITF-14',
label: 'ITF-14'
},
{
value: 'MSI',
label: 'MSI'
},
{
value: 'Pharmacode',
label: 'Pharmacode'
},
{
value: 'Codabar',
label: 'Codabar'
}
]
}
},
created() {},
mounted() {},
methods: {
firstButton() {
this.qrDisplay = true
this.qrCode = this.materialCode
console.log(this.materialCode)
this.$message({
message: '二维码已更新',
type: 'success'
})
},
SecButton() {
this.qrCode = this.materialCode
if (this.nowBarCode === '') {
this.$message({
message: '请先选择条形码类型',
type: 'warning'
})
return
}
console.log('nowBarCode', this.nowBarCode)
this.barcodeFormat = this.nowBarCode.value
} }
} }
} }
</script> </script>
<style scoped> <style scoped></style>
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment