|
|
@ -18,7 +18,7 @@ |
|
|
|
<div class="item"> |
|
|
|
<span class="item_text">条码:</span> |
|
|
|
<el-input v-model="locationForm.barCode" :disabled="disabledCode" placeholder="" class="item_inputs" clearable /> |
|
|
|
<el-button type="primary" size="small" @click="createBarCode" :disabled="disabledCode">自动</el-button> |
|
|
|
<el-button type="primary" size="small" @click="createBarCode" :disabled="disabledCode">随机</el-button> |
|
|
|
</div> |
|
|
|
<div class="item"> |
|
|
|
<span class="item_text">商品名:</span> |
|
|
@ -30,19 +30,19 @@ |
|
|
|
</div> |
|
|
|
<div class="item"> |
|
|
|
<span class="item_text">价值:</span> |
|
|
|
<el-input v-model="locationForm.value" class="item_input" clearable></el-input> |
|
|
|
<el-input v-model="locationForm.value" class="item_input" @input="limitInput1($event)" clearable></el-input> |
|
|
|
</div> |
|
|
|
<div class="item"> |
|
|
|
<span class="item_text">净重:</span> |
|
|
|
<el-input v-model="locationForm.netWeight" class="item_input" clearable></el-input> |
|
|
|
<el-input v-model="locationForm.netWeight" class="item_input" @input="limitInput2($event)" clearable></el-input> |
|
|
|
</div> |
|
|
|
<div class="item"> |
|
|
|
<span class="item_text">毛重:</span> |
|
|
|
<el-input v-model="locationForm.roughWeight" class="item_input" clearable></el-input> |
|
|
|
<el-input v-model="locationForm.roughWeight" class="item_input" @input="limitInput3($event)" clearable></el-input> |
|
|
|
</div> |
|
|
|
<div class="item"> |
|
|
|
<span class="item_text">有效天数:</span> |
|
|
|
<el-input v-model="locationForm.effectiveDays" class="item_input" clearable></el-input> |
|
|
|
<el-input v-model="locationForm.effectiveDays" class="item_input" @input="limitInput4($event)" clearable></el-input> |
|
|
|
</div> |
|
|
|
<div class="item"> |
|
|
|
<span class="item_text">备注:</span> |
|
|
@ -133,6 +133,38 @@ |
|
|
|
var nowstr = now.getTime() |
|
|
|
this.locationForm.barCode = 'P' + now.getTime() |
|
|
|
}, |
|
|
|
limitInput1(value, index) { |
|
|
|
this.locationForm.value = |
|
|
|
("" + value) // 第一步:转成字符串 |
|
|
|
.replace(/[^\d^\.]+/g, "") // 第二步:把不是数字,不是小数点的过滤掉 |
|
|
|
.replace(/^0+(\d)/, "$1") // 第三步:第一位0开头,0后面为数字,则过滤掉,取后面的数字 |
|
|
|
.replace(/^\./, "0.") // 第四步:如果输入的第一位为小数点,则替换成 0. 实现自动补全 |
|
|
|
.match(/^\d*(\.?\d{0,4})/g)[0] || ""; // 第五步:最终匹配得到结果 以数字开头,只有一个小数点,而且小数点后面只能有0到2位小数 |
|
|
|
}, |
|
|
|
limitInput2(value, index) { |
|
|
|
this.locationForm.netWeight = |
|
|
|
("" + value) // 第一步:转成字符串 |
|
|
|
.replace(/[^\d^\.]+/g, "") // 第二步:把不是数字,不是小数点的过滤掉 |
|
|
|
.replace(/^0+(\d)/, "$1") // 第三步:第一位0开头,0后面为数字,则过滤掉,取后面的数字 |
|
|
|
.replace(/^\./, "0.") // 第四步:如果输入的第一位为小数点,则替换成 0. 实现自动补全 |
|
|
|
.match(/^\d*(\.?\d{0,4})/g)[0] || ""; // 第五步:最终匹配得到结果 以数字开头,只有一个小数点,而且小数点后面只能有0到2位小数 |
|
|
|
}, |
|
|
|
limitInput3(value, index) { |
|
|
|
this.locationForm.roughWeight = |
|
|
|
("" + value) // 第一步:转成字符串 |
|
|
|
.replace(/[^\d^\.]+/g, "") // 第二步:把不是数字,不是小数点的过滤掉 |
|
|
|
.replace(/^0+(\d)/, "$1") // 第三步:第一位0开头,0后面为数字,则过滤掉,取后面的数字 |
|
|
|
.replace(/^\./, "0.") // 第四步:如果输入的第一位为小数点,则替换成 0. 实现自动补全 |
|
|
|
.match(/^\d*(\.?\d{0,4})/g)[0] || ""; // 第五步:最终匹配得到结果 以数字开头,只有一个小数点,而且小数点后面只能有0到2位小数 |
|
|
|
}, |
|
|
|
limitInput4(value, index) { |
|
|
|
this.locationForm.effectiveDays = |
|
|
|
("" + value) // 第一步:转成字符串 |
|
|
|
.replace(/[^\d^\.]+/g, "") // 第二步:把不是数字,不是小数点的过滤掉 |
|
|
|
.replace(/^0+(\d)/, "$1") // 第三步:第一位0开头,0后面为数字,则过滤掉,取后面的数字 |
|
|
|
.replace(/^\./, "0.") // 第四步:如果输入的第一位为小数点,则替换成 0. 实现自动补全 |
|
|
|
.match(/^\d*(\d{0,0})/g)[0] || ""; // 第五步:最终匹配得到结果 以数字开头,只有一个小数点,而且小数点后面只能有0到2位小数 |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|