wuxw
2020-01-25 4408eba6e038fa72a11226dd5e53b61d10fa9277
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
(function(vc, vm) {
 
    vc.extends({
        data: {
            editParkingAreaInfo: {
                paId: '',
                num: '',
                typeCd: '',
                remark: '',
 
            }
        },
        _initMethod: function() {
 
},
        _initEvent: function() {
            vc.on('editParkingArea', 'openEditParkingAreaModal',
            function(_params) {
                vc.component.refreshEditParkingAreaInfo();
                $('#editParkingAreaModel').modal('show');
                vc.copyObject(_params, vc.component.editParkingAreaInfo);
                vc.component.editParkingAreaInfo.communityId = vc.getCurrentCommunity().communityId;
            });
        },
        methods: {
            editParkingAreaValidate: function() {
                return vc.validate.validate({
                    editParkingAreaInfo: vc.component.editParkingAreaInfo
                },
                {
                    'editParkingAreaInfo.num': [{
                        limit: "required",
                        param: "",
                        errInfo: "停车场编号不能为空"
                    },
                    {
                        limit: "maxin",
                        param: "1,12",
                        errInfo: "停车场编号不能超过12位"
                    },
                    ],
                    'editParkingAreaInfo.typeCd': [{
                        limit: "required",
                        param: "",
                        errInfo: "停车场类型不能为空"
                    },
                    {
                        limit: "num",
                        param: "",
                        errInfo: "停车场类型格式错误"
                    },
                    ],
                    'editParkingAreaInfo.remark': [
                    {
                        limit: "maxLength",
                        param: "4000",
                        errInfo: "备注太长"
                    },
                    ],
                    'editParkingAreaInfo.paId': [{
                        limit: "required",
                        param: "",
                        errInfo: "停车场ID不能为空"
                    }]
 
                });
            },
            editParkingArea: function() {
                vc.component.editParkingAreaInfo.communityId = vc.getCurrentCommunity().communityId;
 
                if (!vc.component.editParkingAreaValidate()) {
                    vc.toast(vc.validate.errInfo);
                    return;
                }
 
                vc.http.post('editParkingArea', 'update', JSON.stringify(vc.component.editParkingAreaInfo), {
                    emulateJSON: true
                },
                function(json, res) {
                    //vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
                    if (res.status == 200) {
                        //关闭model
                        $('#editParkingAreaModel').modal('hide');
                        vc.emit('parkingAreaManage', 'listParkingArea', {});
                        return;
                    }
                    vc.message(json);
                },
                function(errInfo, error) {
                    console.log('请求失败处理');
 
                    vc.message(errInfo);
                });
            },
            refreshEditParkingAreaInfo: function() {
                vc.component.editParkingAreaInfo = {
                    paId: '',
                    num: '',
                    typeCd: '',
                    remark: '',
 
                }
            }
        }
    });
 
})(window.vc, window.vc.component);