|
@@ -552,6 +552,7 @@
|
|
|
<el-input
|
|
<el-input
|
|
|
v-model="batchForm.quantity"
|
|
v-model="batchForm.quantity"
|
|
|
style="width: 220px"
|
|
style="width: 220px"
|
|
|
|
|
+ @change="batchInput"
|
|
|
></el-input>
|
|
></el-input>
|
|
|
{{ batchForm.unit }}
|
|
{{ batchForm.unit }}
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
@@ -648,7 +649,11 @@
|
|
|
<el-input v-model="lossForm.batchNo" style="width: 220px"></el-input>
|
|
<el-input v-model="lossForm.batchNo" style="width: 220px"></el-input>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item label="损耗数">
|
|
<el-form-item label="损耗数">
|
|
|
- <el-input v-model="lossForm.quantity" style="width: 220px"></el-input>
|
|
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="lossForm.quantity"
|
|
|
|
|
+ style="width: 220px"
|
|
|
|
|
+ @input="lossInput"
|
|
|
|
|
+ ></el-input>
|
|
|
{{ lossForm.unit }}
|
|
{{ lossForm.unit }}
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-form>
|
|
</el-form>
|
|
@@ -1268,13 +1273,13 @@
|
|
|
|
|
|
|
|
if (this.item.workReportInfo) {
|
|
if (this.item.workReportInfo) {
|
|
|
this.item.workReportInfo.formedWeight = parseFloat(
|
|
this.item.workReportInfo.formedWeight = parseFloat(
|
|
|
- formedWeight.toFixed(2)
|
|
|
|
|
|
|
+ formedWeight.toFixed(4)
|
|
|
);
|
|
);
|
|
|
this.item.workReportInfo.notFormedWeight = parseFloat(
|
|
this.item.workReportInfo.notFormedWeight = parseFloat(
|
|
|
- noFormedWeight.toFixed(2)
|
|
|
|
|
|
|
+ noFormedWeight.toFixed(4)
|
|
|
);
|
|
);
|
|
|
this.item.workReportInfo.lossWeight = parseFloat(
|
|
this.item.workReportInfo.lossWeight = parseFloat(
|
|
|
- lossWeight.toFixed(2)
|
|
|
|
|
|
|
+ lossWeight.toFixed(4)
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1413,20 +1418,26 @@
|
|
|
this.batchVisible = true;
|
|
this.batchVisible = true;
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
|
|
+ batchInput(val) {
|
|
|
|
|
+ let newVal = val.replace(/[^\d.]/g, '');
|
|
|
|
|
+
|
|
|
|
|
+ if (newVal.startsWith('.')) {
|
|
|
|
|
+ newVal = '';
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const firstDotIndex = newVal.indexOf('.');
|
|
|
|
|
+ if (firstDotIndex !== -1) {
|
|
|
|
|
+ newVal =
|
|
|
|
|
+ newVal.slice(0, firstDotIndex + 1) +
|
|
|
|
|
+ newVal.slice(firstDotIndex + 1).replace(/\./g, '');
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const match = newVal.match(/^(\d+)(\.\d{0,4})?/);
|
|
|
|
|
+ this.batchForm.quantity = match ? match[0] : '';
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
async getQualityParam() {
|
|
async getQualityParam() {
|
|
|
if (this.batchForm.quantity && this.batchForm.batchNo) {
|
|
if (this.batchForm.quantity && this.batchForm.batchNo) {
|
|
|
- // const reg = /^(\d+)(\.\d{0,4})?$/;
|
|
|
|
|
- // if (
|
|
|
|
|
- // this.itemData.feedQuantity === '' ||
|
|
|
|
|
- // reg.test(this.itemData.feedQuantity)
|
|
|
|
|
- // ) {
|
|
|
|
|
- // this.itemData.feedQuantity = val;
|
|
|
|
|
- // } else {
|
|
|
|
|
- // // 如果用户输入非法字符,直接去掉非法部分
|
|
|
|
|
- // const match = val.match(/^(\d+)(\.\d{0,4})?/);
|
|
|
|
|
- // this.itemData.feedQuantity = match ? match[0] : '';
|
|
|
|
|
- // }
|
|
|
|
|
-
|
|
|
|
|
if (Number(this.itemData.feedQuantity) == 0) {
|
|
if (Number(this.itemData.feedQuantity) == 0) {
|
|
|
this.$message.warning('拆批数不能等于0');
|
|
this.$message.warning('拆批数不能等于0');
|
|
|
return;
|
|
return;
|
|
@@ -1546,20 +1557,26 @@
|
|
|
this.lossVisible = true;
|
|
this.lossVisible = true;
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
|
|
+ lossInput(val) {
|
|
|
|
|
+ let newVal = val.replace(/[^\d.]/g, '');
|
|
|
|
|
+
|
|
|
|
|
+ if (newVal.startsWith('.')) {
|
|
|
|
|
+ newVal = '';
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const firstDotIndex = newVal.indexOf('.');
|
|
|
|
|
+ if (firstDotIndex !== -1) {
|
|
|
|
|
+ newVal =
|
|
|
|
|
+ newVal.slice(0, firstDotIndex + 1) +
|
|
|
|
|
+ newVal.slice(firstDotIndex + 1).replace(/\./g, '');
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const match = newVal.match(/^(\d+)(\.\d{0,4})?/);
|
|
|
|
|
+ this.lossForm.quantity = match ? match[0] : '';
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
async getLossParam() {
|
|
async getLossParam() {
|
|
|
if (this.lossForm.quantity && this.lossForm.batchNo) {
|
|
if (this.lossForm.quantity && this.lossForm.batchNo) {
|
|
|
- // const reg = /^(\d+)(\.\d{0,4})?$/;
|
|
|
|
|
- // if (
|
|
|
|
|
- // this.lossData.feedQuantity === '' ||
|
|
|
|
|
- // reg.test(this.lossData.feedQuantity)
|
|
|
|
|
- // ) {
|
|
|
|
|
- // this.lossData.feedQuantity = val;
|
|
|
|
|
- // } else {
|
|
|
|
|
- // // 如果用户输入非法字符,直接去掉非法部分
|
|
|
|
|
- // const match = val.match(/^(\d+)(\.\d{0,4})?/);
|
|
|
|
|
- // this.lossData.feedQuantity = match ? match[0] : '';
|
|
|
|
|
- // }
|
|
|
|
|
-
|
|
|
|
|
if (
|
|
if (
|
|
|
Number(this.lossData.feedQuantity) < Number(this.lossForm.quantity)
|
|
Number(this.lossData.feedQuantity) < Number(this.lossForm.quantity)
|
|
|
) {
|
|
) {
|