|
@@ -224,17 +224,36 @@
|
|
|
:inline="false"
|
|
|
size="normal"
|
|
|
>
|
|
|
- <el-form-item prop="num" label="请输入打印数量:">
|
|
|
- <el-input
|
|
|
- v-model="printForm.num"
|
|
|
- onkeyup="value=value.replace(/^(0+)|[^\d]+/g,'')"
|
|
|
- ></el-input>
|
|
|
+ <el-form-item label="建议打印数量:">
|
|
|
+ {{ printForm.suggestionNum }}
|
|
|
</el-form-item>
|
|
|
+
|
|
|
+ <el-form-item prop="num" label="打印数量:">
|
|
|
+ <el-row type="flex" justify="space-between">
|
|
|
+ <el-input
|
|
|
+ size="small"
|
|
|
+ v-model="printForm.num"
|
|
|
+ placeholder="起始二维码编号"
|
|
|
+ onkeyup="value=value.replace(/^(0+)|[^\d]+/g,'')"
|
|
|
+ style="flex: 1; margin-right: 10px;"
|
|
|
+ ></el-input>
|
|
|
+ <span>-</span>
|
|
|
+ <el-input
|
|
|
+ size="small"
|
|
|
+ v-model="printForm.endNum"
|
|
|
+ placeholder="结束二维码编号"
|
|
|
+ onkeyup="value=value.replace(/^(0+)|[^\d]+/g,'')"
|
|
|
+ style="flex: 1; margin-left: 10px;"
|
|
|
+ ></el-input>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
</el-form>
|
|
|
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button type="primary" @click="toPrint">确 定</el-button>
|
|
|
- <el-button @click="cancel">取 消</el-button>
|
|
|
+ <el-button @click="cancel1">取 消</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
|
|
@@ -323,16 +342,30 @@ export default {
|
|
|
// 打印数据
|
|
|
printRow: "",
|
|
|
printForm: {
|
|
|
- num: "",
|
|
|
+ num: 1,
|
|
|
+ suggestionNum: 0,
|
|
|
+ startNum: '',
|
|
|
+ endNum: '',
|
|
|
},
|
|
|
printFormRules: {
|
|
|
num: [
|
|
|
+ // {
|
|
|
+ // required: true,
|
|
|
+ // message: "请输入起始二维码编号",
|
|
|
+ // trigger: "blur",
|
|
|
+ // },
|
|
|
+ {
|
|
|
+ validator:this.numValiditor,
|
|
|
+ trigger: "blur"
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ endNum: [
|
|
|
{
|
|
|
required: true,
|
|
|
- message: "请输入打印数量",
|
|
|
+ message: "请输入结束二维码编号",
|
|
|
trigger: "blur",
|
|
|
},
|
|
|
- ],
|
|
|
+ ]
|
|
|
},
|
|
|
// k-form-build组件渲染弹窗
|
|
|
kOpen: false,
|
|
@@ -506,10 +539,38 @@ export default {
|
|
|
}),
|
|
|
},
|
|
|
methods: {
|
|
|
+ cancel1(){
|
|
|
+ this.open = false;
|
|
|
+ this.reset();
|
|
|
+ },
|
|
|
+ reset(){
|
|
|
+ this.printForm ={
|
|
|
+ num: 1,
|
|
|
+ suggestionNum: 0,
|
|
|
+ startNum: '',
|
|
|
+ endNum: '',
|
|
|
+ };
|
|
|
+ this.resetForm("printForm");
|
|
|
+ },
|
|
|
+ //自定义打印校验规则
|
|
|
+ numValiditor(rule,value,callback){
|
|
|
+ let {num,endNum}=this.printForm
|
|
|
+ if(!num){
|
|
|
+ callback(new Error('请输入起始二维码编号'))
|
|
|
+ }else if(!endNum){
|
|
|
+ callback(new Error('请输入结束二维码编号'))
|
|
|
+ }else if(num>endNum){
|
|
|
+ callback(new Error('起始二维码编号不能大于'+endNum))
|
|
|
+ }else{
|
|
|
+ callback()
|
|
|
+ }
|
|
|
+ },
|
|
|
// 打印
|
|
|
async toPrint() {
|
|
|
//
|
|
|
- console.log(this.printRow);
|
|
|
+ console.log(this.printRow,'printRow');
|
|
|
+ console.log(this.printRow.materielSpecificationModel,'materielSpecificationModel');
|
|
|
+ console.log(this.printRow.purchaseQuantity,'quantity');
|
|
|
//母粒编号 采购单编号 单位
|
|
|
let {
|
|
|
purchaseId,
|
|
@@ -553,7 +614,7 @@ export default {
|
|
|
if (valid) {
|
|
|
console.log(this.printRow);
|
|
|
let allPringtData = [];
|
|
|
- for (let i = 0; i < Number(this.printForm.num); i++) {
|
|
|
+ for (let i = Number(this.printForm.num); i <= Number(this.printForm.endNum); i++) {
|
|
|
let stringInner =
|
|
|
printData.id +
|
|
|
"@" +
|
|
@@ -561,11 +622,11 @@ export default {
|
|
|
"@" +
|
|
|
printData.units +
|
|
|
"@" +
|
|
|
- printData.quantity +
|
|
|
+ printData.specificationModel +
|
|
|
"@" +
|
|
|
printData.specificationModel +
|
|
|
"@" +
|
|
|
- (i + 1) +
|
|
|
+ i +
|
|
|
"@" +
|
|
|
new Date().getTime() +
|
|
|
i;
|
|
@@ -584,12 +645,50 @@ export default {
|
|
|
},
|
|
|
{
|
|
|
label: "序号",
|
|
|
- value: i + 1,
|
|
|
+ value: i,
|
|
|
},
|
|
|
],
|
|
|
});
|
|
|
}
|
|
|
+ // for (let i = 0; i < Number(this.printForm.num); i++) {
|
|
|
+ // let stringInner =
|
|
|
+ // printData.id +
|
|
|
+ // "@" +
|
|
|
+ // printData.materielId +
|
|
|
+ // "@" +
|
|
|
+ // printData.units +
|
|
|
+ // "@" +
|
|
|
+ // printData.quantity +
|
|
|
+ // "@" +
|
|
|
+ // printData.specificationModel +
|
|
|
+ // "@" +
|
|
|
+ // (i + 1) +
|
|
|
+ // "@" +
|
|
|
+ // new Date().getTime() +
|
|
|
+ // i;
|
|
|
+ // console.log(stringInner);
|
|
|
+ // // return ;
|
|
|
+ // allPringtData.push({
|
|
|
+ // codeData: stringInner,
|
|
|
+ // showMsg: [
|
|
|
+ // {
|
|
|
+ // label: "编号",
|
|
|
+ // value: printData.materielId,
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // label: "名称",
|
|
|
+ // value: printData.materielName,
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // label: "序号",
|
|
|
+ // value: i + 1,
|
|
|
+ // },
|
|
|
+ // ],
|
|
|
+ // });
|
|
|
+ // }
|
|
|
// console.log(allPringtData);
|
|
|
+
|
|
|
+ console.log(allPringtData,'allPringtData')
|
|
|
qrCodeList(allPringtData, "printDom");
|
|
|
} else {
|
|
|
console.log("error submit!!");
|
|
@@ -824,6 +923,14 @@ export default {
|
|
|
// 采购 打印回调
|
|
|
printHandler(index, row) {
|
|
|
this.printRow = row;
|
|
|
+ // console.log(this.printRow);
|
|
|
+ // console.log(this.printRow.materielSpecificationModel,'materielSpecificationModel');
|
|
|
+ // console.log(this.printRow.purchaseQuantity,'quantity');
|
|
|
+ //重量除规格计算出打印多少张二维码
|
|
|
+ let printNum = Math.ceil(this.printRow.purchaseQuantity / this.printRow.materielSpecificationModel);
|
|
|
+ //打印数量
|
|
|
+ this.printForm.suggestionNum = printNum;
|
|
|
+ this.printForm.endNum = printNum;
|
|
|
this.open = true;
|
|
|
},
|
|
|
// 审计 提交编辑结果按钮回调
|