Commit 3fa18c1c by FangYuan

条码优化

parent 96c8b0d9
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<!-- 含有校验码类型 -->
<template v-if="info.isCheck === 1"> <template v-if="info.isCheck === 1">
<el-form-item> <el-form-item>
<el-input <el-input
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
class="CT2_form_inline" class="CT2_form_inline"
:type="info.inputType" :type="info.inputType"
@input="changeCValue($event, info.maxLength, info.flag, i)" @input="changeCValue($event, info.maxLength, info.flag, i)"
@blur="handleBlur($event, info, i)"
clearable clearable
></el-input> ></el-input>
</el-form-item> </el-form-item>
...@@ -51,6 +52,7 @@ ...@@ -51,6 +52,7 @@
</div> </div>
</el-form-item> </el-form-item>
</template> </template>
<!-- 时间类型 -->
<template v-else-if="info.isDate === 1"> <template v-else-if="info.isDate === 1">
<el-form-item> <el-form-item>
<el-date-picker <el-date-picker
...@@ -60,10 +62,12 @@ ...@@ -60,10 +62,12 @@
format="yyMMdd" format="yyMMdd"
value-format="yyMMdd" value-format="yyMMdd"
clearable clearable
class="DT_form_inline"
> >
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
</template> </template>
<!-- 剩余其他类型 -->
<template v-else> <template v-else>
<el-form-item> <el-form-item>
<el-input <el-input
...@@ -74,6 +78,7 @@ ...@@ -74,6 +78,7 @@
class="CT1_form_inline" class="CT1_form_inline"
:type="info.inputType" :type="info.inputType"
clearable clearable
@blur="handleBlur($event, info, i)"
></el-input> ></el-input>
</el-form-item> </el-form-item>
</template> </template>
...@@ -83,6 +88,7 @@ ...@@ -83,6 +88,7 @@
@click="addRow" @click="addRow"
src="../../assets/image/barcode/add.png" src="../../assets/image/barcode/add.png"
alt="" alt=""
class="button_sty"
/> />
</el-form-item> </el-form-item>
<el-form-item v-else> <el-form-item v-else>
...@@ -90,6 +96,7 @@ ...@@ -90,6 +96,7 @@
@click="deleteRow(i)" @click="deleteRow(i)"
src="../../assets/image/barcode/delete.png" src="../../assets/image/barcode/delete.png"
alt="" alt=""
class="button_sty"
/> />
</el-form-item> </el-form-item>
</template> </template>
...@@ -221,7 +228,7 @@ export default { ...@@ -221,7 +228,7 @@ export default {
}); });
}, },
deleteRow(i) { deleteRow(i) {
this.writeCodeList.splice(0, i); this.writeCodeList.splice(i, 1);
}, },
changeCValue(val, length, code, i) { changeCValue(val, length, code, i) {
console.log(val, length, "------7777----"); console.log(val, length, "------7777----");
...@@ -231,6 +238,14 @@ export default { ...@@ -231,6 +238,14 @@ export default {
this.writeCodeList[i].cValue = val.slice(0, length); this.writeCodeList[i].cValue = val.slice(0, length);
} }
}, },
handleBlur(event, info, index) {
if (
event.target.value.length < info.minLength ||
event.target.value.length > info.maxLength
) {
this.$message.error(info.prompt);
}
},
async queryCheckCode(code, content, i) { async queryCheckCode(code, content, i) {
const params = { const params = {
code, code,
...@@ -334,12 +349,14 @@ input::-webkit-inner-spin-button { ...@@ -334,12 +349,14 @@ input::-webkit-inner-spin-button {
height: 40px; height: 40px;
} }
.CT1_form_inline.el-input, .CT1_form_inline.el-input,
.CT2_form_inline.el-input { .CT2_form_inline.el-input,
.DT_form_inline.el-input {
border-radius: 2px; border-radius: 2px;
position: relative; position: relative;
} }
.CT1_form_inline.el-input .el-input__inner, .CT1_form_inline.el-input .el-input__inner,
.CT2_form_inline.el-input .el-input__inner { .CT2_form_inline.el-input .el-input__inner,
.DT_form_inline.el-input .el-input__inner {
height: 40px; height: 40px;
border-radius: 2px; border-radius: 2px;
border: 1px solid #cccccc; border: 1px solid #cccccc;
...@@ -353,6 +370,14 @@ input::-webkit-inner-spin-button { ...@@ -353,6 +370,14 @@ input::-webkit-inner-spin-button {
top: 0; top: 0;
left: 0; left: 0;
} }
.DT_form_inline.el-date-editor,
.DT_form_inline.el-date-editor .el-input__inner {
width: 320px;
height: 40px;
}
.DT_form_inline.el-input .el-input__inner {
padding-left: 40px;
}
</style> </style>
<style lang="scss" scoped> <style lang="scss" scoped>
.corppay { .corppay {
...@@ -385,6 +410,9 @@ input::-webkit-inner-spin-button { ...@@ -385,6 +410,9 @@ input::-webkit-inner-spin-button {
color: #999999; color: #999999;
text-align: center; text-align: center;
} }
.button_sty {
cursor: pointer;
}
} }
.tag_num { .tag_num {
width: 72px; width: 72px;
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
<img :src="codePicture" alt="" /> <img :src="codePicture" alt="" />
</div> </div>
<div class="down_button" @click="downPicture">下载图片</div> <div class="down_button" @click="downPicture">下载图片</div>
<!-- <a :download="codePicture">下载图片</a> -->
</div> </div>
</div> </div>
<!-- 条码生成成功区域end --> <!-- 条码生成成功区域end -->
...@@ -24,8 +25,8 @@ export default { ...@@ -24,8 +25,8 @@ export default {
props: { props: {
codePicture: { codePicture: {
type: String, type: String,
default: '', default: "",
} },
}, },
data() { data() {
return {}; return {};
...@@ -34,9 +35,33 @@ export default { ...@@ -34,9 +35,33 @@ export default {
mounted() {}, mounted() {},
methods: { methods: {
downPicture() { downPicture() {
window.location.href = this.codePicture; // window.location.href = this.codePicture;
} window.open(this.codePicture, "_blank");
} this.getUrlBase64(this.codePicture).then((base64) => {
let link = document.createElement("a");
link.href = base64;
link.download = "qrCode.png";
link.click();
});
},
getUrlBase64(url) {
return new Promise((resolve) => {
let canvas = document.createElement("canvas");
let ctx = canvas.getContext("2d");
let img = new Image();
img.crossOrigin = "Anonymous"; //允许跨域
img.src = url;
img.onload = function () {
canvas.height = 102;
canvas.width = 300;
ctx.drawImage(img, 0, 0, 300, 102);
let dataURL = canvas.toDataURL("image/png");
canvas = null;
resolve(dataURL);
};
});
},
},
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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