arco design vue3

This commit is contained in:
zhougf committed 2024-02-28 23:05:09 +08:00
1 parent aa33eadcb6
commit b52a8f74b7
9 files changed
+106808 -201

No files matched your search

+44 -195
View File
@@ -1,207 +1,56 @@
<el-row id="print">
<el-row>
<el-col :span="12">
<el-input v-model="qrcode"
placeholder="请扫描二维码"
@@change="scanCode" ref="QrCode">
</el-input>
</el-col>
<el-col :span="8">
<el-input v-model.number="num"
placeholder="请输入数量">
</el-input>
</el-col>
<el-col :span="4">
<el-button type="primary" @@click="genCode">生成</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> *@
<el-divider></el-divider>
<el-table :data="invTable" max-height="400" stripe border
style="width: 100%">
<el-table-column fixed="left"
label="操作"
width="120"
align="center">
<template slot-scope="scope">
<el-button @@click.native.prevent="deleteRow(scope.$index, invTable)"
type="text"
size="small">
移除
</el-button>
</template>
</el-table-column>
<el-table-column label="唯一码" width="220" align="center" prop="UniqueCode"></el-table-column>
<el-table-column label="批次" width="220" align="center" prop="Batch"></el-table-column>
</el-table>
<el-button style="float: right" type="primary" @@click="print">打印</el-button>
</el-row>
<div id="app">
<a-button @@click="handleClick">
<template #icon>
<icon-plus />
</template>
{{ message }}
</a-button>
<a-form :model="form" :style="{ width: '600px' }" @@submit="handleSubmit">
<a-form-item field="name" tooltip="Please enter username" label="Username">
<a-input v-model="form.name"
placeholder="please enter your username..." />
</a-form-item>
<a-form-item field="post" label="Post">
<a-input v-model="form.post" placeholder="please enter your post..." />
</a-form-item>
<a-form-item field="isRead">
<a-checkbox v-model="form.isRead"> I have read the manual </a-checkbox>
</a-form-item>
<a-form-item>
<a-button html-type="submit">Submit</a-button>
</a-form-item>
</a-form>
{{ form }}
</div>
<script>
var app = new Vue({
el: "#print",
const { createApp } = Vue
createApp({
data() {
return {
invTable:[],
printData:[],
gendCode: '',
qrcode: '',
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
}
]
message: 'Hello Vue!',
form: {
name: '',
post: '',
isRead: false,
}
}
},
methods: {
// 删除已绑定行
deleteRow(index, rows) {
rows.splice(index, 1);
handleClick() {
console.log(1);
this.$message.info('This is an info message')
},
scanCode() {
var _this = this;
// 调用后台方法,判断是否在物料表内
$.ajax({
type: "post",
dataType: "json",
data: { code: _this.qrcode },
url: "/configs/Print/ScanCode",
success: function (json) {
// console.log(json);
if (json.Code != 200) {
_this.$message({
message: "扫描失败!" + json.Msg,
type: "warning",
duration: "10000",
});
}
if (_this.clear) {
_this.gendCode = "";
_this.invTable = [];
_this.printData = [];
}
},
error: function (json) {
_this.$message({
message: "扫描失败!",
type: "error",
duration: "10000",
});
},
});
},
genCode() {
var _this = this;
if (_this.qrcode == "") {
_this.$message({
message: "请扫描二维码后再操作!",
type: "warning",
duration: "500",
});
return;
}
if (_this.num == "") {
_this.$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.invTable.push({
"UniqueCode": item.UniqueCode,
"Batch": item.Batch
});
_this.printData.push({ uniqueCode: item.UniqueCode });
_this.printData.push({ uniqueCode: item.Batch });
});
}
},
error: function (json) {
_this.$message({
message: "生成失败!",
type: "error",
duration: "10000",
});
},
});
_this.num = 1;
},
print() {
var _this = this;
_this.printData = [];
this.invTable.forEach(function (item) {
_this.printData.push({ uniqueCode: item.UniqueCode });
_this.printData.push({ uniqueCode: item.Batch });
});;
// _this.gendCode = "";
hiprint.init();
var hiprintTemplate = new hiprint.PrintTemplate({
template: this.template
})
hiprintTemplate.print(this.printData);
// _this.printData = [];
_this.clear = true;
//清空
_this.qrcode = '';
_this.num = 1;
handleSubmit(data) {
console.log(data);
this.$message.info('This is an info message')
}
}
});
})
.use(ArcoVue)
.use(ArcoVueIcon)
.mount('#app')
</script>