wuxw
2020-03-02 40b770f61d5a09f4754512b961756bd934696e3c
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
(function(vc, vm) {
 
    vc.extends({
        data: {
            editInspectionRouteInfo: {
                inspectionRouteId: '',
                routeName: '',
                seq: '',
                remark: '',
 
            }
        },
        _initMethod: function() {
 
},
        _initEvent: function() {
            vc.on('editInspectionRoute', 'openEditInspectionRouteModal',
            function(_params) {
                vc.component.refreshEditInspectionRouteInfo();
                $('#editInspectionRouteModel').modal('show');
                vc.copyObject(_params, vc.component.editInspectionRouteInfo);
                vc.component.editInspectionRouteInfo.communityId = vc.getCurrentCommunity().communityId;
            });
        },
        methods: {
            editInspectionRouteValidate: function() {
                return vc.validate.validate({
                    editInspectionRouteInfo: vc.component.editInspectionRouteInfo
                },
                {
                    'editInspectionRouteInfo.routeName': [{
                        limit: "required",
                        param: "",
                        errInfo: "路线名称不能为空"
                    },
                    {
                        limit: "maxin",
                        param: "1,100",
                        errInfo: "路线名称字数不能超过100个"
                    },
                    ],
                    'editInspectionRouteInfo.seq': [{
                        limit: "required",
                        param: "",
                        errInfo: "顺序不能为空"
                    },
                    {
                        limit: "num",
                        param: "",
                        errInfo: "顺序必须是数字"
                    },
                    ],
                    'editInspectionRouteInfo.remark': [{
                        limit: "maxin",
                        param: "0,200",
                        errInfo: "备注不能超过200位"
                    },
                    ],
                    'editInspectionRouteInfo.inspectionRouteId': [{
                        limit: "required",
                        param: "",
                        errInfo: "路线ID不能为空"
                    }]
 
                });
            },
            editInspectionRoute: function() {
                if (!vc.component.editInspectionRouteValidate()) {
                    vc.toast(vc.validate.errInfo);
                    return;
                }
 
                vc.http.post('editInspectionRoute', 'update', JSON.stringify(vc.component.editInspectionRouteInfo), {
                    emulateJSON: true
                },
                function(json, res) {
                    //vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
                    if (res.status == 200) {
                        //关闭model
                        $('#editInspectionRouteModel').modal('hide');
                        vc.emit('inspectionRouteManage', 'listInspectionRoute', {});
                        return;
                    }
                    vc.message(json);
                },
                function(errInfo, error) {
                    console.log('请求失败处理');
 
                    vc.message(errInfo);
                });
            },
            refreshEditInspectionRouteInfo: function() {
                vc.component.editInspectionRouteInfo = {
                    inspectionRouteId: '',
                    routeName: '',
                    seq: '',
                    remark: '',
                }
            }
        }
    });
 
})(window.vc, window.vc.component);