计数功能校验输入正整数

其他几个页面扫码出错后,清空已扫描的值
This commit is contained in:
zhougf committed 2024-04-25 18:53:35 +08:00
1 parent c286bf55d7
commit a869449034
5 files changed
+16 -2

No files matched your search

@@ -109,6 +109,7 @@
type: "warning",
duration: "10000",
});
_this.qrcode = "";
}
if (_this.clear) {
_this.gendCode = "";
@@ -263,6 +263,10 @@ namespace HHWMS.Web.Controllers
/// <returns></returns>
public ActionResult CountCommit(string code, string uniqueCode, int qty)
{
if (qty <= 0)
{
return JsonMore(null, 500, $"数量必须大于0!");
}
var receiptDetail = _unitwork.FindSingle<ReceiptDetail>(x => x.UniqueCode.Equals(uniqueCode));
if (receiptDetail != null)
{
@@ -88,8 +88,12 @@ var app = new Vue({
onSubmit() {
var _this = this;
var qty = _this.form.qty;
if (qty == "")
qty = parseInt(_this.qtyPlaceholder);
// 正则表达式 校验qty为正整数
if (!/^[1-9]\d*$/.test(qty)) {
layer.alert("数量必须为正整数");
return;
}
// 提交已绑定数据
$.ajax({
type: "post",
@@ -22,6 +22,9 @@
</el-row>
<el-table :data="bindingData" stripe max-height="450" border style="width: 100%">
<el-table-column type="index"
width="50">
</el-table-column>
<el-table-column fixed="left" label="操作" width="120" align="center">
<template slot-scope="scope">
<el-button @@click.native.prevent="deleteRow(scope.$index, bindingData)"
@@ -155,6 +158,7 @@
type: "warning",
duration: "10000",
});
_this.form.uniqueCode = '';
} else {
// 3.已扫描增加
_this.bindingData.push({
@@ -130,6 +130,7 @@
type: "error",
duration: "10000",
});
_this.form.uniqueCode = "";
} else {
var value = _this.invTable[t];
_this.form.uniqueCode = value.UniqueCode;