刘磊
2025-04-19 2f18780a16a68f7fc67dd3bca61b8d0aed7c8e1a
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>
    <div>
        <vol-box v-model="showDetialBox" :lazy="true" :height="350" :width="600" :padding="15" title="料框属性维护">
            <el-form :inline="true" :model="TrayBarcodePropertys" label-width="auto" class="demo-form-inline">
                <el-form-item label="料框属性:">
                    <el-input v-model="TrayBarcodePropertys.TrayBarcodeProperty" placeholder="料框属性" />
                </el-form-item>
                <el-form-item label="托盘容量:">
                    <el-input v-model="TrayBarcodePropertys.Capacity" placeholder="托盘容量" />
                </el-form-item>
                <el-button @click="addProductType" type="primary">添加产品工序</el-button>
                <el-button @click="save" type="success">提交数据</el-button>
                <el-row>
                    <el-col :span="12">
                        <el-form-item label="工序:" v-for="(input, index) in TrayBarcodePropertys.ProcessCodes"
                            :key="index">
                            <el-input v-model="input.ProcessCode" placeholder="工序" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="产品类型:" v-for="(input, index) in TrayBarcodePropertys.ProductTypes"
                            :key="index">
                            <el-input v-model="input.ProductType" placeholder="产品类型" />
                        </el-form-item>
                    </el-col>
                </el-row>
            </el-form>
        </vol-box>
    </div>
</template>
 
<script>
import VolBox from "@/components/basic/VolBox.vue";
import http from "@/../src/api/http.js";
export default {
    components: { VolBox },
    data() {
        return {
            showDetialBox: false,
            TrayBarcodePropertys: {
                TrayBarcodeProperty: '',
                Capacity: 0,
                ProcessCodes: [{ ProcessCode: '', }],
                ProductTypes: [{ ProductType: '', }]
            }
        }
    },
    methods: {
        addProductType() {
            this.TrayBarcodePropertys.ProductTypes.push({ ProductType: '' })
            this.TrayBarcodePropertys.ProcessCodes.push({ ProcessCode: '' })
        },
        open() {
            this.showDetialBox = true
        },
        save() {
            console.log(this.TrayBarcodePropertys)
            let data = ({...this.TrayBarcodePropertys, ProcessCodes:JSON.stringify(this.TrayBarcodePropertys.ProcessCodes) , ProductTypes:JSON.stringify(this.TrayBarcodePropertys.ProductTypes)});
            
            debugger;
            http.post('api/Production/AddData', data).then(res => {
                if (res.code == 200) {
                    // ElMessage.success(res.msg)
                    this.$message.success('添加成功')
                    this.$parent.load();
                } else {
                    // ElMessage.error(res.msg)
                    this.$message.error(x.message)
                }
            })
        }
    }
}
</script>
 
<style lang="scss" scoped></style>