wuxw
2019-11-21 59ce81c19b75e3e6cdc6a3a65d49ec11e27b0a06
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
(function (vc) {
 
    vc.extends({
        propTypes: {
            callBackListener: vc.propTypes.string, //父组件名称
            callBackFunction: vc.propTypes.string //父组件监听方法
        },
        data: {
            auditInfo: {
                state: '',
                remark: ''
            }
        },
        watch: {
            "auditInfo.state": {//深度监听,可监听到对象、数组的变化
                handler(val, oldVal) {
                    if (vc.notNull(val) && vc.component.auditInfo.state == '1100') {
                        vc.component.auditInfo.remark = "同意";
                    } else {
                        vc.component.auditInfo.remark = "";
                    }
 
                },
                deep: true
            }
        },
        _initMethod: function () {
 
        },
        _initEvent: function () {
            vc.on('audit', 'openAuditModal', function () {
                $('#auditModel').modal('show');
            });
        },
        methods: {
            auditValidate() {
                return vc.validate.validate({
                    auditInfo: vc.component.auditInfo
                }, {
                    'auditInfo.state': [
                        {
                            limit: "required",
                            param: "",
                            errInfo: "审核状态不能为空"
                        },
                        {
                            limit: "num",
                            param: "",
                            errInfo: "审核状态错误"
                        },
                    ],
                    'auditInfo.remark': [
                        {
                            limit: "required",
                            param: "",
                            errInfo: "原因内容不能为空"
                        },
                        {
                            limit: "maxLength",
                            param: "200",
                            errInfo: "原因内容不能超过200"
                        },
                    ]
                });
            },
            _auditSubmit: function () {
                if (!vc.component.auditValidate()) {
                    vc.message(vc.validate.errInfo);
                    return;
                }
                //不提交数据将数据 回调给侦听处理
                if (vc.notNull($props.callBackListener)) {
                    vc.emit($props.callBackListener, $props.callBackFunction, vc.component.auditInfo);
                    $('#auditModel').modal('hide');
 
                    vc.component.clearAddBasePrivilegeInfo();
                    return;
                }
 
 
            },
            clearAddBasePrivilegeInfo: function () {
                vc.component.auditInfo = {
                    state: '',
                    remark: ''
                }
            }
        }
    });
 
})(window.vc);