3
This commit is contained in:
1 parent
e9f154bd06
commit
fa7b5814ba
22 files changed
+989
-168
No files matched your search
@@ -1,27 +1,36 @@
|
||||
<el-row id="print">
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-input v-model="qrcode"
|
||||
placeholder="请扫描二维码"
|
||||
@@change="scanCode" ref="QrCode">
|
||||
<el-col :span="4">
|
||||
<el-select v-model="px" :popper-append-to-body="false" placeholder="片型">
|
||||
<el-option v-for="item in pxList"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-input v-model="lot"
|
||||
placeholder="型号">
|
||||
</el-input>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-col :span="4">
|
||||
<el-input v-model.number="num"
|
||||
placeholder="请输入数量">
|
||||
placeholder="数量">
|
||||
</el-input>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-button type="primary" @@click="genCode">生成</el-button>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-button type="primary" @@click="create">创建入库单</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<div style="margin: 20px 0;"></div>
|
||||
@* 富文本 *@
|
||||
<el-input type="textarea"
|
||||
:autosize="{ minRows: 4}"
|
||||
readonly
|
||||
v-model="gendCode">
|
||||
</el-input>
|
||||
|
||||
<div id="qrcode" style="
|
||||
height: 10%;
|
||||
"></div>
|
||||
<el-button style="float: right" type="primary" @@click="print">打印</el-button>
|
||||
</el-row>
|
||||
|
||||
@@ -30,46 +39,96 @@
|
||||
el: "#print",
|
||||
data() {
|
||||
return {
|
||||
pxList:[
|
||||
{
|
||||
value: '1',
|
||||
label: '上轭片'
|
||||
}, {
|
||||
value: '2',
|
||||
label: '下轭片'
|
||||
}, {
|
||||
value: '3',
|
||||
label: 'A柱片'
|
||||
}, {
|
||||
value: '4',
|
||||
label: 'B柱片'
|
||||
}, {
|
||||
value: '5',
|
||||
label: 'C柱片'
|
||||
}
|
||||
],
|
||||
printData:[],
|
||||
gendCode: '',
|
||||
qrcode: '',
|
||||
px: '',
|
||||
lot:'',
|
||||
num: 1,
|
||||
clear: false,
|
||||
template: {
|
||||
"panels": [
|
||||
{
|
||||
"index": 0,
|
||||
"height": 20,
|
||||
"width": 30,
|
||||
"paperHeader": 43.5,
|
||||
"paperFooter": 56.69,
|
||||
"printElements": [
|
||||
{
|
||||
"options": {
|
||||
"left": 0,
|
||||
"top": 2,
|
||||
"height": 52,
|
||||
"width": 81,
|
||||
"title": "",
|
||||
"field": "uniqueCode",
|
||||
"testData": "",
|
||||
"textType": "qrcode",
|
||||
"barcodeMode": "CODE39"
|
||||
},
|
||||
"printElementType": {
|
||||
"type": "text"
|
||||
}
|
||||
}
|
||||
],
|
||||
"paperNumberLeft": 55.5,
|
||||
"paperNumberTop": 34.5,
|
||||
"paperNumberDisabled": true
|
||||
}
|
||||
]
|
||||
}
|
||||
template: { "panels": [{ "index": 0, "height": 50, "width": 80, "paperHeader": 43.5, "paperFooter": 141.73228346456693, "printElements": [{ "options": { "left": 96, "top": 19.5, "height": 87, "width": 120, "field": "qrcode", "testData": "12312312312", "textType": "qrcode" }, "printElementType": { "type": "text" } }, { "options": { "left": 16.5, "top": 24, "height": 25.5, "width": 69, "field": "px", "testData": "123123", "textAlign": "center", "textContentVerticalAlign": "middle" }, "printElementType": { "type": "text" } }, { "options": { "left": 16.5, "top": 67.5, "height": 24, "width": 67.5, "field": "lot", "testData": "1231231", "textAlign": "center", "textContentVerticalAlign": "middle" }, "printElementType": { "type": "text" } }], "paperNumberLeft": 196.5, "paperNumberTop": 118.5, "paperNumberDisabled": true }] }
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
create() {
|
||||
var _this = this;
|
||||
if (_this.px == "") {
|
||||
_this.$message({
|
||||
message: "请选择片型!",
|
||||
type: "warning",
|
||||
duration: "500",
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (_this.lot == "") {
|
||||
_this.$message({
|
||||
message: "请输入型号!",
|
||||
type: "warning",
|
||||
duration: "500",
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (_this.num <= 0) {
|
||||
_this.$message({
|
||||
message: "数量要大于0!",
|
||||
type: "warning",
|
||||
duration: "500",
|
||||
});
|
||||
return;
|
||||
}
|
||||
var pxName = "";
|
||||
_this.pxList.forEach(function (item) {
|
||||
if (item.value == _this.px)
|
||||
pxName = item.label;
|
||||
})
|
||||
// 调用后台方法,判断是否在物料表内
|
||||
$.ajax({
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: { px: _this.px, pxName: pxName, lot: _this.lot, num: _this.num },
|
||||
url: "/xwms/ReceiptHeader2/CreateDetail3",
|
||||
success: function (json) {
|
||||
if (json.Code != 200) {
|
||||
_this.$message({
|
||||
message: "创建失败!" + json.Msg,
|
||||
type: "warning",
|
||||
duration: "10000",
|
||||
});
|
||||
return;
|
||||
} else {
|
||||
_this.$message({
|
||||
message: "创建成功!"
|
||||
});
|
||||
_this.gendCode = "";
|
||||
_this.printData = [];
|
||||
}
|
||||
},
|
||||
error: function (json) {
|
||||
_this.$message({
|
||||
message: "创建失败!",
|
||||
type: "error",
|
||||
duration: "10000",
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
scanCode() {
|
||||
var _this = this;
|
||||
// 调用后台方法,判断是否在物料表内
|
||||
@@ -103,57 +162,46 @@
|
||||
},
|
||||
genCode() {
|
||||
var _this = this;
|
||||
if (_this.qrcode == "") {
|
||||
if (_this.px == "") {
|
||||
_this.$message({
|
||||
message: "请扫描二维码后再操作!",
|
||||
message: "请选择片型!",
|
||||
type: "warning",
|
||||
duration: "500",
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (_this.num == "") {
|
||||
if (_this.lot == "") {
|
||||
_this.$message({
|
||||
message: "请输入数量后再操作!",
|
||||
message: "请输入型号!",
|
||||
type: "warning",
|
||||
duration: "500",
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 调用后台方法,生成唯一码,(流水号)
|
||||
$.ajax({
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: { code: _this.qrcode, num: _this.num },
|
||||
url: "/configs/Print/GenCode",
|
||||
success: function (json) {
|
||||
if (json.Code != 200) {
|
||||
_this.$message({
|
||||
message: "生成失败!" + json.Msg,
|
||||
type: "warning",
|
||||
duration: "10000",
|
||||
});
|
||||
return;
|
||||
}
|
||||
else{
|
||||
// console.log(json);
|
||||
json.Data.forEach(function (item) {
|
||||
_this.gendCode += item.UniqueCode + '\n';
|
||||
_this.gendCode += item.Batch + '\n';
|
||||
_this.printData.push({ uniqueCode: item.UniqueCode });
|
||||
_this.printData.push({ uniqueCode: item.Batch });
|
||||
});
|
||||
|
||||
}
|
||||
},
|
||||
error: function (json) {
|
||||
_this.$message({
|
||||
message: "生成失败!",
|
||||
type: "error",
|
||||
duration: "10000",
|
||||
});
|
||||
},
|
||||
_this.gendCode = _this.lot + '--' + _this.px;
|
||||
var pxName = "";
|
||||
_this.pxList.forEach(function (item) {
|
||||
if (item.value == _this.px)
|
||||
pxName = item.label;
|
||||
})
|
||||
_this.printData.push({
|
||||
px: pxName,
|
||||
lot: _this.lot,
|
||||
qrcode: _this.gendCode
|
||||
});
|
||||
_this.num = 1;
|
||||
// 设置参数方式
|
||||
var qrcode = new QRCode(document.getElementById('qrcode'), {
|
||||
text: _this.gendCode,
|
||||
width: 256,
|
||||
height: 256,
|
||||
colorDark: '#000000',
|
||||
colorLight: '#ffffff',
|
||||
correctLevel: QRCode.CorrectLevel.H
|
||||
});
|
||||
|
||||
// 使用 API
|
||||
qrcode.clear();
|
||||
qrcode.makeCode(_this.gendCode);
|
||||
},
|
||||
print() {
|
||||
var _this = this;
|
||||
@@ -171,4 +219,5 @@
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
Reference in new issue
Block a user