123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <template>
- <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px;">
- <text style="align-self: center;font-size: 35rpx;color: darkslategray;width: 230rpx;">合格数量:</text>
- <input v-if="!keyFlag" class="uni-input" type="number" style="margin-right: 5px;color: blue;font-size: 40rpx;font-weight: bold;" v-model="checkOkQty" placeholder="请输合格数量" />
- <input v-if="keyFlag" class="uni-input" disabled="true" type="number" style="margin-right: 5px;color: blue;font-size: 40rpx;font-weight: bold;" v-model="checkOkQty" />
- </view>
- <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px;">
- <text style="align-self: center;font-size: 35rpx;color: red;width: 230rpx;">不合格数量:</text>
- <input class="uni-input" type="number" style="margin-right: 5px;color: red;font-size: 40rpx;font-weight: bold;" v-model="checkNgQty" @input="onKeyInput" placeholder="请输不合格数量" />
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- keyFlag: true,
- bnSnCode: '',
- checkOkQty: 0,
- checkNgQty: 0
- }
- },
- onUnload() {
-
- },
- onLoad() {
- if(this.keyFlag) {
- this.checkOkQty = 1
- }
- },
- methods: {
- onKeyInput(event) {
- console.log(this.checkNgQty)
- console.log(event)
- if(this.keyFlag) {
- if(Number(this.checkNgQty) > 1) {
- uni.showToast({
- title: '关键件的不合格数量不能大于1,录入错误!',
- icon: 'none',
- duration: 1000
- })
- return;
- }
- if(Number(this.checkNgQty) == 1) {
- this.checkOkQty = 0
- }
- if(Number(this.checkNgQty) == 0) {
- this.checkOkQty = 1
- }
- }
- }
- }
- }
- </script>
- <style>
- </style>
|