username@email.com
2021-06-03 904fb460b9359fe92e00ce25804d96c8a52bb513
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
 
 
//获取href里面的参数
function getUrlParam(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
    var r = window.location.search.substr(1).match(reg); //匹配目标参数
    if (r != null) return unescape(r[2]); return null; //返回参数值
}
var GetMoney = function () {
    var nmaterialMoney = $.trim($('#plc_quality_accident_list_materialMoney').val());
    nmaterialMoney = nmaterialMoney == '' ? 0 : parseFloat(nmaterialMoney);
    var labourMoney = $.trim($('#plc_quality_accident_list_labourMoney').val());
    labourMoney = labourMoney == '' ? 0 : parseFloat(labourMoney);
    var otherMoney = $.trim($('#plc_quality_accident_list_otherMoney').val());
    otherMoney = otherMoney == '' ? 0 : parseFloat(otherMoney);
    var totalMoney = (parseFloat(nmaterialMoney) + parseFloat(labourMoney) + parseFloat(otherMoney)).toFixed(0);
    $('#plc_quality_accident_list_totalMoney').val(totalMoney);
}
 
 
//选择计算金额
$(document).on('change', $('#plc_quality_accident_list_materialMoney,#plc_quality_accident_list_labourMoney,#plc_quality_accident_list_otherMoney'), function (i, r) {
    GetMoney();
});
 
initData = function () {
    var accidentid = getUrlParam('accidentid');
    if (window.flowid == "74370845834942BC8481AA1100DB8237") {
        if (window.sysid === '') {
            $.ajax({
                url: "/PLC_quality_accident_list/GetNum",
                async: false,
                cache: false,
                dataType: "json",
                success: function (resp) {
                    $("#plc_quality_accident_list_code").val(resp);
                }
            });
        } else {
            var dataaddTime = $("#plc_quality_accident_list_addTime").val();
            if (dataaddTime != '') {
                var date = new Date(parseInt(dataaddTime.replace("/Date(", "").replace(")/", ""), 10));
                var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
                var currentDate = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
                var dataStr = date.getFullYear() + "-" + month + "-" + currentDate;
                $("#plc_quality_accident_list_addTime").val(dataStr);
            }
        }
    } else if (window.flowid == "3A2B9AC4D9294D36AC8FAA5400FDF2E6") {
        inputs = '<input type="hidden" id="plc_quality_accident_list_id" name="plc_quality_accident_list.id" field="id" value="' + (sysid == '' ? 0 : initItems.id) + '">';
        $('#plc_quality_accident_list_code').after(inputs);
        if (window.sysid === '') {
            
            $.ajax({
                url: "/PLC_quality_accident_list/Get",
                async: false,
                cache: false,
                dataType: "json",
                data: { sysid: accidentid },
                success: function (resp) {
                    if (resp) {
                        $("#plc_quality_accident_list_id").val(resp.id);
                        $("#plc_quality_accident_list_code").val(resp.code+"-2");
                        $("#plc_quality_accident_list_project_id").val(resp.project_id);
                        $("#plc_quality_accident_list_project_id").trigger("chosen:updated");
                        $("#plc_quality_accident_list_addTime").val(resp.addTime);
                        var Listlevel = $("input[name='plc_quality_accident_list.accident_level']");
                        for (var i = 0; i < Listlevel.length; i++) {
                            if (Listlevel[i].getAttribute("value") ==resp.accident_level) {
                                Listlevel[i].setAttribute("checked", "checked");
                            }
                        }
                        var piletype = $("input[name='plc_quality_accident_list.pileType']");
                        var pile = resp.pileType.split(',');
                        for (var i = 0; i < piletype.length;i++) {
                            for (var j = 0; j < pile.length; j++) {
                                if (piletype[i].getAttribute("value") == pile[j]) {
                                    piletype[i].setAttribute("checked","ckecked");
                                }
 
                            }
                        }
                        var accident_types = $("input[name='plc_quality_accident_list.accident_types']");
                        var accident = resp.accident_types.split(',');
                        for (var i = 0; i < accident_types.length; i++) {
                            for (var j = 0; j < accident.length; j++) {
                                if (accident_types[i].getAttribute("value") == accident[j]) {
                                    accident_types[i].setAttribute("checked", "ckecked");
                                }
 
                            }
                        }
                        $("#plc_quality_accident_list_occurs").html(resp.occurs);
                        $("#plc_quality_accident_list_quality_engineer").val(resp.quality_engineer);
                        $("#plc_quality_accident_list_projectmangmenter").val(resp.projectmangmenter);
                    }
                }
            });
        } else {
            var name = $("#plc_quality_accident_list_code").val();
            $("#plc_quality_accident_list_code").val(name + "-2");
        }
        var dataaddTime = $("#plc_quality_accident_list_addTime").val();
        if (dataaddTime != '') {
            var date = new Date(parseInt(dataaddTime.replace("/Date(", "").replace(")/", ""), 10));
            var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
            var currentDate = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
            var dataStr = date.getFullYear() + "-" + month + "-" + currentDate;
            $("#plc_quality_accident_list_addTime").val(dataStr);
        }
    } else if (window.flowid =="11F293E61FE5444BB7BCAA540102DB9D") {
        inputs = '<input type="hidden" id="plc_quality_accident_list_id" name="plc_quality_accident_list.id" field="id" value="' + (sysid == '' ? 0 : initItems.id) + '">';
        $('#plc_quality_accident_list_code').after(inputs);
        if (window.sysid === '') {
            $.ajax({
                url: "/PLC_quality_accident_list/Get",
                async: false,
                cache: false,
                dataType: "json",
                data: { sysid: accidentid },
                success: function (resp) {
                    if (resp) {
                        $("#plc_quality_accident_list_id").val(resp.id);
                        $("#plc_quality_accident_list_code").val(resp.code + "-3");
                        $("#plc_quality_accident_list_project_id").val(resp.project_id);
                        $("#plc_quality_accident_list_project_id").trigger("chosen:updated");
                        $("#plc_quality_accident_list_addTime").val(resp.addTime);
                        var Listlevel = $("input[name='plc_quality_accident_list.accident_level']");
                        for (var i = 0; i < Listlevel.length; i++) {
                            if (Listlevel[i].getAttribute("value") == resp.accident_level) {
                                Listlevel[i].setAttribute("checked", "checked");
                            }
                        }
                        var piletype = $("input[name='plc_quality_accident_list.pileType']");
                        var pile = resp.pileType.split(',');
                        for (var i = 0; i < piletype.length; i++) {
                            for (var j = 0; j < pile.length; j++) {
                                if (piletype[i].getAttribute("value") == pile[j]) {
                                    piletype[i].setAttribute("checked", "ckecked");
                                }
 
                            }
                        }
                        var accident_types = $("input[name='plc_quality_accident_list.accident_types']");
                        var accident = resp.accident_types.split(',');
                        for (var i = 0; i < accident_types.length; i++) {
                            for (var j = 0; j < accident.length; j++) {
                                if (accident_types[i].getAttribute("value") == accident[j]) {
                                    accident_types[i].setAttribute("checked", "ckecked");
                                }
 
                            }
                        }
                        $("#plc_quality_accident_list_occurs").html(resp.occurs);
                        $("#plc_quality_accident_list_quality_engineer").val(resp.quality_engineer);
                        $("#plc_quality_accident_list_projectmangmenter").val(resp.projectmangmenter);
                        $("#plc_quality_accident_list_reason").html(resp.reason);
                        $("#plc_quality_accident_list_Responsibility").html(resp.Responsibility);
                    }
                }
            });
        } else {
            var name = $("#plc_quality_accident_list_code").val();
            $("#plc_quality_accident_list_code").val(name + "-3");
        }
        var dataaddTime = $("#plc_quality_accident_list_addTime").val();
        if (dataaddTime != '') {
            var date = new Date(parseInt(dataaddTime.replace("/Date(", "").replace(")/", ""), 10));
            var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
            var currentDate = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
            var dataStr = date.getFullYear() + "-" + month + "-" + currentDate;
            $("#plc_quality_accident_list_addTime").val(dataStr);
        }
    }
    $('#plc_quality_accident_list_totalMoney').attr('disabled', 'disabled');
}