allocationNumDialog.vue
1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<!-- 盘点 -->
<template>
<GLDialog title="调拨" :visible.sync="allocationNumVisible" class="allocationNumDailog" okText="确定" @onCancel="handleClose" @onOk="handleAddConfirm">
<div class="gl-form-page gl-form-min">
<el-form ref="allocationNumForm" size="small" :model="infoForm" :rules="formRules" label-width="154px">
<el-form-item label="调拨数量:" prop="allocationNum">
<el-input placeholder="请输入调拨数量" v-model="infoForm.allocationNum" clearable @input="handleUpgradeNum"></el-input>
</el-form-item>
</el-form>
</div>
</GLDialog>
</template>
<script>
import { limitPrice } from '@/common/format'
export default {
name: 'AllocationNumDialog',
data() {
return {
infoForm: {
allocationNum: ''
},
oldVal: {
allocationNum: ''
},
formRules: {
allocationNum: [{ required: true, message: '请输入调拨数量', trigger: 'change' }]
},
selectLoading: false
}
},
props: {
allocationNumVisible: {
type: Boolean,
default: false
},
allocationInfo: {
type: Object,
default: () => {}
}
},
watch: {},
created() {},
components: {},
computed: {},
mounted() {},
methods: {
handleUpgradeNum(newVal) {
this.infoForm.allocationNum = limitPrice(newVal, this.oldVal.allocationNum, 8, 2, 0, this.allocationInfo.stock)
this.oldVal.allocationNum = this.infoForm.allocationNum
},
handleAddConfirm() {
this.$refs.allocationNumForm.validate(valid => {
if (valid) {
this.allocationInfo.allocateNumber = parseFloat(this.infoForm.allocationNum)
this.handleClose(this.allocationInfo)
}
})
},
handleClose(info) {
this.$emit('dialogClose', info)
}
}
}
</script>
<style >
</style>