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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
| <template>
| <a-modal
| :title="title"
| width="600px"
| :visible="visible"
| dialogClass="zero-modal"
| @cancel="handleCancel">
| <a-spin :spinning="confirmLoading">
| <div class="bind-entrance2-edit-modal-content">
| <a-form :form="form" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
| <a-form-item label="批次">
| <a-input placeholder="请输入批次" allow-clear v-decorator="['materialbatch',{rules:[{required:true,message:'批次不可为空!'}]}]" />
| </a-form-item>
| <a-form-item label="供应商">
| <a-input placeholder="请输入供应商" allow-clear v-decorator="['b',{rules:[]}]" />
| </a-form-item>
|
| <a-row :gutter="16">
| <a-col :span="8">
| <a-form-item label="长">
| <a-input-number placeholder="请输入长" allow-clear style="width: 100%" v-decorator="['materiallength',{rules:[{required:true,message:'长不可为空!'},{ validator: numberValidate }]}]" :min="0" />
| </a-form-item>
| </a-col>
| <a-col :span="8">
| <a-form-item label="宽">
| <a-input-number placeholder="请输入宽" allow-clear style="width: 100%" v-decorator="['materialwidth',{rules:[{required:true,message:'宽不可为空!'},{ validator: numberValidate }]}]" :min="0" />
| </a-form-item>
| </a-col>
| <a-col :span="8">
| <a-form-item label="高">
| <a-input-number placeholder="请输入高" allow-clear style="width: 100%" v-decorator="['materialhigh',{rules:[{required:true,message:'高不可为空!'},{ validator: numberValidate }]}]" :min="0" />
| </a-form-item>
| </a-col>
| </a-row>
|
| <a-form-item label="数量">
| <a-input-number placeholder="请输入数量" allow-clear style="width: 100%" v-decorator="['bindquantity',{rules:[{required:true,message:'数量不可为空!'},{ validator: interalNumberValidate }]}]" :min="0" />
| </a-form-item>
|
| </a-form>
| </div>
| </a-spin>
|
| <template slot="footer">
| <a-button key="back" @click="handleCancel">取消</a-button>
| <a-button key="submit" type="primary" :loading="confirmLoading" @click="handleSubmit">确认</a-button>
| </template>
| </a-modal>
| </template>
|
| <script>
| const defaultForm = {
| materialbatch:'',
| b:'',
| bindquantity:null
| }
| export default {
| emits:['callback'],
| data () {
| return {
| labelCol: {
| span:24
| },
| wrapperCol: {
| span:24
| },
| visible: false,
| confirmLoading: false,
| title:'新增胶合板',
| form: this.$form.createForm(this)
| }
| },
| methods: {
| // 初始化方法
| init () {
| let _initForm = {...defaultForm}
| this.visible = true
| this.$nextTick(()=>{
| this.form.setFieldsValue(_initForm)
| })
| },
| interalNumberValidate(rule, value, callback){
| if (value<=0){
| callback('必须大于0');
| } else if (Number(value)!==parseInt(value)) {
| callback('只能是整数');
| } else {
| callback();
| }
| },
| numberValidate(rule, value, callback){
| if (value<=0){
| callback('必须大于0');
| } else {
| callback();
| }
| },
| handleSubmit () {
| this.form.validateFields((errors, values) => {
| if (!errors) {
| this.handleCancel()
| this.$emit('callback',values)
| }
| })
| },
| handleCancel () {
| this.visible = false
| }
| }
| }
| </script>
| <style lang="less" scoped>
| .bind-entrance2-edit-modal-content{
| padding: 20px 16px 0 16px;
| }
| </style>
|
|